@zayne-labs/ui-react 0.10.32 → 0.10.33

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.
Files changed (40) hide show
  1. package/dist/esm/common/await/index.d.ts +5 -5
  2. package/dist/esm/common/await/index.js +4 -4
  3. package/dist/esm/common/client-gate/index.js +1 -1
  4. package/dist/esm/common/error-boundary/index.d.ts +1 -1
  5. package/dist/esm/common/error-boundary/index.js +1 -1
  6. package/dist/esm/common/for/index.d.ts +3 -3
  7. package/dist/esm/common/presence/index.d.ts +13 -10
  8. package/dist/esm/common/presence/index.js +2 -1
  9. package/dist/esm/common/show/index.js +1 -1
  10. package/dist/esm/common/slot/index.d.ts +6 -4
  11. package/dist/esm/common/slot/index.js +1 -1
  12. package/dist/esm/common/suspense-with-boundary/index.d.ts +2 -2
  13. package/dist/esm/common/suspense-with-boundary/index.js +1 -1
  14. package/dist/esm/common/switch/index.js +1 -1
  15. package/dist/esm/{error-boundary-y9Samt_s.js → error-boundary-6VGflFQ9.js} +23 -28
  16. package/dist/esm/{error-boundary-y9Samt_s.js.map → error-boundary-6VGflFQ9.js.map} +1 -1
  17. package/dist/esm/{index-DtKTXtS7.d.ts → index-X53nnrcP.d.ts} +4 -4
  18. package/dist/esm/{index-geg5m4_w.d.ts → index-xeDQG1qT.d.ts} +4 -4
  19. package/dist/esm/{presence-CzmCEhXS.js → presence-Bj-YnaHv.js} +48 -15
  20. package/dist/esm/presence-Bj-YnaHv.js.map +1 -0
  21. package/dist/esm/{show-CDY_D1V0.js → show-kIsXcWiR.js} +3 -4
  22. package/dist/esm/{show-CDY_D1V0.js.map → show-kIsXcWiR.js.map} +1 -1
  23. package/dist/esm/{slot-DNzYW76j.js → slot-HtgJHjB9.js} +5 -7
  24. package/dist/esm/slot-HtgJHjB9.js.map +1 -0
  25. package/dist/esm/ui/card/index.d.ts +1 -1
  26. package/dist/esm/ui/card/index.js +2 -3
  27. package/dist/esm/ui/card/index.js.map +1 -1
  28. package/dist/esm/ui/carousel/index.d.ts +10 -10
  29. package/dist/esm/ui/carousel/index.js +4 -6
  30. package/dist/esm/ui/carousel/index.js.map +1 -1
  31. package/dist/esm/ui/drag-scroll/index.js +2 -2
  32. package/dist/esm/ui/drop-zone/index.d.ts +15 -15
  33. package/dist/esm/ui/drop-zone/index.js +35 -47
  34. package/dist/esm/ui/drop-zone/index.js.map +1 -1
  35. package/dist/esm/ui/form/index.d.ts +20 -20
  36. package/dist/esm/ui/form/index.js +13 -16
  37. package/dist/esm/ui/form/index.js.map +1 -1
  38. package/package.json +7 -7
  39. package/dist/esm/presence-CzmCEhXS.js.map +0 -1
  40. package/dist/esm/slot-DNzYW76j.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Component","Slot.Root"],"sources":["../../../../src/components/ui/card/card.tsx","../../../../src/components/ui/card/card-parts.ts"],"sourcesContent":["import type { PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport * as React from \"react\";\nimport { Slot } from \"@/components/common/slot\";\nimport { cnMerge } from \"@/lib/utils/cn\";\n\nexport function CardRoot<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"article\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"root\"\n\t\t\tdata-slot=\"card-root\"\n\t\t\tclassName={cnMerge(\"flex flex-col\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardHeader<TElement extends React.ElementType = \"header\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"header\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"header\"\n\t\t\tdata-slot=\"card-header\"\n\t\t\tclassName={className}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardTitle<TElement extends React.ElementType = \"h3\">(props: PolymorphicProps<TElement>) {\n\tconst { as: Element = \"h3\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"title\"\n\t\t\tdata-slot=\"card-title\"\n\t\t\tclassName={cnMerge(\"leading-none font-semibold\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardDescription<TElement extends React.ElementType = \"p\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"p\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"description\"\n\t\t\tdata-slot=\"card-description\"\n\t\t\tclassName={cnMerge(\"text-sm text-zu-muted-foreground\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardContent<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"div\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"content\"\n\t\t\tdata-slot=\"card-content\"\n\t\t\tclassName={className}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardAction<TElement extends React.ElementType = \"div\">(props: PolymorphicProps<TElement>) {\n\tconst { as: Element = \"div\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"action\"\n\t\t\tdata-slot=\"card-action\"\n\t\t\tclassName={className}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardFooter<TElement extends React.ElementType = \"footer\">(\n\tprops: PolymorphicProps<TElement, { asChild?: boolean }>\n) {\n\tconst { as: Element = \"footer\", asChild, className, ...restOfProps } = props;\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn (\n\t\t<Component\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"footer\"\n\t\t\tdata-slot=\"card-footer\"\n\t\t\tclassName={className}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n","export {\n\tCardAction as Action,\n\tCardContent as Content,\n\tCardDescription as Description,\n\tCardFooter as Footer,\n\tCardHeader as Header,\n\tCardRoot as Root,\n\tCardTitle as Title,\n} from \"./card\";\n"],"mappings":";;;;;;;AAKA,SAAgB,SACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,WAAW,UAAW,GAAG,gBAAgB;AAE/D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,iBAAiB,UAAU;EAC9C,GAAI;GACH;;AAIJ,SAAgB,WACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAU,UAAW,GAAG,gBAAgB;AAE9D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACC;EACX,GAAI;GACH;;AAIJ,SAAgB,UAAqD,OAAmC;CACvG,MAAM,EAAE,IAAI,UAAU,MAAM,UAAW,GAAG,gBAAgB;AAE1D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,8BAA8B,UAAU;EAC3D,GAAI;GACH;;AAIJ,SAAgB,gBACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,KAAK,UAAW,GAAG,gBAAgB;AAEzD,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,oCAAoC,UAAU;EACjE,GAAI;GACH;;AAIJ,SAAgB,YACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,OAAO,UAAW,GAAG,gBAAgB;AAE3D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACC;EACX,GAAI;GACH;;AAIJ,SAAgB,WAAuD,OAAmC;CACzG,MAAM,EAAE,IAAI,UAAU,OAAO,UAAW,GAAG,gBAAgB;AAE3D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACC;EACX,GAAI;GACH;;AAIJ,SAAgB,WACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAU,SAAS,UAAW,GAAG,gBAAgB;CAEvE,MAAMA,cAAY,UAAUC,WAAY;AAExC,QACC,oBAACD;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACC;EACX,GAAI;GACH"}
