@ttt-productions/ui-core 0.11.32 → 0.11.34

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 (218) hide show
  1. package/dist/browser/index.d.ts +2 -2
  2. package/dist/browser/index.js +1 -1
  3. package/dist/browser/index.js.map +1 -1
  4. package/dist/browser/reload-recovery-watch.d.ts +2 -2
  5. package/dist/browser/reload-recovery-watch.d.ts.map +1 -1
  6. package/dist/browser/reload-recovery-watch.js +5 -5
  7. package/dist/browser/reload-recovery-watch.js.map +1 -1
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +3 -3
  10. package/dist/index.js.map +1 -1
  11. package/dist/lib/format-numbers.js +2 -2
  12. package/dist/lib/format-numbers.js.map +1 -1
  13. package/dist/lib/reload-recovery.js +13 -13
  14. package/dist/lib/reload-recovery.js.map +1 -1
  15. package/dist/lib/utils.js.map +1 -1
  16. package/dist/react/components/accordion.d.ts +2 -2
  17. package/dist/react/components/accordion.d.ts.map +1 -1
  18. package/dist/react/components/accordion.js +8 -8
  19. package/dist/react/components/accordion.js.map +1 -1
  20. package/dist/react/components/action-row.d.ts +32 -0
  21. package/dist/react/components/action-row.d.ts.map +1 -0
  22. package/dist/react/components/action-row.js +16 -0
  23. package/dist/react/components/action-row.js.map +1 -0
  24. package/dist/react/components/alert-dialog.d.ts +2 -2
  25. package/dist/react/components/alert-dialog.d.ts.map +1 -1
  26. package/dist/react/components/alert-dialog.js +15 -15
  27. package/dist/react/components/alert-dialog.js.map +1 -1
  28. package/dist/react/components/alert.d.ts +2 -2
  29. package/dist/react/components/alert.d.ts.map +1 -1
  30. package/dist/react/components/alert.js +12 -12
  31. package/dist/react/components/alert.js.map +1 -1
  32. package/dist/react/components/avatar.d.ts +2 -2
  33. package/dist/react/components/avatar.d.ts.map +1 -1
  34. package/dist/react/components/avatar.js +7 -7
  35. package/dist/react/components/avatar.js.map +1 -1
  36. package/dist/react/components/badge.d.ts +2 -2
  37. package/dist/react/components/badge.d.ts.map +1 -1
  38. package/dist/react/components/badge.js +9 -9
  39. package/dist/react/components/badge.js.map +1 -1
  40. package/dist/react/components/button.d.ts +2 -2
  41. package/dist/react/components/button.d.ts.map +1 -1
  42. package/dist/react/components/button.js +28 -28
  43. package/dist/react/components/button.js.map +1 -1
  44. package/dist/react/components/card.d.ts +1 -1
  45. package/dist/react/components/card.d.ts.map +1 -1
  46. package/dist/react/components/card.js +15 -15
  47. package/dist/react/components/card.js.map +1 -1
  48. package/dist/react/components/checkbox.d.ts +2 -2
  49. package/dist/react/components/checkbox.d.ts.map +1 -1
  50. package/dist/react/components/checkbox.js +6 -6
  51. package/dist/react/components/checkbox.js.map +1 -1
  52. package/dist/react/components/collapsible.d.ts +1 -1
  53. package/dist/react/components/collapsible.d.ts.map +1 -1
  54. package/dist/react/components/collapsible.js +2 -2
  55. package/dist/react/components/collapsible.js.map +1 -1
  56. package/dist/react/components/consequence-dialog.d.ts.map +1 -1
  57. package/dist/react/components/consequence-dialog.js +4 -2
  58. package/dist/react/components/consequence-dialog.js.map +1 -1
  59. package/dist/react/components/date-picker.d.ts +1 -1
  60. package/dist/react/components/date-picker.d.ts.map +1 -1
  61. package/dist/react/components/date-picker.js +102 -66
  62. package/dist/react/components/date-picker.js.map +1 -1
  63. package/dist/react/components/date-time-picker.d.ts +1 -1
  64. package/dist/react/components/date-time-picker.d.ts.map +1 -1
  65. package/dist/react/components/date-time-picker.js +20 -18
  66. package/dist/react/components/date-time-picker.js.map +1 -1
  67. package/dist/react/components/dialog.d.ts +2 -2
  68. package/dist/react/components/dialog.d.ts.map +1 -1
  69. package/dist/react/components/dialog.js +14 -14
  70. package/dist/react/components/dialog.js.map +1 -1
  71. package/dist/react/components/dropdown-menu.d.ts +2 -2
  72. package/dist/react/components/dropdown-menu.d.ts.map +1 -1
  73. package/dist/react/components/dropdown-menu.js +23 -18
  74. package/dist/react/components/dropdown-menu.js.map +1 -1
  75. package/dist/react/components/end-of-list-indicator.d.ts +1 -1
  76. package/dist/react/components/end-of-list-indicator.js +3 -3
  77. package/dist/react/components/end-of-list-indicator.js.map +1 -1
  78. package/dist/react/components/form.d.ts +3 -3
  79. package/dist/react/components/form.d.ts.map +1 -1
  80. package/dist/react/components/form.js +17 -17
  81. package/dist/react/components/form.js.map +1 -1
  82. package/dist/react/components/format-control.d.ts +12 -5
  83. package/dist/react/components/format-control.d.ts.map +1 -1
  84. package/dist/react/components/format-control.js +23 -7
  85. package/dist/react/components/format-control.js.map +1 -1
  86. package/dist/react/components/input.d.ts +10 -10
  87. package/dist/react/components/input.d.ts.map +1 -1
  88. package/dist/react/components/input.js +11 -7
  89. package/dist/react/components/input.js.map +1 -1
  90. package/dist/react/components/label.d.ts +3 -3
  91. package/dist/react/components/label.d.ts.map +1 -1
  92. package/dist/react/components/label.js +6 -6
  93. package/dist/react/components/label.js.map +1 -1
  94. package/dist/react/components/layout/screen-adaptive-view.d.ts +2 -2
  95. package/dist/react/components/layout/screen-adaptive-view.d.ts.map +1 -1
  96. package/dist/react/components/layout/screen-adaptive-view.js +39 -35
  97. package/dist/react/components/layout/screen-adaptive-view.js.map +1 -1
  98. package/dist/react/components/list-pagination.d.ts +1 -1
  99. package/dist/react/components/list-pagination.js +10 -10
  100. package/dist/react/components/list-pagination.js.map +1 -1
  101. package/dist/react/components/menubar.d.ts +2 -2
  102. package/dist/react/components/menubar.d.ts.map +1 -1
  103. package/dist/react/components/menubar.js +17 -17
  104. package/dist/react/components/menubar.js.map +1 -1
  105. package/dist/react/components/opener-focus.d.ts +1 -1
  106. package/dist/react/components/opener-focus.d.ts.map +1 -1
  107. package/dist/react/components/opener-focus.js +3 -3
  108. package/dist/react/components/opener-focus.js.map +1 -1
  109. package/dist/react/components/pending-guard.d.ts +1 -1
  110. package/dist/react/components/pending-guard.d.ts.map +1 -1
  111. package/dist/react/components/pending-guard.js +1 -1
  112. package/dist/react/components/pending-guard.js.map +1 -1
  113. package/dist/react/components/popover.d.ts +2 -2
  114. package/dist/react/components/popover.d.ts.map +1 -1
  115. package/dist/react/components/popover.js +5 -5
  116. package/dist/react/components/popover.js.map +1 -1
  117. package/dist/react/components/progress.d.ts +2 -2
  118. package/dist/react/components/progress.d.ts.map +1 -1
  119. package/dist/react/components/progress.js +5 -5
  120. package/dist/react/components/progress.js.map +1 -1
  121. package/dist/react/components/radio-group.d.ts +2 -2
  122. package/dist/react/components/radio-group.d.ts.map +1 -1
  123. package/dist/react/components/radio-group.js +7 -7
  124. package/dist/react/components/radio-group.js.map +1 -1
  125. package/dist/react/components/relative-time.d.ts +1 -1
  126. package/dist/react/components/relative-time.d.ts.map +1 -1
  127. package/dist/react/components/relative-time.js +8 -7
  128. package/dist/react/components/relative-time.js.map +1 -1
  129. package/dist/react/components/reload-recovery-notice.d.ts +3 -3
  130. package/dist/react/components/reload-recovery-notice.js +7 -7
  131. package/dist/react/components/reload-recovery-notice.js.map +1 -1
  132. package/dist/react/components/scroll-area.d.ts +2 -2
  133. package/dist/react/components/scroll-area.d.ts.map +1 -1
  134. package/dist/react/components/scroll-area.js +6 -8
  135. package/dist/react/components/scroll-area.js.map +1 -1
  136. package/dist/react/components/scroll-to-top-button.d.ts +5 -5
  137. package/dist/react/components/scroll-to-top-button.js +9 -9
  138. package/dist/react/components/scroll-to-top-button.js.map +1 -1
  139. package/dist/react/components/search-dropdown.d.ts.map +1 -1
  140. package/dist/react/components/search-dropdown.js +8 -3
  141. package/dist/react/components/search-dropdown.js.map +1 -1
  142. package/dist/react/components/select.d.ts +2 -2
  143. package/dist/react/components/select.d.ts.map +1 -1
  144. package/dist/react/components/select.js +19 -19
  145. package/dist/react/components/select.js.map +1 -1
  146. package/dist/react/components/separator.d.ts +2 -2
  147. package/dist/react/components/separator.d.ts.map +1 -1
  148. package/dist/react/components/separator.js +5 -5
  149. package/dist/react/components/separator.js.map +1 -1
  150. package/dist/react/components/sheet.d.ts +3 -3
  151. package/dist/react/components/sheet.d.ts.map +1 -1
  152. package/dist/react/components/sheet.js +21 -21
  153. package/dist/react/components/sheet.js.map +1 -1
  154. package/dist/react/components/show-more-toggle.d.ts +2 -2
  155. package/dist/react/components/show-more-toggle.d.ts.map +1 -1
  156. package/dist/react/components/show-more-toggle.js +6 -6
  157. package/dist/react/components/show-more-toggle.js.map +1 -1
  158. package/dist/react/components/skeleton.d.ts +1 -1
  159. package/dist/react/components/skeleton.d.ts.map +1 -1
  160. package/dist/react/components/skeleton.js +3 -3
  161. package/dist/react/components/skeleton.js.map +1 -1
  162. package/dist/react/components/slider.d.ts +2 -2
  163. package/dist/react/components/slider.d.ts.map +1 -1
  164. package/dist/react/components/slider.js +5 -5
  165. package/dist/react/components/slider.js.map +1 -1
  166. package/dist/react/components/spinner.d.ts +1 -1
  167. package/dist/react/components/spinner.d.ts.map +1 -1
  168. package/dist/react/components/spinner.js +10 -10
  169. package/dist/react/components/spinner.js.map +1 -1
  170. package/dist/react/components/switch.d.ts +2 -2
  171. package/dist/react/components/switch.d.ts.map +1 -1
  172. package/dist/react/components/switch.js +13 -8
  173. package/dist/react/components/switch.js.map +1 -1
  174. package/dist/react/components/table.d.ts +2 -2
  175. package/dist/react/components/table.d.ts.map +1 -1
  176. package/dist/react/components/table.js +24 -24
  177. package/dist/react/components/table.js.map +1 -1
  178. package/dist/react/components/tabs.d.ts +2 -2
  179. package/dist/react/components/tabs.d.ts.map +1 -1
  180. package/dist/react/components/tabs.js +7 -7
  181. package/dist/react/components/tabs.js.map +1 -1
  182. package/dist/react/components/textarea.d.ts +5 -5
  183. package/dist/react/components/textarea.d.ts.map +1 -1
  184. package/dist/react/components/textarea.js +11 -7
  185. package/dist/react/components/textarea.js.map +1 -1
  186. package/dist/react/components/toast.d.ts +4 -4
  187. package/dist/react/components/toast.d.ts.map +1 -1
  188. package/dist/react/components/toast.js +25 -25
  189. package/dist/react/components/toast.js.map +1 -1
  190. package/dist/react/components/toaster.d.ts.map +1 -1
  191. package/dist/react/components/toaster.js +5 -5
  192. package/dist/react/components/toaster.js.map +1 -1
  193. package/dist/react/components/tooltip.d.ts +2 -2
  194. package/dist/react/components/tooltip.d.ts.map +1 -1
  195. package/dist/react/components/tooltip.js +5 -5
  196. package/dist/react/components/tooltip.js.map +1 -1
  197. package/dist/react/hooks/use-async-action.js +2 -2
  198. package/dist/react/hooks/use-async-action.js.map +1 -1
  199. package/dist/react/hooks/use-cursor-page.d.ts +1 -1
  200. package/dist/react/hooks/use-cursor-page.js +2 -2
  201. package/dist/react/hooks/use-cursor-page.js.map +1 -1
  202. package/dist/react/hooks/use-media-query.js +5 -5
  203. package/dist/react/hooks/use-media-query.js.map +1 -1
  204. package/dist/react/hooks/use-paged-list.js +2 -2
  205. package/dist/react/hooks/use-paged-list.js.map +1 -1
  206. package/dist/react/hooks/use-return-scroll.d.ts +1 -1
  207. package/dist/react/hooks/use-return-scroll.d.ts.map +1 -1
  208. package/dist/react/hooks/use-return-scroll.js +11 -11
  209. package/dist/react/hooks/use-return-scroll.js.map +1 -1
  210. package/dist/react/hooks/use-toast.d.ts +3 -3
  211. package/dist/react/hooks/use-toast.d.ts.map +1 -1
  212. package/dist/react/hooks/use-toast.js +17 -17
  213. package/dist/react/hooks/use-toast.js.map +1 -1
  214. package/dist/react/index.d.ts +74 -72
  215. package/dist/react/index.d.ts.map +1 -1
  216. package/dist/react/index.js +51 -50
  217. package/dist/react/index.js.map +1 -1
  218. package/package.json +8 -6
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
1
+ import * as React from 'react';
2
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
3
3
  interface ScrollAreaProps extends React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {
4
4
  viewportRef?: React.Ref<HTMLDivElement>;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../../src/react/components/scroll-area.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAA;AAIlE,UAAU,eACR,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC;IACvE,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;CACxC;AAED,QAAA,MAAM,UAAU,wFAkBd,CAAA;AAGF,QAAA,MAAM,SAAS,wKAmBb,CAAA;AAGF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAA"}
1
+ {"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../../src/react/components/scroll-area.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAInE,UAAU,eAAgB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC;IAC/F,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACzC;AAED,QAAA,MAAM,UAAU,wFAed,CAAC;AAGH,QAAA,MAAM,SAAS,wKAiBb,CAAC;AAGH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC"}
@@ -1,13 +1,11 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
5
- import { cn } from "../../lib/utils.js";
6
- const ScrollArea = React.forwardRef(({ className, children, viewportRef, ...props }, ref) => (_jsxs(ScrollAreaPrimitive.Root, { ref: ref, className: cn("relative overflow-hidden", className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { ref: viewportRef, className: "h-full w-full rounded-[inherit]", children: children }), _jsx(ScrollBar, {}), _jsx(ScrollAreaPrimitive.Corner, {})] })));
3
+ import * as React from 'react';
4
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
5
+ import { cn } from '../../lib/utils.js';
6
+ const ScrollArea = React.forwardRef(({ className, children, viewportRef, ...props }, ref) => (_jsxs(ScrollAreaPrimitive.Root, { ref: ref, className: cn('relative overflow-hidden', className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { ref: viewportRef, className: "h-full w-full rounded-[inherit]", children: children }), _jsx(ScrollBar, {}), _jsx(ScrollAreaPrimitive.Corner, {})] })));
7
7
  ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
