UNPKG

@mitcsutt/kiln-forms

Version:

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

53 lines (52 loc) • 1.5 kB
import { FieldPresentation as e } from "../../fields/FieldPresentation/FieldPresentation.js"; import { FieldViewListBoundary as t } from "../../fields/FieldView/FieldView.js"; import { useId as n } from "react"; import { jsx as r, jsxs as i } from "react/jsx-runtime"; import { Fieldset as a, Heading as o, Stack as s, Text as c, VisuallyHidden as l } from "@mitcsutt/kiln-ui"; //#region src/components/layouts/FormSection/FormSection.tsx function u({ title: t, description: u, titleHidden: d = !1, as: f = "fieldset", headingLevel: p = 3, disabled: m, readOnly: h, gap: g = 5, children: _ }) { let v = n(), y = /* @__PURE__ */ r(e, { disabled: m, readOnly: h, children: /* @__PURE__ */ r(s, { gap: g, children: _ }) }); if (f === "section") { let e = /* @__PURE__ */ r(o, { level: p, id: v, children: t }); return /* @__PURE__ */ i(s, { as: "section", gap: g, "aria-labelledby": v, children: [d || u != null ? /* @__PURE__ */ i(s, { gap: 2, children: [d ? /* @__PURE__ */ r(l, { as: "div", children: e }) : e, u == null ? null : /* @__PURE__ */ r(c, { tone: "muted", children: u })] }) : e, y] }); } return /* @__PURE__ */ r(a, { variant: "section", legend: t, legendHidden: d, description: u, disabled: m, children: y }); } function d(e) { return /* @__PURE__ */ r(t, { children: /* @__PURE__ */ r(u, { ...e }) }); } //#endregion export { d as FormSection }; //# sourceMappingURL=FormSection.js.map