shadcn-zod-formkit 3.0.2 → 3.2.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 +124 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +50 -4
- package/dist/index.d.ts +50 -4
- package/dist/index.mjs +124 -7
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-3.2.0.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-3.0.2.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, Dispatch, SetStateAction, ChangeEventHandler } from 'react';
|
|
3
|
+
import React__default, { 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';
|
|
@@ -118,6 +118,8 @@ interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
|
|
|
118
118
|
placeHolder?: string;
|
|
119
119
|
description?: string;
|
|
120
120
|
className?: string;
|
|
121
|
+
classNameInput?: string;
|
|
122
|
+
classNameGroupInput?: string;
|
|
121
123
|
inputType?: InputTypes;
|
|
122
124
|
keyboardType?: TextInputType;
|
|
123
125
|
disabled?: boolean;
|
|
@@ -149,7 +151,19 @@ interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
|
|
|
149
151
|
accept: string;
|
|
150
152
|
multiple: boolean;
|
|
151
153
|
maxSize: number;
|
|
154
|
+
dragAndDrop?: boolean;
|
|
155
|
+
progressBar?: boolean;
|
|
156
|
+
uploadUrl?: string;
|
|
157
|
+
onUploadProgress?: (progress: number) => void;
|
|
158
|
+
onUploadComplete?: (response: any) => void;
|
|
159
|
+
previewFormats?: {
|
|
160
|
+
image?: boolean;
|
|
161
|
+
video?: boolean;
|
|
162
|
+
audio?: boolean;
|
|
163
|
+
pdf?: boolean;
|
|
164
|
+
};
|
|
152
165
|
};
|
|
166
|
+
transform?: 'uppercase' | 'lowercase' | 'capitalize' | 'trim' | ((value: any) => any);
|
|
153
167
|
inputGroupConfig?: inputGroudConfig;
|
|
154
168
|
helpText?: string;
|
|
155
169
|
helpLink?: string;
|
|
@@ -176,6 +190,32 @@ interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
|
|
|
176
190
|
ariaLabel?: string;
|
|
177
191
|
ariaDescribedBy?: string;
|
|
178
192
|
ariaRequired?: boolean;
|
|
193
|
+
autoComplete?: string;
|
|
194
|
+
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
|
|
195
|
+
spellCheck?: boolean;
|
|
196
|
+
inputNumberConfig?: inputNumberConfig;
|
|
197
|
+
inputDateConfig?: inputDateConfig;
|
|
198
|
+
}
|
|
199
|
+
interface inputDateConfig {
|
|
200
|
+
minDate?: Date;
|
|
201
|
+
maxDate?: Date;
|
|
202
|
+
disabledDates?: Date[];
|
|
203
|
+
format?: string;
|
|
204
|
+
showWeekNumbers?: boolean;
|
|
205
|
+
firstDayOfWeek?: number;
|
|
206
|
+
}
|
|
207
|
+
interface inputNumberConfig {
|
|
208
|
+
allowDecimals?: boolean;
|
|
209
|
+
decimalPlaces?: number;
|
|
210
|
+
thousandsSeparator?: string;
|
|
211
|
+
decimalSeparator?: string;
|
|
212
|
+
prefix?: string;
|
|
213
|
+
suffix?: string;
|
|
214
|
+
allowNegative?: boolean;
|
|
215
|
+
min?: number;
|
|
216
|
+
max?: number;
|
|
217
|
+
step?: number;
|
|
218
|
+
formatOnInput?: boolean;
|
|
179
219
|
}
|
|
180
220
|
interface inputGroudConfig {
|
|
181
221
|
autoValidIcons?: boolean;
|
|
@@ -183,6 +223,10 @@ interface inputGroudConfig {
|
|
|
183
223
|
iconsRight?: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>[];
|
|
184
224
|
textLeft?: string;
|
|
185
225
|
textRight?: string;
|
|
226
|
+
transform?: 'uppercase' | 'lowercase' | 'capitalize';
|
|
227
|
+
debounceMs?: number;
|
|
228
|
+
copyButton?: boolean;
|
|
229
|
+
clearButton?: boolean;
|
|
186
230
|
}
|
|
187
231
|
interface ListConfig {
|
|
188
232
|
children?: ReactNode | ((item: any, index: number) => ReactNode);
|
|
@@ -285,11 +329,12 @@ interface Props$i<T extends Record<string, any>> {
|
|
|
285
329
|
childrenHeader?: ReactNode;
|
|
286
330
|
listBtnConfig?: BtnConfig[];
|
|
287
331
|
debug?: boolean;
|
|
332
|
+
submitBtnIcon?: React__default.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
|
|
288
333
|
isWrapInWizard?: boolean;
|
|
289
334
|
currentStep?: number;
|
|
290
335
|
totalSteps?: number;
|
|
291
336
|
}
|
|
292
|
-
declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onAnyFieldChange, onSubmit, onClick, extraValidations, children, childrenHeader, showIcon, showFormHeader, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, listBtnConfig, submitBtnLabel, submitBtnLabelSubmiting, withFormWrapper, btnGroupDirection, withSubmitBtn, debug, isWrapInWizard, totalSteps, currentStep, }: Props$i<T>) => react_jsx_runtime.JSX.Element;
|
|
337
|
+
declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onAnyFieldChange, onSubmit, onClick, extraValidations, children, childrenHeader, showIcon, showFormHeader, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, listBtnConfig, submitBtnLabel, submitBtnLabelSubmiting, withFormWrapper, btnGroupDirection, withSubmitBtn, debug, isWrapInWizard, totalSteps, currentStep, submitBtnIcon }: Props$i<T>) => react_jsx_runtime.JSX.Element;
|
|
293
338
|
|
|
294
339
|
interface WizardRenderProps<T> {
|
|
295
340
|
stepFields: FieldProps<T>[];
|
|
@@ -552,11 +597,12 @@ interface customInputGroup {
|
|
|
552
597
|
form: UseFormReturn;
|
|
553
598
|
isSubmitting?: boolean;
|
|
554
599
|
isValid?: boolean;
|
|
600
|
+
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
|
|
555
601
|
setShowPassword?: Dispatch<SetStateAction<boolean>>;
|
|
556
602
|
autoValidate?: boolean;
|
|
557
603
|
onChange?: ChangeEventHandler<HTMLInputElement> | undefined;
|
|
558
604
|
}
|
|
559
|
-
declare const CustomInputGroup: ({ value, input, field, form, isSubmitting, onChange, isValid }: customInputGroup) => react_jsx_runtime.JSX.Element;
|
|
605
|
+
declare const CustomInputGroup: ({ value, input, field, form, isSubmitting, onChange, isValid, autoCapitalize, }: customInputGroup) => react_jsx_runtime.JSX.Element;
|
|
560
606
|
|
|
561
607
|
declare class TextInput extends BaseInput {
|
|
562
608
|
render(): JSX.Element;
|
|
@@ -867,4 +913,4 @@ declare function useFormPersist({ form, storageKey, storage, debounceMs, exclude
|
|
|
867
913
|
clearSavedData: () => void;
|
|
868
914
|
};
|
|
869
915
|
|
|
870
|
-
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, WizardForm, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, isValidField, mockFields, useDynamicForm, useFormField, useFormPersist, validationMessages };
|
|
916
|
+
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, WizardForm, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, type inputNumberConfig, isValidField, mockFields, useDynamicForm, useFormField, useFormPersist, 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, Dispatch, SetStateAction, ChangeEventHandler } from 'react';
|
|
3
|
+
import React__default, { 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';
|
|
@@ -118,6 +118,8 @@ interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
|
|
|
118
118
|
placeHolder?: string;
|
|
119
119
|
description?: string;
|
|
120
120
|
className?: string;
|
|
121
|
+
classNameInput?: string;
|
|
122
|
+
classNameGroupInput?: string;
|
|
121
123
|
inputType?: InputTypes;
|
|
122
124
|
keyboardType?: TextInputType;
|
|
123
125
|
disabled?: boolean;
|
|
@@ -149,7 +151,19 @@ interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
|
|
|
149
151
|
accept: string;
|
|
150
152
|
multiple: boolean;
|
|
151
153
|
maxSize: number;
|
|
154
|
+
dragAndDrop?: boolean;
|
|
155
|
+
progressBar?: boolean;
|
|
156
|
+
uploadUrl?: string;
|
|
157
|
+
onUploadProgress?: (progress: number) => void;
|
|
158
|
+
onUploadComplete?: (response: any) => void;
|
|
159
|
+
previewFormats?: {
|
|
160
|
+
image?: boolean;
|
|
161
|
+
video?: boolean;
|
|
162
|
+
audio?: boolean;
|
|
163
|
+
pdf?: boolean;
|
|
164
|
+
};
|
|
152
165
|
};
|
|
166
|
+
transform?: 'uppercase' | 'lowercase' | 'capitalize' | 'trim' | ((value: any) => any);
|
|
153
167
|
inputGroupConfig?: inputGroudConfig;
|
|
154
168
|
helpText?: string;
|
|
155
169
|
helpLink?: string;
|
|
@@ -176,6 +190,32 @@ interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
|
|
|
176
190
|
ariaLabel?: string;
|
|
177
191
|
ariaDescribedBy?: string;
|
|
178
192
|
ariaRequired?: boolean;
|
|
193
|
+
autoComplete?: string;
|
|
194
|
+
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
|
|
195
|
+
spellCheck?: boolean;
|
|
196
|
+
inputNumberConfig?: inputNumberConfig;
|
|
197
|
+
inputDateConfig?: inputDateConfig;
|
|
198
|
+
}
|
|
199
|
+
interface inputDateConfig {
|
|
200
|
+
minDate?: Date;
|
|
201
|
+
maxDate?: Date;
|
|
202
|
+
disabledDates?: Date[];
|
|
203
|
+
format?: string;
|
|
204
|
+
showWeekNumbers?: boolean;
|
|
205
|
+
firstDayOfWeek?: number;
|
|
206
|
+
}
|
|
207
|
+
interface inputNumberConfig {
|
|
208
|
+
allowDecimals?: boolean;
|
|
209
|
+
decimalPlaces?: number;
|
|
210
|
+
thousandsSeparator?: string;
|
|
211
|
+
decimalSeparator?: string;
|
|
212
|
+
prefix?: string;
|
|
213
|
+
suffix?: string;
|
|
214
|
+
allowNegative?: boolean;
|
|
215
|
+
min?: number;
|
|
216
|
+
max?: number;
|
|
217
|
+
step?: number;
|
|
218
|
+
formatOnInput?: boolean;
|
|
179
219
|
}
|
|
180
220
|
interface inputGroudConfig {
|
|
181
221
|
autoValidIcons?: boolean;
|
|
@@ -183,6 +223,10 @@ interface inputGroudConfig {
|
|
|
183
223
|
iconsRight?: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>[];
|
|
184
224
|
textLeft?: string;
|
|
185
225
|
textRight?: string;
|
|
226
|
+
transform?: 'uppercase' | 'lowercase' | 'capitalize';
|
|
227
|
+
debounceMs?: number;
|
|
228
|
+
copyButton?: boolean;
|
|
229
|
+
clearButton?: boolean;
|
|
186
230
|
}
|
|
187
231
|
interface ListConfig {
|
|
188
232
|
children?: ReactNode | ((item: any, index: number) => ReactNode);
|
|
@@ -285,11 +329,12 @@ interface Props$i<T extends Record<string, any>> {
|
|
|
285
329
|
childrenHeader?: ReactNode;
|
|
286
330
|
listBtnConfig?: BtnConfig[];
|
|
287
331
|
debug?: boolean;
|
|
332
|
+
submitBtnIcon?: React__default.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
|
|
288
333
|
isWrapInWizard?: boolean;
|
|
289
334
|
currentStep?: number;
|
|
290
335
|
totalSteps?: number;
|
|
291
336
|
}
|
|
292
|
-
declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onAnyFieldChange, onSubmit, onClick, extraValidations, children, childrenHeader, showIcon, showFormHeader, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, listBtnConfig, submitBtnLabel, submitBtnLabelSubmiting, withFormWrapper, btnGroupDirection, withSubmitBtn, debug, isWrapInWizard, totalSteps, currentStep, }: Props$i<T>) => react_jsx_runtime.JSX.Element;
|
|
337
|
+
declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onAnyFieldChange, onSubmit, onClick, extraValidations, children, childrenHeader, showIcon, showFormHeader, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, listBtnConfig, submitBtnLabel, submitBtnLabelSubmiting, withFormWrapper, btnGroupDirection, withSubmitBtn, debug, isWrapInWizard, totalSteps, currentStep, submitBtnIcon }: Props$i<T>) => react_jsx_runtime.JSX.Element;
|
|
293
338
|
|
|
294
339
|
interface WizardRenderProps<T> {
|
|
295
340
|
stepFields: FieldProps<T>[];
|
|
@@ -552,11 +597,12 @@ interface customInputGroup {
|
|
|
552
597
|
form: UseFormReturn;
|
|
553
598
|
isSubmitting?: boolean;
|
|
554
599
|
isValid?: boolean;
|
|
600
|
+
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
|
|
555
601
|
setShowPassword?: Dispatch<SetStateAction<boolean>>;
|
|
556
602
|
autoValidate?: boolean;
|
|
557
603
|
onChange?: ChangeEventHandler<HTMLInputElement> | undefined;
|
|
558
604
|
}
|
|
559
|
-
declare const CustomInputGroup: ({ value, input, field, form, isSubmitting, onChange, isValid }: customInputGroup) => react_jsx_runtime.JSX.Element;
|
|
605
|
+
declare const CustomInputGroup: ({ value, input, field, form, isSubmitting, onChange, isValid, autoCapitalize, }: customInputGroup) => react_jsx_runtime.JSX.Element;
|
|
560
606
|
|
|
561
607
|
declare class TextInput extends BaseInput {
|
|
562
608
|
render(): JSX.Element;
|
|
@@ -867,4 +913,4 @@ declare function useFormPersist({ form, storageKey, storage, debounceMs, exclude
|
|
|
867
913
|
clearSavedData: () => void;
|
|
868
914
|
};
|
|
869
915
|
|
|
870
|
-
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, WizardForm, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, isValidField, mockFields, useDynamicForm, useFormField, useFormPersist, validationMessages };
|
|
916
|
+
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, WizardForm, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, type inputNumberConfig, isValidField, mockFields, useDynamicForm, useFormField, useFormPersist, validationMessages };
|
package/dist/index.mjs
CHANGED
|
@@ -12726,7 +12726,8 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
12726
12726
|
isSubmitting,
|
|
12727
12727
|
field,
|
|
12728
12728
|
form,
|
|
12729
|
-
isValid
|
|
12729
|
+
isValid,
|
|
12730
|
+
autoCapitalize: input.autoCapitalize
|
|
12730
12731
|
}) }),
|
|
12731
12732
|
input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
|
|
12732
12733
|
/* @__PURE__ */ jsx(FormMessage, {})
|
|
@@ -12744,7 +12745,8 @@ var CustomInputGroup = ({
|
|
|
12744
12745
|
form,
|
|
12745
12746
|
isSubmitting,
|
|
12746
12747
|
onChange,
|
|
12747
|
-
isValid
|
|
12748
|
+
isValid,
|
|
12749
|
+
autoCapitalize = "none"
|
|
12748
12750
|
}) => {
|
|
12749
12751
|
const groupConfig = input.inputGroupConfig;
|
|
12750
12752
|
const infoTooltip = input?.infoTooltip;
|
|
@@ -12760,7 +12762,64 @@ var CustomInputGroup = ({
|
|
|
12760
12762
|
const isPasswordField = input.keyboardType === "password" /* PASSWORD */;
|
|
12761
12763
|
const isNumberField = input.keyboardType === "number" /* NUMBER */;
|
|
12762
12764
|
const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField;
|
|
12763
|
-
|
|
12765
|
+
const applyMask = (value2, mask) => {
|
|
12766
|
+
if (!mask) return value2;
|
|
12767
|
+
if (typeof mask === "string") {
|
|
12768
|
+
let result = "";
|
|
12769
|
+
let valueIndex = 0;
|
|
12770
|
+
for (let i = 0; i < mask.length && valueIndex < value2.length; i++) {
|
|
12771
|
+
if (mask[i] === "#") {
|
|
12772
|
+
result += value2[valueIndex++];
|
|
12773
|
+
} else {
|
|
12774
|
+
result += mask[i];
|
|
12775
|
+
}
|
|
12776
|
+
}
|
|
12777
|
+
return result;
|
|
12778
|
+
} else if (mask instanceof RegExp) {
|
|
12779
|
+
const matches = value2.match(mask);
|
|
12780
|
+
return matches ? matches.join("") : value2;
|
|
12781
|
+
}
|
|
12782
|
+
return value2;
|
|
12783
|
+
};
|
|
12784
|
+
const formatNumber = (value2, config) => {
|
|
12785
|
+
if (!config || value2 === "") return value2;
|
|
12786
|
+
let numValue = parseFloat(value2);
|
|
12787
|
+
if (isNaN(numValue)) return value2;
|
|
12788
|
+
if (config.min !== void 0 && numValue < config.min) return config.min.toString();
|
|
12789
|
+
if (config.max !== void 0 && numValue > config.max) return config.max.toString();
|
|
12790
|
+
if (!config.allowDecimals) numValue = Math.floor(numValue);
|
|
12791
|
+
const options = {
|
|
12792
|
+
minimumFractionDigits: config.allowDecimals ? config.decimalPlaces || 2 : 0,
|
|
12793
|
+
maximumFractionDigits: config.allowDecimals ? config.decimalPlaces || 2 : 0
|
|
12794
|
+
};
|
|
12795
|
+
let formatted = numValue.toLocaleString("en-US", options);
|
|
12796
|
+
if (config.thousandsSeparator) {
|
|
12797
|
+
formatted = formatted.replace(/,/g, config.thousandsSeparator);
|
|
12798
|
+
}
|
|
12799
|
+
if (config.decimalSeparator && config.decimalSeparator !== ".") {
|
|
12800
|
+
formatted = formatted.replace(".", config.decimalSeparator);
|
|
12801
|
+
}
|
|
12802
|
+
return `${config.prefix || ""}${formatted}${config.suffix || ""}`;
|
|
12803
|
+
};
|
|
12804
|
+
const applyTransform = (value2, transform) => {
|
|
12805
|
+
if (!transform) return value2;
|
|
12806
|
+
if (typeof transform === "function") {
|
|
12807
|
+
return transform(value2);
|
|
12808
|
+
}
|
|
12809
|
+
switch (transform) {
|
|
12810
|
+
case "uppercase":
|
|
12811
|
+
return value2.toUpperCase();
|
|
12812
|
+
case "lowercase":
|
|
12813
|
+
return value2.toLowerCase();
|
|
12814
|
+
case "capitalize":
|
|
12815
|
+
return value2.charAt(0).toUpperCase() + value2.slice(1).toLowerCase();
|
|
12816
|
+
case "trim":
|
|
12817
|
+
return value2.trim();
|
|
12818
|
+
default:
|
|
12819
|
+
return value2;
|
|
12820
|
+
}
|
|
12821
|
+
};
|
|
12822
|
+
return /* @__PURE__ */ jsxs(InputGroup, { className: input.classNameGroupInput ?? "h-10", children: [
|
|
12764
12823
|
(iconsLeft.length > 0 || textLeft) && /* @__PURE__ */ jsxs(InputGroupAddon, { children: [
|
|
12765
12824
|
textLeft && /* @__PURE__ */ jsx(InputGroupText, { children: textLeft }),
|
|
12766
12825
|
iconsLeft.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 20 }, index))
|
|
@@ -12768,6 +12827,7 @@ var CustomInputGroup = ({
|
|
|
12768
12827
|
/* @__PURE__ */ jsx(
|
|
12769
12828
|
InputGroupInput,
|
|
12770
12829
|
{
|
|
12830
|
+
className: input.classNameInput ?? "h-full text-xl font-semibold",
|
|
12771
12831
|
placeholder: input.placeHolder,
|
|
12772
12832
|
disabled: input.disabled || isSubmitting,
|
|
12773
12833
|
onBlur: field?.onBlur,
|
|
@@ -12781,7 +12841,18 @@ var CustomInputGroup = ({
|
|
|
12781
12841
|
}
|
|
12782
12842
|
let value2 = e.target.value;
|
|
12783
12843
|
if (isNumberField) {
|
|
12784
|
-
|
|
12844
|
+
const numConfig = input.inputNumberConfig;
|
|
12845
|
+
const cleanValue = value2.replace(/[^\d.-]/g, "");
|
|
12846
|
+
const numValue = cleanValue === "" ? "" : Number(cleanValue);
|
|
12847
|
+
if (numConfig?.formatOnInput) {
|
|
12848
|
+
value2 = formatNumber(cleanValue, numConfig);
|
|
12849
|
+
} else {
|
|
12850
|
+
value2 = numValue;
|
|
12851
|
+
}
|
|
12852
|
+
} else {
|
|
12853
|
+
let processedValue = e.target.value;
|
|
12854
|
+
processedValue = applyMask(processedValue, input.mask);
|
|
12855
|
+
value2 = applyTransform(processedValue, input.transform);
|
|
12785
12856
|
}
|
|
12786
12857
|
field?.onChange(value2);
|
|
12787
12858
|
isValidField(input, form);
|
|
@@ -14060,6 +14131,44 @@ var TextInput = class extends BaseInput {
|
|
|
14060
14131
|
var FieldText = ({ input, form, isSubmitting }) => {
|
|
14061
14132
|
const hidden = input.hidden ?? input.inputType === "hidden" /* HIDDEN */;
|
|
14062
14133
|
const type = hidden ? "hidden" : input.keyboardType || "text";
|
|
14134
|
+
const applyMask = (value, mask) => {
|
|
14135
|
+
if (!mask) return value;
|
|
14136
|
+
if (typeof mask === "string") {
|
|
14137
|
+
let result = "";
|
|
14138
|
+
let valueIndex = 0;
|
|
14139
|
+
for (let i = 0; i < mask.length && valueIndex < value.length; i++) {
|
|
14140
|
+
if (mask[i] === "#") {
|
|
14141
|
+
result += value[valueIndex++];
|
|
14142
|
+
} else {
|
|
14143
|
+
result += mask[i];
|
|
14144
|
+
}
|
|
14145
|
+
}
|
|
14146
|
+
return result;
|
|
14147
|
+
} else if (mask instanceof RegExp) {
|
|
14148
|
+
const matches = value.match(mask);
|
|
14149
|
+
return matches ? matches.join("") : value;
|
|
14150
|
+
}
|
|
14151
|
+
return value;
|
|
14152
|
+
};
|
|
14153
|
+
const applyTransform = (value) => {
|
|
14154
|
+
input.inputGroupConfig?.transform || input.transform;
|
|
14155
|
+
if (!input.inputGroupConfig?.transform) return value;
|
|
14156
|
+
if (typeof input.transform === "function") {
|
|
14157
|
+
return input.transform(value);
|
|
14158
|
+
}
|
|
14159
|
+
switch (input.transform) {
|
|
14160
|
+
case "uppercase":
|
|
14161
|
+
return value.toUpperCase();
|
|
14162
|
+
case "lowercase":
|
|
14163
|
+
return value.toLowerCase();
|
|
14164
|
+
case "capitalize":
|
|
14165
|
+
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
|
|
14166
|
+
case "trim":
|
|
14167
|
+
return value.trim();
|
|
14168
|
+
default:
|
|
14169
|
+
return value;
|
|
14170
|
+
}
|
|
14171
|
+
};
|
|
14063
14172
|
return /* @__PURE__ */ jsx(
|
|
14064
14173
|
FormField,
|
|
14065
14174
|
{
|
|
@@ -14071,10 +14180,17 @@ var FieldText = ({ input, form, isSubmitting }) => {
|
|
|
14071
14180
|
Input,
|
|
14072
14181
|
{
|
|
14073
14182
|
className: "min-w-[180px]",
|
|
14183
|
+
autoCapitalize: input.autoCapitalize,
|
|
14074
14184
|
placeholder: input.placeHolder,
|
|
14075
14185
|
...field,
|
|
14076
14186
|
type,
|
|
14077
|
-
onChange: (e) =>
|
|
14187
|
+
onChange: (e) => {
|
|
14188
|
+
let processedValue = e.target.value;
|
|
14189
|
+
processedValue = applyMask(processedValue, input.mask);
|
|
14190
|
+
const transformedValue = applyTransform(processedValue);
|
|
14191
|
+
field.onChange(transformedValue);
|
|
14192
|
+
handleOnChage(e, input, field);
|
|
14193
|
+
},
|
|
14078
14194
|
disabled: input.disabled || isSubmitting
|
|
14079
14195
|
}
|
|
14080
14196
|
) }),
|
|
@@ -15191,7 +15307,8 @@ var DynamicForm = ({
|
|
|
15191
15307
|
debug = false,
|
|
15192
15308
|
isWrapInWizard = false,
|
|
15193
15309
|
totalSteps = 0,
|
|
15194
|
-
currentStep = 1
|
|
15310
|
+
currentStep = 1,
|
|
15311
|
+
submitBtnIcon = Save
|
|
15195
15312
|
}) => {
|
|
15196
15313
|
const [isPending, startTransition] = useTransition();
|
|
15197
15314
|
const schema = useMemo(() => {
|
|
@@ -15266,7 +15383,7 @@ var DynamicForm = ({
|
|
|
15266
15383
|
/* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 mr-2 animate-spin" })
|
|
15267
15384
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15268
15385
|
submitBtnLabel,
|
|
15269
|
-
(totalSteps == 0 || totalSteps == currentStep) &&
|
|
15386
|
+
(totalSteps == 0 || totalSteps == currentStep) && submitBtnIcon && React3__default.createElement(submitBtnIcon, { className: "h-5 w-5 mr-2" })
|
|
15270
15387
|
] })
|
|
15271
15388
|
}
|
|
15272
15389
|
)
|