react-forminate
Version:
React.js + Typescript package that creates dynamic UI forms based on the JSON schema
36 lines (35 loc) • 898 B
JavaScript
import { j as s, D as c } from "./index-BPZpMa2Y.js";
import f from "react";
const n = ({
fieldId: t,
as: d = "fieldset",
label: i,
fields: a,
className: r = "",
styles: o = {},
legendClassName: m = "",
legendStyles: b = {},
labelClassName: p,
// we must keep it that not to automatically inject it to the HTML as an attribute
labelStyles: j = {},
...l
}) => /* @__PURE__ */ s.jsxs(
d,
{
id: t,
"data-testid": "group-field",
className: r,
style: o,
...typeof l.disabled == "boolean" ? { disabled: l.disabled } : {},
...Object.fromEntries(
Object.entries(l).filter(([e]) => e !== "disabled")
),
children: [
d === "fieldset" && /* @__PURE__ */ s.jsx("legend", { className: m, style: b, children: i }),
a && a.map((e) => /* @__PURE__ */ s.jsx(c, { ...e }, e.fieldId))
]
}
), y = f.memo(n);
export {
y as default
};