1
+ {"version":3,"file":"index.js","names":["Slot.Root"],"sources":["../../../../src/components/ui/card/card.tsx","../../../../src/components/ui/card/card-parts.ts"],"sourcesContent":["import type { PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport * as React from \"react\";\nimport { Slot } from \"@/components/common/slot\";\nimport { cnMerge } from \"@/lib/utils/cn\";\n\nexport function CardRoot<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"article\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"root\"\n\t\t\tdata-slot=\"card-root\"\n\t\t\tclassName={cnMerge(\"flex flex-col\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardHeader<TElement extends React.ElementType = \"header\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"header\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"header\"\n\t\t\tdata-slot=\"card-header\"\n\t\t\tclassName={className}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardTitle<TElement extends React.ElementType = \"h3\">(props: PolymorphicProps<TElement>) {\n\tconst { as: Element = \"h3\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"title\"\n\t\t\tdata-slot=\"card-title\"\n\t\t\tclassName={cnMerge(\"leading-none font-semibold\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardDescription<TElement extends React.ElementType = \"p\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"p\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"description\"\n\t\t\tdata-slot=\"card-description\"\n\t\t\tclassName={cnMerge(\"text-sm text-zu-muted-foreground\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardContent<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement>\n) {\n\tconst { as: Element = \"div\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"content\"\n\t\t\tdata-slot=\"card-content\"\n\t\t\tclassName={className}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardAction<TElement extends React.ElementType = \"div\">(props: PolymorphicProps<TElement>) {\n\tconst { as: Element = \"div\", className, ...restOfProps } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"action\"\n\t\t\tdata-slot=\"card-action\"\n\t\t\tclassName={className}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n\nexport function CardFooter<TElement extends React.ElementType = \"footer\">(\n\tprops: PolymorphicProps<TElement, { asChild?: boolean }>\n) {\n\tconst { as: Element = \"footer\", asChild, className, ...restOfProps } = props;\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn (\n\t\t<Component\n\t\t\tdata-scope=\"card\"\n\t\t\tdata-part=\"footer\"\n\t\t\tdata-slot=\"card-footer\"\n\t\t\tclassName={className}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n","export {\n\tCardAction as Action,\n\tCardContent as Content,\n\tCardDescription as Description,\n\tCardFooter as Footer,\n\tCardHeader as Header,\n\tCardRoot as Root,\n\tCardTitle as Title,\n} from \"./card\";\n"],"mappings":";;;;;;;AAKA,SAAgB,SACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,WAAW,UAAW,GAAG,gBAAgB;AAE/D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,iBAAiB,UAAU;EAC9C,GAAI;GACH;;AAIJ,SAAgB,WACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAU,UAAW,GAAG,gBAAgB;AAE9D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACC;EACX,GAAI;GACH;;AAIJ,SAAgB,UAAqD,OAAmC;CACvG,MAAM,EAAE,IAAI,UAAU,MAAM,UAAW,GAAG,gBAAgB;AAE1D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,8BAA8B,UAAU;EAC3D,GAAI;GACH;;AAIJ,SAAgB,gBACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,KAAK,UAAW,GAAG,gBAAgB;AAEzD,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,oCAAoC,UAAU;EACjE,GAAI;GACH;;AAIJ,SAAgB,YACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,OAAO,UAAW,GAAG,gBAAgB;AAE3D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACC;EACX,GAAI;GACH;;AAIJ,SAAgB,WAAuD,OAAmC;CACzG,MAAM,EAAE,IAAI,UAAU,OAAO,UAAW,GAAG,gBAAgB;AAE3D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACC;EACX,GAAI;GACH;;AAIJ,SAAgB,WACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAU,SAAS,UAAW,GAAG,gBAAgB;AAIvE,QACC,oBAHiB,UAAUA,WAAY;EAItC,cAAW;EACX,aAAU;EACV,aAAU;EACC;EACX,GAAI;GACH"}
@@ -1,7 +1,7 @@
1
- import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
2
1
  import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
3
2
  import * as React$1 from "react";
4
- import * as react_jsx_runtime40 from "react/jsx-runtime";
3
+ import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
4
+ import * as react_jsx_runtime6 from "react/jsx-runtime";
5
5
  import { StoreApi } from "@zayne-labs/toolkit-core";
6
6
 
7
7
  //#region src/components/ui/carousel/types.d.ts
@@ -79,14 +79,14 @@ type OtherCarouselProps = {
79
79
  };
80
80
  //#endregion
81
81
  //#region src/components/ui/carousel/carousel.d.ts
82
- declare function CarouselRoot<TImages extends ImagesType, TElement extends React$1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>): react_jsx_runtime40.JSX.Element;
83
- declare function CarouselButton(props: CarouselButtonsProps): react_jsx_runtime40.JSX.Element;
84
- declare function CarouselControls(props: CarouselControlProps): react_jsx_runtime40.JSX.Element;
85
- declare function CarouselItemList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime40.JSX.Element;
86
- declare function CarouselItem(props: OtherCarouselProps): react_jsx_runtime40.JSX.Element;
87
- declare function CarouselCaption<TElement extends React$1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>): react_jsx_runtime40.JSX.Element;
88
- declare function CarouselIndicatorList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime40.JSX.Element;
89
- declare function CarouselIndicator(props: CarouselIndicatorProps): react_jsx_runtime40.JSX.Element;
82
+ declare function CarouselRoot<TImages extends ImagesType, TElement extends React$1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>): react_jsx_runtime6.JSX.Element;
83
+ declare function CarouselButton(props: CarouselButtonsProps): react_jsx_runtime6.JSX.Element;
84
+ declare function CarouselControls(props: CarouselControlProps): react_jsx_runtime6.JSX.Element;
85
+ declare function CarouselItemList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime6.JSX.Element;
86
+ declare function CarouselItem(props: OtherCarouselProps): react_jsx_runtime6.JSX.Element;
87
+ declare function CarouselCaption<TElement extends React$1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>): react_jsx_runtime6.JSX.Element;
88
+ declare function CarouselIndicatorList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime6.JSX.Element;
89
+ declare function CarouselIndicator(props: CarouselIndicatorProps): react_jsx_runtime6.JSX.Element;
90
90
  declare namespace carousel_parts_d_exports {
91
91
  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 };
92
92
  }
@@ -3,11 +3,11 @@
3
3
 
4
4
  import { __export } from "../../chunk-CTAAG5j7.js";
5
5
  import { For } from "../../for-x0-1kO5w.js";
6
- import { ShowContent, ShowFallback, ShowRoot } from "../../show-CDY_D1V0.js";
6
+ import { ShowContent, ShowFallback, ShowRoot } from "../../show-kIsXcWiR.js";
7
7
  import { cnMerge } from "../../cn-DdD3uYxA.js";
8
+ import { useAnimationInterval, useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
8
9
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
9
10
  import { useMemo, useState } from "react";
10
- import { useAnimationInterval, useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
11
11
  import { jsx, jsxs } from "react/jsx-runtime";
12
12
  import { createStore } from "@zayne-labs/toolkit-core";
13
13
  import { createZustandContext } from "@zayne-labs/toolkit-react/zustand";
@@ -98,11 +98,9 @@ const useCarouselOptions = (options) => {
98
98
  intervalDuration: hasAutoSlide && !isPaused ? autoSlideInterval : null,
99
99
  onAnimation: actions.goToNextSlide
100
100
  });
101
- const pauseAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(true));
102
- const resumeAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(false));
103
101
  return {
104
- pauseAutoSlide,
105
- resumeAutoSlide
102
+ pauseAutoSlide: useCallbackRef(() => shouldPauseOnHover && setIsPaused(true)),
103
+ resumeAutoSlide: useCallbackRef(() => shouldPauseOnHover && setIsPaused(false))
106
104
  };
107
105
  };
