shadcn-zod-formkit 1.23.2 → 1.24.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
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
3
  import { ReactNode, JSX } from 'react';
4
4
  import * as react_hook_form from 'react-hook-form';
5
- import { UseFormReturn, FieldValues, FormState, FieldPath, ControllerProps } from 'react-hook-form';
5
+ import { UseFormReturn, ControllerRenderProps, FieldValues, FormState, FieldPath, ControllerProps } from 'react-hook-form';
6
6
  import { ZodTypeAny, z, ZodObject } from 'zod';
7
7
  import { LucideProps } from 'lucide-react';
8
8
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
@@ -83,13 +83,14 @@ type FieldConfig<T, RT = Record<string, any>> = FieldProps<T, RT> | FieldConfig<
83
83
  interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
84
84
  name: keyof T;
85
85
  label: string;
86
+ withDuplicatTag?: boolean;
86
87
  onChange?: (...event: any[]) => void;
87
88
  tabLabelField?: string;
88
89
  childrenPosition?: 'up' | 'down';
89
90
  children?: ReactNode | ((item: any, index: number) => ReactNode);
90
91
  defaultValue?: any;
91
92
  direction?: 'row' | 'col';
92
- repeaterFields?: FieldConfig<RT>;
93
+ repeaterFields?: Array<FieldProps<RT> | FieldProps<RT>[]>;
93
94
  minItems?: number;
94
95
  maxItems?: number;
95
96
  currencyFormat?: Intl.NumberFormatOptions;
@@ -199,6 +200,7 @@ declare const entityToInputOption: (entitiy: any, name?: string, description?: s
199
200
  declare const entitiesToInputOption: (data: any[], optionValue?: string, groupedLabel?: string) => InputOption[];
200
201
  declare const entityToGroupedOption: (entitiy: any, name?: string) => GroupedOption;
201
202
  declare const entitiesToGroupedOption: (data: any[], optionValue?: string) => GroupedOption[];
203
+ declare const handleOnChage: (event: any[] | any, input: FieldProps, field?: ControllerRenderProps<FieldValues, string>) => void;
202
204
 
203
205
  type alertPositionType = 'up' | 'down';
204
206
  interface FormResp<T> {
@@ -454,4 +456,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
454
456
 
455
457
  declare function cn(...inputs: ClassValue[]): string;
456
458
 
457
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, type BtnConfig, Button, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, ColorCnInput, type ColorCompProps, ColorInput, CustomAlert, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, type FieldConfig, type FieldProps, FileInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormItem, FormLabel, FormMessage, type FormResp, type GroupedOption, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputOption, type InputSetup, InputTypes, Label, NumberInput, OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type Props, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Switch, SwitchInput, TextAreaInput, TextInput, TextInputType, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, inputFieldComp, mockFields, useFormField, validationMessages };
459
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, type BtnConfig, Button, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, ColorCnInput, type ColorCompProps, ColorInput, CustomAlert, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, type FieldConfig, type FieldProps, FileInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormItem, FormLabel, FormMessage, type FormResp, type GroupedOption, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputOption, type InputSetup, InputTypes, Label, NumberInput, OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type Props, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Switch, SwitchInput, TextAreaInput, TextInput, TextInputType, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, mockFields, useFormField, validationMessages };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
3
  import { ReactNode, JSX } from 'react';
4
4
  import * as react_hook_form from 'react-hook-form';
5
- import { UseFormReturn, FieldValues, FormState, FieldPath, ControllerProps } from 'react-hook-form';
5
+ import { UseFormReturn, ControllerRenderProps, FieldValues, FormState, FieldPath, ControllerProps } from 'react-hook-form';
6
6
  import { ZodTypeAny, z, ZodObject } from 'zod';
7
7
  import { LucideProps } from 'lucide-react';
8
8
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
@@ -83,13 +83,14 @@ type FieldConfig<T, RT = Record<string, any>> = FieldProps<T, RT> | FieldConfig<
83
83
  interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
84
84
  name: keyof T;
85
85
  label: string;
