shadcn-zod-formkit 1.26.0 → 1.26.1

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
@@ -88,9 +88,10 @@ type FieldConfig<T, RT = Record<string, any>> = FieldProps<T, RT> | FieldConfig<
88
88
  interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
89
89
  name: keyof T;
90
90
  label: string;
91
+ form?: UseFormReturn<any>;
91
92
  isRemovebleOption?: boolean;
92
93
  withDuplicatTag?: boolean;
93
- onChange?: (...event: any[]) => void;
94
+ onChange?: (event: any[], formValues?: Record<string, any>) => void;
94
95
  tabLabelField?: string;
95
96
  childrenPosition?: 'up' | 'down';
96
97
  children?: ReactNode | ((item: any, index: number) => ReactNode);
@@ -207,6 +208,7 @@ declare const entitiesToInputOption: (data: any[], optionValue?: string, grouped
207
208
  declare const entityToGroupedOption: (entitiy: any, name?: string) => GroupedOption;
208
209
  declare const entitiesToGroupedOption: (data: any[], optionValue?: string) => GroupedOption[];
209
210
  declare const handleOnChage: (event: any[] | any, input: FieldProps, field?: ControllerRenderProps<FieldValues, string>) => void;
211
+ declare const isValidField: (input: FieldProps, form: UseFormReturn, defaultValue?: any) => boolean;
210
212
 
211
213
  type alertPositionType = 'up' | 'down';
212
214
  interface FormResp<T> {
@@ -734,4 +736,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
734
736
 
735
737
  declare function cn(...inputs: ClassValue[]): string;
736
738
 
737
- 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, mockFields, useFormField, validationMessages };
739
+ 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 };
package/dist/index.d.ts CHANGED
@@ -88,9 +88,10 @@ type FieldConfig<T, RT = Record<string, any>> = FieldProps<T, RT> | FieldConfig<
88
88
  interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
89
89
  name: keyof T;
90
90
  label: string;
91
+ form?: UseFormReturn<any>;
91
92
  isRemovebleOption?: boolean;
92
93
  withDuplicatTag?: boolean;
93
- onChange?: (...event: any[]) => void;
94
+ onChange?: (event: any[], formValues?: Record<string, any>) => void;
94
95
  tabLabelField?: string;
95
96
  childrenPosition?: 'up' | 'down';
96
97
  children?: ReactNode | ((item: any, index: number) => ReactNode);
@@ -207,6 +208,7 @@ declare const entitiesToInputOption: (data: any[], optionValue?: string, grouped
207
208
  declare const entityToGroupedOption: (entitiy: any, name?: string) => GroupedOption;
208
209
  declare const entitiesToGroupedOption: (data: any[], optionValue?: string) => GroupedOption[];
209
210
  declare const handleOnChage: (event: any[] | any, input: FieldProps, field?: ControllerRenderProps<FieldValues, string>) => void;
211
+ declare const isValidField: (input: FieldProps, form: UseFormReturn, defaultValue?: any) => boolean;
210
212
 
211
213
  type alertPositionType = 'up' | 'down';
212
214
  interface FormResp<T> {
@@ -734,4 +736,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
734
736
 
735
737
  declare function cn(...inputs: ClassValue[]): string;
736
738
 
737
- 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, mockFields, useFormField, validationMessages };
739
+ 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 };
package/dist/index.mjs CHANGED
@@ -195,9 +195,17 @@ var entitiesToGroupedOption = (data, optionValue = "name") => {
195
195
  return entities;
196
196
  };
197
197
  var handleOnChage = (event, input, field) => {
198
- console.log("\u{1F680} ~ handleOnChage ~ event:", event);
199
198
  if (event) field?.onChange(event);
200
- input.onChange?.(event);
199
+ input.onChange?.(event, input.form?.getValues());
200
+ };
201
+ var isValidField = (input, form, defaultValue) => {
202
+ const value = defaultValue ?? form.getValues(input.name);
203
+ const fieldState = form.getFieldState(input.name);
204
+ if (input.zodType) {
205
+ const result = input.zodType.safeParse(value);
206
+ return result.success;
207
+ }
208
+ return !fieldState.error && value !== void 0 && value !== "";
201
209
  };
