@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
@@ -1,53 +1,32 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import * as o from "react";
3
- import { cn as l } from "@brightlocal/ui-components/lib/utils";
4
- const f = o.forwardRef(
5
- ({ className: e, children: t, dataHook: a, trackingEl: r, trackingLabel: d, ...s }, c) => /* @__PURE__ */ n(
6
- "div",
7
- {
8
- ref: c,
9
- className: l(
10
- // Base styles with section-padding tokens (responsive: 16px mobile, 24px desktop) and gap-4 for header/content spacing
11
- "bg-background p-section-sm flex min-h-screen w-full flex-col items-center justify-center gap-4",
12
- e
13
- ),
14
- "data-hook": a,
15
- "data-slot": "centred-layout",
16
- "data-tracking-el": r,
17
- "data-tracking-label": d,
18
- ...s,
19
- children: t
20
- }
21
- )
22
- );
1
+ import * as n from "react";
2
+ import { cn as o } from "@brightlocal/ui-components/lib/utils";
3
+ import { jsx as l } from "react/jsx-runtime";
4
+ var f = n.forwardRef(({ className: e, children: t, dataHook: a, trackingEl: r, trackingLabel: d, ...s }, c) => /* @__PURE__ */ l("div", {
5
+ ref: c,
6
+ className: o("bg-background p-section-sm flex min-h-screen w-full flex-col items-center justify-center gap-4", e),
7
+ "data-hook": a,
8
+ "data-slot": "centred-layout",
9
+ "data-tracking-el": r,
10
+ "data-tracking-label": d,
11
+ ...s,
12
+ children: t
13
+ }));
23
14
  f.displayName = "CentredLayout";
24
- const i = o.forwardRef(({ className: e, children: t, ...a }, r) => /* @__PURE__ */ n(
25
- "div",
26
- {
27
- ref: r,
28
- className: l(
29
- "flex w-full items-center justify-center lg:justify-start",
30
- e
31
- ),
32
- "data-slot": "centred-layout-header",
33
- ...a,
34
- children: t
35
- }
36
- ));
15
+ var i = n.forwardRef(({ className: e, children: t, ...a }, r) => /* @__PURE__ */ l("div", {
16
+ ref: r,
17
+ className: o("flex w-full items-center justify-center lg:justify-start", e),
18
+ "data-slot": "centred-layout-header",
19
+ ...a,
20
+ children: t
21
+ }));
37
22
  i.displayName = "CentredLayoutHeader";
38
- const u = o.forwardRef(({ className: e, children: t, ...a }, r) => /* @__PURE__ */ n(
39
- "div",
40
- {
41
- ref: r,
42
- className: l(
43
- "flex w-full flex-1 flex-col items-center justify-center",
44
- e
45
- ),
46
- "data-slot": "centred-layout-content",
47
- ...a,
48
- children: t
49
- }
50
- ));
23
+ var u = n.forwardRef(({ className: e, children: t, ...a }, r) => /* @__PURE__ */ l("div", {
24
+ ref: r,
25
+ className: o("flex w-full flex-1 flex-col items-center justify-center", e),
26
+ "data-slot": "centred-layout-content",
27
+ ...a,
28
+ children: t
29
+ }));
51
30
  u.displayName = "CentredLayoutContent";
