@brightlocal/ui-components 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. package/AI_USAGE.md +10 -0
  2. package/README.md +3 -1
  3. package/component-meta.json +1271 -428
  4. package/deprecations.json +44 -0
  5. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  6. package/dist/accordion.cjs +1 -1
  7. package/dist/accordion.js +73 -102
  8. package/dist/alert-dialog.cjs +1 -1
  9. package/dist/alert-dialog.d.ts +6 -4
  10. package/dist/alert-dialog.d.ts.map +1 -1
  11. package/dist/alert-dialog.js +85 -133
  12. package/dist/alert.cjs +1 -1
  13. package/dist/alert.d.ts +4 -4
  14. package/dist/alert.d.ts.map +1 -1
  15. package/dist/alert.js +106 -168
  16. package/dist/aspect-ratio.cjs +1 -1
  17. package/dist/aspect-ratio.js +13 -16
  18. package/dist/avatar.cjs +1 -1
  19. package/dist/avatar.js +30 -45
  20. package/dist/badge.cjs +1 -1
  21. package/dist/badge.d.ts +23 -1
  22. package/dist/badge.d.ts.map +1 -1
  23. package/dist/badge.js +90 -91
  24. package/dist/banner.cjs +1 -1
  25. package/dist/banner.js +102 -148
  26. package/dist/blocks/empty-state.cjs +1 -1
  27. package/dist/blocks/empty-state.d.ts +20 -3
  28. package/dist/blocks/empty-state.d.ts.map +1 -1
  29. package/dist/blocks/empty-state.js +73 -140
  30. package/dist/blocks/input-list.cjs +2 -2
  31. package/dist/blocks/input-list.d.ts +2 -2
  32. package/dist/blocks/input-list.d.ts.map +1 -1
  33. package/dist/blocks/input-list.js +136 -176
  34. package/dist/blocks/progress-state.cjs +1 -1
  35. package/dist/blocks/progress-state.js +223 -347
  36. package/dist/blocks/sidebar.cjs +1 -1
  37. package/dist/blocks/sidebar.d.ts +11 -6
  38. package/dist/blocks/sidebar.d.ts.map +1 -1
  39. package/dist/blocks/sidebar.js +763 -1092
  40. package/dist/brand-illustration-motif.cjs +1 -1
  41. package/dist/brand-illustration-motif.js +40 -61
  42. package/dist/breadcrumb.cjs +1 -1
  43. package/dist/breadcrumb.js +62 -102
  44. package/dist/button-group.cjs +1 -1
  45. package/dist/button-group.js +23 -31
  46. package/dist/button.cjs +1 -1
  47. package/dist/button.d.ts +4 -2
  48. package/dist/button.d.ts.map +1 -1
  49. package/dist/button.js +149 -189
  50. package/dist/calendar.cjs +1 -1
  51. package/dist/calendar.d.ts +87 -3
  52. package/dist/calendar.d.ts.map +1 -1
  53. package/dist/calendar.js +116 -173
  54. package/dist/callout.cjs +1 -1
  55. package/dist/callout.js +73 -96
  56. package/dist/card.cjs +1 -1
  57. package/dist/card.d.ts +10 -4
  58. package/dist/card.d.ts.map +1 -1
  59. package/dist/card.js +233 -316
  60. package/dist/carousel.cjs +1 -1
  61. package/dist/carousel.d.ts +3 -3
  62. package/dist/carousel.d.ts.map +1 -1
  63. package/dist/carousel.js +174 -268
  64. package/dist/centred-layout.cjs +1 -1
  65. package/dist/centred-layout.js +27 -48
  66. package/dist/chart-empty.cjs +1 -1
  67. package/dist/chart-empty.js +18 -27
  68. package/dist/chart.cjs +7 -7
  69. package/dist/chart.d.ts +23 -13
  70. package/dist/chart.d.ts.map +1 -1
  71. package/dist/chart.js +445 -651
  72. package/dist/checkbox.cjs +1 -1
  73. package/dist/checkbox.js +36 -69
  74. package/dist/chip.cjs +1 -1
  75. package/dist/chip.js +116 -173
  76. package/dist/collapsible.cjs +1 -1
  77. package/dist/collapsible.d.ts.map +1 -1
  78. package/dist/collapsible.js +35 -41
  79. package/dist/combobox.cjs +3 -3
  80. package/dist/combobox.d.ts +14 -4
  81. package/dist/combobox.d.ts.map +1 -1
  82. package/dist/combobox.js +439 -638
  83. package/dist/command.cjs +1 -1
  84. package/dist/command.d.ts.map +1 -1
  85. package/dist/command.js +273 -420
  86. package/dist/context-menu.cjs +1 -1
  87. package/dist/context-menu.d.ts +5 -5
  88. package/dist/context-menu.d.ts.map +1 -1
  89. package/dist/context-menu.js +121 -191
  90. package/dist/data-table.cjs +1 -1
  91. package/dist/data-table.d.ts +280 -129
  92. package/dist/data-table.d.ts.map +1 -1
  93. package/dist/data-table.js +687 -948
  94. package/dist/date-picker.cjs +1 -1
  95. package/dist/date-picker.d.ts +15 -4
  96. package/dist/date-picker.d.ts.map +1 -1
  97. package/dist/date-picker.js +156 -231
  98. package/dist/delta.cjs +1 -0
  99. package/dist/delta.d.ts +79 -0
  100. package/dist/delta.d.ts.map +1 -0
  101. package/dist/delta.js +62 -0
  102. package/dist/description.cjs +1 -1
  103. package/dist/description.js +11 -20
  104. package/dist/dialog.cjs +1 -1
  105. package/dist/dialog.d.ts +1 -1
  106. package/dist/dialog.d.ts.map +1 -1
  107. package/dist/dialog.js +76 -116
  108. package/dist/drawer.cjs +1 -1
  109. package/dist/drawer.d.ts +11 -11
  110. package/dist/drawer.d.ts.map +1 -1
  111. package/dist/drawer.js +76 -134
  112. package/dist/dropdown-menu.cjs +1 -1
  113. package/dist/dropdown-menu.d.ts +6 -6
  114. package/dist/dropdown-menu.d.ts.map +1 -1
  115. package/dist/dropdown-menu.js +179 -300
  116. package/dist/field.cjs +1 -1
  117. package/dist/field.d.ts +9 -9
  118. package/dist/field.d.ts.map +1 -1
  119. package/dist/field.js +166 -286
  120. package/dist/global-layout.cjs +1 -1
  121. package/dist/global-layout.js +203 -342
  122. package/dist/grid.cjs +1 -1
  123. package/dist/grid.js +16 -29
  124. package/dist/header.cjs +1 -1
  125. package/dist/header.js +21 -38
  126. package/dist/height-transition.cjs +1 -1
  127. package/dist/height-transition.js +38 -55
  128. package/dist/hooks/use-breakpoint.cjs +1 -1
  129. package/dist/hooks/use-breakpoint.js +9 -9
  130. package/dist/hooks/use-debounce.cjs +1 -1
  131. package/dist/hooks/use-debounce.js +12 -11
  132. package/dist/hooks/use-delayed-pending.cjs +1 -1
  133. package/dist/hooks/use-delayed-pending.js +8 -9
  134. package/dist/hooks/use-filter-search-params.cjs +1 -0
  135. package/dist/hooks/use-filter-search-params.d.ts +93 -0
  136. package/dist/hooks/use-filter-search-params.d.ts.map +1 -0
  137. package/dist/hooks/use-filter-search-params.js +122 -0
  138. package/dist/hooks/use-mobile.cjs +1 -1
  139. package/dist/hooks/use-mobile.js +6 -6
  140. package/dist/hooks/use-overlay-pointer-lock.cjs +1 -1
  141. package/dist/hooks/use-overlay-pointer-lock.js +8 -9
  142. package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
  143. package/dist/hooks/use-prefers-reduced-motion.js +5 -8
  144. package/dist/hover-card.cjs +1 -1
  145. package/dist/hover-card.d.ts +1 -1
  146. package/dist/hover-card.d.ts.map +1 -1
  147. package/dist/hover-card.js +30 -62
  148. package/dist/index.cjs +1 -1
  149. package/dist/index.d.ts +6 -0
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +630 -608
  152. package/dist/info-tooltip.cjs +1 -1
  153. package/dist/info-tooltip.js +22 -36
  154. package/dist/input-chip.cjs +1 -1
  155. package/dist/input-chip.d.ts +32 -3
  156. package/dist/input-chip.d.ts.map +1 -1
  157. package/dist/input-chip.js +181 -230
  158. package/dist/input-group.cjs +1 -1
  159. package/dist/input-group.js +174 -221
  160. package/dist/input-otp.cjs +1 -1
  161. package/dist/input-otp.d.ts +3 -3
  162. package/dist/input-otp.d.ts.map +1 -1
  163. package/dist/input-otp.js +102 -146
  164. package/dist/input-password.cjs +1 -1
  165. package/dist/input-password.d.ts +12 -16
  166. package/dist/input-password.d.ts.map +1 -1
  167. package/dist/input-password.js +139 -171
  168. package/dist/input.cjs +1 -1
  169. package/dist/input.d.ts.map +1 -1
  170. package/dist/input.js +51 -73
  171. package/dist/label.cjs +1 -1
  172. package/dist/label.js +20 -38
  173. package/dist/lib/block-illustration.cjs +1 -1
  174. package/dist/lib/block-illustration.d.ts +1 -1
  175. package/dist/lib/block-illustration.d.ts.map +1 -1
  176. package/dist/lib/block-illustration.js +16 -18
  177. package/dist/lib/compose-event-handlers.cjs +1 -0
  178. package/dist/lib/compose-event-handlers.d.ts +9 -0
  179. package/dist/lib/compose-event-handlers.d.ts.map +1 -0
  180. package/dist/lib/compose-event-handlers.js +8 -0
  181. package/dist/lib/download-file.cjs +1 -0
  182. package/dist/lib/download-file.d.ts +14 -0
  183. package/dist/lib/download-file.d.ts.map +1 -0
  184. package/dist/lib/download-file.js +40 -0
  185. package/dist/lib/empty-canvas.cjs +1 -1
  186. package/dist/lib/empty-canvas.js +28 -56
  187. package/dist/lib/empty-chip.cjs +1 -1
  188. package/dist/lib/empty-chip.d.ts +14 -3
  189. package/dist/lib/empty-chip.d.ts.map +1 -1
  190. package/dist/lib/empty-chip.js +15 -11
  191. package/dist/lib/field-aria.cjs +1 -0
  192. package/dist/lib/field-aria.d.ts +34 -0
  193. package/dist/lib/field-aria.d.ts.map +1 -0
  194. package/dist/lib/field-aria.js +52 -0
  195. package/dist/lib/image-file-info.cjs +1 -0
  196. package/dist/lib/image-file-info.d.ts +25 -0
  197. package/dist/lib/image-file-info.d.ts.map +1 -0
  198. package/dist/lib/image-file-info.js +67 -0
  199. package/dist/lib/media-viewer-content.cjs +1 -0
  200. package/dist/lib/media-viewer-content.d.ts +102 -0
  201. package/dist/lib/media-viewer-content.d.ts.map +1 -0
  202. package/dist/lib/media-viewer-content.js +650 -0
  203. package/dist/lib/media-viewer-internal.cjs +1 -0
  204. package/dist/lib/media-viewer-internal.d.ts +98 -0
  205. package/dist/lib/media-viewer-internal.d.ts.map +1 -0
  206. package/dist/lib/media-viewer-internal.js +61 -0
  207. package/dist/lib/media-viewer-motion.cjs +1 -0
  208. package/dist/lib/media-viewer-motion.d.ts +40 -0
  209. package/dist/lib/media-viewer-motion.d.ts.map +1 -0
  210. package/dist/lib/media-viewer-motion.js +37 -0
  211. package/dist/lib/motion.cjs +1 -1
  212. package/dist/lib/motion.d.ts +8 -0
  213. package/dist/lib/motion.d.ts.map +1 -1
  214. package/dist/lib/motion.js +11 -10
  215. package/dist/lib/optical-center.cjs +1 -1
  216. package/dist/lib/optical-center.d.ts +1 -1
  217. package/dist/lib/optical-center.d.ts.map +1 -1
  218. package/dist/lib/optical-center.js +12 -5
  219. package/dist/lib/spring-settle.cjs +1 -1
  220. package/dist/lib/spring-settle.js +1 -1
  221. package/dist/lib/table-internal.cjs +1 -0
  222. package/dist/lib/table-internal.d.ts +62 -0
  223. package/dist/lib/table-internal.d.ts.map +1 -0
  224. package/dist/lib/table-internal.js +18 -0
  225. package/dist/lib/use-controllable.cjs +1 -0
  226. package/dist/lib/use-controllable.d.ts +12 -0
  227. package/dist/lib/use-controllable.d.ts.map +1 -0
  228. package/dist/lib/use-controllable.js +15 -0
  229. package/dist/lib/use-dev-warning.cjs +1 -1
  230. package/dist/lib/utils.cjs +1 -1
  231. package/dist/lib/utils.js +26 -33
  232. package/dist/link.cjs +1 -1
  233. package/dist/link.d.ts +1 -1
  234. package/dist/link.js +78 -124
  235. package/dist/list.cjs +1 -1
  236. package/dist/list.d.ts +8 -0
  237. package/dist/list.d.ts.map +1 -1
  238. package/dist/list.js +94 -156
  239. package/dist/loading.cjs +1 -1
  240. package/dist/loading.js +124 -151
  241. package/dist/logo-mark.cjs +1 -0
  242. package/dist/logo-mark.d.ts +79 -0
  243. package/dist/logo-mark.d.ts.map +1 -0
  244. package/dist/logo-mark.js +219 -0
  245. package/dist/logo.cjs +1 -1
  246. package/dist/logo.d.ts +1 -1
  247. package/dist/logo.d.ts.map +1 -1
  248. package/dist/logo.js +51 -87
  249. package/dist/map.cjs +1 -1
  250. package/dist/map.d.ts.map +1 -1
  251. package/dist/map.js +390 -586
  252. package/dist/media-empty.cjs +1 -1
  253. package/dist/media-empty.js +27 -42
  254. package/dist/media-viewer.cjs +1 -0
  255. package/dist/media-viewer.d.ts +224 -0
  256. package/dist/media-viewer.d.ts.map +1 -0
  257. package/dist/media-viewer.js +295 -0
  258. package/dist/menubar.cjs +1 -1
  259. package/dist/menubar.d.ts +14 -14
  260. package/dist/menubar.d.ts.map +1 -1
  261. package/dist/menubar.js +130 -267
  262. package/dist/multi-select-filter.cjs +1 -1
  263. package/dist/multi-select-filter.d.ts +9 -1
  264. package/dist/multi-select-filter.d.ts.map +1 -1
  265. package/dist/multi-select-filter.js +357 -446
  266. package/dist/navigation-menu.cjs +1 -1
  267. package/dist/navigation-menu.js +108 -172
  268. package/dist/pagination.cjs +1 -1
  269. package/dist/pagination.d.ts +36 -12
  270. package/dist/pagination.d.ts.map +1 -1
  271. package/dist/pagination.js +208 -281
  272. package/dist/popover.cjs +1 -1
  273. package/dist/popover.d.ts +1 -1
  274. package/dist/popover.d.ts.map +1 -1
  275. package/dist/popover.js +34 -45
  276. package/dist/progress.cjs +1 -1
  277. package/dist/progress.d.ts +17 -2
  278. package/dist/progress.d.ts.map +1 -1
  279. package/dist/progress.js +116 -162
  280. package/dist/radio-group.cjs +1 -1
  281. package/dist/radio-group.js +90 -146
  282. package/dist/rating.cjs +1 -1
  283. package/dist/rating.d.ts +80 -13
  284. package/dist/rating.d.ts.map +1 -1
  285. package/dist/rating.js +70 -65
  286. package/dist/relative-date.cjs +1 -1
  287. package/dist/relative-date.d.ts.map +1 -1
  288. package/dist/relative-date.js +73 -89
  289. package/dist/resizable.cjs +1 -1
  290. package/dist/resizable.d.ts +39 -23
  291. package/dist/resizable.d.ts.map +1 -1
  292. package/dist/resizable.js +42 -44
  293. package/dist/result-count.cjs +1 -0
  294. package/dist/result-count.d.ts +110 -0
  295. package/dist/result-count.d.ts.map +1 -0
  296. package/dist/result-count.js +49 -0
  297. package/dist/route-progress.cjs +1 -1
  298. package/dist/route-progress.js +58 -102
  299. package/dist/scroll-area.cjs +1 -1
  300. package/dist/scroll-area.d.ts +9 -1
  301. package/dist/scroll-area.d.ts.map +1 -1
  302. package/dist/scroll-area.js +44 -79
  303. package/dist/select.cjs +2 -2
  304. package/dist/select.d.ts +10 -10
  305. package/dist/select.d.ts.map +1 -1
  306. package/dist/select.js +118 -238
  307. package/dist/separator.cjs +1 -1
  308. package/dist/separator.js +90 -78
  309. package/dist/sheet.cjs +1 -1
  310. package/dist/sheet.d.ts +8 -5
  311. package/dist/sheet.d.ts.map +1 -1
  312. package/dist/sheet.js +250 -317
  313. package/dist/single-select-filter.cjs +1 -1
  314. package/dist/single-select-filter.d.ts +32 -0
  315. package/dist/single-select-filter.d.ts.map +1 -1
  316. package/dist/single-select-filter.js +201 -203
  317. package/dist/skeleton.cjs +1 -1
  318. package/dist/skeleton.js +24 -38
  319. package/dist/slider.cjs +1 -1
  320. package/dist/slider.js +51 -81
  321. package/dist/sonner.cjs +1 -1
  322. package/dist/sonner.d.ts +1 -1
  323. package/dist/sonner.d.ts.map +1 -1
  324. package/dist/sonner.js +101 -125
  325. package/dist/spinner.cjs +1 -1
  326. package/dist/spinner.js +22 -31
  327. package/dist/split-layout.cjs +1 -1
  328. package/dist/split-layout.js +52 -101
  329. package/dist/status.cjs +1 -0
  330. package/dist/status.d.ts +51 -0
  331. package/dist/status.d.ts.map +1 -0
  332. package/dist/status.js +60 -0
  333. package/dist/stepper.cjs +1 -1
  334. package/dist/stepper.js +184 -316
  335. package/dist/switch.cjs +1 -1
  336. package/dist/switch.js +17 -32
  337. package/dist/table.cjs +1 -1
  338. package/dist/table.d.ts +103 -30
  339. package/dist/table.d.ts.map +1 -1
  340. package/dist/table.js +170 -209
  341. package/dist/tabs.cjs +1 -1
  342. package/dist/tabs.d.ts.map +1 -1
  343. package/dist/tabs.js +102 -147
  344. package/dist/text-reveal-motion.cjs +1 -1
  345. package/dist/text-reveal-motion.js +307 -363
  346. package/dist/textarea.cjs +1 -1
  347. package/dist/textarea.d.ts.map +1 -1
  348. package/dist/textarea.js +22 -35
  349. package/dist/toggle-group.cjs +1 -1
  350. package/dist/toggle-group.js +43 -62
  351. package/dist/toggle.cjs +1 -1
  352. package/dist/toggle.js +34 -46
  353. package/dist/tooltip.cjs +1 -1
  354. package/dist/tooltip.d.ts +2 -2
  355. package/dist/tooltip.d.ts.map +1 -1
  356. package/dist/tooltip.js +157 -249
  357. package/dist/typography-heading.cjs +1 -1
  358. package/dist/typography-heading.js +25 -61
  359. package/dist/typography-text.cjs +1 -1
  360. package/dist/typography-text.js +27 -57
  361. package/dist/typography.cjs +1 -1
  362. package/dist/typography.js +132 -340
  363. package/package.json +46 -46
  364. package/src/blocks/empty-state.tsx +34 -18
  365. package/src/blocks/sidebar.tsx +86 -31
  366. package/src/components/accordion.tsx +1 -1
  367. package/src/components/alert-dialog.tsx +4 -2
  368. package/src/components/badge.tsx +127 -15
  369. package/src/components/breadcrumb.tsx +1 -1
  370. package/src/components/button.tsx +8 -6
  371. package/src/components/calendar.tsx +155 -9
  372. package/src/components/card.tsx +63 -10
  373. package/src/components/carousel.tsx +4 -1
  374. package/src/components/chart.tsx +151 -17
  375. package/src/components/checkbox.tsx +1 -1
  376. package/src/components/collapsible.tsx +4 -1
  377. package/src/components/combobox.tsx +40 -7
  378. package/src/components/command.tsx +9 -10
  379. package/src/components/context-menu.tsx +4 -4
  380. package/src/components/data-table.tsx +619 -237
  381. package/src/components/date-picker.tsx +31 -4
  382. package/src/components/delta.tsx +217 -0
  383. package/src/components/drawer.tsx +5 -5
  384. package/src/components/dropdown-menu.tsx +4 -4
  385. package/src/components/field.tsx +36 -15
  386. package/src/components/global-layout.tsx +1 -1
  387. package/src/components/input-chip.tsx +51 -7
  388. package/src/components/input-group.tsx +1 -1
  389. package/src/components/input-password.tsx +15 -19
  390. package/src/components/input.tsx +10 -1
  391. package/src/components/list.tsx +14 -2
  392. package/src/components/logo-mark.tsx +345 -0
  393. package/src/components/map.tsx +18 -20
  394. package/src/components/media-viewer.tsx +908 -0
  395. package/src/components/multi-select-filter.tsx +255 -121
  396. package/src/components/navigation-menu.tsx +2 -2
  397. package/src/components/pagination.tsx +86 -26
  398. package/src/components/progress.tsx +91 -23
  399. package/src/components/rating.tsx +200 -74
  400. package/src/components/relative-date.tsx +19 -11
  401. package/src/components/resizable.tsx +86 -33
  402. package/src/components/result-count.tsx +253 -0
  403. package/src/components/scroll-area.tsx +31 -5
  404. package/src/components/select.tsx +2 -2
  405. package/src/components/sheet.tsx +14 -4
  406. package/src/components/single-select-filter.tsx +136 -41
  407. package/src/components/slider.tsx +2 -2
  408. package/src/components/status.tsx +162 -0
  409. package/src/components/switch.tsx +1 -1
  410. package/src/components/table.tsx +278 -106
  411. package/src/components/tabs.tsx +1 -0
  412. package/src/components/textarea.tsx +20 -2
  413. package/src/components/toggle.tsx +2 -2
  414. package/src/components/tooltip.tsx +11 -20
  415. package/src/hooks/use-filter-search-params.ts +302 -0
  416. package/src/index.ts +6 -0
  417. package/src/lib/compose-event-handlers.ts +14 -0
  418. package/src/lib/download-file.ts +61 -0
  419. package/src/lib/empty-chip.tsx +52 -0
  420. package/src/lib/field-aria.tsx +97 -0
  421. package/src/lib/image-file-info.ts +102 -0
  422. package/src/lib/media-viewer-content.tsx +1587 -0
  423. package/src/lib/media-viewer-internal.tsx +191 -0
  424. package/src/lib/media-viewer-motion.ts +120 -0
  425. package/src/lib/motion.ts +9 -0
  426. package/src/lib/table-internal.ts +74 -0
  427. package/src/lib/use-controllable.ts +43 -0
  428. package/src/lib/empty-chip.ts +0 -24
