@zayne-labs/ui-react 0.11.2 → 0.11.4

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 (70) hide show
  1. package/dist/{esm → components}/common/await/index.d.ts +8 -8
  2. package/dist/{esm → components}/common/await/index.js +18 -9
  3. package/dist/components/common/await/index.js.map +1 -0
  4. package/dist/{esm → components}/common/client-gate/index.d.ts +2 -2
  5. package/dist/components/common/error-boundary/index.d.ts +2 -0
  6. package/dist/{esm → components}/common/error-boundary/index.js +1 -1
  7. package/dist/{esm → components}/common/for/index.d.ts +4 -4
  8. package/dist/{esm → components}/common/presence/index.d.ts +2 -2
  9. package/dist/components/common/presence/index.js +3 -0
  10. package/dist/{esm → components}/common/show/index.d.ts +4 -4
  11. package/dist/{esm → components}/common/show/index.js +1 -1
  12. package/dist/{esm → components}/common/slot/index.d.ts +4 -4
  13. package/dist/components/common/suspense-with-boundary/index.d.ts +2 -0
  14. package/dist/components/common/suspense-with-boundary/index.js +19 -0
  15. package/dist/components/common/suspense-with-boundary/index.js.map +1 -0
  16. package/dist/{esm → components}/common/switch/index.d.ts +4 -4
  17. package/dist/{esm → components}/common/teleport/index.d.ts +2 -2
  18. package/dist/{esm/error-boundary-C4btQhu_.js → components/error-boundary-BOZ3EvMt.js} +33 -31
  19. package/dist/components/error-boundary-BOZ3EvMt.js.map +1 -0
  20. package/dist/{esm/index-Dbt-nJhQ.d.ts → components/index-BmD5l0L7.d.ts} +13 -15
  21. package/dist/components/index-dmMYkH2c.d.ts +10 -0
  22. package/dist/{esm/presence-CHd9s3IS.js → components/presence-DkWhm7xu.js} +3 -3
  23. package/dist/{esm/presence-CHd9s3IS.js.map → components/presence-DkWhm7xu.js.map} +1 -1
  24. package/dist/{esm/show-BzfAw7y3.js → components/show-CMxdpPiN.js} +2 -2
  25. package/dist/components/show-CMxdpPiN.js.map +1 -0
  26. package/dist/{esm → components}/ui/card/index.d.ts +8 -8
  27. package/dist/{esm → components}/ui/carousel/index.d.ts +11 -16
  28. package/dist/{esm → components}/ui/carousel/index.js +42 -51
  29. package/dist/components/ui/carousel/index.js.map +1 -0
  30. package/dist/{esm → components}/ui/drag-scroll/index.d.ts +33 -25
  31. package/dist/{esm → components}/ui/drag-scroll/index.js +60 -59
  32. package/dist/components/ui/drag-scroll/index.js.map +1 -0
  33. package/dist/{esm → components}/ui/drop-zone/index.d.ts +42 -38
  34. package/dist/{esm → components}/ui/drop-zone/index.js +54 -23
  35. package/dist/components/ui/drop-zone/index.js.map +1 -0
  36. package/dist/{esm → components}/ui/form/index.d.ts +22 -22
  37. package/dist/{esm → components}/ui/form/index.js +11 -8
  38. package/dist/{esm → components}/ui/form/index.js.map +1 -1
  39. package/dist/style.css +14 -22
  40. package/package.json +11 -11
  41. package/dist/esm/common/await/index.js.map +0 -1
  42. package/dist/esm/common/error-boundary/index.d.ts +0 -2
  43. package/dist/esm/common/presence/index.js +0 -3
  44. package/dist/esm/common/suspense-with-boundary/index.d.ts +0 -2
  45. package/dist/esm/common/suspense-with-boundary/index.js +0 -20
  46. package/dist/esm/common/suspense-with-boundary/index.js.map +0 -1
  47. package/dist/esm/error-boundary-C4btQhu_.js.map +0 -1
  48. package/dist/esm/index-Ce3J0_vR.d.ts +0 -13
  49. package/dist/esm/show-BzfAw7y3.js.map +0 -1
  50. package/dist/esm/ui/carousel/index.js.map +0 -1
  51. package/dist/esm/ui/drag-scroll/index.js.map +0 -1
  52. package/dist/esm/ui/drop-zone/index.js.map +0 -1
  53. /package/dist/{esm → components}/chunk-pbuEa-1d.js +0 -0
  54. /package/dist/{esm → components}/cn-jNZfGhrk.js +0 -0
  55. /package/dist/{esm → components}/cn-jNZfGhrk.js.map +0 -0
  56. /package/dist/{esm → components}/common/client-gate/index.js +0 -0
  57. /package/dist/{esm → components}/common/client-gate/index.js.map +0 -0
  58. /package/dist/{esm → components}/common/for/index.js +0 -0
  59. /package/dist/{esm → components}/common/slot/index.js +0 -0
  60. /package/dist/{esm → components}/common/switch/index.js +0 -0
  61. /package/dist/{esm → components}/common/teleport/index.js +0 -0
  62. /package/dist/{esm → components}/common/teleport/index.js.map +0 -0
  63. /package/dist/{esm → components}/for-DGTMIS0w.js +0 -0
  64. /package/dist/{esm → components}/for-DGTMIS0w.js.map +0 -0
  65. /package/dist/{esm → components}/slot-DuwoiC2C.js +0 -0
  66. /package/dist/{esm → components}/slot-DuwoiC2C.js.map +0 -0
  67. /package/dist/{esm → components}/switch-Dwy5Gzsb.js +0 -0
  68. /package/dist/{esm → components}/switch-Dwy5Gzsb.js.map +0 -0
  69. /package/dist/{esm → components}/ui/card/index.js +0 -0
  70. /package/dist/{esm → components}/ui/card/index.js.map +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show-CMxdpPiN.js","names":[],"sources":["../../src/components/common/show/show.tsx","../../src/components/common/show/show-parts.ts"],"sourcesContent":["\"use client\";\n\nimport { toArray } from \"@zayne-labs/toolkit-core\";\nimport { getMultipleSlots, getSingleSlot } from \"@zayne-labs/toolkit-react/utils\";\nimport { assert, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\n\nexport type ShowRootProps<TWhen> =\n\t| {\n\t\t\tchildren: React.ReactNode;\n\t\t\tcontrol: \"content\";\n\t\t\tfallback?: React.ReactNode;\n\t\t\twhen?: never;\n\t }\n\t| {\n\t\t\tchildren: React.ReactNode | ((value: TWhen) => React.ReactNode);\n\t\t\tcontrol?: \"root\";\n\t\t\tfallback?: React.ReactNode;\n\t\t\twhen: false | TWhen | null | undefined;\n\t };\n\nexport function ShowRoot<TWhen>(props: ShowRootProps<TWhen>) {\n\tconst { children, control = \"root\", fallback = null, when } = props;\n\n\tif (control === \"content\" && !isFunction(children)) {\n\t\tconst childrenArray = toArray(children) as Array<React.ReactElement<ShowContentProps<TWhen>>>;\n\n\t\tconst foundContentSlot = childrenArray.find((child) => Boolean(child.props.when));\n\n\t\tconst fallBackSlot = getSingleSlot(childrenArray, ShowFallback);\n\n\t\tassert(\n\t\t\t!(fallBackSlot && fallback),\n\t\t\t\"The fallback prop and <Show.Fallback> cannot be used at the same time.\"\n\t\t);\n\n\t\treturn foundContentSlot ?? fallBackSlot ?? fallback;\n\t}\n\n\tconst resolvedChildren = isFunction(children) ? when && children(when) : children;\n\n\tconst {\n\t\tregularChildren,\n\t\tslots: [contentSlot, fallBackSlot],\n\t} = getMultipleSlots(resolvedChildren, [ShowContent, ShowFallback], {\n\t\terrorMessage: [\n\t\t\t\"Only one <Show.Content> component is allowed\",\n\t\t\t\"Only one <Show.Fallback> or <Show.OtherWise> component is allowed\",\n\t\t],\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tif (!when) {\n\t\tassert(\n\t\t\t!(fallBackSlot && fallback),\n\t\t\t\"The fallback prop and <Show.Fallback> cannot be used at the same time.\"\n\t\t);\n\n\t\treturn fallBackSlot ?? fallback;\n\t}\n\n\treturn contentSlot ?? regularChildren;\n}\n\nexport type ShowContentProps<TWhen> = Pick<ShowRootProps<TWhen>, \"children\" | \"when\">;\n\nexport function ShowContent<TWhen>(props: ShowContentProps<TWhen>) {\n\tconst { children, when } = props;\n\n\tconst resolvedChildren = isFunction(children) ? children(when as TWhen) : children;\n\n\treturn resolvedChildren;\n}\nShowContent.slotSymbol = Symbol(\"show-content\");\n\nexport function ShowFallback(props: { children: React.ReactNode }) {\n\tconst { children } = props;\n\n\treturn children;\n}\nShowFallback.slotSymbol = Symbol(\"show-fallback\");\n","export {\n\tShowContent as Content,\n\tShowFallback as Fallback,\n\tShowFallback as Otherwise,\n\tShowRoot as Root,\n} from \"./show\";\n"],"mappings":";;;;;AAoBA,SAAgB,SAAgB,OAA6B;CAC5D,MAAM,EAAE,UAAU,UAAU,QAAQ,WAAW,MAAM,SAAS;AAE9D,KAAI,YAAY,aAAa,CAAC,WAAW,SAAS,EAAE;EACnD,MAAM,gBAAgB,QAAQ,SAAS;EAEvC,MAAM,mBAAmB,cAAc,MAAM,UAAU,QAAQ,MAAM,MAAM,KAAK,CAAC;EAEjF,MAAM,eAAe,cAAc,eAAe,aAAa;AAE/D,SACC,EAAE,gBAAgB,WAClB,yEACA;AAED,SAAO,oBAAoB,gBAAgB;;CAK5C,MAAM,EACL,iBACA,OAAO,CAAC,aAAa,kBAClB,iBALqB,WAAW,SAAS,GAAG,QAAQ,SAAS,KAAK,GAAG,UAKlC,CAAC,aAAa,aAAa,EAAE;EACnE,cAAc,CACb,gDACA,oEACA;EACD,0BAA0B;EAC1B,CAAC;AAEF,KAAI,CAAC,MAAM;AACV,SACC,EAAE,gBAAgB,WAClB,yEACA;AAED,SAAO,gBAAgB;;AAGxB,QAAO,eAAe;;AAKvB,SAAgB,YAAmB,OAAgC;CAClE,MAAM,EAAE,UAAU,SAAS;AAI3B,QAFyB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;;AAI3E,YAAY,aAAa,OAAO,eAAe;AAE/C,SAAgB,aAAa,OAAsC;CAClE,MAAM,EAAE,aAAa;AAErB,QAAO;;AAER,aAAa,aAAa,OAAO,gBAAgB"}
