@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
@@ -1,9 +1,17 @@
1
+ "use client";
2
+
1
3
  import * as React from "react";
2
4
  import { Slot } from "@radix-ui/react-slot";
3
5
  import { cva, type VariantProps } from "class-variance-authority";
4
6
 
5
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
6
8
  import { useDevWarning } from "@brightlocal/ui-components/lib/use-dev-warning";
9
+ import {
10
+ Tooltip,
11
+ TooltipContent,
12
+ TooltipProvider,
13
+ TooltipTrigger,
14
+ } from "@brightlocal/ui-components/tooltip";
7
15
 
8
16
  const badgeVariants = cva(
9
17
  [
@@ -17,11 +25,11 @@ const badgeVariants = cva(
17
25
  // Typography — type-scale role for badges (12/16 Figma 500; the weight
18
26
  // drop from the old semibold is intentional, DS-925)
19
27
  "text-label-sm whitespace-nowrap",
20
- // Icons — direct children, plus the one `srLabel` wrapper (display:
21
- // contents) so an icon inside it keeps its size without resizing any
22
- // other nested SVG
28
+ // Icons — direct children, the `srLabel` wrapper (display: contents),
29
+ // and the truncation label span
23
30
  "[&>svg]:size-3 [&>svg]:pointer-events-none",
24
31
  "[&>.contents>svg]:size-3 [&>.contents>svg]:pointer-events-none",
32
+ "[&>[data-slot=badge-label]>svg]:size-3 [&>[data-slot=badge-label]>svg]:pointer-events-none",
25
33
  // Transition
26
34
  "transition-[color,background-color,border-color,box-shadow] duration-fast ease-out",
27
35
  // Focus
@@ -30,6 +38,8 @@ const badgeVariants = cva(
30
38
  "dark:focus-visible:shadow-[0_0_0_1px_var(--background),0_0_0_2px_var(--color-ring),0_0_0_4px_rgba(255,255,255,0.1)]",
31
39
  // Number badge (single digit)
32
40
  "data-[number=true]:size-5 data-[number=true]:p-0 data-[number=true]:aspect-square",
41
+ // Icon-only mark (a round 20px disc holding one icon)
42
+ "data-[icon-only=true]:size-5 data-[icon-only=true]:p-0 data-[icon-only=true]:aspect-square",
33
43
  ],
34
44
  {
35
45
  variants: {
@@ -42,6 +52,9 @@ const badgeVariants = cva(
42
52
  "border-transparent bg-destructive text-destructive-foreground",
43
53
  outline:
44
54
  "bg-background border-border text-foreground focus-visible:border-ring",
55
+ // Gold: a top or exceptional outcome (DS-1202) — not a warning
56
+ "highlight-gold":
57
+ "border-transparent bg-highlight-gold text-highlight-gold-foreground",
45
58
  },
46
59
  },
47
60
  defaultVariants: {
@@ -80,6 +93,28 @@ interface BadgeProps
80
93
  * @example srLabel="3 active"
81
94
  */
82
95
  srLabel?: string;
96
+ /**
97
+ * Round icon-only mark: a 20px disc holding a single icon. The icon is
98
+ * decorative, so `srLabel` is the accessible name and is required in
99
+ * practice (a dev warning fires without it). Ignored with `asChild`.
100
+ * @default false
101
+ * @example <Badge iconOnly variant="highlight-gold" srLabel="In the knowledge panel"><Crown /></Badge>
102
+ */
103
+ iconOnly?: boolean;
104
+ /**
105
+ * Truncate long text with an ellipsis. When the visible text overflows,
106
+ * a tooltip shows the full content on hover / tap — the same pattern
107
+ * Chip uses. The parent layout must constrain the badge's width for
108
+ * truncation to take effect (e.g. a flex parent, or an explicit
109
+ * `maxWidth`). Ignored with `asChild`.
110
+ * @default false
111
+ */
112
+ truncate?: boolean;
113
+ /**
114
+ * Maximum width of the badge label before truncation (in pixels).
115
+ * Only applies when `truncate` is true.
116
+ */
117
+ maxWidth?: number;
83
118
  }
84
119
 
85
120
  /**
@@ -96,6 +131,9 @@ const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
96
131
  trackingEl,
97
132
  trackingLabel,
98
133
  srLabel,
134
+ iconOnly = false,
135
+ truncate = false,
136
+ maxWidth,
99
137
  children,
100
138
  ...props
101
139
  },
@@ -103,6 +141,7 @@ const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
103
141
  ) => {
104
142
  const Comp = asChild ? Slot : "span";
105
143
  const srLabelApplies = srLabel !== undefined && !asChild;
144
+ const truncateApplies = truncate && !asChild;
106
145
 
107
146
  useDevWarning(
108
147
  () => asChild && srLabel !== undefined,
@@ -111,37 +150,110 @@ const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
111
150
  [asChild, srLabel]
112
151
  );
113
152
 
153
+ useDevWarning(
154
+ () => iconOnly && !asChild && srLabel === undefined,
155
+ "Badge iconOnly has no srLabel. An icon-only mark has no text, so pass srLabel as its accessible name.",
156
+ [iconOnly, asChild, srLabel]
157
+ );
158
+
159
+ useDevWarning(
160
+ () => asChild && truncate,
161
+ "truncate is set on a <Badge asChild>. Slot renders the child element as-is, " +
162
+ "so truncation cannot be applied — add truncation to the child instead.",
163
+ [asChild, truncate]
164
+ );
165
+
166
+ const labelRef = React.useRef<HTMLSpanElement>(null);
167
+ const [isTruncated, setIsTruncated] = React.useState(false);
168
+
169
+ React.useEffect(() => {
170
+ if (!truncateApplies) return;
171
+
172
+ const checkTruncation = () => {
173
+ if (labelRef.current) {
174
+ setIsTruncated(
175
+ labelRef.current.scrollWidth > labelRef.current.clientWidth
176
+ );
177
+ }
178
+ };
179
+
180
+ checkTruncation();
181
+ window.addEventListener("resize", checkTruncation);
182
+ return () => window.removeEventListener("resize", checkTruncation);
183
+ }, [truncateApplies, children]);
184
+
114
185
  // Check if children is a single digit number (0-9)
115
186
  const isNumberBadge =
116
187
  typeof children === "string" && /^[0-9]$/.test(children);
117
188
 
189
+ // Build inner content — three modes: truncate, srLabel, or passthrough
190
+ let innerContent: React.ReactNode;
191
+
192
+ if (truncateApplies) {
193
+ const labelSpan = (
194
+ <span
195
+ ref={labelRef}
196
+ aria-hidden={srLabelApplies || undefined}
197
+ className="truncate"
198
+ data-slot="badge-label"
199
+ style={maxWidth ? { maxWidth } : undefined}
200
+ >
201
+ {children}
202
+ </span>
203
+ );
204
+
205
+ const wrappedLabel = isTruncated ? (
206
+ <TooltipProvider>
207
+ <Tooltip>
208
+ <TooltipTrigger asChild>{labelSpan}</TooltipTrigger>
209
+ <TooltipContent dataHook={`${dataHook}-tooltip`} sideOffset={8}>
210
+ {children}
211
+ </TooltipContent>
212
+ </Tooltip>
213
+ </TooltipProvider>
214
+ ) : (
215
+ labelSpan
216
+ );
217
+
218
+ innerContent = srLabelApplies ? (
219
+ <>
220
+ {wrappedLabel}
221
+ <span className="sr-only">{srLabel}</span>
222
+ </>
223
+ ) : (
224
+ wrappedLabel
225
+ );
226
+ } else if (srLabelApplies) {
227
+ innerContent = (
228
+ <>
229
+ <span aria-hidden="true" className="contents">
230
+ {children}
231
+ </span>
232
+ <span className="sr-only">{srLabel}</span>
233
+ </>
234
+ );
235
+ } else {
236
+ innerContent = children;
237
+ }
238
+
118
239
  return (
119
240
  <Comp
120
241
  ref={ref}
121
242
  className={cn(
122
243
  badgeVariants({ variant }),
123
- /* sr-only is absolutely positioned: the badge is its positioning
124
- context so the phrase never escapes a scroll viewport. */
244
+ truncateApplies && "max-w-full min-w-0 shrink",
125
245
  srLabelApplies && "relative",
126
246
  className
127
247
  )}
128
248
  data-hook={dataHook}
249
+ data-icon-only={iconOnly || undefined}
129
250
  data-number={isNumberBadge}
130
251
  data-slot="badge"
131
252
  data-tracking-el={trackingEl}
132
253
  data-tracking-label={trackingLabel}
133
254
  {...props}
134
255
  >
135
- {srLabelApplies ? (
136
- <>
137
- <span aria-hidden="true" className="contents">
138
- {children}
139
- </span>
140
- <span className="sr-only">{srLabel}</span>
141
- </>
142
- ) : (
143
- children
144
- )}
256
+ {innerContent}
145
257
  </Comp>
146
258
  );
147
259
  }
