@slipstream-ui/core 0.9.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/LICENSE +0 -4
  2. package/dist/index.d.mts +32 -4
  3. package/dist/index.d.ts +32 -4
  4. package/dist/index.js +162 -88
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +162 -88
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/manifests/accordion.manifest.json +1 -1
  9. package/dist/manifests/alert.manifest.json +1 -1
  10. package/dist/manifests/announcement-bar.manifest.json +1 -1
  11. package/dist/manifests/app-shell.manifest.json +1 -1
  12. package/dist/manifests/applied-filters.manifest.json +1 -1
  13. package/dist/manifests/article-card.manifest.json +1 -1
  14. package/dist/manifests/auth-layout.manifest.json +1 -1
  15. package/dist/manifests/autocomplete.manifest.json +1 -1
  16. package/dist/manifests/avatar.manifest.json +1 -1
  17. package/dist/manifests/badge.manifest.json +1 -1
  18. package/dist/manifests/block.manifest.json +1 -1
  19. package/dist/manifests/bottom-nav.manifest.json +1 -1
  20. package/dist/manifests/breadcrumb.manifest.json +1 -1
  21. package/dist/manifests/button-group.manifest.json +1 -1
  22. package/dist/manifests/button.manifest.json +1 -1
  23. package/dist/manifests/calendar.manifest.json +1 -1
  24. package/dist/manifests/card.manifest.json +1 -1
  25. package/dist/manifests/checkbox.manifest.json +1 -1
  26. package/dist/manifests/comparison-table.manifest.json +1 -1
  27. package/dist/manifests/confirm-dialog.manifest.json +1 -1
  28. package/dist/manifests/contact-strip.manifest.json +1 -1
  29. package/dist/manifests/container.manifest.json +1 -1
  30. package/dist/manifests/cta-section.manifest.json +1 -1
  31. package/dist/manifests/data-table.manifest.json +1 -1
  32. package/dist/manifests/date-picker-popover.manifest.json +1 -1
  33. package/dist/manifests/date-picker.manifest.json +1 -1
  34. package/dist/manifests/date-range-picker.manifest.json +1 -1
  35. package/dist/manifests/deal-card.manifest.json +1 -1
  36. package/dist/manifests/dialog.manifest.json +1 -1
  37. package/dist/manifests/document-card.manifest.json +1 -1
  38. package/dist/manifests/drawer.manifest.json +1 -1
  39. package/dist/manifests/empty-state.manifest.json +1 -1
  40. package/dist/manifests/entity-card.manifest.json +1 -1
  41. package/dist/manifests/feature-grid.manifest.json +1 -1
  42. package/dist/manifests/feature-row.manifest.json +1 -1
  43. package/dist/manifests/fieldset.manifest.json +1 -1
  44. package/dist/manifests/file-upload.manifest.json +1 -1
  45. package/dist/manifests/filter-bar.manifest.json +1 -1
  46. package/dist/manifests/filter-chips.manifest.json +13 -1
  47. package/dist/manifests/filter-panel.manifest.json +1 -1
  48. package/dist/manifests/flex.manifest.json +1 -1
  49. package/dist/manifests/form-field.manifest.json +1 -1
  50. package/dist/manifests/form-layout.manifest.json +1 -1
  51. package/dist/manifests/form.manifest.json +1 -1
  52. package/dist/manifests/grid.manifest.json +1 -1
  53. package/dist/manifests/heading.manifest.json +1 -1
  54. package/dist/manifests/hero.manifest.json +1 -1
  55. package/dist/manifests/image.manifest.json +1 -1
  56. package/dist/manifests/input-group.manifest.json +1 -1
  57. package/dist/manifests/input.manifest.json +1 -1
  58. package/dist/manifests/label.manifest.json +1 -1
  59. package/dist/manifests/link-tabs.manifest.json +1 -1
  60. package/dist/manifests/link.manifest.json +1 -1
  61. package/dist/manifests/list.manifest.json +1 -1
  62. package/dist/manifests/load-more.manifest.json +1 -1
  63. package/dist/manifests/logo-cloud.manifest.json +1 -1
  64. package/dist/manifests/menu.manifest.json +1 -1
  65. package/dist/manifests/metric-card.manifest.json +1 -1
  66. package/dist/manifests/multi-select.manifest.json +1 -1
  67. package/dist/manifests/newsletter.manifest.json +1 -1
  68. package/dist/manifests/page-header.manifest.json +1 -1
  69. package/dist/manifests/pagination.manifest.json +1 -1
  70. package/dist/manifests/password-input.manifest.json +1 -1
  71. package/dist/manifests/popover.manifest.json +1 -1
  72. package/dist/manifests/process-steps.manifest.json +1 -1
  73. package/dist/manifests/progress.manifest.json +1 -1
  74. package/dist/manifests/prose.manifest.json +1 -1
  75. package/dist/manifests/radio.manifest.json +1 -1
  76. package/dist/manifests/range-slider.manifest.json +1 -1
  77. package/dist/manifests/search.manifest.json +1 -1
  78. package/dist/manifests/section-heading.manifest.json +1 -1
  79. package/dist/manifests/section.manifest.json +1 -1
  80. package/dist/manifests/segmented-control.manifest.json +1 -1
  81. package/dist/manifests/select-menu.manifest.json +1 -1
  82. package/dist/manifests/select.manifest.json +8 -1
  83. package/dist/manifests/separator.manifest.json +1 -1
  84. package/dist/manifests/site-footer.manifest.json +1 -1
  85. package/dist/manifests/site-header.manifest.json +1 -1
  86. package/dist/manifests/skeleton.manifest.json +1 -1
  87. package/dist/manifests/spinner.manifest.json +1 -1
  88. package/dist/manifests/stat-band.manifest.json +1 -1
  89. package/dist/manifests/stepper.manifest.json +1 -1
  90. package/dist/manifests/switch.manifest.json +1 -1
  91. package/dist/manifests/table-card.manifest.json +1 -1
  92. package/dist/manifests/table-of-contents.manifest.json +1 -1
  93. package/dist/manifests/table.manifest.json +1 -1
  94. package/dist/manifests/tabs.manifest.json +1 -1
  95. package/dist/manifests/testimonial.manifest.json +1 -1
  96. package/dist/manifests/text.manifest.json +1 -1
  97. package/dist/manifests/textarea.manifest.json +1 -1
  98. package/dist/manifests/theme-toggle.manifest.json +1 -1
  99. package/dist/manifests/time-picker.manifest.json +1 -1
  100. package/dist/manifests/timeline.manifest.json +1 -1
  101. package/dist/manifests/toast.manifest.json +1 -1
  102. package/dist/manifests/tombstone-card.manifest.json +1 -1
  103. package/dist/manifests/tooltip.manifest.json +12 -1
  104. package/dist/src/components/accordion/Accordion.js +26 -19
  105. package/dist/src/components/accordion/Accordion.js.map +1 -1
  106. package/dist/src/components/accordion/Accordion.mjs +26 -19
  107. package/dist/src/components/accordion/Accordion.mjs.map +1 -1
  108. package/dist/src/components/bottom-nav/BottomNav.js +1 -1
  109. package/dist/src/components/bottom-nav/BottomNav.js.map +1 -1
  110. package/dist/src/components/bottom-nav/BottomNav.mjs +1 -1
  111. package/dist/src/components/bottom-nav/BottomNav.mjs.map +1 -1
  112. package/dist/src/components/button/Button.js +1 -1
  113. package/dist/src/components/button/Button.js.map +1 -1
  114. package/dist/src/components/button/Button.mjs +1 -1
  115. package/dist/src/components/button/Button.mjs.map +1 -1
  116. package/dist/src/components/checkbox/Checkbox.js +1 -1
  117. package/dist/src/components/checkbox/Checkbox.js.map +1 -1
  118. package/dist/src/components/checkbox/Checkbox.mjs +1 -1
  119. package/dist/src/components/checkbox/Checkbox.mjs.map +1 -1
  120. package/dist/src/components/contact-strip/ContactStrip.js +2 -2
  121. package/dist/src/components/contact-strip/ContactStrip.js.map +1 -1
  122. package/dist/src/components/contact-strip/ContactStrip.mjs +2 -2
  123. package/dist/src/components/contact-strip/ContactStrip.mjs.map +1 -1
  124. package/dist/src/components/date-picker-popover/DatePickerPopover.d.ts +3 -0
  125. package/dist/src/components/date-picker-popover/DatePickerPopover.js +5 -1
  126. package/dist/src/components/date-picker-popover/DatePickerPopover.js.map +1 -1
  127. package/dist/src/components/date-picker-popover/DatePickerPopover.mjs +5 -1
  128. package/dist/src/components/date-picker-popover/DatePickerPopover.mjs.map +1 -1
  129. package/dist/src/components/deal-card/DealCard.js +2 -2
  130. package/dist/src/components/deal-card/DealCard.js.map +1 -1
  131. package/dist/src/components/deal-card/DealCard.mjs +2 -2
  132. package/dist/src/components/deal-card/DealCard.mjs.map +1 -1
  133. package/dist/src/components/document-card/DocumentCard.js +1 -1
  134. package/dist/src/components/document-card/DocumentCard.js.map +1 -1
  135. package/dist/src/components/document-card/DocumentCard.mjs +1 -1
  136. package/dist/src/components/document-card/DocumentCard.mjs.map +1 -1
  137. package/dist/src/components/drawer/Drawer.js +2 -1
  138. package/dist/src/components/drawer/Drawer.js.map +1 -1
  139. package/dist/src/components/drawer/Drawer.mjs +2 -1
  140. package/dist/src/components/drawer/Drawer.mjs.map +1 -1
  141. package/dist/src/components/entity-card/EntityCard.js +2 -2
  142. package/dist/src/components/entity-card/EntityCard.js.map +1 -1
  143. package/dist/src/components/entity-card/EntityCard.mjs +2 -2
  144. package/dist/src/components/entity-card/EntityCard.mjs.map +1 -1
  145. package/dist/src/components/feature-grid/FeatureGrid.js +2 -2
  146. package/dist/src/components/feature-grid/FeatureGrid.js.map +1 -1
  147. package/dist/src/components/feature-grid/FeatureGrid.mjs +2 -2
  148. package/dist/src/components/feature-grid/FeatureGrid.mjs.map +1 -1
  149. package/dist/src/components/feature-row/FeatureRow.js +1 -1
  150. package/dist/src/components/feature-row/FeatureRow.js.map +1 -1
  151. package/dist/src/components/feature-row/FeatureRow.mjs +1 -1
  152. package/dist/src/components/feature-row/FeatureRow.mjs.map +1 -1
  153. package/dist/src/components/file-upload/FileUpload.d.ts +8 -2
  154. package/dist/src/components/file-upload/FileUpload.js +12 -2
  155. package/dist/src/components/file-upload/FileUpload.js.map +1 -1
  156. package/dist/src/components/file-upload/FileUpload.mjs +12 -2
  157. package/dist/src/components/file-upload/FileUpload.mjs.map +1 -1
  158. package/dist/src/components/filter-chips/FilterChips.d.ts +4 -0
  159. package/dist/src/components/filter-chips/FilterChips.js +35 -4
  160. package/dist/src/components/filter-chips/FilterChips.js.map +1 -1
  161. package/dist/src/components/filter-chips/FilterChips.mjs +35 -4
  162. package/dist/src/components/filter-chips/FilterChips.mjs.map +1 -1
  163. package/dist/src/components/filter-panel/FilterPanel.js +16 -12
  164. package/dist/src/components/filter-panel/FilterPanel.js.map +1 -1
  165. package/dist/src/components/filter-panel/FilterPanel.mjs +16 -12
  166. package/dist/src/components/filter-panel/FilterPanel.mjs.map +1 -1
  167. package/dist/src/components/hero/Hero.js +2 -2
  168. package/dist/src/components/hero/Hero.js.map +1 -1
  169. package/dist/src/components/hero/Hero.mjs +2 -2
  170. package/dist/src/components/hero/Hero.mjs.map +1 -1
  171. package/dist/src/components/image/Image.js +5 -0
  172. package/dist/src/components/image/Image.js.map +1 -1
  173. package/dist/src/components/image/Image.mjs +5 -0
  174. package/dist/src/components/image/Image.mjs.map +1 -1
  175. package/dist/src/components/list/List.js +5 -4
  176. package/dist/src/components/list/List.js.map +1 -1
  177. package/dist/src/components/list/List.mjs +5 -4
  178. package/dist/src/components/list/List.mjs.map +1 -1
  179. package/dist/src/components/menu/Menu.d.ts +2 -2
  180. package/dist/src/components/menu/Menu.js.map +1 -1
  181. package/dist/src/components/menu/Menu.mjs.map +1 -1
  182. package/dist/src/components/process-steps/ProcessSteps.js +1 -1
  183. package/dist/src/components/process-steps/ProcessSteps.js.map +1 -1
  184. package/dist/src/components/process-steps/ProcessSteps.mjs +1 -1
  185. package/dist/src/components/process-steps/ProcessSteps.mjs.map +1 -1
  186. package/dist/src/components/prose/Prose.js +1 -1
  187. package/dist/src/components/prose/Prose.js.map +1 -1
  188. package/dist/src/components/prose/Prose.mjs +1 -1
  189. package/dist/src/components/prose/Prose.mjs.map +1 -1
  190. package/dist/src/components/radio/Radio.js +2 -2
  191. package/dist/src/components/radio/Radio.js.map +1 -1
  192. package/dist/src/components/radio/Radio.mjs +2 -2
  193. package/dist/src/components/radio/Radio.mjs.map +1 -1
  194. package/dist/src/components/range-slider/RangeSlider.js +3 -3
  195. package/dist/src/components/range-slider/RangeSlider.js.map +1 -1
  196. package/dist/src/components/range-slider/RangeSlider.mjs +3 -3
  197. package/dist/src/components/range-slider/RangeSlider.mjs.map +1 -1
  198. package/dist/src/components/select/Select.d.ts +10 -0
  199. package/dist/src/components/select/Select.js +2 -2
  200. package/dist/src/components/select/Select.js.map +1 -1
  201. package/dist/src/components/select/Select.mjs +2 -2
  202. package/dist/src/components/select/Select.mjs.map +1 -1
  203. package/dist/src/components/select-menu/SelectMenu.js +1 -1
  204. package/dist/src/components/select-menu/SelectMenu.js.map +1 -1
  205. package/dist/src/components/select-menu/SelectMenu.mjs +1 -1
  206. package/dist/src/components/select-menu/SelectMenu.mjs.map +1 -1
  207. package/dist/src/components/stepper/Stepper.js +1 -1
  208. package/dist/src/components/stepper/Stepper.js.map +1 -1
  209. package/dist/src/components/stepper/Stepper.mjs +1 -1
  210. package/dist/src/components/stepper/Stepper.mjs.map +1 -1
  211. package/dist/src/components/table-of-contents/TableOfContents.js +1 -1
  212. package/dist/src/components/table-of-contents/TableOfContents.js.map +1 -1
  213. package/dist/src/components/table-of-contents/TableOfContents.mjs +1 -1
  214. package/dist/src/components/table-of-contents/TableOfContents.mjs.map +1 -1
  215. package/dist/src/components/timeline/Timeline.js +17 -13
  216. package/dist/src/components/timeline/Timeline.js.map +1 -1
  217. package/dist/src/components/timeline/Timeline.mjs +17 -13
  218. package/dist/src/components/timeline/Timeline.mjs.map +1 -1
  219. package/dist/src/components/toast/Toast.js +1 -1
  220. package/dist/src/components/toast/Toast.js.map +1 -1
  221. package/dist/src/components/toast/Toast.mjs +1 -1
  222. package/dist/src/components/toast/Toast.mjs.map +1 -1
  223. package/dist/src/components/toast/Toaster.js +1 -1
  224. package/dist/src/components/toast/Toaster.js.map +1 -1
  225. package/dist/src/components/toast/Toaster.mjs +1 -1
  226. package/dist/src/components/toast/Toaster.mjs.map +1 -1
  227. package/dist/src/components/tombstone-card/TombstoneCard.js +1 -1
  228. package/dist/src/components/tombstone-card/TombstoneCard.js.map +1 -1
  229. package/dist/src/components/tombstone-card/TombstoneCard.mjs +1 -1
  230. package/dist/src/components/tombstone-card/TombstoneCard.mjs.map +1 -1
  231. package/dist/src/components/tooltip/Tooltip.d.ts +5 -0
  232. package/dist/src/components/tooltip/Tooltip.js +9 -2
  233. package/dist/src/components/tooltip/Tooltip.js.map +1 -1
  234. package/dist/src/components/tooltip/Tooltip.mjs +9 -2
  235. package/dist/src/components/tooltip/Tooltip.mjs.map +1 -1
  236. package/dist/styles-full.css +1 -1
  237. package/dist/styles.css +1 -1
  238. package/package.json +6 -6
  239. package/src/components/accordion/Accordion.test.tsx +14 -3
  240. package/src/components/accordion/Accordion.tsx +34 -21
  241. package/src/components/bottom-nav/BottomNav.tsx +1 -1
  242. package/src/components/button/Button.tsx +1 -1
  243. package/src/components/calendar/Calendar.test.tsx +1 -1
  244. package/src/components/checkbox/Checkbox.tsx +1 -1
  245. package/src/components/contact-strip/ContactStrip.tsx +2 -2
  246. package/src/components/date-picker-popover/DatePickerPopover.test.tsx +15 -0
  247. package/src/components/date-picker-popover/DatePickerPopover.tsx +7 -0
  248. package/src/components/deal-card/DealCard.tsx +2 -2
  249. package/src/components/document-card/DocumentCard.tsx +1 -1
  250. package/src/components/drawer/Drawer.test.tsx +12 -0
  251. package/src/components/drawer/Drawer.tsx +8 -1
  252. package/src/components/entity-card/EntityCard.tsx +2 -2
  253. package/src/components/feature-grid/FeatureGrid.tsx +2 -2
  254. package/src/components/feature-row/FeatureRow.tsx +1 -1
  255. package/src/components/file-upload/FileUpload.test.tsx +10 -0
  256. package/src/components/file-upload/FileUpload.tsx +18 -3
  257. package/src/components/filter-chips/FilterChips.test.tsx +11 -0
  258. package/src/components/filter-chips/FilterChips.tsx +40 -4
  259. package/src/components/filter-panel/FilterPanel.test.tsx +19 -0
  260. package/src/components/filter-panel/FilterPanel.tsx +18 -14
  261. package/src/components/hero/Hero.tsx +2 -2
  262. package/src/components/image/Image.test.tsx +24 -0
  263. package/src/components/image/Image.tsx +7 -0
  264. package/src/components/list/List.test.tsx +18 -0
  265. package/src/components/list/List.tsx +18 -12
  266. package/src/components/menu/Menu.tsx +2 -2
  267. package/src/components/process-steps/ProcessSteps.tsx +1 -1
  268. package/src/components/prose/Prose.tsx +1 -1
  269. package/src/components/radio/Radio.test.tsx +10 -0
  270. package/src/components/radio/Radio.tsx +2 -2
  271. package/src/components/range-slider/RangeSlider.tsx +3 -3
  272. package/src/components/select/Select.test.tsx +14 -0
  273. package/src/components/select/Select.tsx +7 -2
  274. package/src/components/select-menu/SelectMenu.tsx +1 -1
  275. package/src/components/stepper/Stepper.tsx +1 -1
  276. package/src/components/table-of-contents/TableOfContents.tsx +1 -1
  277. package/src/components/timeline/Timeline.test.tsx +11 -0
  278. package/src/components/timeline/Timeline.tsx +13 -2
  279. package/src/components/toast/Toast.tsx +1 -1
  280. package/src/components/toast/Toaster.tsx +1 -1
  281. package/src/components/tombstone-card/TombstoneCard.tsx +1 -1
  282. package/src/components/tooltip/Tooltip.test.tsx +15 -0
  283. package/src/components/tooltip/Tooltip.tsx +19 -2
  284. package/src/manifests/accordion.manifest.json +1 -1
  285. package/src/manifests/alert.manifest.json +1 -1
  286. package/src/manifests/announcement-bar.manifest.json +1 -1
  287. package/src/manifests/app-shell.manifest.json +1 -1
  288. package/src/manifests/applied-filters.manifest.json +1 -1
  289. package/src/manifests/article-card.manifest.json +1 -1
  290. package/src/manifests/auth-layout.manifest.json +1 -1
  291. package/src/manifests/autocomplete.manifest.json +1 -1
  292. package/src/manifests/avatar.manifest.json +1 -1
  293. package/src/manifests/badge.manifest.json +1 -1
  294. package/src/manifests/block.manifest.json +1 -1
  295. package/src/manifests/bottom-nav.manifest.json +1 -1
  296. package/src/manifests/breadcrumb.manifest.json +1 -1
  297. package/src/manifests/button-group.manifest.json +1 -1
  298. package/src/manifests/button.manifest.json +1 -1
  299. package/src/manifests/calendar.manifest.json +1 -1
  300. package/src/manifests/card.manifest.json +1 -1
  301. package/src/manifests/checkbox.manifest.json +1 -1
  302. package/src/manifests/comparison-table.manifest.json +1 -1
  303. package/src/manifests/confirm-dialog.manifest.json +1 -1
  304. package/src/manifests/contact-strip.manifest.json +1 -1
  305. package/src/manifests/container.manifest.json +1 -1
  306. package/src/manifests/cta-section.manifest.json +1 -1
  307. package/src/manifests/data-table.manifest.json +1 -1
  308. package/src/manifests/date-picker-popover.manifest.json +1 -1
  309. package/src/manifests/date-picker.manifest.json +1 -1
  310. package/src/manifests/date-range-picker.manifest.json +1 -1
  311. package/src/manifests/deal-card.manifest.json +1 -1
  312. package/src/manifests/dialog.manifest.json +1 -1
  313. package/src/manifests/document-card.manifest.json +1 -1
  314. package/src/manifests/drawer.manifest.json +1 -1
  315. package/src/manifests/empty-state.manifest.json +1 -1
  316. package/src/manifests/entity-card.manifest.json +1 -1
  317. package/src/manifests/feature-grid.manifest.json +1 -1
  318. package/src/manifests/feature-row.manifest.json +1 -1
  319. package/src/manifests/fieldset.manifest.json +1 -1
  320. package/src/manifests/file-upload.manifest.json +1 -1
  321. package/src/manifests/filter-bar.manifest.json +1 -1
  322. package/src/manifests/filter-chips.manifest.json +13 -1
  323. package/src/manifests/filter-panel.manifest.json +1 -1
  324. package/src/manifests/flex.manifest.json +1 -1
  325. package/src/manifests/form-field.manifest.json +1 -1
  326. package/src/manifests/form-layout.manifest.json +1 -1
  327. package/src/manifests/form.manifest.json +1 -1
  328. package/src/manifests/grid.manifest.json +1 -1
  329. package/src/manifests/heading.manifest.json +1 -1
  330. package/src/manifests/hero.manifest.json +1 -1
  331. package/src/manifests/image.manifest.json +1 -1
  332. package/src/manifests/input-group.manifest.json +1 -1
  333. package/src/manifests/input.manifest.json +1 -1
  334. package/src/manifests/label.manifest.json +1 -1
  335. package/src/manifests/link-tabs.manifest.json +1 -1
  336. package/src/manifests/link.manifest.json +1 -1
  337. package/src/manifests/list.manifest.json +1 -1
  338. package/src/manifests/load-more.manifest.json +1 -1
  339. package/src/manifests/logo-cloud.manifest.json +1 -1
  340. package/src/manifests/menu.manifest.json +1 -1
  341. package/src/manifests/metric-card.manifest.json +1 -1
  342. package/src/manifests/multi-select.manifest.json +1 -1
  343. package/src/manifests/newsletter.manifest.json +1 -1
  344. package/src/manifests/page-header.manifest.json +1 -1
  345. package/src/manifests/pagination.manifest.json +1 -1
  346. package/src/manifests/password-input.manifest.json +1 -1
  347. package/src/manifests/popover.manifest.json +1 -1
  348. package/src/manifests/process-steps.manifest.json +1 -1
  349. package/src/manifests/progress.manifest.json +1 -1
  350. package/src/manifests/prose.manifest.json +1 -1
  351. package/src/manifests/radio.manifest.json +1 -1
  352. package/src/manifests/range-slider.manifest.json +1 -1
  353. package/src/manifests/search.manifest.json +1 -1
  354. package/src/manifests/section-heading.manifest.json +1 -1
  355. package/src/manifests/section.manifest.json +1 -1
  356. package/src/manifests/segmented-control.manifest.json +1 -1
  357. package/src/manifests/select-menu.manifest.json +1 -1
  358. package/src/manifests/select.manifest.json +8 -1
  359. package/src/manifests/separator.manifest.json +1 -1
  360. package/src/manifests/site-footer.manifest.json +1 -1
  361. package/src/manifests/site-header.manifest.json +1 -1
  362. package/src/manifests/skeleton.manifest.json +1 -1
  363. package/src/manifests/spinner.manifest.json +1 -1
  364. package/src/manifests/stat-band.manifest.json +1 -1
  365. package/src/manifests/stepper.manifest.json +1 -1
  366. package/src/manifests/switch.manifest.json +1 -1
  367. package/src/manifests/table-card.manifest.json +1 -1
  368. package/src/manifests/table-of-contents.manifest.json +1 -1
  369. package/src/manifests/table.manifest.json +1 -1
  370. package/src/manifests/tabs.manifest.json +1 -1
  371. package/src/manifests/testimonial.manifest.json +1 -1
  372. package/src/manifests/text.manifest.json +1 -1
  373. package/src/manifests/textarea.manifest.json +1 -1
  374. package/src/manifests/theme-toggle.manifest.json +1 -1
  375. package/src/manifests/time-picker.manifest.json +1 -1
  376. package/src/manifests/timeline.manifest.json +1 -1
  377. package/src/manifests/toast.manifest.json +1 -1
  378. package/src/manifests/tombstone-card.manifest.json +1 -1
  379. package/src/manifests/tooltip.manifest.json +12 -1
