@brightlocal/ui-components 3.1.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 (463) hide show
  1. package/AI_USAGE.md +10 -0
  2. package/README.md +8 -1
  3. package/component-meta.json +1591 -123
  4. package/deprecations.json +45 -1
  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 +36 -5
  10. package/dist/alert-dialog.d.ts.map +1 -1
  11. package/dist/alert-dialog.js +83 -128
  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 +116 -177
  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 +32 -1
  22. package/dist/badge.d.ts.map +1 -1
  23. package/dist/badge.js +90 -71
  24. package/dist/banner.cjs +1 -0
  25. package/dist/banner.d.ts +81 -0
  26. package/dist/banner.d.ts.map +1 -0
  27. package/dist/banner.js +130 -0
  28. package/dist/blocks/empty-state.cjs +1 -1
  29. package/dist/blocks/empty-state.d.ts +24 -6
  30. package/dist/blocks/empty-state.d.ts.map +1 -1
  31. package/dist/blocks/empty-state.js +74 -140
  32. package/dist/blocks/input-list.cjs +2 -2
  33. package/dist/blocks/input-list.d.ts +2 -2
  34. package/dist/blocks/input-list.d.ts.map +1 -1
  35. package/dist/blocks/input-list.js +136 -176
  36. package/dist/blocks/progress-state.cjs +1 -1
  37. package/dist/blocks/progress-state.d.ts +2 -2
  38. package/dist/blocks/progress-state.js +223 -347
  39. package/dist/blocks/sidebar.cjs +1 -1
  40. package/dist/blocks/sidebar.d.ts +28 -6
  41. package/dist/blocks/sidebar.d.ts.map +1 -1
  42. package/dist/blocks/sidebar.js +763 -1086
  43. package/dist/brand-illustration-motif.cjs +1 -1
  44. package/dist/brand-illustration-motif.d.ts +1 -1
  45. package/dist/brand-illustration-motif.js +40 -61
  46. package/dist/breadcrumb.cjs +1 -1
  47. package/dist/breadcrumb.js +62 -102
  48. package/dist/button-group.cjs +1 -1
  49. package/dist/button-group.js +23 -31
  50. package/dist/button.cjs +1 -1
  51. package/dist/button.d.ts +4 -2
  52. package/dist/button.d.ts.map +1 -1
  53. package/dist/button.js +149 -189
  54. package/dist/calendar.cjs +1 -1
  55. package/dist/calendar.d.ts +87 -3
  56. package/dist/calendar.d.ts.map +1 -1
  57. package/dist/calendar.js +116 -173
  58. package/dist/callout.cjs +1 -1
  59. package/dist/callout.js +73 -96
  60. package/dist/card.cjs +1 -1
  61. package/dist/card.d.ts +92 -6
  62. package/dist/card.d.ts.map +1 -1
  63. package/dist/card.js +240 -234
  64. package/dist/carousel.cjs +1 -1
  65. package/dist/carousel.d.ts +3 -3
  66. package/dist/carousel.d.ts.map +1 -1
  67. package/dist/carousel.js +174 -268
  68. package/dist/centred-layout.cjs +1 -1
  69. package/dist/centred-layout.js +27 -48
  70. package/dist/chart-empty.cjs +1 -1
  71. package/dist/chart-empty.js +18 -27
  72. package/dist/chart.cjs +7 -7
  73. package/dist/chart.d.ts +253 -25
  74. package/dist/chart.d.ts.map +1 -1
  75. package/dist/chart.js +465 -511
  76. package/dist/checkbox.cjs +1 -1
  77. package/dist/checkbox.d.ts +1 -1
  78. package/dist/checkbox.d.ts.map +1 -1
  79. package/dist/checkbox.js +37 -69
  80. package/dist/chip.cjs +1 -1
  81. package/dist/chip.js +116 -173
  82. package/dist/collapsible.cjs +1 -1
  83. package/dist/collapsible.d.ts.map +1 -1
  84. package/dist/collapsible.js +35 -41
  85. package/dist/combobox.cjs +3 -3
  86. package/dist/combobox.d.ts +14 -4
  87. package/dist/combobox.d.ts.map +1 -1
  88. package/dist/combobox.js +440 -639
  89. package/dist/command.cjs +1 -1
  90. package/dist/command.d.ts.map +1 -1
  91. package/dist/command.js +273 -420
  92. package/dist/context-menu.cjs +1 -1
  93. package/dist/context-menu.d.ts +5 -5
  94. package/dist/context-menu.d.ts.map +1 -1
  95. package/dist/context-menu.js +121 -191
  96. package/dist/data-table.cjs +1 -1
  97. package/dist/data-table.d.ts +442 -144
  98. package/dist/data-table.d.ts.map +1 -1
  99. package/dist/data-table.js +708 -835
  100. package/dist/date-picker.cjs +1 -1
  101. package/dist/date-picker.d.ts +15 -4
  102. package/dist/date-picker.d.ts.map +1 -1
  103. package/dist/date-picker.js +156 -231
  104. package/dist/delta.cjs +1 -0
  105. package/dist/delta.d.ts +79 -0
  106. package/dist/delta.d.ts.map +1 -0
  107. package/dist/delta.js +62 -0
  108. package/dist/description.cjs +1 -1
  109. package/dist/description.js +11 -20
  110. package/dist/dialog.cjs +1 -1
  111. package/dist/dialog.d.ts +1 -1
  112. package/dist/dialog.d.ts.map +1 -1
  113. package/dist/dialog.js +76 -116
  114. package/dist/drawer.cjs +1 -1
  115. package/dist/drawer.d.ts +11 -11
  116. package/dist/drawer.d.ts.map +1 -1
  117. package/dist/drawer.js +76 -134
  118. package/dist/dropdown-menu.cjs +1 -1
  119. package/dist/dropdown-menu.d.ts +6 -6
  120. package/dist/dropdown-menu.d.ts.map +1 -1
  121. package/dist/dropdown-menu.js +179 -300
  122. package/dist/field.cjs +1 -1
  123. package/dist/field.d.ts +9 -9
  124. package/dist/field.d.ts.map +1 -1
  125. package/dist/field.js +166 -286
  126. package/dist/global-layout.cjs +1 -1
  127. package/dist/global-layout.js +203 -342
  128. package/dist/grid.cjs +1 -1
  129. package/dist/grid.d.ts +24 -1
  130. package/dist/grid.d.ts.map +1 -1
  131. package/dist/grid.js +16 -29
  132. package/dist/header.cjs +1 -1
  133. package/dist/header.js +21 -38
  134. package/dist/height-transition.cjs +1 -1
  135. package/dist/height-transition.js +38 -55
  136. package/dist/hooks/use-breakpoint.cjs +1 -1
  137. package/dist/hooks/use-breakpoint.d.ts +1 -1
  138. package/dist/hooks/use-breakpoint.d.ts.map +1 -1
  139. package/dist/hooks/use-breakpoint.js +10 -9
  140. package/dist/hooks/use-debounce.cjs +1 -1
  141. package/dist/hooks/use-debounce.js +12 -11
  142. package/dist/hooks/use-delayed-pending.cjs +1 -1
  143. package/dist/hooks/use-delayed-pending.js +8 -9
  144. package/dist/hooks/use-filter-search-params.cjs +1 -0
  145. package/dist/hooks/use-filter-search-params.d.ts +93 -0
  146. package/dist/hooks/use-filter-search-params.d.ts.map +1 -0
  147. package/dist/hooks/use-filter-search-params.js +122 -0
  148. package/dist/hooks/use-mobile.cjs +1 -1
  149. package/dist/hooks/use-mobile.js +6 -6
  150. package/dist/hooks/use-overlay-pointer-lock.cjs +1 -1
  151. package/dist/hooks/use-overlay-pointer-lock.js +8 -9
  152. package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
  153. package/dist/hooks/use-prefers-reduced-motion.js +5 -8
  154. package/dist/hover-card.cjs +1 -1
  155. package/dist/hover-card.d.ts +1 -1
  156. package/dist/hover-card.d.ts.map +1 -1
  157. package/dist/hover-card.js +30 -62
  158. package/dist/index.cjs +1 -1
  159. package/dist/index.d.ts +11 -0
  160. package/dist/index.d.ts.map +1 -1
  161. package/dist/index.js +636 -582
  162. package/dist/info-tooltip.cjs +1 -0
  163. package/dist/info-tooltip.d.ts +39 -0
  164. package/dist/info-tooltip.d.ts.map +1 -0
  165. package/dist/info-tooltip.js +27 -0
  166. package/dist/input-chip.cjs +1 -1
  167. package/dist/input-chip.d.ts +32 -3
  168. package/dist/input-chip.d.ts.map +1 -1
  169. package/dist/input-chip.js +182 -231
  170. package/dist/input-group.cjs +1 -1
  171. package/dist/input-group.d.ts +33 -2
  172. package/dist/input-group.d.ts.map +1 -1
  173. package/dist/input-group.js +188 -122
  174. package/dist/input-otp.cjs +1 -1
  175. package/dist/input-otp.d.ts +3 -3
  176. package/dist/input-otp.d.ts.map +1 -1
  177. package/dist/input-otp.js +102 -146
  178. package/dist/input-password.cjs +1 -1
  179. package/dist/input-password.d.ts +26 -8
  180. package/dist/input-password.d.ts.map +1 -1
  181. package/dist/input-password.js +139 -171
  182. package/dist/input.cjs +1 -1
  183. package/dist/input.d.ts.map +1 -1
  184. package/dist/input.js +51 -73
  185. package/dist/label.cjs +1 -1
  186. package/dist/label.js +20 -38
  187. package/dist/lib/block-illustration.cjs +1 -1
  188. package/dist/lib/block-illustration.d.ts +5 -2
  189. package/dist/lib/block-illustration.d.ts.map +1 -1
  190. package/dist/lib/block-illustration.js +16 -17
  191. package/dist/lib/compose-event-handlers.cjs +1 -0
  192. package/dist/lib/compose-event-handlers.d.ts +9 -0
  193. package/dist/lib/compose-event-handlers.d.ts.map +1 -0
  194. package/dist/lib/compose-event-handlers.js +8 -0
  195. package/dist/lib/download-file.cjs +1 -0
  196. package/dist/lib/download-file.d.ts +14 -0
  197. package/dist/lib/download-file.d.ts.map +1 -0
  198. package/dist/lib/download-file.js +40 -0
  199. package/dist/lib/empty-canvas.cjs +1 -1
  200. package/dist/lib/empty-canvas.js +28 -56
  201. package/dist/lib/empty-chip.cjs +1 -1
  202. package/dist/lib/empty-chip.d.ts +14 -3
  203. package/dist/lib/empty-chip.d.ts.map +1 -1
  204. package/dist/lib/empty-chip.js +15 -11
  205. package/dist/lib/field-aria.cjs +1 -0
  206. package/dist/lib/field-aria.d.ts +34 -0
  207. package/dist/lib/field-aria.d.ts.map +1 -0
  208. package/dist/lib/field-aria.js +52 -0
  209. package/dist/lib/image-file-info.cjs +1 -0
  210. package/dist/lib/image-file-info.d.ts +25 -0
  211. package/dist/lib/image-file-info.d.ts.map +1 -0
  212. package/dist/lib/image-file-info.js +67 -0
  213. package/dist/lib/media-viewer-content.cjs +1 -0
  214. package/dist/lib/media-viewer-content.d.ts +102 -0
  215. package/dist/lib/media-viewer-content.d.ts.map +1 -0
  216. package/dist/lib/media-viewer-content.js +650 -0
  217. package/dist/lib/media-viewer-internal.cjs +1 -0
  218. package/dist/lib/media-viewer-internal.d.ts +98 -0
  219. package/dist/lib/media-viewer-internal.d.ts.map +1 -0
  220. package/dist/lib/media-viewer-internal.js +61 -0
  221. package/dist/lib/media-viewer-motion.cjs +1 -0
  222. package/dist/lib/media-viewer-motion.d.ts +40 -0
  223. package/dist/lib/media-viewer-motion.d.ts.map +1 -0
  224. package/dist/lib/media-viewer-motion.js +37 -0
  225. package/dist/lib/motion.cjs +1 -1
  226. package/dist/lib/motion.d.ts +8 -0
  227. package/dist/lib/motion.d.ts.map +1 -1
  228. package/dist/lib/motion.js +11 -10
  229. package/dist/lib/optical-center.cjs +1 -1
  230. package/dist/lib/optical-center.d.ts +1 -1
  231. package/dist/lib/optical-center.d.ts.map +1 -1
  232. package/dist/lib/optical-center.js +12 -5
  233. package/dist/lib/spring-settle.cjs +1 -1
  234. package/dist/lib/spring-settle.js +1 -1
  235. package/dist/lib/table-internal.cjs +1 -0
  236. package/dist/lib/table-internal.d.ts +62 -0
  237. package/dist/lib/table-internal.d.ts.map +1 -0
  238. package/dist/lib/table-internal.js +18 -0
  239. package/dist/lib/use-controllable.cjs +1 -0
  240. package/dist/lib/use-controllable.d.ts +12 -0
  241. package/dist/lib/use-controllable.d.ts.map +1 -0
  242. package/dist/lib/use-controllable.js +15 -0
  243. package/dist/lib/use-dev-warning.cjs +1 -1
  244. package/dist/lib/utils.cjs +1 -1
  245. package/dist/lib/utils.d.ts.map +1 -1
  246. package/dist/lib/utils.js +29 -35
  247. package/dist/link.cjs +1 -1
  248. package/dist/link.d.ts +1 -1
  249. package/dist/link.js +78 -124
  250. package/dist/list.cjs +1 -1
  251. package/dist/list.d.ts +8 -0
  252. package/dist/list.d.ts.map +1 -1
  253. package/dist/list.js +94 -156
  254. package/dist/loading.cjs +1 -1
  255. package/dist/loading.js +124 -151
  256. package/dist/logo-mark.cjs +1 -0
  257. package/dist/logo-mark.d.ts +79 -0
  258. package/dist/logo-mark.d.ts.map +1 -0
  259. package/dist/logo-mark.js +219 -0
  260. package/dist/logo.cjs +1 -1
  261. package/dist/logo.d.ts +1 -1
  262. package/dist/logo.d.ts.map +1 -1
  263. package/dist/logo.js +51 -87
  264. package/dist/map.cjs +1 -1
  265. package/dist/map.d.ts.map +1 -1
  266. package/dist/map.js +390 -586
  267. package/dist/media-empty.cjs +1 -1
  268. package/dist/media-empty.js +27 -42
  269. package/dist/media-viewer.cjs +1 -0
  270. package/dist/media-viewer.d.ts +224 -0
  271. package/dist/media-viewer.d.ts.map +1 -0
  272. package/dist/media-viewer.js +295 -0
  273. package/dist/menubar.cjs +1 -1
  274. package/dist/menubar.d.ts +14 -14
  275. package/dist/menubar.d.ts.map +1 -1
  276. package/dist/menubar.js +130 -267
  277. package/dist/multi-select-filter.cjs +1 -0
  278. package/dist/multi-select-filter.d.ts +186 -0
  279. package/dist/multi-select-filter.d.ts.map +1 -0
  280. package/dist/multi-select-filter.js +374 -0
  281. package/dist/navigation-menu.cjs +1 -1
  282. package/dist/navigation-menu.js +108 -172
  283. package/dist/pagination.cjs +1 -1
  284. package/dist/pagination.d.ts +36 -12
  285. package/dist/pagination.d.ts.map +1 -1
  286. package/dist/pagination.js +208 -281
  287. package/dist/popover.cjs +1 -1
  288. package/dist/popover.d.ts +1 -1
  289. package/dist/popover.d.ts.map +1 -1
  290. package/dist/popover.js +34 -45
  291. package/dist/progress.cjs +1 -1
  292. package/dist/progress.d.ts +139 -17
  293. package/dist/progress.d.ts.map +1 -1
  294. package/dist/progress.js +116 -148
  295. package/dist/radio-group.cjs +1 -1
  296. package/dist/radio-group.js +90 -146
  297. package/dist/rating.cjs +1 -1
  298. package/dist/rating.d.ts +80 -13
  299. package/dist/rating.d.ts.map +1 -1
  300. package/dist/rating.js +70 -65
  301. package/dist/relative-date.cjs +1 -0
  302. package/dist/relative-date.d.ts +65 -0
  303. package/dist/relative-date.d.ts.map +1 -0
  304. package/dist/relative-date.js +112 -0
  305. package/dist/resizable.cjs +1 -1
  306. package/dist/resizable.d.ts +39 -23
  307. package/dist/resizable.d.ts.map +1 -1
  308. package/dist/resizable.js +42 -44
  309. package/dist/result-count.cjs +1 -0
  310. package/dist/result-count.d.ts +110 -0
  311. package/dist/result-count.d.ts.map +1 -0
  312. package/dist/result-count.js +49 -0
  313. package/dist/route-progress.cjs +1 -1
  314. package/dist/route-progress.js +58 -102
  315. package/dist/scroll-area.cjs +1 -1
  316. package/dist/scroll-area.d.ts +9 -1
  317. package/dist/scroll-area.d.ts.map +1 -1
  318. package/dist/scroll-area.js +44 -79
  319. package/dist/select.cjs +2 -2
  320. package/dist/select.d.ts +20 -10
  321. package/dist/select.d.ts.map +1 -1
  322. package/dist/select.js +132 -236
  323. package/dist/separator.cjs +1 -1
  324. package/dist/separator.js +90 -78
  325. package/dist/sheet.cjs +1 -1
  326. package/dist/sheet.d.ts +86 -7
  327. package/dist/sheet.d.ts.map +1 -1
  328. package/dist/sheet.js +275 -235
  329. package/dist/single-select-filter.cjs +1 -0
  330. package/dist/single-select-filter.d.ts +113 -0
  331. package/dist/single-select-filter.d.ts.map +1 -0
  332. package/dist/single-select-filter.js +224 -0
  333. package/dist/skeleton.cjs +1 -1
  334. package/dist/skeleton.js +24 -38
  335. package/dist/slider.cjs +1 -1
  336. package/dist/slider.js +51 -81
  337. package/dist/sonner.cjs +1 -1
  338. package/dist/sonner.d.ts +1 -1
  339. package/dist/sonner.d.ts.map +1 -1
  340. package/dist/sonner.js +113 -137
  341. package/dist/spinner.cjs +1 -1
  342. package/dist/spinner.js +22 -31
  343. package/dist/split-layout.cjs +1 -1
  344. package/dist/split-layout.d.ts +1 -1
  345. package/dist/split-layout.js +53 -102
  346. package/dist/status.cjs +1 -0
  347. package/dist/status.d.ts +51 -0
  348. package/dist/status.d.ts.map +1 -0
  349. package/dist/status.js +60 -0
  350. package/dist/stepper.cjs +1 -1
  351. package/dist/stepper.js +184 -316
  352. package/dist/switch.cjs +1 -1
  353. package/dist/switch.js +17 -32
  354. package/dist/table.cjs +1 -1
  355. package/dist/table.d.ts +127 -13
  356. package/dist/table.d.ts.map +1 -1
  357. package/dist/table.js +170 -192
  358. package/dist/tabs.cjs +1 -1
  359. package/dist/tabs.d.ts +12 -1
  360. package/dist/tabs.d.ts.map +1 -1
  361. package/dist/tabs.js +123 -146
  362. package/dist/text-reveal-motion.cjs +1 -1
  363. package/dist/text-reveal-motion.js +307 -363
  364. package/dist/textarea.cjs +1 -1
  365. package/dist/textarea.d.ts.map +1 -1
  366. package/dist/textarea.js +23 -36
  367. package/dist/toggle-group.cjs +1 -1
  368. package/dist/toggle-group.js +43 -62
  369. package/dist/toggle.cjs +1 -1
  370. package/dist/toggle.js +34 -46
  371. package/dist/tooltip.cjs +1 -1
  372. package/dist/tooltip.d.ts +38 -36
  373. package/dist/tooltip.d.ts.map +1 -1
  374. package/dist/tooltip.js +175 -78
  375. package/dist/typography-heading.cjs +1 -1
  376. package/dist/typography-heading.js +25 -61
  377. package/dist/typography-text.cjs +1 -1
  378. package/dist/typography-text.d.ts +1 -2
  379. package/dist/typography-text.d.ts.map +1 -1
  380. package/dist/typography-text.js +27 -57
  381. package/dist/typography.cjs +1 -1
  382. package/dist/typography.d.ts +1 -1
  383. package/dist/typography.js +132 -340
  384. package/package.json +45 -46
  385. package/src/blocks/empty-state.tsx +42 -21
  386. package/src/blocks/progress-state.tsx +2 -2
  387. package/src/blocks/sidebar.tsx +111 -32
  388. package/src/components/accordion.tsx +1 -1
  389. package/src/components/alert-dialog.tsx +52 -5
  390. package/src/components/alert.tsx +16 -8
  391. package/src/components/badge.tsx +152 -3
  392. package/src/components/banner.tsx +288 -0
  393. package/src/components/brand-illustration-motif.tsx +1 -1
  394. package/src/components/breadcrumb.tsx +1 -1
  395. package/src/components/button.tsx +8 -6
  396. package/src/components/calendar.tsx +155 -9
  397. package/src/components/card.tsx +266 -26
  398. package/src/components/carousel.tsx +4 -1
  399. package/src/components/chart.tsx +664 -42
  400. package/src/components/checkbox.tsx +2 -2
  401. package/src/components/collapsible.tsx +4 -1
  402. package/src/components/combobox.tsx +42 -9
  403. package/src/components/command.tsx +10 -11
  404. package/src/components/context-menu.tsx +4 -4
  405. package/src/components/data-table.tsx +1363 -398
  406. package/src/components/date-picker.tsx +31 -4
  407. package/src/components/delta.tsx +217 -0
  408. package/src/components/drawer.tsx +5 -5
  409. package/src/components/dropdown-menu.tsx +4 -4
  410. package/src/components/field.tsx +36 -15
  411. package/src/components/global-layout.tsx +1 -1
  412. package/src/components/grid.tsx +32 -1
  413. package/src/components/info-tooltip.tsx +94 -0
  414. package/src/components/input-chip.tsx +52 -8
  415. package/src/components/input-group.tsx +247 -12
  416. package/src/components/input-otp.tsx +1 -1
  417. package/src/components/input-password.tsx +29 -11
  418. package/src/components/input.tsx +11 -2
  419. package/src/components/list.tsx +15 -3
  420. package/src/components/logo-mark.tsx +345 -0
  421. package/src/components/map.tsx +18 -20
  422. package/src/components/media-viewer.tsx +908 -0
  423. package/src/components/multi-select-filter.tsx +1046 -0
  424. package/src/components/navigation-menu.tsx +2 -2
  425. package/src/components/pagination.tsx +86 -26
  426. package/src/components/progress.tsx +281 -54
  427. package/src/components/rating.tsx +200 -74
  428. package/src/components/relative-date.tsx +238 -0
  429. package/src/components/resizable.tsx +86 -33
  430. package/src/components/result-count.tsx +253 -0
  431. package/src/components/scroll-area.tsx +31 -5
  432. package/src/components/select.tsx +37 -7
  433. package/src/components/sheet.tsx +252 -6
  434. package/src/components/single-select-filter.tsx +538 -0
  435. package/src/components/slider.tsx +2 -2
  436. package/src/components/sonner.tsx +16 -5
  437. package/src/components/split-layout.tsx +2 -2
  438. package/src/components/status.tsx +162 -0
  439. package/src/components/switch.tsx +1 -1
  440. package/src/components/table.tsx +305 -73
  441. package/src/components/tabs.tsx +94 -46
  442. package/src/components/textarea.tsx +21 -3
  443. package/src/components/toggle.tsx +2 -2
  444. package/src/components/tooltip.tsx +431 -68
  445. package/src/components/typography-text.tsx +1 -2
  446. package/src/components/typography.tsx +1 -1
  447. package/src/hooks/use-breakpoint.ts +2 -1
  448. package/src/hooks/use-filter-search-params.ts +302 -0
  449. package/src/index.ts +11 -0
  450. package/src/lib/block-illustration.tsx +5 -1
  451. package/src/lib/compose-event-handlers.ts +14 -0
  452. package/src/lib/download-file.ts +61 -0
  453. package/src/lib/empty-chip.tsx +52 -0
  454. package/src/lib/field-aria.tsx +97 -0
  455. package/src/lib/image-file-info.ts +102 -0
  456. package/src/lib/media-viewer-content.tsx +1587 -0
  457. package/src/lib/media-viewer-internal.tsx +191 -0
  458. package/src/lib/media-viewer-motion.ts +120 -0
  459. package/src/lib/motion.ts +9 -0
  460. package/src/lib/table-internal.ts +74 -0
  461. package/src/lib/use-controllable.ts +43 -0
  462. package/src/lib/utils.ts +1 -0
  463. package/src/lib/empty-chip.ts +0 -24
