@zayne-labs/ui-react 0.10.38 → 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 +2 -2
- package/dist/esm/common/presence/index.js +1 -2
- 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-CSxj6Lp1.d.ts → index-8XZFObid.d.ts} +2 -2
- package/dist/esm/{index-6DfF1UEM.d.ts → index-BlGC8KAT.d.ts} +6 -6
- package/dist/esm/{presence-C2VQITU0.js → presence-C3Q6J1Fh.js} +4 -4
- package/dist/esm/{presence-C2VQITU0.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 +7 -9
- package/dist/esm/ui/drop-zone/index.js.map +1 -1
- package/dist/esm/ui/form/index.d.ts +44 -48
- package/dist/esm/ui/form/index.js +35 -27
- package/dist/esm/ui/form/index.js.map +1 -1
- package/dist/style.css +10 -10
- package/package.json +11 -11
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __export } from "./chunk-BL-4obUL.js";
|
|
2
|
-
import { composeRefs, mergeProps } from "@zayne-labs/toolkit-react/utils";
|
|
3
2
|
import { isArray } from "@zayne-labs/toolkit-type-helpers";
|
|
4
3
|
import { Children, Fragment, cloneElement, isValidElement } from "react";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { composeRefs, mergeProps } from "@zayne-labs/toolkit-react/utils";
|
|
6
6
|
|
|
7
7
|
//#region src/components/common/slot/slot.tsx
|
|
8
8
|
function SlotRoot(props) {
|
|
@@ -36,12 +36,12 @@ const isSlottable = (child) => {
|
|
|
36
36
|
function SlotClone(props) {
|
|
37
37
|
const { children, ref: forwardedRef, ...restOfSlotProps } = props;
|
|
38
38
|
if (Children.count(children) > 1) return Children.only(null);
|
|
39
|
-
const
|
|
40
|
-
if (!isValidElement(
|
|
41
|
-
const ref = composeRefs(forwardedRef,
|
|
42
|
-
return cloneElement(
|
|
43
|
-
...mergeProps(restOfSlotProps,
|
|
44
|
-
...
|
|
39
|
+
const resolvedChild = isArray(children) ? children[0] : children;
|
|
40
|
+
if (!isValidElement(resolvedChild)) return null;
|
|
41
|
+
const ref = composeRefs(forwardedRef, resolvedChild.props.ref ?? resolvedChild.ref);
|
|
42
|
+
return cloneElement(resolvedChild, {
|
|
43
|
+
...mergeProps(restOfSlotProps, resolvedChild.props),
|
|
44
|
+
...resolvedChild.type !== Fragment && { ref }
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -54,4 +54,4 @@ var slot_parts_exports = /* @__PURE__ */ __export({
|
|
|
54
54
|
|
|
55
55
|
//#endregion
|
|
56
56
|
export { SlotRoot as n, SlotSlottable as r, slot_parts_exports as t };
|
|
57
|
-
//# sourceMappingURL=slot
|
|
57
|
+
//# sourceMappingURL=slot-CfhrgNxR.js.map
|
|
@@ -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_runtime21 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
|
|
|
@@ -441,7 +441,6 @@ const createDropZoneStore = (initStoreValues) => {
|
|
|
441
441
|
const useDropZone = (props) => {
|
|
442
442
|
const { allowedFileTypes, disabled = false, disableFilePickerOpenOnAreaClick = false, disableInternalStateSubscription = false, disablePreviewGenForNonImageFiles = true, initialFiles, maxFileCount, maxFileSize, multiple, onFilesChange, onUpload, onValidationError, onValidationSuccess, rejectDuplicateFiles = true, validator } = props ?? {};
|
|
443
443
|
const inputRef = useRef(null);
|
|
444
|
-
const isOnUploadFnProvided = onUpload !== void 0;
|
|
445
444
|
const stableOnFilesChange = useCallbackRef(onFilesChange);
|
|
446
445
|
const stableOnUpload = useCallbackRef(onUpload);
|
|
447
446
|
const stableOnUploadError = useCallbackRef(onValidationError);
|
|
@@ -460,7 +459,7 @@ const useDropZone = (props) => {
|
|
|
460
459
|
maxFileSize: shallowComparedMaxFileSize,
|
|
461
460
|
multiple,
|
|
462
461
|
onFilesChange: stableOnFilesChange,
|
|
463
|
-
onUpload:
|
|
462
|
+
onUpload: stableOnUpload,
|
|
464
463
|
onValidationError: stableOnUploadError,
|
|
465
464
|
onValidationSuccess: stableOnUploadSuccess,
|
|
466
465
|
rejectDuplicateFiles,
|
|
@@ -474,7 +473,6 @@ const useDropZone = (props) => {
|
|
|
474
473
|
shallowComparedMaxFileSize,
|
|
475
474
|
multiple,
|
|
476
475
|
stableOnFilesChange,
|
|
477
|
-
isOnUploadFnProvided,
|
|
478
476
|
stableOnUpload,
|
|
479
477
|
stableOnUploadError,
|
|
480
478
|
stableOnUploadSuccess,
|
|
@@ -508,8 +506,8 @@ const useDropZone = (props) => {
|
|
|
508
506
|
...innerProps,
|
|
509
507
|
className: cnMerge(`relative flex flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed
|
|
510
508
|
p-6 transition-colors duration-250 ease-out outline-none select-none
|
|
511
|
-
focus-visible:border-zu-ring/50`, `data-
|
|
512
|
-
data-
|
|
509
|
+
focus-visible:border-zu-ring/50`, `data-disabled:pointer-events-none data-drag-over:opacity-60
|
|
510
|
+
data-invalid:border-zu-destructive data-invalid:ring-zu-destructive/20`, innerProps.className),
|
|
513
511
|
"data-disabled": dataAttr(isDisabled),
|
|
514
512
|
onClick: composeTwoEventHandlers(onAreaClick, innerProps.onClick),
|
|
515
513
|
onDragEnter: composeTwoEventHandlers(actions.handleDragEnter, innerProps.onDragEnter),
|