202
210
 
203
211
  // src/components/custom/form/inputs/base/definitions.ts
@@ -4166,60 +4174,82 @@ function cleanEscapedString(input) {
4166
4174
  var DateInput = class extends BaseInput {
4167
4175
  render() {
4168
4176
  const { input, form, isSubmitting } = this;
4169
- const formField = /* @__PURE__ */ jsx(
4170
- FormField,
4171
- {
4172
- control: form.control,
4173
- name: input.name,
4174
- render: ({ field }) => {
4175
- const [date, setDate] = React3.useState(
4176
- field.value ? new Date(field.value) : void 0
4177
- );
4178
- React3.useEffect(() => {
4179
- if (field.value && !date) {
4180
- setDate(new Date(field.value));
4181
- }
4182
- }, [field.value]);
4183
- const handleSelect = (selectedDate) => {
4184
- setDate(selectedDate);
4185
- handleOnChage(selectedDate, input, field);
4186
- };
4187
- return /* @__PURE__ */ jsxs(FormItem, { children: [
4188
- /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
4189
- /* @__PURE__ */ jsxs(Popover, { children: [
4190
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(
4191
- Button,
4192
- {
4193
- variant: "outline",
4194
- className: cn(
4195
- "w-full justify-start text-left font-normal",
4196
- !date && "text-muted-foreground"
4197
- ),
4198
- children: [
4177
+ return /* @__PURE__ */ jsx(FieldTimeInput, { input, form, isSubmitting });
4178
+ }
4179
+ };
4180
+ var FieldTimeInput = ({ form, input, isSubmitting }) => {
4181
+ const [isValid2, setIsValid] = useState(isValidField(input, form));
4182
+ const groupConfig = input.inputGroupConfig;
4183
+ const autoValidate = groupConfig?.autoValidIcons ?? input.zodType ? true : false;
4184
+ const iconValidState = /* @__PURE__ */ jsx(CircleCheck, { style: { color: "#00bf3e" } });
4185
+ const iconInvalidState = /* @__PURE__ */ jsx(CircleX, { style: { color: "#ff8080" } });
4186
+ const iconLoadingState = /* @__PURE__ */ jsx(Loader2, { className: "animate-spin", style: { color: "#1e90ff" } });
4187
+ const iconsRight = groupConfig?.iconsRight ?? [];
4188
+ groupConfig?.iconsLeft ?? [];
4189
+ groupConfig?.textLeft;
4190
+ const textRight = groupConfig?.textRight;
4191
+ const formField = /* @__PURE__ */ jsx(
4192
+ FormField,
4193
+ {
4194
+ control: form.control,
4195
+ name: input.name,
4196
+ render: ({ field }) => {
4197
+ setIsValid(isValidField(input, form));
4198
+ const [date, setDate] = React3.useState(
4199
+ field.value ? new Date(field.value) : void 0
4200
+ );
4201
+ React3.useEffect(() => {
4202
+ if (field.value && !date) {
4203
+ setDate(new Date(field.value));
4204
+ setIsValid(isValidField(input, form));
4205
+ }
4206
+ }, [field.value]);
4207
+ const handleSelect = (selectedDate) => {
4208
+ setDate(selectedDate);
4209
+ handleOnChage(selectedDate, input, field);
4210
+ };
4211
+ return /* @__PURE__ */ jsxs(FormItem, { children: [
4212
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
4213
+ /* @__PURE__ */ jsxs(Popover, { children: [
4214
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(InputGroup, { className: "flex flex-row gap-1", children: /* @__PURE__ */ jsxs(
4215
+ Button,
4216
+ {
4217
+ variant: "outline",
4218
+ className: cn(
4219
+ "w-full justify-start text-left py-0.5 ",
4220
+ !date && "text-muted-foreground"
4221
+ ),
4222
+ children: [
4223
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-1 justify-start text-left ", children: [
4199
4224
  /* @__PURE__ */ jsx(CalendarIcon, {}),
4200
4225
  date ? format(date, "PPP") : /* @__PURE__ */ jsx("span", { children: input.placeHolder ?? "Fecha" })
4201
- ]
4202
- }
4203
- ) }) }),
4204
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", children: /* @__PURE__ */ jsx(
4205
- Calendar,
4206
- {
4207
- mode: "single",
4208
- selected: date,
4209
- onSelect: handleSelect,
4210
- initialFocus: true
4211
- }
4212
- ) })
4213
- ] }),
4214
- /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
4215
- /* @__PURE__ */ jsx(FormMessage, {})
4216
- ] });
4217
- }
4218
- },
4219
- input.name
4220
- );
4221
- return /* @__PURE__ */ jsx(Fragment, { children: formField });
4222
- }
4226
+ ] }),
4227
+ (iconsRight.length > 0 || textRight || autoValidate) && /* @__PURE__ */ jsxs(Fragment, { children: [
4228
+ textRight && /* @__PURE__ */ jsx(InputGroupText, { children: textRight }),
4229
+ iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 24, className: "w-6! h-6!" }, index)),
4230
+ autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
4231
+ ] })
4232
+ ]
4233
+ }
4234
+ ) }) }) }),
4235
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", children: /* @__PURE__ */ jsx(
4236
+ Calendar,
4237
+ {
4238
+ mode: "single",
4239
+ selected: date,
4240
+ onSelect: handleSelect,
4241
+ initialFocus: true
4242
+ }
4243
+ ) })
4244
+ ] }),
4245
+ /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
4246
+ /* @__PURE__ */ jsx(FormMessage, {})
4247
+ ] });
4248
+ }
4249
+ },
4250
+ input.name
4251
+ );
4252
+ return /* @__PURE__ */ jsx(Fragment, { children: formField });
4223
4253
  };
