UNPKG

geoiq-frontend-ui-kit

Version:

This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.

72 lines (71 loc) 1.74 kB
import e, { useState as N } from "react"; import { Button as n } from "./index.es9.js"; import { useFormStructure as k } from "./index.es132.js"; import { useFormValues as C } from "./index.es133.js"; const V = ({ onGoToNextStep: i, onGoToPreviousStep: o, isSubmitting: f, testMode: s = !1 }) => { const { goToNextStep: l, goToPreviousStep: S, isFirstStep: r, isLastStep: a, currentStep: g, currentStepIndex: c, totalSteps: m } = k(), { submitForm: v, validateStep: x, values: u } = C(), { isStepValid: p } = x(g), [y, d] = N(!1), b = async () => { if (!i) { l(); return; } const F = { currentStepIndex: c, totalSteps: m, isFirstStep: r, isLastStep: a, values: u }; try { d(!0); const t = i(F); t && typeof t.then == "function" && await t, l(); } catch { } finally { d(!1); } }, h = () => { o && o({ currentStepIndex: c, totalSteps: m, isFirstStep: r, isLastStep: a, values: u }), S(); }; return /* @__PURE__ */ e.createElement("div", { className: "w-full flex h-[5rem] items-center justify-center gap-3 border-t border-neutral-1 bg-light-2 px-3" }, /* @__PURE__ */ e.createElement(n, { variant: "secondary", onClick: h }, r ? "Cancel" : "Back"), a ? /* @__PURE__ */ e.createElement( n, { variant: "primary", onClick: v, disabled: !(p || s), loading: f }, "Submit" ) : /* @__PURE__ */ e.createElement( n, { variant: "primary", onClick: b, disabled: !(p || s), loading: y }, "Save & Next" )); }; export { V as FormNavigation }; //# sourceMappingURL=index.es108.js.map