108
106
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["useCarouselStore: typeof useCarouselStoreContext","Show.Root","Show.Content","Show.Fallback"],"sources":["../../../../src/components/ui/carousel/carousel-store-context.ts","../../../../src/components/ui/carousel/icons.tsx","../../../../src/components/ui/carousel/useCarouselOptions.ts","../../../../src/components/ui/carousel/carousel.tsx","../../../../src/components/ui/carousel/carousel-parts.ts"],"sourcesContent":["import { createStore } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef, useStore } from \"@zayne-labs/toolkit-react\";\nimport { createZustandContext } from \"@zayne-labs/toolkit-react/zustand\";\nimport type { PrettyOmit } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useMemo } from \"react\";\nimport type { CarouselRootProps, CarouselStore, ImagesType } from \"./types\";\n\nconst [CarouselStoreContextProvider, useCarouselStoreContext] = createZustandContext<CarouselStore>({\n\thookName: \"useCarouselStore\",\n\tname: \"CarouselStoreContext\",\n\tproviderName: \"CarouselRoot\",\n});\n\n// CarouselStore Creation\nconst createCarouselStore = <TImages extends ImagesType>(\n\tstoreValues: PrettyOmit<CarouselRootProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = storeValues;\n\n\tconst carouselStore = createStore<CarouselStore<TImages>>((set, get) => ({\n\t\tcurrentSlide: 0,\n\t\timages,\n\t\tmaxSlide: images.length - 1,\n\n\t\t/* eslint-disable perfectionist/sort-objects -- actions should be last */\n\t\tactions: {\n\t\t\t/* eslint-enable perfectionist/sort-objects -- actions should be last */\n\n\t\t\tgoToNextSlide: () => {\n\t\t\t\tconst { currentSlide, maxSlide } = get();\n\t\t\t\tconst { goToSlide } = get().actions;\n\n\t\t\t\tif (currentSlide === maxSlide) {\n\t\t\t\t\tgoToSlide(0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tgoToSlide(currentSlide + 1);\n\t\t\t},\n\n\t\t\tgoToPreviousSlide: () => {\n\t\t\t\tconst { currentSlide, maxSlide } = get();\n\t\t\t\tconst { goToSlide } = get().actions;\n\n\t\t\t\tif (currentSlide === 0) {\n\t\t\t\t\tgoToSlide(maxSlide);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tgoToSlide(currentSlide - 1);\n\t\t\t},\n\n\t\t\tgoToSlide: (newValue) => {\n\t\t\t\tonSlideBtnClick?.();\n\n\t\t\t\tset({ currentSlide: newValue });\n\t\t\t},\n\t\t},\n\t}));\n\n\treturn carouselStore;\n};\n\nconst useCarousel = <TImages extends ImagesType>(props: Omit<CarouselRootProps<TImages>, \"children\">) => {\n\tconst { images, onSlideBtnClick } = props;\n\n\tconst savedOnSlideBtnClick = useCallbackRef(onSlideBtnClick);\n\n\tconst carouselStore = useMemo(\n\t\t() => createCarouselStore({ images, onSlideBtnClick: savedOnSlideBtnClick }),\n\t\t[images, savedOnSlideBtnClick]\n\t);\n\n\tconst useCarouselStore: typeof useCarouselStoreContext = (selector) => {\n\t\treturn useStore(carouselStore, selector);\n\t};\n\n\tconst savedUseCarouselStore = useCallbackRef(useCarouselStore);\n\n\treturn useMemo(\n\t\t() => ({ carouselStore, useCarouselStore: savedUseCarouselStore }),\n\t\t[carouselStore, savedUseCarouselStore]\n\t);\n};\n\nexport { CarouselStoreContextProvider, useCarousel, useCarouselStoreContext };\n","import * as React from \"react\";\n\nexport const ChevronLeftIcon = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" />\n\t\t\t<path d=\"m14 16l-4-4l4-4\" />\n\t\t</g>\n\t</svg>\n);\n","import { useAnimationInterval, useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useState } from \"react\";\nimport type { CarouselStore } from \"./types\";\n\ntype CarouselOptions = {\n\tactions: CarouselStore[\"actions\"];\n\tautoSlideInterval?: number;\n\thasAutoSlide?: boolean;\n\tshouldPauseOnHover?: boolean;\n};\n\nconst useCarouselOptions = (options: CarouselOptions) => {\n\tconst { actions, autoSlideInterval = 5000, hasAutoSlide = false, shouldPauseOnHover = false } = options;\n\n\tconst [isPaused, setIsPaused] = useState(false);\n\n\tconst shouldAutoSlide = hasAutoSlide && !isPaused;\n\n\tuseAnimationInterval({\n\t\tintervalDuration: shouldAutoSlide ? autoSlideInterval : null,\n\t\tonAnimation: actions.goToNextSlide,\n\t});\n\n\tconst pauseAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(true));\n\n\tconst resumeAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(false));\n\n\treturn { pauseAutoSlide, resumeAutoSlide };\n};\n\nexport { useCarouselOptions };\n","\"use client\";\n\nimport type { CssWithCustomProperties, PolymorphicPropsStrict } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { For } from \"@/components/common/for\";\nimport { Show } from \"@/components/common/show\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport {\n\tCarouselStoreContextProvider,\n\tuseCarousel,\n\tuseCarouselStoreContext,\n} from \"./carousel-store-context\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport type {\n\tCarouselButtonsProps,\n\tCarouselControlProps,\n\tCarouselIndicatorProps,\n\tCarouselRootProps,\n\tCarouselWrapperProps,\n\tImagesType,\n\tOtherCarouselProps,\n} from \"./types\";\nimport { useCarouselOptions } from \"./useCarouselOptions\";\n\n// TODO - Add dragging and swiping support\nexport function CarouselRoot<TImages extends ImagesType, TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>\n) {\n\tconst {\n\t\tas: Element = \"div\",\n\t\tautoSlideInterval,\n\t\tchildren,\n\t\tclassNames,\n\t\thasAutoSlide,\n\t\timages,\n\t\tonSlideBtnClick,\n\t\tshouldPauseOnHover,\n\t} = props;\n\n\tconst { carouselStore } = useCarousel({ images, onSlideBtnClick });\n\n\tconst actions = carouselStore.getState().actions;\n\n\tconst { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({\n\t\tactions,\n\t\tautoSlideInterval,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t});\n\n\treturn (\n\t\t<CarouselStoreContextProvider store={carouselStore}>\n\t\t\t<Element\n\t\t\t\tdata-scope=\"carousel\"\n\t\t\t\tdata-part=\"content\"\n\t\t\t\tdata-slot=\"carousel-content\"\n\t\t\t\tclassName={cnMerge(\"relative select-none\", classNames?.base)}\n\t\t\t\tonMouseEnter={pauseAutoSlide}\n\t\t\t\tonMouseLeave={resumeAutoSlide}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\"flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n\t\t\t\t\t\tclassNames?.scrollContainer\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</Element>\n\t\t</CarouselStoreContextProvider>\n\t);\n}\n\nexport function CarouselButton(props: CarouselButtonsProps) {\n\tconst { classNames, icon, variant } = props;\n\n\tconst { goToNextSlide, goToPreviousSlide } = useCarouselStoreContext((state) => state.actions);\n\n\treturn (\n\t\t<button\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"button\"\n\t\t\tdata-slot=\"carousel-button\"\n\t\t\ttype=\"button\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"z-30 flex h-full w-fit items-center\",\n\t\t\t\tvariant === \"prev\" ? \"justify-start\" : \"justify-end\",\n\t\t\t\tclassNames?.base\n\t\t\t)}\n\t\t\tonClick={variant === \"prev\" ? goToPreviousSlide : goToNextSlide}\n\t\t>\n\t\t\t<span className={cnMerge(\"transition-transform active:scale-[1.06]\", classNames?.iconContainer)}>\n\t\t\t\t{icon ?? (\n\t\t\t\t\t<ChevronLeftIcon\n\t\t\t\t\t\tclassName={cnMerge(variant === \"next\" && \"rotate-180\", classNames?.defaultIcon)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n\nexport function CarouselControls(props: CarouselControlProps) {\n\tconst { classNames, icon } = props;\n\n\treturn (\n\t\t<div\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"controls\"\n\t\t\tdata-slot=\"carousel-controls\"\n\t\t\tclassName={cnMerge(\"absolute inset-0 flex justify-between\", classNames?.base)}\n\t\t>\n\t\t\t<Show.Root when={icon?.iconType}>\n\t\t\t\t<Show.Content>\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\t\ticon?.iconType === \"nextIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\t\ticon?.iconType === \"prevIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t\t/>\n\t\t\t\t</Show.Content>\n\n\t\t\t\t<Show.Fallback>\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.prev}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.next}\n\t\t\t\t\t/>\n\t\t\t\t</Show.Fallback>\n\t\t\t</Show.Root>\n\t\t</div>\n\t);\n}\n\nexport function CarouselItemList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>) {\n\tconst { children, className, each } = props;\n\n\tconst currentSlide = useCarouselStoreContext((state) => state.currentSlide);\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArray));\n\n\treturn (\n\t\t<ul\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"item-list\"\n\t\t\tdata-slot=\"carousel-item-list\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t`flex w-full shrink-0 transform-[translate3d(var(--translate-distance),0,0)] snap-center\n\t\t\t\ttransition-transform duration-800`,\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tstyle={\n\t\t\t\t{\n\t\t\t\t\t\"--translate-distance\": `-${currentSlide * 100}%`,\n\t\t\t\t} satisfies CssWithCustomProperties as CssWithCustomProperties\n\t\t\t}\n\t\t>\n\t\t\t{isFunction(children) ?\n\t\t\t\t<For each={images} renderItem={(image, index, array) => children({ array, image, index })} />\n\t\t\t:\tchildren}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselItem(props: OtherCarouselProps) {\n\tconst { children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<li\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"item\"\n\t\t\tdata-slot=\"carousel-item\"\n\t\t\tclassName={cnMerge(\"flex w-full shrink-0 snap-center justify-center\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</li>\n\t);\n}\n\nexport function CarouselCaption<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicPropsStrict<TElement, OtherCarouselProps>\n) {\n\tconst { as: HtmlElement = \"div\", children, className } = props;\n\n\treturn (\n\t\t<HtmlElement\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"caption\"\n\t\t\tdata-slot=\"carousel-caption\"\n\t\t\tclassName={cnMerge(\"absolute z-10\", className)}\n\t\t>\n\t\t\t{children}\n\t\t</HtmlElement>\n\t);\n}\n\nexport function CarouselIndicatorList<TArray extends unknown[]>(\n\tprops: CarouselWrapperProps<TArray[number]>\n) {\n\tconst { children, className, each } = props;\n\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArray));\n\n\treturn (\n\t\t<ul\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"indicator-list\"\n\t\t\tdata-slot=\"carousel-indicator-list\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"absolute bottom-[25px] z-[2] flex w-full items-center justify-center gap-[15px]\",\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{isFunction(children) ?\n\t\t\t\t<For each={images} renderItem={(image, index, array) => children({ array, image, index })} />\n\t\t\t:\tchildren}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselIndicator(props: CarouselIndicatorProps) {\n\tconst { classNames, currentIndex } = props;\n\n\tconst {\n\t\tactions: { goToSlide },\n\t\tcurrentSlide,\n\t} = useCarouselStoreContext((state) => state);\n\n\treturn (\n\t\t<li\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"indicator\"\n\t\t\tdata-slot=\"carousel-indicator\"\n\t\t\tclassName={cnMerge(\"inline-flex\", classNames?.base)}\n\t\t>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={() => goToSlide(currentIndex)}\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\"size-[6px] rounded-[50%]\",\n\t\t\t\t\tclassNames?.base,\n\t\t\t\t\tcurrentIndex === currentSlide && [\"w-[35px] rounded-[5px]\", classNames?.isActive]\n\t\t\t\t)}\n\t\t\t/>\n\t\t</li>\n\t);\n}\n","export {\n\tCarouselButton as Button,\n\tCarouselCaption as Caption,\n\tCarouselControls as Controls,\n\tCarouselIndicator as Indicator,\n\tCarouselIndicatorList as IndicatorList,\n\tCarouselItem as Item,\n\tCarouselItemList as ItemList,\n\tCarouselRoot as Root,\n} from \"./carousel\";\n"],"mappings":";;;;;;;;;;;;;;;AAOA,MAAM,CAAC,8BAA8B,2BAA2B,qBAAoC;CACnG,UAAU;CACV,MAAM;CACN,cAAc;CACd,CAAC;AAGF,MAAM,uBACL,gBACI;CACJ,MAAM,EAAE,QAAQ,oBAAoB;AA2CpC,QAzCsB,aAAqC,KAAK,SAAS;EACxE,cAAc;EACd;EACA,UAAU,OAAO,SAAS;EAG1B,SAAS;GAGR,qBAAqB;IACpB,MAAM,EAAE,cAAc,aAAa,KAAK;IACxC,MAAM,EAAE,cAAc,KAAK,CAAC;AAE5B,QAAI,iBAAiB,UAAU;AAC9B,eAAU,EAAE;AACZ;;AAGD,cAAU,eAAe,EAAE;;GAG5B,yBAAyB;IACxB,MAAM,EAAE,cAAc,aAAa,KAAK;IACxC,MAAM,EAAE,cAAc,KAAK,CAAC;AAE5B,QAAI,iBAAiB,GAAG;AACvB,eAAU,SAAS;AACnB;;AAGD,cAAU,eAAe,EAAE;;GAG5B,YAAY,aAAa;AACxB,uBAAmB;AAEnB,QAAI,EAAE,cAAc,UAAU,CAAC;;GAEhC;EACD,EAAE;;AAKJ,MAAM,eAA2C,UAAwD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IP,SAAgB,kBAAkB,OAA+B;CAChE,MAAM,EAAE,YAAY,iBAAiB;CAErC,MAAM,EACL,SAAS,EAAE,aACX,iBACG,yBAAyB,UAAU,MAAM;AAE7C,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,eAAe,YAAY,KAAK;YAEnD,oBAAC;GACA,MAAK;GACL,eAAe,UAAU,aAAa;GACtC,WAAW,QACV,4BACA,YAAY,MACZ,iBAAiB,gBAAgB,CAAC,0BAA0B,YAAY,SAAS,CACjF;IACA;GACE"}
1
+ {"version":3,"file":"index.js","names":["useCarouselStore: typeof useCarouselStoreContext","Show.Root","Show.Content","Show.Fallback"],"sources":["../../../../src/components/ui/carousel/carousel-store-context.ts","../../../../src/components/ui/carousel/icons.tsx","../../../../src/components/ui/carousel/useCarouselOptions.ts","../../../../src/components/ui/carousel/carousel.tsx","../../../../src/components/ui/carousel/carousel-parts.ts"],"sourcesContent":["import { createStore } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef, useStore } from \"@zayne-labs/toolkit-react\";\nimport { createZustandContext } from \"@zayne-labs/toolkit-react/zustand\";\nimport type { PrettyOmit } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useMemo } from \"react\";\nimport type { CarouselRootProps, CarouselStore, ImagesType } from \"./types\";\n\nconst [CarouselStoreContextProvider, useCarouselStoreContext] = createZustandContext<CarouselStore>({\n\thookName: \"useCarouselStore\",\n\tname: \"CarouselStoreContext\",\n\tproviderName: \"CarouselRoot\",\n});\n\n// CarouselStore Creation\nconst createCarouselStore = <TImages extends ImagesType>(\n\tstoreValues: PrettyOmit<CarouselRootProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = storeValues;\n\n\tconst carouselStore = createStore<CarouselStore<TImages>>((set, get) => ({\n\t\tcurrentSlide: 0,\n\t\timages,\n\t\tmaxSlide: images.length - 1,\n\n\t\t/* eslint-disable perfectionist/sort-objects -- actions should be last */\n\t\tactions: {\n\t\t\t/* eslint-enable perfectionist/sort-objects -- actions should be last */\n\n\t\t\tgoToNextSlide: () => {\n\t\t\t\tconst { currentSlide, maxSlide } = get();\n\t\t\t\tconst { goToSlide } = get().actions;\n\n\t\t\t\tif (currentSlide === maxSlide) {\n\t\t\t\t\tgoToSlide(0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tgoToSlide(currentSlide + 1);\n\t\t\t},\n\n\t\t\tgoToPreviousSlide: () => {\n\t\t\t\tconst { currentSlide, maxSlide } = get();\n\t\t\t\tconst { goToSlide } = get().actions;\n\n\t\t\t\tif (currentSlide === 0) {\n\t\t\t\t\tgoToSlide(maxSlide);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tgoToSlide(currentSlide - 1);\n\t\t\t},\n\n\t\t\tgoToSlide: (newValue) => {\n\t\t\t\tonSlideBtnClick?.();\n\n\t\t\t\tset({ currentSlide: newValue });\n\t\t\t},\n\t\t},\n\t}));\n\n\treturn carouselStore;\n};\n\nconst useCarousel = <TImages extends ImagesType>(props: Omit<CarouselRootProps<TImages>, \"children\">) => {\n\tconst { images, onSlideBtnClick } = props;\n\n\tconst savedOnSlideBtnClick = useCallbackRef(onSlideBtnClick);\n\n\tconst carouselStore = useMemo(\n\t\t() => createCarouselStore({ images, onSlideBtnClick: savedOnSlideBtnClick }),\n\t\t[images, savedOnSlideBtnClick]\n\t);\n\n\tconst useCarouselStore: typeof useCarouselStoreContext = (selector) => {\n\t\treturn useStore(carouselStore, selector);\n\t};\n\n\tconst savedUseCarouselStore = useCallbackRef(useCarouselStore);\n\n\treturn useMemo(\n\t\t() => ({ carouselStore, useCarouselStore: savedUseCarouselStore }),\n\t\t[carouselStore, savedUseCarouselStore]\n\t);\n};\n\nexport { CarouselStoreContextProvider, useCarousel, useCarouselStoreContext };\n","import * as React from \"react\";\n\nexport const ChevronLeftIcon = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" />\n\t\t\t<path d=\"m14 16l-4-4l4-4\" />\n\t\t</g>\n\t</svg>\n);\n","import { useAnimationInterval, useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useState } from \"react\";\nimport type { CarouselStore } from \"./types\";\n\ntype CarouselOptions = {\n\tactions: CarouselStore[\"actions\"];\n\tautoSlideInterval?: number;\n\thasAutoSlide?: boolean;\n\tshouldPauseOnHover?: boolean;\n};\n\nconst useCarouselOptions = (options: CarouselOptions) => {\n\tconst { actions, autoSlideInterval = 5000, hasAutoSlide = false, shouldPauseOnHover = false } = options;\n\n\tconst [isPaused, setIsPaused] = useState(false);\n\n\tconst shouldAutoSlide = hasAutoSlide && !isPaused;\n\n\tuseAnimationInterval({\n\t\tintervalDuration: shouldAutoSlide ? autoSlideInterval : null,\n\t\tonAnimation: actions.goToNextSlide,\n\t});\n\n\tconst pauseAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(true));\n\n\tconst resumeAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(false));\n\n\treturn { pauseAutoSlide, resumeAutoSlide };\n};\n\nexport { useCarouselOptions };\n","\"use client\";\n\nimport type { CssWithCustomProperties, PolymorphicPropsStrict } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { For } from \"@/components/common/for\";\nimport { Show } from \"@/components/common/show\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport {\n\tCarouselStoreContextProvider,\n\tuseCarousel,\n\tuseCarouselStoreContext,\n} from \"./carousel-store-context\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport type {\n\tCarouselButtonsProps,\n\tCarouselControlProps,\n\tCarouselIndicatorProps,\n\tCarouselRootProps,\n\tCarouselWrapperProps,\n\tImagesType,\n\tOtherCarouselProps,\n} from \"./types\";\nimport { useCarouselOptions } from \"./useCarouselOptions\";\n\n// TODO - Add dragging and swiping support\nexport function CarouselRoot<TImages extends ImagesType, TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>\n) {\n\tconst {\n\t\tas: Element = \"div\",\n\t\tautoSlideInterval,\n\t\tchildren,\n\t\tclassNames,\n\t\thasAutoSlide,\n\t\timages,\n\t\tonSlideBtnClick,\n\t\tshouldPauseOnHover,\n\t} = props;\n\n\tconst { carouselStore } = useCarousel({ images, onSlideBtnClick });\n\n\tconst actions = carouselStore.getState().actions;\n\n\tconst { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({\n\t\tactions,\n\t\tautoSlideInterval,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t});\n\n\treturn (\n\t\t<CarouselStoreContextProvider store={carouselStore}>\n\t\t\t<Element\n\t\t\t\tdata-scope=\"carousel\"\n\t\t\t\tdata-part=\"content\"\n\t\t\t\tdata-slot=\"carousel-content\"\n\t\t\t\tclassName={cnMerge(\"relative select-none\", classNames?.base)}\n\t\t\t\tonMouseEnter={pauseAutoSlide}\n\t\t\t\tonMouseLeave={resumeAutoSlide}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\"flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n\t\t\t\t\t\tclassNames?.scrollContainer\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</Element>\n\t\t</CarouselStoreContextProvider>\n\t);\n}\n\nexport function CarouselButton(props: CarouselButtonsProps) {\n\tconst { classNames, icon, variant } = props;\n\n\tconst { goToNextSlide, goToPreviousSlide } = useCarouselStoreContext((state) => state.actions);\n\n\treturn (\n\t\t<button\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"button\"\n\t\t\tdata-slot=\"carousel-button\"\n\t\t\ttype=\"button\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"z-30 flex h-full w-fit items-center\",\n\t\t\t\tvariant === \"prev\" ? \"justify-start\" : \"justify-end\",\n\t\t\t\tclassNames?.base\n\t\t\t)}\n\t\t\tonClick={variant === \"prev\" ? goToPreviousSlide : goToNextSlide}\n\t\t>\n\t\t\t<span className={cnMerge(\"transition-transform active:scale-[1.06]\", classNames?.iconContainer)}>\n\t\t\t\t{icon ?? (\n\t\t\t\t\t<ChevronLeftIcon\n\t\t\t\t\t\tclassName={cnMerge(variant === \"next\" && \"rotate-180\", classNames?.defaultIcon)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n\nexport function CarouselControls(props: CarouselControlProps) {\n\tconst { classNames, icon } = props;\n\n\treturn (\n\t\t<div\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"controls\"\n\t\t\tdata-slot=\"carousel-controls\"\n\t\t\tclassName={cnMerge(\"absolute inset-0 flex justify-between\", classNames?.base)}\n\t\t>\n\t\t\t<Show.Root when={icon?.iconType}>\n\t\t\t\t<Show.Content>\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\t\ticon?.iconType === \"nextIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\t\ticon?.iconType === \"prevIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t\t/>\n\t\t\t\t</Show.Content>\n\n\t\t\t\t<Show.Fallback>\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.prev}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.next}\n\t\t\t\t\t/>\n\t\t\t\t</Show.Fallback>\n\t\t\t</Show.Root>\n\t\t</div>\n\t);\n}\n\nexport function CarouselItemList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>) {\n\tconst { children, className, each } = props;\n\n\tconst currentSlide = useCarouselStoreContext((state) => state.currentSlide);\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArray));\n\n\treturn (\n\t\t<ul\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"item-list\"\n\t\t\tdata-slot=\"carousel-item-list\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t`flex w-full shrink-0 transform-[translate3d(var(--translate-distance),0,0)] snap-center\n\t\t\t\ttransition-transform duration-800`,\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tstyle={\n\t\t\t\t{\n\t\t\t\t\t\"--translate-distance\": `-${currentSlide * 100}%`,\n\t\t\t\t} satisfies CssWithCustomProperties as CssWithCustomProperties\n\t\t\t}\n\t\t>\n\t\t\t{isFunction(children) ?\n\t\t\t\t<For each={images} renderItem={(image, index, array) => children({ array, image, index })} />\n\t\t\t:\tchildren}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselItem(props: OtherCarouselProps) {\n\tconst { children, className, ...restOfProps } = props;\n\n\treturn (\n\t\t<li\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"item\"\n\t\t\tdata-slot=\"carousel-item\"\n\t\t\tclassName={cnMerge(\"flex w-full shrink-0 snap-center justify-center\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</li>\n\t);\n}\n\nexport function CarouselCaption<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicPropsStrict<TElement, OtherCarouselProps>\n) {\n\tconst { as: HtmlElement = \"div\", children, className } = props;\n\n\treturn (\n\t\t<HtmlElement\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"caption\"\n\t\t\tdata-slot=\"carousel-caption\"\n\t\t\tclassName={cnMerge(\"absolute z-10\", className)}\n\t\t>\n\t\t\t{children}\n\t\t</HtmlElement>\n\t);\n}\n\nexport function CarouselIndicatorList<TArray extends unknown[]>(\n\tprops: CarouselWrapperProps<TArray[number]>\n) {\n\tconst { children, className, each } = props;\n\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArray));\n\n\treturn (\n\t\t<ul\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"indicator-list\"\n\t\t\tdata-slot=\"carousel-indicator-list\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"absolute bottom-[25px] z-[2] flex w-full items-center justify-center gap-[15px]\",\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{isFunction(children) ?\n\t\t\t\t<For each={images} renderItem={(image, index, array) => children({ array, image, index })} />\n\t\t\t:\tchildren}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselIndicator(props: CarouselIndicatorProps) {\n\tconst { classNames, currentIndex } = props;\n\n\tconst {\n\t\tactions: { goToSlide },\n\t\tcurrentSlide,\n\t} = useCarouselStoreContext((state) => state);\n\n\treturn (\n\t\t<li\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"indicator\"\n\t\t\tdata-slot=\"carousel-indicator\"\n\t\t\tclassName={cnMerge(\"inline-flex\", classNames?.base)}\n\t\t>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={() => goToSlide(currentIndex)}\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\"size-[6px] rounded-[50%]\",\n\t\t\t\t\tclassNames?.base,\n\t\t\t\t\tcurrentIndex === currentSlide && [\"w-[35px] rounded-[5px]\", classNames?.isActive]\n\t\t\t\t)}\n\t\t\t/>\n\t\t</li>\n\t);\n}\n","export {\n\tCarouselButton as Button,\n\tCarouselCaption as Caption,\n\tCarouselControls as Controls,\n\tCarouselIndicator as Indicator,\n\tCarouselIndicatorList as IndicatorList,\n\tCarouselItem as Item,\n\tCarouselItemList as ItemList,\n\tCarouselRoot as Root,\n} from \"./carousel\";\n"],"mappings":";;;;;;;;;;;;;;;AAOA,MAAM,CAAC,8BAA8B,2BAA2B,qBAAoC;CACnG,UAAU;CACV,MAAM;CACN,cAAc;CACd,CAAC;AAGF,MAAM,uBACL,gBACI;CACJ,MAAM,EAAE,QAAQ,oBAAoB;AA2CpC,QAzCsB,aAAqC,KAAK,SAAS;EACxE,cAAc;EACd;EACA,UAAU,OAAO,SAAS;EAG1B,SAAS;GAGR,qBAAqB;IACpB,MAAM,EAAE,cAAc,aAAa,KAAK;IACxC,MAAM,EAAE,cAAc,KAAK,CAAC;AAE5B,QAAI,iBAAiB,UAAU;AAC9B,eAAU,EAAE;AACZ;;AAGD,cAAU,eAAe,EAAE;;GAG5B,yBAAyB;IACxB,MAAM,EAAE,cAAc,aAAa,KAAK;IACxC,MAAM,EAAE,cAAc,KAAK,CAAC;AAE5B,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;EACV,WAAW,QACV,mFACA,UACA;YAEA,WAAW,SAAS,GACpB,oBAAC;GAAI,MAAM;GAAQ,aAAa,OAAO,OAAO,UAAU,SAAS;IAAE;IAAO;IAAO;IAAO,CAAC;IAAI,GAC5F;GACE;;AAIP,SAAgB,kBAAkB,OAA+B;CAChE,MAAM,EAAE,YAAY,iBAAiB;CAErC,MAAM,EACL,SAAS,EAAE,aACX,iBACG,yBAAyB,UAAU,MAAM;AAE7C,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,eAAe,YAAY,KAAK;YAEnD,oBAAC;GACA,MAAK;GACL,eAAe,UAAU,aAAa;GACtC,WAAW,QACV,4BACA,YAAY,MACZ,iBAAiB,gBAAgB,CAAC,0BAA0B,YAAY,SAAS,CACjF;IACA;GACE"}
@@ -1,7 +1,7 @@
1
1
  import { cnMerge } from "../../cn-DdD3uYxA.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 { InferProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
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
4
  import * as react1 from "react";