4224
4254
  var DateTimeInput = class extends BaseInput {
4225
4255
  render() {
@@ -4229,7 +4259,7 @@ var DateTimeInput = class extends BaseInput {
4229
4259
  };
4230
4260
  var FieldDateTimeInput = ({ form, input, isSubmitting }) => {
4231
4261
  const groupConfig = input.inputGroupConfig;
4232
- const autoValidate = groupConfig?.autoValidIcons;
4262
+ const autoValidate = groupConfig?.autoValidIcons ?? input.zodType ? true : false;
4233
4263
  const iconValidState = /* @__PURE__ */ jsx(CircleCheck, { style: { color: "#00bf3e" } });
4234
4264
  const iconInvalidState = /* @__PURE__ */ jsx(CircleX, { style: { color: "#ff8080" } });
4235
4265
  const iconLoadingState = /* @__PURE__ */ jsx(Loader2, { className: "animate-spin", style: { color: "#1e90ff" } });
@@ -4280,7 +4310,7 @@ var FieldDateTimeInput = ({ form, input, isSubmitting }) => {
4280
4310
  ),
4281
4311
  (iconsRight.length > 0 || textRight || autoValidate) && /* @__PURE__ */ jsxs(InputGroupAddon, { align: "inline-end", children: [
4282
4312
  textRight && /* @__PURE__ */ jsx(InputGroupText, { children: textRight }),
4283
- iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 20 }, index)),
4313
+ iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 24 }, index)),
4284
4314
  autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
4285
4315
  ] })
4286
4316
  ] }) }),