@@ -112,7 +112,7 @@ const BreadcrumbLink = React.forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(
112
112
  <Comp
113
113
  ref={ref}
114
114
  className={cn(
115
- "hover:text-foreground focus-visible:shadow-default duration-fast rounded-sm transition-colors ease-out outline-none",
115
+ "hover:text-foreground focus-visible:shadow-default duration-fast cursor-pointer rounded-sm transition-colors ease-out outline-none",
116
116
  className
117
117
  )}
118
118
  data-slot="breadcrumb-link"
@@ -19,6 +19,7 @@ type ButtonVariantProps = {
19
19
  | "outline"
20
20
  | "secondary"
21
21
  | "ghost"
22
+ /** @deprecated Use `secondary` for moderate-risk actions or `destructive` for deletions. Will be removed in the next major version. */
22
23
  | "warning";
23
24
  /**
24
25
  * Size variant of the button
@@ -72,12 +73,6 @@ const ButtonVariants = cva(
72
73
  "hover:bg-secondary/80",
73
74
  "focus-visible:shadow-default",
74
75
  ],
75
- warning: [
76
- "bg-warning-background",
77
- "hover:bg-warning-background/80",
78
- "text-warning-foreground",
79
- "focus-visible:shadow-default",
80
- ],
81
76
  destructive: [
82
77
  "bg-destructive",
83
78
  "dark:bg-red-400/90",
@@ -101,6 +96,13 @@ const ButtonVariants = cva(
101
96
  "focus-visible:shadow-default",
102
97
  "focus-visible:border-ring",
103
98
  ],
99
+ /** @deprecated Use `secondary` or `destructive` instead. */
100
+ warning: [
101
+ "bg-warning-background",
102
+ "hover:bg-warning-background/80",
103
+ "text-warning-foreground",
104
+ "focus-visible:shadow-default",
105
+ ],
104
106
  ghost: [
105
107
  "bg-transparent",
106
108
  "text-foreground",
@@ -3,12 +3,14 @@
3
3
  import * as React from "react";
4
4
  import { ChevronDown, ChevronLeft, ChevronRight } from "@brightlocal/icons";
5
5
  import {
6
+ DateLib,
6
7
  DayButton,
7
8
  DayPicker,
8
9
  getDefaultClassNames,
9
10
  type DayPickerProps,
10
11
  } from "react-day-picker";
11
12
 
13
+ import { Button } from "@brightlocal/ui-components/button";
12
14
  import { cn } from "@brightlocal/ui-components/lib/utils";
13
15
 
14
16
  /**
@@ -20,6 +22,14 @@ export type CalendarProps = DayPickerProps & {
20
22
  * @default 1
21
23
  */
22
24
  numberOfMonths?: 1 | 2 | 3;
25
+ /**
26
+ * Stretch the calendar to fill its container instead of sizing to fit:
27
+ * the month, weekday headings and day cells share the width, and day
28
+ * buttons are at least 36px tall so they stay easy to tap. Use it in
29
+ * drawers, sheets and other narrow containers.
30
+ * @default false
31
+ */
32
+ fullWidth?: boolean;
23
33
  /**
24
34
  * Data hook for testing and analytics
25
35
  */
@@ -35,7 +45,7 @@ export type CalendarProps = DayPickerProps & {
35
45
  };
36
46
 
37
47
  const navButtonStyles = cn(
38
- "inline-flex items-center justify-center rounded-md",
48
+ "inline-flex cursor-pointer items-center justify-center rounded-md",
39
49
  "text-muted-foreground hover:text-foreground",
40
50
  "hover:bg-accent hover:text-accent-foreground",
41
51
  "focus-visible:outline-none focus-visible:shadow-default",
@@ -63,7 +73,9 @@ const CalendarDayButton = ({
63
73
  <button
64
74
  ref={ref}
65
75
  className={cn(
66
- "text-foreground text-label h-8 w-8 rounded-md p-0",
76
+ "text-foreground text-label h-8 w-8 cursor-pointer rounded-md p-0",
77
+ "group-data-[full-width=true]/calendar:h-9 group-data-[full-width=true]/calendar:w-full",
78
+ "disabled:cursor-not-allowed disabled:line-through",
67
79
  "hover:bg-accent hover:text-accent-foreground",
68
80
  "focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:outline-none",
69
81
  "group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10",
@@ -104,11 +116,13 @@ function Calendar({
104
116
  numberOfMonths = 1,
105
117
  captionLayout,
106
118
  fixedWeeks = true,
119
+ fullWidth = false,
107
120
  dataHook,
108
121
  trackingEl,
109
122
  trackingLabel,
110
123
  components,
111
124
  formatters,
125
+ labels,
112
126
  ...props
113
127
  }: CalendarProps) {
114
128
  const defaultClassNames = getDefaultClassNames();
@@ -117,12 +131,21 @@ function Calendar({
117
131
  <DayPicker
118
132
  captionLayout={captionLayout}
119
133
  className={cn(
120
- "bg-background border-border group/calendar relative w-fit rounded-lg border p-3 shadow-sm",
134
+ "bg-background border-border group/calendar relative rounded-lg border p-3 shadow-sm",
135
+ fullWidth ? "w-full" : "w-fit",
121
136
  className
122
137
  )}
123
138
  classNames={{
124
- months: cn("flex flex-col sm:flex-row gap-4", defaultClassNames.months),
125
- month: cn("flex flex-col gap-4", defaultClassNames.month),
139
+ months: cn(
140
+ "flex flex-col sm:flex-row gap-4",
141
+ fullWidth && "w-full",
142
+ defaultClassNames.months
143
+ ),
144
+ month: cn(
145
+ "flex flex-col gap-4",
146
+ fullWidth && "w-full flex-1",
147
+ defaultClassNames.month
148
+ ),
126
149
  month_caption: cn(
127
150
  "flex justify-center relative items-center w-full h-8",
128
151
  defaultClassNames.month_caption
@@ -158,13 +181,15 @@ function Calendar({
158
181
  "w-full border-collapse flex flex-col",
159
182
  defaultClassNames.month_grid
160
183
  ),
161
- weekdays: cn("flex", defaultClassNames.weekdays),
184
+ weekdays: cn("flex", fullWidth && "w-full", defaultClassNames.weekdays),
162
185
  weekday: cn(
163
- "text-muted-foreground rounded-md w-8 h-5 flex items-center justify-center text-body-xs",
186
+ "text-muted-foreground rounded-md h-5 flex items-center justify-center text-body-xs",
187
+ fullWidth ? "flex-1" : "w-8",
164
188
  defaultClassNames.weekday
165
189
  ),
166
190
  week: cn(defaultClassNames.week, "flex w-full mt-2"),
167
191
  day: cn(
192
+ fullWidth && "flex-1",
168
193
  "relative w-full h-full p-0 text-center text-label focus-within:relative focus-within:z-20 group/day select-none",
169
194
  "[&:first-child[data-selected=true]_button]:!rounded-l-md",
170
195
  "[&:last-child[data-selected=true]_button]:!rounded-r-md",
@@ -194,7 +219,7 @@ function Calendar({
194
219
  defaultClassNames.outside
195
220
  ),
196
221
  disabled: cn(
197
- "text-foreground opacity-50 cursor-not-allowed",
222
+ "text-foreground opacity-40 cursor-not-allowed",
198
223
  defaultClassNames.disabled
199
224
  ),
200
225
  hidden: cn(defaultClassNames.hidden),
@@ -217,6 +242,7 @@ function Calendar({
217
242
  DayButton: CalendarDayButton,
218
243
  ...components,
219
244
  }}
245
+ data-full-width={fullWidth}
220
246
  data-hook={dataHook}
221
247
  data-slot="calendar"
222
248
  data-tracking-el={trackingEl}
@@ -227,6 +253,19 @@ function Calendar({
227
253
  date.toLocaleString("default", { month: "short" }),
228
254
  ...formatters,
229
255
  }}
256
+ labels={{
257
+ // Lead with the visible day number so the accessible name contains the
258
+ // button text (WCAG 2.5.3 Label in Name); the default label spells the
259
+ // day out as "31st" and fails axe's label-content-name-mismatch.
260
+ labelDayButton: (date, modifiers, options, dateLib) => {
261
+ const lib = dateLib ?? new DateLib(options);
262
+ let label = `${lib.format(date, "d")}, ${lib.format(date, "EEEE, LLLL yyyy")}`;
263
+ if (modifiers.today) label = `Today, ${label}`;
264
+ if (modifiers.selected) label = `${label}, selected`;
265
+ return label;
266
+ },
267
+ ...labels,
268
+ }}
230
269
  numberOfMonths={numberOfMonths}
231
270
  showOutsideDays={showOutsideDays}
232
271
  {...props}
@@ -236,4 +275,111 @@ function Calendar({
236
275
 
237
276
  Calendar.displayName = "Calendar";
238
277
 
239
- export { Calendar, CalendarDayButton };
278
+ /**
279
+ * A quick pick shown under the calendar.
280
+ */
281
+ export type CalendarPreset = {
282
+ /** Visible label, e.g. "Tomorrow" */
283
+ label: string;
284
+ /** The date the preset selects, or a function returning it (resolved on click) */
285
+ date: Date | (() => Date);
286
+ };
287
+
288
+ export type CalendarPresetsProps = Omit<
289
+ React.ComponentPropsWithoutRef<"div">,
290
+ "onSelect"
291
+ > & {
292
+ /**
293
+ * Quick picks to render. The row wraps onto more lines; it never widens the calendar.
294
+ */
295
+ presets: CalendarPreset[];
296
+ /**
297
+ * Called with the preset's date when a preset is clicked
298
+ */
299
+ onSelect: (date: Date) => void;
300
+ /**
301
+ * Currently selected date. The matching preset is marked as pressed.
302
+ */
303
+ selected?: Date;
304
+ /**
305
+ * Accessible name of the presets group
306
+ * @default "Quick picks"
307
+ */
308
+ groupLabel?: string;
309
+ /**
310
+ * Data hook for testing and analytics
311
+ */
312
+ dataHook: string;
313
+ /**
314
+ * Tracking element identifier
315
+ */
316
+ trackingEl?: string;
317
+ /**
318
+ * Tracking label for analytics
319
+ */
320
+ trackingLabel?: string;
321
+ };
322
+
323
+ const resolvePresetDate = (preset: CalendarPreset) =>
324
+ typeof preset.date === "function" ? preset.date() : preset.date;
325
+
326
+ /**
327
+ * Quick picks under the calendar. Pass it to `Calendar` as `footer` — it sits inside
328
+ * the calendar's own frame and owns the rule and spacing. The row takes the calendar's
329
+ * width and wraps, so it never widens the calendar or a popover around it.
330
+ */
331
+ const CalendarPresets = React.forwardRef<HTMLDivElement, CalendarPresetsProps>(
332
+ (
333
+ {
334
+ presets,
335
+ onSelect,
336
+ selected,
337
+ groupLabel,
338
+ dataHook,
339
+ trackingEl,
340
+ trackingLabel,
341
+ className,
342
+ ...props
343
+ },
344
+ ref
345
+ ) => (
346
+ <div
347
+ ref={ref}
348
+ aria-label={groupLabel ?? "Quick picks"}
349
+ className={cn(
350
+ // w-0 + min-w-full: the row follows the calendar's width instead of adding to it
351
+ "border-border mt-3 flex w-0 min-w-full flex-wrap gap-2 border-t pt-3",
352
+ className
353
+ )}
354
+ data-hook={dataHook}
355
+ data-slot="calendar-presets"
356
+ data-tracking-el={trackingEl}
357
+ data-tracking-label={trackingLabel}
358
+ role="group"
359
+ {...props}
360
+ >
361
+ {presets.map((preset) => {
362
+ const date = resolvePresetDate(preset);
363
+ const isSelected =
364
+ selected !== undefined &&
365
+ date.toDateString() === selected.toDateString();
366
+ return (
367
+ <Button
368
+ key={preset.label}
369
+ aria-pressed={isSelected}
370
+ dataHook={`${dataHook}-${preset.label.toLowerCase().replace(/\s+/g, "-")}`}
371
+ size="sm"
372
+ variant="outline"
373
+ onClick={() => onSelect(resolvePresetDate(preset))}
374
+ >
375
+ {preset.label}
376
+ </Button>
377
+ );
378
+ })}
379
+ </div>
380
+ )
381
+ );
382
+
383
+ CalendarPresets.displayName = "CalendarPresets";
384
+
385
+ export { Calendar, CalendarDayButton, CalendarPresets };
@@ -36,6 +36,18 @@ const stickySurface: Record<CardVariant, string> = {
36
36
  "transparent-flush": "bg-background",
37
37
  };
38
38
 
39
+ /**
40
+ * The card's horizontal gutter, published as `--content-inset` for
41
+ * edge-to-edge content (a `Table`/`DataTable` with `frame="container"` inside
42
+ * `CardContent flush`) to align its first/last columns with the title
43
+ * (DS-1103). Mirrors `subPadding`.
44
+ */
45
+ const CONTENT_INSET: Record<CardDensity, string> = {
46
+ default: "[--content-inset:var(--ds-section-padding-x-md)]",
47
+ condensed: "[--content-inset:0.75rem]",
48
+ data: "[--content-inset:var(--ds-content-padding)]",
49
+ };
50
+
39
51
  function subPadding(flush: boolean, density: CardDensity): string | false {
40
52
  if (flush) return false;
41
53
  if (density === "condensed") return "px-3";
@@ -171,7 +183,11 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>(
171
183
  <CardContext.Provider value={{ flush, density, variant }}>
172
184
  <div
173
185
  ref={ref}
174
- className={cn(cardVariants({ variant, density }), className)}
186
+ className={cn(
187
+ cardVariants({ variant, density }),
188
+ CONTENT_INSET[density],
189
+ className
190
+ )}
175
191
  data-density={density}
176
192
  data-hook={dataHook}
177
193
  data-slot="card"
@@ -250,15 +266,52 @@ type CardHeaderProps = CardSubComponentProps & {
250
266
  divider?: boolean;
251
267
  /**
252
268
  * Keeps the header pinned while the card scrolls past (DS-989) — for tall
253
- * report cards whose table scrolls under the title and filters. Sticks
254
- * 16px from the top on mobile and 24px from xl up (the section spacing
255
- * token), stays within the card, and paints the card's surface so rows
256
- * never show through. Pair with `divider` so the stuck header keeps its edge.
269
+ * report cards whose table scrolls under the title and filters. Sticks at
270
+ * the top edge of the nearest scroll container (the page, a Sheet, a
271
+ * Dialog or any scrollable box), so nothing scrolls through a gap above
272
+ * it. Stays within the card and paints the card's surface so rows never
273
+ * show through. Pair with `divider` so the stuck header keeps its edge (DS-1211).
274
+ *
275
+ * A sticky header also publishes its rendered height on the card as
276
+ * `--content-sticky-top`, re-measured whenever it changes (a filter row
277
+ * that wraps), so content can stick directly beneath it — a `DataTable`
278
+ * with `stickyHeader="page"` pins its column headings there (DS-1215).
257
279
  * @default false
258
280
  */
259
281
  sticky?: boolean;
260
282
  };
261
283
 
284
+ /**
285
+ * Publishes a sticky header's rendered height on its card as
286
+ * `--content-sticky-top` (DS-1215), so sticky content inside the card — a
287
+ * `DataTable` with `stickyHeader="page"` — sticks directly beneath it. Set on
288
+ * the DOM rather than through state so a resize never re-renders the card.
289
+ */
290
+ function useStickyTopVar(
291
+ ref: React.RefObject<HTMLDivElement | null>,
292
+ sticky: boolean
293
+ ) {
294
+ React.useLayoutEffect(() => {
295
+ const header = ref.current;
296
+ const card = header?.closest<HTMLElement>('[data-slot="card"]');
297
+ if (!sticky || !header || !card) return;
298
+ // The border box's layout size: padding and the divider count, and an
299
+ // ancestor transform (a Dialog's zoom-in) does not. The observer fires
300
+ // once on observe, so this also publishes the initial height.
301
+ const observer = new ResizeObserver(([entry]) => {
302
+ const height = entry?.borderBoxSize?.[0]?.blockSize;
303
+ if (height !== undefined) {
304
+ card.style.setProperty("--content-sticky-top", `${height}px`);
305
+ }
306
+ });
307
+ observer.observe(header, { box: "border-box" });
308
+ return () => {
309
+ observer.disconnect();
310
+ card.style.removeProperty("--content-sticky-top");
311
+ };
312
+ }, [ref, sticky]);
313
+ }
314
+
262
315
  /**
263
316
  * Header section of the Card containing title and description.
264
317
  */
@@ -275,9 +328,12 @@ const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(
275
328
  ref
276
329
  ) => {
277
330
  const { flush, density, variant } = React.useContext(CardContext);
331
+ const headerRef = React.useRef<HTMLDivElement>(null);
332
+ React.useImperativeHandle(ref, () => headerRef.current!, []);
333
+ useStickyTopVar(headerRef, sticky);
278
334
  return (
279
335
  <div
280
- ref={ref}
336
+ ref={headerRef}
281
337
  className={cn(
282
338
  cardHeaderVariants({ align }),
283
339
  subPadding(flush, density),
@@ -288,10 +344,7 @@ const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(
288
344
  divider && density === "default" && "pb-8",
289
345
  divider && density === "condensed" && "pb-3",
290
346
  divider && "border-border border-b",
291
- sticky && [
292
- "sticky top-(--ds-section-padding-y-sm) z-10 rounded-t-xl",
293
- stickySurface[variant],
294
- ],
347
+ sticky && ["sticky top-0 z-10 rounded-t-xl", stickySurface[variant]],
295
348
  className
296
349
  )}
297
350
  data-divider={divider ? "" : undefined}
@@ -172,6 +172,7 @@ const Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(
172
172
 
173
173
  React.useEffect(() => {
174
174
  if (!api) return;
175
+ // eslint-disable-next-line react-hooks/set-state-in-effect -- Embla select sync; refactor tracked in DS-1070
175
176
  onSelect(api);
176
177
  api.on("reInit", onSelect);
177
178
  api.on("select", onSelect);
@@ -205,6 +206,7 @@ const Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(
205
206
 
206
207
  React.useEffect(() => {
207
208
  if (!api || !lazyLoad) return;
209
+ // eslint-disable-next-line react-hooks/set-state-in-effect -- Embla slidesInView sync; refactor tracked in DS-1070
208
210
  updateLoadedSlides(api);
209
211
  api.on("slidesInView", updateLoadedSlides);
210
212
  api.on("select", updateLoadedSlides);
@@ -539,6 +541,7 @@ function CarouselDots({
539
541
  React.useEffect(() => {
540
542
  if (!api) return;
541
543
 
544
+ // eslint-disable-next-line react-hooks/set-state-in-effect -- Embla scroll snaps / selected index sync; refactor tracked in DS-1070
542
545
  setScrollSnaps(api.scrollSnapList());
543
546
  setSelectedIndex(api.selectedScrollSnap());
544
547
 
@@ -586,7 +589,7 @@ function CarouselDots({
586
589
  : `Go to slide ${index + 1}`
587
590
  }
588
591
  className={cn(
589
- "focus-visible:shadow-default duration-base size-3 rounded-full transition-[width,background-color] ease-in-out outline-none",
592
+ "focus-visible:shadow-default duration-base size-3 cursor-pointer rounded-full transition-[width,background-color] ease-in-out outline-none",
590
593
  index === selectedIndex
591
594
  ? "bg-muted-foreground/50 dark:bg-muted-foreground/70 w-9"
592
595
  : "bg-input hover:bg-muted-foreground/30 dark:bg-input/80 dark:hover:bg-muted-foreground/50"