5
- import "@zayne-labs/toolkit-react";
6
- import * as react_jsx_runtime10 from "react/jsx-runtime";
5
+ import { InferProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
6
+ import * as react_jsx_runtime20 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
 
@@ -232,7 +232,7 @@ type FileItemContextType = {
232
232
  type DropZoneRootProps = UseDropZoneProps & {
233
233
  children: react1.ReactNode;
234
234
  };
235
- declare function DropZoneRoot(props: DropZoneRootProps): react_jsx_runtime10.JSX.Element;
235
+ declare function DropZoneRoot(props: DropZoneRootProps): react_jsx_runtime20.JSX.Element;
236
236
  type DropZoneContextProps<TSlice> = {
237
237
  children: react1.ReactNode | ((context: TSlice) => react1.ReactNode);
238
238
  selector?: SelectorFn<DropZoneStore, TSlice>;
@@ -241,20 +241,20 @@ declare function DropZoneContext<TSlice = DropZoneStore>(props: DropZoneContextP
241
241
  type DropZoneContainerProps = PartInputProps["container"] & {
242
242
  asChild?: boolean;
243
243
  };
244
- declare function DropZoneContainer<TElement extends react1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, DropZoneContainerProps>): react_jsx_runtime10.JSX.Element;
244
+ declare function DropZoneContainer<TElement extends react1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, DropZoneContainerProps>): react_jsx_runtime20.JSX.Element;
245
245
  type DropZoneInputProps = PartInputProps["input"] & {
246
246
  asChild?: boolean;
247
247
  };
248
- declare function DropZoneInput(props: DropZoneInputProps): react_jsx_runtime10.JSX.Element;
248
+ declare function DropZoneInput(props: DropZoneInputProps): react_jsx_runtime20.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>): react_jsx_runtime10.JSX.Element;
253
+ declare function DropZoneArea<TSlice = DropZoneStore>(props: DropZoneAreaProps<TSlice>): react_jsx_runtime20.JSX.Element;
254
254
  type DropZoneTriggerProps = PartInputProps["trigger"] & {
255
255
  asChild?: boolean;
256
256
  };
257
- declare function DropZoneTrigger(props: DropZoneTriggerProps): react_jsx_runtime10.JSX.Element;
257
+ declare function DropZoneTrigger(props: DropZoneTriggerProps): react_jsx_runtime20.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 react1.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, DropZoneFileListProps>): react_jsx_runtime10.JSX.Element;
276
+ declare function DropZoneFileList<TElement extends react1.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, DropZoneFileListProps>): react_jsx_runtime20.JSX.Element;
277
277
  type DropZoneFileItemProps = FileItemContextType & PartInputProps["fileItem"] & {
278
278
  asChild?: boolean;
279
279
  };
