@zayne-labs/ui-react 0.11.3 → 0.11.5

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 (68) hide show
  1. package/dist/{esm → components}/common/await/index.d.ts +4 -4
  2. package/dist/{esm → components}/common/await/index.js +18 -9
  3. package/dist/components/common/await/index.js.map +1 -0
  4. package/dist/components/common/error-boundary/index.d.ts +2 -0
  5. package/dist/{esm → components}/common/error-boundary/index.js +1 -1
  6. package/dist/components/common/presence/index.js +3 -0
  7. package/dist/{esm → components}/common/show/index.js +1 -1
  8. package/dist/components/common/suspense-with-boundary/index.d.ts +2 -0
  9. package/dist/{esm → components}/common/suspense-with-boundary/index.js +5 -6
  10. package/dist/components/common/suspense-with-boundary/index.js.map +1 -0
  11. package/dist/{esm/error-boundary-C4btQhu_.js → components/error-boundary-BOZ3EvMt.js} +33 -31
  12. package/dist/components/error-boundary-BOZ3EvMt.js.map +1 -0
  13. package/dist/{esm/index-DC9fblW0.d.ts → components/index-BmD5l0L7.d.ts} +9 -11
  14. package/dist/{esm/index-D_Ntazyt.d.ts → components/index-dmMYkH2c.d.ts} +4 -7
  15. package/dist/{esm/presence-CHd9s3IS.js → components/presence-DkWhm7xu.js} +3 -3
  16. package/dist/{esm/presence-CHd9s3IS.js.map → components/presence-DkWhm7xu.js.map} +1 -1
  17. package/dist/{esm/show-BzfAw7y3.js → components/show-CMxdpPiN.js} +2 -2
  18. package/dist/components/show-CMxdpPiN.js.map +1 -0
  19. package/dist/{esm → components}/ui/carousel/index.d.ts +9 -12
  20. package/dist/{esm → components}/ui/carousel/index.js +58 -65
  21. package/dist/components/ui/carousel/index.js.map +1 -0
  22. package/dist/{esm → components}/ui/drag-scroll/index.d.ts +1 -9
  23. package/dist/{esm → components}/ui/drag-scroll/index.js +15 -27
  24. package/dist/components/ui/drag-scroll/index.js.map +1 -0
  25. package/dist/{esm → components}/ui/drop-zone/index.d.ts +21 -17
  26. package/dist/{esm → components}/ui/drop-zone/index.js +54 -23
  27. package/dist/components/ui/drop-zone/index.js.map +1 -0
  28. package/dist/{esm → components}/ui/form/index.js +11 -8
  29. package/dist/{esm → components}/ui/form/index.js.map +1 -1
  30. package/dist/style.css +22 -50
  31. package/package.json +8 -8
  32. package/dist/esm/common/await/index.js.map +0 -1
  33. package/dist/esm/common/error-boundary/index.d.ts +0 -2
  34. package/dist/esm/common/presence/index.js +0 -3
  35. package/dist/esm/common/suspense-with-boundary/index.d.ts +0 -2
  36. package/dist/esm/common/suspense-with-boundary/index.js.map +0 -1
  37. package/dist/esm/error-boundary-C4btQhu_.js.map +0 -1
  38. package/dist/esm/show-BzfAw7y3.js.map +0 -1
  39. package/dist/esm/ui/carousel/index.js.map +0 -1
  40. package/dist/esm/ui/drag-scroll/index.js.map +0 -1
  41. package/dist/esm/ui/drop-zone/index.js.map +0 -1
  42. /package/dist/{esm → components}/chunk-pbuEa-1d.js +0 -0
  43. /package/dist/{esm → components}/cn-jNZfGhrk.js +0 -0
  44. /package/dist/{esm → components}/cn-jNZfGhrk.js.map +0 -0
  45. /package/dist/{esm → components}/common/client-gate/index.d.ts +0 -0
  46. /package/dist/{esm → components}/common/client-gate/index.js +0 -0
  47. /package/dist/{esm → components}/common/client-gate/index.js.map +0 -0
  48. /package/dist/{esm → components}/common/for/index.d.ts +0 -0
  49. /package/dist/{esm → components}/common/for/index.js +0 -0
  50. /package/dist/{esm → components}/common/presence/index.d.ts +0 -0
  51. /package/dist/{esm → components}/common/show/index.d.ts +0 -0
  52. /package/dist/{esm → components}/common/slot/index.d.ts +0 -0
  53. /package/dist/{esm → components}/common/slot/index.js +0 -0
  54. /package/dist/{esm → components}/common/switch/index.d.ts +0 -0
  55. /package/dist/{esm → components}/common/switch/index.js +0 -0
  56. /package/dist/{esm → components}/common/teleport/index.d.ts +0 -0
  57. /package/dist/{esm → components}/common/teleport/index.js +0 -0
  58. /package/dist/{esm → components}/common/teleport/index.js.map +0 -0
  59. /package/dist/{esm → components}/for-DGTMIS0w.js +0 -0
  60. /package/dist/{esm → components}/for-DGTMIS0w.js.map +0 -0
  61. /package/dist/{esm → components}/slot-DuwoiC2C.js +0 -0
  62. /package/dist/{esm → components}/slot-DuwoiC2C.js.map +0 -0
  63. /package/dist/{esm → components}/switch-Dwy5Gzsb.js +0 -0
  64. /package/dist/{esm → components}/switch-Dwy5Gzsb.js.map +0 -0
  65. /package/dist/{esm → components}/ui/card/index.d.ts +0 -0
  66. /package/dist/{esm → components}/ui/card/index.js +0 -0
  67. /package/dist/{esm → components}/ui/card/index.js.map +0 -0
  68. /package/dist/{esm → components}/ui/form/index.d.ts +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["Slot.Root"],"sources":["../../../../src/components/ui/drag-scroll/utils.ts","../../../../src/components/ui/drag-scroll/drag-scroll-store.ts","../../../../src/components/ui/drag-scroll/use-drag-scroll.ts","../../../../src/components/ui/drag-scroll/drag-scroll-context.ts","../../../../src/components/ui/drag-scroll/drag-scroll.tsx","../../../../src/components/ui/drag-scroll/drag-scroll-parts.ts"],"sourcesContent":["import { checkIsDeviceMobile } from \"@zayne-labs/toolkit-core\";\n\n/* eslint-disable no-param-reassign -- Mutation is needed here since it's an element */\nexport const updateCursor = <TElement extends HTMLElement>(element: TElement) => {\n\telement.style.cursor = \"grabbing\";\n\telement.style.userSelect = \"none\";\n};\n\nexport const onScrollSnap = <TElement extends HTMLElement>(\n\taction: \"remove\" | \"reset\",\n\telement: TElement\n) => {\n\tif (action === \"remove\") {\n\t\telement.style.scrollSnapType = \"none\";\n\t\treturn;\n\t}\n\n\telement.style.scrollSnapType = \"\";\n};\n\nexport const resetCursor = <TElement extends HTMLElement>(element: TElement) => {\n\telement.style.cursor = \"\";\n\telement.style.userSelect = \"\";\n};\n/* eslint-enable no-param-reassign -- Mutation is needed here since it's an element */\n\nexport const handleScrollSnap = (dragContainer: HTMLElement) => {\n\tconst isMobile = checkIsDeviceMobile();\n\n\tif (!isMobile) {\n\t\tonScrollSnap(\"remove\", dragContainer);\n\t} else {\n\t\tonScrollSnap(\"reset\", dragContainer);\n\t}\n};\n","import { createStore, on, throttleByFrame } from \"@zayne-labs/toolkit-core\";\nimport { isNumber } from \"@zayne-labs/toolkit-type-helpers\";\nimport type { DragScrollStore, UseDragScrollProps } from \"./types\";\nimport { handleScrollSnap, resetCursor, updateCursor } from \"./utils\";\n\ntype RequiredUseDragScrollProps = {\n\t[Key in keyof Required<UseDragScrollProps>]: UseDragScrollProps[Key] | undefined;\n};\n\ntype InitStoreValues = Pick<RequiredUseDragScrollProps, \"orientation\" | \"scrollAmount\" | \"usage\">;\n\nexport const createDragScrollStore = (initStoreValues: InitStoreValues) => {\n\tconst { orientation = \"horizontal\", scrollAmount = \"item\", usage = \"allScreens\" } = initStoreValues;\n\n\tconst listRef: React.RefObject<HTMLElement | null> = {\n\t\tcurrent: null,\n\t};\n\n\tconst positionRef = {\n\t\tcurrent: {\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t},\n\t};\n\n\tconst abortControllerRef = {\n\t\tcurrent: {\n\t\t\tmouseLeave: new AbortController(),\n\t\t\tmouseMove: new AbortController(),\n\t\t\tmouseUp: new AbortController(),\n\t\t},\n\t};\n\n\t// == Calculate scroll amount based on orientation and settings\n\tconst getScrollAmount = (container: HTMLElement): number => {\n\t\tif (isNumber(scrollAmount)) {\n\t\t\treturn scrollAmount;\n\t\t}\n\n\t\tconst firstChild = container.children[0] as HTMLElement | undefined;\n\n\t\tif (!firstChild) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn orientation === \"vertical\" || orientation === \"both\" ?\n\t\t\t\tfirstChild.offsetHeight\n\t\t\t:\tfirstChild.offsetWidth;\n\t};\n\n\tconst store = createStore<DragScrollStore>((set, get) => ({\n\t\tcanGoToNext: true,\n\t\tcanGoToPrev: false,\n\t\tisDragging: false,\n\n\t\t// eslint-disable-next-line perfectionist/sort-objects -- actions should be last\n\t\tactions: {\n\t\t\tcleanupDragListeners: () => {\n\t\t\t\tabortControllerRef.current.mouseMove.abort();\n\t\t\t\tabortControllerRef.current.mouseUp.abort();\n\t\t\t\tabortControllerRef.current.mouseLeave.abort();\n\t\t\t},\n\n\t\t\tgoToNext: () => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tconst { canGoToNext } = get();\n\t\t\t\tif (!canGoToNext) return;\n\n\t\t\t\tconst amount = getScrollAmount(listRef.current);\n\n\t\t\t\tlistRef.current.scrollBy({\n\t\t\t\t\tbehavior: \"smooth\",\n\t\t\t\t\tleft: orientation === \"vertical\" ? 0 : amount,\n\t\t\t\t\ttop: orientation === \"vertical\" || orientation === \"both\" ? amount : 0,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tgoToPrev: () => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tconst { canGoToPrev } = get();\n\t\t\t\tif (!canGoToPrev) return;\n\n\t\t\t\tconst amount = getScrollAmount(listRef.current);\n\n\t\t\t\tlistRef.current.scrollBy({\n\t\t\t\t\tbehavior: \"smooth\",\n\t\t\t\t\tleft: orientation === \"vertical\" ? 0 : -amount,\n\t\t\t\t\ttop: orientation === \"vertical\" || orientation === \"both\" ? -amount : 0,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\thandleMouseDown: (event) => {\n\t\t\t\tif (usage === \"mobileAndTabletOnly\" && window.innerWidth >= 768) return;\n\t\t\t\tif (usage === \"desktopOnly\" && window.innerWidth < 768) return;\n\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\t// == Create fresh AbortControllers for each drag session (they cannot be reused after abort)\n\t\t\t\tabortControllerRef.current = {\n\t\t\t\t\tmouseLeave: new AbortController(),\n\t\t\t\t\tmouseMove: new AbortController(),\n\t\t\t\t\tmouseUp: new AbortController(),\n\t\t\t\t};\n\n\t\t\t\t// == Update all initial position properties\n\t\t\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\t\t\tpositionRef.current.x = event.clientX;\n\t\t\t\t\tpositionRef.current.left = listRef.current.scrollLeft;\n\t\t\t\t}\n\n\t\t\t\tif (orientation === \"vertical\" || orientation === \"both\") {\n\t\t\t\t\tpositionRef.current.y = event.clientY;\n\t\t\t\t\tpositionRef.current.top = listRef.current.scrollTop;\n\t\t\t\t}\n\n\t\t\t\tupdateCursor(listRef.current);\n\t\t\t\tset({ isDragging: true });\n\n\t\t\t\tconst { actions } = get();\n\n\t\t\t\ton(listRef.current, \"mousemove\", actions.handleMouseMove, {\n\t\t\t\t\tsignal: abortControllerRef.current.mouseMove.signal,\n\t\t\t\t});\n\t\t\t\ton(listRef.current, \"mouseup\", actions.handleMouseUpOrLeave, {\n\t\t\t\t\tsignal: abortControllerRef.current.mouseUp.signal,\n\t\t\t\t});\n\t\t\t\ton(listRef.current, \"mouseleave\", actions.handleMouseUpOrLeave, {\n\t\t\t\t\tsignal: abortControllerRef.current.mouseLeave.signal,\n\t\t\t\t});\n\t\t\t\t// == Document-level mouseup fallback for when user releases outside the container\n\t\t\t\ton(document, \"mouseup\", actions.handleMouseUpOrLeave, {\n\t\t\t\t\tonce: true,\n\t\t\t\t\tsignal: abortControllerRef.current.mouseUp.signal,\n\t\t\t\t});\n\t\t\t},\n\n\t\t\thandleMouseMove: (event) => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\t\t\tconst dx = event.clientX - positionRef.current.x;\n\t\t\t\t\tlistRef.current.scrollLeft = positionRef.current.left - dx;\n\t\t\t\t}\n\n\t\t\t\tif (orientation === \"vertical\" || orientation === \"both\") {\n\t\t\t\t\tconst dy = event.clientY - positionRef.current.y;\n\t\t\t\t\tlistRef.current.scrollTop = positionRef.current.top - dy;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\thandleMouseUpOrLeave: () => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tresetCursor(listRef.current);\n\t\t\t\tset({ isDragging: false });\n\n\t\t\t\tconst { actions } = get();\n\t\t\t\tactions.cleanupDragListeners();\n\t\t\t},\n\n\t\t\thandleScroll: throttleByFrame(() => {\n\t\t\t\tconst { actions } = get();\n\t\t\t\tactions.updateScrollState();\n\t\t\t}),\n\n\t\t\tinitializeResizeObserver: () => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tconst { actions } = get();\n\n\t\t\t\t// == Use ResizeObserver to detect when container or children resize\n\t\t\t\tconst resizeObserver = new ResizeObserver(() => actions.updateScrollState());\n\n\t\t\t\tresizeObserver.observe(listRef.current);\n\n\t\t\t\t// == Also observe children for size changes\n\t\t\t\tfor (const child of listRef.current.children) {\n\t\t\t\t\tresizeObserver.observe(child);\n\t\t\t\t}\n\n\t\t\t\tconst cleanup = () => {\n\t\t\t\t\tresizeObserver.disconnect();\n\t\t\t\t};\n\n\t\t\t\treturn cleanup;\n\t\t\t},\n\n\t\t\tsetListRef: (element) => {\n\t\t\t\tlistRef.current = element as HTMLElement;\n\n\t\t\t\tif (!element) return;\n\n\t\t\t\thandleScrollSnap(element);\n\n\t\t\t\tconst { actions } = get();\n\t\t\t\tactions.updateScrollState();\n\t\t\t},\n\n\t\t\tupdateScrollState: () => {\n\t\t\t\tif (!listRef.current) return;\n\n\t\t\t\tif (orientation === \"horizontal\" || orientation === \"both\") {\n\t\t\t\t\tconst { clientWidth, scrollLeft, scrollWidth } = listRef.current;\n\n\t\t\t\t\tset({\n\t\t\t\t\t\tcanGoToNext: Math.ceil(scrollLeft + clientWidth) < scrollWidth,\n\t\t\t\t\t\tcanGoToPrev: Math.floor(scrollLeft) > 0,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (orientation === \"vertical\") {\n\t\t\t\t\tconst { clientHeight, scrollHeight, scrollTop } = listRef.current;\n\n\t\t\t\t\tset({\n\t\t\t\t\t\tcanGoToNext: Math.ceil(scrollTop + clientHeight) < scrollHeight,\n\t\t\t\t\t\tcanGoToPrev: Math.floor(scrollTop) > 0,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t}));\n\n\treturn store;\n};\n","import { dataAttr, on } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef, useStore } from \"@zayne-labs/toolkit-react\";\nimport { composeRefs, composeTwoEventHandlers } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { FromCamelToKebabCase } from \"@/lib/utils/type-helpers\";\nimport { createDragScrollStore } from \"./drag-scroll-store\";\nimport type { DragScrollPropGetters, PartProps, UseDragScrollProps, UseDragScrollResult } from \"./types\";\n\nexport const getDragScrollScopeAttrs = (part: FromCamelToKebabCase<keyof PartProps>) => {\n\treturn {\n\t\t/* eslint-disable perfectionist/sort-objects -- I need this order to be maintained */\n\t\t\"data-slot\": `drag-scroll-${part}`,\n\t\t\"data-scope\": \"drag-scroll\",\n\t\t\"data-part\": part,\n\t\t/* eslint-enable perfectionist/sort-objects -- I need this order to be maintained */\n\t} as const;\n};\n\nexport const useDragScroll = <TContainerElement extends HTMLElement = HTMLElement>(\n\tprops?: UseDragScrollProps\n): UseDragScrollResult<TContainerElement> => {\n\tconst {\n\t\tdisableInternalStateSubscription = false,\n\t\torientation = \"horizontal\",\n\t\tscrollAmount = \"item\",\n\t\tusage = \"allScreens\",\n\t} = props ?? {};\n\n\tconst listRef = useRef<TContainerElement>(null);\n\n\tconst storeApi = useMemo(() => {\n\t\treturn createDragScrollStore({ orientation, scrollAmount, usage });\n\t}, [orientation, scrollAmount, usage]);\n\n\tconst actions = storeApi.getState().actions;\n\n\t/* eslint-disable react-hooks/hooks -- ignore */\n\t// eslint-disable-next-line react-x/component-hook-factories -- Ignore\n\tconst useDragScrollStore: UseDragScrollResult<TContainerElement>[\"useDragScrollStore\"] = (selector) => {\n\t\treturn useStore(storeApi as never, selector);\n\t};\n\n\tconst canGoToPrev = useDragScrollStore((state) =>\n\t\t!disableInternalStateSubscription ? state.canGoToPrev : null\n\t);\n\n\tconst canGoToNext = useDragScrollStore((state) =>\n\t\t!disableInternalStateSubscription ? state.canGoToNext : null\n\t);\n\n\tconst isDragging = useDragScrollStore((state) =>\n\t\t!disableInternalStateSubscription ? state.isDragging : null\n\t);\n\t/* eslint-enable react-hooks/hooks -- ignore */\n\n\tconst refCallback: React.RefCallback<TContainerElement> = useCallbackRef((node) => {\n\t\tlistRef.current = node;\n\t\tactions.setListRef(node);\n\n\t\tif (!node) return;\n\n\t\tconst cleanupMouseDown = on(node, \"mousedown\", actions.handleMouseDown);\n\t\tconst cleanupScroll = on(node, \"scroll\", actions.handleScroll, {\n\t\t\tpassive: true,\n\t\t});\n\n\t\treturn () => {\n\t\t\tcleanupMouseDown();\n\t\t\tcleanupScroll();\n\t\t};\n\t});\n\n\t// == Update scroll state when children might change (e.g., async loaded content)\n\tuseEffect(() => {\n\t\tconst cleanup = actions.initializeResizeObserver();\n\n\t\treturn cleanup;\n\t}, [actions]);\n\n\tconst getRootProps: DragScrollPropGetters<TContainerElement>[\"getRootProps\"] = useCallbackRef(\n\t\t(innerProps) => {\n\t\t\treturn {\n\t\t\t\t...getDragScrollScopeAttrs(\"root\"),\n\t\t\t\t...innerProps,\n\t\t\t\tclassName: cnMerge(\"relative\", innerProps?.className),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst getListProps: DragScrollPropGetters<TContainerElement>[\"getListProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\treturn {\n\t\t\t\t...getDragScrollScopeAttrs(\"list\"),\n\t\t\t\t...(!disableInternalStateSubscription && {\n\t\t\t\t\t\"data-dragging\": dataAttr(isDragging),\n\t\t\t\t}),\n\t\t\t\t...innerProps,\n\t\t\t\tclassName: cnMerge(\n\t\t\t\t\t`scrollbar-hidden flex w-full cursor-grab snap-x snap-mandatory overflow-x-scroll overflow-y-hidden`,\n\t\t\t\t\torientation === \"horizontal\" && \"flex-row\",\n\t\t\t\t\torientation === \"vertical\" && \"flex-col\",\n\t\t\t\t\tusage === \"mobileAndTabletOnly\" && \"md:cursor-default md:flex-col\",\n\t\t\t\t\tusage === \"desktopOnly\" && \"max-md:cursor-default max-md:flex-col\",\n\t\t\t\t\tinnerProps?.className\n\t\t\t\t),\n\t\t\t\tref: composeRefs(\n\t\t\t\t\trefCallback,\n\t\t\t\t\t(innerProps as { ref?: React.Ref<TContainerElement> } | undefined)?.ref\n\t\t\t\t),\n\t\t\t} as never;\n\t\t},\n\t\t[disableInternalStateSubscription, isDragging, orientation, refCallback, usage]\n\t);\n\n\tconst getItemProps: DragScrollPropGetters<TContainerElement>[\"getItemProps\"] = useCallbackRef(\n\t\t(innerProps) => {\n\t\t\treturn {\n\t\t\t\t...getDragScrollScopeAttrs(\"item\"),\n\t\t\t\t...innerProps,\n\t\t\t\tclassName: cnMerge(\"snap-center snap-always\", innerProps?.className),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst getPrevButtonProps: DragScrollPropGetters<TContainerElement>[\"getPrevButtonProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst isDisabled = innerProps?.disabled ?? !canGoToPrev;\n\n\t\t\treturn {\n\t\t\t\t...getDragScrollScopeAttrs(\"prev-button\"),\n\t\t\t\ttype: \"button\",\n\t\t\t\t...innerProps,\n\t\t\t\t\"aria-disabled\": dataAttr(isDisabled),\n\t\t\t\t\"aria-label\": innerProps?.[\"aria-label\"] ?? \"Scroll back\",\n\t\t\t\t\"data-disabled\": dataAttr(isDisabled),\n\t\t\t\tdisabled: isDisabled,\n\t\t\t\tonClick: composeTwoEventHandlers(actions.goToPrev, innerProps?.onClick),\n\t\t\t};\n\t\t},\n\t\t[actions.goToPrev, canGoToPrev]\n\t);\n\n\tconst getNextButtonProps: DragScrollPropGetters<TContainerElement>[\"getNextButtonProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst isDisabled = innerProps?.disabled ?? !canGoToNext;\n\n\t\t\treturn {\n\t\t\t\t...getDragScrollScopeAttrs(\"next-button\"),\n\t\t\t\ttype: \"button\",\n\t\t\t\t...innerProps,\n\t\t\t\t\"aria-disabled\": dataAttr(isDisabled),\n\t\t\t\t\"aria-label\": innerProps?.[\"aria-label\"] ?? \"Scroll forward\",\n\t\t\t\t\"data-disabled\": dataAttr(isDisabled),\n\t\t\t\tdisabled: isDisabled,\n\t\t\t\tonClick: composeTwoEventHandlers(actions.goToNext, innerProps?.onClick),\n\t\t\t};\n\t\t},\n\t\t[actions.goToNext, canGoToNext]\n\t);\n\n\tconst propGetters = useMemo<DragScrollPropGetters<TContainerElement>>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tgetItemProps,\n\t\t\t\tgetListProps,\n\t\t\t\tgetNextButtonProps,\n\t\t\t\tgetPrevButtonProps,\n\t\t\t\tgetRootProps,\n\t\t\t}) satisfies DragScrollPropGetters<TContainerElement>,\n\t\t[getPrevButtonProps, getListProps, getItemProps, getNextButtonProps, getRootProps]\n\t);\n\n\tconst stableUseDragScrollStore = useCallbackRef(useDragScrollStore);\n\n\tconst result = useMemo<UseDragScrollResult<TContainerElement>>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tdisableInternalStateSubscription,\n\t\t\t\tlistRef,\n\t\t\t\tpropGetters,\n\t\t\t\tstoreApi,\n\t\t\t\tuseDragScrollStore: stableUseDragScrollStore,\n\t\t\t}) satisfies UseDragScrollResult<TContainerElement>,\n\t\t[propGetters, disableInternalStateSubscription, storeApi, stableUseDragScrollStore]\n\t);\n\n\treturn result;\n};\n","import { createCustomContext } from \"@zayne-labs/toolkit-react\";\nimport { createReactStoreContext } from \"@zayne-labs/toolkit-react/zustand\";\nimport type { DragScrollStore, UseDragScrollResult } from \"./types\";\n\nconst [DragScrollStoreContextProvider, useDragScrollStoreContext] =\n\tcreateReactStoreContext<DragScrollStore>({\n\t\thookName: \"useDragScrollStoreContext\",\n\t\tname: \"DragScrollStoreContext\",\n\t\tproviderName: \"DragScrollRoot\",\n\t});\n\nexport type DragScrollRootContextType<TElement extends HTMLElement = HTMLElement> = Pick<\n\tUseDragScrollResult<TElement>,\n\t\"disableInternalStateSubscription\" | \"listRef\" | \"propGetters\"\n>;\n\nconst [DragScrollRootContextProvider, useDragScrollRootContext] =\n\tcreateCustomContext<DragScrollRootContextType>({\n\t\thookName: \"useDragScrollRootContext\",\n\t\tname: \"DragScrollRootContext\",\n\t\tproviderName: \"DragScrollRoot\",\n\t});\n\nexport {\n\tDragScrollRootContextProvider,\n\tDragScrollStoreContextProvider,\n\tuseDragScrollRootContext,\n\tuseDragScrollStoreContext,\n};\n","\"use client\";\n\nimport { useCompareSelector } from \"@zayne-labs/toolkit-react\";\nimport type { PolymorphicPropsStrict } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction, type SelectorFn } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useMemo } from \"react\";\nimport { Slot } from \"@/components/common/slot\";\nimport {\n\tDragScrollRootContextProvider,\n\tDragScrollStoreContextProvider,\n\tuseDragScrollRootContext,\n\tuseDragScrollStoreContext,\n\ttype DragScrollRootContextType,\n} from \"./drag-scroll-context\";\nimport type { DragScrollStore, PartInputProps, UseDragScrollProps } from \"./types\";\nimport { useDragScroll } from \"./use-drag-scroll\";\n\n/* eslint-disable perfectionist/sort-intersection-types -- I need non-standard props to come first */\n\nexport type DragScrollRootProps = UseDragScrollProps & {\n\tasChild?: boolean;\n\tchildren: React.ReactNode;\n} & PartInputProps[\"root\"];\n\nexport function DragScrollRoot(props: DragScrollRootProps) {\n\tconst { asChild, children, ...restOfProps } = props;\n\n\tconst { disableInternalStateSubscription, listRef, propGetters, storeApi } = useDragScroll(restOfProps);\n\n\tconst rootContextValue = useMemo<DragScrollRootContextType>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tdisableInternalStateSubscription,\n\t\t\t\tlistRef,\n\t\t\t\tpropGetters,\n\t\t\t}) satisfies DragScrollRootContextType,\n\t\t[listRef, disableInternalStateSubscription, propGetters]\n\t);\n\n\tconst Component = asChild ? Slot.Root : \"div\";\n\n\treturn (\n\t\t<DragScrollStoreContextProvider store={storeApi}>\n\t\t\t<DragScrollRootContextProvider value={rootContextValue}>\n\t\t\t\t<Component {...propGetters.getRootProps(restOfProps)}>{children}</Component>\n\t\t\t</DragScrollRootContextProvider>\n\t\t</DragScrollStoreContextProvider>\n\t);\n}\n\nexport type DragScrollContextProps<TSlice> = {\n\tchildren: React.ReactNode | ((context: TSlice) => React.ReactNode);\n\tselector?: SelectorFn<DragScrollStore, TSlice>;\n};\n\nexport function DragScrollContext<TSlice = DragScrollStore>(props: DragScrollContextProps<TSlice>) {\n\tconst { children, selector } = props;\n\n\tconst dragScrollCtx = useDragScrollStoreContext(useCompareSelector(selector));\n\n\tconst resolvedChildren = isFunction(children) ? children(dragScrollCtx) : children;\n\n\treturn resolvedChildren;\n}\n\nexport type DragScrollListProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"list\"];\n\nexport function DragScrollList<TElement extends React.ElementType = \"ul\">(\n\tprops: PolymorphicPropsStrict<TElement, DragScrollListProps>\n) {\n\tconst { as: Element = \"ul\", asChild, ...restOfProps } = props;\n\n\tconst { propGetters } = useDragScrollRootContext();\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn <Component {...propGetters.getListProps(restOfProps)} />;\n}\n\nexport type DragScrollItemProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"item\"];\n\nexport function DragScrollItem<TElement extends React.ElementType = \"li\">(\n\tprops: PolymorphicPropsStrict<TElement, DragScrollItemProps>\n) {\n\tconst { as: Element = \"li\", asChild, ...restOfProps } = props;\n\n\tconst { propGetters } = useDragScrollRootContext();\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn <Component {...propGetters.getItemProps(restOfProps)} />;\n}\n\nexport type DragScrollPrevProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"prevButton\"];\n\nexport function DragScrollPrev(props: DragScrollPrevProps) {\n\tconst { asChild, ...restOfProps } = props;\n\n\tconst { propGetters } = useDragScrollRootContext();\n\n\tconst Component = asChild ? Slot.Root : \"button\";\n\n\treturn <Component {...propGetters.getPrevButtonProps(restOfProps)} />;\n}\n\nexport type DragScrollNextProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"nextButton\"];\n\nexport function DragScrollNext(props: DragScrollNextProps) {\n\tconst { asChild, ...restOfProps } = props;\n\n\tconst { propGetters } = useDragScrollRootContext();\n\n\tconst Component = asChild ? Slot.Root : \"button\";\n\n\treturn <Component {...propGetters.getNextButtonProps(restOfProps)} />;\n}\n\n/* eslint-enable perfectionist/sort-intersection-types -- I need non-standard props to come first */\n","export {\n\tDragScrollContext as Context,\n\tDragScrollItem as Item,\n\tDragScrollNext as Next,\n\tDragScrollPrev as Prev,\n\tDragScrollRoot as Root,\n\tDragScrollList as List,\n} from \"./drag-scroll\";\n"],"mappings":";;;;;;;;;;;;AAGA,MAAa,gBAA8C,YAAsB;AAChF,SAAQ,MAAM,SAAS;AACvB,SAAQ,MAAM,aAAa;;AAG5B,MAAa,gBACZ,QACA,YACI;AACJ,KAAI,WAAW,UAAU;AACxB,UAAQ,MAAM,iBAAiB;AAC/B;;AAGD,SAAQ,MAAM,iBAAiB;;AAGhC,MAAa,eAA6C,YAAsB;AAC/E,SAAQ,MAAM,SAAS;AACvB,SAAQ,MAAM,aAAa;;AAI5B,MAAa,oBAAoB,kBAA+B;AAG/D,KAAI,CAFa,qBAAqB,CAGrC,cAAa,UAAU,cAAc;KAErC,cAAa,SAAS,cAAc;;;;ACrBtC,MAAa,yBAAyB,oBAAqC;CAC1E,MAAM,EAAE,cAAc,cAAc,eAAe,QAAQ,QAAQ,iBAAiB;CAEpF,MAAM,UAA+C,EACpD,SAAS,MACT;CAED,MAAM,cAAc,EACnB,SAAS;EACR,MAAM;EACN,KAAK;EACL,GAAG;EACH,GAAG;EACH,EACD;CAED,MAAM,qBAAqB,EAC1B,SAAS;EACR,YAAY,IAAI,iBAAiB;EACjC,WAAW,IAAI,iBAAiB;EAChC,SAAS,IAAI,iBAAiB;EAC9B,EACD;CAGD,MAAM,mBAAmB,cAAmC;AAC3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+BAAD;GAA+B,OAdR,eAEtB;IACA;IACA;IACA;IACA,GACF;IAAC;IAAS;IAAkC;IAAY,CACxD;aAOE,oBALe,UAAUA,WAAY,OAKrC;IAAW,GAAI,YAAY,aAAa,YAAY;IAAG;IAAqB,CAAA;GAC7C,CAAA;EACA,CAAA;;AASnC,SAAgB,kBAA4C,OAAuC;CAClG,MAAM,EAAE,UAAU,aAAa;CAE/B,MAAM,gBAAgB,0BAA0B,mBAAmB,SAAS,CAAC;AAI7E,QAFyB,WAAW,SAAS,GAAG,SAAS,cAAc,GAAG;;AAS3E,SAAgB,eACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,MAAM,SAAS,GAAG,gBAAgB;CAExD,MAAM,EAAE,gBAAgB,0BAA0B;AAIlD,QAAO,oBAFW,UAAUA,WAAY,SAEjC,EAAW,GAAI,YAAY,aAAa,YAAY,EAAI,CAAA;;AAOhE,SAAgB,eACf,OACC;CACD,MAAM,EAAE,IAAI,UAAU,MAAM,SAAS,GAAG,gBAAgB;CAExD,MAAM,EAAE,gBAAgB,0BAA0B;AAIlD,QAAO,oBAFW,UAAUA,WAAY,SAEjC,EAAW,GAAI,YAAY,aAAa,YAAY,EAAI,CAAA;;AAOhE,SAAgB,eAAe,OAA4B;CAC1D,MAAM,EAAE,SAAS,GAAG,gBAAgB;CAEpC,MAAM,EAAE,gBAAgB,0BAA0B;AAIlD,QAAO,oBAFW,UAAUA,WAAY,UAEjC,EAAW,GAAI,YAAY,mBAAmB,YAAY,EAAI,CAAA;;AAOtE,SAAgB,eAAe,OAA4B;CAC1D,MAAM,EAAE,SAAS,GAAG,gBAAgB;CAEpC,MAAM,EAAE,gBAAgB,0BAA0B;AAIlD,QAAO,oBAFW,UAAUA,WAAY,UAEjC,EAAW,GAAI,YAAY,mBAAmB,YAAY,EAAI,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["generateFileID","generateFileIDPrimitive","generateFileID","Slot.Root","Switch.Root","Switch.Match"],"sources":["../../../../src/components/ui/drop-zone/drop-zone-context.ts","../../../../src/components/ui/drop-zone/icons.tsx","../../../../src/components/ui/drop-zone/utils.ts","../../../../src/components/ui/drop-zone/drop-zone-store.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 { createReactStoreContext } from \"@zayne-labs/toolkit-react/zustand\";\nimport type { DropZoneStore, FileState, UseDropZoneResult } from \"./types\";\n\nconst [DropZoneStoreContextProvider, useDropZoneStoreContext] = createReactStoreContext<DropZoneStore>({\n\thookName: \"useDropZoneStoreContext\",\n\tname: \"DropZoneStoreContext\",\n\tproviderName: \"DropZoneRoot\",\n});\n\nexport type DropZoneRootContextType = Pick<\n\tUseDropZoneResult,\n\t\"disabled\" | \"disableInternalStateSubscription\" | \"inputRef\" | \"propGetters\"\n>;\n\nconst [DropZoneRootContextProvider, useDropZoneRootContext] = createCustomContext<DropZoneRootContextType>(\n\t{\n\t\thookName: \"useDropZoneRootContext\",\n\t\tname: \"DropZoneRootContext\",\n\t\tproviderName: \"DropZoneRoot\",\n\t}\n);\n\nexport type FileItemContextType = {\n\tfileState: FileState;\n};\n\nconst [FileItemContextProvider, useFileItemContext] = createCustomContext({\n\tdefaultValue: null as unknown as FileItemContextType,\n\thookName: \"useFileItemContext\",\n\tname: \"FileItemContext\",\n\tproviderName: \"FileItem\",\n\tstrict: false,\n});\n\nexport {\n\tDropZoneRootContextProvider,\n\tDropZoneStoreContextProvider,\n\tFileItemContextProvider,\n\tuseDropZoneRootContext,\n\tuseDropZoneStoreContext,\n\tuseFileItemContext,\n};\n","export const FileVideoIcon = (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{/* Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE */}\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\" />\n\t\t\t<path d=\"M14 2v4a2 2 0 0 0 2 2h4m-10 3l5 3l-5 3z\" />\n\t\t</g>\n\t</svg>\n);\n\nexport const FileAudioIcon = (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{/* Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE */}\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<path d=\"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3\" />\n\t\t\t<path d=\"M14 2v4a2 2 0 0 0 2 2h4M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0\" />\n\t\t</g>\n\t</svg>\n);\n\nexport const FileTextIcon = (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{/* Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE */}\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\" />\n\t\t\t<path d=\"M14 2v4a2 2 0 0 0 2 2h4M10 9H8m8 4H8m8 4H8\" />\n\t\t</g>\n\t</svg>\n);\n\nexport const FileCodeIcon = (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{/* Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE */}\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<path d=\"M10 12.5L8 15l2 2.5m4-5l2 2.5l-2 2.5M14 2v4a2 2 0 0 0 2 2h4\" />\n\t\t\t<path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z\" />\n\t\t</g>\n\t</svg>\n);\n\nexport const FileArchiveIcon = (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{/* Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE */}\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<path d=\"M10 12v-1m0 7v-2m0-9V6m4-4v4a2 2 0 0 0 2 2h4\" />\n\t\t\t<path d=\"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01\" />\n\t\t\t<circle cx=\"10\" cy=\"20\" r=\"2\" />\n\t\t</g>\n\t</svg>\n);\n\nexport const FileCogIcon = (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{/* Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE */}\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<path d=\"M14 2v4a2 2 0 0 0 2 2h4M3.2 12.9l-.9-.4m.9 2.6l-.9.4\" />\n\t\t\t<path d=\"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5m.9 4.7l-.4-.9m.4 6.5l-.4.9m3-7.4l-.4.9m.4 6.5l-.4-.9m2.6-4.3l-.9.4m.9 2.6l-.9-.4\" />\n\t\t\t<circle cx=\"6\" cy=\"14\" r=\"3\" />\n\t\t</g>\n\t</svg>\n);\n\nexport const FileIcon = (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{/* Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE */}\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\" />\n\t\t\t<path d=\"M14 2v4a2 2 0 0 0 2 2h4\" />\n\t\t</g>\n\t</svg>\n);\n","import {\n\tcreateFileURL,\n\tgenerateFileID as generateFileIDPrimitive,\n\ttype FileOrFileMeta,\n\ttype FileValidationErrorContextEach,\n} from \"@zayne-labs/toolkit-core\";\nimport { isFile, isObject, isString } from \"@zayne-labs/toolkit-type-helpers\";\nimport type { FileState, FileStateOrIDProp, PartProps } from \"./types\";\n\nexport const generateFileID = generateFileIDPrimitive;\n\nexport const createObjectURL = (\n\tfile: FileOrFileMeta,\n\tdisallowPreviewForNonImageFiles: boolean | undefined\n) => {\n\tif (disallowPreviewForNonImageFiles && !file.type?.startsWith(\"image/\")) return;\n\n\treturn createFileURL(file);\n};\n\nexport const clearObjectURL = (\n\tfileState: FileState | undefined,\n\tdisallowPreviewForNonImageFiles: boolean | undefined\n) => {\n\tif (!isFile(fileState?.file)) return;\n\n\tif (disallowPreviewForNonImageFiles && !fileState.file.type.startsWith(\"image/\")) return;\n\n\tif (!fileState.preview) return;\n\n\tURL.revokeObjectURL(fileState.preview);\n};\n\nexport const isMatchingFile = (\n\toptions: FileStateOrIDProp & {\n\t\tfileState: FileOrFileMeta | FileState;\n\t}\n) => {\n\tconst { fileState, fileStateOrID } = options;\n\n\tconst fileID = isFile(fileState) ? generateFileID(fileState) : fileState.id;\n\n\tif (isString(fileStateOrID)) {\n\t\treturn fileID === fileStateOrID;\n\t}\n\n\tif (isFile(fileStateOrID)) {\n\t\tconst generatedFileID = generateFileID(fileStateOrID);\n\t\treturn fileID === generatedFileID;\n\t}\n\n\treturn fileID === fileStateOrID.id;\n};\n\ntype FromCamelToKebabCase<TString extends string> =\n\tTString extends `${infer First}${infer Rest}` ?\n\t\tFirst extends Uppercase<First> ?\n\t\t\t`-${Lowercase<First>}${FromCamelToKebabCase<Rest>}`\n\t\t:\t`${First}${FromCamelToKebabCase<Rest>}`\n\t:\t\"\";\n\nexport const getDropZoneScopeAttrs = (part: FromCamelToKebabCase<keyof PartProps>) => {\n\treturn {\n\t\t/* eslint-disable perfectionist/sort-objects -- I need this order to be maintained */\n\t\t\"data-slot\": `dropzone-${part}`,\n\t\t\"data-scope\": \"dropzone\",\n\t\t\"data-part\": part,\n\t\t/* eslint-enable perfectionist/sort-objects -- I need this order to be maintained */\n\t} as const;\n};\n\nconst dropZoneErrorSymbol = Symbol(\"DropZoneError\");\n\nexport class DropZoneError extends Error {\n\treadonly dropZoneErrorSymbol = dropZoneErrorSymbol;\n\tfile?: FileValidationErrorContextEach[\"file\"];\n\toverride name = \"DropZoneError\" as const;\n\n\tconstructor(\n\t\tctx: Pick<FileValidationErrorContextEach, \"message\"> & {\n\t\t\tfile?: FileValidationErrorContextEach[\"file\"];\n\t\t},\n\t\terrorOptions?: ErrorOptions\n\t) {\n\t\tconst { file, message } = ctx;\n\n\t\tsuper(message, errorOptions);\n\n\t\tthis.file = file;\n\t}\n\n\tstatic override isError(error: unknown): error is DropZoneError {\n\t\tif (!isObject<DropZoneError>(error)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (error instanceof DropZoneError) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst actualError = error as DropZoneError;\n\n\t\treturn (\n\t\t\tactualError.dropZoneErrorSymbol === dropZoneErrorSymbol\n\t\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Allow\n\t\t\t&& actualError.name === \"DropZoneError\"\n\t\t);\n\t}\n}\n\nexport const getErrorContext = (error: DropZoneError | Error): NonNullable<FileState[\"error\"]> => {\n\tif (DropZoneError.isError(error)) {\n\t\treturn {\n\t\t\tcause: \"custom-error\",\n\t\t\tcode: \"upload-error\",\n\t\t\tfile: error.file ?? ({} as never),\n\t\t\tmessage: error.message,\n\t\t\toriginalError: error.cause ?? error,\n\t\t};\n\t}\n\n\tconst actualError = Error.isError(error) ? error : new Error(\"File upload failed\", { cause: error });\n\n\treturn {\n\t\tcause: \"custom-error\",\n\t\tcode: \"upload-error\",\n\t\tfile: isFile(actualError.cause) ? actualError.cause : ({} as never),\n\t\tmessage: Error.isError(error) ? actualError.message : String(actualError),\n\t\toriginalError: actualError,\n\t};\n};\n","import { createStore, handleFileValidationAsync, toArray } from \"@zayne-labs/toolkit-core\";\nimport type { DropZoneState, DropZoneStore, UseDropZoneProps } from \"./types\";\nimport { clearObjectURL, createObjectURL, generateFileID, getErrorContext, isMatchingFile } from \"./utils\";\n\ntype RequiredUseDropZoneProps = {\n\t[Key in keyof Required<UseDropZoneProps>]: UseDropZoneProps[Key] | undefined;\n};\n\ntype StoreContext = Pick<\n\tRequiredUseDropZoneProps,\n\t| \"allowedFileTypes\"\n\t| \"disablePreviewGenForNonImageFiles\"\n\t| \"initialFiles\"\n\t| \"maxFileCount\"\n\t| \"maxFileSize\"\n\t| \"multiple\"\n\t| \"onFilesChange\"\n\t| \"onUpload\"\n\t| \"onValidationError\"\n\t| \"onValidationSuccess\"\n\t| \"rejectDuplicateFiles\"\n\t| \"validator\"\n>;\n\nexport const createDropZoneStore = (storeContext: StoreContext) => {\n\tconst {\n\t\tallowedFileTypes,\n\t\tdisablePreviewGenForNonImageFiles,\n\t\tinitialFiles,\n\t\tmaxFileCount,\n\t\tmaxFileSize,\n\t\tmultiple,\n\t\tonFilesChange,\n\t\tonUpload,\n\t\tonValidationError,\n\t\tonValidationSuccess,\n\t\trejectDuplicateFiles,\n\t\tvalidator,\n\t} = storeContext;\n\n\tconst inputRef: React.RefObject<HTMLInputElement | null> = { current: null };\n\n\tconst initialFileArray = toArray(initialFiles).filter(Boolean);\n\n\tconst clearInputValue = () => {\n\t\tif (!inputRef.current) return;\n\n\t\tinputRef.current.value = \"\";\n\t};\n\n\tconst initFileStateArray: DropZoneState[\"fileStateArray\"] = initialFileArray.map((fileMeta) => ({\n\t\tfile: fileMeta,\n\t\tid: fileMeta.id,\n\t\tpreview: fileMeta.url,\n\t\tprogress: 0,\n\t\tstatus: \"idle\",\n\t}));\n\n\tconst store = createStore<DropZoneStore>((set, get) => ({\n\t\tdisabled: false,\n\t\terrors: [],\n\t\tfileStateArray: initFileStateArray,\n\t\tisDraggingOver: false,\n\t\tisInvalid: false,\n\n\t\t// eslint-disable-next-line perfectionist/sort-objects -- ignore\n\t\tactions: {\n\t\t\taddFiles: async (files) => {\n\t\t\t\tif (!files || files.length === 0) {\n\t\t\t\t\tconsole.warn(\"No file selected!\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { actions, fileStateArray: existingFileStateArray } = get();\n\n\t\t\t\t// == In single file mode, only use the first file\n\t\t\t\tconst resolvedNewFiles = !multiple ? [files[0]] : files;\n\n\t\t\t\tconst { errors, validFiles } = await handleFileValidationAsync({\n\t\t\t\t\texistingFiles: existingFileStateArray.map((fileWithPreview) => fileWithPreview.file),\n\t\t\t\t\thooks: {\n\t\t\t\t\t\tonErrorEach: onValidationError,\n\t\t\t\t\t\tonSuccessBatch: onValidationSuccess,\n\t\t\t\t\t},\n\t\t\t\t\tnewFiles: resolvedNewFiles,\n\t\t\t\t\tsettings: {\n\t\t\t\t\t\tallowedFileTypes,\n\t\t\t\t\t\tmaxFileCount,\n\t\t\t\t\t\tmaxFileSize,\n\t\t\t\t\t\trejectDuplicateFiles,\n\t\t\t\t\t\tvalidator,\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\tif (validFiles.length === 0) {\n\t\t\t\t\tset({ errors, isDraggingOver: false });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst newFileStateArray: DropZoneState[\"fileStateArray\"] = validFiles.map((file) => ({\n\t\t\t\t\tfile,\n\t\t\t\t\tid: generateFileID(file),\n\t\t\t\t\tpreview: createObjectURL(file, disablePreviewGenForNonImageFiles),\n\t\t\t\t\tprogress: 0,\n\t\t\t\t\tstatus: \"idle\",\n\t\t\t\t}));\n\n\t\t\t\tconst resolvedFileStateArray =\n\t\t\t\t\t!multiple ? newFileStateArray : [...existingFileStateArray, ...newFileStateArray];\n\n\t\t\t\tset(\n\t\t\t\t\t{\n\t\t\t\t\t\terrors,\n\t\t\t\t\t\tfileStateArray: resolvedFileStateArray,\n\t\t\t\t\t\tisDraggingOver: false,\n\t\t\t\t\t},\n\t\t\t\t\t{ shouldNotifySync: true }\n\t\t\t\t);\n\n\t\t\t\tawait actions.handleFileUpload({ newFileStateArray });\n\t\t\t},\n\t\t\tclearErrors: () => {\n\t\t\t\tset({ errors: [], isInvalid: false });\n\t\t\t},\n\n\t\t\tclearFiles: () => {\n\t\t\t\tconst { actions } = get();\n\n\t\t\t\tactions.clearObjectURLs();\n\n\t\t\t\tset({ errors: [], fileStateArray: [], isInvalid: false });\n\t\t\t},\n\n\t\t\tclearObjectURLs: () => {\n\t\t\t\tconst { fileStateArray } = get();\n\n\t\t\t\tfor (const fileState of fileStateArray) {\n\t\t\t\t\tclearObjectURL(fileState, disablePreviewGenForNonImageFiles);\n\t\t\t\t}\n\t\t\t},\n\n\t\t\thandleChange: async (event) => {\n\t\t\t\tconst fileList = event.target.files;\n\n\t\t\t\tconst { actions } = get();\n\n\t\t\t\tawait actions.addFiles(fileList);\n\n\t\t\t\tclearInputValue();\n\t\t\t},\n\n\t\t\thandleDragEnter: (event) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\n\t\t\t\tset({ isDraggingOver: true });\n\t\t\t},\n\n\t\t\thandleDragLeave: (event) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\n\t\t\t\tset({ isDraggingOver: false });\n\t\t\t},\n\n\t\t\thandleDragOver: (event) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t},\n\n\t\t\thandleDrop: async (event) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\n\t\t\t\tconst { actions } = get();\n\n\t\t\t\tconst fileList = event.dataTransfer.files;\n\n\t\t\t\tawait actions.addFiles(fileList);\n\t\t\t},\n\n\t\t\thandleFileUpload: async (context) => {\n\t\t\t\tconst { newFileStateArray } = context;\n\n\t\t\t\tconst { actions } = get();\n\n\t\t\t\tif (!onUpload) {\n\t\t\t\t\tfor (const fileState of newFileStateArray) {\n\t\t\t\t\t\tactions.updateFileState({ fileStateOrID: fileState, progress: 100, status: \"success\" });\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait onUpload({\n\t\t\t\t\t\tfileStateArray: newFileStateArray,\n\t\t\t\t\t\tonError: (ctx) => {\n\t\t\t\t\t\t\tconst { error, fileStateOrID } = ctx;\n\n\t\t\t\t\t\t\tconst errorContext = getErrorContext(error);\n\n\t\t\t\t\t\t\tactions.updateFileState({ error: errorContext, fileStateOrID, status: \"error\" });\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonProgress: (ctx) => {\n\t\t\t\t\t\t\tconst { fileStateOrID, progress } = ctx;\n\n\t\t\t\t\t\t\tactions.updateFileState({ fileStateOrID, progress });\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonSuccess: (ctx) => {\n\t\t\t\t\t\t\tconst { fileStateOrID } = ctx;\n\n\t\t\t\t\t\t\tactions.updateFileState({ fileStateOrID, progress: 100, status: \"success\" });\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\n\t\t\t\t\t// == Handle Errors ==\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst errorContext = getErrorContext(error as Error);\n\n\t\t\t\t\tfor (const fileState of newFileStateArray) {\n\t\t\t\t\t\tactions.updateFileState({\n\t\t\t\t\t\t\terror: errorContext,\n\t\t\t\t\t\t\tfileStateOrID: fileState,\n\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\thandleKeyDown: (event) => {\n\t\t\t\tconst isEnterKey = event.key === \"Enter\";\n\t\t\t\tconst isSpaceKey = event.key === \" \";\n\n\t\t\t\tconst isAllowedKey = isEnterKey || isSpaceKey;\n\n\t\t\t\tif (!isAllowedKey) return;\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst { actions } = get();\n\n\t\t\t\tactions.openFilePicker();\n\t\t\t},\n\n\t\t\thandlePaste: async (event) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\n\t\t\t\tconst { actions } = get();\n\n\t\t\t\tconst fileList = event.clipboardData.files;\n\n\t\t\t\tawait actions.addFiles(fileList);\n\t\t\t},\n\n\t\t\topenFilePicker: () => {\n\t\t\t\tinputRef.current?.click();\n\t\t\t},\n\n\t\t\tremoveFile: (ctx) => {\n\t\t\t\tconst { fileStateOrID } = ctx;\n\n\t\t\t\tconst { fileStateArray } = get();\n\n\t\t\t\tconst updatedFileStateArray = fileStateArray.filter((fileState) => {\n\t\t\t\t\tif (!isMatchingFile({ fileState, fileStateOrID })) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\tclearObjectURL(fileState, disablePreviewGenForNonImageFiles);\n\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\n\t\t\t\tset({ errors: [], fileStateArray: updatedFileStateArray });\n\t\t\t},\n\n\t\t\tsetInputRef: (element) => {\n\t\t\t\tinputRef.current = element;\n\t\t\t},\n\n\t\t\tupdateFileState: (ctx) => {\n\t\t\t\tconst { fileStateOrID, ...updatedFileState } = ctx;\n\n\t\t\t\tconst { fileStateArray } = get();\n\n\t\t\t\tconst updatedFileStateArray: DropZoneState[\"fileStateArray\"] = fileStateArray.map(\n\t\t\t\t\t(fileState) => {\n\t\t\t\t\t\tif (!isMatchingFile({ fileState, fileStateOrID })) {\n\t\t\t\t\t\t\treturn fileState;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...fileState,\n\t\t\t\t\t\t\t...updatedFileState,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tset({ fileStateArray: updatedFileStateArray }, { shouldNotifySync: true });\n\t\t\t},\n\t\t},\n\t}));\n\n\t// == File change subscription\n\tstore.subscribe.withSelector(\n\t\t(state) => state.fileStateArray,\n\t\t(fileStateArray) => {\n\t\t\tonFilesChange?.({ fileStateArray });\n\t\t}\n\t);\n\n\t// == Set `isInvalid` to true if there are errors\n\tstore.subscribe.withSelector(\n\t\t(state) => state.errors,\n\t\t(errors) => {\n\t\t\tif (errors.length === 0) return;\n\n\t\t\tstore.setState({ isInvalid: true });\n\n\t\t\t// == Reset to false after 1.5 seconds\n\t\t\tsetTimeout(() => store.setState({ isInvalid: false }), 1500);\n\t\t}\n\t);\n\n\treturn store;\n};\n","import { dataAttr } from \"@zayne-labs/toolkit-core\";\nimport { useCallbackRef, useCompareValue, useStore, useUnmountEffect } from \"@zayne-labs/toolkit-react\";\nimport { composeRefs, composeTwoEventHandlers } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCallback, useMemo, useRef } from \"react\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport { createDropZoneStore } from \"./drop-zone-store\";\nimport type { DropZonePropGetters, UseDropZoneProps, UseDropZoneResult } from \"./types\";\nimport { getDropZoneScopeAttrs } from \"./utils\";\n\nexport const useDropZone = (props?: UseDropZoneProps): UseDropZoneResult => {\n\tconst {\n\t\tallowedFileTypes,\n\t\tdisabled = false,\n\t\tdisableFilePickerOpenOnAreaClick = false,\n\t\tdisableInternalStateSubscription = false,\n\t\tdisablePreviewGenForNonImageFiles = true,\n\t\tinitialFiles,\n\t\tmaxFileCount,\n\t\tmaxFileSize,\n\t\tmultiple,\n\t\tonFilesChange,\n\t\tonUpload,\n\t\tonValidationError,\n\t\tonValidationSuccess,\n\t\trejectDuplicateFiles = true,\n\t\tunstyled: globalUnstyled = false,\n\t\tvalidator,\n\t} = props ?? {};\n\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\tconst stableOnFilesChange = useCallbackRef(onFilesChange);\n\tconst stableOnUpload = useCallbackRef(onUpload);\n\tconst stableOnUploadError = useCallbackRef(onValidationError);\n\tconst stableOnUploadSuccess = useCallbackRef(onValidationSuccess);\n\tconst stableValidator = useCallbackRef(validator);\n\n\tconst shallowComparedInitialFiles = useCompareValue(initialFiles);\n\tconst shallowComparedMaxFileSize = useCompareValue(maxFileSize);\n\tconst shallowComparedAllowedFileTypes = useCompareValue(allowedFileTypes);\n\n\tconst storeApi = useMemo(() => {\n\t\treturn createDropZoneStore({\n\t\t\tallowedFileTypes: shallowComparedAllowedFileTypes,\n\t\t\tdisablePreviewGenForNonImageFiles,\n\t\t\tinitialFiles: shallowComparedInitialFiles,\n\t\t\tmaxFileCount,\n\t\t\tmaxFileSize: shallowComparedMaxFileSize,\n\t\t\tmultiple,\n\t\t\tonFilesChange: stableOnFilesChange,\n\t\t\tonUpload: stableOnUpload,\n\t\t\tonValidationError: stableOnUploadError,\n\t\t\tonValidationSuccess: stableOnUploadSuccess,\n\t\t\trejectDuplicateFiles,\n\t\t\tvalidator: stableValidator,\n\t\t});\n\t}, [\n\t\tshallowComparedAllowedFileTypes,\n\t\tdisablePreviewGenForNonImageFiles,\n\t\tshallowComparedInitialFiles,\n\t\tmaxFileCount,\n\t\tshallowComparedMaxFileSize,\n\t\tmultiple,\n\t\tstableOnFilesChange,\n\t\tstableOnUpload,\n\t\tstableOnUploadError,\n\t\tstableOnUploadSuccess,\n\t\trejectDuplicateFiles,\n\t\tstableValidator,\n\t]);\n\n\tconst actions = storeApi.getState().actions;\n\n\tuseUnmountEffect(() => {\n\t\tactions.clearObjectURLs();\n\t});\n\n\t/* eslint-disable react-hooks/hooks -- ignore */\n\t// eslint-disable-next-line react-x/component-hook-factories -- ignore\n\tconst useDropZoneStore: UseDropZoneResult[\"useDropZoneStore\"] = (selector) => {\n\t\treturn useStore(storeApi as never, selector);\n\t};\n\n\tconst isDraggingOver = useDropZoneStore((state) =>\n\t\t!disableInternalStateSubscription ? state.isDraggingOver : null\n\t);\n\n\tconst isInvalid = useDropZoneStore((state) =>\n\t\t!disableInternalStateSubscription ? state.isInvalid : null\n\t);\n\t/* eslint-enable react-hooks/hooks -- ignore */\n\n\tconst getContainerProps: DropZonePropGetters[\"getContainerProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst { unstyled = globalUnstyled, ...restOfInnerProps } = innerProps;\n\n\t\t\tconst isDisabled = disabled;\n\t\t\tconst onFileDrop = !isDisabled ? actions.handleDrop : undefined;\n\t\t\tconst onFilePaste = !isDisabled ? actions.handlePaste : undefined;\n\t\t\tconst tabIndex = !isDisabled ? 0 : undefined;\n\t\t\tconst onAreaClick =\n\t\t\t\t!isDisabled && !disableFilePickerOpenOnAreaClick ? actions.openFilePicker : undefined;\n\t\t\tconst onKeyDown =\n\t\t\t\t!isDisabled && !disableFilePickerOpenOnAreaClick ? actions.handleKeyDown : undefined;\n\n\t\t\treturn {\n\t\t\t\t...getDropZoneScopeAttrs(\"container\"),\n\t\t\t\trole: \"region\",\n\t\t\t\t...(!disableInternalStateSubscription && {\n\t\t\t\t\t\"data-drag-over\": dataAttr(isDraggingOver),\n\t\t\t\t\t\"data-invalid\": dataAttr(isInvalid),\n\t\t\t\t}),\n\t\t\t\t...restOfInnerProps,\n\t\t\t\t...(!unstyled && {\n\t\t\t\t\tclassName: cnMerge(\n\t\t\t\t\t\t`relative flex flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-6 transition-colors duration-250 ease-out outline-none select-none focus-visible:border-zu-ring/50`,\n\t\t\t\t\t\t`data-disabled:pointer-events-none data-drag-over:opacity-60 data-invalid:border-zu-destructive data-invalid:ring-zu-destructive/20`,\n\t\t\t\t\t\tinnerProps.className\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t\t\"data-disabled\": dataAttr(isDisabled),\n\t\t\t\tonClick: composeTwoEventHandlers(onAreaClick, innerProps.onClick),\n\t\t\t\tonDragEnter: composeTwoEventHandlers(actions.handleDragEnter, innerProps.onDragEnter),\n\t\t\t\tonDragLeave: composeTwoEventHandlers(actions.handleDragLeave, innerProps.onDragLeave),\n\t\t\t\tonDragOver: composeTwoEventHandlers(actions.handleDragOver, innerProps.onDragOver),\n\t\t\t\tonDrop: composeTwoEventHandlers(onFileDrop, innerProps.onDrop),\n\t\t\t\tonKeyDown: composeTwoEventHandlers(onKeyDown, innerProps.onKeyDown),\n\t\t\t\tonPaste: composeTwoEventHandlers(onFilePaste, innerProps.onPaste),\n\t\t\t\ttabIndex,\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tglobalUnstyled,\n\t\t\tdisabled,\n\t\t\tactions.handleDrop,\n\t\t\tactions.handlePaste,\n\t\t\tactions.openFilePicker,\n\t\t\tactions.handleKeyDown,\n\t\t\tactions.handleDragEnter,\n\t\t\tactions.handleDragLeave,\n\t\t\tactions.handleDragOver,\n\t\t\tdisableFilePickerOpenOnAreaClick,\n\t\t\tdisableInternalStateSubscription,\n\t\t\tisDraggingOver,\n\t\t\tisInvalid,\n\t\t]\n\t);\n\n\tconst refCallback: React.RefCallback<HTMLInputElement> = useCallbackRef((node) => {\n\t\tinputRef.current = node;\n\t\tactions.setInputRef(node);\n\t});\n\n\tconst getInputProps: DropZonePropGetters[\"getInputProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst isDisabled = innerProps.disabled ?? disabled;\n\n\t\t\tconst onFileChange = !isDisabled ? actions.handleChange : undefined;\n\n\t\t\treturn {\n\t\t\t\t...getDropZoneScopeAttrs(\"input\"),\n\t\t\t\t...(!disableInternalStateSubscription && { \"data-drag-over\": dataAttr(isDraggingOver) }),\n\t\t\t\t...innerProps,\n\t\t\t\taccept: allowedFileTypes ? allowedFileTypes.join(\", \") : innerProps.accept,\n\t\t\t\tclassName: cnMerge(\"hidden\", innerProps.className),\n\t\t\t\t\"data-disabled\": dataAttr(isDisabled),\n\t\t\t\tdisabled: isDisabled,\n\t\t\t\tmultiple: multiple ?? innerProps.multiple,\n\t\t\t\tonChange: composeTwoEventHandlers(onFileChange, innerProps.onChange),\n\t\t\t\tref: composeRefs(refCallback, innerProps.ref),\n\t\t\t\ttype: \"file\",\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tactions.handleChange,\n\t\t\tallowedFileTypes,\n\t\t\tdisableInternalStateSubscription,\n\t\t\tdisabled,\n\t\t\tisDraggingOver,\n\t\t\tmultiple,\n\t\t\trefCallback,\n\t\t]\n\t);\n\n\tconst getTriggerProps: DropZonePropGetters[\"getTriggerProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst isDisabled = innerProps.disabled ?? disabled;\n\n\t\t\treturn {\n\t\t\t\t...getDropZoneScopeAttrs(\"trigger\"),\n\t\t\t\ttype: \"button\",\n\t\t\t\t...innerProps,\n\t\t\t\t\"data-disabled\": dataAttr(isDisabled),\n\t\t\t\tdisabled: isDisabled,\n\t\t\t\tonClick: composeTwoEventHandlers(actions.openFilePicker, innerProps.onClick),\n\t\t\t};\n\t\t},\n\t\t[actions.openFilePicker, disabled]\n\t);\n\n\tconst getFileListProps: DropZonePropGetters[\"getFileListProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst { orientation = \"vertical\", unstyled = globalUnstyled, ...restOfInnerProps } = innerProps;\n\n\t\t\treturn {\n\t\t\t\t...getDropZoneScopeAttrs(\"file-list\"),\n\t\t\t\t\"data-orientation\": orientation,\n\t\t\t\t...restOfInnerProps,\n\t\t\t\t...(!unstyled && {\n\t\t\t\t\tclassName: cnMerge(\n\t\t\t\t\t\t\"flex flex-col gap-2\",\n\t\t\t\t\t\torientation === \"horizontal\" && \"flex-row overflow-x-auto p-1.5\",\n\t\t\t\t\t\tinnerProps.className\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t};\n\t\t},\n\t\t[globalUnstyled]\n\t);\n\n\tconst getFileItemProps: DropZonePropGetters[\"getFileItemProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst { unstyled = globalUnstyled, ...restOfInnerProps } = innerProps;\n\n\t\t\treturn {\n\t\t\t\t...getDropZoneScopeAttrs(\"file-item\"),\n\t\t\t\t...restOfInnerProps,\n\t\t\t\t...(!unstyled && {\n\t\t\t\t\tclassName: cnMerge(\n\t\t\t\t\t\t\"relative flex animate-files-in items-center gap-2.5 rounded-md border p-2\",\n\t\t\t\t\t\tinnerProps.className\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t};\n\t\t},\n\t\t[globalUnstyled]\n\t);\n\n\tconst getFileItemProgressProps: DropZonePropGetters[\"getFileItemProgressProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst { unstyled = globalUnstyled, variant = \"linear\", ...restOfInnerProps } = innerProps;\n\n\t\t\treturn {\n\t\t\t\t...getDropZoneScopeAttrs(\"file-item-progress\"),\n\t\t\t\trole: \"progressbar\",\n\t\t\t\t...restOfInnerProps,\n\t\t\t\t...(!unstyled && {\n\t\t\t\t\tclassName: cnMerge(\n\t\t\t\t\t\t\"inline-flex\",\n\t\t\t\t\t\tvariant === \"circular\" && \"absolute top-1/2 left-1/2 -translate-1/2\",\n\t\t\t\t\t\tvariant === \"fill\" && `absolute inset-0`,\n\t\t\t\t\t\tvariant === \"linear\"\n\t\t\t\t\t\t\t&& \"relative h-1.5 w-full overflow-hidden rounded-full bg-zu-primary/20\",\n\t\t\t\t\t\trestOfInnerProps.className\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t};\n\t\t},\n\t\t[globalUnstyled]\n\t);\n\n\tconst getFileItemDeleteProps: DropZonePropGetters[\"getFileItemDeleteProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst { fileStateOrID, ...restOfInnerProps } = innerProps;\n\n\t\t\tconst isDisabled = innerProps.disabled ?? disabled;\n\n\t\t\tconst onRemoveFile = () => fileStateOrID && actions.removeFile({ fileStateOrID });\n\n\t\t\treturn {\n\t\t\t\t...getDropZoneScopeAttrs(\"file-item-delete\"),\n\t\t\t\ttype: \"button\",\n\t\t\t\t...restOfInnerProps,\n\t\t\t\t\"data-disabled\": dataAttr(isDisabled),\n\t\t\t\tdisabled: isDisabled,\n\t\t\t\tonClick: composeTwoEventHandlers(onRemoveFile, restOfInnerProps.onClick),\n\t\t\t};\n\t\t},\n\t\t[actions, disabled]\n\t);\n\n\tconst getFileItemPreviewProps: DropZonePropGetters[\"getFileItemPreviewProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst { unstyled = globalUnstyled, ...restOfInnerProps } = innerProps;\n\n\t\t\treturn {\n\t\t\t\t...getDropZoneScopeAttrs(\"file-item-preview\"),\n\t\t\t\t...restOfInnerProps,\n\t\t\t\t...(!unstyled && {\n\t\t\t\t\tclassName: cnMerge(\n\t\t\t\t\t\t`relative flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-md bg-zu-accent/50 [&>svg]:size-10`,\n\t\t\t\t\t\tinnerProps.className\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t};\n\t\t},\n\t\t[globalUnstyled]\n\t);\n\n\tconst getFileItemMetadataProps: DropZonePropGetters[\"getFileItemMetadataProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst { unstyled = globalUnstyled, ...restOfInnerProps } = innerProps;\n\n\t\t\treturn {\n\t\t\t\t...getDropZoneScopeAttrs(\"file-item-metadata\"),\n\t\t\t\t...restOfInnerProps,\n\t\t\t\t...(!unstyled && {\n\t\t\t\t\tclassName: cnMerge(\"flex min-w-0 grow flex-col\", innerProps.className),\n\t\t\t\t}),\n\t\t\t};\n\t\t},\n\t\t[globalUnstyled]\n\t);\n\n\tconst getFileItemClearProps: DropZonePropGetters[\"getFileItemClearProps\"] = useCallback(\n\t\t(innerProps) => {\n\t\t\tconst isDisabled = innerProps.disabled ?? disabled;\n\n\t\t\treturn {\n\t\t\t\t...getDropZoneScopeAttrs(\"file-item-clear\"),\n\t\t\t\ttype: \"button\",\n\t\t\t\t...innerProps,\n\t\t\t\t\"data-disabled\": dataAttr(isDisabled),\n\t\t\t\tdisabled: isDisabled,\n\t\t\t\tonClick: composeTwoEventHandlers(actions.clearFiles, innerProps.onClick),\n\t\t\t};\n\t\t},\n\t\t[actions.clearFiles, disabled]\n\t);\n\n\tconst propGetters = useMemo<DropZonePropGetters>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tgetContainerProps,\n\t\t\t\tgetFileItemClearProps,\n\t\t\t\tgetFileItemDeleteProps,\n\t\t\t\tgetFileItemMetadataProps,\n\t\t\t\tgetFileItemPreviewProps,\n\t\t\t\tgetFileItemProgressProps,\n\t\t\t\tgetFileItemProps,\n\t\t\t\tgetFileListProps,\n\t\t\t\tgetInputProps,\n\t\t\t\tgetTriggerProps,\n\t\t\t}) satisfies DropZonePropGetters,\n\t\t[\n\t\t\tgetContainerProps,\n\t\t\tgetFileListProps,\n\t\t\tgetFileItemClearProps,\n\t\t\tgetFileItemDeleteProps,\n\t\t\tgetFileItemMetadataProps,\n\t\t\tgetFileItemPreviewProps,\n\t\t\tgetFileItemProgressProps,\n\t\t\tgetFileItemProps,\n\t\t\tgetInputProps,\n\t\t\tgetTriggerProps,\n\t\t]\n\t);\n\n\tconst stableUseDropZoneStore = useCallbackRef(useDropZoneStore);\n\n\tconst result = useMemo<UseDropZoneResult>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tdisabled,\n\t\t\t\tdisableInternalStateSubscription,\n\t\t\t\tinputRef,\n\t\t\t\tpropGetters,\n\t\t\t\tstoreApi,\n\t\t\t\tuseDropZoneStore: stableUseDropZoneStore,\n\t\t\t}) satisfies UseDropZoneResult,\n\t\t[disabled, disableInternalStateSubscription, propGetters, storeApi, stableUseDropZoneStore]\n\t);\n\n\treturn result;\n};\n","\"use client\";\n\nimport { dataAttr, formatBytes } from \"@zayne-labs/toolkit-core\";\nimport { useCompareSelector } from \"@zayne-labs/toolkit-react\";\nimport type {\n\tCssWithCustomProperties,\n\tInferProps,\n\tPolymorphicPropsStrict,\n} from \"@zayne-labs/toolkit-react/utils\";\nimport {\n\tisBoolean,\n\tisFunction,\n\tisNumber,\n\ttype AnyFunction,\n\ttype SelectorFn,\n\ttype UnionDiscriminator,\n\ttype UnionToIntersection,\n} from \"@zayne-labs/toolkit-type-helpers\";\nimport { useMemo } from \"react\";\nimport { For } from \"@/components/common/for\";\nimport { Presence } from \"@/components/common/presence\";\nimport { Slot } from \"@/components/common/slot\";\nimport { Switch } from \"@/components/common/switch\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport {\n\tDropZoneRootContextProvider,\n\tDropZoneStoreContextProvider,\n\tFileItemContextProvider,\n\tuseDropZoneRootContext,\n\tuseDropZoneStoreContext,\n\tuseFileItemContext,\n\ttype DropZoneRootContextType,\n\ttype FileItemContextType,\n} from \"./drop-zone-context\";\nimport {\n\tFileArchiveIcon,\n\tFileAudioIcon,\n\tFileCodeIcon,\n\tFileCogIcon,\n\tFileIcon,\n\tFileTextIcon,\n\tFileVideoIcon,\n} from \"./icons\";\nimport type { DropZoneStore, PartInputProps, UseDropZoneProps } from \"./types\";\nimport { useDropZone } from \"./use-drop-zone\";\n\nexport type DropZoneRootProps = UseDropZoneProps & {\n\tchildren: React.ReactNode;\n};\n\nexport function DropZoneRoot(props: DropZoneRootProps) {\n\tconst { children, ...restOfProps } = props;\n\n\tconst { disabled, disableInternalStateSubscription, inputRef, propGetters, storeApi } =\n\t\tuseDropZone(restOfProps);\n\n\tconst rootContextValue = useMemo<DropZoneRootContextType>(\n\t\t() =>\n\t\t\t({\n\t\t\t\tdisabled,\n\t\t\t\tdisableInternalStateSubscription,\n\t\t\t\tinputRef,\n\t\t\t\tpropGetters,\n\t\t\t}) satisfies DropZoneRootContextType,\n\t\t[disableInternalStateSubscription, disabled, inputRef, propGetters]\n\t);\n\n\treturn (\n\t\t<DropZoneStoreContextProvider store={storeApi}>\n\t\t\t<DropZoneRootContextProvider value={rootContextValue}>{children}</DropZoneRootContextProvider>\n\t\t</DropZoneStoreContextProvider>\n\t);\n}\n\nexport type DropZoneContextProps<TSlice> = {\n\tchildren: React.ReactNode | ((context: TSlice) => React.ReactNode);\n\tselector?: SelectorFn<DropZoneStore, TSlice>;\n};\n\nexport function DropZoneContext<TSlice = DropZoneStore>(props: DropZoneContextProps<TSlice>) {\n\tconst { children, selector } = props;\n\n\tconst dropZoneCtx = useDropZoneStoreContext(useCompareSelector(selector));\n\n\tconst resolvedChildren = isFunction(children) ? children(dropZoneCtx) : children;\n\n\treturn resolvedChildren;\n}\n\n/* eslint-disable perfectionist/sort-intersection-types -- I need non-standard props to come first */\n\nexport type DropZoneContainerProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"container\"];\n\nexport function DropZoneContainer<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicPropsStrict<TElement, DropZoneContainerProps>\n) {\n\tconst { as: Element = \"div\", asChild, ...restOfProps } = props;\n\n\tconst { disableInternalStateSubscription, propGetters } = useDropZoneRootContext();\n\n\tconst isDraggingOver = useDropZoneStoreContext((store) =>\n\t\tdisableInternalStateSubscription ? store.isDraggingOver : null\n\t);\n\n\tconst isInvalid = useDropZoneStoreContext((store) =>\n\t\tdisableInternalStateSubscription ? store.isInvalid : null\n\t);\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn (\n\t\t<Component\n\t\t\t{...propGetters.getContainerProps({\n\t\t\t\t...(disableInternalStateSubscription && {\n\t\t\t\t\t\"data-drag-over\": dataAttr(isDraggingOver),\n\t\t\t\t\t\"data-invalid\": dataAttr(isInvalid),\n\t\t\t\t}),\n\t\t\t\t...restOfProps,\n\t\t\t})}\n\t\t/>\n\t);\n}\n\nexport type DropZoneInputProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"input\"];\n\nexport function DropZoneInput(props: DropZoneInputProps) {\n\tconst { asChild, ...restOfProps } = props;\n\n\tconst { disableInternalStateSubscription, propGetters } = useDropZoneRootContext();\n\n\tconst isDraggingOver = useDropZoneStoreContext((store) =>\n\t\tdisableInternalStateSubscription ? store.isDraggingOver : null\n\t);\n\n\tconst Component = asChild ? Slot.Root : \"input\";\n\n\treturn (\n\t\t<Component\n\t\t\t{...propGetters.getInputProps({\n\t\t\t\t...(disableInternalStateSubscription && { \"data-drag-over\": dataAttr(isDraggingOver) }),\n\t\t\t\t...restOfProps,\n\t\t\t})}\n\t\t/>\n\t);\n}\n\nexport type DropZoneAreaProps<TSlice = DropZoneStore> = DropZoneContextProps<TSlice> & {\n\tclassNames?: Partial<Record<Extract<keyof PartInputProps, \"container\" | \"input\">, string>>;\n\textraProps?: Partial<Pick<PartInputProps, \"container\" | \"input\">>;\n} & PartInputProps[\"container\"];\n\nexport function DropZoneArea<TSlice = DropZoneStore>(props: DropZoneAreaProps<TSlice>) {\n\tconst { children, className, classNames, extraProps, selector, ...restOfProps } = props;\n\n\treturn (\n\t\t<DropZoneContainer\n\t\t\t{...extraProps?.container}\n\t\t\t{...restOfProps}\n\t\t\tclassName={cnMerge(extraProps?.container?.className, className, classNames?.container)}\n\t\t>\n\t\t\t<DropZoneInput\n\t\t\t\t{...extraProps?.input}\n\t\t\t\tclassName={cnMerge(extraProps?.input?.className, classNames?.input)}\n\t\t\t/>\n\n\t\t\t<DropZoneContext selector={selector}>{children}</DropZoneContext>\n\t\t</DropZoneContainer>\n\t);\n}\n\nexport type DropZoneTriggerProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"trigger\"];\n\nexport function DropZoneTrigger(props: DropZoneTriggerProps) {\n\tconst { asChild, ...restOfProps } = props;\n\n\tconst { propGetters } = useDropZoneRootContext();\n\n\tconst Component = asChild ? Slot.Root : \"button\";\n\n\treturn <Component {...propGetters.getTriggerProps(restOfProps)} />;\n}\n\ntype ListPerItemContext = Pick<DropZoneStore, \"actions\"> & {\n\tarray: DropZoneStore[\"fileStateArray\"];\n\tfileState: DropZoneStore[\"fileStateArray\"][number];\n\tindex: number;\n};\n\ntype FileListPerItemVariant = {\n\tchildren: React.ReactNode | ((context: ListPerItemContext) => React.ReactNode);\n\trenderMode?: \"per-item\";\n};\n\ntype ListManualListContext = Pick<DropZoneStore, \"actions\" | \"fileStateArray\">;\n\ntype FileListManualListVariant = {\n\tchildren: React.ReactNode | ((context: ListManualListContext) => React.ReactNode);\n\trenderMode: \"manual-list\";\n};\n\nexport type DropZoneFileListProps = {\n\tasChild?: boolean;\n\tforceMount?: boolean;\n} & (FileListManualListVariant | FileListPerItemVariant)\n\t& Omit<PartInputProps[\"fileList\"], \"children\">;\n\nexport function DropZoneFileList<TElement extends React.ElementType = \"ul\">(\n\tprops: PolymorphicPropsStrict<TElement, DropZoneFileListProps>\n) {\n\tconst {\n\t\tas: Element = \"ul\",\n\t\tasChild,\n\t\tchildren,\n\t\tforceMount = false,\n\t\trenderMode = \"per-item\",\n\t\t...restOfProps\n\t} = props;\n\n\tconst fileStateArray = useDropZoneStoreContext((store) => store.fileStateArray);\n\tconst actions = useDropZoneStoreContext((store) => store.actions);\n\n\tconst { disableInternalStateSubscription, propGetters } = useDropZoneRootContext();\n\n\tconst childrenMap = {\n\t\t\"manual-list\": () => {\n\t\t\tconst childrenFn = children as Extract<FileListManualListVariant[\"children\"], AnyFunction>;\n\t\t\treturn childrenFn({ actions, fileStateArray });\n\t\t},\n\t\t\"per-item\": () => {\n\t\t\tconst childrenFn = children as Extract<FileListPerItemVariant[\"children\"], AnyFunction>;\n\n\t\t\treturn (\n\t\t\t\t<For\n\t\t\t\t\teach={fileStateArray}\n\t\t\t\t\trenderItem={(fileState, index, array) => childrenFn({ actions, array, fileState, index })}\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t} satisfies Record<typeof renderMode, () => React.ReactNode>;\n\n\tconst hasFiles = fileStateArray.length > 0;\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\treturn (\n\t\t<Presence present={hasFiles} forceMount={forceMount}>\n\t\t\t<Component\n\t\t\t\t{...propGetters.getFileListProps({\n\t\t\t\t\t...(disableInternalStateSubscription && { \"data-state\": hasFiles ? \"active\" : \"inactive\" }),\n\t\t\t\t\t...restOfProps,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{isFunction(children) ? childrenMap[renderMode]() : children}\n\t\t\t</Component>\n\t\t</Presence>\n\t);\n}\n\nexport type DropZoneFileItemProps = FileItemContextType & {\n\tasChild?: boolean;\n} & PartInputProps[\"fileItem\"];\n\nexport function DropZoneFileItem<TElement extends React.ElementType = \"li\">(\n\tprops: PolymorphicPropsStrict<TElement, DropZoneFileItemProps>\n) {\n\tconst { as: Element = \"li\", asChild, fileState, ...restOfProps } = props;\n\n\tconst { propGetters } = useDropZoneRootContext();\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\tconst contextValue = useMemo<FileItemContextType>(\n\t\t() => ({ fileState }) satisfies FileItemContextType,\n\t\t[fileState]\n\t);\n\n\treturn (\n\t\t<FileItemContextProvider value={contextValue}>\n\t\t\t<Component {...propGetters.getFileItemProps(restOfProps)} />\n\t\t</FileItemContextProvider>\n\t);\n}\n\nexport type DropZoneFileItemDeleteProps = {\n\tasChild?: boolean;\n} & PartInputProps[\"fileItemDelete\"];\n\nexport function DropZoneFileItemDelete(props: DropZoneFileItemDeleteProps) {\n\tconst { asChild, fileStateOrID, ...restOfProps } = props;\n\n\tconst { propGetters } = useDropZoneRootContext();\n\n\tconst fileItemContextValue = useFileItemContext();\n\n\tconst Component = asChild ? Slot.Root : \"button\";\n\n\tconst resolvedFileStateOrID = fileStateOrID ?? fileItemContextValue?.fileState;\n\n\treturn (\n\t\t<Component\n\t\t\t{...propGetters.getFileItemDeleteProps({ fileStateOrID: resolvedFileStateOrID, ...restOfProps })}\n\t\t/>\n\t);\n}\n\ntype StrictExtract<TUnion, TPick extends TUnion> = Extract<TUnion, TPick>;\n\nexport type DropZoneFileItemProgressProps = {\n\tasChild?: boolean;\n\tforceMount?: boolean;\n\tsize?: number;\n} & PartInputProps[\"fileItemProgress\"]\n\t& (\n\t\t| {\n\t\t\t\tclassNames?: { svgCircleOne?: string; svgCircleTwo?: string; svgRoot?: string };\n\t\t\t\tvariant: StrictExtract<PartInputProps[\"fileItemProgress\"][\"variant\"], \"circular\">;\n\t\t }\n\t\t| {\n\t\t\t\tclassNames?: { track?: string };\n\t\t\t\tvariant: StrictExtract<PartInputProps[\"fileItemProgress\"][\"variant\"], \"fill\">;\n\t\t }\n\t\t| {\n\t\t\t\tclassNames?: { track?: string };\n\t\t\t\tvariant?: StrictExtract<PartInputProps[\"fileItemProgress\"][\"variant\"], \"linear\">;\n\t\t }\n\t);\n\nexport function DropZoneFileItemProgress<TElement extends React.ElementType = \"span\">(\n\tprops: PolymorphicPropsStrict<TElement, DropZoneFileItemProgressProps>\n) {\n\tconst {\n\t\tas: Element = \"span\",\n\t\tasChild,\n\t\tclassName,\n\t\tclassNames: classNamesProp,\n\t\tforceMount = false,\n\t\tsize = 40,\n\t\tvariant = \"linear\",\n\t\t...restOfProps\n\t} = props;\n\n\tconst classNames = classNamesProp as\n\t\t| UnionToIntersection<NonNullable<typeof classNamesProp>>\n\t\t| undefined;\n\n\tconst fileItemContextValue = useFileItemContext();\n\n\tconst fileState = fileItemContextValue?.fileState;\n\n\tconst { propGetters } = useDropZoneRootContext();\n\n\tif (!fileState) {\n\t\treturn null;\n\t}\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\tconst componentProps = propGetters.getFileItemProgressProps({ variant, ...restOfProps });\n\n\treturn (\n\t\t<Presence\n\t\t\tpresent={fileState.progress !== 100}\n\t\t\tforceMount={forceMount}\n\t\t\tclassName=\"data-[animation-phase=exit]:animate-progress-out\"\n\t\t>\n\t\t\t<Component className={cnMerge(\"inline-block\", className)} {...componentProps}>\n\t\t\t\t<Switch.Root>\n\t\t\t\t\t<Switch.Match when={variant === \"circular\"}>\n\t\t\t\t\t\t{() => {\n\t\t\t\t\t\t\tconst circumference = 2 * Math.PI * ((size - 4) / 2);\n\t\t\t\t\t\t\tconst strokeDashoffset = circumference - (fileState.progress / 100) * circumference;\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\tclassName={cnMerge(\"-rotate-90\", classNames?.svgRoot)}\n\t\t\t\t\t\t\t\t\twidth={size}\n\t\t\t\t\t\t\t\t\theight={size}\n\t\t\t\t\t\t\t\t\tviewBox={`0 0 ${size} ${size}`}\n\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<circle\n\t\t\t\t\t\t\t\t\t\tclassName={cnMerge(\"text-zu-primary/20\", classNames?.svgCircleOne)}\n\t\t\t\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\t\t\t\tcx={size / 2}\n\t\t\t\t\t\t\t\t\t\tcy={size / 2}\n\t\t\t\t\t\t\t\t\t\tr={(size - 4) / 2}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<circle\n\t\t\t\t\t\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\t\t\t\t\t\"text-zu-primary transition-[stroke-dashoffset] duration-300 ease-linear\",\n\t\t\t\t\t\t\t\t\t\t\tclassNames?.svgCircleTwo\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\t\t\t\tstrokeDasharray={2 * Math.PI * ((size - 4) / 2)}\n\t\t\t\t\t\t\t\t\t\tstrokeDashoffset={strokeDashoffset}\n\t\t\t\t\t\t\t\t\t\tcx={size / 2}\n\t\t\t\t\t\t\t\t\t\tcy={size / 2}\n\t\t\t\t\t\t\t\t\t\tr={(size - 4) / 2}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}}\n\t\t\t\t\t</Switch.Match>\n\t\t\t\t\t<Switch.Match when={variant === \"fill\"}>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\t\t`size-full bg-zu-primary/50 transition-[clip-path] duration-300 ease-linear\n\t\t\t\t\t\t\t\t[clip-path:var(--clip-path)]`,\n\t\t\t\t\t\t\t\tclassNames?.track\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"--clip-path\": `inset(${100 - fileState.progress}% 0% 0% 0%)`,\n\t\t\t\t\t\t\t\t} satisfies CssWithCustomProperties as CssWithCustomProperties\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Switch.Match>\n\t\t\t\t\t<Switch.Match when={variant === \"linear\"}>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\t\t`inline-block size-full grow translate-x-(--translate-distance) bg-zu-primary\n\t\t\t\t\t\t\t\ttransition-transform duration-300 ease-linear`,\n\t\t\t\t\t\t\t\tclassNames?.track\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"--translate-distance\": `-${100 - fileState.progress}%`,\n\t\t\t\t\t\t\t\t} satisfies CssWithCustomProperties as CssWithCustomProperties\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Switch.Match>\n\t\t\t\t</Switch.Root>\n\t\t\t</Component>\n\t\t</Presence>\n\t);\n}\n\ntype NodeCtx<TElement extends React.ElementType> = {\n\tgetProps: (innerProps: Partial<InferProps<TElement>>) => InferProps<TElement>;\n};\n\ntype RenderPreviewDetails<TElement extends React.ElementType = \"svg\"> = UnionDiscriminator<\n\t[\n\t\t{ props: InferProps<TElement> },\n\t\t{ node: React.ReactNode | ((ctx: NodeCtx<TElement>) => React.ReactNode) },\n\t]\n>;\n\ntype RenderPropContext = Pick<FileItemContextType, \"fileState\"> & {\n\tfileExtension: string;\n\tfileType: string;\n};\n\ntype RenderPreviewObject = {\n\tarchive?: RenderPreviewDetails;\n\taudio?: RenderPreviewDetails;\n\tcode?: RenderPreviewDetails;\n\tdefault?: RenderPreviewDetails;\n\texecutable?: RenderPreviewDetails;\n\timage?: RenderPreviewDetails<\"img\">;\n\ttext?: RenderPreviewDetails;\n\tvideo?: RenderPreviewDetails;\n};\ntype RenderPreviewFn = (context: RenderPropContext) => RenderPreviewObject;\n\ntype RenderPreview = RenderPreviewFn | RenderPreviewObject;\n\nexport type DropZoneFileItemPreviewProps = Partial<Pick<FileItemContextType, \"fileState\">> & {\n\tasChild?: boolean;\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((context: RenderPropContext & { fallbackPreview: () => React.ReactNode }) => React.ReactNode);\n\trenderPreview?: boolean | RenderPreview;\n} & Omit<PartInputProps[\"fileItemPreview\"], \"children\">;\n\nexport function DropZoneFileItemPreview<TElement extends React.ElementType>(\n\tprops: PolymorphicPropsStrict<TElement, DropZoneFileItemPreviewProps>\n) {\n\tconst {\n\t\tas: Element = \"span\",\n\t\tasChild,\n\t\tchildren,\n\t\tfileState: fileStateProp,\n\t\trenderPreview = true,\n\t\t...restOfProps\n\t} = props;\n\n\tconst fileItemContextValue = useFileItemContext();\n\n\tconst { propGetters } = useDropZoneRootContext();\n\n\tconst fileState = fileStateProp ?? fileItemContextValue?.fileState;\n\n\tif (!fileState) {\n\t\treturn null;\n\t}\n\n\tconst fileType = fileState.file.type ?? \"\";\n\n\tconst fileExtension = fileState.file.name?.split(\".\").pop()?.toLowerCase() ?? \"\";\n\n\tconst Component = asChild ? Slot.Root : Element;\n\n\tconst fallbackPreview = () =>\n\t\tgetFilePreviewOrIcon({ fileExtension, fileState, fileType, renderPreview });\n\n\tconst resolvedChildren =\n\t\tisFunction(children) ? children({ fallbackPreview, fileExtension, fileState, fileType }) : children;\n\n\treturn (\n\t\t<Component {...propGetters.getFileItemPreviewProps(restOfProps)}>\n\t\t\t{renderPreview && fallbackPreview()}\n\t\t\t{resolvedChildren}\n\t\t</Component>\n\t);\n}\n\nconst resolvePreviewNode = <\n\tTPreviewDetail extends NonNullable<RenderPreviewObject[keyof RenderPreviewObject]>,\n\tTNodeFn extends Extract<TPreviewDetail[\"node\"], AnyFunction>,\n>(\n\tdetails: TPreviewDetail | undefined,\n\tgetProps: Parameters<TNodeFn>[0][\"getProps\"] = ((props: unknown) => props) as never\n) => {\n\tconst resolvedNode =\n\t\tisFunction(details?.node) ? details.node({ getProps: getProps as never }) : details?.node;\n\n\treturn resolvedNode;\n};\n\nconst getFilePreviewOrIcon = (\n\tcontext: Pick<Required<DropZoneFileItemPreviewProps>, \"renderPreview\"> & Required<RenderPropContext>\n): React.ReactNode => {\n\tconst { fileExtension, fileState, fileType, renderPreview } = context;\n\n\tconst renderPreviewValue = isBoolean(renderPreview) ? {} : renderPreview;\n\n\tconst resolvedRenderPreviewObject =\n\t\tisFunction(renderPreviewValue) ?\n\t\t\trenderPreviewValue({ fileExtension, fileState, fileType })\n\t\t:\trenderPreviewValue;\n\n\tswitch (true) {\n\t\tcase fileType.startsWith(\"image/\"): {\n\t\t\tconst resolvedNode = resolvePreviewNode(resolvedRenderPreviewObject.image, (innerProps) => ({\n\t\t\t\t...innerProps,\n\t\t\t\talt: innerProps.alt ?? fileState.file.name ?? \"\",\n\t\t\t\tclassName: cnMerge(\"size-full object-cover\", innerProps.className),\n\t\t\t\tsrc: innerProps.src ?? fileState.preview,\n\t\t\t}));\n\n\t\t\treturn (\n\t\t\t\tresolvedNode ?? (\n\t\t\t\t\t<img\n\t\t\t\t\t\t{...resolvedRenderPreviewObject.image?.props}\n\t\t\t\t\t\tsrc={fileState.preview}\n\t\t\t\t\t\talt={fileState.file.name ?? \"\"}\n\t\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\t\"size-full object-cover\",\n\t\t\t\t\t\t\tresolvedRenderPreviewObject.image?.props?.className\n\t\t\t\t\t\t)}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tcase fileType.startsWith(\"video/\"): {\n\t\t\tconst resolvedNode = resolvePreviewNode(resolvedRenderPreviewObject.video, (innerProps) => ({\n\t\t\t\t...innerProps,\n\t\t\t\tclassName: cnMerge(\"size-full object-cover\", innerProps.className),\n\t\t\t}));\n\n\t\t\treturn (\n\t\t\t\tresolvedNode ?? (\n\t\t\t\t\t<FileVideoIcon\n\t\t\t\t\t\t{...resolvedRenderPreviewObject.video?.props}\n\t\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\t\"size-full object-cover\",\n\t\t\t\t\t\t\tresolvedRenderPreviewObject.video?.props?.className\n\t\t\t\t\t\t)}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tcase fileType.startsWith(\"audio/\"): {\n\t\t\tconst resolvedNode = resolvePreviewNode(resolvedRenderPreviewObject.audio, (innerProps) => ({\n\t\t\t\t...innerProps,\n\t\t\t\tclassName: cnMerge(\"size-full object-cover\", innerProps.className),\n\t\t\t}));\n\n\t\t\treturn (\n\t\t\t\tresolvedNode ?? (\n\t\t\t\t\t<FileAudioIcon\n\t\t\t\t\t\t{...resolvedRenderPreviewObject.audio?.props}\n\t\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\t\"size-full object-cover\",\n\t\t\t\t\t\t\tresolvedRenderPreviewObject.audio?.props?.className\n\t\t\t\t\t\t)}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tcase fileType.startsWith(\"text/\") || [\"md\", \"pdf\", \"rtf\", \"txt\"].includes(fileExtension): {\n\t\t\tconst resolvedNode = resolvePreviewNode(resolvedRenderPreviewObject.text);\n\n\t\t\treturn resolvedNode ?? <FileTextIcon {...resolvedRenderPreviewObject.text?.props} />;\n\t\t}\n\n\t\tcase [\n\t\t\t\"c\",\n\t\t\t\"cpp\",\n\t\t\t\"cs\",\n\t\t\t\"css\",\n\t\t\t\"html\",\n\t\t\t\"java\",\n\t\t\t\"js\",\n\t\t\t\"json\",\n\t\t\t\"jsx\",\n\t\t\t\"php\",\n\t\t\t\"py\",\n\t\t\t\"rb\",\n\t\t\t\"ts\",\n\t\t\t\"tsx\",\n\t\t\t\"xml\",\n\t\t].includes(fileExtension): {\n\t\t\tconst resolvedNode = resolvePreviewNode(resolvedRenderPreviewObject.code);\n\n\t\t\treturn resolvedNode ?? <FileCodeIcon {...resolvedRenderPreviewObject.code?.props} />;\n\t\t}\n\n\t\tcase [\"7z\", \"bz2\", \"gz\", \"rar\", \"tar\", \"zip\"].includes(fileExtension): {\n\t\t\tconst resolvedNode = resolvePreviewNode(resolvedRenderPreviewObject.archive);\n\n\t\t\treturn resolvedNode ?? <FileArchiveIcon {...resolvedRenderPreviewObject.archive?.props} />;\n\t\t}\n\n\t\tcase [\"apk\", \"app\", \"deb\", \"exe\", \"msi\", \"rpm\"].includes(fileExtension): {\n\t\t\tconst resolvedNode = resolvePreviewNode(resolvedRenderPreviewObject.executable);\n\n\t\t\treturn resolvedNode ?? <FileCogIcon {...resolvedRenderPreviewObject.executable?.props} />;\n\t\t}\n\n\t\tdefault: {\n\t\t\tconst resolvedNode = resolvePreviewNode(resolvedRenderPreviewObject.default);\n\n\t\t\treturn resolvedNode ?? <FileIcon {...resolvedRenderPreviewObject.default?.props} />;\n\t\t}\n\t}\n};\n\nexport type DropZoneFileItemMetadataProps = Partial<Pick<FileItemContextType, \"fileState\">> & {\n\tasChild?: boolean;\n\tchildren?: React.ReactNode | ((context: Pick<FileItemContextType, \"fileState\">) => React.ReactNode);\n\tclassNames?: {\n\t\tname?: string;\n\t\tsize?: string;\n\t};\n\tsize?: \"default\" | \"sm\";\n} & Omit<PartInputProps[\"fileItemMetadata\"], \"children\">;\n\nexport function DropZoneFileItemMetadata(props: DropZoneFileItemMetadataProps) {\n\tconst {\n\t\tasChild,\n\t\tchildren,\n\t\tclassNames,\n\t\tfileState: fileStateProp,\n\t\tsize = \"default\",\n\t\t...restOfProps\n\t} = props;\n\n\tconst fileItemContextValue = useFileItemContext();\n\n\tconst { propGetters } = useDropZoneRootContext();\n\n\tconst fileState = fileStateProp ?? fileItemContextValue?.fileState;\n\n\tif (!fileState) {\n\t\treturn null;\n\t}\n\n\tconst Component = asChild ? Slot.Root : \"div\";\n\n\tconst resolvedChildren = isFunction(children) ? children({ fileState }) : children;\n\n\tconst getDefaultMetadataChildren = () => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<p\n\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\"truncate\",\n\t\t\t\t\t\tsize === \"default\" && \"text-[14px] font-medium\",\n\t\t\t\t\t\tsize === \"sm\" && \"text-[13px] leading-snug\",\n\t\t\t\t\t\tclassNames?.name\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{fileState.file.name}\n\t\t\t\t</p>\n\t\t\t\t<p\n\t\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\t\"truncate text-zu-muted-foreground\",\n\t\t\t\t\t\tsize === \"default\" && \"text-[12px]\",\n\t\t\t\t\t\tsize === \"sm\" && \"text-[11px] leading-snug\",\n\t\t\t\t\t\tclassNames?.size\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{isNumber(fileState.file.size) && formatBytes(fileState.file.size)}\n\t\t\t\t</p>\n\t\t\t\t{fileState.error && (\n\t\t\t\t\t<p className=\"text-[12px] text-zu-destructive\">{fileState.error.message}</p>\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n\n\treturn (\n\t\t<Component {...propGetters.getFileItemMetadataProps(restOfProps)}>\n\t\t\t{resolvedChildren ?? getDefaultMetadataChildren()}\n\t\t</Component>\n\t);\n}\n\nexport type DropZoneFileClearProps = {\n\tasChild?: boolean;\n\tforceMount?: boolean;\n} & PartInputProps[\"fileItemClear\"];\n\nexport function DropZoneFileClear(props: DropZoneFileClearProps) {\n\tconst { asChild, forceMount = false, ...restOfProps } = props;\n\n\tconst { propGetters } = useDropZoneRootContext();\n\n\tconst fileCount = useDropZoneStoreContext((state) => state.fileStateArray.length);\n\n\tconst shouldRender = forceMount || fileCount > 0;\n\n\tif (!shouldRender) {\n\t\treturn null;\n\t}\n\n\tconst Component = asChild ? Slot.Root : \"button\";\n\n\treturn <Component {...propGetters.getFileItemClearProps(restOfProps)} />;\n}\n\n/* eslint-enable perfectionist/sort-intersection-types -- I need non-standard props to come first */\n","export {\n\tDropZoneArea as Area,\n\tDropZoneContainer as Container,\n\tDropZoneContext as Context,\n\tDropZoneFileClear as FileClear,\n\tDropZoneFileItem as FileItem,\n\tDropZoneFileItemDelete as FileItemDelete,\n\tDropZoneFileItemMetadata as FileItemMetadata,\n\tDropZoneFileItemPreview as FileItemPreview,\n\tDropZoneFileItemProgress as FileItemProgress,\n\tDropZoneFileList as FileList,\n\tDropZoneInput as Input,\n\tDropZoneRoot as Root,\n\tDropZoneTrigger as Trigger,\n} from \"./drop-zone\";\n"],"mappings":";;;;;;;;;;;;;;;AAIA,MAAM,CAAC,8B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zD,KAAI,CAAC,UACJ,QAAO;CAGR,MAAM,YAAY,UAAUA,WAAY;CAExC,MAAM,mBAAmB,WAAW,SAAS,GAAG,SAAS,EAAE,WAAW,CAAC,GAAG;CAE1E,MAAM,mCAAmC;AACxC,SACC,qBAAA,YAAA,EAAA,UAAA;GACC,oBAAC,KAAD;IACC,WAAW,QACV,YACA,SAAS,aAAa,2BACtB,SAAS,QAAQ,4BACjB,YAAY,KACZ;cAEA,UAAU,KAAK;IACb,CAAA;GACJ,oBAAC,KAAD;IACC,WAAW,QACV,qCACA,SAAS,aAAa,eACtB,SAAS,QAAQ,4BACjB,YAAY,KACZ;cAEA,SAAS,UAAU,KAAK,KAAK,IAAI,YAAY,UAAU,KAAK,KAAK;IAC/D,CAAA;GACH,UAAU,SACV,oBAAC,KAAD;IAAG,WAAU;cAAmC,UAAU,MAAM;IAAY,CAAA;GAE3E,EAAA,CAAA;;AAIL,QACC,oBAAC,WAAD;EAAW,GAAI,YAAY,yBAAyB,YAAY;YAC9D,oBAAoB,4BAA4B;EACtC,CAAA;;AASd,SAAgB,kBAAkB,OAA+B;CAChE,MAAM,EAAE,SAAS,aAAa,OAAO,GAAG,gBAAgB;CAExD,MAAM,EAAE,gBAAgB,wBAAwB;CAEhD,MAAM,YAAY,yBAAyB,UAAU,MAAM,eAAe,OAAO;AAIjF,KAAI,EAFiB,cAAc,YAAY,GAG9C,QAAO;AAKR,QAAO,oBAFW,UAAUA,WAAY,UAEjC,EAAW,GAAI,YAAY,sBAAsB,YAAY,EAAI,CAAA"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes