@uselets/ui 2.0.1 → 2.1.0

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 (246) hide show
  1. package/README.md +8 -0
  2. package/dist/{as-child-Dxg3Xo1G.d.ts → as-child-T9W73ZYU.d.ts} +1 -3
  3. package/dist/{chart-B_6nC_ih.d.ts → chart-8rgtsk95.d.ts} +1 -3
  4. package/dist/checkbox-group-context-HDVxTNPi.js +2 -0
  5. package/dist/checkbox-group-context-HDVxTNPi.js.map +1 -0
  6. package/dist/cli/uselets.mjs.map +1 -1
  7. package/dist/combobox-styles-CZ0aJayc.js +2 -0
  8. package/dist/combobox-styles-CZ0aJayc.js.map +1 -0
  9. package/dist/components/accordion.d.ts +1 -3
  10. package/dist/components/accordion.js.map +1 -1
  11. package/dist/components/alert-dialog.d.ts +1 -3
  12. package/dist/components/alert-dialog.js.map +1 -1
  13. package/dist/components/alert.d.ts +0 -2
  14. package/dist/components/alert.js.map +1 -1
  15. package/dist/components/anchor.d.ts +1 -3
  16. package/dist/components/anchor.js.map +1 -1
  17. package/dist/components/area-chart.d.ts +1 -3
  18. package/dist/components/area-chart.js.map +1 -1
  19. package/dist/components/autocomplete.d.ts +46 -0
  20. package/dist/components/autocomplete.js +2 -0
  21. package/dist/components/autocomplete.js.map +1 -0
  22. package/dist/components/avatar.d.ts +1 -3
  23. package/dist/components/avatar.js.map +1 -1
  24. package/dist/components/badge.d.ts +1 -3
  25. package/dist/components/badge.js +1 -1
  26. package/dist/components/badge.js.map +1 -1
  27. package/dist/components/bar-chart.d.ts +1 -3
  28. package/dist/components/bar-chart.js.map +1 -1
  29. package/dist/components/bottom-nav.d.ts +1 -3
  30. package/dist/components/bottom-nav.js.map +1 -1
  31. package/dist/components/breadcrumb.d.ts +1 -3
  32. package/dist/components/breadcrumb.js.map +1 -1
  33. package/dist/components/button-group.d.ts +1 -3
  34. package/dist/components/button-group.js.map +1 -1
  35. package/dist/components/button.d.ts +1 -3
  36. package/dist/components/button.js +1 -1
  37. package/dist/components/button.js.map +1 -1
  38. package/dist/components/calendar.d.ts +0 -2
  39. package/dist/components/calendar.js +1 -1
  40. package/dist/components/calendar.js.map +1 -1
  41. package/dist/components/card.d.ts +0 -2
  42. package/dist/components/card.js.map +1 -1
  43. package/dist/components/carousel.d.ts +0 -2
  44. package/dist/components/carousel.js.map +1 -1
  45. package/dist/components/center.d.ts +0 -2
  46. package/dist/components/center.js.map +1 -1
  47. package/dist/components/chart.d.ts +1 -1
  48. package/dist/components/chart.js.map +1 -1
  49. package/dist/components/checkbox-group.d.ts +19 -0
  50. package/dist/components/checkbox-group.js +2 -0
  51. package/dist/components/checkbox-group.js.map +1 -0
  52. package/dist/components/checkbox.d.ts +2 -4
  53. package/dist/components/checkbox.js +1 -1
  54. package/dist/components/checkbox.js.map +1 -1
  55. package/dist/components/code.d.ts +0 -2
  56. package/dist/components/code.js.map +1 -1
  57. package/dist/components/collapsible.d.ts +1 -3
  58. package/dist/components/collapsible.js.map +1 -1
  59. package/dist/components/combobox.d.ts +1 -3
  60. package/dist/components/combobox.js +1 -1
  61. package/dist/components/combobox.js.map +1 -1
  62. package/dist/components/command.d.ts +0 -2
  63. package/dist/components/command.js +1 -1
  64. package/dist/components/command.js.map +1 -1
  65. package/dist/components/container.d.ts +0 -2
  66. package/dist/components/container.js.map +1 -1
  67. package/dist/components/data-table.d.ts +0 -2
  68. package/dist/components/data-table.js +1 -1
  69. package/dist/components/data-table.js.map +1 -1
  70. package/dist/components/date-range-picker.d.ts +0 -2
  71. package/dist/components/date-range-picker.js.map +1 -1
  72. package/dist/components/dialog.d.ts +1 -3
  73. package/dist/components/dialog.js.map +1 -1
  74. package/dist/components/direction.d.ts +0 -2
  75. package/dist/components/donut-chart.d.ts +0 -2
  76. package/dist/components/donut-chart.js.map +1 -1
  77. package/dist/components/drawer.d.ts +1 -3
  78. package/dist/components/drawer.js.map +1 -1
  79. package/dist/components/dropdown-menu.d.ts +1 -3
  80. package/dist/components/dropdown-menu.js.map +1 -1
  81. package/dist/components/dropzone.d.ts +0 -2
  82. package/dist/components/dropzone.js +1 -1
  83. package/dist/components/dropzone.js.map +1 -1
  84. package/dist/components/empty.d.ts +0 -2
  85. package/dist/components/empty.js.map +1 -1
  86. package/dist/components/field.d.ts +0 -2
  87. package/dist/components/field.js +1 -1
  88. package/dist/components/field.js.map +1 -1
  89. package/dist/components/flex.d.ts +0 -2
  90. package/dist/components/flex.js.map +1 -1
  91. package/dist/components/grid.d.ts +0 -2
  92. package/dist/components/grid.js.map +1 -1
  93. package/dist/components/group.d.ts +0 -2
  94. package/dist/components/group.js.map +1 -1
  95. package/dist/components/heading.d.ts +1 -3
  96. package/dist/components/heading.js.map +1 -1
  97. package/dist/components/hover-card.d.ts +1 -3
  98. package/dist/components/hover-card.js.map +1 -1
  99. package/dist/components/input-group.d.ts +0 -2
  100. package/dist/components/input-group.js.map +1 -1
  101. package/dist/components/input-otp.d.ts +0 -2
  102. package/dist/components/input-otp.js.map +1 -1
  103. package/dist/components/input.d.ts +0 -2
  104. package/dist/components/input.js.map +1 -1
  105. package/dist/components/kbd.d.ts +0 -2
  106. package/dist/components/kbd.js.map +1 -1
  107. package/dist/components/label.d.ts +1 -3
  108. package/dist/components/label.js.map +1 -1
  109. package/dist/components/list.d.ts +1 -3
  110. package/dist/components/list.js.map +1 -1
  111. package/dist/components/logo.d.ts +0 -2
  112. package/dist/components/marker.d.ts +1 -3
  113. package/dist/components/marker.js.map +1 -1
  114. package/dist/components/mask-input.d.ts +1 -3
  115. package/dist/components/mask-input.js +1 -1
  116. package/dist/components/mask-input.js.map +1 -1
  117. package/dist/components/meter.d.ts +21 -0
  118. package/dist/components/meter.js +2 -0
  119. package/dist/components/meter.js.map +1 -0
  120. package/dist/components/native-select.d.ts +0 -2
  121. package/dist/components/native-select.js.map +1 -1
  122. package/dist/components/navigation-menu.d.ts +1 -3
  123. package/dist/components/navigation-menu.js.map +1 -1
  124. package/dist/components/number-field.d.ts +1 -3
  125. package/dist/components/number-field.js +1 -1
  126. package/dist/components/number-field.js.map +1 -1
  127. package/dist/components/pagination.d.ts +0 -2
  128. package/dist/components/pagination.js.map +1 -1
  129. package/dist/components/phone-input.d.ts +0 -2
  130. package/dist/components/phone-input.js +1 -1
  131. package/dist/components/phone-input.js.map +1 -1
  132. package/dist/components/pie-chart.d.ts +1 -3
  133. package/dist/components/pie-chart.js.map +1 -1
  134. package/dist/components/popover.d.ts +1 -3
  135. package/dist/components/popover.js.map +1 -1
  136. package/dist/components/progress.d.ts +0 -2
  137. package/dist/components/progress.js +1 -1
  138. package/dist/components/progress.js.map +1 -1
  139. package/dist/components/radio-group.d.ts +0 -2
  140. package/dist/components/radio-group.js +1 -1
  141. package/dist/components/radio-group.js.map +1 -1
  142. package/dist/components/resizable.d.ts +0 -2
  143. package/dist/components/resizable.js.map +1 -1
  144. package/dist/components/ring-progress.d.ts +0 -2
  145. package/dist/components/ring-progress.js +1 -1
  146. package/dist/components/ring-progress.js.map +1 -1
  147. package/dist/components/scroll-area.d.ts +0 -2
  148. package/dist/components/scroll-area.js.map +1 -1
  149. package/dist/components/select.d.ts +1 -3
  150. package/dist/components/select.js.map +1 -1
  151. package/dist/components/separator.d.ts +1 -3
  152. package/dist/components/separator.js.map +1 -1
  153. package/dist/components/sidebar.d.ts +2 -4
  154. package/dist/components/sidebar.js +1 -1
  155. package/dist/components/sidebar.js.map +1 -1
  156. package/dist/components/simple-grid.d.ts +0 -2
  157. package/dist/components/simple-grid.js.map +1 -1
  158. package/dist/components/skeleton.d.ts +0 -2
  159. package/dist/components/skeleton.js.map +1 -1
  160. package/dist/components/slider.d.ts +0 -2
  161. package/dist/components/slider.js.map +1 -1
  162. package/dist/components/sonner.d.ts +0 -2
  163. package/dist/components/sonner.js.map +1 -1
  164. package/dist/components/spinner.d.ts +0 -2
  165. package/dist/components/spinner.js.map +1 -1
  166. package/dist/components/stack.d.ts +0 -2
  167. package/dist/components/stack.js.map +1 -1
  168. package/dist/components/stepper.d.ts +1 -3
  169. package/dist/components/stepper.js +1 -1
  170. package/dist/components/stepper.js.map +1 -1
  171. package/dist/components/switch.d.ts +0 -2
  172. package/dist/components/switch.js +1 -1
  173. package/dist/components/switch.js.map +1 -1
  174. package/dist/components/table.d.ts +0 -2
  175. package/dist/components/table.js.map +1 -1
  176. package/dist/components/tabs.d.ts +1 -3
  177. package/dist/components/tabs.js.map +1 -1
  178. package/dist/components/text.d.ts +1 -3
  179. package/dist/components/text.js.map +1 -1
  180. package/dist/components/textarea.d.ts +0 -2
  181. package/dist/components/textarea.js.map +1 -1
  182. package/dist/components/theme.d.ts +0 -2
  183. package/dist/components/theme.js.map +1 -1
  184. package/dist/components/timeline.d.ts +0 -2
  185. package/dist/components/timeline.js.map +1 -1
  186. package/dist/components/toggle-group.d.ts +1 -3
  187. package/dist/components/toggle-group.js.map +1 -1
  188. package/dist/components/toggle.d.ts +1 -3
  189. package/dist/components/toggle.js +1 -1
  190. package/dist/components/toggle.js.map +1 -1
  191. package/dist/components/toolbar.d.ts +30 -0
  192. package/dist/components/toolbar.js +2 -0
  193. package/dist/components/toolbar.js.map +1 -0
  194. package/dist/components/tooltip.d.ts +1 -3
  195. package/dist/components/tooltip.js.map +1 -1
  196. package/dist/components/unstyled-button.d.ts +1 -3
  197. package/dist/components/unstyled-button.js.map +1 -1
  198. package/dist/components/visibility.d.ts +0 -2
  199. package/dist/components/visibility.js.map +1 -1
  200. package/dist/hooks/use-breakpoint-value.d.ts +0 -2
  201. package/dist/hooks/use-breakpoint-value.js.map +1 -1
  202. package/dist/hooks/use-breakpoint.d.ts +0 -2
  203. package/dist/hooks/use-breakpoint.js.map +1 -1
  204. package/dist/hooks/use-disclosure.d.ts +0 -2
  205. package/dist/hooks/use-disclosure.js.map +1 -1
  206. package/dist/hooks/use-document-visibility.d.ts +0 -2
  207. package/dist/hooks/use-document-visibility.js.map +1 -1
  208. package/dist/hooks/use-hotkeys.d.ts +1 -1
  209. package/dist/hooks/use-idle.d.ts +0 -2
  210. package/dist/hooks/use-idle.js.map +1 -1
  211. package/dist/hooks/use-interval.d.ts +0 -2
  212. package/dist/hooks/use-interval.js.map +1 -1
  213. package/dist/hooks/use-local-storage.d.ts +0 -2
  214. package/dist/hooks/use-local-storage.js.map +1 -1
  215. package/dist/hooks/use-mask.d.ts +0 -2
  216. package/dist/hooks/use-mask.js.map +1 -1
  217. package/dist/hooks/use-mobile.d.ts +0 -2
  218. package/dist/hooks/use-mobile.js.map +1 -1
  219. package/dist/index.d.ts +21 -17
  220. package/dist/index.js +1 -1
  221. package/dist/lib/as-child.d.ts +1 -1
  222. package/dist/lib/as-child.js.map +1 -1
  223. package/dist/lib/badge.d.ts +0 -2
  224. package/dist/lib/badge.js.map +1 -1
  225. package/dist/lib/button.d.ts +0 -2
  226. package/dist/lib/button.js.map +1 -1
  227. package/dist/lib/color.d.ts +0 -2
  228. package/dist/lib/color.js.map +1 -1
  229. package/dist/lib/compose-refs.d.ts +0 -2
  230. package/dist/lib/compose-refs.js.map +1 -1
  231. package/dist/lib/progress.d.ts +0 -2
  232. package/dist/lib/progress.js.map +1 -1
  233. package/dist/lib/utils.d.ts +0 -2
  234. package/dist/lib/utils.js.map +1 -1
  235. package/dist/logo--R3_XDgA.js.map +1 -1
  236. package/dist/postcss.config.js.map +1 -1
  237. package/dist/resolve-class-name-BurP8ngI.js.map +1 -1
  238. package/dist/skills/uselets-ui/SKILL.md +3 -3
  239. package/dist/skills/uselets-ui/references/component-catalog.md +14 -2
  240. package/dist/skills/uselets-ui/references/package-guide.md +3 -3
  241. package/dist/{use-hotkeys-D1_TEIwN.d.ts → use-hotkeys-BVm0IGb8.d.ts} +1 -5
  242. package/dist/use-hotkeys-YDJmGWX6.js.map +1 -1
  243. package/package.json +14 -14
  244. package/skills/uselets-ui/SKILL.md +3 -3
  245. package/skills/uselets-ui/references/component-catalog.md +14 -2
  246. package/skills/uselets-ui/references/package-guide.md +3 -3
@@ -1,9 +1,8 @@
1
1
  import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