52
31
  export {
53
32
  f as CentredLayout,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),l=require("react"),m=require("@brightlocal/icons"),p=require("@brightlocal/ui-components/lib/utils"),d=require("./lib/empty-canvas.cjs");function f(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const y=f(l),o=y.forwardRef(({className:e,dataHook:r,icon:t,message:a,trackingEl:s,trackingLabel:c,...u},i)=>n.jsx(d.EmptyCanvas,{ref:i,className:p.cn("w-full rounded-lg",e),dataHook:r,icon:t??n.jsx(m.ChartColumn,{strokeWidth:2}),message:a??"No data yet",slot:"chart-empty",trackingEl:s,trackingLabel:c,...u}));o.displayName="ChartEmpty";exports.ChartEmpty=o;
1
+ const m=require("./_virtual/_rolldown/runtime.cjs"),n=require("./lib/empty-canvas.cjs");let e=require("react");e=m.__toESM(e,1);let h=require("@brightlocal/icons"),p=require("@brightlocal/ui-components/lib/utils"),r=require("react/jsx-runtime");var t=e.forwardRef(({className:a,dataHook:i,icon:l,message:s,trackingEl:o,trackingLabel:u,..._},c)=>(0,r.jsx)(n.EmptyCanvas,{ref:c,className:(0,p.cn)("w-full rounded-lg",a),dataHook:i,icon:l??(0,r.jsx)(h.ChartColumn,{strokeWidth:2}),message:s??"No data yet",slot:"chart-empty",trackingEl:o,trackingLabel:u,..._}));t.displayName="ChartEmpty";exports.ChartEmpty=t;
@@ -1,29 +1,20 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import * as i from "react";
3
- import { ChartColumn as l } from "@brightlocal/icons";
4
- import { cn as c } from "@brightlocal/ui-components/lib/utils";
5
- import { EmptyCanvas as d } from "./lib/empty-canvas.js";
6
- const n = i.forwardRef(
7
- ({ className: o, dataHook: r, icon: m, message: a, trackingEl: e, trackingLabel: p, ...s }, f) => (
8
- /* `w-full` and no height: the height is the consumer's, because only the
9
- chart knows what it had reserved. */
10
- /* @__PURE__ */ t(
11
- d,
12
- {
13
- ref: f,
14
- className: c("w-full rounded-lg", o),
15
- dataHook: r,
16
- icon: m ?? /* @__PURE__ */ t(l, { strokeWidth: 2 }),
17
- message: a ?? "No data yet",
18
- slot: "chart-empty",
19
- trackingEl: e,
20
- trackingLabel: p,
21
- ...s
22
- }
23
- )
24
- )
25
- );
26
- n.displayName = "ChartEmpty";
1
+ import { EmptyCanvas as i } from "./lib/empty-canvas.js";
2
+ import * as l from "react";
3
+ import { ChartColumn as d } from "@brightlocal/icons";
4
+ import { cn as y } from "@brightlocal/ui-components/lib/utils";
5
+ import { jsx as r } from "react/jsx-runtime";
6
+ var c = l.forwardRef(({ className: t, dataHook: m, icon: o, message: a, trackingEl: e, trackingLabel: p, ...s }, f) => /* @__PURE__ */ r(i, {
7
+ ref: f,
8
+ className: y("w-full rounded-lg", t),
9
+ dataHook: m,
10
+ icon: o ?? /* @__PURE__ */ r(d, { strokeWidth: 2 }),
11
+ message: a ?? "No data yet",
12
+ slot: "chart-empty",
13
+ trackingEl: e,
14
+ trackingLabel: p,
15
+ ...s
16
+ }));
17
+ c.displayName = "ChartEmpty";
27
18
  export {
28
- n as ChartEmpty
19
+ c as ChartEmpty
29
20
  };
package/dist/chart.cjs CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),X=require("react"),s=require("recharts"),b=require("@brightlocal/ui-components/lib/utils");function N(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const t=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(r,l,t.get?t:{enumerable:!0,get:()=>e[l]})}}return r.default=e,Object.freeze(r)}const y=N(X),P=N(s),_=y.createContext(null);function R(){const e=y.useContext(_);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const $=y.forwardRef(({id:e,className:r,children:l,config:t,dataHook:n,width:o,height:i,minWidth:d,minHeight:c,maxHeight:h,trackingEl:f,trackingLabel:m,...g},C)=>{const x=y.useId(),p=`chart-${e||x.replace(/:/g,"")}`;return a.jsx(_.Provider,{value:{config:t},children:a.jsxs("div",{ref:C,className:b.cn("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-polar-radius-axis-tick-value]:fill-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background text-body-xs flex aspect-video justify-center [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",r),"data-chart":p,"data-hook":n,"data-slot":"chart-container","data-tracking-el":f,"data-tracking-label":m,...g,children:[a.jsx(S,{config:t,id:p}),a.jsx(P.ResponsiveContainer,{height:i??"100%",initialDimension:{width:1,height:1},maxHeight:h,minHeight:c,minWidth:d??0,width:o??"100%",children:l})]})})});$.displayName="ChartContainer";function S({id:e,config:r}){const l=Object.entries(r).filter(([,t])=>t.theme||t.color);return l.length?a.jsx("style",{dangerouslySetInnerHTML:{__html:l.map(([t,n])=>{const o=typeof n.color=="string"?n.color.replace(/^hsl\((.*)\)$/,"$1"):null;return o?`
2
- [data-chart=${e}] {
3
- --color-${t}: ${o};
1
+ "use client";const $=require("./_virtual/_rolldown/runtime.cjs"),Z=require("./chart-empty.cjs");let x=require("react");x=$.__toESM(x,1);let y=require("@brightlocal/ui-components/lib/utils"),o=require("react/jsx-runtime"),S=require("@radix-ui/react-slot"),J=require("class-variance-authority"),c=require("recharts");c=$.__toESM(c,1);var k=x.createContext(null);function z(){const t=x.useContext(k);if(!t)throw new Error("useChart must be used within a <ChartContainer />");return t}function A(){return x.useContext(k)}var E=x.forwardRef(({id:t,className:n,children:l,config:e,dataHook:r,width:a,height:i,minWidth:d,minHeight:s,maxHeight:f,trackingEl:m,trackingLabel:b,...C},v)=>{const j=x.useId(),g=`chart-${t||j.replace(/:/g,"")}`,h=x.useRef(null),L=x.useCallback(p=>{h.current=p,typeof v=="function"?v(p):v&&(v.current=p)},[v]),u=typeof i=="number";return(0,o.jsx)(k.Provider,{value:{config:e,containerRef:h},children:(0,o.jsxs)("div",{ref:L,className:(0,y.cn)("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-polar-radius-axis-tick-value]:fill-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background text-body-xs flex justify-center [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",u?"aspect-auto":"aspect-video",n),"data-chart":g,"data-hook":r,"data-slot":"chart-container","data-tracking-el":m,"data-tracking-label":b,style:u?{height:i}:void 0,...C,children:[(0,o.jsx)(T,{config:e,id:g}),(0,o.jsx)(c.ResponsiveContainer,{height:i??"100%",initialDimension:{width:1,height:1},maxHeight:f,minHeight:s,minWidth:d??0,width:a??"100%",children:l})]})})});E.displayName="ChartContainer";function T({id:t,config:n}){const l=Object.entries(n).filter(([,e])=>e.theme||e.color);return l.length?(0,o.jsx)("style",{dangerouslySetInnerHTML:{__html:l.map(([e,r])=>{const a=typeof r.color=="string"?r.color.replace(/^hsl\((.*)\)$/,"$1"):null;return a?`
2
+ [data-chart=${t}] {
3
+ --color-${e}: ${a};
4
4
  }
5
- `:n.theme?Object.entries(n.theme).map(([i,d])=>`
6
- .${i} [data-chart=${e}] {
7
- --color-${t}: ${d.replace(/^hsl\((.*)\)$/,"$1")};
5
+ `:r.theme?Object.entries(r.theme).map(([i,d])=>`
6
+ .${i} [data-chart=${t}] {
7
+ --color-${e}: ${d.replace(/^hsl\((.*)\)$/,"$1")};
8
8
  }
9
9
  `).join(""):""}).join(`
10
- `)}}):null}function O(e){return e==null||e===""?!1:typeof e=="number"?Number.isFinite(e):!0}function w({...e}){return a.jsx(P.Tooltip,{...e})}w.displayName="ChartTooltip";function A({active:e,payload:r,className:l,indicator:t="dot",hideLabel:n=!1,hideIndicator:o=!1,label:i,labelFormatter:d,labelClassName:c,formatter:h,color:f,nameKey:m,labelKey:g}){const{config:C}=R(),x=y.useMemo(()=>{if(n||!r?.length)return null;const[u]=r;if(!u)return null;const L=`${g||u.dataKey||u.name||"value"}`,v=C[L],j=!g&&typeof i=="string"?C[i]?.label||i:v?.label;return d?a.jsx("div",{className:b.cn("font-medium",c),children:d(j,r)}):j?a.jsx("div",{className:b.cn("font-medium",c),children:j}):null},[i,d,r,n,c,C,g]);if(!e||!r?.length)return null;const p=r.length===1&&t!=="dot";return a.jsxs("div",{className:b.cn("border-border/50 bg-background text-body-xs grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 shadow-xl",l),"data-slot":"chart-tooltip-content",children:[p?null:x,a.jsx("div",{className:"grid gap-1.5",children:r.map((u,L)=>{const v=`${m||u.name||u.dataKey||"value"}`,j=C[v],k=f||u.color||u.payload.fill||`var(--color-${v})`;return a.jsx("div",{className:b.cn("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2",t==="dot"&&"items-center"),"data-slot":"chart-tooltip-item",children:h&&O(u.value)&&u.name?h(u.value,u.name,u,L,r):a.jsxs(a.Fragment,{children:[j?.icon&&!o?a.jsx(j.icon,{size:10}):!o&&a.jsx("div",{className:b.cn("shrink-0 rounded-[2px]",{"h-2.5 w-2.5":t==="dot","w-1":t==="line","w-0 border-[1.5px] border-dashed bg-transparent":t==="dashed","my-0.5":p&&t==="dashed"}),style:{backgroundColor:t==="dashed"?"transparent":k,borderColor:k}}),a.jsxs("div",{className:b.cn("flex flex-1 justify-between gap-2 leading-none",p?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[p?x:null,a.jsx("span",{className:"text-muted-foreground","data-slot":"chart-tooltip-item-name",children:j?.label||u.name})]}),O(u.value)&&a.jsx("span",{className:"text-foreground tabular-nums","data-slot":"chart-tooltip-item-value",children:typeof u.value=="number"?u.value.toLocaleString():u.value})]})]})},u.dataKey)})})]})}A.displayName="ChartTooltipContent";function T({...e}){return a.jsx(P.Legend,{...e})}T.displayName="ChartLegend";function D({className:e,hideIcon:r=!1,payload:l,verticalAlign:t="bottom",nameKey:n}){const{config:o}=R();return l?.length?a.jsx("div",{className:b.cn("flex items-center justify-center gap-4",t==="top"?"pb-4":"pt-4",e),"data-slot":"chart-legend-content",children:l.map(i=>{const d=`${n||i.dataKey||"value"}`,c=o[d];return a.jsxs("div",{className:b.cn("[&>svg]:text-muted-foreground flex items-center gap-1.5"),children:[c?.icon&&!r?a.jsx(c.icon,{size:12}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:i.color}}),c?.label||i.value]},i.value)})}):null}D.displayName="ChartLegendContent";function G({colorKey:e,color:r,fill:l,stroke:t,payload:n}){return(e&&typeof n?.[e]=="string"?n[e]:void 0)??r??l??t??"currentColor"}function W({size:e=8,custom:r=!1,color:l,colorKey:t,cx:n,cy:o,stroke:i,fill:d,payload:c}){if(n==null||o==null)return null;const h=G({colorKey:t,color:l,fill:d,stroke:i,payload:c});return a.jsx("circle",{className:r?"fill-background":void 0,cx:n,cy:o,"data-slot":"chart-dot",fill:r?void 0:h,r:e/2,stroke:r?h:"none",strokeWidth:r?2:void 0})}W.displayName="ChartDot";function B({size:e=6,color:r,colorKey:l,cx:t,cy:n,stroke:o,fill:i,payload:d}){if(t==null||n==null)return null;const c=G({colorKey:l,color:r,fill:i,stroke:o,payload:d});return a.jsx("circle",{className:"stroke-background",cx:t,cy:n,"data-slot":"chart-dot-on-stroke",fill:c,r:e/2,strokeWidth:2})}B.displayName="ChartDotOnStroke";function M({type:e="default",filled:r=!1,fillColor:l="var(--chart-teal)",fillOpacity:t=.2,boundaryOnly:n=!1,radialLines:o,className:i,...d}){const c=e==="circle"?"circle":"polygon",f=n?`[&_.${c==="circle"?"recharts-polar-grid-concentric-circle":"recharts-polar-grid-concentric-polygon"}:not(:last-of-type)]:stroke-transparent`:void 0;return r?a.jsx(P.PolarGrid,{className:b.cn(f,i),fill:l,fillOpacity:t,gridType:c,radialLines:o??!1,stroke:"none",...d}):a.jsx(P.PolarGrid,{className:b.cn(f,i),gridType:c,radialLines:o,...d})}M.displayName="ChartRadarGrid";function z({type:e="default",data:r,primaryKey:l,secondaryKey:t,x:n,y:o,textAnchor:i,payload:d,index:c}){const h=r!=null&&c!=null?r[c]:void 0,f=h&&l!=null?h[l]:void 0,m=h&&t!=null?h[t]:void 0,g=e==="default"&&f!=null?m!=null?`${String(f)}/${String(m)}`:String(f):null;return a.jsxs("text",{className:"text-body-xs","data-slot":"chart-radar-label-wrapper",textAnchor:i,x:n,y:o,children:[g!=null&&a.jsx("tspan",{className:"fill-card-foreground",dy:"-0.5em",x:n,children:g}),a.jsx("tspan",{className:"fill-muted-foreground",dy:g!=null?"1.2em":void 0,x:n,children:d?.value})]})}z.displayName="ChartRadarLabelWrapper";function q({nameKey:e,config:r,radiusRatio:l=.5,cx:t,cy:n,midAngle:o=0,innerRadius:i=0,outerRadius:d=0,payload:c,name:h}){if(t==null||n==null)return null;const f=Math.PI/180,m=i+(d-i)*l,g=t+m*Math.cos(-o*f),C=n+m*Math.sin(-o*f),x=e!=null&&c!=null?c[e]:void 0,p=x!=null?String(x):h,u=p!=null?r?.[p]?.label??p:p;return a.jsx("text",{className:"fill-foreground text-body-xs","data-slot":"chart-pie-label-list",dominantBaseline:"middle",textAnchor:"middle",x:g,y:C,children:u})}q.displayName="ChartPieLabelList";function I({valueKey:e,x:r,y:l,textAnchor:t,payload:n,value:o}){if(r==null||l==null)return null;const i=e!=null&&n!=null?n[e]:o;return a.jsx("text",{className:"fill-foreground text-body-xs","data-slot":"chart-pie-label-wrapper",dominantBaseline:"middle",textAnchor:t,x:r,y:l,children:i})}I.displayName="ChartPieLabelWrapper";const Y={"2xl":"text-metric","3xl":"font-sans text-3xl font-semibold","4xl":"font-sans text-4xl font-semibold"};function V({primary:e,secondary:r,size:l="3xl",viewBox:t}){if(t==null||typeof t!="object"||!("cx"in t)||!("cy"in t))return null;const{cx:n,cy:o}=t;return a.jsxs("text",{"data-slot":"chart-center-label",dominantBaseline:"middle",textAnchor:"middle",x:n,y:o,children:[a.jsx("tspan",{className:b.cn("fill-foreground",Y[l]),x:n,y:o,children:e}),r!=null&&a.jsx("tspan",{className:"fill-muted-foreground text-body-xs",x:n,y:o+24,children:r})]})}V.displayName="ChartCenterLabel";Object.defineProperty(exports,"Area",{enumerable:!0,get:()=>s.Area});Object.defineProperty(exports,"AreaChart",{enumerable:!0,get:()=>s.AreaChart});Object.defineProperty(exports,"Bar",{enumerable:!0,get:()=>s.Bar});Object.defineProperty(exports,"BarChart",{enumerable:!0,get:()=>s.BarChart});Object.defineProperty(exports,"CartesianGrid",{enumerable:!0,get:()=>s.CartesianGrid});Object.defineProperty(exports,"Cell",{enumerable:!0,get:()=>s.Cell});Object.defineProperty(exports,"ChartLabel",{enumerable:!0,get:()=>s.Label});Object.defineProperty(exports,"ChartsLegend",{enumerable:!0,get:()=>s.Legend});Object.defineProperty(exports,"ChartsTooltip",{enumerable:!0,get:()=>s.Tooltip});Object.defineProperty(exports,"Customized",{enumerable:!0,get:()=>s.Customized});Object.defineProperty(exports,"LabelList",{enumerable:!0,get:()=>s.LabelList});Object.defineProperty(exports,"Line",{enumerable:!0,get:()=>s.Line});Object.defineProperty(exports,"LineChart",{enumerable:!0,get:()=>s.LineChart});Object.defineProperty(exports,"Pie",{enumerable:!0,get:()=>s.Pie});Object.defineProperty(exports,"PieChart",{enumerable:!0,get:()=>s.PieChart});Object.defineProperty(exports,"PolarAngleAxis",{enumerable:!0,get:()=>s.PolarAngleAxis});Object.defineProperty(exports,"PolarGrid",{enumerable:!0,get:()=>s.PolarGrid});Object.defineProperty(exports,"PolarRadiusAxis",{enumerable:!0,get:()=>s.PolarRadiusAxis});Object.defineProperty(exports,"Radar",{enumerable:!0,get:()=>s.Radar});Object.defineProperty(exports,"RadarChart",{enumerable:!0,get:()=>s.RadarChart});Object.defineProperty(exports,"RadialBar",{enumerable:!0,get:()=>s.RadialBar});Object.defineProperty(exports,"RadialBarChart",{enumerable:!0,get:()=>s.RadialBarChart});Object.defineProperty(exports,"Rectangle",{enumerable:!0,get:()=>s.Rectangle});Object.defineProperty(exports,"ReferenceLine",{enumerable:!0,get:()=>s.ReferenceLine});Object.defineProperty(exports,"ResponsiveContainer",{enumerable:!0,get:()=>s.ResponsiveContainer});Object.defineProperty(exports,"Sector",{enumerable:!0,get:()=>s.Sector});Object.defineProperty(exports,"XAxis",{enumerable:!0,get:()=>s.XAxis});Object.defineProperty(exports,"YAxis",{enumerable:!0,get:()=>s.YAxis});exports.ChartCenterLabel=V;exports.ChartContainer=$;exports.ChartDot=W;exports.ChartDotOnStroke=B;exports.ChartLegend=T;exports.ChartLegendContent=D;exports.ChartPieLabelList=q;exports.ChartPieLabelWrapper=I;exports.ChartRadarGrid=M;exports.ChartRadarLabelWrapper=z;exports.ChartStyle=S;exports.ChartTooltip=w;exports.ChartTooltipContent=A;
10
+ `)}}):null}function R(t){return t==null||t===""?!1:typeof t=="number"?Number.isFinite(t):!0}var Q=50;function U(t){const[n,l]=x.useState(null);return x.useEffect(()=>{if(!t){l(null);return}const e=document.createElement("div");return e.setAttribute("data-slot","chart-tooltip-portal"),document.body.appendChild(e),l(e),()=>{document.body.removeChild(e)}},[t]),n}function K(t,n){x.useEffect(()=>{const l=t?.current;if(!l)return;const e=n??l;let r=!1;function a(){const s=e.querySelector(".recharts-tooltip-wrapper");s&&(s.style.visibility="hidden")}function i(s){r=!0;const f=s.target;!l.contains(f)&&!e.contains(f)&&(a(),r=!1)}function d(){r&&(a(),r=!1)}return document.addEventListener("touchstart",i,{passive:!0}),window.addEventListener("scroll",d,{passive:!0,capture:!0}),()=>{document.removeEventListener("touchstart",i),window.removeEventListener("scroll",d,{capture:!0})}},[t,n])}function I({portal:t,wrapperStyle:n,allowEscapeViewBox:l,...e}){const r=A(),a=U(t!==null);return K(r?.containerRef,a),(0,o.jsx)(c.Tooltip,{allowEscapeViewBox:l??{x:!0,y:!0},portal:t!==void 0?t:a,wrapperStyle:{zIndex:Q,...n},...e})}I.displayName="ChartTooltip";function q({active:t,payload:n,className:l,indicator:e="dot",hideLabel:r=!1,hideIndicator:a=!1,label:i,labelFormatter:d,labelClassName:s,formatter:f,color:m,nameKey:b,labelKey:C}){const{config:v}=z(),j=x.useMemo(()=>{if(r||!n?.length)return null;const[h]=n;if(!h)return null;const L=`${C||h.dataKey||h.name||"value"}`,u=v[L],p=!C&&typeof i=="string"?v[i]?.label||i:u?.label;return d?(0,o.jsx)("div",{className:(0,y.cn)("font-medium",s),children:d(p,n)}):p?(0,o.jsx)("div",{className:(0,y.cn)("font-medium",s),children:p}):null},[i,d,n,r,s,v,C]);if(!t||!n?.length)return null;const g=n.length===1&&e!=="dot";return(0,o.jsxs)("div",{className:(0,y.cn)("border-border/50 bg-background text-body-xs grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 shadow-xl",l),"data-slot":"chart-tooltip-content",children:[g?null:j,(0,o.jsx)("div",{className:"grid gap-1.5",children:n.map((h,L)=>{const u=`${b||h.name||h.dataKey||"value"}`,p=v[u],P=m||h.color||h.payload.fill||`var(--color-${u})`;return(0,o.jsx)("div",{className:(0,y.cn)("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2",e==="dot"&&"items-center"),"data-slot":"chart-tooltip-item",children:f&&R(h.value)&&h.name?f(h.value,h.name,h,L,n):(0,o.jsxs)(o.Fragment,{children:[p?.icon&&!a?(0,o.jsx)(p.icon,{size:10}):!a&&(0,o.jsx)("div",{className:(0,y.cn)("shrink-0 rounded-[2px]",{"h-2.5 w-2.5":e==="dot","w-1":e==="line","w-0 border-[1.5px] border-dashed bg-transparent":e==="dashed","my-0.5":g&&e==="dashed"}),style:{backgroundColor:e==="dashed"?"transparent":P,borderColor:P}}),(0,o.jsxs)("div",{className:(0,y.cn)("flex flex-1 justify-between gap-2 leading-none",g?"items-end":"items-center"),children:[(0,o.jsxs)("div",{className:"grid gap-1.5",children:[g?j:null,(0,o.jsx)("span",{className:"text-muted-foreground","data-slot":"chart-tooltip-item-name",children:p?.label||h.name})]}),R(h.value)&&(0,o.jsx)("span",{className:"text-foreground tabular-nums","data-slot":"chart-tooltip-item-value",children:typeof h.value=="number"?h.value.toLocaleString():h.value})]})]})},h.dataKey)})})]})}q.displayName="ChartTooltipContent";function D({...t}){return(0,o.jsx)(c.Legend,{...t})}D.displayName="ChartLegend";var N=x.forwardRef(({asChild:t=!1,children:n,className:l,color:e,dataHook:r,hidden:a=!1,hideIcon:i=!1,muted:d=!1,seriesKey:s,trackingEl:f,trackingLabel:m,value:b,...C},v)=>{const j=A(),g=s?j?.config[s]:void 0,h=e??g?.color??(s?`var(--color-${s})`:void 0),L=!!s&&!e&&(!j||!!j.standalone&&!g?.color);x.useEffect(()=>{process.env.NODE_ENV!=="production"&&L&&console.warn(`ChartLegendItem: seriesKey="${s}" has no colour to resolve — render it inside a ChartContainer, give the ChartLegendList config a \`color\` for this key (a \`theme\` only resolves inside a container), or set \`color\`.`)},[s,L]);const u=t?S.Slot:"div",p=n??g?.label??s;return(0,o.jsxs)(u,{ref:v,className:(0,y.cn)("[&>svg]:text-muted-foreground focus-visible:shadow-default flex items-center gap-1.5 rounded-sm outline-none group-data-[size=md]/legend:gap-2 [&>svg]:size-3 group-data-[size=md]/legend:[&>svg]:size-3.5",(d||a)&&"text-muted-foreground",a&&"line-through [&_:is(button,a)]:line-through",l),"data-hidden":a||void 0,"data-hook":r,"data-muted":d||a||void 0,"data-slot":"chart-legend-item","data-tracking-el":f,"data-tracking-label":m,...C,children:[g?.icon&&!i?(0,o.jsx)(g.icon,{size:12}):(0,o.jsx)("span",{"aria-hidden":"true",className:(0,y.cn)("duration-fast block size-2 shrink-0 rounded-[2px] transition-opacity ease-out group-data-[size=md]/legend:size-2.5",(d||a)&&"opacity-40"),"data-slot":"chart-legend-item-swatch",style:{backgroundColor:h}}),(0,o.jsx)(S.Slottable,{children:p}),b!=null&&(0,o.jsx)("span",{className:"ml-auto pl-0.5 tabular-nums","data-slot":"chart-legend-item-value",children:(0,o.jsx)("span",{className:"inline-block",children:b})})]})});N.displayName="ChartLegendItem";var ee=(0,J.cva)("group/legend flex",{variants:{size:{sm:"text-body-xs",md:"text-body-sm"},orientation:{horizontal:"flex-wrap items-center justify-center gap-x-4 gap-y-1",vertical:"flex-col items-stretch gap-3"}},defaultVariants:{orientation:"horizontal",size:"sm"}}),O=x.forwardRef(({ariaLabel:t,children:n,className:l,config:e,dataHook:r,orientation:a="horizontal",size:i="sm",trackingEl:d,trackingLabel:s,...f},m)=>{const b=x.useMemo(()=>e?{config:e,standalone:!0}:null,[e]),C=(0,o.jsx)("div",{ref:m,"aria-label":t??"Chart legend",className:(0,y.cn)(ee({orientation:a,size:i}),l),"data-hook":r,"data-orientation":a,"data-size":i,"data-slot":"chart-legend-list","data-tracking-el":d,"data-tracking-label":s,role:"group",...f,children:n});return b?(0,o.jsx)(k.Provider,{value:b,children:C}):C});O.displayName="ChartLegendList";var te=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");function G({ariaLabel:t,className:n,dataHook:l="chart-legend",hideIcon:e=!1,nameKey:r,orientation:a="horizontal",payload:i,renderItem:d,showValue:s=!1,size:f="sm",sortBy:m,valueFormatter:b,valueKey:C,verticalAlign:v="bottom"}){const{config:j}=z();if(!i?.length)return null;const g=u=>{const p=u.dataKey!==void 0&&u.payload?.dataKey===u.dataKey;return String((r?u.payload?.[r]:void 0)??(p?u.dataKey:u.value??u.dataKey))},h=u=>{const p=Array.isArray(m)?m.indexOf(g(u)):-1;return p===-1?Number.POSITIVE_INFINITY:p},L=m?[...i].sort(Array.isArray(m)?(u,p)=>{const P=h(u),_=h(p);return P===_?0:P-_}:m):i;return(0,o.jsx)(O,{ariaLabel:t,className:(0,y.cn)(v==="top"&&"pb-4",v==="bottom"&&"pt-4",n),"data-slot":"chart-legend-content",dataHook:l,orientation:a,size:f,children:L.map(u=>{const p=g(u),P=j[p],_=s?b?b(u):u.payload?.[C??u.dataKey??"value"]:void 0,w=(0,o.jsx)(N,{color:u.color,dataHook:`${l}-${te(p)}`,hideIcon:e,seriesKey:p,value:_,children:P?.label||u.value},u.value);return d?(0,o.jsx)(x.Fragment,{children:d(u,w)},u.value):w})})}G.displayName="ChartLegendContent";function V({colorKey:t,color:n,fill:l,stroke:e,payload:r}){return(t&&typeof r?.[t]=="string"?r[t]:void 0)??n??l??e??"currentColor"}function W({size:t=8,custom:n=!1,color:l,colorKey:e,cx:r,cy:a,stroke:i,fill:d,payload:s}){if(r==null||a==null)return null;const f=V({colorKey:e,color:l,fill:d,stroke:i,payload:s});return(0,o.jsx)("circle",{className:n?"fill-background":void 0,cx:r,cy:a,"data-slot":"chart-dot",fill:n?void 0:f,r:t/2,stroke:n?f:"none",strokeWidth:n?2:void 0})}W.displayName="ChartDot";function M({size:t=6,color:n,colorKey:l,cx:e,cy:r,stroke:a,fill:i,payload:d}){if(e==null||r==null)return null;const s=V({colorKey:l,color:n,fill:i,stroke:a,payload:d});return(0,o.jsx)("circle",{className:"stroke-background",cx:e,cy:r,"data-slot":"chart-dot-on-stroke",fill:s,r:t/2,strokeWidth:2})}M.displayName="ChartDotOnStroke";function B({type:t="default",filled:n=!1,fillColor:l="var(--chart-teal)",fillOpacity:e=.2,boundaryOnly:r=!1,radialLines:a,className:i,...d}){const s=t==="circle"?"circle":"polygon",f=r?`[&_.${s==="circle"?"recharts-polar-grid-concentric-circle":"recharts-polar-grid-concentric-polygon"}:not(:last-of-type)]:stroke-transparent`:void 0;return n?(0,o.jsx)(c.PolarGrid,{className:(0,y.cn)(f,i),fill:l,fillOpacity:e,gridType:s,radialLines:a??!1,stroke:"none",...d}):(0,o.jsx)(c.PolarGrid,{className:(0,y.cn)(f,i),gridType:s,radialLines:a,...d})}B.displayName="ChartRadarGrid";function H({type:t="default",data:n,primaryKey:l,secondaryKey:e,x:r,y:a,textAnchor:i,payload:d,index:s}){const f=n!=null&&s!=null?n[s]:void 0,m=f&&l!=null?f[l]:void 0,b=f&&e!=null?f[e]:void 0,C=t==="default"&&m!=null?b!=null?`${String(m)}/${String(b)}`:String(m):null;return(0,o.jsxs)("text",{className:"text-body-xs","data-slot":"chart-radar-label-wrapper",textAnchor:i,x:r,y:a,children:[C!=null&&(0,o.jsx)("tspan",{className:"fill-card-foreground",dy:"-0.5em",x:r,children:C}),(0,o.jsx)("tspan",{className:"fill-muted-foreground",dy:C!=null?"1.2em":void 0,x:r,children:d?.value})]})}H.displayName="ChartRadarLabelWrapper";function X({nameKey:t,config:n,radiusRatio:l=.5,cx:e,cy:r,midAngle:a=0,innerRadius:i=0,outerRadius:d=0,payload:s,name:f}){if(e==null||r==null)return null;const m=Math.PI/180,b=i+(d-i)*l,C=e+b*Math.cos(-a*m),v=r+b*Math.sin(-a*m),j=t!=null&&s!=null?s[t]:void 0,g=j!=null?String(j):f,h=g!=null?n?.[g]?.label??g:g;return(0,o.jsx)("text",{className:"fill-foreground text-body-xs","data-slot":"chart-pie-label-list",dominantBaseline:"middle",textAnchor:"middle",x:C,y:v,children:h})}X.displayName="ChartPieLabelList";function Y({valueKey:t,x:n,y:l,textAnchor:e,payload:r,value:a}){if(n==null||l==null)return null;const i=t!=null&&r!=null?r[t]:a;return(0,o.jsx)("text",{className:"fill-foreground text-body-xs","data-slot":"chart-pie-label-wrapper",dominantBaseline:"middle",textAnchor:e,x:n,y:l,children:i})}Y.displayName="ChartPieLabelWrapper";var re={"2xl":"text-metric","3xl":"font-sans text-3xl font-semibold","4xl":"font-sans text-4xl font-semibold"};function F({primary:t,secondary:n,size:l="3xl",viewBox:e}){if(e==null||typeof e!="object"||!("cx"in e)||!("cy"in e))return null;const{cx:r,cy:a}=e;return(0,o.jsxs)("text",{"data-slot":"chart-center-label",dominantBaseline:"middle",textAnchor:"middle",x:r,y:a,children:[(0,o.jsx)("tspan",{className:(0,y.cn)("fill-foreground",re[l]),x:r,y:a,children:t}),n!=null&&(0,o.jsx)("tspan",{className:"fill-muted-foreground text-body-xs",x:r,y:a+24,children:n})]})}F.displayName="ChartCenterLabel";Object.defineProperty(exports,"Area",{enumerable:!0,get:function(){return c.Area}});Object.defineProperty(exports,"AreaChart",{enumerable:!0,get:function(){return c.AreaChart}});Object.defineProperty(exports,"Bar",{enumerable:!0,get:function(){return c.Bar}});Object.defineProperty(exports,"BarChart",{enumerable:!0,get:function(){return c.BarChart}});Object.defineProperty(exports,"CartesianGrid",{enumerable:!0,get:function(){return c.CartesianGrid}});Object.defineProperty(exports,"Cell",{enumerable:!0,get:function(){return c.Cell}});exports.ChartCenterLabel=F;exports.ChartContainer=E;exports.ChartDot=W;exports.ChartDotOnStroke=M;exports.ChartEmpty=Z.ChartEmpty;Object.defineProperty(exports,"ChartLabel",{enumerable:!0,get:function(){return c.Label}});exports.ChartLegend=D;exports.ChartLegendContent=G;exports.ChartLegendItem=N;exports.ChartLegendList=O;exports.ChartPieLabelList=X;exports.ChartPieLabelWrapper=Y;exports.ChartRadarGrid=B;exports.ChartRadarLabelWrapper=H;exports.ChartStyle=T;exports.ChartTooltip=I;exports.ChartTooltipContent=q;Object.defineProperty(exports,"ChartsLegend",{enumerable:!0,get:function(){return c.Legend}});Object.defineProperty(exports,"ChartsTooltip",{enumerable:!0,get:function(){return c.Tooltip}});Object.defineProperty(exports,"Customized",{enumerable:!0,get:function(){return c.Customized}});Object.defineProperty(exports,"LabelList",{enumerable:!0,get:function(){return c.LabelList}});Object.defineProperty(exports,"Line",{enumerable:!0,get:function(){return c.Line}});Object.defineProperty(exports,"LineChart",{enumerable:!0,get:function(){return c.LineChart}});Object.defineProperty(exports,"Pie",{enumerable:!0,get:function(){return c.Pie}});Object.defineProperty(exports,"PieChart",{enumerable:!0,get:function(){return c.PieChart}});Object.defineProperty(exports,"PolarAngleAxis",{enumerable:!0,get:function(){return c.PolarAngleAxis}});Object.defineProperty(exports,"PolarGrid",{enumerable:!0,get:function(){return c.PolarGrid}});Object.defineProperty(exports,"PolarRadiusAxis",{enumerable:!0,get:function(){return c.PolarRadiusAxis}});Object.defineProperty(exports,"Radar",{enumerable:!0,get:function(){return c.Radar}});Object.defineProperty(exports,"RadarChart",{enumerable:!0,get:function(){return c.RadarChart}});Object.defineProperty(exports,"RadialBar",{enumerable:!0,get:function(){return c.RadialBar}});Object.defineProperty(exports,"RadialBarChart",{enumerable:!0,get:function(){return c.RadialBarChart}});Object.defineProperty(exports,"Rectangle",{enumerable:!0,get:function(){return c.Rectangle}});Object.defineProperty(exports,"ReferenceLine",{enumerable:!0,get:function(){return c.ReferenceLine}});Object.defineProperty(exports,"ResponsiveContainer",{enumerable:!0,get:function(){return c.ResponsiveContainer}});Object.defineProperty(exports,"Sector",{enumerable:!0,get:function(){return c.Sector}});Object.defineProperty(exports,"XAxis",{enumerable:!0,get:function(){return c.XAxis}});Object.defineProperty(exports,"YAxis",{enumerable:!0,get:function(){return c.YAxis}});
package/dist/chart.d.ts CHANGED
@@ -76,7 +76,7 @@ declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartContaine
76
76
  declare function ChartStyle({ id, config }: {
77
77
  id: string;
78
78
  config: ChartConfig;
79
- }): import("react/jsx-runtime").JSX.Element | null;
79
+ }): React.JSX.Element | null;
80
80
  /**
81
81
  * A single entry of the Recharts tooltip payload, as `ChartTooltipContent`
82
82
  * receives it. This is the `item` argument given to `formatter` and the
@@ -100,6 +100,11 @@ interface ChartTooltipPayloadItem {
100
100
  }
101
101
  /**
102
102
  * Props for the ChartTooltip component.
103
+ *
104
+ * Inherits all Recharts Tooltip props. Notable defaults changed by the DS:
105
+ * - `portal` — renders to `document.body`; pass `null` for inline (Recharts default)
106
+ * - `allowEscapeViewBox` — `{ x: true, y: true }` so the tooltip is never clipped
107
+ * - `wrapperStyle` — includes `zIndex: 50`; consumer values are merged on top
103
108
  */
104
109
  interface ChartTooltipProps extends React.ComponentProps<typeof RechartsPrimitive.Tooltip> {
105
110
  /** Hide the tooltip label */
@@ -114,9 +119,14 @@ interface ChartTooltipProps extends React.ComponentProps<typeof RechartsPrimitiv
114
119
  labelKey?: string;
115
120
  }
116
121
  /**
117
- * ChartTooltip displays data values on hover.
122
+ * ChartTooltip displays data values on hover/tap. Portals to `document.body`
123
+ * by default so the tooltip escapes chart overflow clipping and sits above
124
+ * page-level widgets (z-index 50). On touch devices, dismisses on tap-outside
125
+ * and scroll.
126
+ *
127
+ * Pass `portal={null}` to render inline (pre-portal Recharts default).
118
128
  */
119
- declare function ChartTooltip({ ...props }: ChartTooltipProps): import("react/jsx-runtime").JSX.Element;
129
+ declare function ChartTooltip({ portal, wrapperStyle, allowEscapeViewBox, ...props }: ChartTooltipProps): React.JSX.Element;
120
130
  declare namespace ChartTooltip {
121
131
  var displayName: string;
122
132
  }
@@ -152,7 +162,7 @@ declare function ChartTooltipContent({ active, payload, className, indicator, hi
152
162
  payload?: ChartTooltipPayloadItem[];
153
163
  label?: string;
154
164
  color?: string;
155
- }): import("react/jsx-runtime").JSX.Element | null;
165
+ }): React.JSX.Element | null;
156
166
  declare namespace ChartTooltipContent {
157
167
  var displayName: string;
158
168
  }
