@zayne-labs/ui-react 0.11.3 → 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 (69) hide show
  1. package/dist/{esm → components}/common/await/index.d.ts +4 -4
  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/components/common/error-boundary/index.d.ts +2 -0
  5. package/dist/{esm → components}/common/error-boundary/index.js +1 -1
  6. package/dist/components/common/presence/index.js +3 -0
  7. package/dist/{esm → components}/common/show/index.js +1 -1
  8. package/dist/components/common/suspense-with-boundary/index.d.ts +2 -0
  9. package/dist/components/common/suspense-with-boundary/index.js +19 -0
  10. package/dist/components/common/suspense-with-boundary/index.js.map +1 -0
  11. package/dist/{esm/error-boundary-C4btQhu_.js → components/error-boundary-BOZ3EvMt.js} +33 -31
  12. package/dist/components/error-boundary-BOZ3EvMt.js.map +1 -0
  13. package/dist/{esm/index-DC9fblW0.d.ts → components/index-BmD5l0L7.d.ts} +9 -11
  14. package/dist/{esm/index-D_Ntazyt.d.ts → components/index-dmMYkH2c.d.ts} +4 -7
  15. package/dist/{esm/presence-CHd9s3IS.js → components/presence-DkWhm7xu.js} +3 -3
  16. package/dist/{esm/presence-CHd9s3IS.js.map → components/presence-DkWhm7xu.js.map} +1 -1
  17. package/dist/{esm/show-BzfAw7y3.js → components/show-CMxdpPiN.js} +2 -2
  18. package/dist/components/show-CMxdpPiN.js.map +1 -0
  19. package/dist/{esm → components}/ui/carousel/index.d.ts +2 -7
  20. package/dist/{esm → components}/ui/carousel/index.js +42 -51
  21. package/dist/components/ui/carousel/index.js.map +1 -0
  22. package/dist/{esm → components}/ui/drag-scroll/index.js +9 -10
  23. package/dist/components/ui/drag-scroll/index.js.map +1 -0
  24. package/dist/{esm → components}/ui/drop-zone/index.d.ts +21 -17
  25. package/dist/{esm → components}/ui/drop-zone/index.js +54 -23
  26. package/dist/components/ui/drop-zone/index.js.map +1 -0
  27. package/dist/{esm → components}/ui/form/index.js +11 -8
  28. package/dist/{esm → components}/ui/form/index.js.map +1 -1
  29. package/dist/style.css +14 -22
  30. package/package.json +8 -8
  31. package/dist/esm/common/await/index.js.map +0 -1
  32. package/dist/esm/common/error-boundary/index.d.ts +0 -2
  33. package/dist/esm/common/presence/index.js +0 -3
  34. package/dist/esm/common/suspense-with-boundary/index.d.ts +0 -2
  35. package/dist/esm/common/suspense-with-boundary/index.js +0 -20
  36. package/dist/esm/common/suspense-with-boundary/index.js.map +0 -1
  37. package/dist/esm/error-boundary-C4btQhu_.js.map +0 -1
  38. package/dist/esm/show-BzfAw7y3.js.map +0 -1
  39. package/dist/esm/ui/carousel/index.js.map +0 -1
  40. package/dist/esm/ui/drag-scroll/index.js.map +0 -1
  41. package/dist/esm/ui/drop-zone/index.js.map +0 -1
  42. /package/dist/{esm → components}/chunk-pbuEa-1d.js +0 -0
  43. /package/dist/{esm → components}/cn-jNZfGhrk.js +0 -0
  44. /package/dist/{esm → components}/cn-jNZfGhrk.js.map +0 -0
  45. /package/dist/{esm → components}/common/client-gate/index.d.ts +0 -0
  46. /package/dist/{esm → components}/common/client-gate/index.js +0 -0
  47. /package/dist/{esm → components}/common/client-gate/index.js.map +0 -0
  48. /package/dist/{esm → components}/common/for/index.d.ts +0 -0
  49. /package/dist/{esm → components}/common/for/index.js +0 -0
  50. /package/dist/{esm → components}/common/presence/index.d.ts +0 -0
  51. /package/dist/{esm → components}/common/show/index.d.ts +0 -0
  52. /package/dist/{esm → components}/common/slot/index.d.ts +0 -0
  53. /package/dist/{esm → components}/common/slot/index.js +0 -0
  54. /package/dist/{esm → components}/common/switch/index.d.ts +0 -0
  55. /package/dist/{esm → components}/common/switch/index.js +0 -0
  56. /package/dist/{esm → components}/common/teleport/index.d.ts +0 -0
  57. /package/dist/{esm → components}/common/teleport/index.js +0 -0
  58. /package/dist/{esm → components}/common/teleport/index.js.map +0 -0
  59. /package/dist/{esm → components}/for-DGTMIS0w.js +0 -0
  60. /package/dist/{esm → components}/for-DGTMIS0w.js.map +0 -0
  61. /package/dist/{esm → components}/slot-DuwoiC2C.js +0 -0
  62. /package/dist/{esm → components}/slot-DuwoiC2C.js.map +0 -0
  63. /package/dist/{esm → components}/switch-Dwy5Gzsb.js +0 -0
  64. /package/dist/{esm → components}/switch-Dwy5Gzsb.js.map +0 -0
  65. /package/dist/{esm → components}/ui/card/index.d.ts +0 -0
  66. /package/dist/{esm → components}/ui/card/index.js +0 -0
  67. /package/dist/{esm → components}/ui/card/index.js.map +0 -0
  68. /package/dist/{esm → components}/ui/drag-scroll/index.d.ts +0 -0
  69. /package/dist/{esm → components}/ui/form/index.d.ts +0 -0
@@ -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,2BA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
  }, [actions]);
218
218
  const getRootProps = useCallbackRef((innerProps) => {
219
219
  return {
220
- ...getDragScrollScopeAttrs("root"),
221
220
  ...innerProps,
221
+ ...getDragScrollScopeAttrs("root"),
222
222
  className: cnMerge("relative", innerProps?.className)
223
223
  };
224
224
  });
