/* global React, ReactDOM, MATERIALS, PRINTERS, FINISHING_PRESETS, PLATFORM_PRESETS, CD3D, fmtBRL, fmtNum, fmtPct, cdStorage */
const STEP_useState = React.useState;
const STEP_reverseCalc = window.CD3D.reverseCalc;
const STEPS = [
{ id: 0, label: "Material", short: "MAT" },
{ id: 1, label: "Impressão", short: "PRT" },
{ id: 2, label: "Mão de Obra", short: "LAB" },
{ id: 3, label: "Preço & Venda", short: "PRC" }
];
// ====================== UI Atoms ======================
function Field({ label, hint, children, full, req }) {
return (
{children}
);
}
function NumInput({ value, onChange, min = 0, step = "any", max, suffix, prefix }) {
const wrap = (el) => suffix ? (
{el}{suffix}
) : prefix ? (
{el}{prefix}
) : el;
return wrap(
onChange(e.target.value === "" ? 0 : parseFloat(e.target.value))}
/>
);
}
function TimeInput({ hours, minutes, onHours, onMinutes }) {
return (
);
}
function Switch({ on, onChange }) {
return