280
- declare function DropZoneFileItem<TElement extends react1.ElementType = "li">(props: PolymorphicPropsStrict<TElement, DropZoneFileItemProps>): react_jsx_runtime10.JSX.Element;
280
+ declare function DropZoneFileItem<TElement extends react1.ElementType = "li">(props: PolymorphicPropsStrict<TElement, DropZoneFileItemProps>): react_jsx_runtime20.JSX.Element;
281
281
  type DropZoneFileItemDeleteProps = PartInputProps["fileItemDelete"] & {
282
282
  asChild?: boolean;
283
283
  };
284
- declare function DropZoneFileItemDelete(props: DropZoneFileItemDeleteProps): react_jsx_runtime10.JSX.Element;
284
+ declare function DropZoneFileItemDelete(props: DropZoneFileItemDeleteProps): react_jsx_runtime20.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 react1.ElementType = "span">(props: PolymorphicPropsStrict<TElement, DropZoneFileItemProgressProps>): react_jsx_runtime10.JSX.Element | null;
290
+ declare function DropZoneFileItemProgress<TElement extends react1.ElementType = "span">(props: PolymorphicPropsStrict<TElement, DropZoneFileItemProgressProps>): react_jsx_runtime20.JSX.Element | null;
291
291
  type RenderPreviewDetails<TElement extends react1.ElementType = "svg"> = {
292
292
  node?: react1.ReactNode;
293
293
  } & {
@@ -316,7 +316,7 @@ type DropZoneFileItemPreviewProps = Omit<PartInputProps["fileItemPreview"], "chi
316
316
  }) => react1.ReactNode);
