shadcn-zod-formkit 1.28.0 → 1.30.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.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
- import { ReactNode, JSX } from 'react';
3
+ import { ReactNode, JSX, Dispatch, SetStateAction, ChangeEventHandler } from 'react';
4
4
  import * as react_hook_form from 'react-hook-form';
5
5
  import { UseFormReturn, ControllerRenderProps, FieldValues, FormState, FieldPath, ControllerProps } from 'react-hook-form';
6
6
  import { ZodTypeAny, z, ZodObject } from 'zod';
@@ -488,6 +488,18 @@ interface Props$3 {
488
488
  isSubmitting?: boolean;
489
489
  }
490
490
  declare const FieldTextGroup: ({ form, input, isSubmitting }: Props$3) => react_jsx_runtime.JSX.Element;
491
+ interface customInputGroup {
492
+ value?: any;
493
+ input: FieldProps<Record<string, any>, Record<string, any>>;
494
+ field?: ControllerRenderProps<FieldValues, string>;
495
+ form: UseFormReturn;
496
+ isSubmitting?: boolean;
497
+ isValid?: boolean;
498
+ setShowPassword?: Dispatch<SetStateAction<boolean>>;
499
+ autoValidate?: boolean;
500
+ onChange?: ChangeEventHandler<HTMLInputElement> | undefined;
501
+ }
502
+ declare const CustomInputGroup: ({ value, input, field, form, isSubmitting, onChange, isValid }: customInputGroup) => react_jsx_runtime.JSX.Element;
491
503
 
