@zayne-labs/ui-react 0.10.39 → 0.10.40
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 +4 -4
- package/dist/esm/common/client-gate/index.d.ts +2 -2
- package/dist/esm/common/client-gate/index.js +1 -1
- package/dist/esm/common/error-boundary/index.d.ts +1 -1
- package/dist/esm/common/error-boundary/index.js +1 -1
- package/dist/esm/common/for/index.d.ts +5 -5
- package/dist/esm/common/presence/index.d.ts +1 -1
- package/dist/esm/common/presence/index.js +1 -1
- package/dist/esm/common/show/index.d.ts +4 -4
- package/dist/esm/common/show/index.js +1 -1
- 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/suspense-with-boundary/index.js +1 -1
- package/dist/esm/common/switch/index.d.ts +4 -4
- package/dist/esm/common/switch/index.js +1 -1
- 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/{error-boundary-TM4xzQfq.js → error-boundary-DWMkqaAt.js} +2 -2
- package/dist/esm/{error-boundary-TM4xzQfq.js.map → error-boundary-DWMkqaAt.js.map} +1 -1
- package/dist/esm/{index-BpohqQE-.d.ts → index-8XZFObid.d.ts} +2 -2
- package/dist/esm/{index-DYKwNSzB.d.ts → index-BlGC8KAT.d.ts} +6 -6
- package/dist/esm/{presence-DNwNWipt.js → presence-C3Q6J1Fh.js} +3 -3
- package/dist/esm/{presence-DNwNWipt.js.map → presence-C3Q6J1Fh.js.map} +1 -1
- package/dist/esm/{show-C99TZhow.js → show-EaLp01Ro.js} +2 -2
- package/dist/esm/{show-C99TZhow.js.map → show-EaLp01Ro.js.map} +1 -1
- package/dist/esm/{slot--lEkrAQf.js → slot-CfhrgNxR.js} +8 -8
- package/dist/esm/{slot--lEkrAQf.js.map → slot-CfhrgNxR.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 +10 -10
- package/dist/esm/ui/carousel/index.js +2 -2
- package/dist/esm/ui/drag-scroll/index.js +2 -2
- package/dist/esm/ui/drop-zone/index.d.ts +18 -18
- package/dist/esm/ui/drop-zone/index.js +4 -4
- package/dist/esm/ui/form/index.d.ts +59 -63
- package/dist/esm/ui/form/index.js +35 -27
- package/dist/esm/ui/form/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot
|
|
1
|
+
{"version":3,"file":"slot-CfhrgNxR.js","names":["ReactFragment"],"sources":["../../src/components/common/slot/slot.tsx","../../src/components/common/slot/slot-parts.ts"],"sourcesContent":["import { composeRefs, type InferProps, mergeProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, type UnknownObject } from \"@zayne-labs/toolkit-type-helpers\";\n\nimport { Children, cloneElement, isValidElement, Fragment as ReactFragment } from \"react\";\n\ntype SlotProps = InferProps<HTMLElement> & { ref?: React.Ref<HTMLElement> };\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * ----------------------------------------------------------------------------------------------- */\n\nexport function SlotRoot(props: SlotProps) {\n\tconst { children, ...restOfSlotProps } = props;\n\n\tconst childrenArray = isArray<React.ReactNode>(children) ? children : [children];\n\n\tconst slottable = childrenArray.find((element) => isSlottable(element));\n\n\tif (!slottable) {\n\t\treturn <SlotClone {...restOfSlotProps}>{children}</SlotClone>;\n\t}\n\n\tif (!isValidElement<SlotProps>(slottable)) {\n\t\treturn null;\n\t}\n\n\t// == The new element to render is the one passed as a child of `Slot.Slottable`\n\tconst newElement = slottable.props.children;\n\n\tif (Children.count(newElement) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedNewElement = isArray(newElement) ? newElement[0] : newElement;\n\n\tif (!isValidElement(resolvedNewElement)) {\n\t\treturn null;\n\t}\n\n\tconst newChildren = childrenArray.map((child) => {\n\t\tif (child === slottable) {\n\t\t\t// == Because the new element will be the one rendered, we are only interested in grabbing its children (`newElement.props.children`)\n\t\t\treturn (resolvedNewElement.props as SlotProps).children;\n\t\t}\n\n\t\treturn child;\n\t});\n\n\treturn (\n\t\t<SlotClone {...restOfSlotProps}>\n\t\t\t{cloneElement(resolvedNewElement, undefined, newChildren)}\n\t\t</SlotClone>\n\t);\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * ----------------------------------------------------------------------------------------------- */\n\nexport function SlotSlottable({ children }: Pick<SlotProps, \"children\">) {\n\treturn children;\n}\n\nconst isSlottable = (child: React.ReactNode): child is React.ReactElement => {\n\treturn isValidElement(child) && child.type === SlotSlottable;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * ----------------------------------------------------------------------------------------------- */\ntype SlotCloneProps = Pick<SlotProps, \"children\" | \"ref\">;\n\nfunction SlotClone(props: SlotCloneProps) {\n\tconst { children, ref: forwardedRef, ...restOfSlotProps } = props;\n\n\tif (Children.count(children) > 1) {\n\t\treturn Children.only(null);\n\t}\n\n\tconst resolvedChild = isArray(children) ? children[0] : children;\n\n\tif (!isValidElement<UnknownObject>(resolvedChild)) {\n\t\treturn null;\n\t}\n\n\tconst childRef = (resolvedChild.props.ref\n\t\t?? (resolvedChild as unknown as UnknownObject).ref) as React.Ref<HTMLElement>;\n\n\tconst ref = composeRefs(forwardedRef, childRef);\n\n\tconst clonedProps = {\n\t\t...mergeProps(restOfSlotProps, resolvedChild.props),\n\t\t...(resolvedChild.type !== ReactFragment && { ref }),\n\t};\n\n\treturn cloneElement(resolvedChild, clonedProps);\n}\n","export { SlotRoot as Root, SlotSlottable as Slottable } from \"./slot\";\n"],"mappings":";;;;;;;AAWA,SAAgB,SAAS,OAAkB;CAC1C,MAAM,EAAE,UAAU,GAAG,oBAAoB;CAEzC,MAAM,gBAAgB,QAAyB,SAAS,GAAG,WAAW,CAAC,SAAS;CAEhF,MAAM,YAAY,cAAc,MAAM,YAAY,YAAY,QAAQ,CAAC;AAEvE,KAAI,CAAC,UACJ,QAAO,oBAAC;EAAU,GAAI;EAAkB;GAAqB;AAG9D,KAAI,CAAC,eAA0B,UAAU,CACxC,QAAO;CAIR,MAAM,aAAa,UAAU,MAAM;AAEnC,KAAI,SAAS,MAAM,WAAW,GAAG,EAChC,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,qBAAqB,QAAQ,WAAW,GAAG,WAAW,KAAK;AAEjE,KAAI,CAAC,eAAe,mBAAmB,CACtC,QAAO;CAGR,MAAM,cAAc,cAAc,KAAK,UAAU;AAChD,MAAI,UAAU,UAEb,QAAQ,mBAAmB,MAAoB;AAGhD,SAAO;GACN;AAEF,QACC,oBAAC;EAAU,GAAI;YACb,aAAa,oBAAoB,QAAW,YAAY;GAC9C;;AAQd,SAAgB,cAAc,EAAE,YAAyC;AACxE,QAAO;;AAGR,MAAM,eAAe,UAAwD;AAC5E,QAAO,eAAe,MAAM,IAAI,MAAM,SAAS;;AAQhD,SAAS,UAAU,OAAuB;CACzC,MAAM,EAAE,UAAU,KAAK,cAAc,GAAG,oBAAoB;AAE5D,KAAI,SAAS,MAAM,SAAS,GAAG,EAC9B,QAAO,SAAS,KAAK,KAAK;CAG3B,MAAM,gBAAgB,QAAQ,SAAS,GAAG,SAAS,KAAK;AAExD,KAAI,CAAC,eAA8B,cAAc,CAChD,QAAO;CAMR,MAAM,MAAM,YAAY,cAHN,cAAc,MAAM,OACjC,cAA2C,IAED;AAO/C,QAAO,aAAa,eALA;EACnB,GAAG,WAAW,iBAAiB,cAAc,MAAM;EACnD,GAAI,cAAc,SAASA,YAAiB,EAAE,KAAK;EACnD,CAE8C"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
1
2
|
import { PolymorphicProps } from "@zayne-labs/toolkit-react/utils";
|
|
2
|
-
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/ui/card/card.d.ts
|
|
5
|
-
declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement>):
|
|
6
|
-
declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement>):
|
|
7
|
-
declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement>):
|
|
8
|
-
declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement>):
|
|
9
|
-
declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>):
|
|
10
|
-
declare function CardAction<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>):
|
|
5
|
+
declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement>): react_jsx_runtime17.JSX.Element;
|
|
6
|
+
declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement>): react_jsx_runtime17.JSX.Element;
|
|
7
|
+
declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement>): react_jsx_runtime17.JSX.Element;
|
|
8
|
+
declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement>): react_jsx_runtime17.JSX.Element;
|
|
9
|
+
declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime17.JSX.Element;
|
|
10
|
+
declare function CardAction<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime17.JSX.Element;
|
|
11
11
|
declare function CardFooter<TElement extends React.ElementType = "footer">(props: PolymorphicProps<TElement, {
|
|
12
12
|
asChild?: boolean;
|
|
13
|
-
}>):
|
|
13
|
+
}>): react_jsx_runtime17.JSX.Element;
|
|
14
14
|
declare namespace card_parts_d_exports {
|
|
15
15
|
export { CardAction as Action, CardContent as Content, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
|
|
16
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __export } from "../../chunk-BL-4obUL.js";
|
|
2
|
-
import { n as SlotRoot } from "../../slot
|
|
2
|
+
import { n as SlotRoot } from "../../slot-CfhrgNxR.js";
|
|
3
3
|
import { t as cnMerge } from "../../cn-Ba8kxuby.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
|
|
2
1
|
import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
|
|
3
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime24 from "react/jsx-runtime";
|
|
3
|
+
import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
|
|
4
4
|
import { StoreApi } from "@zayne-labs/toolkit-core";
|
|
5
5
|
|
|
6
6
|
//#region src/components/ui/carousel/types.d.ts
|
|
@@ -78,14 +78,14 @@ type OtherCarouselProps = {
|
|
|
78
78
|
};
|
|
79
79
|
//#endregion
|
|
80
80
|
//#region src/components/ui/carousel/carousel.d.ts
|
|
81
|
-
declare function CarouselRoot<TImages extends ImagesType, TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>):
|
|
82
|
-
declare function CarouselButton(props: CarouselButtonsProps):
|
|
83
|
-
declare function CarouselControls(props: CarouselControlProps):
|
|
84
|
-
declare function CarouselItemList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>):
|
|
85
|
-
declare function CarouselItem(props: OtherCarouselProps):
|
|
86
|
-
declare function CarouselCaption<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>):
|
|
87
|
-
declare function CarouselIndicatorList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>):
|
|
88
|
-
declare function CarouselIndicator(props: CarouselIndicatorProps):
|
|
81
|
+
declare function CarouselRoot<TImages extends ImagesType, TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>): react_jsx_runtime24.JSX.Element;
|
|
82
|
+
declare function CarouselButton(props: CarouselButtonsProps): react_jsx_runtime24.JSX.Element;
|
|
83
|
+
declare function CarouselControls(props: CarouselControlProps): react_jsx_runtime24.JSX.Element;
|
|
84
|
+
declare function CarouselItemList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime24.JSX.Element;
|
|
85
|
+
declare function CarouselItem(props: OtherCarouselProps): react_jsx_runtime24.JSX.Element;
|
|
86
|
+
declare function CarouselCaption<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>): react_jsx_runtime24.JSX.Element;
|
|
87
|
+
declare function CarouselIndicatorList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime24.JSX.Element;
|
|
88
|
+
declare function CarouselIndicator(props: CarouselIndicatorProps): react_jsx_runtime24.JSX.Element;
|
|
89
89
|
declare namespace carousel_parts_d_exports {
|
|
90
90
|
export { CarouselButton as Button, CarouselCaption as Caption, CarouselControls as Controls, CarouselIndicator as Indicator, CarouselIndicatorList as IndicatorList, CarouselItem as Item, CarouselItemList as ItemList, CarouselRoot as Root };
|
|
91
91
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { t as __export } from "../../chunk-BL-4obUL.js";
|
|
4
4
|
import { n as For } from "../../for-DsdwXl8s.js";
|
|
5
|
-
import { i as ShowRoot, n as ShowContent, r as ShowFallback } from "../../show-
|
|
5
|
+
import { i as ShowRoot, n as ShowContent, r as ShowFallback } from "../../show-EaLp01Ro.js";
|
|
6
6
|
import { t as cnMerge } from "../../cn-Ba8kxuby.js";
|
|
7
|
+
import { useAnimationInterval, useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
|
|
7
8
|
import { isFunction } from "@zayne-labs/toolkit-type-helpers";
|
|
8
9
|
import { useMemo, useState } from "react";
|
|
9
|
-
import { useAnimationInterval, useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { createStore } from "@zayne-labs/toolkit-core";
|
|
12
12
|
import { createReactStoreContext } from "@zayne-labs/toolkit-react/zustand";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as cnMerge } from "../../cn-Ba8kxuby.js";
|
|
2
|
-
import { composeRefs, mergeTwoProps } from "@zayne-labs/toolkit-react/utils";
|
|
3
|
-
import { useCallback, useMemo, useRef } from "react";
|
|
4
2
|
import { useCallbackRef, useLazyRef } from "@zayne-labs/toolkit-react";
|
|
3
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
4
|
+
import { composeRefs, mergeTwoProps } from "@zayne-labs/toolkit-react/utils";
|
|
5
5
|
import { checkIsDeviceMobile, on } from "@zayne-labs/toolkit-core";
|
|
6
6
|
|
|
7
7
|
//#region src/components/ui/drag-scroll/utils.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@zayne-labs/toolkit-react";
|
|
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
|
|
5
|
-
import "
|
|
6
|
-
import
|
|
4
|
+
import * as react30 from "react";
|
|
5
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
6
|
+
import { InferProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
|
|
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_runtime5.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_runtime5.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_runtime5.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_runtime5.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_runtime5.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_runtime5.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_runtime5.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_runtime5.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_runtime5.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_runtime5.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_runtime5.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_runtime5.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,15 +1,15 @@
|
|
|
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-CfhrgNxR.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-C3Q6J1Fh.js";
|
|
7
7
|
import { t as cnMerge } from "../../cn-Ba8kxuby.js";
|
|
8
|
-
import {
|
|
8
|
+
import { createCustomContext, useCallbackRef, useConstant, useShallowCompSelector, useShallowCompValue, useStore, useUnmountEffect } from "@zayne-labs/toolkit-react";
|
|
9
9
|
import { isBoolean, isFile, isFunction, isNumber, isObject, isString } from "@zayne-labs/toolkit-type-helpers";
|
|
10
10
|
import { useCallback, useMemo, useRef } from "react";
|
|
11
|
-
import { createCustomContext, useCallbackRef, useConstant, useShallowCompSelector, useShallowCompValue, useStore, useUnmountEffect } from "@zayne-labs/toolkit-react";
|
|
12
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { composeRefs, composeTwoEventHandlers } from "@zayne-labs/toolkit-react/utils";
|
|
13
13
|
import { createFileURL, createStore, dataAttr, formatBytes, generateFileID, handleFileValidationAsync, toArray } from "@zayne-labs/toolkit-core";
|
|
14
14
|
import { createReactStoreContext } from "@zayne-labs/toolkit-react/zustand";
|
|
15
15
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DiscriminatedRenderItemProps, DiscriminatedRenderProps, InferProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
|
|
2
|
-
import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
|
|
3
|
-
import * as react20 from "react";
|
|
4
1
|
import "@zayne-labs/toolkit-react";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
2
|
+
import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
|
|
3
|
+
import * as react37 from "react";
|
|
4
|
+
import * as react_jsx_runtime32 from "react/jsx-runtime";
|
|
5
|
+
import { DiscriminatedRenderItemProps, DiscriminatedRenderProps, InferProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
|
|
6
|
+
import { Control, ControllerProps, DeepPartialSkipArrayKey, FieldPath, FieldPathValue, FieldPathValues, FieldValues as FieldValues$1, FormStateSubscribeProps, RegisterOptions, UseFormReturn, UseFormStateReturn, useFormContext as useFormRootContext } from "react-hook-form";
|
|
7
7
|
|
|
8
8
|
//#region src/components/ui/form/form-context.d.ts
|
|
9
9
|
|
|
@@ -32,18 +32,32 @@ type FieldState = {
|
|
|
32
32
|
isInvalid?: boolean;
|
|
33
33
|
};
|
|
34
34
|
//#endregion
|
|
35
|
+
//#region src/components/ui/form/types.d.ts
|
|
36
|
+
type WatchDefaultValue<TFieldName, TFieldValues extends FieldValues$1 = FieldValues$1> = TFieldName extends FieldPath<TFieldValues> ? FieldPathValue<TFieldValues, TFieldName> : DeepPartialSkipArrayKey<TFieldValues>;
|
|
37
|
+
type WatchValue<TFieldName, TFieldValues extends FieldValues$1 = FieldValues$1> = TFieldName extends Array<FieldPath<TFieldValues>> | ReadonlyArray<FieldPath<TFieldValues>> ? FieldPathValues<TFieldValues, TFieldName> : TFieldName extends FieldPath<TFieldValues> ? FieldPathValue<TFieldValues, TFieldName> : TFieldValues;
|
|
38
|
+
type WatchRenderValue<TFieldName, TFieldValues extends FieldValues$1, TComputeValue> = TComputeValue extends undefined ? WatchValue<TFieldName, TFieldValues> : TComputeValue;
|
|
39
|
+
type WatchProps<TFieldName extends Array<FieldPath<TFieldValues>> | FieldPath<TFieldValues> | ReadonlyArray<FieldPath<TFieldValues>> | undefined = undefined, TFieldValues extends FieldValues$1 = FieldValues$1, TContext = unknown, TTransformedValues = TFieldValues, TComputeValue = undefined> = {
|
|
40
|
+
compute?: (value: WatchValue<TFieldName, TFieldValues>) => TComputeValue;
|
|
41
|
+
control?: Control<TFieldValues, TContext, TTransformedValues>;
|
|
42
|
+
defaultValue?: WatchDefaultValue<TFieldName, TFieldValues>;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
exact?: boolean;
|
|
45
|
+
name?: TFieldName;
|
|
46
|
+
render: (value: WatchRenderValue<TFieldName, TFieldValues, TComputeValue>) => React.ReactNode;
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
35
49
|
//#region src/components/ui/form/form.d.ts
|
|
36
50
|
type FieldValues = Record<string, any>;
|
|
37
|
-
type FormRootProps<TFieldValues extends FieldValues> = InferProps<"form"> & Partial<FormRootContext> & {
|
|
51
|
+
type FormRootProps<TFieldValues extends FieldValues, TTransformedValues> = InferProps<"form"> & Partial<FormRootContext> & {
|
|
38
52
|
children: React.ReactNode;
|
|
39
|
-
|
|
53
|
+
form: UseFormReturn<TFieldValues, unknown, TTransformedValues>;
|
|
40
54
|
};
|
|
41
|
-
declare function FormRoot<
|
|
42
|
-
type FormFieldProps<TControl, TFieldValues extends FieldValues> = (TControl extends (Control<infer TValues>) ? {
|
|
55
|
+
declare function FormRoot<TFieldValues extends FieldValues, TTransformedValues = TFieldValues>(props: FormRootProps<TFieldValues, TTransformedValues>): react_jsx_runtime32.JSX.Element;
|
|
56
|
+
type FormFieldProps<TControl, TFieldValues extends FieldValues, TTransformedValues> = (TControl extends (Control<infer TValues>) ? {
|
|
43
57
|
control?: never;
|
|
44
58
|
name: FieldPath<TValues>;
|
|
45
59
|
} : {
|
|
46
|
-
control?: Control<TFieldValues>;
|
|
60
|
+
control?: Control<TFieldValues, unknown, TTransformedValues>;
|
|
47
61
|
name: FieldPath<TFieldValues>;
|
|
48
62
|
}) & ((InferProps<"div"> & {
|
|
49
63
|
withWrapper?: true;
|
|
@@ -52,35 +66,29 @@ type FormFieldProps<TControl, TFieldValues extends FieldValues> = (TControl exte
|
|
|
52
66
|
className?: never;
|
|
53
67
|
withWrapper: false;
|
|
54
68
|
});
|
|
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;
|
|
69
|
+
declare function FormField<TControl, TFieldValues extends FieldValues, TTransformedValues>(props: FormFieldProps<TControl, TFieldValues, TTransformedValues>): react_jsx_runtime32.JSX.Element;
|
|
70
|
+
type FormFieldControlledFieldProps<TControl, TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>, TTransformedValues = TFieldValues> = TControl extends Control<infer TValues> ? Omit<ControllerProps<TValues, FieldPath<TValues>, TTransformedValues>, "control"> & {
|
|
71
|
+
control?: never;
|
|
72
|
+
} : ControllerProps<TFieldValues, TName, TTransformedValues>;
|
|
73
|
+
declare function FormFieldWithController<TControl, TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>, TTransformedValues = TFieldValues>(props: FormFieldControlledFieldProps<TControl, TFieldValues, TName, TTransformedValues>): react_jsx_runtime32.JSX.Element;
|
|
74
|
+
type FormFieldBoundControllerProps<TFieldValues extends FieldValues, TTransformedValues> = Omit<ControllerProps<TFieldValues, never, TTransformedValues>, "control" | "name">;
|
|
75
|
+
declare function FormFieldBoundController<TFieldValues extends FieldValues = Record<string, never>, TTransformedValues = TFieldValues>(props: FormFieldBoundControllerProps<TFieldValues, TTransformedValues>): react_jsx_runtime32.JSX.Element;
|
|
76
|
+
declare function FormFieldContext(props: FormFieldContextProps): react37.ReactNode;
|
|
77
|
+
declare function FormLabel(props: InferProps<"label">): react_jsx_runtime32.JSX.Element;
|
|
78
|
+
declare function FormInputGroup(props: InferProps<"div">): react_jsx_runtime32.JSX.Element;
|
|
71
79
|
type FormSideItemProps = {
|
|
72
80
|
children?: React.ReactNode;
|
|
73
81
|
className?: string;
|
|
74
82
|
};
|
|
75
|
-
declare function FormInputLeftItem<TElement extends React.ElementType = "span">(props: PolymorphicPropsStrict<TElement, FormSideItemProps>):
|
|
83
|
+
declare function FormInputLeftItem<TElement extends React.ElementType = "span">(props: PolymorphicPropsStrict<TElement, FormSideItemProps>): react_jsx_runtime32.JSX.Element;
|
|
76
84
|
declare namespace FormInputLeftItem {
|
|
77
85
|
var slotSymbol: symbol;
|
|
78
86
|
}
|
|
79
|
-
declare function FormInputRightItem<TElement extends React.ElementType = "span">(props: PolymorphicPropsStrict<TElement, FormSideItemProps>):
|
|
87
|
+
declare function FormInputRightItem<TElement extends React.ElementType = "span">(props: PolymorphicPropsStrict<TElement, FormSideItemProps>): react_jsx_runtime32.JSX.Element;
|
|
80
88
|
declare namespace FormInputRightItem {
|
|
81
89
|
var slotSymbol: symbol;
|
|
82
90
|
}
|
|
83
|
-
type FormInputPrimitiveProps<TFieldValues extends FieldValues
|
|
91
|
+
type FormInputPrimitiveProps<TFieldValues extends FieldValues> = Omit<React.ComponentPropsWithRef<"input">, "children"> & {
|
|
84
92
|
classNames?: {
|
|
85
93
|
error?: string;
|
|
86
94
|
eyeIcon?: string;
|
|
@@ -92,7 +100,7 @@ type FormInputPrimitiveProps<TFieldValues extends FieldValues = FieldValues> = O
|
|
|
92
100
|
name?: FieldPath<TFieldValues>;
|
|
93
101
|
withEyeIcon?: FormRootContext["withEyeIcon"];
|
|
94
102
|
};
|
|
95
|
-
type FormTextAreaPrimitiveProps<TFieldValues extends FieldValues
|
|
103
|
+
type FormTextAreaPrimitiveProps<TFieldValues extends FieldValues> = React.ComponentPropsWithRef<"textarea"> & {
|
|
96
104
|
classNames?: {
|
|
97
105
|
base?: string;
|
|
98
106
|
error?: string;
|
|
@@ -101,7 +109,7 @@ type FormTextAreaPrimitiveProps<TFieldValues extends FieldValues = FieldValues>
|
|
|
101
109
|
fieldState?: FieldState;
|
|
102
110
|
name?: FieldPath<TFieldValues>;
|
|
103
111
|
};
|
|
104
|
-
type FormSelectPrimitiveProps<TFieldValues extends FieldValues
|
|
112
|
+
type FormSelectPrimitiveProps<TFieldValues extends FieldValues> = React.ComponentPropsWithRef<"select"> & {
|
|
105
113
|
classNames?: {
|
|
106
114
|
base?: string;
|
|
107
115
|
error?: string;
|
|
@@ -112,21 +120,21 @@ type FormSelectPrimitiveProps<TFieldValues extends FieldValues = FieldValues> =
|
|
|
112
120
|
};
|
|
113
121
|
declare function FormInputPrimitive<TFieldValues extends FieldValues>(props: FormInputPrimitiveProps<TFieldValues> & {
|
|
114
122
|
rules?: RegisterOptions;
|
|
115
|
-
}):
|
|
123
|
+
}): react_jsx_runtime32.JSX.Element;
|
|
116
124
|
declare function FormTextAreaPrimitive<TFieldValues extends FieldValues>(props: FormTextAreaPrimitiveProps<TFieldValues> & {
|
|
117
125
|
rules?: RegisterOptions;
|
|
118
|
-
}):
|
|
126
|
+
}): react_jsx_runtime32.JSX.Element;
|
|
119
127
|
declare function FormSelectPrimitive<TFieldValues extends FieldValues>(props: FormSelectPrimitiveProps<TFieldValues> & {
|
|
120
128
|
rules?: RegisterOptions;
|
|
121
|
-
}):
|
|
129
|
+
}): react_jsx_runtime32.JSX.Element;
|
|
122
130
|
type PrimitivePropsToOmit = "control" | "formState" | "name";
|
|
123
|
-
type FormInputProps = Omit<FormInputPrimitiveProps
|
|
131
|
+
type FormInputProps = Omit<FormInputPrimitiveProps<FieldValues>, PrimitivePropsToOmit> & {
|
|
124
132
|
rules?: RegisterOptions;
|
|
125
133
|
};
|
|
126
|
-
type FormTextAreaProps = Omit<FormTextAreaPrimitiveProps
|
|
134
|
+
type FormTextAreaProps = Omit<FormTextAreaPrimitiveProps<FieldValues>, PrimitivePropsToOmit> & {
|
|
127
135
|
rules?: RegisterOptions;
|
|
128
136
|
};
|
|
129
|
-
type FormSelectProps = Omit<FormSelectPrimitiveProps
|
|
137
|
+
type FormSelectProps = Omit<FormSelectPrimitiveProps<FieldValues>, PrimitivePropsToOmit> & {
|
|
130
138
|
rules?: RegisterOptions;
|
|
131
139
|
};
|
|
132
140
|
type CombinedFormInputProps = (FormSelectProps & {
|
|
@@ -136,10 +144,10 @@ type CombinedFormInputProps = (FormSelectProps & {
|
|
|
136
144
|
}) | FormInputProps;
|
|
137
145
|
declare function FormInput(props: CombinedFormInputProps & {
|
|
138
146
|
rules?: RegisterOptions;
|
|
139
|
-
}):
|
|
140
|
-
declare function FormTextArea(props: FormTextAreaProps):
|
|
141
|
-
declare function FormSelect(props: FormSelectProps):
|
|
142
|
-
declare function FormDescription(props: InferProps<"p">):
|
|
147
|
+
}): react_jsx_runtime32.JSX.Element;
|
|
148
|
+
declare function FormTextArea(props: FormTextAreaProps): react_jsx_runtime32.JSX.Element;
|
|
149
|
+
declare function FormSelect(props: FormSelectProps): react_jsx_runtime32.JSX.Element;
|
|
150
|
+
declare function FormDescription(props: InferProps<"p">): react_jsx_runtime32.JSX.Element;
|
|
143
151
|
type ErrorMessageRenderProps = {
|
|
144
152
|
className: string;
|
|
145
153
|
"data-index": number;
|
|
@@ -183,45 +191,33 @@ type FormErrorMessagePrimitiveType = {
|
|
|
183
191
|
}>): React.ReactNode;
|
|
184
192
|
};
|
|
185
193
|
declare const FormErrorMessagePrimitive: FormErrorMessagePrimitiveType;
|
|
186
|
-
type FormErrorMessageProps<TControl, TFieldValues extends FieldValues> = (TControl extends Control<infer TValues> ? {
|
|
194
|
+
type FormErrorMessageProps<TControl, TFieldValues extends FieldValues, TTransformedValues> = (TControl extends Control<infer TValues> ? {
|
|
187
195
|
className?: string;
|
|
188
196
|
control?: never;
|
|
189
197
|
errorField?: FieldPath<TValues>;
|
|
190
198
|
type?: "regular";
|
|
191
199
|
} : {
|
|
192
200
|
className?: string;
|
|
193
|
-
control?: Control<TFieldValues>;
|
|
201
|
+
control?: Control<TFieldValues, unknown, TTransformedValues>;
|
|
194
202
|
errorField?: FieldPath<TFieldValues>;
|
|
195
203
|
type?: "regular";
|
|
196
204
|
}) | {
|
|
197
205
|
className?: string;
|
|
198
|
-
control?: never;
|
|
199
206
|
errorField: string;
|
|
200
207
|
type: "root";
|
|
201
208
|
};
|
|
202
|
-
declare function FormErrorMessage<TControl, TFieldValues extends FieldValues = FieldValues>(props: FormErrorMessageProps<TControl, TFieldValues>):
|
|
209
|
+
declare function FormErrorMessage<TControl, TFieldValues extends FieldValues = FieldValues, TTransformedValues = TFieldValues>(props: FormErrorMessageProps<TControl, TFieldValues, TTransformedValues>): react_jsx_runtime32.JSX.Element;
|
|
203
210
|
type FormSubmitProps = InferProps<"button"> & {
|
|
204
211
|
asChild?: boolean;
|
|
205
212
|
};
|
|
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;
|
|
213
|
+
declare function FormSubmit<TElement extends React.ElementType = "button">(props: PolymorphicPropsStrict<TElement, FormSubmitProps>): react_jsx_runtime32.JSX.Element;
|
|
214
|
+
type FormWatchProps<TFieldValues extends FieldValues, TFieldName extends Array<FieldPath<TFieldValues>> | FieldPath<TFieldValues> | ReadonlyArray<FieldPath<TFieldValues>> | undefined, TTransformedValues, TComputeValue, TComputedProps extends WatchProps<TFieldName, TFieldValues, unknown, TTransformedValues, TComputeValue> = WatchProps<TFieldName, TFieldValues, unknown, TTransformedValues, TComputeValue>> = DiscriminatedRenderProps<TComputedProps["render"]> & Omit<TComputedProps, "render">;
|
|
215
|
+
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;
|
|
216
|
+
type FormWatchFormStateProps<TFieldValues extends FieldValues, TTransformedValues, TComputedProps extends FormStateSubscribeProps<TFieldValues, TTransformedValues> = FormStateSubscribeProps<TFieldValues, TTransformedValues>> = DiscriminatedRenderProps<TComputedProps["render"]> & Omit<TComputedProps, "render">;
|
|
217
|
+
declare function FormStateSubscribe<TFieldValues extends FieldValues, TTransformedValues = TFieldValues>(props: FormWatchFormStateProps<TFieldValues, TTransformedValues>): react37.ReactNode;
|
|
222
218
|
declare namespace form_parts_d_exports {
|
|
223
|
-
export {
|
|
219
|
+
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
220
|
}
|
|
225
221
|
//#endregion
|
|
226
|
-
export { FieldValues, form_parts_d_exports as Form, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormErrorMessagePrimitiveProps, FormField,
|
|
222
|
+
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
223
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,14 +1,14 @@
|
|
|
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-CfhrgNxR.js";
|
|
5
5
|
import { r as ForWithWrapper } from "../../for-DsdwXl8s.js";
|
|
6
6
|
import { t as cnMerge } from "../../cn-Ba8kxuby.js";
|
|
7
|
-
import {
|
|
7
|
+
import { ContextError, createCustomContext, useCallbackRef, useToggle } from "@zayne-labs/toolkit-react";
|
|
8
8
|
import { defineEnum, isObject } from "@zayne-labs/toolkit-type-helpers";
|
|
9
9
|
import { Fragment, createElement, useEffect, useId, useMemo, useRef } from "react";
|
|
10
|
-
import { ContextError, createCustomContext, useCallbackRef, useToggle } from "@zayne-labs/toolkit-react";
|
|
11
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { composeRefs, composeTwoEventHandlers, getMultipleSlots } from "@zayne-labs/toolkit-react/utils";
|
|
12
12
|
import { dataAttr, on, toArray } from "@zayne-labs/toolkit-core";
|
|
13
13
|
import { Controller, FormProvider, useFormContext, useFormContext as useFormRootContext, useFormState, useWatch } from "react-hook-form";
|
|
14
14
|
|
|
@@ -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();
|
|
@@ -536,13 +542,15 @@ function FormWatch(props) {
|
|
|
536
542
|
control,
|
|
537
543
|
name
|
|
538
544
|
});
|
|
539
|
-
return (typeof children === "function" ? children : render)(
|
|
545
|
+
return (typeof children === "function" ? children : render)(formValue);
|
|
540
546
|
}
|
|
541
|
-
function
|
|
547
|
+
function FormStateSubscribe(props) {
|
|
542
548
|
const fieldContextValues = useLaxFormFieldContext();
|
|
543
|
-
const { children, control, name = fieldContextValues?.name, render } = props;
|
|
549
|
+
const { children, control, disabled, exact, name = fieldContextValues?.name, render } = props;
|
|
544
550
|
const formState = useFormState({
|
|
545
551
|
control,
|
|
552
|
+
disabled,
|
|
553
|
+
exact,
|
|
546
554
|
name
|
|
547
555
|
});
|
|
548
556
|
return (typeof children === "function" ? children : render)(formState);
|
|
@@ -551,13 +559,13 @@ function FormWatchFormState(props) {
|
|
|
551
559
|
//#endregion
|
|
552
560
|
//#region src/components/ui/form/form-parts.ts
|
|
553
561
|
var form_parts_exports = /* @__PURE__ */ __export({
|
|
554
|
-
ControlledField: () => FormFieldControlledField,
|
|
555
562
|
Description: () => FormDescription,
|
|
556
563
|
ErrorMessage: () => FormErrorMessage,
|
|
557
564
|
ErrorMessagePrimitive: () => FormErrorMessagePrimitive,
|
|
558
565
|
Field: () => FormField,
|
|
566
|
+
FieldBoundController: () => FormFieldBoundController,
|
|
559
567
|
FieldContext: () => FormFieldContext,
|
|
560
|
-
|
|
568
|
+
FieldWithController: () => FormFieldWithController,
|
|
561
569
|
Input: () => FormInput,
|
|
562
570
|
InputGroup: () => FormInputGroup,
|
|
563
571
|
InputLeftItem: () => FormInputLeftItem,
|
|
@@ -566,13 +574,13 @@ var form_parts_exports = /* @__PURE__ */ __export({
|
|
|
566
574
|
Label: () => FormLabel,
|
|
567
575
|
Root: () => FormRoot,
|
|
568
576
|
Select: () => FormSelect,
|
|
577
|
+
StateSubscribe: () => FormStateSubscribe,
|
|
569
578
|
Submit: () => FormSubmit,
|
|
570
579
|
TextArea: () => FormTextArea,
|
|
571
580
|
TextAreaPrimitive: () => FormTextAreaPrimitive,
|
|
572
|
-
Watch: () => FormWatch
|
|
573
|
-
WatchFormState: () => FormWatchFormState
|
|
581
|
+
Watch: () => FormWatch
|
|
574
582
|
});
|
|
575
583
|
|
|
576
584
|
//#endregion
|
|
577
|
-
export { form_parts_exports as Form, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField,
|
|
585
|
+
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
586
|
//# sourceMappingURL=index.js.map
|