@uselets/ui 2.0.0 → 2.0.2

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 (209) hide show
  1. package/dist/{as-child-Dxg3Xo1G.d.ts → as-child-T9W73ZYU.d.ts} +1 -3
  2. package/dist/{chart-B_6nC_ih.d.ts → chart-8rgtsk95.d.ts} +1 -3
  3. package/dist/cli/uselets.mjs.map +1 -1
  4. package/dist/components/accordion.d.ts +1 -3
  5. package/dist/components/accordion.js.map +1 -1
  6. package/dist/components/alert-dialog.d.ts +5 -5
  7. package/dist/components/alert-dialog.js +1 -1
  8. package/dist/components/alert-dialog.js.map +1 -1
  9. package/dist/components/alert.d.ts +0 -2
  10. package/dist/components/alert.js.map +1 -1
  11. package/dist/components/anchor.d.ts +1 -3
  12. package/dist/components/anchor.js.map +1 -1
  13. package/dist/components/area-chart.d.ts +1 -3
  14. package/dist/components/area-chart.js.map +1 -1
  15. package/dist/components/avatar.d.ts +1 -3
  16. package/dist/components/avatar.js.map +1 -1
  17. package/dist/components/badge.d.ts +1 -3
  18. package/dist/components/badge.js.map +1 -1
  19. package/dist/components/bar-chart.d.ts +1 -3
  20. package/dist/components/bar-chart.js.map +1 -1
  21. package/dist/components/bottom-nav.d.ts +1 -3
  22. package/dist/components/bottom-nav.js.map +1 -1
  23. package/dist/components/breadcrumb.d.ts +1 -3
  24. package/dist/components/breadcrumb.js.map +1 -1
  25. package/dist/components/button-group.d.ts +1 -3
  26. package/dist/components/button-group.js.map +1 -1
  27. package/dist/components/button.d.ts +1 -3
  28. package/dist/components/button.js.map +1 -1
  29. package/dist/components/calendar.d.ts +0 -2
  30. package/dist/components/calendar.js +1 -1
  31. package/dist/components/calendar.js.map +1 -1
  32. package/dist/components/card.d.ts +0 -2
  33. package/dist/components/card.js.map +1 -1
  34. package/dist/components/carousel.d.ts +0 -2
  35. package/dist/components/carousel.js.map +1 -1
  36. package/dist/components/center.d.ts +0 -2
  37. package/dist/components/center.js.map +1 -1
  38. package/dist/components/chart.d.ts +1 -1
  39. package/dist/components/chart.js.map +1 -1
  40. package/dist/components/checkbox.d.ts +0 -2
  41. package/dist/components/checkbox.js.map +1 -1
  42. package/dist/components/code.d.ts +0 -2
  43. package/dist/components/code.js.map +1 -1
  44. package/dist/components/collapsible.d.ts +1 -3
  45. package/dist/components/collapsible.js.map +1 -1
  46. package/dist/components/combobox.d.ts +1 -3
  47. package/dist/components/combobox.js.map +1 -1
  48. package/dist/components/command.d.ts +0 -2
  49. package/dist/components/command.js.map +1 -1
  50. package/dist/components/container.d.ts +0 -2
  51. package/dist/components/container.js.map +1 -1
  52. package/dist/components/data-table.d.ts +0 -2
  53. package/dist/components/data-table.js.map +1 -1
  54. package/dist/components/date-range-picker.d.ts +0 -2
  55. package/dist/components/date-range-picker.js.map +1 -1
  56. package/dist/components/dialog.d.ts +5 -5
  57. package/dist/components/dialog.js +1 -1
  58. package/dist/components/dialog.js.map +1 -1
  59. package/dist/components/direction.d.ts +0 -2
  60. package/dist/components/donut-chart.d.ts +0 -2
  61. package/dist/components/donut-chart.js.map +1 -1
  62. package/dist/components/drawer.d.ts +2 -4
  63. package/dist/components/drawer.js +1 -1
  64. package/dist/components/drawer.js.map +1 -1
  65. package/dist/components/dropdown-menu.d.ts +1 -3
  66. package/dist/components/dropdown-menu.js.map +1 -1
  67. package/dist/components/dropzone.d.ts +0 -2
  68. package/dist/components/dropzone.js.map +1 -1
  69. package/dist/components/empty.d.ts +0 -2
  70. package/dist/components/empty.js.map +1 -1
  71. package/dist/components/field.d.ts +0 -2
  72. package/dist/components/field.js.map +1 -1
  73. package/dist/components/flex.d.ts +0 -2
  74. package/dist/components/flex.js.map +1 -1
  75. package/dist/components/grid.d.ts +0 -2
  76. package/dist/components/grid.js.map +1 -1
  77. package/dist/components/group.d.ts +0 -2
  78. package/dist/components/group.js.map +1 -1
  79. package/dist/components/heading.d.ts +1 -3
  80. package/dist/components/heading.js.map +1 -1
  81. package/dist/components/hover-card.d.ts +1 -3
  82. package/dist/components/hover-card.js.map +1 -1
  83. package/dist/components/input-group.d.ts +0 -2
  84. package/dist/components/input-group.js.map +1 -1
  85. package/dist/components/input-otp.d.ts +0 -2
  86. package/dist/components/input-otp.js.map +1 -1
  87. package/dist/components/input.d.ts +0 -2
  88. package/dist/components/input.js.map +1 -1
  89. package/dist/components/kbd.d.ts +0 -2
  90. package/dist/components/kbd.js.map +1 -1
  91. package/dist/components/label.d.ts +1 -3
  92. package/dist/components/label.js.map +1 -1
  93. package/dist/components/list.d.ts +1 -3
  94. package/dist/components/list.js.map +1 -1
  95. package/dist/components/logo.d.ts +0 -2
  96. package/dist/components/marker.d.ts +1 -3
  97. package/dist/components/marker.js.map +1 -1
  98. package/dist/components/mask-input.d.ts +0 -2
  99. package/dist/components/mask-input.js.map +1 -1
  100. package/dist/components/native-select.d.ts +0 -2
  101. package/dist/components/native-select.js.map +1 -1
  102. package/dist/components/navigation-menu.d.ts +1 -3
  103. package/dist/components/navigation-menu.js.map +1 -1
  104. package/dist/components/number-field.d.ts +1 -3
  105. package/dist/components/number-field.js.map +1 -1
  106. package/dist/components/pagination.d.ts +0 -2
  107. package/dist/components/pagination.js.map +1 -1
  108. package/dist/components/phone-input.d.ts +0 -2
  109. package/dist/components/phone-input.js.map +1 -1
  110. package/dist/components/pie-chart.d.ts +1 -3
  111. package/dist/components/pie-chart.js.map +1 -1
  112. package/dist/components/popover.d.ts +1 -3
  113. package/dist/components/popover.js.map +1 -1
  114. package/dist/components/progress.d.ts +0 -2
  115. package/dist/components/progress.js.map +1 -1
  116. package/dist/components/radio-group.d.ts +0 -2
  117. package/dist/components/radio-group.js.map +1 -1
  118. package/dist/components/resizable.d.ts +0 -2
  119. package/dist/components/resizable.js.map +1 -1
  120. package/dist/components/ring-progress.d.ts +0 -2
  121. package/dist/components/ring-progress.js.map +1 -1
  122. package/dist/components/scroll-area.d.ts +0 -2
  123. package/dist/components/scroll-area.js.map +1 -1
  124. package/dist/components/select.d.ts +1 -3
  125. package/dist/components/select.js.map +1 -1
  126. package/dist/components/separator.d.ts +1 -3
  127. package/dist/components/separator.js.map +1 -1
  128. package/dist/components/sidebar.d.ts +1 -3
  129. package/dist/components/sidebar.js.map +1 -1
  130. package/dist/components/simple-grid.d.ts +0 -2
  131. package/dist/components/simple-grid.js.map +1 -1
  132. package/dist/components/skeleton.d.ts +0 -2
  133. package/dist/components/skeleton.js.map +1 -1
  134. package/dist/components/slider.d.ts +0 -2
  135. package/dist/components/slider.js.map +1 -1
  136. package/dist/components/sonner.d.ts +0 -2
  137. package/dist/components/sonner.js.map +1 -1
  138. package/dist/components/spinner.d.ts +0 -2
  139. package/dist/components/spinner.js.map +1 -1
  140. package/dist/components/stack.d.ts +0 -2
  141. package/dist/components/stack.js.map +1 -1
  142. package/dist/components/stepper.d.ts +1 -3
  143. package/dist/components/stepper.js.map +1 -1
  144. package/dist/components/switch.d.ts +0 -2
  145. package/dist/components/switch.js.map +1 -1
  146. package/dist/components/table.d.ts +0 -2
  147. package/dist/components/table.js.map +1 -1
  148. package/dist/components/tabs.d.ts +1 -3
  149. package/dist/components/tabs.js.map +1 -1
  150. package/dist/components/text.d.ts +1 -3
  151. package/dist/components/text.js.map +1 -1
  152. package/dist/components/textarea.d.ts +0 -2
  153. package/dist/components/textarea.js.map +1 -1
  154. package/dist/components/theme.d.ts +0 -2
  155. package/dist/components/theme.js.map +1 -1
  156. package/dist/components/timeline.d.ts +0 -2
  157. package/dist/components/timeline.js.map +1 -1
  158. package/dist/components/toggle-group.d.ts +1 -3
  159. package/dist/components/toggle-group.js.map +1 -1
  160. package/dist/components/toggle.d.ts +1 -3
  161. package/dist/components/toggle.js.map +1 -1
  162. package/dist/components/tooltip.d.ts +1 -3
  163. package/dist/components/tooltip.js.map +1 -1
  164. package/dist/components/unstyled-button.d.ts +1 -3
  165. package/dist/components/unstyled-button.js.map +1 -1
  166. package/dist/components/visibility.d.ts +0 -2
  167. package/dist/components/visibility.js.map +1 -1
  168. package/dist/hooks/use-breakpoint-value.d.ts +0 -2
  169. package/dist/hooks/use-breakpoint-value.js.map +1 -1
  170. package/dist/hooks/use-breakpoint.d.ts +0 -2
  171. package/dist/hooks/use-breakpoint.js.map +1 -1
  172. package/dist/hooks/use-disclosure.d.ts +0 -2
  173. package/dist/hooks/use-disclosure.js.map +1 -1
  174. package/dist/hooks/use-document-visibility.d.ts +0 -2
  175. package/dist/hooks/use-document-visibility.js.map +1 -1
  176. package/dist/hooks/use-hotkeys.d.ts +1 -1
  177. package/dist/hooks/use-idle.d.ts +0 -2
  178. package/dist/hooks/use-idle.js.map +1 -1
  179. package/dist/hooks/use-interval.d.ts +0 -2
  180. package/dist/hooks/use-interval.js.map +1 -1
  181. package/dist/hooks/use-local-storage.d.ts +0 -2
  182. package/dist/hooks/use-local-storage.js.map +1 -1
  183. package/dist/hooks/use-mask.d.ts +0 -2
  184. package/dist/hooks/use-mask.js.map +1 -1
  185. package/dist/hooks/use-mobile.d.ts +0 -2
  186. package/dist/hooks/use-mobile.js.map +1 -1
  187. package/dist/index.d.ts +3 -3
  188. package/dist/lib/as-child.d.ts +1 -1
  189. package/dist/lib/as-child.js.map +1 -1
  190. package/dist/lib/badge.d.ts +0 -2
  191. package/dist/lib/badge.js.map +1 -1
  192. package/dist/lib/button.d.ts +0 -2
  193. package/dist/lib/button.js.map +1 -1
  194. package/dist/lib/color.d.ts +0 -2
  195. package/dist/lib/color.js.map +1 -1
  196. package/dist/lib/compose-refs.d.ts +0 -2
  197. package/dist/lib/compose-refs.js.map +1 -1
  198. package/dist/lib/progress.d.ts +0 -2
  199. package/dist/lib/progress.js.map +1 -1
  200. package/dist/lib/utils.d.ts +0 -2
  201. package/dist/lib/utils.js.map +1 -1
  202. package/dist/logo--R3_XDgA.js.map +1 -1
  203. package/dist/postcss.config.js.map +1 -1
  204. package/dist/resolve-class-name-BurP8ngI.js.map +1 -1
  205. package/dist/skills/uselets-ui/references/component-catalog.md +3 -3
  206. package/dist/{use-hotkeys-D1_TEIwN.d.ts → use-hotkeys-BVm0IGb8.d.ts} +1 -5
  207. package/dist/use-hotkeys-YDJmGWX6.js.map +1 -1
  208. package/package.json +9 -9
  209. package/skills/uselets-ui/references/component-catalog.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 } 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;