492
504
  declare class TextInput extends BaseInput {
493
505
  render(): JSX.Element;
@@ -739,4 +751,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
739
751
 
740
752
  declare function cn(...inputs: ClassValue[]): string;
741
753
 
742
- export { Accordion, AccordionContent, AccordionGroupedSwitchInput, AccordionGroupedSwitches, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, type BtnConfig, Button, ButtonGroup, ButtonGroupInput, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, CheckboxInput, ColorCnInput, type ColorCompProps, ColorInput, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CurrencyInput, CustomAlert, DateInput, DateTimeInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, Field, FieldButtonGroup, type FieldConfig, FieldContent, FieldCurrency, FieldDateTimeInput, FieldDescription, FieldError, FieldFileMultiUpload, FieldGroup, FieldKeyValueList, FieldLabel, FieldLegend, type FieldProps, FieldRepeater, FieldSeparator, FieldSet, FieldSimpleCheckList, FieldSlider, FieldStringValueList, FieldTextGroup, FieldTimeInput, FieldTitle, FileInput, FileMultiUploadInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormFieldsGrid, FormItem, FormLabel, FormMessage, type FormResp, GenericFilter, type GroupedOption, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputOption, type InputSetup, InputTypes, KeyValueListInput, Label, MultiSelectInput, NumberInput, OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type Props, RadioGroup, RadioGroupInput, RadioGroupItem, RepeaterInput, RepeaterTabsInput, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SimpleCheckListInput, Slider, SliderInput, SortableListInput, StringValueListInput, Switch, SwitchInput, Tabs, TabsContent, TabsList, TabsTrigger, TagInput, TextAreaInput, TextInput, TextInputGroup, TextInputType, Textarea, TimeInput, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, isValidField, mockFields, useFormField, validationMessages };
754
+ export { Accordion, AccordionContent, AccordionGroupedSwitchInput, AccordionGroupedSwitches, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, type BtnConfig, Button, ButtonGroup, ButtonGroupInput, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, CheckboxInput, ColorCnInput, type ColorCompProps, ColorInput, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CurrencyInput, CustomAlert, CustomInputGroup, DateInput, DateTimeInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, Field, FieldButtonGroup, type FieldConfig, FieldContent, FieldCurrency, FieldDateTimeInput, FieldDescription, FieldError, FieldFileMultiUpload, FieldGroup, FieldKeyValueList, FieldLabel, FieldLegend, type FieldProps, FieldRepeater, FieldSeparator, FieldSet, FieldSimpleCheckList, FieldSlider, FieldStringValueList, FieldTextGroup, FieldTimeInput, FieldTitle, FileInput, FileMultiUploadInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormFieldsGrid, FormItem, FormLabel, FormMessage, type FormResp, GenericFilter, type GroupedOption, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputOption, type InputSetup, InputTypes, KeyValueListInput, Label, MultiSelectInput, NumberInput, OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type Props, RadioGroup, RadioGroupInput, RadioGroupItem, RepeaterInput, RepeaterTabsInput, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SimpleCheckListInput, Slider, SliderInput, SortableListInput, StringValueListInput, Switch, SwitchInput, Tabs, TabsContent, TabsList, TabsTrigger, TagInput, TextAreaInput, TextInput, TextInputGroup, TextInputType, Textarea, TimeInput, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, isValidField, mockFields, useFormField, validationMessages };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
- import { ReactNode, JSX } from 'react';
3
+ import { ReactNode, JSX, Dispatch, SetStateAction, ChangeEventHandler } from 'react';
4
4
  import * as react_hook_form from 'react-hook-form';
5
5
  import { UseFormReturn, ControllerRenderProps, FieldValues, FormState, FieldPath, ControllerProps } from 'react-hook-form';
6
6
  import { ZodTypeAny, z, ZodObject } from 'zod';
@@ -488,6 +488,18 @@ interface Props$3 {
488
488
  isSubmitting?: boolean;
489
489
  }
490
490
  declare const FieldTextGroup: ({ form, input, isSubmitting }: Props$3) => react_jsx_runtime.JSX.Element;
491
+ interface customInputGroup {
492
+ value?: any;
493
+ input: FieldProps<Record<string, any>, Record<string, any>>;
494
+ field?: ControllerRenderProps<FieldValues, string>;
495
+ form: UseFormReturn;
496
+ isSubmitting?: boolean;
497
+ isValid?: boolean;
498
+ setShowPassword?: Dispatch<SetStateAction<boolean>>;
499
+ autoValidate?: boolean;
500
+ onChange?: ChangeEventHandler<HTMLInputElement> | undefined;
501
+ }
502
+ declare const CustomInputGroup: ({ value, input, field, form, isSubmitting, onChange, isValid }: customInputGroup) => react_jsx_runtime.JSX.Element;
491
503
 
492
504
  declare class TextInput extends BaseInput {
493
505
  render(): JSX.Element;
@@ -739,4 +751,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
739
751
 
740
752
  declare function cn(...inputs: ClassValue[]): string;
741
753
 
742
- export { Accordion, AccordionContent, AccordionGroupedSwitchInput, AccordionGroupedSwitches, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, type BtnConfig, Button, ButtonGroup, ButtonGroupInput, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, CheckboxInput, ColorCnInput, type ColorCompProps, ColorInput, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CurrencyInput, CustomAlert, DateInput, DateTimeInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, Field, FieldButtonGroup, type FieldConfig, FieldContent, FieldCurrency, FieldDateTimeInput, FieldDescription, FieldError, FieldFileMultiUpload, FieldGroup, FieldKeyValueList, FieldLabel, FieldLegend, type FieldProps, FieldRepeater, FieldSeparator, FieldSet, FieldSimpleCheckList, FieldSlider, FieldStringValueList, FieldTextGroup, FieldTimeInput, FieldTitle, FileInput, FileMultiUploadInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormFieldsGrid, FormItem, FormLabel, FormMessage, type FormResp, GenericFilter, type GroupedOption, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputOption, type InputSetup, InputTypes, KeyValueListInput, Label, MultiSelectInput, NumberInput, OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type Props, RadioGroup, RadioGroupInput, RadioGroupItem, RepeaterInput, RepeaterTabsInput, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SimpleCheckListInput, Slider, SliderInput, SortableListInput, StringValueListInput, Switch, SwitchInput, Tabs, TabsContent, TabsList, TabsTrigger, TagInput, TextAreaInput, TextInput, TextInputGroup, TextInputType, Textarea, TimeInput, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, isValidField, mockFields, useFormField, validationMessages };
754
+ export { Accordion, AccordionContent, AccordionGroupedSwitchInput, AccordionGroupedSwitches, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, type BtnConfig, Button, ButtonGroup, ButtonGroupInput, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, CheckboxInput, ColorCnInput, type ColorCompProps, ColorInput, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CurrencyInput, CustomAlert, CustomInputGroup, DateInput, DateTimeInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, Field, FieldButtonGroup, type FieldConfig, FieldContent, FieldCurrency, FieldDateTimeInput, FieldDescription, FieldError, FieldFileMultiUpload, FieldGroup, FieldKeyValueList, FieldLabel, FieldLegend, type FieldProps, FieldRepeater, FieldSeparator, FieldSet, FieldSimpleCheckList, FieldSlider, FieldStringValueList, FieldTextGroup, FieldTimeInput, FieldTitle, FileInput, FileMultiUploadInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormFieldsGrid, FormItem, FormLabel, FormMessage, type FormResp, GenericFilter, type GroupedOption, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputOption, type InputSetup, InputTypes, KeyValueListInput, Label, MultiSelectInput, NumberInput, OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type Props, RadioGroup, RadioGroupInput, RadioGroupItem, RepeaterInput, RepeaterTabsInput, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SimpleCheckListInput, Slider, SliderInput, SortableListInput, StringValueListInput, Switch, SwitchInput, Tabs, TabsContent, TabsList, TabsTrigger, TagInput, TextAreaInput, TextInput, TextInputGroup, TextInputType, Textarea, TimeInput, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, isValidField, mockFields, useFormField, validationMessages };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CheckIcon, XIcon, MinusIcon, CircleIcon, GripVerticalIcon, ChevronUpIcon, SearchIcon, ChevronsUpDown, Check, CalendarIcon, EyeOff, Eye, Upload, Trash2, Plus, Info, GripVertical, Loader2, Save, Pencil, Search, MessageCircleWarning, CircleCheck, CircleX } from 'lucide-react';
1
+ import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CheckIcon, XIcon, MinusIcon, CircleIcon, GripVerticalIcon, ChevronUpIcon, SearchIcon, ChevronsUpDown, Check, CalendarIcon, EyeOff, Eye, Upload, Info, Trash2, Plus, GripVertical, Loader2, Save, Pencil, Search, MessageCircleWarning, CircleCheck, CircleX } from 'lucide-react';
2
2
  import { InfoCircledIcon } from '@radix-ui/react-icons';
