@techsio/ui-kit 0.57.0 → 0.59.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 (346) hide show
  1. package/README.md +128 -133
  2. package/dist/atoms/action-icon.js +9 -8
  3. package/dist/atoms/button.js +114 -18
  4. package/dist/atoms/checkbox.js +77 -17
  5. package/dist/atoms/hotkeys.js +26 -7
  6. package/dist/atoms/icon.js +5 -5
  7. package/dist/atoms/image.js +118 -3
  8. package/dist/atoms/input.js +57 -9
  9. package/dist/atoms/label.js +13 -4
  10. package/dist/atoms/link-button.js +15 -12
  11. package/dist/atoms/link.js +18 -4
  12. package/dist/atoms/numeric-input.js +362 -84
  13. package/dist/atoms/rating.js +306 -73
  14. package/dist/atoms/skeleton.js +18 -14
  15. package/dist/atoms/status-text.js +31 -18
  16. package/dist/atoms/textarea.js +59 -12
  17. package/dist/atoms/tooltip.js +64 -43
  18. package/dist/hotkeys.js +1 -0
  19. package/dist/internal/choice-control.js +173 -0
  20. package/dist/internal/combobox-query-sync.js +11 -0
  21. package/dist/internal/date-picker-coordinator.js +56 -40
  22. package/dist/internal/date-picker-dom.js +44 -0
  23. package/dist/internal/date-picker-input.js +30 -0
  24. package/dist/internal/described-by.js +23 -18
  25. package/dist/internal/form-control-lifecycle.js +122 -0
  26. package/dist/internal/molecules/command.context.js +1 -0
  27. package/dist/internal/molecules/drawer.context.js +1 -0
  28. package/dist/internal/molecules/vertical-navigation.context.js +1 -0
  29. package/dist/internal/molecules/vertical-navigation.styles.js +9 -2
  30. package/dist/internal/numeric-input-editing.js +87 -0
  31. package/dist/internal/organisms/sidebar.context.js +1 -0
  32. package/dist/internal/organisms/sidebar.focus.js +1 -0
  33. package/dist/internal/overlay-portal.js +72 -0
  34. package/dist/internal/reduced-motion.js +1 -0
  35. package/dist/internal/use-effective-disabled.js +8 -0
  36. package/dist/molecules/accordion.js +44 -30
  37. package/dist/molecules/availability-status.js +1 -0
  38. package/dist/molecules/breadcrumb.js +11 -11
  39. package/dist/molecules/carousel.js +279 -97
  40. package/dist/molecules/cascade-select.js +327 -81
  41. package/dist/molecules/chart.js +427 -78
  42. package/dist/molecules/color-select.js +181 -62
  43. package/dist/molecules/combobox.js +537 -182
  44. package/dist/molecules/command.js +2 -1
  45. package/dist/molecules/date-picker.js +629 -119
  46. package/dist/molecules/dialog.js +89 -48
  47. package/dist/molecules/drawer.js +63 -6
  48. package/dist/molecules/file-upload.js +373 -37
  49. package/dist/molecules/form-checkbox.js +65 -22
  50. package/dist/molecules/form-error-summary.js +29 -5
  51. package/dist/molecules/form-input.js +26 -30
  52. package/dist/molecules/form-numeric-input.js +11 -9
  53. package/dist/molecules/form-textarea.js +26 -23
  54. package/dist/molecules/menu.js +170 -47
  55. package/dist/molecules/pagination.js +100 -28
  56. package/dist/molecules/phone-input.js +172 -37
  57. package/dist/molecules/popover.js +53 -26
  58. package/dist/molecules/price-block.js +1 -0
  59. package/dist/molecules/product-card.js +85 -23
  60. package/dist/molecules/quantity-field.js +4 -2
  61. package/dist/molecules/radio-card.js +102 -30
  62. package/dist/molecules/radio-group.js +108 -31
  63. package/dist/molecules/search-form.js +116 -13
  64. package/dist/molecules/select.js +226 -81
  65. package/dist/molecules/slider.js +141 -30
  66. package/dist/molecules/steps.js +181 -50
  67. package/dist/molecules/switch.js +86 -20
  68. package/dist/molecules/tabs.js +227 -31
  69. package/dist/molecules/toast.js +155 -53
  70. package/dist/molecules/totals-summary.js +2 -1
  71. package/dist/molecules/tour.js +9 -5
  72. package/dist/molecules/tree-view.js +255 -109
  73. package/dist/molecules/vertical-navigation.js +8 -4
  74. package/dist/organisms/data-table.fields.js +26 -5
  75. package/dist/organisms/data-table.helpers.js +6 -2
  76. package/dist/organisms/data-table.js +587 -154
  77. package/dist/organisms/footer.js +18 -11
  78. package/dist/organisms/gallery.js +61 -24
  79. package/dist/organisms/header.js +106 -32
  80. package/dist/organisms/line-item.js +1 -0
  81. package/dist/organisms/sidebar.js +1 -0
  82. package/dist/organisms/table.js +22 -7
  83. package/dist/src/atoms/action-icon.d.ts +10 -10
  84. package/dist/src/atoms/action-icon.d.ts.map +1 -1
  85. package/dist/src/atoms/badge.d.ts +3 -3
  86. package/dist/src/atoms/badge.d.ts.map +1 -1
  87. package/dist/src/atoms/button.d.ts +47 -24
  88. package/dist/src/atoms/button.d.ts.map +1 -1
  89. package/dist/src/atoms/checkbox.d.ts +6 -5
  90. package/dist/src/atoms/checkbox.d.ts.map +1 -1
  91. package/dist/src/atoms/hotkeys.d.ts +3 -2
  92. package/dist/src/atoms/hotkeys.d.ts.map +1 -1
  93. package/dist/src/atoms/icon.d.ts +18 -17
  94. package/dist/src/atoms/icon.d.ts.map +1 -1
  95. package/dist/src/atoms/image.d.ts +38 -7
  96. package/dist/src/atoms/image.d.ts.map +1 -1
  97. package/dist/src/atoms/input.d.ts +23 -14
  98. package/dist/src/atoms/input.d.ts.map +1 -1
  99. package/dist/src/atoms/label.d.ts +4 -4
  100. package/dist/src/atoms/label.d.ts.map +1 -1
  101. package/dist/src/atoms/link-button.d.ts +78 -31
  102. package/dist/src/atoms/link-button.d.ts.map +1 -1
  103. package/dist/src/atoms/link.d.ts +30 -9
  104. package/dist/src/atoms/link.d.ts.map +1 -1
  105. package/dist/src/atoms/numeric-input.d.ts +24 -19
  106. package/dist/src/atoms/numeric-input.d.ts.map +1 -1
  107. package/dist/src/atoms/rating.d.ts +54 -26
  108. package/dist/src/atoms/rating.d.ts.map +1 -1
  109. package/dist/src/atoms/skeleton.d.ts +9 -9
  110. package/dist/src/atoms/skeleton.d.ts.map +1 -1
  111. package/dist/src/atoms/status-text.d.ts +21 -13
  112. package/dist/src/atoms/status-text.d.ts.map +1 -1
  113. package/dist/src/atoms/textarea.d.ts +22 -20
  114. package/dist/src/atoms/textarea.d.ts.map +1 -1
  115. package/dist/src/atoms/tooltip.d.ts +5 -5
  116. package/dist/src/atoms/tooltip.d.ts.map +1 -1
  117. package/dist/src/hotkeys.d.ts +1 -1
  118. package/dist/src/hotkeys.d.ts.map +1 -1
  119. package/dist/src/internal/choice-control.d.ts +18 -0
  120. package/dist/src/internal/choice-control.d.ts.map +1 -0
  121. package/dist/src/internal/combobox-query-sync.d.ts +4 -0
  122. package/dist/src/internal/combobox-query-sync.d.ts.map +1 -0
  123. package/dist/src/internal/date-picker-coordinator.d.ts +7 -1
  124. package/dist/src/internal/date-picker-coordinator.d.ts.map +1 -1
  125. package/dist/src/internal/date-picker-dom.d.ts +10 -0
  126. package/dist/src/internal/date-picker-dom.d.ts.map +1 -0
  127. package/dist/src/internal/date-picker-input.d.ts +7 -0
  128. package/dist/src/internal/date-picker-input.d.ts.map +1 -0
  129. package/dist/src/internal/described-by.d.ts +7 -1
  130. package/dist/src/internal/described-by.d.ts.map +1 -1
  131. package/dist/src/internal/form-control-lifecycle.d.ts +22 -0
  132. package/dist/src/internal/form-control-lifecycle.d.ts.map +1 -0
  133. package/dist/src/internal/molecules/vertical-navigation.context.d.ts +1 -1
  134. package/dist/src/internal/molecules/vertical-navigation.context.d.ts.map +1 -1
  135. package/dist/src/internal/molecules/vertical-navigation.styles.d.ts +21 -0
  136. package/dist/src/internal/molecules/vertical-navigation.styles.d.ts.map +1 -1
  137. package/dist/src/internal/numeric-input-editing.d.ts +13 -0
  138. package/dist/src/internal/numeric-input-editing.d.ts.map +1 -0
  139. package/dist/src/internal/overlay-portal.d.ts +18 -0
  140. package/dist/src/internal/overlay-portal.d.ts.map +1 -0
  141. package/dist/src/internal/use-effective-disabled.d.ts +4 -0
  142. package/dist/src/internal/use-effective-disabled.d.ts.map +1 -0
  143. package/dist/src/molecules/accordion.d.ts +25 -19
  144. package/dist/src/molecules/accordion.d.ts.map +1 -1
  145. package/dist/src/molecules/availability-status.d.ts +4 -1
  146. package/dist/src/molecules/availability-status.d.ts.map +1 -1
  147. package/dist/src/molecules/breadcrumb.d.ts +2 -2
  148. package/dist/src/molecules/breadcrumb.d.ts.map +1 -1
  149. package/dist/src/molecules/carousel.d.ts +51 -52
  150. package/dist/src/molecules/carousel.d.ts.map +1 -1
  151. package/dist/src/molecules/cascade-select.d.ts +23 -8
  152. package/dist/src/molecules/cascade-select.d.ts.map +1 -1
  153. package/dist/src/molecules/chart.d.ts +18 -1
  154. package/dist/src/molecules/chart.d.ts.map +1 -1
  155. package/dist/src/molecules/color-select.d.ts +19 -3
  156. package/dist/src/molecules/color-select.d.ts.map +1 -1
  157. package/dist/src/molecules/combobox.d.ts +27 -5
  158. package/dist/src/molecules/combobox.d.ts.map +1 -1
  159. package/dist/src/molecules/command.d.ts +1 -1
  160. package/dist/src/molecules/date-picker.d.ts +30 -4
  161. package/dist/src/molecules/date-picker.d.ts.map +1 -1
  162. package/dist/src/molecules/dialog.d.ts +17 -4
  163. package/dist/src/molecules/dialog.d.ts.map +1 -1
  164. package/dist/src/molecules/drawer.d.ts +4 -4
  165. package/dist/src/molecules/drawer.d.ts.map +1 -1
  166. package/dist/src/molecules/file-upload.d.ts +11 -6
  167. package/dist/src/molecules/file-upload.d.ts.map +1 -1
  168. package/dist/src/molecules/form-checkbox.d.ts +7 -2
  169. package/dist/src/molecules/form-checkbox.d.ts.map +1 -1
  170. package/dist/src/molecules/form-error-summary.d.ts +4 -3
  171. package/dist/src/molecules/form-error-summary.d.ts.map +1 -1
  172. package/dist/src/molecules/form-input.d.ts +5 -6
  173. package/dist/src/molecules/form-input.d.ts.map +1 -1
  174. package/dist/src/molecules/form-numeric-input.d.ts +5 -5
  175. package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
  176. package/dist/src/molecules/form-textarea.d.ts +5 -6
  177. package/dist/src/molecules/form-textarea.d.ts.map +1 -1
  178. package/dist/src/molecules/menu.d.ts +17 -3
  179. package/dist/src/molecules/menu.d.ts.map +1 -1
  180. package/dist/src/molecules/pagination.d.ts +1 -1
  181. package/dist/src/molecules/pagination.d.ts.map +1 -1
  182. package/dist/src/molecules/phone-input.d.ts +4 -1
  183. package/dist/src/molecules/phone-input.d.ts.map +1 -1
  184. package/dist/src/molecules/popover.d.ts +7 -1
  185. package/dist/src/molecules/popover.d.ts.map +1 -1
  186. package/dist/src/molecules/price-block.d.ts +1 -1
  187. package/dist/src/molecules/price-block.d.ts.map +1 -1
  188. package/dist/src/molecules/product-card.d.ts +127 -27
  189. package/dist/src/molecules/product-card.d.ts.map +1 -1
  190. package/dist/src/molecules/quantity-field.d.ts +1 -1
  191. package/dist/src/molecules/quantity-field.d.ts.map +1 -1
  192. package/dist/src/molecules/radio-card.d.ts +10 -3
  193. package/dist/src/molecules/radio-card.d.ts.map +1 -1
  194. package/dist/src/molecules/radio-group.d.ts +15 -6
  195. package/dist/src/molecules/radio-group.d.ts.map +1 -1
  196. package/dist/src/molecules/search-form.d.ts +37 -12
  197. package/dist/src/molecules/search-form.d.ts.map +1 -1
  198. package/dist/src/molecules/select.d.ts +34 -29
  199. package/dist/src/molecules/select.d.ts.map +1 -1
  200. package/dist/src/molecules/slider.d.ts +23 -2
  201. package/dist/src/molecules/slider.d.ts.map +1 -1
  202. package/dist/src/molecules/steps.d.ts +30 -10
  203. package/dist/src/molecules/steps.d.ts.map +1 -1
  204. package/dist/src/molecules/switch.d.ts +54 -33
  205. package/dist/src/molecules/switch.d.ts.map +1 -1
  206. package/dist/src/molecules/tabs.d.ts +11 -11
  207. package/dist/src/molecules/tabs.d.ts.map +1 -1
  208. package/dist/src/molecules/toast.d.ts +38 -14
  209. package/dist/src/molecules/toast.d.ts.map +1 -1
  210. package/dist/src/molecules/totals-summary.d.ts +1 -1
  211. package/dist/src/molecules/totals-summary.d.ts.map +1 -1
  212. package/dist/src/molecules/tour.d.ts +1 -1
  213. package/dist/src/molecules/tour.d.ts.map +1 -1
  214. package/dist/src/molecules/tree-view.d.ts +16 -20
  215. package/dist/src/molecules/tree-view.d.ts.map +1 -1
  216. package/dist/src/molecules/vertical-navigation.d.ts +2 -2
  217. package/dist/src/molecules/vertical-navigation.d.ts.map +1 -1
  218. package/dist/src/organisms/data-table.d.ts +28 -3
  219. package/dist/src/organisms/data-table.d.ts.map +1 -1
  220. package/dist/src/organisms/data-table.fields.d.ts +4 -1
  221. package/dist/src/organisms/data-table.fields.d.ts.map +1 -1
  222. package/dist/src/organisms/data-table.helpers.d.ts +5 -12
  223. package/dist/src/organisms/data-table.helpers.d.ts.map +1 -1
  224. package/dist/src/organisms/footer.d.ts +5 -5
  225. package/dist/src/organisms/footer.d.ts.map +1 -1
  226. package/dist/src/organisms/gallery.d.ts +11 -9
  227. package/dist/src/organisms/gallery.d.ts.map +1 -1
  228. package/dist/src/organisms/header.d.ts +24 -22
  229. package/dist/src/organisms/header.d.ts.map +1 -1
  230. package/dist/src/organisms/table.d.ts +14 -14
  231. package/dist/src/organisms/table.d.ts.map +1 -1
  232. package/dist/src/templates/accordion.d.ts +8 -6
  233. package/dist/src/templates/accordion.d.ts.map +1 -1
  234. package/dist/src/templates/breadcrumb.d.ts +1 -1
  235. package/dist/src/templates/breadcrumb.d.ts.map +1 -1
  236. package/dist/src/templates/carousel.d.ts +3 -3
  237. package/dist/src/templates/carousel.d.ts.map +1 -1
  238. package/dist/src/templates/facet-filter-panel.d.ts +9 -3
  239. package/dist/src/templates/facet-filter-panel.d.ts.map +1 -1
  240. package/dist/src/templates/gallery.d.ts +2 -2
  241. package/dist/src/templates/gallery.d.ts.map +1 -1
  242. package/dist/src/templates/numeric-input.d.ts +1 -1
  243. package/dist/src/templates/numeric-input.d.ts.map +1 -1
  244. package/dist/src/templates/popover.d.ts +4 -2
  245. package/dist/src/templates/popover.d.ts.map +1 -1
  246. package/dist/src/templates/product-card.d.ts +12 -4
  247. package/dist/src/templates/product-card.d.ts.map +1 -1
  248. package/dist/src/templates/search-suggestions.d.ts +1 -1
  249. package/dist/src/templates/select.d.ts +7 -2
  250. package/dist/src/templates/select.d.ts.map +1 -1
  251. package/dist/src/templates/tabs.d.ts +8 -7
  252. package/dist/src/templates/tabs.d.ts.map +1 -1
  253. package/dist/src/theme/theme-config.d.ts +9 -16
  254. package/dist/src/theme/theme-config.d.ts.map +1 -1
  255. package/dist/src/theme/theme-provider.d.ts +16 -21
  256. package/dist/src/theme/theme-provider.d.ts.map +1 -1
  257. package/dist/src/theme/theme-toggle.d.ts.map +1 -1
  258. package/dist/src/utils.d.ts.map +1 -1
  259. package/dist/templates/accordion.js +3 -1
  260. package/dist/templates/breadcrumb.js +11 -4
  261. package/dist/templates/carousel.js +3 -6
  262. package/dist/templates/facet-filter-panel.js +121 -52
  263. package/dist/templates/gallery.js +6 -2
  264. package/dist/templates/numeric-input.js +6 -1
  265. package/dist/templates/popover.js +6 -1
  266. package/dist/templates/product-card.js +52 -26
  267. package/dist/templates/select.js +6 -1
  268. package/dist/templates/tabs.js +4 -2
  269. package/dist/theme/theme-config.js +8 -16
  270. package/dist/theme/theme-provider.js +89 -63
  271. package/dist/theme/theme-toggle.js +17 -9
  272. package/dist/utils.js +11 -1
  273. package/package.json +9 -5
  274. package/src/tokens/_base.css +4 -3
  275. package/src/tokens/_business-atoms.css +96 -0
  276. package/src/tokens/_foundation-overrides.css +251 -0
  277. package/src/tokens/_reset.css +10 -10
  278. package/src/tokens/_scheme-scopes.css +4194 -0
  279. package/src/tokens/_semantic.css +1 -23
  280. package/src/tokens/_tokens-base.css +36 -32
  281. package/src/tokens/_typography.css +2 -1
  282. package/src/tokens/components/_form-control.css +149 -6
  283. package/src/tokens/components/_popup-surface.css +15 -29
  284. package/src/tokens/components/atoms/_action-icon.css +49 -0
  285. package/src/tokens/components/atoms/_button.css +77 -0
  286. package/src/tokens/components/atoms/_checkbox.css +47 -4
  287. package/src/tokens/components/atoms/_hotkeys.css +2 -0
  288. package/src/tokens/components/atoms/_icon.css +60 -7
  289. package/src/tokens/components/atoms/_image.css +18 -0
  290. package/src/tokens/components/atoms/_input.css +20 -0
  291. package/src/tokens/components/atoms/_label.css +3 -7
  292. package/src/tokens/components/atoms/_link.css +47 -5
  293. package/src/tokens/components/atoms/_numeric-input.css +121 -2
  294. package/src/tokens/components/atoms/_rating.css +55 -6
  295. package/src/tokens/components/atoms/_skeleton.css +12 -2
  296. package/src/tokens/components/atoms/_status-text.css +35 -5
  297. package/src/tokens/components/atoms/_textarea.css +32 -3
  298. package/src/tokens/components/atoms/_tooltip.css +25 -0
  299. package/src/tokens/components/molecules/_accordion.css +46 -5
  300. package/src/tokens/components/molecules/_breadcrumb.css +15 -4
  301. package/src/tokens/components/molecules/_carousel.css +67 -0
  302. package/src/tokens/components/molecules/_cascade-select.css +104 -0
  303. package/src/tokens/components/molecules/_chart.css +32 -16
  304. package/src/tokens/components/molecules/_color-select.css +21 -0
  305. package/src/tokens/components/molecules/_combobox.css +81 -0
  306. package/src/tokens/components/molecules/_command.css +1 -0
  307. package/src/tokens/components/molecules/_date-picker.css +66 -10
  308. package/src/tokens/components/molecules/_dialog.css +36 -4
  309. package/src/tokens/components/molecules/_drawer.css +39 -3
  310. package/src/tokens/components/molecules/_file-upload.css +16 -1
  311. package/src/tokens/components/molecules/_menu.css +17 -0
  312. package/src/tokens/components/molecules/_pagination.css +19 -0
  313. package/src/tokens/components/molecules/_phone-input.css +20 -5
  314. package/src/tokens/components/molecules/_popover.css +34 -0
  315. package/src/tokens/components/molecules/_product-card.css +70 -0
  316. package/src/tokens/components/molecules/_radio-card.css +35 -0
  317. package/src/tokens/components/molecules/_radio-group.css +8 -0
  318. package/src/tokens/components/molecules/_select.css +33 -0
  319. package/src/tokens/components/molecules/_slider.css +5 -0
  320. package/src/tokens/components/molecules/_steps.css +52 -0
  321. package/src/tokens/components/molecules/_switch.css +59 -10
  322. package/src/tokens/components/molecules/_tabs.css +61 -3
  323. package/src/tokens/components/molecules/_toast.css +60 -0
  324. package/src/tokens/components/molecules/_totals-summary.css +22 -22
  325. package/src/tokens/components/molecules/_tour.css +16 -1
  326. package/src/tokens/components/molecules/_tree-view.css +27 -3
  327. package/src/tokens/components/molecules/_vertical-navigation.css +21 -3
  328. package/src/tokens/components/organisms/_data-table.css +97 -0
  329. package/src/tokens/components/organisms/_footer.css +9 -0
  330. package/src/tokens/components/organisms/_gallery.css +11 -0
  331. package/src/tokens/components/organisms/_header.css +22 -0
  332. package/src/tokens/components/organisms/_sidebar.css +1 -1
  333. package/src/tokens/components/organisms/_table.css +31 -0
  334. package/src/tokens/components/templates/_facet-filter-panel.css +11 -1
  335. package/src/tokens/figma/akros/variables.css +15 -6
  336. package/src/tokens/figma/brand-overrides.css +171 -57
  337. package/src/tokens/figma/business/variables.css +15 -6
  338. package/src/tokens/figma/cyber/variables.css +115 -38
  339. package/src/tokens/figma/cyber-dark/variables.css +115 -38
  340. package/src/tokens/figma/dark/variables.css +13 -4
  341. package/src/tokens/figma/light/variables.css +62 -49
  342. package/src/tokens/figma/{neo → n1}/variables.css +123 -114
  343. package/src/tokens/figma/variables.css +658 -249
  344. package/src/tokens/theme.css +24 -4
  345. package/src/tokens/_colors.css +0 -5
  346. package/src/tokens/figma/neo-dark/variables.css +0 -457