@@ -103,6 +103,13 @@ export interface InputChipProps {
103
103
  defaultValue?: string[];
104
104
  /** Callback when value changes */
105
105
  onValueChange?: (value: string[]) => void;
106
+ /**
107
+ * Synchronous validation hook called before a typed value is added.
108
+ * Return `false` to reject the add — the typed text stays in the input
109
+ * so the user can correct it. Any other return (including `undefined`)
110
+ * lets the add proceed.
111
+ */
112
+ onBeforeAdd?: (item: string) => boolean | void;
106
113
  /** Disabled state */
107
114
  disabled?: boolean;
108
115
  /** Allow duplicate values (default: false) */
@@ -136,6 +143,7 @@ function InputChip({
136
143
  value: controlledValue,
137
144
  defaultValue = [],
138
145
  onValueChange: controlledOnValueChange,
146
+ onBeforeAdd,
139
147
  disabled = false,
140
148
  allowDuplicates = false,
141
149
  children,
@@ -152,10 +160,12 @@ function InputChip({
152
160
 
153
161
  const valueRef = React.useRef(value);
154
162
  const controlledOnValueChangeRef = React.useRef(controlledOnValueChange);
163
+ const onBeforeAddRef = React.useRef(onBeforeAdd);
155
164
  const disabledRef = React.useRef(disabled);
156
165
  React.useLayoutEffect(() => {
157
166
  valueRef.current = value;
158
167
  controlledOnValueChangeRef.current = controlledOnValueChange;
168
+ onBeforeAddRef.current = onBeforeAdd;
159
169
  disabledRef.current = disabled;
160
170
  });
161
171
 
@@ -165,6 +175,7 @@ function InputChip({
165
175
  chipRefs.current.length = value.length;
166
176
  }
167
177
  if (focusedChipIndex >= value.length) {
178
+ // eslint-disable-next-line react-hooks/set-state-in-effect -- reset stale focus index; refactor tracked in DS-1070
168
179
  setFocusedChipIndex(-1);
169
180
  }
170
181
  }, [value.length, focusedChipIndex]);
@@ -183,10 +194,11 @@ function InputChip({
183
194
  (item: string) => {
184
195
  if (disabledRef.current) return;
185
196
  const trimmed = item.trim();
186
- if (trimmed && (allowDuplicates || !valueRef.current.includes(trimmed))) {
187
- onValueChange([...valueRef.current, trimmed]);
188
- setInputValue("");
189
- }
197
+ if (!trimmed) return;
198
+ if (onBeforeAddRef.current?.(trimmed) === false) return;
199
+ if (!allowDuplicates && valueRef.current.includes(trimmed)) return;
200
+ onValueChange([...valueRef.current, trimmed]);
201
+ setInputValue("");
190
202
  },
191
203
  [allowDuplicates, onValueChange]
192
204
  );
@@ -276,7 +288,7 @@ const inputStyles = [
276
288
  "bg-transparent",
277
289
  "border-0 outline-none",
278
290
  // Typography
279
- "text-body",
291
+ "text-field",
280
292
  "text-foreground",
281
293
  // Placeholder
282
294
  "placeholder:text-muted-foreground",
@@ -325,13 +337,35 @@ export interface InputChipInputProps
325
337
  * ID of element that labels the input
326
338
  */
327
339
  "aria-labelledby"?: string;
340
+ /**
341
+ * ID(s) of elements that describe the input (hint text, error message).
342
+ * Passed to the inner text input for screen-reader announcement.
343
+ */
344
+ "aria-describedby"?: string;
345
+ /**
346
+ * Marks the input as invalid for assistive technology.
347
+ * Also derived from the `error` prop — either source triggers the
348
+ * invalid state on the inner text input.
349
+ */
350
+ "aria-invalid"?: boolean | "true" | "false";
351
+ /**
352
+ * Ref to the wrapper div (the bordered container).
353
+ * Use when you need to anchor a Popover or measure the container box.
354
+ * The primary `ref` now points to the inner text input for form
355
+ * integration (focus, ARIA).
356
+ */
357
+ wrapperRef?: React.Ref<HTMLDivElement>;
328
358
  }
329
359
 
330
360
  /**
331
361
  * Input container with bordered styling.
332
362
  * Place Chip components or InputChipItems inside as children.
363
+ *
364
+ * The forwarded `ref` points to the inner text input (for focus, ARIA
365
+ * wiring, and form integration). Use `wrapperRef` when you need the
366
+ * bordered container element (e.g. for Popover anchoring).
333
367
  */
334
- const InputChipInput = React.forwardRef<HTMLDivElement, InputChipInputProps>(
368
+ const InputChipInput = React.forwardRef<HTMLInputElement, InputChipInputProps>(
335
369
  (
336
370
  {
337
371
  className,
@@ -343,6 +377,9 @@ const InputChipInput = React.forwardRef<HTMLDivElement, InputChipInputProps>(
343
377
  inputId,
344
378
  "aria-label": ariaLabel,
345
379
  "aria-labelledby": ariaLabelledby,
380
+ "aria-describedby": ariaDescribedby,
381
+ "aria-invalid": ariaInvalid,
382
+ wrapperRef,
346
383
  children,
347
384
  ...props
348
385
  },
@@ -353,6 +390,11 @@ const InputChipInput = React.forwardRef<HTMLDivElement, InputChipInputProps>(
353
390
  const { value, disabled } = useInputChipValue();
354
391
  const { inputValue } = useInputChipInput();
355
392
 
393
+ // Expose the inner text input through the consumer's ref
394
+ React.useImperativeHandle(ref, () => inputRef.current!, [inputRef]);
395
+
396
+ const hasError = error || ariaInvalid === true || ariaInvalid === "true";
397
+
356
398
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
357
399
  setInputValue(e.target.value);
358
400
  };
@@ -382,8 +424,8 @@ const InputChipInput = React.forwardRef<HTMLDivElement, InputChipInputProps>(
382
424
 
383
425
  return (
384
426
  <div
385
- ref={ref}
386
- className={cn(inputChipInputVariants({ error }), className)}
427
+ ref={wrapperRef}
428
+ className={cn(inputChipInputVariants({ error: hasError }), className)}
387
429
  data-hook={dataHook}
388
430
  data-slot="input-chip"
389
431
  data-tracking-el={trackingEl}
@@ -393,6 +435,8 @@ const InputChipInput = React.forwardRef<HTMLDivElement, InputChipInputProps>(
393
435
  {children}
394
436
  <input
395
437
  ref={inputRef as React.RefObject<HTMLInputElement>}
438
+ aria-describedby={ariaDescribedby || undefined}
439
+ aria-invalid={hasError ? "true" : undefined}
396
440
  aria-label={ariaLabel}
397
441
  aria-labelledby={ariaLabelledby}
398
442
  className={cn(inputStyles)}
@@ -3,10 +3,38 @@
3
3
  import * as React from "react";
4
4
  import { Slot } from "@radix-ui/react-slot";
5
5
  import { cva, type VariantProps } from "class-variance-authority";
6
+ import { X } from "@brightlocal/icons";
6
7
 
7
8
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
9
  import { Input, type InputProps } from "./input";
9
10
 
11
+ interface InputGroupContextValue {
12
+ /** Snapshot of the composed input's DOM state, kept fresh by InputGroupInput. */
13
+ inputState: { hasValue: boolean; disabled: boolean };
14
+ /** Re-reads the composed input into `inputState`; cheap and safe to call often. */
15
+ syncInputState: () => void;
16
+ /**
17
+ * Registers the composed input element with the group. A callback rather
18
+ * than a ref write because context values are immutable to the compiler.
19
+ */
20
+ registerInput: (node: HTMLInputElement | null) => void;
21
+ /**
22
+ * Registers the input's clear routine (owned by InputGroupInput, which
23
+ * holds the consumer's `onChange`).
24
+ */
25
+ registerClearHandler: (
26
+ fn: ((event: React.SyntheticEvent) => void) | null
27
+ ) => void;
28
+ /** Clears the composed input through its React onChange and refocuses it. */
29
+ clearInput: (event: React.SyntheticEvent) => void;
30
+ /** The composed input element. */
31
+ inputRef: React.RefObject<HTMLInputElement | null>;
32
+ }
33
+
34
+ const InputGroupContext = React.createContext<InputGroupContextValue | null>(
35
+ null
36
+ );
37
+
10
38
  const inputGroupVariants = cva(
11
39
  "relative flex w-full items-center rounded-sm border border-input bg-background transition-[color,background-color,border-color,box-shadow] duration-fast ease-out has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-default has-[:disabled]:opacity-50",
12
40
  {
@@ -58,16 +86,70 @@ const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
58
86
  { className, size, error, dataHook, trackingEl, trackingLabel, ...props },
59
87
  ref
60
88
  ) => {
89
+ const [inputState, setInputState] = React.useState({
90
+ hasValue: false,
91
+ disabled: false,
92
+ });
93
+ const inputRef = React.useRef<HTMLInputElement | null>(null);
94
+ const syncInputState = React.useCallback(() => {
95
+ const input = inputRef.current;
96
+ // readOnly counts as disabled here: a field the user cannot edit must
97
+ // not offer a clear affordance either.
98
+ const next = {
99
+ hasValue: !!input && input.value.length > 0,
100
+ disabled: !!input && (input.disabled || input.readOnly),
101
+ };
102
+ setInputState((prev) =>
103
+ prev.hasValue === next.hasValue && prev.disabled === next.disabled
104
+ ? prev
105
+ : next
106
+ );
107
+ }, []);
108
+ const registerInput = React.useCallback((node: HTMLInputElement | null) => {
109
+ inputRef.current = node;
110
+ }, []);
111
+ const clearHandlerRef = React.useRef<
112
+ ((event: React.SyntheticEvent) => void) | null
113
+ >(null);
114
+ const registerClearHandler = React.useCallback(
115
+ (fn: ((event: React.SyntheticEvent) => void) | null) => {
116
+ clearHandlerRef.current = fn;
117
+ },
118
+ []
119
+ );
120
+ const clearInput = React.useCallback((event: React.SyntheticEvent) => {
121
+ clearHandlerRef.current?.(event);
122
+ }, []);
123
+ const contextValue = React.useMemo(
124
+ () => ({
125
+ inputState,
126
+ syncInputState,
127
+ registerInput,
128
+ registerClearHandler,
129
+ clearInput,
130
+ inputRef,
131
+ }),
132
+ [
133
+ inputState,
134
+ syncInputState,
135
+ registerInput,
136
+ registerClearHandler,
137
+ clearInput,
138
+ ]
139
+ );
140
+
61
141
  return (
62
- <div
63
- ref={ref}
64
- className={cn(inputGroupVariants({ size, error }), className)}
65
- data-hook={dataHook}
66
- data-slot="input-group"
67
- data-tracking-el={trackingEl}
68
- data-tracking-label={trackingLabel}
69
- {...props}
70
- />
142
+ <InputGroupContext.Provider value={contextValue}>
143
+ <div
144
+ ref={ref}
145
+ className={cn(inputGroupVariants({ size, error }), className)}
146
+ data-hook={dataHook}
147
+ data-slot="input-group"
148
+ data-tracking-el={trackingEl}
149
+ data-tracking-label={trackingLabel}
150
+ {...props}
151
+ />
152
+ </InputGroupContext.Provider>
71
153
  );
72
154
  }
73
155
  );
@@ -81,10 +163,73 @@ type InputGroupInputProps = Omit<
81
163
  const InputGroupInput = React.forwardRef<
82
164
  HTMLInputElement,
83
165
  InputGroupInputProps
84
- >(({ className, ...props }, ref) => {
166
+ >(({ className, onChange, ...props }, ref) => {
167
+ const context = React.useContext(InputGroupContext);
168
+ const localRef = React.useRef<HTMLInputElement | null>(null);
169
+
170
+ const registerInput = context?.registerInput;
171
+ const setRefs = React.useCallback(
172
+ (node: HTMLInputElement | null) => {
173
+ localRef.current = node;
174
+ registerInput?.(node);
175
+ if (typeof ref === "function") ref(node);
176
+ else if (ref) ref.current = node;
177
+ },
178
+ [registerInput, ref]
179
+ );
180
+
181
+ // Re-read the DOM after every render (no dep array): covers mount
182
+ // (defaultValue), controlled updates, disabled/readOnly toggles, and a
183
+ // controlled parent rejecting or transforming a change — React restores
184
+ // the DOM value on that render and this re-read follows it.
185
+ const syncInputState = context?.syncInputState;
186
+ React.useEffect(() => {
187
+ syncInputState?.();
188
+ });
189
+
190
+ // form.reset() restores defaultValue without firing input/change events;
191
+ // re-read once the reset steps have run.
192
+ React.useEffect(() => {
193
+ const form = localRef.current?.form;
194
+ if (!form || !syncInputState) return;
195
+ const handleReset = () => queueMicrotask(syncInputState);
196
+ form.addEventListener("reset", handleReset);
197
+ return () => form.removeEventListener("reset", handleReset);
198
+ }, [syncInputState]);
199
+
200
+ // The clear routine lives here because this component holds the consumer's
201
+ // onChange. Assigning through the element keeps React's value tracker in
202
+ // sync, and calling onChange directly with a retargeted event (instead of
203
+ // dispatching a DOM input event) keeps React's controlled-input restoration
204
+ // out of the picture — a dispatched event raced it and could resurrect the
205
+ // cleared value. Re-registered every render so the closure stays fresh.
206
+ const registerClearHandler = context?.registerClearHandler;
207
+ React.useEffect(() => {
208
+ registerClearHandler?.((event: React.SyntheticEvent) => {
209
+ const input = localRef.current;
210
+ if (!input) return;
211
+ input.value = "";
212
+ const changeEvent = Object.create(event, {
213
+ target: { value: input, enumerable: true },
214
+ currentTarget: { value: input, enumerable: true },
215
+ }) as React.ChangeEvent<HTMLInputElement>;
216
+ onChange?.(changeEvent);
217
+ syncInputState?.();
218
+ input.focus();
219
+ });
220
+ });
221
+ React.useEffect(() => {
222
+ return () => registerClearHandler?.(null);
223
+ }, [registerClearHandler]);
224
+
225
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
226
+ syncInputState?.();
227
+ onChange?.(event);
228
+ };
229
+
85
230
  return (
86
231
  <Input
87
- ref={ref}
232
+ ref={setRefs}
88
233
  className={cn(
89
234
  // Override border and focus styles since InputGroup handles them
90
235
  "border-0 focus-visible:border-0 focus-visible:shadow-[none]",
@@ -92,6 +237,7 @@ const InputGroupInput = React.forwardRef<
92
237
  className
93
238
  )}
94
239
  dataHook="input-group-input"
240
+ onChange={handleChange}
95
241
  {...props}
96
242
  />
97
243
  );
@@ -139,7 +285,7 @@ const inputGroupButtonVariants = cva(
139
285
  "inline-flex items-center justify-center gap-2",
140
286
  "text-label transition-colors duration-fast ease-out",
141
287
  "outline-none focus-visible:shadow-default rounded-sm",
142
- "disabled:pointer-events-none disabled:opacity-50",
288
+ "cursor-pointer disabled:pointer-events-none disabled:opacity-50",
143
289
  "text-muted-foreground hover:text-foreground",
144
290
  "[&_svg]:pointer-events-none [&_svg]:shrink-0",
145
291
  ],
@@ -195,11 +341,99 @@ const InputGroupButton = React.forwardRef<
195
341
  });
196
342
  InputGroupButton.displayName = "InputGroupButton";
197
343
 
344
+ interface InputGroupClearProps extends Omit<
345
+ React.ButtonHTMLAttributes<HTMLButtonElement>,
346
+ "onClick" | "children"
347
+ > {
348
+ /**
349
+ * Accessible label for the clear button.
350
+ * @default "Clear search"
351
+ */
352
+ clearSearchAriaLabel?: string;
353
+ /**
354
+ * Called after the input has been cleared.
355
+ */
356
+ onClear?: () => void;
357
+ /**
358
+ * Data hook for automated testing.
359
+ * @default "input-group-clear"
360
+ */
361
+ dataHook?: string;
362
+ /**
363
+ * Tracking element identifier for analytics
364
+ */
365
+ trackingEl?: string;
366
+ /**
367
+ * Tracking label for analytics context
368
+ */
369
+ trackingLabel?: string;
370
+ }
371
+
372
+ /**
373
+ * Opt-in clear button for InputGroup. Renders only while the composed
374
+ * `InputGroupInput` holds content and is editable (not disabled or
375
+ * read-only); clicking it clears the input (firing the input's `onChange`,
376
+ * so controlled and uncontrolled usage both work) and returns focus to it.
377
+ */
378
+ const InputGroupClear = React.forwardRef<
379
+ HTMLButtonElement,
380
+ InputGroupClearProps
381
+ >(
382
+ (
383
+ {
384
+ className,
385
+ clearSearchAriaLabel,
386
+ onClear,
387
+ dataHook,
388
+ trackingEl,
389
+ trackingLabel,
390
+ ...props
391
+ },
392
+ ref
393
+ ) => {
394
+ const context = React.useContext(InputGroupContext);
395
+ if (!context) {
396
+ throw new Error("InputGroupClear must be used within <InputGroup>");
397
+ }
398
+ const { inputState, clearInput } = context;
399
+ if (!inputState.hasValue || inputState.disabled) return null;
400
+
401
+ const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
402
+ // Delegates to InputGroupInput's registered routine: it clears the
403
+ // element, fires the consumer's onChange, and refocuses the input.
404
+ clearInput(event);
405
+ onClear?.();
406
+ };
407
+
408
+ return (
409
+ <InputGroupButton
410
+ ref={ref}
411
+ aria-label={clearSearchAriaLabel ?? "Clear search"}
412
+ // The button is the rendered root: alignment lives here so the
413
+ // consumer's className, ref, and data attributes reach the real element.
414
+ // Fully rounded to match Button's icon shape.
415
+ className={cn("mr-1 ml-auto shrink-0 rounded-full", className)}
416
+ data-hook={dataHook ?? "input-group-clear"}
417
+ data-slot="input-group-clear"
418
+ data-tracking-el={trackingEl}
419
+ data-tracking-label={trackingLabel}
420
+ size="icon-xs"
421
+ onClick={handleClick}
422
+ {...props}
423
+ >
424
+ <X size={14} />
425
+ </InputGroupButton>
426
+ );
427
+ }
428
+ );
429
+ InputGroupClear.displayName = "InputGroupClear";
430
+
198
431
  export {
199
432
  InputGroup,
200
433
  InputGroupInput,
201
434
  InputGroupAddon,
202
435
  InputGroupButton,
436
+ InputGroupClear,
203
437
  inputGroupVariants,
204
438
  inputGroupButtonVariants,
205
439
  };
@@ -208,4 +442,5 @@ export type {
208
442
  InputGroupInputProps,
209
443
  InputGroupAddonProps,
210
444
  InputGroupButtonProps,
445
+ InputGroupClearProps,
211
446
  };
@@ -137,7 +137,7 @@ function InputOTPSlot({ index, className, ...props }: InputOTPSlotProps) {
137
137
  // Base styles
138
138
  "relative flex h-9 w-9 items-center justify-center",
139
139
  "border-input bg-background border-y border-r",
140
- "text-foreground duration-fast text-body transition-[border-color,box-shadow] ease-out outline-none",
140
+ "text-foreground duration-fast text-field transition-[border-color,box-shadow] ease-out outline-none",
141
141
  "first:rounded-l-md first:border-l last:rounded-r-md",
142
142
  // Focus state
143
143
  "data-[active=true]:border-ring data-[active=true]:z-10",
@@ -26,23 +26,41 @@ type DefaultPasswordStrength = "meter" | "weak" | "ok" | "good" | "great";
26
26
  * Configuration for a single strength level
27
27
  */
28
28
  interface StrengthLevelConfig {
29
+ /** Text shown beside the bar for this level, e.g. `"Weak"` */
29
30
  label: string;
31
+ /** Bar fill as a percentage, 0–100 */
30
32
  value: number;
33
+ /**
34
+ * Background utility for the bar fill. Use the Progress bar palette
35
+ * (`bg-score-strong`, `bg-score-poor`, `bg-score-weak`, `bg-score-moderate`,
36
+ * `bg-muted`) so custom levels stay consistent with Progress (DS-773).
37
+ */
31
38
  color: string;
32
39
  }
33
40
 
34
41
  /**
35
42
  * Default strength levels configuration
43
+ *
44
+ * DESIGN DECISION (DS-293, kept in DS-666): every level shares one fill. The
45
+ * bar's length and the label ("Weak" … "Great") carry the strength, so colour
46
+ * is never the only indicator of state. Per-level red/amber/green would also
47
+ * have to come from the alert-surface tokens (`success-background` is green-200
48
+ * in light, green-950 in dark) — tints tuned as a backdrop, which read as a
49
+ * washed-out or near-black 8px bar.
50
+ *
51
+ * The fill is `score-strong` — the same fill the green Progress bar uses
52
+ * (the score scale, DS-774). The meter IS a Progress, so its green must match,
53
+ * and the track beneath is Progress's own `score-strong/20`.
36
54
  */
37
55
  const DEFAULT_STRENGTH_LEVELS: Record<
38
56
  DefaultPasswordStrength,
39
57
  StrengthLevelConfig
40
58
  > = {
41
- meter: { label: "Meter", value: 0, color: "bg-green-500" },
42
- weak: { label: "Weak", value: 25, color: "bg-green-500" },
43
- ok: { label: "Ok", value: 50, color: "bg-green-500" },
44
- good: { label: "Good", value: 75, color: "bg-green-500" },
45
- great: { label: "Great", value: 100, color: "bg-green-500" },
59
+ meter: { label: "Meter", value: 0, color: "bg-score-strong" },
60
+ weak: { label: "Weak", value: 25, color: "bg-score-strong" },
61
+ ok: { label: "Ok", value: 50, color: "bg-score-strong" },
62
+ good: { label: "Good", value: 75, color: "bg-score-strong" },
63
+ great: { label: "Great", value: 100, color: "bg-score-strong" },
46
64
  };
47
65
 
48
66
  /**
@@ -161,9 +179,9 @@ export interface InputPasswordProps<
161
179
  * @example
162
180
  * strengthLevels={{
163
181
  * empty: { label: "Enter password", value: 0, color: "bg-muted" },
164
- * slow: { label: "Slow", value: 33, color: "bg-red-500" },
165
- * medium: { label: "Medium", value: 66, color: "bg-yellow-500" },
166
- * fast: { label: "Fast", value: 100, color: "bg-green-500" },
182
+ * slow: { label: "Slow", value: 33, color: "bg-score-poor" },
183
+ * medium: { label: "Medium", value: 66, color: "bg-score-moderate" },
184
+ * fast: { label: "Fast", value: 100, color: "bg-score-strong" },
167
185
  * }}
168
186
  */
169
187
  strengthLevels?: Record<T, StrengthLevelConfig>;
@@ -205,9 +223,9 @@ export interface InputPasswordProps<
205
223
  * dataHook="password"
206
224
  * strengthLevels={{
207
225
  * empty: { label: "Enter password", value: 0, color: "bg-muted" },
208
- * slow: { label: "Slow", value: 33, color: "bg-red-500" },
209
- * medium: { label: "Medium", value: 66, color: "bg-yellow-500" },
210
- * fast: { label: "Fast", value: 100, color: "bg-green-500" },
226
+ * slow: { label: "Slow", value: 33, color: "bg-score-poor" },
227
+ * medium: { label: "Medium", value: 66, color: "bg-score-moderate" },
228
+ * fast: { label: "Fast", value: 100, color: "bg-score-strong" },
211
229
  * }}
212
230
  * calculateStrength={(password) => {
213
231
  * if (!password) return "empty";
@@ -3,6 +3,7 @@
3
3
  import * as React from "react";
4
4
  import { cva, type VariantProps } from "class-variance-authority";
5
5
  import { cn } from "@brightlocal/ui-components/lib/utils";
6
+ import { useFieldDescribedBy } from "../lib/field-aria";
6
7
 
7
8
  /**
8
9
  * Shared input variant styles
@@ -16,7 +17,7 @@ export const inputVariants = cva(
16
17
  "border border-input bg-background rounded-sm",
17
18
  "outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
18
19
  // Typography
19
- "text-body",
20
+ "text-field",
20
21
  "text-foreground",
21
22
  "overflow-hidden text-ellipsis",
22
23
  // States - Focus
@@ -101,6 +102,7 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
101
102
  error,
102
103
  trackingEl,
103
104
  trackingLabel,
105
+ "aria-describedby": ariaDescribedBy,
104
106
  ...props
105
107
  },
106
108
  ref
@@ -111,14 +113,21 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
111
113
  props["aria-invalid"] === true ||
112
114
  props["aria-invalid"] === "true";
113
115
 
116
+ // Inside a Field, point aria-describedby at the FieldError and
117
+ // FieldDescription automatically; a hand-wired value is kept and merged.
118
+ const describedBy = useFieldDescribedBy(ariaDescribedBy);
119
+
114
120
  return (
115
121
  <input
116
122
  ref={ref}
123
+ aria-describedby={describedBy}
117
124
  aria-invalid={hasError ? "true" : undefined}
118
125
  className={cn(
119
126
  inputVariants({ hasIcon, hasSecondaryIcon }),
127
+ // scroll-mb-16 reserves room for a two-line error message under the
128
+ // field, so a phone keyboard scrolls the message into view with it
120
129
  hasError &&
121
- "border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",
130
+ "border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive scroll-mb-16",
122
131
  className
123
132
  )}
124
133
  data-hook={dataHook}
@@ -12,7 +12,6 @@ import { Skeleton } from "@brightlocal/ui-components/skeleton";
12
12
  const itemVariants = cva(
13
13
  [
14
14
  "flex",
15
- "items-center",
16
15
  "gap-4",
17
16
  "rounded-lg",
18
17
  "py-2",
@@ -26,13 +25,18 @@ const itemVariants = cva(
26
25
  variants: {
27
26
  variant: {
28
27
  default: [],
29
- filled: ["bg-card"],
28
+ filled: ["bg-muted"],
30
29
  outline: ["bg-background", "border", "border-border"],
31
30
  loading: ["p-0"],
32
31
  },
32
+ align: {
33
+ center: ["items-center"],
34
+ start: ["items-start"],
35
+ },
33
36
  },
34
37
  defaultVariants: {
35
38
  variant: "filled",
39
+ align: "center",
36
40
  },
37
41
  }
38
42
  );
@@ -115,6 +119,13 @@ export type ItemProps = React.ComponentProps<"li"> & {
115
119
  * @default "filled"
116
120
  */
117
121
  variant?: "default" | "filled" | "outline" | "loading";
122
+ /**
123
+ * Cross-axis alignment of the row's children (media, content, actions).
124
+ * Use `"start"` when ItemMedia (icon, avatar, step number) should pin to the
125
+ * first line of multi-line content instead of centering vertically.
126
+ * @default "center"
127
+ */
128
+ align?: "center" | "start";
118
129
  /**
119
130
  * Data hook for automated testing.
120
131
  */
@@ -139,6 +150,7 @@ const Item = React.forwardRef<HTMLLIElement, ItemProps>(
139
150
  asChild = false,
140
151
  className,
141
152
  variant,
153
+ align,
142
154
  dataHook,
143
155
  trackingEl,
144
156
  trackingLabel,
@@ -152,7 +164,7 @@ const Item = React.forwardRef<HTMLLIElement, ItemProps>(
152
164
  return (
153
165
  <Comp
154
166
  ref={ref}
155
- className={cn(itemVariants({ variant }), className)}
167
+ className={cn(itemVariants({ variant, align }), className)}
156
168
  data-hook={dataHook}
157
169
  data-slot="item"
158
170
  data-tracking-el={trackingEl}