@@ -164,35 +174,253 @@ interface ChartLegendProps extends React.ComponentProps<typeof RechartsPrimitive
164
174
  nameKey?: string;
165
175
  }
166
176
  /**
167
- * ChartLegend displays a legend for the chart series.
177
+ * ChartLegend positions a legend inside a Recharts chart. Pass
178
+ * `content={<ChartLegendContent />}` to render it with DS styling.
179
+ *
180
+ * For a legend that lives *beside* a chart (next to a donut, or shared by
181
+ * several charts) compose {@link ChartLegendList} and {@link ChartLegendItem}
182
+ * directly instead — Recharts' Legend takes its room from the plot area.
168
183
  */
169
- declare function ChartLegend({ ...props }: ChartLegendProps): import("react/jsx-runtime").JSX.Element;
184
+ declare function ChartLegend({ ...props }: ChartLegendProps): React.JSX.Element;
170
185
  declare namespace ChartLegend {
171
186
  var displayName: string;
172
187
  }
188
+ /**
189
+ * Layout direction of a {@link ChartLegendList}.
190
+ */
191
+ type ChartLegendOrientation = "horizontal" | "vertical";
192
+ /**
193
+ * Scale of a {@link ChartLegendList} and its items.
194
+ * - `sm` — 12/16 text, 8px swatch: chart chrome, next to axis ticks and the tooltip.
195
+ * - `md` — 14/20 text, 10px swatch: a key read as content, beside a donut or under a report chart.
196
+ */
197
+ type ChartLegendSize = "sm" | "md";
198
+ /**
199
+ * Props for the ChartLegendItem component.
200
+ */
201
+ interface ChartLegendItemProps extends React.ComponentPropsWithoutRef<"div"> {
202
+ /**
203
+ * Data hook for automated testing (required)
204
+ * @example "sources-legend-google"
205
+ */
206
+ dataHook: string;
207
+ /**
208
+ * Key into the chart config. Resolves the swatch colour, the custom icon and
209
+ * the default label. Reads the config from the nearest `ChartContainer` or
210
+ * `ChartLegendList config={…}`; outside both, pass `color` and a label.
211
+ */
212
+ seriesKey?: string;
213
+ /**
214
+ * Swatch colour. Wins over the config colour — the way to colour an item
215
+ * that renders beside a chart rather than inside one.
216
+ * @example "var(--chart-blue)"
217
+ */
218
+ color?: string;
219
+ /**
220
+ * Hide the series icon from the config and draw the colour swatch instead.
221
+ * @default false
222
+ */
223
+ hideIcon?: boolean;
224
+ /**
225
+ * Trailing value (a count, a percentage), rendered in tabular figures and
226
+ * pushed to the far edge in a vertical list.
227
+ */
228
+ value?: React.ReactNode;
229
+ /**
230
+ * De-emphasised: the swatch dims and the text turns muted. The series is
231
+ * still drawn and still counts — it is just not what the reader is looking
232
+ * at (e.g. sources a filter has not chosen). Figma `Visibility=Muted`.
233
+ * @default false
234
+ */
235
+ muted?: boolean;
236
+ /**
237
+ * Switched off: the muted look plus a strike through the label (the value
238
+ * stays legible), so a hidden series reads as hidden in greyscale and in a
239
+ * screenshot — never by colour alone. The strike also reaches a nested
240
+ * button or link used as the label. Use it for a toggled-off series in an
241
+ * interactive legend. Wins over `muted`. Figma `Visibility=Hidden`.
242
+ * @default false
243
+ */
244
+ hidden?: boolean;
245
+ /**
246
+ * Render the child element instead of a `div`, merging the item's props
247
+ * into it — so the item can be a `PopoverTrigger` or a `<button
248
+ * aria-pressed>`. The child's own content becomes the label; the swatch
249
+ * and value are placed around it.
250
+ * @default false
251
+ */
252
+ asChild?: boolean;
253
+ /** Analytics element identifier */
254
+ trackingEl?: string;
255
+ /** Analytics label */
256
+ trackingLabel?: string;
257
+ /**
258
+ * The label. Defaults to the config label for `seriesKey`, then to the key
259
+ * itself. Required when `asChild` is set (it is the element to render).
260
+ */
261
+ children?: React.ReactNode;
262
+ }
263
+ /**
264
+ * One legend entry: a colour swatch (or the series icon), a label and an
265
+ * optional value. Composable — it renders inside a chart via
266
+ * {@link ChartLegendContent}, or anywhere else inside a
267
+ * {@link ChartLegendList}.
268
+ *
269
+ * @example
270
+ * ```tsx
271
+ * <ChartLegendList dataHook="sources-legend" orientation="vertical" config={config}>
272
+ * <ChartLegendItem dataHook="sources-legend-google" seriesKey="google" value={1240} />
273
+ * <ChartLegendItem dataHook="sources-legend-other" seriesKey="other" value={88} asChild>
274
+ * <PopoverTrigger>Other</PopoverTrigger>
275
+ * </ChartLegendItem>
276
+ * </ChartLegendList>
277
+ * ```
278
+ */
279
+ declare const ChartLegendItem: React.ForwardRefExoticComponent<ChartLegendItemProps & React.RefAttributes<HTMLDivElement>>;
280
+ /**
281
+ * Props for the ChartLegendList component.
282
+ */
283
+ interface ChartLegendListProps extends React.ComponentPropsWithoutRef<"div"> {
284
+ /**
285
+ * Data hook for automated testing (required)
286
+ * @example "sources-legend"
287
+ */
288
+ dataHook: string;
289
+ /**
290
+ * Layout direction. Horizontal wraps under or above a plot; vertical stacks
291
+ * beside a donut, label left and value right.
292
+ * @default "horizontal"
293
+ */
294
+ orientation?: ChartLegendOrientation;
295
+ /**
296
+ * Scale of the list and its items. `sm` matches the chart's axis ticks and
297
+ * tooltip; `md` is for a key read as content beside a donut or under a
298
+ * report chart (14px text, 10px swatch).
299
+ * @default "sm"
300
+ */
301
+ size?: ChartLegendSize;
302
+ /**
303
+ * Accessible name of the legend group.
304
+ * @default "Chart legend"
305
+ */
306
+ ariaLabel?: string;
307
+ /**
308
+ * Chart config for the items, when the list renders outside a
309
+ * `ChartContainer`. Replaces (does not merge with) a surrounding
310
+ * container's config. Give each key a `color` — a `theme` only resolves
311
+ * inside a container.
312
+ */
313
+ config?: ChartConfig;
314
+ /** Analytics element identifier */
315
+ trackingEl?: string;
316
+ /** Analytics label */
317
+ trackingLabel?: string;
318
+ }
319
+ /**
320
+ * A legend as a standalone list of {@link ChartLegendItem}s — the key beside
321
+ * a donut, a shared key under several charts, or a row of series toggles.
322
+ * {@link ChartLegendContent} renders one of these inside a chart.
323
+ *
324
+ * It is a labelled `role="group"`, not a list: the same container holds
325
+ * static keys and rows of toggle buttons, and a group with a name reads
326
+ * correctly for both ("Chart legend, group"). A static key therefore no
327
+ * longer announces its item count — accepted trade-off (DS-1026 review).
328
+ */
329
+ declare const ChartLegendList: React.ForwardRefExoticComponent<ChartLegendListProps & React.RefAttributes<HTMLDivElement>>;
330
+ /**
331
+ * One entry of the legend payload Recharts hands to `ChartLegend`'s content.
332
+ */
333
+ interface ChartLegendPayloadItem {
334
+ /** Display name — the series name for Bar/Line, the sector name for Pie. */
335
+ value: string;
336
+ /** Series key. Present for Bar/Line/Area series; Pie entries have none. */
337
+ dataKey?: string;
338
+ color?: string;
339
+ /** The series' or sector's raw datum. */
340
+ payload: Record<string, unknown>;
341
+ }
173
342
  /**
174
343
  * Props for the ChartLegendContent component.
175
344
  */
