shadcn-zod-formkit 1.2.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 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: input.keyboardType
3862
+ type: isPasswordField && !showPassword ? "password" : "text"
3860
3863
  }
3861
3864
  ),
3862
- (iconsRight.length > 0 || textRight || autoValidate || infoTooltip) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroupAddon, { align: "inline-end", children: [
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
  ] }) }),