import { jsx as r, jsxs as t } from "react/jsx-runtime";
import { useCallback as p } from "react";
import { shippingProviderOptions as h } from "../schemas.js";
import f from "../../../hooks/useStepperState.js";
import g from "../../../hooks/useStepperHandlers.js";
import u from "../../../../form/hooks/useZodForm.js";
import S from "../../../hooks/useStepperBeforeNavigate.js";
import v from "../../../../form/Form.js";
import x from "../../../../box/Box.js";
import a from "../../../../field/Field.js";
import C from "../../../../field/components/field-label/FieldLabel.js";
import n from "../../../../field/components/field-control/FieldControl.js";
import V from "../../../../select/Select.js";
import F from "../../../../field/components/field-description/FieldDescription.js";
import P from "../../../../checkbox/Checkbox.js";
const T = ({ id: D }) => {
  const { currentStep: o } = f(), { setStepData: s } = g(), { schema: m, defaultValues: l } = o.initialData, e = u({ schema: m, defaultValues: o.storedData ?? l });
  S(async (i) => {
    if (i.type === "next" && !await e.trigger()) return !1;
    s("shipping", e.getValues());
  });
  const c = p(
    (i) => {
      e.setValue("acceptShippingTerms", i, { shouldValidate: !0 });
    },
    [e]
  ), d = p(
    (i) => {
      e.setValue("shippingProvider", i);
    },
    [e]
  );
  return /* @__PURE__ */ r(v, { form: e, onSubmit: () => {
  }, noValidate: !0, children: /* @__PURE__ */ t(x, { className: "flex flex-col gap-[var(--spacing-6)]", children: [
    /* @__PURE__ */ t(a, { name: "shippingProvider", children: [
      /* @__PURE__ */ r(C, { children: "Shipping Provider" }),
      /* @__PURE__ */ r(n, { children: /* @__PURE__ */ r(V, { options: h, placeholder: "DHL", value: e.watch("shippingProvider"), onChange: d }) }),
      /* @__PURE__ */ r(F, { children: "More shipping providers coming soon." })
    ] }),
    /* @__PURE__ */ r(a, { name: "acceptShippingTerms", children: /* @__PURE__ */ r(n, { children: /* @__PURE__ */ r(P, { value: e.watch("acceptShippingTerms"), onChange: c, children: "I accept the JTL Shipping Terms and confirm that I have read and understood them." }) }) })
  ] }) });
};
T.displayName = "ShippingStep";
export {
  T as default
};
//# sourceMappingURL=ShippingStep.js.map