@@ -62,6 +62,16 @@ const FileUpload = React.forwardRef(function FileUpload2({
62
62
  const current = files ?? internal;
63
63
  const generatedId = React.useId();
64
64
  const inputId = id ?? generatedId;
65
+ const fileIds = React.useRef(/* @__PURE__ */ new WeakMap());
66
+ const nextFileId = React.useRef(0);
67
+ const idFor = (file) => {
68
+ let fileId = fileIds.current.get(file);
69
+ if (!fileId) {
70
+ fileId = `file-${nextFileId.current++}`;
71
+ fileIds.current.set(file, fileId);
72
+ }
73
+ return fileId;
74
+ };
65
75
  const commit = (next) => {
66
76
  if (files === void 0) setInternal(next);
67
77
  onFilesChange?.(next);
@@ -138,13 +148,13 @@ const FileUpload = React.forwardRef(function FileUpload2({
138
148
  "button",
139
149
  {
140
150
  type: "button",
141
- onClick: () => commit(current.filter((entry) => entry.name !== file.name)),
151
+ onClick: () => commit(current.filter((entry) => entry !== file)),
142
152
  "aria-label": removeLabel(file),
143
153
  className: "rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
144
154
  children: "\u2715"
145
155
  }
146
156
  )
147
- ] }, file.name)) })
157
+ ] }, idFor(file))) })
148
158
  ] });