86
+ withDuplicatTag?: boolean;
86
87
  onChange?: (...event: any[]) => void;
87
88
  tabLabelField?: string;
88
89
  childrenPosition?: 'up' | 'down';
89
90
  children?: ReactNode | ((item: any, index: number) => ReactNode);
90
91
  defaultValue?: any;
91
92
  direction?: 'row' | 'col';
92
- repeaterFields?: FieldConfig<RT>;
93
+ repeaterFields?: Array<FieldProps<RT> | FieldProps<RT>[]>;
93
94
  minItems?: number;
94
95
  maxItems?: number;
95
96
  currencyFormat?: Intl.NumberFormatOptions;
@@ -199,6 +200,7 @@ declare const entityToInputOption: (entitiy: any, name?: string, description?: s
199
200
  declare const entitiesToInputOption: (data: any[], optionValue?: string, groupedLabel?: string) => InputOption[];
200
201
  declare const entityToGroupedOption: (entitiy: any, name?: string) => GroupedOption;
201
202
  declare const entitiesToGroupedOption: (data: any[], optionValue?: string) => GroupedOption[];
203
+ declare const handleOnChage: (event: any[] | any, input: FieldProps, field?: ControllerRenderProps<FieldValues, string>) => void;
202
204
 
203
205
  type alertPositionType = 'up' | 'down';
204
206
  interface FormResp<T> {
@@ -454,4 +456,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
454
456
 
455
457
  declare function cn(...inputs: ClassValue[]): string;
456
458
 
457
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, type BtnConfig, Button, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, ColorCnInput, type ColorCompProps, ColorInput, CustomAlert, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, type FieldConfig, type FieldProps, FileInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormItem, FormLabel, FormMessage, type FormResp, type GroupedOption, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputOption, type InputSetup, InputTypes, Label, NumberInput, OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type Props, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Switch, SwitchInput, TextAreaInput, TextInput, TextInputType, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, inputFieldComp, mockFields, useFormField, validationMessages };
459
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, type BtnConfig, Button, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, ColorCnInput, type ColorCompProps, ColorInput, CustomAlert, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, type FieldConfig, type FieldProps, FileInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormItem, FormLabel, FormMessage, type FormResp, type GroupedOption, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputOption, type InputSetup, InputTypes, Label, NumberInput, OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type Props, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Switch, SwitchInput, TextAreaInput, TextInput, TextInputType, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, mockFields, useFormField, validationMessages };
package/dist/index.mjs CHANGED
@@ -194,6 +194,11 @@ var entitiesToGroupedOption = (data, optionValue = "name") => {
194
194
  }
195
195
  return entities;
196
196
  };
197
+ var handleOnChage = (event, input, field) => {
198
+ console.log("\u{1F680} ~ handleOnChage ~ event:", event);
199
+ if (event) field?.onChange(event);
200
+ input.onChange?.(event);
201
+ };
197
202
 
198
203
  // src/components/custom/form/inputs/base/definitions.ts
199
204
  var flattenFields = (fields) => {
@@ -1629,13 +1634,14 @@ var GroupedSwitches = ({ options, onChange, input, isSubmitting }) => {
1629
1634
  setAllChecked(checked);
1630
1635
  onChange?.(updated.filter((opt) => opt.checked));
1631
1636
  };
1632
- const handleChildToggle = (option, checked) => {
1637
+ const handleChildToggle = (option, checked, input2) => {
1633
1638
  const updated = switches.map(
1634
1639
  (opt) => opt.id === option.id ? { ...opt, checked } : opt
1635
1640
  );
1636
1641
  setSwitches(updated);
1637
1642
  setAllChecked(updated.every((opt) => opt.checked));
1638
1643
  onChange?.(updated.filter((opt) => opt.checked));
1644
+ handleOnChage(updated.filter((opt) => opt.checked), input2);
1639
1645
  };
1640
1646
  return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs("div", { className: cn(`w-full h-full space-y-4 p-4 border-2 rounded-xl bg-green-500 ${allChecked ? "bg-green-500/5 border-green-400/10" : "bg-black/5"}`), children: [
1641
1647
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b p-2", children: [
@@ -1653,7 +1659,7 @@ var GroupedSwitches = ({ options, onChange, input, isSubmitting }) => {
1653
1659
  disabled: input.disabled || isSubmitting,
1654
1660
  id: String(opt.id),
1655
1661
  checked: opt?.checked || false,
1656
- onCheckedChange: (checked) => handleChildToggle(opt, checked)
1662
+ onCheckedChange: (checked) => handleChildToggle(opt, checked, input)
1657
1663
  }
1658
1664
  )
1659
1665
  ] }, opt.id))
