@slipstream-ui/core 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/dist/index.d.mts +19 -0
  2. package/dist/index.d.ts +19 -0
  3. package/dist/index.js +96 -46
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +96 -46
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/manifests/accordion.manifest.json +1 -1
  8. package/dist/manifests/alert.manifest.json +1 -1
  9. package/dist/manifests/announcement-bar.manifest.json +1 -1
  10. package/dist/manifests/app-shell.manifest.json +1 -1
  11. package/dist/manifests/applied-filters.manifest.json +1 -1
  12. package/dist/manifests/article-card.manifest.json +1 -1
  13. package/dist/manifests/auth-layout.manifest.json +1 -1
  14. package/dist/manifests/autocomplete.manifest.json +1 -1
  15. package/dist/manifests/avatar.manifest.json +1 -1
  16. package/dist/manifests/badge.manifest.json +1 -1
  17. package/dist/manifests/block.manifest.json +1 -1
  18. package/dist/manifests/bottom-nav.manifest.json +1 -1
  19. package/dist/manifests/breadcrumb.manifest.json +1 -1
  20. package/dist/manifests/button-group.manifest.json +1 -1
  21. package/dist/manifests/button.manifest.json +1 -1
  22. package/dist/manifests/calendar.manifest.json +1 -1
  23. package/dist/manifests/card.manifest.json +1 -1
  24. package/dist/manifests/checkbox.manifest.json +1 -1
  25. package/dist/manifests/comparison-table.manifest.json +1 -1
  26. package/dist/manifests/confirm-dialog.manifest.json +1 -1
  27. package/dist/manifests/contact-strip.manifest.json +1 -1
  28. package/dist/manifests/container.manifest.json +1 -1
  29. package/dist/manifests/cta-section.manifest.json +1 -1
  30. package/dist/manifests/data-table.manifest.json +1 -1
  31. package/dist/manifests/date-picker-popover.manifest.json +1 -1
  32. package/dist/manifests/date-picker.manifest.json +1 -1
  33. package/dist/manifests/date-range-picker.manifest.json +1 -1
  34. package/dist/manifests/deal-card.manifest.json +1 -1
  35. package/dist/manifests/dialog.manifest.json +1 -1
  36. package/dist/manifests/document-card.manifest.json +1 -1
  37. package/dist/manifests/drawer.manifest.json +1 -1
  38. package/dist/manifests/empty-state.manifest.json +1 -1
  39. package/dist/manifests/entity-card.manifest.json +1 -1
  40. package/dist/manifests/feature-grid.manifest.json +1 -1
  41. package/dist/manifests/feature-row.manifest.json +1 -1
  42. package/dist/manifests/fieldset.manifest.json +1 -1
  43. package/dist/manifests/file-upload.manifest.json +1 -1
  44. package/dist/manifests/filter-bar.manifest.json +1 -1
  45. package/dist/manifests/filter-chips.manifest.json +13 -1
  46. package/dist/manifests/filter-panel.manifest.json +1 -1
  47. package/dist/manifests/flex.manifest.json +1 -1
  48. package/dist/manifests/form-field.manifest.json +1 -1
  49. package/dist/manifests/form-layout.manifest.json +1 -1
  50. package/dist/manifests/form.manifest.json +1 -1
  51. package/dist/manifests/grid.manifest.json +1 -1
  52. package/dist/manifests/heading.manifest.json +1 -1
  53. package/dist/manifests/hero.manifest.json +1 -1
  54. package/dist/manifests/image.manifest.json +1 -1
  55. package/dist/manifests/input-group.manifest.json +1 -1
  56. package/dist/manifests/input.manifest.json +1 -1
  57. package/dist/manifests/label.manifest.json +1 -1
  58. package/dist/manifests/link-tabs.manifest.json +1 -1
  59. package/dist/manifests/link.manifest.json +1 -1
  60. package/dist/manifests/list.manifest.json +1 -1
  61. package/dist/manifests/load-more.manifest.json +1 -1
  62. package/dist/manifests/logo-cloud.manifest.json +1 -1
  63. package/dist/manifests/menu.manifest.json +1 -1
  64. package/dist/manifests/metric-card.manifest.json +1 -1
  65. package/dist/manifests/multi-select.manifest.json +1 -1
  66. package/dist/manifests/newsletter.manifest.json +1 -1
  67. package/dist/manifests/page-header.manifest.json +1 -1
  68. package/dist/manifests/pagination.manifest.json +1 -1
  69. package/dist/manifests/password-input.manifest.json +1 -1
  70. package/dist/manifests/popover.manifest.json +1 -1
  71. package/dist/manifests/process-steps.manifest.json +1 -1
  72. package/dist/manifests/progress.manifest.json +1 -1
  73. package/dist/manifests/prose.manifest.json +1 -1
  74. package/dist/manifests/radio.manifest.json +1 -1
  75. package/dist/manifests/range-slider.manifest.json +1 -1
  76. package/dist/manifests/search.manifest.json +1 -1
  77. package/dist/manifests/section-heading.manifest.json +1 -1
  78. package/dist/manifests/section.manifest.json +1 -1
  79. package/dist/manifests/segmented-control.manifest.json +1 -1
  80. package/dist/manifests/select-menu.manifest.json +1 -1
  81. package/dist/manifests/select.manifest.json +8 -1
  82. package/dist/manifests/separator.manifest.json +1 -1
  83. package/dist/manifests/site-footer.manifest.json +1 -1
  84. package/dist/manifests/site-header.manifest.json +1 -1
  85. package/dist/manifests/skeleton.manifest.json +1 -1
  86. package/dist/manifests/spinner.manifest.json +1 -1
  87. package/dist/manifests/stat-band.manifest.json +1 -1
  88. package/dist/manifests/stepper.manifest.json +1 -1
  89. package/dist/manifests/switch.manifest.json +1 -1
  90. package/dist/manifests/table-card.manifest.json +1 -1
  91. package/dist/manifests/table-of-contents.manifest.json +1 -1
  92. package/dist/manifests/table.manifest.json +1 -1
  93. package/dist/manifests/tabs.manifest.json +1 -1
  94. package/dist/manifests/testimonial.manifest.json +1 -1
  95. package/dist/manifests/text.manifest.json +1 -1
  96. package/dist/manifests/textarea.manifest.json +1 -1
  97. package/dist/manifests/theme-toggle.manifest.json +1 -1
  98. package/dist/manifests/time-picker.manifest.json +1 -1
  99. package/dist/manifests/timeline.manifest.json +1 -1
  100. package/dist/manifests/toast.manifest.json +1 -1
  101. package/dist/manifests/tombstone-card.manifest.json +1 -1
  102. package/dist/manifests/tooltip.manifest.json +12 -1
  103. package/dist/src/components/accordion/Accordion.js +26 -19
  104. package/dist/src/components/accordion/Accordion.js.map +1 -1
  105. package/dist/src/components/accordion/Accordion.mjs +26 -19
  106. package/dist/src/components/accordion/Accordion.mjs.map +1 -1
  107. package/dist/src/components/checkbox/Checkbox.js +1 -1
  108. package/dist/src/components/checkbox/Checkbox.js.map +1 -1
  109. package/dist/src/components/checkbox/Checkbox.mjs +1 -1
  110. package/dist/src/components/checkbox/Checkbox.mjs.map +1 -1
  111. package/dist/src/components/drawer/Drawer.js +2 -1
  112. package/dist/src/components/drawer/Drawer.js.map +1 -1
  113. package/dist/src/components/drawer/Drawer.mjs +2 -1
  114. package/dist/src/components/drawer/Drawer.mjs.map +1 -1
  115. package/dist/src/components/filter-chips/FilterChips.d.ts +4 -0
  116. package/dist/src/components/filter-chips/FilterChips.js +35 -4
  117. package/dist/src/components/filter-chips/FilterChips.js.map +1 -1
  118. package/dist/src/components/filter-chips/FilterChips.mjs +35 -4
  119. package/dist/src/components/filter-chips/FilterChips.mjs.map +1 -1
  120. package/dist/src/components/radio/Radio.js +1 -1
  121. package/dist/src/components/radio/Radio.js.map +1 -1
  122. package/dist/src/components/radio/Radio.mjs +1 -1
  123. package/dist/src/components/radio/Radio.mjs.map +1 -1
  124. package/dist/src/components/range-slider/RangeSlider.js +3 -3
  125. package/dist/src/components/range-slider/RangeSlider.js.map +1 -1
  126. package/dist/src/components/range-slider/RangeSlider.mjs +3 -3
  127. package/dist/src/components/range-slider/RangeSlider.mjs.map +1 -1
  128. package/dist/src/components/select/Select.d.ts +10 -0
  129. package/dist/src/components/select/Select.js +2 -2
  130. package/dist/src/components/select/Select.js.map +1 -1
  131. package/dist/src/components/select/Select.mjs +2 -2
  132. package/dist/src/components/select/Select.mjs.map +1 -1
  133. package/dist/src/components/timeline/Timeline.js +17 -13
  134. package/dist/src/components/timeline/Timeline.js.map +1 -1
  135. package/dist/src/components/timeline/Timeline.mjs +17 -13
  136. package/dist/src/components/timeline/Timeline.mjs.map +1 -1
  137. package/dist/src/components/tooltip/Tooltip.d.ts +5 -0
  138. package/dist/src/components/tooltip/Tooltip.js +9 -2
  139. package/dist/src/components/tooltip/Tooltip.js.map +1 -1
  140. package/dist/src/components/tooltip/Tooltip.mjs +9 -2
  141. package/dist/src/components/tooltip/Tooltip.mjs.map +1 -1
  142. package/dist/styles-full.css +1 -1
  143. package/dist/styles.css +1 -1
  144. package/package.json +1 -1
  145. package/src/components/accordion/Accordion.test.tsx +14 -3
  146. package/src/components/accordion/Accordion.tsx +34 -21
  147. package/src/components/checkbox/Checkbox.tsx +1 -1
  148. package/src/components/drawer/Drawer.test.tsx +12 -0
  149. package/src/components/drawer/Drawer.tsx +8 -1
  150. package/src/components/filter-chips/FilterChips.test.tsx +11 -0
  151. package/src/components/filter-chips/FilterChips.tsx +40 -4
  152. package/src/components/radio/Radio.tsx +1 -1
  153. package/src/components/range-slider/RangeSlider.tsx +3 -3
  154. package/src/components/select/Select.test.tsx +14 -0
  155. package/src/components/select/Select.tsx +7 -2
  156. package/src/components/timeline/Timeline.test.tsx +11 -0
  157. package/src/components/timeline/Timeline.tsx +13 -2
  158. package/src/components/tooltip/Tooltip.test.tsx +15 -0
  159. package/src/components/tooltip/Tooltip.tsx +19 -2
  160. package/src/manifests/accordion.manifest.json +1 -1
  161. package/src/manifests/alert.manifest.json +1 -1
  162. package/src/manifests/announcement-bar.manifest.json +1 -1
  163. package/src/manifests/app-shell.manifest.json +1 -1
  164. package/src/manifests/applied-filters.manifest.json +1 -1
  165. package/src/manifests/article-card.manifest.json +1 -1
  166. package/src/manifests/auth-layout.manifest.json +1 -1
  167. package/src/manifests/autocomplete.manifest.json +1 -1
  168. package/src/manifests/avatar.manifest.json +1 -1
  169. package/src/manifests/badge.manifest.json +1 -1
  170. package/src/manifests/block.manifest.json +1 -1
  171. package/src/manifests/bottom-nav.manifest.json +1 -1
  172. package/src/manifests/breadcrumb.manifest.json +1 -1
  173. package/src/manifests/button-group.manifest.json +1 -1
  174. package/src/manifests/button.manifest.json +1 -1
  175. package/src/manifests/calendar.manifest.json +1 -1
  176. package/src/manifests/card.manifest.json +1 -1
  177. package/src/manifests/checkbox.manifest.json +1 -1
  178. package/src/manifests/comparison-table.manifest.json +1 -1
  179. package/src/manifests/confirm-dialog.manifest.json +1 -1
  180. package/src/manifests/contact-strip.manifest.json +1 -1
  181. package/src/manifests/container.manifest.json +1 -1
  182. package/src/manifests/cta-section.manifest.json +1 -1
  183. package/src/manifests/data-table.manifest.json +1 -1
  184. package/src/manifests/date-picker-popover.manifest.json +1 -1
  185. package/src/manifests/date-picker.manifest.json +1 -1
  186. package/src/manifests/date-range-picker.manifest.json +1 -1
  187. package/src/manifests/deal-card.manifest.json +1 -1
  188. package/src/manifests/dialog.manifest.json +1 -1
  189. package/src/manifests/document-card.manifest.json +1 -1
  190. package/src/manifests/drawer.manifest.json +1 -1
  191. package/src/manifests/empty-state.manifest.json +1 -1
  192. package/src/manifests/entity-card.manifest.json +1 -1
  193. package/src/manifests/feature-grid.manifest.json +1 -1
  194. package/src/manifests/feature-row.manifest.json +1 -1
  195. package/src/manifests/fieldset.manifest.json +1 -1
  196. package/src/manifests/file-upload.manifest.json +1 -1
  197. package/src/manifests/filter-bar.manifest.json +1 -1
  198. package/src/manifests/filter-chips.manifest.json +13 -1
  199. package/src/manifests/filter-panel.manifest.json +1 -1
  200. package/src/manifests/flex.manifest.json +1 -1
  201. package/src/manifests/form-field.manifest.json +1 -1
  202. package/src/manifests/form-layout.manifest.json +1 -1
  203. package/src/manifests/form.manifest.json +1 -1
  204. package/src/manifests/grid.manifest.json +1 -1
  205. package/src/manifests/heading.manifest.json +1 -1
  206. package/src/manifests/hero.manifest.json +1 -1
  207. package/src/manifests/image.manifest.json +1 -1
  208. package/src/manifests/input-group.manifest.json +1 -1
  209. package/src/manifests/input.manifest.json +1 -1
  210. package/src/manifests/label.manifest.json +1 -1
  211. package/src/manifests/link-tabs.manifest.json +1 -1
  212. package/src/manifests/link.manifest.json +1 -1
  213. package/src/manifests/list.manifest.json +1 -1
  214. package/src/manifests/load-more.manifest.json +1 -1
  215. package/src/manifests/logo-cloud.manifest.json +1 -1
  216. package/src/manifests/menu.manifest.json +1 -1
  217. package/src/manifests/metric-card.manifest.json +1 -1
  218. package/src/manifests/multi-select.manifest.json +1 -1
  219. package/src/manifests/newsletter.manifest.json +1 -1
  220. package/src/manifests/page-header.manifest.json +1 -1
  221. package/src/manifests/pagination.manifest.json +1 -1
  222. package/src/manifests/password-input.manifest.json +1 -1
  223. package/src/manifests/popover.manifest.json +1 -1
  224. package/src/manifests/process-steps.manifest.json +1 -1
  225. package/src/manifests/progress.manifest.json +1 -1
  226. package/src/manifests/prose.manifest.json +1 -1
  227. package/src/manifests/radio.manifest.json +1 -1
  228. package/src/manifests/range-slider.manifest.json +1 -1
  229. package/src/manifests/search.manifest.json +1 -1
  230. package/src/manifests/section-heading.manifest.json +1 -1
  231. package/src/manifests/section.manifest.json +1 -1
  232. package/src/manifests/segmented-control.manifest.json +1 -1
  233. package/src/manifests/select-menu.manifest.json +1 -1
  234. package/src/manifests/select.manifest.json +8 -1
  235. package/src/manifests/separator.manifest.json +1 -1
  236. package/src/manifests/site-footer.manifest.json +1 -1
  237. package/src/manifests/site-header.manifest.json +1 -1
  238. package/src/manifests/skeleton.manifest.json +1 -1
  239. package/src/manifests/spinner.manifest.json +1 -1
  240. package/src/manifests/stat-band.manifest.json +1 -1
  241. package/src/manifests/stepper.manifest.json +1 -1
  242. package/src/manifests/switch.manifest.json +1 -1
  243. package/src/manifests/table-card.manifest.json +1 -1
  244. package/src/manifests/table-of-contents.manifest.json +1 -1
  245. package/src/manifests/table.manifest.json +1 -1
  246. package/src/manifests/tabs.manifest.json +1 -1
  247. package/src/manifests/testimonial.manifest.json +1 -1
  248. package/src/manifests/text.manifest.json +1 -1
  249. package/src/manifests/textarea.manifest.json +1 -1
  250. package/src/manifests/theme-toggle.manifest.json +1 -1
  251. package/src/manifests/time-picker.manifest.json +1 -1
  252. package/src/manifests/timeline.manifest.json +1 -1
  253. package/src/manifests/toast.manifest.json +1 -1
  254. package/src/manifests/tombstone-card.manifest.json +1 -1
  255. package/src/manifests/tooltip.manifest.json +12 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/accordion/Accordion.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { resolveGap, type GapValue } from '../../utils/gap';\n\ntype AccordionContextValue = {\n openItems: Set<string>;\n toggle: (id: string) => void;\n /** Whether only one item may be open at a time. */\n collapsible: boolean;\n};\n\nconst AccordionContext = React.createContext<AccordionContextValue>({\n openItems: new Set(),\n toggle: () => {},\n collapsible: true,\n});\n\nexport type AccordionSection = {\n /** Unique id linking the trigger to its panel. */\n id: string;\n /** Trigger label. */\n title: React.ReactNode;\n /** Panel content. */\n content: React.ReactNode;\n /** Disables the trigger for this section. */\n disabled?: boolean;\n};\n\nexport type AccordionProps = {\n /** Controlled open item ids. */\n value?: string[];\n /** Initial open item ids when uncontrolled. */\n defaultValue?: string[];\n /** Called when the open set changes. */\n onValueChange?: (value: string[]) => void;\n /** When true (default), opening an item closes the others. */\n collapsible?: boolean;\n /** 'default' = bordered card with dividers; 'borderless' = plain stacked sections. */\n variant?: 'default' | 'borderless';\n /** Token gap ('lg') or exact pixels (16) between items. */\n gap?: GapValue;\n /**\n * Declarative sections. When provided, Accordion renders an\n * AccordionItem/AccordionTrigger/AccordionContent per entry instead of\n * reading `children`.\n */\n items?: AccordionSection[];\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\n/**\n * Collapsible content sections with proper ARIA accordion semantics.\n * Each item's trigger announces its expanded state and controls its panel.\n */\nconst Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(\n (\n {\n value,\n defaultValue = [],\n onValueChange,\n collapsible = true,\n variant = 'default',\n gap,\n items,\n className,\n style,\n children,\n },\n ref\n ) => {\n const [internalOpen, setInternalOpen] = React.useState<string[]>(defaultValue);\n const current = value ?? internalOpen;\n\n const toggle = React.useCallback(\n (id: string) => {\n const next = current.includes(id)\n ? current.filter((item) => item !== id)\n : collapsible\n ? [id]\n : [...current, id];\n if (value === undefined) setInternalOpen(next);\n onValueChange?.(next);\n },\n [current, collapsible, value, onValueChange]\n );\n\n const gapResolved = resolveGap(gap);\n\n return (\n <div\n ref={ref}\n className={cn(\n // flex-col so token/px gaps apply (gap is a flex property);\n // divide-y rides along in the default variant.\n 'flex w-full flex-col',\n variant === 'default' && 'rounded-lg border border-border divide-y divide-border',\n gapResolved.className,\n className\n )}\n style={{ ...gapResolved.style, ...style }}\n >\n <AccordionContext.Provider value={{ openItems: new Set(current), toggle, collapsible }}>\n {items\n ? items.map((item) => (\n <AccordionItem key={item.id} id={item.id}>\n <AccordionTrigger disabled={item.disabled}>{item.title}</AccordionTrigger>\n <AccordionContent>{item.content}</AccordionContent>\n </AccordionItem>\n ))\n : children}\n </AccordionContext.Provider>\n </div>\n );\n }\n);\nAccordion.displayName = 'Accordion';\n\nexport type AccordionItemProps = {\n /** Unique id linking the trigger to its panel. */\n id: string;\n className?: string;\n children: React.ReactNode;\n};\n\n/** A single collapsible section. */\nconst AccordionItem = React.forwardRef<HTMLDivElement, AccordionItemProps>(\n ({ id, className, children }, ref) => (\n <div ref={ref} data-accordion-item={id} className={className}>\n <AccordionItemContext.Provider value={{ id }}>{children}</AccordionItemContext.Provider>\n </div>\n )\n);\nAccordionItem.displayName = 'AccordionItem';\n\nconst AccordionItemContext = React.createContext<{ id: string }>({ id: '' });\n\nexport type AccordionTriggerProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n /** Replace the default chevron (rendered at the far right of the header). */\n icon?: React.ReactNode;\n};\n\n/** The clickable header that expands/collapses its panel. */\nconst AccordionTrigger = React.forwardRef<HTMLButtonElement, AccordionTriggerProps>(\n ({ className, children, icon, ...props }, ref) => {\n const { id } = React.useContext(AccordionItemContext);\n const { openItems, toggle } = React.useContext(AccordionContext);\n const open = openItems.has(id);\n const panelId = `${id}-panel`;\n const triggerId = `${id}-trigger`;\n\n return (\n <button\n ref={ref}\n type=\"button\"\n id={triggerId}\n aria-expanded={open}\n aria-controls={panelId}\n onClick={() => toggle(id)}\n className={cn(\n // w-full keeps the header clickable edge-to-edge in closed AND\n // open states; the icon slot sits at the far right via justify-between.\n 'flex w-full flex-1 items-center justify-between px-4 py-3 text-left text-sm font-medium transition-colors',\n 'hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n className\n )}\n {...props}\n >\n {children}\n {icon ?? (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n className={cn('h-4 w-4 shrink-0 transition-transform duration-200', open && 'rotate-180')}\n >\n <polyline points=\"6 9 12 15 18 9\" />\n </svg>\n )}\n </button>\n );\n }\n);\nAccordionTrigger.displayName = 'AccordionTrigger';\n\nexport type AccordionContentProps = React.HTMLAttributes<HTMLDivElement>;\n\n/** The collapsible panel; hidden from assistive tech when collapsed. */\nconst AccordionContent = React.forwardRef<HTMLDivElement, AccordionContentProps>(\n ({ className, children, ...props }, ref) => {\n const { id } = React.useContext(AccordionItemContext);\n const { openItems } = React.useContext(AccordionContext);\n const open = openItems.has(id);\n\n // Expansion animation via grid-template-rows (0fr -> 1fr): supported\n // in Chrome 117+/Firefox 66+/Safari 17+, and degrades to an instant\n // toggle elsewhere because the rows value simply stops interpolating.\n // The `hidden` attribute stays bound to `open` (synchronous) so panels\n // are removed from the a11y tree and tab order the moment they close.\n const [expanded, setExpanded] = React.useState(open);\n React.useEffect(() => {\n if (!open) {\n setExpanded(false);\n return;\n }\n const reduce =\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n if (reduce) {\n setExpanded(true);\n return;\n }\n let second = 0;\n const first = requestAnimationFrame(() => {\n second = requestAnimationFrame(() => setExpanded(true));\n });\n return () => {\n cancelAnimationFrame(first);\n cancelAnimationFrame(second);\n };\n }, [open]);\n\n return (\n <div\n ref={ref}\n id={`${id}-panel`}\n role=\"region\"\n aria-labelledby={`${id}-trigger`}\n hidden={!open}\n className={cn(\n // No display utility while closed: author styles would beat the\n // UA [hidden] rule and keep the collapsed panel visible.\n open &&\n cn(\n 'grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none',\n expanded ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'\n ),\n !open && 'grid-rows-[0fr]',\n className\n )}\n {...props}\n >\n <div className=\"overflow-hidden\">\n <div className=\"px-4 pb-3 text-sm text-muted-foreground\">{children}</div>\n </div>\n </div>\n );\n }\n);\nAccordionContent.displayName = 'AccordionContent';\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent };\n"],"mappings":";AA4GgB,SACE,KADF;AA1GhB,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,kBAAiC;AAS1C,MAAM,mBAAmB,MAAM,cAAqC;AAAA,EAClE,WAAW,oBAAI,IAAI;AAAA,EACnB,QAAQ,MAAM;AAAA,EAAC;AAAA,EACf,aAAa;AACf,CAAC;AAyCD,MAAM,YAAY,MAAM;AAAA,EACtB,CACE;AAAA,IACE;AAAA,IACA,eAAe,CAAC;AAAA,IAChB;AAAA,IACA,cAAc;AAAA,IACd,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GACA,QACG;AACH,UAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAmB,YAAY;AAC7E,UAAM,UAAU,SAAS;AAEzB,UAAM,SAAS,MAAM;AAAA,MACnB,CAAC,OAAe;AACd,cAAM,OAAO,QAAQ,SAAS,EAAE,IAC5B,QAAQ,OAAO,CAAC,SAAS,SAAS,EAAE,IACpC,cACE,CAAC,EAAE,IACH,CAAC,GAAG,SAAS,EAAE;AACrB,YAAI,UAAU,OAAW,iBAAgB,IAAI;AAC7C,wBAAgB,IAAI;AAAA,MACtB;AAAA,MACA,CAAC,SAAS,aAAa,OAAO,aAAa;AAAA,IAC7C;AAEA,UAAM,cAAc,WAAW,GAAG;AAElC,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA;AAAA;AAAA,UAGT;AAAA,UACA,YAAY,aAAa;AAAA,UACzB,YAAY;AAAA,UACZ;AAAA,QACF;AAAA,QACA,OAAO,EAAE,GAAG,YAAY,OA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AQ;AAAA,UACT;AAAA,QACF;AAAA,QACC,GAAG;AAAA,QAEJ,8BAAC,SAAI,WAAU,mBACb,8BAAC,SAAI,WAAU,2CAA2C,UAAS,GACrE;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACA,iBAAiB,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/accordion/Accordion.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { resolveGap, type GapValue } from '../../utils/gap';\n\ntype AccordionContextValue = {\n openItems: Set<string>;\n toggle: (id: string) => void;\n /** Whether only one item may be open at a time. */\n collapsible: boolean;\n};\n\nconst AccordionContext = React.createContext<AccordionContextValue>({\n openItems: new Set(),\n toggle: () => {},\n collapsible: true,\n});\n\nexport type AccordionSection = {\n /** Unique id linking the trigger to its panel. */\n id: string;\n /** Trigger label. */\n title: React.ReactNode;\n /** Panel content. */\n content: React.ReactNode;\n /** Disables the trigger for this section. */\n disabled?: boolean;\n};\n\nexport type AccordionProps = {\n /** Controlled open item ids. */\n value?: string[];\n /** Initial open item ids when uncontrolled. */\n defaultValue?: string[];\n /** Called when the open set changes. */\n onValueChange?: (value: string[]) => void;\n /** When true (default), opening an item closes the others. */\n collapsible?: boolean;\n /** 'default' = bordered card with dividers; 'borderless' = plain stacked sections. */\n variant?: 'default' | 'borderless';\n /** Token gap ('lg') or exact pixels (16) between items. */\n gap?: GapValue;\n /**\n * Declarative sections. When provided, Accordion renders an\n * AccordionItem/AccordionTrigger/AccordionContent per entry instead of\n * reading `children`.\n */\n items?: AccordionSection[];\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\n/**\n * Collapsible content sections with proper ARIA accordion semantics.\n * Each item's trigger announces its expanded state and controls its panel.\n */\nconst Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(\n (\n {\n value,\n defaultValue = [],\n onValueChange,\n collapsible = true,\n variant = 'default',\n gap,\n items,\n className,\n style,\n children,\n },\n ref\n ) => {\n const [internalOpen, setInternalOpen] = React.useState<string[]>(defaultValue);\n const current = value ?? internalOpen;\n\n const toggle = React.useCallback(\n (id: string) => {\n const next = current.includes(id)\n ? current.filter((item) => item !== id)\n : collapsible\n ? [id]\n : [...current, id];\n if (value === undefined) setInternalOpen(next);\n onValueChange?.(next);\n },\n [current, collapsible, value, onValueChange]\n );\n\n const gapResolved = resolveGap(gap);\n\n return (\n <div\n ref={ref}\n className={cn(\n // flex-col so token/px gaps apply (gap is a flex property);\n // divide-y rides along in the default variant.\n 'flex w-full flex-col',\n variant === 'default' && 'rounded-lg border border-border divide-y divide-border',\n gapResolved.className,\n className\n )}\n style={{ ...gapResolved.style, ...style }}\n >\n <AccordionContext.Provider value={{ openItems: new Set(current), toggle, collapsible }}>\n {items\n ? items.map((item) => (\n <AccordionItem key={item.id} id={item.id}>\n <AccordionTrigger disabled={item.disabled}>{item.title}</AccordionTrigger>\n <AccordionContent>{item.content}</AccordionContent>\n </AccordionItem>\n ))\n : children}\n </AccordionContext.Provider>\n </div>\n );\n }\n);\nAccordion.displayName = 'Accordion';\n\nexport type AccordionItemProps = {\n /** Unique id linking the trigger to its panel. */\n id: string;\n className?: string;\n children: React.ReactNode;\n};\n\n/** A single collapsible section. */\nconst AccordionItem = React.forwardRef<HTMLDivElement, AccordionItemProps>(\n ({ id, className, children }, ref) => (\n <div ref={ref} data-accordion-item={id} className={className}>\n <AccordionItemContext.Provider value={{ id }}>{children}</AccordionItemContext.Provider>\n </div>\n )\n);\nAccordionItem.displayName = 'AccordionItem';\n\nconst AccordionItemContext = React.createContext<{ id: string }>({ id: '' });\n\nexport type AccordionTriggerProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n /** Replace the default chevron (rendered at the far right of the header). */\n icon?: React.ReactNode;\n};\n\n/** The clickable header that expands/collapses its panel. */\nconst AccordionTrigger = React.forwardRef<HTMLButtonElement, AccordionTriggerProps>(\n ({ className, children, icon, ...props }, ref) => {\n const { id } = React.useContext(AccordionItemContext);\n const { openItems, toggle } = React.useContext(AccordionContext);\n const open = openItems.has(id);\n const panelId = `${id}-panel`;\n const triggerId = `${id}-trigger`;\n\n return (\n <button\n ref={ref}\n type=\"button\"\n id={triggerId}\n aria-expanded={open}\n aria-controls={panelId}\n onClick={() => toggle(id)}\n className={cn(\n // w-full keeps the header clickable edge-to-edge in closed AND\n // open states; the icon slot sits at the far right via justify-between.\n 'flex w-full flex-1 items-center justify-between px-4 py-3 text-left text-sm font-medium transition-colors',\n 'hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n className\n )}\n {...props}\n >\n {children}\n {icon ?? (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n className={cn('h-4 w-4 shrink-0 transition-transform duration-200', open && 'rotate-180')}\n >\n <polyline points=\"6 9 12 15 18 9\" />\n </svg>\n )}\n </button>\n );\n }\n);\nAccordionTrigger.displayName = 'AccordionTrigger';\n\nexport type AccordionContentProps = React.HTMLAttributes<HTMLDivElement>;\n\n/** The collapsible panel; hidden from assistive tech when collapsed. */\nconst AccordionContent = React.forwardRef<HTMLDivElement, AccordionContentProps>(\n ({ className, children, ...props }, ref) => {\n const { id } = React.useContext(AccordionItemContext);\n const { openItems } = React.useContext(AccordionContext);\n const open = openItems.has(id);\n\n // Expansion animation via grid-template-rows (0fr -> 1fr): supported\n // in Chrome 117+/Firefox 66+/Safari 17+, and degrades to an instant\n // toggle elsewhere because the rows value simply stops interpolating.\n //\n // Closing keeps the panel mounted for the transition window. Binding\n // `hidden` straight to `open` removed the panel on the closing frame, so\n // collapse was a jump cut with no animation at all.\n const [mounted, setMounted] = React.useState(open);\n const [expanded, setExpanded] = React.useState(open);\n\n React.useEffect(() => {\n const reduce =\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n if (open) {\n setMounted(true);\n if (reduce) {\n setExpanded(true);\n return;\n }\n // Paint the collapsed frame first so the row transition has a start.\n let second = 0;\n const first = requestAnimationFrame(() => {\n second = requestAnimationFrame(() => setExpanded(true));\n });\n return () => {\n cancelAnimationFrame(first);\n cancelAnimationFrame(second);\n };\n }\n\n setExpanded(false);\n if (reduce) {\n setMounted(false);\n return;\n }\n const timer = setTimeout(() => setMounted(false), 320);\n return () => clearTimeout(timer);\n }, [open]);\n\n return (\n <div\n ref={ref}\n id={`${id}-panel`}\n role=\"region\"\n aria-labelledby={`${id}-trigger`}\n aria-hidden={open ? undefined : true}\n hidden={!mounted}\n className={cn(\n // No display utility while unmounted: author styles would beat the\n // UA [hidden] rule and keep the collapsed panel visible.\n mounted &&\n cn(\n 'grid transition-[grid-template-rows,opacity] duration-300 ease-out motion-reduce:transition-none',\n expanded ? 'grid-rows-[1fr] opacity-100' : 'grid-rows-[0fr] pointer-events-none opacity-0'\n ),\n className\n )}\n {...props}\n >\n <div className=\"overflow-hidden\">\n <div className=\"px-4 pb-3 text-sm text-muted-foreground\">{children}</div>\n </div>\n </div>\n );\n }\n);\nAccordionContent.displayName = 'AccordionContent';\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent };\n"],"mappings":";AA4GgB,SACE,KADF;AA1GhB,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,kBAAiC;AAS1C,MAAM,mBAAmB,MAAM,cAAqC;AAAA,EAClE,WAAW,oBAAI,IAAI;AAAA,EACnB,QAAQ,MAAM;AAAA,EAAC;AAAA,EACf,aAAa;AACf,CAAC;AAyCD,MAAM,YAAY,MAAM;AAAA,EACtB,CACE;AAAA,IACE;AAAA,IACA,eAAe,CAAC;AAAA,IAChB;AAAA,IACA,cAAc;AAAA,IACd,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GACA,QACG;AACH,UAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAmB,YAAY;AAC7E,UAAM,UAAU,SAA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AAI,MAAM;AACR,mBAAW,IAAI;AACf,YAAI,QAAQ;AACV,sBAAY,IAAI;AAChB;AAAA,QACF;AAEA,YAAI,SAAS;AACb,cAAM,QAAQ,sBAAsB,MAAM;AACxC,mBAAS,sBAAsB,MAAM,YAAY,IAAI,CAAC;AAAA,QACxD,CAAC;AACD,eAAO,MAAM;AACX,+BAAqB,KAAK;AAC1B,+BAAqB,MAAM;AAAA,QAC7B;AAAA,MACF;AAEA,kBAAY,KAAK;AACjB,UAAI,QAAQ;AACV,mBAAW,KAAK;AAChB;AAAA,MACF;AACA,YAAM,QAAQ,WAAW,MAAM,WAAW,KAAK,GAAG,GAAG;AACrD,aAAO,MAAM,aAAa,KAAK;AAAA,IACjC,GAAG,CAAC,IAAI,CAAC;AAET,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,IAAI,GAAG,EAAE;AAAA,QACT,MAAK;AAAA,QACL,mBAAiB,GAAG,EAAE;AAAA,QACtB,eAAa,OAAO,SAAY;AAAA,QAChC,QAAQ,CAAC;AAAA,QACT,WAAW;AAAA;AAAA;AAAA,UAGT,WACE;AAAA,YACE;AAAA,YACA,WAAW,gCAAgC;AAAA,UAC7C;AAAA,UACF;AAAA,QACF;AAAA,QACC,GAAG;AAAA,QAEJ,8BAAC,SAAI,WAAU,mBACb,8BAAC,SAAI,WAAU,2CAA2C,UAAS,GACrE;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACA,iBAAiB,cAAc;","names":[]}
@@ -46,7 +46,7 @@ const Checkbox = React.forwardRef(
46
46
  onChange?.(event);
47
47
  },
48
48
  className: (0, import_cn.cn)(
49
- "peer h-4 w-4 shrink-0 rounded-sm border border-primary",
49
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary accent-primary",
50
50
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
51
51
  "disabled:cursor-not-allowed disabled:opacity-50",
52
52
  "checked:bg-primary checked:text-primary-foreground",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type CheckboxProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> & {\n /** Controlled checked state; omit for uncontrolled usage. */\n checked?: boolean;\n /** Fired when the user toggles the checkbox. */\n onCheckedChange?: (checked: boolean) => void;\n};\n\n/**\n * Accessible checkbox built on the native input: keyboard, form, and\n * screen-reader behavior comes from the platform. Visual state is drawn\n * with a CSS overlay so the native input stays the source of truth.\n */\nconst Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({ className, checked, onCheckedChange, onChange, ...props }, ref) => (\n <input\n type=\"checkbox\"\n ref={ref}\n checked={checked}\n onChange={(event) => {\n onCheckedChange?.(event.target.checked);\n onChange?.(event);\n }}\n className={cn(\n 'peer h-4 w-4 shrink-0 rounded-sm border border-primary',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'checked:bg-primary checked:text-primary-foreground',\n className\n )}\n {...props}\n />\n )\n);\nCheckbox.displayName = 'Checkbox';\n\nexport { Checkbox };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBI;AAjBJ,YAAuB;AACvB,gBAAmB;AAcnB,MAAM,WAAW,MAAM;AAAA,EACrB,CAAC,EAAE,WAAW,SAAS,iBAAiB,UAAU,GAAG,MAAM,GAAG,QAC5D;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,UAAU,CAAC,UAAU;AACnB,0BAAkB,MAAM,OAAO,OAAO;AACtC,mBAAW,KAAK;AAAA,MAClB;AAAA,MACA,eAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,SAAS,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type CheckboxProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> & {\n /** Controlled checked state; omit for uncontrolled usage. */\n checked?: boolean;\n /** Fired when the user toggles the checkbox. */\n onCheckedChange?: (checked: boolean) => void;\n};\n\n/**\n * Accessible checkbox built on the native input: keyboard, form, and\n * screen-reader behavior comes from the platform. Visual state is drawn\n * with a CSS overlay so the native input stays the source of truth.\n */\nconst Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({ className, checked, onCheckedChange, onChange, ...props }, ref) => (\n <input\n type=\"checkbox\"\n ref={ref}\n checked={checked}\n onChange={(event) => {\n onCheckedChange?.(event.target.checked);\n onChange?.(event);\n }}\n className={cn(\n 'peer h-4 w-4 shrink-0 rounded-sm border border-primary accent-primary',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'checked:bg-primary checked:text-primary-foreground',\n className\n )}\n {...props}\n />\n )\n);\nCheckbox.displayName = 'Checkbox';\n\nexport { Checkbox };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBI;AAjBJ,YAAuB;AACvB,gBAAmB;AAcnB,MAAM,WAAW,MAAM;AAAA,EACrB,CAAC,EAAE,WAAW,SAAS,iBAAiB,UAAU,GAAG,MAAM,GAAG,QAC5D;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,UAAU,CAAC,UAAU;AACnB,0BAAkB,MAAM,OAAO,OAAO;AACtC,mBAAW,KAAK;AAAA,MAClB;AAAA,MACA,eAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,SAAS,cAAc;","names":[]}
@@ -13,7 +13,7 @@ const Checkbox = React.forwardRef(
13
13
  onChange?.(event);
14
14
  },
15
15
  className: cn(
16
- "peer h-4 w-4 shrink-0 rounded-sm border border-primary",
16
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary accent-primary",
17
17
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
18
18
  "disabled:cursor-not-allowed disabled:opacity-50",
19
19
  "checked:bg-primary checked:text-primary-foreground",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type CheckboxProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> & {\n /** Controlled checked state; omit for uncontrolled usage. */\n checked?: boolean;\n /** Fired when the user toggles the checkbox. */\n onCheckedChange?: (checked: boolean) => void;\n};\n\n/**\n * Accessible checkbox built on the native input: keyboard, form, and\n * screen-reader behavior comes from the platform. Visual state is drawn\n * with a CSS overlay so the native input stays the source of truth.\n */\nconst Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({ className, checked, onCheckedChange, onChange, ...props }, ref) => (\n <input\n type=\"checkbox\"\n ref={ref}\n checked={checked}\n onChange={(event) => {\n onCheckedChange?.(event.target.checked);\n onChange?.(event);\n }}\n className={cn(\n 'peer h-4 w-4 shrink-0 rounded-sm border border-primary',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'checked:bg-primary checked:text-primary-foreground',\n className\n )}\n {...props}\n />\n )\n);\nCheckbox.displayName = 'Checkbox';\n\nexport { Checkbox };\n"],"mappings":"AAiBI;AAjBJ,YAAY,WAAW;AACvB,SAAS,UAAU;AAcnB,MAAM,WAAW,MAAM;AAAA,EACrB,CAAC,EAAE,WAAW,SAAS,iBAAiB,UAAU,GAAG,MAAM,GAAG,QAC5D;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,UAAU,CAAC,UAAU;AACnB,0BAAkB,MAAM,OAAO,OAAO;AACtC,mBAAW,KAAK;AAAA,MAClB;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,SAAS,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type CheckboxProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> & {\n /** Controlled checked state; omit for uncontrolled usage. */\n checked?: boolean;\n /** Fired when the user toggles the checkbox. */\n onCheckedChange?: (checked: boolean) => void;\n};\n\n/**\n * Accessible checkbox built on the native input: keyboard, form, and\n * screen-reader behavior comes from the platform. Visual state is drawn\n * with a CSS overlay so the native input stays the source of truth.\n */\nconst Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({ className, checked, onCheckedChange, onChange, ...props }, ref) => (\n <input\n type=\"checkbox\"\n ref={ref}\n checked={checked}\n onChange={(event) => {\n onCheckedChange?.(event.target.checked);\n onChange?.(event);\n }}\n className={cn(\n 'peer h-4 w-4 shrink-0 rounded-sm border border-primary accent-primary',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'checked:bg-primary checked:text-primary-foreground',\n className\n )}\n {...props}\n />\n )\n);\nCheckbox.displayName = 'Checkbox';\n\nexport { Checkbox };\n"],"mappings":"AAiBI;AAjBJ,YAAY,WAAW;AACvB,SAAS,UAAU;AAcnB,MAAM,WAAW,MAAM;AAAA,EACrB,CAAC,EAAE,WAAW,SAAS,iBAAiB,UAAU,GAAG,MAAM,GAAG,QAC5D;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,UAAU,CAAC,UAAU;AACnB,0BAAkB,MAAM,OAAO,OAAO;AACtC,mBAAW,KAAK;AAAA,MAClB;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,SAAS,cAAc;","names":[]}
@@ -228,11 +228,12 @@ function Drawer({
228
228
  "duration-200 motion-reduce:animate-none",
229
229
  exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`
230
230
  ) : void 0;
231
+ const backdropMotion = animate ? (0, import_cn.cn)("motion-reduce:animate-none", exiting ? "animate-out fade-out-0" : "animate-in fade-in-0") : void 0;
231
232
  return (0, import_react_dom.createPortal)(
232
233
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
233
234
  "div",
234
235
  {
235
- className: "fixed inset-0 z-50",
236
+ className: (0, import_cn.cn)("fixed inset-0 z-50 bg-background/80", backdropMotion),
236
237
  onMouseDown: (event) => {
237
238
  if (closeOnBackdrop && event.target === event.currentTarget) requestClose();
238
239
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { cn } from '../../utils/cn';\nimport { usePresence } from '../../utils/presence';\nimport { useModalLayer } from '../../utils/modal-layer';\n\nexport type DrawerSide = 'left' | 'right' | 'top' | 'bottom';\nexport type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport type DrawerProps = {\n open: boolean;\n /** Called with the next open state. Alias: onClose (close requests only). */\n onOpenChange?: (open: boolean) => void;\n /**\n * Called when the drawer asks to close: Escape, backdrop click or the close\n * button. Alias for `onOpenChange(false)`, used when only a close handler is\n * passed.\n */\n onClose?: () => void;\n title: string;\n description?: string;\n children?: React.ReactNode;\n /** Edge the drawer slides from (default 'right'). */\n side?: DrawerSide;\n /** Preset extent along the side axis (width for left/right, height for top/bottom). */\n size?: DrawerSize;\n /**\n * Custom extent for left/right drawers: pixels (480) or any CSS length\n * (\"70vw\"). Overrides `size`.\n */\n width?: number | string;\n /**\n * Custom extent for top/bottom drawers: pixels (320) or any CSS length\n * (\"60vh\"). Overrides `size`.\n */\n height?: number | string;\n /**\n * Drag the inner edge to resize a left/right drawer. Keyboard: Arrow keys\n * nudge 16px, Shift+Arrow 64px, Home/End jump to the bounds. Ignored for\n * top/bottom drawers.\n */\n resizable?: boolean;\n /** Lower bound in pixels while resizable (default 240). */\n minWidth?: number;\n /** Upper bound in pixels while resizable (default 960). */\n maxWidth?: number;\n /** Initial width in pixels while resizable; defaults to the `size` preset. */\n defaultWidth?: number;\n /** Fired with the next width in pixels when a resize commits. */\n onWidthChange?: (width: number) => void;\n /** Accessible label for the resize handle (default \"Resize drawer\"). */\n resizeLabel?: string;\n /** Clicking the backdrop closes (default true). */\n closeOnBackdrop?: boolean;\n /** Hide the close (✕) button in the header (default true). */\n showClose?: boolean;\n /** Accessible label for the close button (default \"Close drawer\"). */\n closeLabel?: string;\n /** Focused when the drawer opens; defaults to the first focusable element. */\n initialFocusRef?: React.RefObject<HTMLElement | null>;\n /** Overrides the accessible name (defaults to the title). */\n ariaLabel?: string;\n /**\n * Slide the panel in from its edge and out on close (requires the\n * tailwindcss-animate plugin). Off by default; reduced-motion users\n * get animate-none automatically.\n */\n animate?: boolean;\n};\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst sideClasses: Record<DrawerSide, string> = {\n right: 'inset-y-0 right-0 border-l',\n left: 'inset-y-0 left-0 border-r',\n top: 'inset-x-0 top-0 border-b',\n bottom: 'inset-x-0 bottom-0 border-t',\n};\n\nconst sideWidths: Record<DrawerSize, string> = {\n sm: 'w-72',\n md: 'w-96',\n lg: 'w-[32rem]',\n xl: 'w-[40rem]',\n '2xl': 'w-[48rem]',\n};\n\nconst sideHeights: Record<DrawerSize, string> = {\n sm: 'h-48',\n md: 'h-80',\n lg: 'h-[32rem]',\n xl: 'h-[40rem]',\n '2xl': 'h-[48rem]',\n};\n\nconst sizeClasses: Record<DrawerSide, Record<DrawerSize, string>> = {\n right: sideWidths,\n left: sideWidths,\n top: sideHeights,\n bottom: sideHeights,\n};\n\n/** Pixel equivalents of the width presets, used as the resize starting point. */\nconst sizePx: Record<DrawerSize, number> = {\n sm: 288,\n md: 384,\n lg: 512,\n xl: 640,\n '2xl': 768,\n};\n\n/** Custom extent wins over the preset; numbers are pixels. */\nfunction extentStyle(value: number | string | undefined): string | undefined {\n if (value === undefined) return undefined;\n return typeof value === 'number' ? `${value}px` : value;\n}\n\n// Literal class maps so Tailwind's scanner keeps every slide utility.\nconst slideIn: Record<DrawerSide, string> = {\n right: 'slide-in-from-right',\n left: 'slide-in-from-left',\n top: 'slide-in-from-top',\n bottom: 'slide-in-from-bottom',\n};\nconst slideOut: Record<DrawerSide, string> = {\n right: 'slide-out-to-right',\n left: 'slide-out-to-left',\n top: 'slide-out-to-top',\n bottom: 'slide-out-to-bottom',\n};\n\n/**\n * Edge sheet for secondary flows (filters, detail panes, mobile nav).\n * Modal semantics identical to Dialog: portal, aria-modal + labelled by\n * title, Escape and backdrop dismissal, focus move + Tab trap + focus\n * restoration on close. Renders fixed to the chosen edge with a border\n * against the backdrop.\n */\nexport function Drawer({\n open,\n onOpenChange,\n onClose,\n title,\n description,\n children,\n side = 'right',\n size = 'md',\n width,\n height,\n resizable = false,\n minWidth = 240,\n maxWidth = 960,\n defaultWidth,\n onWidthChange,\n resizeLabel = 'Resize drawer',\n closeOnBackdrop = true,\n showClose = true,\n closeLabel = 'Close drawer',\n initialFocusRef,\n ariaLabel,\n animate = false,\n}: DrawerProps) {\n const drawerRef = React.useRef<HTMLDivElement | null>(null);\n const previouslyFocused = React.useRef<HTMLElement | null>(null);\n const titleId = React.useId();\n const descriptionId = React.useId();\n const { present, exiting } = usePresence(open, animate);\n const isTopLayer = useModalLayer(open);\n\n // Prefer onOpenChange; fall back to the onClose alias so a migration code\n // path that only passes onClose still dismisses without double-firing.\n const requestClose = React.useCallback(() => {\n if (onOpenChange) onOpenChange(false);\n else onClose?.();\n }, [onOpenChange, onClose]);\n\n // Resizable left/right drawers. Width is state-local so dragging stays\n // smooth; `onWidthChange` fires once a drag commits or a key is pressed.\n const isVerticalSide = side === 'top' || side === 'bottom';\n const canResize = resizable && !isVerticalSide;\n const clampWidth = React.useCallback(\n (next: number) => Math.min(maxWidth, Math.max(minWidth, Math.round(next))),\n [minWidth, maxWidth]\n );\n const [resizedWidth, setResizedWidth] = React.useState<number | null>(null);\n const initialWidth = clampWidth(\n defaultWidth ?? (typeof width === 'number' ? width : sizePx[size])\n );\n const resizeWidth = resizedWidth ?? initialWidth;\n const widthRef = React.useRef(resizeWidth);\n widthRef.current = resizeWidth;\n const onWidthChangeRef = React.useRef(onWidthChange);\n onWidthChangeRef.current = onWidthChange;\n\n const commitWidth = (next: number) => {\n const clamped = clampWidth(next);\n setResizedWidth(clamped);\n onWidthChangeRef.current?.(clamped);\n };\n\n const onResizePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n event.preventDefault();\n const startX = event.clientX;\n const startWidth = resizeWidth;\n const onMove = (moveEvent: PointerEvent) => {\n const delta = side === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX;\n setResizedWidth(clampWidth(startWidth + delta));\n };\n const onUp = () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n onWidthChangeRef.current?.(widthRef.current);\n };\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n };\n\n const onResizeKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const step = event.shiftKey ? 64 : 16;\n const grow = side === 'right' ? 'ArrowLeft' : 'ArrowRight';\n const shrink = side === 'right' ? 'ArrowRight' : 'ArrowLeft';\n if (event.key === grow) {\n event.preventDefault();\n commitWidth(resizeWidth + step);\n } else if (event.key === shrink) {\n event.preventDefault();\n commitWidth(resizeWidth - step);\n } else if (event.key === 'Home') {\n event.preventDefault();\n commitWidth(minWidth);\n } else if (event.key === 'End') {\n event.preventDefault();\n commitWidth(maxWidth);\n }\n };\n\n // Capture the opener before the panel takes focus; restore the moment\n // open flips false — even while an exit animation keeps the DOM up.\n React.useEffect(() => {\n if (open) {\n previouslyFocused.current = document.activeElement as HTMLElement | null;\n return;\n }\n previouslyFocused.current?.focus?.();\n previouslyFocused.current = null;\n }, [open]);\n\n // Move focus in once the panel is actually mounted (present can lag\n // open by a render when the presence gate starts closed).\n React.useEffect(() => {\n if (!open || !present) return;\n const node = drawerRef.current;\n const target =\n initialFocusRef?.current ?? node?.querySelector<HTMLElement>(FOCUSABLE) ?? node;\n target?.focus();\n }, [open, present, initialFocusRef]);\n\n React.useEffect(() => {\n if (!open) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n if (!isTopLayer()) return;\n event.stopPropagation();\n requestClose();\n return;\n }\n if (event.key !== 'Tab') return;\n const node = drawerRef.current;\n if (!node) return;\n const focusable = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = document.activeElement;\n if (event.shiftKey && (active === first || !node.contains(active))) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [open, requestClose, isTopLayer]);\n\n if (!present || typeof document === 'undefined') return null;\n\n const customExtent = canResize\n ? `${resizeWidth}px`\n : isVerticalSide\n ? extentStyle(height)\n : extentStyle(width);\n\n const motion = animate\n ? cn(\n 'duration-200 motion-reduce:animate-none',\n exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`,\n )\n : undefined;\n\n return createPortal(\n <div\n className=\"fixed inset-0 z-50\"\n onMouseDown={(event) => {\n if (closeOnBackdrop && event.target === event.currentTarget) requestClose();\n }}\n >\n <div\n ref={drawerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel ?? title}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n className={cn(\n 'fixed flex flex-col bg-background shadow-xl border-border',\n sideClasses[side],\n sizeClasses[side][size],\n motion\n )}\n style={customExtent ? { [isVerticalSide ? 'height' : 'width']: customExtent } : undefined}\n >\n {canResize && (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-valuenow={resizeWidth}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n tabIndex={0}\n onPointerDown={onResizePointerDown}\n onKeyDown={onResizeKeyDown}\n className={cn(\n 'absolute inset-y-0 z-10 w-2 cursor-col-resize touch-none rounded-sm bg-transparent',\n 'hover:bg-primary/20 focus-visible:bg-primary/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n side === 'right' ? '-left-1' : '-right-1'\n )}\n />\n )}\n <div className=\"flex items-start justify-between gap-4 border-b border-border px-5 py-4\">\n <div>\n <h2 id={titleId} className=\"text-base font-semibold leading-tight\">\n {title}\n </h2>\n {description && (\n <p id={descriptionId} className=\"mt-1 text-sm text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n {showClose && (\n <button\n type=\"button\"\n onClick={requestClose}\n aria-label={closeLabel}\n className=\"-me-1 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n ✕\n </button>\n )}\n </div>\n <div className=\"flex-1 overflow-y-auto px-5 py-4\">{children}</div>\n </div>\n </div>,\n document.body\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4UU;AA1UV,YAAuB;AACvB,uBAA6B;AAC7B,gBAAmB;AACnB,sBAA4B;AAC5B,yBAA8B;AAkE9B,MAAM,YACJ;AAEF,MAAM,cAA0C;AAAA,EAC9C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AAEA,MAAM,aAAyC;AAAA,EAC7C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA0C;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA8D;AAAA,EAClE,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AAGA,MAAM,SAAqC;AAAA,EACzC,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAGA,SAAS,YAAY,OAAwD;AAC3E,MAAI,UAAU,OAAW,QAAO;AAChC,SAAO,OAAO,UAAU,WAAW,GAAG,KAAK,OAAO;AACpD;AAGA,MAAM,UAAsC;AAAA,EAC1C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AACA,MAAM,WAAuC;AAAA,EAC3C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AASO,SAAS,OAAO;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,O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F;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { cn } from '../../utils/cn';\nimport { usePresence } from '../../utils/presence';\nimport { useModalLayer } from '../../utils/modal-layer';\n\nexport type DrawerSide = 'left' | 'right' | 'top' | 'bottom';\nexport type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport type DrawerProps = {\n open: boolean;\n /** Called with the next open state. Alias: onClose (close requests only). */\n onOpenChange?: (open: boolean) => void;\n /**\n * Called when the drawer asks to close: Escape, backdrop click or the close\n * button. Alias for `onOpenChange(false)`, used when only a close handler is\n * passed.\n */\n onClose?: () => void;\n title: string;\n description?: string;\n children?: React.ReactNode;\n /** Edge the drawer slides from (default 'right'). */\n side?: DrawerSide;\n /** Preset extent along the side axis (width for left/right, height for top/bottom). */\n size?: DrawerSize;\n /**\n * Custom extent for left/right drawers: pixels (480) or any CSS length\n * (\"70vw\"). Overrides `size`.\n */\n width?: number | string;\n /**\n * Custom extent for top/bottom drawers: pixels (320) or any CSS length\n * (\"60vh\"). Overrides `size`.\n */\n height?: number | string;\n /**\n * Drag the inner edge to resize a left/right drawer. Keyboard: Arrow keys\n * nudge 16px, Shift+Arrow 64px, Home/End jump to the bounds. Ignored for\n * top/bottom drawers.\n */\n resizable?: boolean;\n /** Lower bound in pixels while resizable (default 240). */\n minWidth?: number;\n /** Upper bound in pixels while resizable (default 960). */\n maxWidth?: number;\n /** Initial width in pixels while resizable; defaults to the `size` preset. */\n defaultWidth?: number;\n /** Fired with the next width in pixels when a resize commits. */\n onWidthChange?: (width: number) => void;\n /** Accessible label for the resize handle (default \"Resize drawer\"). */\n resizeLabel?: string;\n /** Clicking the backdrop closes (default true). */\n closeOnBackdrop?: boolean;\n /** Hide the close (✕) button in the header (default true). */\n showClose?: boolean;\n /** Accessible label for the close button (default \"Close drawer\"). */\n closeLabel?: string;\n /** Focused when the drawer opens; defaults to the first focusable element. */\n initialFocusRef?: React.RefObject<HTMLElement | null>;\n /** Overrides the accessible name (defaults to the title). */\n ariaLabel?: string;\n /**\n * Slide the panel in from its edge and out on close (requires the\n * tailwindcss-animate plugin). Off by default; reduced-motion users\n * get animate-none automatically.\n */\n animate?: boolean;\n};\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst sideClasses: Record<DrawerSide, string> = {\n right: 'inset-y-0 right-0 border-l',\n left: 'inset-y-0 left-0 border-r',\n top: 'inset-x-0 top-0 border-b',\n bottom: 'inset-x-0 bottom-0 border-t',\n};\n\nconst sideWidths: Record<DrawerSize, string> = {\n sm: 'w-72',\n md: 'w-96',\n lg: 'w-[32rem]',\n xl: 'w-[40rem]',\n '2xl': 'w-[48rem]',\n};\n\nconst sideHeights: Record<DrawerSize, string> = {\n sm: 'h-48',\n md: 'h-80',\n lg: 'h-[32rem]',\n xl: 'h-[40rem]',\n '2xl': 'h-[48rem]',\n};\n\nconst sizeClasses: Record<DrawerSide, Record<DrawerSize, string>> = {\n right: sideWidths,\n left: sideWidths,\n top: sideHeights,\n bottom: sideHeights,\n};\n\n/** Pixel equivalents of the width presets, used as the resize starting point. */\nconst sizePx: Record<DrawerSize, number> = {\n sm: 288,\n md: 384,\n lg: 512,\n xl: 640,\n '2xl': 768,\n};\n\n/** Custom extent wins over the preset; numbers are pixels. */\nfunction extentStyle(value: number | string | undefined): string | undefined {\n if (value === undefined) return undefined;\n return typeof value === 'number' ? `${value}px` : value;\n}\n\n// Literal class maps so Tailwind's scanner keeps every slide utility.\nconst slideIn: Record<DrawerSide, string> = {\n right: 'slide-in-from-right',\n left: 'slide-in-from-left',\n top: 'slide-in-from-top',\n bottom: 'slide-in-from-bottom',\n};\nconst slideOut: Record<DrawerSide, string> = {\n right: 'slide-out-to-right',\n left: 'slide-out-to-left',\n top: 'slide-out-to-top',\n bottom: 'slide-out-to-bottom',\n};\n\n/**\n * Edge sheet for secondary flows (filters, detail panes, mobile nav).\n * Modal semantics identical to Dialog: portal, aria-modal + labelled by\n * title, Escape and backdrop dismissal, focus move + Tab trap + focus\n * restoration on close. Renders fixed to the chosen edge with a border\n * against the backdrop.\n */\nexport function Drawer({\n open,\n onOpenChange,\n onClose,\n title,\n description,\n children,\n side = 'right',\n size = 'md',\n width,\n height,\n resizable = false,\n minWidth = 240,\n maxWidth = 960,\n defaultWidth,\n onWidthChange,\n resizeLabel = 'Resize drawer',\n closeOnBackdrop = true,\n showClose = true,\n closeLabel = 'Close drawer',\n initialFocusRef,\n ariaLabel,\n animate = false,\n}: DrawerProps) {\n const drawerRef = React.useRef<HTMLDivElement | null>(null);\n const previouslyFocused = React.useRef<HTMLElement | null>(null);\n const titleId = React.useId();\n const descriptionId = React.useId();\n const { present, exiting } = usePresence(open, animate);\n const isTopLayer = useModalLayer(open);\n\n // Prefer onOpenChange; fall back to the onClose alias so a migration code\n // path that only passes onClose still dismisses without double-firing.\n const requestClose = React.useCallback(() => {\n if (onOpenChange) onOpenChange(false);\n else onClose?.();\n }, [onOpenChange, onClose]);\n\n // Resizable left/right drawers. Width is state-local so dragging stays\n // smooth; `onWidthChange` fires once a drag commits or a key is pressed.\n const isVerticalSide = side === 'top' || side === 'bottom';\n const canResize = resizable && !isVerticalSide;\n const clampWidth = React.useCallback(\n (next: number) => Math.min(maxWidth, Math.max(minWidth, Math.round(next))),\n [minWidth, maxWidth]\n );\n const [resizedWidth, setResizedWidth] = React.useState<number | null>(null);\n const initialWidth = clampWidth(\n defaultWidth ?? (typeof width === 'number' ? width : sizePx[size])\n );\n const resizeWidth = resizedWidth ?? initialWidth;\n const widthRef = React.useRef(resizeWidth);\n widthRef.current = resizeWidth;\n const onWidthChangeRef = React.useRef(onWidthChange);\n onWidthChangeRef.current = onWidthChange;\n\n const commitWidth = (next: number) => {\n const clamped = clampWidth(next);\n setResizedWidth(clamped);\n onWidthChangeRef.current?.(clamped);\n };\n\n const onResizePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n event.preventDefault();\n const startX = event.clientX;\n const startWidth = resizeWidth;\n const onMove = (moveEvent: PointerEvent) => {\n const delta = side === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX;\n setResizedWidth(clampWidth(startWidth + delta));\n };\n const onUp = () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n onWidthChangeRef.current?.(widthRef.current);\n };\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n };\n\n const onResizeKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const step = event.shiftKey ? 64 : 16;\n const grow = side === 'right' ? 'ArrowLeft' : 'ArrowRight';\n const shrink = side === 'right' ? 'ArrowRight' : 'ArrowLeft';\n if (event.key === grow) {\n event.preventDefault();\n commitWidth(resizeWidth + step);\n } else if (event.key === shrink) {\n event.preventDefault();\n commitWidth(resizeWidth - step);\n } else if (event.key === 'Home') {\n event.preventDefault();\n commitWidth(minWidth);\n } else if (event.key === 'End') {\n event.preventDefault();\n commitWidth(maxWidth);\n }\n };\n\n // Capture the opener before the panel takes focus; restore the moment\n // open flips false — even while an exit animation keeps the DOM up.\n React.useEffect(() => {\n if (open) {\n previouslyFocused.current = document.activeElement as HTMLElement | null;\n return;\n }\n previouslyFocused.current?.focus?.();\n previouslyFocused.current = null;\n }, [open]);\n\n // Move focus in once the panel is actually mounted (present can lag\n // open by a render when the presence gate starts closed).\n React.useEffect(() => {\n if (!open || !present) return;\n const node = drawerRef.current;\n const target =\n initialFocusRef?.current ?? node?.querySelector<HTMLElement>(FOCUSABLE) ?? node;\n target?.focus();\n }, [open, present, initialFocusRef]);\n\n React.useEffect(() => {\n if (!open) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n if (!isTopLayer()) return;\n event.stopPropagation();\n requestClose();\n return;\n }\n if (event.key !== 'Tab') return;\n const node = drawerRef.current;\n if (!node) return;\n const focusable = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = document.activeElement;\n if (event.shiftKey && (active === first || !node.contains(active))) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [open, requestClose, isTopLayer]);\n\n if (!present || typeof document === 'undefined') return null;\n\n const customExtent = canResize\n ? `${resizeWidth}px`\n : isVerticalSide\n ? extentStyle(height)\n : extentStyle(width);\n\n const motion = animate\n ? cn(\n 'duration-200 motion-reduce:animate-none',\n exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`,\n )\n : undefined;\n\n // The backdrop dims and fades with the panel. Without it the page showed\n // through at full brightness while the drawer slid out, which read as a\n // content flash during close.\n const backdropMotion = animate\n ? cn('motion-reduce:animate-none', exiting ? 'animate-out fade-out-0' : 'animate-in fade-in-0')\n : undefined;\n\n return createPortal(\n <div\n className={cn('fixed inset-0 z-50 bg-background/80', backdropMotion)}\n onMouseDown={(event) => {\n if (closeOnBackdrop && event.target === event.currentTarget) requestClose();\n }}\n >\n <div\n ref={drawerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel ?? title}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n className={cn(\n 'fixed flex flex-col bg-background shadow-xl border-border',\n sideClasses[side],\n sizeClasses[side][size],\n motion\n )}\n style={customExtent ? { [isVerticalSide ? 'height' : 'width']: customExtent } : undefined}\n >\n {canResize && (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-valuenow={resizeWidth}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n tabIndex={0}\n onPointerDown={onResizePointerDown}\n onKeyDown={onResizeKeyDown}\n className={cn(\n 'absolute inset-y-0 z-10 w-2 cursor-col-resize touch-none rounded-sm bg-transparent',\n 'hover:bg-primary/20 focus-visible:bg-primary/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n side === 'right' ? '-left-1' : '-right-1'\n )}\n />\n )}\n <div className=\"flex items-start justify-between gap-4 border-b border-border px-5 py-4\">\n <div>\n <h2 id={titleId} className=\"text-base font-semibold leading-tight\">\n {title}\n </h2>\n {description && (\n <p id={descriptionId} className=\"mt-1 text-sm text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n {showClose && (\n <button\n type=\"button\"\n onClick={requestClose}\n aria-label={closeLabel}\n className=\"-me-1 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n ✕\n </button>\n )}\n </div>\n <div className=\"flex-1 overflow-y-auto px-5 py-4\">{children}</div>\n </div>\n </div>,\n document.body\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmVU;AAjVV,YAAuB;AACvB,uBAA6B;AAC7B,gBAAmB;AACnB,sBAA4B;AAC5B,yBAA8B;AAkE9B,MAAM,YACJ;AAEF,MAAM,cAA0C;AAAA,EAC9C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AAEA,MAAM,aAAyC;AAAA,EAC7C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA0C;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA8D;AAAA,EAClE,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AAGA,MAAM,SAAqC;AAA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AAU;AAAA,kBACV,eAAe;AAAA,kBACf,WAAW;AAAA,kBACX,eAAW;AAAA,oBACT;AAAA,oBACA;AAAA,oBACA,SAAS,UAAU,YAAY;AAAA,kBACjC;AAAA;AAAA,cACF;AAAA,cAEF,6CAAC,SAAI,WAAU,2EACb;AAAA,6DAAC,SACC;AAAA,8DAAC,QAAG,IAAI,SAAS,WAAU,yCACxB,iBACH;AAAA,kBACC,eACC,4CAAC,OAAE,IAAI,eAAe,WAAU,sCAC7B,uBACH;AAAA,mBAEJ;AAAA,gBACC,aACC;AAAA,kBAAC;AAAA;AAAA,oBACC,MAAK;AAAA,oBACL,SAAS;AAAA,oBACT,cAAY;AAAA,oBACZ,WAAU;AAAA,oBACX;AAAA;AAAA,gBAED;AAAA,iBAEJ;AAAA,cACA,4CAAC,SAAI,WAAU,oCAAoC,UAAS;AAAA;AAAA;AAAA,QAC9D;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
@@ -195,11 +195,12 @@ function Drawer({
195
195
  "duration-200 motion-reduce:animate-none",
196
196
  exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`
197
197
  ) : void 0;
198
+ const backdropMotion = animate ? cn("motion-reduce:animate-none", exiting ? "animate-out fade-out-0" : "animate-in fade-in-0") : void 0;
198
199
  return createPortal(
199
200
  /* @__PURE__ */ jsx(
200
201
  "div",
201
202
  {
202
- className: "fixed inset-0 z-50",
203
+ className: cn("fixed inset-0 z-50 bg-background/80", backdropMotion),
203
204
  onMouseDown: (event) => {
204
205
  if (closeOnBackdrop && event.target === event.currentTarget) requestClose();
205
206
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { cn } from '../../utils/cn';\nimport { usePresence } from '../../utils/presence';\nimport { useModalLayer } from '../../utils/modal-layer';\n\nexport type DrawerSide = 'left' | 'right' | 'top' | 'bottom';\nexport type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport type DrawerProps = {\n open: boolean;\n /** Called with the next open state. Alias: onClose (close requests only). */\n onOpenChange?: (open: boolean) => void;\n /**\n * Called when the drawer asks to close: Escape, backdrop click or the close\n * button. Alias for `onOpenChange(false)`, used when only a close handler is\n * passed.\n */\n onClose?: () => void;\n title: string;\n description?: string;\n children?: React.ReactNode;\n /** Edge the drawer slides from (default 'right'). */\n side?: DrawerSide;\n /** Preset extent along the side axis (width for left/right, height for top/bottom). */\n size?: DrawerSize;\n /**\n * Custom extent for left/right drawers: pixels (480) or any CSS length\n * (\"70vw\"). Overrides `size`.\n */\n width?: number | string;\n /**\n * Custom extent for top/bottom drawers: pixels (320) or any CSS length\n * (\"60vh\"). Overrides `size`.\n */\n height?: number | string;\n /**\n * Drag the inner edge to resize a left/right drawer. Keyboard: Arrow keys\n * nudge 16px, Shift+Arrow 64px, Home/End jump to the bounds. Ignored for\n * top/bottom drawers.\n */\n resizable?: boolean;\n /** Lower bound in pixels while resizable (default 240). */\n minWidth?: number;\n /** Upper bound in pixels while resizable (default 960). */\n maxWidth?: number;\n /** Initial width in pixels while resizable; defaults to the `size` preset. */\n defaultWidth?: number;\n /** Fired with the next width in pixels when a resize commits. */\n onWidthChange?: (width: number) => void;\n /** Accessible label for the resize handle (default \"Resize drawer\"). */\n resizeLabel?: string;\n /** Clicking the backdrop closes (default true). */\n closeOnBackdrop?: boolean;\n /** Hide the close (✕) button in the header (default true). */\n showClose?: boolean;\n /** Accessible label for the close button (default \"Close drawer\"). */\n closeLabel?: string;\n /** Focused when the drawer opens; defaults to the first focusable element. */\n initialFocusRef?: React.RefObject<HTMLElement | null>;\n /** Overrides the accessible name (defaults to the title). */\n ariaLabel?: string;\n /**\n * Slide the panel in from its edge and out on close (requires the\n * tailwindcss-animate plugin). Off by default; reduced-motion users\n * get animate-none automatically.\n */\n animate?: boolean;\n};\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst sideClasses: Record<DrawerSide, string> = {\n right: 'inset-y-0 right-0 border-l',\n left: 'inset-y-0 left-0 border-r',\n top: 'inset-x-0 top-0 border-b',\n bottom: 'inset-x-0 bottom-0 border-t',\n};\n\nconst sideWidths: Record<DrawerSize, string> = {\n sm: 'w-72',\n md: 'w-96',\n lg: 'w-[32rem]',\n xl: 'w-[40rem]',\n '2xl': 'w-[48rem]',\n};\n\nconst sideHeights: Record<DrawerSize, string> = {\n sm: 'h-48',\n md: 'h-80',\n lg: 'h-[32rem]',\n xl: 'h-[40rem]',\n '2xl': 'h-[48rem]',\n};\n\nconst sizeClasses: Record<DrawerSide, Record<DrawerSize, string>> = {\n right: sideWidths,\n left: sideWidths,\n top: sideHeights,\n bottom: sideHeights,\n};\n\n/** Pixel equivalents of the width presets, used as the resize starting point. */\nconst sizePx: Record<DrawerSize, number> = {\n sm: 288,\n md: 384,\n lg: 512,\n xl: 640,\n '2xl': 768,\n};\n\n/** Custom extent wins over the preset; numbers are pixels. */\nfunction extentStyle(value: number | string | undefined): string | undefined {\n if (value === undefined) return undefined;\n return typeof value === 'number' ? `${value}px` : value;\n}\n\n// Literal class maps so Tailwind's scanner keeps every slide utility.\nconst slideIn: Record<DrawerSide, string> = {\n right: 'slide-in-from-right',\n left: 'slide-in-from-left',\n top: 'slide-in-from-top',\n bottom: 'slide-in-from-bottom',\n};\nconst slideOut: Record<DrawerSide, string> = {\n right: 'slide-out-to-right',\n left: 'slide-out-to-left',\n top: 'slide-out-to-top',\n bottom: 'slide-out-to-bottom',\n};\n\n/**\n * Edge sheet for secondary flows (filters, detail panes, mobile nav).\n * Modal semantics identical to Dialog: portal, aria-modal + labelled by\n * title, Escape and backdrop dismissal, focus move + Tab trap + focus\n * restoration on close. Renders fixed to the chosen edge with a border\n * against the backdrop.\n */\nexport function Drawer({\n open,\n onOpenChange,\n onClose,\n title,\n description,\n children,\n side = 'right',\n size = 'md',\n width,\n height,\n resizable = false,\n minWidth = 240,\n maxWidth = 960,\n defaultWidth,\n onWidthChange,\n resizeLabel = 'Resize drawer',\n closeOnBackdrop = true,\n showClose = true,\n closeLabel = 'Close drawer',\n initialFocusRef,\n ariaLabel,\n animate = false,\n}: DrawerProps) {\n const drawerRef = React.useRef<HTMLDivElement | null>(null);\n const previouslyFocused = React.useRef<HTMLElement | null>(null);\n const titleId = React.useId();\n const descriptionId = React.useId();\n const { present, exiting } = usePresence(open, animate);\n const isTopLayer = useModalLayer(open);\n\n // Prefer onOpenChange; fall back to the onClose alias so a migration code\n // path that only passes onClose still dismisses without double-firing.\n const requestClose = React.useCallback(() => {\n if (onOpenChange) onOpenChange(false);\n else onClose?.();\n }, [onOpenChange, onClose]);\n\n // Resizable left/right drawers. Width is state-local so dragging stays\n // smooth; `onWidthChange` fires once a drag commits or a key is pressed.\n const isVerticalSide = side === 'top' || side === 'bottom';\n const canResize = resizable && !isVerticalSide;\n const clampWidth = React.useCallback(\n (next: number) => Math.min(maxWidth, Math.max(minWidth, Math.round(next))),\n [minWidth, maxWidth]\n );\n const [resizedWidth, setResizedWidth] = React.useState<number | null>(null);\n const initialWidth = clampWidth(\n defaultWidth ?? (typeof width === 'number' ? width : sizePx[size])\n );\n const resizeWidth = resizedWidth ?? initialWidth;\n const widthRef = React.useRef(resizeWidth);\n widthRef.current = resizeWidth;\n const onWidthChangeRef = React.useRef(onWidthChange);\n onWidthChangeRef.current = onWidthChange;\n\n const commitWidth = (next: number) => {\n const clamped = clampWidth(next);\n setResizedWidth(clamped);\n onWidthChangeRef.current?.(clamped);\n };\n\n const onResizePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n event.preventDefault();\n const startX = event.clientX;\n const startWidth = resizeWidth;\n const onMove = (moveEvent: PointerEvent) => {\n const delta = side === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX;\n setResizedWidth(clampWidth(startWidth + delta));\n };\n const onUp = () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n onWidthChangeRef.current?.(widthRef.current);\n };\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n };\n\n const onResizeKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const step = event.shiftKey ? 64 : 16;\n const grow = side === 'right' ? 'ArrowLeft' : 'ArrowRight';\n const shrink = side === 'right' ? 'ArrowRight' : 'ArrowLeft';\n if (event.key === grow) {\n event.preventDefault();\n commitWidth(resizeWidth + step);\n } else if (event.key === shrink) {\n event.preventDefault();\n commitWidth(resizeWidth - step);\n } else if (event.key === 'Home') {\n event.preventDefault();\n commitWidth(minWidth);\n } else if (event.key === 'End') {\n event.preventDefault();\n commitWidth(maxWidth);\n }\n };\n\n // Capture the opener before the panel takes focus; restore the moment\n // open flips false — even while an exit animation keeps the DOM up.\n React.useEffect(() => {\n if (open) {\n previouslyFocused.current = document.activeElement as HTMLElement | null;\n return;\n }\n previouslyFocused.current?.focus?.();\n previouslyFocused.current = null;\n }, [open]);\n\n // Move focus in once the panel is actually mounted (present can lag\n // open by a render when the presence gate starts closed).\n React.useEffect(() => {\n if (!open || !present) return;\n const node = drawerRef.current;\n const target =\n initialFocusRef?.current ?? node?.querySelector<HTMLElement>(FOCUSABLE) ?? node;\n target?.focus();\n }, [open, present, initialFocusRef]);\n\n React.useEffect(() => {\n if (!open) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n if (!isTopLayer()) return;\n event.stopPropagation();\n requestClose();\n return;\n }\n if (event.key !== 'Tab') return;\n const node = drawerRef.current;\n if (!node) return;\n const focusable = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = document.activeElement;\n if (event.shiftKey && (active === first || !node.contains(active))) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [open, requestClose, isTopLayer]);\n\n if (!present || typeof document === 'undefined') return null;\n\n const customExtent = canResize\n ? `${resizeWidth}px`\n : isVerticalSide\n ? extentStyle(height)\n : extentStyle(width);\n\n const motion = animate\n ? cn(\n 'duration-200 motion-reduce:animate-none',\n exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`,\n )\n : undefined;\n\n return createPortal(\n <div\n className=\"fixed inset-0 z-50\"\n onMouseDown={(event) => {\n if (closeOnBackdrop && event.target === event.currentTarget) requestClose();\n }}\n >\n <div\n ref={drawerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel ?? title}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n className={cn(\n 'fixed flex flex-col bg-background shadow-xl border-border',\n sideClasses[side],\n sizeClasses[side][size],\n motion\n )}\n style={customExtent ? { [isVerticalSide ? 'height' : 'width']: customExtent } : undefined}\n >\n {canResize && (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-valuenow={resizeWidth}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n tabIndex={0}\n onPointerDown={onResizePointerDown}\n onKeyDown={onResizeKeyDown}\n className={cn(\n 'absolute inset-y-0 z-10 w-2 cursor-col-resize touch-none rounded-sm bg-transparent',\n 'hover:bg-primary/20 focus-visible:bg-primary/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n side === 'right' ? '-left-1' : '-right-1'\n )}\n />\n )}\n <div className=\"flex items-start justify-between gap-4 border-b border-border px-5 py-4\">\n <div>\n <h2 id={titleId} className=\"text-base font-semibold leading-tight\">\n {title}\n </h2>\n {description && (\n <p id={descriptionId} className=\"mt-1 text-sm text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n {showClose && (\n <button\n type=\"button\"\n onClick={requestClose}\n aria-label={closeLabel}\n className=\"-me-1 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n ✕\n </button>\n )}\n </div>\n <div className=\"flex-1 overflow-y-auto px-5 py-4\">{children}</div>\n </div>\n </div>,\n document.body\n );\n}\n"],"mappings":";AA4UU,cAkBA,YAlBA;AA1UV,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAkE9B,MAAM,YACJ;AAEF,MAAM,cAA0C;AAAA,EAC9C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AAEA,MAAM,aAAyC;AAAA,EAC7C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA0C;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA8D;AAAA,EAClE,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AAGA,MAAM,SAAqC;AAAA,EACzC,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAGA,SAAS,YAAY,OAAwD;AAC3E,MAAI,UAAU,OAAW,QAAO;AAChC,SAAO,OAAO,UAAU,WAAW,GAAG,KAAK,OAAO;AACpD;AAGA,MAAM,UAAsC;AAAA,EAC1C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AACA,MAAM,WAAuC;AAAA,EAC3C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AASO,SAAS,OAAO;AAAA,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CAAoC,UAAS;AAAA;AAAA;AAAA,QAC9D;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { cn } from '../../utils/cn';\nimport { usePresence } from '../../utils/presence';\nimport { useModalLayer } from '../../utils/modal-layer';\n\nexport type DrawerSide = 'left' | 'right' | 'top' | 'bottom';\nexport type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport type DrawerProps = {\n open: boolean;\n /** Called with the next open state. Alias: onClose (close requests only). */\n onOpenChange?: (open: boolean) => void;\n /**\n * Called when the drawer asks to close: Escape, backdrop click or the close\n * button. Alias for `onOpenChange(false)`, used when only a close handler is\n * passed.\n */\n onClose?: () => void;\n title: string;\n description?: string;\n children?: React.ReactNode;\n /** Edge the drawer slides from (default 'right'). */\n side?: DrawerSide;\n /** Preset extent along the side axis (width for left/right, height for top/bottom). */\n size?: DrawerSize;\n /**\n * Custom extent for left/right drawers: pixels (480) or any CSS length\n * (\"70vw\"). Overrides `size`.\n */\n width?: number | string;\n /**\n * Custom extent for top/bottom drawers: pixels (320) or any CSS length\n * (\"60vh\"). Overrides `size`.\n */\n height?: number | string;\n /**\n * Drag the inner edge to resize a left/right drawer. Keyboard: Arrow keys\n * nudge 16px, Shift+Arrow 64px, Home/End jump to the bounds. Ignored for\n * top/bottom drawers.\n */\n resizable?: boolean;\n /** Lower bound in pixels while resizable (default 240). */\n minWidth?: number;\n /** Upper bound in pixels while resizable (default 960). */\n maxWidth?: number;\n /** Initial width in pixels while resizable; defaults to the `size` preset. */\n defaultWidth?: number;\n /** Fired with the next width in pixels when a resize commits. */\n onWidthChange?: (width: number) => void;\n /** Accessible label for the resize handle (default \"Resize drawer\"). */\n resizeLabel?: string;\n /** Clicking the backdrop closes (default true). */\n closeOnBackdrop?: boolean;\n /** Hide the close (✕) button in the header (default true). */\n showClose?: boolean;\n /** Accessible label for the close button (default \"Close drawer\"). */\n closeLabel?: string;\n /** Focused when the drawer opens; defaults to the first focusable element. */\n initialFocusRef?: React.RefObject<HTMLElement | null>;\n /** Overrides the accessible name (defaults to the title). */\n ariaLabel?: string;\n /**\n * Slide the panel in from its edge and out on close (requires the\n * tailwindcss-animate plugin). Off by default; reduced-motion users\n * get animate-none automatically.\n */\n animate?: boolean;\n};\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst sideClasses: Record<DrawerSide, string> = {\n right: 'inset-y-0 right-0 border-l',\n left: 'inset-y-0 left-0 border-r',\n top: 'inset-x-0 top-0 border-b',\n bottom: 'inset-x-0 bottom-0 border-t',\n};\n\nconst sideWidths: Record<DrawerSize, string> = {\n sm: 'w-72',\n md: 'w-96',\n lg: 'w-[32rem]',\n xl: 'w-[40rem]',\n '2xl': 'w-[48rem]',\n};\n\nconst sideHeights: Record<DrawerSize, string> = {\n sm: 'h-48',\n md: 'h-80',\n lg: 'h-[32rem]',\n xl: 'h-[40rem]',\n '2xl': 'h-[48rem]',\n};\n\nconst sizeClasses: Record<DrawerSide, Record<DrawerSize, string>> = {\n right: sideWidths,\n left: sideWidths,\n top: sideHeights,\n bottom: sideHeights,\n};\n\n/** Pixel equivalents of the width presets, used as the resize starting point. */\nconst sizePx: Record<DrawerSize, number> = {\n sm: 288,\n md: 384,\n lg: 512,\n xl: 640,\n '2xl': 768,\n};\n\n/** Custom extent wins over the preset; numbers are pixels. */\nfunction extentStyle(value: number | string | undefined): string | undefined {\n if (value === undefined) return undefined;\n return typeof value === 'number' ? `${value}px` : value;\n}\n\n// Literal class maps so Tailwind's scanner keeps every slide utility.\nconst slideIn: Record<DrawerSide, string> = {\n right: 'slide-in-from-right',\n left: 'slide-in-from-left',\n top: 'slide-in-from-top',\n bottom: 'slide-in-from-bottom',\n};\nconst slideOut: Record<DrawerSide, string> = {\n right: 'slide-out-to-right',\n left: 'slide-out-to-left',\n top: 'slide-out-to-top',\n bottom: 'slide-out-to-bottom',\n};\n\n/**\n * Edge sheet for secondary flows (filters, detail panes, mobile nav).\n * Modal semantics identical to Dialog: portal, aria-modal + labelled by\n * title, Escape and backdrop dismissal, focus move + Tab trap + focus\n * restoration on close. Renders fixed to the chosen edge with a border\n * against the backdrop.\n */\nexport function Drawer({\n open,\n onOpenChange,\n onClose,\n title,\n description,\n children,\n side = 'right',\n size = 'md',\n width,\n height,\n resizable = false,\n minWidth = 240,\n maxWidth = 960,\n defaultWidth,\n onWidthChange,\n resizeLabel = 'Resize drawer',\n closeOnBackdrop = true,\n showClose = true,\n closeLabel = 'Close drawer',\n initialFocusRef,\n ariaLabel,\n animate = false,\n}: DrawerProps) {\n const drawerRef = React.useRef<HTMLDivElement | null>(null);\n const previouslyFocused = React.useRef<HTMLElement | null>(null);\n const titleId = React.useId();\n const descriptionId = React.useId();\n const { present, exiting } = usePresence(open, animate);\n const isTopLayer = useModalLayer(open);\n\n // Prefer onOpenChange; fall back to the onClose alias so a migration code\n // path that only passes onClose still dismisses without double-firing.\n const requestClose = React.useCallback(() => {\n if (onOpenChange) onOpenChange(false);\n else onClose?.();\n }, [onOpenChange, onClose]);\n\n // Resizable left/right drawers. Width is state-local so dragging stays\n // smooth; `onWidthChange` fires once a drag commits or a key is pressed.\n const isVerticalSide = side === 'top' || side === 'bottom';\n const canResize = resizable && !isVerticalSide;\n const clampWidth = React.useCallback(\n (next: number) => Math.min(maxWidth, Math.max(minWidth, Math.round(next))),\n [minWidth, maxWidth]\n );\n const [resizedWidth, setResizedWidth] = React.useState<number | null>(null);\n const initialWidth = clampWidth(\n defaultWidth ?? (typeof width === 'number' ? width : sizePx[size])\n );\n const resizeWidth = resizedWidth ?? initialWidth;\n const widthRef = React.useRef(resizeWidth);\n widthRef.current = resizeWidth;\n const onWidthChangeRef = React.useRef(onWidthChange);\n onWidthChangeRef.current = onWidthChange;\n\n const commitWidth = (next: number) => {\n const clamped = clampWidth(next);\n setResizedWidth(clamped);\n onWidthChangeRef.current?.(clamped);\n };\n\n const onResizePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n event.preventDefault();\n const startX = event.clientX;\n const startWidth = resizeWidth;\n const onMove = (moveEvent: PointerEvent) => {\n const delta = side === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX;\n setResizedWidth(clampWidth(startWidth + delta));\n };\n const onUp = () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n onWidthChangeRef.current?.(widthRef.current);\n };\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n };\n\n const onResizeKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const step = event.shiftKey ? 64 : 16;\n const grow = side === 'right' ? 'ArrowLeft' : 'ArrowRight';\n const shrink = side === 'right' ? 'ArrowRight' : 'ArrowLeft';\n if (event.key === grow) {\n event.preventDefault();\n commitWidth(resizeWidth + step);\n } else if (event.key === shrink) {\n event.preventDefault();\n commitWidth(resizeWidth - step);\n } else if (event.key === 'Home') {\n event.preventDefault();\n commitWidth(minWidth);\n } else if (event.key === 'End') {\n event.preventDefault();\n commitWidth(maxWidth);\n }\n };\n\n // Capture the opener before the panel takes focus; restore the moment\n // open flips false — even while an exit animation keeps the DOM up.\n React.useEffect(() => {\n if (open) {\n previouslyFocused.current = document.activeElement as HTMLElement | null;\n return;\n }\n previouslyFocused.current?.focus?.();\n previouslyFocused.current = null;\n }, [open]);\n\n // Move focus in once the panel is actually mounted (present can lag\n // open by a render when the presence gate starts closed).\n React.useEffect(() => {\n if (!open || !present) return;\n const node = drawerRef.current;\n const target =\n initialFocusRef?.current ?? node?.querySelector<HTMLElement>(FOCUSABLE) ?? node;\n target?.focus();\n }, [open, present, initialFocusRef]);\n\n React.useEffect(() => {\n if (!open) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n if (!isTopLayer()) return;\n event.stopPropagation();\n requestClose();\n return;\n }\n if (event.key !== 'Tab') return;\n const node = drawerRef.current;\n if (!node) return;\n const focusable = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = document.activeElement;\n if (event.shiftKey && (active === first || !node.contains(active))) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [open, requestClose, isTopLayer]);\n\n if (!present || typeof document === 'undefined') return null;\n\n const customExtent = canResize\n ? `${resizeWidth}px`\n : isVerticalSide\n ? extentStyle(height)\n : extentStyle(width);\n\n const motion = animate\n ? cn(\n 'duration-200 motion-reduce:animate-none',\n exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`,\n )\n : undefined;\n\n // The backdrop dims and fades with the panel. Without it the page showed\n // through at full brightness while the drawer slid out, which read as a\n // content flash during close.\n const backdropMotion = animate\n ? cn('motion-reduce:animate-none', exiting ? 'animate-out fade-out-0' : 'animate-in fade-in-0')\n : undefined;\n\n return createPortal(\n <div\n className={cn('fixed inset-0 z-50 bg-background/80', backdropMotion)}\n onMouseDown={(event) => {\n if (closeOnBackdrop && event.target === event.currentTarget) requestClose();\n }}\n >\n <div\n ref={drawerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel ?? title}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n className={cn(\n 'fixed flex flex-col bg-background shadow-xl border-border',\n sideClasses[side],\n sizeClasses[side][size],\n motion\n )}\n style={customExtent ? { [isVerticalSide ? 'height' : 'width']: customExtent } : undefined}\n >\n {canResize && (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-valuenow={resizeWidth}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n tabIndex={0}\n onPointerDown={onResizePointerDown}\n onKeyDown={onResizeKeyDown}\n className={cn(\n 'absolute inset-y-0 z-10 w-2 cursor-col-resize touch-none rounded-sm bg-transparent',\n 'hover:bg-primary/20 focus-visible:bg-primary/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n side === 'right' ? '-left-1' : '-right-1'\n )}\n />\n )}\n <div className=\"flex items-start justify-between gap-4 border-b border-border px-5 py-4\">\n <div>\n <h2 id={titleId} className=\"text-base font-semibold leading-tight\">\n {title}\n </h2>\n {description && (\n <p id={descriptionId} className=\"mt-1 text-sm text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n {showClose && (\n <button\n type=\"button\"\n onClick={requestClose}\n aria-label={closeLabel}\n className=\"-me-1 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n ✕\n </button>\n )}\n </div>\n <div className=\"flex-1 overflow-y-auto px-5 py-4\">{children}</div>\n </div>\n </div>,\n document.body\n );\n}\n"],"mappings":";AAmVU,cAkBA,YAlBA;AAjVV,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAkE9B,MAAM,YACJ;AAEF,MAAM,cAA0C;AAAA,EAC9C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AACV;AAEA,MAAM,aAAyC;AAAA,EAC7C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA0C;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,MAAM,cAA8D;AAAA,EAClE,OAAO;AAAA,EACP,MAAM;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iBAAe;AAAA,kBACf,iBAAe;AAAA,kBACf,iBAAe;AAAA,kBACf,UAAU;AAAA,kBACV,eAAe;AAAA,kBACf,WAAW;AAAA,kBACX,WAAW;AAAA,oBACT;AAAA,oBACA;AAAA,oBACA,SAAS,UAAU,YAAY;AAAA,kBACjC;AAAA;AAAA,cACF;AAAA,cAEF,qBAAC,SAAI,WAAU,2EACb;AAAA,qCAAC,SACC;AAAA,sCAAC,QAAG,IAAI,SAAS,WAAU,yCACxB,iBACH;AAAA,kBACC,eACC,oBAAC,OAAE,IAAI,eAAe,WAAU,sCAC7B,uBACH;AAAA,mBAEJ;AAAA,gBACC,aACC;AAAA,kBAAC;AAAA;AAAA,oBACC,MAAK;AAAA,oBACL,SAAS;AAAA,oBACT,cAAY;AAAA,oBACZ,WAAU;AAAA,oBACX;AAAA;AAAA,gBAED;AAAA,iBAEJ;AAAA,cACA,oBAAC,SAAI,WAAU,oCAAoC,UAAS;AAAA;AAAA;AAAA,QAC9D;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
@@ -12,6 +12,8 @@ export type FilterChip = {
12
12
  export type FilterChipsProps = React.HTMLAttributes<HTMLDivElement> & {
13
13
  /** Active filters to render. */
14
14
  filters: FilterChip[];
15
+ /** Chip scale. Default 'md'. */
16
+ size?: 'sm' | 'md' | 'lg';
15
17
  /** Shows a clear-all action when provided. */
16
18
  onClearAll?: () => void;
17
19
  /** Label for the clear-all action. Default "Clear all". */
@@ -28,6 +30,8 @@ export type FilterChipsProps = React.HTMLAttributes<HTMLDivElement> & {
28
30
  export declare const FilterChips: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
29
31
  /** Active filters to render. */
30
32
  filters: FilterChip[];
33
+ /** Chip scale. Default 'md'. */
34
+ size?: "sm" | "md" | "lg";
31
35
  /** Shows a clear-all action when provided. */
32
36
  onClearAll?: () => void;
33
37
  /** Label for the clear-all action. Default "Clear all". */
@@ -35,8 +35,29 @@ module.exports = __toCommonJS(FilterChips_exports);
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var React = __toESM(require("react"));
37
37
  var import_cn = require("../../utils/cn.js");
38
+ const CHIP_SIZES = {
39
+ sm: {
40
+ chip: "gap-1 py-0.5 pl-2.5 pr-0.5 text-xs",
41
+ remove: "p-0.5",
42
+ icon: "h-3 w-3",
43
+ clear: "text-xs"
44
+ },
45
+ md: {
46
+ chip: "gap-1.5 py-1 pl-3 pr-1 text-sm",
47
+ remove: "p-1",
48
+ icon: "h-3.5 w-3.5",
49
+ clear: "text-sm"
50
+ },
51
+ lg: {
52
+ chip: "gap-2 py-1.5 pl-3.5 pr-1.5 text-base",
53
+ remove: "p-1.5",
54
+ icon: "h-4 w-4",
55
+ clear: "text-base"
56
+ }
57
+ };
38
58
  const FilterChips = React.forwardRef(function FilterChips2({
39
59
  filters,
60
+ size = "md",
40
61
  onClearAll,
41
62
  clearLabel = "Clear all",
42
63
  emptyLabel,
@@ -47,6 +68,7 @@ const FilterChips = React.forwardRef(function FilterChips2({
47
68
  if (filters.length === 0) {
48
69
  return emptyLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: (0, import_cn.cn)("text-sm text-muted-foreground", className), ...props, children: emptyLabel }) : null;
49
70
  }
71
+ const scale = CHIP_SIZES[size];
50
72
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
51
73
  "div",
52
74
  {
@@ -59,7 +81,10 @@ const FilterChips = React.forwardRef(function FilterChips2({
59
81
  filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
60
82
  "span",
61
83
  {
62
- className: "inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/60 py-1 pl-3 pr-1 text-sm",
84
+ className: (0, import_cn.cn)(
85
+ "inline-flex max-w-full items-center rounded-full border border-border bg-muted/60",
86
+ scale.chip
87
+ ),
63
88
  children: [
64
89
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "truncate", children: [
65
90
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "text-muted-foreground", children: [
@@ -75,8 +100,11 @@ const FilterChips = React.forwardRef(function FilterChips2({
75
100
  type: "button",
76
101
  onClick: filter.onRemove,
77
102
  "aria-label": `Remove ${filter.label}${filter.value ? `: ${filter.value}` : ""}`,
78
- className: "rounded-full p-1 text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
79
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m5 5 10 10M15 5 5 15" }) })
103
+ className: (0, import_cn.cn)(
104
+ "rounded-full text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
105
+ scale.remove
106
+ ),
107
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: scale.icon, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m5 5 10 10M15 5 5 15" }) })
80
108
  }
81
109
  )
82
110
  ]
@@ -88,7 +116,10 @@ const FilterChips = React.forwardRef(function FilterChips2({
88
116
  {
89
117
  type: "button",
90
118
  onClick: onClearAll,
91
- className: "rounded-sm px-1 text-sm font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
119
+ className: (0, import_cn.cn)(
120
+ "rounded-sm px-1 font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
121
+ scale.clear
122
+ ),
92
123
  children: clearLabel
93
124
  }
94
125
  )
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/filter-chips/FilterChips.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type FilterChip = {\n /** Stable key for the filter. */\n key: string;\n /** Filter name (e.g. \"Industry\"). */\n label: string;\n /** Selected value (e.g. \"Technology\"). */\n value?: string;\n /** Removes this filter. */\n onRemove?: () => void;\n};\n\nexport type FilterChipsProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Active filters to render. */\n filters: FilterChip[];\n /** Shows a clear-all action when provided. */\n onClearAll?: () => void;\n /** Label for the clear-all action. Default \"Clear all\". */\n clearLabel?: string;\n /** Shown when there are no active filters. Nothing renders when omitted. */\n emptyLabel?: string;\n};\n\n/**\n * Active-filter summary for list and dashboard pages. Each chip pairs a\n * filter name with its current value and exposes a remove action; an optional\n * clear-all action resets the set. Use it under FilterBar or FilterPanel so\n * applied filters stay visible after the controls scroll away.\n */\nexport const FilterChips = React.forwardRef<HTMLDivElement, FilterChipsProps>(function FilterChips(\n {\n filters,\n onClearAll,\n clearLabel = 'Clear all',\n emptyLabel,\n className,\n 'aria-label': ariaLabel = 'Active filters',\n ...props\n },\n ref\n) {\n if (filters.length === 0) {\n return emptyLabel ? (\n <div ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props}>\n {emptyLabel}\n </div>\n ) : null;\n }\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel}\n className={cn('flex flex-wrap items-center gap-2', className)}\n {...props}\n >\n {filters.map((filter) => (\n <span\n key={filter.key}\n className=\"inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/60 py-1 pl-3 pr-1 text-sm\"\n >\n <span className=\"truncate\">\n <span className=\"text-muted-foreground\">{filter.label}:</span>{' '}\n <span className=\"font-medium\">{filter.value ?? 'Any'}</span>\n </span>\n {filter.onRemove && (\n <button\n type=\"button\"\n onClick={filter.onRemove}\n aria-label={`Remove ${filter.label}${filter.value ? `: ${filter.value}` : ''}`}\n className=\"rounded-full p-1 text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" className=\"h-3.5 w-3.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\">\n <path d=\"m5 5 10 10M15 5 5 15\" />\n </svg>\n </button>\n )}\n </span>\n ))}\n {onClearAll && (\n <button\n type=\"button\"\n onClick={onClearAll}\n className=\"rounded-sm px-1 text-sm font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {clearLabel}\n </button>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+CM;AA7CN,YAAuB;AACvB,gBAAmB;AA8BZ,MAAM,cAAc,MAAM,WAA6C,SAASA,aACrF;AAAA,EACE;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,cAAc,YAAY;AAAA,EAC1B,GAAG;AACL,GACA,KACA;AACA,MAAI,QAAQ,WAAW,GAAG;AACxB,WAAO,aACL,4CAAC,SAAI,KAAU,eAAW,cAAG,iCAAiC,SAAS,GAAI,GAAG,OAC3E,sBACH,IACE;AAAA,EACN;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,cAAY;AAAA,MACZ,eAAW,cAAG,qCAAqC,SAAS;AAAA,MAC3D,GAAG;AAAA,MAEH;AAAA,gBAAQ,IAAI,CAAC,WACZ;AAAA,UAAC;AAAA;AAAA,YAEC,WAAU;AAAA,YAEV;AAAA,2DAAC,UAAK,WAAU,YACd;AAAA,6DAAC,UAAK,WAAU,yBAAyB;AAAA,yBAAO;AAAA,kBAAM;AAAA,mBAAC;AAAA,gBAAQ;AAAA,gBAC/D,4CAAC,UAAK,WAAU,eAAe,iBAAO,SAAS,OAAM;AAAA,iBACvD;AAAA,cACC,OAAO,YACN;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAK;AAAA,kBACL,SAAS,OAAO;AAAA,kBAChB,cAAY,UAAU,OAAO,KAAK,GAAG,OAAO,QAAQ,KAAK,OAAO,KAAK,KAAK,EAAE;AAAA,kBAC5E,WAAU;AAAA,kBAEV,sDAAC,SAAI,eAAY,QAAO,SAAQ,aAAY,WAAU,eAAc,MAAK,QAAO,QAAO,gBAAe,aAAY,KAAI,eAAc,SAClI,sDAAC,UAAK,GAAE,wBAAuB,GACjC;AAAA;AAAA,cACF;AAAA;AAAA;AAAA,UAjBG,OAAO;AAAA,QAmBd,CACD;AAAA,QACA,cACC;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS;AAAA,YACT,WAAU;AAAA,YAET;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["FilterChips"]}
1
+ {"version":3,"sources":["../../../../src/components/filter-chips/FilterChips.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type FilterChip = {\n /** Stable key for the filter. */\n key: string;\n /** Filter name (e.g. \"Industry\"). */\n label: string;\n /** Selected value (e.g. \"Technology\"). */\n value?: string;\n /** Removes this filter. */\n onRemove?: () => void;\n};\n\nexport type FilterChipsProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Active filters to render. */\n filters: FilterChip[];\n /** Chip scale. Default 'md'. */\n size?: 'sm' | 'md' | 'lg';\n /** Shows a clear-all action when provided. */\n onClearAll?: () => void;\n /** Label for the clear-all action. Default \"Clear all\". */\n clearLabel?: string;\n /** Shown when there are no active filters. Nothing renders when omitted. */\n emptyLabel?: string;\n};\n\n/** Literal size maps so the scanner keeps every chip utility. */\nconst CHIP_SIZES = {\n sm: {\n chip: 'gap-1 py-0.5 pl-2.5 pr-0.5 text-xs',\n remove: 'p-0.5',\n icon: 'h-3 w-3',\n clear: 'text-xs',\n },\n md: {\n chip: 'gap-1.5 py-1 pl-3 pr-1 text-sm',\n remove: 'p-1',\n icon: 'h-3.5 w-3.5',\n clear: 'text-sm',\n },\n lg: {\n chip: 'gap-2 py-1.5 pl-3.5 pr-1.5 text-base',\n remove: 'p-1.5',\n icon: 'h-4 w-4',\n clear: 'text-base',\n },\n} as const;\n\n/**\n * Active-filter summary for list and dashboard pages. Each chip pairs a\n * filter name with its current value and exposes a remove action; an optional\n * clear-all action resets the set. Use it under FilterBar or FilterPanel so\n * applied filters stay visible after the controls scroll away.\n */\nexport const FilterChips = React.forwardRef<HTMLDivElement, FilterChipsProps>(function FilterChips(\n {\n filters,\n size = 'md',\n onClearAll,\n clearLabel = 'Clear all',\n emptyLabel,\n className,\n 'aria-label': ariaLabel = 'Active filters',\n ...props\n },\n ref\n) {\n if (filters.length === 0) {\n return emptyLabel ? (\n <div ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props}>\n {emptyLabel}\n </div>\n ) : null;\n }\n\n const scale = CHIP_SIZES[size];\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel}\n className={cn('flex flex-wrap items-center gap-2', className)}\n {...props}\n >\n {filters.map((filter) => (\n <span\n key={filter.key}\n className={cn(\n 'inline-flex max-w-full items-center rounded-full border border-border bg-muted/60',\n scale.chip\n )}\n >\n <span className=\"truncate\">\n <span className=\"text-muted-foreground\">{filter.label}:</span>{' '}\n <span className=\"font-medium\">{filter.value ?? 'Any'}</span>\n </span>\n {filter.onRemove && (\n <button\n type=\"button\"\n onClick={filter.onRemove}\n aria-label={`Remove ${filter.label}${filter.value ? `: ${filter.value}` : ''}`}\n className={cn(\n 'rounded-full text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n scale.remove\n )}\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" className={scale.icon} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\">\n <path d=\"m5 5 10 10M15 5 5 15\" />\n </svg>\n </button>\n )}\n </span>\n ))}\n {onClearAll && (\n <button\n type=\"button\"\n onClick={onClearAll}\n className={cn(\n 'rounded-sm px-1 font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n scale.clear\n )}\n >\n {clearLabel}\n </button>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwEM;AAtEN,YAAuB;AACvB,gBAAmB;AA2BnB,MAAM,aAAa;AAAA,EACjB,IAAI;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA,IAAI;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA,IAAI;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AACF;AAQO,MAAM,cAAc,MAAM,WAA6C,SAASA,aACrF;AAAA,EACE;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,cAAc,YAAY;AAAA,EAC1B,GAAG;AACL,GACA,KACA;AACA,MAAI,QAAQ,WAAW,GAAG;AACxB,WAAO,aACL,4CAAC,SAAI,KAAU,eAAW,cAAG,iCAAiC,SAAS,GAAI,GAAG,OAC3E,sBACH,IACE;AAAA,EACN;AAEA,QAAM,QAAQ,WAAW,IAAI;AAE7B,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,cAAY;AAAA,MACZ,eAAW,cAAG,qCAAqC,SAAS;AAAA,MAC3D,GAAG;AAAA,MAEH;AAAA,gBAAQ,IAAI,CAAC,WACZ;AAAA,UAAC;AAAA;AAAA,YAEC,eAAW;AAAA,cACT;AAAA,cACA,MAAM;AAAA,YACR;AAAA,YAEA;AAAA,2DAAC,UAAK,WAAU,YACd;AAAA,6DAAC,UAAK,WAAU,yBAAyB;AAAA,yBAAO;AAAA,kBAAM;AAAA,mBAAC;AAAA,gBAAQ;AAAA,gBAC/D,4CAAC,UAAK,WAAU,eAAe,iBAAO,SAAS,OAAM;AAAA,iBACvD;AAAA,cACC,OAAO,YACN;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAK;AAAA,kBACL,SAAS,OAAO;AAAA,kBAChB,cAAY,UAAU,OAAO,KAAK,GAAG,OAAO,QAAQ,KAAK,OAAO,KAAK,KAAK,EAAE;AAAA,kBAC5E,eAAW;AAAA,oBACT;AAAA,oBACA,MAAM;AAAA,kBACR;AAAA,kBAEA,sDAAC,SAAI,eAAY,QAAO,SAAQ,aAAY,WAAW,MAAM,MAAM,MAAK,QAAO,QAAO,gBAAe,aAAY,KAAI,eAAc,SACjI,sDAAC,UAAK,GAAE,wBAAuB,GACjC;AAAA;AAAA,cACF;AAAA;AAAA;AAAA,UAvBG,OAAO;AAAA,QAyBd,CACD;AAAA,QACA,cACC;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS;AAAA,YACT,eAAW;AAAA,cACT;AAAA,cACA,MAAM;AAAA,YACR;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["FilterChips"]}
@@ -2,8 +2,29 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { cn } from "../../utils/cn.mjs";
5
+ const CHIP_SIZES = {
6
+ sm: {
7
+ chip: "gap-1 py-0.5 pl-2.5 pr-0.5 text-xs",
8
+ remove: "p-0.5",
9
+ icon: "h-3 w-3",
10
+ clear: "text-xs"
11
+ },
12
+ md: {
13
+ chip: "gap-1.5 py-1 pl-3 pr-1 text-sm",
14
+ remove: "p-1",
15
+ icon: "h-3.5 w-3.5",
16
+ clear: "text-sm"
17
+ },
18
+ lg: {
19
+ chip: "gap-2 py-1.5 pl-3.5 pr-1.5 text-base",
20
+ remove: "p-1.5",
21
+ icon: "h-4 w-4",
22
+ clear: "text-base"
23
+ }
24
+ };
5
25
  const FilterChips = React.forwardRef(function FilterChips2({
6
26
  filters,
27
+ size = "md",
7
28
  onClearAll,
8
29
  clearLabel = "Clear all",
9
30
  emptyLabel,
@@ -14,6 +35,7 @@ const FilterChips = React.forwardRef(function FilterChips2({
14
35
  if (filters.length === 0) {
15
36
  return emptyLabel ? /* @__PURE__ */ jsx("div", { ref, className: cn("text-sm text-muted-foreground", className), ...props, children: emptyLabel }) : null;
16
37
  }
38
+ const scale = CHIP_SIZES[size];
17
39
  return /* @__PURE__ */ jsxs(
18
40
  "div",
19
41
  {
@@ -26,7 +48,10 @@ const FilterChips = React.forwardRef(function FilterChips2({
26
48
  filters.map((filter) => /* @__PURE__ */ jsxs(
27
49
  "span",
28
50
  {
29
- className: "inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/60 py-1 pl-3 pr-1 text-sm",
51
+ className: cn(
52
+ "inline-flex max-w-full items-center rounded-full border border-border bg-muted/60",
53
+ scale.chip
54
+ ),
30
55
  children: [
31
56
  /* @__PURE__ */ jsxs("span", { className: "truncate", children: [
32
57
  /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
@@ -42,8 +67,11 @@ const FilterChips = React.forwardRef(function FilterChips2({
42
67
  type: "button",
43
68
  onClick: filter.onRemove,
44
69
  "aria-label": `Remove ${filter.label}${filter.value ? `: ${filter.value}` : ""}`,
45
- className: "rounded-full p-1 text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
46
- children: /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ jsx("path", { d: "m5 5 10 10M15 5 5 15" }) })
70
+ className: cn(
71
+ "rounded-full text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
72
+ scale.remove
73
+ ),
74
+ children: /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: scale.icon, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ jsx("path", { d: "m5 5 10 10M15 5 5 15" }) })
47
75
  }
48
76
  )
49
77
  ]
@@ -55,7 +83,10 @@ const FilterChips = React.forwardRef(function FilterChips2({
55
83
  {
56
84
  type: "button",
57
85
  onClick: onClearAll,
58
- className: "rounded-sm px-1 text-sm font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
86
+ className: cn(
87
+ "rounded-sm px-1 font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
88
+ scale.clear
89
+ ),
59
90
  children: clearLabel
60
91
  }
61
92
  )
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/filter-chips/FilterChips.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type FilterChip = {\n /** Stable key for the filter. */\n key: string;\n /** Filter name (e.g. \"Industry\"). */\n label: string;\n /** Selected value (e.g. \"Technology\"). */\n value?: string;\n /** Removes this filter. */\n onRemove?: () => void;\n};\n\nexport type FilterChipsProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Active filters to render. */\n filters: FilterChip[];\n /** Shows a clear-all action when provided. */\n onClearAll?: () => void;\n /** Label for the clear-all action. Default \"Clear all\". */\n clearLabel?: string;\n /** Shown when there are no active filters. Nothing renders when omitted. */\n emptyLabel?: string;\n};\n\n/**\n * Active-filter summary for list and dashboard pages. Each chip pairs a\n * filter name with its current value and exposes a remove action; an optional\n * clear-all action resets the set. Use it under FilterBar or FilterPanel so\n * applied filters stay visible after the controls scroll away.\n */\nexport const FilterChips = React.forwardRef<HTMLDivElement, FilterChipsProps>(function FilterChips(\n {\n filters,\n onClearAll,\n clearLabel = 'Clear all',\n emptyLabel,\n className,\n 'aria-label': ariaLabel = 'Active filters',\n ...props\n },\n ref\n) {\n if (filters.length === 0) {\n return emptyLabel ? (\n <div ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props}>\n {emptyLabel}\n </div>\n ) : null;\n }\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel}\n className={cn('flex flex-wrap items-center gap-2', className)}\n {...props}\n >\n {filters.map((filter) => (\n <span\n key={filter.key}\n className=\"inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/60 py-1 pl-3 pr-1 text-sm\"\n >\n <span className=\"truncate\">\n <span className=\"text-muted-foreground\">{filter.label}:</span>{' '}\n <span className=\"font-medium\">{filter.value ?? 'Any'}</span>\n </span>\n {filter.onRemove && (\n <button\n type=\"button\"\n onClick={filter.onRemove}\n aria-label={`Remove ${filter.label}${filter.value ? `: ${filter.value}` : ''}`}\n className=\"rounded-full p-1 text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" className=\"h-3.5 w-3.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\">\n <path d=\"m5 5 10 10M15 5 5 15\" />\n </svg>\n </button>\n )}\n </span>\n ))}\n {onClearAll && (\n <button\n type=\"button\"\n onClick={onClearAll}\n className=\"rounded-sm px-1 text-sm font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {clearLabel}\n </button>\n )}\n </div>\n );\n});\n"],"mappings":";AA+CM,cAoBM,YApBN;AA7CN,YAAY,WAAW;AACvB,SAAS,UAAU;AA8BZ,MAAM,cAAc,MAAM,WAA6C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names":["FilterChips"]}
1
+ {"version":3,"sources":["../../../../src/components/filter-chips/FilterChips.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type FilterChip = {\n /** Stable key for the filter. */\n key: string;\n /** Filter name (e.g. \"Industry\"). */\n label: string;\n /** Selected value (e.g. \"Technology\"). */\n value?: string;\n /** Removes this filter. */\n onRemove?: () => void;\n};\n\nexport type FilterChipsProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Active filters to render. */\n filters: FilterChip[];\n /** Chip scale. Default 'md'. */\n size?: 'sm' | 'md' | 'lg';\n /** Shows a clear-all action when provided. */\n onClearAll?: () => void;\n /** Label for the clear-all action. Default \"Clear all\". */\n clearLabel?: string;\n /** Shown when there are no active filters. Nothing renders when omitted. */\n emptyLabel?: string;\n};\n\n/** Literal size maps so the scanner keeps every chip utility. */\nconst CHIP_SIZES = {\n sm: {\n chip: 'gap-1 py-0.5 pl-2.5 pr-0.5 text-xs',\n remove: 'p-0.5',\n icon: 'h-3 w-3',\n clear: 'text-xs',\n },\n md: {\n chip: 'gap-1.5 py-1 pl-3 pr-1 text-sm',\n remove: 'p-1',\n icon: 'h-3.5 w-3.5',\n clear: 'text-sm',\n },\n lg: {\n chip: 'gap-2 py-1.5 pl-3.5 pr-1.5 text-base',\n remove: 'p-1.5',\n icon: 'h-4 w-4',\n clear: 'text-base',\n },\n} as const;\n\n/**\n * Active-filter summary for list and dashboard pages. Each chip pairs a\n * filter name with its current value and exposes a remove action; an optional\n * clear-all action resets the set. Use it under FilterBar or FilterPanel so\n * applied filters stay visible after the controls scroll away.\n */\nexport const FilterChips = React.forwardRef<HTMLDivElement, FilterChipsProps>(function FilterChips(\n {\n filters,\n size = 'md',\n onClearAll,\n clearLabel = 'Clear all',\n emptyLabel,\n className,\n 'aria-label': ariaLabel = 'Active filters',\n ...props\n },\n ref\n) {\n if (filters.length === 0) {\n return emptyLabel ? (\n <div ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props}>\n {emptyLabel}\n </div>\n ) : null;\n }\n\n const scale = CHIP_SIZES[size];\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel}\n className={cn('flex flex-wrap items-center gap-2', className)}\n {...props}\n >\n {filters.map((filter) => (\n <span\n key={filter.key}\n className={cn(\n 'inline-flex max-w-full items-center rounded-full border border-border bg-muted/60',\n scale.chip\n )}\n >\n <span className=\"truncate\">\n <span className=\"text-muted-foreground\">{filter.label}:</span>{' '}\n <span className=\"font-medium\">{filter.value ?? 'Any'}</span>\n </span>\n {filter.onRemove && (\n <button\n type=\"button\"\n onClick={filter.onRemove}\n aria-label={`Remove ${filter.label}${filter.value ? `: ${filter.value}` : ''}`}\n className={cn(\n 'rounded-full text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n scale.remove\n )}\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" className={scale.icon} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\">\n <path d=\"m5 5 10 10M15 5 5 15\" />\n </svg>\n </button>\n )}\n </span>\n ))}\n {onClearAll && (\n <button\n type=\"button\"\n onClick={onClearAll}\n className={cn(\n 'rounded-sm px-1 font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n scale.clear\n )}\n >\n {clearLabel}\n </button>\n )}\n </div>\n );\n});\n"],"mappings":";AAwEM,cAyBM,YAzBN;AAtEN,YAAY,WAAW;AACvB,SAAS,UAAU;AA2BnB,MAAM,aAAa;AAAA,EACjB,IAAI;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA,IAAI;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA,IAAI;AAAA,IACF,MAAM;AAAA,I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B,GACjC;AAAA;AAAA,cACF;AAAA;AAAA;AAAA,UAvBG,OAAO;AAAA,QAyBd,CACD;AAAA,QACA,cACC;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS;AAAA,YACT,WAAW;AAAA,cACT;AAAA,cACA,MAAM;AAAA,YACR;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["FilterChips"]}
@@ -50,7 +50,7 @@ const Radio = React.forwardRef(
50
50
  onChange?.(event);
51
51
  },
52
52
  className: (0, import_cn.cn)(
53
- "h-4 w-4 shrink-0 rounded-full border border-primary",
53
+ "h-4 w-4 shrink-0 rounded-full border border-primary accent-primary",
54
54
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
55
55
  "disabled:cursor-not-allowed disabled:opacity-50",
56
56
  "checked:bg-primary checked:text-primary-foreground",