UNPKG

@mitcsutt/kiln-forms

Version:

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

46 lines (45 loc) • 1.71 kB
import { formContext as e } from "../../../kit/contexts.js"; import { FieldPresentation as t } from "../../fields/FieldPresentation/FieldPresentation.js"; import { defaultMessages as n } from "../../../runtime/messages.js"; import { getFormRuntime as r } from "../../../runtime/formRuntime.js"; import { FieldViewListBoundary as i } from "../../fields/FieldView/FieldView.js"; import { useOptionalFormSteps as a } from "../FormSteps/useFormSteps.js"; import { useContext as o, useId as s } from "react"; import { jsx as c, jsxs as l } from "react/jsx-runtime"; import { Button as u, Heading as d, Inline as f, Stack as p } from "@mitcsutt/kiln-ui"; //#region src/components/layouts/FormReview/FormReview.tsx function m({ title: i, headingLevel: m = 3, step: h, onEdit: g, editLabel: _, viewLines: v, children: y }) { let b = a(), x = o(e), S = x ? r(x).options.messages : n, C = s(), w = h === void 0 ? void 0 : g ? () => { g(h); } : b ? () => void b.goTo(h) : void 0, T = w ? /* @__PURE__ */ c(u, { variant: "ghost", tone: "neutral", size: "sm", "aria-describedby": i == null ? void 0 : C, onClick: w, children: _ ?? S.edit }) : null; return /* @__PURE__ */ c(t, { mode: "view", viewLines: v, children: /* @__PURE__ */ l(p, { gap: 3, children: [i != null || T ? /* @__PURE__ */ l(f, { justify: i == null ? "end" : "between", align: "center", gap: 3, children: [i == null ? null : /* @__PURE__ */ c(d, { level: m, id: C, children: i }), T] }) : null, y] }) }); } function h(e) { return /* @__PURE__ */ c(i, { children: /* @__PURE__ */ c(m, { ...e }) }); } //#endregion export { h as FormReview }; //# sourceMappingURL=FormReview.js.map