176
345
  interface ChartLegendContentProps extends React.ComponentProps<"div">, Pick<ChartLegendProps, "nameKey"> {
346
+ /**
347
+ * Data hook for automated testing. Items derive theirs from it
348
+ * (`<dataHook>-<entry key>`, where the entry key is the series `dataKey`,
349
+ * or the Pie entry's `nameKey` value, slugified).
350
+ * @default "chart-legend"
351
+ */
352
+ dataHook?: string;
177
353
  /** Hide the series icon in the legend */
178
354
  hideIcon?: boolean;
179
355
  /** Legend payload from Recharts (automatically provided) */
180
- payload?: Array<{
181
- value: string;
182
- dataKey: string;
183
- color?: string;
184
- payload: Record<string, unknown>;
185
- }>;
356
+ payload?: Array<ChartLegendPayloadItem>;
186
357
  /**
187
- * Vertical alignment of the legend relative to the chart
358
+ * Vertical alignment of the legend relative to the chart — sets the gap
359
+ * to the plot. Pass the same value to `ChartLegend`.
188
360
  * @default "bottom"
189
361
  */
190
- verticalAlign?: "top" | "bottom";
362
+ verticalAlign?: "top" | "middle" | "bottom";
363
+ /**
364
+ * Layout direction. Pair `vertical` with
365
+ * `<ChartLegend layout="vertical" align="right" verticalAlign="middle" />`.
366
+ * @default "horizontal"
367
+ */
368
+ orientation?: ChartLegendOrientation;
369
+ /**
370
+ * Accessible name of the legend group.
371
+ * @default "Chart legend"
372
+ */
373
+ ariaLabel?: string;
374
+ /**
375
+ * Scale of the legend. Keep `sm` inside a chart — it matches the axis
376
+ * ticks and the tooltip; `md` is for a key read as content.
377
+ * @default "sm"
378
+ */
379
+ size?: ChartLegendSize;
380
+ /**
381
+ * Show each entry's value after its label, read from `payload[valueKey]`.
382
+ * Meaningful for Pie/Donut, whose payload is the sector's datum — for Bar
383
+ * and Line series the payload carries no total, so render a
384
+ * `ChartLegendList` beside the chart with your own values instead.
385
+ * @default false
386
+ */
387
+ showValue?: boolean;
388
+ /**
389
+ * Field of each entry's datum that holds its value — for a Pie, its
390
+ * `dataKey` (e.g. `"visitors"`). Defaults to the series `dataKey`, then
391
+ * `"value"`.
392
+ */
393
+ valueKey?: string;
394
+ /**
395
+ * Formats the value shown by `showValue`. Receives the payload entry;
396
+ * read the number from `item.payload`.
397
+ * @example (item) => `${item.payload.visitors} visitors`
398
+ */
399
+ valueFormatter?: (item: ChartLegendPayloadItem) => React.ReactNode;
400
+ /**
401
+ * Order of the entries. Recharts sorts the payload alphabetically by
402
+ * default; pass the entry keys (series `dataKey`s, or Pie `nameKey`
403
+ * values) in the order the chart declares them, or a comparator. Keys not
404
+ * listed go last. Legend order should match series order and tooltip
405
+ * order.
406
+ * @example ["google", "facebook", "other"]
407
+ */
408
+ sortBy?: string[] | ((a: ChartLegendPayloadItem, b: ChartLegendPayloadItem) => number);
409
+ /**
410
+ * Replace the rendering of one entry — e.g. wrap "Other" in a popover
411
+ * trigger. Receives the entry and the default item. Recharts positions the
412
+ * legend inside the chart's box, so floating content opened from here can
413
+ * be clipped by it; for an interactive legend prefer a `ChartLegendList`
414
+ * beside the chart.
415
+ */
416
+ renderItem?: (item: ChartLegendPayloadItem, defaultNode: React.ReactNode) => React.ReactNode;
191
417
  }
