@zayne-labs/ui-react 0.10.39 → 0.10.41
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/css/preset.css +1 -1
- package/dist/esm/common/await/index.d.ts +6 -6
- package/dist/esm/common/await/index.js +1 -1
- package/dist/esm/common/client-gate/index.d.ts +2 -2
- package/dist/esm/common/error-boundary/index.d.ts +1 -1
- package/dist/esm/common/for/index.d.ts +4 -4
- package/dist/esm/common/presence/index.js +1 -1
- package/dist/esm/common/show/index.d.ts +4 -4
- package/dist/esm/common/slot/index.d.ts +4 -4
- package/dist/esm/common/slot/index.js +1 -1
- package/dist/esm/common/suspense-with-boundary/index.d.ts +2 -2
- package/dist/esm/common/switch/index.d.ts +4 -4
- package/dist/esm/common/teleport/index.d.ts +2 -2
- package/dist/esm/common/teleport/index.js +21 -12
- package/dist/esm/common/teleport/index.js.map +1 -1
- package/dist/esm/{index-DYKwNSzB.d.ts → index-ClrHf6FU.d.ts} +5 -5
- package/dist/esm/{index-BpohqQE-.d.ts → index-U3_Q7EUG.d.ts} +4 -4
- package/dist/esm/{presence-DNwNWipt.js → presence-5mRo32XH.js} +2 -2
- package/dist/esm/{presence-DNwNWipt.js.map → presence-5mRo32XH.js.map} +1 -1
- package/dist/esm/{slot--lEkrAQf.js → slot-CURylbjq.js} +7 -7
- package/dist/esm/{slot--lEkrAQf.js.map → slot-CURylbjq.js.map} +1 -1
- package/dist/esm/ui/card/index.d.ts +8 -8
- package/dist/esm/ui/card/index.js +1 -1
- package/dist/esm/ui/carousel/index.d.ts +9 -9
- package/dist/esm/ui/drop-zone/index.d.ts +16 -16
- package/dist/esm/ui/drop-zone/index.js +2 -2
- package/dist/esm/ui/form/index.d.ts +43 -61
- package/dist/esm/ui/form/index.js +37 -26
- package/dist/esm/ui/form/index.js.map +1 -1
- package/dist/style.css +1 -4
- package/package.json +8 -8
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { InferProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
|
|
2
2
|
import * as _zayne_labs_toolkit_type_helpers0 from "@zayne-labs/toolkit-type-helpers";
|
|
3
3
|
import { Awaitable, SelectorFn } from "@zayne-labs/toolkit-type-helpers";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react30 from "react";
|
|
5
5
|
import "@zayne-labs/toolkit-react";
|
|
6
|
-
import * as
|
|
6
|
+
import * as react_jsx_runtime19 from "react/jsx-runtime";
|
|
7
7
|
import * as _zayne_labs_toolkit_core1 from "@zayne-labs/toolkit-core";
|
|
8
8
|
import { FileMeta, FileOrFileMeta, FileValidationErrorContextEach, FileValidationHooksAsync, FileValidationSettingsAsync } from "@zayne-labs/toolkit-core";
|
|
9
9
|
|
|
@@ -223,7 +223,7 @@ interface UseDropZoneProps extends FileValidationSettingsAsync {
|
|
|
223
223
|
declare const DropZoneStoreContextProvider: (props: {
|
|
224
224
|
children: React.ReactNode;
|
|
225
225
|
store: _zayne_labs_toolkit_core1.StoreApi<DropZoneStore>;
|
|
226
|
-
}) =>
|
|
226
|
+
}) => react30.FunctionComponentElement<react30.ProviderProps<_zayne_labs_toolkit_core1.StoreApi<DropZoneStore>>>, useDropZoneStoreContext: <TResult = DropZoneStore>(selector?: _zayne_labs_toolkit_type_helpers0.SelectorFn<DropZoneStore, TResult> | undefined) => TResult;
|
|
227
227
|
type FileItemContextType = {
|
|
228
228
|
fileState: FileState;
|
|
229
229
|
};
|
|
@@ -232,29 +232,29 @@ type FileItemContextType = {
|
|
|
232
232
|
type DropZoneRootProps = UseDropZoneProps & {
|
|
233
233
|
children: React.ReactNode;
|
|
234
234
|
};
|
|
235
|
-
declare function DropZoneRoot(props: DropZoneRootProps):
|
|
235
|
+
declare function DropZoneRoot(props: DropZoneRootProps): react_jsx_runtime19.JSX.Element;
|
|
236
236
|
type DropZoneContextProps<TSlice> = {
|
|
237
237
|
children: React.ReactNode | ((context: TSlice) => React.ReactNode);
|
|
238
238
|
selector?: SelectorFn<DropZoneStore, TSlice>;
|
|
239
239
|
};
|
|
240
|
-
declare function DropZoneContext<TSlice = DropZoneStore>(props: DropZoneContextProps<TSlice>):
|
|
240
|
+
declare function DropZoneContext<TSlice = DropZoneStore>(props: DropZoneContextProps<TSlice>): react30.ReactNode;
|
|
241
241
|
type DropZoneContainerProps = PartInputProps["container"] & {
|
|
242
242
|
asChild?: boolean;
|
|
243
243
|
};
|
|
244
|
-
declare function DropZoneContainer<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, DropZoneContainerProps>):
|
|
244
|
+
declare function DropZoneContainer<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, DropZoneContainerProps>): react_jsx_runtime19.JSX.Element;
|
|
245
245
|
type DropZoneInputProps = PartInputProps["input"] & {
|
|
246
246
|
asChild?: boolean;
|
|
247
247
|
};
|
|
248
|
-
declare function DropZoneInput(props: DropZoneInputProps):
|
|
248
|
+
declare function DropZoneInput(props: DropZoneInputProps): react_jsx_runtime19.JSX.Element;
|
|
249
249
|
type DropZoneAreaProps<TSlice> = DropZoneContextProps<TSlice> & PartInputProps["container"] & {
|
|
250
250
|
classNames?: Partial<Record<Extract<keyof PartInputProps, "container" | "input">, string>>;
|
|
251
251
|
extraProps?: Partial<Pick<PartInputProps, "container" | "input">>;
|
|
252
252
|
};
|
|
253
|
-
declare function DropZoneArea<TSlice = DropZoneStore>(props: DropZoneAreaProps<TSlice>):
|
|
253
|
+
declare function DropZoneArea<TSlice = DropZoneStore>(props: DropZoneAreaProps<TSlice>): react_jsx_runtime19.JSX.Element;
|
|
254
254
|
type DropZoneTriggerProps = PartInputProps["trigger"] & {
|
|
255
255
|
asChild?: boolean;
|
|
256
256
|
};
|
|
257
|
-
declare function DropZoneTrigger(props: DropZoneTriggerProps):
|
|
257
|
+
declare function DropZoneTrigger(props: DropZoneTriggerProps): react_jsx_runtime19.JSX.Element;
|
|
258
258
|
type ListPerItemContext = Pick<DropZoneStore, "actions"> & {
|
|
259
259
|
array: DropZoneStore["fileStateArray"];
|
|
260
260
|
fileState: DropZoneStore["fileStateArray"][number];
|
|
@@ -273,21 +273,21 @@ type DropZoneFileListProps = Omit<PartInputProps["fileList"], "children"> & {
|
|
|
273
273
|
asChild?: boolean;
|
|
274
274
|
forceMount?: boolean;
|
|
275
275
|
} & (FileListManualListVariant | FileListPerItemVariant);
|
|
276
|
-
declare function DropZoneFileList<TElement extends React.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, DropZoneFileListProps>):
|
|
276
|
+
declare function DropZoneFileList<TElement extends React.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, DropZoneFileListProps>): react_jsx_runtime19.JSX.Element;
|
|
277
277
|
type DropZoneFileItemProps = FileItemContextType & PartInputProps["fileItem"] & {
|
|
278
278
|
asChild?: boolean;
|
|
279
279
|
};
|
|
280
|
-
declare function DropZoneFileItem<TElement extends React.ElementType = "li">(props: PolymorphicPropsStrict<TElement, DropZoneFileItemProps>):
|
|
280
|
+
declare function DropZoneFileItem<TElement extends React.ElementType = "li">(props: PolymorphicPropsStrict<TElement, DropZoneFileItemProps>): react_jsx_runtime19.JSX.Element;
|
|
281
281
|
type DropZoneFileItemDeleteProps = PartInputProps["fileItemDelete"] & {
|
|
282
282
|
asChild?: boolean;
|
|
283
283
|
};
|
|
284
|
-
declare function DropZoneFileItemDelete(props: DropZoneFileItemDeleteProps):
|
|
284
|
+
declare function DropZoneFileItemDelete(props: DropZoneFileItemDeleteProps): react_jsx_runtime19.JSX.Element;
|
|
285
285
|
type DropZoneFileItemProgressProps = PartInputProps["fileItemProgress"] & {
|
|
286
286
|
asChild?: boolean;
|
|
287
287
|
forceMount?: boolean;
|
|
288
288
|
size?: number;
|
|
289
289
|
};
|
|
290
|
-
declare function DropZoneFileItemProgress<TElement extends React.ElementType = "span">(props: PolymorphicPropsStrict<TElement, DropZoneFileItemProgressProps>):
|
|
290
|
+
declare function DropZoneFileItemProgress<TElement extends React.ElementType = "span">(props: PolymorphicPropsStrict<TElement, DropZoneFileItemProgressProps>): react_jsx_runtime19.JSX.Element | null;
|
|
291
291
|
type RenderPreviewDetails<TElement extends React.ElementType = "svg"> = {
|
|
292
292
|
node?: React.ReactNode;
|
|
293
293
|
} & {
|
|
@@ -316,7 +316,7 @@ type DropZoneFileItemPreviewProps = Omit<PartInputProps["fileItemPreview"], "chi
|
|
|
316
316
|
}) => React.ReactNode);
|
|
317
317
|
renderPreview?: boolean | RenderPreview;
|
|
318
318
|
};
|
|
319
|
-
declare function DropZoneFileItemPreview<TElement extends React.ElementType>(props: PolymorphicPropsStrict<TElement, DropZoneFileItemPreviewProps>):
|
|
319
|
+
declare function DropZoneFileItemPreview<TElement extends React.ElementType>(props: PolymorphicPropsStrict<TElement, DropZoneFileItemPreviewProps>): react_jsx_runtime19.JSX.Element | null;
|
|
320
320
|
type DropZoneFileItemMetadataProps = Omit<PartInputProps["fileItemMetadata"], "children"> & Partial<Pick<FileItemContextType, "fileState">> & {
|
|
321
321
|
asChild?: boolean;
|
|
322
322
|
children?: React.ReactNode | ((context: Pick<FileItemContextType, "fileState">) => React.ReactNode);
|
|
@@ -326,12 +326,12 @@ type DropZoneFileItemMetadataProps = Omit<PartInputProps["fileItemMetadata"], "c
|
|
|
326
326
|
};
|
|
327
327
|
size?: "default" | "sm";
|
|
328
328
|
};
|
|
329
|
-
declare function DropZoneFileItemMetadata(props: DropZoneFileItemMetadataProps):
|
|
329
|
+
declare function DropZoneFileItemMetadata(props: DropZoneFileItemMetadataProps): react_jsx_runtime19.JSX.Element | null;
|
|
330
330
|
type DropZoneFileClearProps = PartInputProps["fileItemClear"] & {
|
|
331
331
|
asChild?: boolean;
|
|
332
332
|
forceMount?: boolean;
|
|
333
333
|
};
|
|
334
|
-
declare function DropZoneFileClear(props: DropZoneFileClearProps):
|
|
334
|
+
declare function DropZoneFileClear(props: DropZoneFileClearProps): react_jsx_runtime19.JSX.Element | null;
|
|
335
335
|
declare namespace drop_zone_parts_d_exports {
|
|
336
336
|
export { DropZoneArea as Area, DropZoneContainer as Container, DropZoneContext as Context, DropZoneFileClear as FileClear, DropZoneFileItem as FileItem, DropZoneFileItemDelete as FileItemDelete, DropZoneFileItemMetadata as FileItemMetadata, DropZoneFileItemPreview as FileItemPreview, DropZoneFileItemProgress as FileItemProgress, DropZoneFileList as FileList, DropZoneInput as Input, DropZoneRoot as Root, DropZoneTrigger as Trigger };
|
|
337
337
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { t as __export } from "../../chunk-BL-4obUL.js";
|
|
4
|
-
import { n as SlotRoot } from "../../slot
|
|
4
|
+
import { n as SlotRoot } from "../../slot-CURylbjq.js";
|
|
5
5
|
import { n as For } from "../../for-DsdwXl8s.js";
|
|
6
|
-
import { t as Presence } from "../../presence-
|
|
6
|
+
import { t as Presence } from "../../presence-5mRo32XH.js";
|
|
7
7
|
import { t as cnMerge } from "../../cn-Ba8kxuby.js";
|
|
8
8
|
import { composeRefs, composeTwoEventHandlers } from "@zayne-labs/toolkit-react/utils";
|
|
9
9
|
import { isBoolean, isFile, isFunction, isNumber, isObject, isString } from "@zayne-labs/toolkit-type-helpers";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DiscriminatedRenderItemProps, DiscriminatedRenderProps, InferProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
|
|
2
2
|
import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react37 from "react";
|
|
4
4
|
import "@zayne-labs/toolkit-react";
|
|
5
|
-
import * as
|
|
6
|
-
import { Control,
|
|
5
|
+
import * as react_jsx_runtime31 from "react/jsx-runtime";
|
|
6
|
+
import { Control, ControllerProps, FieldPath, FormStateSubscribeProps, RegisterOptions, UseFormReturn, UseFormStateReturn, WatchProps, useFormContext as useFormRootContext } from "react-hook-form";
|
|
7
7
|
|
|
8
8
|
//#region src/components/ui/form/form-context.d.ts
|
|
9
9
|
|
|
@@ -34,16 +34,16 @@ type FieldState = {
|
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/components/ui/form/form.d.ts
|
|
36
36
|
type FieldValues = Record<string, any>;
|
|
37
|
-
type FormRootProps<TFieldValues extends FieldValues> = InferProps<"form"> & Partial<FormRootContext> & {
|
|
37
|
+
type FormRootProps<TFieldValues extends FieldValues, TTransformedValues> = InferProps<"form"> & Partial<FormRootContext> & {
|
|
38
38
|
children: React.ReactNode;
|
|
39
|
-
|
|
39
|
+
form: UseFormReturn<TFieldValues, unknown, TTransformedValues>;
|
|
40
40
|
};
|
|
41
|
-
declare function FormRoot<
|
|
42
|
-
type FormFieldProps<TControl, TFieldValues extends FieldValues> = (TControl extends (Control<infer TValues>) ? {
|
|
41
|
+
declare function FormRoot<TFieldValues extends FieldValues, TTransformedValues = TFieldValues>(props: FormRootProps<TFieldValues, TTransformedValues>): react_jsx_runtime31.JSX.Element;
|
|
42
|
+
type FormFieldProps<TControl, TFieldValues extends FieldValues, TTransformedValues> = (TControl extends (Control<infer TValues>) ? {
|
|
43
43
|
control?: never;
|
|
44
44
|
name: FieldPath<TValues>;
|
|
45
45
|
} : {
|
|
46
|
-
control?: Control<TFieldValues>;
|
|
46
|
+
control?: Control<TFieldValues, unknown, TTransformedValues>;
|
|
47
47
|
name: FieldPath<TFieldValues>;
|
|
48
48
|
}) & ((InferProps<"div"> & {
|
|
49
49
|
withWrapper?: true;
|
|
@@ -52,35 +52,29 @@ type FormFieldProps<TControl, TFieldValues extends FieldValues> = (TControl exte
|
|
|
52
52
|
className?: never;
|
|
53
53
|
withWrapper: false;
|
|
54
54
|
});
|
|
55
|
-
declare function FormField<TControl, TFieldValues extends FieldValues
|
|
56
|
-
type
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
66
|
-
declare function FormFieldController(props: FormFieldControllerProps): react_jsx_runtime30.JSX.Element;
|
|
67
|
-
declare function FormFieldControlledField<TFieldValues extends FieldValues>(props: ControllerProps<TFieldValues>): react_jsx_runtime30.JSX.Element;
|
|
68
|
-
declare function FormFieldContext(props: FormFieldContextProps): react20.ReactNode;
|
|
69
|
-
declare function FormLabel(props: InferProps<"label">): react_jsx_runtime30.JSX.Element;
|
|
70
|
-
declare function FormInputGroup(props: InferProps<"div">): react_jsx_runtime30.JSX.Element;
|
|
55
|
+
declare function FormField<TControl, TFieldValues extends FieldValues, TTransformedValues>(props: FormFieldProps<TControl, TFieldValues, TTransformedValues>): react_jsx_runtime31.JSX.Element;
|
|
56
|
+
type FormFieldControlledFieldProps<TControl, TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>, TTransformedValues = TFieldValues> = TControl extends Control<infer TValues> ? Omit<ControllerProps<TValues, FieldPath<TValues>, TTransformedValues>, "control"> & {
|
|
57
|
+
control?: never;
|
|
58
|
+
} : ControllerProps<TFieldValues, TName, TTransformedValues>;
|
|
59
|
+
declare function FormFieldWithController<TControl, TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>, TTransformedValues = TFieldValues>(props: FormFieldControlledFieldProps<TControl, TFieldValues, TName, TTransformedValues>): react_jsx_runtime31.JSX.Element;
|
|
60
|
+
type FormFieldBoundControllerProps<TFieldValues extends FieldValues, TTransformedValues> = Omit<ControllerProps<TFieldValues, never, TTransformedValues>, "control" | "name">;
|
|
61
|
+
declare function FormFieldBoundController<TFieldValues extends FieldValues = Record<string, never>, TTransformedValues = TFieldValues>(props: FormFieldBoundControllerProps<TFieldValues, TTransformedValues>): react_jsx_runtime31.JSX.Element;
|
|
62
|
+
declare function FormFieldContext(props: FormFieldContextProps): react37.ReactNode;
|
|
63
|
+
declare function FormLabel(props: InferProps<"label">): react_jsx_runtime31.JSX.Element;
|
|
64
|
+
declare function FormInputGroup(props: InferProps<"div">): react_jsx_runtime31.JSX.Element;
|
|
71
65
|
type FormSideItemProps = {
|
|
72
66
|
children?: React.ReactNode;
|
|
73
67
|
className?: string;
|
|
74
68
|
};
|
|
75
|
-
declare function FormInputLeftItem<TElement extends React.ElementType = "span">(props: PolymorphicPropsStrict<TElement, FormSideItemProps>):
|
|
69
|
+
declare function FormInputLeftItem<TElement extends React.ElementType = "span">(props: PolymorphicPropsStrict<TElement, FormSideItemProps>): react_jsx_runtime31.JSX.Element;
|
|
76
70
|
declare namespace FormInputLeftItem {
|
|
77
71
|
var slotSymbol: symbol;
|
|
78
72
|
}
|
|
79
|
-
declare function FormInputRightItem<TElement extends React.ElementType = "span">(props: PolymorphicPropsStrict<TElement, FormSideItemProps>):
|
|
73
|
+
declare function FormInputRightItem<TElement extends React.ElementType = "span">(props: PolymorphicPropsStrict<TElement, FormSideItemProps>): react_jsx_runtime31.JSX.Element;
|
|
80
74
|
declare namespace FormInputRightItem {
|
|
81
75
|
var slotSymbol: symbol;
|
|
82
76
|
}
|
|
83
|
-
type FormInputPrimitiveProps<TFieldValues extends FieldValues
|
|
77
|
+
type FormInputPrimitiveProps<TFieldValues extends FieldValues> = Omit<React.ComponentPropsWithRef<"input">, "children"> & {
|
|
84
78
|
classNames?: {
|
|
85
79
|
error?: string;
|
|
86
80
|
eyeIcon?: string;
|
|
@@ -92,7 +86,7 @@ type FormInputPrimitiveProps<TFieldValues extends FieldValues = FieldValues> = O
|
|
|
92
86
|
name?: FieldPath<TFieldValues>;
|
|
93
87
|
withEyeIcon?: FormRootContext["withEyeIcon"];
|
|
94
88
|
};
|
|
95
|
-
type FormTextAreaPrimitiveProps<TFieldValues extends FieldValues
|
|
89
|
+
type FormTextAreaPrimitiveProps<TFieldValues extends FieldValues> = React.ComponentPropsWithRef<"textarea"> & {
|
|
96
90
|
classNames?: {
|
|
97
91
|
base?: string;
|
|
98
92
|
error?: string;
|
|
@@ -101,7 +95,7 @@ type FormTextAreaPrimitiveProps<TFieldValues extends FieldValues = FieldValues>
|
|
|
101
95
|
fieldState?: FieldState;
|
|
102
96
|
name?: FieldPath<TFieldValues>;
|
|
103
97
|
};
|
|
104
|
-
type FormSelectPrimitiveProps<TFieldValues extends FieldValues
|
|
98
|
+
type FormSelectPrimitiveProps<TFieldValues extends FieldValues> = React.ComponentPropsWithRef<"select"> & {
|
|
105
99
|
classNames?: {
|
|
106
100
|
base?: string;
|
|
107
101
|
error?: string;
|
|
@@ -112,21 +106,21 @@ type FormSelectPrimitiveProps<TFieldValues extends FieldValues = FieldValues> =
|
|
|
112
106
|
};
|
|
113
107
|
declare function FormInputPrimitive<TFieldValues extends FieldValues>(props: FormInputPrimitiveProps<TFieldValues> & {
|
|
114
108
|
rules?: RegisterOptions;
|
|
115
|
-
}):
|
|
109
|
+
}): react_jsx_runtime31.JSX.Element;
|
|
116
110
|
declare function FormTextAreaPrimitive<TFieldValues extends FieldValues>(props: FormTextAreaPrimitiveProps<TFieldValues> & {
|
|
117
111
|
rules?: RegisterOptions;
|
|
118
|
-
}):
|
|
112
|
+
}): react_jsx_runtime31.JSX.Element;
|
|
119
113
|
declare function FormSelectPrimitive<TFieldValues extends FieldValues>(props: FormSelectPrimitiveProps<TFieldValues> & {
|
|
120
114
|
rules?: RegisterOptions;
|
|
121
|
-
}):
|
|
115
|
+
}): react_jsx_runtime31.JSX.Element;
|
|
122
116
|
type PrimitivePropsToOmit = "control" | "formState" | "name";
|
|
123
|
-
type FormInputProps = Omit<FormInputPrimitiveProps
|
|
117
|
+
type FormInputProps = Omit<FormInputPrimitiveProps<FieldValues>, PrimitivePropsToOmit> & {
|
|
124
118
|
rules?: RegisterOptions;
|
|
125
119
|
};
|
|
126
|
-
type FormTextAreaProps = Omit<FormTextAreaPrimitiveProps
|
|
120
|
+
type FormTextAreaProps = Omit<FormTextAreaPrimitiveProps<FieldValues>, PrimitivePropsToOmit> & {
|
|
127
121
|
rules?: RegisterOptions;
|
|
128
122
|
};
|
|
129
|
-
type FormSelectProps = Omit<FormSelectPrimitiveProps
|
|
123
|
+
type FormSelectProps = Omit<FormSelectPrimitiveProps<FieldValues>, PrimitivePropsToOmit> & {
|
|
130
124
|
rules?: RegisterOptions;
|
|
131
125
|
};
|
|
132
126
|
type CombinedFormInputProps = (FormSelectProps & {
|
|
@@ -136,10 +130,10 @@ type CombinedFormInputProps = (FormSelectProps & {
|
|
|
136
130
|
}) | FormInputProps;
|
|
137
131
|
declare function FormInput(props: CombinedFormInputProps & {
|
|
138
132
|
rules?: RegisterOptions;
|
|
139
|
-
}):
|
|
140
|
-
declare function FormTextArea(props: FormTextAreaProps):
|
|
141
|
-
declare function FormSelect(props: FormSelectProps):
|
|
142
|
-
declare function FormDescription(props: InferProps<"p">):
|
|
133
|
+
}): react_jsx_runtime31.JSX.Element;
|
|
134
|
+
declare function FormTextArea(props: FormTextAreaProps): react_jsx_runtime31.JSX.Element;
|
|
135
|
+
declare function FormSelect(props: FormSelectProps): react_jsx_runtime31.JSX.Element;
|
|
136
|
+
declare function FormDescription(props: InferProps<"p">): react_jsx_runtime31.JSX.Element;
|
|
143
137
|
type ErrorMessageRenderProps = {
|
|
144
138
|
className: string;
|
|
145
139
|
"data-index": number;
|
|
@@ -183,45 +177,33 @@ type FormErrorMessagePrimitiveType = {
|
|
|
183
177
|
}>): React.ReactNode;
|
|
184
178
|
};
|
|
185
179
|
declare const FormErrorMessagePrimitive: FormErrorMessagePrimitiveType;
|
|
186
|
-
type FormErrorMessageProps<TControl, TFieldValues extends FieldValues> = (TControl extends Control<infer TValues> ? {
|
|
180
|
+
type FormErrorMessageProps<TControl, TFieldValues extends FieldValues, TTransformedValues> = (TControl extends Control<infer TValues> ? {
|
|
187
181
|
className?: string;
|
|
188
182
|
control?: never;
|
|
189
183
|
errorField?: FieldPath<TValues>;
|
|
190
184
|
type?: "regular";
|
|
191
185
|
} : {
|
|
192
186
|
className?: string;
|
|
193
|
-
control?: Control<TFieldValues>;
|
|
187
|
+
control?: Control<TFieldValues, unknown, TTransformedValues>;
|
|
194
188
|
errorField?: FieldPath<TFieldValues>;
|
|
195
189
|
type?: "regular";
|
|
196
190
|
}) | {
|
|
197
191
|
className?: string;
|
|
198
|
-
control?: never;
|
|
199
192
|
errorField: string;
|
|
200
193
|
type: "root";
|
|
201
194
|
};
|
|
202
|
-
declare function FormErrorMessage<TControl, TFieldValues extends FieldValues = FieldValues>(props: FormErrorMessageProps<TControl, TFieldValues>):
|
|
195
|
+
declare function FormErrorMessage<TControl, TFieldValues extends FieldValues = FieldValues, TTransformedValues = TFieldValues>(props: FormErrorMessageProps<TControl, TFieldValues, TTransformedValues>): react_jsx_runtime31.JSX.Element;
|
|
203
196
|
type FormSubmitProps = InferProps<"button"> & {
|
|
204
197
|
asChild?: boolean;
|
|
205
198
|
};
|
|
206
|
-
declare function FormSubmit<TElement extends React.ElementType = "button">(props: PolymorphicPropsStrict<TElement, FormSubmitProps>):
|
|
207
|
-
type
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
type FormWatchProps<TFieldValues extends FieldValues, TFieldPathOrPaths> = DiscriminatedRenderProps<FormWatchRenderFn<TFieldValues, TFieldPathOrPaths>> & {
|
|
212
|
-
control: Control<TFieldValues>;
|
|
213
|
-
name?: TFieldPathOrPaths;
|
|
214
|
-
};
|
|
215
|
-
declare function FormWatch<TFieldValues extends FieldValues, const TFieldPathOrPaths extends Array<FieldPath<TFieldValues>> | FieldPath<TFieldValues>>(props: FormWatchProps<TFieldValues, TFieldPathOrPaths>): react20.ReactNode;
|
|
216
|
-
type FormWatchFormStateRenderFn<TFieldValues extends FieldValues> = (props: UseFormStateReturn<TFieldValues>) => React.ReactNode;
|
|
217
|
-
type FormWatchFormStateProps<TFieldValues extends FieldValues> = DiscriminatedRenderProps<FormWatchFormStateRenderFn<TFieldValues>> & {
|
|
218
|
-
control?: Control<TFieldValues>;
|
|
219
|
-
name?: Array<FieldPath<TFieldValues>> | FieldPath<TFieldValues>;
|
|
220
|
-
};
|
|
221
|
-
declare function FormWatchFormState<TFieldValues extends FieldValues = FieldValues>(props: FormWatchFormStateProps<TFieldValues>): react20.ReactNode;
|
|
199
|
+
declare function FormSubmit<TElement extends React.ElementType = "button">(props: PolymorphicPropsStrict<TElement, FormSubmitProps>): react_jsx_runtime31.JSX.Element;
|
|
200
|
+
type FormWatchProps<TFieldValues extends FieldValues, TFieldName extends Array<FieldPath<TFieldValues>> | FieldPath<TFieldValues> | ReadonlyArray<FieldPath<TFieldValues>> | undefined, TTransformedValues, TComputeValue, TComputedProps extends Omit<WatchProps<TFieldName, TFieldValues, unknown, TTransformedValues, TComputeValue>, "names"> = Omit<WatchProps<TFieldName, TFieldValues, unknown, TTransformedValues, TComputeValue>, "names">> = DiscriminatedRenderProps<TComputedProps["render"]> & Omit<TComputedProps, "render">;
|
|
201
|
+
declare function FormWatch<TFieldValues extends FieldValues = FieldValues, const TFieldName extends Array<FieldPath<TFieldValues>> | FieldPath<TFieldValues> | ReadonlyArray<FieldPath<TFieldValues>> | undefined = undefined, TTransformedValues = TFieldValues, TComputeValue = undefined>(props: FormWatchProps<TFieldValues, TFieldName, TTransformedValues, TComputeValue>): react37.ReactNode;
|
|
202
|
+
type FormStateSubscribeProps$1<TFieldValues extends FieldValues, TTransformedValues, TComputedProps extends FormStateSubscribeProps<TFieldValues, TTransformedValues> = FormStateSubscribeProps<TFieldValues, TTransformedValues>> = DiscriminatedRenderProps<TComputedProps["render"]> & Omit<TComputedProps, "render">;
|
|
203
|
+
declare function FormStateSubscribe<TFieldValues extends FieldValues, TTransformedValues = TFieldValues>(props: FormStateSubscribeProps$1<TFieldValues, TTransformedValues>): react37.ReactNode;
|
|
222
204
|
declare namespace form_parts_d_exports {
|
|
223
|
-
export {
|
|
205
|
+
export { FormDescription as Description, FormErrorMessage as ErrorMessage, FormErrorMessagePrimitive as ErrorMessagePrimitive, FormField as Field, FormFieldBoundController as FieldBoundController, FormFieldContext as FieldContext, FormFieldWithController as FieldWithController, FormInput as Input, FormInputGroup as InputGroup, FormInputLeftItem as InputLeftItem, FormInputPrimitive as InputPrimitive, FormInputRightItem as InputRightItem, FormLabel as Label, FormRoot as Root, FormSelect as Select, FormStateSubscribe as StateSubscribe, FormSubmit as Submit, FormTextArea as TextArea, FormTextAreaPrimitive as TextAreaPrimitive, FormWatch as Watch };
|
|
224
206
|
}
|
|
225
207
|
//#endregion
|
|
226
|
-
export { FieldValues, form_parts_d_exports as Form, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormErrorMessagePrimitiveProps, FormField,
|
|
208
|
+
export { FieldValues, form_parts_d_exports as Form, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormErrorMessagePrimitiveProps, FormField, FormFieldBoundController, FormFieldContext, FormFieldWithController, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputProps, FormInputRightItem, FormLabel, FormRoot, FormSelect, FormSelectPrimitive, FormSelectProps, FormStateSubscribe, FormSubmit, FormTextArea, FormTextAreaPrimitive, FormTextAreaProps, FormWatch, useStrictFormFieldContext as useFormFieldContext, useFormRootContext };
|
|
227
209
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { t as __export } from "../../chunk-BL-4obUL.js";
|
|
4
|
-
import { n as SlotRoot } from "../../slot
|
|
4
|
+
import { n as SlotRoot } from "../../slot-CURylbjq.js";
|
|
5
5
|
import { r as ForWithWrapper } from "../../for-DsdwXl8s.js";
|
|
6
6
|
import { t as cnMerge } from "../../cn-Ba8kxuby.js";
|
|
7
7
|
import { composeRefs, composeTwoEventHandlers, getMultipleSlots } from "@zayne-labs/toolkit-react/utils";
|
|
@@ -113,10 +113,10 @@ const useLaxFormFieldState = (options) => {
|
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region src/components/ui/form/form.tsx
|
|
115
115
|
function FormRoot(props) {
|
|
116
|
-
const { children, className,
|
|
116
|
+
const { children, className, form, withEyeIcon, ...restOfProps } = props;
|
|
117
117
|
const formContextValue = useMemo(() => ({ withEyeIcon }), [withEyeIcon]);
|
|
118
118
|
return /* @__PURE__ */ jsx(FormProvider, {
|
|
119
|
-
...
|
|
119
|
+
...form,
|
|
120
120
|
children: /* @__PURE__ */ jsx(LaxFormRootProvider, {
|
|
121
121
|
value: formContextValue,
|
|
122
122
|
children: /* @__PURE__ */ jsx("form", {
|
|
@@ -161,19 +161,9 @@ function FormField(props) {
|
|
|
161
161
|
})
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
const
|
|
166
|
-
const { name } =
|
|
167
|
-
const { render, ...restOfProps } = props;
|
|
168
|
-
return /* @__PURE__ */ jsx(Controller, {
|
|
169
|
-
name,
|
|
170
|
-
control,
|
|
171
|
-
render,
|
|
172
|
-
...restOfProps
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
function FormFieldControlledField(props) {
|
|
176
|
-
const { name } = props;
|
|
164
|
+
function FormFieldWithController(props) {
|
|
165
|
+
const formMethods = useFormMethodsContext({ strict: false });
|
|
166
|
+
const { control = formMethods?.control, name, render, ...restOfProps } = props;
|
|
177
167
|
const uniqueId = useId();
|
|
178
168
|
const fieldContextValue = useMemo(() => ({
|
|
179
169
|
formDescriptionId: `${name}-(${uniqueId})-form-item-description`,
|
|
@@ -185,10 +175,26 @@ function FormFieldControlledField(props) {
|
|
|
185
175
|
value: fieldContextValue,
|
|
186
176
|
children: /* @__PURE__ */ jsx(LaxFormFieldProvider, {
|
|
187
177
|
value: fieldContextValue,
|
|
188
|
-
children: /* @__PURE__ */ jsx(Controller, {
|
|
178
|
+
children: /* @__PURE__ */ jsx(Controller, {
|
|
179
|
+
control,
|
|
180
|
+
name,
|
|
181
|
+
render,
|
|
182
|
+
...restOfProps
|
|
183
|
+
})
|
|
189
184
|
})
|
|
190
185
|
});
|
|
191
186
|
}
|
|
187
|
+
function FormFieldBoundController(props) {
|
|
188
|
+
const { control } = useFormMethodsContext();
|
|
189
|
+
const { name } = useStrictFormFieldContext();
|
|
190
|
+
const { render, ...restOfProps } = props;
|
|
191
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
192
|
+
name,
|
|
193
|
+
control,
|
|
194
|
+
render,
|
|
195
|
+
...restOfProps
|
|
196
|
+
});
|
|
197
|
+
}
|
|
192
198
|
function FormFieldContext(props) {
|
|
193
199
|
const { children, render } = props;
|
|
194
200
|
const fieldContextValues = useStrictFormFieldContext();
|
|
@@ -530,19 +536,24 @@ function FormSubmit(props) {
|
|
|
530
536
|
}
|
|
531
537
|
function FormWatch(props) {
|
|
532
538
|
const fieldContextValues = useLaxFormFieldContext();
|
|
533
|
-
const { children, name = fieldContextValues?.name, render } = props;
|
|
539
|
+
const { children, compute, disabled, exact, name = fieldContextValues?.name, render } = props;
|
|
534
540
|
const { control } = useFormMethodsContext();
|
|
535
541
|
const formValue = useWatch({
|
|
542
|
+
compute,
|
|
536
543
|
control,
|
|
544
|
+
disabled,
|
|
545
|
+
exact,
|
|
537
546
|
name
|
|
538
547
|
});
|
|
539
|
-
return (typeof children === "function" ? children : render)(
|
|
548
|
+
return (typeof children === "function" ? children : render)(formValue);
|
|
540
549
|
}
|
|
541
|
-
function
|
|
550
|
+
function FormStateSubscribe(props) {
|
|
542
551
|
const fieldContextValues = useLaxFormFieldContext();
|
|
543
|
-
const { children, control, name = fieldContextValues?.name, render } = props;
|
|
552
|
+
const { children, control, disabled, exact, name = fieldContextValues?.name, render } = props;
|
|
544
553
|
const formState = useFormState({
|
|
545
554
|
control,
|
|
555
|
+
disabled,
|
|
556
|
+
exact,
|
|
546
557
|
name
|
|
547
558
|
});
|
|
548
559
|
return (typeof children === "function" ? children : render)(formState);
|
|
@@ -551,13 +562,13 @@ function FormWatchFormState(props) {
|
|
|
551
562
|
//#endregion
|
|
552
563
|
//#region src/components/ui/form/form-parts.ts
|
|
553
564
|
var form_parts_exports = /* @__PURE__ */ __export({
|
|
554
|
-
ControlledField: () => FormFieldControlledField,
|
|
555
565
|
Description: () => FormDescription,
|
|
556
566
|
ErrorMessage: () => FormErrorMessage,
|
|
557
567
|
ErrorMessagePrimitive: () => FormErrorMessagePrimitive,
|
|
558
568
|
Field: () => FormField,
|
|
569
|
+
FieldBoundController: () => FormFieldBoundController,
|
|
559
570
|
FieldContext: () => FormFieldContext,
|
|
560
|
-
|
|
571
|
+
FieldWithController: () => FormFieldWithController,
|
|
561
572
|
Input: () => FormInput,
|
|
562
573
|
InputGroup: () => FormInputGroup,
|
|
563
574
|
InputLeftItem: () => FormInputLeftItem,
|
|
@@ -566,13 +577,13 @@ var form_parts_exports = /* @__PURE__ */ __export({
|
|
|
566
577
|
Label: () => FormLabel,
|
|
567
578
|
Root: () => FormRoot,
|
|
568
579
|
Select: () => FormSelect,
|
|
580
|
+
StateSubscribe: () => FormStateSubscribe,
|
|
569
581
|
Submit: () => FormSubmit,
|
|
570
582
|
TextArea: () => FormTextArea,
|
|
571
583
|
TextAreaPrimitive: () => FormTextAreaPrimitive,
|
|
572
|
-
Watch: () => FormWatch
|
|
573
|
-
WatchFormState: () => FormWatchFormState
|
|
584
|
+
Watch: () => FormWatch
|
|
574
585
|
});
|
|
575
586
|
|
|
576
587
|
//#endregion
|
|
577
|
-
export { form_parts_exports as Form, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField,
|
|
588
|
+
export { form_parts_exports as Form, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldBoundController, FormFieldContext, FormFieldWithController, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormSelect, FormSelectPrimitive, FormStateSubscribe, FormSubmit, FormTextArea, FormTextAreaPrimitive, FormWatch, useStrictFormFieldContext as useFormFieldContext, useFormRootContext };
|
|
578
589
|
//# sourceMappingURL=index.js.map
|