@@ -1694,7 +1700,7 @@ var AccordionGroupedSwitches = ({ form, input, groups = [], onChange, isSubmitti
1694
1700
  const countCheckedByGroup = (group) => {
1695
1701
  return group.options.filter((opt) => opt.checked).length;
1696
1702
  };
1697
- const handleOptionChange = (field, updatedGroupLabel, updatedOptions) => {
1703
+ const handleOptionChange = (field, updatedGroupLabel, updatedOptions, input2) => {
1698
1704
  const newGroups = groupsState.map(
1699
1705
  (group) => group.label === updatedGroupLabel ? { ...group, options: updatedOptions } : group
1700
1706
  );
@@ -1703,6 +1709,7 @@ var AccordionGroupedSwitches = ({ form, input, groups = [], onChange, isSubmitti
1703
1709
  setSelectedOptions(allChecked);
1704
1710
  field.onChange(allChecked);
1705
1711
  onChange?.(allChecked);
1712
+ handleOnChage(allChecked, input2, field);
1706
1713
  };
1707
1714
  return /* @__PURE__ */ jsx(
1708
1715
  FormField,
@@ -1733,7 +1740,7 @@ var AccordionGroupedSwitches = ({ form, input, groups = [], onChange, isSubmitti
1733
1740
  isSubmitting,
1734
1741
  input,
1735
1742
  options: group.options,
1736
- onChange: (updated) => handleOptionChange(field, group.label, updated)
1743
+ onChange: (updated) => handleOptionChange(field, group.label, updated, input)
1737
1744
  }
1738
1745
  ) })
1739
1746
  ]
@@ -1798,7 +1805,10 @@ var FieldButtonGroup = ({ input, form, isSubmitting, className = "w-full flex-1"
1798
1805
  type: "button",
1799
1806
  className,
1800
1807
  variant: selectedValue === option.value ? "default" : "outline",
1801
- onClick: () => handleSelect(option.value),
1808
+ onClick: () => {
1809
+ handleSelect(option.value);
1810
+ handleOnChage(option.value, input);
1811
+ },
1802
1812
  disabled: isSubmitting,
1803
1813
  children: option.label ?? option.name
1804
1814
  },
@@ -1823,6 +1833,7 @@ var CheckListInput = class extends BaseInput {
1823
1833
  /* @__PURE__ */ jsx(
1824
1834
  Checkbox,
1825
1835
  {
1836
+ onChange: (e) => handleOnChage(e, input),
1826
1837
  disabled: input.disabled || isSubmitting,
1827
1838
  id: String(item[optionValue]),
1828
1839
  checked: value.includes(item[optionValue]),
@@ -1874,7 +1885,7 @@ var FieldCheckbox = ({ input, form, isSubmitting }) => {
1874
1885
  {
1875
1886
  id: input.name,
1876
1887
  checked: field.value,
1877
- onCheckedChange: field.onChange,
1888
+ onCheckedChange: (e) => handleOnChage(e, input, field),
1878
1889
  disabled: input.disabled || isSubmitting,
1879
1890
  className: "data-[state=checked]:border-blue-600 data-[state=checked]:bg-blue-600 data-[state=checked]:text-white \n dark:data-[state=checked]:border-blue-700 dark:data-[state=checked]:bg-blue-700"
1880
1891
  }
@@ -1910,23 +1921,14 @@ var FieldColor = ({ form, input, isSubmitting }) => {
1910
1921
  ColorCmp,
1911
1922
  {
1912
1923
  value: field.value || "#000000",
1913
- onChange: field.onChange,
1924
+ onChange: (event) => {
1925
+ handleOnChage(event, input, field);
1926
+ },
1914
1927
  onBlur: field.onBlur,
1915
1928
  disabled: input.disabled || isSubmitting,
1916
1929
  placeholder: input.placeHolder
1917
1930
  }
1918
- ) : /* @__PURE__ */ jsx(
1919
- "input",
1920
- {
1921
- type: "color",
1922
- value: field.value || "#000000",
1923
- onChange: (e) => field.onChange(e.target.value),
1924
- onBlur: () => field.onBlur(),
1925
- disabled: input.disabled || isSubmitting,
1926
- placeholder: input.placeHolder,
1927
- style: { width: 48, height: 28 }
1928
- }
1929
- ) }),
1931
+ ) : "N/A" }),
1930
1932
  /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
1931
1933
  /* @__PURE__ */ jsx(FormMessage, {})
1932
1934
  ] })