149
159
  });
150
160
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/file-upload/FileUpload.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type FileUploadProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'onChange'> & {\n /** Controlled selection. */\n files?: File[];\n /** Initial selection when uncontrolled. */\n defaultFiles?: File[];\n /** Fired whenever the list changes (add, remove, drop, clear). */\n onFilesChange?: (files: File[]) => void;\n /** Drag-and-drop area copy. */\n label?: string;\n hint?: string;\n /** Accessible label for the selected-files list. Default 'Selected files'. */\n selectedFilesLabel?: string;\n /** Accessible label for a file's remove button. Default `Remove <name>`. */\n removeLabel?: (file: File) => string;\n /** Accessible label for a file's upload progress. Default `Uploading <name>`. */\n uploadingLabel?: (file: File) => string;\n /** Per-file progress (0-100) keyed by file name, rendered as a bar. */\n progress?: Record<string, number>;\n};\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * Drag-and-drop file picker with a removable list. The native input drives\n * selection (keyboard + mobile camera/file dialogs); the drop zone is a\n * progressive enhancement. Files are plain `File` objects, so you own the\n * upload transport and can render progress per file.\n */\nexport const FileUpload = React.forwardRef<HTMLInputElement, FileUploadProps>(function FileUpload(\n {\n files,\n defaultFiles,\n onFilesChange,\n label = 'Drop files here or click to browse',\n hint,\n selectedFilesLabel = 'Selected files',\n removeLabel = (file: File) => `Remove ${file.name}`,\n uploadingLabel = (file: File) => `Uploading ${file.name}`,\n progress,\n multiple = true,\n accept,\n disabled,\n className,\n id,\n ...props\n },\n ref\n) {\n const [internal, setInternal] = React.useState<File[]>(defaultFiles ?? []);\n const [dragging, setDragging] = React.useState(false);\n const current = files ?? internal;\n const generatedId = React.useId();\n const inputId = id ?? generatedId;\n\n const commit = (next: File[]) => {\n if (files === undefined) setInternal(next);\n onFilesChange?.(next);\n };\n\n const add = (incoming: FileList | null) => {\n if (!incoming || incoming.length === 0) return;\n const list = Array.from(incoming);\n commit(multiple ? [...current, ...list] : list.slice(0, 1));\n };\n\n return (\n <div className={cn('flex flex-col gap-3', className)}>\n <div\n onDragOver={(event) => {\n if (disabled) return;\n event.preventDefault();\n setDragging(true);\n }}\n onDragLeave={() => setDragging(false)}\n onDrop={(event) => {\n if (disabled) return;\n event.preventDefault();\n setDragging(false);\n add(event.dataTransfer.files);\n }}\n className={cn(\n 'rounded-lg border border-dashed border-border p-6 text-center transition-colors',\n dragging && 'border-primary bg-primary/5',\n disabled && 'opacity-50'\n )}\n >\n <label htmlFor={inputId} className={cn('block text-sm', disabled ? 'cursor-not-allowed' : 'cursor-pointer')}>\n {label}\n <input\n ref={ref}\n id={inputId}\n type=\"file\"\n multiple={multiple}\n accept={accept}\n disabled={disabled}\n className=\"sr-only\"\n onChange={(event) => {\n add(event.target.files);\n event.target.value = '';\n }}\n {...props}\n />\n </label>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {hint ?? (accept ? `Accepted: ${accept}` : 'Any file type')}\n </p>\n </div>\n\n {current.length > 0 && (\n <ul aria-label={selectedFilesLabel} className=\"space-y-2\">\n {current.map((file) => (\n <li key={file.name} className=\"flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm\">{file.name}</p>\n <p className=\"text-xs text-muted-foreground\">{formatSize(file.size)}</p>\n {progress?.[file.name] !== undefined && (\n <div\n role=\"progressbar\"\n aria-valuenow={progress[file.name]}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={uploadingLabel(file)}\n className=\"mt-1 h-1.5 w-40 overflow-hidden rounded-full bg-muted\"\n >\n <div className=\"h-full bg-primary\" style={{ width: `${progress[file.name]}%` }} />\n </div>\n )}\n </div>\n <button\n type=\"button\"\n onClick={() => commit(current.filter((entry) => entry.name !== file.name))}\n aria-label={removeLabel(file)}\n className=\"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 </li>\n ))}\n </ul>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+FQ;AA7FR,YAAuB;AACvB,gBAAmB;AAsBnB,SAAS,WAAW,OAAuB;AACzC,MAAI,QAAQ,KAAM,QAAO,GAAG,KAAK;AACjC,MAAI,QAAQ,OAAO,KAAM,QAAO,IAAI,QAAQ,MAAM,QAAQ,CAAC,CAAC;AAC5D,SAAO,IAAI,SAAS,OAAO,OAAO,QAAQ,CAAC,CAAC;AAC9C;AAQO,MAAM,aAAa,MAAM,WAA8C,SAASA,YACrF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,qBAAqB;AAAA,EACrB,cAAc,CAAC,SAAe,UAAU,KAAK,IAAI;AAAA,EACjD,iBAAiB,CAAC,SAAe,aAAa,KAAK,IAAI;AAAA,EACvD;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAiB,gBAAgB,CAAC,CAAC;AACzE,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAS,KAAK;AACpD,QAAM,UAAU,SAAS;AACzB,QAAM,cAAc,MAAM,MAAM;AAChC,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QAAQ,SAAS,KAChB,4CAAC,QAAG,cAAY,oBAAoB,WAAU,aAC3C,kBAAQ,IAAI,CAAC,SACZ,6CAAC,QAAmB,WAAU,qFAC5B;AAAA,mDAAC,SAAI,WAAU,WACb;AAAA,oDAAC,OAAE,WAAU,oBAAoB,eAAK,MAAK;AAAA,QAC3C,4CAAC,OAAE,WAAU,iCAAiC,qBAAW,KAAK,IAAI,GAAE;AAAA,QACnE,WAAW,KAAK,IAAI,MAAM,UACzB;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,iBAAe,SAAS,KAAK,IAAI;AAAA,YACjC,iBAAe;AAAA,YACf,iBAAe;AAAA,YACf,cAAY,eAAe,IAAI;AAAA,YAC/B,WAAU;AAAA,YAEV,sDAAC,SAAI,WAAU,qBAAoB,OAAO,EAAE,OAAO,GAAG,SAAS,KAAK,IAAI,CAAC,IAAI,GAAG;AAAA;AAAA,QAClF;AAAA,SAEJ;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS,MAAM,OAAO,QAAQ,OAAO,CAAC,UAAU,MAAM,SAAS,KAAK,IAAI,CAAC;AAAA,UACzE,cAAY,YAAY,IAAI;AAAA,UAC5B,WAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,SAxBO,KAAK,IAyBd,CACD,GACH;AAAA,KAEJ;AAEJ,CAAC;","names":["FileUpload"]}
1
+ {"version":3,"sources":["../../../../src/components/file-upload/FileUpload.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type FileUploadProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'onChange'> & {\n /** Controlled selection. */\n files?: File[];\n /** Initial selection when uncontrolled. */\n defaultFiles?: File[];\n /** Fired whenever the list changes (add, remove, drop, clear). */\n onFilesChange?: (files: File[]) => void;\n /** Drag-and-drop area copy. */\n label?: string;\n hint?: string;\n /** Accessible label for the selected-files list. Default 'Selected files'. */\n selectedFilesLabel?: string;\n /** Accessible label for a file's remove button. Default `Remove <name>`. */\n removeLabel?: (file: File) => string;\n /** Accessible label for a file's upload progress. Default `Uploading <name>`. */\n uploadingLabel?: (file: File) => string;\n /**\n * Per-file progress (0-100) keyed by file name, rendered as a bar.\n * Same-named files share one progress entry.\n */\n progress?: Record<string, number>;\n};\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * Drag-and-drop file picker with a removable list. The native input drives\n * selection (keyboard + mobile camera/file dialogs); the drop zone is a\n * progressive enhancement. Files are plain `File` objects, so you own the\n * upload transport and can render progress per file.\n */\nexport const FileUpload = React.forwardRef<HTMLInputElement, FileUploadProps>(function FileUpload(\n {\n files,\n defaultFiles,\n onFilesChange,\n label = 'Drop files here or click to browse',\n hint,\n selectedFilesLabel = 'Selected files',\n removeLabel = (file: File) => `Remove ${file.name}`,\n uploadingLabel = (file: File) => `Uploading ${file.name}`,\n progress,\n multiple = true,\n accept,\n disabled,\n className,\n id,\n ...props\n },\n ref\n) {\n const [internal, setInternal] = React.useState<File[]>(defaultFiles ?? []);\n const [dragging, setDragging] = React.useState(false);\n const current = files ?? internal;\n const generatedId = React.useId();\n const inputId = id ?? generatedId;\n // Stable per-File identity: same-named files are distinct objects, so a\n // WeakMap gives each entry a unique key without changing the File API.\n const fileIds = React.useRef(new WeakMap<File, string>());\n const nextFileId = React.useRef(0);\n const idFor = (file: File) => {\n let fileId = fileIds.current.get(file);\n if (!fileId) {\n fileId = `file-${nextFileId.current++}`;\n fileIds.current.set(file, fileId);\n }\n return fileId;\n };\n\n const commit = (next: File[]) => {\n if (files === undefined) setInternal(next);\n onFilesChange?.(next);\n };\n\n const add = (incoming: FileList | null) => {\n if (!incoming || incoming.length === 0) return;\n const list = Array.from(incoming);\n commit(multiple ? [...current, ...list] : list.slice(0, 1));\n };\n\n return (\n <div className={cn('flex flex-col gap-3', className)}>\n <div\n onDragOver={(event) => {\n if (disabled) return;\n event.preventDefault();\n setDragging(true);\n }}\n onDragLeave={() => setDragging(false)}\n onDrop={(event) => {\n if (disabled) return;\n event.preventDefault();\n setDragging(false);\n add(event.dataTransfer.files);\n }}\n className={cn(\n 'rounded-lg border border-dashed border-border p-6 text-center transition-colors',\n dragging && 'border-primary bg-primary/5',\n disabled && 'opacity-50'\n )}\n >\n <label htmlFor={inputId} className={cn('block text-sm', disabled ? 'cursor-not-allowed' : 'cursor-pointer')}>\n {label}\n <input\n ref={ref}\n id={inputId}\n type=\"file\"\n multiple={multiple}\n accept={accept}\n disabled={disabled}\n className=\"sr-only\"\n onChange={(event) => {\n add(event.target.files);\n event.target.value = '';\n }}\n {...props}\n />\n </label>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {hint ?? (accept ? `Accepted: ${accept}` : 'Any file type')}\n </p>\n </div>\n\n {current.length > 0 && (\n <ul aria-label={selectedFilesLabel} className=\"space-y-2\">\n {current.map((file) => (\n <li key={idFor(file)} className=\"flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm\">{file.name}</p>\n <p className=\"text-xs text-muted-foreground\">{formatSize(file.size)}</p>\n {progress?.[file.name] !== undefined && (\n <div\n role=\"progressbar\"\n aria-valuenow={progress[file.name]}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={uploadingLabel(file)}\n className=\"mt-1 h-1.5 w-40 overflow-hidden rounded-full bg-muted\"\n >\n <div className=\"h-full bg-primary\" style={{ width: `${progress[file.name]}%` }} />\n </div>\n )}\n </div>\n <button\n type=\"button\"\n onClick={() => commit(current.filter((entry) => entry !== file))}\n aria-label={removeLabel(file)}\n className=\"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 </li>\n ))}\n </ul>\n )}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AAqB,WAAU,qFAC9B;AAAA,mDAAC,SAAI,WAAU,WACb;AAAA,oDAAC,OAAE,WAAU,oBAAoB,eAAK,MAAK;AAAA,QAC3C,4CAAC,OAAE,WAAU,iCAAiC,qBAAW,KAAK,IAAI,GAAE;AAAA,QACnE,WAAW,KAAK,IAAI,MAAM,UACzB;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,iBAAe,SAAS,KAAK,IAAI;AAAA,YACjC,iBAAe;AAAA,YACf,iBAAe;AAAA,YACf,cAAY,eAAe,IAAI;AAAA,YAC/B,WAAU;AAAA,YAEV,sDAAC,SAAI,WAAU,qBAAoB,OAAO,EAAE,OAAO,GAAG,SAAS,KAAK,IAAI,CAAC,IAAI,GAAG;AAAA;AAAA,QAClF;AAAA,SAEJ;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS,MAAM,OAAO,QAAQ,OAAO,CAAC,UAAU,UAAU,IAAI,CAAC;AAAA,UAC/D,cAAY,YAAY,IAAI;AAAA,UAC5B,WAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,SAxBO,MAAM,IAAI,CAyBnB,CACD,GACH;AAAA,KAEJ;AAEJ,CAAC;","names":["FileUpload"]}
@@ -29,6 +29,16 @@ const FileUpload = React.forwardRef(function FileUpload2({
29
29
  const current = files ?? internal;
30
30
  const generatedId = React.useId();
31
31
  const inputId = id ?? generatedId;
32
+ const fileIds = React.useRef(/* @__PURE__ */ new WeakMap());
33
+ const nextFileId = React.useRef(0);
34
+ const idFor = (file) => {
35
+ let fileId = fileIds.current.get(file);
36
+ if (!fileId) {
37
+ fileId = `file-${nextFileId.current++}`;
38
+ fileIds.current.set(file, fileId);
39
+ }
40
+ return fileId;
41
+ };
32
42
  const commit = (next) => {
33
43
  if (files === void 0) setInternal(next);
34
44
  onFilesChange?.(next);
@@ -105,13 +115,13 @@ const FileUpload = React.forwardRef(function FileUpload2({
105
115
  "button",
106
116
  {
107
117
  type: "button",
108
- onClick: () => commit(current.filter((entry) => entry.name !== file.name)),
118
+ onClick: () => commit(current.filter((entry) => entry !== file)),
109
119
  "aria-label": removeLabel(file),
110
120
  className: "rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
111
121
  children: "\u2715"
112
122
  }
113
123
  )
114
- ] }, file.name)) })
124
+ ] }, idFor(file))) })
115
125
  ] });
