shadcn-zod-formkit 1.1.0 → 1.3.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 +18 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +18 -4
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-1.3.0.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-1.1.0.tgz +0 -0
package/dist/index.cjs
CHANGED
|
@@ -3835,6 +3835,9 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
3835
3835
|
const fieldState = form.getFieldState(input.name);
|
|
3836
3836
|
return !fieldState.error && value !== void 0 && value !== "";
|
|
3837
3837
|
});
|
|
3838
|
+
const [showPassword, setShowPassword] = React3.useState(false);
|
|
3839
|
+
const isPasswordField = input.keyboardType === "password";
|
|
3840
|
+
const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField;
|
|
3838
3841
|
const formField = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3839
3842
|
FormField,
|
|
3840
3843
|
{
|
|
@@ -3856,16 +3859,25 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
3856
3859
|
placeholder: input.placeHolder,
|
|
3857
3860
|
disabled: input.disabled || isSubmitting,
|
|
3858
3861
|
...field,
|
|
3859
|
-
type:
|
|
3862
|
+
type: isPasswordField && !showPassword ? "password" : "text"
|
|
3860
3863
|
}
|
|
3861
3864
|
),
|
|
3862
|
-
|
|
3865
|
+
showInputGroupAddons && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
3863
3866
|
infoTooltip && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
3864
3867
|
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { size: 20 }) }),
|
|
3865
3868
|
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: infoTooltip }) })
|
|
3866
3869
|
] }),
|
|
3867
3870
|
textRight && /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, { children: textRight }),
|
|
3868
3871
|
iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { size: 20 }, index)),
|
|
3872
|
+
isPasswordField && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3873
|
+
"button",
|
|
3874
|
+
{
|
|
3875
|
+
type: "button",
|
|
3876
|
+
onClick: () => setShowPassword(!showPassword),
|
|
3877
|
+
className: "p-1",
|
|
3878
|
+
children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { size: 20 })
|
|
3879
|
+
}
|
|
3880
|
+
),
|
|
3869
3881
|
autoValidate && /* @__PURE__ */ jsxRuntime.jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
|
|
3870
3882
|
] })
|
|
3871
3883
|
] }) }),
|
|
@@ -4382,20 +4394,22 @@ var TextInput = class extends BaseInput {
|
|
|
4382
4394
|
}
|
|
4383
4395
|
};
|
|
4384
4396
|
var FieldText = ({ input, form, isSubmitting }) => {
|
|
4397
|
+
const hidden = input.hidden ?? input.inputType === "hidden" /* HIDDEN */;
|
|
4398
|
+
const type = hidden ? "hidden" : input.keyboardType || "text";
|
|
4385
4399
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4386
4400
|
FormField,
|
|
4387
4401
|
{
|
|
4388
4402
|
control: form.control,
|
|
4389
4403
|
name: input.name,
|
|
4390
4404
|
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: input.className, children: [
|
|
4391
|
-
/* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
4405
|
+
!hidden && /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: input.label }) }),
|
|
4392
4406
|
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { className: "shadow-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4393
4407
|
Input,
|
|
4394
4408
|
{
|
|
4395
4409
|
className: "min-w-[180px]",
|
|
4396
4410
|
placeholder: input.placeHolder,
|
|
4397
4411
|
...field,
|
|
4398
|
-
type
|
|
4412
|
+
type,
|
|
4399
4413
|
disabled: input.disabled || isSubmitting
|
|
4400
4414
|
}
|
|
4401
4415
|
) }),
|