shadcn-zod-formkit 1.18.0 → 1.18.1
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 +30 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +30 -20
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-1.18.1.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-1.18.0.tgz +0 -0
package/dist/index.cjs
CHANGED
|
@@ -5629,7 +5629,6 @@ var DynamicForm = ({
|
|
|
5629
5629
|
withErrorsAlert = true,
|
|
5630
5630
|
errorAlertPosition = "up",
|
|
5631
5631
|
withCard = false,
|
|
5632
|
-
// btnType = 'submit',
|
|
5633
5632
|
submitBtnClass = "",
|
|
5634
5633
|
submitBtnLabel = "Guardar"
|
|
5635
5634
|
}) => {
|
|
@@ -5646,24 +5645,25 @@ var DynamicForm = ({
|
|
|
5646
5645
|
}, [initialValues, form]);
|
|
5647
5646
|
const handleSubmit = (data) => {
|
|
5648
5647
|
if (readOnly) return;
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5648
|
+
startTransition(() => {
|
|
5649
|
+
const resp = { data, form };
|
|
5650
|
+
onSubmit?.(resp);
|
|
5651
|
+
});
|
|
5652
|
+
};
|
|
5653
|
+
const handleClick = async () => {
|
|
5654
|
+
if (!onClick) return;
|
|
5655
|
+
const isValid2 = await form.trigger();
|
|
5656
|
+
if (!isValid2) return;
|
|
5657
|
+
const data = form.getValues();
|
|
5658
|
+
const resp = { data, form };
|
|
5659
|
+
onClick(resp);
|
|
5657
5660
|
};
|
|
5658
5661
|
const formContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
5659
5662
|
showFormHeader && /* @__PURE__ */ jsxRuntime.jsxs(CardTitle, { className: "flex flex-row items-center gap-2 p-2 border-b", children: [
|
|
5660
5663
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-2 w-full", children: [
|
|
5661
5664
|
showIcon && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-5 w-5" }),
|
|
5662
5665
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
5663
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5664
|
-
formTitle,
|
|
5665
|
-
" "
|
|
5666
|
-
] }),
|
|
5666
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xl", children: formTitle }),
|
|
5667
5667
|
formSubTitle && /* @__PURE__ */ jsxRuntime.jsx(CardDescription, { children: formSubTitle })
|
|
5668
5668
|
] })
|
|
5669
5669
|
] }),
|
|
@@ -5680,13 +5680,23 @@ var DynamicForm = ({
|
|
|
5680
5680
|
/* @__PURE__ */ jsxRuntime.jsx(FormFieldsGrid, { fields, form, readOnly }),
|
|
5681
5681
|
children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row items-center gap-2 w-full h-full", children })
|
|
5682
5682
|
] }),
|
|
5683
|
-
!readOnly && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-2 justify-end items-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5683
|
+
!readOnly && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-2 justify-end items-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5684
|
+
Button,
|
|
5685
|
+
{
|
|
5686
|
+
type: onClick ? "button" : "submit",
|
|
5687
|
+
size: "lg",
|
|
5688
|
+
className: submitBtnClass,
|
|
5689
|
+
disabled: isPending,
|
|
5690
|
+
onClick: onClick ? handleClick : void 0,
|
|
5691
|
+
children: isPending ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5692
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
5693
|
+
"Guardando..."
|
|
5694
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5695
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "h-4 w-4 mr-2" }),
|
|
5696
|
+
submitBtnLabel
|
|
5697
|
+
] })
|
|
5698
|
+
}
|
|
5699
|
+
) })
|
|
5690
5700
|
]
|
|
5691
5701
|
}
|
|
5692
5702
|
) }),
|