@zayne-labs/ui-react 0.9.18 → 0.9.19

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 (54) hide show
  1. package/dist/esm/{carousel-Dznupnx8.js → carousel-Dvp-qURP.js} +2 -2
  2. package/dist/esm/{carousel-Dznupnx8.js.map → carousel-Dvp-qURP.js.map} +1 -1
  3. package/dist/esm/components/common/await/index.d.ts +5 -5
  4. package/dist/esm/components/common/await/index.js +1 -1
  5. package/dist/esm/components/common/error-boundary/index.d.ts +1 -1
  6. package/dist/esm/components/common/for/index.d.ts +1 -1
  7. package/dist/esm/components/common/index.d.ts +10 -10
  8. package/dist/esm/components/common/index.js +3 -3
  9. package/dist/esm/components/common/show/index.d.ts +1 -1
  10. package/dist/esm/components/common/show/index.js +2 -2
  11. package/dist/esm/components/common/slot/index.d.ts +1 -1
  12. package/dist/esm/components/common/suspense-with-boundary/index.d.ts +2 -2
  13. package/dist/esm/components/common/switch/index.d.ts +1 -1
  14. package/dist/esm/components/common/switch/index.js +2 -2
  15. package/dist/esm/components/common/teleport/index.d.ts +1 -1
  16. package/dist/esm/components/ui/card/index.d.ts +1 -1
  17. package/dist/esm/components/ui/carousel/index.d.ts +1 -1
  18. package/dist/esm/components/ui/carousel/index.js +4 -4
  19. package/dist/esm/components/ui/drag-scroll/index.d.ts +1 -1
  20. package/dist/esm/components/ui/drop-zone/index.d.ts +2 -2
  21. package/dist/esm/components/ui/drop-zone/index.js +4 -4
  22. package/dist/esm/components/ui/form/index.d.ts +1 -1
  23. package/dist/esm/components/ui/form/index.js +2 -2
  24. package/dist/esm/components/ui/index.d.ts +6 -6
  25. package/dist/esm/components/ui/index.js +6 -6
  26. package/dist/esm/{drop-zone-_YK9C3Xj.js → drop-zone-Beip1k4x.js} +2 -2
  27. package/dist/esm/{drop-zone-_YK9C3Xj.js.map → drop-zone-Beip1k4x.js.map} +1 -1
  28. package/dist/esm/{form-DytCfL6R.js → form-CUlTG3KI.js} +2 -2
  29. package/dist/esm/{form-DytCfL6R.js.map → form-CUlTG3KI.js.map} +1 -1
  30. package/dist/esm/{getSlot-BIcGgBwN.js → getSlot-D1_uG-Ym.js} +2 -2
  31. package/dist/esm/{getSlot-BIcGgBwN.js.map → getSlot-D1_uG-Ym.js.map} +1 -1
  32. package/dist/esm/{getSlotMap-DA_uhXqU.d.ts → getSlotMap-DZlQN8--.d.ts} +2 -3
  33. package/dist/esm/{index-DnaUCh8d.d.ts → index-B3N6YbN8.d.ts} +2 -3
  34. package/dist/esm/{index-BuSQsDCX.d.ts → index-BMcv7ELE.d.ts} +2 -5
  35. package/dist/esm/{index-ASoFjmZ6.d.ts → index-BilTdK_M.d.ts} +7 -10
  36. package/dist/esm/{index-BSJ30pGj.d.ts → index-BsjcsNQh.d.ts} +4 -5
  37. package/dist/esm/{index-1UCPJf7B.d.ts → index-BwnMUHzm.d.ts} +2 -5
  38. package/dist/esm/{index-CqlM1M0j.d.ts → index-CFNg1R-m.d.ts} +5 -6
  39. package/dist/esm/{index-C0XZoIZD.d.ts → index-CGI7EVlK.d.ts} +2 -5
  40. package/dist/esm/{index-DQ1yFGd2.d.ts → index-CIM4YPg5.d.ts} +4 -6
  41. package/dist/esm/{index-BhpBx8dH.d.ts → index-CNE9Cime.d.ts} +2 -4
  42. package/dist/esm/{index-BC0r1cBF.d.ts → index-DT8F8QKc.d.ts} +4 -7
  43. package/dist/esm/{index-D-j2Cn1J.d.ts → index-DeBZiR6B.d.ts} +1 -2
  44. package/dist/esm/{index--1COprHP.d.ts → index-UX3DaMVe.d.ts} +2 -5
  45. package/dist/esm/{index-TBkPiipk.d.ts → index-YFi-sIuR.d.ts} +5 -9
  46. package/dist/esm/{index-CTZr4PTO.d.ts → index-gT9tVHv1.d.ts} +2 -3
  47. package/dist/esm/lib/utils/index.d.ts +2 -2
  48. package/dist/esm/lib/utils/index.js +1 -1
  49. package/dist/esm/{show-BgYrfIxJ.js → show-DNPzdLi-.js} +2 -2
  50. package/dist/esm/{show-BgYrfIxJ.js.map → show-DNPzdLi-.js.map} +1 -1
  51. package/dist/esm/{switch-PF5xTJfr.js → switch-B2gKl94R.js} +2 -2
  52. package/dist/esm/{switch-PF5xTJfr.js.map → switch-B2gKl94R.js.map} +1 -1
  53. package/dist/style.css +1 -1
  54. package/package.json +10 -10
@@ -1,6 +1,6 @@
1
1
  import { __export } from "./chunk-Cl8Af3a2.js";
2
2
  import { getElementList } from "./for-aTw1TgJo.js";
3
- import { ShowFallback, ShowRoot } from "./show-BgYrfIxJ.js";
3
+ import { ShowFallback, ShowRoot } from "./show-DNPzdLi-.js";
4
4
  import { cnMerge } from "./cn-_FbtIrlZ.js";
5
5
  import { useEffect, useState } from "react";
6
6
  import { useAnimationInterval, useCallbackRef, useConstant } from "@zayne-labs/toolkit-react";