317
317
  renderPreview?: boolean | RenderPreview;
318
318
  };
319
- declare function DropZoneFileItemPreview<TElement extends react1.ElementType>(props: PolymorphicPropsStrict<TElement, DropZoneFileItemPreviewProps>): react_jsx_runtime10.JSX.Element | null;
319
+ declare function DropZoneFileItemPreview<TElement extends react1.ElementType>(props: PolymorphicPropsStrict<TElement, DropZoneFileItemPreviewProps>): react_jsx_runtime20.JSX.Element | null;
320
320
  type DropZoneFileItemMetadataProps = Omit<PartInputProps["fileItemMetadata"], "children"> & Partial<Pick<FileItemContextType, "fileState">> & {
321
321
  asChild?: boolean;
322
322
  children?: react1.ReactNode | ((context: Pick<FileItemContextType, "fileState">) => react1.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): react_jsx_runtime10.JSX.Element | null;
329
+ declare function DropZoneFileItemMetadata(props: DropZoneFileItemMetadataProps): react_jsx_runtime20.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): react_jsx_runtime10.JSX.Element | null;
334
+ declare function DropZoneFileClear(props: DropZoneFileClearProps): react_jsx_runtime20.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
  }
@@ -2,14 +2,14 @@
2
2
 
3
3
 