@@ -1,31 +1,31 @@
1
1
  import { PolymorphicProps } from "@zayne-labs/toolkit-react/utils";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/ui/card/card.d.ts
5
5
  declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement, {
6
6
  asChild?: boolean;
7
7
  className?: string;
8
- }>): react_jsx_runtime0.JSX.Element;
8
+ }>): _$react_jsx_runtime0.JSX.Element;
9
9
  declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement, {
10
10
  asChild?: boolean;
11
11
  className?: string;
12
- }>): react_jsx_runtime0.JSX.Element;
12
+ }>): _$react_jsx_runtime0.JSX.Element;
13
13
  declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement, {
14
14
  className?: string;
15
- }>): react_jsx_runtime0.JSX.Element;
15
+ }>): _$react_jsx_runtime0.JSX.Element;
16
16
  declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement, {
17
17
  className?: string;
18
- }>): react_jsx_runtime0.JSX.Element;
18
+ }>): _$react_jsx_runtime0.JSX.Element;
19
19
  declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement, {
20
20
  className?: string;
21
- }>): react_jsx_runtime0.JSX.Element;
21
+ }>): _$react_jsx_runtime0.JSX.Element;
22
22
  declare function CardAction<TElement extends React.ElementType = "button">(props: PolymorphicProps<TElement, {
23
23
  className?: string;
24
- }>): react_jsx_runtime0.JSX.Element;
24
+ }>): _$react_jsx_runtime0.JSX.Element;
25
25
  declare function CardFooter<TElement extends React.ElementType = "footer">(props: PolymorphicProps<TElement, {
26
26
  asChild?: boolean;
27
27
  className?: string;
28
- }>): react_jsx_runtime0.JSX.Element;
28
+ }>): _$react_jsx_runtime0.JSX.Element;
29
29
  declare namespace card_parts_d_exports {
30
30
  export { CardAction as Action, CardContent as Content, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
31
31
  }
@@ -1,6 +1,6 @@
1
1
  import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
2
2
  import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
3
- import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
4
  import { StoreApi } from "@zayne-labs/toolkit-core";
5
5
 
6
6
  //#region src/components/ui/carousel/types.d.ts
@@ -21,7 +21,7 @@ type CarouselRootProps<TImages extends ImagesType = ImagesType> = {
21
21
  children: React.ReactNode;
22
22
  classNames?: {
23
23
  base?: string;
24
- scrollContainer?: string;
24
+ content?: string;
25
25
  };
26
26
  hasAutoSlide?: boolean;
27
27
  images: CarouselStore<TImages>["images"];
@@ -37,12 +37,7 @@ type CarouselButtonsProps = {
37
37
  icon?: React.ReactElement;
38
38
  variant: "next" | "prev";
39
39
  };
40
- type CarouselControlProps = {
41
- classNames?: {
42
- base?: string;
43
- defaultIcon?: string;
44
- iconContainer?: string;
45
- };
40
+ type CarouselControlProps = Pick<CarouselButtonsProps, "classNames"> & {
46
41
  icon?: UnionDiscriminator<[{
47
42
  icon?: React.ReactElement;
48
43
  iconType: "nextIcon" | "prevIcon";
@@ -78,14 +73,14 @@ type OtherCarouselProps = {
78
73
  };
79
74
  //#endregion
80
75
  //#region src/components/ui/carousel/carousel.d.ts
81
- declare function CarouselRoot<TImages extends ImagesType, TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>): react_jsx_runtime0.JSX.Element;
82
- declare function CarouselButton(props: CarouselButtonsProps): react_jsx_runtime0.JSX.Element;
83
- declare function CarouselControls(props: CarouselControlProps): react_jsx_runtime0.JSX.Element;
84
- declare function CarouselItemList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime0.JSX.Element;
85
- declare function CarouselItem(props: OtherCarouselProps): react_jsx_runtime0.JSX.Element;
86
- declare function CarouselCaption<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>): react_jsx_runtime0.JSX.Element;
87
- declare function CarouselIndicatorList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): react_jsx_runtime0.JSX.Element;
88
- declare function CarouselIndicator(props: CarouselIndicatorProps): react_jsx_runtime0.JSX.Element;
76
+ declare function CarouselRoot<TImages extends ImagesType, TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>): _$react_jsx_runtime0.JSX.Element;
77
+ declare function CarouselButton(props: CarouselButtonsProps): _$react_jsx_runtime0.JSX.Element;
78
+ declare function CarouselControls(props: CarouselControlProps): _$react_jsx_runtime0.JSX.Element;
79
+ declare function CarouselItemList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): _$react_jsx_runtime0.JSX.Element;
80
+ declare function CarouselItem(props: OtherCarouselProps): _$react_jsx_runtime0.JSX.Element;
81
+ declare function CarouselCaption<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>): _$react_jsx_runtime0.JSX.Element;
82
+ declare function CarouselIndicatorList<TArray extends unknown[]>(props: CarouselWrapperProps<TArray[number]>): _$react_jsx_runtime0.JSX.Element;
83
+ declare function CarouselIndicator(props: CarouselIndicatorProps): _$react_jsx_runtime0.JSX.Element;
89
84
  declare namespace carousel_parts_d_exports {
90
85
  export { CarouselButton as Button, CarouselCaption as Caption, CarouselControls as Controls, CarouselIndicator as Indicator, CarouselIndicatorList as IndicatorList, CarouselItem as Item, CarouselItemList as ItemList, CarouselRoot as Root };
91
86
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { t as __exportAll } from "../../chunk-pbuEa-1d.js";
3
3
  import { n as For } from "../../for-DGTMIS0w.js";
4
- import { i as ShowRoot, n as ShowContent, r as ShowFallback } from "../../show-BzfAw7y3.js";
4
+ import { i as ShowRoot, n as ShowContent, r as ShowFallback } from "../../show-CMxdpPiN.js";
5
5
  import { t as cnMerge } from "../../cn-jNZfGhrk.js";
6
6
  import { isFunction } from "@zayne-labs/toolkit-type-helpers";
7
7
  import { useMemo, useState } from "react";
@@ -116,14 +116,17 @@ function CarouselRoot(props) {
116
116
  return /* @__PURE__ */ jsx(CarouselStoreContextProvider, {
117
117
  store: carouselStore,
118
118
  children: /* @__PURE__ */ jsx(Element, {
119
+ "data-slot": "carousel-root",
119
120
  "data-scope": "carousel",
120
- "data-part": "content",
121
- "data-slot": "carousel-content",
122
- className: cnMerge("relative select-none", classNames?.base),
121
+ "data-part": "root",
122
+ className: cnMerge("relative isolate", classNames?.base),
123
123
  onMouseEnter: pauseAutoSlide,
124
124
  onMouseLeave: resumeAutoSlide,
125
125
  children: /* @__PURE__ */ jsx("div", {
126
- className: cnMerge("flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", classNames?.scrollContainer),
126
+ "data-scope": "carousel",
127
+ "data-part": "content",
128
+ "data-slot": "carousel-content",
129
+ className: cnMerge("scrollbar-hidden flex size-full overflow-x-scroll", classNames?.content),
127
130
  children
128
131
  })
129
132
  })
@@ -133,11 +136,11 @@ function CarouselButton(props) {
133
136
  const { classNames, icon, variant } = props;
134
137
  const { goToNextSlide, goToPreviousSlide } = useCarouselStoreContext((state) => state.actions);
135
138
  return /* @__PURE__ */ jsx("button", {
139
+ "data-slot": `carousel-${variant}-button`,
136
140
  "data-scope": "carousel",
137
141
  "data-part": "button",
138
- "data-slot": "carousel-button",
139
142
  type: "button",
140
- className: cnMerge("z-30 flex h-full w-fit items-center", variant === "prev" ? "justify-start" : "justify-end", classNames?.base),
143
+ className: cnMerge("absolute inset-y-0 z-20 flex items-center justify-center", variant === "prev" && "left-0", variant === "next" && "right-0", classNames?.base),
141
144
  onClick: variant === "prev" ? goToPreviousSlide : goToNextSlide,
142
145
  children: /* @__PURE__ */ jsx("span", {
143
146
  className: cnMerge("transition-transform active:scale-[1.06]", classNames?.iconContainer),
@@ -147,43 +150,31 @@ function CarouselButton(props) {
147
150
  }
148
151
  function CarouselControls(props) {
149
152
  const { classNames, icon } = props;
150
- return /* @__PURE__ */ jsx("div", {
151
- "data-scope": "carousel",
152
- "data-part": "controls",
153
- "data-slot": "carousel-controls",
154
- className: cnMerge("absolute inset-0 flex justify-between", classNames?.base),
155
- children: /* @__PURE__ */ jsxs(ShowRoot, {
156
- when: icon?.iconType,
157
- children: [/* @__PURE__ */ jsxs(ShowContent, { children: [/* @__PURE__ */ jsx(CarouselButton, {
158
- variant: "prev",
159
- classNames: {
160
- defaultIcon: classNames?.defaultIcon,
161
- iconContainer: cnMerge(icon?.iconType === "nextIcon" && "rotate-180", classNames?.iconContainer)
162
- },
163
- icon: icon?.icon
164
- }), /* @__PURE__ */ jsx(CarouselButton, {
165
- variant: "next",
166
- classNames: {
167
- defaultIcon: classNames?.defaultIcon,
168
- iconContainer: cnMerge(icon?.iconType === "prevIcon" && "rotate-180", classNames?.iconContainer)
169
- },
170
- icon: icon?.icon
171
- })] }), /* @__PURE__ */ jsxs(ShowFallback, { children: [/* @__PURE__ */ jsx(CarouselButton, {
172
- variant: "prev",
173
- classNames: {
174
- defaultIcon: classNames?.defaultIcon,
175
- iconContainer: classNames?.iconContainer
176
- },
177
- icon: icon?.prev
178
- }), /* @__PURE__ */ jsx(CarouselButton, {
179
- variant: "next",
180
- classNames: {
181
- defaultIcon: classNames?.defaultIcon,
182
- iconContainer: classNames?.iconContainer
183
- },
184
- icon: icon?.next
185
- })] })]
186
- })
153
+ return /* @__PURE__ */ jsxs(ShowRoot, {
154
+ when: icon?.iconType,
155
+ children: [/* @__PURE__ */ jsxs(ShowContent, { children: [/* @__PURE__ */ jsx(CarouselButton, {
156
+ variant: "prev",
157
+ classNames: {
158
+ ...classNames,
159
+ iconContainer: cnMerge(icon?.iconType === "nextIcon" && "rotate-180", classNames?.iconContainer)
160
+ },
161
+ icon: icon?.icon
162
+ }), /* @__PURE__ */ jsx(CarouselButton, {
163
+ variant: "next",
164
+ classNames: {
165
+ ...classNames,
166
+ iconContainer: cnMerge(icon?.iconType === "prevIcon" && "rotate-180", classNames?.iconContainer)
167
+ },
168
+ icon: icon?.icon
169
+ })] }), /* @__PURE__ */ jsxs(ShowFallback, { children: [/* @__PURE__ */ jsx(CarouselButton, {
170
+ variant: "prev",
171
+ classNames,
172
+ icon: icon?.prev
173
+ }), /* @__PURE__ */ jsx(CarouselButton, {
174
+ variant: "next",
175
+ classNames,
176
+ icon: icon?.next
177
+ })] })]
187
178
  });
188
179
  }
189
180
  function CarouselItemList(props) {
@@ -191,9 +182,9 @@ function CarouselItemList(props) {
191
182
  const currentSlide = useCarouselStoreContext((state) => state.currentSlide);
192
183
  const images = useCarouselStoreContext((state) => each ?? state.images);
193
184
  return /* @__PURE__ */ jsx("ul", {
185
+ "data-slot": "carousel-item-list",
194
186
  "data-scope": "carousel",
195
187
  "data-part": "item-list",
196
- "data-slot": "carousel-item-list",
197
188
  className: cnMerge(`flex w-full shrink-0 transform-[translate3d(var(--translate-distance),0,0)] snap-center
198
189
  transition-transform duration-800`, className),
199
190
  style: { "--translate-distance": `-${currentSlide * 100}%` },
@@ -210,20 +201,20 @@ function CarouselItemList(props) {
210
201
  function CarouselItem(props) {
211
202
  const { children, className, ...restOfProps } = props;
212
203
  return /* @__PURE__ */ jsx("li", {
204
+ "data-slot": "carousel-item",
213
205
  "data-scope": "carousel",
214
206
  "data-part": "item",
215
- "data-slot": "carousel-item",
216
207
  className: cnMerge("flex w-full shrink-0 snap-center justify-center", className),
217
208
  ...restOfProps,
218
209
  children
219
210
  });
220
211
  }
221
212
  function CarouselCaption(props) {
222
- const { as: HtmlElement = "div", children, className } = props;
223
- return /* @__PURE__ */ jsx(HtmlElement, {
213
+ const { as: Element = "div", children, className } = props;
214
+ return /* @__PURE__ */ jsx(Element, {
215
+ "data-slot": "carousel-caption",
224
216
  "data-scope": "carousel",
225
217
  "data-part": "caption",
226
- "data-slot": "carousel-caption",
227
218
  className: cnMerge("absolute z-10", className),
228
219
  children
229
220
  });
@@ -232,9 +223,9 @@ function CarouselIndicatorList(props) {
232
223
  const { children, className, each } = props;
233
224
  const images = useCarouselStoreContext((state) => each ?? state.images);
234
225
  return /* @__PURE__ */ jsx("ul", {
226
+ "data-slot": "carousel-indicator-list",
235
227
  "data-scope": "carousel",
236
228
  "data-part": "indicator-list",
237
- "data-slot": "carousel-indicator-list",
238
229
  className: cnMerge("absolute bottom-[25px] z-2 flex w-full items-center justify-center gap-[15px]", className),
239
230
  children: isFunction(children) ? /* @__PURE__ */ jsx(For, {
240
231
  each: images,
@@ -250,9 +241,9 @@ function CarouselIndicator(props) {
250
241
  const { classNames, currentIndex } = props;
251
242
  const { actions: { goToSlide }, currentSlide } = useCarouselStoreContext((state) => state);
252
243
  return /* @__PURE__ */ jsx("li", {
244
+ "data-slot": "carousel-indicator",
253
245
  "data-scope": "carousel",
254
246
  "data-part": "indicator",
255
- "data-slot": "carousel-indicator",
256
247
  className: cnMerge("inline-flex", classNames?.base),
257
248
  children: /* @__PURE__ */ jsx("button", {
258
249
  type: "button",
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["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 { createReactStoreContext } 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] = createReactStoreContext<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\t// eslint-disable-next-line react-x/component-hook-factories -- Ignore\n\tconst useCarouselStore: typeof useCarouselStoreContext = (selector) => {\n\t\t// eslint-disable-next-line react-hooks/hooks -- Ignore\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","export 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 { 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-slot=\"carousel-root\"\n\t\t\t\tdata-scope=\"carousel\"\n\t\t\t\tdata-part=\"root\"\n\t\t\t\tclassName={cnMerge(\"relative isolate\", 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\tdata-scope=\"carousel\"\n\t\t\t\t\tdata-part=\"content\"\n\t\t\t\t\tdata-slot=\"carousel-content\"\n\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\"scrollbar-hidden flex size-full overflow-x-scroll\",\n\t\t\t\t\t\tclassNames?.content\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-slot={`carousel-${variant}-button`}\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"button\"\n\t\t\ttype=\"button\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"absolute inset-y-0 z-20 flex items-center justify-center\",\n\t\t\t\tvariant === \"prev\" && \"left-0\",\n\t\t\t\tvariant === \"next\" && \"right-0\",\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<Show.Root when={icon?.iconType}>\n\t\t\t<Show.Content>\n\t\t\t\t<CarouselButton\n\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t...classNames,\n\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\ticon?.iconType === \"nextIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t/>\n\n\t\t\t\t<CarouselButton\n\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t...classNames,\n\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\ticon?.iconType === \"prevIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t/>\n\t\t\t</Show.Content>\n\n\t\t\t<Show.Fallback>\n\t\t\t\t<CarouselButton variant=\"prev\" classNames={classNames} icon={icon?.prev} />\n\n\t\t\t\t<CarouselButton variant=\"next\" classNames={classNames} icon={icon?.next} />\n\t\t\t</Show.Fallback>\n\t\t</Show.Root>\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-slot=\"carousel-item-list\"\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"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-slot=\"carousel-item\"\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"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: Element = \"div\", children, className } = props;\n\n\treturn (\n\t\t<Element\n\t\t\tdata-slot=\"carousel-caption\"\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"caption\"\n\t\t\tclassName={cnMerge(\"absolute z-10\", className)}\n\t\t>\n\t\t\t{children}\n\t\t</Element>\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-slot=\"carousel-indicator-list\"\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"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-slot=\"carousel-indicator\"\n\t\t\tdata-scope=\"carousel\"\n\t\t\tdata-part=\"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-1.5 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,2BAA2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ropsStrict } from "@zayne-labs/toolkit-react/utils";
2
- import * as _zayne_labs_toolkit_type_helpers0 from "@zayne-labs/toolkit-type-helpers";
2
+ import * as _$_zayne_labs_toolkit_type_helpers0 from "@zayne-labs/toolkit-type-helpers";
3
3
  import { SelectorFn } from "@zayne-labs/toolkit-type-helpers";
4
- import * as react from "react";
5
- import * as react_jsx_runtime0 from "react/jsx-runtime";
6
- import * as _zayne_labs_toolkit_core0 from "@zayne-labs/toolkit-core";
4
+ import * as _$react from "react";
5
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
6
+ import * as _$_zayne_labs_toolkit_core0 from "@zayne-labs/toolkit-core";
7
7
 
8
8
  //#region src/components/ui/drag-scroll/drag-scroll-context.d.ts
9
9
  declare const DragScrollStoreContextProvider: (props: {
@@ -29,9 +29,9 @@ declare const DragScrollStoreContextProvider: (props: {
29
29
  shouldReplace: true;
30
30
  }) | undefined): void;
31
31
  };
32
- subscribe: _zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore>;
32
+ subscribe: _$_zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore>;
33
33
  };
34
- }) => react.FunctionComponentElement<react.ProviderProps<{
34
+ }) => _$react.FunctionComponentElement<_$react.ProviderProps<{
35
35
  getInitialState: () => DragScrollStore;
36
36
  getListeners: () => Set<(state: DragScrollStore, prevState: DragScrollStore) => void>;
37
37
  getState: () => DragScrollStore;
@@ -52,8 +52,8 @@ declare const DragScrollStoreContextProvider: (props: {
52
52
  shouldReplace: true;
53
53
  }) | undefined): void;
54
54
  };
55
- subscribe: _zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore>;
56
- }>>, useDragScrollStoreContext: <TResult = DragScrollStore>(selector?: _zayne_labs_toolkit_type_helpers0.SelectorFn<DragScrollStore, TResult> | undefined) => TResult;
55
+ subscribe: _$_zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore>;
56
+ }>>, useDragScrollStoreContext: <TResult = DragScrollStore>(selector?: _$_zayne_labs_toolkit_type_helpers0.SelectorFn<DragScrollStore, TResult> | undefined) => TResult;
57
57
  //#endregion
58
58
  //#region src/components/ui/drag-scroll/drag-scroll-store.d.ts
59
59
  type RequiredUseDragScrollProps = { [Key in keyof Required<UseDragScrollProps>]: UseDragScrollProps[Key] | undefined };
@@ -79,7 +79,7 @@ declare const createDragScrollStore: (initStoreValues: InitStoreValues) => {
79
79
  shouldReplace: true;
80
80
  }) | undefined): void;
81
81
  };
82
- subscribe: _zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore>;
82
+ subscribe: _$_zayne_labs_toolkit_core0.SubscribeFn<DragScrollStore>;
83
83
  };
84
84
  //#endregion
85
85
  //#region src/components/ui/drag-scroll/types.d.ts
@@ -91,14 +91,14 @@ type SharedInputProps = {
91
91
  unstyled?: boolean;
92
92
  };
93
93
  type PartProps<TContainerElement extends HTMLElement = HTMLElement> = {
94
- container: {
95
- input: PartProps<TContainerElement>["container"]["output"] & SharedInputProps;
96
- output: RecordForDataAttr & InferProps<TContainerElement>;
97
- };
98
94
  item: {
99
95
  input: PartProps<TContainerElement>["item"]["output"] & SharedInputProps;
100
96
  output: InferProps<HTMLElement> & RecordForDataAttr;
101
97
  };
98
+ list: {
99
+ input: PartProps<TContainerElement>["list"]["output"] & SharedInputProps;
100
+ output: RecordForDataAttr & InferProps<TContainerElement>;
101
+ };
102
102
  nextButton: {
103
103
  input: PartProps<TContainerElement>["nextButton"]["output"] & SharedInputProps;
104
104
  output: RecordForDataAttr & InferProps<"button">;
@@ -129,7 +129,7 @@ type DragScrollActions = {
129
129
  handleMouseUpOrLeave: () => void;
130
130
  handleScroll: () => void;
131
131
  initializeResizeObserver: () => (() => void) | undefined;
132
- setContainerRef: (element: HTMLElement | null) => void;
132
+ setListRef: (element: HTMLElement | null) => void;
133
133
  updateScrollState: () => void;
134
134
  };
135
135
  };
@@ -166,13 +166,21 @@ type UseDragScrollProps = {
166
166
  usage?: "allScreens" | "desktopOnly" | "mobileAndTabletOnly";
167
167
  };
168
168
  type UseDragScrollResult<TContainerElement extends HTMLElement> = Pick<UseDragScrollProps, "disableInternalStateSubscription"> & {
169
- containerRef: React.RefObject<TContainerElement | null>;
169
+ listRef: React.RefObject<TContainerElement | null>;
170
170
  propGetters: DragScrollPropGetters<TContainerElement>;
171
171
  storeApi: ReturnType<typeof createDragScrollStore>;
172
172
  useDragScrollStore: typeof useDragScrollStoreContext;
173
173
  };
174
174
  //#endregion
175
+ //#region src/lib/utils/type-helpers.d.ts
176
+ type FromCamelToKebabCase<TString extends string> = TString extends `${infer First}${infer Rest}` ? First extends Uppercase<First> ? `-${Lowercase<First>}${FromCamelToKebabCase<Rest>}` : `${First}${FromCamelToKebabCase<Rest>}` : "";
177
+ //#endregion
175
178
  //#region src/components/ui/drag-scroll/use-drag-scroll.d.ts
179
+ declare const getDragScrollScopeAttrs: (part: FromCamelToKebabCase<keyof PartProps>) => {
180
+ readonly "data-slot": "drag-scroll-item" | "drag-scroll-list" | "drag-scroll-root" | "drag-scroll-next-button" | "drag-scroll-prev-button";
181
+ readonly "data-scope": "drag-scroll";
182
+ readonly "data-part": FromCamelToKebabCase<keyof PartProps>;
183
+ };
176
184
  declare const useDragScroll: <TContainerElement extends HTMLElement = HTMLElement>(props?: UseDragScrollProps) => UseDragScrollResult<TContainerElement>;
177
185
  //#endregion
178
186
  //#region src/components/ui/drag-scroll/drag-scroll.d.ts
@@ -180,31 +188,31 @@ type DragScrollRootProps = UseDragScrollProps & {
180
188
  asChild?: boolean;
181
189
  children: React.ReactNode;
182
190
  } & PartInputProps["root"];
183
- declare function DragScrollRoot<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, DragScrollRootProps>): react_jsx_runtime0.JSX.Element;
191
+ declare function DragScrollRoot(props: DragScrollRootProps): _$react_jsx_runtime0.JSX.Element;
184
192
  type DragScrollContextProps<TSlice> = {
185
193
  children: React.ReactNode | ((context: TSlice) => React.ReactNode);
186
194
  selector?: SelectorFn<DragScrollStore, TSlice>;
187
195
  };
188
- declare function DragScrollContext<TSlice = DragScrollStore>(props: DragScrollContextProps<TSlice>): react.ReactNode;
189
- type DragScrollContainerProps = {
196
+ declare function DragScrollContext<TSlice = DragScrollStore>(props: DragScrollContextProps<TSlice>): _$react.ReactNode;
197
+ type DragScrollListProps = {
190
198
  asChild?: boolean;
191
- } & PartInputProps["container"];
192
- declare function DragScrollContainer<TElement extends React.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, DragScrollContainerProps>): react_jsx_runtime0.JSX.Element;
199
+ } & PartInputProps["list"];
200
+ declare function DragScrollList<TElement extends React.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, DragScrollListProps>): _$react_jsx_runtime0.JSX.Element;
193
201
  type DragScrollItemProps = {
194
202
  asChild?: boolean;
195
203
  } & PartInputProps["item"];
196
- declare function DragScrollItem<TElement extends React.ElementType = "li">(props: PolymorphicPropsStrict<TElement, DragScrollItemProps>): react_jsx_runtime0.JSX.Element;
204
+ declare function DragScrollItem<TElement extends React.ElementType = "li">(props: PolymorphicPropsStrict<TElement, DragScrollItemProps>): _$react_jsx_runtime0.JSX.Element;
197
205
  type DragScrollPrevProps = {
198
206
  asChild?: boolean;
199
207
  } & PartInputProps["prevButton"];
200
- declare function DragScrollPrev(props: DragScrollPrevProps): react_jsx_runtime0.JSX.Element;
208
+ declare function DragScrollPrev(props: DragScrollPrevProps): _$react_jsx_runtime0.JSX.Element;
201
209
  type DragScrollNextProps = {
202
210
  asChild?: boolean;
203
211
  } & PartInputProps["nextButton"];
204
- declare function DragScrollNext(props: DragScrollNextProps): react_jsx_runtime0.JSX.Element;
212
+ declare function DragScrollNext(props: DragScrollNextProps): _$react_jsx_runtime0.JSX.Element;
205
213
  declare namespace drag_scroll_parts_d_exports {
206
- export { DragScrollContainer as Container, DragScrollContext as Context, DragScrollItem as Item, DragScrollNext as Next, DragScrollPrev as Prev, DragScrollRoot as Root };
214
+ export { DragScrollContext as Context, DragScrollItem as Item, DragScrollList as List, DragScrollNext as Next, DragScrollPrev as Prev, DragScrollRoot as Root };
207
215
  }
208
216
  //#endregion
209
- export { drag_scroll_parts_d_exports as DragScroll, DragScrollContainer, DragScrollContainerProps, DragScrollContext, DragScrollContextProps, DragScrollItem, DragScrollItemProps, DragScrollNext, DragScrollNextProps, DragScrollPrev, DragScrollPrevProps, DragScrollRoot, DragScrollRootProps, type DragScrollStore, type UseDragScrollProps, type UseDragScrollResult, useDragScroll, useDragScrollStoreContext };
217
+ export { drag_scroll_parts_d_exports as DragScroll, DragScrollContext, DragScrollContextProps, DragScrollItem, DragScrollItemProps, DragScrollList, DragScrollListProps, DragScrollNext, DragScrollNextProps, DragScrollPrev, DragScrollPrevProps, DragScrollRoot, DragScrollRootProps, type DragScrollStore, type UseDragScrollProps, type UseDragScrollResult, getDragScrollScopeAttrs, useDragScroll, useDragScrollStoreContext };
210
218
  //# sourceMappingURL=index.d.ts.map