225
225
  const getListProps = useCallback((innerProps) => {
226
226
  return {
227
+ ...innerProps,
227
228
  ...getDragScrollScopeAttrs("list"),
228
229
  ...!disableInternalStateSubscription && { "data-dragging": dataAttr(isDragging) },
229
- ...innerProps,
230
230
  className: cnMerge(`scrollbar-hidden flex w-full cursor-grab snap-x snap-mandatory overflow-x-scroll overflow-y-hidden`, orientation === "horizontal" && "flex-row", orientation === "vertical" && "flex-col", usage === "mobileAndTabletOnly" && "md:cursor-default md:flex-col", usage === "desktopOnly" && "max-md:cursor-default max-md:flex-col", innerProps?.className),
231
231
  ref: composeRefs(refCallback, innerProps?.ref)
232
232
  };
@@ -239,35 +239,34 @@ const useDragScroll = (props) => {
239
239
  ]);
240
240
  const getItemProps = useCallbackRef((innerProps) => {
241
241
  return {
242
- ...getDragScrollScopeAttrs("item"),
243
242
  ...innerProps,
243
+ ...getDragScrollScopeAttrs("item"),
244
244
  className: cnMerge("snap-center snap-always", innerProps?.className)
245
245
  };
246
246
  });
247
247
  const getPrevButtonProps = useCallback((innerProps) => {
248
248
  const isDisabled = innerProps?.disabled ?? !canGoToPrev;
249
249
  return {
250
- ...getDragScrollScopeAttrs("prev-button"),
251
- type: "button",
252
250
  ...innerProps,
251
+ ...getDragScrollScopeAttrs("prev-button"),
253
252
  "aria-disabled": dataAttr(isDisabled),
254
253
  "aria-label": innerProps?.["aria-label"] ?? "Scroll back",
255
254
  "data-disabled": dataAttr(isDisabled),
256
255
  disabled: isDisabled,
257
- onClick: composeTwoEventHandlers(actions.goToPrev, innerProps?.onClick)
256
+ onClick: composeTwoEventHandlers(actions.goToPrev, innerProps?.onClick),
257
+ type: "button"
258
258
  };
259
259
  }, [actions.goToPrev, canGoToPrev]);
260
260
  const getNextButtonProps = useCallback((innerProps) => {
261
261
  const isDisabled = innerProps?.disabled ?? !canGoToNext;
262
262
  return {
263
- ...getDragScrollScopeAttrs("next-button"),
264
- type: "button",
265
263
  ...innerProps,
266
- "aria-disabled": dataAttr(isDisabled),
264
+ ...getDragScrollScopeAttrs("next-button"),
267
265
  "aria-label": innerProps?.["aria-label"] ?? "Scroll forward",
268
266
  "data-disabled": dataAttr(isDisabled),
269
267
  disabled: isDisabled,
270
- onClick: composeTwoEventHandlers(actions.goToNext, innerProps?.onClick)
268
+ onClick: composeTwoEventHandlers(actions.goToNext, innerProps?.onClick),
269
+ type: "button"
271
270
  };
272
271
  }, [actions.goToNext, canGoToNext]);
273
272
  const propGetters = useMemo(() => ({
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Slot.Root"],"sources":["../../../../src/components/ui/drag-scroll/utils.ts","../../../../src/components/ui/drag-scroll/drag-scroll-store.ts","../../../../src/components/ui/drag-scroll/use-drag-scroll.ts","../../../../src/components/ui/drag-scroll/drag-scroll-context.ts","../../../../src/components/ui/drag-scroll/drag-scroll.tsx","../../../../src/components/ui/drag-scroll/drag-scroll-parts.ts"],"sourcesContent":["import { checkIsDeviceMobile } from \"@zayne-labs/toolkit-core\";\n\n/* eslint-disable no-param-reassign -- Mutation is needed here since it's an element */\nexport const updateCursor = <TElement extends HTMLElement>(element: TElement) => {\n\telement.style.cursor = \"grabbing\";\n\telement.style.userSelect = \"none\";\n};\n\nexport const onScrollSnap = <TElement extends HTMLElement>(\n\taction: \"remove\" | \"reset\",\n\telement: TElement\n) => {\n\tif (action === \"remove\") {\n\t\telement.style.scrollSnapType = \"none\";\n\t\treturn;\n\t}\n\n\telement.style.scrollSnapType = \"\";\n};\n\nexport const resetCursor = <TElement extends HTMLElement>(element: TElement) => {\n\telement.style.cursor = \"\";\n\telement.style.userSelect = \"\";\n};\n/* eslint-enable no-param-reassign -- Mutation is needed here since it's an element */\n\nexport const handleScrollSnap = (dragContainer: HTMLElement) => {\n\tconst isMobile = checkIsDeviceMobile();\n\n\tif (!isMobile) {\n\t\tonScrollSnap(\"remove\", dragContainer);\n\t} else {\n\t\tonScrollSnap(\"reset\", dragContainer);\n\t}\n};\n","import { createStore, on, throttleByFrame } from \"@zayne-labs/toolkit-core\";\nimport { isNumber } from \"@zayne-labs/toolkit-type-helpers\";\nimport type { DragScrollStore, UseDragScrollProps } from \"./types\";\nimport { handleScrollSnap, resetCursor, updateCursor } from \"./utils\";\n\ntype RequiredUseDragScrollProps = {\n\t[Key in keyof Required<UseDragScrollProps>]: UseDragScrollProps[Key] | undefined;\n};\n\ntype InitStoreValues = Pick<RequiredUseDragScrollProps, \"orientation\" | \"scrollAmount\" | \"usage\">;\n\nexport const createDragScrollStore = (initStoreValues: InitStoreValues) => {\n\tconst { orientation = \"horizontal\", scrollAmount = \"item\", usage = \"allScreens\" } = initStoreValues;\n\n\tconst listRef: React.RefObject<HTMLElement | null> = {\n\t\tcurrent: null,\n\t};\n\n\tconst positionRef = {\n\t\tcurrent: {\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t},\n\t};\n\n\tconst abortControllerRef = {\n\t\tcurrent: {\n\t\t\tmouseLeave: new AbortController(),\n\t\t\tmouseMove: new AbortController(),\n\t\t\tmouseUp: new AbortController(),\n\t\t},\n\t};\n\n\t// == Calculate scroll amount based on orientation and settings\n\tconst getScrollAmount = (container: HTMLElement): number => {\n\t\tif (isNumber(scrollAmount)) {\n\t\t\treturn scrollAmount;\n\t\t}\n\n\t\tconst firstChild = container.children[0] as HTMLElement | undefined;\n\n\t\tif (!firstChild) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn orientation === \"vertical\" || orientation === \"both\" ?\n\t\t\t\tfirstChild.offsetHeight\n\t\t\t:\tfirstChild.offsetWidth;\n\t};\n\n\tconst store = createStore<DragScrollStore>((set, get) => ({\n\t\tcanGoToNext: true,\n\t\tcanGoToPrev: false,\n\t\tisDragging: false,\n\n\t\t// eslint-disable-next-line perfectionist/sort-objects -- actions should be last\n\t\tactions: {\n\t\t\tcleanupDragListeners: () => {\n\t\t\t\tabortControllerRef.current.mouseMove.abort();\n\t\t\t\tabortControllerRef.current.mouseUp.abort();\n\t\t\t\tabortControllerRef.current.mouseLeave.abort();\n\t\t\t},\n\n\t\t\tgoToNext: () => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tconst { canGoToNext } = get();\n\t\t\t\tif (!canGoToNext) return;\n\n\t\t\t\tconst amount = getScrollAmount(listRef.current);\n\n\t\t\t\tlistRef.current.scrollBy({\n\t\t\t\t\tbehavior: \"smooth\",\n\t\t\t\t\tleft: orientation === \"vertical\" ? 0 : amount,\n\t\t\t\t\ttop: orientation === \"vertical\" || orientation === \"both\" ? amount : 0,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tgoToPrev: () => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tconst { canGoToPrev } = get();\n\t\t\t\tif (!canGoToPrev) return;\n\n\t\t\t\tconst amount = getScrollAmount(listRef.current);\n\n\t\t\t\tlistRef.current.scrollBy({\n\t\t\t\t\tbehavior: \"smooth\",\n\t\t\t\t\tleft: orientation === \"vertical\" ? 0 : -amount,\n\t\t\t\t\ttop: orientation === \"vertical\" || orientation === \"both\" ? -amount : 0,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\thandleMouseDown: (event) => {\n\t\t\t\tif (usage === \"mobileAndTabletOnly\" && window.innerWidth >= 768) return;\n\t\t\t\tif (usage === \"desktopOnly\" && window.innerWidth < 768) return;\n\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\t// == Create fresh AbortControllers for each drag session (they cannot be reused after abort)\n\t\t\t\tabortControllerRef.current = {\n\t\t\t\t\tmouseLeave: new AbortController(),\n\t\t\t\t\tmouseMove: new AbortController(),\n\t\t\t\t\tmouseUp: new AbortController(),\n\t\t\t\t};\n\n\t\t\t\t// == Update all initial position properties\n\t\t\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\t\t\tpositionRef.current.x = event.clientX;\n\t\t\t\t\tpositionRef.current.left = listRef.current.scrollLeft;\n\t\t\t\t}\n\n\t\t\t\tif (orientation === \"vertical\" || orientation === \"both\") {\n\t\t\t\t\tpositionRef.current.y = event.clientY;\n\t\t\t\t\tpositionRef.current.top = listRef.current.scrollTop;\n\t\t\t\t}\n\n\t\t\t\tupdateCursor(listRef.current);\n\t\t\t\tset({ isDragging: true });\n\n\t\t\t\tconst { actions } = get();\n\n\t\t\t\ton(listRef.current, \"mousemove\", actions.handleMouseMove, {\n\t\t\t\t\tsignal: abortControllerRef.current.mouseMove.signal,\n\t\t\t\t});\n\t\t\t\ton(listRef.current, \"mouseup\", actions.handleMouseUpOrLeave, {\n\t\t\t\t\tsignal: abortControllerRef.current.mouseUp.signal,\n\t\t\t\t});\n\t\t\t\ton(listRef.current, \"mouseleave\", actions.handleMouseUpOrLeave, {\n\t\t\t\t\tsignal: abortControllerRef.current.mouseLeave.signal,\n\t\t\t\t});\n\t\t\t\t// == Document-level mouseup fallback for when user releases outside the container\n\t\t\t\ton(document, \"mouseup\", actions.handleMouseUpOrLeave, {\n\t\t\t\t\tonce: true,\n\t\t\t\t\tsignal: abortControllerRef.current.mouseUp.signal,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\thandleMouseMove: (event) => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\t\t\tconst dx = event.clientX - positionRef.current.x;\n\t\t\t\t\tlistRef.current.scrollLeft = positionRef.current.left - dx;\n\t\t\t\t}\n\n\t\t\t\tif (orientation === \"vertical\" || orientation === \"both\") {\n\t\t\t\t\tconst dy = event.clientY - positionRef.current.y;\n\t\t\t\t\tlistRef.current.scrollTop = positionRef.current.top - dy;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\thandleMouseUpOrLeave: () => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tresetCursor(listRef.current);\n\t\t\t\tset({ isDragging: false });\n\n\t\t\t\tconst { actions } = get();\n\t\t\t\tactions.cleanupDragListeners();\n\t\t\t},\n\n\t\t\thandleScroll: throttleByFrame(() => {\n\t\t\t\tconst { actions } = get();\n\t\t\t\tactions.updateScrollState();\n\t\t\t}),\n\n\t\t\tinitializeResizeObserver: () => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tconst { actions } = get();\n\n\t\t\t\t// == Use ResizeObserver to detect when container or children resize\n\t\t\t\tconst resizeObserver = new ResizeObserver(() => actions.updateScrollState());\n\n\t\t\t\tresizeObserver.observe(listRef.current);\n\n\t\t\t\t// == Also observe children for size changes\n\t\t\t\tfor (const child of listRef.current.children) {\n\t\t\t\t\tresizeObserver.observe(child);\n\t\t\t\t}\n\n\t\t\t\tconst cleanup = () => {\n\t\t\t\t\tresizeObserver.disconnect();\n\t\t\t\t};\n\n\t\t\t\treturn cleanup;\n\t\t\t},\n\n\t\t\tsetListRef: (element) => {\n\t\t\t\tlistRef.current = element as HTMLElement;\n\n\t\t\t\tif (!element) return;\n\n\t\t\t\thandleScrollSnap(element);\n\n\t\t\t\tconst { actions } = get();\n\t\t\t\tactions.updateScrollState();\n\t\t\t},\n\n\t\t\tupdateScrollState: () => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\t\t\tconst { clientWidth, scrollLeft, scrollWidth } = listRef.current;\n\n\t\t\t\t\tset({\n\t\t\t\t\t\tcanGoToNext: Math.ceil(scrollLeft + clientWidth) < scrollWidth,\n\t\t\t\t\t\tcanGoToPrev: Math.floor(scrollLeft) > 0,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (orientation === \"vertical\") {\n\t\t\t\t\tconst { clientHeight, scrollHeight, scrollTop } = listRef.current;\n\n\t\t\t\t\tset({\n\t\t\t\t\t\tcanGoToNext: Math.ceil(scrollTop + clientHeight) < scrollHeight,\n\t\t\t\t\t\tcanGoToPrev: Math.floor(scrollTop) > 0,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t}));\n\n\treturn store;\n};\n","import { dataAttr, on } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef, useStore } from \"@zayne-labs/toolkit-react\";\nimport { composeRefs, composeTwoEventHandlers } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { FromCamelToKebabCase } from \"@/lib/utils/type-helpers\";\nimport { createDragScrollStore } from \"./drag-scroll-store\";\nimport type { DragScrollPropGetters, PartProps, UseDragScrollProps, UseDragScrollResult } from \"./types\";\n\nexport const getDragScrollScopeAttrs = (part: FromCamelToKebabCase<keyof PartProps>) => {\n\treturn {\n\t\t/* eslint-disable perfectionist/sort-objects -- I need this order to be maintained */\n\t\t\"data-slot\": `drag-scroll-${part}`,\n\t\t\"data-scope\": \"drag-scroll\",\n\t\t\"data-part\": part,\n\t\t/* eslint-enable perfectionist/sort-objects -- I need this order to be maintained */\n\t} as const;\n};\n\nexport const useDragScroll = <TContainerElement extends HTMLElement = HTMLElement>(\n\tprops?: UseDragScrollProps\n): UseDragScrollResult<TContainerElement> => {\n\tconst {\n\t\tdisableInternalStateSubscription = false,\n\t\torientation = \"horizontal\",\n\t\tscrollAmount = \"item\",\n\t\tusage = \"allScreens\",\n\t} = props ?? {};\n\n\tconst listRef = useRef<TContainerElement>(null);\n\n\tconst storeApi = useMemo(() => {\n\t\treturn createDragScrollStore({ orientation, scrollAmount, usage });\n\t}, [orientation, scrollAmount, usage]);\n\n\tconst actions = storeApi.getState().actions;\n\n\t/* eslint-disable react-hooks/hooks -- ignore */\n\t// eslint-disable-next-line react-x/component-hook-factories -- Ignore\n\tconst useDragScrollStore: UseDragScrollResult<TContainerElement>[\"useDragScrollStore\"] = (selector) => {\n\t\treturn useStore(storeApi as never, selector);\n\t};\n\n\tconst canGoToPrev = useDragScrollStore((state) =>\n\t\t!disableInternalStateSubscription ? state.canGoToPrev : null\n\t);\n\n\tconst canGoToNext = useDragScrollStore((state) =>\n\t\t!disableInternalStateSubscription ? state.canGoToNext : null\n\t);\n\n\tconst isDragging = useDragScrollStore((state) =>\n\t\t!disableInternalStateSubscription ? state.isDragging : null\n\t);\n\t/* eslint-enable react-hooks/hooks -- ignore */\n\n\tconst refCallback: React.RefCallback<TContainerElement> = useCallbackRef((node) => {\n\t\tlistRef.current = node;\n\t\tactions.setListRef(node);\n\n\t\tif (!node) return;\n\n\t\tconst cleanupMouseDown = on(node, \"mousedown\", actions.handleMouseDown);\n\t\tconst cleanupScroll = on(node, \"scroll\", actions.handleScroll, { passive: true });\n\n\t\treturn () => {\n\t\t\tcleanupMouseDown();\n\t\t\tcleanupScroll();\n\t\t};\n\t});\n\n\t// == Update scroll state when children might change (e.g., async loaded content)\n\tuseEffect(() => {\n\t\tconst cleanup = actions.initializeResizeObserver();\n\n\t\treturn cleanup;\n\t}, [actions]);\n\n\tconst getRootProps: DragScrollPropGetters<TContainerElement>[\"getRootProps\"] = useCallbackRef(\n\t\t(innerProps) => {\n\t\t\treturn {\n\t\t\t\t...innerProps,\n\t\t\t\t...getDragScrollScopeAttrs(\"root\"),\n\t\t\t\tclassName: cnMerge(\"relative\", innerProps?.className),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst getListProps: DragScrollPropGetters<TContainerElement>[\"getListProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\treturn {\n\t\t\t\t...innerProps,\n\t\t\t\t...getDragScrollScopeAttrs(\"list\"),\n\t\t\t\t...(!disableInternalStateSubscription && {\n\t\t\t\t\t\"data-dragging\": dataAttr(isDragging),\n\t\t\t\t}),\n\t\t\t\tclassName: cnMerge(\n\t\t\t\t\t`scrollbar-hidden flex w-full cursor-grab snap-x snap-mandatory overflow-x-scroll overflow-y-hidden`,\n\t\t\t\t\torientation === \"horizontal\" && \"flex-row\",\n\t\t\t\t\torientation === \"vertical\" && \"flex-col\",\n\t\t\t\t\tusage === \"mobileAndTabletOnly\" && \"md:cursor-default md:flex-col\",\n\t\t\t\t\tusage === \"desktopOnly\" && \"max-md:cursor-default max-md:flex-col\",\n\t\t\t\t\tinnerProps?.className\n\t\t\t\t),\n\t\t\t\tref: composeRefs(\n\t\t\t\t\trefCallback,\n\t\t\t\t\t(innerProps as { ref?: React.Ref<TContainerElement> } | undefined)?.ref\n\t\t\t\t),\n\t\t\t} as never;\n\t\t},\n\t\t[disableInternalStateSubscription, isDragging, orientation, refCallback, usage]\n\t);\n\n\tconst getItemProps: DragScrollPropGetters<TContainerElement>[\"getItemProps\"] = useCallbackRef(\n\t\t(innerProps) => {\n\t\t\treturn {\n\t\t\t\t...innerProps,\n\t\t\t\t...getDragScrollScopeAttrs(\"item\"),\n\t\t\t\tclassName: cnMerge(\"snap-center snap-always\", innerProps?.className),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst getPrevButtonProps: DragScrollPropGetters<TContainerElement>[\"getPrevButtonProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst isDisabled = innerProps?.disabled ?? !canGoToPrev;\n\n\t\t\treturn {\n\t\t\t\t...innerProps,\n\t\t\t\t...getDragScrollScopeAttrs(\"prev-button\"),\n\t\t\t\t\"aria-disabled\": dataAttr(isDisabled),\n\t\t\t\t\"aria-label\": innerProps?.[\"aria-label\"] ?? \"Scroll back\",\n\t\t\t\t\"data-disabled\": dataAttr(isDisabled),\n\t\t\t\tdisabled: isDisabled,\n\t\t\t\tonClick: composeTwoEventHandlers(actions.goToPrev, innerProps?.onClick),\n\t\t\t\ttype: \"button\",\n\t\t\t};\n\t\t},\n\t\t[actions.goToPrev, canGoToPrev]\n\t);\n\n\tconst getNextButtonProps: DragScrollPropGetters<TContainerElement>[\"getNextButtonProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst isDisabled = innerProps?.disabled ?? !canGoToNext;\n\n\t\t\treturn {\n\t\t\t\t...innerProps,\n\t\t\t\t...getDragScrollScopeAttrs(\"next-button\"),\n\t\t\t\t\"aria-label\": innerProps?.[\"aria-label\"] ?? \"Scroll forward\",\n\t\t\t\t\"data-disabled\": dataAttr(isDisabled),\n\t\t\t\tdisabled: isDisabled,\n\t\t\t\tonClick: composeTwoEventHandlers(actions.goToNext, innerProps?.onClick),\n\t\t\t\ttype: \"button\",\n\t\t\t};\n\t\t},\n\t\t[actions.goToNext, canGoToNext]\n\t);\n\n\tconst propGetters = useMemo<DragScrollPropGetters<TContainerElement>>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tgetItemProps,\n\t\t\t\tgetListProps,\n\t\t\t\tgetNextButtonProps,\n\t\t\t\tgetPrevButtonProps,\n\t\t\t\tgetRootProps,\n\t\t\t}) satisfies DragScrollPropGetters<TContainerElement>,\n\t\t[getPrevButtonProps, getListProps, getItemProps, getNextButtonProps, getRootProps]\n\t);\n\n\tconst stableUseDragScrollStore = useCallbackRef(useDragScrollStore);\n\n\tconst result = useMemo<UseDragScrollResult<TContainerElement>>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tdisableInternalStateSubscription,\n\t\t\t\tlistRef,\n\t\t\t\tpropGetters,\n\t\t\t\tstoreApi,\n\t\t\t\tuseDragScrollStore: stableUseDragScrollStore,\n\t\t\t}) satisfies UseDragScrollResult<TContainerElement>,\n\t\t[propGetters, disableInternalStateSubscription, storeApi, stableUseDragScrollStore]\n\t);\n\n\treturn result;\n};\n","import { createCustomContext } from \"@zayne-labs/toolkit-react\";\nimport { createReactStoreContext } from \"@zayne-labs/toolkit-react/zustand\";\nimport type { DragScrollStore, UseDragScrollResult } from \"./types\";\n\nconst [DragScrollStoreContextProvider, useDragScrollStoreContext] =\n\tcreateReactStoreContext<DragScrollStore>({\n\t\thookName: \"useDragScrollStoreContext\",\n\t\tname: \"DragScrollStoreContext\",\n\t\tproviderName: \"DragScrollRoot\",\n\t});\n\nexport type DragScrollRootContextType<TElement extends HTMLElement = HTMLElement> = Pick<\n\tUseDragScrollResult<TElement>,\n\t\"disableInternalStateSubscription\" | \"listRef\" | \"propGetters\"\n>;\n\nconst [DragScrollRootContextProvider, useDragScrollRootContext] =\n\tcreateCustomContext<DragScrollRootContextType>({\n\t\thookName: \"useDragScrollRootContext\",\n\t\tname: \"DragScrollRootContext\",\n\t\tproviderName: \"DragScrollRoot\",\n\t});\n\nexport {\n\tDragScrollRootContextProvider,\n\tDragScrollStoreContextProvider,\n\tuseDragScrollRootContext,\n\tuseDragScrollStoreContext,\n};\n","\"use client\";\n\nimport { useCompareSelector } from \"@zayne-labs/toolkit-react\";\nimport type { PolymorphicPropsStrict } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction, type SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useMemo } from \"react\";\nimport { Slot } from \"@/components/common/slot\";\nimport {\n\tDragScrollRootContextProvider,\n\tDragScrollStoreContextProvider,\n\tuseDragScrollRootContext,\n\tuseDragScrollStoreContext,\n\ttype DragScrollRootContextType,\n} from \"./drag-scroll-context\";\nimport type { DragScrollStore, PartInputProps, UseDragScrollProps } from \"./types\";\nimport { useDragScroll } from \"./use-drag-scroll\";\n\n/* eslint-disable perfectionist/sort-intersection-types -- I need non-standard props to come first */\n\nexport type DragScrollRootProps = UseDragScrollProps & {\n\tasChild?: boolean;\n\tchildren: React.ReactNode;\n} & PartInputProps[\"root\"];\n\nexport function DragScrollRoot(props: DragScrollRootProps) {\n\tconst { asChild, children, ...restOfProps } = props;\n\n\tconst { disableInternalStateSubscription, listRef, propGetters, storeApi } = useDragScroll(restOfProps);\n\n\tconst rootContextValue = useMemo<DragScrollRootContextType>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tdisableInternalStateSubscription,\n\t\t\t\tlistRef,\n\t\t\t\tpropGetters,\n\t\t\t}) satisfies DragScrollRootContextType,\n\t\t[listRef, disableInternalStateSubscription, propGetters]\n\t);\n\n\tconst Component = asChild ? Slot.Root : \"div\";\n\n\treturn (\n\t\t<DragScrollStoreContextProvider store={storeApi}>\n\t\t\t<DragScrollRootContextProvider value={rootContextValue}>\n\t\t\t\t<Component {...propGetters.getRootProps(restOfProps)}>{children}</Component>\n\t\t\t</DragScrollRootContextProvider>\n\t\t</DragScrollStoreContextProvider>\n\t);\n}\n\nexport type DragScrollContextProps<TSlice> = {\n\tchildren: React.ReactNode | ((context: TSlice) => React.ReactNode);\n\tselector?: SelectorFn<DragScrollStore, TSlice>;\n};\n\nexport function DragScrollContext<TSlice = DragScrollStore>(props: DragScrollContextProps<TSlice>) {\n\tconst { children, selector } = props;\n\n\tconst dragScrollCtx = useDragScrollStoreContext(useCompareSelector(selector));\n\n\tconst resolvedChildren = isFunction(children) ? children(dragScrollCtx) : children;\n\n\treturn resolvedChildren;\n}\n\nexport type DragScrollListProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"list\"];\n\nexport function DragScrollList<TElement extends React.ElementType = \"ul\">(\n\tprops: PolymorphicPropsStrict<TElement, DragScrollListProps>\n) {\n\tconst { as: Element = \"ul\", asChild, ...restOfProps } = props;\n\n\tconst { propGetters } = useDragScrollRootContext();\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn <Component {...propGetters.getListProps(restOfProps)} />;\n}\n\nexport type DragScrollItemProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"item\"];\n\nexport function DragScrollItem<TElement extends React.ElementType = \"li\">(\n\tprops: PolymorphicPropsStrict<TElement, DragScrollItemProps>\n) {\n\tconst { as: Element = \"li\", asChild, ...restOfProps } = props;\n\n\tconst { propGetters } = useDragScrollRootContext();\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn <Component {...propGetters.getItemProps(restOfProps)} />;\n}\n\nexport type DragScrollPrevProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"prevButton\"];\n\nexport function DragScrollPrev(props: DragScrollPrevProps) {\n\tconst { asChild, ...restOfProps } = props;\n\n\tconst { propGetters } = useDragScrollRootContext();\n\n\tconst Component = asChild ? Slot.Root : \"button\";\n\n\treturn <Component {...propGetters.getPrevButtonProps(restOfProps)} />;\n}\n\nexport type DragScrollNextProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"nextButton\"];\n\nexport function DragScrollNext(props: DragScrollNextProps) {\n\tconst { asChild, ...restOfProps } = props;\n\n\tconst { propGetters } = useDragScrollRootContext();\n\n\tconst Component = asChild ? Slot.Root : \"button\";\n\n\treturn <Component {...propGetters.getNextButtonProps(restOfProps)} />;\n}\n\n/* eslint-enable perfectionist/sort-intersection-types -- I need non-standard props to come first */\n","export {\n\tDragScrollContext as Context,\n\tDragScrollItem as Item,\n\tDragScrollNext as Next,\n\tDragScrollPrev as Prev,\n\tDragScrollRoot as Root,\n\tDragScrollList as List,\n} from \"./drag-scroll\";\n"],"mappings":";;;;;;;;;;;;AAGA,MAAa,gBAA8C,YAAsB;AAChF,SAAQ,MAAM,SAAS;AACvB,SAAQ,MAAM,aAAa;;AAG5B,MAAa,gBACZ,QACA,YACI;AACJ,KAAI,WAAW,UAAU;AACxB,UAAQ,MAAM,iBAAiB;AAC/B;;AAGD,SAAQ,MAAM,iBAAiB;;AAGhC,MAAa,eAA6C,YAAsB;AAC/E,SAAQ,MAAM,SAAS;AACvB,SAAQ,MAAM,aAAa;;AAI5B,MAAa,oBAAoB,kBAA+B;AAG/D,KAAI,CAFa,qBAAqB,CAGrC,cAAa,UAAU,cAAc;KAErC,cAAa,SAAS,cAAc;;;;ACrBtC,MAAa,yBAAyB,oBAAqC;CAC1E,MAAM,EAAE,cAAc,cAAc,eAAe,QAAQ,QAAQ,iBAAiB;CAEpF,MAAM,UAA+C,EACpD,SAAS,MACT;CAED,MAAM,cAAc,EACnB,SAAS;EACR,MAAM;EACN,KAAK;EACL,GAAG;EACH,GAAG;EACH,EACD;CAED,MAAM,qBAAqB,EAC1B,SAAS;EACR,YAAY,IAAI,iBAAiB;EACjC,WAAW,IAAI,iBAAiB;EAChC,SAAS,IAAI,iBAAiB;EAC9B,EACD;CAGD,MAAM,mBAAmB,c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35
  //#endregion
36
- //#region src/components/ui/drop-zone/utils.d.ts
37
- declare class DropZoneError extends Error {
38
- readonly dropZoneErrorSymbol: symbol;
39
- file?: FileValidationErrorContextEach["file"];
40
- name: "DropZoneError";
41
- constructor(ctx: Pick<FileValidationErrorContextEach, "message"> & {
42
- file?: FileValidationErrorContextEach["file"];
43
- }, errorOptions?: ErrorOptions);
44
- static isError(error: unknown): error is DropZoneError;
45
- }
46
- //#endregion
47
36
  //#region src/components/ui/drop-zone/types.d.ts
48
37
  type FileErrorContext = Omit<FileValidationErrorContextEach, "code"> & {
49
38
  code: "upload-error" | FileValidationErrorContextEach["code"];
@@ -89,11 +78,11 @@ type SharedInputProps = {
89
78
  };
90
79
  interface PartProps {
91
80
  container: {
92
- input: PartProps["container"]["output"] & SharedInputProps;
81
+ input: SharedInputProps & PartProps["container"]["output"];
93
82
  output: RecordForDataAttr & InferProps<HTMLElement>;
94
83
  };
95
84
  fileItem: {
96
- input: PartProps["fileItem"]["output"] & SharedInputProps;
85
+ input: SharedInputProps & PartProps["fileItem"]["output"];
97
86
  output: RecordForDataAttr & InferProps<"li">;
98
87
  };
99
88
  fileItemClear: {
@@ -128,6 +117,10 @@ interface PartProps {
128
117
  input: PartProps["input"]["output"];
129
118
  output: RecordForDataAttr & InferProps<"input">;
130
119
  };
120
+ root: {
121
+ input: SharedInputProps & PartProps["root"]["output"];
122
+ output: RecordForDataAttr & InferProps<"div">;
123
+ };
131
124
  trigger: {
132
125
  input: PartProps["trigger"]["output"];
133
126
  output: RecordForDataAttr & InferProps<"button">;
@@ -221,7 +214,7 @@ interface UseDropZoneProps extends FileValidationSettingsAsync, Pick<SharedInput
221
214
  */
222
215
  onUpload?: (context: Pick<DropZoneState, "fileStateArray"> & {
223
216
  onError: (ctx: FileStateOrIDProp & {
224
- error: DropZoneError;
217
+ error: unknown;
225
218
  }) => void;
226
219
  onProgress: (ctx: FileStateOrIDProp & {
227
220
  progress: number;
@@ -300,9 +293,9 @@ type FileItemContextType = {
300
293
  //#endregion
301
294
  //#region src/components/ui/drop-zone/drop-zone.d.ts
302
295
  type DropZoneRootProps = UseDropZoneProps & {
303
- children: React.ReactNode;
304
- };
305
- declare function DropZoneRoot(props: DropZoneRootProps): _$react_jsx_runtime0.JSX.Element;
296
+ asChild?: boolean;
297
+ } & PartInputProps["root"];
298
+ declare function DropZoneRoot<TElement extends React.ElementType = "div">(props: PolymorphicPropsStrict<TElement, DropZoneRootProps>): _$react_jsx_runtime0.JSX.Element;
306
299
  type DropZoneContextProps<TSlice> = {
307
300
  children: React.ReactNode | ((context: TSlice) => React.ReactNode);
308
301
  selector?: SelectorFn<DropZoneStore, TSlice>;
@@ -430,5 +423,16 @@ declare namespace drop_zone_parts_d_exports {
430
423
  //#region src/components/ui/drop-zone/use-drop-zone.d.ts
431
424
  declare const useDropZone: (props?: UseDropZoneProps) => UseDropZoneResult;
432
425
  //#endregion
426
+ //#region src/components/ui/drop-zone/utils.d.ts
427
+ declare class DropZoneError extends Error {
428
+ readonly dropZoneErrorSymbol: symbol;
429
+ file?: FileValidationErrorContextEach["file"];
430
+ name: "DropZoneError";
431
+ constructor(ctx: Pick<FileValidationErrorContextEach, "message"> & {
432
+ file?: FileValidationErrorContextEach["file"];
433
+ }, errorOptions?: ErrorOptions);
434
+ static isError(error: unknown): error is DropZoneError;
435
+ }
436
+ //#endregion
433
437
  export { drop_zone_parts_d_exports as DropZone, type DropZoneActions, DropZoneArea, DropZoneAreaProps, DropZoneContainer, DropZoneContainerProps, DropZoneContext, DropZoneContextProps, DropZoneError, DropZoneFileClear, DropZoneFileClearProps, DropZoneFileItem, DropZoneFileItemDelete, DropZoneFileItemDeleteProps, DropZoneFileItemMetadata, DropZoneFileItemMetadataProps, DropZoneFileItemPreview, DropZoneFileItemPreviewProps, DropZoneFileItemProgress, DropZoneFileItemProgressProps, DropZoneFileItemProps, DropZoneFileList, DropZoneFileListProps, DropZoneInput, DropZoneInputProps, DropZoneRoot, DropZoneRootProps, type DropZoneState, type DropZoneStore, DropZoneTrigger, DropZoneTriggerProps, type FileState, type UseDropZoneProps, type UseDropZoneResult, useDropZone, useDropZoneStoreContext };
434
438
  //# sourceMappingURL=index.d.ts.map
@@ -2,7 +2,7 @@
2
2
  import { t as __exportAll } from "../../chunk-pbuEa-1d.js";
3
3
  import { n as SlotRoot } from "../../slot-DuwoiC2C.js";
4
4
  import { n as For } from "../../for-DGTMIS0w.js";
5
- import { t as Presence } from "../../presence-CHd9s3IS.js";
5
+ import { t as Presence } from "../../presence-DkWhm7xu.js";
6
6
  import { i as SwitchRoot, r as SwitchMatch } from "../../switch-Dwy5Gzsb.js";
7
7
  import { t as cnMerge } from "../../cn-jNZfGhrk.js";
8
8
  import { composeRefs, composeTwoEventHandlers } from "@zayne-labs/toolkit-react/utils";
@@ -10,7 +10,7 @@ import { isBoolean, isFile, isFunction, isNumber, isObject, isString } from "@za
10
10
  import { useCallback, useMemo, useRef } from "react";
11
11
  import { createCustomContext, useCallbackRef, useCompareSelector, useCompareValue, useStore, useUnmountEffect } from "@zayne-labs/toolkit-react";
12
12
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
- import { createFileURL, createStore, dataAttr, formatBytes, generateFileID, handleFileValidationAsync, toArray } from "@zayne-labs/toolkit-core";
13
+ import { createFileURL, createStore, dataAttr, formatBytes, generateFileID, handleFileValidationAsync, omitKeys, toArray } from "@zayne-labs/toolkit-core";
14
14
  import { createReactStoreContext } from "@zayne-labs/toolkit-react/zustand";
15
15
  //#region src/components/ui/drop-zone/drop-zone-context.ts
16
16
  const [DropZoneStoreContextProvider, useDropZoneStoreContext] = createReactStoreContext({
@@ -488,6 +488,13 @@ const useDropZone = (props) => {
488
488
  };
489
489
  const isDraggingOver = useDropZoneStore((state) => !disableInternalStateSubscription ? state.isDraggingOver : null);
490
490
  const isInvalid = useDropZoneStore((state) => !disableInternalStateSubscription ? state.isInvalid : null);
491
+ const getRootProps = useCallback((innerProps) => {
492
+ return {
493
+ ...innerProps,
494
+ ...getDropZoneScopeAttrs("root"),
495
+ "data-disabled": dataAttr(disabled)
496
+ };
497
+ }, [disabled]);
491
498
  const getContainerProps = useCallback((innerProps) => {
492
499
  const { unstyled = globalUnstyled, ...restOfInnerProps } = innerProps;
493
500
  const isDisabled = disabled;
@@ -497,15 +504,15 @@ const useDropZone = (props) => {
497
504
  const onAreaClick = !isDisabled && !disableFilePickerOpenOnAreaClick ? actions.openFilePicker : void 0;
498
505
  const onKeyDown = !isDisabled && !disableFilePickerOpenOnAreaClick ? actions.handleKeyDown : void 0;
499
506
  return {
507
+ ...restOfInnerProps,
500
508
  ...getDropZoneScopeAttrs("container"),
501
- role: "region",
502
509
  ...!disableInternalStateSubscription && {
503
510
  "data-drag-over": dataAttr(isDraggingOver),
504
511
  "data-invalid": dataAttr(isInvalid)
505
512
  },
506
- ...restOfInnerProps,
507
- ...!unstyled && { className: cnMerge(`relative flex flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-6 transition-colors duration-250 ease-out outline-none select-none focus-visible:border-zu-ring/50`, `data-disabled:pointer-events-none data-drag-over:opacity-60 data-invalid:border-zu-destructive data-invalid:ring-zu-destructive/20`, innerProps.className) },
508
513
  "data-disabled": dataAttr(isDisabled),
514
+ role: "region",
515
+ ...!unstyled && { className: cnMerge(`relative flex flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-6 transition-colors duration-250 ease-out outline-none select-none focus-visible:border-zu-ring/50`, `data-disabled:pointer-events-none data-drag-over:opacity-60 data-invalid:border-zu-destructive data-invalid:ring-zu-destructive/20`, innerProps.className) },
509
516
  onClick: composeTwoEventHandlers(onAreaClick, innerProps.onClick),
510
517
  onDragEnter: composeTwoEventHandlers(actions.handleDragEnter, innerProps.onDragEnter),
511
518
  onDragLeave: composeTwoEventHandlers(actions.handleDragLeave, innerProps.onDragLeave),
@@ -538,9 +545,9 @@ const useDropZone = (props) => {
538
545
  const isDisabled = innerProps.disabled ?? disabled;
539
546
  const onFileChange = !isDisabled ? actions.handleChange : void 0;
540
547
  return {
548
+ ...innerProps,
541
549
  ...getDropZoneScopeAttrs("input"),
542
550
  ...!disableInternalStateSubscription && { "data-drag-over": dataAttr(isDraggingOver) },
543
- ...innerProps,
544
551
  accept: allowedFileTypes ? allowedFileTypes.join(", ") : innerProps.accept,
545
552
  className: cnMerge("hidden", innerProps.className),
546
553
  "data-disabled": dataAttr(isDisabled),
@@ -562,37 +569,37 @@ const useDropZone = (props) => {
562
569
  const getTriggerProps = useCallback((innerProps) => {
563
570
  const isDisabled = innerProps.disabled ?? disabled;
564
571
  return {
565
- ...getDropZoneScopeAttrs("trigger"),
566
- type: "button",
567
572
  ...innerProps,
573
+ ...getDropZoneScopeAttrs("trigger"),
568
574
  "data-disabled": dataAttr(isDisabled),
569
575
  disabled: isDisabled,
570
- onClick: composeTwoEventHandlers(actions.openFilePicker, innerProps.onClick)
576
+ onClick: composeTwoEventHandlers(actions.openFilePicker, innerProps.onClick),
577
+ type: "button"
571
578
  };
572
579
  }, [actions.openFilePicker, disabled]);
573
580
  const getFileListProps = useCallback((innerProps) => {
574
581
  const { orientation = "vertical", unstyled = globalUnstyled, ...restOfInnerProps } = innerProps;
575
582
  return {
583
+ ...restOfInnerProps,
576
584
  ...getDropZoneScopeAttrs("file-list"),
577
585
  "data-orientation": orientation,
578
- ...restOfInnerProps,
579
586
  ...!unstyled && { className: cnMerge("flex flex-col gap-2", orientation === "horizontal" && "flex-row overflow-x-auto p-1.5", innerProps.className) }
580
587
  };
581
588
  }, [globalUnstyled]);
582
589
  const getFileItemProps = useCallback((innerProps) => {
583
590
  const { unstyled = globalUnstyled, ...restOfInnerProps } = innerProps;
584
591
  return {
585
- ...getDropZoneScopeAttrs("file-item"),
586
592
  ...restOfInnerProps,
593
+ ...getDropZoneScopeAttrs("file-item"),
587
594
  ...!unstyled && { className: cnMerge("relative flex animate-files-in items-center gap-2.5 rounded-md border p-2", innerProps.className) }
588
595
  };
589
596
  }, [globalUnstyled]);
590
597
  const getFileItemProgressProps = useCallback((innerProps) => {
591
598
  const { unstyled = globalUnstyled, variant = "linear", ...restOfInnerProps } = innerProps;
592
599
  return {
600
+ ...restOfInnerProps,
593
601
  ...getDropZoneScopeAttrs("file-item-progress"),
594
602
  role: "progressbar",
595
- ...restOfInnerProps,
596
603
  ...!unstyled && { className: cnMerge("inline-flex", variant === "circular" && "absolute top-1/2 left-1/2 -translate-1/2", variant === "fill" && `absolute inset-0`, variant === "linear" && "relative h-1.5 w-full overflow-hidden rounded-full bg-zu-primary/20", restOfInnerProps.className) }
597
604
  };
598
605
  }, [globalUnstyled]);
@@ -601,39 +608,39 @@ const useDropZone = (props) => {
601
608
  const isDisabled = innerProps.disabled ?? disabled;
602
609
  const onRemoveFile = () => fileStateOrID && actions.removeFile({ fileStateOrID });
603
610
  return {
604
- ...getDropZoneScopeAttrs("file-item-delete"),
605
- type: "button",
606
611
  ...restOfInnerProps,
612
+ ...getDropZoneScopeAttrs("file-item-delete"),
607
613
  "data-disabled": dataAttr(isDisabled),
608
614
  disabled: isDisabled,
609
- onClick: composeTwoEventHandlers(onRemoveFile, restOfInnerProps.onClick)
615
+ onClick: composeTwoEventHandlers(onRemoveFile, restOfInnerProps.onClick),
616
+ type: "button"
610
617
  };
611
618
  }, [actions, disabled]);
612
619
  const getFileItemPreviewProps = useCallback((innerProps) => {
613
620
  const { unstyled = globalUnstyled, ...restOfInnerProps } = innerProps;
614
621
  return {
615
- ...getDropZoneScopeAttrs("file-item-preview"),
616
622
  ...restOfInnerProps,
623
+ ...getDropZoneScopeAttrs("file-item-preview"),
617
624
  ...!unstyled && { className: cnMerge(`relative flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-md bg-zu-accent/50 [&>svg]:size-10`, innerProps.className) }
618
625
  };
619
626
  }, [globalUnstyled]);
620
627
  const getFileItemMetadataProps = useCallback((innerProps) => {
621
628
  const { unstyled = globalUnstyled, ...restOfInnerProps } = innerProps;
622
629
  return {
623
- ...getDropZoneScopeAttrs("file-item-metadata"),
624
630
  ...restOfInnerProps,
631
+ ...getDropZoneScopeAttrs("file-item-metadata"),
625
632
  ...!unstyled && { className: cnMerge("flex min-w-0 grow flex-col", innerProps.className) }
626
633
  };
627
634
  }, [globalUnstyled]);
628
635
  const getFileItemClearProps = useCallback((innerProps) => {
629
636
  const isDisabled = innerProps.disabled ?? disabled;
630
637
  return {
631
- ...getDropZoneScopeAttrs("file-item-clear"),
632
- type: "button",
633
638
  ...innerProps,
639
+ ...getDropZoneScopeAttrs("file-item-clear"),
634
640
  "data-disabled": dataAttr(isDisabled),
635
641
  disabled: isDisabled,
636
- onClick: composeTwoEventHandlers(actions.clearFiles, innerProps.onClick)
642
+ onClick: composeTwoEventHandlers(actions.clearFiles, innerProps.onClick),
643
+ type: "button"
637
644
  };
638
645
  }, [actions.clearFiles, disabled]);
639
646
  const propGetters = useMemo(() => ({
@@ -646,17 +653,19 @@ const useDropZone = (props) => {
646
653
  getFileItemProps,
647
654
  getFileListProps,
648
655
  getInputProps,
656
+ getRootProps,
649
657
  getTriggerProps
650
658
  }), [
651
659
  getContainerProps,
652
- getFileListProps,
653
660
  getFileItemClearProps,
654
661
  getFileItemDeleteProps,
655
662
  getFileItemMetadataProps,
656
663
  getFileItemPreviewProps,
657
664
  getFileItemProgressProps,
658
665
  getFileItemProps,
666
+ getFileListProps,
659
667
  getInputProps,
668
+ getRootProps,
660
669
  getTriggerProps
661
670
  ]);
662
671
  const stableUseDropZoneStore = useCallbackRef(useDropZoneStore);
@@ -677,8 +686,27 @@ const useDropZone = (props) => {
677
686
  };
678
687
  //#endregion
679
688
  //#region src/components/ui/drop-zone/drop-zone.tsx
689
+ const dropzonePropKeys = [
690
+ "allowedFileTypes",
691
+ "disableFilePickerOpenOnAreaClick",
692
+ "disableInternalStateSubscription",
693
+ "disablePreviewGenForNonImageFiles",
694
+ "disabled",
695
+ "initialFiles",
696
+ "maxFileCount",
697
+ "maxFileSize",
698
+ "multiple",
699
+ "onFilesChange",
700
+ "onUpload",
701
+ "onValidationError",
702
+ "onValidationSuccess",
703
+ "rejectDuplicateFiles",
704
+ "unstyled",
705
+ "validator"
706
+ ];
680
707
  function DropZoneRoot(props) {
681
- const { children, ...restOfProps } = props;
708
+ const { as: Element = "div", asChild, children, ...restOfProps } = props;
709
+ const rootProps = useMemo(() => omitKeys(restOfProps, dropzonePropKeys), [restOfProps]);
682
710
  const { disabled, disableInternalStateSubscription, inputRef, propGetters, storeApi } = useDropZone(restOfProps);
683
711
  return /* @__PURE__ */ jsx(DropZoneStoreContextProvider, {
684
712
  store: storeApi,
@@ -694,7 +722,10 @@ function DropZoneRoot(props) {
694
722
  inputRef,
695
723
  propGetters
696
724
  ]),
697
- children
725
+ children: /* @__PURE__ */ jsx(asChild ? SlotRoot : Element, {
726
+ ...propGetters.getRootProps(rootProps),
727
+ children
728
+ })
698
729
  })
699
730
  });
700
731
  }