@@ -2147,6 +2149,7 @@ var FieldCombobox = ({ form, input, isSubmitting }) => {
2147
2149
  const newValue = currentValue === value ? "" : currentValue;
2148
2150
  setValue(newValue);
2149
2151
  form.setValue(input.name, newValue);
2152
+ handleOnChage(options.find((o) => getValue(o) === newValue), input);
2150
2153
  input.listConfig?.onOptionChange?.(
2151
2154
  options.find((o) => getValue(o) === newValue)
2152
2155
  );
@@ -2269,6 +2272,7 @@ var FieldCurrency = ({ form, input, isSubmitting }) => {
2269
2272
  setRawValue(newVal);
2270
2273
  const parsed = parseValue(newVal);
2271
2274
  if (parsed !== null) field.onChange(parsed);
2275
+ handleOnChage(parsed, input, field);
2272
2276
  },
2273
2277
  onBlur: (e) => {
2274
2278
  const formatted = formatValue(e.target.value);
@@ -3867,7 +3871,7 @@ var DateInput = class extends BaseInput {
3867
3871
  }, [field.value]);
3868
3872
  const handleSelect = (selectedDate) => {
3869
3873
  setDate(selectedDate);
3870
- field.onChange(selectedDate);
3874
+ handleOnChage(selectedDate, input, field);
3871
3875
  };
3872
3876
  return /* @__PURE__ */ jsxs(FormItem, { children: [
3873
3877
  /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
@@ -3957,7 +3961,10 @@ var FieldDateTimeInput = ({ form, input, isSubmitting }) => {
3957
3961
  type: "datetime-local",
3958
3962
  value: dateTime,
3959
3963
  disabled: input.disabled || isSubmitting,
3960
- onChange: (e) => handleChange(e.target.value)
3964
+ onChange: (e) => {
3965
+ handleOnChage(e.target.value, input, field);
3966
+ handleChange(e.target.value);
3967
+ }
3961
3968
  }
3962
3969
  ),
3963
3970
  (iconsRight.length > 0 || textRight || autoValidate) && /* @__PURE__ */ jsxs(InputGroupAddon, { align: "inline-end", children: [
@@ -4017,6 +4024,7 @@ var FieldFile = ({ form, input, isSubmitting }) => {
4017
4024
  onChange: (e) => {
4018
4025
  field.onChange(e.target.files?.[0]);
4019
4026
  handleFileChange(e);
4027
+ handleOnChage(e.target.files?.[0], input, field);
4020
4028
  }
4021
4029
  }
4022
4030
  ) }),
@@ -4300,7 +4308,10 @@ var FieldMultiSelect = ({ form, input, isSubmitting }) => {
4300
4308
  return /* @__PURE__ */ jsxs(
4301
4309
  CommandItem,
4302
4310
  {
4303
- onSelect: () => toggleOption(value),
4311
+ onSelect: () => {
4312
+ handleOnChage(value, input, field);
4313
+ toggleOption(value);
4314
+ },
4304
4315
  children: [
4305
4316
  /* @__PURE__ */ jsx(
4306
4317
  Check,
@@ -4383,6 +4394,7 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
4383
4394
  if (isNumberField) {
4384
4395
  value = e.target.value === "" ? "" : Number(e.target.value);
4385
4396
  }
4397
+ handleOnChage(value, input, field);
4386
4398
  field.onChange(value);
4387
4399
  }
4388
4400
  }
@@ -4440,7 +4452,7 @@ var FieldOTP = ({ form, input, isSubmitting }) => {
4440
4452
  name: input.name,
4441
4453
  render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4442
4454
  /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
4443
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(InputOTP, { maxLength: totalPositions.length, ...field, children: /* @__PURE__ */ jsx(InputOTPGroup, { children: totalPositions.map((position) => /* @__PURE__ */ jsx(InputOTPSlot, { index: position }, position)) }) }) }),
4455
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(InputOTP, { maxLength: totalPositions.length, ...field, onChange: (event) => handleOnChage(event, input, field), children: /* @__PURE__ */ jsx(InputOTPGroup, { children: totalPositions.map((position) => /* @__PURE__ */ jsx(InputOTPSlot, { index: position }, position)) }) }) }),
4444
4456
  /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
4445
4457
  /* @__PURE__ */ jsx(FormMessage, {})
4446
4458
  ] })