@@ -29,7 +29,11 @@ import {
29
29
  DrawerTrigger,
30
30
  } from "@brightlocal/ui-components/drawer";
31
31
  import { useIsBelowBreakpoint } from "@brightlocal/ui-components/hooks/use-breakpoint";
32
- import { Input } from "@brightlocal/ui-components/input";
32
+ import {
33
+ InputGroup,
34
+ InputGroupClear,
35
+ InputGroupInput,
36
+ } from "@brightlocal/ui-components/input-group";
33
37
  import { Label } from "@brightlocal/ui-components/label";
34
38
  import { cn } from "@brightlocal/ui-components/lib/utils";
35
39
  import {
@@ -37,11 +41,11 @@ import {
37
41
  PopoverContent,
38
42
  PopoverTrigger,
39
43
  } from "@brightlocal/ui-components/popover";
40
- import { emptyChipStyles } from "../lib/empty-chip";
44
+ import { EmptyChip } from "../lib/empty-chip";
41
45
 
42
- /* MultiSelectFilter — the Filtering pattern's faceted multi-select
43
- (Patterns/Data Manipulation/Filtering → Which control → Faceted
44
- multi-select): several values from one dimension, combining as OR.
46
+ /* MultiSelectFilter — the Filtering pattern's several-at-once filter
47
+ (Patterns/Filtering → Which filter → Several at once): several values
48
+ from one dimension, combining as OR.
45
49
 
46
50
  Trigger. The trigger hugs its label in a toolbar and wears the field look
47
51
  (SelectTrigger's border, radius, focus ring and chevron), because a filter
@@ -82,6 +86,14 @@ import { emptyChipStyles } from "../lib/empty-chip";
82
86
  happened"). `presentation="auto"` switches at the `md` breakpoint. Both
83
87
  render from one state, so the rules above cannot drift between them.
84
88
 
89
+ Groups. An option's `group` files it under a heading (Facebook's
90
+ Recommended / Not recommended after the star ratings). Groups keep the
91
+ order their first option has in `options`; options without a group form
92
+ the leading, heading-less group with the All row. Picks pin to the top of
93
+ their own group, search narrows within each group and hides a group with
94
+ no match, and the All row, counts, full-set collapse and the trigger
95
+ reading run across every group exactly as on a flat list (DS-1241).
96
+
85
97
  Commit model is per filter: `onValueChange` fires on every pick so client
86
98
  data can reflect immediately; defer an expensive refetch to
87
99
  `onOpenChange(false)`. */
@@ -96,13 +108,12 @@ import { emptyChipStyles } from "../lib/empty-chip";
96
108
  differences are structural, not decorative: the trigger hugs its label
97
109
  where a form field fills its row, there is no `data-[placeholder]` state
98
110
  because a trigger always has text to show, and there is no error state
99
- because a filter does not validate. Exported so the Filtering pattern's "Filters (n)" recipe
100
- — a trigger that opens a Sheet or Drawer of hidden filters — can wear the
101
- same look. */
111
+ because a filter does not validate. Exported as the trigger's style
112
+ helper (SingleSelectFilter's drawer trigger wears it too). */
102
113
  const multiSelectFilterTriggerVariants = cva(
103
114
  [
104
115
  // Base layout
105
- "relative inline-flex items-center justify-between gap-2 py-2",
116
+ "relative inline-flex cursor-pointer items-center justify-between gap-2 py-2",
106
117
 
107
118
  // Base appearance — the Figma Select's surface: background (input/30 in
108
119
  // dark) fill and the input border
@@ -169,6 +180,14 @@ interface MultiSelectFilterOption {
169
180
  * first pick's glyph when no `icon` is set.
170
181
  */
171
182
  icon?: React.ReactNode;
183
+ /**
184
+ * Heading this option is listed under, e.g. "Facebook". Options sharing a
185
+ * `group` render together under it, in the order the group first appears
186
+ * in `options`; options without one lead the list with no heading. Only
187
+ * the menu and the drawer show it — the trigger, counts, the All row and
188
+ * the full-set collapse treat every option alike.
189
+ */
190
+ group?: string;
172
191
  }
173
192
 
174
193
  interface MultiSelectFilterProps
@@ -181,7 +200,7 @@ interface MultiSelectFilterProps
181
200
  /**
182
201
  * Data hook for automated testing (REQUIRED). Every part of the menu
183
202
  * derives its own hook from it (`-popover`, `-search`, `-option-all`,
184
- * `-option-<value>`, `-clear`, `-summary`, `-icon`).
203
+ * `-option-<value>`, `-group-<heading>`, `-clear`, `-summary`, `-icon`).
185
204
  * @example "locations-status-filter"
186
205
  */
187
206
  dataHook: string;
@@ -450,6 +469,42 @@ function OptionCount({ count }: { count: number }) {
450
469
  );
451
470
  }
452
471
 
472
+ /* One heading's worth of options. `group` undefined is the leading,
473
+ heading-less run. */
474
+ interface OptionSection {
475
+ group?: string;
476
+ options: MultiSelectFilterOption[];
477
+ }
478
+
479
+ /* Split the shown options into their groups: the heading-less run first,
480
+ then named groups in the order of their first option in `options` (not
481
+ the shown list), so pinning a pick
482
+ never moves its whole group up; within a group the shown order (picks
483
+ pinned first) is kept. Empty groups (all filtered out) are dropped. */
484
+ function groupOptions(
485
+ options: readonly MultiSelectFilterOption[],
486
+ shown: readonly MultiSelectFilterOption[]
487
+ ): OptionSection[] {
488
+ /* Ungrouped options always lead, wherever they sit in `options`; the
489
+ empty-section filter drops that run when every option has a group. */
490
+ const order: (string | undefined)[] = [undefined];
491
+ for (const option of options) {
492
+ if (!order.includes(option.group)) order.push(option.group);
493
+ }
494
+ return order
495
+ .map((group) => ({
496
+ group,
497
+ options: shown.filter((option) => option.group === group),
498
+ }))
499
+ .filter((section) => section.options.length > 0);
500
+ }
501
+
502
+ /* `<dataHook>-group-<heading>`, the heading lower-cased with spaces as
503
+ dashes ("Not recommended" → "-group-not-recommended"). */
504
+ function groupHook(dataHook: string, group: string): string {
505
+ return `${dataHook}-group-${group.trim().toLowerCase().replace(/\s+/g, "-")}`;
506
+ }
507
+
453
508
  /* cmdk values for the two rows that are not options — unique, so an option
454
509
  labelled "All" or "Clear" never shares a value with them. */
455
510
  const ALL_ROW_VALUE = "__all__";
@@ -501,6 +556,7 @@ const MultiSelectFilter = React.forwardRef<
501
556
  trackingEl,
502
557
  trackingLabel,
503
558
  "aria-label": ariaLabelProp,
559
+ "aria-describedby": describedByProp,
504
560
  ...props
505
561
  },
506
562
  ref
@@ -524,7 +580,9 @@ const MultiSelectFilter = React.forwardRef<
524
580
  person types. It resets with every open. */
525
581
  const [query, setQuery] = React.useState("");
526
582
  const normalizedQuery = query.trim().toLowerCase();
527
- const searching = normalizedQuery.length > 0;
583
+ const commandRef = React.useRef<HTMLDivElement>(null);
584
+ const showSearch = searchable ?? options.length > searchThreshold;
585
+ const searching = showSearch && normalizedQuery.length > 0;
528
586
  /* Case-insensitive substring match on label and value — predictable for
529
587
  a list of names, unlike a fuzzy score. */
530
588
  const visibleOptions = searching
@@ -534,8 +592,7 @@ const MultiSelectFilter = React.forwardRef<
534
592
  option.value.toLowerCase().includes(normalizedQuery)
535
593
  )
536
594
  : state.orderedOptions;
537
- const commandRef = React.useRef<HTMLDivElement>(null);
538
- const showSearch = searchable ?? options.length > searchThreshold;
595
+ const sections = groupOptions(options, visibleOptions);
539
596
 
540
597
  /* The trigger's own record of the selection, in pick order — the first
541
598
  label stays put while more are added. A value with no option (stale
@@ -584,14 +641,25 @@ const MultiSelectFilter = React.forwardRef<
584
641
  );
585
642
  }
586
643
 
587
- /* The accessible name always starts with the dimension; the summary may
588
- hide picks ("Google +2"), so every pick is spelled out. */
644
+ /* The accessible name starts with the dimension and then reads the text
645
+ the trigger shows (WCAG 2.5.3 Label in Name). The summary may hide
646
+ picks ("Google +2"), so when it does every pick is spelled out in the
647
+ description instead of the name. */
589
648
  const computedAriaLabel =
590
649
  count > 0
591
- ? `${label}: ${pickedLabels.join(", ")}`
650
+ ? `${label}: ${triggerText}`
592
651
  : allLabel !== undefined
593
652
  ? `${label}: ${allLabel}`
594
653
  : label;
654
+ const picksDescription =
655
+ count > visibleLabels ? pickedLabels.join(", ") : undefined;
656
+ const picksId = `${idPrefix}-picks`;
657
+ /* The consumer's description ids ride along with the picks, never replace
658
+ them. */
659
+ const describedBy =
660
+ [describedByProp, picksDescription ? picksId : undefined]
661
+ .filter(Boolean)
662
+ .join(" ") || undefined;
595
663
 
596
664
  /* The glyph follows the selection unless the consumer pins one: the All
597
665
  mark at zero, then the first pick's own. */
@@ -602,13 +670,14 @@ const MultiSelectFilter = React.forwardRef<
602
670
  icon ?? (count > 0 ? firstPicked?.icon : allIcon) ?? undefined;
603
671
 
604
672
  const handleOpenChange = (next: boolean) => {
605
- if (!next) setQuery("");
673
+ if (next) setQuery("");
606
674
  state.onOpenChange(next);
607
675
  };
608
676
 
609
677
  const triggerNode = (
610
678
  <button
611
679
  ref={ref}
680
+ aria-describedby={describedBy}
612
681
  aria-label={ariaLabelProp ?? computedAriaLabel}
613
682
  className={cn(multiSelectFilterTriggerVariants({ size }), className)}
614
683
  data-hook={dataHook}
@@ -634,6 +703,11 @@ const MultiSelectFilter = React.forwardRef<
634
703
  >
635
704
  {triggerText}
636
705
  </span>
706
+ {picksDescription ? (
707
+ <span hidden id={picksId}>
708
+ {picksDescription}
709
+ </span>
710
+ ) : null}
637
711
  {/* The affordance the field look promises: a menu opens here. */}
638
712
  <ChevronDown aria-hidden="true" className="text-muted-foreground" />
639
713
  </button>
@@ -656,14 +730,18 @@ const MultiSelectFilter = React.forwardRef<
656
730
  stays in reach while the list scrolls. */}
657
731
  {showSearch ? (
658
732
  <DrawerBody className="shrink-0 pb-4">
659
- <Input
660
- aria-label={searchPlaceholder ?? "Search options..."}
661
- dataHook={`${dataHook}-search`}
662
- placeholder={searchPlaceholder ?? "Search options..."}
663
- type="search"
664
- value={query}
665
- onChange={(event) => setQuery(event.target.value)}
666
- />
733
+ <InputGroup dataHook={`${dataHook}-search`}>
734
+ <InputGroupInput
735
+ aria-label={searchPlaceholder ?? "Search options..."}
736
+ placeholder={searchPlaceholder ?? "Search options..."}
737
+ value={query}
738
+ onChange={(event) => setQuery(event.target.value)}
739
+ />
740
+ <InputGroupClear
741
+ clearSearchAriaLabel={clearSearchAriaLabel}
742
+ dataHook={`${dataHook}-search-clear`}
743
+ />
744
+ </InputGroup>
667
745
  </DrawerBody>
668
746
  ) : null}
669
747
  {/* min-h-0 + overflow: the list scrolls inside the drawer's
@@ -678,12 +756,12 @@ const MultiSelectFilter = React.forwardRef<
678
756
  className="text-body-sm flex flex-col items-center gap-1 py-6 text-center"
679
757
  data-hook={`${dataHook}-empty`}
680
758
  >
681
- <span
682
- aria-hidden="true"
683
- className={cn(emptyChipStyles(), "mb-1")}
684
- >
685
- <SearchX />
686
- </span>
759
+ <EmptyChip
760
+ className="mb-1"
761
+ dataHook={`${dataHook}-empty-icon`}
762
+ icon={<SearchX />}
763
+ slot="multi-select-filter-empty-icon"
764
+ />
687
765
  <p>{emptyLabel ?? "No options found."}</p>
688
766
  <p className="text-muted-foreground">
689
767
  {emptyDescription ?? "Try another search."}
@@ -715,44 +793,77 @@ const MultiSelectFilter = React.forwardRef<
715
793
  ) : null}
716
794
  </div>
717
795
  ) : null}
718
- <div className="grid grid-cols-2 gap-x-4 gap-y-3">
719
- {visibleOptions.map((option, index) => {
720
- const active = state.selectedSet.has(option.value);
721
- const optionDisabled =
722
- option.disabled || (option.count === 0 && !active);
723
- /* Keyed on the index, not the value — an id may not
796
+ {sections.map((section, sectionIndex) => {
797
+ const grid = (
798
+ <div className="grid grid-cols-2 gap-x-4 gap-y-3">
799
+ {section.options.map((option) => {
800
+ const index = visibleOptions.indexOf(option);
801
+ const active = state.selectedSet.has(option.value);
802
+ const optionDisabled =
803
+ option.disabled || (option.count === 0 && !active);
804
+ /* Keyed on the index, not the value — an id may not
724
805
  contain whitespace, and a value may. */
725
- const optionId = `${idPrefix}-${index}`;
726
- return (
727
- <div
728
- key={option.value}
729
- className="flex items-center gap-2"
730
- >
731
- <Checkbox
732
- checked={active}
733
- dataHook={`${dataHook}-option-${option.value}`}
734
- disabled={optionDisabled}
735
- id={optionId}
736
- onCheckedChange={() =>
737
- state.toggleOption(option.value)
738
- }
739
- />
740
- <Label className="flex-1 gap-2" htmlFor={optionId}>
741
- {option.icon ? (
742
- <span
743
- aria-hidden="true"
744
- className="flex shrink-0 items-center [&_svg]:size-4"
745
- data-hook={`${dataHook}-option-${option.value}-icon`}
806
+ const optionId = `${idPrefix}-${index}`;
807
+ return (
808
+ <div
809
+ key={option.value}
810
+ className="flex items-center gap-2"
811
+ >
812
+ <Checkbox
813
+ checked={active}
814
+ dataHook={`${dataHook}-option-${option.value}`}
815
+ disabled={optionDisabled}
816
+ id={optionId}
817
+ onCheckedChange={() =>
818
+ state.toggleOption(option.value)
819
+ }
820
+ />
821
+ <Label
822
+ className="flex-1 gap-2"
823
+ htmlFor={optionId}
746
824
  >
747
- {option.icon}
748
- </span>
749
- ) : null}
750
- {option.label}
751
- </Label>
752
- </div>
825
+ {option.icon ? (
826
+ <span
827
+ aria-hidden="true"
828
+ className="flex shrink-0 items-center [&_svg]:size-4"
829
+ data-hook={`${dataHook}-option-${option.value}-icon`}
830
+ >
831
+ {option.icon}
832
+ </span>
833
+ ) : null}
834
+ {option.label}
835
+ </Label>
836
+ </div>
837
+ );
838
+ })}
839
+ </div>
840
+ );
841
+ if (!section.group) {
842
+ return (
843
+ <React.Fragment key="__ungrouped__">
844
+ {grid}
845
+ </React.Fragment>
753
846
  );
754
- })}
755
- </div>
847
+ }
848
+ const headingId = `${idPrefix}-group-${sectionIndex}`;
849
+ return (
850
+ <div
851
+ key={section.group}
852
+ aria-labelledby={headingId}
853
+ className="flex flex-col gap-3"
854
+ data-hook={groupHook(dataHook, section.group)}
855
+ role="group"
856
+ >
857
+ <p
858
+ className="text-muted-foreground text-label-sm"
859
+ id={headingId}
860
+ >
861
+ {section.group}
862
+ </p>
863
+ {grid}
864
+ </div>
865
+ );
866
+ })}
756
867
  </>
