shadcn-zod-formkit 1.22.0 → 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.0.tgz +0 -0
package/dist/index.cjs
CHANGED
|
@@ -5602,33 +5602,34 @@ var FormFieldsGrid = ({
|
|
|
5602
5602
|
const fieldCopy = { ...field, disabled: readOnly ? true : field.disabled };
|
|
5603
5603
|
const renderUp = fieldCopy.childrenPosition !== "down" && isRenderableChild(fieldCopy.children);
|
|
5604
5604
|
const renderDown = fieldCopy.childrenPosition === "down" && isRenderableChild(fieldCopy.children);
|
|
5605
|
-
const dirClass = fieldCopy.direction === "row" ? "flex flex-col sm:flex-row sm:items-center sm:gap-4
|
|
5605
|
+
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";
|
|
5606
5606
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: dirClass, children: [
|
|
5607
5607
|
renderUp && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fieldCopy.children }),
|
|
5608
5608
|
InputFactory.create(fieldCopy, form, isPending),
|
|
5609
5609
|
renderDown && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fieldCopy.children })
|
|
5610
5610
|
] });
|
|
5611
5611
|
};
|
|
5612
|
-
const renderColumn = (col) => {
|
|
5612
|
+
const renderColumn = (col, parentKey = "") => {
|
|
5613
5613
|
if (col.length === 0) return null;
|
|
5614
|
-
const colDirection = isFieldProps(col[0]) && col[0].direction === "row" ? "flex flex-col sm:flex-row sm:items-center sm:gap-4
|
|
5614
|
+
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";
|
|
5615
5615
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: colDirection, children: col.map((item, idx) => {
|
|
5616
|
-
if (isFieldProps(item))
|
|
5617
|
-
|
|
5616
|
+
if (isFieldProps(item))
|
|
5617
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-[200px]", children: renderField(item) }, `${parentKey}${item.name.toString()}-${idx}`);
|
|
5618
|
+
if (Array.isArray(item)) return renderColumn(item, `${parentKey}col${idx}-`);
|
|
5618
5619
|
return null;
|
|
5619
5620
|
}) });
|
|
5620
5621
|
};
|
|
5621
|
-
const renderRow = (row) => {
|
|
5622
|
+
const renderRow = (row, parentKey = "") => {
|
|
5622
5623
|
if (row.length === 0) return null;
|
|
5623
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex flex-col sm:flex-row sm:gap-4 py-2 flex-wrap", children: row.map((col, idx) => {
|
|
5624
|
-
if (isFieldProps(col)) return renderColumn([col]);
|
|
5625
|
-
if (Array.isArray(col)) return renderColumn(col);
|
|
5624
|
+
return /* @__PURE__ */ jsxRuntime.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) => {
|
|
5625
|
+
if (isFieldProps(col)) return renderColumn([col], `${parentKey}row${idx}-`);
|
|
5626
|
+
if (Array.isArray(col)) return renderColumn(col, `${parentKey}row${idx}-`);
|
|
5626
5627
|
return null;
|
|
5627
5628
|
}) });
|
|
5628
5629
|
};
|
|
5629
5630
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `w-full flex flex-col ${gap} ${className}`, children: fields.map((f, idx) => {
|
|
5630
|
-
if (isFieldProps(f)) return /* @__PURE__ */ jsxRuntime.jsx("div", { children: renderField(f) }, idx);
|
|
5631
|
-
if (Array.isArray(f)) return /* @__PURE__ */ jsxRuntime.jsx("div", { children: renderRow(f) }, idx);
|
|
5631
|
+
if (isFieldProps(f)) return /* @__PURE__ */ jsxRuntime.jsx("div", { children: renderField(f) }, `field-${f.name.toString()}-${idx}`);
|
|
5632
|
+
if (Array.isArray(f)) return /* @__PURE__ */ jsxRuntime.jsx("div", { children: renderRow(f, `row-${idx}-`) }, `row-${idx}`);
|
|
5632
5633
|
return null;
|
|
5633
5634
|
}) });
|
|
5634
5635
|
};
|