@@ -1,5 +1,6 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { areaY, barX, barY, colorLegend, d3Curve, dot, group, lineY, stack } from "@tanstack/charts";
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { areaY, barX, barY, colorLegend, colorLegendItems, d3Curve, dot, group, lineY, stack } from "@tanstack/charts";
3
4
  import { polar, radialArc } from "@tanstack/charts/polar";
4
5
  import { Chart } from "@tanstack/charts/react";
5
6
  import { scaleBand } from "@tanstack/charts/scales/band";
@@ -9,13 +10,19 @@ import { renderChartSvg } from "@tanstack/charts/svg";
9
10
  import { tooltip as tooltip_tooltip } from "@tanstack/charts/tooltip";
10
11
  import { scaleUtc } from "d3-scale";
11
12
  import { curveMonotoneX, pie } from "d3-shape";
12
- import { useMemo } from "react";
13
+ import { useMemo, useRef, useState } from "react";
13
14
  import { usePrefersReducedMotion } from "../internal/reduced-motion.js";
14
15
  import { tv } from "../utils.js";
15
16
  const chartVariants = tv({
16
17
  slots: {
17
18
  root: "chart-base block w-full text-chart-fg",
18
- tooltip: "chart-tooltip"
19
+ tooltip: "chart-tooltip popup-layer!",
20
+ alternative: "overflow-auto text-chart-data text-chart-fg",
21
+ summary: "cursor-pointer rounded-chart-tooltip focus-visible:outline-chart-fg",
22
+ cell: "border-chart-tooltip-border border-b p-chart-cell text-start",
23
+ legend: "flex flex-wrap gap-chart-legend text-chart-data text-chart-fg",
24
+ legendItem: "inline-flex items-center gap-chart-item",
25
+ fallback: "p-chart-fallback text-chart-data text-chart-fg"
19
26
  }
20
27
  });