8
- const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => (_jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, { ref: ref, orientation: orientation, className: cn("flex touch-none select-none transition-colors", orientation === "vertical" &&
9
- "h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" &&
10
- "h-2.5 flex-col border-t border-t-transparent p-[1px]", className), ...props, children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" }) })));
8
+ const ScrollBar = React.forwardRef(({ className, orientation = 'vertical', ...props }, ref) => (_jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, { ref: ref, orientation: orientation, className: cn('flex touch-none select-none transition-colors', orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent p-[1px]', orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent p-[1px]', className), ...props, children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" }) })));
11
9
  ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
12
10
  export { ScrollArea, ScrollBar };
13
11
  //# sourceMappingURL=scroll-area.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-area.js","sourceRoot":"","sources":["../../../src/react/components/scroll-area.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,mBAAmB,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reaPrimitive from \"@radix-ui/react-scroll-area\"\n\nimport { cn } from \"../../lib/utils.js\"\n\ninterface ScrollAreaProps\n extends React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {\n viewportRef?: React.Ref<HTMLDivElement>\n}\n\nconst ScrollArea = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n ScrollAreaProps\n>(({ className, children, viewportRef, ...props }, ref) => (\n <ScrollAreaPrimitive.Root\n ref={ref}\n className={cn(\"relative overflow-hidden\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={viewportRef}\n className=\"h-full w-full rounded-[inherit]\"\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n))\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName\n\nconst ScrollBar = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = \"vertical\", ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n \"flex touch-none select-none transition-colors\",\n orientation === \"vertical\" &&\n \"h-full w-2.5 border-l border-l-transparent p-[1px]\",\n orientation === \"horizontal\" &&\n \"h-2.5 flex-col border-t border-t-transparent p-[1px]\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border\" />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n))\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName\n\nexport { ScrollArea, ScrollBar }\n"]}
1
+ {"version":3,"file":"scroll-area.js","sourceRoot":"","sources":["../../../src/react/components/scroll-area.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAA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\n\nimport * as React from 'react';\nimport * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';\n\nimport { cn } from '../../lib/utils.js';\n\ninterface ScrollAreaProps extends React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {\n viewportRef?: React.Ref<HTMLDivElement>;\n}\n\nconst ScrollArea = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n ScrollAreaProps\n>(({ className, children, viewportRef, ...props }, ref) => (\n <ScrollAreaPrimitive.Root\n ref={ref}\n className={cn('relative overflow-hidden', className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport ref={viewportRef} className=\"h-full w-full rounded-[inherit]\">\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n));\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;\n\nconst ScrollBar = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = 'vertical', ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n 'flex touch-none select-none transition-colors',\n orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent p-[1px]',\n orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent p-[1px]',\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border\" />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n));\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;\n\nexport { ScrollArea, ScrollBar };\n"]}
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { type ButtonProps } from "./button.js";
1
+ import * as React from 'react';
2
+ import { type ButtonProps } from './button.js';
3
3
  /**
4
4
  * Standard button DOM props forwarded to the rendered element, minus the props
5
5
  * this component owns. Owned props are excluded (not just overridden) so a
@@ -11,7 +11,7 @@ import { type ButtonProps } from "./button.js";
11
11
  * {@link ScrollToTopButtonProps.scrollBehavior}). This mirrors how the sibling
12
12
  * `Button` destructures its owned `className` out of the forwarded `...props`.
13
13
  */
14
- type ScrollToTopButtonPassthrough = Omit<React.ComponentPropsWithoutRef<"button">, "className" | "onClick" | "aria-label" | "children">;
14
+ type ScrollToTopButtonPassthrough = Omit<React.ComponentPropsWithoutRef<'button'>, 'className' | 'onClick' | 'aria-label' | 'children'>;
15
15
  export interface ScrollToTopButtonProps extends ScrollToTopButtonPassthrough {
16
16
  /** Scroll threshold (px) before the button appears. Default 400. */
17
17
  threshold?: number;
@@ -22,9 +22,9 @@ export interface ScrollToTopButtonProps extends ScrollToTopButtonPassthrough {
22
22
  /** Optional override for the icon. */
23
23
  icon?: React.ReactNode;
24
24
  /** Button variant. Forwarded to the underlying Button. Defaults to Button's own default. */
25
- variant?: ButtonProps["variant"];
25
+ variant?: ButtonProps['variant'];
26
26
  /** Button size. Forwarded to the underlying Button. Default "icon". */
27
- size?: ButtonProps["size"];
27
+ size?: ButtonProps['size'];
28
28
  /**
29
29
  * Scroll behavior passed to `window.scrollTo`. Default "smooth". Pass "auto"
30
30
  * to skip the smooth animation (e.g. for a reduced-motion mode). The package
@@ -1,18 +1,18 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import { ChevronUp } from "lucide-react";
5
- import { Button } from "./button.js";
6
- import { cn } from "../../lib/utils.js";
7
- export function ScrollToTopButton({ threshold = 400, ariaLabel = "Scroll to top", className, icon, variant, size = "icon", scrollBehavior = "smooth", ...rest }) {
3
+ import * as React from 'react';
4
+ import { ChevronUp } from 'lucide-react';
5
+ import { Button } from './button.js';
6
+ import { cn } from '../../lib/utils.js';
7
+ export function ScrollToTopButton({ threshold = 400, ariaLabel = 'Scroll to top', className, icon, variant, size = 'icon', scrollBehavior = 'smooth', ...rest }) {
8
8
  const [isVisible, setIsVisible] = React.useState(false);
9
9
  React.useEffect(() => {
10
10
  const toggle = () => setIsVisible(window.scrollY > threshold);
11
11
  toggle();
12
- window.addEventListener("scroll", toggle, { passive: true });
13
- return () => window.removeEventListener("scroll", toggle);
12
+ window.addEventListener('scroll', toggle, { passive: true });
13
+ return () => window.removeEventListener('scroll', toggle);
14
14
  }, [threshold]);
15
15
  const onClick = () => window.scrollTo({ top: 0, behavior: scrollBehavior });
16
- return (_jsx(Button, { ...rest, variant: variant, size: size, onClick: onClick, "aria-label": ariaLabel, className: cn("fixed bottom-24 left-1/2 -translate-x-1/2 z-50 rounded-full elevation-raised transition-opacity duration-300", isVisible ? "opacity-100" : "opacity-0 pointer-events-none", className), children: icon ?? _jsx(ChevronUp, { className: "h-5 w-5" }) }));
16
+ return (_jsx(Button, { ...rest, variant: variant, size: size, onClick: onClick, "aria-label": ariaLabel, className: cn('fixed bottom-24 left-1/2 -translate-x-1/2 z-50 rounded-full elevation-raised transition-opacity duration-[var(--motion-base)] ease-[var(--motion-ease)]', isVisible ? 'opacity-100' : 'opacity-0 pointer-events-none', className), children: icon ?? _jsx(ChevronUp, { className: "h-5 w-5" }) }));
17
17
  }
18
18
  //# sourceMappingURL=scroll-to-top-button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-to-top-button.js","sourceRoot":"","sources":["../../../src/react/components/scroll-to-top-button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAoB,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AA0CxC,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,GAAG,GAAG,EACf,SAAS,GAAG,eAAe,EAC3B,SAAS,EACT,IAAI,EACJ,OAAO,EACP,IAAI,GAAG,MAAM,EACb,cAAc,GAAG,QAAQ,EACzB,GAAG,IAAI,EACgB;IACvB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;QAC9D,MAAM,EAAE,CAAC;QACT,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC;IAE5E,OAAO,CACL,KAAC,MAAM,OACD,IAAI,EACR,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,gBACJ,SAAS,EACrB,SAAS,EAAE,EAAE,CACX,8GAA8G,EAC9G,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,+BAA+B,EAC3D,SAAS,CACV,YAEA,IAAI,IAAI,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,GAAG,GACnC,CACV,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronUp } from \"lucide-react\";\nimport { Button, type ButtonProps } from \"./button.js\";\nimport { cn } from \"../../lib/utils.js\";\n\n/**\n * Standard button DOM props forwarded to the rendered element, minus the props\n * this component owns. Owned props are excluded (not just overridden) so a\n * consumer can never route them through the passthrough channel: `aria-label`\n * is set via {@link ScrollToTopButtonProps.ariaLabel}, extra classes via the\n * merge-aware {@link ScrollToTopButtonProps.className}, content via\n * {@link ScrollToTopButtonProps.icon}, and `onClick` is fixed to scroll-to-top\n * (its scroll animation configurable via\n * {@link ScrollToTopButtonProps.scrollBehavior}). This mirrors how the sibling\n * `Button` destructures its owned `className` out of the forwarded `...props`.\n */\ntype ScrollToTopButtonPassthrough = Omit<\n React.ComponentPropsWithoutRef<\"button\">,\n \"className\" | \"onClick\" | \"aria-label\" | \"children\"\n>;\n\nexport interface ScrollToTopButtonProps extends ScrollToTopButtonPassthrough {\n /** Scroll threshold (px) before the button appears. Default 400. */\n threshold?: number;\n /** Aria label. Default \"Scroll to top\". */\n ariaLabel?: string;\n /** Optional extra classes for the button. Merged with the component's own classes. */\n className?: string;\n /** Optional override for the icon. */\n icon?: React.ReactNode;\n /** Button variant. Forwarded to the underlying Button. Defaults to Button's own default. */\n variant?: ButtonProps[\"variant\"];\n /** Button size. Forwarded to the underlying Button. Default \"icon\". */\n size?: ButtonProps[\"size\"];\n /**\n * Scroll behavior passed to `window.scrollTo`. Default \"smooth\". Pass \"auto\"\n * to skip the smooth animation (e.g. for a reduced-motion mode). The package\n * stays motion-policy agnostic: the consumer decides what to pass here — an\n * explicit JS `behavior: \"smooth\"` is not overridden by a CSS\n * `scroll-behavior` kill-switch, so an app-level reduced-motion mode must\n * pass \"auto\" to actually stop the animation.\n */\n scrollBehavior?: ScrollBehavior;\n}\n\nexport function ScrollToTopButton({\n threshold = 400,\n ariaLabel = \"Scroll to top\",\n className,\n icon,\n variant,\n size = \"icon\",\n scrollBehavior = \"smooth\",\n ...rest\n}: ScrollToTopButtonProps) {\n const [isVisible, setIsVisible] = React.useState(false);\n\n React.useEffect(() => {\n const toggle = () => setIsVisible(window.scrollY > threshold);\n toggle();\n window.addEventListener(\"scroll\", toggle, { passive: true });\n return () => window.removeEventListener(\"scroll\", toggle);\n }, [threshold]);\n\n const onClick = () => window.scrollTo({ top: 0, behavior: scrollBehavior });\n\n return (\n <Button\n {...rest}\n variant={variant}\n size={size}\n onClick={onClick}\n aria-label={ariaLabel}\n className={cn(\n \"fixed bottom-24 left-1/2 -translate-x-1/2 z-50 rounded-full elevation-raised transition-opacity duration-300\",\n isVisible ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n className,\n )}\n >\n {icon ?? <ChevronUp className=\"h-5 w-5\" />}\n </Button>\n );\n}\n"]}
1
+ {"version":3,"file":"scroll-to-top-button.js","sourceRoot":"","sources":["../../../src/react/components/scroll-to-top-button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAoB,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AA0CxC,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,GAAG,GAAG,EACf,SAAS,GAAG,eAAe,EAC3B,SAAS,EACT,IAAI,EACJ,OAAO,EACP,IAAI,GAAG,MAAM,EACb,cAAc,GAAG,QAAQ,EACzB,GAAG,IAAI,EACgB;IACvB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;QAC9D,MAAM,EAAE,CAAC;QACT,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC;IAE5E,OAAO,CACL,KAAC,MAAM,OACD,IAAI,EACR,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,gBACJ,SAAS,EACrB,SAAS,EAAE,EAAE,CACX,yJAAyJ,EACzJ,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,+BAA+B,EAC3D,SAAS,CACV,YAEA,IAAI,IAAI,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,GAAG,GACnC,CACV,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronUp } from 'lucide-react';\nimport { Button, type ButtonProps } from './button.js';\nimport { cn } from '../../lib/utils.js';\n\n/**\n * Standard button DOM props forwarded to the rendered element, minus the props\n * this component owns. Owned props are excluded (not just overridden) so a\n * consumer can never route them through the passthrough channel: `aria-label`\n * is set via {@link ScrollToTopButtonProps.ariaLabel}, extra classes via the\n * merge-aware {@link ScrollToTopButtonProps.className}, content via\n * {@link ScrollToTopButtonProps.icon}, and `onClick` is fixed to scroll-to-top\n * (its scroll animation configurable via\n * {@link ScrollToTopButtonProps.scrollBehavior}). This mirrors how the sibling\n * `Button` destructures its owned `className` out of the forwarded `...props`.\n */\ntype ScrollToTopButtonPassthrough = Omit<\n React.ComponentPropsWithoutRef<'button'>,\n 'className' | 'onClick' | 'aria-label' | 'children'\n>;\n\nexport interface ScrollToTopButtonProps extends ScrollToTopButtonPassthrough {\n /** Scroll threshold (px) before the button appears. Default 400. */\n threshold?: number;\n /** Aria label. Default \"Scroll to top\". */\n ariaLabel?: string;\n /** Optional extra classes for the button. Merged with the component's own classes. */\n className?: string;\n /** Optional override for the icon. */\n icon?: React.ReactNode;\n /** Button variant. Forwarded to the underlying Button. Defaults to Button's own default. */\n variant?: ButtonProps['variant'];\n /** Button size. Forwarded to the underlying Button. Default \"icon\". */\n size?: ButtonProps['size'];\n /**\n * Scroll behavior passed to `window.scrollTo`. Default \"smooth\". Pass \"auto\"\n * to skip the smooth animation (e.g. for a reduced-motion mode). The package\n * stays motion-policy agnostic: the consumer decides what to pass here — an\n * explicit JS `behavior: \"smooth\"` is not overridden by a CSS\n * `scroll-behavior` kill-switch, so an app-level reduced-motion mode must\n * pass \"auto\" to actually stop the animation.\n */\n scrollBehavior?: ScrollBehavior;\n}\n\nexport function ScrollToTopButton({\n threshold = 400,\n ariaLabel = 'Scroll to top',\n className,\n icon,\n variant,\n size = 'icon',\n scrollBehavior = 'smooth',\n ...rest\n}: ScrollToTopButtonProps) {\n const [isVisible, setIsVisible] = React.useState(false);\n\n React.useEffect(() => {\n const toggle = () => setIsVisible(window.scrollY > threshold);\n toggle();\n window.addEventListener('scroll', toggle, { passive: true });\n return () => window.removeEventListener('scroll', toggle);\n }, [threshold]);\n\n const onClick = () => window.scrollTo({ top: 0, behavior: scrollBehavior });\n\n return (\n <Button\n {...rest}\n variant={variant}\n size={size}\n onClick={onClick}\n aria-label={ariaLabel}\n className={cn(\n 'fixed bottom-24 left-1/2 -translate-x-1/2 z-50 rounded-full elevation-raised transition-opacity duration-[var(--motion-base)] ease-[var(--motion-ease)]',\n isVisible ? 'opacity-100' : 'opacity-0 pointer-events-none',\n className,\n )}\n >\n {icon ?? <ChevronUp className=\"h-5 w-5\" />}\n </Button>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"search-dropdown.d.ts","sourceRoot":"","sources":["../../../src/react/components/search-dropdown.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IA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,QAAQ,EACR,YAAY,EACZ,YAAiC,EACjC,mBAAgD,EAChD,YAAY,GACb,EAAE,mBAAmB,CAAC,CAAC,CAAC,+BAkMxB"}
1
+ {"version":3,"file":"search-dropdown.d.ts","sourceRoot":"","sources":["../../../src/react/components/search-dropdown.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,2BAA2B;IAC3B,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,oBAAoB;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,8GAA8G;IAC9G,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,CAAC,SAAS,CAAC;IACjD,uCAAuC;IACvC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAC9B,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+FAA+F;IAC/F,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,6CAA6C;IAC7C,YAAY,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;CAC7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAChC,KAAK,EACL,aAAa,EACb,OAAO,EACP,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,WAAyB,EACzB,KAAK,EACL,SAAS,EACT,QAAgB,EAChB,IAAqC,EACrC,QAAQ,EACR,YAAY,EACZ,YAAiC,EACjC,mBAAgD,EAChD,YAAY,GACb,EAAE,mBAAmB,CAAC,CAAC,CAAC,+BA2MxB"}
@@ -5,7 +5,7 @@ import { Input } from './input.js';
5
5
  import { Label } from './label.js';
6
6
  import { X, Search } from 'lucide-react';
7
7
  import { Spinner } from './spinner.js';
8
- import { cn } from "../../lib/utils.js";
8
+ import { cn } from '../../lib/utils.js';
9
9
  function defaultResultsAnnouncement(count) {
10
10
  return count === 1 ? '1 result' : `${count} results`;
11
11
  }
@@ -56,7 +56,9 @@ export function SearchDropdown({ value, onValueChange, results, isLoading, error
56
56
  const isOpen = searchable && dismissedFor !== value;
57
57
  const failed = error !== null && error !== undefined;
58
58
  const showOptions = isOpen && !failed && !isLoading && results.length > 0;
59
- const activeIndex = showOptions && highlight && highlight.value === value && highlight.index < results.length ? highlight.index : -1;
59
+ const activeIndex = showOptions && highlight && highlight.value === value && highlight.index < results.length
60
+ ? highlight.index
61
+ : -1;
60
62
  const showHint = value.length > 0 && !searchable;
61
63
  const announcement = !isOpen || failed
62
64
  ? ''
@@ -92,7 +94,10 @@ export function SearchDropdown({ value, onValueChange, results, isLoading, error
92
94
  }
93
95
  if (!showOptions)
94
96
  return;
95
- setHighlight({ value, index: activeIndex < results.length - 1 ? activeIndex + 1 : activeIndex });
97
+ setHighlight({
98
+ value,
99
+ index: activeIndex < results.length - 1 ? activeIndex + 1 : activeIndex,
100
+ });
96
101
  break;
97
102
  case 'ArrowUp':
98
103
  if (!showOptions)
@@ -1 +1 @@
1
- {"version":3,"file":"search-dropdown.js","sourceRoot":"","sources":["../../../src/react/components/search-dropdown.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,SAAS,0BAA0B,CAAC,KAAa;IAC/C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,UAAU,CAAC;AACvD,CAAC;AA+CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,cAAc,CAAI,EAChC,KAAK,EACL,aAAa,EACb,OAAO,EACP,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,WAAW,GAAG,WAAW,EACzB,KAAK,EACL,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,IAAI,GAAG,KAAC,MAAM,IAAC,SAAS,EAAC,SAAS,GAAG,EACrC,QAAQ,EACR,YAAY,EACZ,YAAY,GAAG,kBAAkB,EACjC,mBAAmB,GAAG,0BAA0B,EAChD,YAAY,GACW;IACvB,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,GAAG,MAAM,QAAQ,CAAC;IAClC,MAAM,OAAO,GAAG,GAAG,MAAM,QAAQ,CAAC;IAClC,MAAM,SAAS,GAAG,GAAG,MAAM,UAAU,CAAC;IAC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Ref, useEffect, useId } from 'react';\nimport { Input } from './input.js';\nimport { Label } from './label.js';\nimport { X, Search } from 'lucide-react';\nimport { Spinner } from './spinner.js';\nimport { cn } from \"../../lib/utils.js\";\n\nfunction defaultResultsAnnouncement(count: number): string {\n return count === 1 ? '1 result' : `${count} results`;\n}\n\nexport interface SearchDropdownProps<T> {\n /** Current search value */\n value: string;\n /** Called when search value changes */\n onValueChange: (value: string) => void;\n /** Search results array */\n results: T[];\n /** Loading state */\n isLoading: boolean;\n /** The search's failure exactly as the data layer reported it; `null` or `undefined` when it did not fail. */\n error: unknown;\n /**\n * Renders a failed search inside the open dropdown. The consumer owns the failure's words and any\n * retry, so the dropdown never shows a failure state of its own.\n */\n renderError: (error: unknown) => React.ReactNode;\n /** Called when a result is selected */\n onSelect: (result: T) => void;\n /** Called when search is cleared (after the value has been reset). Optional notification hook. */\n onClear?: () => void;\n /** Placeholder text */\n placeholder?: string;\n /** Label for the input */\n label?: string;\n /** Custom className */\n className?: string;\n /** Disabled state */\n disabled?: boolean;\n /** Icon to show in input (default: Search) */\n icon?: React.ReactNode;\n /**\n * The search rule of the hook behind the dropdown, passed from that hook rather than restated:\n * `isSearchable(value)` decides whether the value is searched (and the dropdown opens), and\n * `minChars` is the minimum the below-minimum hint names.\n */\n minChars: number;\n isSearchable: (value: string) => boolean;\n /** Message to show when no results found */\n emptyMessage?: string;\n /** What assistive technology hears when results arrive (default: \"1 result\" / \"N results\"). */\n resultsAnnouncement?: (count: number) => string;\n /** Custom render function for each result */\n renderResult: (result: T, index: number) => React.ReactNode;\n}\n\n/**\n * A search box with a results dropdown, following the combobox pattern: the input keeps focus, the\n * results are a listbox, and the arrow-highlighted result is the input's active descendant. Every\n * instance carries its own ids, so several can share a page.\n *\n * Once the value is long enough the dropdown stays open through every settled state — results, an\n * empty answer, or a failure — until the user dismisses it (Escape, a click outside, a selection).\n * A dismissal holds for the value it was made on: re-rendered props never reopen it, while typing,\n * a new value, or ArrowDown does.\n *\n * @example\n * ```tsx\n * <SearchDropdown<User>\n * value={searchValue}\n * onValueChange={setSearchValue}\n * results={users}\n * isLoading={isLoading}\n * error={error}\n * renderError={(error) => <MyErrorState error={error} />}\n * minChars={SEARCH_MIN_LENGTH}\n * isSearchable={isSearchableText}\n * onSelect={(user) => console.log(user)}\n * placeholder=\"Search users...\"\n * renderResult={(user) => (\n * <div>{user.displayName}</div>\n * )}\n * />\n * ```\n */\nexport function SearchDropdown<T>({\n value,\n onValueChange,\n results,\n isLoading,\n error,\n renderError,\n onSelect,\n onClear,\n placeholder = 'Search...',\n label,\n className,\n disabled = false,\n icon = <Search className=\"h-4 w-4\" />,\n minChars,\n isSearchable,\n emptyMessage = 'No results found',\n resultsAnnouncement = defaultResultsAnnouncement,\n renderResult,\n}: SearchDropdownProps<T>) {\n const baseId = useId();\n const inputId = `${baseId}-input`;\n const labelId = `${baseId}-label`;\n const listboxId = `${baseId}-listbox`;\n const panelId = `${baseId}-panel`;\n const hintId = `${baseId}-hint`;\n const optionId = (index: number) => `${baseId}-option-${index}`;\n\n const [dismissedFor, setDismissedFor] = useState<string | null>(null);\n // The highlight belongs to the value it was made on, so a new query starts with none, while a\n // refreshed result list for the same query keeps it.\n const [highlight, setHighlight] = useState<{ value: string; index: number } | null>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const searchable = isSearchable(value);\n const isOpen = searchable && dismissedFor !== value;\n const failed = error !== null && error !== undefined;\n const showOptions = isOpen && !failed && !isLoading && results.length > 0;\n const activeIndex =\n showOptions && highlight && highlight.value === value && highlight.index < results.length ? highlight.index : -1;\n const showHint = value.length > 0 && !searchable;\n const announcement =\n !isOpen || failed\n ? ''\n : isLoading\n ? 'Searching...'\n : results.length === 0\n ? emptyMessage\n : resultsAnnouncement(results.length);\n\n useEffect(() => {\n if (!isOpen) return;\n const handleClickOutside = (event: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(event.target as Node)) {\n setDismissedFor(value);\n }\n };\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, [isOpen, value]);\n\n const select = (result: T) => {\n onSelect(result);\n setDismissedFor(value);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n switch (e.key) {\n case 'ArrowDown':\n if (!searchable) return;\n e.preventDefault();\n if (!isOpen) {\n setDismissedFor(null);\n return;\n }\n if (!showOptions) return;\n setHighlight({ value, index: activeIndex < results.length - 1 ? activeIndex + 1 : activeIndex });\n break;\n case 'ArrowUp':\n if (!showOptions) return;\n e.preventDefault();\n setHighlight({ value, index: activeIndex > 0 ? activeIndex - 1 : 0 });\n break;\n case 'Enter':\n if (activeIndex < 0) return;\n e.preventDefault();\n select(results[activeIndex]);\n break;\n case 'Escape':\n // Escape never falls through to the search field's own clear, which would skip onClear:\n // it closes an open dropdown, and clears a closed one through handleClear.\n e.preventDefault();\n if (isOpen) setDismissedFor(value);\n else if (value) handleClear();\n break;\n }\n };\n\n const handleClear = () => {\n onValueChange('');\n onClear?.();\n setDismissedFor(null);\n inputRef.current?.focus();\n };\n\n return (\n <div ref={containerRef} className={cn('relative', className)}>\n {label && (\n <Label id={labelId} htmlFor={inputId} className=\"mb-2 block\">\n {label}\n </Label>\n )}\n\n <div className=\"relative\">\n <div className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\" aria-hidden=\"true\">\n {icon}\n </div>\n\n <Input\n ref={inputRef}\n id={inputId}\n type=\"search\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? (showOptions ? listboxId : panelId) : undefined}\n aria-activedescendant={activeIndex >= 0 ? optionId(activeIndex) : undefined}\n aria-describedby={showHint ? hintId : undefined}\n autoComplete=\"off\"\n value={value}\n onChange={(e) => {\n setDismissedFor(null);\n onValueChange(e.target.value);\n }}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled}\n className=\"pl-10 pr-10 [&::-webkit-search-cancel-button]:appearance-none\"\n />\n\n <div className=\"absolute right-3 top-1/2 -translate-y-1/2\">\n {isLoading ? (\n <Spinner size=\"xs\" className=\"text-muted-foreground\" />\n ) : value ? (\n <button\n type=\"button\"\n onClick={handleClear}\n className=\"text-muted-foreground hover:text-foreground transition-colors\"\n aria-label=\"Clear search\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n ) : null}\n </div>\n </div>\n\n {isOpen && (\n <div id={panelId} className=\"absolute z-50 w-full mt-1 bg-popover border rounded-md elevation-raised max-h-60 overflow-auto\">\n {failed ? (\n renderError(error)\n ) : isLoading ? (\n <div className=\"px-3 py-2 text-sm text-muted-foreground flex items-center gap-2\">\n <Spinner size=\"xs\" />\n Searching...\n </div>\n ) : results.length === 0 ? (\n <div className=\"px-3 py-2 text-sm text-muted-foreground\">\n {emptyMessage}\n </div>\n ) : (\n <div\n role=\"listbox\"\n id={listboxId}\n aria-labelledby={label ? labelId : undefined}\n aria-label={label ? undefined : placeholder}\n >\n {results.map((result, index) => (\n <div\n key={index}\n id={optionId(index)}\n role=\"option\"\n aria-selected={index === activeIndex}\n // Keeps focus in the input, where the combobox's keyboard handling lives.\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => select(result)}\n onMouseEnter={() => setHighlight({ value, index })}\n className={cn(\n 'w-full text-left transition-colors cursor-pointer hover:bg-accent',\n index === activeIndex && 'bg-accent'\n )}\n >\n {renderResult(result, index)}\n </div>\n ))}\n </div>\n )}\n </div>\n )}\n\n {/* Always mounted, so every change of the open panel's state is announced. A failure is\n announced by the consumer's renderError. */}\n <div role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {announcement}\n </div>\n\n {showHint && (\n <p id={hintId} className=\"text-xs text-muted-foreground mt-1\">\n Type at least {minChars} characters to search\n </p>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"search-dropdown.js","sourceRoot":"","sources":["../../../src/react/components/search-dropdown.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,O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K,SAAS,EAAC,yCAAyC,YAAE,YAAY,GAAO,CAC9E,CAAC,CAAC,CAAC,CACF,cACE,IAAI,EAAC,SAAS,EACd,EAAE,EAAE,SAAS,qBACI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,gBAChC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,YAE1C,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9B,cAEE,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,EACnB,IAAI,EAAC,QAAQ,mBACE,KAAK,KAAK,WAAW;wBACpC,0EAA0E;wBAC1E,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAC7B,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAClD,SAAS,EAAE,EAAE,CACX,mEAAmE,EACnE,KAAK,KAAK,WAAW,IAAI,WAAW,CACrC,YAEA,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,IAbvB,KAAK,CAcN,CACP,CAAC,GACE,CACP,GACG,CACP,EAID,cAAK,IAAI,EAAC,QAAQ,eAAW,QAAQ,EAAC,SAAS,EAAC,SAAS,YACtD,YAAY,GACT,EAEL,QAAQ,IAAI,CACX,aAAG,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC,oCAAoC,+BAC5C,QAAQ,6BACrB,CACL,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useState, useRef, useEffect, useId } from 'react';\nimport { Input } from './input.js';\nimport { Label } from './label.js';\nimport { X, Search } from 'lucide-react';\nimport { Spinner } from './spinner.js';\nimport { cn } from '../../lib/utils.js';\n\nfunction defaultResultsAnnouncement(count: number): string {\n return count === 1 ? '1 result' : `${count} results`;\n}\n\nexport interface SearchDropdownProps<T> {\n /** Current search value */\n value: string;\n /** Called when search value changes */\n onValueChange: (value: string) => void;\n /** Search results array */\n results: T[];\n /** Loading state */\n isLoading: boolean;\n /** The search's failure exactly as the data layer reported it; `null` or `undefined` when it did not fail. */\n error: unknown;\n /**\n * Renders a failed search inside the open dropdown. The consumer owns the failure's words and any\n * retry, so the dropdown never shows a failure state of its own.\n */\n renderError: (error: unknown) => React.ReactNode;\n /** Called when a result is selected */\n onSelect: (result: T) => void;\n /** Called when search is cleared (after the value has been reset). Optional notification hook. */\n onClear?: () => void;\n /** Placeholder text */\n placeholder?: string;\n /** Label for the input */\n label?: string;\n /** Custom className */\n className?: string;\n /** Disabled state */\n disabled?: boolean;\n /** Icon to show in input (default: Search) */\n icon?: React.ReactNode;\n /**\n * The search rule of the hook behind the dropdown, passed from that hook rather than restated:\n * `isSearchable(value)` decides whether the value is searched (and the dropdown opens), and\n * `minChars` is the minimum the below-minimum hint names.\n */\n minChars: number;\n isSearchable: (value: string) => boolean;\n /** Message to show when no results found */\n emptyMessage?: string;\n /** What assistive technology hears when results arrive (default: \"1 result\" / \"N results\"). */\n resultsAnnouncement?: (count: number) => string;\n /** Custom render function for each result */\n renderResult: (result: T, index: number) => React.ReactNode;\n}\n\n/**\n * A search box with a results dropdown, following the combobox pattern: the input keeps focus, the\n * results are a listbox, and the arrow-highlighted result is the input's active descendant. Every\n * instance carries its own ids, so several can share a page.\n *\n * Once the value is long enough the dropdown stays open through every settled state — results, an\n * empty answer, or a failure — until the user dismisses it (Escape, a click outside, a selection).\n * A dismissal holds for the value it was made on: re-rendered props never reopen it, while typing,\n * a new value, or ArrowDown does.\n *\n * @example\n * ```tsx\n * <SearchDropdown<User>\n * value={searchValue}\n * onValueChange={setSearchValue}\n * results={users}\n * isLoading={isLoading}\n * error={error}\n * renderError={(error) => <MyErrorState error={error} />}\n * minChars={SEARCH_MIN_LENGTH}\n * isSearchable={isSearchableText}\n * onSelect={(user) => console.log(user)}\n * placeholder=\"Search users...\"\n * renderResult={(user) => (\n * <div>{user.displayName}</div>\n * )}\n * />\n * ```\n */\nexport function SearchDropdown<T>({\n value,\n onValueChange,\n results,\n isLoading,\n error,\n renderError,\n onSelect,\n onClear,\n placeholder = 'Search...',\n label,\n className,\n disabled = false,\n icon = <Search className=\"h-4 w-4\" />,\n minChars,\n isSearchable,\n emptyMessage = 'No results found',\n resultsAnnouncement = defaultResultsAnnouncement,\n renderResult,\n}: SearchDropdownProps<T>) {\n const baseId = useId();\n const inputId = `${baseId}-input`;\n const labelId = `${baseId}-label`;\n const listboxId = `${baseId}-listbox`;\n const panelId = `${baseId}-panel`;\n const hintId = `${baseId}-hint`;\n const optionId = (index: number) => `${baseId}-option-${index}`;\n\n const [dismissedFor, setDismissedFor] = useState<string | null>(null);\n // The highlight belongs to the value it was made on, so a new query starts with none, while a\n // refreshed result list for the same query keeps it.\n const [highlight, setHighlight] = useState<{ value: string; index: number } | null>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const searchable = isSearchable(value);\n const isOpen = searchable && dismissedFor !== value;\n const failed = error !== null && error !== undefined;\n const showOptions = isOpen && !failed && !isLoading && results.length > 0;\n const activeIndex =\n showOptions && highlight && highlight.value === value && highlight.index < results.length\n ? highlight.index\n : -1;\n const showHint = value.length > 0 && !searchable;\n const announcement =\n !isOpen || failed\n ? ''\n : isLoading\n ? 'Searching...'\n : results.length === 0\n ? emptyMessage\n : resultsAnnouncement(results.length);\n\n useEffect(() => {\n if (!isOpen) return;\n const handleClickOutside = (event: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(event.target as Node)) {\n setDismissedFor(value);\n }\n };\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, [isOpen, value]);\n\n const select = (result: T) => {\n onSelect(result);\n setDismissedFor(value);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n switch (e.key) {\n case 'ArrowDown':\n if (!searchable) return;\n e.preventDefault();\n if (!isOpen) {\n setDismissedFor(null);\n return;\n }\n if (!showOptions) return;\n setHighlight({\n value,\n index: activeIndex < results.length - 1 ? activeIndex + 1 : activeIndex,\n });\n break;\n case 'ArrowUp':\n if (!showOptions) return;\n e.preventDefault();\n setHighlight({ value, index: activeIndex > 0 ? activeIndex - 1 : 0 });\n break;\n case 'Enter':\n if (activeIndex < 0) return;\n e.preventDefault();\n select(results[activeIndex]);\n break;\n case 'Escape':\n // Escape never falls through to the search field's own clear, which would skip onClear:\n // it closes an open dropdown, and clears a closed one through handleClear.\n e.preventDefault();\n if (isOpen) setDismissedFor(value);\n else if (value) handleClear();\n break;\n }\n };\n\n const handleClear = () => {\n onValueChange('');\n onClear?.();\n setDismissedFor(null);\n inputRef.current?.focus();\n };\n\n return (\n <div ref={containerRef} className={cn('relative', className)}>\n {label && (\n <Label id={labelId} htmlFor={inputId} className=\"mb-2 block\">\n {label}\n </Label>\n )}\n\n <div className=\"relative\">\n <div\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n aria-hidden=\"true\"\n >\n {icon}\n </div>\n\n <Input\n ref={inputRef}\n id={inputId}\n type=\"search\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? (showOptions ? listboxId : panelId) : undefined}\n aria-activedescendant={activeIndex >= 0 ? optionId(activeIndex) : undefined}\n aria-describedby={showHint ? hintId : undefined}\n autoComplete=\"off\"\n value={value}\n onChange={(e) => {\n setDismissedFor(null);\n onValueChange(e.target.value);\n }}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled}\n className=\"pl-10 pr-10 [&::-webkit-search-cancel-button]:appearance-none\"\n />\n\n <div className=\"absolute right-3 top-1/2 -translate-y-1/2\">\n {isLoading ? (\n <Spinner size=\"xs\" className=\"text-muted-foreground\" />\n ) : value ? (\n <button\n type=\"button\"\n onClick={handleClear}\n className=\"text-muted-foreground hover:text-foreground transition-colors\"\n aria-label=\"Clear search\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n ) : null}\n </div>\n </div>\n\n {isOpen && (\n <div\n id={panelId}\n className=\"absolute z-50 w-full mt-1 bg-popover border rounded-md elevation-raised max-h-60 overflow-auto\"\n >\n {failed ? (\n renderError(error)\n ) : isLoading ? (\n <div className=\"px-3 py-2 text-sm text-muted-foreground flex items-center gap-2\">\n <Spinner size=\"xs\" />\n Searching...\n </div>\n ) : results.length === 0 ? (\n <div className=\"px-3 py-2 text-sm text-muted-foreground\">{emptyMessage}</div>\n ) : (\n <div\n role=\"listbox\"\n id={listboxId}\n aria-labelledby={label ? labelId : undefined}\n aria-label={label ? undefined : placeholder}\n >\n {results.map((result, index) => (\n <div\n key={index}\n id={optionId(index)}\n role=\"option\"\n aria-selected={index === activeIndex}\n // Keeps focus in the input, where the combobox's keyboard handling lives.\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => select(result)}\n onMouseEnter={() => setHighlight({ value, index })}\n className={cn(\n 'w-full text-left transition-colors cursor-pointer hover:bg-accent',\n index === activeIndex && 'bg-accent',\n )}\n >\n {renderResult(result, index)}\n </div>\n ))}\n </div>\n )}\n </div>\n )}\n\n {/* Always mounted, so every change of the open panel's state is announced. A failure is\n announced by the consumer's renderError. */}\n <div role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {announcement}\n </div>\n\n {showHint && (\n <p id={hintId} className=\"text-xs text-muted-foreground mt-1\">\n Type at least {minChars} characters to search\n </p>\n )}\n </div>\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import * as SelectPrimitive from "@radix-ui/react-select";
1
+ import * as React from 'react';
2
+ import * as SelectPrimitive from '@radix-ui/react-select';
3
3
  declare const Select: React.FC<SelectPrimitive.SelectProps>;
4
4
  declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
5
5
  declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/react/components/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAOzD,QAAA,MAAM,MAAM,uCAAuB,CAAA;AACnC,QAAA,MAAM,WAAW,yGAAwB,CAAA;AACzC,QAAA,MAAM,WAAW,0GAAwB,CAAA;AAIzC,QAAA,MAAM,aAAa;IAGf;;;;;;OAMG;cACO,OAAO;2CA+BnB,CAAA;AAGF,QAAA,MAAM,oBAAoB,qKAWxB,CAAA;AAGF,QAAA,MAAM,sBAAsB,uKAW1B,CAAA;AAGF,QAAA,MAAM,aAAa,8JA6BjB,CAAA;AAGF,QAAA,MAAM,WAAW,4JASf,CAAA;AAGF,QAAA,MAAM,UAAU,2JAoBd,CAAA;AAGF,QAAA,MAAM,eAAe,gKASnB,CAAA;AAGF,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAA"}
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/react/components/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAO1D,QAAA,MAAM,MAAM,uCAAuB,CAAC;AACpC,QAAA,MAAM,WAAW,yGAAwB,CAAC;AAC1C,QAAA,MAAM,WAAW,0GAAwB,CAAC;AAI1C,QAAA,MAAM,aAAa;IAGf;;;;;;OAMG;cACO,OAAO;2CA+BnB,CAAC;AAGH,QAAA,MAAM,oBAAoB,qKAWxB,CAAC;AAGH,QAAA,MAAM,sBAAsB,uKAW1B,CAAC;AAGH,QAAA,MAAM,aAAa,8JA6BjB,CAAC;AAGH,QAAA,MAAM,WAAW,4JASf,CAAC;AAGH,QAAA,MAAM,UAAU,2JAoBd,CAAC;AAGH,QAAA,MAAM,eAAe,gKASnB,CAAC;AAGH,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAC"}
@@ -1,40 +1,40 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import * as SelectPrimitive from "@radix-ui/react-select";
5
- import { Check, ChevronDown, ChevronUp } from "lucide-react";
6
- import { cn } from "../../lib/utils.js";
7
- import { Spinner } from "./spinner.js";
8
- import { blockActivationKey, blockEvent } from "./pending-guard.js";
3
+ import * as React from 'react';
4
+ import * as SelectPrimitive from '@radix-ui/react-select';
5
+ import { Check, ChevronDown, ChevronUp } from 'lucide-react';
6
+ import { cn } from '../../lib/utils.js';
7
+ import { Spinner } from './spinner.js';
8
+ import { blockActivationKey, blockEvent } from './pending-guard.js';
9
9
  const Select = SelectPrimitive.Root;
10
10
  const SelectGroup = SelectPrimitive.Group;
11
11
  const SelectValue = SelectPrimitive.Value;
12
12
  // A pending trigger opens on nothing: it opens on a pointer press or a key, and a closed
13
13
  // trigger's typeahead changes the value, so both are stopped before the trigger's own handlers.
14
- const SelectTrigger = React.forwardRef(({ className, children, pending = false, disabled, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn("flex h-10 w-full items-center justify-between rounded-md border-2 border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 [&>span]:line-clamp-1", className), ...props, ...(pending
14
+ const SelectTrigger = React.forwardRef(({ className, children, pending = false, disabled, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn('flex h-10 w-full items-center justify-between rounded-md border-2 border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 [&>span]:line-clamp-1', className), ...props, ...(pending
15
15
  ? {
16
- "aria-busy": true,
17
- "aria-disabled": true,
18
- "data-pending": "",
16
+ 'aria-busy': true,
17
+ 'aria-disabled': true,
18
+ 'data-pending': '',
19
19
  onPointerDownCapture: blockEvent,
20
20
  onClickCapture: blockEvent,
21
21
  onKeyDownCapture: blockActivationKey,
22
22
  }
23
23
  : {}), disabled: (disabled && !pending) || undefined, children: [children, pending ? (_jsx(Spinner, { size: "xs" })) : (_jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: "h-4 w-4 opacity-50" }) }))] })));
24
24
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
25
- const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(ChevronUp, { className: "h-4 w-4" }) })));
25
+ const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn('flex cursor-default items-center justify-center py-1', className), ...props, children: _jsx(ChevronUp, { className: "h-4 w-4" }) })));
26
26
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
27
- const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollDownButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(ChevronDown, { className: "h-4 w-4" }) })));
27
+ const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollDownButton, { ref: ref, className: cn('flex cursor-default items-center justify-center py-1', className), ...props, children: _jsx(ChevronDown, { className: "h-4 w-4" }) })));
28
28
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
29
- const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { ref: ref, className: cn("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground elevation-popover data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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", position === "popper" &&
30
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { className: cn("p-1", position === "popper" &&
31
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"), children: children }), _jsx(SelectScrollDownButton, {})] }) })));
29
+ const SelectContent = React.forwardRef(({ className, children, position = 'popper', ...props }, ref) => (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { ref: ref, className: cn('relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground elevation-popover duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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', position === 'popper' &&
30
+ 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), position: position, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { className: cn('p-1', position === 'popper' &&
31
+ 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'), children: children }), _jsx(SelectScrollDownButton, {})] }) })));
32
32
  SelectContent.displayName = SelectPrimitive.Content.displayName;
33
- const SelectLabel = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Label, { ref: ref, className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className), ...props })));
33
+ const SelectLabel = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Label, { ref: ref, className: cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className), ...props })));
34
34
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
35
- const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref, className: cn("relative flex w-full cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: [_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Check, { className: "h-4 w-4" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] })));
35
+ const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref, className: cn('relative flex w-full cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', className), ...props, children: [_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Check, { className: "h-4 w-4" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] })));
36
36
  SelectItem.displayName = SelectPrimitive.Item.displayName;
