shadcn-zod-formkit 1.13.0 → 1.14.0
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 +32 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +32 -11
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-1.14.0.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-1.13.0.tgz +0 -0
package/dist/index.cjs
CHANGED
|
@@ -196,11 +196,10 @@ var validationMessages = {
|
|
|
196
196
|
|
|
197
197
|
// src/components/custom/form/inputs/base/base-input.ts
|
|
198
198
|
var BaseInput = class {
|
|
199
|
-
constructor(input, form, isSubmitting
|
|
199
|
+
constructor(input, form, isSubmitting) {
|
|
200
200
|
this.input = input;
|
|
201
201
|
this.form = form;
|
|
202
202
|
this.isSubmitting = isSubmitting;
|
|
203
|
-
this.children = children;
|
|
204
203
|
}
|
|
205
204
|
};
|
|
206
205
|
var entityToInputOption = (entitiy, name = "name", description = "description", groupedLabel) => ({
|
|
@@ -5403,6 +5402,7 @@ var getFieldLabel = (fieldErrorKey, fields) => {
|
|
|
5403
5402
|
const foundField = fields.find((field) => field.name === fieldErrorKey);
|
|
5404
5403
|
return foundField?.label ?? fieldErrorKey;
|
|
5405
5404
|
};
|
|
5405
|
+
var isRenderableChild = (c) => c !== void 0 && c !== null && typeof c !== "function";
|
|
5406
5406
|
var FormFieldsGrid = ({
|
|
5407
5407
|
fields,
|
|
5408
5408
|
form,
|
|
@@ -5412,23 +5412,44 @@ var FormFieldsGrid = ({
|
|
|
5412
5412
|
gap = "gap-2"
|
|
5413
5413
|
}) => {
|
|
5414
5414
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `w-full grid grid-cols-1 ${gap} ${className}`, children: fields.map(
|
|
5415
|
-
(
|
|
5416
|
-
"
|
|
5415
|
+
(inputOrGroup, idx) => Array.isArray(inputOrGroup) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5416
|
+
"div",
|
|
5417
5417
|
{
|
|
5418
|
-
className: "w-full flex flex-row
|
|
5419
|
-
children:
|
|
5420
|
-
|
|
5421
|
-
|
|
5418
|
+
className: "w-full flex flex-row items-start gap-4 py-3",
|
|
5419
|
+
children: inputOrGroup.map((field, subIdx) => {
|
|
5420
|
+
const fieldCopy = {
|
|
5421
|
+
...field,
|
|
5422
|
+
disabled: readOnly ? true : field.disabled
|
|
5423
|
+
};
|
|
5424
|
+
const renderInlineChild = fieldCopy.childrenPosition !== "down" && isRenderableChild(fieldCopy.children);
|
|
5425
|
+
const renderInlineChildDown = fieldCopy.childrenPosition === "down" && isRenderableChild(fieldCopy.children);
|
|
5426
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full px-2", children: [
|
|
5427
|
+
renderInlineChild && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fieldCopy.children }),
|
|
5428
|
+
InputFactory.create(fieldCopy, form, isPending),
|
|
5429
|
+
renderInlineChildDown && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fieldCopy.children })
|
|
5430
|
+
] }, `field-${idx}-${subIdx}`);
|
|
5422
5431
|
})
|
|
5423
5432
|
},
|
|
5424
5433
|
`field-group-${idx}`
|
|
5425
5434
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5426
|
-
"
|
|
5435
|
+
"div",
|
|
5427
5436
|
{
|
|
5428
5437
|
className: "flex flex-col justify-between py-3 w-full px-2",
|
|
5429
|
-
children:
|
|
5438
|
+
children: (() => {
|
|
5439
|
+
const fieldCopy = {
|
|
5440
|
+
...inputOrGroup,
|
|
5441
|
+
disabled: readOnly ? true : inputOrGroup.disabled
|
|
5442
|
+
};
|
|
5443
|
+
const renderUp = fieldCopy.childrenPosition !== "down" && isRenderableChild(fieldCopy.children);
|
|
5444
|
+
const renderDown = fieldCopy.childrenPosition === "down" && isRenderableChild(fieldCopy.children);
|
|
5445
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5446
|
+
renderUp && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fieldCopy.children }),
|
|
5447
|
+
InputFactory.create(fieldCopy, form, isPending),
|
|
5448
|
+
renderDown && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fieldCopy.children })
|
|
5449
|
+
] });
|
|
5450
|
+
})()
|
|
5430
5451
|
},
|
|
5431
|
-
`field-
|
|
5452
|
+
`field-single-${idx}`
|
|
5432
5453
|
)
|
|
5433
5454
|
) });
|
|
5434
5455
|
};
|