21
28
  const SERIES_1_PAINT = "var(--color-chart-series-1)";
@@ -26,27 +33,114 @@ function toAccessor(accessor) {
26
33
  if ("function" == typeof accessor) return accessor;
27
34
  return (datum)=>datum[accessor];
28
35
  }
36
+ const READABLE_TICK_LABELS = {
37
+ fontSize: 14,
38
+ opacity: 1
39
+ };
29
40
  const MAX_SERIES = 6;
41
+ const LINE_DASHES = [
42
+ "",
43
+ "8 4",
44
+ "2 4",
45
+ "8 4 2 4",
46
+ "12 4",
47
+ "4 4"
48
+ ];
49
+ const TOOLTIP_GAP = 12;
50
+ const TOOLTIP_EDGE = 8;
51
+ let tooltipMeasureContext;
52
+ function validLocale(locale) {
53
+ if (null == locale) return;
54
+ try {
55
+ Intl.getCanonicalLocales(locale);
56
+ return locale;
57
+ } catch {
58
+ return;
59
+ }
60
+ }
61
+ function tooltipTextWidth(text, weight) {
62
+ if (null == tooltipMeasureContext && "u" > typeof document) tooltipMeasureContext = document.createElement("canvas").getContext?.("2d") ?? false;
63
+ if (!tooltipMeasureContext) return 8.5 * text.length;
64
+ tooltipMeasureContext.font = `${weight} 15px system-ui, sans-serif`;
65
+ return 1.08 * tooltipMeasureContext.measureText(text).width;
66
+ }
67
+ function estimateTooltipSize(content) {
68
+ const titleWidth = content.title ? tooltipTextWidth(content.title, 650) : 0;
69
+ const rowWidth = Math.max(0, ...content.rows.map((row)=>40 + tooltipTextWidth(row.label, 500) + tooltipTextWidth(row.value, 600)));
70
+ return {
71
+ width: Math.ceil(Math.max(titleWidth, rowWidth) + 34),
72
+ height: Math.ceil(30 + (content.title ? 26 : 0) + 24 * content.rows.length)
73
+ };
74
+ }
75
+ function chartTooltipCorner(content, points, context, horizontal) {
76
+ const first = points[0];
77
+ if (!first) return null;
78
+ const { width, height } = estimateTooltipSize(content);
79
+ const { surface } = context;
80
+ const xs = points.map((point)=>point.x);
81
+ const ys = points.map((point)=>point.y);
82
+ const categoryScale = context.scales[horizontal ? "y" : "x"];
83
+ const band = categoryScale?.bandwidth ?? 0;
84
+ const bandStart = categoryScale && band > 0 ? categoryScale.map(horizontal ? first.yValue : first.xValue) : 0 / 0;
85
+ const hasBand = Number.isFinite(bandStart);
86
+ if (horizontal) {
87
+ const top = hasBand ? bandStart : Math.min(...ys);
88
+ const bottom = hasBand ? bandStart + band : Math.max(...ys);
89
+ const end = Math.max(...xs);
90
+ if (end + TOOLTIP_GAP + width + TOOLTIP_EDGE <= surface.width) return {
91
+ x: end + TOOLTIP_GAP,
92
+ y: (top + bottom - height) / 2
93
+ };
94
+ if (top - TOOLTIP_GAP - height >= TOOLTIP_EDGE) return {
95
+ x: end - width,
96
+ y: top - TOOLTIP_GAP - height
97
+ };
98
+ return {
99
+ x: end - width,
100
+ y: bottom + TOOLTIP_GAP
101
+ };
102
+ }
103
+ const left = hasBand ? bandStart : Math.min(...xs);
104
+ const right = hasBand ? bandStart + band : Math.max(...xs);
105
+ const top = Math.min(...ys);
106
+ const center = (left + right) / 2;
107
+ if (top - TOOLTIP_GAP - height >= TOOLTIP_EDGE) return {
108
+ x: center - width / 2,
109
+ y: top - TOOLTIP_GAP - height
110
+ };
111
+ const y = Math.max(TOOLTIP_EDGE, top);
112
+ if (right + TOOLTIP_GAP + width + TOOLTIP_EDGE <= surface.width) return {
113
+ x: right + TOOLTIP_GAP,
114
+ y
115
+ };
116
+ return {
117
+ x: left - TOOLTIP_GAP - width,
118
+ y
119
+ };
120
+ }
30
121
  function resolveXAxis(data, getX, xLabel) {
31
122
  const values = data.map(getX);
32
123
  if (values.length > 0 && values.every((value)=>value instanceof Date)) return {
33
124
  scale: ()=>scaleUtc(),
34
125
  nice: true,
35
126
  axis: {
36
- label: xLabel
127
+ label: xLabel,
128
+ tickLabels: READABLE_TICK_LABELS
37
129
  }
38
130
  };
39
131
  if (values.length > 0 && values.every((value)=>"number" == typeof value)) return {
40
132
  scale: scaleLinear,
41
133
  nice: true,
42
134
  axis: {
43
- label: xLabel
135
+ label: xLabel,
136
+ tickLabels: READABLE_TICK_LABELS
44
137
  }
45
138
  };
46
139
  return {
47
140
  scale: ()=>scalePoint().padding(0.1),
48
141
  axis: {
49
- label: xLabel
142
+ label: xLabel,
143
+ tickLabels: READABLE_TICK_LABELS
50
144
  }
51
145
  };
52
146
  }