@@ -4658,7 +4688,7 @@ var TextInputGroup = class extends BaseInput {
4658
4688
  var FieldTextGroup = ({ form, input, isSubmitting }) => {
4659
4689
  const groupConfig = input.inputGroupConfig;
4660
4690
  const infoTooltip = input?.infoTooltip;
4661
- const autoValidate = groupConfig?.autoValidIcons;
4691
+ const autoValidate = groupConfig?.autoValidIcons ?? input.zodType ? true : false;
4662
4692
  const iconValidState = /* @__PURE__ */ jsx(CircleCheck, { style: { color: "#00bf3e" } });
4663
4693
  const iconInvalidState = /* @__PURE__ */ jsx(CircleX, { style: { color: "#ff8080" } });
4664
4694
  const iconLoadingState = /* @__PURE__ */ jsx(Loader2, { className: "animate-spin", style: { color: "#1e90ff" } });
@@ -4666,11 +4696,7 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
4666
4696
  const iconsLeft = groupConfig?.iconsLeft ?? [];
4667
4697
  const textLeft = groupConfig?.textLeft;
4668
4698
  const textRight = groupConfig?.textRight;
4669
- const [isValid2, setIsValid] = useState(() => {
4670
- const value = form.getValues(input.name);
4671
- const fieldState = form.getFieldState(input.name);
4672
- return !fieldState.error && value !== void 0 && value !== "";
4673
- });
4699
+ const [isValid2, setIsValid] = useState(isValidField(input, form));
4674
4700
  const [showPassword, setShowPassword] = useState(false);
4675
4701
  const isPasswordField = input.keyboardType === "password" /* PASSWORD */;
4676
4702
  const isNumberField = input.keyboardType === "number" /* NUMBER */;
@@ -4680,9 +4706,8 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
4680
4706
  {
4681
4707
  control: form.control,
4682
4708
  name: input.name,
4683
- render: ({ field, fieldState }) => {
4684
- const validNow = !fieldState.error && field.value !== void 0 && field.value !== "";
4685
- if (validNow !== isValid2) setIsValid(validNow);
4709
+ render: ({ field }) => {
4710
+ setIsValid(isValidField(input, form));
4686
4711
  return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
4687
4712
  /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
4688
4713
  /* @__PURE__ */ jsx(FormControl, { className: "shadow-lg", children: /* @__PURE__ */ jsxs(InputGroup, { children: [
@@ -4707,6 +4732,7 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
4707
4732
  }
4708
4733
  handleOnChage(value, input, field);
4709
4734
  field.onChange(value);
4735
+ isValidField(input, form);
4710
4736
  }
4711
4737
  }
4712
4738
  ),
@@ -5784,10 +5810,10 @@ var FieldText = ({ input, form, isSubmitting }) => {
5784
5810
  var TimeInput = class extends BaseInput {
5785
5811
  render() {
5786
5812
  const { input, form, isSubmitting } = this;
5787
- return /* @__PURE__ */ jsx(FieldTimeInput, { input, form, isSubmitting });
5813
+ return /* @__PURE__ */ jsx(FieldTimeInput2, { input, form, isSubmitting });
5788
5814
  }
5789
5815
  };
5790
- var FieldTimeInput = ({ form, input, isSubmitting }) => {
5816
+ var FieldTimeInput2 = ({ form, input, isSubmitting }) => {
5791
5817
  const groupConfig = input.inputGroupConfig;
5792
5818
  const autoValidate = groupConfig?.autoValidIcons;
5793
5819
  const iconValidState = /* @__PURE__ */ jsx(CircleCheck, { style: { color: "#00bf3e" } });
@@ -5895,6 +5921,7 @@ var inputMap = {
5895
5921
  };
5896
5922
  var InputFactory = class {
5897
5923
  static create(input, form, isSubmitting = false) {
5924
+ input.form = form;
5898
5925
  const inputType = input.inputType ?? "text" /* TEXT */;
5899
5926
  const InputClass = inputMap[inputType] ?? TextInput;
5900
5927
  const instance = new InputClass(input, form, isSubmitting);
@@ -6075,7 +6102,7 @@ var DynamicForm = ({
6075
6102
  });
6076
6103
  useEffect(() => {
6077
6104
  form.reset(initialValues);
6078
- }, [initialValues, form]);
6105
+ }, []);
6079
6106
  const handleSubmit = (data) => {
6080
6107
  if (readOnly) return;
6081
6108
  startTransition(() => {
@@ -6472,6 +6499,6 @@ var GenericFilter = ({
6472
6499
  ) }) });
6473
6500
  };
6474
6501
 
6475
- 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, 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, mockFields, useFormField, validationMessages };
6502
+ 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 };
6476
6503
  //# sourceMappingURL=index.mjs.map
6477
6504
  //# sourceMappingURL=index.mjs.map