4
4
  import { __export } from "../../chunk-CTAAG5j7.js";
5
- import { SlotRoot } from "../../slot-DNzYW76j.js";
5
+ import { SlotRoot } from "../../slot-HtgJHjB9.js";
6
6
  import { For } from "../../for-x0-1kO5w.js";
7
- import { Presence } from "../../presence-CzmCEhXS.js";
7
+ import { Presence } from "../../presence-Bj-YnaHv.js";
8
8
  import { cnMerge } from "../../cn-DdD3uYxA.js";
9
- import { composeRefs, composeTwoEventHandlers } from "@zayne-labs/toolkit-react/utils";
9
+ import { createCustomContext, useCallbackRef, useConstant, useShallowCompSelector, useShallowCompValue, useStore, useUnmountEffect } from "@zayne-labs/toolkit-react";
10
10
  import { isBoolean, isFile, isFunction, isNumber, isObject, isString } from "@zayne-labs/toolkit-type-helpers";
11
11
  import { useCallback, useMemo, useRef } from "react";
12
- import { createCustomContext, useCallbackRef, useConstant, useShallowCompSelector, useShallowCompValue, useStore, useUnmountEffect } from "@zayne-labs/toolkit-react";
12
+ import { composeRefs, composeTwoEventHandlers } from "@zayne-labs/toolkit-react/utils";
13
13
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
14
14
  import { createFileURL, createStore, dataAttr, formatBytes, generateFileID, handleFileValidationAsync, toArray } from "@zayne-labs/toolkit-core";
15
15
  import { createZustandContext } from "@zayne-labs/toolkit-react/zustand";
@@ -174,10 +174,7 @@ const isMatchingFile = (options) => {
174
174
  const { fileState, fileStateOrID } = options;
175
175
  const fileID = isFile(fileState) ? generateFileID$1(fileState) : fileState.id;
176
176
  if (isString(fileStateOrID)) return fileID === fileStateOrID;
177
- if (isFile(fileStateOrID)) {
178
- const generatedFileID = generateFileID$1(fileStateOrID);
179
- return fileID === generatedFileID;
180
- }
177
+ if (isFile(fileStateOrID)) return fileID === generateFileID$1(fileStateOrID);
181
178
  return fileID === fileStateOrID.id;
182
179
  };
183
180
  const getScopeAttrs = (part) => {
@@ -285,7 +282,7 @@ const createDropZoneStore = (initStoreValues) => {
285
282
  errors,
286
283
  fileStateArray: !multiple ? newFileStateArray : [...fileStateArray, ...newFileStateArray],
287
284
  isDraggingOver: false
288
- }, { shouldNotifyImmediately: true });
285
+ }, { shouldNotifySync: true });
289
286
  await actions.handleFileUpload({ newFileStateArray });
290
287
  },
