@zayne-labs/ui-react 0.10.9 → 0.10.10

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 (76) hide show
  1. package/dist/esm/{cn-s-D7vHW1.js → cn-DdD3uYxA.js} +1 -1
  2. package/dist/esm/{cn-s-D7vHW1.js.map → cn-DdD3uYxA.js.map} +1 -1
  3. package/dist/esm/common/await/index.d.ts +46 -4
  4. package/dist/esm/common/await/index.js +86 -4
  5. package/dist/esm/common/await/index.js.map +1 -0
  6. package/dist/esm/common/error-boundary/index.d.ts +1 -1
  7. package/dist/esm/common/for/index.d.ts +23 -2
  8. package/dist/esm/common/for/index.js +1 -1
  9. package/dist/esm/common/presence/index.js +1 -1
  10. package/dist/esm/common/show/index.d.ts +32 -2
  11. package/dist/esm/common/slot/index.d.ts +16 -2
  12. package/dist/esm/common/suspense-with-boundary/index.d.ts +2 -2
  13. package/dist/esm/common/suspense-with-boundary/index.js +20 -3
  14. package/dist/esm/common/suspense-with-boundary/index.js.map +1 -0
  15. package/dist/esm/common/switch/index.d.ts +28 -2
  16. package/dist/esm/common/switch/index.js +37 -2
  17. package/dist/esm/common/switch/index.js.map +1 -0
  18. package/dist/esm/common/teleport/index.d.ts +14 -2
  19. package/dist/esm/common/teleport/index.js +31 -2
  20. package/dist/esm/common/teleport/index.js.map +1 -0
  21. package/dist/esm/{for-DK5rEY_m.js → for-BYsFEk3R.js} +1 -1
  22. package/dist/esm/{for-DK5rEY_m.js.map → for-BYsFEk3R.js.map} +1 -1
  23. package/dist/esm/{index-C0L6V4Zq.d.ts → index-BwhRxsrZ.d.ts} +3 -3
  24. package/dist/esm/{index-lw5txqar.d.ts → index-C_2Onnhl.d.ts} +4 -4
  25. package/dist/esm/{presence-CL5_GHQH.js → presence-CAQElNtY.js} +1 -1
  26. package/dist/esm/{presence-CL5_GHQH.js.map → presence-CAQElNtY.js.map} +1 -1
  27. package/dist/esm/ui/card/index.d.ts +20 -2
  28. package/dist/esm/ui/card/index.js +94 -4
  29. package/dist/esm/ui/card/index.js.map +1 -0
  30. package/dist/esm/ui/carousel/index.d.ts +95 -2
  31. package/dist/esm/ui/carousel/index.js +285 -13
  32. package/dist/esm/ui/carousel/index.js.map +1 -0
  33. package/dist/esm/ui/drag-scroll/index.d.ts +23 -2
  34. package/dist/esm/ui/drag-scroll/index.js +114 -3
  35. package/dist/esm/ui/drag-scroll/index.js.map +1 -0
  36. package/dist/esm/ui/drop-zone/index.d.ts +346 -2
  37. package/dist/esm/ui/drop-zone/index.js +1026 -14
  38. package/dist/esm/ui/drop-zone/index.js.map +1 -0
  39. package/dist/esm/ui/form/index.d.ts +227 -2
  40. package/dist/esm/ui/form/index.js +573 -5
  41. package/dist/esm/ui/form/index.js.map +1 -0
  42. package/package.json +6 -8
  43. package/dist/esm/await-DDgVzpvI.js +0 -87
  44. package/dist/esm/await-DDgVzpvI.js.map +0 -1
  45. package/dist/esm/card-DDLJVCwL.js +0 -95
  46. package/dist/esm/card-DDLJVCwL.js.map +0 -1
  47. package/dist/esm/carousel-B051PAAX.js +0 -285
  48. package/dist/esm/carousel-B051PAAX.js.map +0 -1
  49. package/dist/esm/common/index.d.ts +0 -9
  50. package/dist/esm/common/index.js +0 -11
  51. package/dist/esm/common-PS3X58Pj.js +0 -0
  52. package/dist/esm/drag-scroll-Bb1SG4On.js +0 -115
  53. package/dist/esm/drag-scroll-Bb1SG4On.js.map +0 -1
  54. package/dist/esm/drop-zone-FkkbzZ3j.js +0 -1019
  55. package/dist/esm/drop-zone-FkkbzZ3j.js.map +0 -1
  56. package/dist/esm/form-DyGy9LnA.js +0 -574
  57. package/dist/esm/form-DyGy9LnA.js.map +0 -1
  58. package/dist/esm/index-BJUTFSec.d.ts +0 -227
  59. package/dist/esm/index-BeCCgTjL.d.ts +0 -16
  60. package/dist/esm/index-BsGxDKlt.d.ts +0 -32
  61. package/dist/esm/index-C1GPFYKG.d.ts +0 -23
  62. package/dist/esm/index-CZjeBSoQ.d.ts +0 -14
  63. package/dist/esm/index-CffEFE66.d.ts +0 -28
  64. package/dist/esm/index-DFHOx2Pf.d.ts +0 -23
  65. package/dist/esm/index-DXwAMkn0.d.ts +0 -46
  66. package/dist/esm/index-RpfwCCWX.d.ts +0 -345
  67. package/dist/esm/index-bD-GMufy.d.ts +0 -20
  68. package/dist/esm/index-ipYGGqwN.d.ts +0 -95
  69. package/dist/esm/suspense-with-boundary-D-1NYDV4.js +0 -21
  70. package/dist/esm/suspense-with-boundary-D-1NYDV4.js.map +0 -1
  71. package/dist/esm/switch-Ch22z21e.js +0 -38
  72. package/dist/esm/switch-Ch22z21e.js.map +0 -1
  73. package/dist/esm/teleport-C8TzRm4M.js +0 -32
  74. package/dist/esm/teleport-C8TzRm4M.js.map +0 -1
  75. package/dist/esm/ui/index.d.ts +0 -6
  76. package/dist/esm/ui/index.js +0 -18