757
868
  )}
758
869
  {state.value.length > 0 && !searching ? (
@@ -777,6 +888,34 @@ const MultiSelectFilter = React.forwardRef<
777
888
  );
778
889
  }
779
890
 
891
+ const showAllRow = allLabel !== undefined && !searching;
892
+ /* The All row rides in the leading heading-less group; when every option
893
+ has a group (or there are none) it gets a group of its own. */
894
+ const allInLead =
895
+ showAllRow && sections[0]?.group === undefined && sections.length > 0;
896
+ const allRow = showAllRow ? (
897
+ <CommandItem
898
+ aria-checked={allSelected}
899
+ dataHook={`${dataHook}-option-all`}
900
+ value={ALL_ROW_VALUE}
901
+ onSelect={state.clear}
902
+ >
903
+ <OptionCheck checked={allSelected} />
904
+ {allIcon ? (
905
+ <span
906
+ aria-hidden="true"
907
+ className="flex shrink-0 items-center [&_svg]:size-4"
908
+ >
909
+ {allIcon}
910
+ </span>
911
+ ) : null}
912
+ {allLabel}
913
+ {resolvedAllCount !== undefined ? (
914
+ <OptionCount count={resolvedAllCount} />
915
+ ) : null}
916
+ </CommandItem>
917
+ ) : null;
918
+
780
919
  return (
781
920
  <Popover open={state.open} onOpenChange={handleOpenChange}>
782
921
  <PopoverTrigger asChild>{triggerNode}</PopoverTrigger>
@@ -801,6 +940,7 @@ const MultiSelectFilter = React.forwardRef<
801
940
  provides the roving highlight and the keyboard. */}