291
288
  clearErrors: () => {
@@ -403,25 +400,24 @@ const createDropZoneStore = (initStoreValues) => {
403
400
  removeFile: (ctx) => {
404
401
  const { fileStateOrID } = ctx;
405
402
  const { fileStateArray } = get();
406
- const updatedFileStateArray = fileStateArray.flatMap((fileState) => {
407
- if (isMatchingFile({
408
- fileState,
409
- fileStateOrID
410
- })) {
411
- clearObjectURL(fileState, disablePreviewGenForNonImageFiles);
412
- return [];
413
- }
414
- return fileState;
415
- });
416
403
  set({
417
404
  errors: [],
418
- fileStateArray: updatedFileStateArray
405
+ fileStateArray: fileStateArray.flatMap((fileState) => {
406
+ if (isMatchingFile({
407
+ fileState,
408
+ fileStateOrID
409
+ })) {
410
+ clearObjectURL(fileState, disablePreviewGenForNonImageFiles);
411
+ return [];
412
+ }
413
+ return fileState;
414
+ })
419
415
  });
420
416
  },
421
417
  updateFileState: (ctx) => {
422
418
  const { fileStateOrID,...updatedFileState } = ctx;
423
419
  const { fileStateArray } = get();
424
- const updatedFileStateArray = fileStateArray.map((fileState) => {
420
+ set({ fileStateArray: fileStateArray.map((fileState) => {
425
421
  if (isMatchingFile({
426
422
  fileState,
427
423
  fileStateOrID
@@ -430,8 +426,7 @@ const createDropZoneStore = (initStoreValues) => {
430
426
  ...updatedFileState
431
427
  };
432
428
  return fileState;
433
- });
434
- set({ fileStateArray: updatedFileStateArray }, { shouldNotifyImmediately: true });
429
+ }) }, { shouldNotifySync: true });
435
430
  }
436
431
  }
437
432
  }));
@@ -688,21 +683,20 @@ const useDropZone = (props) => {
688
683
  function DropZoneRoot(props) {
689
684
  const { children,...restOfProps } = props;
690
685
  const { disabled, disableInternalStateSubscription, inputRef, propGetters, storeApi } = useDropZone(restOfProps);
691
- const rootContextValue = useMemo(() => ({
692
- disabled,
693
- disableInternalStateSubscription,
694
- inputRef,
695
- propGetters
696
- }), [
697
- disableInternalStateSubscription,
698
- disabled,
699
- inputRef,
700
- propGetters
701
- ]);
702
686
  return /* @__PURE__ */ jsx(DropZoneStoreContextProvider, {
703
687
  store: storeApi,
704
688
  children: /* @__PURE__ */ jsx(DropZoneRootContextProvider, {
705
- value: rootContextValue,
689
+ value: useMemo(() => ({
690
+ disabled,
691
+ disableInternalStateSubscription,
692
+ inputRef,
693
+ propGetters
694
+ }), [
695
+ disableInternalStateSubscription,
696
+ disabled,
697
+ inputRef,
698
+ propGetters
699
+ ]),
706
700
  children
707
701
  })
708
702
  });
@@ -717,8 +711,7 @@ function DropZoneContainer(props) {
717
711
  const { disableInternalStateSubscription, propGetters } = useDropZoneRootContext();
718
712
  const isDraggingOver = useDropZoneStoreContext((store) => disableInternalStateSubscription ? store.isDraggingOver : null);
719
713
  const isInvalid = useDropZoneStoreContext((store) => disableInternalStateSubscription ? store.isInvalid : null);
720
- const Component$1 = asChild ? SlotRoot : Element;
721
- return /* @__PURE__ */ jsx(Component$1, { ...propGetters.getContainerProps({
714
+ return /* @__PURE__ */ jsx(asChild ? SlotRoot : Element, { ...propGetters.getContainerProps({
722
715
  ...disableInternalStateSubscription && {
723
716
  "data-drag-over": dataAttr(isDraggingOver),
724
717
  "data-invalid": dataAttr(isInvalid)
@@ -730,8 +723,7 @@ function DropZoneInput(props) {
730
723
  const { asChild,...restOfProps } = props;
731
724
  const { disableInternalStateSubscription, propGetters } = useDropZoneRootContext();
732
725
  const isDraggingOver = useDropZoneStoreContext((store) => disableInternalStateSubscription ? store.isDraggingOver : null);
733
- const Component$1 = asChild ? SlotRoot : "input";
734
- return /* @__PURE__ */ jsx(Component$1, { ...propGetters.getInputProps({
726
+ return /* @__PURE__ */ jsx(asChild ? SlotRoot : "input", { ...propGetters.getInputProps({
735
727
  ...disableInternalStateSubscription && { "data-drag-over": dataAttr(isDraggingOver) },
736
728
  ...restOfProps
737
729
  }) });
@@ -754,8 +746,7 @@ function DropZoneArea(props) {
754
746
  function DropZoneTrigger(props) {
755
747
  const { asChild,...restOfProps } = props;
756
748
  const { propGetters } = useDropZoneRootContext();
757
- const Component$1 = asChild ? SlotRoot : "button";
758
- return /* @__PURE__ */ jsx(Component$1, { ...propGetters.getTriggerProps(restOfProps) });
749
+ return /* @__PURE__ */ jsx(asChild ? SlotRoot : "button", { ...propGetters.getTriggerProps(restOfProps) });
759
750
  }
760
751
  function DropZoneFileList(props) {
761
752
  const { as: Element = "ul", asChild, children, forceMount = false, renderMode = "per-item",...restOfProps } = props;
@@ -783,11 +774,10 @@ function DropZoneFileList(props) {
783
774
  }
784
775
  };
785
776
  const hasFiles = fileStateArray.length > 0;
786
- const Component$1 = asChild ? SlotRoot : Element;
787
777
  return /* @__PURE__ */ jsx(Presence, {
788
778
  present: hasFiles,
789
779
  forceMount,
790
- children: /* @__PURE__ */ jsx(Component$1, {
780
+ children: /* @__PURE__ */ jsx(asChild ? SlotRoot : Element, {
791
781
  ...propGetters.getFileListProps({
792
782
  ...disableInternalStateSubscription && { "data-state": hasFiles ? "active" : "inactive" },
793
783
  ...restOfProps
@@ -800,9 +790,8 @@ function DropZoneFileItem(props) {
800
790
  const { as: Element = "li", asChild, fileState,...restOfProps } = props;
801
791
  const { propGetters } = useDropZoneRootContext();
802
792
  const Component$1 = asChild ? SlotRoot : Element;
803
- const contextValue = useMemo(() => ({ fileState }), [fileState]);
804
793
  return /* @__PURE__ */ jsx(FileItemContextProvider, {
805
- value: contextValue,
794
+ value: useMemo(() => ({ fileState }), [fileState]),
806
795
  children: /* @__PURE__ */ jsx(Component$1, { ...propGetters.getFileItemProps(restOfProps) })
807
796
  });
808
797
  }
@@ -1003,8 +992,7 @@ function DropZoneFileClear(props) {
1003
992
  const { propGetters } = useDropZoneRootContext();
1004
993
  const fileCount = useDropZoneStoreContext((state) => state.fileStateArray.length);
1005
994
  if (!(forceMount || fileCount > 0)) return null;
1006
- const Component$1 = asChild ? SlotRoot : "button";
1007
- return /* @__PURE__ */ jsx(Component$1, { ...propGetters.getFileItemClearProps(restOfProps) });
995
+ return /* @__PURE__ */ jsx(asChild ? SlotRoot : "button", { ...propGetters.getFileItemClearProps(restOfProps) });
1008
996
  }
1009
997
 
1010
998
  //#endregion