116
126
  });
117
127
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/file-upload/FileUpload.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type FileUploadProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'onChange'> & {\n /** Controlled selection. */\n files?: File[];\n /** Initial selection when uncontrolled. */\n defaultFiles?: File[];\n /** Fired whenever the list changes (add, remove, drop, clear). */\n onFilesChange?: (files: File[]) => void;\n /** Drag-and-drop area copy. */\n label?: string;\n hint?: string;\n /** Accessible label for the selected-files list. Default 'Selected files'. */\n selectedFilesLabel?: string;\n /** Accessible label for a file's remove button. Default `Remove <name>`. */\n removeLabel?: (file: File) => string;\n /** Accessible label for a file's upload progress. Default `Uploading <name>`. */\n uploadingLabel?: (file: File) => string;\n /** Per-file progress (0-100) keyed by file name, rendered as a bar. */\n progress?: Record<string, number>;\n};\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * Drag-and-drop file picker with a removable list. The native input drives\n * selection (keyboard + mobile camera/file dialogs); the drop zone is a\n * progressive enhancement. Files are plain `File` objects, so you own the\n * upload transport and can render progress per file.\n */\nexport const FileUpload = React.forwardRef<HTMLInputElement, FileUploadProps>(function FileUpload(\n {\n files,\n defaultFiles,\n onFilesChange,\n label = 'Drop files here or click to browse',\n hint,\n selectedFilesLabel = 'Selected files',\n removeLabel = (file: File) => `Remove ${file.name}`,\n uploadingLabel = (file: File) => `Uploading ${file.name}`,\n progress,\n multiple = true,\n accept,\n disabled,\n className,\n id,\n ...props\n },\n ref\n) {\n const [internal, setInternal] = React.useState<File[]>(defaultFiles ?? []);\n const [dragging, setDragging] = React.useState(false);\n const current = files ?? internal;\n const generatedId = React.useId();\n const inputId = id ?? generatedId;\n\n const commit = (next: File[]) => {\n if (files === undefined) setInternal(next);\n onFilesChange?.(next);\n };\n\n const add = (incoming: FileList | null) => {\n if (!incoming || incoming.length === 0) return;\n const list = Array.from(incoming);\n commit(multiple ? [...current, ...list] : list.slice(0, 1));\n };\n\n return (\n <div className={cn('flex flex-col gap-3', className)}>\n <div\n onDragOver={(event) => {\n if (disabled) return;\n event.preventDefault();\n setDragging(true);\n }}\n onDragLeave={() => setDragging(false)}\n onDrop={(event) => {\n if (disabled) return;\n event.preventDefault();\n setDragging(false);\n add(event.dataTransfer.files);\n }}\n className={cn(\n 'rounded-lg border border-dashed border-border p-6 text-center transition-colors',\n dragging && 'border-primary bg-primary/5',\n disabled && 'opacity-50'\n )}\n >\n <label htmlFor={inputId} className={cn('block text-sm', disabled ? 'cursor-not-allowed' : 'cursor-pointer')}>\n {label}\n <input\n ref={ref}\n id={inputId}\n type=\"file\"\n multiple={multiple}\n accept={accept}\n disabled={disabled}\n className=\"sr-only\"\n onChange={(event) => {\n add(event.target.files);\n event.target.value = '';\n }}\n {...props}\n />\n </label>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {hint ?? (accept ? `Accepted: ${accept}` : 'Any file type')}\n </p>\n </div>\n\n {current.length > 0 && (\n <ul aria-label={selectedFilesLabel} className=\"space-y-2\">\n {current.map((file) => (\n <li key={file.name} className=\"flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm\">{file.name}</p>\n <p className=\"text-xs text-muted-foreground\">{formatSize(file.size)}</p>\n {progress?.[file.name] !== undefined && (\n <div\n role=\"progressbar\"\n aria-valuenow={progress[file.name]}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={uploadingLabel(file)}\n className=\"mt-1 h-1.5 w-40 overflow-hidden rounded-full bg-muted\"\n >\n <div className=\"h-full bg-primary\" style={{ width: `${progress[file.name]}%` }} />\n </div>\n )}\n </div>\n <button\n type=\"button\"\n onClick={() => commit(current.filter((entry) => entry.name !== file.name))}\n aria-label={removeLabel(file)}\n className=\"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 </li>\n ))}\n </ul>\n )}\n </div>\n );\n});\n"],"mappings":";AA+FQ,SAEE,KAFF;AA7FR,YAAY,WAAW;AACvB,SAAS,UAAU;AAsBnB,SAAS,WAAW,OAAuB;AACzC,MAAI,QAAQ,KAAM,QAAO,GAAG,KAAK;AACjC,MAAI,QAAQ,OAAO,KAAM,QAAO,IAAI,QAAQ,MAAM,QAAQ,CAAC,CAAC;AAC5D,SAAO,IAAI,SAAS,OAAO,OAAO,QAAQ,CAAC,CAAC;AAC9C;AAQO,MAAM,aAAa,MAAM,WAA8C,SAASA,YACrF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,qBAAqB;AAAA,EACrB,cAAc,CAAC,SAAe,UAAU,KAAK,IAAI;AAAA,EACjD,iBAAiB,CAAC,SAAe,aAAa,KAAK,IAAI;AAAA,EACvD;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAiB,gBAAgB,CAAC,CAAC;AACzE,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAS,KAAK;AACpD,QAAM,UAAU,SAAS;AACzB,QAAM,cAAc,MAAM,MAAM;AAChC,QAAM,UAAU,MAAM;AAE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AAC,QAAG,cAAY,oBAAoB,WAAU,aAC3C,kBAAQ,IAAI,CAAC,SACZ,qBAAC,QAAmB,WAAU,qFAC5B;AAAA,2BAAC,SAAI,WAAU,WACb;AAAA,4BAAC,OAAE,WAAU,oBAAoB,eAAK,MAAK;AAAA,QAC3C,oBAAC,OAAE,WAAU,iCAAiC,qBAAW,KAAK,IAAI,GAAE;AAAA,QACnE,WAAW,KAAK,IAAI,MAAM,UACzB;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,iBAAe,SAAS,KAAK,IAAI;AAAA,YACjC,iBAAe;AAAA,YACf,iBAAe;AAAA,YACf,cAAY,eAAe,IAAI;AAAA,YAC/B,WAAU;AAAA,YAEV,8BAAC,SAAI,WAAU,qBAAoB,OAAO,EAAE,OAAO,GAAG,SAAS,KAAK,IAAI,CAAC,IAAI,GAAG;AAAA;AAAA,QAClF;AAAA,SAEJ;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS,MAAM,OAAO,QAAQ,OAAO,CAAC,UAAU,MAAM,SAAS,KAAK,IAAI,CAAC;AAAA,UACzE,cAAY,YAAY,IAAI;AAAA,UAC5B,WAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,SAxBO,KAAK,IAyBd,CACD,GACH;AAAA,KAEJ;AAEJ,CAAC;","names":["FileUpload"]}
1
+ {"version":3,"sources":["../../../../src/components/file-upload/FileUpload.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type FileUploadProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'onChange'> & {\n /** Controlled selection. */\n files?: File[];\n /** Initial selection when uncontrolled. */\n defaultFiles?: File[];\n /** Fired whenever the list changes (add, remove, drop, clear). */\n onFilesChange?: (files: File[]) => void;\n /** Drag-and-drop area copy. */\n label?: string;\n hint?: string;\n /** Accessible label for the selected-files list. Default 'Selected files'. */\n selectedFilesLabel?: string;\n /** Accessible label for a file's remove button. Default `Remove <name>`. */\n removeLabel?: (file: File) => string;\n /** Accessible label for a file's upload progress. Default `Uploading <name>`. */\n uploadingLabel?: (file: File) => string;\n /**\n * Per-file progress (0-100) keyed by file name, rendered as a bar.\n * Same-named files share one progress entry.\n */\n progress?: Record<string, number>;\n};\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * Drag-and-drop file picker with a removable list. The native input drives\n * selection (keyboard + mobile camera/file dialogs); the drop zone is a\n * progressive enhancement. Files are plain `File` objects, so you own the\n * upload transport and can render progress per file.\n */\nexport const FileUpload = React.forwardRef<HTMLInputElement, FileUploadProps>(function FileUpload(\n {\n files,\n defaultFiles,\n onFilesChange,\n label = 'Drop files here or click to browse',\n hint,\n selectedFilesLabel = 'Selected files',\n removeLabel = (file: File) => `Remove ${file.name}`,\n uploadingLabel = (file: File) => `Uploading ${file.name}`,\n progress,\n multiple = true,\n accept,\n disabled,\n className,\n id,\n ...props\n },\n ref\n) {\n const [internal, setInternal] = React.useState<File[]>(defaultFiles ?? []);\n const [dragging, setDragging] = React.useState(false);\n const current = files ?? internal;\n const generatedId = React.useId();\n const inputId = id ?? generatedId;\n // Stable per-File identity: same-named files are distinct objects, so a\n // WeakMap gives each entry a unique key without changing the File API.\n const fileIds = React.useRef(new WeakMap<File, string>());\n const nextFileId = React.useRef(0);\n const idFor = (file: File) => {\n let fileId = fileIds.current.get(file);\n if (!fileId) {\n fileId = `file-${nextFileId.current++}`;\n fileIds.current.set(file, fileId);\n }\n return fileId;\n };\n\n const commit = (next: File[]) => {\n if (files === undefined) setInternal(next);\n onFilesChange?.(next);\n };\n\n const add = (incoming: FileList | null) => {\n if (!incoming || incoming.length === 0) return;\n const list = Array.from(incoming);\n commit(multiple ? [...current, ...list] : list.slice(0, 1));\n };\n\n return (\n <div className={cn('flex flex-col gap-3', className)}>\n <div\n onDragOver={(event) => {\n if (disabled) return;\n event.preventDefault();\n setDragging(true);\n }}\n onDragLeave={() => setDragging(false)}\n onDrop={(event) => {\n if (disabled) return;\n event.preventDefault();\n setDragging(false);\n add(event.dataTransfer.files);\n }}\n className={cn(\n 'rounded-lg border border-dashed border-border p-6 text-center transition-colors',\n dragging && 'border-primary bg-primary/5',\n disabled && 'opacity-50'\n )}\n >\n <label htmlFor={inputId} className={cn('block text-sm', disabled ? 'cursor-not-allowed' : 'cursor-pointer')}>\n {label}\n <input\n ref={ref}\n id={inputId}\n type=\"file\"\n multiple={multiple}\n accept={accept}\n disabled={disabled}\n className=\"sr-only\"\n onChange={(event) => {\n add(event.target.files);\n event.target.value = '';\n }}\n {...props}\n />\n </label>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {hint ?? (accept ? `Accepted: ${accept}` : 'Any file type')}\n </p>\n </div>\n\n {current.length > 0 && (\n <ul aria-label={selectedFilesLabel} className=\"space-y-2\">\n {current.map((file) => (\n <li key={idFor(file)} className=\"flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm\">{file.name}</p>\n <p className=\"text-xs text-muted-foreground\">{formatSize(file.size)}</p>\n {progress?.[file.name] !== undefined && (\n <div\n role=\"progressbar\"\n aria-valuenow={progress[file.name]}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={uploadingLabel(file)}\n className=\"mt-1 h-1.5 w-40 overflow-hidden rounded-full bg-muted\"\n >\n <div className=\"h-full bg-primary\" style={{ width: `${progress[file.name]}%` }} />\n </div>\n )}\n </div>\n <button\n type=\"button\"\n onClick={() => commit(current.filter((entry) => entry !== file))}\n aria-label={removeLabel(file)}\n className=\"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 </li>\n ))}\n </ul>\n )}\n </div>\n );\n});\n"],"mapp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AAE,WAAU,oBAAoB,eAAK,MAAK;AAAA,QAC3C,oBAAC,OAAE,WAAU,iCAAiC,qBAAW,KAAK,IAAI,GAAE;AAAA,QACnE,WAAW,KAAK,IAAI,MAAM,UACzB;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,iBAAe,SAAS,KAAK,IAAI;AAAA,YACjC,iBAAe;AAAA,YACf,iBAAe;AAAA,YACf,cAAY,eAAe,IAAI;AAAA,YAC/B,WAAU;AAAA,YAEV,8BAAC,SAAI,WAAU,qBAAoB,OAAO,EAAE,OAAO,GAAG,SAAS,KAAK,IAAI,CAAC,IAAI,GAAG;AAAA;AAAA,QAClF;AAAA,SAEJ;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS,MAAM,OAAO,QAAQ,OAAO,CAAC,UAAU,UAAU,IAAI,CAAC;AAAA,UAC/D,cAAY,YAAY,IAAI;AAAA,UAC5B,WAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,SAxBO,MAAM,IAAI,CAyBnB,CACD,GACH;AAAA,KAEJ;AAEJ,CAAC;","names":["FileUpload"]}
@@ -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-ink 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-ink 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-ink 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,WAA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A;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-ink 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,O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gBAAe,aAAY,KAAI,eAAc,SACjI,8BAAC,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,WAAW;AAAA,cACT;AAAA,cACA,MAAM;AAAA,YACR;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;","names":["FilterChips"]}
@@ -52,14 +52,17 @@ const FilterPanel = React.forwardRef(function FilterPanel2({
52
52
  ...props
53
53
  }, ref) {
54
54
  const Tag = as;
55
- const [open, setOpen] = React.useState(
56
- defaultOpen ?? sections.filter((section) => section.defaultOpen).map((section) => section.title)
57
- );
58
- const isOpen = (section) => !collapsible || open.includes(section.title);
59
- const toggle = (section) => {
55
+ const [open, setOpen] = React.useState(() => {
56
+ if (defaultOpen) {
57
+ return sections.flatMap((section, index) => defaultOpen.includes(section.title) ? [index] : []);
58
+ }
59
+ return sections.flatMap((section, index) => section.defaultOpen ? [index] : []);
60
+ });
61
+ const isOpen = (index) => !collapsible || open.includes(index);
62
+ const toggle = (index) => {
60
63
  if (!collapsible) return;
61
64
  setOpen(
62
- (current) => current.includes(section.title) ? current.filter((title2) => title2 !== section.title) : [...current, section.title]
65
+ (current) => current.includes(index) ? current.filter((entry) => entry !== index) : [...current, index]
63
66
  );
64
67
  };
65
68
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tag, { ref, className: (0, import_cn.cn)("w-full rounded-xl border border-border bg-card", className), ...props, children: [
@@ -67,16 +70,17 @@ const FilterPanel = React.forwardRef(function FilterPanel2({
67
70
  title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-sm font-semibold", children: title }),
68
71
  description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: description })
69
72
  ] }),
70
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "divide-y divide-border", children: sections.map((section) => {
71
- const expanded = isOpen(section);
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "divide-y divide-border", children: sections.map((section, index) => {
74
+ const expanded = isOpen(index);
75
+ const sectionId = `filter-section-${index}`;
72
76
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "px-4 py-3", children: [
73
77
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
74
78
  "button",
75
79
  {
76
80
  type: "button",
77
- onClick: () => toggle(section),
81
+ onClick: () => toggle(index),
78
82
  "aria-expanded": expanded,
79
- "aria-controls": `filter-section-${section.title.replace(/\s+/g, "-").toLowerCase()}`,
83
+ "aria-controls": sectionId,
80
84
  disabled: !collapsible,
81
85
  className: (0, import_cn.cn)(
82
86
  "flex w-full items-center justify-between gap-2 text-left text-sm font-medium",
@@ -91,8 +95,8 @@ const FilterPanel = React.forwardRef(function FilterPanel2({
91
95
  ]
92
96
  }
93
97
  ) }),
94
- expanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: `filter-section-${section.title.replace(/\s+/g, "-").toLowerCase()}`, className: "mt-3", children: section.content })
95
- ] }, section.title);
98
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: sectionId, className: "mt-3", children: section.content })
99
+ ] }, index);
96
100
  }) }),
