shadcn-zod-formkit 1.28.0 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +91 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.mjs +91 -65
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-1.29.0.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-1.28.0.tgz +0 -0
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
|
@@ -4743,21 +4743,7 @@ var TextInputGroup = class extends BaseInput {
|
|
|
4743
4743
|
}
|
|
4744
4744
|
};
|
|
4745
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
4746
|
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
4747
|
const formField = /* @__PURE__ */ jsx(
|
|
4762
4748
|
FormField,
|
|
4763
4749
|
{
|
|
@@ -4767,51 +4753,13 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
4767
4753
|
setIsValid(isValidField(input, form));
|
|
4768
4754
|
return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
|
|
4769
4755
|
/* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
|
|
4770
|
-
/* @__PURE__ */ jsx(FormControl, { className: "shadow-lg", children:
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
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
|
-
] }) }),
|
|
4756
|
+
/* @__PURE__ */ jsx(FormControl, { className: "shadow-lg", children: CustomInputGroup({
|
|
4757
|
+
input,
|
|
4758
|
+
isSubmitting,
|
|
4759
|
+
field,
|
|
4760
|
+
form,
|
|
4761
|
+
isValid: isValid2
|
|
4762
|
+
}) }),
|
|
4815
4763
|
input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
|
|
4816
4764
|
/* @__PURE__ */ jsx(FormMessage, {})
|
|
4817
4765
|
] });
|
|
@@ -4821,6 +4769,78 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
4821
4769
|
);
|
|
4822
4770
|
return /* @__PURE__ */ jsx(Fragment, { children: formField });
|
|
4823
4771
|
};
|
|
4772
|
+
var CustomInputGroup = ({
|
|
4773
|
+
value,
|
|
4774
|
+
input,
|
|
4775
|
+
field,
|
|
4776
|
+
form,
|
|
4777
|
+
isSubmitting,
|
|
4778
|
+
onChange,
|
|
4779
|
+
isValid: isValid2
|
|
4780
|
+
}) => {
|
|
4781
|
+
const groupConfig = input.inputGroupConfig;
|
|
4782
|
+
const infoTooltip = input?.infoTooltip;
|
|
4783
|
+
const autoValidate = groupConfig?.autoValidIcons ?? input.zodType ? true : false;
|
|
4784
|
+
const iconValidState = /* @__PURE__ */ jsx(CircleCheck, { style: { color: "#00bf3e" } });
|
|
4785
|
+
const iconInvalidState = /* @__PURE__ */ jsx(CircleX, { style: { color: "#ff8080" } });
|
|
4786
|
+
const iconLoadingState = /* @__PURE__ */ jsx(Loader2, { className: "animate-spin", style: { color: "#1e90ff" } });
|
|
4787
|
+
const iconsRight = groupConfig?.iconsRight ?? [];
|
|
4788
|
+
const iconsLeft = groupConfig?.iconsLeft ?? [];
|
|
4789
|
+
const textLeft = groupConfig?.textLeft;
|
|
4790
|
+
const textRight = groupConfig?.textRight;
|
|
4791
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
4792
|
+
const isPasswordField = input.keyboardType === "password" /* PASSWORD */;
|
|
4793
|
+
const isNumberField = input.keyboardType === "number" /* NUMBER */;
|
|
4794
|
+
const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField;
|
|
4795
|
+
return /* @__PURE__ */ jsxs(InputGroup, { children: [
|
|
4796
|
+
(iconsLeft.length > 0 || textLeft) && /* @__PURE__ */ jsxs(InputGroupAddon, { children: [
|
|
4797
|
+
textLeft && /* @__PURE__ */ jsx(InputGroupText, { children: textLeft }),
|
|
4798
|
+
iconsLeft.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 20 }, index))
|
|
4799
|
+
] }),
|
|
4800
|
+
/* @__PURE__ */ jsx(
|
|
4801
|
+
InputGroupInput,
|
|
4802
|
+
{
|
|
4803
|
+
placeholder: input.placeHolder,
|
|
4804
|
+
disabled: input.disabled || isSubmitting,
|
|
4805
|
+
onBlur: field?.onBlur,
|
|
4806
|
+
name: field?.name,
|
|
4807
|
+
ref: field?.ref,
|
|
4808
|
+
type: isPasswordField && !showPassword ? "password" : isNumberField ? "number" : "text",
|
|
4809
|
+
value: field?.value ?? value ?? "",
|
|
4810
|
+
onChange: (e) => {
|
|
4811
|
+
if (onChange) {
|
|
4812
|
+
onChange(e);
|
|
4813
|
+
}
|
|
4814
|
+
let value2 = e.target.value;
|
|
4815
|
+
if (isNumberField) {
|
|
4816
|
+
value2 = e.target.value === "" ? "" : Number(e.target.value);
|
|
4817
|
+
}
|
|
4818
|
+
field?.onChange(value2);
|
|
4819
|
+
isValidField(input, form);
|
|
4820
|
+
handleOnChage(value2, input, field);
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4823
|
+
),
|
|
4824
|
+
showInputGroupAddons && /* @__PURE__ */ jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
4825
|
+
infoTooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4826
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Info, { size: 20 }) }),
|
|
4827
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: infoTooltip }) })
|
|
4828
|
+
] }),
|
|
4829
|
+
textRight && /* @__PURE__ */ jsx(InputGroupText, { children: textRight }),
|
|
4830
|
+
iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 20 }, index)),
|
|
4831
|
+
isPasswordField && /* @__PURE__ */ jsx(
|
|
4832
|
+
"button",
|
|
4833
|
+
{
|
|
4834
|
+
type: "button",
|
|
4835
|
+
onClick: () => setShowPassword(!showPassword),
|
|
4836
|
+
className: "p-1",
|
|
4837
|
+
children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { size: 20 }) : /* @__PURE__ */ jsx(Eye, { size: 20 })
|
|
4838
|
+
}
|
|
4839
|
+
),
|
|
4840
|
+
autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
|
|
4841
|
+
] })
|
|
4842
|
+
] });
|
|
4843
|
+
};
|
|
4824
4844
|
var NumberInput = class extends BaseInput {
|
|
4825
4845
|
render() {
|
|
4826
4846
|
const { input, form, isSubmitting } = this;
|
|
@@ -5570,6 +5590,10 @@ var StringValueListInput = class extends BaseInput {
|
|
|
5570
5590
|
var FieldStringValueList = ({ form, input, isSubmitting }) => {
|
|
5571
5591
|
const fieldName = input.name;
|
|
5572
5592
|
const withAddBtn = input.withAddBtn ?? false;
|
|
5593
|
+
const [isValid2, setIsValid] = useState(isValidField(input, form));
|
|
5594
|
+
useEffect(() => {
|
|
5595
|
+
setIsValid(isValidField(input, form));
|
|
5596
|
+
}, [input]);
|
|
5573
5597
|
useEffect(() => {
|
|
5574
5598
|
const current = form.getValues(fieldName);
|
|
5575
5599
|
if (!Array.isArray(current)) {
|
|
@@ -5597,7 +5621,7 @@ var FieldStringValueList = ({ form, input, isSubmitting }) => {
|
|
|
5597
5621
|
{
|
|
5598
5622
|
control: form.control,
|
|
5599
5623
|
name: fieldName,
|
|
5600
|
-
render: () => {
|
|
5624
|
+
render: (field) => {
|
|
5601
5625
|
const items = form.watch(fieldName) || [];
|
|
5602
5626
|
return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
|
|
5603
5627
|
/* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
|
|
@@ -5610,12 +5634,14 @@ var FieldStringValueList = ({ form, input, isSubmitting }) => {
|
|
|
5610
5634
|
className: "flex items-center gap-4 py-2",
|
|
5611
5635
|
children: [
|
|
5612
5636
|
/* @__PURE__ */ jsx(
|
|
5613
|
-
|
|
5637
|
+
CustomInputGroup,
|
|
5614
5638
|
{
|
|
5615
|
-
|
|
5639
|
+
autoValidate: true,
|
|
5616
5640
|
value,
|
|
5617
|
-
|
|
5618
|
-
|
|
5641
|
+
input,
|
|
5642
|
+
isValid: isValid2,
|
|
5643
|
+
onChange: (e) => handleChange(index, e.target.value),
|
|
5644
|
+
form
|
|
5619
5645
|
}
|
|
5620
5646
|
),
|
|
5621
5647
|
input.isRemovebleOption && /* @__PURE__ */ jsx(
|
|
@@ -6559,6 +6585,6 @@ var GenericFilter = ({
|
|
|
6559
6585
|
) }) });
|
|
6560
6586
|
};
|
|
6561
6587
|
|
|
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 };
|
|
6588
|
+
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
6589
|
//# sourceMappingURL=index.mjs.map
|
|
6564
6590
|
//# sourceMappingURL=index.mjs.map
|