802
941
  <Command
803
942
  ref={commandRef}
943
+ className="border-0 shadow-none"
804
944
  dataHook={`${dataHook}-command`}
805
945
  shouldFilter={false}
806
946
  >
@@ -826,64 +966,58 @@ const MultiSelectFilter = React.forwardRef<
826
966
  >
827
967
  {emptyLabel ?? "No options found."}
828
968
  </CommandEmpty>
829
- <CommandGroup>
830
- {allLabel !== undefined && !searching ? (
831
- <CommandItem
832
- aria-checked={allSelected}
833
- dataHook={`${dataHook}-option-all`}
834
- value={ALL_ROW_VALUE}
835
- onSelect={state.clear}
836
- >
837
- <OptionCheck checked={allSelected} />
838
- {allIcon ? (
839
- <span
840
- aria-hidden="true"
841
- className="flex shrink-0 items-center [&_svg]:size-4"
842
- >
843
- {allIcon}
844
- </span>
845
- ) : null}
846
- {allLabel}
847
- {resolvedAllCount !== undefined ? (
848
- <OptionCount count={resolvedAllCount} />
849
- ) : null}
850
- </CommandItem>
851
- ) : null}
852
- {visibleOptions.map((option) => {
853
- const active = state.selectedSet.has(option.value);
854
- /* A zero-count option disables, never hides — the dimension
969
+ {/* The All row shares the leading group with the heading-less
970
+ options; every named group follows under its heading. */}
971
+ {showAllRow && !allInLead ? (
972
+ <CommandGroup>{allRow}</CommandGroup>
973
+ ) : null}
974
+ {sections.map((section, sectionIndex) => (
975
+ <CommandGroup
976
+ key={section.group ?? "__ungrouped__"}
977
+ dataHook={
978
+ section.group
979
+ ? groupHook(dataHook, section.group)
980
+ : undefined
981
+ }
982
+ heading={section.group}
983
+ >
984
+ {sectionIndex === 0 && allInLead ? allRow : null}
985
+ {section.options.map((option) => {
986
+ const active = state.selectedSet.has(option.value);
987
+ /* A zero-count option disables, never hides — the dimension
855
988
  keeps its full shape on screen. A pick whose count dropped
856
989
  to zero under another filter stays enabled, so it can
857
990
  still be unticked. */
858
- const optionDisabled =
859
- option.disabled || (option.count === 0 && !active);
860
- return (
861
- <CommandItem
862
- key={option.value}
863
- aria-checked={active}
864
- dataHook={`${dataHook}-option-${option.value}`}
865
- disabled={optionDisabled}
866
- value={option.value}
867
- onSelect={() => state.toggleOption(option.value)}
868
- >
869
- <OptionCheck checked={active} />
870
- {option.icon ? (
871
- <span
872
- aria-hidden="true"
873
- className="flex shrink-0 items-center [&_svg]:size-4"
874
- data-hook={`${dataHook}-option-${option.value}-icon`}
875
- >
876
- {option.icon}
877
- </span>
878
- ) : null}
879
- {option.label}
880
- {option.count !== undefined ? (
881
- <OptionCount count={option.count} />
882
- ) : null}
883
- </CommandItem>
884
- );
885
- })}
886
- </CommandGroup>
991
+ const optionDisabled =
992
+ option.disabled || (option.count === 0 && !active);
993
+ return (
994
+ <CommandItem
995
+ key={option.value}
996
+ aria-checked={active}
997
+ dataHook={`${dataHook}-option-${option.value}`}
998
+ disabled={optionDisabled}
999
+ value={option.value}
1000
+ onSelect={() => state.toggleOption(option.value)}
1001
+ >
1002
+ <OptionCheck checked={active} />
1003
+ {option.icon ? (
1004
+ <span
1005
+ aria-hidden="true"
1006
+ className="flex shrink-0 items-center [&_svg]:size-4"
1007
+ data-hook={`${dataHook}-option-${option.value}-icon`}
1008
+ >
1009
+ {option.icon}
1010
+ </span>
1011
+ ) : null}
1012
+ {option.label}
1013
+ {option.count !== undefined ? (
1014
+ <OptionCount count={option.count} />
1015
+ ) : null}
1016
+ </CommandItem>
1017
+ );
1018
+ })}
1019
+ </CommandGroup>
1020
+ ))}
887
1021
  {state.value.length > 0 && !searching ? (
888
1022
  /* A bordered group, not CommandSeparator — role="separator"
889
1023
  is not a permitted child of the cmdk listbox. */
@@ -137,7 +137,7 @@ const NavigationMenuTrigger = React.forwardRef<
137
137
  ref={ref}
138
138
  className={cn(
139
139
  [
140
- "group inline-flex h-9 w-max items-center justify-center gap-1",
140
+ "group inline-flex h-9 w-max cursor-pointer items-center justify-center gap-1",
141
141
  "rounded-md px-4 py-2",
142
142
  "text-label",
143
143
  "text-foreground",
@@ -250,7 +250,7 @@ const NavigationMenuLink = React.forwardRef<
250
250
  ref={ref}
251
251
  className={cn(
252
252
  [
253
- "block rounded-md p-3 leading-none no-underline select-none",
253
+ "block cursor-pointer rounded-md p-3 leading-none no-underline select-none",
254
254
  "duration-fast transition-colors ease-out outline-none",
255
255
  "hover:bg-accent hover:text-accent-foreground",
256
256
  "focus:bg-accent focus:text-accent-foreground",