3
3
  import { cva } from 'class-variance-authority';
4
4
  import { twMerge } from 'tailwind-merge';
@@ -2184,6 +2184,8 @@ var ColorInput = class extends BaseInput {
2184
2184
  }
2185
2185
  };
2186
2186
  var PRESET_COLORS = [
2187
+ "#800000",
2188
+ // Maroon
2187
2189
  "#ef4444",
2188
2190
  // red
2189
2191
  "#f97316",
@@ -2192,16 +2194,26 @@ var PRESET_COLORS = [
2192
2194
  // yellow
2193
2195
  "#22c55e",
2194
2196
  // green
2197
+ "#00FF00",
2198
+ // lime
2199
+ "#00FFFF",
2200
+ // Aqua
2195
2201
  "#06b6d4",
2196
2202
  // cyan
2197
2203
  "#3b82f6",
2198
2204
  // blue
2199
2205
  "#8b5cf6",
2200
2206
  // purple
2207
+ "#800080",
2208
+ // purple
2209
+ "#FF00FF",
2210
+ // Fuchsia
2201
2211
  "#ec4899",
2202
2212
  // pink
2203
2213
  "#64748b",
2204
2214
  // slate
2215
+ "#808080",
2216
+ // Gray
2205
2217
  "#000000"
2206
2218
  // black
2207
2219
  ];
@@ -4527,6 +4539,111 @@ var FieldFileMultiUpload = ({ input, form, isSubmitting }) => {
4527
4539
  );
4528
4540
  return /* @__PURE__ */ jsx(Fragment, { children: formField });
4529
4541
  };
