UNPKG

@mitcsutt/kiln-forms

Version:

Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui

36 lines (35 loc) • 1.07 kB
import { FieldView as e } from "../FieldView/FieldView.js"; import { accepts as t } from "../../../kit/accepts.js"; import { useFieldBinding as n } from "../../../hooks/useFieldBinding.js"; import { defineField as r } from "../../../kit/contracts.js"; import { jsx as i } from "react/jsx-runtime"; import { OneTimeCodeField as a } from "@mitcsutt/kiln-ui"; //#region src/components/fields/FormOneTimeCodeField/FormOneTimeCodeField.tsx var o = r()(function({ warn: r, excluded: o, onBlur: s, onComplete: c, submitOnComplete: l, ...u }) { let d = n({ ...u, warn: r, excluded: o, accepts: t.string, empty: "" }); return d.mode === "view" ? /* @__PURE__ */ i(e, { label: u.label, children: d.value || void 0 }) : /* @__PURE__ */ i(a, { ...u, ...d.fieldProps, ref: d.ref, value: d.value ?? "", onValueChange: d.setValue, onComplete: (e) => { c?.(e), l && d.api.form.handleSubmit(); }, onBlur: (e) => { s?.(e), d.onBlur(); } }); }); //#endregion export { o as FormOneTimeCodeField }; //# sourceMappingURL=FormOneTimeCodeField.js.map