192
418
  /**
193
- * ChartLegendContent renders the content inside the legend.
419
+ * ChartLegendContent renders Recharts' legend payload as a
420
+ * {@link ChartLegendList} of {@link ChartLegendItem}s. Use as
421
+ * `<ChartLegend content={<ChartLegendContent />} />`.
194
422
  */
195
- declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: ChartLegendContentProps): import("react/jsx-runtime").JSX.Element | null;
423
+ declare function ChartLegendContent({ ariaLabel, className, dataHook, hideIcon, nameKey, orientation, payload, renderItem, showValue, size, sortBy, valueFormatter, valueKey, verticalAlign, }: ChartLegendContentProps): React.JSX.Element | null;
196
424
  declare namespace ChartLegendContent {
197
425
  var displayName: string;
198
426
  }
@@ -244,7 +472,7 @@ interface ChartDotProps {
244
472
  /**
245
473
  * ChartDot renders a data-point marker for line/area/scatter charts.
246
474
  */
247
- declare function ChartDot({ size, custom, color, colorKey, cx, cy, stroke, fill, payload, }: ChartDotProps): import("react/jsx-runtime").JSX.Element | null;
475
+ declare function ChartDot({ size, custom, color, colorKey, cx, cy, stroke, fill, payload, }: ChartDotProps): React.JSX.Element | null;
248
476
  declare namespace ChartDot {
249
477
  var displayName: string;
250
478
  }
@@ -282,7 +510,7 @@ interface ChartDotOnStrokeProps {
282
510
  /**
283
511
  * ChartDotOnStroke renders a solid marker ringed with the background colour.
284
512
  */
285
- declare function ChartDotOnStroke({ size, color, colorKey, cx, cy, stroke, fill, payload, }: ChartDotOnStrokeProps): import("react/jsx-runtime").JSX.Element | null;
513
+ declare function ChartDotOnStroke({ size, color, colorKey, cx, cy, stroke, fill, payload, }: ChartDotOnStrokeProps): React.JSX.Element | null;
286
514
  declare namespace ChartDotOnStroke {
287
515
  var displayName: string;
288
516
  }
@@ -331,7 +559,7 @@ interface ChartRadarGridProps extends Omit<React.ComponentProps<typeof RechartsP
331
559
  /**
332
560
  * ChartRadarGrid renders a design-system polar grid for radar / radial charts.
333
561
  */
334
- declare function ChartRadarGrid({ type, filled, fillColor, fillOpacity, boundaryOnly, radialLines, className, ...props }: ChartRadarGridProps): import("react/jsx-runtime").JSX.Element;
562
+ declare function ChartRadarGrid({ type, filled, fillColor, fillOpacity, boundaryOnly, radialLines, className, ...props }: ChartRadarGridProps): React.JSX.Element;
335
563
  declare namespace ChartRadarGrid {
336
564
  var displayName: string;
337
565
  }
@@ -383,7 +611,7 @@ interface ChartRadarLabelWrapperProps {
383
611
  /**
384
612
  * ChartRadarLabelWrapper renders a one- or two-line polar axis tick label.
385
613
  */
386
- declare function ChartRadarLabelWrapper({ type, data, primaryKey, secondaryKey, x, y, textAnchor, payload, index, }: ChartRadarLabelWrapperProps): import("react/jsx-runtime").JSX.Element;
614
+ declare function ChartRadarLabelWrapper({ type, data, primaryKey, secondaryKey, x, y, textAnchor, payload, index, }: ChartRadarLabelWrapperProps): React.JSX.Element;
387
615
  declare namespace ChartRadarLabelWrapper {
388
616
  var displayName: string;
389
617
  }
@@ -422,7 +650,7 @@ interface ChartPieLabelListProps {
422
650
  /**
423
651
  * ChartPieLabelList renders a category-name label inside a pie slice.
424
652
  */
425
- declare function ChartPieLabelList({ nameKey, config, radiusRatio, cx, cy, midAngle, innerRadius, outerRadius, payload, name, }: ChartPieLabelListProps): import("react/jsx-runtime").JSX.Element | null;
653
+ declare function ChartPieLabelList({ nameKey, config, radiusRatio, cx, cy, midAngle, innerRadius, outerRadius, payload, name, }: ChartPieLabelListProps): React.JSX.Element | null;
426
654
  declare namespace ChartPieLabelList {
427
655
  var displayName: string;
428
656
  }
@@ -450,7 +678,7 @@ interface ChartPieLabelWrapperProps {
450
678
  /**
451
679
  * ChartPieLabelWrapper renders a value label outside a pie slice.
452
680
  */
453
- declare function ChartPieLabelWrapper({ valueKey, x, y, textAnchor, payload, value, }: ChartPieLabelWrapperProps): import("react/jsx-runtime").JSX.Element | null;
681
+ declare function ChartPieLabelWrapper({ valueKey, x, y, textAnchor, payload, value, }: ChartPieLabelWrapperProps): React.JSX.Element | null;
454
682
  declare namespace ChartPieLabelWrapper {
455
683
  var displayName: string;
456
684
  }
@@ -480,12 +708,12 @@ interface ChartCenterLabelProps {
480
708
  * The primary value is a KPI figure in the `text-metric` type-scale style;
481
709
  * `size` scales the figure.
482
710
  */
483
- declare function ChartCenterLabel({ primary, secondary, size, viewBox, }: ChartCenterLabelProps): import("react/jsx-runtime").JSX.Element | null;
711
+ declare function ChartCenterLabel({ primary, secondary, size, viewBox, }: ChartCenterLabelProps): React.JSX.Element | null;
484
712
  declare namespace ChartCenterLabel {
485
713
  var displayName: string;
486
714
  }
487
- export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, ChartDot, ChartDotOnStroke, ChartRadarGrid, ChartRadarLabelWrapper, ChartPieLabelList, ChartPieLabelWrapper, ChartCenterLabel, };
488
- export type { ChartContainerProps, ChartTooltipProps, ChartTooltipContentProps, ChartTooltipPayloadItem, ChartLegendProps, ChartLegendContentProps, ChartDotProps, ChartDotOnStrokeProps, ChartDotSize, ChartDotOnStrokeSize, ChartRadarGridProps, ChartRadarGridType, ChartRadarLabelWrapperProps, ChartRadarLabelWrapperType, ChartPieLabelListProps, ChartPieLabelWrapperProps, ChartCenterLabelProps, ChartCenterLabelSize, };
715
+ export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartLegendList, ChartLegendItem, ChartStyle, ChartDot, ChartDotOnStroke, ChartRadarGrid, ChartRadarLabelWrapper, ChartPieLabelList, ChartPieLabelWrapper, ChartCenterLabel, };
716
+ export type { ChartContainerProps, ChartTooltipProps, ChartTooltipContentProps, ChartTooltipPayloadItem, ChartLegendProps, ChartLegendContentProps, ChartLegendListProps, ChartLegendItemProps, ChartLegendOrientation, ChartLegendPayloadItem, ChartLegendSize, ChartDotProps, ChartDotOnStrokeProps, ChartDotSize, ChartDotOnStrokeSize, ChartRadarGridProps, ChartRadarGridType, ChartRadarLabelWrapperProps, ChartRadarLabelWrapperType, ChartPieLabelListProps, ChartPieLabelWrapperProps, ChartCenterLabelProps, ChartCenterLabelSize, };
489
717
  export { ChartEmpty } from './chart-empty';
490
718
  export type { ChartEmptyProps } from './chart-empty';
491
719
  export { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, Customized, Label as ChartLabel, LabelList, Legend as ChartsLegend, Line, LineChart, Pie, PieChart, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart, RadialBar, RadialBarChart, Rectangle, ReferenceLine, ResponsiveContainer, Sector, Tooltip as ChartsTooltip, XAxis, YAxis, } from 'recharts';