shadcn-zod-formkit 1.30.0 → 1.30.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.cjs +130 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.mjs +130 -8
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-1.30.1.tgz +0 -0
- package/package.json +4 -2
- package/dist/shadcn-zod-formkit-1.30.0.tgz +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -28,13 +28,13 @@ import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
|
28
28
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
29
29
|
import { ClassValue } from 'clsx';
|
|
30
30
|
|
|
31
|
-
interface Props$
|
|
31
|
+
interface Props$j {
|
|
32
32
|
title: string;
|
|
33
33
|
description: string | ReactNode;
|
|
34
34
|
className?: string;
|
|
35
35
|
variant?: "info" | "warning" | "error" | "success";
|
|
36
36
|
}
|
|
37
|
-
declare const CustomAlert: ({ title, description, className, variant, }: Props$
|
|
37
|
+
declare const CustomAlert: ({ title, description, className, variant, }: Props$j) => react_jsx_runtime.JSX.Element;
|
|
38
38
|
|
|
39
39
|
declare const validationMessages: {
|
|
40
40
|
required: string;
|
|
@@ -88,6 +88,7 @@ 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
|
+
step?: number;
|
|
91
92
|
withAddBtn?: boolean;
|
|
92
93
|
form?: UseFormReturn<any>;
|
|
93
94
|
isRemovebleOption?: boolean;
|
|
@@ -217,7 +218,7 @@ interface FormResp<T> {
|
|
|
217
218
|
form?: UseFormReturn<any>;
|
|
218
219
|
data: T;
|
|
219
220
|
}
|
|
220
|
-
interface Props$
|
|
221
|
+
interface Props$i<T extends Record<string, any>> {
|
|
221
222
|
showIcon?: boolean;
|
|
222
223
|
showFormHeader?: boolean;
|
|
223
224
|
formTitle: string;
|
|
@@ -242,7 +243,14 @@ interface Props$h<T extends Record<string, any>> {
|
|
|
242
243
|
childrenHeader?: ReactNode;
|
|
243
244
|
listBtnConfig?: BtnConfig[];
|
|
244
245
|
}
|
|
245
|
-
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 }: Props$
|
|
246
|
+
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 }: Props$i<T>) => react_jsx_runtime.JSX.Element;
|
|
247
|
+
|
|
248
|
+
interface Props$h<T> {
|
|
249
|
+
onSubmit?: (resp: FormResp<T>) => void;
|
|
250
|
+
fields: FieldConfig<T>[];
|
|
251
|
+
record: any;
|
|
252
|
+
}
|
|
253
|
+
declare const WizardForm: <T extends Record<string, any>>({ fields, record, onSubmit, }: Props$h<T>) => react_jsx_runtime.JSX.Element;
|
|
246
254
|
|
|
247
255
|
declare const DynamicFormExample: () => react_jsx_runtime.JSX.Element;
|
|
248
256
|
declare const mockFields: Array<FieldProps | FieldProps[]>;
|
|
@@ -751,4 +759,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
|
|
|
751
759
|
|
|
752
760
|
declare function cn(...inputs: ClassValue[]): string;
|
|
753
761
|
|
|
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 };
|
|
762
|
+
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, useFormField, validationMessages };
|
package/dist/index.d.ts
CHANGED
|
@@ -28,13 +28,13 @@ import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
|
28
28
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
29
29
|
import { ClassValue } from 'clsx';
|
|
30
30
|
|
|
31
|
-
interface Props$
|
|
31
|
+
interface Props$j {
|
|
32
32
|
title: string;
|
|
33
33
|
description: string | ReactNode;
|
|
34
34
|
className?: string;
|
|
35
35
|
variant?: "info" | "warning" | "error" | "success";
|
|
36
36
|
}
|
|
37
|
-
declare const CustomAlert: ({ title, description, className, variant, }: Props$
|
|
37
|
+
declare const CustomAlert: ({ title, description, className, variant, }: Props$j) => react_jsx_runtime.JSX.Element;
|
|
38
38
|
|
|
39
39
|
declare const validationMessages: {
|
|
40
40
|
required: string;
|
|
@@ -88,6 +88,7 @@ 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
|
+
step?: number;
|
|
91
92
|
withAddBtn?: boolean;
|
|
92
93
|
form?: UseFormReturn<any>;
|
|
93
94
|
isRemovebleOption?: boolean;
|
|
@@ -217,7 +218,7 @@ interface FormResp<T> {
|
|
|
217
218
|
form?: UseFormReturn<any>;
|
|
218
219
|
data: T;
|
|
219
220
|
}
|
|
220
|
-
interface Props$
|
|
221
|
+
interface Props$i<T extends Record<string, any>> {
|
|
221
222
|
showIcon?: boolean;
|
|
222
223
|
showFormHeader?: boolean;
|
|
223
224
|
formTitle: string;
|
|
@@ -242,7 +243,14 @@ interface Props$h<T extends Record<string, any>> {
|
|
|
242
243
|
childrenHeader?: ReactNode;
|
|
243
244
|
listBtnConfig?: BtnConfig[];
|
|
244
245
|
}
|
|
245
|
-
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 }: Props$
|
|
246
|
+
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 }: Props$i<T>) => react_jsx_runtime.JSX.Element;
|
|
247
|
+
|
|
248
|
+
interface Props$h<T> {
|
|
249
|
+
onSubmit?: (resp: FormResp<T>) => void;
|
|
250
|
+
fields: FieldConfig<T>[];
|
|
251
|
+
record: any;
|
|
252
|
+
}
|
|
253
|
+
declare const WizardForm: <T extends Record<string, any>>({ fields, record, onSubmit, }: Props$h<T>) => react_jsx_runtime.JSX.Element;
|
|
246
254
|
|
|
247
255
|
declare const DynamicFormExample: () => react_jsx_runtime.JSX.Element;
|
|
248
256
|
declare const mockFields: Array<FieldProps | FieldProps[]>;
|
|
@@ -751,4 +759,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
|
|
|
751
759
|
|
|
752
760
|
declare function cn(...inputs: ClassValue[]): string;
|
|
753
761
|
|
|
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 };
|
|
762
|
+
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, useFormField, validationMessages };
|
package/dist/index.mjs
CHANGED
|
@@ -2184,6 +2184,8 @@ var ColorInput = class extends BaseInput {
|
|
|
2184
2184
|
}
|
|
2185
2185
|
};
|
|
2186
2186
|
var PRESET_COLORS = [
|
|
2187
|
+
"#9A275A",
|
|
2188
|
+
// QuinaMagenta
|
|
2187
2189
|
"#800000",
|
|
2188
2190
|
// Maroon
|
|
2189
2191
|
"#ef4444",
|
|
@@ -2194,6 +2196,8 @@ var PRESET_COLORS = [
|
|
|
2194
2196
|
// yellow
|
|
2195
2197
|
"#22c55e",
|
|
2196
2198
|
// green
|
|
2199
|
+
"#99EDCC",
|
|
2200
|
+
// Aquamarine
|
|
2197
2201
|
"#00FF00",
|
|
2198
2202
|
// lime
|
|
2199
2203
|
"#00FFFF",
|
|
@@ -2212,10 +2216,12 @@ var PRESET_COLORS = [
|
|
|
2212
2216
|
// pink
|
|
2213
2217
|
"#64748b",
|
|
2214
2218
|
// slate
|
|
2219
|
+
"#000000",
|
|
2220
|
+
// black
|
|
2215
2221
|
"#808080",
|
|
2216
2222
|
// Gray
|
|
2217
|
-
"#
|
|
2218
|
-
//
|
|
2223
|
+
"#FFFFFF"
|
|
2224
|
+
// White
|
|
2219
2225
|
];
|
|
2220
2226
|
var FieldColor = ({ form, input, isSubmitting }) => {
|
|
2221
2227
|
const [ColorCmp, _setColorCmp] = useState(ColorComp);
|
|
@@ -2268,13 +2274,13 @@ var ColorComp = React3__default.forwardRef(
|
|
|
2268
2274
|
}
|
|
2269
2275
|
};
|
|
2270
2276
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
2271
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-
|
|
2277
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2 p-2", children: PRESET_COLORS.map((presetColor) => /* @__PURE__ */ jsx(
|
|
2272
2278
|
"button",
|
|
2273
2279
|
{
|
|
2274
2280
|
type: "button",
|
|
2275
2281
|
disabled,
|
|
2276
2282
|
className: cn(
|
|
2277
|
-
"size-
|
|
2283
|
+
"flex-1 size-4 shadow-lg rounded-md border-2 border-black transition-all hover:scale-110 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2278
2284
|
color.hex === presetColor ? "border-foreground ring-2 ring-foreground/20" : "border-border hover:border-foreground/50"
|
|
2279
2285
|
),
|
|
2280
2286
|
style: { backgroundColor: presetColor },
|
|
@@ -4715,7 +4721,7 @@ var FieldKeyValueList = ({ form, input, isSubmitting }) => {
|
|
|
4715
4721
|
] }),
|
|
4716
4722
|
/* @__PURE__ */ jsxs(ButtonGroup, { className: "w-full", children: [
|
|
4717
4723
|
/* @__PURE__ */ jsx(ButtonGroupText, { asChild: true, children: /* @__PURE__ */ jsx(Label$1, { htmlFor: "value", children: "Value" }) }),
|
|
4718
|
-
/* @__PURE__ */ jsx(
|
|
4724
|
+
/* @__PURE__ */ jsx(
|
|
4719
4725
|
CustomInputGroup,
|
|
4720
4726
|
{
|
|
4721
4727
|
autoValidate: true,
|
|
@@ -4726,7 +4732,7 @@ var FieldKeyValueList = ({ form, input, isSubmitting }) => {
|
|
|
4726
4732
|
onChange: (e) => handleChange(index, "value", e.target.value),
|
|
4727
4733
|
form
|
|
4728
4734
|
}
|
|
4729
|
-
)
|
|
4735
|
+
)
|
|
4730
4736
|
] }),
|
|
4731
4737
|
input.isRemovebleOption && /* @__PURE__ */ jsx(
|
|
4732
4738
|
Button,
|
|
@@ -5726,7 +5732,7 @@ var FieldSwitch = ({ input, form, isSubmitting }) => {
|
|
|
5726
5732
|
onCheckedChange: (event) => {
|
|
5727
5733
|
handleOnChage(event, input, field);
|
|
5728
5734
|
},
|
|
5729
|
-
disabled:
|
|
5735
|
+
disabled: input.disabled || isSubmitting
|
|
5730
5736
|
}
|
|
5731
5737
|
) })
|
|
5732
5738
|
] }) })
|
|
@@ -6318,6 +6324,122 @@ var FormWrapper = ({ form, handleSubmit, children, readOnly }) => {
|
|
|
6318
6324
|
}
|
|
6319
6325
|
) });
|
|
6320
6326
|
};
|
|
6327
|
+
function Stepper({ steps, currentStep, clickable = false, onStepClick }) {
|
|
6328
|
+
const handleStepClick = (stepNumber) => {
|
|
6329
|
+
if (clickable && onStepClick) {
|
|
6330
|
+
onStepClick(stepNumber);
|
|
6331
|
+
}
|
|
6332
|
+
};
|
|
6333
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx("div", { className: "flex flex-row gap-4 items-center justify-around", children: steps.map((step, index) => {
|
|
6334
|
+
const stepNumber = index + 1;
|
|
6335
|
+
const isCompleted = stepNumber < currentStep;
|
|
6336
|
+
const isCurrent = stepNumber === currentStep;
|
|
6337
|
+
const isUpcoming = stepNumber > currentStep;
|
|
6338
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center", children: [
|
|
6339
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
6340
|
+
/* @__PURE__ */ jsx(
|
|
6341
|
+
"div",
|
|
6342
|
+
{
|
|
6343
|
+
onClick: () => handleStepClick(stepNumber),
|
|
6344
|
+
className: cn(
|
|
6345
|
+
"flex size-10 items-center shadow-lg justify-center rounded-full border-2 transition-all duration-300",
|
|
6346
|
+
isCompleted && "border-primary bg-primary text-primary-foreground",
|
|
6347
|
+
isCurrent && "border-primary bg-background text-primary scale-110",
|
|
6348
|
+
isUpcoming && "border-muted-foreground/60 bg-background border-b text-muted-foreground",
|
|
6349
|
+
clickable && "cursor-pointer hover:scale-125 hover:shadow-xl",
|
|
6350
|
+
!clickable && "cursor-default"
|
|
6351
|
+
),
|
|
6352
|
+
children: isCompleted ? /* @__PURE__ */ jsx(Check, { className: "size-5" }) : /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: stepNumber })
|
|
6353
|
+
}
|
|
6354
|
+
),
|
|
6355
|
+
step.title && /* @__PURE__ */ jsxs("div", { className: "mt-3 text-center", children: [
|
|
6356
|
+
/* @__PURE__ */ jsx(
|
|
6357
|
+
"p",
|
|
6358
|
+
{
|
|
6359
|
+
className: cn(
|
|
6360
|
+
"text-sm font-medium transition-colors",
|
|
6361
|
+
(isCompleted || isCurrent) && "text-foreground",
|
|
6362
|
+
isUpcoming && "text-muted-foreground"
|
|
6363
|
+
),
|
|
6364
|
+
children: step.title
|
|
6365
|
+
}
|
|
6366
|
+
),
|
|
6367
|
+
step.description && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground max-w-[120px]", children: step.description })
|
|
6368
|
+
] })
|
|
6369
|
+
] }),
|
|
6370
|
+
index < steps.length - 1 && /* @__PURE__ */ jsx("div", { className: "mx-2 flex-1 mb-8", children: /* @__PURE__ */ jsx(
|
|
6371
|
+
"div",
|
|
6372
|
+
{
|
|
6373
|
+
className: cn(
|
|
6374
|
+
"h-0.5 w-full transition-all duration-300",
|
|
6375
|
+
stepNumber < currentStep ? "bg-primary" : "bg-muted-foreground/30"
|
|
6376
|
+
)
|
|
6377
|
+
}
|
|
6378
|
+
) })
|
|
6379
|
+
] }, index);
|
|
6380
|
+
}) }) });
|
|
6381
|
+
}
|
|
6382
|
+
var WizardForm = ({
|
|
6383
|
+
fields,
|
|
6384
|
+
record,
|
|
6385
|
+
onSubmit
|
|
6386
|
+
}) => {
|
|
6387
|
+
const [currentStep, setCurrentStep] = useState(1);
|
|
6388
|
+
const flattenFields4 = (list) => list.flatMap((f) => Array.isArray(f) ? flattenFields4(f) : f);
|
|
6389
|
+
const allFields = flattenFields4(fields);
|
|
6390
|
+
const totalSteps = allFields.reduce(
|
|
6391
|
+
(max, f) => Math.max(max, f.step ?? 1),
|
|
6392
|
+
1
|
|
6393
|
+
);
|
|
6394
|
+
const stepFields = allFields.filter((f) => (f.step ?? 1) === currentStep);
|
|
6395
|
+
return /* @__PURE__ */ jsxs(Card, { className: "flex flex-col gap-4 px-4", children: [
|
|
6396
|
+
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-4 gap-2 px-4", children: [
|
|
6397
|
+
/* @__PURE__ */ jsx(
|
|
6398
|
+
Stepper,
|
|
6399
|
+
{
|
|
6400
|
+
steps: Array(totalSteps).fill({}),
|
|
6401
|
+
currentStep,
|
|
6402
|
+
clickable: true,
|
|
6403
|
+
onStepClick: setCurrentStep
|
|
6404
|
+
}
|
|
6405
|
+
),
|
|
6406
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-center space-x-4 gap-2", children: [
|
|
6407
|
+
/* @__PURE__ */ jsx(
|
|
6408
|
+
Button,
|
|
6409
|
+
{
|
|
6410
|
+
variant: "outline",
|
|
6411
|
+
className: "w-32",
|
|
6412
|
+
onClick: () => setCurrentStep((prev) => prev - 1),
|
|
6413
|
+
disabled: currentStep === 1,
|
|
6414
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
6415
|
+
}
|
|
6416
|
+
),
|
|
6417
|
+
/* @__PURE__ */ jsx(
|
|
6418
|
+
Button,
|
|
6419
|
+
{
|
|
6420
|
+
variant: "outline",
|
|
6421
|
+
className: "w-32",
|
|
6422
|
+
onClick: () => setCurrentStep((prev) => prev + 1),
|
|
6423
|
+
disabled: currentStep > totalSteps,
|
|
6424
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
6425
|
+
}
|
|
6426
|
+
)
|
|
6427
|
+
] })
|
|
6428
|
+
] }) }),
|
|
6429
|
+
/* @__PURE__ */ jsx(
|
|
6430
|
+
DynamicForm,
|
|
6431
|
+
{
|
|
6432
|
+
record,
|
|
6433
|
+
formSubTitle: "This is a subtitle",
|
|
6434
|
+
formTitle: "Wizard Form Example",
|
|
6435
|
+
withCard: false,
|
|
6436
|
+
errorAlertPosition: "down",
|
|
6437
|
+
fields: stepFields,
|
|
6438
|
+
onSubmit
|
|
6439
|
+
}
|
|
6440
|
+
)
|
|
6441
|
+
] });
|
|
6442
|
+
};
|
|
6321
6443
|
var DynamicFormExample = () => {
|
|
6322
6444
|
const record = {
|
|
6323
6445
|
username: "John Doe ",
|
|
@@ -6608,6 +6730,6 @@ var GenericFilter = ({
|
|
|
6608
6730
|
) }) });
|
|
6609
6731
|
};
|
|
6610
6732
|
|
|
6611
|
-
export { Accordion, AccordionContent, AccordionGroupedSwitchInput, AccordionGroupedSwitches, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, Button, ButtonGroup, ButtonGroupInput, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, CheckboxInput, ColorCnInput, ColorInput, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CurrencyInput, CustomAlert, CustomInputGroup, DateInput, DateTimeInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, Field, FieldButtonGroup, FieldContent, FieldCurrency, FieldDateTimeInput, FieldDescription, FieldError, FieldFileMultiUpload, FieldGroup, FieldKeyValueList, FieldLabel, FieldLegend, FieldRepeater, FieldSeparator, FieldSet, FieldSimpleCheckList, FieldSlider, FieldStringValueList, FieldTextGroup, FieldTimeInput2 as FieldTimeInput, FieldTitle, FileInput, FileMultiUploadInput, Form, FormControl, FormDescription, FormErrorsAlert, FormField, FormFieldsGrid, FormItem, FormLabel, FormMessage, GenericFilter, GroupedSwitchInput, GroupedSwitches, Input, InputFactory, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, InputTypes, KeyValueListInput, Label, MultiSelectInput, NumberInput, OTPInput2 as OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupInput, RadioGroupItem, RepeaterInput, RepeaterTabsInput, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SimpleCheckListInput, Slider, SliderInput, SortableListInput, StringValueListInput, Switch, SwitchInput, Tabs, TabsContent, TabsList, TabsTrigger, TagInput, TextAreaInput, TextInput, TextInputGroup, TextInputType, Textarea, TimeInput, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, isValidField, mockFields, useFormField, validationMessages };
|
|
6733
|
+
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, WizardForm, badgeVariants, buttonGroupVariants, buttonVariants, cn, entitiesToGroupedOption, entitiesToInputOption, entityToGroupedOption, entityToInputOption, flattenFields, getDefaultValues, getDynamicSchema, getFieldLabel, handleOnChage, inputFieldComp, isValidField, mockFields, useFormField, validationMessages };
|
|
6612
6734
|
//# sourceMappingURL=index.mjs.map
|
|
6613
6735
|
//# sourceMappingURL=index.mjs.map
|