@@ -49,13 +48,12 @@ declare function Drawer({ size, direction, dismissible, disablePointerDismissal,
49
48
  declare function DrawerTrigger({ asChild, children, ...props }: DrawerTriggerProps): React.JSX.Element;
50
49
  declare function DrawerPortal({ ...props }: DrawerPortalProps): React.JSX.Element;
51
50
  declare function DrawerClose({ asChild, children, ...props }: DrawerCloseProps): React.JSX.Element;
52
- declare function DrawerOverlay({ className, onClick, asChild, children, ...props }: DrawerOverlayProps): React.JSX.Element;
51
+ declare function DrawerOverlay({ className, onClick, forceRender, asChild, children, ...props }: DrawerOverlayProps): React.JSX.Element;
53
52
  declare function DrawerContent({ className, children, showCloseButton, overlayProps, keepMounted, asChild, ...props }: DrawerContentProps): React.JSX.Element;
54
53
  declare function DrawerHeader({ className, ...props }: DrawerHeaderProps): React.JSX.Element;
55
54
  declare function DrawerBody({ className, ...props }: DrawerBodyProps): React.JSX.Element;
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,2 +1,2 @@
1
- import"../rolldown-runtime-BhWHdk3m.js";import{toAsChildRenderProps as e}from"../lib/as-child.js";import{cn as t,stopPropagationHandler as n}from"../lib/utils.js";import{t as r}from"../resolve-class-name-BurP8ngI.js";import{Button as i}from"./button.js";import{IconX as a}from"@tabler/icons-react";import*as o from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{cva as l}from"class-variance-authority";import{Dialog as u}from"@base-ui/react/dialog";const d=l([`bg-background flex h-auto flex-col text-sm fixed z-50 outline-none duration-200`,`data-open:animate-in data-closed:animate-out`],{variants:{direction:{top:`inset-x-0 top-0 rounded-b-xl border-b data-closed:slide-out-to-top data-open:slide-in-from-top-10`,right:`inset-y-0 right-0 rounded-l-xl border-l data-closed:slide-out-to-right data-open:slide-in-from-right-10`,bottom:`inset-x-0 bottom-0 rounded-t-xl border-t data-closed:slide-out-to-bottom data-open:slide-in-from-bottom-10`,left:`inset-y-0 left-0 rounded-r-xl border-r data-closed:slide-out-to-left data-open:slide-in-from-left-10`},size:{sm:``,md:``,lg:``,xl:``,"2xl":``,"3xl":``,full:``}},compoundVariants:[{direction:[`left`,`right`],size:`sm`,className:`w-3/4 sm:max-w-sm`},{direction:[`left`,`right`],size:`md`,className:`w-4/5 sm:max-w-md`},{direction:[`left`,`right`],size:`lg`,className:`w-[90%] sm:max-w-lg`},{direction:[`left`,`right`],size:`xl`,className:`w-[90%] sm:max-w-195`},{direction:[`left`,`right`],size:`2xl`,className:`w-[90%] sm:max-w-240`},{direction:[`left`,`right`],size:`3xl`,className:`w-[90%] sm:max-w-300`},{direction:[`left`,`right`],size:`full`,className:`w-full`},{direction:`top`,size:`sm`,className:`mb-24 h-full max-h-96`},{direction:`top`,size:`md`,className:`mb-20 h-full max-h-112`},{direction:`top`,size:`lg`,className:`mb-12 h-full max-h-128`},{direction:`top`,size:`xl`,className:`mb-12 h-full max-h-195`},{direction:`top`,size:`2xl`,className:`mb-12 h-full max-h-240`},{direction:`top`,size:`3xl`,className:`mb-12 h-full max-h-300`},{direction:`top`,size:`full`,className:`mb-0 h-full`},{direction:`bottom`,size:`sm`,className:`mt-24 h-full max-h-96`},{direction:`bottom`,size:`md`,className:`mt-20 h-full max-h-112`},{direction:`bottom`,size:`lg`,className:`mt-12 h-full max-h-128`},{direction:`bottom`,size:`xl`,className:`mt-12 h-full max-h-195`},{direction:`bottom`,size:`2xl`,className:`mt-12 h-full max-h-240`},{direction:`bottom`,size:`3xl`,className:`mt-12 h-full max-h-300`},{direction:`bottom`,size:`full`,className:`mt-0 h-full`}],defaultVariants:{direction:`right`,size:`md`}}),f=o.createContext({size:`md`,direction:`right`});function Drawer({size:e=`md`,direction:t=`right`,dismissible:n=!0,disablePointerDismissal:r,onOpenChange:i,...a}){let c=o.useMemo(()=>({size:e,direction:t}),[e,t]);return/* @__PURE__ */ s(f.Provider,{value:c,children:/* @__PURE__ */ s(u.Root,{"data-slot":`drawer`,disablePointerDismissal:!n||r,onOpenChange:(e,t)=>{!n&&t.reason===`escape-key`?t.cancel():i?.(e,t)},...a})})}function DrawerTrigger({asChild:t,children:n,...r}){return/* @__PURE__ */ s(u.Trigger,{"data-slot":`drawer-trigger`,...r,...e(t,n)})}function DrawerPortal({...e}){return/* @__PURE__ */ s(u.Portal,{"data-slot":`drawer-portal`,...e})}function DrawerClose({asChild:t,children:n,...r}){return/* @__PURE__ */ s(u.Close,{"data-slot":`drawer-close`,...r,...e(t,n)})}function DrawerOverlay({className:i,onClick:a,asChild:o,children:c,...l}){return/* @__PURE__ */ s(u.Backdrop,{"data-slot":`drawer-overlay`,className:e=>t(`bg-black/10 fixed inset-0 z-50 duration-200`,`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0`,`supports-backdrop-filter:backdrop-blur-xs`,r(i,e)),onClick:n(a),...l,...e(o,c)})}function DrawerContent({className:l,children:p,showCloseButton:m=!0,overlayProps:h,keepMounted:g,asChild:_,...v}){let{size:y,direction:b}=o.useContext(f);return/* @__PURE__ */ c(DrawerPortal,{keepMounted:g,children:[/* @__PURE__ */ s(DrawerOverlay,{...h}),/* @__PURE__ */ c(u.Popup,{"data-slot":`drawer-content`,className:e=>t(d({size:y,direction:b}),r(l,e)),...v,...e(_,p),onClick:n(v.onClick),onSubmit:n(v.onSubmit),children:[!_&&p,m&&!_&&/* @__PURE__ */ c(u.Close,{"data-slot":`drawer-close`,render:/* @__PURE__ */ s(i,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[/* @__PURE__ */ s(a,{}),/* @__PURE__ */ s(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function DrawerHeader({className:e,...n}){let{direction:r}=o.useContext(f);return/* @__PURE__ */ s(`div`,{"data-slot":`drawer-header`,className:t(`p-4 flex flex-col gap-0.5 md:gap-0.5`,(r===`top`||r===`bottom`)&&`text-center md:text-left`,e),...n})}function DrawerBody({className:e,...n}){return/* @__PURE__ */ s(`div`,{"data-slot":`drawer-body`,className:t(`px-4 pb-4 flex-1 min-h-0 overflow-y-auto`,e),...n})}function DrawerFooter({className:e,...n}){return/* @__PURE__ */ s(`div`,{"data-slot":`drawer-footer`,className:t(`gap-2 p-4 mt-auto flex flex-col sm:flex-row sm:justify-end`,e),...n})}function DrawerTitle({className:n,asChild:i,children:a,...o}){return/* @__PURE__ */ s(u.Title,{"data-slot":`drawer-title`,className:e=>t(`text-foreground text-base font-medium`,r(n,e)),...o,...e(i,a)})}function DrawerDescription({className:n,asChild:i,children:a,...o}){return/* @__PURE__ */ s(u.Description,{"data-slot":`drawer-description`,className:e=>t(`text-muted-foreground text-sm`,r(n,e)),...o,...e(i,a)})}export{Drawer,DrawerBody,DrawerClose,DrawerContent,DrawerDescription,DrawerFooter,DrawerHeader,DrawerOverlay,DrawerPortal,DrawerTitle,DrawerTrigger};
1
+ import"../rolldown-runtime-BhWHdk3m.js";import{toAsChildRenderProps as e}from"../lib/as-child.js";import{cn as t,stopPropagationHandler as n}from"../lib/utils.js";import{t as r}from"../resolve-class-name-BurP8ngI.js";import{Button as i}from"./button.js";import{IconX as a}from"@tabler/icons-react";import*as o from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{cva as l}from"class-variance-authority";import{Dialog as u}from"@base-ui/react/dialog";const d=l([`bg-background flex h-auto flex-col text-sm fixed z-50 outline-none duration-200`,`data-open:animate-in data-closed:animate-out`],{variants:{direction:{top:`inset-x-0 top-0 rounded-b-xl border-b data-closed:slide-out-to-top data-open:slide-in-from-top-10`,right:`inset-y-0 right-0 rounded-l-xl border-l data-closed:slide-out-to-right data-open:slide-in-from-right-10`,bottom:`inset-x-0 bottom-0 rounded-t-xl border-t data-closed:slide-out-to-bottom data-open:slide-in-from-bottom-10`,left:`inset-y-0 left-0 rounded-r-xl border-r data-closed:slide-out-to-left data-open:slide-in-from-left-10`},size:{sm:``,md:``,lg:``,xl:``,"2xl":``,"3xl":``,full:``}},compoundVariants:[{direction:[`left`,`right`],size:`sm`,className:`w-3/4 sm:max-w-sm`},{direction:[`left`,`right`],size:`md`,className:`w-4/5 sm:max-w-md`},{direction:[`left`,`right`],size:`lg`,className:`w-[90%] sm:max-w-lg`},{direction:[`left`,`right`],size:`xl`,className:`w-[90%] sm:max-w-195`},{direction:[`left`,`right`],size:`2xl`,className:`w-[90%] sm:max-w-240`},{direction:[`left`,`right`],size:`3xl`,className:`w-[90%] sm:max-w-300`},{direction:[`left`,`right`],size:`full`,className:`w-full`},{direction:`top`,size:`sm`,className:`mb-24 h-full max-h-96`},{direction:`top`,size:`md`,className:`mb-20 h-full max-h-112`},{direction:`top`,size:`lg`,className:`mb-12 h-full max-h-128`},{direction:`top`,size:`xl`,className:`mb-12 h-full max-h-195`},{direction:`top`,size:`2xl`,className:`mb-12 h-full max-h-240`},{direction:`top`,size:`3xl`,className:`mb-12 h-full max-h-300`},{direction:`top`,size:`full`,className:`mb-0 h-full`},{direction:`bottom`,size:`sm`,className:`mt-24 h-full max-h-96`},{direction:`bottom`,size:`md`,className:`mt-20 h-full max-h-112`},{direction:`bottom`,size:`lg`,className:`mt-12 h-full max-h-128`},{direction:`bottom`,size:`xl`,className:`mt-12 h-full max-h-195`},{direction:`bottom`,size:`2xl`,className:`mt-12 h-full max-h-240`},{direction:`bottom`,size:`3xl`,className:`mt-12 h-full max-h-300`},{direction:`bottom`,size:`full`,className:`mt-0 h-full`}],defaultVariants:{direction:`right`,size:`md`}}),f=o.createContext({size:`md`,direction:`right`});function Drawer({size:e=`md`,direction:t=`right`,dismissible:n=!0,disablePointerDismissal:r,onOpenChange:i,...a}){let c=o.useMemo(()=>({size:e,direction:t}),[e,t]);return/* @__PURE__ */ s(f.Provider,{value:c,children:/* @__PURE__ */ s(u.Root,{"data-slot":`drawer`,disablePointerDismissal:!n||r,onOpenChange:(e,t)=>{!n&&t.reason===`escape-key`?t.cancel():i?.(e,t)},...a})})}function DrawerTrigger({asChild:t,children:n,...r}){return/* @__PURE__ */ s(u.Trigger,{"data-slot":`drawer-trigger`,...r,...e(t,n)})}function DrawerPortal({...e}){return/* @__PURE__ */ s(u.Portal,{"data-slot":`drawer-portal`,...e})}function DrawerClose({asChild:t,children:n,...r}){return/* @__PURE__ */ s(u.Close,{"data-slot":`drawer-close`,...r,...e(t,n)})}function DrawerOverlay({className:i,onClick:a,forceRender:o=!0,asChild:c,children:l,...d}){return/* @__PURE__ */ s(u.Backdrop,{"data-slot":`drawer-overlay`,forceRender:o,className:e=>t(`bg-black/10 fixed inset-0 z-50 duration-200`,`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0`,`supports-backdrop-filter:backdrop-blur-xs`,r(i,e)),onClick:n(a),...d,...e(c,l)})}function DrawerContent({className:l,children:p,showCloseButton:m=!0,overlayProps:h,keepMounted:g,asChild:_,...v}){let{size:y,direction:b}=o.useContext(f);return/* @__PURE__ */ c(DrawerPortal,{keepMounted:g,children:[/* @__PURE__ */ s(DrawerOverlay,{...h}),/* @__PURE__ */ c(u.Popup,{"data-slot":`drawer-content`,className:e=>t(d({size:y,direction:b}),r(l,e)),...v,...e(_,p),onClick:n(v.onClick),onSubmit:n(v.onSubmit),children:[!_&&p,m&&!_&&/* @__PURE__ */ c(u.Close,{"data-slot":`drawer-close`,render:/* @__PURE__ */ s(i,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[/* @__PURE__ */ s(a,{}),/* @__PURE__ */ s(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function DrawerHeader({className:e,...n}){let{direction:r}=o.useContext(f);return/* @__PURE__ */ s(`div`,{"data-slot":`drawer-header`,className:t(`p-4 flex flex-col gap-0.5 md:gap-0.5`,(r===`top`||r===`bottom`)&&`text-center md:text-left`,e),...n})}function DrawerBody({className:e,...n}){return/* @__PURE__ */ s(`div`,{"data-slot":`drawer-body`,className:t(`px-4 pb-4 flex-1 min-h-0 overflow-y-auto`,e),...n})}function DrawerFooter({className:e,...n}){return/* @__PURE__ */ s(`div`,{"data-slot":`drawer-footer`,className:t(`gap-2 p-4 mt-auto flex flex-col sm:flex-row sm:justify-end`,e),...n})}function DrawerTitle({className:n,asChild:i,children:a,...o}){return/* @__PURE__ */ s(u.Title,{"data-slot":`drawer-title`,className:e=>t(`text-foreground text-base font-medium`,r(n,e)),...o,...e(i,a)})}function DrawerDescription({className:n,asChild:i,children:a,...o}){return/* @__PURE__ */ s(u.Description,{"data-slot":`drawer-description`,className:e=>t(`text-muted-foreground text-sm`,r(n,e)),...o,...e(i,a)})}export{Drawer,DrawerBody,DrawerClose,DrawerContent,DrawerDescription,DrawerFooter,DrawerHeader,DrawerOverlay,DrawerPortal,DrawerTitle,DrawerTrigger};
2
2
  //# sourceMappingURL=drawer.js.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, asChild, children, ...props }: DrawerOverlayProps) {\n return (\n <DrawerPrimitive.Backdrop\n data-slot=\"drawer-overlay\"\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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AyClB,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"}
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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AEL,CAEA,SAAS,WAAW,CAAE,YAAW,GAAGA,GAA0B,CAC5D,MACE,kBAAC,MAAD,CAAK,YAAU,cAAc,UAAWa,EAAG,2CAA4CC,CAAS,EAAG,GAAId,CAAQ,CAAA,CAEnH,CAEA,SAAS,aAAa,CAAE,YAAW,GAAGA,GAA4B,CAChE,MACE,kBAAC,MAAD,CACE,YAAU,gBACV,UAAWa,EAAG,6DAA8DC,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,CAC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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 DropdownMenuSubTrigger,\n DropdownMenuTrigger\n}\n"],"mappings":"A,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,EAAiBS,EAAWC,CAAK,CACnC,EAEF,GAAIP,EACJ,GAAIE,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAC+B,CAAA,CAChB,CAA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,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,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 +1 @@
1
- {"version":3,"file":"dropzone.js","names":["useReactDropzone","React","useDropzone$1","dropzoneErrorCodes","ErrorCode","dropzoneErrorCodeSet","valueTextMap","DropzoneContext","DropzoneFileListContext","action","state","fileStatus","accept","acceptedTypes","mimeType","extensions","errorCodes","fileRejections","rejection","error","errorCode","errors","limits","firstError","restErrors","shapeUploadError","message","context","handleDropFile","handleRemoveFile","props","inputId","rootMessageId","rootDescriptionId","rootError","setRootErrorState","setRootError","onRootError","fileStatuses","dispatch","getFileMessageId","id","isInvalid","uploadFile","result","file","autoRetry","retryCount","maxRetryCount","onFileUploadError","onFileUploaded","uploadError","onRemoveFile","canRetry","item","onRetry","dropzone","validation","nextFiles","acceptedFiles","maxFiles","overflow","shiftOnMaxFiles","filesToRemove","remainingOverflow","availableSlots","onAllUploaded","DropzoneArea","describedBy","rootRef","rootProps","cn","className","inputProps","composeRefs","forwardedRef","children","DropzoneDescription","DropzoneFileList","DropzoneFileListItem","messageId","value","DropzoneFileMessage","body","DropzoneMessage","DropzoneRemoveFile","handleClick","onClick","event","Button","DropzoneRetryFile","isDisabled","disabled","DropzoneTrigger","InfiniteProgress","done","status","isError"],"sources":["../../src/components/dropzone.tsx"],"sourcesContent":["import * as React from 'react'\nimport {\n type Accept,\n ErrorCode,\n type FileError,\n type FileRejection,\n useDropzone as useReactDropzone\n} from 'react-dropzone'\n\nimport { composeRefs } from '../lib/compose-refs'\nimport { cn } from '../lib/utils'\nimport { Button, type ButtonProps } from './button'\n\nconst dropzoneErrorCodes = [\n ErrorCode.FileInvalidType,\n ErrorCode.FileTooLarge,\n ErrorCode.FileTooSmall,\n ErrorCode.TooManyFiles\n]\n\ntype DropzoneAction<TUploadResult, TUploadError> =\n | {\n type: 'add'\n id: string\n fileName: string\n file: File\n }\n | {\n type: 'remove'\n id: string\n }\n | {\n type: 'update-status'\n id: string\n status: 'pending'\n }\n | {\n type: 'update-status'\n id: string\n status: 'error'\n error: TUploadError\n message?: string\n }\n | {\n type: 'update-status'\n id: string\n status: 'success'\n result: TUploadResult\n }\n\nexport type DropzoneUploadResult<TUploadResult, TUploadError> =\n | {\n status: 'error'\n error: TUploadError\n }\n | {\n status: 'success'\n result: TUploadResult\n }\n\nexport type DropzoneFileStatus<TUploadResult, TUploadError> = {\n id: string\n fileName: string\n file: File\n tries: number\n} & (\n | {\n status: 'pending'\n error?: undefined\n message?: undefined\n result?: undefined\n }\n | {\n status: 'error'\n error: TUploadError\n message?: string\n result?: undefined\n }\n | {\n status: 'success'\n result: TUploadResult\n error?: undefined\n message?: undefined\n }\n)\n\nexport type FileStatus<TUploadResult, TUploadError> = DropzoneFileStatus<TUploadResult, TUploadError>\n\nexport type DropzoneValidation = {\n accept?: Accept\n minSize?: number\n maxSize?: number\n maxFiles?: number\n}\n\nexport type UseDropzoneProps<TUploadResult, TUploadError = string> = {\n /** Uploads one file. Resolve to `{ status: 'success', result }` or `{ status: 'error', error }`. */\n onDropFile: (file: File) => Promise<DropzoneUploadResult<TUploadResult, TUploadError>>\n /** Called when a file is removed, with its id. */\n onRemoveFile?: (id: string) => void | Promise<void>\n /** Called with the result of each successful upload. */\n onFileUploaded?: (result: TUploadResult) => void\n /** Called with the error of each failed upload. */\n onFileUploadError?: (error: TUploadError) => void\n /** Called when every pending upload has finished. */\n onAllUploaded?: () => void\n /** Called with the validation message when dropped files are rejected, or `undefined` when cleared. */\n onRootError?: (error: string | undefined) => void\n /** Turns an upload error into the message shown for the file. */\n shapeUploadError?: (error: TUploadError) => string | undefined\n /** Maximum number of retries per file. Unlimited when omitted. */\n maxRetryCount?: number\n /**\n * Retries failed uploads automatically, up to `maxRetryCount`.\n * @default false\n */\n autoRetry?: boolean\n /** File rules: `accept`, `minSize`, `maxSize` (bytes) and `maxFiles`. */\n validation?: DropzoneValidation\n /**\n * Removes the oldest files when new ones exceed `maxFiles`, instead of rejecting them.\n * @default false\n */\n shiftOnMaxFiles?: boolean\n}\n\nexport interface UseDropzoneReturn<TUploadResult, TUploadError> {\n getRootProps: ReturnType<typeof useReactDropzone>['getRootProps']\n getInputProps: ReturnType<typeof useReactDropzone>['getInputProps']\n open: () => void\n onRemoveFile: (id: string) => Promise<void>\n onRetry: (id: string) => Promise<void>\n canRetry: (id: string) => boolean\n fileStatuses: DropzoneFileStatus<TUploadResult, TUploadError>[]\n isInvalid: boolean\n isDragActive: boolean\n rootError: string | undefined\n inputId: string\n rootMessageId: string\n rootDescriptionId: string\n getFileMessageId: (id: string) => string\n}\n\nexport type DropzoneProps<TUploadResult, TUploadError> = React.PropsWithChildren<\n UseDropzoneReturn<TUploadResult, TUploadError>\n>\n\nexport type DropzoneAreaProps = React.ComponentProps<'div'>\n\nexport type DropzoneDescriptionProps = React.ComponentProps<'p'>\n\nexport type DropzoneFileListProps = React.ComponentProps<'ol'>\n\nexport type DropzoneFileListItemProps<TUploadResult, TUploadError> = React.ComponentProps<'li'> & {\n /** File status from `fileStatuses`, used by the parts inside the item. */\n file: DropzoneFileStatus<TUploadResult, TUploadError>\n}\n\nexport type DropzoneFileMessageProps = React.ComponentProps<'p'>\n\nexport type DropzoneMessageProps = React.ComponentProps<'p'>\n\nexport type DropzoneRemoveFileProps = ButtonProps\n\nexport type DropzoneRetryFileProps = ButtonProps\n\nexport type DropzoneTriggerProps = ButtonProps\n\nexport type InfiniteProgressProps = React.ComponentProps<'div'> & {\n /** Upload status shown by the bar. */\n status: 'pending' | 'success' | 'error'\n}\n\ntype DropzoneFileListContextValue<TUploadResult, TUploadError> = {\n onRemoveFile: () => Promise<void>\n onRetry: () => Promise<void>\n fileStatus: DropzoneFileStatus<TUploadResult, TUploadError>\n canRetry: boolean\n dropzoneId: string\n messageId: string\n}\n\nconst dropzoneErrorCodeSet = new Set<ErrorCode>(dropzoneErrorCodes)\n\nconst valueTextMap = {\n pending: 'indeterminate',\n success: '100%',\n error: 'error'\n} as const\n\nconst DropzoneContext = React.createContext<UseDropzoneReturn<unknown, unknown> | null>(null)\n\nconst DropzoneFileListContext = React.createContext<DropzoneFileListContextValue<unknown, unknown> | null>(null)\n\nfunction fileStatusReducer<TUploadResult, TUploadError>(\n state: DropzoneFileStatus<TUploadResult, TUploadError>[],\n action: DropzoneAction<TUploadResult, TUploadError>\n): DropzoneFileStatus<TUploadResult, TUploadError>[] {\n switch (action.type) {\n case 'add':\n return [\n ...state,\n {\n id: action.id,\n fileName: action.fileName,\n file: action.file,\n status: 'pending',\n tries: 1\n }\n ]\n case 'remove':\n return state.filter((fileStatus) => fileStatus.id !== action.id)\n case 'update-status':\n return state.map((fileStatus) => {\n if (fileStatus.id !== action.id) {\n return fileStatus\n }\n\n if (action.status === 'pending') {\n return {\n ...fileStatus,\n status: 'pending',\n error: undefined,\n message: undefined,\n result: undefined,\n tries: fileStatus.tries + 1\n }\n }\n\n if (action.status === 'error') {\n return {\n ...fileStatus,\n status: 'error',\n error: action.error,\n message: action.message,\n result: undefined\n }\n }\n\n return {\n ...fileStatus,\n status: 'success',\n result: action.result,\n error: undefined,\n message: undefined\n }\n })\n }\n}\n\nfunction formatAcceptedTypes(accept?: Accept) {\n if (!accept) {\n return undefined\n }\n\n const acceptedTypes = Object.entries(accept).flatMap(([mimeType, extensions]) => {\n return extensions.length > 0 ? extensions : [mimeType]\n })\n\n return acceptedTypes.length > 0 ? acceptedTypes.join(', ') : undefined\n}\n\nfunction getDropzoneErrorCodes(fileRejections: FileRejection[]) {\n const errorCodes = fileRejections.flatMap((rejection) =>\n rejection.errors.map((error) => error.code as ErrorCode).filter((errorCode) => dropzoneErrorCodeSet.has(errorCode))\n )\n\n return Array.from(new Set(errorCodes))\n}\n\nfunction getRootError(errorCodes: ErrorCode[], limits: DropzoneValidation) {\n const errors = errorCodes.flatMap((errorCode) => {\n switch (errorCode) {\n case 'file-invalid-type': {\n const acceptedTypes = formatAcceptedTypes(limits.accept)\n return acceptedTypes ? [`only ${acceptedTypes} files are allowed`] : ['this file type is not allowed']\n }\n case 'file-too-large': {\n if (!limits.maxSize) {\n return ['this file is too large']\n }\n\n return [`max size is ${(limits.maxSize / (1024 * 1024)).toFixed(2)} MB`]\n }\n case 'file-too-small': {\n if (!limits.minSize) {\n return ['this file is too small']\n }\n\n return [`min size is ${(limits.minSize / (1024 * 1024)).toFixed(2)} MB`]\n }\n case 'too-many-files':\n return limits.maxFiles ? [`max ${limits.maxFiles} files`] : ['too many files']\n default:\n return []\n }\n })\n\n if (errors.length === 0) {\n return 'Unable to add the selected files'\n }\n\n const [firstError, ...restErrors] = errors as [string, ...string[]]\n return `${firstError.charAt(0).toUpperCase()}${firstError.slice(1)}${restErrors.length > 0 ? `, ${restErrors.join(', ')}` : ''}`\n}\n\nfunction getRejectionMessage(fileRejections: FileRejection[], limits: DropzoneValidation) {\n const errorCodes = getDropzoneErrorCodes(fileRejections)\n\n if (errorCodes.length > 0) {\n return getRootError(errorCodes, limits)\n }\n\n return fileRejections[0]?.errors[0]?.message ?? 'Unable to add the selected files'\n}\n\nfunction getUploadErrorMessage<TUploadError>(\n error: TUploadError,\n shapeUploadError?: (error: TUploadError) => string | undefined\n) {\n if (shapeUploadError) {\n const message = shapeUploadError(error)\n if (message !== undefined) {\n return message\n }\n }\n\n if (typeof error === 'string') {\n return error\n }\n\n if (error instanceof Error) {\n return error.message\n }\n\n return undefined\n}\n\nfunction useDropzoneContext<TUploadResult, TUploadError>() {\n const context = React.useContext(DropzoneContext)\n\n if (!context) {\n throw new Error('Dropzone components must be used within a Dropzone.')\n }\n\n return context as UseDropzoneReturn<TUploadResult, TUploadError>\n}\n\nfunction useDropzoneFileListContext<TUploadResult, TUploadError>() {\n const context = React.useContext(DropzoneFileListContext)\n\n if (!context) {\n throw new Error('Dropzone file actions must be used within a DropzoneFileListItem.')\n }\n\n return context as DropzoneFileListContextValue<TUploadResult, TUploadError>\n}\n\nfunction useDropzone<TUploadResult, TUploadError = string>(\n props: UseDropzoneProps<TUploadResult, TUploadError>\n): UseDropzoneReturn<TUploadResult, TUploadError> {\n const {\n onDropFile: handleDropFile,\n onRemoveFile: handleRemoveFile,\n shapeUploadError,\n onFileUploaded,\n onFileUploadError,\n onAllUploaded,\n onRootError,\n maxRetryCount,\n autoRetry = false,\n validation,\n shiftOnMaxFiles = false\n } = props\n\n const inputId = React.useId()\n const rootMessageId = `${inputId}-message`\n const rootDescriptionId = `${inputId}-description`\n const [rootError, setRootErrorState] = React.useState<string | undefined>(undefined)\n\n const setRootError = React.useCallback(\n (error: string | undefined) => {\n setRootErrorState(error)\n onRootError?.(error)\n },\n [onRootError]\n )\n\n const [fileStatuses, dispatch] = React.useReducer(\n fileStatusReducer<TUploadResult, TUploadError>,\n [] as DropzoneFileStatus<TUploadResult, TUploadError>[]\n )\n\n const getFileMessageId = React.useCallback((id: string) => `${inputId}-${id}-message`, [inputId])\n\n const isInvalid = React.useMemo(() => {\n return rootError !== undefined || fileStatuses.some((fileStatus) => fileStatus.status === 'error')\n }, [fileStatuses, rootError])\n\n const uploadFile = React.useCallback(\n async (file: File, id: string, retryCount = 0) => {\n try {\n const result = await handleDropFile(file)\n\n if (result.status === 'error') {\n if (autoRetry && retryCount < (maxRetryCount ?? Number.POSITIVE_INFINITY)) {\n dispatch({ type: 'update-status', id, status: 'pending' })\n return uploadFile(file, id, retryCount + 1)\n }\n\n dispatch({\n type: 'update-status',\n id,\n status: 'error',\n error: result.error,\n message: getUploadErrorMessage(result.error, shapeUploadError)\n })\n onFileUploadError?.(result.error)\n return\n }\n\n dispatch({\n type: 'update-status',\n id,\n status: 'success',\n result: result.result\n })\n onFileUploaded?.(result.result)\n } catch (error) {\n const uploadError = error as TUploadError\n\n dispatch({\n type: 'update-status',\n id,\n status: 'error',\n error: uploadError,\n message: getUploadErrorMessage(uploadError, shapeUploadError)\n })\n onFileUploadError?.(uploadError)\n }\n },\n [autoRetry, handleDropFile, maxRetryCount, onFileUploadError, onFileUploaded, shapeUploadError]\n )\n\n const onRemoveFile = React.useCallback(\n async (id: string) => {\n await handleRemoveFile?.(id)\n dispatch({ type: 'remove', id })\n },\n [handleRemoveFile]\n )\n\n const canRetry = React.useCallback(\n (id: string) => {\n const fileStatus = fileStatuses.find((item) => item.id === id)\n\n return fileStatus?.status === 'error' && fileStatus.tries <= (maxRetryCount ?? Number.POSITIVE_INFINITY)\n },\n [fileStatuses, maxRetryCount]\n )\n\n const onRetry = React.useCallback(\n async (id: string) => {\n if (!canRetry(id)) {\n return\n }\n\n const fileStatus = fileStatuses.find((item) => item.id === id)\n\n if (fileStatus?.status !== 'error') {\n return\n }\n\n dispatch({ type: 'update-status', id, status: 'pending' })\n await uploadFile(fileStatus.file, id)\n },\n [canRetry, fileStatuses, uploadFile]\n )\n\n const dropzone = useReactDropzone({\n accept: validation?.accept,\n minSize: validation?.minSize,\n maxSize: validation?.maxSize,\n maxFiles: validation?.maxFiles,\n noClick: true,\n noKeyboard: true,\n onDropAccepted: async (acceptedFiles) => {\n setRootError(undefined)\n\n let nextFiles = acceptedFiles\n const maxFiles = validation?.maxFiles ?? Number.POSITIVE_INFINITY\n const overflow = Number.isFinite(maxFiles)\n ? Math.max(fileStatuses.length + acceptedFiles.length - maxFiles, 0)\n : 0\n\n if (overflow > 0) {\n if (shiftOnMaxFiles) {\n const filesToRemove = fileStatuses.slice(0, Math.min(overflow, fileStatuses.length))\n\n await Promise.all(filesToRemove.map((fileStatus) => onRemoveFile(fileStatus.id)))\n\n const remainingOverflow = overflow - filesToRemove.length\n if (remainingOverflow > 0) {\n nextFiles = acceptedFiles.slice(remainingOverflow)\n }\n } else {\n setRootError(getRootError([ErrorCode.TooManyFiles], validation ?? {}))\n const availableSlots = Math.max(maxFiles - fileStatuses.length, 0)\n nextFiles = acceptedFiles.slice(0, availableSlots)\n }\n }\n\n if (nextFiles.length === 0) {\n return\n }\n\n await Promise.all(\n nextFiles.map(async (file) => {\n const id = crypto.randomUUID()\n dispatch({ type: 'add', id, fileName: file.name, file })\n await uploadFile(file, id)\n })\n )\n\n onAllUploaded?.()\n },\n onDropRejected: (fileRejections) => {\n setRootError(getRejectionMessage(fileRejections, validation ?? {}))\n }\n })\n\n return {\n getRootProps: dropzone.getRootProps,\n getInputProps: dropzone.getInputProps,\n open: dropzone.open,\n onRemoveFile,\n onRetry,\n canRetry,\n fileStatuses,\n isInvalid,\n isDragActive: dropzone.isDragActive,\n rootError,\n inputId,\n rootMessageId,\n rootDescriptionId,\n getFileMessageId\n }\n}\n\nfunction Dropzone<TUploadResult, TUploadError>({ children, ...dropzone }: DropzoneProps<TUploadResult, TUploadError>) {\n return <DropzoneContext.Provider value={dropzone}>{children}</DropzoneContext.Provider>\n}\n\nconst DropzoneArea = React.forwardRef<HTMLDivElement, DropzoneAreaProps>(\n ({ className, children, ...props }, forwardedRef) => {\n const context = useDropzoneContext()\n const describedBy =\n [context.rootDescriptionId, context.isInvalid ? context.rootMessageId : undefined].filter(Boolean).join(' ') ||\n undefined\n\n const { ref: rootRef, ...rootProps } = context.getRootProps({\n ...props,\n 'data-slot': 'dropzone-area',\n 'aria-describedby': describedBy,\n 'aria-invalid': context.isInvalid || undefined,\n className: cn(\n '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',\n context.isDragActive && 'border-primary bg-primary/5',\n context.isInvalid && 'border-destructive bg-destructive/5',\n className\n )\n }) as React.HTMLAttributes<HTMLDivElement> & {\n ref?: React.Ref<HTMLDivElement>\n }\n\n const inputProps = context.getInputProps({\n id: context.inputId,\n className: 'sr-only',\n 'aria-describedby': describedBy,\n 'aria-invalid': context.isInvalid,\n tabIndex: -1\n })\n\n return (\n <div {...rootProps} ref={composeRefs(forwardedRef, rootRef)}>\n <input {...inputProps} />\n {children}\n </div>\n )\n }\n)\n\nconst DropzoneDescription = React.forwardRef<HTMLParagraphElement, DropzoneDescriptionProps>(\n ({ className, ...props }, ref) => {\n const context = useDropzoneContext()\n\n return (\n <p\n ref={ref}\n id={context.rootDescriptionId}\n data-slot=\"dropzone-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneFileList = React.forwardRef<HTMLOListElement, DropzoneFileListProps>(({ className, ...props }, ref) => {\n useDropzoneContext()\n\n return <ol ref={ref} data-slot=\"dropzone-file-list\" className={cn('space-y-3', className)} {...props} />\n})\n\nconst DropzoneFileListItem = React.forwardRef<HTMLLIElement, DropzoneFileListItemProps<unknown, unknown>>(\n ({ className, file, children, ...props }, ref) => {\n const context = useDropzoneContext()\n const messageId = context.getFileMessageId(file.id)\n const isInvalid = file.status === 'error'\n const canRetry = context.canRetry(file.id)\n\n const value = React.useMemo<DropzoneFileListContextValue<unknown, unknown>>(\n () => ({\n onRemoveFile: () => context.onRemoveFile(file.id),\n onRetry: () => context.onRetry(file.id),\n fileStatus: file,\n canRetry,\n dropzoneId: context.inputId,\n messageId\n }),\n [canRetry, context, file, messageId]\n )\n\n return (\n <DropzoneFileListContext.Provider value={value}>\n <li\n ref={ref}\n data-slot=\"dropzone-file-item\"\n data-status={file.status}\n aria-describedby={isInvalid ? messageId : undefined}\n className={cn(\n 'rounded-xl border bg-card px-4 py-3 shadow-xs',\n file.status === 'error' && 'border-destructive/50',\n className\n )}\n {...props}\n >\n {children}\n </li>\n </DropzoneFileListContext.Provider>\n )\n }\n)\n\nconst DropzoneFileMessage = React.forwardRef<HTMLParagraphElement, DropzoneFileMessageProps>(\n ({ className, children, ...props }, ref) => {\n const context = useDropzoneFileListContext()\n const body =\n context.fileStatus.status === 'error'\n ? (context.fileStatus.message ?? String(context.fileStatus.error))\n : children\n\n return (\n <p\n ref={ref}\n id={context.messageId}\n data-slot=\"dropzone-file-message\"\n className={cn(\n 'min-h-5 text-[0.8rem] font-medium',\n context.fileStatus.status === 'error' && 'text-destructive',\n className\n )}\n {...props}\n >\n {body}\n </p>\n )\n }\n)\n\nconst DropzoneMessage = React.forwardRef<HTMLParagraphElement, DropzoneMessageProps>(\n ({ className, children, ...props }, ref) => {\n const context = useDropzoneContext()\n const body = context.rootError ?? children\n\n return (\n <p\n ref={ref}\n id={context.rootMessageId}\n data-slot=\"dropzone-message\"\n className={cn('min-h-5 text-[0.8rem] font-medium text-destructive', className)}\n {...props}\n >\n {body}\n </p>\n )\n }\n)\n\nconst DropzoneRemoveFile = React.forwardRef<HTMLButtonElement, DropzoneRemoveFileProps>(\n ({ className, onClick, size = 'icon-sm', type = 'button', variant = 'ghost', ...props }, ref) => {\n const context = useDropzoneFileListContext()\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n void context.onRemoveFile()\n },\n [context, onClick]\n )\n\n return (\n <Button\n ref={ref}\n data-slot=\"dropzone-remove-file\"\n className={cn(className)}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneRetryFile = React.forwardRef<HTMLButtonElement, DropzoneRetryFileProps>(\n ({ className, disabled, onClick, size = 'icon-sm', type = 'button', variant = 'ghost', ...props }, ref) => {\n const context = useDropzoneFileListContext()\n const isDisabled = disabled || !context.canRetry\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented || isDisabled) {\n return\n }\n\n void context.onRetry()\n },\n [context, isDisabled, onClick]\n )\n\n return (\n <Button\n ref={ref}\n data-slot=\"dropzone-retry-file\"\n className={cn(className)}\n disabled={isDisabled}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneTrigger = React.forwardRef<HTMLButtonElement, DropzoneTriggerProps>(\n ({ className, onClick, size = 'sm', type = 'button', variant = 'subtle', ...props }, ref) => {\n const context = useDropzoneContext()\n const describedBy =\n [context.rootDescriptionId, context.isInvalid ? context.rootMessageId : undefined].filter(Boolean).join(' ') ||\n undefined\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n context.open()\n },\n [context, onClick]\n )\n\n return (\n <Button\n ref={ref}\n aria-controls={context.inputId}\n aria-describedby={describedBy}\n aria-invalid={context.isInvalid || undefined}\n data-slot=\"dropzone-trigger\"\n className={cn(className)}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst InfiniteProgress = React.forwardRef<HTMLDivElement, InfiniteProgressProps>(\n ({ className, status, ...props }, ref) => {\n const done = status === 'success' || status === 'error'\n const isError = status === 'error'\n\n return (\n <div\n ref={ref}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuetext={valueTextMap[status]}\n data-slot=\"dropzone-progress\"\n data-status={status}\n role=\"progressbar\"\n className={cn('relative h-2 w-full overflow-hidden rounded-full bg-muted', className)}\n {...props}\n >\n <div\n className={cn(\n 'h-full w-full rounded-full bg-primary transition-transform',\n done ? 'translate-x-0' : 'animate-infinite-progress',\n isError && 'bg-destructive'\n )}\n />\n </div>\n )\n }\n)\n\nDropzone.displayName = 'Dropzone'\nDropzoneArea.displayName = 'DropzoneArea'\nDropzoneDescription.displayName = 'DropzoneDescription'\nDropzoneFileList.displayName = 'DropzoneFileList'\nDropzoneFileListItem.displayName = 'DropzoneFileListItem'\nDropzoneFileMessage.displayName = 'DropzoneFileMessage'\nDropzoneMessage.displayName = 'DropzoneMessage'\nDropzoneRemoveFile.displayName = 'DropzoneRemoveFile'\nDropzoneRetryFile.displayName = 'DropzoneRetryFile'\nDropzoneTrigger.displayName = 'DropzoneTrigger'\nInfiniteProgress.displayName = 'InfiniteProgress'\n\nexport {\n Dropzone,\n DropzoneArea,\n DropzoneDescription,\n DropzoneFileList,\n DropzoneFileListItem,\n DropzoneFileMessage,\n DropzoneMessage,\n DropzoneRemoveFile,\n DropzoneRetryFile,\n DropzoneTrigger,\n ErrorCode,\n type FileError,\n InfiniteProgress,\n useDropzone\n}\n"],"mappings":"6SAaA,MAAMG,EAAqB,CACzBC,EAAU,gBACVA,EAAU,aACVA,EAAU,aACVA,EAAU,YACZ,EAoKMC,EAAuB,IAAI,IAAeF,CAAkB,EAE5DG,EAAe,CACnB,QAAS,gBACT,QAAS,OACT,MAAO,OACT,EAEMC,EAAkBN,EAAM,cAA0D,IAAI,EAEtFO,EAA0BP,EAAM,cAAqE,IAAI,EAE/G,SAAS,kBACP,EACA,EACmD,CACnD,OAAQQ,EAAO,KAAf,CACE,IAAK,MACH,MAAO,CACL,GAAGC,EACH,CACE,GAAID,EAAO,GACX,SAAUA,EAAO,SACjB,KAAMA,EAAO,KACb,OAAQ,UACR,MAAO,CACT,CACF,EACF,IAAK,SACH,OAAOC,EAAM,OAAQ,GAAeC,EAAW,KAAOF,EAAO,EAAE,EACjE,IAAK,gBACH,OAAOC,EAAM,IAAK,GACZC,EAAW,KAAOF,EAAO,GAIzBA,EAAO,SAAW,UACb,CACL,GAAGE,EACH,OAAQ,UACR,MAAO,IAAA,GACP,QAAS,IAAA,GACT,OAAQ,IAAA,GACR,MAAOA,EAAW,MAAQ,CAC5B,EAGEF,EAAO,SAAW,QACb,CACL,GAAGE,EACH,OAAQ,QACR,MAAOF,E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C,MAAD,CACE,UAAWyC,EACT,6DACAwB,EAAO,gBAAkB,4BACzBE,GAAW,gBACb,CACD,CAAA,CACE,CAAA,CAET,CACF,EAEA,SAAS,YAAc,WACvB,EAAa,YAAc,eAC3B,EAAoB,YAAc,sBAClC,EAAiB,YAAc,mBAC/B,EAAqB,YAAc,uBACnC,EAAoB,YAAc,sBAClC,EAAgB,YAAc,kBAC9B,EAAmB,YAAc,qBACjC,EAAkB,YAAc,oBAChC,EAAgB,YAAc,kBAC9B,EAAiB,YAAc"}
1
+ {"version":3,"file":"dropzone.js","names":["useReactDropzone","React","useDropzone$1","dropzoneErrorCodes","ErrorCode","dropzoneErrorCodeSet","valueTextMap","DropzoneContext","DropzoneFileListContext","action","state","fileStatus","accept","acceptedTypes","mimeType","extensions","errorCodes","fileRejections","rejection","error","errorCode","errors","limits","firstError","restErrors","shapeUploadError","message","context","handleDropFile","handleRemoveFile","props","inputId","rootMessageId","rootDescriptionId","rootError","setRootErrorState","setRootError","onRootError","fileStatuses","dispatch","getFileMessageId","id","isInvalid","uploadFile","result","file","autoRetry","retryCount","maxRetryCount","onFileUploadError","onFileUploaded","uploadError","onRemoveFile","canRetry","item","onRetry","dropzone","validation","nextFiles","acceptedFiles","maxFiles","overflow","shiftOnMaxFiles","filesToRemove","remainingOverflow","availableSlots","onAllUploaded","DropzoneArea","describedBy","rootRef","rootProps","cn","className","inputProps","composeRefs","forwardedRef","children","DropzoneDescription","DropzoneFileList","DropzoneFileListItem","messageId","value","DropzoneFileMessage","body","DropzoneMessage","DropzoneRemoveFile","handleClick","onClick","event","Button","DropzoneRetryFile","isDisabled","disabled","DropzoneTrigger","InfiniteProgress","done","status","isError"],"sources":["../../src/components/dropzone.tsx"],"sourcesContent":["import * as React from 'react'\nimport {\n type Accept,\n ErrorCode,\n type FileError,\n type FileRejection,\n useDropzone as useReactDropzone\n} from 'react-dropzone'\n\nimport { composeRefs } from '../lib/compose-refs'\nimport { cn } from '../lib/utils'\nimport { Button, type ButtonProps } from './button'\n\nconst dropzoneErrorCodes = [\n ErrorCode.FileInvalidType,\n ErrorCode.FileTooLarge,\n ErrorCode.FileTooSmall,\n ErrorCode.TooManyFiles\n]\n\ntype DropzoneAction<TUploadResult, TUploadError> =\n | {\n type: 'add'\n id: string\n fileName: string\n file: File\n }\n | {\n type: 'remove'\n id: string\n }\n | {\n type: 'update-status'\n id: string\n status: 'pending'\n }\n | {\n type: 'update-status'\n id: string\n status: 'error'\n error: TUploadError\n message?: string\n }\n | {\n type: 'update-status'\n id: string\n status: 'success'\n result: TUploadResult\n }\n\nexport type DropzoneUploadResult<TUploadResult, TUploadError> =\n | {\n status: 'error'\n error: TUploadError\n }\n | {\n status: 'success'\n result: TUploadResult\n }\n\nexport type DropzoneFileStatus<TUploadResult, TUploadError> = {\n id: string\n fileName: string\n file: File\n tries: number\n} & (\n | {\n status: 'pending'\n error?: undefined\n message?: undefined\n result?: undefined\n }\n | {\n status: 'error'\n error: TUploadError\n message?: string\n result?: undefined\n }\n | {\n status: 'success'\n result: TUploadResult\n error?: undefined\n message?: undefined\n }\n)\n\nexport type FileStatus<TUploadResult, TUploadError> = DropzoneFileStatus<TUploadResult, TUploadError>\n\nexport type DropzoneValidation = {\n accept?: Accept\n minSize?: number\n maxSize?: number\n maxFiles?: number\n}\n\nexport type UseDropzoneProps<TUploadResult, TUploadError = string> = {\n /** Uploads one file. Resolve to `{ status: 'success', result }` or `{ status: 'error', error }`. */\n onDropFile: (file: File) => Promise<DropzoneUploadResult<TUploadResult, TUploadError>>\n /** Called when a file is removed, with its id. */\n onRemoveFile?: (id: string) => void | Promise<void>\n /** Called with the result of each successful upload. */\n onFileUploaded?: (result: TUploadResult) => void\n /** Called with the error of each failed upload. */\n onFileUploadError?: (error: TUploadError) => void\n /** Called when every pending upload has finished. */\n onAllUploaded?: () => void\n /** Called with the validation message when dropped files are rejected, or `undefined` when cleared. */\n onRootError?: (error: string | undefined) => void\n /** Turns an upload error into the message shown for the file. */\n shapeUploadError?: (error: TUploadError) => string | undefined\n /** Maximum number of retries per file. Unlimited when omitted. */\n maxRetryCount?: number\n /**\n * Retries failed uploads automatically, up to `maxRetryCount`.\n * @default false\n */\n autoRetry?: boolean\n /** File rules: `accept`, `minSize`, `maxSize` (bytes) and `maxFiles`. */\n validation?: DropzoneValidation\n /**\n * Removes the oldest files when new ones exceed `maxFiles`, instead of rejecting them.\n * @default false\n */\n shiftOnMaxFiles?: boolean\n}\n\nexport interface UseDropzoneReturn<TUploadResult, TUploadError> {\n getRootProps: ReturnType<typeof useReactDropzone>['getRootProps']\n getInputProps: ReturnType<typeof useReactDropzone>['getInputProps']\n open: () => void\n onRemoveFile: (id: string) => Promise<void>\n onRetry: (id: string) => Promise<void>\n canRetry: (id: string) => boolean\n fileStatuses: DropzoneFileStatus<TUploadResult, TUploadError>[]\n isInvalid: boolean\n isDragActive: boolean\n rootError: string | undefined\n inputId: string\n rootMessageId: string\n rootDescriptionId: string\n getFileMessageId: (id: string) => string\n}\n\nexport type DropzoneProps<TUploadResult, TUploadError> = React.PropsWithChildren<\n UseDropzoneReturn<TUploadResult, TUploadError>\n>\n\nexport type DropzoneAreaProps = React.ComponentProps<'div'>\n\nexport type DropzoneDescriptionProps = React.ComponentProps<'p'>\n\nexport type DropzoneFileListProps = React.ComponentProps<'ol'>\n\nexport type DropzoneFileListItemProps<TUploadResult, TUploadError> = React.ComponentProps<'li'> & {\n /** File status from `fileStatuses`, used by the parts inside the item. */\n file: DropzoneFileStatus<TUploadResult, TUploadError>\n}\n\nexport type DropzoneFileMessageProps = React.ComponentProps<'p'>\n\nexport type DropzoneMessageProps = React.ComponentProps<'p'>\n\nexport type DropzoneRemoveFileProps = ButtonProps\n\nexport type DropzoneRetryFileProps = ButtonProps\n\nexport type DropzoneTriggerProps = ButtonProps\n\nexport type InfiniteProgressProps = React.ComponentProps<'div'> & {\n /** Upload status shown by the bar. */\n status: 'pending' | 'success' | 'error'\n}\n\ntype DropzoneFileListContextValue<TUploadResult, TUploadError> = {\n onRemoveFile: () => Promise<void>\n onRetry: () => Promise<void>\n fileStatus: DropzoneFileStatus<TUploadResult, TUploadError>\n canRetry: boolean\n dropzoneId: string\n messageId: string\n}\n\nconst dropzoneErrorCodeSet = new Set<ErrorCode>(dropzoneErrorCodes)\n\nconst valueTextMap = {\n pending: 'indeterminate',\n success: '100%',\n error: 'error'\n} as const\n\nconst DropzoneContext = React.createContext<UseDropzoneReturn<unknown, unknown> | null>(null)\n\nconst DropzoneFileListContext = React.createContext<DropzoneFileListContextValue<unknown, unknown> | null>(null)\n\nfunction fileStatusReducer<TUploadResult, TUploadError>(\n state: DropzoneFileStatus<TUploadResult, TUploadError>[],\n action: DropzoneAction<TUploadResult, TUploadError>\n): DropzoneFileStatus<TUploadResult, TUploadError>[] {\n switch (action.type) {\n case 'add':\n return [\n ...state,\n {\n id: action.id,\n fileName: action.fileName,\n file: action.file,\n status: 'pending',\n tries: 1\n }\n ]\n case 'remove':\n return state.filter((fileStatus) => fileStatus.id !== action.id)\n case 'update-status':\n return state.map((fileStatus) => {\n if (fileStatus.id !== action.id) {\n return fileStatus\n }\n\n if (action.status === 'pending') {\n return {\n ...fileStatus,\n status: 'pending',\n error: undefined,\n message: undefined,\n result: undefined,\n tries: fileStatus.tries + 1\n }\n }\n\n if (action.status === 'error') {\n return {\n ...fileStatus,\n status: 'error',\n error: action.error,\n message: action.message,\n result: undefined\n }\n }\n\n return {\n ...fileStatus,\n status: 'success',\n result: action.result,\n error: undefined,\n message: undefined\n }\n })\n }\n}\n\nfunction formatAcceptedTypes(accept?: Accept) {\n if (!accept) {\n return undefined\n }\n\n const acceptedTypes = Object.entries(accept).flatMap(([mimeType, extensions]) => {\n return extensions.length > 0 ? extensions : [mimeType]\n })\n\n return acceptedTypes.length > 0 ? acceptedTypes.join(', ') : undefined\n}\n\nfunction getDropzoneErrorCodes(fileRejections: FileRejection[]) {\n const errorCodes = fileRejections.flatMap((rejection) =>\n rejection.errors.map((error) => error.code as ErrorCode).filter((errorCode) => dropzoneErrorCodeSet.has(errorCode))\n )\n\n return Array.from(new Set(errorCodes))\n}\n\nfunction getRootError(errorCodes: ErrorCode[], limits: DropzoneValidation) {\n const errors = errorCodes.flatMap((errorCode) => {\n switch (errorCode) {\n case 'file-invalid-type': {\n const acceptedTypes = formatAcceptedTypes(limits.accept)\n return acceptedTypes ? [`only ${acceptedTypes} files are allowed`] : ['this file type is not allowed']\n }\n case 'file-too-large': {\n if (!limits.maxSize) {\n return ['this file is too large']\n }\n\n return [`max size is ${(limits.maxSize / (1024 * 1024)).toFixed(2)} MB`]\n }\n case 'file-too-small': {\n if (!limits.minSize) {\n return ['this file is too small']\n }\n\n return [`min size is ${(limits.minSize / (1024 * 1024)).toFixed(2)} MB`]\n }\n case 'too-many-files':\n return limits.maxFiles ? [`max ${limits.maxFiles} files`] : ['too many files']\n default:\n return []\n }\n })\n\n if (errors.length === 0) {\n return 'Unable to add the selected files'\n }\n\n const [firstError, ...restErrors] = errors as [string, ...string[]]\n return `${firstError.charAt(0).toUpperCase()}${firstError.slice(1)}${restErrors.length > 0 ? `, ${restErrors.join(', ')}` : ''}`\n}\n\nfunction getRejectionMessage(fileRejections: FileRejection[], limits: DropzoneValidation) {\n const errorCodes = getDropzoneErrorCodes(fileRejections)\n\n if (errorCodes.length > 0) {\n return getRootError(errorCodes, limits)\n }\n\n return fileRejections[0]?.errors[0]?.message ?? 'Unable to add the selected files'\n}\n\nfunction getUploadErrorMessage<TUploadError>(\n error: TUploadError,\n shapeUploadError?: (error: TUploadError) => string | undefined\n) {\n if (shapeUploadError) {\n const message = shapeUploadError(error)\n if (message !== undefined) {\n return message\n }\n }\n\n if (typeof error === 'string') {\n return error\n }\n\n if (error instanceof Error) {\n return error.message\n }\n\n return undefined\n}\n\nfunction useDropzoneContext<TUploadResult, TUploadError>() {\n const context = React.useContext(DropzoneContext)\n\n if (!context) {\n throw new Error('Dropzone components must be used within a Dropzone.')\n }\n\n return context as UseDropzoneReturn<TUploadResult, TUploadError>\n}\n\nfunction useDropzoneFileListContext<TUploadResult, TUploadError>() {\n const context = React.useContext(DropzoneFileListContext)\n\n if (!context) {\n throw new Error('Dropzone file actions must be used within a DropzoneFileListItem.')\n }\n\n return context as DropzoneFileListContextValue<TUploadResult, TUploadError>\n}\n\nfunction useDropzone<TUploadResult, TUploadError = string>(\n props: UseDropzoneProps<TUploadResult, TUploadError>\n): UseDropzoneReturn<TUploadResult, TUploadError> {\n const {\n onDropFile: handleDropFile,\n onRemoveFile: handleRemoveFile,\n shapeUploadError,\n onFileUploaded,\n onFileUploadError,\n onAllUploaded,\n onRootError,\n maxRetryCount,\n autoRetry = false,\n validation,\n shiftOnMaxFiles = false\n } = props\n\n const inputId = React.useId()\n const rootMessageId = `${inputId}-message`\n const rootDescriptionId = `${inputId}-description`\n const [rootError, setRootErrorState] = React.useState<string | undefined>(undefined)\n\n const setRootError = React.useCallback(\n (error: string | undefined) => {\n setRootErrorState(error)\n onRootError?.(error)\n },\n [onRootError]\n )\n\n const [fileStatuses, dispatch] = React.useReducer(\n fileStatusReducer<TUploadResult, TUploadError>,\n [] as DropzoneFileStatus<TUploadResult, TUploadError>[]\n )\n\n const getFileMessageId = React.useCallback((id: string) => `${inputId}-${id}-message`, [inputId])\n\n const isInvalid = React.useMemo(() => {\n return rootError !== undefined || fileStatuses.some((fileStatus) => fileStatus.status === 'error')\n }, [fileStatuses, rootError])\n\n const uploadFile = React.useCallback(\n async (file: File, id: string, retryCount = 0) => {\n try {\n const result = await handleDropFile(file)\n\n if (result.status === 'error') {\n if (autoRetry && retryCount < (maxRetryCount ?? Number.POSITIVE_INFINITY)) {\n dispatch({ type: 'update-status', id, status: 'pending' })\n return uploadFile(file, id, retryCount + 1)\n }\n\n dispatch({\n type: 'update-status',\n id,\n status: 'error',\n error: result.error,\n message: getUploadErrorMessage(result.error, shapeUploadError)\n })\n onFileUploadError?.(result.error)\n return\n }\n\n dispatch({\n type: 'update-status',\n id,\n status: 'success',\n result: result.result\n })\n onFileUploaded?.(result.result)\n } catch (error) {\n const uploadError = error as TUploadError\n\n dispatch({\n type: 'update-status',\n id,\n status: 'error',\n error: uploadError,\n message: getUploadErrorMessage(uploadError, shapeUploadError)\n })\n onFileUploadError?.(uploadError)\n }\n },\n [autoRetry, handleDropFile, maxRetryCount, onFileUploadError, onFileUploaded, shapeUploadError]\n )\n\n const onRemoveFile = React.useCallback(\n async (id: string) => {\n await handleRemoveFile?.(id)\n dispatch({ type: 'remove', id })\n },\n [handleRemoveFile]\n )\n\n const canRetry = React.useCallback(\n (id: string) => {\n const fileStatus = fileStatuses.find((item) => item.id === id)\n\n return fileStatus?.status === 'error' && fileStatus.tries <= (maxRetryCount ?? Number.POSITIVE_INFINITY)\n },\n [fileStatuses, maxRetryCount]\n )\n\n const onRetry = React.useCallback(\n async (id: string) => {\n if (!canRetry(id)) {\n return\n }\n\n const fileStatus = fileStatuses.find((item) => item.id === id)\n\n if (fileStatus?.status !== 'error') {\n return\n }\n\n dispatch({ type: 'update-status', id, status: 'pending' })\n await uploadFile(fileStatus.file, id)\n },\n [canRetry, fileStatuses, uploadFile]\n )\n\n const dropzone = useReactDropzone({\n accept: validation?.accept,\n minSize: validation?.minSize,\n maxSize: validation?.maxSize,\n maxFiles: validation?.maxFiles,\n noClick: true,\n noKeyboard: true,\n onDropAccepted: async (acceptedFiles) => {\n setRootError(undefined)\n\n let nextFiles = acceptedFiles\n const maxFiles = validation?.maxFiles ?? Number.POSITIVE_INFINITY\n const overflow = Number.isFinite(maxFiles)\n ? Math.max(fileStatuses.length + acceptedFiles.length - maxFiles, 0)\n : 0\n\n if (overflow > 0) {\n if (shiftOnMaxFiles) {\n const filesToRemove = fileStatuses.slice(0, Math.min(overflow, fileStatuses.length))\n\n await Promise.all(filesToRemove.map((fileStatus) => onRemoveFile(fileStatus.id)))\n\n const remainingOverflow = overflow - filesToRemove.length\n if (remainingOverflow > 0) {\n nextFiles = acceptedFiles.slice(remainingOverflow)\n }\n } else {\n setRootError(getRootError([ErrorCode.TooManyFiles], validation ?? {}))\n const availableSlots = Math.max(maxFiles - fileStatuses.length, 0)\n nextFiles = acceptedFiles.slice(0, availableSlots)\n }\n }\n\n if (nextFiles.length === 0) {\n return\n }\n\n await Promise.all(\n nextFiles.map(async (file) => {\n const id = crypto.randomUUID()\n dispatch({ type: 'add', id, fileName: file.name, file })\n await uploadFile(file, id)\n })\n )\n\n onAllUploaded?.()\n },\n onDropRejected: (fileRejections) => {\n setRootError(getRejectionMessage(fileRejections, validation ?? {}))\n }\n })\n\n return {\n getRootProps: dropzone.getRootProps,\n getInputProps: dropzone.getInputProps,\n open: dropzone.open,\n onRemoveFile,\n onRetry,\n canRetry,\n fileStatuses,\n isInvalid,\n isDragActive: dropzone.isDragActive,\n rootError,\n inputId,\n rootMessageId,\n rootDescriptionId,\n getFileMessageId\n }\n}\n\nfunction Dropzone<TUploadResult, TUploadError>({ children, ...dropzone }: DropzoneProps<TUploadResult, TUploadError>) {\n return <DropzoneContext.Provider value={dropzone}>{children}</DropzoneContext.Provider>\n}\n\nconst DropzoneArea = React.forwardRef<HTMLDivElement, DropzoneAreaProps>(\n ({ className, children, ...props }, forwardedRef) => {\n const context = useDropzoneContext()\n const describedBy =\n [context.rootDescriptionId, context.isInvalid ? context.rootMessageId : undefined].filter(Boolean).join(' ') ||\n undefined\n\n const { ref: rootRef, ...rootProps } = context.getRootProps({\n ...props,\n 'data-slot': 'dropzone-area',\n 'aria-describedby': describedBy,\n 'aria-invalid': context.isInvalid || undefined,\n className: cn(\n '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',\n context.isDragActive && 'border-primary bg-primary/5',\n context.isInvalid && 'border-destructive bg-destructive/5',\n className\n )\n }) as React.HTMLAttributes<HTMLDivElement> & {\n ref?: React.Ref<HTMLDivElement>\n }\n\n const inputProps = context.getInputProps({\n id: context.inputId,\n className: 'sr-only',\n 'aria-describedby': describedBy,\n 'aria-invalid': context.isInvalid,\n tabIndex: -1\n })\n\n return (\n <div {...rootProps} ref={composeRefs(forwardedRef, rootRef)}>\n <input {...inputProps} />\n {children}\n </div>\n )\n }\n)\n\nconst DropzoneDescription = React.forwardRef<HTMLParagraphElement, DropzoneDescriptionProps>(\n ({ className, ...props }, ref) => {\n const context = useDropzoneContext()\n\n return (\n <p\n ref={ref}\n id={context.rootDescriptionId}\n data-slot=\"dropzone-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneFileList = React.forwardRef<HTMLOListElement, DropzoneFileListProps>(({ className, ...props }, ref) => {\n useDropzoneContext()\n\n return <ol ref={ref} data-slot=\"dropzone-file-list\" className={cn('space-y-3', className)} {...props} />\n})\n\nconst DropzoneFileListItem = React.forwardRef<HTMLLIElement, DropzoneFileListItemProps<unknown, unknown>>(\n ({ className, file, children, ...props }, ref) => {\n const context = useDropzoneContext()\n const messageId = context.getFileMessageId(file.id)\n const isInvalid = file.status === 'error'\n const canRetry = context.canRetry(file.id)\n\n const value = React.useMemo<DropzoneFileListContextValue<unknown, unknown>>(\n () => ({\n onRemoveFile: () => context.onRemoveFile(file.id),\n onRetry: () => context.onRetry(file.id),\n fileStatus: file,\n canRetry,\n dropzoneId: context.inputId,\n messageId\n }),\n [canRetry, context, file, messageId]\n )\n\n return (\n <DropzoneFileListContext.Provider value={value}>\n <li\n ref={ref}\n data-slot=\"dropzone-file-item\"\n data-status={file.status}\n aria-describedby={isInvalid ? messageId : undefined}\n className={cn(\n 'rounded-xl border bg-card px-4 py-3 shadow-xs',\n file.status === 'error' && 'border-destructive/50',\n className\n )}\n {...props}\n >\n {children}\n </li>\n </DropzoneFileListContext.Provider>\n )\n }\n)\n\nconst DropzoneFileMessage = React.forwardRef<HTMLParagraphElement, DropzoneFileMessageProps>(\n ({ className, children, ...props }, ref) => {\n const context = useDropzoneFileListContext()\n const body =\n context.fileStatus.status === 'error'\n ? (context.fileStatus.message ?? String(context.fileStatus.error))\n : children\n\n return (\n <p\n ref={ref}\n id={context.messageId}\n data-slot=\"dropzone-file-message\"\n className={cn(\n 'min-h-5 text-[0.8rem] font-medium',\n context.fileStatus.status === 'error' && 'text-destructive',\n className\n )}\n {...props}\n >\n {body}\n </p>\n )\n }\n)\n\nconst DropzoneMessage = React.forwardRef<HTMLParagraphElement, DropzoneMessageProps>(\n ({ className, children, ...props }, ref) => {\n const context = useDropzoneContext()\n const body = context.rootError ?? children\n\n return (\n <p\n ref={ref}\n id={context.rootMessageId}\n data-slot=\"dropzone-message\"\n className={cn('min-h-5 text-[0.8rem] font-medium text-destructive', className)}\n {...props}\n >\n {body}\n </p>\n )\n }\n)\n\nconst DropzoneRemoveFile = React.forwardRef<HTMLButtonElement, DropzoneRemoveFileProps>(\n ({ className, onClick, size = 'icon-sm', type = 'button', variant = 'ghost', ...props }, ref) => {\n const context = useDropzoneFileListContext()\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n void context.onRemoveFile()\n },\n [context, onClick]\n )\n\n return (\n <Button\n ref={ref}\n data-slot=\"dropzone-remove-file\"\n className={cn(className)}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneRetryFile = React.forwardRef<HTMLButtonElement, DropzoneRetryFileProps>(\n ({ className, disabled, onClick, size = 'icon-sm', type = 'button', variant = 'ghost', ...props }, ref) => {\n const context = useDropzoneFileListContext()\n const isDisabled = disabled || !context.canRetry\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented || isDisabled) {\n return\n }\n\n void context.onRetry()\n },\n [context, isDisabled, onClick]\n )\n\n return (\n <Button\n ref={ref}\n data-slot=\"dropzone-retry-file\"\n className={cn(className)}\n disabled={isDisabled}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst DropzoneTrigger = React.forwardRef<HTMLButtonElement, DropzoneTriggerProps>(\n ({ className, onClick, size = 'sm', type = 'button', variant = 'subtle', ...props }, ref) => {\n const context = useDropzoneContext()\n const describedBy =\n [context.rootDescriptionId, context.isInvalid ? context.rootMessageId : undefined].filter(Boolean).join(' ') ||\n undefined\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n onClick?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n context.open()\n },\n [context, onClick]\n )\n\n return (\n <Button\n ref={ref}\n aria-controls={context.inputId}\n aria-describedby={describedBy}\n aria-invalid={context.isInvalid || undefined}\n data-slot=\"dropzone-trigger\"\n className={cn(className)}\n onClick={handleClick}\n size={size}\n type={type}\n variant={variant}\n {...props}\n />\n )\n }\n)\n\nconst InfiniteProgress = React.forwardRef<HTMLDivElement, InfiniteProgressProps>(\n ({ className, status, ...props }, ref) => {\n const done = status === 'success' || status === 'error'\n const isError = status === 'error'\n\n return (\n <div\n ref={ref}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuetext={valueTextMap[status]}\n data-slot=\"dropzone-progress\"\n data-status={status}\n role=\"progressbar\"\n className={cn('relative h-2 w-full overflow-hidden rounded-full bg-muted', className)}\n {...props}\n >\n <div\n className={cn(\n 'h-full w-full rounded-full bg-primary transition-transform',\n done ? 'translate-x-0' : 'animate-infinite-progress',\n isError && 'bg-destructive'\n )}\n />\n </div>\n )\n }\n)\n\nDropzone.displayName = 'Dropzone'\nDropzoneArea.displayName = 'DropzoneArea'\nDropzoneDescription.displayName = 'DropzoneDescription'\nDropzoneFileList.displayName = 'DropzoneFileList'\nDropzoneFileListItem.displayName = 'DropzoneFileListItem'\nDropzoneFileMessage.displayName = 'DropzoneFileMessage'\nDropzoneMessage.displayName = 'DropzoneMessage'\nDropzoneRemoveFile.displayName = 'DropzoneRemoveFile'\nDropzoneRetryFile.displayName = 'DropzoneRetryFile'\nDropzoneTrigger.displayName = 'DropzoneTrigger'\nInfiniteProgress.displayName = 'InfiniteProgress'\n\nexport {\n Dropzone,\n DropzoneArea,\n DropzoneDescription,\n DropzoneFileList,\n DropzoneFileListItem,\n DropzoneFileMessage,\n DropzoneMessage,\n DropzoneRemoveFile,\n DropzoneRetryFile,\n DropzoneTrigger,\n ErrorCode,\n type FileError,\n InfiniteProgress,\n useDropzone\n}\n"],"mappings":"A,6SAaA,MAAMG,EAAqB,CACzBC,EAAU,gBACVA,EAAU,aACVA,EAAU,aACVA,EAAU,YACZ,EAoKMC,EAAuB,IAAI,IAAeF,CAAkB,EAE5DG,EAAe,CACnB,QAAS,gBACT,QAAS,OACT,MAAO,OACT,EAEMC,EAAkBN,EAAM,cAA0D,IAAI,EAEtFO,EAA0BP,EAAM,cAAqE,IAAI,EAE/G,SAAS,kBACP,EACA,EACmD,CACnD,OAAQQ,EAAO,KAAf,CACE,IAAK,MACH,MAAO,CACL,GAAGC,EACH,CACE,GAAID,EAAO,GACX,SAAUA,EAAO,SACjB,KAAMA,EAAO,KACb,OAAQ,UACR,MAAO,CACT,CACF,EACF,IAAK,SACH,OAAOC,EAAM,OAAQ,GAAeC,EAAW,KAAOF,EAAO,EAAE,EACjE,IAAK,gBACH,OAAOC,EAAM,IAAK,GACZC,EAAW,KAAOF,EAAO,GAIzBA,EAAO,SAAW,UACb,CACL,GAAGE,EACH,OAAQ,UACR,MAAO,IAAA,GACP,QAAS,IAAA,GACT,OAAQ,IAAA,GACR,MAAOA,EAAW,MAAQ,CAC5B,EAGEF,EAAO,SAAW,QACb,CACL,GAAGE,EACH,OAAQ,QACR,MAAOF,EAAO,MACd,QAASA,EAAO,QAChB,OAAQ,IAAA,EACV,EAGK,CACL,GAAGE,EACH,OAAQ,UACR,OAAQF,EAAO,OACf,MAAO,IAAA,GACP,QAAS,IAAA,EACX,EA9BSE,CA+BV,CACL,CACF,CAEA,SAAS,oBAAoB,EAAiB,CAC5C,GAAI,CAACC,EACH,OAGF,IAAMC,EAAgB,OAAO,QAAQD,CAAM,CAAC,CAAC,SAAS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BACjC,EAAkB,YAAc,oBAChC,EAAgB,YAAc,kBAC9B,EAAiB,YAAc,mB"}
@@ -1,6 +1,5 @@
1
1
  import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
2
  import { VariantProps } from "class-variance-authority";
3
- //#region src/components/empty.d.ts
4
3
  export type EmptyProps = React.ComponentProps<'div'>;
5
4
  export type EmptyHeaderProps = React.ComponentProps<'div'>;
6
5
  export type EmptyMediaProps = React.ComponentProps<'div'> & VariantProps<typeof emptyMediaVariants>;
@@ -16,6 +15,5 @@ declare function EmptyMedia({ className, variant, ...props }: EmptyMediaProps):
16
15
  declare function EmptyTitle({ className, ...props }: EmptyTitleProps): import("react").JSX.Element;
17
16
  declare function EmptyDescription({ className, ...props }: EmptyDescriptionProps): import("react").JSX.Element;
18
17
  declare function EmptyContent({ className, ...props }: EmptyContentProps): import("react").JSX.Element;
19
- //#endregion
20
18
  export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle };
21
19
  //# sourceMappingURL=empty.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"empty.js","names":["props","cn","className","emptyMediaVariants","cva","variant"],"sources":["../../src/components/empty.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nexport type EmptyProps = React.ComponentProps<'div'>\n\nexport type EmptyHeaderProps = React.ComponentProps<'div'>\n\nexport type EmptyMediaProps = React.ComponentProps<'div'> & VariantProps<typeof emptyMediaVariants>\n\nexport type EmptyTitleProps = React.ComponentProps<'div'>\n\nexport type EmptyDescriptionProps = React.ComponentProps<'p'>\n\nexport type EmptyContentProps = React.ComponentProps<'div'>\n\nfunction Empty({ className, ...props }: EmptyProps) {\n return (\n <div\n data-slot=\"empty\"\n className={cn(\n 'gap-4 rounded-xl border-dashed p-6 flex w-full min-w-0 flex-1 flex-col items-center justify-center text-center text-balance',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyHeader({ className, ...props }: EmptyHeaderProps) {\n return (\n <div data-slot=\"empty-header\" className={cn('gap-2 flex max-w-sm flex-col items-center', className)} {...props} />\n )\n}\n\nconst emptyMediaVariants = cva(\n 'mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'bg-transparent',\n icon: \"bg-muted text-foreground flex size-8 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-4\"\n }\n },\n defaultVariants: {\n variant: 'default'\n }\n }\n)\n\nfunction EmptyMedia({ className, variant = 'default', ...props }: EmptyMediaProps) {\n return (\n <div\n data-slot=\"empty-icon\"\n data-variant={variant}\n className={cn(emptyMediaVariants({ variant, className }))}\n {...props}\n />\n )\n}\n\nfunction EmptyTitle({ className, ...props }: EmptyTitleProps) {\n return <div data-slot=\"empty-title\" className={cn('text-sm font-medium tracking-tight', className)} {...props} />\n}\n\nfunction EmptyDescription({ className, ...props }: EmptyDescriptionProps) {\n return (\n <div\n data-slot=\"empty-description\"\n className={cn(\n 'text-sm/relaxed text-muted-foreground [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyContent({ className, ...props }: EmptyContentProps) {\n return (\n <div\n data-slot=\"empty-content\"\n className={cn('gap-2.5 text-sm flex w-full max-w-sm min-w-0 flex-col items-center text-balance', className)}\n {...props}\n />\n )\n}\n\nexport { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle }\n"],"mappings":"oKAgBA,SAAS,MAAM,CAAE,YAAW,GAAGA,GAAqB,CAClD,MACE,kBAAC,MAAD,CACE,YAAU,QACV,UAAWC,EACT,8HACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL,CAEA,SAAS,YAAY,CAAE,YAAW,GAAGA,GAA2B,CAC9D,MACE,kBAAC,MAAD,CAAK,YAAU,eAAe,UAAWC,EAAG,4CAA6CC,CAAS,EAAG,GAAIF,CAAQ,CAAA,CAErH,CAEA,MAAMG,EAAqBC,EACzB,8FACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,iBACT,KAAM,2HACR,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,CACF,EAEA,SAAS,WAAW,CAAE,YAAW,UAAU,UAAW,GAAGJ,GAA0B,CACjF,MACE,kBAAC,MAAD,CACE,YAAU,aACV,eAAcK,EACd,UAAWJ,EAAGE,EAAmB,CAAE,UAAS,WAAU,CAAC,CAAC,EACxD,GAAIH,CACL,CAAA,CAEL,CAEA,SAAS,WAAW,CAAE,YAAW,GAAGA,GAA0B,CAC5D,MAAO,kBAAC,MAAD,CAAK,YAAU,cAAc,UAAWC,EAAG,qCAAsCC,CAAS,EAAG,GAAIF,CAAQ,CAAA,CAClH,CAEA,SAAS,iBAAiB,CAAE,YAAW,GAAGA,GAAgC,CACxE,MACE,kBAAC,MAAD,CACE,YAAU,oBACV,UAAWC,EACT,0GACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL,CAEA,SAAS,aAAa,CAAE,YAAW,GAAGA,GAA4B,CAChE,MACE,kBAAC,MAAD,CACE,YAAU,gBACV,UAAWC,EAAG,kFAAmFC,CAAS,EAC1G,GAAIF,CACL,CAAA,CAEL"}
1
+ {"version":3,"file":"empty.js","names":["props","cn","className","emptyMediaVariants","cva","variant"],"sources":["../../src/components/empty.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nexport type EmptyProps = React.ComponentProps<'div'>\n\nexport type EmptyHeaderProps = React.ComponentProps<'div'>\n\nexport type EmptyMediaProps = React.ComponentProps<'div'> & VariantProps<typeof emptyMediaVariants>\n\nexport type EmptyTitleProps = React.ComponentProps<'div'>\n\nexport type EmptyDescriptionProps = React.ComponentProps<'p'>\n\nexport type EmptyContentProps = React.ComponentProps<'div'>\n\nfunction Empty({ className, ...props }: EmptyProps) {\n return (\n <div\n data-slot=\"empty\"\n className={cn(\n 'gap-4 rounded-xl border-dashed p-6 flex w-full min-w-0 flex-1 flex-col items-center justify-center text-center text-balance',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyHeader({ className, ...props }: EmptyHeaderProps) {\n return (\n <div data-slot=\"empty-header\" className={cn('gap-2 flex max-w-sm flex-col items-center', className)} {...props} />\n )\n}\n\nconst emptyMediaVariants = cva(\n 'mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'bg-transparent',\n icon: \"bg-muted text-foreground flex size-8 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-4\"\n }\n },\n defaultVariants: {\n variant: 'default'\n }\n }\n)\n\nfunction EmptyMedia({ className, variant = 'default', ...props }: EmptyMediaProps) {\n return (\n <div\n data-slot=\"empty-icon\"\n data-variant={variant}\n className={cn(emptyMediaVariants({ variant, className }))}\n {...props}\n />\n )\n}\n\nfunction EmptyTitle({ className, ...props }: EmptyTitleProps) {\n return <div data-slot=\"empty-title\" className={cn('text-sm font-medium tracking-tight', className)} {...props} />\n}\n\nfunction EmptyDescription({ className, ...props }: EmptyDescriptionProps) {\n return (\n <div\n data-slot=\"empty-description\"\n className={cn(\n 'text-sm/relaxed text-muted-foreground [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyContent({ className, ...props }: EmptyContentProps) {\n return (\n <div\n data-slot=\"empty-content\"\n className={cn('gap-2.5 text-sm flex w-full max-w-sm min-w-0 flex-col items-center text-balance', className)}\n {...props}\n />\n )\n}\n\nexport { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle }\n"],"mappings":"A,oKAgBA,SAAS,MAAM,CAAE,YAAW,GAAGA,GAAqB,CAClD,MACE,kBAAC,MAAD,CACE,YAAU,QACV,UAAWC,EACT,8HACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL,CAEA,SAAS,YAAY,CAAE,YAAW,GAAGA,GAA2B,CAC9D,MACE,kBAAC,MAAD,CAAK,YAAU,eAAe,UAAWC,EAAG,4CAA6CC,CAAS,EAAG,GAAIF,CAAQ,CAAA,CAErH,CAEA,MAAMG,EAAqBC,EACzB,8FACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,iBACT,KAAM,2HACR,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,CACF,EAEA,SAAS,WAAW,CAAE,YAAW,UAAU,UAAW,GAAGJ,GAA0B,CACjF,MACE,kBAAC,MAAD,CACE,YAAU,aACV,eAAcK,EACd,UAAWJ,EAAGE,EAAmB,CAAE,UAAS,WAAU,CAAC,CAAC,EACxD,GAAIH,CACL,CAAA,CAEL,CAEA,SAAS,WAAW,CAAE,YAAW,GAAGA,GAA0B,CAC5D,MAAO,kBAAC,MAAD,CAAK,YAAU,cAAc,UAAWC,EAAG,qCAAsCC,CAAS,EAAG,GAAIF,CAAQ,CAAA,CAClH,CAEA,SAAS,iBAAiB,CAAE,YAAW,GAAGA,GAAgC,CACxE,MACE,kBAAC,MAAD,CACE,YAAU,oBACV,UAAWC,EACT,0GACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL,CAEA,SAAS,aAAa,CAAE,YAAW,GAAGA,GAA4B,CAChE,MACE,kBAAC,MAAD,CACE,YAAU,gBACV,UAAWC,EAAG,kFAAmFC,CAAS,EAC1G,GAAIF,CACL,CAAA,CAEL,C"}
@@ -1,7 +1,6 @@
1
1
  import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
2
  import { Label } from "./label.js";
3
3
  import { VariantProps } from "class-variance-authority";
4
- //#region src/components/field.d.ts
5
4
  export type FieldSetProps = React.ComponentProps<'fieldset'>;
6
5
  export type FieldLegendProps = React.ComponentProps<'legend'> & {
7
6
  /**
@@ -46,6 +45,5 @@ declare function FieldTitle({ className, ...props }: FieldTitleProps): import("r
46
45
  declare function FieldDescription({ className, ...props }: FieldDescriptionProps): import("react").JSX.Element;
47
46
  declare function FieldSeparator({ children, className, ...props }: FieldSeparatorProps): import("react").JSX.Element;
48
47
  declare function FieldError({ className, children, errors, ...props }: FieldErrorProps): import("react").JSX.Element | null;
49
- //#endregion
50
48
  export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, useFieldControlId, useFieldInvalid, useFieldLabelId };
51
49
  //# sourceMappingURL=field.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","names":["FieldContext","createContext","context","useContext","id","invalid","ariaInvalid","props","cn","className","variant","fieldVariants","cva","dataInvalid","controlId","useId","labelId","isInvalid","contextValue","useMemo","orientation","fieldControlId","htmlFor","fieldLabelId","Label","children","Separator","content","errors","uniqueErrors","error"],"sources":["../../src/components/field.tsx"],"sourcesContent":["import { createContext, useContext, useId, useMemo } from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\nimport { Label } from './label'\nimport { Separator } from './separator'\n\nexport type FieldSetProps = React.ComponentProps<'fieldset'>\n\nexport type FieldLegendProps = React.ComponentProps<'legend'> & {\n /**\n * `label` renders the legend at the size of a field label.\n * @default 'legend'\n */\n variant?: 'legend' | 'label'\n}\n\nexport type FieldGroupProps = React.ComponentProps<'div'>\n\nexport type FieldContentProps = React.ComponentProps<'div'>\n\nexport type FieldLabelProps = React.ComponentProps<typeof Label>\n\nexport type FieldTitleProps = React.ComponentProps<'div'>\n\nexport type FieldDescriptionProps = React.ComponentProps<'p'>\n\nexport type FieldSeparatorProps = React.ComponentProps<'div'> & {\n children?: React.ReactNode\n}\n\nexport type FieldErrorProps = React.ComponentProps<'div'> & {\n /** Errors to show. Each `message` is rendered; duplicates are removed. Ignored when `children` is passed. */\n errors?: Array<{ message?: string } | undefined>\n}\n\ntype FieldContextValue = {\n controlId: string\n labelId: string\n invalid: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nfunction useFieldControlId(id?: string) {\n const context = useContext(FieldContext)\n\n return id ?? context?.controlId\n}\n\nfunction useFieldLabelId() {\n return useContext(FieldContext)?.labelId\n}\n\n// The control's own `aria-invalid` always wins (including `false`); otherwise an invalid `Field` marks it invalid.\nfunction useFieldInvalid(ariaInvalid?: React.AriaAttributes['aria-invalid']) {\n const invalid = useContext(FieldContext)?.invalid\n\n return ariaInvalid ?? (invalid ? true : undefined)\n}\n\nfunction FieldSet({ className, ...props }: FieldSetProps) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n 'flex flex-col gap-4',\n 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLegend({ className, variant = 'legend', ...props }: FieldLegendProps) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className)}\n {...props}\n />\n )\n}\n\nfunction FieldGroup({ className, ...props }: FieldGroupProps) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-5',\n 'data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',\n className\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva('data-[invalid=true]:text-destructive gap-1 group/field flex w-full', {\n variants: {\n orientation: {\n vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',\n horizontal:\n 'flex-row items-center *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n responsive:\n 'flex-col *:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:*:data-[slot=field-label]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'\n }\n },\n defaultVariants: {\n orientation: 'vertical'\n }\n})\n\nexport type FieldProps = React.ComponentProps<'div'> &\n VariantProps<typeof fieldVariants> & {\n /** Marks the field and the control inside it as invalid. */\n invalid?: boolean\n /** Same as `invalid`, for form libraries that set the attribute directly. */\n 'data-invalid'?: boolean | 'true' | 'false'\n }\n\nfunction Field({ className, orientation = 'vertical', invalid, 'data-invalid': dataInvalid, ...props }: FieldProps) {\n const controlId = useId()\n const labelId = useId()\n const isInvalid = invalid ?? (dataInvalid === true || dataInvalid === 'true')\n const contextValue = useMemo(() => ({ controlId, labelId, invalid: isInvalid }), [controlId, labelId, isInvalid])\n\n return (\n <FieldContext.Provider value={contextValue}>\n <div\n data-slot=\"field\"\n data-orientation={orientation}\n data-invalid={isInvalid ? 'true' : undefined}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n </FieldContext.Provider>\n )\n}\n\nfunction FieldContent({ className, ...props }: FieldContentProps) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn('gap-0.5 group/field-content flex flex-1 flex-col leading-snug', className)}\n {...props}\n />\n )\n}\n\nfunction FieldLabel({ className, htmlFor, id, ...props }: FieldLabelProps) {\n const fieldControlId = useFieldControlId(htmlFor)\n const fieldLabelId = useFieldLabelId()\n\n return (\n <Label\n data-slot=\"field-label\"\n id={id ?? fieldLabelId}\n htmlFor={fieldControlId}\n className={cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug',\n 'has-data-checked:bg-primary/5 has-data-checked:border-primary/30 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10',\n 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5',\n 'group-data-[disabled=true]/field:opacity-50',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldTitle({ className, ...props }: FieldTitleProps) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n 'gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50 flex w-fit items-center leading-snug',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({ className, ...props }: FieldDescriptionProps) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n 'text-muted-foreground text-left text-xs leading-normal font-normal',\n '[[data-variant=legend]+&]:-mt-1.5 group-has-data-horizontal/field:text-balance last:mt-0 nth-last-2:-mt-1',\n '[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldSeparator({ children, className, ...props }: FieldSeparatorProps) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('-my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2 relative', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"text-muted-foreground px-2 bg-background relative mx-auto block w-fit\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({ className, children, errors, ...props }: FieldErrorProps) {\n const content = useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()]\n\n if (uniqueErrors?.length === 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map((error) => error?.message && <li key={error.message}>{error.message}</li>)}\n </ul>\n )\n }, [children, errors])\n\n if (!content) {\n return null\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn('text-destructive text-sm font-normal', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n useFieldControlId,\n useFieldInvalid,\n useFieldLabelId\n}\n"],"mappings":"0UA2CA,MAAMA,EAAeC,EAAwC,IAAI,EAEjE,SAAS,kBAAkB,EAAa,CACtC,IAA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OACX,OAAO,KAGT,IAAMC,EAAe,CAAC,GAAG,IAAI,IAAID,EAAO,IAAK,GAAU,CAACE,GAAO,QAASA,CAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAMzF,OAJID,GAAc,SAAW,EACpBA,EAAa,EAAE,EAAE,QAIxB,kBAAC,KAAD,CAAI,UAAU,qCACX,SAAAA,EAAa,IAAK,GAAUC,GAAO,SAAW,kBAAC,KAAD,CAAA,SAAyBA,EAAM,OAAY,EAAlCA,EAAM,OAA4B,CAAC,CACzF,CAAA,CAER,EAAG,CAACL,EAAUG,CAAM,CAAC,EAMrB,OAJKD,EAKH,kBAAC,MAAD,CACE,KAAK,QACL,YAAU,cACV,UAAWnB,EAAG,uCAAwCC,CAAS,EAC/D,GAAIF,EAEH,SAAAoB,CACE,CAAA,EAXE,IAaX"}
1
+ {"version":3,"file":"field.js","names":["FieldContext","createContext","context","useContext","id","invalid","ariaInvalid","props","cn","className","variant","fieldVariants","cva","dataInvalid","controlId","useId","labelId","isInvalid","contextValue","useMemo","orientation","fieldControlId","htmlFor","fieldLabelId","Label","children","Separator","content","errors","uniqueErrors","error"],"sources":["../../src/components/field.tsx"],"sourcesContent":["import { createContext, useContext, useId, useMemo } from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\nimport { Label } from './label'\nimport { Separator } from './separator'\n\nexport type FieldSetProps = React.ComponentProps<'fieldset'>\n\nexport type FieldLegendProps = React.ComponentProps<'legend'> & {\n /**\n * `label` renders the legend at the size of a field label.\n * @default 'legend'\n */\n variant?: 'legend' | 'label'\n}\n\nexport type FieldGroupProps = React.ComponentProps<'div'>\n\nexport type FieldContentProps = React.ComponentProps<'div'>\n\nexport type FieldLabelProps = React.ComponentProps<typeof Label>\n\nexport type FieldTitleProps = React.ComponentProps<'div'>\n\nexport type FieldDescriptionProps = React.ComponentProps<'p'>\n\nexport type FieldSeparatorProps = React.ComponentProps<'div'> & {\n children?: React.ReactNode\n}\n\nexport type FieldErrorProps = React.ComponentProps<'div'> & {\n /** Errors to show. Each `message` is rendered; duplicates are removed. Ignored when `children` is passed. */\n errors?: Array<{ message?: string } | undefined>\n}\n\ntype FieldContextValue = {\n controlId: string\n labelId: string\n invalid: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nfunction useFieldControlId(id?: string) {\n const context = useContext(FieldContext)\n\n return id ?? context?.controlId\n}\n\nfunction useFieldLabelId() {\n return useContext(FieldContext)?.labelId\n}\n\n// The control's own `aria-invalid` always wins (including `false`); otherwise an invalid `Field` marks it invalid.\nfunction useFieldInvalid(ariaInvalid?: React.AriaAttributes['aria-invalid']) {\n const invalid = useContext(FieldContext)?.invalid\n\n return ariaInvalid ?? (invalid ? true : undefined)\n}\n\nfunction FieldSet({ className, ...props }: FieldSetProps) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n 'flex flex-col gap-4',\n 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLegend({ className, variant = 'legend', ...props }: FieldLegendProps) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className)}\n {...props}\n />\n )\n}\n\nfunction FieldGroup({ className, ...props }: FieldGroupProps) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-5',\n 'data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',\n className\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva('data-[invalid=true]:text-destructive gap-1 group/field flex w-full', {\n variants: {\n orientation: {\n vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',\n horizontal:\n 'flex-row items-center *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n responsive:\n 'flex-col *:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:*:data-[slot=field-label]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'\n }\n },\n defaultVariants: {\n orientation: 'vertical'\n }\n})\n\nexport type FieldProps = React.ComponentProps<'div'> &\n VariantProps<typeof fieldVariants> & {\n /** Marks the field and the control inside it as invalid. */\n invalid?: boolean\n /** Same as `invalid`, for form libraries that set the attribute directly. */\n 'data-invalid'?: boolean | 'true' | 'false'\n }\n\nfunction Field({ className, orientation = 'vertical', invalid, 'data-invalid': dataInvalid, ...props }: FieldProps) {\n const controlId = useId()\n const labelId = useId()\n const isInvalid = invalid ?? (dataInvalid === true || dataInvalid === 'true')\n const contextValue = useMemo(() => ({ controlId, labelId, invalid: isInvalid }), [controlId, labelId, isInvalid])\n\n return (\n <FieldContext.Provider value={contextValue}>\n <div\n data-slot=\"field\"\n data-orientation={orientation}\n data-invalid={isInvalid ? 'true' : undefined}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n </FieldContext.Provider>\n )\n}\n\nfunction FieldContent({ className, ...props }: FieldContentProps) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn('gap-0.5 group/field-content flex flex-1 flex-col leading-snug', className)}\n {...props}\n />\n )\n}\n\nfunction FieldLabel({ className, htmlFor, id, ...props }: FieldLabelProps) {\n const fieldControlId = useFieldControlId(htmlFor)\n const fieldLabelId = useFieldLabelId()\n\n return (\n <Label\n data-slot=\"field-label\"\n id={id ?? fieldLabelId}\n htmlFor={fieldControlId}\n className={cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug',\n 'has-data-checked:bg-primary/5 has-data-checked:border-primary/30 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10',\n 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5',\n 'group-data-[disabled=true]/field:opacity-50',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldTitle({ className, ...props }: FieldTitleProps) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n 'gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50 flex w-fit items-center leading-snug',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({ className, ...props }: FieldDescriptionProps) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n 'text-muted-foreground text-left text-xs leading-normal font-normal',\n '[[data-variant=legend]+&]:-mt-1.5 group-has-data-horizontal/field:text-balance last:mt-0 nth-last-2:-mt-1',\n '[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldSeparator({ children, className, ...props }: FieldSeparatorProps) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('-my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2 relative', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"text-muted-foreground px-2 bg-background relative mx-auto block w-fit\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({ className, children, errors, ...props }: FieldErrorProps) {\n const content = useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()]\n\n if (uniqueErrors?.length === 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map((error) => error?.message && <li key={error.message}>{error.message}</li>)}\n </ul>\n )\n }, [children, errors])\n\n if (!content) {\n return null\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn('text-destructive text-sm font-normal', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n useFieldControlId,\n useFieldInvalid,\n useFieldLabelId\n}\n"],"mappings":"A,0UA2CA,MAAMA,EAAeC,EAAwC,IAAI,EAEjE,SAAS,kBAAkB,EAAa,CACtC,IAAMC,EAAUC,EAAWH,CAAY,EAEvC,OAAOI,GAAMF,GAAS,SACxB,CAEA,SAAS,iBAAkB,CACzB,OAAOC,EAAWH,CAAY,CAAC,EAAE,OACnC,CAGA,SAAS,gBAAgB,EAAoD,CAC3E,IAAMK,EAAUF,EAAWH,CAAY,CAAC,EAAE,QAE1C,OAAOM,IAAgBD,EAAU,GAAO,IAAA,GAC1C,CAEA,SAAS,SAAS,CAAE,YAAW,GAAGE,GAAwB,CACxD,MACE,kBAAC,WAAD,CACE,YAAU,YACV,UAAWC,EACT,sBACA,+EACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL,CAEA,SAAS,YAAY,CAAE,YAAW,UAAU,SAAU,GAAGA,GAA2B,CAClF,MACE,kBAAC,SAAD,CACE,YAAU,eACV,eAAcG,EACd,UAAWF,EAAG,kFAAmFC,CAAS,EAC1G,GAAIF,CACL,CAAA,CAEL,CAEA,SAAS,WAAW,CAAE,YAAW,GAAGA,GAA0B,CAC5D,MACE,kBAAC,MAAD,CACE,YAAU,cACV,UAAWC,EACT,sEACA,mEACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL,CAEA,MAAMI,EAAgBC,EAAI,qEAAsE,CAC9F,SAAU,CACR,YAAa,CACX,SAAU,wCACV,WACE,iLACF,WACE,+TACJ,CACF,EACA,gBAAiB,CACf,YAAa,UACf,CACF,CAAC,EAUD,SAAS,MAAM,CAAE,YAAW,cAAc,WAAY,UAAS,eAAgBC,EAAa,GAAGN,GAAqB,CAClH,IAAMO,EAAYC,EAAM,EAClBC,EAAUD,EAAM,EAChBE,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