@@ -267,4 +267,4 @@ __export(carousel_parts_exports, {
267
267
 
268
268
  //#endregion
269
269
  export { CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup, carousel_parts_exports };
270
- //# sourceMappingURL=carousel-Dznupnx8.js.map
270
+ //# sourceMappingURL=carousel-Dvp-qURP.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel-Dznupnx8.js","names":["storeValues: PrettyOmit<CarouselProviderProps<TImages>, \"children\">","props: Omit<CarouselProviderProps<TImages>, \"children\">","props: CarouselProviderProps<TImages>","props: React.SVGProps<SVGSVGElement>","options: CarouselOptions","props: PolymorphicProps<TElement, CarouselContentProps>","props: CarouselButtonsProps","props: CarouselControlProps","props: CarouselWrapperProps<TArrayItem>","props: PolymorphicProps<TElement, OtherCarouselProps>","props: CarouselIndicatorProps"],"sources":["../../src/components/ui/carousel/carousel-store-context.tsx","../../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 * as React from \"react\";\n\nimport { useConstant } from \"@zayne-labs/toolkit-react\";\nimport { createZustandContext } from \"@zayne-labs/toolkit-react/zustand\";\nimport type { PrettyOmit } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useEffect } from \"react\";\nimport { create } from \"zustand\";\nimport type { CarouselProviderProps, CarouselStore, ImagesType } from \"./types\";\n\nconst [Provider, useCarouselStoreContext] = createZustandContext<CarouselStore>({\n\thookName: \"useCarouselStore\",\n\tname: \"CarouselStoreContext\",\n\tproviderName: \"CarouselContextProvider\",\n});\n\n// CarouselStore Creation\nconst createCarouselStore = <TImages extends ImagesType>(\n\tstoreValues: PrettyOmit<CarouselProviderProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = storeValues;\n\n\tconst useInitCarouselStore = create<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 useInitCarouselStore;\n};\n\nconst useCarousel = <TImages extends ImagesType>(\n\tprops: Omit<CarouselProviderProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = props;\n\n\tconst useInitCarouselStore = useConstant(() => createCarouselStore({ images, onSlideBtnClick }));\n\n\t// == To set images again when a page is mounted, preventing stale images from previous page\n\tuseEffect(() => {\n\t\tuseInitCarouselStore.setState({ images });\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- useInitCarouselStore is stable\n\t}, [images]);\n\n\treturn useInitCarouselStore;\n};\n\n// == Provider Component\nfunction CarouselContextProvider<TImages extends ImagesType>(props: CarouselProviderProps<TImages>) {\n\tconst { children, images, onSlideBtnClick } = props;\n\n\tconst useInitCarouselStore = useCarousel({ images, onSlideBtnClick });\n\n\treturn <Provider value={useInitCarouselStore}>{children}</Provider>;\n}\n\n// eslint-disable-next-line react-refresh/only-export-components -- It's fine\nexport { useCarouselStoreContext, CarouselContextProvider };\n","import * as React from \"react\";\n\nexport const ChevronLeftIcon = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" />\n\t\t\t<path d=\"m14 16l-4-4l4-4\" />\n\t\t</g>\n\t</svg>\n);\n","import { useAnimationInterval, useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useState } from \"react\";\nimport { useCarouselStoreContext } from \"./carousel-store-context\";\n\ntype CarouselOptions = {\n\tautoSlideInterval?: number;\n\thasAutoSlide?: boolean;\n\tshouldPauseOnHover?: boolean;\n};\n\nconst useCarouselOptions = (options: CarouselOptions = {}) => {\n\tconst { autoSlideInterval = 5000, hasAutoSlide = false, shouldPauseOnHover = false } = options;\n\n\tconst { goToNextSlide } = useCarouselStoreContext((state) => state.actions);\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: 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 * as React from \"react\";\n\nimport { Show } from \"@/components/common\";\nimport { getElementList } from \"@/components/common/for\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { CssWithCustomProperties, PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCarouselStoreContext } from \"./carousel-store-context\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport type {\n\tCarouselButtonsProps,\n\tCarouselContentProps,\n\tCarouselControlProps,\n\tCarouselIndicatorProps,\n\tCarouselWrapperProps,\n\tOtherCarouselProps,\n} from \"./types\";\nimport { useCarouselOptions } from \"./useCarouselOptions\";\n\n// TODO - Add dragging and swiping support\nexport function CarouselContent<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement, CarouselContentProps>\n) {\n\tconst {\n\t\tas: HtmlElement = \"article\",\n\t\tautoSlideInterval,\n\t\tchildren,\n\t\tclassNames,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t} = props;\n\n\tconst { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({\n\t\tautoSlideInterval,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t});\n\n\t// FIXME - Prevent touch swipe on mobile using a cover element or allow swipe but it must update the state appropriately\n\treturn (\n\t\t<HtmlElement\n\t\t\tdata-id=\"Carousel\"\n\t\t\tclassName={cnMerge(\"relative select-none\", classNames?.base)}\n\t\t\tonMouseEnter={pauseAutoSlide}\n\t\t\tonMouseLeave={resumeAutoSlide}\n\t\t>\n\t\t\t<div\n\t\t\t\tdata-id=\"Scroll Container\"\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\"flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n\t\t\t\t\tclassNames?.scrollContainer\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</HtmlElement>\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\ttype=\"button\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"z-30 flex h-full w-fit items-center\",\n\t\t\t\tvariant === \"prev\" ? \"justify-start\" : \"justify-end\",\n\t\t\t\tclassNames?.base\n\t\t\t)}\n\t\t\tonClick={variant === \"prev\" ? goToPreviousSlide : goToNextSlide}\n\t\t>\n\t\t\t<span className={cnMerge(\"transition-transform active:scale-[1.06]\", classNames?.iconContainer)}>\n\t\t\t\t{icon ?? (\n\t\t\t\t\t<ChevronLeftIcon\n\t\t\t\t\t\tclassName={cnMerge(variant === \"next\" && \"rotate-180\", classNames?.defaultIcon)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n\nexport function CarouselControls(props: CarouselControlProps) {\n\tconst { classNames, icon } = props;\n\n\treturn (\n\t\t<div className={cnMerge(\"absolute inset-0 flex justify-between\", classNames?.base)}>\n\t\t\t<Show.Root when={icon?.iconType}>\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\tdefaultIcon: classNames?.defaultIcon,\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\tdefaultIcon: classNames?.defaultIcon,\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\n\t\t\t\t<Show.Otherwise>\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.prev}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.next}\n\t\t\t\t\t/>\n\t\t\t\t</Show.Otherwise>\n\t\t\t</Show.Root>\n\t\t</div>\n\t);\n}\n\nexport function CarouselItemGroup<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each, render } = props;\n\n\tconst [ItemList] = getElementList(\"base\");\n\tconst currentSlide = useCarouselStoreContext((state) => state.currentSlide);\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\n\n\treturn (\n\t\t<ul\n\t\t\tdata-id=\"Carousel Image Wrapper\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t`flex w-full shrink-0 snap-center [transform:translate3d(var(--translate-distance),0,0)]\n\t\t\t\t[transition:transform_800ms_ease]`,\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{typeof render === \"function\" ? (\n\t\t\t\t<ItemList each={images} render={render} />\n\t\t\t) : (\n\t\t\t\t<ItemList each={images}>{children}</ItemList>\n\t\t\t)}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselItem({ children, className, ...restOfProps }: OtherCarouselProps) {\n\treturn (\n\t\t<li\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: PolymorphicProps<TElement, OtherCarouselProps>\n) {\n\tconst { as: HtmlElement = \"div\", children, className } = props;\n\n\treturn (\n\t\t<HtmlElement data-id=\"Carousel Caption\" className={cnMerge(\"absolute z-10\", className)}>\n\t\t\t{children}\n\t\t</HtmlElement>\n\t);\n}\n\nexport function CarouselIndicatorGroup<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each, render } = props;\n\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\n\tconst [IndicatorList] = getElementList(\"base\");\n\n\treturn (\n\t\t<ul\n\t\t\tdata-id=\"Carousel Indicators\"\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{typeof render === \"function\" ? (\n\t\t\t\t<IndicatorList each={images} render={render} />\n\t\t\t) : (\n\t\t\t\t<IndicatorList each={images}>{children}</IndicatorList>\n\t\t\t)}\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 className={cnMerge(\"inline-flex\", classNames?.base)}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={() => goToSlide(currentIndex)}\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\"size-[6px] rounded-[50%]\",\n\t\t\t\t\tclassNames?.base,\n\t\t\t\t\tcurrentIndex === currentSlide && [\"w-[35px] rounded-[5px]\", classNames?.isActive]\n\t\t\t\t)}\n\t\t\t/>\n\t\t</li>\n\t);\n}\n","export { CarouselContextProvider as Root } from \"./carousel-store-context\";\nexport {\n\tCarouselContent as Content,\n\tCarouselControls as Controls,\n\tCarouselButton as Button,\n\tCarouselItem as Item,\n\tCarouselItemGroup as ItemGroup,\n\tCarouselCaption as Caption,\n\tCarouselIndicator as Indicator,\n\tCarouselIndicatorGroup as IndicatorGroup,\n} from \"./carousel\";\n"],"mappings":";;;;;;;;;;;AASA,MAAM,CAAC,UAAU,wBAAwB,GAAG,qBAAoC;CAC/E,UAAU;CACV,MAAM;CACN,cAAc;AACd,EAAC;AAGF,MAAM,sBAAsB,CAC3BA,gBACI;CACJ,MAAM,EAAE,QAAQ,iBAAiB,GAAG;CAEpC,MAAM,uBAAuB,QAAgC,CAAC,CAAC,KAAK,SAAS;EAC5E,cAAc;EACd;EACA,UAAU,OAAO,SAAS;EAG1B,SAAS;GAGR,eAAe,MAAM;IACpB,MAAM,EAAE,cAAc,UAAU,GAAG,KAAK;IACxC,MAAM,EAAE,WAAW,GAAG,KAAK,CAAC;AAE5B,QAAI,iBAAiB,UAAU;AAC9B,eAAU,EAAE;AACZ;IACA;AAED,cAAU,eAAe,EAAE;GAC3B;GAED,mBAAmB,MAAM;IACxB,MAAM,EAAE,cAAc,UAAU,GAAG,KAAK;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CAAC,UAAU,QAAS,MAAM,OAAwB;CACzF,MAAM,CAAC,cAAc,GAAG,eAAe,OAAO;AAE9C,wBACC,IAAC;EACA,WAAQ;EACR,WAAW,QACV,mFACA,UACA;mBAEO,WAAW,6BAClB,IAAC;GAAc,MAAM;GAAgB;IAAU,mBAE/C,IAAC;GAAc,MAAM;GAAS;IAAyB;GAEpD;AAEN;AAED,SAAgB,kBAAkBE,OAA+B;CAChE,MAAM,EAAE,YAAY,cAAc,GAAG;CAErC,MAAM,EACL,SAAS,EAAE,WAAW,EACtB,cACA,GAAG,wBAAwB,CAAC,UAAU,MAAM;AAE7C,wBACC,IAAC;EAAG,WAAW,QAAQ,eAAe,YAAY,KAAK;4BACtD,IAAC;GACA,MAAK;GACL,SAAS,MAAM,UAAU,aAAa;GACtC,WAAW,QACV,4BACA,YAAY,MACZ,iBAAiB,gBAAgB,CAAC,0BAA0B,YAAY,QAAS,EACjF;IACA;GACE;AAEN"}
1
+ {"version":3,"file":"carousel-Dvp-qURP.js","names":["storeValues: PrettyOmit<CarouselProviderProps<TImages>, \"children\">","props: Omit<CarouselProviderProps<TImages>, \"children\">","props: CarouselProviderProps<TImages>","props: React.SVGProps<SVGSVGElement>","options: CarouselOptions","props: PolymorphicProps<TElement, CarouselContentProps>","props: CarouselButtonsProps","props: CarouselControlProps","props: CarouselWrapperProps<TArrayItem>","props: PolymorphicProps<TElement, OtherCarouselProps>","props: CarouselIndicatorProps"],"sources":["../../src/components/ui/carousel/carousel-store-context.tsx","../../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 * as React from \"react\";\n\nimport { useConstant } from \"@zayne-labs/toolkit-react\";\nimport { createZustandContext } from \"@zayne-labs/toolkit-react/zustand\";\nimport type { PrettyOmit } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useEffect } from \"react\";\nimport { create } from \"zustand\";\nimport type { CarouselProviderProps, CarouselStore, ImagesType } from \"./types\";\n\nconst [Provider, useCarouselStoreContext] = createZustandContext<CarouselStore>({\n\thookName: \"useCarouselStore\",\n\tname: \"CarouselStoreContext\",\n\tproviderName: \"CarouselContextProvider\",\n});\n\n// CarouselStore Creation\nconst createCarouselStore = <TImages extends ImagesType>(\n\tstoreValues: PrettyOmit<CarouselProviderProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = storeValues;\n\n\tconst useInitCarouselStore = create<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 useInitCarouselStore;\n};\n\nconst useCarousel = <TImages extends ImagesType>(\n\tprops: Omit<CarouselProviderProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = props;\n\n\tconst useInitCarouselStore = useConstant(() => createCarouselStore({ images, onSlideBtnClick }));\n\n\t// == To set images again when a page is mounted, preventing stale images from previous page\n\tuseEffect(() => {\n\t\tuseInitCarouselStore.setState({ images });\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- useInitCarouselStore is stable\n\t}, [images]);\n\n\treturn useInitCarouselStore;\n};\n\n// == Provider Component\nfunction CarouselContextProvider<TImages extends ImagesType>(props: CarouselProviderProps<TImages>) {\n\tconst { children, images, onSlideBtnClick } = props;\n\n\tconst useInitCarouselStore = useCarousel({ images, onSlideBtnClick });\n\n\treturn <Provider value={useInitCarouselStore}>{children}</Provider>;\n}\n\n// eslint-disable-next-line react-refresh/only-export-components -- It's fine\nexport { useCarouselStoreContext, CarouselContextProvider };\n","import * as React from \"react\";\n\nexport const ChevronLeftIcon = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" />\n\t\t\t<path d=\"m14 16l-4-4l4-4\" />\n\t\t</g>\n\t</svg>\n);\n","import { useAnimationInterval, useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useState } from \"react\";\nimport { useCarouselStoreContext } from \"./carousel-store-context\";\n\ntype CarouselOptions = {\n\tautoSlideInterval?: number;\n\thasAutoSlide?: boolean;\n\tshouldPauseOnHover?: boolean;\n};\n\nconst useCarouselOptions = (options: CarouselOptions = {}) => {\n\tconst { autoSlideInterval = 5000, hasAutoSlide = false, shouldPauseOnHover = false } = options;\n\n\tconst { goToNextSlide } = useCarouselStoreContext((state) => state.actions);\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: 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 * as React from \"react\";\n\nimport { Show } from \"@/components/common\";\nimport { getElementList } from \"@/components/common/for\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { CssWithCustomProperties, PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCarouselStoreContext } from \"./carousel-store-context\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport type {\n\tCarouselButtonsProps,\n\tCarouselContentProps,\n\tCarouselControlProps,\n\tCarouselIndicatorProps,\n\tCarouselWrapperProps,\n\tOtherCarouselProps,\n} from \"./types\";\nimport { useCarouselOptions } from \"./useCarouselOptions\";\n\n// TODO - Add dragging and swiping support\nexport function CarouselContent<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement, CarouselContentProps>\n) {\n\tconst {\n\t\tas: HtmlElement = \"article\",\n\t\tautoSlideInterval,\n\t\tchildren,\n\t\tclassNames,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t} = props;\n\n\tconst { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({\n\t\tautoSlideInterval,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t});\n\n\t// FIXME - Prevent touch swipe on mobile using a cover element or allow swipe but it must update the state appropriately\n\treturn (\n\t\t<HtmlElement\n\t\t\tdata-id=\"Carousel\"\n\t\t\tclassName={cnMerge(\"relative select-none\", classNames?.base)}\n\t\t\tonMouseEnter={pauseAutoSlide}\n\t\t\tonMouseLeave={resumeAutoSlide}\n\t\t>\n\t\t\t<div\n\t\t\t\tdata-id=\"Scroll Container\"\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\"flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n\t\t\t\t\tclassNames?.scrollContainer\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</HtmlElement>\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\ttype=\"button\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"z-30 flex h-full w-fit items-center\",\n\t\t\t\tvariant === \"prev\" ? \"justify-start\" : \"justify-end\",\n\t\t\t\tclassNames?.base\n\t\t\t)}\n\t\t\tonClick={variant === \"prev\" ? goToPreviousSlide : goToNextSlide}\n\t\t>\n\t\t\t<span className={cnMerge(\"transition-transform active:scale-[1.06]\", classNames?.iconContainer)}>\n\t\t\t\t{icon ?? (\n\t\t\t\t\t<ChevronLeftIcon\n\t\t\t\t\t\tclassName={cnMerge(variant === \"next\" && \"rotate-180\", classNames?.defaultIcon)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n\nexport function CarouselControls(props: CarouselControlProps) {\n\tconst { classNames, icon } = props;\n\n\treturn (\n\t\t<div className={cnMerge(\"absolute inset-0 flex justify-between\", classNames?.base)}>\n\t\t\t<Show.Root when={icon?.iconType}>\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\tdefaultIcon: classNames?.defaultIcon,\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\tdefaultIcon: classNames?.defaultIcon,\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\n\t\t\t\t<Show.Otherwise>\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.prev}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.next}\n\t\t\t\t\t/>\n\t\t\t\t</Show.Otherwise>\n\t\t\t</Show.Root>\n\t\t</div>\n\t);\n}\n\nexport function CarouselItemGroup<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each, render } = props;\n\n\tconst [ItemList] = getElementList(\"base\");\n\tconst currentSlide = useCarouselStoreContext((state) => state.currentSlide);\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\n\n\treturn (\n\t\t<ul\n\t\t\tdata-id=\"Carousel Image Wrapper\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t`flex w-full shrink-0 snap-center [transform:translate3d(var(--translate-distance),0,0)]\n\t\t\t\t[transition:transform_800ms_ease]`,\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{typeof render === \"function\" ? (\n\t\t\t\t<ItemList each={images} render={render} />\n\t\t\t) : (\n\t\t\t\t<ItemList each={images}>{children}</ItemList>\n\t\t\t)}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselItem({ children, className, ...restOfProps }: OtherCarouselProps) {\n\treturn (\n\t\t<li\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: PolymorphicProps<TElement, OtherCarouselProps>\n) {\n\tconst { as: HtmlElement = \"div\", children, className } = props;\n\n\treturn (\n\t\t<HtmlElement data-id=\"Carousel Caption\" className={cnMerge(\"absolute z-10\", className)}>\n\t\t\t{children}\n\t\t</HtmlElement>\n\t);\n}\n\nexport function CarouselIndicatorGroup<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each, render } = props;\n\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\n\tconst [IndicatorList] = getElementList(\"base\");\n\n\treturn (\n\t\t<ul\n\t\t\tdata-id=\"Carousel Indicators\"\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{typeof render === \"function\" ? (\n\t\t\t\t<IndicatorList each={images} render={render} />\n\t\t\t) : (\n\t\t\t\t<IndicatorList each={images}>{children}</IndicatorList>\n\t\t\t)}\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 className={cnMerge(\"inline-flex\", classNames?.base)}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={() => goToSlide(currentIndex)}\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\"size-[6px] rounded-[50%]\",\n\t\t\t\t\tclassNames?.base,\n\t\t\t\t\tcurrentIndex === currentSlide && [\"w-[35px] rounded-[5px]\", classNames?.isActive]\n\t\t\t\t)}\n\t\t\t/>\n\t\t</li>\n\t);\n}\n","export { CarouselContextProvider as Root } from \"./carousel-store-context\";\nexport {\n\tCarouselContent as Content,\n\tCarouselControls as Controls,\n\tCarouselButton as Button,\n\tCarouselItem as Item,\n\tCarouselItemGroup as ItemGroup,\n\tCarouselCaption as Caption,\n\tCarouselIndicator as Indicator,\n\tCarouselIndicatorGroup as IndicatorGroup,\n} from \"./carousel\";\n"],"mappings":";;;;;;;;;;;AASA,MAAM,CAAC,UAAU,wBAAwB,GAAG,qBAAoC;CAC/E,UAAU;CACV,MAAM;CACN,cAAc;AACd,EAAC;AAGF,MAAM,sBAAsB,CAC3BA,gBACI;CACJ,MAAM,EAAE,QAAQ,iBAAiB,GAAG;CAEpC,MAAM,uBAAuB,QAAgC,CAAC,CAAC,KAAK,SAAS;EAC5E,cAAc;EACd;EACA,UAAU,OAAO,SAAS;EAG1B,SAAS;GAGR,eAAe,MAAM;IACpB,MAAM,EAAE,cAAc,UAAU,GAAG,KAAK;IACxC,MAAM,EAAE,WAAW,GAAG,KAAK,CAAC;AAE5B,QAAI,iBAAiB,UAAU;AAC9B,eAAU,EAAE;AACZ;IACA;AAED,cAAU,eAAe,EAAE;GAC3B;GAED,mBAAmB,MAAM;IACxB,MAAM,EAAE,cAAc,UAAU,GAAG,KAAK;IACxC,MAAM,EAAE,WAAW,GAAG,KAAK,CAAC;AAE5B,QAAI,iBAAiB,GAAG;AACvB,eAAU,SAAS;AACnB;IACA;AAED,cAAU,eAAe,EAAE;GAC3B;GAED,WAAW,CAAC,aAAa;AACxB,uB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Ac,MAAM;GAAgB;IAAU,mBAE/C,IAAC;GAAc,MAAM;GAAS;IAAyB;GAEpD;AAEN;AAED,SAAgB,kBAAkBE,OAA+B;CAChE,MAAM,EAAE,YAAY,cAAc,GAAG;CAErC,MAAM,EACL,SAAS,EAAE,WAAW,EACtB,cACA,GAAG,wBAAwB,CAAC,UAAU,MAAM;AAE7C,wBACC,IAAC;EAAG,WAAW,QAAQ,eAAe,YAAY,KAAK;4BACtD,IAAC;GACA,MAAK;GACL,SAAS,MAAM,UAAU,aAAa;GACtC,WAAW,QACV,4BACA,YAAY,MACZ,iBAAiB,gBAAgB,CAAC,0BAA0B,YAAY,QAAS,EACjF;IACA;GACE;AAEN"}
@@ -1,6 +1,6 @@
1
- import "../../../getSlotMap-DA_uhXqU.js";
2
- import "../../../index-D-j2Cn1J.js";
3
- import "../../../index-BSJ30pGj.js";
4
- import "../../../index-CqlM1M0j.js";
5
- import { AwaitError$1 as AwaitError, AwaitPending$1 as AwaitPending, AwaitRoot$1 as AwaitRoot, AwaitSuccess$1 as AwaitSuccess, await_parts_d_exports, useAwaitContext$1 as useAwaitContext } from "../../../index-TBkPiipk.js";
1
+ import "../../../getSlotMap-DZlQN8--.js";
2
+ import "../../../index-DeBZiR6B.js";
3
+ import "../../../index-BsjcsNQh.js";
4
+ import "../../../index-CFNg1R-m.js";
5
+ import { AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, await_parts_d_exports, useAwaitContext } from "../../../index-YFi-sIuR.js";
6
6
  export { await_parts_d_exports as Await, AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, useAwaitContext };
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
  import "../../../utils-D4YNWj2X.js";
5
- import "../../../getSlot-BIcGgBwN.js";
5
+ import "../../../getSlot-D1_uG-Ym.js";
6
6
  import "../../../error-boundary-B3ycUZ1t.js";
7
7
  import "../../../slot-RXTKo4L7.js";
8
8
  import { AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, await_parts_exports, useAwaitContext } from "../../../await-Fe4LFRKd.js";
@@ -1,2 +1,2 @@
1
- import { ErrorBoundary$1 as ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary$1 as useErrorBoundary, useErrorBoundaryContext$1 as useErrorBoundaryContext } from "../../../index-BSJ30pGj.js";
1
+ import { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext } from "../../../index-BsjcsNQh.js";
2
2
  export { ErrorBoundary, ErrorBoundaryContextType, ErrorBoundaryProps, FallbackProps, useErrorBoundary, useErrorBoundaryContext };
@@ -1,2 +1,2 @@
1
- import { For$1 as For, ForRenderProps, ForWithWrapper$1 as ForWithWrapper, getElementList$1 as getElementList } from "../../../index-BhpBx8dH.js";
1
+ import { For, ForRenderProps, ForWithWrapper, getElementList } from "../../../index-CNE9Cime.js";
2
2
  export { For, ForRenderProps, ForWithWrapper, getElementList };
@@ -1,11 +1,11 @@
1
- import "../../getSlotMap-DA_uhXqU.js";
2
- import "../../index-D-j2Cn1J.js";
3
- import { ErrorBoundary$1 as ErrorBoundary } from "../../index-BSJ30pGj.js";
4
- import { SuspenseWithBoundary$1 as SuspenseWithBoundary } from "../../index-CqlM1M0j.js";
5
- import { await_parts_d_exports } from "../../index-TBkPiipk.js";
6
- import { For$1 as For, ForWithWrapper$1 as ForWithWrapper } from "../../index-BhpBx8dH.js";
7
- import { show_parts_d_exports } from "../../index-C0XZoIZD.js";
8
- import { slot_parts_d_exports } from "../../index-1UCPJf7B.js";
9
- import { switch_parts_d_exports } from "../../index--1COprHP.js";
10
- import { Teleport$1 as Teleport } from "../../index-DnaUCh8d.js";
1
+ import "../../getSlotMap-DZlQN8--.js";
2
+ import "../../index-DeBZiR6B.js";
3
+ import { ErrorBoundary } from "../../index-BsjcsNQh.js";
4
+ import { SuspenseWithBoundary } from "../../index-CFNg1R-m.js";
5
+ import { await_parts_d_exports } from "../../index-YFi-sIuR.js";
6
+ import { For, ForWithWrapper } from "../../index-CNE9Cime.js";
7
+ import { show_parts_d_exports } from "../../index-CGI7EVlK.js";
8
+ import { slot_parts_d_exports } from "../../index-BwnMUHzm.js";
9
+ import { switch_parts_d_exports } from "../../index-UX3DaMVe.js";
10
+ import { Teleport } from "../../index-B3N6YbN8.js";
11
11
  export { await_parts_d_exports as Await, ErrorBoundary, For, ForWithWrapper, show_parts_d_exports as Show, slot_parts_d_exports as Slot, SuspenseWithBoundary, switch_parts_d_exports as Switch, Teleport };
@@ -1,12 +1,12 @@
1
1
  import "../../utils-D4YNWj2X.js";
2
- import "../../getSlot-BIcGgBwN.js";
2
+ import "../../getSlot-D1_uG-Ym.js";
3
3
  import { ErrorBoundary } from "../../error-boundary-B3ycUZ1t.js";
4
4
  import { slot_parts_exports } from "../../slot-RXTKo4L7.js";
5
5
  import { await_parts_exports } from "../../await-Fe4LFRKd.js";
6
6
  import { For, ForWithWrapper } from "../../for-aTw1TgJo.js";
7
- import { show_parts_exports } from "../../show-BgYrfIxJ.js";
7
+ import { show_parts_exports } from "../../show-DNPzdLi-.js";
8
8
  import { SuspenseWithBoundary } from "../../suspense-with-boundary-TrQxYRG6.js";
9
- import { switch_parts_exports } from "../../switch-PF5xTJfr.js";
9
+ import { switch_parts_exports } from "../../switch-B2gKl94R.js";
10
10
  import { Teleport } from "../../teleport-dlSjWj_t.js";
11
11
  import "../../common-BYWy8Q78.js";
12
12
 
@@ -1,2 +1,2 @@
1
- import { ShowContent$1 as ShowContent, ShowFallback$1 as ShowFallback, ShowRoot$1 as ShowRoot, show_parts_d_exports } from "../../../index-C0XZoIZD.js";
1
+ import { ShowContent, ShowFallback, ShowRoot, show_parts_d_exports } from "../../../index-CGI7EVlK.js";
2
2
  export { show_parts_d_exports as Show, ShowContent, ShowFallback, ShowRoot };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
 
4
- import "../../../getSlot-BIcGgBwN.js";
5
- import { ShowContent, ShowFallback, ShowRoot, show_parts_exports } from "../../../show-BgYrfIxJ.js";
4
+ import "../../../getSlot-D1_uG-Ym.js";
5
+ import { ShowContent, ShowFallback, ShowRoot, show_parts_exports } from "../../../show-DNPzdLi-.js";
6
6
 
7
7
  export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot };
@@ -1,2 +1,2 @@
1
- import { SlotRoot$1 as SlotRoot, SlotSlottable$1 as SlotSlottable, slot_parts_d_exports } from "../../../index-1UCPJf7B.js";
1
+ import { SlotRoot, SlotSlottable, slot_parts_d_exports } from "../../../index-BwnMUHzm.js";
2
2
  export { slot_parts_d_exports as Slot, SlotRoot, SlotSlottable };
@@ -1,3 +1,3 @@
1
- import "../../../index-BSJ30pGj.js";
2
- import { SuspenseWithBoundary$1 as SuspenseWithBoundary, SuspenseWithBoundaryProps } from "../../../index-CqlM1M0j.js";
1
+ import "../../../index-BsjcsNQh.js";
2
+ import { SuspenseWithBoundary, SuspenseWithBoundaryProps } from "../../../index-CFNg1R-m.js";
3
3
  export { SuspenseWithBoundary, SuspenseWithBoundaryProps };
@@ -1,2 +1,2 @@
1
- import { SwitchDefault$1 as SwitchDefault, SwitchMatch$1 as SwitchMatch, SwitchRoot$1 as SwitchRoot, switch_parts_d_exports } from "../../../index--1COprHP.js";
1
+ import { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_d_exports } from "../../../index-UX3DaMVe.js";
2
2
  export { switch_parts_d_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
 
4
- import "../../../getSlot-BIcGgBwN.js";
5
- import { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_exports } from "../../../switch-PF5xTJfr.js";
4
+ import "../../../getSlot-D1_uG-Ym.js";
5
+ import { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_exports } from "../../../switch-B2gKl94R.js";
6
6
 
7
7
  export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot };
@@ -1,2 +1,2 @@
1
- import { Teleport$1 as Teleport } from "../../../index-DnaUCh8d.js";
1
+ import { Teleport } from "../../../index-B3N6YbN8.js";
2
2
  export { Teleport };
@@ -1,2 +1,2 @@
1
- import { CardContent$1 as CardContent, CardDescription$1 as CardDescription, CardFooter$1 as CardFooter, CardHeader$1 as CardHeader, CardRoot$1 as CardRoot, CardTitle$1 as CardTitle, card_parts_d_exports } from "../../../index-BuSQsDCX.js";
1
+ import { CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_d_exports } from "../../../index-BMcv7ELE.js";
2
2
  export { card_parts_d_exports as Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
@@ -1,2 +1,2 @@
1
- import { CarouselButton$1 as CarouselButton, CarouselButtonsProps, CarouselCaption$1 as CarouselCaption, CarouselContent$1 as CarouselContent, CarouselContentProps, CarouselControlProps, CarouselControls$1 as CarouselControls, CarouselIndicator$1 as CarouselIndicator, CarouselIndicatorGroup$1 as CarouselIndicatorGroup, CarouselIndicatorProps, CarouselItem$1 as CarouselItem, CarouselItemGroup$1 as CarouselItemGroup, CarouselProviderProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps, carousel_parts_d_exports } from "../../../index-BC0r1cBF.js";
1
+ import { CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselContent, CarouselContentProps, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselIndicatorProps, CarouselItem, CarouselItemGroup, CarouselProviderProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps, carousel_parts_d_exports } from "../../../index-DT8F8QKc.js";
2
2
  export { carousel_parts_d_exports as Carousel, CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselContent, CarouselContentProps, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselIndicatorProps, CarouselItem, CarouselItemGroup, CarouselProviderProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps };
@@ -2,17 +2,17 @@
2
2
 
3
3
 
4
4
  import "../../../utils-D4YNWj2X.js";
5
- import "../../../getSlot-BIcGgBwN.js";
5
+ import "../../../getSlot-D1_uG-Ym.js";
6
6
  import "../../../error-boundary-B3ycUZ1t.js";
7
7
  import "../../../slot-RXTKo4L7.js";
8
8
  import "../../../await-Fe4LFRKd.js";
9
9
  import "../../../for-aTw1TgJo.js";
10
- import "../../../show-BgYrfIxJ.js";
10
+ import "../../../show-DNPzdLi-.js";
11
11
  import "../../../suspense-with-boundary-TrQxYRG6.js";
12
- import "../../../switch-PF5xTJfr.js";
12
+ import "../../../switch-B2gKl94R.js";
13
13
  import "../../../teleport-dlSjWj_t.js";
14
14
  import "../../../common-BYWy8Q78.js";
15
15
  import "../../../cn-_FbtIrlZ.js";
16
- import { CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup, carousel_parts_exports } from "../../../carousel-Dznupnx8.js";
16
+ import { CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup, carousel_parts_exports } from "../../../carousel-Dvp-qURP.js";
17
17
 
18
18
  export { carousel_parts_exports as Carousel, CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup };
@@ -1,2 +1,2 @@
1
- import { useDragScroll$1 as useDragScroll } from "../../../index-CTZr4PTO.js";
1
+ import { useDragScroll } from "../../../index-gT9tVHv1.js";
2
2
  export { useDragScroll };
@@ -1,3 +1,3 @@
1
- import "../../../getSlotMap-DA_uhXqU.js";
2
- import { ContainerProps, DropZoneActions, DropZoneContainer$1 as DropZoneContainer, DropZoneContext$1 as DropZoneContext, DropZoneImagePreview$1 as DropZoneImagePreview, DropZoneInput$1 as DropZoneInput, DropZoneRenderPropType, DropZoneRoot$1 as DropZoneRoot, DropZoneRootProps, DropZoneState, FileWithPreview, InputProps, UseDropZoneProps, UseDropZoneResult, drop_zone_parts_d_exports, useDropZone$1 as useDropZone, useDropZoneContext$1 as useDropZoneContext } from "../../../index-ASoFjmZ6.js";
1
+ import "../../../getSlotMap-DZlQN8--.js";
2
+ import { ContainerProps, DropZoneActions, DropZoneContainer, DropZoneContext, DropZoneImagePreview, DropZoneInput, DropZoneRenderPropType, DropZoneRoot, DropZoneRootProps, DropZoneState, FileWithPreview, InputProps, UseDropZoneProps, UseDropZoneResult, drop_zone_parts_d_exports, useDropZone, useDropZoneContext } from "../../../index-BilTdK_M.js";
3
3
  export { ContainerProps, drop_zone_parts_d_exports as DropZone, DropZoneActions, DropZoneContainer, DropZoneContext, DropZoneImagePreview, DropZoneInput, DropZoneRenderPropType, DropZoneRoot, DropZoneRootProps, DropZoneState, FileWithPreview, InputProps, UseDropZoneProps, UseDropZoneResult, useDropZone, useDropZoneContext };
@@ -2,17 +2,17 @@
2
2
 
3
3
 
4
4
  import "../../../utils-D4YNWj2X.js";
5
- import "../../../getSlot-BIcGgBwN.js";
5
+ import "../../../getSlot-D1_uG-Ym.js";
6
6
  import "../../../error-boundary-B3ycUZ1t.js";
7
7
  import "../../../slot-RXTKo4L7.js";
8
8
  import "../../../await-Fe4LFRKd.js";
9
9
  import "../../../for-aTw1TgJo.js";
10
- import "../../../show-BgYrfIxJ.js";
10
+ import "../../../show-DNPzdLi-.js";
11
11
  import "../../../suspense-with-boundary-TrQxYRG6.js";
12
- import "../../../switch-PF5xTJfr.js";
12
+ import "../../../switch-B2gKl94R.js";
13
13
  import "../../../teleport-dlSjWj_t.js";
14
14
  import "../../../common-BYWy8Q78.js";
15
15
  import "../../../cn-_FbtIrlZ.js";
16
- import { DropZoneContainer, DropZoneContext, DropZoneImagePreview, DropZoneInput, DropZoneRoot, drop_zone_parts_exports, useDropZone, useDropZoneContext } from "../../../drop-zone-_YK9C3Xj.js";
16
+ import { DropZoneContainer, DropZoneContext, DropZoneImagePreview, DropZoneInput, DropZoneRoot, drop_zone_parts_exports, useDropZone, useDropZoneContext } from "../../../drop-zone-Beip1k4x.js";
17
17
 
18
18
  export { drop_zone_parts_exports as DropZone, DropZoneContainer, DropZoneContext, DropZoneImagePreview, DropZoneInput, DropZoneRoot, useDropZone, useDropZoneContext };
@@ -1,2 +1,2 @@
1
- import { FieldValues, FormDescription$1 as FormDescription, FormErrorMessage$1 as FormErrorMessage, FormErrorMessagePrimitive$1 as FormErrorMessagePrimitive, FormErrorMessagePrimitiveProps, FormField$1 as FormField, FormFieldContext$1 as FormFieldContext, FormFieldControlledField$1 as FormFieldControlledField, FormFieldController$1 as FormFieldController, FormInput$1 as FormInput, FormInputGroup$1 as FormInputGroup, FormInputLeftItem$1 as FormInputLeftItem, FormInputPrimitive$1 as FormInputPrimitive, FormInputProps, FormInputRightItem$1 as FormInputRightItem, FormLabel$1 as FormLabel, FormRoot$1 as FormRoot, FormSelect$1 as FormSelect, FormSelectPrimitive$1 as FormSelectPrimitive, FormSelectProps, FormSubmit$1 as FormSubmit, FormSubscribeToFieldValue$1 as FormSubscribeToFieldValue, FormSubscribeToFormState$1 as FormSubscribeToFormState, FormTextArea$1 as FormTextArea, FormTextAreaPrimitive$1 as FormTextAreaPrimitive, FormTextAreaProps, form_parts_d_exports, useFormRootContext$1 as useFormRootContext, useStrictFormFieldContext$1 as useStrictFormFieldContext } from "../../../index-DQ1yFGd2.js";
1
+ import { FieldValues, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormErrorMessagePrimitiveProps, FormField, FormFieldContext, FormFieldControlledField, FormFieldController, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputProps, FormInputRightItem, FormLabel, FormRoot, FormSelect, FormSelectPrimitive, FormSelectProps, FormSubmit, FormSubscribeToFieldValue, FormSubscribeToFormState, FormTextArea, FormTextAreaPrimitive, FormTextAreaProps, form_parts_d_exports, useFormRootContext, useStrictFormFieldContext } from "../../../index-CIM4YPg5.js";
2
2
  export { FieldValues, form_parts_d_exports as Form, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormErrorMessagePrimitiveProps, FormField, FormFieldContext, FormFieldControlledField, FormFieldController, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputProps, FormInputRightItem, FormLabel, FormRoot, FormSelect, FormSelectPrimitive, FormSelectProps, FormSubmit, FormSubscribeToFieldValue, FormSubscribeToFormState, FormTextArea, FormTextAreaPrimitive, FormTextAreaProps, useStrictFormFieldContext as useFormFieldContext, useFormRootContext };
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
 
3
3
 
4
- import "../../../getSlot-BIcGgBwN.js";
4
+ import "../../../getSlot-D1_uG-Ym.js";
5
5
  import "../../../slot-RXTKo4L7.js";
6
6
  import "../../../for-aTw1TgJo.js";
7
7
  import "../../../cn-_FbtIrlZ.js";
8
- import { FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldControlledField, FormFieldController, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormSelect, FormSelectPrimitive, FormSubmit, FormSubscribeToFieldValue, FormSubscribeToFormState, FormTextArea, FormTextAreaPrimitive, form_parts_exports, useFormRootContext, useStrictFormFieldContext } from "../../../form-DytCfL6R.js";
8
+ import { FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldControlledField, FormFieldController, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormSelect, FormSelectPrimitive, FormSubmit, FormSubscribeToFieldValue, FormSubscribeToFormState, FormTextArea, FormTextAreaPrimitive, form_parts_exports, useFormRootContext, useStrictFormFieldContext } from "../../../form-CUlTG3KI.js";
9
9
 
10
10
  export { form_parts_exports as Form, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldControlledField, FormFieldController, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormSelect, FormSelectPrimitive, FormSubmit, FormSubscribeToFieldValue, FormSubscribeToFormState, FormTextArea, FormTextAreaPrimitive, useStrictFormFieldContext as useFormFieldContext, useFormRootContext };
@@ -1,7 +1,7 @@
1
- import "../../getSlotMap-DA_uhXqU.js";
2
- import { card_parts_d_exports } from "../../index-BuSQsDCX.js";
3
- import { carousel_parts_d_exports } from "../../index-BC0r1cBF.js";
4
- import { useDragScroll$1 as useDragScroll } from "../../index-CTZr4PTO.js";
5
- import { drop_zone_parts_d_exports, useDropZone$1 as useDropZone } from "../../index-ASoFjmZ6.js";
6
- import { form_parts_d_exports } from "../../index-DQ1yFGd2.js";
1
+ import "../../getSlotMap-DZlQN8--.js";
2
+ import { card_parts_d_exports } from "../../index-BMcv7ELE.js";
3
+ import { carousel_parts_d_exports } from "../../index-DT8F8QKc.js";
4
+ import { useDragScroll } from "../../index-gT9tVHv1.js";
5
+ import { drop_zone_parts_d_exports, useDropZone } from "../../index-BilTdK_M.js";
6
+ import { form_parts_d_exports } from "../../index-CIM4YPg5.js";
7
7
  export { card_parts_d_exports as Card, carousel_parts_d_exports as Carousel, drop_zone_parts_d_exports as DropZone, form_parts_d_exports as Form, useDragScroll, useDropZone };
@@ -1,19 +1,19 @@
1
1
  import "../../utils-D4YNWj2X.js";
2
- import "../../getSlot-BIcGgBwN.js";
2
+ import "../../getSlot-D1_uG-Ym.js";
3
3
  import "../../error-boundary-B3ycUZ1t.js";
4
4
  import "../../slot-RXTKo4L7.js";
5
5
  import "../../await-Fe4LFRKd.js";
6
6
  import "../../for-aTw1TgJo.js";
7
- import "../../show-BgYrfIxJ.js";
7
+ import "../../show-DNPzdLi-.js";
8
8
  import "../../suspense-with-boundary-TrQxYRG6.js";
9
- import "../../switch-PF5xTJfr.js";
9
+ import "../../switch-B2gKl94R.js";
10
10
  import "../../teleport-dlSjWj_t.js";
11
11
  import "../../common-BYWy8Q78.js";
12
12
  import "../../cn-_FbtIrlZ.js";
13
13
  import { card_parts_exports } from "../../card-DRjs-vtv.js";
14
- import { carousel_parts_exports } from "../../carousel-Dznupnx8.js";
14
+ import { carousel_parts_exports } from "../../carousel-Dvp-qURP.js";
15
15
  import { useDragScroll } from "../../drag-scroll-BLjij7aI.js";
16
- import { drop_zone_parts_exports, useDropZone } from "../../drop-zone-_YK9C3Xj.js";
17
- import { form_parts_exports } from "../../form-DytCfL6R.js";
16
+ import { drop_zone_parts_exports, useDropZone } from "../../drop-zone-Beip1k4x.js";
17
+ import { form_parts_exports } from "../../form-CUlTG3KI.js";
18
18
 
19
19
  export { card_parts_exports as Card, carousel_parts_exports as Carousel, drop_zone_parts_exports as DropZone, form_parts_exports as Form, useDragScroll, useDropZone };
@@ -1,7 +1,7 @@
1
1
  import { __export } from "./chunk-Cl8Af3a2.js";
2
2
  import { getSlotMap, withSlotNameAndSymbol } from "./utils-D4YNWj2X.js";
3
3
  import { SlotRoot } from "./slot-RXTKo4L7.js";
4
- import { ShowRoot } from "./show-BgYrfIxJ.js";
4
+ import { ShowRoot } from "./show-DNPzdLi-.js";
5
5
  import { cnMerge } from "./cn-_FbtIrlZ.js";
6
6
  import { Fragment, isValidElement, useCallback, useMemo, useRef, useState } from "react";
7
7
  import { createImagePreview, dataAttr, handleFileValidation, toArray } from "@zayne-labs/toolkit-core";
@@ -310,4 +310,4 @@ __export(drop_zone_parts_exports, {
310
310
 
311
311
  //#endregion
312
312
  export { DropZoneContainer, DropZoneContext, DropZoneImagePreview, DropZoneInput, DropZoneRoot, drop_zone_parts_exports, useDropZone, useDropZoneContext };
313
- //# sourceMappingURL=drop-zone-_YK9C3Xj.js.map
313
+ //# sourceMappingURL=drop-zone-Beip1k4x.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drop-zone-_YK9C3Xj.js","names":["file: File | FileMeta","file: File","disallowPreviewForNonImageFiles: boolean","fileWithPreview: FileWithPreview | undefined","props?: UseDropZoneProps","value: boolean","addFiles: DropZoneActions[\"addFiles\"]","filesWithPreview: FileWithPreview[]","clearFiles: DropZoneActions[\"clearFiles\"]","removeFile: DropZoneActions[\"removeFile\"]","clearErrors: DropZoneActions[\"clearErrors\"]","handleFileUpload: DropZoneActions[\"handleFileUpload\"]","handleDragEnter: DropZoneActions[\"handleDragEnter\"]","handleDragOver: DropZoneActions[\"handleDragOver\"]","handleDragLeave: DropZoneActions[\"handleDragLeave\"]","openFilePicker: DropZoneActions[\"openFilePicker\"]","getContainerProps: UseDropZoneResult[\"getContainerProps\"]","getInputProps: UseDropZoneResult[\"getInputProps\"]","props: DropZoneRootProps","ReactFragment","props: DropZoneInputProps","Component","props: PolymorphicProps<TElement, DropZoneContainerProps>","props: { children: RenderPropFn }"],"sources":["../../src/components/ui/drop-zone/drop-context.ts","../../src/components/ui/drop-zone/utils.ts","../../src/components/ui/drop-zone/use-drop-zone.ts","../../src/components/ui/drop-zone/drop-zone.tsx","../../src/components/ui/drop-zone/drop-zone-parts.ts"],"sourcesContent":["import { createCustomContext } from \"@zayne-labs/toolkit-react\";\nimport type { UseDropZoneResult } from \"./use-drop-zone\";\n\nconst [DropZoneContextProvider, useDropZoneContext] = createCustomContext<UseDropZoneResult>({\n\thookName: \"useDropZoneContext\",\n\tname: \"DropZoneContext\",\n\tproviderName: \"DropZoneRoot\",\n});\n\nexport { DropZoneContextProvider, useDropZoneContext };\n","import { type FileMeta, createImagePreview } from \"@zayne-labs/toolkit-core\";\nimport { isFile } from \"@zayne-labs/toolkit-type-helpers\";\nimport type { FileWithPreview } from \"./use-drop-zone\";\n\nexport const generateUniqueId = (file: File | FileMeta): string => {\n\tif (!isFile(file)) {\n\t\treturn file.id;\n\t}\n\n\treturn `${file.name}-(${Math.round(performance.now())})-${crypto.randomUUID().slice(0, 8)}`;\n};\n\nexport const createObjectURL = (file: File, disallowPreviewForNonImageFiles: boolean) => {\n\tif (disallowPreviewForNonImageFiles && !file.type.startsWith(\"image/\")) return;\n\n\treturn createImagePreview(file);\n};\n\nexport const clearObjectURL = (\n\tfileWithPreview: FileWithPreview | undefined,\n\tdisallowPreviewForNonImageFiles: boolean\n) => {\n\tif (!isFile(fileWithPreview?.file)) return;\n\n\tif (disallowPreviewForNonImageFiles && !fileWithPreview.file.type.startsWith(\"image/\")) return;\n\n\tif (!fileWithPreview.preview) return;\n\n\tURL.revokeObjectURL(fileWithPreview.preview);\n};\n","import { cnMerge } from \"@/lib/utils/cn\";\nimport { dataAttr } from \"@zayne-labs/toolkit-core\";\nimport {\n\ttype FileMeta,\n\ttype FileValidationErrorContext,\n\ttype FileValidationOptions,\n\thandleFileValidation,\n\ttoArray,\n} from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport {\n\ttype InferProps,\n\tcomposeRefs,\n\tcomposeTwoEventHandlers,\n\tmergeTwoProps,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport { type Prettify, isString } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\nimport { clearObjectURL, createObjectURL, generateUniqueId } from \"./utils\";\n\nexport type ContainerProps = InferProps<HTMLElement> & {\n\tclassNames?: {\n\t\tbase?: string;\n\t\tisDragging?: string;\n\t};\n};\n\nexport type InputProps = InferProps<\"input\">;\n\nexport type FileWithPreview = {\n\t/**\n\t * File object or file metadata\n\t */\n\tfile: File | FileMeta;\n\t/**\n\t * Unique ID for the file\n\t */\n\tid: string;\n\t/**\n\t * Preview URL for the file\n\t * - Will be undefined if `disallowPreviewForNonImageFiles` is set to `true` and the file is not an image\n\t * - Can also be undefined if `URL.createObjectURL` fails\n\t */\n\tpreview: string | undefined;\n};\n\nexport type DropZoneState = {\n\t/**\n\t * List of validation errors\n\t */\n\terrors: FileValidationErrorContext[];\n\t/**\n\t * List of files with their preview URLs and unique IDs\n\t */\n\tfilesWithPreview: FileWithPreview[];\n\t/**\n\t * Whether or not a file is currently being dragged over the drop zone\n\t */\n\tisDragging: boolean;\n};\n\ntype ChangeOrDragEvent = React.ChangeEvent<HTMLInputElement> | React.DragEvent<HTMLElement>;\n\nexport type DropZoneActions = {\n\taddFiles: (fileList: File[] | FileList | null, event?: ChangeOrDragEvent) => void;\n\tclearErrors: () => void;\n\tclearFiles: () => void;\n\thandleDragEnter: (event: React.DragEvent<HTMLElement>) => void;\n\thandleDragLeave: (event: React.DragEvent<HTMLElement>) => void;\n\thandleDragOver: (event: React.DragEvent<HTMLElement>) => void;\n\thandleFileUpload: (event: ChangeOrDragEvent) => void;\n\topenFilePicker: () => void;\n\tremoveFile: (fileToRemoveOrId: string | FileWithPreview) => void;\n};\n\nexport type UseDropZoneResult = {\n\tdropZoneActions: DropZoneActions;\n\tdropZoneState: DropZoneState;\n\tgetContainerProps: (containerProps?: ContainerProps) => ContainerProps;\n\tgetInputProps: (inputProps?: InputProps) => InputProps;\n\tinputRef: React.RefObject<HTMLInputElement | null>;\n};\n\nexport type UseDropZoneProps = {\n\t/**\n\t * Allowed file types to be uploaded.\n\t */\n\tallowedFileTypes?: string[];\n\n\t/**\n\t * CSS classes to apply to the various parts of the drop zone\n\t */\n\tclassNames?: Prettify<ContainerProps[\"classNames\"] & { input?: string }>;\n\n\t/**\n\t * Whether to disallow duplicate files\n\t * @default true\n\t */\n\tdisallowDuplicates?: boolean;\n\n\t/**\n\t * Whether to disallow preview for non-image files\n\t * @default true\n\t */\n\tdisallowPreviewForNonImageFiles?: boolean;\n\n\t/**\n\t * Extra props to pass to the container element\n\t */\n\textraContainerProps?: ContainerProps;\n\n\t/**\n\t * Extra props to pass to the input element\n\t */\n\textraInputProps?: InputProps;\n\n\t/**\n\t * Initial files to populate the drop zone\n\t */\n\tinitialFiles?: FileMeta | FileMeta[] | null;\n\n\t/**\n\t * Maximum number of files that can be uploaded.\n\t */\n\tmaxFileCount?: number;\n\n\t/**\n\t * Maximum file size in MB\n\t */\n\tmaxFileSize?: number;\n\n\t/**\n\t * Whether to allow multiple files to be uploaded\n\t */\n\tmultiple?: boolean;\n\n\t/**\n\t * Callback function to be called when internal files state changes\n\t */\n\tonFilesChange?: (context: { filesWithPreview: FileWithPreview[] }) => void;\n\n\t/**\n\t * Callback function to be called when the render props change\n\t */\n\tonRenderPropsChange?: (props: UseDropZoneResult) => void;\n\n\t/**\n\t * Callback function to be called when new files are uploaded\n\t */\n\tonUpload?: (context: { event: ChangeOrDragEvent; filesWithPreview: FileWithPreview[] }) => void;\n\n\t/**\n\t * Callback function to be called on each file upload as they occur\n\t */\n\tonUploadError?: FileValidationOptions[\"onError\"];\n\n\t/**\n\t * Callback function to be called once after all file upload errors have occurred\n\t */\n\tonUploadErrors?: FileValidationOptions[\"onErrors\"];\n\n\t/**\n\t * Callback function to be called on file upload success\n\t */\n\tonUploadSuccess?: FileValidationOptions[\"onSuccess\"];\n\n\t/**\n\t * Custom validation function.\n\t *\n\t * If the function returns false, the file will be rejected\n\t */\n\tvalidator?: NonNullable<FileValidationOptions[\"validationSettings\"]>[\"validator\"];\n\n\t/**\n\t * Custom validation function that runs after all file validation has occurred\n\t */\n\tvalidatorForAllFiles?: FileValidationOptions[\"validatorForAllFiles\"];\n\n\t/**\n\t * Whether to allow the default file picker via the file input element\n\t * @default true\n\t */\n\twithDefaultFilePicker?: boolean;\n};\n\nexport const useDropZone = (props?: UseDropZoneProps): UseDropZoneResult => {\n\tconst {\n\t\tallowedFileTypes,\n\t\tclassNames,\n\t\tdisallowDuplicates = true,\n\t\tdisallowPreviewForNonImageFiles = true,\n\t\textraContainerProps,\n\t\textraInputProps,\n\t\tinitialFiles,\n\t\tmaxFileCount,\n\t\tmaxFileSize,\n\t\tmultiple,\n\t\tonFilesChange,\n\t\tonRenderPropsChange,\n\t\tonUpload,\n\t\tonUploadError,\n\t\tonUploadErrors,\n\t\tonUploadSuccess,\n\t\tvalidator,\n\t\tvalidatorForAllFiles,\n\t\twithDefaultFilePicker = true,\n\t} = props ?? {};\n\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\tconst initialFileArray = toArray(initialFiles).filter(Boolean);\n\n\tconst [dropZoneState, setDropZoneState] = useState<DropZoneState>({\n\t\terrors: [],\n\t\tfilesWithPreview: initialFileArray.map((fileMeta) => ({\n\t\t\tfile: fileMeta,\n\t\t\tid: fileMeta.id,\n\t\t\tpreview: fileMeta.url,\n\t\t})),\n\t\tisDragging: false,\n\t});\n\n\tconst toggleIsDragging = (value: boolean) => {\n\t\tsetDropZoneState((prevState) => ({ ...prevState, isDragging: value }));\n\t};\n\n\tconst addFiles: DropZoneActions[\"addFiles\"] = useCallbackRef((fileList, event) => {\n\t\tif (!fileList || fileList.length === 0) {\n\t\t\tconsole.warn(\"No file selected!\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Clear existing errors when new files are uploaded\n\t\tclearErrors();\n\n\t\t// In single file mode, clear existing files first\n\t\tif (!multiple) {\n\t\t\tclearFiles();\n\t\t}\n\n\t\tconst { errors, validFiles } = handleFileValidation({\n\t\t\texistingFiles: dropZoneState.filesWithPreview.map((fileWithPreview) => fileWithPreview.file),\n\t\t\tnewFiles: fileList,\n\t\t\tonError: onUploadError,\n\t\t\tonErrors: onUploadErrors,\n\t\t\tonSuccess: onUploadSuccess,\n\t\t\tvalidationSettings: {\n\t\t\t\tallowedFileTypes,\n\t\t\t\tdisallowDuplicates,\n\t\t\t\tmaxFileCount,\n\t\t\t\tmaxFileSize,\n\t\t\t\tvalidator,\n\t\t\t},\n\t\t\tvalidatorForAllFiles,\n\t\t});\n\n\t\tif (validFiles.length === 0) {\n\t\t\tsetDropZoneState((prevState) => ({ ...prevState, errors }));\n\t\t\treturn;\n\t\t}\n\n\t\tconst filesWithPreview: FileWithPreview[] = validFiles.map((file) => ({\n\t\t\tfile,\n\t\t\tid: generateUniqueId(file),\n\t\t\tpreview: createObjectURL(file, disallowPreviewForNonImageFiles),\n\t\t}));\n\n\t\t// == Only call onUpload callback if event is provided, which indicates that new files were uploaded from an event handler\n\n\t\tif (event) {\n\t\t\tonUpload?.({ event, filesWithPreview });\n\t\t}\n\n\t\tconst newFileUploadState = {\n\t\t\t...dropZoneState,\n\t\t\terrors,\n\t\t\t...(event?.type === \"drop\" && { isDragging: false }),\n\t\t\tfilesWithPreview: multiple\n\t\t\t\t? [...dropZoneState.filesWithPreview, ...filesWithPreview]\n\t\t\t\t: filesWithPreview,\n\t\t} satisfies DropZoneState;\n\n\t\tonFilesChange?.({ filesWithPreview: newFileUploadState.filesWithPreview });\n\n\t\tsetDropZoneState(newFileUploadState);\n\n\t\t// == Reset input value after adding files\n\t\tinputRef.current && (inputRef.current.value = \"\");\n\t});\n\n\tconst clearFiles: DropZoneActions[\"clearFiles\"] = useCallbackRef(() => {\n\t\t// == Clean up object URLs if any\n\t\tdropZoneState.filesWithPreview.forEach((fileWithPreview) =>\n\t\t\tclearObjectURL(fileWithPreview, disallowPreviewForNonImageFiles)\n\t\t);\n\n\t\tconst newFileUploadState = {\n\t\t\t...dropZoneState,\n\t\t\terrors: [],\n\t\t\tfilesWithPreview: [],\n\t\t} satisfies DropZoneState;\n\n\t\tonFilesChange?.({ filesWithPreview: newFileUploadState.filesWithPreview });\n\n\t\tsetDropZoneState(newFileUploadState);\n\n\t\t// == Reset input value after clearing files\n\t\tinputRef.current && (inputRef.current.value = \"\");\n\t});\n\n\tconst removeFile: DropZoneActions[\"removeFile\"] = useCallbackRef((fileToRemoveOrId) => {\n\t\tconst actualFileToRemove = isString(fileToRemoveOrId)\n\t\t\t? dropZoneState.filesWithPreview.find((file) => file.id === fileToRemoveOrId)\n\t\t\t: fileToRemoveOrId;\n\n\t\tif (!actualFileToRemove) return;\n\n\t\tclearObjectURL(actualFileToRemove, disallowPreviewForNonImageFiles);\n\n\t\tconst newFilesWithPreview = dropZoneState.filesWithPreview.filter(\n\t\t\t(file) => file.id !== actualFileToRemove.id\n\t\t);\n\n\t\tonFilesChange?.({ filesWithPreview: newFilesWithPreview });\n\n\t\tsetDropZoneState({\n\t\t\t...dropZoneState,\n\t\t\terrors: [],\n\t\t\tfilesWithPreview: newFilesWithPreview,\n\t\t});\n\t});\n\n\tconst clearErrors: DropZoneActions[\"clearErrors\"] = useCallbackRef(() => {\n\t\tsetDropZoneState((prevState) => ({ ...prevState, errors: [] }));\n\t});\n\n\tconst handleFileUpload: DropZoneActions[\"handleFileUpload\"] = useCallbackRef((event) => {\n\t\tif (inputRef.current?.disabled) return;\n\n\t\tif (event.type === \"drop\") {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t}\n\n\t\tconst fileList =\n\t\t\tevent.type === \"drop\"\n\t\t\t\t? (event as React.DragEvent).dataTransfer.files\n\t\t\t\t: (event as React.ChangeEvent<HTMLInputElement>).target.files;\n\n\t\t// == In single file mode, only use the first file\n\t\tif (!multiple) {\n\t\t\tconst firstFile = fileList?.[0];\n\n\t\t\tfirstFile && addFiles([firstFile], event);\n\n\t\t\treturn;\n\t\t}\n\n\t\taddFiles(fileList, event);\n\t});\n\n\tconst handleDragEnter: DropZoneActions[\"handleDragEnter\"] = useCallbackRef((event) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\ttoggleIsDragging(true);\n\t});\n\n\tconst handleDragOver: DropZoneActions[\"handleDragOver\"] = useCallbackRef((event) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\ttoggleIsDragging(true);\n\t});\n\n\tconst handleDragLeave: DropZoneActions[\"handleDragLeave\"] = useCallbackRef((event) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\ttoggleIsDragging(false);\n\t});\n\n\tconst openFilePicker: DropZoneActions[\"openFilePicker\"] = useCallbackRef(() => {\n\t\tinputRef.current?.click();\n\t});\n\n\tconst getContainerProps: UseDropZoneResult[\"getContainerProps\"] = useCallback(\n\t\t(containerProps) => {\n\t\t\tconst mergedContainerProps = mergeTwoProps(extraContainerProps, containerProps);\n\n\t\t\treturn {\n\t\t\t\t...mergedContainerProps,\n\t\t\t\tclassName: cnMerge(\n\t\t\t\t\t\"relative isolate flex flex-col\",\n\t\t\t\t\tmergedContainerProps.className,\n\t\t\t\t\tclassNames?.base,\n\t\t\t\t\tdropZoneState.isDragging && [\n\t\t\t\t\t\t\"opacity-60\",\n\t\t\t\t\t\tclassNames?.isDragging,\n\t\t\t\t\t\tcontainerProps?.classNames?.isDragging,\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\t\"data-dragging\": dataAttr(dropZoneState.isDragging),\n\t\t\t\t\"data-scope\": \"dropzone\",\n\t\t\t\t// eslint-disable-next-line perfectionist/sort-objects -- I need data-scope to be first\n\t\t\t\t\"data-part\": \"container\",\n\t\t\t\t\"data-slot\": \"dropzone-container\",\n\t\t\t\tonDragEnter: composeTwoEventHandlers(handleDragEnter, mergedContainerProps.onDragEnter),\n\t\t\t\tonDragLeave: composeTwoEventHandlers(handleDragLeave, mergedContainerProps.onDragLeave),\n\t\t\t\tonDragOver: composeTwoEventHandlers(handleDragOver, mergedContainerProps.onDragOver),\n\t\t\t\tonDrop: composeTwoEventHandlers(handleFileUpload, mergedContainerProps.onDrop),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tclassNames?.base,\n\t\t\tclassNames?.isDragging,\n\t\t\textraContainerProps,\n\t\t\tdropZoneState.isDragging,\n\t\t\thandleDragEnter,\n\t\t\thandleDragLeave,\n\t\t\thandleDragOver,\n\t\t\thandleFileUpload,\n\t\t]\n\t);\n\n\tconst getInputProps: UseDropZoneResult[\"getInputProps\"] = useCallback(\n\t\t(inputProps) => {\n\t\t\tconst mergedInputProps = mergeTwoProps(extraInputProps, inputProps);\n\n\t\t\treturn {\n\t\t\t\t...mergedInputProps,\n\t\t\t\taccept: allowedFileTypes ? allowedFileTypes.join(\", \") : mergedInputProps.accept,\n\t\t\t\tclassName: cnMerge(\n\t\t\t\t\twithDefaultFilePicker ? \"absolute inset-0 z-[100] cursor-pointer opacity-0\" : \"hidden\",\n\t\t\t\t\tclassNames?.input,\n\t\t\t\t\tmergedInputProps.className\n\t\t\t\t),\n\t\t\t\t\"data-dragging\": dataAttr(dropZoneState.isDragging),\n\t\t\t\t\"data-scope\": \"dropzone\",\n\t\t\t\t// eslint-disable-next-line perfectionist/sort-objects -- I need data-scope to be first\n\t\t\t\t\"data-part\": \"input\",\n\t\t\t\t\"data-slot\": \"dropzone-input\",\n\t\t\t\tmultiple: multiple ?? mergedInputProps.multiple,\n\t\t\t\tonChange: composeTwoEventHandlers(handleFileUpload, mergedInputProps.onChange),\n\t\t\t\tref: composeRefs(inputRef, mergedInputProps.ref),\n\t\t\t\ttype: \"file\",\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tallowedFileTypes,\n\t\t\tclassNames?.input,\n\t\t\textraInputProps,\n\t\t\tdropZoneState.isDragging,\n\t\t\thandleFileUpload,\n\t\t\tmultiple,\n\t\t\twithDefaultFilePicker,\n\t\t]\n\t);\n\n\tconst savedOnRenderPropsChange = useCallbackRef(onRenderPropsChange);\n\n\tconst dropZoneResult = useMemo(() => {\n\t\tconst propsForRenderFn = {\n\t\t\tdropZoneActions: {\n\t\t\t\taddFiles,\n\t\t\t\tclearErrors,\n\t\t\t\tclearFiles,\n\t\t\t\thandleDragEnter,\n\t\t\t\thandleDragLeave,\n\t\t\t\thandleDragOver,\n\t\t\t\thandleFileUpload,\n\t\t\t\topenFilePicker,\n\t\t\t\tremoveFile,\n\t\t\t},\n\t\t\tdropZoneState,\n\t\t\tgetContainerProps,\n\t\t\tgetInputProps,\n\t\t\tinputRef,\n\t\t} satisfies UseDropZoneResult;\n\n\t\tsavedOnRenderPropsChange(propsForRenderFn);\n\n\t\treturn propsForRenderFn;\n\t}, [\n\t\tsavedOnRenderPropsChange,\n\t\taddFiles,\n\t\tclearErrors,\n\t\tclearFiles,\n\t\tdropZoneState,\n\t\tgetInputProps,\n\t\tgetContainerProps,\n\t\thandleDragEnter,\n\t\thandleDragLeave,\n\t\thandleDragOver,\n\t\thandleFileUpload,\n\t\topenFilePicker,\n\t\tremoveFile,\n\t]);\n\n\treturn dropZoneResult;\n};\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { Show, Slot } from \"@/components/common\";\nimport { type GetSlotComponentProps, getSlotMap, withSlotNameAndSymbol } from \"@/lib/utils/getSlotMap\";\nimport type { DiscriminatedRenderProps, PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Fragment as ReactFragment, isValidElement } from \"react\";\nimport { DropZoneContextProvider, useDropZoneContext } from \"./drop-context\";\nimport {\n\ttype ContainerProps,\n\ttype InputProps,\n\ttype UseDropZoneProps,\n\ttype UseDropZoneResult,\n\tuseDropZone,\n} from \"./use-drop-zone\";\n\nexport type DropZoneRenderPropType = DiscriminatedRenderProps<\n\tReact.ReactNode | ((props: UseDropZoneResult) => React.ReactNode)\n>;\n\nexport type DropZoneRootProps = DropZoneRenderPropType\n\t& UseDropZoneProps & {\n\t\t/**\n\t\t * Controls whether to include internal elements (root and input) or not.\n\t\t */\n\t\twithInternalElements?: boolean;\n\t};\n\nexport function DropZoneRoot(props: DropZoneRootProps) {\n\tconst { children, render, withInternalElements = true, ...restOfProps } = props;\n\n\tconst dropZone = useDropZone(restOfProps);\n\n\tconst ContainerComponent = withInternalElements ? DropZoneContainer : ReactFragment;\n\tconst InputComponent = withInternalElements ? DropZoneInput : ReactFragment;\n\n\tconst selectedChildren = children ?? render;\n\n\tconst resolvedChildren = isFunction(selectedChildren) ? selectedChildren(dropZone) : selectedChildren;\n\n\tconst couldChildrenContainSlots =\n\t\tisArray(resolvedChildren)\n\t\t|| (isValidElement(resolvedChildren) && resolvedChildren.type === ReactFragment);\n\n\tconst slots =\n\t\twithInternalElements && couldChildrenContainSlots\n\t\t\t? getSlotMap<SlotComponentProps>(resolvedChildren)\n\t\t\t: ({ default: resolvedChildren } as ReturnType<typeof getSlotMap<SlotComponentProps>>);\n\n\treturn (\n\t\t<DropZoneContextProvider value={dropZone}>\n\t\t\t<ContainerComponent>\n\t\t\t\t<InputComponent />\n\n\t\t\t\t{slots.default}\n\t\t\t</ContainerComponent>\n\n\t\t\t{slots.preview}\n\t\t</DropZoneContextProvider>\n\t);\n}\n\ntype DropZoneInputProps = InputProps & { asChild?: boolean };\n\nexport function DropZoneInput(props: DropZoneInputProps) {\n\tconst { asChild, ...restOfProps } = props;\n\n\tconst dropZoneContext = useDropZoneContext();\n\n\tconst Component = asChild ? Slot.Root : \"input\";\n\n\treturn <Component {...dropZoneContext.getInputProps(restOfProps)} />;\n}\n\ntype DropZoneContainerProps = ContainerProps & { asChild?: boolean };\n\nexport function DropZoneContainer<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement, DropZoneContainerProps>\n) {\n\tconst { as: Element = \"div\", asChild, ...restOfProps } = props;\n\n\tconst dropZoneContext = useDropZoneContext();\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn <Component {...dropZoneContext.getContainerProps(restOfProps)} />;\n}\n\ntype RenderPropFn = (props: UseDropZoneResult) => React.ReactNode;\n\ntype SlotComponentProps = GetSlotComponentProps<\"preview\", React.ReactNode | RenderPropFn>;\n\nexport function DropZoneContext(props: { children: RenderPropFn }) {\n\tconst { children } = props;\n\n\tconst dropZoneContext = useDropZoneContext();\n\n\treturn children(dropZoneContext);\n}\n\nexport const DropZoneImagePreview = withSlotNameAndSymbol<SlotComponentProps>(\"preview\", (props) => {\n\tconst { children } = props;\n\n\tif (isFunction(children)) {\n\t\treturn (\n\t\t\t<DropZoneContext>\n\t\t\t\t{(dropZoneCtx) => (\n\t\t\t\t\t<Show.Root when={dropZoneCtx.dropZoneState.filesWithPreview.length > 0}>\n\t\t\t\t\t\t{children(dropZoneCtx)}\n\t\t\t\t\t</Show.Root>\n\t\t\t\t)}\n\t\t\t</DropZoneContext>\n\t\t);\n\t}\n\n\treturn children;\n});\n","export {\n\tDropZoneRoot as Root,\n\tDropZoneImagePreview as ImagePreview,\n\tDropZoneContext as Context,\n\tDropZoneInput as Input,\n\tDropZoneContainer as Container,\n} from \"./drop-zone\";\n"],"mappings":";;;;;;;;;;;;;AAGA,MAAM,CAAC,yBAAyB,mBAAmB,GA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EAAE,UAAU,GAAG;AAErB,KAAI,WAAW,SAAS,CACvB,wBACC,IAAC,6BACC,CAAC,gCACD;EAAW,MAAM,YAAY,cAAc,iBAAiB,SAAS;YACnE,SAAS,YAAY;GACX,GAEI;AAIpB,QAAO;AACP,EAAC"}
1
+ {"version":3,"file":"drop-zone-Beip1k4x.js","names":["file: File | FileMeta","file: File","disallowPreviewForNonImageFiles: boolean","fileWithPreview: FileWithPreview | undefined","props?: UseDropZoneProps","value: boolean","addFiles: DropZoneActions[\"addFiles\"]","filesWithPreview: FileWithPreview[]","clearFiles: DropZoneActions[\"clearFiles\"]","removeFile: DropZoneActions[\"removeFile\"]","clearErrors: DropZoneActions[\"clearErrors\"]","handleFileUpload: DropZoneActions[\"handleFileUpload\"]","handleDragEnter: DropZoneActions[\"handleDragEnter\"]","handleDragOver: DropZoneActions[\"handleDragOver\"]","handleDragLeave: DropZoneActions[\"handleDragLeave\"]","openFilePicker: DropZoneActions[\"openFilePicker\"]","getContainerProps: UseDropZoneResult[\"getContainerProps\"]","getInputProps: UseDropZoneResult[\"getInputProps\"]","props: DropZoneRootProps","ReactFragment","props: DropZoneInputProps","Component","props: PolymorphicProps<TElement, DropZoneContainerProps>","props: { children: RenderPropFn }"],"sources":["../../src/components/ui/drop-zone/drop-context.ts","../../src/components/ui/drop-zone/utils.ts","../../src/components/ui/drop-zone/use-drop-zone.ts","../../src/components/ui/drop-zone/drop-zone.tsx","../../src/components/ui/drop-zone/drop-zone-parts.ts"],"sourcesContent":["import { createCustomContext } from \"@zayne-labs/toolkit-react\";\nimport type { UseDropZoneResult } from \"./use-drop-zone\";\n\nconst [DropZoneContextProvider, useDropZoneContext] = createCustomContext<UseDropZoneResult>({\n\thookName: \"useDropZoneContext\",\n\tname: \"DropZoneContext\",\n\tproviderName: \"DropZoneRoot\",\n});\n\nexport { DropZoneContextProvider, useDropZoneContext };\n","import { type FileMeta, createImagePreview } from \"@zayne-labs/toolkit-core\";\nimport { isFile } from \"@zayne-labs/toolkit-type-helpers\";\nimport type { FileWithPreview } from \"./use-drop-zone\";\n\nexport const generateUniqueId = (file: File | FileMeta): string => {\n\tif (!isFile(file)) {\n\t\treturn file.id;\n\t}\n\n\treturn `${file.name}-(${Math.round(performance.now())})-${crypto.randomUUID().slice(0, 8)}`;\n};\n\nexport const createObjectURL = (file: File, disallowPreviewForNonImageFiles: boolean) => {\n\tif (disallowPreviewForNonImageFiles && !file.type.startsWith(\"image/\")) return;\n\n\treturn createImagePreview(file);\n};\n\nexport const clearObjectURL = (\n\tfileWithPreview: FileWithPreview | undefined,\n\tdisallowPreviewForNonImageFiles: boolean\n) => {\n\tif (!isFile(fileWithPreview?.file)) return;\n\n\tif (disallowPreviewForNonImageFiles && !fileWithPreview.file.type.startsWith(\"image/\")) return;\n\n\tif (!fileWithPreview.preview) return;\n\n\tURL.revokeObjectURL(fileWithPreview.preview);\n};\n","import { cnMerge } from \"@/lib/utils/cn\";\nimport { dataAttr } from \"@zayne-labs/toolkit-core\";\nimport {\n\ttype FileMeta,\n\ttype FileValidationErrorContext,\n\ttype FileValidationOptions,\n\thandleFileValidation,\n\ttoArray,\n} from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport {\n\ttype InferProps,\n\tcomposeRefs,\n\tcomposeTwoEventHandlers,\n\tmergeTwoProps,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport { type Prettify, isString } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\nimport { clearObjectURL, createObjectURL, generateUniqueId } from \"./utils\";\n\nexport type ContainerProps = InferProps<HTMLElement> & {\n\tclassNames?: {\n\t\tbase?: string;\n\t\tisDragging?: string;\n\t};\n};\n\nexport type InputProps = InferProps<\"input\">;\n\nexport type FileWithPreview = {\n\t/**\n\t * File object or file metadata\n\t */\n\tfile: File | FileMeta;\n\t/**\n\t * Unique ID for the file\n\t */\n\tid: string;\n\t/**\n\t * Preview URL for the file\n\t * - Will be undefined if `disallowPreviewForNonImageFiles` is set to `true` and the file is not an image\n\t * - Can also be undefined if `URL.createObjectURL` fails\n\t */\n\tpreview: string | undefined;\n};\n\nexport type DropZoneState = {\n\t/**\n\t * List of validation errors\n\t */\n\terrors: FileValidationErrorContext[];\n\t/**\n\t * List of files with their preview URLs and unique IDs\n\t */\n\tfilesWithPreview: FileWithPreview[];\n\t/**\n\t * Whether or not a file is currently being dragged over the drop zone\n\t */\n\tisDragging: boolean;\n};\n\ntype ChangeOrDragEvent = React.ChangeEvent<HTMLInputElement> | React.DragEvent<HTMLElement>;\n\nexport type DropZoneActions = {\n\taddFiles: (fileList: File[] | FileList | null, event?: ChangeOrDragEvent) => void;\n\tclearErrors: () => void;\n\tclearFiles: () => void;\n\thandleDragEnter: (event: React.DragEvent<HTMLElement>) => void;\n\thandleDragLeave: (event: React.DragEvent<HTMLElement>) => void;\n\thandleDragOver: (event: React.DragEvent<HTMLElement>) => void;\n\thandleFileUpload: (event: ChangeOrDragEvent) => void;\n\topenFilePicker: () => void;\n\tremoveFile: (fileToRemoveOrId: string | FileWithPreview) => void;\n};\n\nexport type UseDropZoneResult = {\n\tdropZoneActions: DropZoneActions;\n\tdropZoneState: DropZoneState;\n\tgetContainerProps: (containerProps?: ContainerProps) => ContainerProps;\n\tgetInputProps: (inputProps?: InputProps) => InputProps;\n\tinputRef: React.RefObject<HTMLInputElement | null>;\n};\n\nexport type UseDropZoneProps = {\n\t/**\n\t * Allowed file types to be uploaded.\n\t */\n\tallowedFileTypes?: string[];\n\n\t/**\n\t * CSS classes to apply to the various parts of the drop zone\n\t */\n\tclassNames?: Prettify<ContainerProps[\"classNames\"] & { input?: string }>;\n\n\t/**\n\t * Whether to disallow duplicate files\n\t * @default true\n\t */\n\tdisallowDuplicates?: boolean;\n\n\t/**\n\t * Whether to disallow preview for non-image files\n\t * @default true\n\t */\n\tdisallowPreviewForNonImageFiles?: boolean;\n\n\t/**\n\t * Extra props to pass to the container element\n\t */\n\textraContainerProps?: ContainerProps;\n\n\t/**\n\t * Extra props to pass to the input element\n\t */\n\textraInputProps?: InputProps;\n\n\t/**\n\t * Initial files to populate the drop zone\n\t */\n\tinitialFiles?: FileMeta | FileMeta[] | null;\n\n\t/**\n\t * Maximum number of files that can be uploaded.\n\t */\n\tmaxFileCount?: number;\n\n\t/**\n\t * Maximum file size in MB\n\t */\n\tmaxFileSize?: number;\n\n\t/**\n\t * Whether to allow multiple files to be uploaded\n\t */\n\tmultiple?: boolean;\n\n\t/**\n\t * Callback function to be called when internal files state changes\n\t */\n\tonFilesChange?: (context: { filesWithPreview: FileWithPreview[] }) => void;\n\n\t/**\n\t * Callback function to be called when the render props change\n\t */\n\tonRenderPropsChange?: (props: UseDropZoneResult) => void;\n\n\t/**\n\t * Callback function to be called when new files are uploaded\n\t */\n\tonUpload?: (context: { event: ChangeOrDragEvent; filesWithPreview: FileWithPreview[] }) => void;\n\n\t/**\n\t * Callback function to be called on each file upload as they occur\n\t */\n\tonUploadError?: FileValidationOptions[\"onError\"];\n\n\t/**\n\t * Callback function to be called once after all file upload errors have occurred\n\t */\n\tonUploadErrors?: FileValidationOptions[\"onErrors\"];\n\n\t/**\n\t * Callback function to be called on file upload success\n\t */\n\tonUploadSuccess?: FileValidationOptions[\"onSuccess\"];\n\n\t/**\n\t * Custom validation function.\n\t *\n\t * If the function returns false, the file will be rejected\n\t */\n\tvalidator?: NonNullable<FileValidationOptions[\"validationSettings\"]>[\"validator\"];\n\n\t/**\n\t * Custom validation function that runs after all file validation has occurred\n\t */\n\tvalidatorForAllFiles?: FileValidationOptions[\"validatorForAllFiles\"];\n\n\t/**\n\t * Whether to allow the default file picker via the file input element\n\t * @default true\n\t */\n\twithDefaultFilePicker?: boolean;\n};\n\nexport const useDropZone = (props?: UseDropZoneProps): UseDropZoneResult => {\n\tconst {\n\t\tallowedFileTypes,\n\t\tclassNames,\n\t\tdisallowDuplicates = true,\n\t\tdisallowPreviewForNonImageFiles = true,\n\t\textraContainerProps,\n\t\textraInputProps,\n\t\tinitialFiles,\n\t\tmaxFileCount,\n\t\tmaxFileSize,\n\t\tmultiple,\n\t\tonFilesChange,\n\t\tonRenderPropsChange,\n\t\tonUpload,\n\t\tonUploadError,\n\t\tonUploadErrors,\n\t\tonUploadSuccess,\n\t\tvalidator,\n\t\tvalidatorForAllFiles,\n\t\twithDefaultFilePicker = true,\n\t} = props ?? {};\n\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\tconst initialFileArray = toArray(initialFiles).filter(Boolean);\n\n\tconst [dropZoneState, setDropZoneState] = useState<DropZoneState>({\n\t\terrors: [],\n\t\tfilesWithPreview: initialFileArray.map((fileMeta) => ({\n\t\t\tfile: fileMeta,\n\t\t\tid: fileMeta.id,\n\t\t\tpreview: fileMeta.url,\n\t\t})),\n\t\tisDragging: false,\n\t});\n\n\tconst toggleIsDragging = (value: boolean) => {\n\t\tsetDropZoneState((prevState) => ({ ...prevState, isDragging: value }));\n\t};\n\n\tconst addFiles: DropZoneActions[\"addFiles\"] = useCallbackRef((fileList, event) => {\n\t\tif (!fileList || fileList.length === 0) {\n\t\t\tconsole.warn(\"No file selected!\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Clear existing errors when new files are uploaded\n\t\tclearErrors();\n\n\t\t// In single file mode, clear existing files first\n\t\tif (!multiple) {\n\t\t\tclearFiles();\n\t\t}\n\n\t\tconst { errors, validFiles } = handleFileValidation({\n\t\t\texistingFiles: dropZoneState.filesWithPreview.map((fileWithPreview) => fileWithPreview.file),\n\t\t\tnewFiles: fileList,\n\t\t\tonError: onUploadError,\n\t\t\tonErrors: onUploadErrors,\n\t\t\tonSuccess: onUploadSuccess,\n\t\t\tvalidationSettings: {\n\t\t\t\tallowedFileTypes,\n\t\t\t\tdisallowDuplicates,\n\t\t\t\tmaxFileCount,\n\t\t\t\tmaxFileSize,\n\t\t\t\tvalidator,\n\t\t\t},\n\t\t\tvalidatorForAllFiles,\n\t\t});\n\n\t\tif (validFiles.length === 0) {\n\t\t\tsetDropZoneState((prevState) => ({ ...prevState, errors }));\n\t\t\treturn;\n\t\t}\n\n\t\tconst filesWithPreview: FileWithPreview[] = validFiles.map((file) => ({\n\t\t\tfile,\n\t\t\tid: generateUniqueId(file),\n\t\t\tpreview: createObjectURL(file, disallowPreviewForNonImageFiles),\n\t\t}));\n\n\t\t// == Only call onUpload callback if event is provided, which indicates that new files were uploaded from an event handler\n\n\t\tif (event) {\n\t\t\tonUpload?.({ event, filesWithPreview });\n\t\t}\n\n\t\tconst newFileUploadState = {\n\t\t\t...dropZoneState,\n\t\t\terrors,\n\t\t\t...(event?.type === \"drop\" && { isDragging: false }),\n\t\t\tfilesWithPreview: multiple\n\t\t\t\t? [...dropZoneState.filesWithPreview, ...filesWithPreview]\n\t\t\t\t: filesWithPreview,\n\t\t} satisfies DropZoneState;\n\n\t\tonFilesChange?.({ filesWithPreview: newFileUploadState.filesWithPreview });\n\n\t\tsetDropZoneState(newFileUploadState);\n\n\t\t// == Reset input value after adding files\n\t\tinputRef.current && (inputRef.current.value = \"\");\n\t});\n\n\tconst clearFiles: DropZoneActions[\"clearFiles\"] = useCallbackRef(() => {\n\t\t// == Clean up object URLs if any\n\t\tdropZoneState.filesWithPreview.forEach((fileWithPreview) =>\n\t\t\tclearObjectURL(fileWithPreview, disallowPreviewForNonImageFiles)\n\t\t);\n\n\t\tconst newFileUploadState = {\n\t\t\t...dropZoneState,\n\t\t\terrors: [],\n\t\t\tfilesWithPreview: [],\n\t\t} satisfies DropZoneState;\n\n\t\tonFilesChange?.({ filesWithPreview: newFileUploadState.filesWithPreview });\n\n\t\tsetDropZoneState(newFileUploadState);\n\n\t\t// == Reset input value after clearing files\n\t\tinputRef.current && (inputRef.current.value = \"\");\n\t});\n\n\tconst removeFile: DropZoneActions[\"removeFile\"] = useCallbackRef((fileToRemoveOrId) => {\n\t\tconst actualFileToRemove = isString(fileToRemoveOrId)\n\t\t\t? dropZoneState.filesWithPreview.find((file) => file.id === fileToRemoveOrId)\n\t\t\t: fileToRemoveOrId;\n\n\t\tif (!actualFileToRemove) return;\n\n\t\tclearObjectURL(actualFileToRemove, disallowPreviewForNonImageFiles);\n\n\t\tconst newFilesWithPreview = dropZoneState.filesWithPreview.filter(\n\t\t\t(file) => file.id !== actualFileToRemove.id\n\t\t);\n\n\t\tonFilesChange?.({ filesWithPreview: newFilesWithPreview });\n\n\t\tsetDropZoneState({\n\t\t\t...dropZoneState,\n\t\t\terrors: [],\n\t\t\tfilesWithPreview: newFilesWithPreview,\n\t\t});\n\t});\n\n\tconst clearErrors: DropZoneActions[\"clearErrors\"] = useCallbackRef(() => {\n\t\tsetDropZoneState((prevState) => ({ ...prevState, errors: [] }));\n\t});\n\n\tconst handleFileUpload: DropZoneActions[\"handleFileUpload\"] = useCallbackRef((event) => {\n\t\tif (inputRef.current?.disabled) return;\n\n\t\tif (event.type === \"drop\") {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t}\n\n\t\tconst fileList =\n\t\t\tevent.type === \"drop\"\n\t\t\t\t? (event as React.DragEvent).dataTransfer.files\n\t\t\t\t: (event as React.ChangeEvent<HTMLInputElement>).target.files;\n\n\t\t// == In single file mode, only use the first file\n\t\tif (!multiple) {\n\t\t\tconst firstFile = fileList?.[0];\n\n\t\t\tfirstFile && addFiles([firstFile], event);\n\n\t\t\treturn;\n\t\t}\n\n\t\taddFiles(fileList, event);\n\t});\n\n\tconst handleDragEnter: DropZoneActions[\"handleDragEnter\"] = useCallbackRef((event) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\ttoggleIsDragging(true);\n\t});\n\n\tconst handleDragOver: DropZoneActions[\"handleDragOver\"] = useCallbackRef((event) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\ttoggleIsDragging(true);\n\t});\n\n\tconst handleDragLeave: DropZoneActions[\"handleDragLeave\"] = useCallbackRef((event) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\ttoggleIsDragging(false);\n\t});\n\n\tconst openFilePicker: DropZoneActions[\"openFilePicker\"] = useCallbackRef(() => {\n\t\tinputRef.current?.click();\n\t});\n\n\tconst getContainerProps: UseDropZoneResult[\"getContainerProps\"] = useCallback(\n\t\t(containerProps) => {\n\t\t\tconst mergedContainerProps = mergeTwoProps(extraContainerProps, containerProps);\n\n\t\t\treturn {\n\t\t\t\t...mergedContainerProps,\n\t\t\t\tclassName: cnMerge(\n\t\t\t\t\t\"relative isolate flex flex-col\",\n\t\t\t\t\tmergedContainerProps.className,\n\t\t\t\t\tclassNames?.base,\n\t\t\t\t\tdropZoneState.isDragging && [\n\t\t\t\t\t\t\"opacity-60\",\n\t\t\t\t\t\tclassNames?.isDragging,\n\t\t\t\t\t\tcontainerProps?.classNames?.isDragging,\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\t\"data-dragging\": dataAttr(dropZoneState.isDragging),\n\t\t\t\t\"data-scope\": \"dropzone\",\n\t\t\t\t// eslint-disable-next-line perfectionist/sort-objects -- I need data-scope to be first\n\t\t\t\t\"data-part\": \"container\",\n\t\t\t\t\"data-slot\": \"dropzone-container\",\n\t\t\t\tonDragEnter: composeTwoEventHandlers(handleDragEnter, mergedContainerProps.onDragEnter),\n\t\t\t\tonDragLeave: composeTwoEventHandlers(handleDragLeave, mergedContainerProps.onDragLeave),\n\t\t\t\tonDragOver: composeTwoEventHandlers(handleDragOver, mergedContainerProps.onDragOver),\n\t\t\t\tonDrop: composeTwoEventHandlers(handleFileUpload, mergedContainerProps.onDrop),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tclassNames?.base,\n\t\t\tclassNames?.isDragging,\n\t\t\textraContainerProps,\n\t\t\tdropZoneState.isDragging,\n\t\t\thandleDragEnter,\n\t\t\thandleDragLeave,\n\t\t\thandleDragOver,\n\t\t\thandleFileUpload,\n\t\t]\n\t);\n\n\tconst getInputProps: UseDropZoneResult[\"getInputProps\"] = useCallback(\n\t\t(inputProps) => {\n\t\t\tconst mergedInputProps = mergeTwoProps(extraInputProps, inputProps);\n\n\t\t\treturn {\n\t\t\t\t...mergedInputProps,\n\t\t\t\taccept: allowedFileTypes ? allowedFileTypes.join(\", \") : mergedInputProps.accept,\n\t\t\t\tclassName: cnMerge(\n\t\t\t\t\twithDefaultFilePicker ? \"absolute inset-0 z-[100] cursor-pointer opacity-0\" : \"hidden\",\n\t\t\t\t\tclassNames?.input,\n\t\t\t\t\tmergedInputProps.className\n\t\t\t\t),\n\t\t\t\t\"data-dragging\": dataAttr(dropZoneState.isDragging),\n\t\t\t\t\"data-scope\": \"dropzone\",\n\t\t\t\t// eslint-disable-next-line perfectionist/sort-objects -- I need data-scope to be first\n\t\t\t\t\"data-part\": \"input\",\n\t\t\t\t\"data-slot\": \"dropzone-input\",\n\t\t\t\tmultiple: multiple ?? mergedInputProps.multiple,\n\t\t\t\tonChange: composeTwoEventHandlers(handleFileUpload, mergedInputProps.onChange),\n\t\t\t\tref: composeRefs(inputRef, mergedInputProps.ref),\n\t\t\t\ttype: \"file\",\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tallowedFileTypes,\n\t\t\tclassNames?.input,\n\t\t\textraInputProps,\n\t\t\tdropZoneState.isDragging,\n\t\t\thandleFileUpload,\n\t\t\tmultiple,\n\t\t\twithDefaultFilePicker,\n\t\t]\n\t);\n\n\tconst savedOnRenderPropsChange = useCallbackRef(onRenderPropsChange);\n\n\tconst dropZoneResult = useMemo(() => {\n\t\tconst propsForRenderFn = {\n\t\t\tdropZoneActions: {\n\t\t\t\taddFiles,\n\t\t\t\tclearErrors,\n\t\t\t\tclearFiles,\n\t\t\t\thandleDragEnter,\n\t\t\t\thandleDragLeave,\n\t\t\t\thandleDragOver,\n\t\t\t\thandleFileUpload,\n\t\t\t\topenFilePicker,\n\t\t\t\tremoveFile,\n\t\t\t},\n\t\t\tdropZoneState,\n\t\t\tgetContainerProps,\n\t\t\tgetInputProps,\n\t\t\tinputRef,\n\t\t} satisfies UseDropZoneResult;\n\n\t\tsavedOnRenderPropsChange(propsForRenderFn);\n\n\t\treturn propsForRenderFn;\n\t}, [\n\t\tsavedOnRenderPropsChange,\n\t\taddFiles,\n\t\tclearErrors,\n\t\tclearFiles,\n\t\tdropZoneState,\n\t\tgetInputProps,\n\t\tgetContainerProps,\n\t\thandleDragEnter,\n\t\thandleDragLeave,\n\t\thandleDragOver,\n\t\thandleFileUpload,\n\t\topenFilePicker,\n\t\tremoveFile,\n\t]);\n\n\treturn dropZoneResult;\n};\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { Show, Slot } from \"@/components/common\";\nimport { type GetSlotComponentProps, getSlotMap, withSlotNameAndSymbol } from \"@/lib/utils/getSlotMap\";\nimport type { DiscriminatedRenderProps, PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { isArray, isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Fragment as ReactFragment, isValidElement } from \"react\";\nimport { DropZoneContextProvider, useDropZoneContext } from \"./drop-context\";\nimport {\n\ttype ContainerProps,\n\ttype InputProps,\n\ttype UseDropZoneProps,\n\ttype UseDropZoneResult,\n\tuseDropZone,\n} from \"./use-drop-zone\";\n\nexport type DropZoneRenderPropType = DiscriminatedRenderProps<\n\tReact.ReactNode | ((props: UseDropZoneResult) => React.ReactNode)\n>;\n\nexport type DropZoneRootProps = DropZoneRenderPropType\n\t& UseDropZoneProps & {\n\t\t/**\n\t\t * Controls whether to include internal elements (root and input) or not.\n\t\t */\n\t\twithInternalElements?: boolean;\n\t};\n\nexport function DropZoneRoot(props: DropZoneRootProps) {\n\tconst { children, render, withInternalElements = true, ...restOfProps } = props;\n\n\tconst dropZone = useDropZone(restOfProps);\n\n\tconst ContainerComponent = withInternalElements ? DropZoneContainer : ReactFragment;\n\tconst InputComponent = withInternalElements ? DropZoneInput : ReactFragment;\n\n\tconst selectedChildren = children ?? render;\n\n\tconst resolvedChildren = isFunction(selectedChildren) ? selectedChildren(dropZone) : selectedChildren;\n\n\tconst couldChildrenContainSlots =\n\t\tisArray(resolvedChildren)\n\t\t|| (isValidElement(resolvedChildren) && resolvedChildren.type === ReactFragment);\n\n\tconst slots =\n\t\twithInternalElements && couldChildrenContainSlots\n\t\t\t? getSlotMap<SlotComponentProps>(resolvedChildren)\n\t\t\t: ({ default: resolvedChildren } as ReturnType<typeof getSlotMap<SlotComponentProps>>);\n\n\treturn (\n\t\t<DropZoneContextProvider value={dropZone}>\n\t\t\t<ContainerComponent>\n\t\t\t\t<InputComponent />\n\n\t\t\t\t{slots.default}\n\t\t\t</ContainerComponent>\n\n\t\t\t{slots.preview}\n\t\t</DropZoneContextProvider>\n\t);\n}\n\ntype DropZoneInputProps = InputProps & { asChild?: boolean };\n\nexport function DropZoneInput(props: DropZoneInputProps) {\n\tconst { asChild, ...restOfProps } = props;\n\n\tconst dropZoneContext = useDropZoneContext();\n\n\tconst Component = asChild ? Slot.Root : \"input\";\n\n\treturn <Component {...dropZoneContext.getInputProps(restOfProps)} />;\n}\n\ntype DropZoneContainerProps = ContainerProps & { asChild?: boolean };\n\nexport function DropZoneContainer<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement, DropZoneContainerProps>\n) {\n\tconst { as: Element = \"div\", asChild, ...restOfProps } = props;\n\n\tconst dropZoneContext = useDropZoneContext();\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn <Component {...dropZoneContext.getContainerProps(restOfProps)} />;\n}\n\ntype RenderPropFn = (props: UseDropZoneResult) => React.ReactNode;\n\ntype SlotComponentProps = GetSlotComponentProps<\"preview\", React.ReactNode | RenderPropFn>;\n\nexport function DropZoneContext(props: { children: RenderPropFn }) {\n\tconst { children } = props;\n\n\tconst dropZoneContext = useDropZoneContext();\n\n\treturn children(dropZoneContext);\n}\n\nexport const DropZoneImagePreview = withSlotNameAndSymbol<SlotComponentProps>(\"preview\", (props) => {\n\tconst { children } = props;\n\n\tif (isFunction(children)) {\n\t\treturn (\n\t\t\t<DropZoneContext>\n\t\t\t\t{(dropZoneCtx) => (\n\t\t\t\t\t<Show.Root when={dropZoneCtx.dropZoneState.filesWithPreview.length > 0}>\n\t\t\t\t\t\t{children(dropZoneCtx)}\n\t\t\t\t\t</Show.Root>\n\t\t\t\t)}\n\t\t\t</DropZoneContext>\n\t\t);\n\t}\n\n\treturn children;\n});\n","export {\n\tDropZoneRoot as Root,\n\tDropZoneImagePreview as ImagePreview,\n\tDropZoneContext as Context,\n\tDropZoneInput as Input,\n\tDropZoneContainer as Container,\n} from \"./drop-zone\";\n"],"mappings":";;;;;;;;;;;;;AAGA,MAAM,CAAC,yBAAyB,mBAAmB,GAAG,oBAAuC;CAC5F,UAAU;CACV,MAAM;CACN,cAAc;AACd,EAAC;;;;ACHF,MAAa,mBAAmB,CAACA,SAAkC;AAClE,MAAK,OAAO,KAAK,CAChB,QAAO,KAAK;AAGb,SAAQ,EAAE,KAAK,KAAK,IAAI,KAAK,MAAM,YAAY,KAAK,CAAC,CAAC,IAAI,OAAO,YAAY,CAAC,MAAM,GAAG,EAAE,CAAC;AAC1F;AAED,MAAa,kBAAkB,CAACC,MAAYC,oCAA6C;AACxF,KAAI,oCAAoC,KAAK,KAAK,WAAW,SAAS,CAAE;AAExE,QAAO,mBAAmB,KAAK;AAC/B;AAED,MAAa,iBAAiB,CAC7BC,iBACAD,oCACI;AACJ,MAAK,OAAO,iBAAiB,KAAK,CAAE;AAEpC,KAAI,oCAAoC,gBAAgB,KAAK,KAAK,WAAW,SAAS,CAAE;AAExF,MAAK,gBAAgB,QAAS;AAE9B,KAAI,gBAAgB,gBAAgB,QAAQ;AAC5C;;;;AC4JD,MAAa,cAAc,CAACE,UAAgD;CAC3E,MAAM,EACL,kBACA,YACA,qBAAqB,MACrB,kCAAkC,MAClC,qBACA,iBACA,cACA,cACA,aACA,UACA,eACA,qBACA,UACA,eACA,gBACA,iBACA,WACA,sBACA,wBAAwB,MACxB,GAAG,SAAS,CAAE;CAEf,MAAM,WAAW,OAAyB,KAAK;CAE/C,MAAM,mBAAmB,QAAQ,aAAa,CAAC,OAAO,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AE,IAAI,UAAU,OAAO,QAAS,GAAG,aAAa,GAAG;CAEzD,MAAM,kBAAkB,oBAAoB;CAE5C,MAAMD,cAAY,qBAAsB;AAExC,wBAAO,IAACA,eAAU,GAAI,gBAAgB,kBAAkB,YAAY,GAAI;AACxE;AAMD,SAAgB,gBAAgBE,OAAmC;CAClE,MAAM,EAAE,UAAU,GAAG;CAErB,MAAM,kBAAkB,oBAAoB;AAE5C,QAAO,SAAS,gBAAgB;AAChC;AAED,MAAa,uBAAuB,sBAA0C,WAAW,CAAC,UAAU;CACnG,MAAM,EAAE,UAAU,GAAG;AAErB,KAAI,WAAW,SAAS,CACvB,wBACC,IAAC,6BACC,CAAC,gCACD;EAAW,MAAM,YAAY,cAAc,iBAAiB,SAAS;YACnE,SAAS,YAAY;GACX,GAEI;AAIpB,QAAO;AACP,EAAC"}
@@ -1,5 +1,5 @@
1
1
  import { __export } from "./chunk-Cl8Af3a2.js";
2
- import { getMultipleSlots$1 as getMultipleSlots } from "./getSlot-BIcGgBwN.js";
2
+ import { getMultipleSlots } from "./getSlot-D1_uG-Ym.js";
3
3
  import { SlotRoot } from "./slot-RXTKo4L7.js";
4
4
  import { getElementList } from "./for-aTw1TgJo.js";
5
5
  import { cnMerge } from "./cn-_FbtIrlZ.js";
@@ -587,4 +587,4 @@ __export(form_parts_exports, {
587
587
 
588
588
  //#endregion
589
589
  export { FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormField, FormFieldContext, FormFieldControlledField, FormFieldController, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormLabel, FormRoot, FormSelect, FormSelectPrimitive, FormSubmit, FormSubscribeToFieldValue, FormSubscribeToFormState, FormTextArea, FormTextAreaPrimitive, form_parts_exports, useFormRootContext, useStrictFormFieldContext };
590
- //# sourceMappingURL=form-DytCfL6R.js.map
590
+ //# sourceMappingURL=form-CUlTG3KI.js.map