shadcn-zod-formkit 1.27.4 → 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/README.md +2 -0
- package/dist/index.cjs +149 -79
- 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 +150 -81
- 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.27.4.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
|
@@ -4,7 +4,7 @@ import { cva } from 'class-variance-authority';
|
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
import * as React3 from 'react';
|
|
7
|
-
import React3__default, {
|
|
7
|
+
import React3__default, { useState, useMemo, useEffect, useRef, useTransition } from 'react';
|
|
8
8
|
import { FormProvider, Controller, useFormContext, useFormState, useFieldArray, useForm } from 'react-hook-form';
|
|
9
9
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
10
10
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -2183,6 +2183,28 @@ var ColorInput = class extends BaseInput {
|
|
|
2183
2183
|
return /* @__PURE__ */ jsx(FieldColor, { input, form, isSubmitting });
|
|
2184
2184
|
}
|
|
2185
2185
|
};
|
|
2186
|
+
var PRESET_COLORS = [
|
|
2187
|
+
"#ef4444",
|
|
2188
|
+
// red
|
|
2189
|
+
"#f97316",
|
|
2190
|
+
// orange
|
|
2191
|
+
"#eab308",
|
|
2192
|
+
// yellow
|
|
2193
|
+
"#22c55e",
|
|
2194
|
+
// green
|
|
2195
|
+
"#06b6d4",
|
|
2196
|
+
// cyan
|
|
2197
|
+
"#3b82f6",
|
|
2198
|
+
// blue
|
|
2199
|
+
"#8b5cf6",
|
|
2200
|
+
// purple
|
|
2201
|
+
"#ec4899",
|
|
2202
|
+
// pink
|
|
2203
|
+
"#64748b",
|
|
2204
|
+
// slate
|
|
2205
|
+
"#000000"
|
|
2206
|
+
// black
|
|
2207
|
+
];
|
|
2186
2208
|
var FieldColor = ({ form, input, isSubmitting }) => {
|
|
2187
2209
|
const [ColorCmp, _setColorCmp] = useState(ColorComp);
|
|
2188
2210
|
return /* @__PURE__ */ jsx(
|
|
@@ -2213,13 +2235,17 @@ var FieldColor = ({ form, input, isSubmitting }) => {
|
|
|
2213
2235
|
var ColorComp = React3__default.forwardRef(
|
|
2214
2236
|
({ value = "#000000", onChange, onBlur, disabled, className, hideInput = ["hsv"] }, ref) => {
|
|
2215
2237
|
const [color, setColor] = useColor(value);
|
|
2216
|
-
const [open, setOpen] =
|
|
2238
|
+
const [open, setOpen] = useState(false);
|
|
2217
2239
|
React3__default.useEffect(() => {
|
|
2218
2240
|
if (value !== color.hex) {
|
|
2219
2241
|
setColor({ ...color, hex: value });
|
|
2220
2242
|
}
|
|
2221
|
-
}, [
|
|
2243
|
+
}, [value]);
|
|
2222
2244
|
const handleColorChange = (newColor) => {
|
|
2245
|
+
setColor({ ...color, hex: newColor });
|
|
2246
|
+
onChange?.(newColor);
|
|
2247
|
+
};
|
|
2248
|
+
const handlePickerChange = (newColor) => {
|
|
2223
2249
|
setColor(newColor);
|
|
2224
2250
|
onChange?.(newColor.hex);
|
|
2225
2251
|
};
|
|
@@ -2229,21 +2255,38 @@ var ColorComp = React3__default.forwardRef(
|
|
|
2229
2255
|
onBlur?.();
|
|
2230
2256
|
}
|
|
2231
2257
|
};
|
|
2232
|
-
return /* @__PURE__ */ jsxs(
|
|
2233
|
-
/* @__PURE__ */ jsx(
|
|
2234
|
-
|
|
2258
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
2259
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 p-2", children: PRESET_COLORS.map((presetColor) => /* @__PURE__ */ jsx(
|
|
2260
|
+
"button",
|
|
2235
2261
|
{
|
|
2236
|
-
|
|
2237
|
-
variant: "outline",
|
|
2262
|
+
type: "button",
|
|
2238
2263
|
disabled,
|
|
2239
|
-
className: cn(
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2264
|
+
className: cn(
|
|
2265
|
+
"size-6 rounded-md border-2 transition-all hover:scale-110 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2266
|
+
color.hex === presetColor ? "border-foreground ring-2 ring-foreground/20" : "border-border hover:border-foreground/50"
|
|
2267
|
+
),
|
|
2268
|
+
style: { backgroundColor: presetColor },
|
|
2269
|
+
onClick: () => handleColorChange(presetColor),
|
|
2270
|
+
"aria-label": `Select color ${presetColor}`
|
|
2271
|
+
},
|
|
2272
|
+
presetColor
|
|
2273
|
+
)) }),
|
|
2274
|
+
/* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
2275
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2276
|
+
Button,
|
|
2277
|
+
{
|
|
2278
|
+
ref,
|
|
2279
|
+
variant: "outline",
|
|
2280
|
+
disabled,
|
|
2281
|
+
className: cn("w-full justify-start text-left font-normal", !value && "text-muted-foreground", className),
|
|
2282
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2283
|
+
/* @__PURE__ */ jsx("div", { className: "h-4 w-4 border border-border rounded-sm", style: { backgroundColor: color.hex, width: 20, height: 20 } }),
|
|
2284
|
+
/* @__PURE__ */ jsx("span", { children: color.hex })
|
|
2285
|
+
] })
|
|
2286
|
+
}
|
|
2287
|
+
) }),
|
|
2288
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-3", align: "start", children: /* @__PURE__ */ jsx(ColorPicker, { color, onChange: handlePickerChange, hideInput }) })
|
|
2289
|
+
] })
|
|
2247
2290
|
] });
|
|
2248
2291
|
}
|
|
2249
2292
|
);
|
|
@@ -4700,21 +4743,7 @@ var TextInputGroup = class extends BaseInput {
|
|
|
4700
4743
|
}
|
|
4701
4744
|
};
|
|
4702
4745
|
var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
4703
|
-
const groupConfig = input.inputGroupConfig;
|
|
4704
|
-
const infoTooltip = input?.infoTooltip;
|
|
4705
|
-
const autoValidate = groupConfig?.autoValidIcons ?? input.zodType ? true : false;
|
|
4706
|
-
const iconValidState = /* @__PURE__ */ jsx(CircleCheck, { style: { color: "#00bf3e" } });
|
|
4707
|
-
const iconInvalidState = /* @__PURE__ */ jsx(CircleX, { style: { color: "#ff8080" } });
|
|
4708
|
-
const iconLoadingState = /* @__PURE__ */ jsx(Loader2, { className: "animate-spin", style: { color: "#1e90ff" } });
|
|
4709
|
-
const iconsRight = groupConfig?.iconsRight ?? [];
|
|
4710
|
-
const iconsLeft = groupConfig?.iconsLeft ?? [];
|
|
4711
|
-
const textLeft = groupConfig?.textLeft;
|
|
4712
|
-
const textRight = groupConfig?.textRight;
|
|
4713
4746
|
const [isValid2, setIsValid] = useState(isValidField(input, form));
|
|
4714
|
-
const [showPassword, setShowPassword] = useState(false);
|
|
4715
|
-
const isPasswordField = input.keyboardType === "password" /* PASSWORD */;
|
|
4716
|
-
const isNumberField = input.keyboardType === "number" /* NUMBER */;
|
|
4717
|
-
const showInputGroupAddons = iconsRight.length > 0 || textRight || autoValidate || infoTooltip || isPasswordField;
|
|
4718
4747
|
const formField = /* @__PURE__ */ jsx(
|
|
4719
4748
|
FormField,
|
|
4720
4749
|
{
|
|
@@ -4724,51 +4753,13 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
4724
4753
|
setIsValid(isValidField(input, form));
|
|
4725
4754
|
return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
|
|
4726
4755
|
/* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
|
|
4727
|
-
/* @__PURE__ */ jsx(FormControl, { className: "shadow-lg", children:
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
{
|
|
4735
|
-
placeholder: input.placeHolder,
|
|
4736
|
-
disabled: input.disabled || isSubmitting,
|
|
4737
|
-
onBlur: field.onBlur,
|
|
4738
|
-
name: field.name,
|
|
4739
|
-
ref: field.ref,
|
|
4740
|
-
type: isPasswordField && !showPassword ? "password" : isNumberField ? "number" : "text",
|
|
4741
|
-
value: field.value ?? "",
|
|
4742
|
-
onChange: (e) => {
|
|
4743
|
-
let value = e.target.value;
|
|
4744
|
-
if (isNumberField) {
|
|
4745
|
-
value = e.target.value === "" ? "" : Number(e.target.value);
|
|
4746
|
-
}
|
|
4747
|
-
field.onChange(value);
|
|
4748
|
-
isValidField(input, form);
|
|
4749
|
-
handleOnChage(value, input, field);
|
|
4750
|
-
}
|
|
4751
|
-
}
|
|
4752
|
-
),
|
|
4753
|
-
showInputGroupAddons && /* @__PURE__ */ jsxs(InputGroupAddon, { align: "inline-end", children: [
|
|
4754
|
-
infoTooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4755
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Info, { size: 20 }) }),
|
|
4756
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: infoTooltip }) })
|
|
4757
|
-
] }),
|
|
4758
|
-
textRight && /* @__PURE__ */ jsx(InputGroupText, { children: textRight }),
|
|
4759
|
-
iconsRight.map((IconComponent, index) => /* @__PURE__ */ jsx(IconComponent, { size: 20 }, index)),
|
|
4760
|
-
isPasswordField && /* @__PURE__ */ jsx(
|
|
4761
|
-
"button",
|
|
4762
|
-
{
|
|
4763
|
-
type: "button",
|
|
4764
|
-
onClick: () => setShowPassword(!showPassword),
|
|
4765
|
-
className: "p-1",
|
|
4766
|
-
children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { size: 20 }) : /* @__PURE__ */ jsx(Eye, { size: 20 })
|
|
4767
|
-
}
|
|
4768
|
-
),
|
|
4769
|
-
autoValidate && /* @__PURE__ */ jsx("div", { children: isSubmitting ? iconLoadingState : isValid2 ? iconValidState : iconInvalidState })
|
|
4770
|
-
] })
|
|
4771
|
-
] }) }),
|
|
4756
|
+
/* @__PURE__ */ jsx(FormControl, { className: "shadow-lg", children: CustomInputGroup({
|
|
4757
|
+
input,
|
|
4758
|
+
isSubmitting,
|
|
4759
|
+
field,
|
|
4760
|
+
form,
|
|
4761
|
+
isValid: isValid2
|
|
4762
|
+
}) }),
|
|
4772
4763
|
input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
|
|
4773
4764
|
/* @__PURE__ */ jsx(FormMessage, {})
|
|
4774
4765
|
] });
|
|
@@ -4778,6 +4769,78 @@ var FieldTextGroup = ({ form, input, isSubmitting }) => {
|
|
|
4778
4769
|
);
|
|
4779
4770
|
return /* @__PURE__ */ jsx(Fragment, { children: formField });
|
|
4780
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
|
+
};
|
|
4781
4844
|
var NumberInput = class extends BaseInput {
|
|
4782
4845
|
render() {
|
|
4783
4846
|
const { input, form, isSubmitting } = this;
|
|
@@ -5527,6 +5590,10 @@ var StringValueListInput = class extends BaseInput {
|
|
|
5527
5590
|
var FieldStringValueList = ({ form, input, isSubmitting }) => {
|
|
5528
5591
|
const fieldName = input.name;
|
|
5529
5592
|
const withAddBtn = input.withAddBtn ?? false;
|
|
5593
|
+
const [isValid2, setIsValid] = useState(isValidField(input, form));
|
|
5594
|
+
useEffect(() => {
|
|
5595
|
+
setIsValid(isValidField(input, form));
|
|
5596
|
+
}, [input]);
|
|
5530
5597
|
useEffect(() => {
|
|
5531
5598
|
const current = form.getValues(fieldName);
|
|
5532
5599
|
if (!Array.isArray(current)) {
|
|
@@ -5554,7 +5621,7 @@ var FieldStringValueList = ({ form, input, isSubmitting }) => {
|
|
|
5554
5621
|
{
|
|
5555
5622
|
control: form.control,
|
|
5556
5623
|
name: fieldName,
|
|
5557
|
-
render: () => {
|
|
5624
|
+
render: (field) => {
|
|
5558
5625
|
const items = form.watch(fieldName) || [];
|
|
5559
5626
|
return /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
|
|
5560
5627
|
/* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
|
|
@@ -5567,12 +5634,14 @@ var FieldStringValueList = ({ form, input, isSubmitting }) => {
|
|
|
5567
5634
|
className: "flex items-center gap-4 py-2",
|
|
5568
5635
|
children: [
|
|
5569
5636
|
/* @__PURE__ */ jsx(
|
|
5570
|
-
|
|
5637
|
+
CustomInputGroup,
|
|
5571
5638
|
{
|
|
5572
|
-
|
|
5639
|
+
autoValidate: true,
|
|
5573
5640
|
value,
|
|
5574
|
-
|
|
5575
|
-
|
|
5641
|
+
input,
|
|
5642
|
+
isValid: isValid2,
|
|
5643
|
+
onChange: (e) => handleChange(index, e.target.value),
|
|
5644
|
+
form
|
|
5576
5645
|
}
|
|
5577
5646
|
),
|
|
5578
5647
|
input.isRemovebleOption && /* @__PURE__ */ jsx(
|
|
@@ -6516,6 +6585,6 @@ var GenericFilter = ({
|
|
|
6516
6585
|
) }) });
|
|
6517
6586
|
};
|
|
6518
6587
|
|
|
6519
|
-
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 };
|
|
6520
6589
|
//# sourceMappingURL=index.mjs.map
|
|
6521
6590
|
//# sourceMappingURL=index.mjs.map
|