@@ -4481,7 +4493,7 @@ var FieldRadioGroup = ({ input, form, isSubmitting }) => {
4481
4493
  {
4482
4494
  ...field,
4483
4495
  value: field.value ?? "",
4484
- onValueChange: field.onChange,
4496
+ onValueChange: (e) => handleOnChage(e, input, field),
4485
4497
  className: "space-y-2 mt-3",
4486
4498
  children: options.map((opt, index) => /* @__PURE__ */ jsxs(
4487
4499
  "div",
@@ -4833,7 +4845,7 @@ var FieldSelect = ({ form, input, isSubmitting }) => {
4833
4845
  {
4834
4846
  disabled: input.disabled || isSubmitting || loading,
4835
4847
  onValueChange: (val) => {
4836
- field.onChange(val);
4848
+ handleOnChage(val, input, field);
4837
4849
  setValue(val);
4838
4850
  if (input.listConfig?.onOptionChange) {
4839
4851
  const selectedItem = lista.find(
@@ -4877,7 +4889,7 @@ var SimpleCheckListInput = class extends BaseInput {
4877
4889
  isSubmitting,
4878
4890
  input,
4879
4891
  value: field.value || [],
4880
- onChange: field.onChange
4892
+ onChange: (e) => handleOnChage(e, input, field)
4881
4893
  }
4882
4894
  )
4883
4895
  }
@@ -4899,12 +4911,14 @@ var FieldSimpleCheckList = ({ input, value, onChange, isSubmitting }) => {
4899
4911
  const handleMainToggle = (checked) => {
4900
4912
  const updated = options.map((opt) => ({ ...opt, checked }));
4901
4913
  setOptions(updated);
4914
+ handleOnChage(updated, input);
4902
4915
  onChange(updated);
4903
4916
  };
4904
4917
  const handleChildToggle = (option, checked) => {
4905
4918
  const updated = options.map(
4906
4919
  (opt) => opt.id === option.id ? { ...opt, checked } : opt
4907
4920
  );
4921
+ handleOnChage(updated, input);
4908
4922
  setOptions(updated);
4909
4923
  onChange(updated);
4910
4924
  };
@@ -5169,7 +5183,7 @@ var FieldSwitch = ({ input, form, isSubmitting }) => {
5169
5183
  Switch,
5170
5184
  {
5171
5185
  checked: field.value,
5172
- onCheckedChange: field.onChange,
5186
+ onCheckedChange: (event) => handleOnChage(event, input, field),
5173
5187
  "aria-disabled": true,
5174
5188
  disabled: input.disabled || isSubmitting
5175
5189
  }
@@ -5196,8 +5210,9 @@ var FieldTags = ({ input, form, isSubmitting }) => {
5196
5210
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
5197
5211
  TagsInput,
5198
5212
  {
5213
+ input,
5199
5214
  value: field.value ?? [],
5200
- onValueChange: field.onChange,
5215
+ onValueChange: (event) => handleOnChage(event, input, field),
5201
5216
  placeholder: "Enter for add tag"
5202
5217
  }
5203
5218
  ) }),
@@ -5212,6 +5227,7 @@ var SPLITTER_REGEX = /[\n#?=&\t,./-]+/;
5212
5227
  var FORMATTING_REGEX = /^[^a-zA-Z0-9]*|[^a-zA-Z0-9]*$/g;
5213
5228
  var TagsInput = React3__default.forwardRef(
5214
5229
  ({
5230
+ input,
5215
5231
  value,
5216
5232
  onValueChange,
5217
5233
  placeholder,
@@ -5226,7 +5242,7 @@ var TagsInput = React3__default.forwardRef(
5226
5242
  const parseMinItems = minItems ?? 0;
5227
5243
  const parseMaxItems = maxItems ?? Infinity;
5228
5244
  const addTag = (val) => {
5229
- if (!value.includes(val) && value.length < parseMaxItems) {
5245
+ if (!value.includes(val) && value.length < parseMaxItems || input.withDuplicatTag) {
5230
5246
  onValueChange([...value, val]);
5231
5247
  }
5232
5248
  };
@@ -5301,7 +5317,18 @@ function FieldTextArea({ form, input, isSubmitting }) {
5301
5317
  name: input.name,
5302
5318
  render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "shadow-lg", children: [
5303
5319
  /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
5304
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Textarea, { className: "min-w-[260px] bg-white", placeholder: input.placeHolder, ...field, disabled: input.disabled || isSubmitting }) }),
5320
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
5321
+ Textarea,
5322
+ {
5323
+ className: "min-w-[260px] bg-white",
5324
+ placeholder: input.placeHolder,
5325
+ ...field,
5326
+ onChange: (event) => {
5327
+ handleOnChage(event, input, field);
5328
+ },
5329
+ disabled: input.disabled || isSubmitting
5330
+ }
5331
+ ) }),
5305
5332
  input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
5306
5333
  /* @__PURE__ */ jsx(FormMessage, {})
5307
5334
  ] })
@@ -5332,6 +5359,7 @@ var FieldText = ({ input, form, isSubmitting }) => {
5332
5359
  placeholder: input.placeHolder,
5333
5360
  ...field,
5334
5361
  type,
5362
+ onChange: (e) => handleOnChage(e, input, field),
5335
5363
  disabled: input.disabled || isSubmitting
5336
5364
  }
5337
5365
  ) }),
@@ -5382,6 +5410,7 @@ var FieldTimeInput = ({ form, input, isSubmitting }) => {
5382
5410
  if (validNow !== isValid2) setIsValid(validNow);
5383
5411
  const handleChange = (val) => {
5384
5412
  setTime(val);
5413
+ handleOnChage(val, input, field);
5385
5414
  field.onChange(val);
5386
5415
  };
5387
5416
  return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
@@ -5920,6 +5949,6 @@ var InputList = ({ handleAddInput, inputsTypes }) => {
5920
5949
  }) });
5921
5950
  };
5922
5951
 
5923
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, Button, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, ColorCnInput, ColorInput, CustomAlert, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, FileInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormItem, FormLabel, FormMessage, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, InputTypes, Label, NumberInput, OTPInput2 as OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Switch, SwitchInput, TextAreaInput, TextInput, TextInputType, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, inputFieldComp, mockFields, useFormField, validationMessages };
5952
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, Button, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, ColorCnInput, ColorInput, CustomAlert, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, FileInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormItem, FormLabel, FormMessage, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, InputTypes, Label, NumberInput, OTPInput2 as OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Switch, SwitchInput, TextAreaInput, TextInput, TextInputType, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, mockFields, useFormField, validationMessages };
5924
5953
  //# sourceMappingURL=index.mjs.map
5925
5954
  //# sourceMappingURL=index.mjs.map