37
- const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-muted", className), ...props })));
37
+ const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Separator, { ref: ref, className: cn('-mx-1 my-1 h-px bg-muted', className), ...props })));
38
38
  SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
39
39
  export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
40
40
  //# sourceMappingURL=select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/react/components/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEnE,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAA;AACnC,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAA;AACzC,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAA;AAEzC,yFAAyF;AACzF,gGAAgG;AAChG,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAYpC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG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AG,eAAe,CAAC,KAAK,CAAC,WAAW,CAAA;AAE3D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAGjC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAC5C,MAAC,eAAe,CAAC,IAAI,IACnB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,6NAA6N,EAC7N,SAAS,CACV,KACG,KAAK,aAET,eAAM,SAAS,EAAC,8DAA8D,YAC5E,KAAC,eAAe,CAAC,aAAa,cAC5B,KAAC,KAAK,IAAC,SAAS,EAAC,SAAS,GAAG,GACC,GAC3B,EAEP,KAAC,eAAe,CAAC,QAAQ,cAAE,QAAQ,GAA4B,IAC1C,CACxB,CAAC,CAAA;AACF,UAAU,CAAC,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,CAAA;AAEzD,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAGtC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,SAAS,IACxB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,KAChD,KAAK,GACT,CACH,CAAC,CAAA;AACF,eAAe,CAAC,WAAW,GAAG,eAAe,CAAC,SAAS,CAAC,WAAW,CAAA;AAEnE,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAA","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as SelectPrimitive from \"@radix-ui/react-select\"\nimport { Check, ChevronDown, ChevronUp } from \"lucide-react\"\n\nimport { cn } from \"../../lib/utils.js\"\nimport { Spinner } from \"./spinner.js\"\nimport { blockActivationKey, blockEvent } from \"./pending-guard.js\"\n\nconst Select = SelectPrimitive.Root\nconst SelectGroup = SelectPrimitive.Group\nconst SelectValue = SelectPrimitive.Value\n\n// A pending trigger opens on nothing: it opens on a pointer press or a key, and a closed\n// trigger's typeahead changes the value, so both are stopped before the trigger's own handlers.\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {\n /**\n * The change this select started is in flight: the trigger ignores opening and typeahead,\n * sets `aria-disabled` and `aria-busy`, and shows the spinner in place of its chevron. It\n * is never natively disabled while pending (a `disabled` passed alongside applies once\n * pending ends), so it keeps focus (FRONTEND-203). It keeps showing\n * the COMMITTED value — the caller changes `value` only once the write lands.\n */\n pending?: boolean\n }\n>(({ className, children, pending = false, disabled, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex h-10 w-full items-center justify-between rounded-md border-2 border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 [&>span]:line-clamp-1\",\n className\n )}\n {...props}\n {...(pending\n ? {\n \"aria-busy\": true,\n \"aria-disabled\": true,\n \"data-pending\": \"\",\n onPointerDownCapture: blockEvent,\n onClickCapture: blockEvent,\n onKeyDownCapture: blockActivationKey,\n }\n : {})}\n disabled={(disabled && !pending) || undefined}\n >\n {children}\n {pending ? (\n <Spinner size=\"xs\" />\n ) : (\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n )}\n </SelectPrimitive.Trigger>\n))\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\"flex cursor-default items-center justify-center py-1\", className)}\n {...props}\n >\n <ChevronUp className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollUpButton>\n))\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\"flex cursor-default items-center justify-center py-1\", className)}\n {...props}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollDownButton>\n))\nSelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground elevation-popover data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n \"p-1\",\n position === \"popper\" &&\n \"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n))\nSelectContent.displayName = SelectPrimitive.Content.displayName\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\"py-1.5 pl-8 pr-2 text-sm font-semibold\", className)}\n {...props}\n />\n))\nSelectLabel.displayName = SelectPrimitive.Label.displayName\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n))\nSelectItem.displayName = SelectPrimitive.Item.displayName\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n))\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScroll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B,IAC1C,CACxB,CAAC,CAAC;AACH,UAAU,CAAC,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC;AAE1D,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAGtC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,SAAS,IACxB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,KAChD,KAAK,GACT,CACH,CAAC,CAAC;AACH,eAAe,CAAC,WAAW,GAAG,eAAe,CAAC,SAAS,CAAC,WAAW,CAAC;AAEpE,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport { Check, ChevronDown, ChevronUp } from 'lucide-react';\n\nimport { cn } from '../../lib/utils.js';\nimport { Spinner } from './spinner.js';\nimport { blockActivationKey, blockEvent } from './pending-guard.js';\n\nconst Select = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\n// A pending trigger opens on nothing: it opens on a pointer press or a key, and a closed\n// trigger's typeahead changes the value, so both are stopped before the trigger's own handlers.\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {\n /**\n * The change this select started is in flight: the trigger ignores opening and typeahead,\n * sets `aria-disabled` and `aria-busy`, and shows the spinner in place of its chevron. It\n * is never natively disabled while pending (a `disabled` passed alongside applies once\n * pending ends), so it keeps focus (FRONTEND-203). It keeps showing\n * the COMMITTED value — the caller changes `value` only once the write lands.\n */\n pending?: boolean;\n }\n>(({ className, children, pending = false, disabled, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n 'flex h-10 w-full items-center justify-between rounded-md border-2 border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 [&>span]:line-clamp-1',\n className,\n )}\n {...props}\n {...(pending\n ? {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'data-pending': '',\n onPointerDownCapture: blockEvent,\n onClickCapture: blockEvent,\n onKeyDownCapture: blockActivationKey,\n }\n : {})}\n disabled={(disabled && !pending) || undefined}\n >\n {children}\n {pending ? (\n <Spinner size=\"xs\" />\n ) : (\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n )}\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <ChevronUp className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = 'popper', ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n 'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground elevation-popover duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 position === 'popper' &&\n 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'p-1',\n position === 'popper' &&\n 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]',\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex w-full cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n};\n"]}
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import * as SeparatorPrimitive from "@radix-ui/react-separator";
1
+ import * as React from 'react';
2
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
3
3
  declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