@@ -57,72 +151,101 @@ function resolveBuild(config) {
57
151
  const isPolar = "pie" === config.type || "donut" === config.type;
58
152
  const showLegend = config.legend ?? (null != config.series || isPolar);
59
153
  const { formatValue } = config;
60
- const valueTicks = formatValue ? {
154
+ const valueTicks = {
61
155
  format: formatValue
62
- } : void 0;
156
+ };
63
157
  warnOnSeriesOverflow(config.data, isPolar ? getX : getSeries);
64
158
  const tooltipBase = {
65
159
  use: tooltip_tooltip,
66
160
  className: config.tooltipClassName
67
161
  };
68
- const channelName = (accessor, label)=>label ?? ("string" == typeof accessor ? accessor : void 0);
69
- const xName = channelName(config.x, config.xLabel);
70
- const yName = channelName(config.y, config.yLabel);
71
- const formatChannel = (point, channel)=>{
72
- const value = "x" === channel ? point.xValue : point.yValue;
73
- if ("number" == typeof value && formatValue) return formatValue(value);
74
- return String(value ?? "");
162
+ const locale = validLocale(config.locale);
163
+ const numberFormat = locale ? new Intl.NumberFormat(locale) : void 0;
164
+ const dateFormat = new Intl.DateTimeFormat(locale, {
165
+ dateStyle: "medium",
166
+ timeZone: "UTC"
167
+ });
168
+ const formatCategory = (value)=>{
169
+ if (config.formatCategory) return config.formatCategory(value);
170
+ if (value instanceof Date) return dateFormat.format(value);
171
+ if ("number" == typeof value) return numberFormat ? numberFormat.format(value) : String(value);
172
+ return String(value);
75
173
  };
76
- const tooltipFor = (valueChannel, swapped = false)=>{
77
- if (!config.showTooltip) return false;
78
- const dataValueChannel = swapped ? "y" : valueChannel;
79
- const valueName = "x" === dataValueChannel ? xName : yName;
80
- const categoryName = "x" === dataValueChannel ? yName : xName;
81
- const valueItem = {
82
- channel: valueChannel,
83
- label: valueName,
84
- text: formatValue ? (point)=>formatChannel(point, valueChannel) : void 0
174
+ const formatTooltipValue = (value)=>{
175
+ const format = config.formatTooltipValue ?? formatValue;
176
+ if (format) return format(value);
177
+ return numberFormat ? numberFormat.format(value) : String(value);
178
+ };
179
+ const valueName = config.valueLabel ?? config.yLabel ?? "";
180
+ const rowFor = (row, point, active)=>({
181
+ label: getSeries ? String(getSeries(row)) : valueName,
182
+ value: formatTooltipValue(getY(row)),
183
+ color: point.color || SERIES_1_PAINT,
184
+ active
185
+ });
186
+ const cartesianContent = (points, primaryPoint)=>{
187
+ const first = points[0];
188
+ if (!first) return {
189
+ rows: []
190
+ };
191
+ return {
192
+ title: formatCategory(getX(first.datum)),
193
+ rows: points.map((point)=>rowFor(point.datum, point, points.length > 1 && point === primaryPoint))
85
194
  };
86
- const categoryChannel = "x" === valueChannel ? "y" : "x";
87
- const categoryItem = {
88
- channel: categoryChannel,
89
- label: categoryName
195
+ };
196
+ const polarContent = (points)=>{
197
+ const first = points[0];
198
+ if (!first) return {
199
+ rows: []
90
200
  };
201
+ const row = first.datum.data;
91
202
  return {
92
- ...tooltipBase,
93
- items: "x" === valueChannel ? [
94
- valueItem,
95
- categoryItem
96
- ] : [
97
- categoryItem,
98
- valueItem
203
+ title: formatCategory(getX(row)),
204
+ rows: [
205
+ {
206
+ label: valueName,
207
+ value: formatTooltipValue(getY(row)),
208
+ color: first.color || SERIES_1_PAINT
209
+ }
99
210
  ]
100
211
  };
101
212
  };
213
+ const tooltipFor = (valueChannel)=>{
214
+ if (!config.showTooltip) return false;
215
+ const horizontal = "x" === valueChannel;
216
+ return {
217
+ ...tooltipBase,
218
+ content: (points, context)=>cartesianContent(points, context.primaryPoint),
219
+ anchor: (points, context)=>chartTooltipCorner(cartesianContent(points, context.focus.primary), points, context, horizontal),
220
+ placement: "bottom-right",
221
+ offset: 0
222
+ };
223
+ };
102
224
  const polarTooltip = ()=>{
103
225
  if (!config.showTooltip) return false;
104
226
  return {
105
227
  ...tooltipBase,
106
- items: [
107
- {
108
- id: "value",
109
- label: yName,
110
- text: (point)=>{
111
- const row = point.datum.data;
112
- const value = getY(row);
113
- return formatValue ? formatValue(value) : String(value);
114
- }
115
- }
116
- ]
228
+ content: polarContent,
229
+ anchor: "pointer",
230
+ placement: [
231
+ "right",
232
+ "left",
233
+ "bottom",
234
+ "top"
235
+ ],
236
+ offset: 16
117
237
  };
118
238
  };
239
+ let focus;
240
+ if (null != getSeries && !isPolar) focus = "bar-horizontal" === config.type ? "group-y" : "group-x";
119
241
  const valueAxis = {
120
242
  scale: scaleLinear,
121
243
  nice: true,
122
244
  grid: config.grid,
123
245
  axis: {
124
246
  label: config.yLabel,
125
- ticks: valueTicks
247
+ ticks: valueTicks,
248
+ tickLabels: READABLE_TICK_LABELS
126
249
  }
127
250
  };
128
251
  const xAxis = resolveXAxis(config.data, getX, config.xLabel);
@@ -131,6 +254,7 @@ function resolveBuild(config) {
131
254
  getX,
132
255
  getY,
133
256
  getSeries,
257
+ seriesDomain: config.seriesDomain,
134
258
  stacked: config.stacked,
135
259
  points: config.points,
136
260
  curve: config.smooth ? d3Curve(curveMonotoneX) : void 0,
@@ -143,18 +267,29 @@ function resolveBuild(config) {
143
267
  bandAxis: {
144
268
  scale: ()=>scaleBand().padding(0.3),
145
269
  axis: {
146
- label: config.xLabel
270
+ label: config.xLabel,
271
+ tickLabels: READABLE_TICK_LABELS
147
272
  }
148
273
  },
149
274
  tooltipFor,
150
275
  polarTooltip,
151
276
  shared: {
152
- color: showLegend ? {
153
- legend: colorLegend({
154
- label: config.legendLabel
155
- })
156
- } : void 0,
157
- svgAnimation: config.animate
277
+ color: {
278
+ domain: config.seriesDomain,
279
+ legend: showLegend && "line" !== config.type ? colorLegend({
280
+ label: config.legendLabel,
281
+ items: colorLegendItems({
282
+ label: {
283
+ fontSize: 14,
284
+ fillOpacity: 1
285
+ }
286
+ })
287
+ }) : void 0
288
+ },
289
+ svgAnimation: config.animate,
290
+ ...focus ? {
291
+ focus
292
+ } : {}
158
293
  }
159
294
  };
160
295
  }
@@ -166,18 +301,26 @@ function warnOnSeriesOverflow(data, getColorIdentity) {
166
301
  }
167
302
  function buildLine(build) {
168
303
  const { data, getX, getY, getSeries } = build;
304
+ const identities = getSeries ? [
305
+ ...new Set(data.map(getSeries))
306
+ ] : [
307
+ void 0
308
+ ];
169
309
  return {
170
- marks: [
171
- lineY(data, {
310
+ marks: identities.map((identity)=>{
311
+ const rows = getSeries ? data.filter((row)=>getSeries(row) === identity) : data;
312
+ const index = null == identity ? 0 : build.seriesDomain?.indexOf(identity) ?? 0;
313
+ return lineY(rows, {
172
314
  x: getX,
173
315
  y: getY,
174
316
  z: getSeries,
175
317
  color: getSeries,
176
- points: build.points,
318
+ points: build.points || 1 === rows.length,
177
319
  curve: build.curve,
320
+ strokeDasharray: LINE_DASHES[index % LINE_DASHES.length],
178
321
  stroke: null == getSeries ? SERIES_1_PAINT : void 0
179
- })
180
- ],
322
+ });
323
+ }),
181
324
  scales: {
182
325
  x: build.xAxis,
183
326
  y: build.valueAxis
@@ -247,13 +390,14 @@ function buildBars(build, horizontal) {
247
390
  grid: build.grid,
248
391
  axis: {
249
392
  label: build.yLabel,
250
- ticks: build.valueTicks
393
+ ticks: build.valueTicks,
394
+ tickLabels: READABLE_TICK_LABELS
251
395
  }
252
396
  },
253
397
  y: build.bandAxis
254
398
  },
255
399
  ...build.shared,
256
- tooltip: build.tooltipFor("x", true)
400
+ tooltip: build.tooltipFor("x")
257
401
  };
258
402
  return {
259
403
  marks: [
@@ -385,22 +529,176 @@ function renderCartesianChartSvg(scene, options) {
385
529
  children
386
530
  };
387
531
  });
388
- return renderChartSvg({
532
+ return renderReadableChartSvg({
389
533
  ...scene,
390
534
  nodes
391
535
  }, options);
392
536
  }
393
- function chart_Chart({ type = "line", data, x, y, series, stacked, points = false, smooth = false, grid = true, legend, legendLabel, xLabel, yLabel, formatValue, height, aspectRatio, initialWidth = 640, animate, tooltip = true, ariaLabel, ariaDescription, className, onSelect }) {
394
- const { root, tooltip: tooltipSlot } = chartVariants();
537
+ function renderReadableChartSvg(scene, options) {
538
+ const readable = (node)=>{
539
+ if ("group" === node.kind) return {
540
+ ...node,
541
+ children: node.children.map(readable)
542
+ };
543
+ if ("label" === node.kind) return {
544
+ ...node,
545
+ fontSize: Math.max(READABLE_TICK_LABELS.fontSize, node.fontSize ?? 0),
546
+ style: {
547
+ ...node.style,
548
+ fillOpacity: 1,
549
+ opacity: 1
550
+ }
551
+ };
552
+ return node;
553
+ };
554
+ return renderChartSvg({
555
+ ...scene,
556
+ nodes: scene.nodes.map(readable)
557
+ }, options);
558
+ }
559
+ function useStableSeriesDomain(data, getIdentity, domain) {
560
+ const seenIdentities = useRef([]);
561
+ for (const datum of data){
562
+ const identity = getIdentity?.(datum);
563
+ if (null != identity && !seenIdentities.current.includes(identity)) seenIdentities.current.push(identity);
564
+ }
565
+ return domain ?? seenIdentities.current;
566
+ }
567
+ function filterChartData(data, x, y) {
568
+ const getX = toAccessor(x);
569
+ const getY = toAccessor(y);
570
+ return data.filter((datum)=>{
571
+ const category = getX(datum);
572
+ return Number.isFinite(getY(datum)) && ("number" != typeof category || Number.isFinite(category)) && (!(category instanceof Date) || Number.isFinite(category.getTime()));
573
+ });
574
+ }
575
+ function invalidPolarData(data, validData, getY) {
576
+ const total = validData.reduce((sum, datum)=>sum + getY(datum), 0);
577
+ return validData.length !== data.length || validData.some((datum)=>getY(datum) < 0) || validData.length > 0 && (!Number.isFinite(total) || total <= 0);
578
+ }
579
+ function ChartDataAlternative({ data, x, y, series, xLabel, yLabel, legendLabel, formatValue, ariaLabel, dataTableLabel }) {
580
+ const { alternative, summary, cell } = chartVariants();
581
+ const getX = toAccessor(x);
582
+ const getY = toAccessor(y);
583
+ const getSeries = null == series ? void 0 : toAccessor(series);
584
+ const occurrences = new Map();
585
+ return /*#__PURE__*/ jsxs("details", {
586
+ className: alternative(),
587
+ children: [
588
+ /*#__PURE__*/ jsx("summary", {
589
+ className: summary(),
590
+ children: dataTableLabel
591
+ }),
592
+ /*#__PURE__*/ jsxs("table", {
593
+ children: [
594
+ /*#__PURE__*/ jsx("caption", {
595
+ children: ariaLabel
596
+ }),
597
+ /*#__PURE__*/ jsx("thead", {
598
+ children: /*#__PURE__*/ jsxs("tr", {
599
+ children: [
600
+ getSeries && /*#__PURE__*/ jsx("th", {
601
+ className: cell(),
602
+ scope: "col",
603
+ children: legendLabel ?? ("string" == typeof series ? series : "Series")
604
+ }),
605
+ /*#__PURE__*/ jsx("th", {
606
+ className: cell(),
607
+ scope: "col",
608
+ children: xLabel ?? ("string" == typeof x ? x : "Category")
609
+ }),
610
+ /*#__PURE__*/ jsx("th", {
611
+ className: cell(),
612
+ scope: "col",
613
+ children: yLabel ?? ("string" == typeof y ? y : "Value")
614
+ })
615
+ ]
616
+ })
617
+ }),
618
+ /*#__PURE__*/ jsx("tbody", {
619
+ children: data.map((datum)=>{
620
+ const identity = `${String(getX(datum))}:${getSeries?.(datum) ?? ""}`;
621
+ const occurrence = occurrences.get(identity) ?? 0;
622
+ occurrences.set(identity, occurrence + 1);
623
+ return /*#__PURE__*/ jsxs("tr", {
624
+ children: [
625
+ getSeries && /*#__PURE__*/ jsx("td", {
626
+ className: cell(),
627
+ children: getSeries(datum)
628
+ }),
629
+ /*#__PURE__*/ jsx("td", {
630
+ className: cell(),
631
+ children: String(getX(datum))
632
+ }),
633
+ /*#__PURE__*/ jsx("td", {
634
+ className: cell(),
635
+ children: formatValue ? formatValue(getY(datum)) : String(getY(datum))
636
+ })
637
+ ]
638
+ }, `${identity}:${occurrence}`);
639
+ })
640
+ })
641
+ ]
642
+ })
643
+ ]
644
+ });
645
+ }
646
+ function ChartLineLegend({ identities, domain, label }) {
647
+ const { legend, legendItem } = chartVariants();
648
+ return /*#__PURE__*/ jsx("ul", {
649
+ "aria-label": label,
650
+ className: legend(),
651
+ children: identities.map((identity)=>{
652
+ const index = Math.max(0, domain.indexOf(identity));
653
+ return /*#__PURE__*/ jsxs("li", {
654
+ className: legendItem(),
655
+ children: [
656
+ /*#__PURE__*/ jsx("svg", {
657
+ "aria-hidden": "true",
658
+ height: "12",
659
+ viewBox: "0 0 32 12",
660
+ width: "32",
661
+ children: /*#__PURE__*/ jsx("line", {
662
+ stroke: `var(--color-chart-series-${index % MAX_SERIES + 1})`,
663
+ strokeDasharray: LINE_DASHES[index % LINE_DASHES.length],
664
+ strokeWidth: "2",
665
+ x1: "0",
666
+ x2: "32",
667
+ y1: "6",
668
+ y2: "6"
669
+ })
670
+ }),
671
+ identity
672
+ ]
673
+ }, identity);
674
+ })
675
+ });
676
+ }
677
+ function chart_Chart({ type = "line", data, x, y, series, seriesDomain, stacked, points = false, smooth = false, grid = true, legend, legendLabel, xLabel, yLabel, formatValue, valueLabel, formatCategory, formatTooltipValue, locale, height, aspectRatio, initialWidth = 640, animate, tooltip = true, ariaLabel, ariaDescription, className, dataTableLabel = "View chart data", emptyLabel = "No data to display.", invalidLabel = "Pie and donut values must be finite, non-negative numbers with a positive total.", onSelect }) {
678
+ const { root, tooltip: tooltipSlot, fallback } = chartVariants();
395
679
  const tooltipClassName = tooltipSlot();
396
680
  const prefersReducedMotion = usePrefersReducedMotion();
397
681
  const shouldAnimate = animate ?? !prefersReducedMotion;
682
+ const [dismissed, setDismissed] = useState(false);
683
+ const getX = toAccessor(x);
684
+ const getY = toAccessor(y);
685
+ const getSeries = null == series ? void 0 : toAccessor(series);
686
+ const isPolar = "pie" === type || "donut" === type;
687
+ const validData = useMemo(()=>filterChartData(data, x, y), [
688
+ data,
689
+ x,
690
+ y
691
+ ]);
692
+ const invalidPolar = isPolar && invalidPolarData(data, validData, getY);
693
+ const stableDomain = useStableSeriesDomain(validData, isPolar ? (datum)=>String(getX(datum)) : getSeries, isPolar ? seriesDomain?.map(String) : seriesDomain);
694
+ const domainKey = JSON.stringify(stableDomain);
398
695
  const definition = useMemo(()=>buildChartDefinition({
399
696
  type,
400
- data,
697
+ data: invalidPolar ? [] : validData,
401
698
  x,
402
699
  y,
403
700
  series,
701
+ seriesDomain: JSON.parse(domainKey),
404
702
  stacked,
405
703
  points,
406
704
  smooth,
@@ -410,12 +708,19 @@ function chart_Chart({ type = "line", data, x, y, series, stacked, points = fals
410
708
  xLabel,
411
709
  yLabel,
412
710
  formatValue,
711
+ valueLabel,
712
+ formatCategory,
713
+ formatTooltipValue,
714
+ locale,
413
715
  animate: shouldAnimate,
414
- showTooltip: tooltip,
716
+ showTooltip: tooltip && !dismissed,
415
717
  tooltipClassName
416
718
  }), [
417
719
  type,
418
- data,
720
+ validData,
721
+ invalidPolar,
722
+ domainKey,
723
+ dismissed,
419
724
  x,
420
725
  y,
421
726
  series,
@@ -428,27 +733,71 @@ function chart_Chart({ type = "line", data, x, y, series, stacked, points = fals
428
733
  xLabel,
429
734
  yLabel,
430
735
  formatValue,
736
+ valueLabel,
737
+ formatCategory,
738
+ formatTooltipValue,
739
+ locale,
431
740
  shouldAnimate,
432
741
  tooltip,
433
742
  tooltipClassName
434
743
  ]);
435
- const isPolar = "pie" === type || "donut" === type;
436
744
  const handleSelect = onSelect ? (point)=>{
437
745
  if (null == point) return void onSelect(null);
438
746
  onSelect(isPolar ? point.datum.data : point.datum);
439
747
  } : void 0;
440
- return /*#__PURE__*/ jsx(Chart, {
441
- ariaDescription: ariaDescription,
442
- ariaLabel: ariaLabel,
443
- aspectRatio: null == height ? aspectRatio ?? 16 / 9 : void 0,
748
+ return /*#__PURE__*/ jsxs("div", {
444
749
  className: root({
445
750
  className
446
751
  }),
447
- definition: definition,
448
- height: height,
449
- initialWidth: initialWidth,
450
- onSelect: handleSelect,
451
- renderSvg: isPolar ? void 0 : renderCartesianChartSvg
752
+ onKeyDownCapture: (event)=>{
753
+ if ("Escape" === event.key) setDismissed(true);
754
+ else if ([
755
+ "ArrowLeft",
756
+ "ArrowRight",
757
+ "ArrowUp",
758
+ "ArrowDown",
759
+ "Home",
760
+ "End"
761
+ ].includes(event.key)) setDismissed(false);
762
+ },
763
+ onPointerMoveCapture: ()=>{
764
+ if (dismissed) setDismissed(false);
765
+ },
766
+ children: [
767
+ invalidPolar || 0 === validData.length ? /*#__PURE__*/ jsx("p", {
768
+ className: fallback(),
769
+ role: "status",
770
+ children: invalidPolar ? invalidLabel : emptyLabel
771
+ }) : /*#__PURE__*/ jsx(Chart, {
772
+ ariaDescription: ariaDescription,
773
+ ariaLabel: ariaLabel,
774
+ aspectRatio: null == height ? aspectRatio ?? 16 / 9 : void 0,
775
+ definition: definition,
776
+ height: height,
777
+ initialWidth: initialWidth,
778
+ onSelect: handleSelect,
779
+ renderSvg: isPolar ? renderReadableChartSvg : renderCartesianChartSvg
780
+ }),
781
+ "line" === type && getSeries && false !== legend && !invalidPolar && /*#__PURE__*/ jsx(ChartLineLegend, {
782
+ domain: stableDomain,
783
+ identities: [
784
+ ...new Set(validData.map(getSeries))
785
+ ],
786
+ label: legendLabel
787
+ }),
788
+ validData.length > 0 && !invalidPolar && /*#__PURE__*/ jsx(ChartDataAlternative, {
789
+ ariaLabel: ariaLabel,
790
+ data: validData,
791
+ dataTableLabel: dataTableLabel,
792
+ formatValue: formatValue,
793
+ legendLabel: legendLabel,
794
+ series: series,
795
+ x: x,
796
+ xLabel: xLabel,
797
+ y: y,
798
+ yLabel: yLabel
799
+ })
800
+ ]
452
801
  });
453
802
  }
454
803
  export { chart_Chart as Chart };