@@ -1,2 +1,20 @@
1
- import { CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_d_exports } from "../../index-bD-GMufy.js";
2
- export { card_parts_d_exports as Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
1
+ import { PolymorphicProps } from "@zayne-labs/toolkit-react/utils";
2
+ import * as React from "react";
3
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
4
+
5
+ //#region src/components/ui/card/card.d.ts
6
+ declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
7
+ declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
8
+ declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
9
+ declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
10
+ declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
11
+ declare function CardAction<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime2.JSX.Element;
12
+ declare function CardFooter<TElement extends React.ElementType = "footer">(props: PolymorphicProps<TElement, {
13
+ asChild?: boolean;
14
+ }>): react_jsx_runtime2.JSX.Element;
15
+ declare namespace card_parts_d_exports {
16
+ export { CardAction as Action, CardContent as Content, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
17
+ }
18
+ //#endregion
19
+ export { card_parts_d_exports as Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
20
+ //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,95 @@
1
- import "../../slot-WVWfOlr3.js";
2
- import "../../cn-s-D7vHW1.js";
3
- import { CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_exports } from "../../card-DDLJVCwL.js";
1
+ import { __export } from "../../chunk-CTAAG5j7.js";
2
+ import { SlotRoot } from "../../slot-WVWfOlr3.js";
3
+ import { cnMerge } from "../../cn-DdD3uYxA.js";
4
+ import "react";
5
+ import { jsx } from "react/jsx-runtime";
4
6
 
5
- export { card_parts_exports as Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
7
+ //#region src/components/ui/card/card.tsx
8
+ function CardRoot(props) {
9
+ const { as: Element = "article",...restOfProps } = props;
10
+ return /* @__PURE__ */ jsx(Element, {
11
+ "data-scope": "card",
12
+ "data-part": "root",
13
+ "data-slot": "card-root",
14
+ className: "flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
15
+ ...restOfProps
16
+ });
17
+ }
18
+ function CardHeader(props) {
19
+ const { as: Element = "header", className,...restOfProps } = props;
20
+ return /* @__PURE__ */ jsx(Element, {
21
+ "data-scope": "card",
22
+ "data-part": "header",
23
+ "data-slot": "card-header",
24
+ className: cnMerge(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6
25
+ has-data-[slot=card-action]:grid-cols-[1fr_auto]`, className),
26
+ ...restOfProps
27
+ });
28
+ }
29
+ function CardTitle(props) {
30
+ const { as: Element = "h3", className,...restOfProps } = props;
31
+ return /* @__PURE__ */ jsx(Element, {
32
+ "data-scope": "card",
33
+ "data-part": "title",
34
+ "data-slot": "card-title",
35
+ className: cnMerge("leading-none font-semibold", className),
36
+ ...restOfProps
37
+ });
38
+ }
39
+ function CardDescription(props) {
40
+ const { as: Element = "p", className,...restOfProps } = props;
41
+ return /* @__PURE__ */ jsx(Element, {
42
+ "data-scope": "card",
43
+ "data-part": "description",
44
+ "data-slot": "card-description",
45
+ className: cnMerge("text-sm text-zu-muted-foreground", className),
46
+ ...restOfProps
47
+ });
48
+ }
49
+ function CardContent(props) {
50
+ const { as: Element = "div", className,...restOfProps } = props;
51
+ return /* @__PURE__ */ jsx(Element, {
52
+ "data-scope": "card",
53
+ "data-part": "content",
54
+ "data-slot": "card-content",
55
+ className: cnMerge("px-6", className),
56
+ ...restOfProps
57
+ });
58
+ }
59
+ function CardAction(props) {
60
+ const { as: Element = "div", className,...restOfProps } = props;
61
+ return /* @__PURE__ */ jsx(Element, {
62
+ "data-scope": "card",
63
+ "data-part": "action",
64
+ "data-slot": "card-action",
65
+ className: cnMerge("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
66
+ ...restOfProps
67
+ });
68
+ }
69
+ function CardFooter(props) {
70
+ const { as: Element = "footer", asChild, className,...restOfProps } = props;
71
+ const Component$1 = asChild ? SlotRoot : Element;
72
+ return /* @__PURE__ */ jsx(Component$1, {
73
+ "data-scope": "card",
74
+ "data-part": "footer",
75
+ "data-slot": "card-footer",
76
+ className: cnMerge("px-6", className),
77
+ ...restOfProps
78
+ });
79
+ }
80
+
81
+ //#endregion
82
+ //#region src/components/ui/card/card-parts.ts
83
+ var card_parts_exports = __export({
84
+ Action: () => CardAction,
85
+ Content: () => CardContent,
86
+ Description: () => CardDescription,
87
+ Footer: () => CardFooter,
88
+ Header: () => CardHeader,
89
+ Root: () => CardRoot,
90
+ Title: () => CardTitle
91
+ });
92
+
93
+ //#endregion
94
+ export { card_parts_exports as Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
95
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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\", ...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=\"flex flex-col gap-6 rounded-xl border py-6 shadow-sm\"\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={cnMerge(\n\t\t\t\t`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6\n\t\t\t\thas-data-[slot=card-action]:grid-cols-[1fr_auto]`,\n\t\t\t\tclassName\n\t\t\t)}\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={cnMerge(\"px-6\", 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={cnMerge(\"col-start-2 row-span-2 row-start-1 self-start justify-self-end\", 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={cnMerge(\"px-6\", className)}\n\t\t\t{...restOfProps}\n\t\t/>\n\t);\n}\n","export {\n\tCardContent as Content,\n\tCardDescription as Description,\n\tCardFooter as Footer,\n\tCardHeader as Header,\n\tCardAction as Action,\n\tCardRoot as Root,\n\tCardTitle as Title,\n} from \"./card\";\n"],"mappings":";;;;;;;AAKA,SAAgB,SACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAW,GAAG,gBAAgB;AAEpD,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAU;EACV,GAAI;GACH;;AAIJ,SAAgB,WACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,UAAU,UAAW,GAAG,gBAAgB;AAE9D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QACV;uDAEA,UACA;EACD,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;EACV,WAAW,QAAQ,QAAQ,UAAU;EACrC,GAAI;GACH;;AAIJ,SAAgB,WAAuD,OAAmC;CACzG,MAAM,EAAE,IAAI,UAAU,OAAO,UAAW,GAAG,gBAAgB;AAE3D,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,kEAAkE,UAAU;EAC/F,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;EACV,WAAW,QAAQ,QAAQ,UAAU;EACrC,GAAI;GACH"}
@@ -1,2 +1,95 @@
1
- import { CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselIndicatorProps, CarouselItem, CarouselItemList, CarouselRoot, CarouselRootProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps, carousel_parts_d_exports } from "../../index-ipYGGqwN.js";
2
- export { carousel_parts_d_exports as Carousel, CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselIndicatorProps, CarouselItem, CarouselItemList, CarouselRoot, CarouselRootProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps };
1
+ import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
2
+ import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
3
+ import * as React$1 from "react";
4
+ import * as react_jsx_runtime40 from "react/jsx-runtime";
5
+ import { StoreApi } from "@zayne-labs/toolkit-core";
6
+
7
+ //#region src/components/ui/carousel/types.d.ts
8
+ type ImagesType = Array<Record<string, string>> | string[];
9
+ type CarouselStore<TImages extends ImagesType = any> = {
10
+ actions: {
11
+ goToNextSlide: () => void;
12
+ goToPreviousSlide: () => void;
13
+ goToSlide: (newValue: number) => void;
14
+ };
15
+ currentSlide: number;
16
+ images: TImages;
17
+ maxSlide: number;
18
+ };
19
+ type CarouselStoreApi<TImages extends ImagesType = ImagesType> = StoreApi<CarouselStore<TImages>>;
20
+ type CarouselRootProps<TImages extends ImagesType = ImagesType> = {
21
+ autoSlideInterval?: number;
22
+ children: React.ReactNode;
23
+ classNames?: {
24
+ base?: string;
25
+ scrollContainer?: string;
26
+ };
27
+ hasAutoSlide?: boolean;
28
+ images: CarouselStore<TImages>["images"];
29
+ onSlideBtnClick?: () => void;
30
+ shouldPauseOnHover?: boolean;
31
+ };
32
+ type CarouselButtonsProps = {
33
+ classNames?: {
34
+ base?: string;
35
+ defaultIcon?: string;
36
+ iconContainer?: string;
37
+ };
38
+ icon?: React.ReactElement;
39
+ variant: "next" | "prev";
40
+ };
41
+ type CarouselControlProps = {
42
+ classNames?: {
43
+ base?: string;
44
+ defaultIcon?: string;
45
+ iconContainer?: string;
46
+ };
47
+ icon?: UnionDiscriminator<[{
48
+ icon?: React.ReactElement;
49
+ iconType: "nextIcon" | "prevIcon";
50
+ }, {
51
+ next?: React.ReactElement;
52
+ prev?: React.ReactElement;
53
+ }]>;
54
+ };
55
+ type CarouselIndicatorProps = {
56
+ classNames?: {
57
+ base?: string;
58
+ button?: string;
59
+ isActive?: string;
60
+ };
61
+ currentIndex: number;
62
+ };
63
+ type RenderPropFn<TArrayItem> = (context: {
64
+ array: NoInfer<TArrayItem[]>;
65
+ image: NoInfer<TArrayItem>;
66
+ index: number;
67
+ }) => React.ReactNode;
68
+ type BaseWrapperProps<TArrayItem> = {
69
+ children: React.ReactNode | RenderPropFn<TArrayItem>;
70
+ each?: TArrayItem[];
71
+ };
72
+ type CarouselWrapperProps<TArrayItem> = BaseWrapperProps<TArrayItem> & {
73
+ className?: string;
74
+ };
75
+ type OtherCarouselProps = {
76
+ children?: React.ReactNode;
77
+ className?: string;
78
+ style?: React.CSSProperties;
79
+ };
80
+ //#endregion
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<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): 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<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): react_jsx_runtime40.JSX.Element;
89
+ declare function CarouselIndicator(props: CarouselIndicatorProps): react_jsx_runtime40.JSX.Element;
90
+ declare namespace carousel_parts_d_exports {
91
+ export { CarouselButton as Button, CarouselCaption as Caption, CarouselControls as Controls, CarouselIndicator as Indicator, CarouselIndicatorList as IndicatorGroup, CarouselItem as Item, CarouselItemList as ItemGroup, CarouselRoot as Root };
92
+ }
93
+ //#endregion
94
+ export { carousel_parts_d_exports as Carousel, CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselIndicatorProps, CarouselItem, CarouselItemList, CarouselRoot, CarouselRootProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps };
95
+ //# sourceMappingURL=index.d.ts.map
@@ -1,16 +1,288 @@
1
1
  "use client";
2
2
 
3
3
 
4
- import "../../error-boundary-y9Samt_s.js";
5
- import "../../slot-WVWfOlr3.js";
6
- import "../../await-DDgVzpvI.js";
7
- import "../../for-DK5rEY_m.js";
8
- import "../../show-N1ZXBhoA.js";
9
- import "../../suspense-with-boundary-D-1NYDV4.js";
10
- import "../../switch-Ch22z21e.js";
11
- import "../../teleport-C8TzRm4M.js";
12
- import "../../common-PS3X58Pj.js";
13
- import "../../cn-s-D7vHW1.js";
14
- import { CarouselButton, CarouselCaption, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselItem, CarouselItemList, CarouselRoot, carousel_parts_exports } from "../../carousel-B051PAAX.js";
15
-
16
- export { carousel_parts_exports as Carousel, CarouselButton, CarouselCaption, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselItem, CarouselItemList, CarouselRoot };
4
+ import { __export } from "../../chunk-CTAAG5j7.js";
5
+ import { For } from "../../for-BYsFEk3R.js";
6
+ import { ShowContent, ShowFallback, ShowRoot } from "../../show-N1ZXBhoA.js";
7
+ import { cnMerge } from "../../cn-DdD3uYxA.js";
8
+ import { isFunction } from "@zayne-labs/toolkit-type-helpers";
9
+ import { useMemo, useState } from "react";
10
+ import { useAnimationInterval, useCallbackRef, useStore } from "@zayne-labs/toolkit-react";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ import { createStore } from "@zayne-labs/toolkit-core";
13
+ import { createZustandContext } from "@zayne-labs/toolkit-react/zustand";
14
+
15
+ //#region src/components/ui/carousel/carousel-store-context.ts
16
+ const [CarouselStoreContextProvider, useCarouselStoreContext] = createZustandContext({
17
+ hookName: "useCarouselStore",
18
+ name: "CarouselStoreContext",
19
+ providerName: "CarouselRoot"
20
+ });
21
+ const createCarouselStore = (storeValues) => {
22
+ const { images, onSlideBtnClick } = storeValues;
23
+ return createStore((set, get) => ({
24
+ currentSlide: 0,
25
+ images,
26
+ maxSlide: images.length - 1,
27
+ actions: {
28
+ goToNextSlide: () => {
29
+ const { currentSlide, maxSlide } = get();
30
+ const { goToSlide } = get().actions;
31
+ if (currentSlide === maxSlide) {
32
+ goToSlide(0);
33
+ return;
34
+ }
35
+ goToSlide(currentSlide + 1);
36
+ },
37
+ goToPreviousSlide: () => {
38
+ const { currentSlide, maxSlide } = get();
39
+ const { goToSlide } = get().actions;
40
+ if (currentSlide === 0) {
41
+ goToSlide(maxSlide);
42
+ return;
43
+ }
44
+ goToSlide(currentSlide - 1);
45
+ },
46
+ goToSlide: (newValue) => {
47
+ onSlideBtnClick?.();
48
+ set({ currentSlide: newValue });
49
+ }
50
+ }
51
+ }));
52
+ };
53
+ const useCarousel = (props) => {
54
+ const { images, onSlideBtnClick } = props;
55
+ const savedOnSlideBtnClick = useCallbackRef(onSlideBtnClick);
56
+ const carouselStore = useMemo(() => createCarouselStore({
57
+ images,
58
+ onSlideBtnClick: savedOnSlideBtnClick
59
+ }), [images, savedOnSlideBtnClick]);
60
+ const useCarouselStore = (selector) => {
61
+ return useStore(carouselStore, selector);
62
+ };
63
+ const savedUseCarouselStore = useCallbackRef(useCarouselStore);
64
+ return useMemo(() => ({
65
+ carouselStore,
66
+ useCarouselStore: savedUseCarouselStore
67
+ }), [carouselStore, savedUseCarouselStore]);
68
+ };
69
+
70
+ //#endregion
71
+ //#region src/components/ui/carousel/icons.tsx
72
+ const ChevronLeftIcon = (props) => /* @__PURE__ */ jsx("svg", {
73
+ xmlns: "http://www.w3.org/2000/svg",
74
+ width: "1em",
75
+ height: "1em",
76
+ viewBox: "0 0 24 24",
77
+ ...props,
78
+ children: /* @__PURE__ */ jsxs("g", {
79
+ fill: "none",
80
+ stroke: "currentColor",
81
+ strokeLinecap: "round",
82
+ strokeLinejoin: "round",
83
+ strokeWidth: "2",
84
+ children: [/* @__PURE__ */ jsx("circle", {
85
+ cx: "12",
86
+ cy: "12",
87
+ r: "10"
88
+ }), /* @__PURE__ */ jsx("path", { d: "m14 16l-4-4l4-4" })]
89
+ })
90
+ });
91
+
92
+ //#endregion
93
+ //#region src/components/ui/carousel/useCarouselOptions.ts
94
+ const useCarouselOptions = (options) => {
95
+ const { actions, autoSlideInterval = 5e3, hasAutoSlide = false, shouldPauseOnHover = false } = options;
96
+ const [isPaused, setIsPaused] = useState(false);
97
+ useAnimationInterval({
98
+ intervalDuration: hasAutoSlide && !isPaused ? autoSlideInterval : null,
99
+ onAnimation: actions.goToNextSlide
100
+ });
101
+ const pauseAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(true));
102
+ const resumeAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(false));
103
+ return {
104
+ pauseAutoSlide,
105
+ resumeAutoSlide
106
+ };
107
+ };
108
+
109
+ //#endregion
110
+ //#region src/components/ui/carousel/carousel.tsx
111
+ function CarouselRoot(props) {
112
+ const { as: Element = "div", autoSlideInterval, children, classNames, hasAutoSlide, images, onSlideBtnClick, shouldPauseOnHover } = props;
113
+ const { carouselStore } = useCarousel({
114
+ images,
115
+ onSlideBtnClick
116
+ });
117
+ const actions = carouselStore.getState().actions;
118
+ const { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({
119
+ actions,
120
+ autoSlideInterval,
121
+ hasAutoSlide,
122
+ shouldPauseOnHover
123
+ });
124
+ return /* @__PURE__ */ jsx(CarouselStoreContextProvider, {
125
+ store: carouselStore,
126
+ children: /* @__PURE__ */ jsx(Element, {
127
+ "data-scope": "carousel",
128
+ "data-part": "content",
129
+ "data-slot": "carousel-content",
130
+ className: cnMerge("relative select-none", classNames?.base),
131
+ onMouseEnter: pauseAutoSlide,
132
+ onMouseLeave: resumeAutoSlide,
133
+ children: /* @__PURE__ */ jsx("div", {
134
+ className: cnMerge("flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", classNames?.scrollContainer),
135
+ children
136
+ })
137
+ })
138
+ });
139
+ }
140
+ function CarouselButton(props) {
141
+ const { classNames, icon, variant } = props;
142
+ const { goToNextSlide, goToPreviousSlide } = useCarouselStoreContext((state) => state.actions);
143
+ return /* @__PURE__ */ jsx("button", {
144
+ "data-scope": "carousel",
145
+ "data-part": "button",
146
+ "data-slot": "carousel-button",
147
+ type: "button",
148
+ className: cnMerge("z-30 flex h-full w-fit items-center", variant === "prev" ? "justify-start" : "justify-end", classNames?.base),
149
+ onClick: variant === "prev" ? goToPreviousSlide : goToNextSlide,
150
+ children: /* @__PURE__ */ jsx("span", {
151
+ className: cnMerge("transition-transform active:scale-[1.06]", classNames?.iconContainer),
152
+ children: icon ?? /* @__PURE__ */ jsx(ChevronLeftIcon, { className: cnMerge(variant === "next" && "rotate-180", classNames?.defaultIcon) })
153
+ })
154
+ });
155
+ }
156
+ function CarouselControls(props) {
157
+ const { classNames, icon } = props;
158
+ return /* @__PURE__ */ jsx("div", {
159
+ "data-scope": "carousel",
160
+ "data-part": "controls",
161
+ "data-slot": "carousel-controls",
162
+ className: cnMerge("absolute inset-0 flex justify-between", classNames?.base),
163
+ children: /* @__PURE__ */ jsxs(ShowRoot, {
164
+ when: icon?.iconType,
165
+ children: [/* @__PURE__ */ jsxs(ShowContent, { children: [/* @__PURE__ */ jsx(CarouselButton, {
166
+ variant: "prev",
167
+ classNames: {
168
+ defaultIcon: classNames?.defaultIcon,
169
+ iconContainer: cnMerge(icon?.iconType === "nextIcon" && "rotate-180", classNames?.iconContainer)
170
+ },
171
+ icon: icon?.icon
172
+ }), /* @__PURE__ */ jsx(CarouselButton, {
173
+ variant: "next",
174
+ classNames: {
175
+ defaultIcon: classNames?.defaultIcon,
176
+ iconContainer: cnMerge(icon?.iconType === "prevIcon" && "rotate-180", classNames?.iconContainer)
177
+ },
178
+ icon: icon?.icon
179
+ })] }), /* @__PURE__ */ jsxs(ShowFallback, { children: [/* @__PURE__ */ jsx(CarouselButton, {
180
+ variant: "prev",
181
+ classNames: {
182
+ defaultIcon: classNames?.defaultIcon,
183
+ iconContainer: classNames?.iconContainer
184
+ },
185
+ icon: icon?.prev
186
+ }), /* @__PURE__ */ jsx(CarouselButton, {
187
+ variant: "next",
188
+ classNames: {
189
+ defaultIcon: classNames?.defaultIcon,
190
+ iconContainer: classNames?.iconContainer
191
+ },
192
+ icon: icon?.next
193
+ })] })]
194
+ })
195
+ });
196
+ }
197
+ function CarouselItemList(props) {
198
+ const { children, className, each } = props;
199
+ const currentSlide = useCarouselStoreContext((state) => state.currentSlide);
200
+ const images = useCarouselStoreContext((state) => each ?? state.images);
201
+ return /* @__PURE__ */ jsx("ul", {
202
+ "data-scope": "carousel",
203
+ "data-part": "item-list",
204
+ "data-slot": "carousel-item-list",
205
+ className: cnMerge(`flex w-full shrink-0 transform-[translate3d(var(--translate-distance),0,0)] snap-center
206
+ transition-transform duration-800`, className),
207
+ style: { "--translate-distance": `-${currentSlide * 100}%` },
208
+ children: isFunction(children) ? /* @__PURE__ */ jsx(For, {
209
+ each: images,
210
+ renderItem: (image, index, array) => children({
211
+ array,
212
+ image,
213
+ index
214
+ })
215
+ }) : children
216
+ });
217
+ }
218
+ function CarouselItem(props) {
219
+ const { children, className,...restOfProps } = props;
220
+ return /* @__PURE__ */ jsx("li", {
221
+ "data-scope": "carousel",
222
+ "data-part": "item",
223
+ "data-slot": "carousel-item",
224
+ className: cnMerge("flex w-full shrink-0 snap-center justify-center", className),
225
+ ...restOfProps,
226
+ children
227
+ });
228
+ }
229
+ function CarouselCaption(props) {
230
+ const { as: HtmlElement = "div", children, className } = props;
231
+ return /* @__PURE__ */ jsx(HtmlElement, {
232
+ "data-scope": "carousel",
233
+ "data-part": "caption",
234
+ "data-slot": "carousel-caption",
235
+ className: cnMerge("absolute z-10", className),
236
+ children
237
+ });
238
+ }
239
+ function CarouselIndicatorList(props) {
240
+ const { children, className, each } = props;
241
+ const images = useCarouselStoreContext((state) => each ?? state.images);
242
+ return /* @__PURE__ */ jsx("ul", {
243
+ "data-scope": "carousel",
244
+ "data-part": "indicator-list",
245
+ "data-slot": "carousel-indicator-list",
246
+ className: cnMerge("absolute bottom-[25px] z-[2] flex w-full items-center justify-center gap-[15px]", className),
247
+ children: isFunction(children) ? /* @__PURE__ */ jsx(For, {
248
+ each: images,
249
+ renderItem: (image, index, array) => children({
250
+ array,
251
+ image,
252
+ index
253
+ })
254
+ }) : children
255
+ });
256
+ }
257
+ function CarouselIndicator(props) {
258
+ const { classNames, currentIndex } = props;
259
+ const { actions: { goToSlide }, currentSlide } = useCarouselStoreContext((state) => state);
260
+ return /* @__PURE__ */ jsx("li", {
261
+ "data-scope": "carousel",
262
+ "data-part": "indicator",
263
+ "data-slot": "carousel-indicator",
264
+ className: cnMerge("inline-flex", classNames?.base),
265
+ children: /* @__PURE__ */ jsx("button", {
266
+ type: "button",
267
+ onClick: () => goToSlide(currentIndex),
268
+ className: cnMerge("size-[6px] rounded-[50%]", classNames?.base, currentIndex === currentSlide && ["w-[35px] rounded-[5px]", classNames?.isActive])
269
+ })
270
+ });
271
+ }
272
+
273
+ //#endregion
274
+ //#region src/components/ui/carousel/carousel-parts.ts
275
+ var carousel_parts_exports = __export({
276
+ Button: () => CarouselButton,
277
+ Caption: () => CarouselCaption,
278
+ Controls: () => CarouselControls,
279
+ Indicator: () => CarouselIndicator,
280
+ IndicatorGroup: () => CarouselIndicatorList,
281
+ Item: () => CarouselItem,
282
+ ItemGroup: () => CarouselItemList,
283
+ Root: () => CarouselRoot
284
+ });
285
+
286
+ //#endregion
287
+ export { carousel_parts_exports as Carousel, CarouselButton, CarouselCaption, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselItem, CarouselItemList, CarouselRoot };
288
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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 { Show } from \"@/components/common/show\";\nimport { For } from \"@/components/common/for\";\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<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each } = props;\n\n\tconst currentSlide = useCarouselStoreContext((state) => state.currentSlide);\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\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<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each } = props;\n\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\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 IndicatorGroup,\n\tCarouselItem as Item,\n\tCarouselItemList as ItemGroup,\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,M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;EACX,aAAU;EACV,aAAU;EACV,WAAW,QAAQ,iBAAiB,UAAU;EAE7C;GACY;;AAIhB,SAAgB,sBAAkC,OAAyC;CAC1F,MAAM,EAAE,UAAU,WAAW,SAAS;CAEtC,MAAM,SAAS,yBAAyB,UAAU,QAAS,MAAM,OAAwB;AAEzF,QACC,oBAAC;EACA,cAAW;EACX,aAAU;EACV,aAAU;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,2 +1,23 @@
1
- import { useDragScroll } from "../../index-C1GPFYKG.js";
2
- export { useDragScroll };
1
+ import { InferProps } from "@zayne-labs/toolkit-react/utils";
2
+
3
+ //#region src/components/ui/drag-scroll/use-drag-scroll.d.ts
4
+ type ItemProps<TItemElement extends HTMLElement> = Omit<InferProps<TItemElement>, "children">;
5
+ type RootProps<TElement extends HTMLElement> = Omit<InferProps<TElement>, "children">;
6
+ type DragScrollProps<TElement extends HTMLElement, TItemElement extends HTMLElement> = {
7
+ classNames?: {
8
+ base?: string;
9
+ item?: string;
10
+ };
11
+ extraItemProps?: ItemProps<TItemElement>;
12
+ extraRootProps?: InferProps<TElement>;
13
+ orientation?: "both" | "horizontal" | "vertical";
14
+ usage?: "allScreens" | "desktopOnly" | "mobileAndTabletOnly";
15
+ };
16
+ type DragScrollResult<TElement extends HTMLElement, TItemElement extends HTMLElement> = {
17
+ getItemProps: (itemProps?: ItemProps<TItemElement>) => ItemProps<TItemElement>;
18
+ getRootProps: (rootProps?: RootProps<TElement>) => RootProps<TElement>;
19
+ };
20
+ declare const useDragScroll: <TElement extends HTMLElement, TItemElement extends HTMLElement = HTMLElement>(props?: DragScrollProps<TElement, TItemElement>) => DragScrollResult<TElement, TItemElement>;
21
+ //#endregion
22
+ export { useDragScroll };
23
+ //# sourceMappingURL=index.d.ts.map