97
101
  (onReset || onApply || actions) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-2 border-t border-border px-4 py-3", children: [
98
102
  actions,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/filter-panel/FilterPanel.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../button/Button';\n\nexport type FilterSection = {\n /** Section heading. */\n title: string;\n /** Supporting line under the heading. */\n description?: string;\n /** Filter controls shown inside the section. */\n content: React.ReactNode;\n /** Open on first render. */\n defaultOpen?: boolean;\n};\n\nexport type FilterPanelProps = React.HTMLAttributes<HTMLElement> & {\n /** Filter groups. */\n sections: FilterSection[];\n /** Panel heading. Default \"Filters\". */\n title?: string;\n /** Supporting copy under the panel heading. */\n description?: string;\n /** Reset action shown in the footer. */\n onReset?: () => void;\n /** Apply action shown in the footer. */\n onApply?: () => void;\n /** Reset button label. Default \"Reset\". */\n resetLabel?: string;\n /** Apply button label. Default \"Apply\". */\n applyLabel?: string;\n /** Allow sections to collapse. Default true. */\n collapsible?: boolean;\n /** Section titles open on first render. */\n defaultOpen?: string[];\n /** Extra footer content. */\n actions?: React.ReactNode;\n /** Semantic element (default 'div'). */\n as?: 'div' | 'aside' | 'section';\n};\n\n/**\n * Structured filter panel for dashboards and directories. It owns section\n * expansion and the reset/apply footer; filter values stay with the caller.\n * Use it in a sidebar on desktop and inside a Drawer on mobile.\n */\nexport const FilterPanel = React.forwardRef<HTMLElement, FilterPanelProps>(function FilterPanel(\n {\n sections,\n title = 'Filters',\n description,\n onReset,\n onApply,\n resetLabel = 'Reset',\n applyLabel = 'Apply',\n collapsible = true,\n defaultOpen,\n actions,\n as = 'div',\n className,\n ...props\n },\n ref\n) {\n const Tag = as as 'div';\n const [open, setOpen] = React.useState<string[]>(\n defaultOpen ?? sections.filter((section) => section.defaultOpen).map((section) => section.title)\n );\n\n const isOpen = (section: FilterSection) => !collapsible || open.includes(section.title);\n\n const toggle = (section: FilterSection) => {\n if (!collapsible) return;\n setOpen((current) =>\n current.includes(section.title)\n ? current.filter((title) => title !== section.title)\n : [...current, section.title]\n );\n };\n\n return (\n <Tag ref={ref as never} className={cn('w-full rounded-xl border border-border bg-card', className)} {...props}>\n {(title || description) && (\n <div className=\"border-b border-border px-4 py-3\">\n {title && <h2 className=\"text-sm font-semibold\">{title}</h2>}\n {description && <p className=\"mt-1 text-xs text-muted-foreground\">{description}</p>}\n </div>\n )}\n <div className=\"divide-y divide-border\">\n {sections.map((section) => {\n const expanded = isOpen(section);\n return (\n <div key={section.title} className=\"px-4 py-3\">\n <h3>\n <button\n type=\"button\"\n onClick={() => toggle(section)}\n aria-expanded={expanded}\n aria-controls={`filter-section-${section.title.replace(/\\s+/g, '-').toLowerCase()}`}\n disabled={!collapsible}\n className={cn(\n 'flex w-full items-center justify-between gap-2 text-left text-sm font-medium',\n collapsible && 'rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n )}\n >\n <span>\n {section.title}\n {section.description && (\n <span className=\"mt-0.5 block text-xs font-normal text-muted-foreground\">{section.description}</span>\n )}\n </span>\n {collapsible && (\n <span aria-hidden=\"true\" className={cn('text-muted-foreground transition-transform', expanded && 'rotate-180')}>\n ⌄\n </span>\n )}\n </button>\n </h3>\n {expanded && (\n <div id={`filter-section-${section.title.replace(/\\s+/g, '-').toLowerCase()}`} className=\"mt-3\">\n {section.content}\n </div>\n )}\n </div>\n );\n })}\n </div>\n {(onReset || onApply || actions) && (\n <div className=\"flex flex-wrap items-center gap-2 border-t border-border px-4 py-3\">\n {actions}\n {onReset && (\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={onReset} className=\"ml-auto\">\n {resetLabel}\n </Button>\n )}\n {onApply && (\n <Button type=\"button\" size=\"sm\" onClick={onApply}>\n {applyLabel}\n </Button>\n )}\n </div>\n )}\n </Tag>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoFQ;AAlFR,YAAuB;AACvB,gBAAmB;AACnB,oBAAuB;AA2ChB,MAAM,cAAc,MAAM,WAA0C,SAASA,aAClF;AAAA,EACE;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,aAAa;AAAA,EACb,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,KAAK;AAAA,EACL;AAAA,EACA,GAAG;AACL,GACA,K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C,4CAAC,UAAK,eAAY,QAAO,eAAW,cAAG,8CAA8C,YAAY,YAAY,GAAG,oBAEhH;AAAA;AAAA;AAAA,QAEJ,GACF;AAAA,QACC,YACC,4CAAC,SAAI,IAAI,kBAAkB,QAAQ,MAAM,QAAQ,QAAQ,GAAG,EAAE,YAAY,CAAC,IAAI,WAAU,QACtF,kBAAQ,SACX;AAAA,WA7BM,QAAQ,KA+BlB;AAAA,IAEJ,CAAC,GACH;AAAA,KACE,WAAW,WAAW,YACtB,6CAAC,SAAI,WAAU,sEACZ;AAAA;AAAA,MACA,WACC,4CAAC,wBAAO,MAAK,UAAS,SAAQ,SAAQ,MAAK,MAAK,SAAS,SAAS,WAAU,WACzE,sBACH;AAAA,MAED,WACC,4CAAC,wBAAO,MAAK,UAAS,MAAK,MAAK,SAAS,SACtC,sBACH;AAAA,OAEJ;AAAA,KAEJ;AAEJ,CAAC;","names":["FilterPanel","title"]}
1
+ {"version":3,"sources":["../../../../src/components/filter-panel/FilterPanel.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../button/Button';\n\nexport type FilterSection = {\n /** Section heading. */\n title: string;\n /** Supporting line under the heading. */\n description?: string;\n /** Filter controls shown inside the section. */\n content: React.ReactNode;\n /** Open on first render. */\n defaultOpen?: boolean;\n};\n\nexport type FilterPanelProps = React.HTMLAttributes<HTMLElement> & {\n /** Filter groups. */\n sections: FilterSection[];\n /** Panel heading. Default \"Filters\". */\n title?: string;\n /** Supporting copy under the panel heading. */\n description?: string;\n /** Reset action shown in the footer. */\n onReset?: () => void;\n /** Apply action shown in the footer. */\n onApply?: () => void;\n /** Reset button label. Default \"Reset\". */\n resetLabel?: string;\n /** Apply button label. Default \"Apply\". */\n applyLabel?: string;\n /** Allow sections to collapse. Default true. */\n collapsible?: boolean;\n /** Section titles open on first render. */\n defaultOpen?: string[];\n /** Extra footer content. */\n actions?: React.ReactNode;\n /** Semantic element (default 'div'). */\n as?: 'div' | 'aside' | 'section';\n};\n\n/**\n * Structured filter panel for dashboards and directories. It owns section\n * expansion and the reset/apply footer; filter values stay with the caller.\n * Use it in a sidebar on desktop and inside a Drawer on mobile.\n */\nexport const FilterPanel = React.forwardRef<HTMLElement, FilterPanelProps>(function FilterPanel(\n {\n sections,\n title = 'Filters',\n description,\n onReset,\n onApply,\n resetLabel = 'Reset',\n applyLabel = 'Apply',\n collapsible = true,\n defaultOpen,\n actions,\n as = 'div',\n className,\n ...props\n },\n ref\n) {\n const Tag = as as 'div';\n // Sections are identified by index, not title: duplicate or\n // punctuation-colliding titles must not share open state or DOM ids.\n const [open, setOpen] = React.useState<number[]>(() => {\n if (defaultOpen) {\n return sections.flatMap((section, index) => (defaultOpen.includes(section.title) ? [index] : []));\n }\n return sections.flatMap((section, index) => (section.defaultOpen ? [index] : []));\n });\n\n const isOpen = (index: number) => !collapsible || open.includes(index);\n\n const toggle = (index: number) => {\n if (!collapsible) return;\n setOpen((current) =>\n current.includes(index) ? current.filter((entry) => entry !== index) : [...current, index]\n );\n };\n\n return (\n <Tag ref={ref as never} className={cn('w-full rounded-xl border border-border bg-card', className)} {...props}>\n {(title || description) && (\n <div className=\"border-b border-border px-4 py-3\">\n {title && <h2 className=\"text-sm font-semibold\">{title}</h2>}\n {description && <p className=\"mt-1 text-xs text-muted-foreground\">{description}</p>}\n </div>\n )}\n <div className=\"divide-y divide-border\">\n {sections.map((section, index) => {\n const expanded = isOpen(index);\n const sectionId = `filter-section-${index}`;\n return (\n <div key={index} className=\"px-4 py-3\">\n <h3>\n <button\n type=\"button\"\n onClick={() => toggle(index)}\n aria-expanded={expanded}\n aria-controls={sectionId}\n disabled={!collapsible}\n className={cn(\n 'flex w-full items-center justify-between gap-2 text-left text-sm font-medium',\n collapsible && 'rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n )}\n >\n <span>\n {section.title}\n {section.description && (\n <span className=\"mt-0.5 block text-xs font-normal text-muted-foreground\">{section.description}</span>\n )}\n </span>\n {collapsible && (\n <span aria-hidden=\"true\" className={cn('text-muted-foreground transition-transform', expanded && 'rotate-180')}>\n ⌄\n </span>\n )}\n </button>\n </h3>\n {expanded && (\n <div id={sectionId} className=\"mt-3\">\n {section.content}\n </div>\n )}\n </div>\n );\n })}\n </div>\n {(onReset || onApply || actions) && (\n <div className=\"flex flex-wrap items-center gap-2 border-t border-border px-4 py-3\">\n {actions}\n {onReset && (\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={onReset} className=\"ml-auto\">\n {resetLabel}\n </Button>\n )}\n {onApply && (\n <Button type=\"button\" size=\"sm\" onClick={onApply}>\n {applyLabel}\n </Button>\n )}\n </div>\n )}\n </Tag>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuFQ;AArFR,YAAuB;AACvB,gBAAmB;AACnB,oBAAuB;AA2ChB,MAAM,cAAc,MAAM,WAA0C,SAASA,aAClF;AAAA,EACE;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,aAAa;AAAA,EACb,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,KAAK;AAAA,EACL;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,MAAM;AAGZ,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAmB,MAAM;AACrD,QAAI,aAAa;AACf,aAAO,SAAS,QAAQ,CAAC,SAAS,UAAW,YAAY,SAAS,QAAQ,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,CAAE;AAAA,IAClG;AACA,WAAO,SAAS,QAAQ,CAAC,SAAS,UAAW,QAAQ,cAAc,CAAC,KAAK,IAAI,CAAC,CAAE;AAAA,EAClF,CAAC;AAED,QAAM,SAAS,CAAC,UAAkB,CAAC,eAAe,KAAK,SAAS,KAAK;AAErE,QAAM,SAAS,CAAC,UAAkB;AAChC,QAAI,CAAC,YAA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AK,MAAK,SAAS,SAAS,WAAU,WACzE,sBACH;AAAA,MAED,WACC,4CAAC,wBAAO,MAAK,UAAS,MAAK,MAAK,SAAS,SACtC,sBACH;AAAA,OAEJ;AAAA,KAEJ;AAEJ,CAAC;","names":["FilterPanel"]}
@@ -19,14 +19,17 @@ const FilterPanel = React.forwardRef(function FilterPanel2({
19
19
  ...props
20
20
  }, ref) {
21
21
  const Tag = as;
22
- const [open, setOpen] = React.useState(
23
- defaultOpen ?? sections.filter((section) => section.defaultOpen).map((section) => section.title)
24
- );
25
- const isOpen = (section) => !collapsible || open.includes(section.title);
26
- const toggle = (section) => {
22
+ const [open, setOpen] = React.useState(() => {
23
+ if (defaultOpen) {
24
+ return sections.flatMap((section, index) => defaultOpen.includes(section.title) ? [index] : []);
25
+ }
26
+ return sections.flatMap((section, index) => section.defaultOpen ? [index] : []);
27
+ });
28
+ const isOpen = (index) => !collapsible || open.includes(index);
29
+ const toggle = (index) => {
27
30
  if (!collapsible) return;
28
31
  setOpen(
29
- (current) => current.includes(section.title) ? current.filter((title2) => title2 !== section.title) : [...current, section.title]
32
+ (current) => current.includes(index) ? current.filter((entry) => entry !== index) : [...current, index]
30
33
  );
31
34
  };
32
35
  return /* @__PURE__ */ jsxs(Tag, { ref, className: cn("w-full rounded-xl border border-border bg-card", className), ...props, children: [
@@ -34,16 +37,17 @@ const FilterPanel = React.forwardRef(function FilterPanel2({
34
37
  title && /* @__PURE__ */ jsx("h2", { className: "text-sm font-semibold", children: title }),
35
38
  description && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: description })
36
39
  ] }),
37
- /* @__PURE__ */ jsx("div", { className: "divide-y divide-border", children: sections.map((section) => {
38
- const expanded = isOpen(section);
40
+ /* @__PURE__ */ jsx("div", { className: "divide-y divide-border", children: sections.map((section, index) => {
41
+ const expanded = isOpen(index);
42
+ const sectionId = `filter-section-${index}`;
39
43
  return /* @__PURE__ */ jsxs("div", { className: "px-4 py-3", children: [
40
44
  /* @__PURE__ */ jsx("h3", { children: /* @__PURE__ */ jsxs(
41
45
  "button",
42
46
  {
43
47
  type: "button",
44
- onClick: () => toggle(section),
48
+ onClick: () => toggle(index),
45
49
  "aria-expanded": expanded,
46
- "aria-controls": `filter-section-${section.title.replace(/\s+/g, "-").toLowerCase()}`,
50
+ "aria-controls": sectionId,
47
51
  disabled: !collapsible,
48
52
  className: cn(
49
53
  "flex w-full items-center justify-between gap-2 text-left text-sm font-medium",
@@ -58,8 +62,8 @@ const FilterPanel = React.forwardRef(function FilterPanel2({
58
62
  ]
59
63
  }
60
64
  ) }),
61
- expanded && /* @__PURE__ */ jsx("div", { id: `filter-section-${section.title.replace(/\s+/g, "-").toLowerCase()}`, className: "mt-3", children: section.content })
62
- ] }, section.title);
65
+ expanded && /* @__PURE__ */ jsx("div", { id: sectionId, className: "mt-3", children: section.content })
66
+ ] }, index);
63
67
  }) }),
64
68
  (onReset || onApply || actions) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 border-t border-border px-4 py-3", children: [
65
69
  actions,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/filter-panel/FilterPanel.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../button/Button';\n\nexport type FilterSection = {\n /** Section heading. */\n title: string;\n /** Supporting line under the heading. */\n description?: string;\n /** Filter controls shown inside the section. */\n content: React.ReactNode;\n /** Open on first render. */\n defaultOpen?: boolean;\n};\n\nexport type FilterPanelProps = React.HTMLAttributes<HTMLElement> & {\n /** Filter groups. */\n sections: FilterSection[];\n /** Panel heading. Default \"Filters\". */\n title?: string;\n /** Supporting copy under the panel heading. */\n description?: string;\n /** Reset action shown in the footer. */\n onReset?: () => void;\n /** Apply action shown in the footer. */\n onApply?: () => void;\n /** Reset button label. Default \"Reset\". */\n resetLabel?: string;\n /** Apply button label. Default \"Apply\". */\n applyLabel?: string;\n /** Allow sections to collapse. Default true. */\n collapsible?: boolean;\n /** Section titles open on first render. */\n defaultOpen?: string[];\n /** Extra footer content. */\n actions?: React.ReactNode;\n /** Semantic element (default 'div'). */\n as?: 'div' | 'aside' | 'section';\n};\n\n/**\n * Structured filter panel for dashboards and directories. It owns section\n * expansion and the reset/apply footer; filter values stay with the caller.\n * Use it in a sidebar on desktop and inside a Drawer on mobile.\n */\nexport const FilterPanel = React.forwardRef<HTMLElement, FilterPanelProps>(function FilterPanel(\n {\n sections,\n title = 'Filters',\n description,\n onReset,\n onApply,\n resetLabel = 'Reset',\n applyLabel = 'Apply',\n collapsible = true,\n defaultOpen,\n actions,\n as = 'div',\n className,\n ...props\n },\n ref\n) {\n const Tag = as as 'div';\n const [open, setOpen] = React.useState<string[]>(\n defaultOpen ?? sections.filter((section) => section.defaultOpen).map((section) => section.title)\n );\n\n const isOpen = (section: FilterSection) => !collapsible || open.includes(section.title);\n\n const toggle = (section: FilterSection) => {\n if (!collapsible) return;\n setOpen((current) =>\n current.includes(section.title)\n ? current.filter((title) => title !== section.title)\n : [...current, section.title]\n );\n };\n\n return (\n <Tag ref={ref as never} className={cn('w-full rounded-xl border border-border bg-card', className)} {...props}>\n {(title || description) && (\n <div className=\"border-b border-border px-4 py-3\">\n {title && <h2 className=\"text-sm font-semibold\">{title}</h2>}\n {description && <p className=\"mt-1 text-xs text-muted-foreground\">{description}</p>}\n </div>\n )}\n <div className=\"divide-y divide-border\">\n {sections.map((section) => {\n const expanded = isOpen(section);\n return (\n <div key={section.title} className=\"px-4 py-3\">\n <h3>\n <button\n type=\"button\"\n onClick={() => toggle(section)}\n aria-expanded={expanded}\n aria-controls={`filter-section-${section.title.replace(/\\s+/g, '-').toLowerCase()}`}\n disabled={!collapsible}\n className={cn(\n 'flex w-full items-center justify-between gap-2 text-left text-sm font-medium',\n collapsible && 'rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n )}\n >\n <span>\n {section.title}\n {section.description && (\n <span className=\"mt-0.5 block text-xs font-normal text-muted-foreground\">{section.description}</span>\n )}\n </span>\n {collapsible && (\n <span aria-hidden=\"true\" className={cn('text-muted-foreground transition-transform', expanded && 'rotate-180')}>\n ⌄\n </span>\n )}\n </button>\n </h3>\n {expanded && (\n <div id={`filter-section-${section.title.replace(/\\s+/g, '-').toLowerCase()}`} className=\"mt-3\">\n {section.content}\n </div>\n )}\n </div>\n );\n })}\n </div>\n {(onReset || onApply || actions) && (\n <div className=\"flex flex-wrap items-center gap-2 border-t border-border px-4 py-3\">\n {actions}\n {onReset && (\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={onReset} className=\"ml-auto\">\n {resetLabel}\n </Button>\n )}\n {onApply && (\n <Button type=\"button\" size=\"sm\" onClick={onApply}>\n {applyLabel}\n </Button>\n )}\n </div>\n )}\n </Tag>\n );\n});\n"],"mappings":";AAoFQ,SACY,KADZ;AAlFR,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,cAAc;AA2ChB,MAAM,cAAc,MAAM,WAA0C,SAASA,aAClF;AAAA,EACE;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,aAAa;AAAA,EACb,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,KAAK;AAAA,EACL;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,MAAM;AACZ,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM;AAAA,IAC5B,eAAe,SAAS,OAAO,CAAC,YAAY,QAAQ,WAAW,EAAE,IAAI,CAAC,YAAY,QAAQ,KAAK;AAAA,EACjG;AAEA,QAAM,SAAS,CAAC,YAA2B,CAAC,eAAe,KAAK,SAAS,QAAQ,KAAK;AAEtF,QAAM,SAAS,CAAC,YAA2B;AACzC,QAAI,CAAC,YAAa;AAClB;AAAA,MAAQ,CAAC,YACP,QAAQ,SAAS,QAAQ,KAAK,IAC1B,QAAQ,OAAO,CAACC,WAAUA,WAAU,QAAQ,KAAK,IACjD,CAAC,G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S,SAAS,WAAU,WACzE,sBACH;AAAA,MAED,WACC,oBAAC,UAAO,MAAK,UAAS,MAAK,MAAK,SAAS,SACtC,sBACH;AAAA,OAEJ;AAAA,KAEJ;AAEJ,CAAC;","names":["FilterPanel","title"]}
1
+ {"version":3,"sources":["../../../../src/components/filter-panel/FilterPanel.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../button/Button';\n\nexport type FilterSection = {\n /** Section heading. */\n title: string;\n /** Supporting line under the heading. */\n description?: string;\n /** Filter controls shown inside the section. */\n content: React.ReactNode;\n /** Open on first render. */\n defaultOpen?: boolean;\n};\n\nexport type FilterPanelProps = React.HTMLAttributes<HTMLElement> & {\n /** Filter groups. */\n sections: FilterSection[];\n /** Panel heading. Default \"Filters\". */\n title?: string;\n /** Supporting copy under the panel heading. */\n description?: string;\n /** Reset action shown in the footer. */\n onReset?: () => void;\n /** Apply action shown in the footer. */\n onApply?: () => void;\n /** Reset button label. Default \"Reset\". */\n resetLabel?: string;\n /** Apply button label. Default \"Apply\". */\n applyLabel?: string;\n /** Allow sections to collapse. Default true. */\n collapsible?: boolean;\n /** Section titles open on first render. */\n defaultOpen?: string[];\n /** Extra footer content. */\n actions?: React.ReactNode;\n /** Semantic element (default 'div'). */\n as?: 'div' | 'aside' | 'section';\n};\n\n/**\n * Structured filter panel for dashboards and directories. It owns section\n * expansion and the reset/apply footer; filter values stay with the caller.\n * Use it in a sidebar on desktop and inside a Drawer on mobile.\n */\nexport const FilterPanel = React.forwardRef<HTMLElement, FilterPanelProps>(function FilterPanel(\n {\n sections,\n title = 'Filters',\n description,\n onReset,\n onApply,\n resetLabel = 'Reset',\n applyLabel = 'Apply',\n collapsible = true,\n defaultOpen,\n actions,\n as = 'div',\n className,\n ...props\n },\n ref\n) {\n const Tag = as as 'div';\n // Sections are identified by index, not title: duplicate or\n // punctuation-colliding titles must not share open state or DOM ids.\n const [open, setOpen] = React.useState<number[]>(() => {\n if (defaultOpen) {\n return sections.flatMap((section, index) => (defaultOpen.includes(section.title) ? [index] : []));\n }\n return sections.flatMap((section, index) => (section.defaultOpen ? [index] : []));\n });\n\n const isOpen = (index: number) => !collapsible || open.includes(index);\n\n const toggle = (index: number) => {\n if (!collapsible) return;\n setOpen((current) =>\n current.includes(index) ? current.filter((entry) => entry !== index) : [...current, index]\n );\n };\n\n return (\n <Tag ref={ref as never} className={cn('w-full rounded-xl border border-border bg-card', className)} {...props}>\n {(title || description) && (\n <div className=\"border-b border-border px-4 py-3\">\n {title && <h2 className=\"text-sm font-semibold\">{title}</h2>}\n {description && <p className=\"mt-1 text-xs text-muted-foreground\">{description}</p>}\n </div>\n )}\n <div className=\"divide-y divide-border\">\n {sections.map((section, index) => {\n const expanded = isOpen(index);\n const sectionId = `filter-section-${index}`;\n return (\n <div key={index} className=\"px-4 py-3\">\n <h3>\n <button\n type=\"button\"\n onClick={() => toggle(index)}\n aria-expanded={expanded}\n aria-controls={sectionId}\n disabled={!collapsible}\n className={cn(\n 'flex w-full items-center justify-between gap-2 text-left text-sm font-medium',\n collapsible && 'rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n )}\n >\n <span>\n {section.title}\n {section.description && (\n <span className=\"mt-0.5 block text-xs font-normal text-muted-foreground\">{section.description}</span>\n )}\n </span>\n {collapsible && (\n <span aria-hidden=\"true\" className={cn('text-muted-foreground transition-transform', expanded && 'rotate-180')}>\n ⌄\n </span>\n )}\n </button>\n </h3>\n {expanded && (\n <div id={sectionId} className=\"mt-3\">\n {section.content}\n </div>\n )}\n </div>\n );\n })}\n </div>\n {(onReset || onApply || actions) && (\n <div className=\"flex flex-wrap items-center gap-2 border-t border-border px-4 py-3\">\n {actions}\n {onReset && (\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={onReset} className=\"ml-auto\">\n {resetLabel}\n </Button>\n )}\n {onApply && (\n <Button type=\"button\" size=\"sm\" onClick={onApply}>\n {applyLabel}\n </Button>\n )}\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