shadcn-zod-formkit 1.18.1 → 1.19.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 +58 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.mjs +58 -36
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-1.19.0.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-1.18.1.tgz +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1815,22 +1815,17 @@ var FieldButtonGroup = ({ input, form, isSubmitting }) => {
|
|
|
1815
1815
|
form.setValue(input.name, value, { shouldValidate: true });
|
|
1816
1816
|
};
|
|
1817
1817
|
const selectedValue = form.watch(input.name);
|
|
1818
|
-
return (
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
children: option.label ?? option.name
|
|
1830
|
-
},
|
|
1831
|
-
option.value
|
|
1832
|
-
)) })
|
|
1833
|
-
);
|
|
1818
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ButtonGroup, { children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1819
|
+
Button,
|
|
1820
|
+
{
|
|
1821
|
+
type: "button",
|
|
1822
|
+
variant: selectedValue === option.value ? "default" : "outline",
|
|
1823
|
+
onClick: () => handleSelect(option.value),
|
|
1824
|
+
disabled: isSubmitting,
|
|
1825
|
+
children: option.label ?? option.name
|
|
1826
|
+
},
|
|
1827
|
+
option.value
|
|
1828
|
+
)) });
|
|
1834
1829
|
};
|
|
1835
1830
|
var CheckListInput = class extends BaseInput {
|
|
1836
1831
|
render() {
|
|
@@ -4378,7 +4373,8 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
4378
4373
|
return !fieldState.error && value !== void 0 && value !== "";
|
|
4379
4374
|
});
|
|
4380
4375
|
const [showPassword, setShowPassword] = React3.useState(false);
|
|
4381
|
-
const isPasswordField = input.keyboardType === "password"
|
|
4376
|
+
const isPasswordField = input.keyboardType === "password" /* PASSWORD */;
|
|
4377
|
+
const isNumberField = input.keyboardType === "number" /* NUMBER */;
|
|
4382
4378
|
const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField;
|
|
4383
4379
|
const formField = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4384
4380
|
FormField,
|
|
@@ -4400,8 +4396,18 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
4400
4396
|
{
|
|
4401
4397
|
placeholder: input.placeHolder,
|
|
4402
4398
|
disabled: input.disabled || isSubmitting,
|
|
4403
|
-
|
|
4404
|
-
|
|
4399
|
+
onBlur: field.onBlur,
|
|
4400
|
+
name: field.name,
|
|
4401
|
+
ref: field.ref,
|
|
4402
|
+
type: isPasswordField && !showPassword ? "password" : isNumberField ? "number" : "text",
|
|
4403
|
+
value: field.value ?? "",
|
|
4404
|
+
onChange: (e) => {
|
|
4405
|
+
let value = e.target.value;
|
|
4406
|
+
if (isNumberField) {
|
|
4407
|
+
value = e.target.value === "" ? "" : Number(e.target.value);
|
|
4408
|
+
}
|
|
4409
|
+
field.onChange(value);
|
|
4410
|
+
}
|
|
4405
4411
|
}
|
|
4406
4412
|
),
|
|
4407
4413
|
showInputGroupAddons && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
@@ -5630,6 +5636,7 @@ var DynamicForm = ({
|
|
|
5630
5636
|
errorAlertPosition = "up",
|
|
5631
5637
|
withCard = false,
|
|
5632
5638
|
submitBtnClass = "",
|
|
5639
|
+
listBtnConfig = [],
|
|
5633
5640
|
submitBtnLabel = "Guardar"
|
|
5634
5641
|
}) => {
|
|
5635
5642
|
const [isPending, startTransition] = React3.useTransition();
|
|
@@ -5680,23 +5687,38 @@ var DynamicForm = ({
|
|
|
5680
5687
|
/* @__PURE__ */ jsxRuntime.jsx(FormFieldsGrid, { fields, form, readOnly }),
|
|
5681
5688
|
children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row items-center gap-2 w-full h-full", children })
|
|
5682
5689
|
] }),
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5690
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ButtonGroup, { className: "flex flex-row w-full", children: [
|
|
5691
|
+
listBtnConfig.map((btn, key) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5692
|
+
Button,
|
|
5693
|
+
{
|
|
5694
|
+
type: btn.btnType,
|
|
5695
|
+
size: "lg",
|
|
5696
|
+
className: submitBtnClass,
|
|
5697
|
+
variant: btn.variant,
|
|
5698
|
+
onClick: btn.onClick,
|
|
5699
|
+
disabled: btn.disabled,
|
|
5700
|
+
children: btn.label
|
|
5701
|
+
},
|
|
5702
|
+
key
|
|
5703
|
+
)),
|
|
5704
|
+
!readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5705
|
+
Button,
|
|
5706
|
+
{
|
|
5707
|
+
type: onClick ? "button" : "submit",
|
|
5708
|
+
size: "lg",
|
|
5709
|
+
className: submitBtnClass,
|
|
5710
|
+
disabled: isPending,
|
|
5711
|
+
onClick: onClick ? handleClick : void 0,
|
|
5712
|
+
children: isPending ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5713
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
5714
|
+
"Guardando..."
|
|
5715
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5716
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "h-4 w-4 mr-2" }),
|
|
5717
|
+
submitBtnLabel
|
|
5718
|
+
] })
|
|
5719
|
+
}
|
|
5720
|
+
)
|
|
5721
|
+
] })
|
|
5700
5722
|
]
|
|
5701
5723
|
}
|
|
5702
5724
|
) }),
|