- import { t as AsChildPrimitiveProps } from "../as-child-Dxg3Xo1G.js";
2
+ import { t as AsChildPrimitiveProps } from "../as-child-T9W73ZYU.js";
3
3
  import * as React from "react";
4
4
  import { VariantProps } from "class-variance-authority";
5
5
  import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
6
- //#region src/components/dialog.d.ts
7
6
  declare const dialogContentVariants: (props?: ({
8
7
  size?: "2xl" | "3xl" | "full" | "lg" | "md" | "sm" | "xl" | null | undefined;
9
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -57,6 +56,5 @@ declare function DialogBody({ className, ...props }: DialogBodyProps): React.JSX
57
56
  declare function DialogFooter({ className, showCloseButton, children, ...props }: DialogFooterProps): React.JSX.Element;
58
57
  declare function DialogTitle({ className, asChild, children, ...props }: DialogTitleProps): React.JSX.Element;
59
58
  declare function DialogDescription({ className, asChild, children, ...props }: DialogDescriptionProps): React.JSX.Element;
60
- //#endregion
61
59
  export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
62
60
  //# sourceMappingURL=dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","names":["DialogPrimitive","resolveClassName","React","Dialog$1","dialogContentVariants","cva","DialogContext","props","contextValue","size","dismissible","disablePointerDismissal","eventDetails","onOpenChange","open","toAsChildRenderProps","asChild","children","cn","className","state","stopPropagationHandler","onClick","overlayProps","overlayRef","showCloseButton","Button","IconX"],"sources":["../../src/components/dialog.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Dialog as DialogPrimitive } from '@base-ui/react/dialog'\nimport { IconX } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { type AsChildPrimitiveProps, toAsChildRenderProps } from '../lib/as-child'\nimport { cn, stopPropagationHandler } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\nimport { Button } from './button'\n\nconst dialogContentVariants = cva(\n [\n 'bg-background ring-foreground/10 fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none',\n 'flex flex-col gap-4 rounded-xl p-4 text-sm ring-1 duration-100',\n 'max-w-[calc(100%-2rem)] max-h-[calc(100dvh-2rem)] overflow-hidden',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95'\n ],\n {\n variants: {\n size: {\n sm: 'sm:max-w-sm',\n md: 'sm:max-w-md',\n lg: 'sm:max-w-lg',\n xl: 'sm:max-w-xl',\n '2xl': 'sm:max-w-2xl',\n '3xl': 'sm:max-w-3xl',\n full: 'w-screen h-screen max-w-none max-h-screen rounded-none sm:max-w-none'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n }\n)\n\ntype DialogSize = NonNullable<VariantProps<typeof dialogContentVariants>['size']>\ntype DialogContextValue = { size: DialogSize }\nconst DialogContext = React.createContext<DialogContextValue>({ size: 'md' })\n\nexport type DialogProps = React.ComponentProps<typeof DialogPrimitive.Root> & {\n /**\n * Dialog width. `full` fills the whole viewport.\n * @default 'md'\n */\n size?: DialogSize\n /**\n * When `false`, clicking outside and pressing Esc no longer close the dialog. The close button and `DialogClose` still work.\n * @default true\n */\n dismissible?: boolean\n}\nexport type DialogTriggerProps = AsChildPrimitiveProps<typeof DialogPrimitive.Trigger>\nexport type DialogPortalProps = React.ComponentProps<typeof DialogPrimitive.Portal>\nexport type DialogCloseProps = AsChildPrimitiveProps<typeof DialogPrimitive.Close>\nexport type DialogOverlayProps = AsChildPrimitiveProps<typeof DialogPrimitive.Backdrop>\nexport type DialogContentProps = AsChildPrimitiveProps<typeof DialogPrimitive.Popup> &\n Pick<DialogPortalProps, 'keepMounted'> & {\n /**\n * Shows the X button in the top-right corner.\n * @default true\n */\n showCloseButton?: boolean\n /** Ref to the overlay element rendered behind the dialog. */\n overlayRef?: React.Ref<HTMLDivElement>\n /** Props passed to the overlay rendered behind the dialog. */\n overlayProps?: DialogOverlayProps\n }\nexport type DialogHeaderProps = React.ComponentProps<'div'>\nexport type DialogBodyProps = React.ComponentProps<'div'>\nexport type DialogFooterProps = React.ComponentProps<'div'> & {\n /**\n * Adds an outline \"Close\" button after the footer actions.\n * @default false\n */\n showCloseButton?: boolean\n}\nexport type DialogTitleProps = AsChildPrimitiveProps<typeof DialogPrimitive.Title>\nexport type DialogDescriptionProps = AsChildPrimitiveProps<typeof DialogPrimitive.Description>\n\nfunction Dialog({ size = 'md', dismissible = true, disablePointerDismissal, onOpenChange, ...props }: DialogProps) {\n const contextValue = React.useMemo<DialogContextValue>(() => ({ size }), [size])\n\n return (\n <DialogContext.Provider value={contextValue}>\n <DialogPrimitive.Root\n data-slot=\"dialog\"\n disablePointerDismissal={!dismissible || disablePointerDismissal}\n onOpenChange={(open, eventDetails) => {\n if (!dismissible && eventDetails.reason === 'escape-key') {\n eventDetails.cancel()\n return\n }\n onOpenChange?.(open, eventDetails)\n }}\n {...props}\n />\n </DialogContext.Provider>\n )\n}\n\nfunction DialogTrigger({ asChild, children, ...props }: DialogTriggerProps) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} {...toAsChildRenderProps(asChild, children)} />\n}\n\nfunction DialogPortal({ ...props }: DialogPortalProps) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({ asChild, children, ...props }: DialogCloseProps) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} {...toAsChildRenderProps(asChild, children)} />\n}\n\nfunction DialogOverlay({ className, onClick, forceRender = true, asChild, children, ...props }: DialogOverlayProps) {\n return (\n <DialogPrimitive.Backdrop\n data-slot=\"dialog-overlay\"\n forceRender={forceRender}\n className={(state) =>\n cn(\n 'bg-black/10 fixed inset-0 isolate z-50',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0',\n 'duration-100 supports-backdrop-filter:backdrop-blur-xs',\n resolveClassName(className, state)\n )\n }\n onClick={stopPropagationHandler(onClick)}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n overlayRef,\n overlayProps,\n keepMounted,\n asChild,\n ...props\n}: DialogContentProps) {\n const { size } = React.useContext(DialogContext)\n\n return (\n <DialogPortal keepMounted={keepMounted}>\n <DialogOverlay {...overlayProps} ref={overlayRef ?? overlayProps?.ref} />\n <DialogPrimitive.Popup\n data-slot=\"dialog-content\"\n className={(state) => cn(dialogContentVariants({ size }), resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n // React events bubble through the fiber tree, not the DOM, so a portaled Popup still\n // reaches any ancestor's onClick/onSubmit even though it renders outside it in the DOM.\n onClick={stopPropagationHandler(props.onClick)}\n onSubmit={stopPropagationHandler(props.onSubmit)}\n >\n {!asChild && children}\n {showCloseButton && !asChild && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n render={<Button variant=\"ghost\" className=\"absolute top-2 right-2\" size=\"icon-sm\" />}\n >\n <IconX />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Popup>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: DialogHeaderProps) {\n return <div data-slot=\"dialog-header\" className={cn('gap-2 flex flex-col shrink-0', className)} {...props} />\n}\n\nfunction DialogBody({ className, ...props }: DialogBodyProps) {\n return <div data-slot=\"dialog-body\" className={cn('-mx-4 px-4 flex-1 overflow-y-auto', className)} {...props} />\n}\n\nfunction DialogFooter({ className, showCloseButton = false, children, ...props }: DialogFooterProps) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 shrink-0',\n 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && <DialogPrimitive.Close render={<Button variant=\"outline\" />}>Close</DialogPrimitive.Close>}\n </div>\n )\n}\n\nfunction DialogTitle({ className, asChild, children, ...props }: DialogTitleProps) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={(state) => cn('text-base leading-none font-medium', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DialogDescription({ className, asChild, children, ...props }: DialogDescriptionProps) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={(state) =>\n cn(\n 'text-muted-foreground text-sm',\n '*:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nexport {\n Dialog,\n DialogBody,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger\n}\n"],"mappings":"kdAWA,MAAMI,EAAwBC,EAC5B,CACE,qHACA,iEACA,oEACA,sIACF,EACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,cACJ,GAAI,cACJ,GAAI,cACJ,GAAI,cACJ,MAAO,eACP,MAAO,eACP,KAAM,sEACR,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CACF,EAIMC,EAAgBJ,EAAM,cAAkC,CAAE,KAAM,IAAK,CAAC,EA0C5E,SAAS,OAAO,CAAE,OAAO,KAAM,cAAc,GAAM,0BAAyB,eAAc,GAAGK,GAAsB,CACjH,IAAMC,EAAeN,EAAM,aAAmC,CAAE,MAAK,GAAI,CAACO,CAAI,CAAC,EAE/E,MACE,kBAACH,EAAc,SAAf,CAAwB,MAAOE,EAC7B,SAAA,kBAACR,EAAgB,KAAjB,CACE,YAAU,SACV,wBAAyB,CAACU,GAAeC,EACzC,cAAe,EAAM,IAAiB,CAChC,CAACD,GAAeE,EAAa,SAAW,aAC1CA,EAAa,OAAO,EAGtBC,IAAeC,EAAMF,CAA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B,CAAE,YAAW,UAAS,WAAU,GAAGV,GAAiC,CAC7F,MACE,kBAACP,EAAgB,YAAjB,CACE,YAAU,qBACV,UAAY,GACVkB,EACE,gCACA,uEACAjB,EAAiBkB,EAAWC,CAAK,CACnC,EAEF,GAAIb,EACJ,GAAIQ,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL"}
1
+ {"version":3,"file":"dialog.js","names":["DialogPrimitive","resolveClassName","React","Dialog$1","dialogContentVariants","cva","DialogContext","props","contextValue","size","dismissible","disablePointerDismissal","eventDetails","onOpenChange","open","toAsChildRenderProps","asChild","children","cn","className","state","stopPropagationHandler","onClick","overlayProps","overlayRef","showCloseButton","Button","IconX"],"sources":["../../src/components/dialog.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Dialog as DialogPrimitive } from '@base-ui/react/dialog'\nimport { IconX } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { type AsChildPrimitiveProps, toAsChildRenderProps } from '../lib/as-child'\nimport { cn, stopPropagationHandler } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\nimport { Button } from './button'\n\nconst dialogContentVariants = cva(\n [\n 'bg-background ring-foreground/10 fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none',\n 'flex flex-col gap-4 rounded-xl p-4 text-sm ring-1 duration-100',\n 'max-w-[calc(100%-2rem)] max-h-[calc(100dvh-2rem)] overflow-hidden',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95'\n ],\n {\n variants: {\n size: {\n sm: 'sm:max-w-sm',\n md: 'sm:max-w-md',\n lg: 'sm:max-w-lg',\n xl: 'sm:max-w-xl',\n '2xl': 'sm:max-w-2xl',\n '3xl': 'sm:max-w-3xl',\n full: 'w-screen h-screen max-w-none max-h-screen rounded-none sm:max-w-none'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n }\n)\n\ntype DialogSize = NonNullable<VariantProps<typeof dialogContentVariants>['size']>\ntype DialogContextValue = { size: DialogSize }\nconst DialogContext = React.createContext<DialogContextValue>({ size: 'md' })\n\nexport type DialogProps = React.ComponentProps<typeof DialogPrimitive.Root> & {\n /**\n * Dialog width. `full` fills the whole viewport.\n * @default 'md'\n */\n size?: DialogSize\n /**\n * When `false`, clicking outside and pressing Esc no longer close the dialog. The close button and `DialogClose` still work.\n * @default true\n */\n dismissible?: boolean\n}\nexport type DialogTriggerProps = AsChildPrimitiveProps<typeof DialogPrimitive.Trigger>\nexport type DialogPortalProps = React.ComponentProps<typeof DialogPrimitive.Portal>\nexport type DialogCloseProps = AsChildPrimitiveProps<typeof DialogPrimitive.Close>\nexport type DialogOverlayProps = AsChildPrimitiveProps<typeof DialogPrimitive.Backdrop>\nexport type DialogContentProps = AsChildPrimitiveProps<typeof DialogPrimitive.Popup> &\n Pick<DialogPortalProps, 'keepMounted'> & {\n /**\n * Shows the X button in the top-right corner.\n * @default true\n */\n showCloseButton?: boolean\n /** Ref to the overlay element rendered behind the dialog. */\n overlayRef?: React.Ref<HTMLDivElement>\n /** Props passed to the overlay rendered behind the dialog. */\n overlayProps?: DialogOverlayProps\n }\nexport type DialogHeaderProps = React.ComponentProps<'div'>\nexport type DialogBodyProps = React.ComponentProps<'div'>\nexport type DialogFooterProps = React.ComponentProps<'div'> & {\n /**\n * Adds an outline \"Close\" button after the footer actions.\n * @default false\n */\n showCloseButton?: boolean\n}\nexport type DialogTitleProps = AsChildPrimitiveProps<typeof DialogPrimitive.Title>\nexport type DialogDescriptionProps = AsChildPrimitiveProps<typeof DialogPrimitive.Description>\n\nfunction Dialog({ size = 'md', dismissible = true, disablePointerDismissal, onOpenChange, ...props }: DialogProps) {\n const contextValue = React.useMemo<DialogContextValue>(() => ({ size }), [size])\n\n return (\n <DialogContext.Provider value={contextValue}>\n <DialogPrimitive.Root\n data-slot=\"dialog\"\n disablePointerDismissal={!dismissible || disablePointerDismissal}\n onOpenChange={(open, eventDetails) => {\n if (!dismissible && eventDetails.reason === 'escape-key') {\n eventDetails.cancel()\n return\n }\n onOpenChange?.(open, eventDetails)\n }}\n {...props}\n />\n </DialogContext.Provider>\n )\n}\n\nfunction DialogTrigger({ asChild, children, ...props }: DialogTriggerProps) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} {...toAsChildRenderProps(asChild, children)} />\n}\n\nfunction DialogPortal({ ...props }: DialogPortalProps) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({ asChild, children, ...props }: DialogCloseProps) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} {...toAsChildRenderProps(asChild, children)} />\n}\n\nfunction DialogOverlay({ className, onClick, forceRender = true, asChild, children, ...props }: DialogOverlayProps) {\n return (\n <DialogPrimitive.Backdrop\n data-slot=\"dialog-overlay\"\n forceRender={forceRender}\n className={(state) =>\n cn(\n 'bg-black/10 fixed inset-0 isolate z-50',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0',\n 'duration-100 supports-backdrop-filter:backdrop-blur-xs',\n resolveClassName(className, state)\n )\n }\n onClick={stopPropagationHandler(onClick)}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n overlayRef,\n overlayProps,\n keepMounted,\n asChild,\n ...props\n}: DialogContentProps) {\n const { size } = React.useContext(DialogContext)\n\n return (\n <DialogPortal keepMounted={keepMounted}>\n <DialogOverlay {...overlayProps} ref={overlayRef ?? overlayProps?.ref} />\n <DialogPrimitive.Popup\n data-slot=\"dialog-content\"\n className={(state) => cn(dialogContentVariants({ size }), resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n // React events bubble through the fiber tree, not the DOM, so a portaled Popup still\n // reaches any ancestor's onClick/onSubmit even though it renders outside it in the DOM.\n onClick={stopPropagationHandler(props.onClick)}\n onSubmit={stopPropagationHandler(props.onSubmit)}\n >\n {!asChild && children}\n {showCloseButton && !asChild && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n render={<Button variant=\"ghost\" className=\"absolute top-2 right-2\" size=\"icon-sm\" />}\n >\n <IconX />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Popup>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: DialogHeaderProps) {\n return <div data-slot=\"dialog-header\" className={cn('gap-2 flex flex-col shrink-0', className)} {...props} />\n}\n\nfunction DialogBody({ className, ...props }: DialogBodyProps) {\n return <div data-slot=\"dialog-body\" className={cn('-mx-4 px-4 flex-1 overflow-y-auto', className)} {...props} />\n}\n\nfunction DialogFooter({ className, showCloseButton = false, children, ...props }: DialogFooterProps) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 shrink-0',\n 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && <DialogPrimitive.Close render={<Button variant=\"outline\" />}>Close</DialogPrimitive.Close>}\n </div>\n )\n}\n\nfunction DialogTitle({ className, asChild, children, ...props }: DialogTitleProps) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={(state) => cn('text-base leading-none font-medium', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DialogDescription({ className, asChild, children, ...props }: DialogDescriptionProps) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={(state) =>\n cn(\n 'text-muted-foreground text-sm',\n '*:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nexport {\n Dialog,\n DialogBody,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHe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AC9G,CAEA,SAAS,WAAW,CAAE,YAAW,GAAGA,GAA0B,CAC5D,MAAO,kBAAC,MAAD,CAAK,YAAU,cAAc,UAAWW,EAAG,oCAAqCC,CAAS,EAAG,GAAIZ,CAAQ,CAAA,CACjH,CAEA,SAAS,aAAa,CAAE,YAAW,kBAAkB,GAAO,WAAU,GAAGA,GAA4B,CACnG,MACE,kBAAC,MAAD,CACE,YAAU,gBACV,UAAWW,EACT,6DACA,yDACAC,CACF,EACA,GAAIZ,EAPN,SAAA,CASGU,EACAQ,GAAmB,kBAACzB,EAAgB,MAAjB,CAAuB,OAAQ,kBAAC0B,EAAD,CAAQ,QAAQ,SAAW,CAAA,EAAG,SAAA,OAA4B,CAAA,CAC1G,C,EAET,CAEA,SAAS,YAAY,CAAE,YAAW,UAAS,WAAU,GAAGnB,GAA2B,CACjF,MACE,kBAACP,EAAgB,MAAjB,CACE,YAAU,eACV,UAAY,GAAUkB,EAAG,qCAAsCjB,EAAiBkB,EAAWC,CAAK,CAAC,EACjG,GAAIb,EACJ,GAAIQ,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL,CAEA,SAAS,kBAAkB,CAAE,YAAW,UAAS,WAAU,GAAGV,GAAiC,CAC7F,MACE,kBAACP,EAAgB,YAAjB,CACE,YAAU,qBACV,UAAY,GACVkB,EACE,gCACA,uEACAjB,EAAiBkB,EAAWC,CAAK,CACnC,EAEF,GAAIb,EACJ,GAAIQ,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL,C"}
@@ -1,7 +1,5 @@
1
1
  import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
2
  import { DirectionProvider, TextDirection, useDirection } from "@base-ui/react/direction-provider";
3
- //#region src/components/direction.d.ts
4
3
  export type DirectionProviderProps = DirectionProvider.Props;
5
- //#endregion
6
4
  export { DirectionProvider, type TextDirection, useDirection };
7
5
  //# sourceMappingURL=direction.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
2
  import { PieChartProps } from "./pie-chart.js";
3
3
  import * as React from "react";
4
- //#region src/components/donut-chart.d.ts
5
4
  export type DonutChartProps = PieChartProps & {
6
5
  /**
7
6
  * Ring width as a fraction of the radius.
@@ -20,6 +19,5 @@ export type DonutChartProps = PieChartProps & {
20
19
  totalLabel?: React.ReactNode;
21
20
  };
22
21
  declare function DonutChart({ className, thickness, outerRadius, withTotal, totalLabel, data, ...props }: DonutChartProps): React.JSX.Element;
23
- //#endregion
24
22
  export { DonutChart };
25
23
  //# sourceMappingURL=donut-chart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"donut-chart.js","names":["React","props","innerRadius","ratio","thickness","outerRadius","match","total","data","sum","item","PieChartBase","cn","className","withTotal","Label","viewBox","totalLabel"],"sources":["../../src/components/donut-chart.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Label } from 'recharts'\n\nimport { cn } from '../lib/utils'\nimport { PieChartBase, type PieChartProps } from './pie-chart'\n\nexport type DonutChartProps = PieChartProps & {\n /**\n * Ring width as a fraction of the radius.\n * @default 0.35\n */\n thickness?: number\n /**\n * Shows the sum of the values in the center.\n * @default false\n */\n withTotal?: boolean\n /**\n * Label below the total.\n * @default 'Total'\n */\n totalLabel?: React.ReactNode\n}\n\nfunction DonutChart({\n className,\n thickness = 0.35,\n outerRadius = '80%',\n withTotal = false,\n totalLabel = 'Total',\n data,\n ...props\n}: DonutChartProps) {\n const innerRadius = React.useMemo(() => {\n const ratio = Math.min(Math.max(1 - thickness, 0), 1)\n if (typeof outerRadius === 'number') {\n return outerRadius * ratio\n }\n const match = /^(\\d+(?:\\.\\d+)?)%$/.exec(outerRadius)\n if (match) {\n return `${Number(match[1]) * ratio}%`\n }\n return outerRadius\n }, [outerRadius, thickness])\n\n const total = React.useMemo(() => data.reduce((sum, item) => sum + item.value, 0), [data])\n\n return (\n <PieChartBase\n dataSlot=\"donut-chart\"\n className={cn(className)}\n data={data}\n outerRadius={outerRadius}\n innerRadius={innerRadius}\n centerSlot={\n withTotal ? (\n <Label\n content={({ viewBox }) => {\n if (!viewBox || !('cx' in viewBox) || !('cy' in viewBox)) {\n return null\n }\n return (\n <text x={viewBox.cx} y={viewBox.cy} textAnchor=\"middle\" dominantBaseline=\"middle\">\n <tspan x={viewBox.cx} y={viewBox.cy} className=\"fill-foreground font-medium text-2xl tabular-nums\">\n {total.toLocaleString()}\n </tspan>\n <tspan x={viewBox.cx} y={(viewBox.cy ?? 0) + 20} className=\"fill-muted-foreground text-xs\">\n {totalLabel}\n </tspan>\n </text>\n )\n }}\n />\n ) : null\n }\n {...props}\n />\n )\n}\n\nexport { DonutChart }\n"],"mappings":"sOAyBA,SAAS,WAAW,CAClB,YACA,YAAY,IACZ,cAAc,MACd,YAAY,GACZ,aAAa,QACb,OACA,GAAGC,GACe,CAClB,IAAMC,EAAcF,EAAM,YAAc,CACtC,IAAMG,EAAQ,KAAK,IAAI,KAAK,IAAI,EAAIC,EAAW,CAAC,EAAG,CAAC,EACpD,GAAI,OAAOC,GAAgB,SACzB,OAAOA,EAAcF,EAEvB,IAAMG,EAAQ,qBAAqB,KAAKD,CAAW,EAInD,OAHIC,EACK,GAAG,OAAOA,EAAM,EAAE,EAAIH,EAAM,GAE9BE,CACT,EAAG,CAACA,EAAaD,CAAS,CAAC,EAErBG,EAAQP,EAAM,YAAcQ,EAAK,QAAQ,EAAK,IAASC,EAAMC,EAAK,MAAO,CAAC,EAAG,CAACF,CAAI,CAAC,EAEzF,MACE,kBAACG,EAAD,CACE,SAAS,cACT,UAAWC,EAAGC,CAAS,EACjB,OACO,cACA,cACb,WACEC,EACE,kBAACC,EAAD,CACE,SAAU,CAAE,aACN,CAACC,GAAW,EAAE,OAAQA,IAAY,EAAE,OAAQA,GACvC,KAGP,kBAAC,OAAD,CAAM,EAAGA,EAAQ,GAAI,EAAGA,EAAQ,GAAI,WAAW,SAAS,iBAAiB,SAAzE,SAAA,CACE,kBAAC,QAAD,CAAO,EAAGA,EAAQ,GAAI,EAAGA,EAAQ,GAAI,UAAU,oDAC5C,SAAAT,EAAM,eAAe,CACjB,CAAA,EACP,kBAAC,QAAD,CAAO,EAAGS,EAAQ,GAAI,GAAIA,EAAQ,IAAM,GAAK,GAAI,UAAU,gCACxD,SAAAC,CACI,CAAA,CACH,GAGX,CAAA,EACC,KAEN,GAAIhB,CACL,CAAA,CAEL"}
1
+ {"version":3,"file":"donut-chart.js","names":["React","props","innerRadius","ratio","thickness","outerRadius","match","total","data","sum","item","PieChartBase","cn","className","withTotal","Label","viewBox","totalLabel"],"sources":["../../src/components/donut-chart.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Label } from 'recharts'\n\nimport { cn } from '../lib/utils'\nimport { PieChartBase, type PieChartProps } from './pie-chart'\n\nexport type DonutChartProps = PieChartProps & {\n /**\n * Ring width as a fraction of the radius.\n * @default 0.35\n */\n thickness?: number\n /**\n * Shows the sum of the values in the center.\n * @default false\n */\n withTotal?: boolean\n /**\n * Label below the total.\n * @default 'Total'\n */\n totalLabel?: React.ReactNode\n}\n\nfunction DonutChart({\n className,\n thickness = 0.35,\n outerRadius = '80%',\n withTotal = false,\n totalLabel = 'Total',\n data,\n ...props\n}: DonutChartProps) {\n const innerRadius = React.useMemo(() => {\n const ratio = Math.min(Math.max(1 - thickness, 0), 1)\n if (typeof outerRadius === 'number') {\n return outerRadius * ratio\n }\n const match = /^(\\d+(?:\\.\\d+)?)%$/.exec(outerRadius)\n if (match) {\n return `${Number(match[1]) * ratio}%`\n }\n return outerRadius\n }, [outerRadius, thickness])\n\n const total = React.useMemo(() => data.reduce((sum, item) => sum + item.value, 0), [data])\n\n return (\n <PieChartBase\n dataSlot=\"donut-chart\"\n className={cn(className)}\n data={data}\n outerRadius={outerRadius}\n innerRadius={innerRadius}\n centerSlot={\n withTotal ? (\n <Label\n content={({ viewBox }) => {\n if (!viewBox || !('cx' in viewBox) || !('cy' in viewBox)) {\n return null\n }\n return (\n <text x={viewBox.cx} y={viewBox.cy} textAnchor=\"middle\" dominantBaseline=\"middle\">\n <tspan x={viewBox.cx} y={viewBox.cy} className=\"fill-foreground font-medium text-2xl tabular-nums\">\n {total.toLocaleString()}\n </tspan>\n <tspan x={viewBox.cx} y={(viewBox.cy ?? 0) + 20} className=\"fill-muted-foreground text-xs\">\n {totalLabel}\n </tspan>\n </text>\n )\n }}\n />\n ) : null\n }\n {...props}\n />\n )\n}\n\nexport { DonutChart }\n"],"mappings":"A,sOAyBA,SAAS,WAAW,CAClB,YACA,YAAY,IACZ,cAAc,MACd,YAAY,GACZ,aAAa,QACb,OACA,GAAGC,GACe,CAClB,IAAMC,EAAcF,EAAM,YAAc,CACtC,IAAMG,EAAQ,KAAK,IAAI,KAAK,IAAI,EAAIC,EAAW,CAAC,EAAG,CAAC,EACpD,GAAI,OAAOC,GAAgB,SACzB,OAAOA,EAAcF,EAEvB,IAAMG,EAAQ,qBAAqB,KAAKD,CAAW,EAInD,OAHIC,EACK,GAAG,OAAOA,EAAM,EAAE,EAAIH,EAAM,GAE9BE,CACT,EAAG,CAACA,EAAaD,CAAS,CAAC,EAErBG,EAAQP,EAAM,YAAcQ,EAAK,QAAQ,EAAK,IAASC,EAAMC,EAAK,MAAO,CAAC,EAAG,CAACF,CAAI,CAAC,EAEzF,MACE,kBAACG,EAAD,CACE,SAAS,cACT,UAAWC,EAAGC,CAAS,EACjB,OACO,cACA,cACb,WACEC,EACE,kBAACC,EAAD,CACE,SAAU,CAAE,aACN,CAACC,GAAW,EAAE,OAAQA,IAAY,EAAE,OAAQA,GACvC,KAGP,kBAAC,OAAD,CAAM,EAAGA,EAAQ,GAAI,EAAGA,EAAQ,GAAI,WAAW,SAAS,iBAAiB,SAAzE,SAAA,CACE,kBAAC,QAAD,CAAO,EAAGA,EAAQ,GAAI,EAAGA,EAAQ,GAAI,UAAU,oDAC5C,SAAAT,EAAM,eAAe,CACjB,CAAA,EACP,kBAAC,QAAD,CAAO,EAAGS,EAAQ,GAAI,GAAIA,EAAQ,IAAM,GAAK,GAAI,UAAU,gCACxD,SAAAC,CACI,CAAA,CACH,C,EAGX,CAAA,EACC,KAEN,GAAIhB,CACL,CAAA,CAEL,C"}
@@ -1,9 +1,8 @@
1
1
  import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
- import { t as AsChildPrimitiveProps } from "../as-child-Dxg3Xo1G.js";
2
+ import { t as AsChildPrimitiveProps } from "../as-child-T9W73ZYU.js";
3
3
  import * as React from "react";
4
4
  import { VariantProps } from "class-variance-authority";
5
5
  import { Dialog } from "@base-ui/react/dialog";
6
- //#region src/components/drawer.d.ts
7
6
  declare const drawerContentVariants: (props?: ({
8
7
  direction?: "bottom" | "left" | "right" | "top" | null | undefined;
9
8
  size?: "2xl" | "3xl" | "full" | "lg" | "md" | "sm" | "xl" | null | undefined;
@@ -56,6 +55,5 @@ declare function DrawerBody({ className, ...props }: DrawerBodyProps): React.JSX
56
55
  declare function DrawerFooter({ className, ...props }: DrawerFooterProps): React.JSX.Element;
57
56
  declare function DrawerTitle({ className, asChild, children, ...props }: DrawerTitleProps): React.JSX.Element;
58
57
  declare function DrawerDescription({ className, asChild, children, ...props }: DrawerDescriptionProps): React.JSX.Element;
59
- //#endregion
60
58
  export { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger };
61
59
  //# sourceMappingURL=drawer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","names":["DrawerPrimitive","resolveClassName","React","drawerContentVariants","cva","DrawerContext","props","contextValue","size","direction","Dialog","dismissible","disablePointerDismissal","eventDetails","onOpenChange","open","toAsChildRenderProps","asChild","children","cn","className","state","stopPropagationHandler","onClick","overlayProps","showCloseButton","Button","IconX"],"sources":["../../src/components/drawer.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Dialog as DrawerPrimitive } from '@base-ui/react/dialog'\nimport { IconX } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { type AsChildPrimitiveProps, toAsChildRenderProps } from '../lib/as-child'\nimport { cn, stopPropagationHandler } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\nimport { Button } from './button'\n\nconst drawerContentVariants = cva(\n [\n 'bg-background flex h-auto flex-col text-sm fixed z-50 outline-none duration-200',\n 'data-open:animate-in data-closed:animate-out'\n ],\n {\n variants: {\n direction: {\n top: 'inset-x-0 top-0 rounded-b-xl border-b data-closed:slide-out-to-top data-open:slide-in-from-top-10',\n right:\n 'inset-y-0 right-0 rounded-l-xl border-l data-closed:slide-out-to-right data-open:slide-in-from-right-10',\n bottom:\n 'inset-x-0 bottom-0 rounded-t-xl border-t data-closed:slide-out-to-bottom data-open:slide-in-from-bottom-10',\n left: 'inset-y-0 left-0 rounded-r-xl border-r data-closed:slide-out-to-left data-open:slide-in-from-left-10'\n },\n size: {\n sm: '',\n md: '',\n lg: '',\n xl: '',\n '2xl': '',\n '3xl': '',\n full: ''\n }\n },\n compoundVariants: [\n { direction: ['left', 'right'], size: 'sm', className: 'w-3/4 sm:max-w-sm' },\n { direction: ['left', 'right'], size: 'md', className: 'w-4/5 sm:max-w-md' },\n { direction: ['left', 'right'], size: 'lg', className: 'w-[90%] sm:max-w-lg' },\n { direction: ['left', 'right'], size: 'xl', className: 'w-[90%] sm:max-w-195' },\n { direction: ['left', 'right'], size: '2xl', className: 'w-[90%] sm:max-w-240' },\n { direction: ['left', 'right'], size: '3xl', className: 'w-[90%] sm:max-w-300' },\n { direction: ['left', 'right'], size: 'full', className: 'w-full' },\n { direction: 'top', size: 'sm', className: 'mb-24 h-full max-h-96' },\n { direction: 'top', size: 'md', className: 'mb-20 h-full max-h-112' },\n { direction: 'top', size: 'lg', className: 'mb-12 h-full max-h-128' },\n { direction: 'top', size: 'xl', className: 'mb-12 h-full max-h-195' },\n { direction: 'top', size: '2xl', className: 'mb-12 h-full max-h-240' },\n { direction: 'top', size: '3xl', className: 'mb-12 h-full max-h-300' },\n { direction: 'top', size: 'full', className: 'mb-0 h-full' },\n { direction: 'bottom', size: 'sm', className: 'mt-24 h-full max-h-96' },\n { direction: 'bottom', size: 'md', className: 'mt-20 h-full max-h-112' },\n { direction: 'bottom', size: 'lg', className: 'mt-12 h-full max-h-128' },\n { direction: 'bottom', size: 'xl', className: 'mt-12 h-full max-h-195' },\n { direction: 'bottom', size: '2xl', className: 'mt-12 h-full max-h-240' },\n { direction: 'bottom', size: '3xl', className: 'mt-12 h-full max-h-300' },\n { direction: 'bottom', size: 'full', className: 'mt-0 h-full' }\n ],\n defaultVariants: {\n direction: 'right',\n size: 'md'\n }\n }\n)\n\ntype DrawerDirection = NonNullable<VariantProps<typeof drawerContentVariants>['direction']>\ntype DrawerSize = NonNullable<VariantProps<typeof drawerContentVariants>['size']>\ntype DrawerContextValue = { size: DrawerSize; direction: DrawerDirection }\nconst DrawerContext = React.createContext<DrawerContextValue>({ size: 'md', direction: 'right' })\n\nexport type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {\n /**\n * Panel width for `left`/`right`, or height for `top`/`bottom`. `full` fills the whole viewport.\n * @default 'md'\n */\n size?: DrawerSize\n /**\n * Edge the drawer slides in from.\n * @default 'right'\n */\n direction?: DrawerDirection\n /**\n * When `false`, clicking outside and pressing Esc no longer close the drawer. The close button and `DrawerClose` still work.\n * @default true\n */\n dismissible?: boolean\n}\nexport type DrawerTriggerProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Trigger>\nexport type DrawerPortalProps = React.ComponentProps<typeof DrawerPrimitive.Portal>\nexport type DrawerCloseProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Close>\nexport type DrawerOverlayProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Backdrop>\nexport type DrawerContentProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Popup> &\n Pick<DrawerPortalProps, 'keepMounted'> & {\n /**\n * Shows the X button in the top-right corner.\n * @default true\n */\n showCloseButton?: boolean\n /** Props passed to the overlay rendered behind the drawer. */\n overlayProps?: DrawerOverlayProps\n }\nexport type DrawerHeaderProps = React.ComponentProps<'div'>\nexport type DrawerBodyProps = React.ComponentProps<'div'>\nexport type DrawerFooterProps = React.ComponentProps<'div'>\nexport type DrawerTitleProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Title>\nexport type DrawerDescriptionProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Description>\n\nfunction Drawer({\n size = 'md',\n direction = 'right',\n dismissible = true,\n disablePointerDismissal,\n onOpenChange,\n ...props\n}: DrawerProps) {\n const contextValue = React.useMemo<DrawerContextValue>(() => ({ size, direction }), [size, direction])\n\n return (\n <DrawerContext.Provider value={contextValue}>\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n disablePointerDismissal={!dismissible || disablePointerDismissal}\n onOpenChange={(open, eventDetails) => {\n if (!dismissible && eventDetails.reason === 'escape-key') {\n eventDetails.cancel()\n return\n }\n onOpenChange?.(open, eventDetails)\n }}\n {...props}\n />\n </DrawerContext.Provider>\n )\n}\n\nfunction DrawerTrigger({ asChild, children, ...props }: DrawerTriggerProps) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} {...toAsChildRenderProps(asChild, children)} />\n}\n\nfunction DrawerPortal({ ...props }: DrawerPortalProps) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />\n}\n\nfunction DrawerClose({ asChild, children, ...props }: DrawerCloseProps) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} {...toAsChildRenderProps(asChild, children)} />\n}\n\nfunction DrawerOverlay({ className, onClick, forceRender = true, asChild, children, ...props }: DrawerOverlayProps) {\n return (\n <DrawerPrimitive.Backdrop\n data-slot=\"drawer-overlay\"\n forceRender={forceRender}\n className={(state) =>\n cn(\n 'bg-black/10 fixed inset-0 z-50 duration-200',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0',\n 'supports-backdrop-filter:backdrop-blur-xs',\n resolveClassName(className, state)\n )\n }\n onClick={stopPropagationHandler(onClick)}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DrawerContent({\n className,\n children,\n showCloseButton = true,\n overlayProps,\n keepMounted,\n asChild,\n ...props\n}: DrawerContentProps) {\n const { size, direction } = React.useContext(DrawerContext)\n\n return (\n <DrawerPortal keepMounted={keepMounted}>\n <DrawerOverlay {...overlayProps} />\n <DrawerPrimitive.Popup\n data-slot=\"drawer-content\"\n className={(state) => cn(drawerContentVariants({ size, direction }), resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n // React events bubble through the fiber tree, not the DOM, so a portaled Popup still\n // reaches any ancestor's onClick/onSubmit even though it renders outside it in the DOM.\n onClick={stopPropagationHandler(props.onClick)}\n onSubmit={stopPropagationHandler(props.onSubmit)}\n >\n {!asChild && children}\n {showCloseButton && !asChild && (\n <DrawerPrimitive.Close\n data-slot=\"drawer-close\"\n render={<Button variant=\"ghost\" className=\"absolute top-3 right-3\" size=\"icon-sm\" />}\n >\n <IconX />\n <span className=\"sr-only\">Close</span>\n </DrawerPrimitive.Close>\n )}\n </DrawerPrimitive.Popup>\n </DrawerPortal>\n )\n}\n\nfunction DrawerHeader({ className, ...props }: DrawerHeaderProps) {\n const { direction } = React.useContext(DrawerContext)\n const isVertical = direction === 'top' || direction === 'bottom'\n\n return (\n <div\n data-slot=\"drawer-header\"\n className={cn('p-4 flex flex-col gap-0.5 md:gap-0.5', isVertical && 'text-center md:text-left', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerBody({ className, ...props }: DrawerBodyProps) {\n return (\n <div data-slot=\"drawer-body\" className={cn('px-4 pb-4 flex-1 min-h-0 overflow-y-auto', className)} {...props} />\n )\n}\n\nfunction DrawerFooter({ className, ...props }: DrawerFooterProps) {\n return (\n <div\n data-slot=\"drawer-footer\"\n className={cn('gap-2 p-4 mt-auto flex flex-col sm:flex-row sm:justify-end', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerTitle({ className, asChild, children, ...props }: DrawerTitleProps) {\n return (\n <DrawerPrimitive.Title\n data-slot=\"drawer-title\"\n className={(state) => cn('text-foreground text-base font-medium', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DrawerDescription({ className, asChild, children, ...props }: DrawerDescriptionProps) {\n return (\n <DrawerPrimitive.Description\n data-slot=\"drawer-description\"\n className={(state) => cn('text-muted-foreground text-sm', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nexport {\n Drawer,\n DrawerBody,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger\n}\n"],"mappings":"kdAWA,MAAMG,EAAwBC,EAC5B,CACE,kFACA,8CACF,EACA,CACE,SAAU,CACR,UAAW,CACT,IAAK,oGACL,MACE,0GACF,OACE,6GACF,KAAM,sGACR,EACA,KAAM,CACJ,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,MAAO,GACP,MAAO,GACP,KAAM,EACR,CACF,EACA,iBAAkB,CAChB,CAAE,UAAW,CAAC,OAAQ,OAAO,EAAG,KAAM,KAAM,UAAW,mBAAoB,EAC3E,CAAE,UAAW,CAAC,OAAQ,OAAO,EAAG,KAAM,KAAM,UAAW,mBAAoB,EAC3E,CAAE,UAAW,CAAC,OAAQ,OAAO,EAAG,KAAM,KAAM,UAAW,qBAAsB,EAC7E,CAAE,UAAW,CAAC,OAAQ,OAAO,EAAG,KAAM,KAAM,UAAW,sBAAuB,EAC9E,CAAE,UAAW,CAAC,OAAQ,OAAO,EAAG,KAAM,MAAO,UAAW,sBAAuB,EAC/E,CAAE,UAAW,CAAC,OAAQ,OAAO,EAAG,KAAM,MAAO,UAAW,sBAAuB,EAC/E,CAAE,UAAW,CAAC,OAAQ,OAAO,EAAG,KAAM,OAAQ,UAAW,QAAS,EAClE,CAAE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CAAK,CAAC,EAC5F,GAAIf,EACJ,GAAIU,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL"}
1
+ {"version":3,"file":"drawer.js","names":["DrawerPrimitive","resolveClassName","React","drawerContentVariants","cva","DrawerContext","props","contextValue","size","direction","Dialog","dismissible","disablePointerDismissal","eventDetails","onOpenChange","open","toAsChildRenderProps","asChild","children","cn","className","state","stopPropagationHandler","onClick","overlayProps","showCloseButton","Button","IconX"],"sources":["../../src/components/drawer.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Dialog as DrawerPrimitive } from '@base-ui/react/dialog'\nimport { IconX } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { type AsChildPrimitiveProps, toAsChildRenderProps } from '../lib/as-child'\nimport { cn, stopPropagationHandler } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\nimport { Button } from './button'\n\nconst drawerContentVariants = cva(\n [\n 'bg-background flex h-auto flex-col text-sm fixed z-50 outline-none duration-200',\n 'data-open:animate-in data-closed:animate-out'\n ],\n {\n variants: {\n direction: {\n top: 'inset-x-0 top-0 rounded-b-xl border-b data-closed:slide-out-to-top data-open:slide-in-from-top-10',\n right:\n 'inset-y-0 right-0 rounded-l-xl border-l data-closed:slide-out-to-right data-open:slide-in-from-right-10',\n bottom:\n 'inset-x-0 bottom-0 rounded-t-xl border-t data-closed:slide-out-to-bottom data-open:slide-in-from-bottom-10',\n left: 'inset-y-0 left-0 rounded-r-xl border-r data-closed:slide-out-to-left data-open:slide-in-from-left-10'\n },\n size: {\n sm: '',\n md: '',\n lg: '',\n xl: '',\n '2xl': '',\n '3xl': '',\n full: ''\n }\n },\n compoundVariants: [\n { direction: ['left', 'right'], size: 'sm', className: 'w-3/4 sm:max-w-sm' },\n { direction: ['left', 'right'], size: 'md', className: 'w-4/5 sm:max-w-md' },\n { direction: ['left', 'right'], size: 'lg', className: 'w-[90%] sm:max-w-lg' },\n { direction: ['left', 'right'], size: 'xl', className: 'w-[90%] sm:max-w-195' },\n { direction: ['left', 'right'], size: '2xl', className: 'w-[90%] sm:max-w-240' },\n { direction: ['left', 'right'], size: '3xl', className: 'w-[90%] sm:max-w-300' },\n { direction: ['left', 'right'], size: 'full', className: 'w-full' },\n { direction: 'top', size: 'sm', className: 'mb-24 h-full max-h-96' },\n { direction: 'top', size: 'md', className: 'mb-20 h-full max-h-112' },\n { direction: 'top', size: 'lg', className: 'mb-12 h-full max-h-128' },\n { direction: 'top', size: 'xl', className: 'mb-12 h-full max-h-195' },\n { direction: 'top', size: '2xl', className: 'mb-12 h-full max-h-240' },\n { direction: 'top', size: '3xl', className: 'mb-12 h-full max-h-300' },\n { direction: 'top', size: 'full', className: 'mb-0 h-full' },\n { direction: 'bottom', size: 'sm', className: 'mt-24 h-full max-h-96' },\n { direction: 'bottom', size: 'md', className: 'mt-20 h-full max-h-112' },\n { direction: 'bottom', size: 'lg', className: 'mt-12 h-full max-h-128' },\n { direction: 'bottom', size: 'xl', className: 'mt-12 h-full max-h-195' },\n { direction: 'bottom', size: '2xl', className: 'mt-12 h-full max-h-240' },\n { direction: 'bottom', size: '3xl', className: 'mt-12 h-full max-h-300' },\n { direction: 'bottom', size: 'full', className: 'mt-0 h-full' }\n ],\n defaultVariants: {\n direction: 'right',\n size: 'md'\n }\n }\n)\n\ntype DrawerDirection = NonNullable<VariantProps<typeof drawerContentVariants>['direction']>\ntype DrawerSize = NonNullable<VariantProps<typeof drawerContentVariants>['size']>\ntype DrawerContextValue = { size: DrawerSize; direction: DrawerDirection }\nconst DrawerContext = React.createContext<DrawerContextValue>({ size: 'md', direction: 'right' })\n\nexport type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {\n /**\n * Panel width for `left`/`right`, or height for `top`/`bottom`. `full` fills the whole viewport.\n * @default 'md'\n */\n size?: DrawerSize\n /**\n * Edge the drawer slides in from.\n * @default 'right'\n */\n direction?: DrawerDirection\n /**\n * When `false`, clicking outside and pressing Esc no longer close the drawer. The close button and `DrawerClose` still work.\n * @default true\n */\n dismissible?: boolean\n}\nexport type DrawerTriggerProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Trigger>\nexport type DrawerPortalProps = React.ComponentProps<typeof DrawerPrimitive.Portal>\nexport type DrawerCloseProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Close>\nexport type DrawerOverlayProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Backdrop>\nexport type DrawerContentProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Popup> &\n Pick<DrawerPortalProps, 'keepMounted'> & {\n /**\n * Shows the X button in the top-right corner.\n * @default true\n */\n showCloseButton?: boolean\n /** Props passed to the overlay rendered behind the drawer. */\n overlayProps?: DrawerOverlayProps\n }\nexport type DrawerHeaderProps = React.ComponentProps<'div'>\nexport type DrawerBodyProps = React.ComponentProps<'div'>\nexport type DrawerFooterProps = React.ComponentProps<'div'>\nexport type DrawerTitleProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Title>\nexport type DrawerDescriptionProps = AsChildPrimitiveProps<typeof DrawerPrimitive.Description>\n\nfunction Drawer({\n size = 'md',\n direction = 'right',\n dismissible = true,\n disablePointerDismissal,\n onOpenChange,\n ...props\n}: DrawerProps) {\n const contextValue = React.useMemo<DrawerContextValue>(() => ({ size, direction }), [size, direction])\n\n return (\n <DrawerContext.Provider value={contextValue}>\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n disablePointerDismissal={!dismissible || disablePointerDismissal}\n onOpenChange={(open, eventDetails) => {\n if (!dismissible && eventDetails.reason === 'escape-key') {\n eventDetails.cancel()\n return\n }\n onOpenChange?.(open, eventDetails)\n }}\n {...props}\n />\n </DrawerContext.Provider>\n )\n}\n\nfunction DrawerTrigger({ asChild, children, ...props }: DrawerTriggerProps) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} {...toAsChildRenderProps(asChild, children)} />\n}\n\nfunction DrawerPortal({ ...props }: DrawerPortalProps) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />\n}\n\nfunction DrawerClose({ asChild, children, ...props }: DrawerCloseProps) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} {...toAsChildRenderProps(asChild, children)} />\n}\n\nfunction DrawerOverlay({ className, onClick, forceRender = true, asChild, children, ...props }: DrawerOverlayProps) {\n return (\n <DrawerPrimitive.Backdrop\n data-slot=\"drawer-overlay\"\n forceRender={forceRender}\n className={(state) =>\n cn(\n 'bg-black/10 fixed inset-0 z-50 duration-200',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0',\n 'supports-backdrop-filter:backdrop-blur-xs',\n resolveClassName(className, state)\n )\n }\n onClick={stopPropagationHandler(onClick)}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DrawerContent({\n className,\n children,\n showCloseButton = true,\n overlayProps,\n keepMounted,\n asChild,\n ...props\n}: DrawerContentProps) {\n const { size, direction } = React.useContext(DrawerContext)\n\n return (\n <DrawerPortal keepMounted={keepMounted}>\n <DrawerOverlay {...overlayProps} />\n <DrawerPrimitive.Popup\n data-slot=\"drawer-content\"\n className={(state) => cn(drawerContentVariants({ size, direction }), resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n // React events bubble through the fiber tree, not the DOM, so a portaled Popup still\n // reaches any ancestor's onClick/onSubmit even though it renders outside it in the DOM.\n onClick={stopPropagationHandler(props.onClick)}\n onSubmit={stopPropagationHandler(props.onSubmit)}\n >\n {!asChild && children}\n {showCloseButton && !asChild && (\n <DrawerPrimitive.Close\n data-slot=\"drawer-close\"\n render={<Button variant=\"ghost\" className=\"absolute top-3 right-3\" size=\"icon-sm\" />}\n >\n <IconX />\n <span className=\"sr-only\">Close</span>\n </DrawerPrimitive.Close>\n )}\n </DrawerPrimitive.Popup>\n </DrawerPortal>\n )\n}\n\nfunction DrawerHeader({ className, ...props }: DrawerHeaderProps) {\n const { direction } = React.useContext(DrawerContext)\n const isVertical = direction === 'top' || direction === 'bottom'\n\n return (\n <div\n data-slot=\"drawer-header\"\n className={cn('p-4 flex flex-col gap-0.5 md:gap-0.5', isVertical && 'text-center md:text-left', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerBody({ className, ...props }: DrawerBodyProps) {\n return (\n <div data-slot=\"drawer-body\" className={cn('px-4 pb-4 flex-1 min-h-0 overflow-y-auto', className)} {...props} />\n )\n}\n\nfunction DrawerFooter({ className, ...props }: DrawerFooterProps) {\n return (\n <div\n data-slot=\"drawer-footer\"\n className={cn('gap-2 p-4 mt-auto flex flex-col sm:flex-row sm:justify-end', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerTitle({ className, asChild, children, ...props }: DrawerTitleProps) {\n return (\n <DrawerPrimitive.Title\n data-slot=\"drawer-title\"\n className={(state) => cn('text-foreground text-base font-medium', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DrawerDescription({ className, asChild, children, ...props }: DrawerDescriptionProps) {\n return (\n <DrawerPrimitive.Description\n data-slot=\"drawer-description\"\n className={(state) => cn('text-muted-foreground text-sm', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nexport {\n Drawer,\n DrawerBody,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger\n}\n"],"mappings":"A,kdAWA,MAAMG,EAAwBC,EAC5B,CACE,kFACA,8CACF,EACA,CACE,SAAU,CACR,UAAW,CACT,IAAK,oGACL,MACE,0GACF,OACE,6GACF,KAAM,sGACR,EACA,KAAM,CACJ,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,MAAO,GACP,MAAO,GACP,KAAM,EACR,CACF,EACA,iBAAkB,CAChB,CAAE,UAAW,CAAC,OAAQ,OAAO,EAAG,KAAM,KAAM,UAAW,mBAAoB,EAC3E,CAAE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C,CAAS,EACrF,GAAId,CACL,CAAA,CAEL,CAEA,SAAS,YAAY,CAAE,YAAW,UAAS,WAAU,GAAGA,GAA2B,CACjF,MACE,kBAACN,EAAgB,MAAjB,CACE,YAAU,eACV,UAAY,GAAUmB,EAAG,wCAAyClB,EAAiBmB,EAAWC,CAAK,CAAC,EACpG,GAAIf,EACJ,GAAIU,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL,CAEA,SAAS,kBAAkB,CAAE,YAAW,UAAS,WAAU,GAAGZ,GAAiC,CAC7F,MACE,kBAACN,EAAgB,YAAjB,CACE,YAAU,qBACV,UAAY,GAAUmB,EAAG,gCAAiClB,EAAiBmB,EAAWC,CAAK,CAAC,EAC5F,GAAIf,EACJ,GAAIU,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL,C"}
@@ -1,8 +1,7 @@
1
1
  import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
- import { n as AsChildProps, t as AsChildPrimitiveProps } from "../as-child-Dxg3Xo1G.js";
2
+ import { n as AsChildProps, t as AsChildPrimitiveProps } from "../as-child-T9W73ZYU.js";
3
3
  import * as React from "react";
4
4
  import { Menu } from "@base-ui/react/menu";
5
- //#region src/components/dropdown-menu.d.ts
6
5
  export type DropdownMenuProps = React.ComponentProps<typeof Menu.Root>;
7
6
  export type DropdownMenuPortalProps = React.ComponentProps<typeof Menu.Portal>;
8
7
  export type DropdownMenuTriggerProps = AsChildPrimitiveProps<typeof Menu.Trigger>;
@@ -53,6 +52,5 @@ declare function DropdownMenuShortcut({ className, ...props }: DropdownMenuShort
53
52
  declare function DropdownMenuSub({ ...props }: DropdownMenuSubProps): React.JSX.Element;
54
53
  declare function DropdownMenuSubTrigger({ className, inset, children, asChild, ...props }: DropdownMenuSubTriggerProps): React.JSX.Element;
55
54
  declare function DropdownMenuSubContent({ className, side, sideOffset, align, alignOffset, sticky, keepMounted, asChild, children, ...props }: DropdownMenuSubContentProps): React.JSX.Element;
56
- //#endregion
57
55
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
58
56
  //# sourceMappingURL=dropdown-menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu.js","names":["DropdownMenuPrimitive","resolveClassName","React","DropdownMenuGroupContext","props","Menu","toAsChildRenderProps","asChild","children","cn","className","state","inset","variant","IconCheck","isInsideGroup","labelProps","useAsChild","IconChevronRight"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Menu as DropdownMenuPrimitive } from '@base-ui/react/menu'\nimport { IconCheck, IconChevronRight } from '@tabler/icons-react'\n\nimport { type AsChildPrimitiveProps, type AsChildProps, toAsChildRenderProps, useAsChild } from '../lib/as-child'\nimport { cn } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\n\nexport type DropdownMenuProps = React.ComponentProps<typeof DropdownMenuPrimitive.Root>\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof DropdownMenuPrimitive.Portal>\n\nexport type DropdownMenuTriggerProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.Trigger>\n\nexport type DropdownMenuContentProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.Popup> &\n Pick<\n React.ComponentProps<typeof DropdownMenuPrimitive.Positioner>,\n 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'sticky'\n > &\n Pick<DropdownMenuPortalProps, 'keepMounted'>\n\nexport type DropdownMenuGroupProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.Group>\n\nexport type DropdownMenuItemProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.Item> & {\n /** Adds left padding so the text lines up with items that have an icon or indicator. */\n inset?: boolean\n /**\n * `destructive` colors the item red for dangerous actions.\n * @default 'default'\n */\n variant?: 'default' | 'destructive'\n}\n\nexport type DropdownMenuCheckboxItemProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.CheckboxItem> & {\n /** Adds left padding so the text lines up with items that have an icon or indicator. */\n inset?: boolean\n}\n\nexport type DropdownMenuRadioGroupProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.RadioGroup>\n\nexport type DropdownMenuRadioItemProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.RadioItem> & {\n /** Adds left padding so the text lines up with items that have an icon or indicator. */\n inset?: boolean\n}\n\nexport type DropdownMenuLabelProps = AsChildProps<'div'> & {\n /** Adds left padding so the text lines up with items that have an icon or indicator. */\n inset?: boolean\n}\n\nexport type DropdownMenuSeparatorProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.Separator>\n\nexport type DropdownMenuShortcutProps = React.ComponentProps<'span'>\n\nexport type DropdownMenuSubProps = React.ComponentProps<typeof DropdownMenuPrimitive.SubmenuRoot>\n\nexport type DropdownMenuSubTriggerProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.SubmenuTrigger> & {\n /** Adds left padding so the text lines up with items that have an icon or indicator. */\n inset?: boolean\n}\n\nexport type DropdownMenuSubContentProps = DropdownMenuContentProps\n\n// Base UI's `GroupLabel` must live inside a `Group`/`RadioGroup`; this flag lets `DropdownMenuLabel`\n// fall back to a plain element when it is rendered on its own, like Radix's `Label` allowed.\nconst DropdownMenuGroupContext = React.createContext(false)\n\nfunction DropdownMenu({ ...props }: DropdownMenuProps) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />\n}\n\nfunction DropdownMenuPortal({ ...props }: DropdownMenuPortalProps) {\n return <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n}\n\nfunction DropdownMenuTrigger({ asChild, children, ...props }: DropdownMenuTriggerProps) {\n return (\n <DropdownMenuPrimitive.Trigger\n data-slot=\"dropdown-menu-trigger\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DropdownMenuContent({\n className,\n side = 'bottom',\n sideOffset = 4,\n align = 'start',\n alignOffset = 0,\n sticky,\n keepMounted,\n asChild,\n children,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuPortal keepMounted={keepMounted}>\n <DropdownMenuPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n sticky={sticky}\n className=\"isolate z-50 outline-none\"\n >\n <DropdownMenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={(state) =>\n cn(\n 'relative z-50 w-(--anchor-width) min-w-32 max-h-(--available-height) outline-none',\n 'origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1',\n 'bg-popover/70 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100',\n 'data-closed:overflow-hidden',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n 'before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit]',\n 'before:backdrop-blur-2xl before:backdrop-saturate-150',\n '**:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10',\n '**:data-[slot$=-separator]:bg-foreground/5',\n '**:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10!',\n '**:data-[variant=destructive]:focus:bg-destructive/10! dark:**:data-[variant=destructive]:focus:bg-destructive/20!',\n '**:data-[variant=destructive]:text-destructive! **:data-[variant=destructive]:**:text-destructive!',\n 'animate-none!',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n </DropdownMenuPrimitive.Positioner>\n </DropdownMenuPortal>\n )\n}\n\nfunction DropdownMenuGroup({ asChild, children, ...props }: DropdownMenuGroupProps) {\n return (\n <DropdownMenuGroupContext.Provider value={true}>\n <DropdownMenuPrimitive.Group\n data-slot=\"dropdown-menu-group\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n </DropdownMenuGroupContext.Provider>\n )\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n asChild,\n children,\n ...props\n}: DropdownMenuItemProps) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={(state) =>\n cn(\n 'group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm',\n 'select-none outline-hidden',\n 'focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground',\n 'data-inset:pl-7',\n 'data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive',\n 'dark:data-[variant=destructive]:focus:bg-destructive/20',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n 'data-[variant=destructive]:*:[svg]:text-destructive',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({ className, children, inset, asChild, ...props }: DropdownMenuCheckboxItemProps) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={(state) =>\n cn(\n 'relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm',\n 'select-none outline-hidden',\n 'focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground',\n 'data-inset:pl-7',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && (\n <span\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n className=\"pointer-events-none absolute right-2 flex items-center justify-center\"\n >\n <DropdownMenuPrimitive.CheckboxItemIndicator>\n <IconCheck />\n </DropdownMenuPrimitive.CheckboxItemIndicator>\n </span>\n )}\n {!asChild && children}\n </DropdownMenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({ asChild, children, ...props }: DropdownMenuRadioGroupProps) {\n return (\n <DropdownMenuGroupContext.Provider value={true}>\n <DropdownMenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n </DropdownMenuGroupContext.Provider>\n )\n}\n\nfunction DropdownMenuRadioItem({ className, children, inset, asChild, ...props }: DropdownMenuRadioItemProps) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={(state) =>\n cn(\n 'relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm',\n 'select-none outline-hidden',\n 'focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground',\n 'data-inset:pl-7',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && (\n <span\n data-slot=\"dropdown-menu-radio-item-indicator\"\n className=\"pointer-events-none absolute right-2 flex items-center justify-center\"\n >\n <DropdownMenuPrimitive.RadioItemIndicator>\n <IconCheck />\n </DropdownMenuPrimitive.RadioItemIndicator>\n </span>\n )}\n {!asChild && children}\n </DropdownMenuPrimitive.RadioItem>\n )\n}\n\nfunction DropdownMenuLabel({ className, inset, asChild, children, ...props }: DropdownMenuLabelProps) {\n const isInsideGroup = React.useContext(DropdownMenuGroupContext)\n const labelProps = {\n 'data-slot': 'dropdown-menu-label',\n 'data-inset': inset,\n className: cn('px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7', className),\n ...props\n }\n\n if (isInsideGroup) {\n return <DropdownMenuPrimitive.GroupLabel {...labelProps} {...toAsChildRenderProps(asChild, children)} />\n }\n\n return (\n <DropdownMenuStandaloneLabel {...labelProps} asChild={asChild}>\n {children}\n </DropdownMenuStandaloneLabel>\n )\n}\n\nfunction DropdownMenuStandaloneLabel(props: AsChildProps<'div'>) {\n return useAsChild('div', { ...props })\n}\n\nfunction DropdownMenuSeparator({ className, asChild, children, ...props }: DropdownMenuSeparatorProps) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={(state) => cn('bg-border -mx-1 my-1 h-px', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: DropdownMenuShortcutProps) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({ ...props }: DropdownMenuSubProps) {\n return <DropdownMenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({ className, inset, children, asChild, ...props }: DropdownMenuSubTriggerProps) {\n return (\n <DropdownMenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={(state) =>\n cn(\n 'flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm',\n 'select-none outline-hidden',\n 'focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground',\n 'data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && children}\n {!asChild && <IconChevronRight className=\"ml-auto\" />}\n </DropdownMenuPrimitive.SubmenuTrigger>\n )\n}\n\nfunction DropdownMenuSubContent({\n className,\n side = 'right',\n sideOffset = 0,\n align = 'start',\n alignOffset = -3,\n sticky,\n keepMounted,\n asChild,\n children,\n ...props\n}: DropdownMenuSubContentProps) {\n return (\n <DropdownMenuPortal keepMounted={keepMounted}>\n <DropdownMenuPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n sticky={sticky}\n className=\"isolate z-50 outline-none\"\n >\n <DropdownMenuPrimitive.Popup\n data-slot=\"dropdown-menu-sub-content\"\n className={(state) =>\n cn(\n 'relative z-50 min-w-24 origin-(--transform-origin) overflow-hidden rounded-lg p-1 outline-none',\n 'bg-popover/70 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n 'before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit]',\n 'before:backdrop-blur-2xl before:backdrop-saturate-150',\n '**:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10',\n '**:data-[slot$=-separator]:bg-foreground/5',\n '**:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10!',\n '**:data-[variant=destructive]:focus:bg-destructive/10! dark:**:data-[variant=destructive]:focus:bg-destructive/20!',\n '**:data-[variant=destructive]:text-destructive! **:data-[variant=destructive]:**:text-destructive!',\n 'animate-none!',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n </DropdownMenuPrimitive.Positioner>\n </DropdownMenuPortal>\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger\n}\n"],"mappings":"wYAkEA,MAAMG,EAA2BD,EAAM,cAAc,EAAK,EAE1D,SAAS,aAAa,CAAE,GAAGE,GAA4B,CACrD,MAAO,kBAACJ,EAAsB,KAAvB,CAA4B,YAAU,gBAAgB,GAAII,CAAQ,CAAA,CAC3E,CAEA,SAAS,mBAAmB,CAAE,GAAGA,GAAkC,CACjE,MAAO,kBAACJ,EAAsB,OAAvB,CAA8B,YAAU,uBAAuB,GAAII,CAAQ,CAAA,CACpF,CAEA,SAAS,oBAAoB,CAAE,UAAS,WAAU,GAAGA,GAAmC,CACtF,MACE,kBAACJ,EAAsB,QAAvB,CACE,YAAU,wBACV,GAAII,EACJ,GAAIE,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL,CAEA,SAAS,oBAAoB,CAC3B,YACA,OAAO,SACP,aAAa,EACb,QAAQ,QACR,cAAc,EACd,SACA,cACA,UACA,WACA,GAAGJ,GACwB,CAC3B,MACE,kBAAC,mBAAD,CAAiC,cAC/B,SAAA,kBAACJ,EAAsB,WAAvB,CACQ,OACM,aACL,QACM,cACL,SACR,UAAU,4BAEV,SAAA,kBAACA,EAAsB,MAAvB,CACE,YAAU,wBACV,UAAY,GACVS,EACE,oFACA,+EACA,yFACA,8BACA,uIACA,8JACA,iGACA,wDACA,uGACA,6CACA,2GACA,qHACA,qGACA,gBACAR,EAA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,CAC3C,CAAA,CAEL,CAEA,SAAS,qBAAqB,CAAE,YAAW,GAAGJ,GAAoC,CAChF,MACE,kBAAC,OAAD,CACE,YAAU,yBACV,UAAWK,EACT,8GACAC,CACF,EACA,GAAIN,CACL,CAAA,CAEL,CAEA,SAAS,gBAAgB,CAAE,GAAGA,GAA+B,CAC3D,MAAO,kBAACJ,EAAsB,YAAvB,CAAmC,YAAU,oBAAoB,GAAII,CAAQ,CAAA,CACtF,CAEA,SAAS,uBAAuB,CAAE,YAAW,QAAO,WAAU,UAAS,GAAGA,GAAsC,CAC9G,MACE,kBAACJ,EAAsB,eAAvB,CACE,YAAU,4BACV,aAAYY,EACZ,UAAY,GACVH,EACE,0EACA,6BACA,8GACA,mFACA,oFACAR,EAAiBS,EAAWC,CAAK,CACnC,EAEF,GAAIP,EACJ,GAAIE,EAAqBC,EAASC,CAAQ,EAd5C,SAAA,CAgBG,CAACD,GAAWC,EACZ,CAACD,GAAW,kBAACW,EAAD,CAAkB,UAAU,SAAW,CAAA,CAChB,GAE1C,CAEA,SAAS,uBAAuB,CAC9B,YACA,OAAO,QACP,aAAa,EACb,QAAQ,QACR,cAAc,GACd,SACA,cACA,UACA,WACA,GAAGd,GAC2B,CAC9B,MACE,kBAAC,mBAAD,CAAiC,cAC/B,SAAA,kBAACJ,EAAsB,WAAvB,CACQ,OACM,aACL,QACM,cACL,SACR,UAAU,4BAEV,SAAA,kBAACA,EAAsB,MAAvB,CACE,YAAU,4BACV,UAAY,GACVS,EACE,iGACA,yFACA,uIACA,8JACA,iGACA,wDACA,uGACA,6CACA,2GACA,qHACA,qGACA,gBACAR,EAAiBS,EAAWC,CAAK,CACnC,EAEF,GAAIP,EACJ,GAAIE,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAC+B,CAAA,CAChB,CAAA,CAExB"}
1
+ {"version":3,"file":"dropdown-menu.js","names":["DropdownMenuPrimitive","resolveClassName","React","DropdownMenuGroupContext","props","Menu","toAsChildRenderProps","asChild","children","cn","className","state","inset","variant","IconCheck","isInsideGroup","labelProps","useAsChild","IconChevronRight"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Menu as DropdownMenuPrimitive } from '@base-ui/react/menu'\nimport { IconCheck, IconChevronRight } from '@tabler/icons-react'\n\nimport { type AsChildPrimitiveProps, type AsChildProps, toAsChildRenderProps, useAsChild } from '../lib/as-child'\nimport { cn } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\n\nexport type DropdownMenuProps = React.ComponentProps<typeof DropdownMenuPrimitive.Root>\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof DropdownMenuPrimitive.Portal>\n\nexport type DropdownMenuTriggerProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.Trigger>\n\nexport type DropdownMenuContentProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.Popup> &\n Pick<\n React.ComponentProps<typeof DropdownMenuPrimitive.Positioner>,\n 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'sticky'\n > &\n Pick<DropdownMenuPortalProps, 'keepMounted'>\n\nexport type DropdownMenuGroupProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.Group>\n\nexport type DropdownMenuItemProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.Item> & {\n /** Adds left padding so the text lines up with items that have an icon or indicator. */\n inset?: boolean\n /**\n * `destructive` colors the item red for dangerous actions.\n * @default 'default'\n */\n variant?: 'default' | 'destructive'\n}\n\nexport type DropdownMenuCheckboxItemProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.CheckboxItem> & {\n /** Adds left padding so the text lines up with items that have an icon or indicator. */\n inset?: boolean\n}\n\nexport type DropdownMenuRadioGroupProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.RadioGroup>\n\nexport type DropdownMenuRadioItemProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.RadioItem> & {\n /** Adds left padding so the text lines up with items that have an icon or indicator. */\n inset?: boolean\n}\n\nexport type DropdownMenuLabelProps = AsChildProps<'div'> & {\n /** Adds left padding so the text lines up with items that have an icon or indicator. */\n inset?: boolean\n}\n\nexport type DropdownMenuSeparatorProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.Separator>\n\nexport type DropdownMenuShortcutProps = React.ComponentProps<'span'>\n\nexport type DropdownMenuSubProps = React.ComponentProps<typeof DropdownMenuPrimitive.SubmenuRoot>\n\nexport type DropdownMenuSubTriggerProps = AsChildPrimitiveProps<typeof DropdownMenuPrimitive.SubmenuTrigger> & {\n /** Adds left padding so the text lines up with items that have an icon or indicator. */\n inset?: boolean\n}\n\nexport type DropdownMenuSubContentProps = DropdownMenuContentProps\n\n// Base UI's `GroupLabel` must live inside a `Group`/`RadioGroup`; this flag lets `DropdownMenuLabel`\n// fall back to a plain element when it is rendered on its own, like Radix's `Label` allowed.\nconst DropdownMenuGroupContext = React.createContext(false)\n\nfunction DropdownMenu({ ...props }: DropdownMenuProps) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />\n}\n\nfunction DropdownMenuPortal({ ...props }: DropdownMenuPortalProps) {\n return <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n}\n\nfunction DropdownMenuTrigger({ asChild, children, ...props }: DropdownMenuTriggerProps) {\n return (\n <DropdownMenuPrimitive.Trigger\n data-slot=\"dropdown-menu-trigger\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DropdownMenuContent({\n className,\n side = 'bottom',\n sideOffset = 4,\n align = 'start',\n alignOffset = 0,\n sticky,\n keepMounted,\n asChild,\n children,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuPortal keepMounted={keepMounted}>\n <DropdownMenuPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n sticky={sticky}\n className=\"isolate z-50 outline-none\"\n >\n <DropdownMenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={(state) =>\n cn(\n 'relative z-50 w-(--anchor-width) min-w-32 max-h-(--available-height) outline-none',\n 'origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1',\n 'bg-popover/70 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100',\n 'data-closed:overflow-hidden',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n 'before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit]',\n 'before:backdrop-blur-2xl before:backdrop-saturate-150',\n '**:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10',\n '**:data-[slot$=-separator]:bg-foreground/5',\n '**:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10!',\n '**:data-[variant=destructive]:focus:bg-destructive/10! dark:**:data-[variant=destructive]:focus:bg-destructive/20!',\n '**:data-[variant=destructive]:text-destructive! **:data-[variant=destructive]:**:text-destructive!',\n 'animate-none!',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n </DropdownMenuPrimitive.Positioner>\n </DropdownMenuPortal>\n )\n}\n\nfunction DropdownMenuGroup({ asChild, children, ...props }: DropdownMenuGroupProps) {\n return (\n <DropdownMenuGroupContext.Provider value={true}>\n <DropdownMenuPrimitive.Group\n data-slot=\"dropdown-menu-group\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n </DropdownMenuGroupContext.Provider>\n )\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n asChild,\n children,\n ...props\n}: DropdownMenuItemProps) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={(state) =>\n cn(\n 'group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm',\n 'select-none outline-hidden',\n 'focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground',\n 'data-inset:pl-7',\n 'data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive',\n 'dark:data-[variant=destructive]:focus:bg-destructive/20',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n 'data-[variant=destructive]:*:[svg]:text-destructive',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({ className, children, inset, asChild, ...props }: DropdownMenuCheckboxItemProps) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={(state) =>\n cn(\n 'relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm',\n 'select-none outline-hidden',\n 'focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground',\n 'data-inset:pl-7',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && (\n <span\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n className=\"pointer-events-none absolute right-2 flex items-center justify-center\"\n >\n <DropdownMenuPrimitive.CheckboxItemIndicator>\n <IconCheck />\n </DropdownMenuPrimitive.CheckboxItemIndicator>\n </span>\n )}\n {!asChild && children}\n </DropdownMenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({ asChild, children, ...props }: DropdownMenuRadioGroupProps) {\n return (\n <DropdownMenuGroupContext.Provider value={true}>\n <DropdownMenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n </DropdownMenuGroupContext.Provider>\n )\n}\n\nfunction DropdownMenuRadioItem({ className, children, inset, asChild, ...props }: DropdownMenuRadioItemProps) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={(state) =>\n cn(\n 'relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm',\n 'select-none outline-hidden',\n 'focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground',\n 'data-inset:pl-7',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && (\n <span\n data-slot=\"dropdown-menu-radio-item-indicator\"\n className=\"pointer-events-none absolute right-2 flex items-center justify-center\"\n >\n <DropdownMenuPrimitive.RadioItemIndicator>\n <IconCheck />\n </DropdownMenuPrimitive.RadioItemIndicator>\n </span>\n )}\n {!asChild && children}\n </DropdownMenuPrimitive.RadioItem>\n )\n}\n\nfunction DropdownMenuLabel({ className, inset, asChild, children, ...props }: DropdownMenuLabelProps) {\n const isInsideGroup = React.useContext(DropdownMenuGroupContext)\n const labelProps = {\n 'data-slot': 'dropdown-menu-label',\n 'data-inset': inset,\n className: cn('px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7', className),\n ...props\n }\n\n if (isInsideGroup) {\n return <DropdownMenuPrimitive.GroupLabel {...labelProps} {...toAsChildRenderProps(asChild, children)} />\n }\n\n return (\n <DropdownMenuStandaloneLabel {...labelProps} asChild={asChild}>\n {children}\n </DropdownMenuStandaloneLabel>\n )\n}\n\nfunction DropdownMenuStandaloneLabel(props: AsChildProps<'div'>) {\n return useAsChild('div', { ...props })\n}\n\nfunction DropdownMenuSeparator({ className, asChild, children, ...props }: DropdownMenuSeparatorProps) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={(state) => cn('bg-border -mx-1 my-1 h-px', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: DropdownMenuShortcutProps) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({ ...props }: DropdownMenuSubProps) {\n return <DropdownMenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({ className, inset, children, asChild, ...props }: DropdownMenuSubTriggerProps) {\n return (\n <DropdownMenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={(state) =>\n cn(\n 'flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm',\n 'select-none outline-hidden',\n 'focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground',\n 'data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && children}\n {!asChild && <IconChevronRight className=\"ml-auto\" />}\n </DropdownMenuPrimitive.SubmenuTrigger>\n )\n}\n\nfunction DropdownMenuSubContent({\n className,\n side = 'right',\n sideOffset = 0,\n align = 'start',\n alignOffset = -3,\n sticky,\n keepMounted,\n asChild,\n children,\n ...props\n}: DropdownMenuSubContentProps) {\n return (\n <DropdownMenuPortal keepMounted={keepMounted}>\n <DropdownMenuPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n sticky={sticky}\n className=\"isolate z-50 outline-none\"\n >\n <DropdownMenuPrimitive.Popup\n data-slot=\"dropdown-menu-sub-content\"\n className={(state) =>\n cn(\n 'relative z-50 min-w-24 origin-(--transform-origin) overflow-hidden rounded-lg p-1 outline-none',\n 'bg-popover/70 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n 'before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit]',\n 'before:backdrop-blur-2xl before:backdrop-saturate-150',\n '**:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10',\n '**:data-[slot$=-separator]:bg-foreground/5',\n '**:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10!',\n '**:data-[variant=destructive]:focus:bg-destructive/10! dark:**:data-[variant=destructive]:focus:bg-destructive/20!',\n '**:data-[variant=destructive]:text-destructive! **:data-[variant=destructive]:**:text-destructive!',\n 'animate-none!',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n </DropdownMenuPrimitive.Positioner>\n </DropdownMenuPortal>\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubT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,kBAACJ,EAAsB,eAAvB,CACE,YAAU,4BACV,aAAYY,EACZ,UAAY,GACVH,EACE,0EACA,6BACA,8GACA,mFACA,oFACAR,EAAiBS,EAAWC,CAAK,CACnC,EAEF,GAAIP,EACJ,GAAIE,EAAqBC,EAASC,CAAQ,EAd5C,SAAA,CAgBG,CAACD,GAAWC,EACZ,CAACD,GAAW,kBAACW,EAAD,CAAkB,UAAU,SAAW,CAAA,CAChB,C,EAE1C,CAEA,SAAS,uBAAuB,CAC9B,YACA,OAAO,QACP,aAAa,EACb,QAAQ,QACR,cAAc,GACd,SACA,cACA,UACA,WACA,GAAGd,GAC2B,CAC9B,MACE,kBAAC,mBAAD,CAAiC,cAC/B,SAAA,kBAACJ,EAAsB,WAAvB,CACQ,OACM,aACL,QACM,cACL,SACR,UAAU,4BAEV,SAAA,kBAACA,EAAsB,MAAvB,CACE,YAAU,4BACV,UAAY,GACVS,EACE,iGACA,yFACA,uIACA,8JACA,iGACA,wDACA,uGACA,6CACA,2GACA,qHACA,qGACA,gBACAR,EAAiBS,EAAWC,CAAK,CACnC,EAEF,GAAIP,EACJ,GAAIE,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAC+B,CAAA,CAChB,CAAA,CAExB,C"}
@@ -2,7 +2,6 @@ import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
2
  import { ButtonProps } from "./button.js";
3
3
  import * as React from "react";
4
4
  import { Accept, ErrorCode, FileError, useDropzone as useDropzone$1 } from "react-dropzone";
5
- //#region src/components/dropzone.d.ts
6
5
  export type DropzoneUploadResult<TUploadResult, TUploadError> = {
7
6
  status: 'error';
8
7
  error: TUploadError;
@@ -116,6 +115,5 @@ declare const DropzoneRemoveFile: React.ForwardRefExoticComponent<Omit<ButtonPro
116
115
  declare const DropzoneRetryFile: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
117
116
  declare const DropzoneTrigger: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
118
117
  declare const InfiniteProgress: React.ForwardRefExoticComponent<Omit<InfiniteProgressProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
119
- //#endregion
120
118
  export { Dropzone, DropzoneArea, DropzoneDescription, DropzoneFileList, DropzoneFileListItem, DropzoneFileMessage, DropzoneMessage, DropzoneRemoveFile, DropzoneRetryFile, DropzoneTrigger, ErrorCode, type FileError, InfiniteProgress, useDropzone };
121
119
  //# sourceMappingURL=dropzone.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{composeRefs as n}from"../lib/compose-refs.js";import*as r from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{ErrorCode as o,useDropzone as s}from"react-dropzone";const c=[o.FileInvalidType,o.FileTooLarge,o.FileTooSmall,o.TooManyFiles],l=new Set(c),u={pending:`indeterminate`,success:`100%`,error:`error`},d=r.createContext(null),f=r.createContext(null);function fileStatusReducer(e,t){switch(t.type){case`add`:return[...e,{id:t.id,fileName:t.fileName,file:t.file,status:`pending`,tries:1}];case`remove`:return e.filter(e=>e.id!==t.id);case`update-status`:return e.map(e=>e.id===t.id?t.status===`pending`?{...e,status:`pending`,error:void 0,message:void 0,result:void 0,tries:e.tries+1}:t.status===`error`?{...e,status:`error`,error:t.error,message:t.message,result:void 0}:{...e,status:`success`,result:t.result,error:void 0,message:void 0}:e)}}function formatAcceptedTypes(e){if(!e)return;let t=Object.entries(e).flatMap(([e,t])=>t.length>0?t:[e]);return t.length>0?t.join(`, `):void 0}function getDropzoneErrorCodes(e){let t=e.flatMap(e=>e.errors.map(e=>e.code).filter(e=>l.has(e)));return Array.from(new Set(t))}function getRootError(e,t){let n=e.flatMap(e=>{switch(e){case`file-invalid-type`:{let e=formatAcceptedTypes(t.accept);return e?[`only ${e} files are allowed`]:[`this file type is not allowed`]}case`file-too-large`:return t.maxSize?[`max size is ${(t.maxSize/1048576).toFixed(2)} MB`]:[`this file is too large`];case`file-too-small`:return t.minSize?[`min size is ${(t.minSize/1048576).toFixed(2)} MB`]:[`this file is too small`];case`too-many-files`:return t.maxFiles?[`max ${t.maxFiles} files`]:[`too many files`];default:return[]}});if(n.length===0)return`Unable to add the selected files`;let[r,...i]=n;return`${r.charAt(0).toUpperCase()}${r.slice(1)}${i.length>0?`, ${i.join(`, `)}`:``}`}function getRejectionMessage(e,t){let n=getDropzoneErrorCodes(e);return n.length>0?getRootError(n,t):e[0]?.errors[0]?.message??`Unable to add the selected files`}function getUploadErrorMessage(e,t){if(t){let n=t(e);if(n!==void 0)return n}if(typeof e==`string`)return e;if(e instanceof Error)return e.message}function useDropzoneContext(){let e=r.useContext(d);if(!e)throw Error(`Dropzone components must be used within a Dropzone.`);return e}function useDropzoneFileListContext(){let e=r.useContext(f);if(!e)throw Error(`Dropzone file actions must be used within a DropzoneFileListItem.`);return e}function useDropzone(e){let{onDropFile:t,onRemoveFile:n,shapeUploadError:i,onFileUploaded:a,onFileUploadError:c,onAllUploaded:l,onRootError:u,maxRetryCount:d,autoRetry:f=!1,validation:p,shiftOnMaxFiles:m=!1}=e,h=r.useId(),g=`${h}-message`,_=`${h}-description`,[v,y]=r.useState(void 0),b=r.useCallback(e=>{y(e),u?.(e)},[u]),[x,S]=r.useReducer(fileStatusReducer,[]),C=r.useCallback(e=>`${h}-${e}-message`,[h]),w=r.useMemo(()=>v!==void 0||x.some(e=>e.status===`error`),[x,v]),T=r.useCallback(async(e,n,r=0)=>{try{let o=await t(e);if(o.status===`error`){if(f&&r<(d??1/0))return S({type:`update-status`,id:n,status:`pending`}),T(e,n,r+1);S({type:`update-status`,id:n,status:`error`,error:o.error,message:getUploadErrorMessage(o.error,i)}),c?.(o.error);return}S({type:`update-status`,id:n,status:`success`,result:o.result}),a?.(o.result)}catch(e){let t=e;S({type:`update-status`,id:n,status:`error`,error:t,message:getUploadErrorMessage(t,i)}),c?.(t)}},[f,t,d,c,a,i]),E=r.useCallback(async e=>{await n?.(e),S({type:`remove`,id:e})},[n]),D=r.useCallback(e=>{let t=x.find(t=>t.id===e);return t?.status===`error`&&t.tries<=(d??1/0)},[x,d]),O=r.useCallback(async e=>{if(!D(e))return;let t=x.find(t=>t.id===e);t?.status===`error`&&(S({type:`update-status`,id:e,status:`pending`}),await T(t.file,e))},[D,x,T]),k=s({accept:p?.accept,minSize:p?.minSize,maxSize:p?.maxSize,maxFiles:p?.maxFiles,noClick:!0,noKeyboard:!0,onDropAccepted:async e=>{b(void 0);let t=e,n=p?.maxFiles??1/0,r=Number.isFinite(n)?Math.max(x.length+e.length-n,0):0;if(r>0){if(m){let n=x.slice(0,Math.min(r,x.length));await Promise.all(n.map(e=>E(e.id)));let i=r-n.length;i>0&&(t=e.slice(i))}else{b(getRootError([o.TooManyFiles],p??{}));let r=Math.max(n-x.length,0);t=e.slice(0,r)}}t.length!==0&&(await Promise.all(t.map(async e=>{let t=crypto.randomUUID();S({type:`add`,id:t,fileName:e.name,file:e}),await T(e,t)})),l?.())},onDropRejected:e=>{b(getRejectionMessage(e,p??{}))}});return{getRootProps:k.getRootProps,getInputProps:k.getInputProps,open:k.open,onRemoveFile:E,onRetry:O,canRetry:D,fileStatuses:x,isInvalid:w,isDragActive:k.isDragActive,rootError:v,inputId:h,rootMessageId:g,rootDescriptionId:_,getFileMessageId:C}}function Dropzone({children:e,...t}){return/* @__PURE__ */ i(d.Provider,{value:t,children:e})}const p=r.forwardRef(({className:t,children:r,...o},s)=>{let c=useDropzoneContext(),l=[c.rootDescriptionId,c.isInvalid?c.rootMessageId:void 0].filter(Boolean).join(` `)||void 0,{ref:u,...d}=c.getRootProps({...o,"data-slot":`dropzone-area`,"aria-describedby":l,"aria-invalid":c.isInvalid||void 0,className:e(`flex min-h-44 flex-col items-center justify-center gap-4 rounded-xl border border-dashed border-input bg-muted/20 px-6 py-8 text-center transition-colors`,c.isDragActive&&`border-primary bg-primary/5`,c.isInvalid&&`border-destructive bg-destructive/5`,t)}),f=c.getInputProps({id:c.inputId,className:`sr-only`,"aria-describedby":l,"aria-invalid":c.isInvalid,tabIndex:-1});return/* @__PURE__ */ a(`div`,{...d,ref:n(s,u),children:[/* @__PURE__ */ i(`input`,{...f}),r]})}),m=r.forwardRef(({className:t,...n},r)=>{let a=useDropzoneContext();return/* @__PURE__ */ i(`p`,{ref:r,id:a.rootDescriptionId,"data-slot":`dropzone-description`,className:e(`text-sm text-muted-foreground`,t),...n})}),h=r.forwardRef(({className:t,...n},r)=>(useDropzoneContext(),/* @__PURE__ */ i(`ol`,{ref:r,"data-slot":`dropzone-file-list`,className:e(`space-y-3`,t),...n}))),g=r.forwardRef(({className:t,file:n,children:a,...o},s)=>{let c=useDropzoneContext(),l=c.getFileMessageId(n.id),u=n.status===`error`,d=c.canRetry(n.id),p=r.useMemo(()=>({onRemoveFile:()=>c.onRemoveFile(n.id),onRetry:()=>c.onRetry(n.id),fileStatus:n,canRetry:d,dropzoneId:c.inputId,messageId:l}),[d,c,n,l]);return/* @__PURE__ */ i(f.Provider,{value:p,children:/* @__PURE__ */ i(`li`,{ref:s,"data-slot":`dropzone-file-item`,"data-status":n.status,"aria-describedby":u?l:void 0,className:e(`rounded-xl border bg-card px-4 py-3 shadow-xs`,n.status===`error`&&`border-destructive/50`,t),...o,children:a})})}),_=r.forwardRef(({className:t,children:n,...r},a)=>{let o=useDropzoneFileListContext(),s=o.fileStatus.status===`error`?o.fileStatus.message??String(o.fileStatus.error):n;return/* @__PURE__ */ i(`p`,{ref:a,id:o.messageId,"data-slot":`dropzone-file-message`,className:e(`min-h-5 text-[0.8rem] font-medium`,o.fileStatus.status===`error`&&`text-destructive`,t),...r,children:s})}),v=r.forwardRef(({className:t,children:n,...r},a)=>{let o=useDropzoneContext(),s=o.rootError??n;return/* @__PURE__ */ i(`p`,{ref:a,id:o.rootMessageId,"data-slot":`dropzone-message`,className:e(`min-h-5 text-[0.8rem] font-medium text-destructive`,t),...r,children:s})}),y=r.forwardRef(({className:n,onClick:a,size:o=`icon-sm`,type:s=`button`,variant:c=`ghost`,...l},u)=>{let d=useDropzoneFileListContext(),f=r.useCallback(e=>{a?.(e),!e.defaultPrevented&&d.onRemoveFile()},[d,a]);return/* @__PURE__ */ i(t,{ref:u,"data-slot":`dropzone-remove-file`,className:e(n),onClick:f,size:o,type:s,variant:c,...l})}),b=r.forwardRef(({className:n,disabled:a,onClick:o,size:s=`icon-sm`,type:c=`button`,variant:l=`ghost`,...u},d)=>{let f=useDropzoneFileListContext(),p=a||!f.canRetry,m=r.useCallback(e=>{o?.(e),!(e.defaultPrevented||p)&&f.onRetry()},[f,p,o]);return/* @__PURE__ */ i(t,{ref:d,"data-slot":`dropzone-retry-file`,className:e(n),disabled:p,onClick:m,size:s,type:c,variant:l,...u})}),x=r.forwardRef(({className:n,onClick:a,size:o=`sm`,type:s=`button`,variant:c=`subtle`,...l},u)=>{let d=useDropzoneContext(),f=[d.rootDescriptionId,d.isInvalid?d.rootMessageId:void 0].filter(Boolean).join(` `)||void 0,p=r.useCallback(e=>{a?.(e),!e.defaultPrevented&&d.open()},[d,a]);return/* @__PURE__ */ i(t,{ref:u,"aria-controls":d.inputId,"aria-describedby":f,"aria-invalid":d.isInvalid||void 0,"data-slot":`dropzone-trigger`,className:e(n),onClick:p,size:o,type:s,variant:c,...l})}),S=r.forwardRef(({className:t,status:n,...r},a)=>{let o=n===`success`||n===`error`,s=n===`error`;return/* @__PURE__ */ i(`div`,{ref:a,"aria-valuemax":100,"aria-valuemin":0,"aria-valuetext":u[n],"data-slot":`dropzone-progress`,"data-status":n,role:`progressbar`,className:e(`relative h-2 w-full overflow-hidden rounded-full bg-muted`,t),...r,children:/* @__PURE__ */ i(`div`,{className:e(`h-full w-full rounded-full bg-primary transition-transform`,o?`translate-x-0`:`animate-infinite-progress`,s&&`bg-destructive`)})})});Dropzone.displayName=`Dropzone`,p.displayName=`DropzoneArea`,m.displayName=`DropzoneDescription`,h.displayName=`DropzoneFileList`,g.displayName=`DropzoneFileListItem`,_.displayName=`DropzoneFileMessage`,v.displayName=`DropzoneMessage`,y.displayName=`DropzoneRemoveFile`,b.displayName=`DropzoneRetryFile`,x.displayName=`DropzoneTrigger`,S.displayName=`InfiniteProgress`;export{Dropzone,p as DropzoneArea,m as DropzoneDescription,h as DropzoneFileList,g as DropzoneFileListItem,_ as DropzoneFileMessage,v as DropzoneMessage,y as DropzoneRemoveFile,b as DropzoneRetryFile,x as DropzoneTrigger,o as ErrorCode,S as InfiniteProgress,useDropzone};
1
+ import"../rolldown-runtime-BhWHdk3m.js";import{composeRefs as e}from"../lib/compose-refs.js";import{cn as t}from"../lib/utils.js";import{Button as n}from"./button.js";import*as r from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{ErrorCode as o,useDropzone as s}from"react-dropzone";const c=[o.FileInvalidType,o.FileTooLarge,o.FileTooSmall,o.TooManyFiles],l=new Set(c),u={pending:`indeterminate`,success:`100%`,error:`error`},d=r.createContext(null),f=r.createContext(null);function fileStatusReducer(e,t){switch(t.type){case`add`:return[...e,{id:t.id,fileName:t.fileName,file:t.file,status:`pending`,tries:1}];case`remove`:return e.filter(e=>e.id!==t.id);case`update-status`:return e.map(e=>e.id===t.id?t.status===`pending`?{...e,status:`pending`,error:void 0,message:void 0,result:void 0,tries:e.tries+1}:t.status===`error`?{...e,status:`error`,error:t.error,message:t.message,result:void 0}:{...e,status:`success`,result:t.result,error:void 0,message:void 0}:e)}}function formatAcceptedTypes(e){if(!e)return;let t=Object.entries(e).flatMap(([e,t])=>t.length>0?t:[e]);return t.length>0?t.join(`, `):void 0}function getDropzoneErrorCodes(e){let t=e.flatMap(e=>e.errors.map(e=>e.code).filter(e=>l.has(e)));return Array.from(new Set(t))}function getRootError(e,t){let n=e.flatMap(e=>{switch(e){case`file-invalid-type`:{let e=formatAcceptedTypes(t.accept);return e?[`only ${e} files are allowed`]:[`this file type is not allowed`]}case`file-too-large`:return t.maxSize?[`max size is ${(t.maxSize/1048576).toFixed(2)} MB`]:[`this file is too large`];case`file-too-small`:return t.minSize?[`min size is ${(t.minSize/1048576).toFixed(2)} MB`]:[`this file is too small`];case`too-many-files`:return t.maxFiles?[`max ${t.maxFiles} files`]:[`too many files`];default:return[]}});if(n.length===0)return`Unable to add the selected files`;let[r,...i]=n;return`${r.charAt(0).toUpperCase()}${r.slice(1)}${i.length>0?`, ${i.join(`, `)}`:``}`}function getRejectionMessage(e,t){let n=getDropzoneErrorCodes(e);return n.length>0?getRootError(n,t):e[0]?.errors[0]?.message??`Unable to add the selected files`}function getUploadErrorMessage(e,t){if(t){let n=t(e);if(n!==void 0)return n}if(typeof e==`string`)return e;if(e instanceof Error)return e.message}function useDropzoneContext(){let e=r.useContext(d);if(!e)throw Error(`Dropzone components must be used within a Dropzone.`);return e}function useDropzoneFileListContext(){let e=r.useContext(f);if(!e)throw Error(`Dropzone file actions must be used within a DropzoneFileListItem.`);return e}function useDropzone(e){let{onDropFile:t,onRemoveFile:n,shapeUploadError:i,onFileUploaded:a,onFileUploadError:c,onAllUploaded:l,onRootError:u,maxRetryCount:d,autoRetry:f=!1,validation:p,shiftOnMaxFiles:m=!1}=e,h=r.useId(),g=`${h}-message`,_=`${h}-description`,[v,y]=r.useState(void 0),b=r.useCallback(e=>{y(e),u?.(e)},[u]),[x,S]=r.useReducer(fileStatusReducer,[]),C=r.useCallback(e=>`${h}-${e}-message`,[h]),w=r.useMemo(()=>v!==void 0||x.some(e=>e.status===`error`),[x,v]),T=r.useCallback(async(e,n,r=0)=>{try{let o=await t(e);if(o.status===`error`){if(f&&r<(d??1/0))return S({type:`update-status`,id:n,status:`pending`}),T(e,n,r+1);S({type:`update-status`,id:n,status:`error`,error:o.error,message:getUploadErrorMessage(o.error,i)}),c?.(o.error);return}S({type:`update-status`,id:n,status:`success`,result:o.result}),a?.(o.result)}catch(e){let t=e;S({type:`update-status`,id:n,status:`error`,error:t,message:getUploadErrorMessage(t,i)}),c?.(t)}},[f,t,d,c,a,i]),E=r.useCallback(async e=>{await n?.(e),S({type:`remove`,id:e})},[n]),D=r.useCallback(e=>{let t=x.find(t=>t.id===e);return t?.status===`error`&&t.tries<=(d??1/0)},[x,d]),O=r.useCallback(async e=>{if(!D(e))return;let t=x.find(t=>t.id===e);t?.status===`error`&&(S({type:`update-status`,id:e,status:`pending`}),await T(t.file,e))},[D,x,T]),k=s({accept:p?.accept,minSize:p?.minSize,maxSize:p?.maxSize,maxFiles:p?.maxFiles,noClick:!0,noKeyboard:!0,onDropAccepted:async e=>{b(void 0);let t=e,n=p?.maxFiles??1/0,r=Number.isFinite(n)?Math.max(x.length+e.length-n,0):0;if(r>0){if(m){let n=x.slice(0,Math.min(r,x.length));await Promise.all(n.map(e=>E(e.id)));let i=r-n.length;i>0&&(t=e.slice(i))}else{b(getRootError([o.TooManyFiles],p??{}));let r=Math.max(n-x.length,0);t=e.slice(0,r)}}t.length!==0&&(await Promise.all(t.map(async e=>{let t=crypto.randomUUID();S({type:`add`,id:t,fileName:e.name,file:e}),await T(e,t)})),l?.())},onDropRejected:e=>{b(getRejectionMessage(e,p??{}))}});return{getRootProps:k.getRootProps,getInputProps:k.getInputProps,open:k.open,onRemoveFile:E,onRetry:O,canRetry:D,fileStatuses:x,isInvalid:w,isDragActive:k.isDragActive,rootError:v,inputId:h,rootMessageId:g,rootDescriptionId:_,getFileMessageId:C}}function Dropzone({children:e,...t}){return/* @__PURE__ */ i(d.Provider,{value:t,children:e})}const p=r.forwardRef(({className:n,children:r,...o},s)=>{let c=useDropzoneContext(),l=[c.rootDescriptionId,c.isInvalid?c.rootMessageId:void 0].filter(Boolean).join(` `)||void 0,{ref:u,...d}=c.getRootProps({...o,"data-slot":`dropzone-area`,"aria-describedby":l,"aria-invalid":c.isInvalid||void 0,className:t(`flex min-h-44 flex-col items-center justify-center gap-4 rounded-xl border border-dashed border-input bg-muted/20 px-6 py-8 text-center transition-colors`,c.isDragActive&&`border-primary bg-primary/5`,c.isInvalid&&`border-destructive bg-destructive/5`,n)}),f=c.getInputProps({id:c.inputId,className:`sr-only`,"aria-describedby":l,"aria-invalid":c.isInvalid,tabIndex:-1});return/* @__PURE__ */ a(`div`,{...d,ref:e(s,u),children:[/* @__PURE__ */ i(`input`,{...f}),r]})}),m=r.forwardRef(({className:e,...n},r)=>{let a=useDropzoneContext();return/* @__PURE__ */ i(`p`,{ref:r,id:a.rootDescriptionId,"data-slot":`dropzone-description`,className:t(`text-sm text-muted-foreground`,e),...n})}),h=r.forwardRef(({className:e,...n},r)=>(useDropzoneContext(),/* @__PURE__ */ i(`ol`,{ref:r,"data-slot":`dropzone-file-list`,className:t(`space-y-3`,e),...n}))),g=r.forwardRef(({className:e,file:n,children:a,...o},s)=>{let c=useDropzoneContext(),l=c.getFileMessageId(n.id),u=n.status===`error`,d=c.canRetry(n.id),p=r.useMemo(()=>({onRemoveFile:()=>c.onRemoveFile(n.id),onRetry:()=>c.onRetry(n.id),fileStatus:n,canRetry:d,dropzoneId:c.inputId,messageId:l}),[d,c,n,l]);return/* @__PURE__ */ i(f.Provider,{value:p,children:/* @__PURE__ */ i(`li`,{ref:s,"data-slot":`dropzone-file-item`,"data-status":n.status,"aria-describedby":u?l:void 0,className:t(`rounded-xl border bg-card px-4 py-3 shadow-xs`,n.status===`error`&&`border-destructive/50`,e),...o,children:a})})}),_=r.forwardRef(({className:e,children:n,...r},a)=>{let o=useDropzoneFileListContext(),s=o.fileStatus.status===`error`?o.fileStatus.message??String(o.fileStatus.error):n;return/* @__PURE__ */ i(`p`,{ref:a,id:o.messageId,"data-slot":`dropzone-file-message`,className:t(`min-h-5 text-[0.8rem] font-medium`,o.fileStatus.status===`error`&&`text-destructive`,e),...r,children:s})}),v=r.forwardRef(({className:e,children:n,...r},a)=>{let o=useDropzoneContext(),s=o.rootError??n;return/* @__PURE__ */ i(`p`,{ref:a,id:o.rootMessageId,"data-slot":`dropzone-message`,className:t(`min-h-5 text-[0.8rem] font-medium text-destructive`,e),...r,children:s})}),y=r.forwardRef(({className:e,onClick:a,size:o=`icon-sm`,type:s=`button`,variant:c=`ghost`,...l},u)=>{let d=useDropzoneFileListContext(),f=r.useCallback(e=>{a?.(e),e.defaultPrevented||d.onRemoveFile()},[d,a]);return/* @__PURE__ */ i(n,{ref:u,"data-slot":`dropzone-remove-file`,className:t(e),onClick:f,size:o,type:s,variant:c,...l})}),b=r.forwardRef(({className:e,disabled:a,onClick:o,size:s=`icon-sm`,type:c=`button`,variant:l=`ghost`,...u},d)=>{let f=useDropzoneFileListContext(),p=a||!f.canRetry,m=r.useCallback(e=>{o?.(e),e.defaultPrevented||p||f.onRetry()},[f,p,o]);return/* @__PURE__ */ i(n,{ref:d,"data-slot":`dropzone-retry-file`,className:t(e),disabled:p,onClick:m,size:s,type:c,variant:l,...u})}),x=r.forwardRef(({className:e,onClick:a,size:o=`sm`,type:s=`button`,variant:c=`subtle`,...l},u)=>{let d=useDropzoneContext(),f=[d.rootDescriptionId,d.isInvalid?d.rootMessageId:void 0].filter(Boolean).join(` `)||void 0,p=r.useCallback(e=>{a?.(e),e.defaultPrevented||d.open()},[d,a]);return/* @__PURE__ */ i(n,{ref:u,"aria-controls":d.inputId,"aria-describedby":f,"aria-invalid":d.isInvalid||void 0,"data-slot":`dropzone-trigger`,className:t(e),onClick:p,size:o,type:s,variant:c,...l})}),S=r.forwardRef(({className:e,status:n,...r},a)=>{let o=n===`success`||n===`error`,s=n===`error`;return/* @__PURE__ */ i(`div`,{ref:a,"aria-valuemax":100,"aria-valuemin":0,"aria-valuetext":u[n],"data-slot":`dropzone-progress`,"data-status":n,role:`progressbar`,className:t(`relative h-2 w-full overflow-hidden rounded-full bg-muted`,e),...r,children:/* @__PURE__ */ i(`div`,{className:t(`h-full w-full rounded-full bg-primary transition-transform`,o?`translate-x-0`:`animate-infinite-progress`,s&&`bg-destructive`)})})});Dropzone.displayName=`Dropzone`,p.displayName=`DropzoneArea`,m.displayName=`DropzoneDescription`,h.displayName=`DropzoneFileList`,g.displayName=`DropzoneFileListItem`,_.displayName=`DropzoneFileMessage`,v.displayName=`DropzoneMessage`,y.displayName=`DropzoneRemoveFile`,b.displayName=`DropzoneRetryFile`,x.displayName=`DropzoneTrigger`,S.displayName=`InfiniteProgress`;export{Dropzone,p as DropzoneArea,m as DropzoneDescription,h as DropzoneFileList,g as DropzoneFileListItem,_ as DropzoneFileMessage,v as DropzoneMessage,y as DropzoneRemoveFile,b as DropzoneRetryFile,x as DropzoneTrigger,o as ErrorCode,S as InfiniteProgress,useDropzone};
2
2
  //# sourceMappingURL=dropzone.js.map