shadcn-zod-formkit 1.22.1 → 1.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +12 -11
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-1.22.2.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-1.22.1.tgz +0 -0
package/dist/index.mjs
CHANGED
|
@@ -5564,33 +5564,34 @@ var FormFieldsGrid = ({
|
|
|
5564
5564
|
const fieldCopy = { ...field, disabled: readOnly ? true : field.disabled };
|
|
5565
5565
|
const renderUp = fieldCopy.childrenPosition !== "down" && isRenderableChild(fieldCopy.children);
|
|
5566
5566
|
const renderDown = fieldCopy.childrenPosition === "down" && isRenderableChild(fieldCopy.children);
|
|
5567
|
-
const dirClass = fieldCopy.direction === "row" ? "flex flex-col sm:flex-row sm:items-center sm:gap-x-4 gap-y-2
|
|
5567
|
+
const dirClass = fieldCopy.direction === "row" ? "flex flex-col sm:flex-row sm:items-center sm:gap-x-4 gap-y-2 flex-wrap" : "flex flex-col gap-2";
|
|
5568
5568
|
return /* @__PURE__ */ jsxs("div", { className: dirClass, children: [
|
|
5569
5569
|
renderUp && /* @__PURE__ */ jsx(Fragment, { children: fieldCopy.children }),
|
|
5570
5570
|
InputFactory.create(fieldCopy, form, isPending),
|
|
5571
5571
|
renderDown && /* @__PURE__ */ jsx(Fragment, { children: fieldCopy.children })
|
|
5572
5572
|
] });
|
|
5573
5573
|
};
|
|
5574
|
-
const renderColumn = (col) => {
|
|
5574
|
+
const renderColumn = (col, parentKey = "") => {
|
|
5575
5575
|
if (col.length === 0) return null;
|
|
5576
|
-
const colDirection = isFieldProps(col[0]) && col[0].direction === "row" ? "flex flex-col sm:flex-row sm:items-center sm:gap-x-4 gap-y-2
|
|
5576
|
+
const colDirection = isFieldProps(col[0]) && col[0].direction === "row" ? "flex flex-col sm:flex-row sm:items-center sm:gap-x-4 gap-y-2 flex-wrap" : "flex flex-col w-full";
|
|
5577
5577
|
return /* @__PURE__ */ jsx("div", { className: colDirection, children: col.map((item, idx) => {
|
|
5578
|
-
if (isFieldProps(item))
|
|
5579
|
-
|
|
5578
|
+
if (isFieldProps(item))
|
|
5579
|
+
return /* @__PURE__ */ jsx("div", { className: "flex-1 min-w-[200px]", children: renderField(item) }, `${parentKey}${item.name.toString()}-${idx}`);
|
|
5580
|
+
if (Array.isArray(item)) return renderColumn(item, `${parentKey}col${idx}-`);
|
|
5580
5581
|
return null;
|
|
5581
5582
|
}) });
|
|
5582
5583
|
};
|
|
5583
|
-
const renderRow = (row) => {
|
|
5584
|
+
const renderRow = (row, parentKey = "") => {
|
|
5584
5585
|
if (row.length === 0) return null;
|
|
5585
|
-
return /* @__PURE__ */ jsx("div", { className:
|
|
5586
|
-
if (isFieldProps(col)) return renderColumn([col]);
|
|
5587
|
-
if (Array.isArray(col)) return renderColumn(col);
|
|
5586
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full flex flex-col sm:flex-row sm:gap-x-4 gap-y-2 py-2 flex-wrap gap-4", children: row.map((col, idx) => {
|
|
5587
|
+
if (isFieldProps(col)) return renderColumn([col], `${parentKey}row${idx}-`);
|
|
5588
|
+
if (Array.isArray(col)) return renderColumn(col, `${parentKey}row${idx}-`);
|
|
5588
5589
|
return null;
|
|
5589
5590
|
}) });
|
|
5590
5591
|
};
|
|
5591
5592
|
return /* @__PURE__ */ jsx("div", { className: `w-full flex flex-col ${gap} ${className}`, children: fields.map((f, idx) => {
|
|
5592
|
-
if (isFieldProps(f)) return /* @__PURE__ */ jsx("div", { children: renderField(f) }, idx);
|
|
5593
|
-
if (Array.isArray(f)) return /* @__PURE__ */ jsx("div", { children: renderRow(f) }, idx);
|
|
5593
|
+
if (isFieldProps(f)) return /* @__PURE__ */ jsx("div", { children: renderField(f) }, `field-${f.name.toString()}-${idx}`);
|
|
5594
|
+
if (Array.isArray(f)) return /* @__PURE__ */ jsx("div", { children: renderRow(f, `row-${idx}-`) }, `row-${idx}`);
|
|
5594
5595
|
return null;
|
|
5595
5596
|
}) });
|
|
5596
5597
|
};
|