4
  export { Separator };
5
5
  //# sourceMappingURL=separator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../../src/react/components/separator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAA;AAI/D,QAAA,MAAM,SAAS,6JAeb,CAAA;AAGF,OAAO,EAAE,SAAS,EAAE,CAAA"}
1
+ {"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../../src/react/components/separator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAIhE,QAAA,MAAM,SAAS,6JAeb,CAAC;AAGH,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,9 +1,9 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import * as SeparatorPrimitive from "@radix-ui/react-separator";
5
- import { cn } from "../../lib/utils.js";
6
- const Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (_jsx(SeparatorPrimitive.Root, { ref: ref, decorative: decorative, orientation: orientation, className: cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[2px] w-full" : "h-full w-[1px]", className), ...props })));
3
+ import * as React from 'react';
4
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
5
+ import { cn } from '../../lib/utils.js';
6
+ const Separator = React.forwardRef(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (_jsx(SeparatorPrimitive.Root, { ref: ref, decorative: decorative, orientation: orientation, className: cn('shrink-0 bg-border', orientation === 'horizontal' ? 'h-[2px] w-full' : 'h-full w-[1px]', className), ...props })));
7
7
  Separator.displayName = SeparatorPrimitive.Root.displayName;
8
8
  export { Separator };
9
9
  //# sourceMappingURL=separator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"separator.js","sourceRoot":"","sources":["../../../src/react/components/separator.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAA;AAE/D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAEvC,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAGhC,CAAC,EAAE,SAAS,EAAE,WAAW,GAAG,YAAY,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACjF,KAAC,kBAAkB,CAAC,IAAI,IACtB,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,EAAE,CACX,oBAAoB,EACpB,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,EAClE,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAA;AACF,SAAS,CAAC,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAA;AAE3D,OAAO,EAAE,SAAS,EAAE,CAAA","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\"\n\nimport { cn } from \"../../lib/utils.js\"\n\nconst Separator = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = \"horizontal\", decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-[2px] w-full\" : \"h-full w-[1px]\",\n className\n )}\n {...props}\n />\n))\nSeparator.displayName = SeparatorPrimitive.Root.displayName\n\nexport { Separator }\n"]}
1
+ {"version":3,"file":"separator.js","sourceRoot":"","sources":["../../../src/react/components/separator.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAGhC,CAAC,EAAE,SAAS,EAAE,WAAW,GAAG,YAAY,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACjF,KAAC,kBAAkB,CAAC,IAAI,IACtB,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,EAAE,CACX,oBAAoB,EACpB,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,EAClE,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AACH,SAAS,CAAC,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\n\nimport { cn } from '../../lib/utils.js';\n\nconst Separator = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n 'shrink-0 bg-border',\n orientation === 'horizontal' ? 'h-[2px] w-full' : 'h-full w-[1px]',\n className,\n )}\n {...props}\n />\n));\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n\nexport { Separator };\n"]}
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
- import * as SheetPrimitive from "@radix-ui/react-dialog";
3
- import { type VariantProps } from "class-variance-authority";
1
+ import * as React from 'react';
2
+ import * as SheetPrimitive from '@radix-ui/react-dialog';
3
+ import { type VariantProps } from 'class-variance-authority';
4
4
  declare const Sheet: React.FC<SheetPrimitive.DialogProps>;
5
5
  declare const SheetTrigger: React.ForwardRefExoticComponent<SheetPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
6
  declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../../src/react/components/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,QAAA,MAAM,KAAK,sCAAsB,CAAA;AAEjC,QAAA,MAAM,YAAY,6GAAyB,CAAA;AAE3C,QAAA,MAAM,UAAU,2GAAuB,CAAA;AAEvC,QAAA,MAAM,WAAW,4CAAwB,CAAA;AAEzC,QAAA,MAAM,YAAY,6JAYhB,CAAA;AAGF,QAAA,MAAM,aAAa;;8EAiBlB,CAAA;AAED,UAAU,iBACR,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,EACnE,YAAY,CAAC,OAAO,aAAa,CAAC;CAAG;AAEzC,QAAA,MAAM,YAAY,0FAsBhB,CAAA;AAGF,QAAA,MAAM,WAAW;8BAGd,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAQtC,CAAA;AAGD,QAAA,MAAM,WAAW;8BAGd,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAQtC,CAAA;AAGD,QAAA,MAAM,UAAU,mKASd,CAAA;AAGF,QAAA,MAAM,gBAAgB,6KASpB,CAAA;AAGF,OAAO,EACL,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,CAAA"}
1
+ {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../../src/react/components/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAMlE,QAAA,MAAM,KAAK,sCAAsB,CAAC;AAElC,QAAA,MAAM,YAAY,6GAAyB,CAAC;AAE5C,QAAA,MAAM,UAAU,2GAAuB,CAAC;AAExC,QAAA,MAAM,WAAW,4CAAwB,CAAC;AAE1C,QAAA,MAAM,YAAY,6JAYhB,CAAC;AAGH,QAAA,MAAM,aAAa;;8EAiBlB,CAAC;AAEF,UAAU,iBACR,SACE,KAAK,CAAC,wBAAwB,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,EAC7D,YAAY,CAAC,OAAO,aAAa,CAAC;CAAG;AAEzC,QAAA,MAAM,YAAY,0FAsBhB,CAAC;AAGH,QAAA,MAAM,WAAW;8BAA6B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAEjF,CAAC;AAGF,QAAA,MAAM,WAAW;8BAA6B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAKjF,CAAC;AAGF,QAAA,MAAM,UAAU,mKASd,CAAC;AAGH,QAAA,MAAM,gBAAgB,6KASpB,CAAC;AAGH,OAAO,EACL,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,CAAC"}
@@ -1,42 +1,42 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import * as SheetPrimitive from "@radix-ui/react-dialog";
5
- import { cva } from "class-variance-authority";
6
- import { X } from "lucide-react";
7
- import { cn } from "../../lib/utils.js";
8
- import { useOpenerFocus } from "./opener-focus.js";
3
+ import * as React from 'react';
4
+ import * as SheetPrimitive from '@radix-ui/react-dialog';
5
+ import { cva } from 'class-variance-authority';
6
+ import { X } from 'lucide-react';
7
+ import { cn } from '../../lib/utils.js';
8
+ import { useOpenerFocus } from './opener-focus.js';
9
9
  const Sheet = SheetPrimitive.Root;
10
10
  const SheetTrigger = SheetPrimitive.Trigger;
11
11
  const SheetClose = SheetPrimitive.Close;
12
12
  const SheetPortal = SheetPrimitive.Portal;
13
- const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Overlay, { className: cn("fixed inset-0 z-50 bg-[color:var(--scrim)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className), ...props, ref: ref })));
13
+ const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Overlay, { className: cn('fixed inset-0 z-50 bg-[color:var(--scrim)] duration-[var(--motion-base)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0', className), ...props, ref: ref })));
14
14
  SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
15
- const sheetVariants = cva("fixed z-50 gap-4 bg-background p-6 elevation-raised transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", {
15
+ const sheetVariants = cva('fixed z-50 gap-4 bg-background p-6 elevation-raised ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-[var(--motion-base)] data-[state=open]:duration-[var(--motion-slow)]', {
16
16
  variants: {
17
17
  side: {
18
- top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
19
- bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
20
- left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
21
- right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
18
+ top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
19
+ bottom: 'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
20
+ left: 'inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm',
21
+ right: 'inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm',
22
22
  },
23
23
  },
24
24
  defaultVariants: {
25
- side: "right",
25
+ side: 'right',
26
26
  },
27
27
  });
28
- const SheetContent = React.forwardRef(({ side = "right", className, children, onOpenAutoFocus, onCloseAutoFocus, ...props }, ref) => {
28
+ const SheetContent = React.forwardRef(({ side = 'right', className, children, onOpenAutoFocus, onCloseAutoFocus, ...props }, ref) => {
29
29
  const openerFocus = useOpenerFocus({ onOpenAutoFocus, onCloseAutoFocus });
30
30
  return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Content, { ref: ref, className: cn(sheetVariants({ side }), className), ...props, ...openerFocus, children: [children, _jsxs(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [_jsx(X, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] })] })] }));
31
31
  });
32
32
  SheetContent.displayName = SheetPrimitive.Content.displayName;
33
- const SheetHeader = ({ className, ...props }) => (_jsx("div", { className: cn("flex flex-col space-y-2 text-center sm:text-left", className), ...props }));
34
- SheetHeader.displayName = "SheetHeader";
35
- const SheetFooter = ({ className, ...props }) => (_jsx("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props }));
36
- SheetFooter.displayName = "SheetFooter";
37
- const SheetTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Title, { ref: ref, className: cn("text-lg font-semibold text-foreground break-words", className), ...props })));
33
+ const SheetHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col space-y-2 text-center sm:text-left', className), ...props }));
34
+ SheetHeader.displayName = 'SheetHeader';
35
+ const SheetFooter = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className), ...props }));
36
+ SheetFooter.displayName = 'SheetFooter';
37
+ const SheetTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Title, { ref: ref, className: cn('text-lg font-semibold text-foreground break-words', className), ...props })));
38
38
  SheetTitle.displayName = SheetPrimitive.Title.displayName;
39
- const SheetDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Description, { ref: ref, className: cn("text-sm text-muted-foreground break-words", className), ...props })));
39
+ const SheetDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(SheetPrimitive.Description, { ref: ref, className: cn('text-sm text-muted-foreground break-words', className), ...props })));
40
40
  SheetDescription.displayName = SheetPrimitive.Description.displayName;
41
41
  export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
42
42
  //# sourceMappingURL=sheet.js.map