4542
+ var TextInputGroup = class extends BaseInput {
4543
+ render() {
4544
+ const { input, form, isSubmitting } = this;
4545
+ return /* @__PURE__ */ jsx(FieldTextGroup, { input, form, isSubmitting });
4546
+ }
4547
+ };
4548
+ var FieldTextGroup = ({ form, input, isSubmitting }) => {
4549
+ const [isValid2, setIsValid] = useState(isValidField(input, form));
4550
+ const formField = /* @__PURE__ */ jsx(
4551
+ FormField,
4552
+ {
4553
+ control: form.control,
4554
+ name: input.name,
4555
+ render: ({ field }) => {
4556
+ setIsValid(isValidField(input, form));
4557
+ return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
4558
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
4559
+ /* @__PURE__ */ jsx(FormControl, { className: "shadow-lg", children: CustomInputGroup({
4560
+ input,
4561
+ isSubmitting,
4562
+ field,
4563
+ form,
4564
+ isValid: isValid2
4565
+ }) }),
4566
+ input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
4567
+ /* @__PURE__ */ jsx(FormMessage, {})
4568
+ ] });
4569
+ }
4570
+ },
4571
+ input.name
4572
+ );
4573
+ return /* @__PURE__ */ jsx(Fragment, { children: formField });
4574
+ };
4575
+ var CustomInputGroup = ({
4576
+ value,
4577
+ input,
4578
+ field,
4579
+ form,
4580
+ isSubmitting,
4581
+ onChange,
4582
+ isValid: isValid2
4583
+ }) => {
4584
+ const groupConfig = input.inputGroupConfig;
4585
+ const infoTooltip = input?.infoTooltip;
4586
+ const autoValidate = groupConfig?.autoValidIcons ?? input.zodType ? true : false;
4587
+ const iconValidState = /* @__PURE__ */ jsx(CircleCheck, { style: { color: "#00bf3e" } });
4588
+ const iconInvalidState = /* @__PURE__ */ jsx(CircleX, { style: { color: "#ff8080" } });
4589
+ const iconLoadingState = /* @__PURE__ */ jsx(Loader2, { className: "animate-spin", style: { color: "#1e90ff" } });
4590
+ const iconsRight = groupConfig?.iconsRight ?? [];
4591
+ const iconsLeft = groupConfig?.iconsLeft ?? [];
4592
+ const textLeft = groupConfig?.textLeft;
4593
+ const textRight = groupConfig?.textRight;
4594
+ const [showPassword, setShowPassword] = useState(false);
4595
+ const isPasswordField = input.keyboardType === "password" /* PASSWORD */;
4596
+ const isNumberField = input.keyboardType === "number" /* NUMBER */;
4597
+ const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField;
4598
+ return /* @__PURE__ */ jsxs(InputGroup, { children: [
4599
+ (iconsLeft.length > 0 || textLeft) && /* @__PURE__ */ jsxs(InputGroupAddon, { children: [
4600
+ textLeft && /* @__PURE__ */ jsx(InputGroupText, { children: textLeft }),
4601
+ iconsLeft.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 20 }, index))
4602
+ ] }),
4603
+ /* @__PURE__ */ jsx(
4604
+ InputGroupInput,
4605
+ {
4606
+ placeholder: input.placeHolder,
4607
+ disabled: input.disabled || isSubmitting,
4608
+ onBlur: field?.onBlur,
4609
+ name: field?.name,
4610
+ ref: field?.ref,
4611
+ type: isPasswordField && !showPassword ? "password" : isNumberField ? "number" : "text",
4612
+ value: field?.value ?? value ?? "",
4613
+ onChange: (e) => {
4614
+ if (onChange) {
4615
+ onChange(e);
4616
+ }
4617
+ let value2 = e.target.value;
4618
+ if (isNumberField) {
4619
+ value2 = e.target.value === "" ? "" : Number(e.target.value);
4620
+ }
4621
+ field?.onChange(value2);
4622
+ isValidField(input, form);
4623
+ handleOnChage(value2, input, field);
4624
+ }
4625
+ }
4626
+ ),
4627
+ showInputGroupAddons && /* @__PURE__ */ jsxs(InputGroupAddon, { align: "inline-end", children: [
4628
+ infoTooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [
4629
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Info, { size: 20 }) }),
4630
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: infoTooltip }) })
4631
+ ] }),
4632
+ textRight && /* @__PURE__ */ jsx(InputGroupText, { children: textRight }),
4633
+ iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 20 }, index)),
4634
+ isPasswordField && /* @__PURE__ */ jsx(
4635
+ "button",
4636
+ {
4637
+ type: "button",
4638
+ onClick: () => setShowPassword(!showPassword),
4639
+ className: "p-1",
4640
+ children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { size: 20 }) : /* @__PURE__ */ jsx(Eye, { size: 20 })
4641
+ }
4642
+ ),
4643
+ autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
4644
+ ] })
4645
+ ] });
4646
+ };
4530
4647
  var KeyValueListInput = class extends BaseInput {
4531
4648
  render() {
4532
4649
  const { input, form, isSubmitting } = this;
@@ -4583,27 +4700,31 @@ var FieldKeyValueList = ({ form, input, isSubmitting }) => {
4583
4700
  children: [
4584
4701
  /* @__PURE__ */ jsxs(ButtonGroup, { className: "w-full", children: [
4585
4702
  /* @__PURE__ */ jsx(ButtonGroupText, { asChild: true, children: /* @__PURE__ */ jsx(Label$1, { htmlFor: "key", children: "Key" }) }),
4586
- /* @__PURE__ */ jsx(InputGroup, { children: /* @__PURE__ */ jsx(
4587
- InputGroupInput,
4703
+ /* @__PURE__ */ jsx(
4704
+ CustomInputGroup,
4588
4705
  {
4589
- placeholder: "Key",
4706
+ autoValidate: true,
4590
4707
  value: pair.key,
4591
- disabled: isSubmitting,
4708
+ input,
4709
+ isValid: pair.key.trim() != "",
4710
+ isSubmitting,
4592
4711
  onChange: (e) => handleChange(index, "key", e.target.value),
4593
- className: "flex-1"
4712
+ form
4594
4713
  }
4595
- ) })
4714
+ )
4596
4715
  ] }),
4597
4716
  /* @__PURE__ */ jsxs(ButtonGroup, { className: "w-full", children: [
4598
4717
  /* @__PURE__ */ jsx(ButtonGroupText, { asChild: true, children: /* @__PURE__ */ jsx(Label$1, { htmlFor: "value", children: "Value" }) }),
4599
4718
  /* @__PURE__ */ jsx(InputGroup, { children: /* @__PURE__ */ jsx(
4600
- InputGroupInput,
4719
+ CustomInputGroup,
4601
4720
  {
4602
- placeholder: "Value",
4721
+ autoValidate: true,
4603
4722
  value: pair.value,
4604
- disabled: isSubmitting,
4723
+ input,
4724
+ isValid: pair.value.trim() != "",
4725
+ isSubmitting,
4605
4726
  onChange: (e) => handleChange(index, "value", e.target.value),
4606
- className: "flex-1"
4727
+ form
4607
4728
  }
4608
4729
  ) })
4609
4730
  ] }),
@@ -4736,91 +4857,6 @@ var FieldMultiSelect = ({ form, input, isSubmitting }) => {
4736
4857
  input.name
4737
4858
  );
4738
4859
  };
4739
- var TextInputGroup = class extends BaseInput {
4740
- render() {
4741
- const { input, form, isSubmitting } = this;
4742
- return /* @__PURE__ */ jsx(FieldTextGroup, { input, form, isSubmitting });
4743
- }
4744
- };
4745
- var FieldTextGroup = ({ form, input, isSubmitting }) => {
4746
- const groupConfig = input.inputGroupConfig;
4747
- const infoTooltip = input?.infoTooltip;
4748
- const autoValidate = groupConfig?.autoValidIcons ?? input.zodType ? true : false;
4749
- const iconValidState = /* @__PURE__ */ jsx(CircleCheck, { style: { color: "#00bf3e" } });
4750
- const iconInvalidState = /* @__PURE__ */ jsx(CircleX, { style: { color: "#ff8080" } });
4751
- const iconLoadingState = /* @__PURE__ */ jsx(Loader2, { className: "animate-spin", style: { color: "#1e90ff" } });
4752
- const iconsRight = groupConfig?.iconsRight ?? [];
4753
- const iconsLeft = groupConfig?.iconsLeft ?? [];
4754
- const textLeft = groupConfig?.textLeft;
4755
- const textRight = groupConfig?.textRight;
4756
- const [isValid2, setIsValid] = useState(isValidField(input, form));
4757
- const [showPassword, setShowPassword] = useState(false);
4758
- const isPasswordField = input.keyboardType === "password" /* PASSWORD */;
4759
- const isNumberField = input.keyboardType === "number" /* NUMBER */;
4760
- const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField;
4761
- const formField = /* @__PURE__ */ jsx(
4762
- FormField,
4763
- {
4764
- control: form.control,
4765
- name: input.name,
4766
- render: ({ field }) => {
4767
- setIsValid(isValidField(input, form));
4768
- return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
4769
- /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
4770
- /* @__PURE__ */ jsx(FormControl, { className: "shadow-lg", children: /* @__PURE__ */ jsxs(InputGroup, { children: [
4771
- (iconsLeft.length > 0 || textLeft) && /* @__PURE__ */ jsxs(InputGroupAddon, { children: [
4772
- textLeft && /* @__PURE__ */ jsx(InputGroupText, { children: textLeft }),
4773
- iconsLeft.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 20 }, index))
4774
- ] }),
4775
- /* @__PURE__ */ jsx(
4776
- InputGroupInput,
4777
- {
4778
- placeholder: input.placeHolder,
4779
- disabled: input.disabled || isSubmitting,
4780
- onBlur: field.onBlur,
4781
- name: field.name,
4782
- ref: field.ref,
4783
- type: isPasswordField && !showPassword ? "password" : isNumberField ? "number" : "text",
4784
- value: field.value ?? "",
4785
- onChange: (e) => {
4786
- let value = e.target.value;
4787
- if (isNumberField) {
4788
- value = e.target.value === "" ? "" : Number(e.target.value);
4789
- }
4790
- field.onChange(value);
4791
- isValidField(input, form);
4792
- handleOnChage(value, input, field);
4793
- }
4794
- }
4795
- ),
4796
- showInputGroupAddons && /* @__PURE__ */ jsxs(InputGroupAddon, { align: "inline-end", children: [
4797
- infoTooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [
4798
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Info, { size: 20 }) }),
4799
- /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: infoTooltip }) })
4800
- ] }),
4801
- textRight && /* @__PURE__ */ jsx(InputGroupText, { children: textRight }),
4802
- iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 20 }, index)),
4803
- isPasswordField && /* @__PURE__ */ jsx(
4804
- "button",
4805
- {
4806
- type: "button",
4807
- onClick: () => setShowPassword(!showPassword),
4808
- className: "p-1",
4809
- children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { size: 20 }) : /* @__PURE__ */ jsx(Eye, { size: 20 })
4810
- }
4811
- ),
4812
- autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
4813
- ] })
4814
- ] }) }),
4815
- input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
4816
- /* @__PURE__ */ jsx(FormMessage, {})
4817
- ] });
4818
- }
4819
- },
4820
- input.name
4821
- );
4822
- return /* @__PURE__ */ jsx(Fragment, { children: formField });
4823
- };
4824
4860
  var NumberInput = class extends BaseInput {
4825
4861
  render() {
4826
4862
  const { input, form, isSubmitting } = this;
@@ -4933,6 +4969,10 @@ var FieldRepeater = ({ form, input, isSubmitting }) => {
4933
4969
  });
4934
4970
  const canAdd = !input.maxItems || fields.length < input.maxItems;
4935
4971
  const canRemove = fields.length > (input.minItems ?? 0);
4972
+ const [isValid2, setIsValid] = useState(isValidField(input, form));
4973
+ useEffect(() => {
4974
+ setIsValid(isValidField(input, form));
4975
+ }, [input]);
4936
4976
  return /* @__PURE__ */ jsx(
4937
4977
  FormField,
4938
4978
  {
@@ -4952,7 +4992,7 @@ var FieldRepeater = ({ form, input, isSubmitting }) => {
4952
4992
  return /* @__PURE__ */ jsx(
4953
4993
  "div",
4954
4994
  {
4955
- className: `grid gap-3 grid-cols-${cols}`,
4995
+ className: `grid gap-1 grid-cols-${cols}`,
4956
4996
  children: group.map((subField) => /* @__PURE__ */ jsx(
4957
4997
  FormField,
4958
4998
  {
@@ -4961,11 +5001,14 @@ var FieldRepeater = ({ form, input, isSubmitting }) => {
4961
5001
  render: ({ field, fieldState }) => /* @__PURE__ */ jsxs(FormItem, { className: "flex-1", children: [
4962
5002
  /* @__PURE__ */ jsx(FormLabel, { children: subField.label }),
4963
5003
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
4964
- Input,
5004
+ CustomInputGroup,
4965
5005
  {
4966
- placeholder: subField.placeHolder,
4967
- disabled: subField.disabled || isSubmitting,
4968
- ...field
5006
+ autoValidate: true,
5007
+ value: field.value,
5008
+ input: subField,
5009
+ isValid: isValid2,
5010
+ field,
5011
+ form
4969
5012
  }
4970
5013
  ) }),
4971
5014
  /* @__PURE__ */ jsx(FormMessage, { children: fieldState.error?.message })
@@ -5570,6 +5613,10 @@ var StringValueListInput = class extends BaseInput {
5570
5613
  var FieldStringValueList = ({ form, input, isSubmitting }) => {
5571
5614
  const fieldName = input.name;
5572
5615
  const withAddBtn = input.withAddBtn ?? false;
5616
+ const [isValid2, setIsValid] = useState(isValidField(input, form));
5617
+ useEffect(() => {
5618
+ setIsValid(isValidField(input, form));
5619
+ }, [input]);
5573
5620
  useEffect(() => {
5574
5621
  const current = form.getValues(fieldName);
5575
5622
  if (!Array.isArray(current)) {
@@ -5597,7 +5644,7 @@ var FieldStringValueList = ({ form, input, isSubmitting }) => {
5597
5644
  {
5598
5645
  control: form.control,
5599
5646
  name: fieldName,
5600
- render: () => {
5647
+ render: (field) => {
5601
5648
  const items = form.watch(fieldName) || [];
5602
5649
  return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
5603
5650
  /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
@@ -5610,12 +5657,14 @@ var FieldStringValueList = ({ form, input, isSubmitting }) => {
5610
5657
  className: "flex items-center gap-4 py-2",
5611
5658
  children: [
5612
5659
  /* @__PURE__ */ jsx(
5613
- Input,
5660
+ CustomInputGroup,
5614
5661
  {
5615
- placeholder: `Item ${index + 1}`,
5662
+ autoValidate: true,
5616
5663
  value,
5617
- disabled: isSubmitting,
5618
- onChange: (e) => handleChange(index, e.target.value)
5664
+ input,
5665
+ isValid: isValid2,
5666
+ onChange: (e) => handleChange(index, e.target.value),
5667
+ form
5619
5668
  }
5620
5669
  ),
5621
5670
  input.isRemovebleOption && /* @__PURE__ */ jsx(
@@ -6559,6 +6608,6 @@ var GenericFilter = ({
6559
6608
  ) }) });
6560
6609
  };
6561
6610
 
6562
- export { Accordion, AccordionContent, AccordionGroupedSwitchInput, AccordionGroupedSwitches, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, Button, ButtonGroup, ButtonGroupInput, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, CheckboxInput, ColorCnInput, ColorInput, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CurrencyInput, CustomAlert, DateInput, DateTimeInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, Field, FieldButtonGroup, FieldContent, FieldCurrency, FieldDateTimeInput, FieldDescription, FieldError, FieldFileMultiUpload, FieldGroup, FieldKeyValueList, FieldLabel, FieldLegend, FieldRepeater, FieldSeparator, FieldSet, FieldSimpleCheckList, FieldSlider, FieldStringValueList, FieldTextGroup, FieldTimeInput2 as FieldTimeInput, FieldTitle, FileInput, FileMultiUploadInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormFieldsGrid, FormItem, FormLabel, FormMessage, GenericFilter, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, InputTypes, KeyValueListInput, Label, MultiSelectInput, NumberInput, OTPInput2 as OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupInput, RadioGroupItem, RepeaterInput, RepeaterTabsInput, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SimpleCheckListInput, Slider, SliderInput, SortableListInput, StringValueListInput, Switch, SwitchInput, Tabs, TabsContent, TabsList, TabsTrigger, TagInput, TextAreaInput, TextInput, TextInputGroup, TextInputType, Textarea, TimeInput, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, isValidField, mockFields, useFormField, validationMessages };
6611
+ export { Accordion, AccordionContent, AccordionGroupedSwitchInput, AccordionGroupedSwitches, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, Button, ButtonGroup, ButtonGroupInput, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, CheckboxInput, ColorCnInput, ColorInput, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CurrencyInput, CustomAlert, CustomInputGroup, DateInput, DateTimeInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, Field, FieldButtonGroup, FieldContent, FieldCurrency, FieldDateTimeInput, FieldDescription, FieldError, FieldFileMultiUpload, FieldGroup, FieldKeyValueList, FieldLabel, FieldLegend, FieldRepeater, FieldSeparator, FieldSet, FieldSimpleCheckList, FieldSlider, FieldStringValueList, FieldTextGroup, FieldTimeInput2 as FieldTimeInput, FieldTitle, FileInput, FileMultiUploadInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormFieldsGrid, FormItem, FormLabel, FormMessage, GenericFilter, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, InputTypes, KeyValueListInput, Label, MultiSelectInput, NumberInput, OTPInput2 as OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupInput, RadioGroupItem, RepeaterInput, RepeaterTabsInput, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SimpleCheckListInput, Slider, SliderInput, SortableListInput, StringValueListInput, Switch, SwitchInput, Tabs, TabsContent, TabsList, TabsTrigger, TagInput, TextAreaInput, TextInput, TextInputGroup, TextInputType, Textarea, TimeInput, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, isValidField, mockFields, useFormField, validationMessages };
6563
6612
  //# sourceMappingURL=index.mjs.map
6564
6613
  //# sourceMappingURL=index.mjs.map