@mui/x-charts 8.11.3 → 8.13.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 (304) hide show
  1. package/BarChart/BarChart.d.ts +2 -2
  2. package/BarChart/BarChart.js +1 -0
  3. package/BarChart/BarChart.plugins.d.ts +3 -2
  4. package/BarChart/BarChart.plugins.js +2 -1
  5. package/BarChart/BarElement.js +10 -2
  6. package/BarChart/index.d.ts +1 -0
  7. package/BarChart/index.js +12 -0
  8. package/BarChart/useBarChartProps.d.ts +2 -2
  9. package/CHANGELOG.md +296 -6
  10. package/ChartContainer/ChartContainer.js +4 -2
  11. package/ChartContainer/useChartContainerProps.js +4 -2
  12. package/ChartsLegend/ContinuousColorLegend.js +1 -0
  13. package/ChartsLegend/PiecewiseColorLegend.js +1 -0
  14. package/ChartsSurface/ChartsSurface.js +23 -3
  15. package/ChartsWrapper/ChartsWrapper.d.ts +2 -1
  16. package/ChartsWrapper/ChartsWrapper.js +49 -46
  17. package/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
  18. package/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
  19. package/LineChart/FocusedMark.d.ts +2 -0
  20. package/LineChart/FocusedMark.js +44 -0
  21. package/LineChart/LineChart.d.ts +2 -2
  22. package/LineChart/LineChart.js +3 -1
  23. package/LineChart/LineChart.plugins.d.ts +3 -2
  24. package/LineChart/LineChart.plugins.js +2 -1
  25. package/LineChart/index.d.ts +1 -0
  26. package/LineChart/index.js +12 -0
  27. package/LineChart/useLineChartProps.d.ts +2 -2
  28. package/PieChart/PieArc.d.ts +4 -0
  29. package/PieChart/PieArc.js +16 -11
  30. package/PieChart/PieArcPlot.js +28 -3
  31. package/PieChart/PieChart.js +1 -0
  32. package/PieChart/PieChart.plugins.d.ts +2 -1
  33. package/PieChart/PieChart.plugins.js +2 -1
  34. package/PieChart/dataTransform/useTransformData.d.ts +1 -0
  35. package/PieChart/dataTransform/useTransformData.js +9 -1
  36. package/PieChart/index.d.ts +1 -0
  37. package/PieChart/index.js +12 -0
  38. package/RadarChart/RadarChart.plugins.d.ts +1 -1
  39. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
  40. package/RadarChart/index.d.ts +2 -1
  41. package/RadarChart/index.js +12 -0
  42. package/RadarChart/useRadarChartProps.d.ts +2 -2
  43. package/ScatterChart/BatchScatter.d.ts +32 -0
  44. package/ScatterChart/BatchScatter.js +171 -0
  45. package/ScatterChart/Scatter.js +13 -5
  46. package/ScatterChart/ScatterChart.d.ts +4 -4
  47. package/ScatterChart/ScatterChart.js +13 -2
  48. package/ScatterChart/ScatterChart.plugins.d.ts +4 -3
  49. package/ScatterChart/ScatterChart.plugins.js +3 -2
  50. package/ScatterChart/ScatterPlot.d.ts +10 -0
  51. package/ScatterChart/ScatterPlot.js +14 -2
  52. package/ScatterChart/index.d.ts +1 -0
  53. package/ScatterChart/index.js +12 -0
  54. package/ScatterChart/useScatterChartProps.d.ts +2 -2
  55. package/ScatterChart/useScatterChartProps.js +8 -5
  56. package/SparkLineChart/SparkLineChart.js +10 -5
  57. package/Toolbar/Toolbar.js +1 -2
  58. package/colorPalettes/types.d.ts +1 -1
  59. package/context/ChartApi.d.ts +6 -6
  60. package/esm/BarChart/BarChart.d.ts +2 -2
  61. package/esm/BarChart/BarChart.js +1 -0
  62. package/esm/BarChart/BarChart.plugins.d.ts +3 -2
  63. package/esm/BarChart/BarChart.plugins.js +2 -1
  64. package/esm/BarChart/BarElement.js +10 -2
  65. package/esm/BarChart/index.d.ts +1 -0
  66. package/esm/BarChart/index.js +1 -0
  67. package/esm/BarChart/useBarChartProps.d.ts +2 -2
  68. package/esm/ChartContainer/ChartContainer.js +4 -2
  69. package/esm/ChartContainer/useChartContainerProps.js +4 -2
  70. package/esm/ChartsLegend/ContinuousColorLegend.js +1 -0
  71. package/esm/ChartsLegend/PiecewiseColorLegend.js +1 -0
  72. package/esm/ChartsSurface/ChartsSurface.js +23 -3
  73. package/esm/ChartsWrapper/ChartsWrapper.d.ts +2 -1
  74. package/esm/ChartsWrapper/ChartsWrapper.js +49 -46
  75. package/esm/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
  76. package/esm/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
  77. package/esm/LineChart/FocusedMark.d.ts +2 -0
  78. package/esm/LineChart/FocusedMark.js +38 -0
  79. package/esm/LineChart/LineChart.d.ts +2 -2
  80. package/esm/LineChart/LineChart.js +3 -1
  81. package/esm/LineChart/LineChart.plugins.d.ts +3 -2
  82. package/esm/LineChart/LineChart.plugins.js +2 -1
  83. package/esm/LineChart/index.d.ts +1 -0
  84. package/esm/LineChart/index.js +1 -0
  85. package/esm/LineChart/useLineChartProps.d.ts +2 -2
  86. package/esm/PieChart/PieArc.d.ts +4 -0
  87. package/esm/PieChart/PieArc.js +17 -12
  88. package/esm/PieChart/PieArcPlot.js +30 -5
  89. package/esm/PieChart/PieChart.js +1 -0
  90. package/esm/PieChart/PieChart.plugins.d.ts +2 -1
  91. package/esm/PieChart/PieChart.plugins.js +2 -1
  92. package/esm/PieChart/dataTransform/useTransformData.d.ts +1 -0
  93. package/esm/PieChart/dataTransform/useTransformData.js +9 -1
  94. package/esm/PieChart/index.d.ts +1 -0
  95. package/esm/PieChart/index.js +1 -0
  96. package/esm/RadarChart/RadarChart.plugins.d.ts +1 -1
  97. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
  98. package/esm/RadarChart/index.d.ts +2 -1
  99. package/esm/RadarChart/index.js +2 -1
  100. package/esm/RadarChart/useRadarChartProps.d.ts +2 -2
  101. package/esm/ScatterChart/BatchScatter.d.ts +32 -0
  102. package/esm/ScatterChart/BatchScatter.js +165 -0
  103. package/esm/ScatterChart/Scatter.js +13 -5
  104. package/esm/ScatterChart/ScatterChart.d.ts +4 -4
  105. package/esm/ScatterChart/ScatterChart.js +13 -2
  106. package/esm/ScatterChart/ScatterChart.plugins.d.ts +4 -3
  107. package/esm/ScatterChart/ScatterChart.plugins.js +3 -2
  108. package/esm/ScatterChart/ScatterPlot.d.ts +10 -0
  109. package/esm/ScatterChart/ScatterPlot.js +14 -2
  110. package/esm/ScatterChart/index.d.ts +1 -0
  111. package/esm/ScatterChart/index.js +1 -0
  112. package/esm/ScatterChart/useScatterChartProps.d.ts +2 -2
  113. package/esm/ScatterChart/useScatterChartProps.js +8 -5
  114. package/esm/SparkLineChart/SparkLineChart.js +10 -5
  115. package/esm/Toolbar/Toolbar.js +1 -2
  116. package/esm/colorPalettes/types.d.ts +1 -1
  117. package/esm/context/ChartApi.d.ts +6 -6
  118. package/esm/hooks/useAxis.d.ts +5 -5
  119. package/esm/hooks/useDrawingArea.d.ts +20 -2
  120. package/esm/hooks/useFocusedItem.d.ts +15 -0
  121. package/esm/hooks/useFocusedItem.js +20 -0
  122. package/esm/hooks/useIsItemFocused.d.ts +12 -0
  123. package/esm/hooks/useIsItemFocused.js +15 -0
  124. package/esm/hooks/useIsItemFocusedGetter.d.ts +8 -0
  125. package/esm/hooks/useIsItemFocusedGetter.js +14 -0
  126. package/esm/hooks/useScale.js +6 -0
  127. package/esm/index.d.ts +1 -0
  128. package/esm/index.js +2 -1
  129. package/esm/internals/animation/Transition.js +1 -3
  130. package/esm/internals/index.d.ts +3 -2
  131. package/esm/internals/index.js +3 -2
  132. package/esm/internals/plugins/allPlugins.d.ts +5 -4
  133. package/esm/internals/plugins/allPlugins.js +3 -2
  134. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +60 -32
  135. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +19 -5
  136. package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
  137. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
  138. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +66 -72
  139. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
  140. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
  141. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
  142. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/{getAxisExtremum.d.ts → getAxisExtrema.d.ts} +1 -1
  143. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +24 -0
  144. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +66 -0
  145. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +121 -0
  146. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
  147. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
  148. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +49 -5
  149. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +20 -0
  150. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +41 -21
  151. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +2 -2
  152. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +30 -7
  153. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
  154. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.js +2 -0
  155. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
  156. package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +9 -7
  157. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
  158. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +3 -0
  159. package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
  160. package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
  161. package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +32 -0
  162. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
  163. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +5 -0
  164. package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
  165. package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +3 -0
  166. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +6 -4
  167. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -1
  168. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +2 -1
  169. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +6 -0
  170. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
  171. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +2 -0
  172. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
  173. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
  174. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +88 -0
  175. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +170 -0
  176. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +37 -0
  177. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +33 -0
  178. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +36 -0
  179. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +1 -0
  180. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -5
  181. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
  182. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
  183. package/esm/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
  184. package/esm/internals/scaleGuards.d.ts +7 -0
  185. package/esm/internals/scaleGuards.js +6 -0
  186. package/esm/internals/ticks.d.ts +3 -5
  187. package/esm/internals/ticks.js +6 -5
  188. package/esm/locales/elGR.d.ts +96 -0
  189. package/esm/locales/elGR.js +100 -0
  190. package/esm/locales/enUS.d.ts +96 -0
  191. package/esm/locales/enUS.js +99 -1
  192. package/esm/locales/frFR.d.ts +96 -0
  193. package/esm/locales/frFR.js +100 -2
  194. package/esm/locales/ptBR.d.ts +96 -0
  195. package/esm/locales/ptBR.js +100 -0
  196. package/esm/locales/ptPT.d.ts +96 -0
  197. package/esm/locales/ptPT.js +100 -0
  198. package/esm/locales/svSE.d.ts +97 -1
  199. package/esm/locales/svSE.js +100 -0
  200. package/esm/locales/utils/chartsLocaleTextApi.d.ts +384 -0
  201. package/esm/locales/utils/getChartsLocalization.d.ts +96 -0
  202. package/esm/plugins/index.d.ts +6 -0
  203. package/esm/plugins/index.js +12 -0
  204. package/hooks/useAxis.d.ts +5 -5
  205. package/hooks/useDrawingArea.d.ts +20 -2
  206. package/hooks/useFocusedItem.d.ts +15 -0
  207. package/hooks/useFocusedItem.js +26 -0
  208. package/hooks/useIsItemFocused.d.ts +12 -0
  209. package/hooks/useIsItemFocused.js +20 -0
  210. package/hooks/useIsItemFocusedGetter.d.ts +8 -0
  211. package/hooks/useIsItemFocusedGetter.js +18 -0
  212. package/hooks/useScale.js +6 -0
  213. package/index.d.ts +1 -0
  214. package/index.js +13 -1
  215. package/internals/animation/Transition.js +0 -2
  216. package/internals/index.d.ts +3 -2
  217. package/internals/index.js +20 -8
  218. package/internals/plugins/allPlugins.d.ts +5 -4
  219. package/internals/plugins/allPlugins.js +3 -2
  220. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +59 -31
  221. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +19 -5
  222. package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
  223. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
  224. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +63 -69
  225. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
  226. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
  227. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
  228. package/internals/plugins/featurePlugins/useChartCartesianAxis/{getAxisExtremum.d.ts → getAxisExtrema.d.ts} +1 -1
  229. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +30 -0
  230. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +66 -0
  231. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +131 -0
  232. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
  233. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
  234. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +49 -5
  235. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +20 -0
  236. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +42 -22
  237. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +2 -2
  238. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +30 -7
  239. package/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
  240. package/internals/plugins/featurePlugins/useChartClosestPoint/index.js +27 -0
  241. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
  242. package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +11 -9
  243. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
  244. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +9 -0
  245. package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
  246. package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
  247. package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +41 -0
  248. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
  249. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +6 -1
  250. package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
  251. package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +9 -0
  252. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +6 -4
  253. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -1
  254. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +3 -2
  255. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +6 -0
  256. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
  257. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +27 -0
  258. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
  259. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
  260. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +96 -0
  261. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +178 -0
  262. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +37 -0
  263. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +39 -0
  264. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +36 -0
  265. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +5 -0
  266. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +1 -4
  267. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
  268. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
  269. package/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
  270. package/internals/scaleGuards.d.ts +7 -0
  271. package/internals/scaleGuards.js +8 -0
  272. package/internals/ticks.d.ts +3 -5
  273. package/internals/ticks.js +7 -5
  274. package/locales/elGR.d.ts +96 -0
  275. package/locales/elGR.js +100 -0
  276. package/locales/enUS.d.ts +96 -0
  277. package/locales/enUS.js +99 -1
  278. package/locales/frFR.d.ts +96 -0
  279. package/locales/frFR.js +100 -2
  280. package/locales/ptBR.d.ts +96 -0
  281. package/locales/ptBR.js +100 -0
  282. package/locales/ptPT.d.ts +96 -0
  283. package/locales/ptPT.js +100 -0
  284. package/locales/svSE.d.ts +97 -1
  285. package/locales/svSE.js +100 -0
  286. package/locales/utils/chartsLocaleTextApi.d.ts +384 -0
  287. package/locales/utils/getChartsLocalization.d.ts +96 -0
  288. package/package.json +5 -5
  289. package/plugins/index.d.ts +6 -0
  290. package/plugins/index.js +47 -0
  291. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -22
  292. package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
  293. package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -2
  294. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
  295. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
  296. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -3
  297. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -29
  298. package/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
  299. package/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -27
  300. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
  301. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
  302. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -9
  303. /package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
  304. /package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
@@ -14,10 +14,10 @@ const useChartInteraction = ({
14
14
  const cleanInteraction = (0, _useEventCallback.default)(function cleanInteraction() {
15
15
  store.update(prev => {
16
16
  return (0, _extends2.default)({}, prev, {
17
- interaction: {
17
+ interaction: (0, _extends2.default)({}, prev.interaction, {
18
18
  pointer: null,
19
19
  item: null
20
- }
20
+ })
21
21
  });
22
22
  });
23
23
  });
@@ -58,7 +58,8 @@ const useChartInteraction = ({
58
58
  const setPointerCoordinate = (0, _useEventCallback.default)(function setPointerCoordinate(coordinate) {
59
59
  store.update(prev => (0, _extends2.default)({}, prev, {
60
60
  interaction: (0, _extends2.default)({}, prev.interaction, {
61
- pointer: coordinate
61
+ pointer: coordinate,
62
+ lastUpdate: coordinate !== null ? 'pointer' : prev.interaction.lastUpdate
62
63
  })
63
64
  }));
64
65
  });
@@ -75,7 +76,8 @@ exports.useChartInteraction = useChartInteraction;
75
76
  useChartInteraction.getInitialState = () => ({
76
77
  interaction: {
77
78
  item: null,
78
- pointer: null
79
+ pointer: null,
80
+ lastUpdate: 'pointer'
79
81
  }
80
82
  });
81
83
  useChartInteraction.params = {};
@@ -27,4 +27,9 @@ export declare const selectorChartsInteractionItemIsDefined: import("reselect").
27
27
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
28
28
  } & {
29
29
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
30
- }, boolean, any[]>;
30
+ }, boolean, any[]>;
31
+ export declare const selectorChartsLastInteraction: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartInteraction.types.js").UseChartInteractionState> & {
32
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
33
+ } & {
34
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
35
+ }, import("./useChartInteraction.types.js").InteractionUpdateSource | undefined, any[]>;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.selectorChartsInteractionPointerY = exports.selectorChartsInteractionPointerX = exports.selectorChartsInteractionPointer = exports.selectorChartsInteractionItemIsDefined = exports.selectorChartsInteractionItem = exports.selectorChartsInteractionIsInitialized = void 0;
6
+ exports.selectorChartsLastInteraction = exports.selectorChartsInteractionPointerY = exports.selectorChartsInteractionPointerX = exports.selectorChartsInteractionPointer = exports.selectorChartsInteractionItemIsDefined = exports.selectorChartsInteractionItem = exports.selectorChartsInteractionIsInitialized = void 0;
7
7
  var _selectors = require("../../utils/selectors");
8
8
  const selectInteraction = state => state.interaction;
9
9
  const selectorChartsInteractionIsInitialized = exports.selectorChartsInteractionIsInitialized = (0, _selectors.createSelector)([selectInteraction], interaction => interaction !== undefined);
@@ -11,4 +11,5 @@ const selectorChartsInteractionItem = exports.selectorChartsInteractionItem = (0
11
11
  const selectorChartsInteractionPointer = exports.selectorChartsInteractionPointer = (0, _selectors.createSelector)([selectInteraction], interaction => interaction?.pointer ?? null);
12
12
  const selectorChartsInteractionPointerX = exports.selectorChartsInteractionPointerX = (0, _selectors.createSelector)([selectorChartsInteractionPointer], pointer => pointer && pointer.x);
13
13
  const selectorChartsInteractionPointerY = exports.selectorChartsInteractionPointerY = (0, _selectors.createSelector)([selectorChartsInteractionPointer], pointer => pointer && pointer.y);
14
- const selectorChartsInteractionItemIsDefined = exports.selectorChartsInteractionItemIsDefined = (0, _selectors.createSelector)([selectorChartsInteractionItem], item => item !== null);
14
+ const selectorChartsInteractionItemIsDefined = exports.selectorChartsInteractionItemIsDefined = (0, _selectors.createSelector)([selectorChartsInteractionItem], item => item !== null);
15
+ const selectorChartsLastInteraction = exports.selectorChartsLastInteraction = (0, _selectors.createSelector)([selectInteraction], interaction => interaction?.lastUpdate);
@@ -4,6 +4,7 @@ export type Coordinate = {
4
4
  x: number;
5
5
  y: number;
6
6
  };
7
+ export type InteractionUpdateSource = 'pointer' | 'keyboard';
7
8
  export interface UseChartInteractionInstance {
8
9
  /**
9
10
  * Remove all interaction.
@@ -35,6 +36,11 @@ export interface UseChartInteractionState {
35
36
  * The x/y SVG coordinate of the "main" pointer
36
37
  */
37
38
  pointer: Coordinate | null;
39
+ /**
40
+ * The last interaction highlight update.
41
+ * Used to decide if highlight should be based on pointer position or keyboard navigation.
42
+ */
43
+ lastUpdate: InteractionUpdateSource;
38
44
  };
39
45
  }
40
46
  export type UseChartInteractionSignature = ChartPluginSignature<{
@@ -0,0 +1,3 @@
1
+ export { useChartKeyboardNavigation } from "./useChartKeyboardNavigation.js";
2
+ export * from "./useChartKeyboardNavigation.selectors.js";
3
+ export type { UseChartKeyboardNavigationSignature } from "./useChartKeyboardNavigation.types.js";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ useChartKeyboardNavigation: true
8
+ };
9
+ Object.defineProperty(exports, "useChartKeyboardNavigation", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _useChartKeyboardNavigation.useChartKeyboardNavigation;
13
+ }
14
+ });
15
+ var _useChartKeyboardNavigation = require("./useChartKeyboardNavigation");
16
+ var _useChartKeyboardNavigation2 = require("./useChartKeyboardNavigation.selectors");
17
+ Object.keys(_useChartKeyboardNavigation2).forEach(function (key) {
18
+ if (key === "default" || key === "__esModule") return;
19
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
+ if (key in exports && exports[key] === _useChartKeyboardNavigation2[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _useChartKeyboardNavigation2[key];
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,3 @@
1
+ import { ChartPlugin } from "../../models/index.js";
2
+ import { UseChartKeyboardNavigationSignature } from "./useChartKeyboardNavigation.types.js";
3
+ export declare const useChartKeyboardNavigation: ChartPlugin<UseChartKeyboardNavigationSignature>;
@@ -0,0 +1,20 @@
1
+ import { ChartSeriesType, ChartsSeriesConfig } from "../../../../models/seriesType/config.js";
2
+ import { SeriesId } from "../../../../models/seriesType/common.js";
3
+ import { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
4
+ /**
5
+ * Returns the next series type and id that contains some data.
6
+ * Returns `null` if no other series have data.
7
+ */
8
+ export declare function getNextSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: ChartSeriesType, seriesId?: SeriesId): {
9
+ type: Exclude<ChartSeriesType, 'sankey'>;
10
+ seriesId: SeriesId;
11
+ } | null;
12
+ /**
13
+ * Returns the previous series type and id that contains some data.
14
+ * Returns `null` if no other series have data.
15
+ */
16
+ export declare function getPreviousSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: ChartSeriesType, seriesId?: SeriesId): {
17
+ type: Exclude<ChartSeriesType, 'sankey'>;
18
+ seriesId: SeriesId;
19
+ } | null;
20
+ export declare function seriesHasData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type: ChartSeriesType, seriesId: SeriesId): boolean | undefined;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getNextSeriesWithData = getNextSeriesWithData;
7
+ exports.getPreviousSeriesWithData = getPreviousSeriesWithData;
8
+ exports.seriesHasData = seriesHasData;
9
+ /**
10
+ * Returns the next series type and id that contains some data.
11
+ * Returns `null` if no other series have data.
12
+ */
13
+ function getNextSeriesWithData(series, type, seriesId) {
14
+ const startingTypeIndex = type !== undefined && series[type] ? Object.keys(series).indexOf(type) : 0;
15
+ const currentSeriesIndex = type !== undefined && seriesId !== undefined && series[type] && series[type].series[seriesId] ? series[type].seriesOrder.indexOf(seriesId) : -1;
16
+ const typesAvailable = Object.keys(series).filter(t => t !== 'sankey');
17
+
18
+ // Loop over all series types starting with the current seriesType
19
+ for (let typeGap = 0; typeGap < typesAvailable.length; typeGap += 1) {
20
+ const typeIndex = (startingTypeIndex + typeGap) % typesAvailable.length;
21
+ const seriesOfType = series[typesAvailable[typeIndex]];
22
+
23
+ // Edge case for the current series type: we don't loop on previous series of the same type.
24
+ const startingSeriesIndex = typeGap === 0 ? currentSeriesIndex + 1 : 0;
25
+ for (let seriesIndex = startingSeriesIndex; seriesIndex < seriesOfType.seriesOrder.length; seriesIndex += 1) {
26
+ if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
27
+ return {
28
+ type: typesAvailable[typeIndex],
29
+ seriesId: seriesOfType.seriesOrder[seriesIndex]
30
+ };
31
+ }
32
+ }
33
+ }
34
+
35
+ // End looping on the initial type up to the initial series (excluded)
36
+ const typeIndex = startingTypeIndex;
37
+ const seriesOfType = series[typesAvailable[typeIndex]];
38
+ const endingSeriesIndex = currentSeriesIndex;
39
+ for (let seriesIndex = 0; seriesIndex < endingSeriesIndex; seriesIndex += 1) {
40
+ if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
41
+ return {
42
+ type: typesAvailable[typeIndex],
43
+ seriesId: seriesOfType.seriesOrder[seriesIndex]
44
+ };
45
+ }
46
+ }
47
+ return null;
48
+ }
49
+
50
+ /**
51
+ * Returns the previous series type and id that contains some data.
52
+ * Returns `null` if no other series have data.
53
+ */
54
+ function getPreviousSeriesWithData(series, type, seriesId) {
55
+ const startingTypeIndex = type !== undefined && series[type] ? Object.keys(series).indexOf(type) : 0;
56
+ const startingSeriesIndex = type !== undefined && seriesId !== undefined && series[type] && series[type].series[seriesId] ? series[type].seriesOrder.indexOf(seriesId) : 1;
57
+ const typesAvailable = Object.keys(series).filter(t => t !== 'sankey');
58
+
59
+ // Loop over all series types starting with the current seriesType
60
+ for (let typeGap = 0; typeGap < typesAvailable.length; typeGap += 1) {
61
+ const typeIndex = (typesAvailable.length + startingTypeIndex - typeGap) % typesAvailable.length;
62
+ const seriesOfType = series[typesAvailable[typeIndex]];
63
+ const maxGap = typeGap === 0 ? startingSeriesIndex + 1 : seriesOfType.seriesOrder.length;
64
+ for (let seriesGap = 1; seriesGap < maxGap; seriesGap += 1) {
65
+ const seriesIndex = (seriesOfType.seriesOrder.length + startingSeriesIndex - seriesGap) % seriesOfType.seriesOrder.length;
66
+ if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
67
+ return {
68
+ type: typesAvailable[typeIndex],
69
+ seriesId: seriesOfType.seriesOrder[seriesIndex]
70
+ };
71
+ }
72
+ }
73
+ }
74
+
75
+ // End looping on the initial type down to the initial series (excluded)
76
+ const typeIndex = startingTypeIndex;
77
+ const seriesOfType = series[typesAvailable[typeIndex]];
78
+ const availableSeriesIds = seriesOfType.seriesOrder;
79
+ for (let seriesIndex = availableSeriesIds.length - 1; seriesIndex > startingSeriesIndex; seriesIndex -= 1) {
80
+ if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
81
+ return {
82
+ type: typesAvailable[typeIndex],
83
+ seriesId: seriesOfType.seriesOrder[seriesIndex]
84
+ };
85
+ }
86
+ }
87
+ return null;
88
+ }
89
+ function seriesHasData(series, type, seriesId) {
90
+ // @ts-ignore snakey is not in MIT version
91
+ if (type === 'sankey') {
92
+ return false;
93
+ }
94
+ const data = series[type]?.series[seriesId]?.data;
95
+ return data && data.length > 0;
96
+ }
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.useChartKeyboardNavigation = void 0;
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var React = _interopRequireWildcard(require("react"));
12
+ var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
13
+ var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
14
+ var _useChartKeyboardNavigation = require("./useChartKeyboardNavigation.helpers");
15
+ function getNextIndexFocusedItem(state) {
16
+ let {
17
+ type,
18
+ seriesId
19
+ } = state.keyboardNavigation.item ?? {};
20
+ if (type === undefined ||
21
+ // @ts-ignore sankey is not in MIT version
22
+ type === 'sankey' || seriesId === undefined || !(0, _useChartKeyboardNavigation.seriesHasData)(state.series.processedSeries, type, seriesId)) {
23
+ const nextSeries = (0, _useChartKeyboardNavigation.getNextSeriesWithData)(state.series.processedSeries, type, seriesId);
24
+ if (nextSeries === null) {
25
+ return null;
26
+ }
27
+ type = nextSeries.type;
28
+ seriesId = nextSeries.seriesId;
29
+ }
30
+ const dataLength = state.series.processedSeries[type].series[seriesId].data.length;
31
+ return {
32
+ type,
33
+ seriesId,
34
+ dataIndex: ((state.keyboardNavigation.item?.dataIndex ?? -1) + 1) % dataLength
35
+ };
36
+ }
37
+ function getPreviousIndexFocusedItem(state) {
38
+ let {
39
+ type,
40
+ seriesId
41
+ } = state.keyboardNavigation.item ?? {};
42
+ if (type === undefined ||
43
+ // @ts-ignore sankey is not in MIT version
44
+ type === 'sankey' || seriesId === undefined || !(0, _useChartKeyboardNavigation.seriesHasData)(state.series.processedSeries, type, seriesId)) {
45
+ const previousSeries = (0, _useChartKeyboardNavigation.getPreviousSeriesWithData)(state.series.processedSeries, type, seriesId);
46
+ if (previousSeries === null) {
47
+ return null;
48
+ }
49
+ type = previousSeries.type;
50
+ seriesId = previousSeries.seriesId;
51
+ }
52
+ const dataLength = state.series.processedSeries[type].series[seriesId].data.length;
53
+ return {
54
+ type,
55
+ seriesId,
56
+ dataIndex: (dataLength + (state.keyboardNavigation.item?.dataIndex ?? 1) - 1) % dataLength
57
+ };
58
+ }
59
+ function getNextSeriesFocusedItem(state) {
60
+ let {
61
+ type,
62
+ seriesId
63
+ } = state.keyboardNavigation.item ?? {};
64
+ const nextSeries = (0, _useChartKeyboardNavigation.getNextSeriesWithData)(state.series.processedSeries, type, seriesId);
65
+ if (nextSeries === null) {
66
+ return null; // No series to move the focus to.
67
+ }
68
+ type = nextSeries.type;
69
+ seriesId = nextSeries.seriesId;
70
+ const dataLength = state.series.processedSeries[type].series[seriesId].data.length;
71
+ return {
72
+ type,
73
+ seriesId,
74
+ dataIndex: Math.min(dataLength - 1, state.keyboardNavigation.item?.dataIndex ?? 0)
75
+ };
76
+ }
77
+ function getPreviousSeriesFocusedItem(state) {
78
+ let {
79
+ type,
80
+ seriesId
81
+ } = state.keyboardNavigation.item ?? {};
82
+ const previousSeries = (0, _useChartKeyboardNavigation.getPreviousSeriesWithData)(state.series.processedSeries, type, seriesId);
83
+ if (previousSeries === null) {
84
+ return null; // No series to move the focus to.
85
+ }
86
+ type = previousSeries.type;
87
+ seriesId = previousSeries.seriesId;
88
+ const dataLength = state.series.processedSeries[type].series[seriesId].data.length;
89
+ return {
90
+ type,
91
+ seriesId,
92
+ dataIndex: Math.min(dataLength - 1, state.keyboardNavigation.item?.dataIndex ?? 0)
93
+ };
94
+ }
95
+ const useChartKeyboardNavigation = ({
96
+ params,
97
+ store,
98
+ svgRef
99
+ }) => {
100
+ const removeFocus = (0, _useEventCallback.default)(function removeFocus() {
101
+ store.update(state => {
102
+ if (state.keyboardNavigation.item === null) {
103
+ return state;
104
+ }
105
+ return (0, _extends2.default)({}, state, {
106
+ keyboardNavigation: (0, _extends2.default)({}, state.keyboardNavigation, {
107
+ item: null
108
+ })
109
+ });
110
+ });
111
+ });
112
+ React.useEffect(() => {
113
+ const element = svgRef.current;
114
+ if (!element || !params.enableKeyboardNavigation) {
115
+ return undefined;
116
+ }
117
+ function keyboardHandler(event) {
118
+ store.update(prevState => {
119
+ let newFocusedItem = prevState.keyboardNavigation.item;
120
+ switch (event.key) {
121
+ case 'ArrowRight':
122
+ newFocusedItem = getNextIndexFocusedItem(prevState);
123
+ break;
124
+ case 'ArrowLeft':
125
+ newFocusedItem = getPreviousIndexFocusedItem(prevState);
126
+ break;
127
+ case 'ArrowDown':
128
+ {
129
+ newFocusedItem = getPreviousSeriesFocusedItem(prevState);
130
+ break;
131
+ }
132
+ case 'ArrowUp':
133
+ {
134
+ newFocusedItem = getNextSeriesFocusedItem(prevState);
135
+ break;
136
+ }
137
+ default:
138
+ break;
139
+ }
140
+ if (newFocusedItem !== prevState.keyboardNavigation.item) {
141
+ event.preventDefault();
142
+ return (0, _extends2.default)({}, prevState, prevState.interaction && {
143
+ interaction: (0, _extends2.default)({}, prevState.interaction, {
144
+ lastUpdate: 'keyboard'
145
+ })
146
+ }, {
147
+ keyboardNavigation: (0, _extends2.default)({}, prevState.keyboardNavigation, {
148
+ item: newFocusedItem
149
+ })
150
+ });
151
+ }
152
+ return prevState;
153
+ });
154
+ }
155
+ element.addEventListener('keydown', keyboardHandler);
156
+ element.addEventListener('blur', removeFocus);
157
+ return () => {
158
+ element.removeEventListener('keydown', keyboardHandler);
159
+ element.removeEventListener('blur', removeFocus);
160
+ };
161
+ }, [svgRef, removeFocus, params.enableKeyboardNavigation, store]);
162
+ (0, _useEnhancedEffect.default)(() => store.update(prev => prev.keyboardNavigation.enableKeyboardNavigation === params.enableKeyboardNavigation ? prev : (0, _extends2.default)({}, prev, {
163
+ keyboardNavigation: (0, _extends2.default)({}, prev.keyboardNavigation, {
164
+ enableKeyboardNavigation: !!params.enableKeyboardNavigation
165
+ })
166
+ })), [store, params.enableKeyboardNavigation]);
167
+ return {};
168
+ };
169
+ exports.useChartKeyboardNavigation = useChartKeyboardNavigation;
170
+ useChartKeyboardNavigation.getInitialState = params => ({
171
+ keyboardNavigation: {
172
+ item: null,
173
+ enableKeyboardNavigation: !!params.enableKeyboardNavigation
174
+ }
175
+ });
176
+ useChartKeyboardNavigation.params = {
177
+ enableKeyboardNavigation: true
178
+ };
@@ -0,0 +1,37 @@
1
+ import { SeriesId } from "../../../../models/seriesType/common.js";
2
+ import { AxisItemIdentifier } from "../../../../models/axis.js";
3
+ export declare const selectorChartsHasFocusedItem: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
4
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
5
+ } & {
6
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
7
+ }, boolean, any[]>;
8
+ export declare const selectorChartsFocusedSeriesType: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
9
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
10
+ } & {
11
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
12
+ }, keyof import("../../../index.js").ChartsSeriesConfig | undefined, any[]>;
13
+ export declare const selectorChartsFocusedSeriesId: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
14
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
15
+ } & {
16
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
17
+ }, SeriesId | undefined, any[]>;
18
+ export declare const selectorChartsFocusedDataIndex: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
19
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
20
+ } & {
21
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
22
+ }, number | undefined, any[]>;
23
+ export declare const selectorChartsIsKeyboardNavigationEnabled: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
24
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
25
+ } & {
26
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
27
+ }, boolean, any[]>;
28
+ export declare const selectorChartsKeyboardXAxisIndex: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
29
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
30
+ } & {
31
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
32
+ } & Partial<import("../useChartCartesianAxis/index.js").UseChartCartesianAxisState> & Partial<{}>, AxisItemIdentifier | undefined, any[]>;
33
+ export declare const selectorChartsKeyboardYAxisIndex: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
34
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
35
+ } & {
36
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
37
+ } & Partial<import("../useChartCartesianAxis/index.js").UseChartCartesianAxisState> & Partial<{}>, AxisItemIdentifier | undefined, any[]>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.selectorChartsKeyboardYAxisIndex = exports.selectorChartsKeyboardXAxisIndex = exports.selectorChartsIsKeyboardNavigationEnabled = exports.selectorChartsHasFocusedItem = exports.selectorChartsFocusedSeriesType = exports.selectorChartsFocusedSeriesId = exports.selectorChartsFocusedDataIndex = void 0;
7
+ var _selectors = require("../../utils/selectors");
8
+ var _useChartSeries = require("../../corePlugins/useChartSeries");
9
+ var _useChartCartesianAxisRendering = require("../useChartCartesianAxis/useChartCartesianAxisRendering.selectors");
10
+ const selectKeyboardNavigation = state => state.keyboardNavigation;
11
+ const selectorChartsHasFocusedItem = exports.selectorChartsHasFocusedItem = (0, _selectors.createSelector)([selectKeyboardNavigation], keyboardNavigationState => keyboardNavigationState?.item != null);
12
+ const selectorChartsFocusedSeriesType = exports.selectorChartsFocusedSeriesType = (0, _selectors.createSelector)([selectKeyboardNavigation], keyboardNavigationState => keyboardNavigationState?.item?.type);
13
+ const selectorChartsFocusedSeriesId = exports.selectorChartsFocusedSeriesId = (0, _selectors.createSelector)([selectKeyboardNavigation], keyboardNavigationState => keyboardNavigationState?.item?.seriesId);
14
+ const selectorChartsFocusedDataIndex = exports.selectorChartsFocusedDataIndex = (0, _selectors.createSelector)([selectKeyboardNavigation], keyboardNavigationState => keyboardNavigationState?.item?.dataIndex);
15
+ const selectorChartsIsKeyboardNavigationEnabled = exports.selectorChartsIsKeyboardNavigationEnabled = (0, _selectors.createSelector)([selectKeyboardNavigation], keyboardNavigationState => !!keyboardNavigationState?.enableKeyboardNavigation);
16
+
17
+ /**
18
+ * Selectors to override highlight behavior.
19
+ */
20
+
21
+ const createSelectAxisHighlight = direction => (type, seriesId, dataIndex, axis, series) => {
22
+ if (type === undefined || seriesId === undefined || dataIndex === undefined) {
23
+ return undefined;
24
+ }
25
+ const seriesConfig = series[type]?.series[seriesId];
26
+ if (!seriesConfig) {
27
+ return undefined;
28
+ }
29
+ let axisId = direction === 'x' ? 'xAxisId' in seriesConfig && seriesConfig.xAxisId : 'yAxisId' in seriesConfig && seriesConfig.yAxisId;
30
+ if (axisId === undefined || axisId === false) {
31
+ axisId = axis.axisIds[0];
32
+ }
33
+ return {
34
+ axisId,
35
+ dataIndex
36
+ };
37
+ };
38
+ const selectorChartsKeyboardXAxisIndex = exports.selectorChartsKeyboardXAxisIndex = (0, _selectors.createSelector)([selectorChartsFocusedSeriesType, selectorChartsFocusedSeriesId, selectorChartsFocusedDataIndex, _useChartCartesianAxisRendering.selectorChartXAxis, _useChartSeries.selectorChartSeriesProcessed], createSelectAxisHighlight('x'));
39
+ const selectorChartsKeyboardYAxisIndex = exports.selectorChartsKeyboardYAxisIndex = (0, _selectors.createSelector)([selectorChartsFocusedSeriesType, selectorChartsFocusedSeriesId, selectorChartsFocusedDataIndex, _useChartCartesianAxisRendering.selectorChartYAxis, _useChartSeries.selectorChartSeriesProcessed], createSelectAxisHighlight('y'));
@@ -0,0 +1,36 @@
1
+ import { ChartPluginSignature } from "../../models/index.js";
2
+ import { ChartSeriesType } from "../../../../models/seriesType/config.js";
3
+ import { SeriesId } from "../../../../models/seriesType/common.js";
4
+ import { UseChartInteractionSignature } from "../useChartInteraction/index.js";
5
+ export interface UseChartKeyboardNavigationInstance {}
6
+ type SeriesItemIdentifier = {
7
+ /**
8
+ * The type of the series
9
+ */
10
+ type: ChartSeriesType;
11
+ /**
12
+ * The id of the series with focus.
13
+ */
14
+ seriesId: SeriesId;
15
+ /**
16
+ * The index of the data point with focus.
17
+ */
18
+ dataIndex: number;
19
+ };
20
+ export interface UseChartKeyboardNavigationState {
21
+ keyboardNavigation: {
22
+ item: null | SeriesItemIdentifier;
23
+ enableKeyboardNavigation: boolean;
24
+ };
25
+ }
26
+ type UseChartKeyboardNavigationParameters = {
27
+ enableKeyboardNavigation?: boolean;
28
+ };
29
+ export type UseChartKeyboardNavigationSignature = ChartPluginSignature<{
30
+ params: UseChartKeyboardNavigationParameters;
31
+ defaultizedParams: UseChartKeyboardNavigationParameters;
32
+ instance: UseChartKeyboardNavigationInstance;
33
+ state: UseChartKeyboardNavigationState;
34
+ optionalDependencies: [UseChartInteractionSignature];
35
+ }>;
36
+ export {};
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -106,10 +106,7 @@ function computeAxisValue({
106
106
  axisExtremums[0] = min;
107
107
  axisExtremums[1] = max;
108
108
  }
109
- const rawTickNumber = (0, _ticks.getTickNumber)((0, _extends2.default)({}, axis, {
110
- range,
111
- domain: axisExtremums
112
- }));
109
+ const rawTickNumber = (0, _ticks.getTickNumber)(axis, axisExtremums, (0, _ticks.getDefaultTickNumber)(Math.abs(range[1] - range[0])));
113
110
  const tickNumber = (0, _ticks.scaleTickNumberByRange)(rawTickNumber, range);
114
111
  const scale = (0, _getScale.getScale)(scaleType, axisExtremums, range);
115
112
  const finalScale = domainLimit === 'nice' ? scale.nice(rawTickNumber) : scale;
@@ -19,6 +19,7 @@ var _getSVGPoint = require("../../../getSVGPoint");
19
19
  var _coordinateTransformation = require("./coordinateTransformation");
20
20
  var _getAxisIndex = require("./getAxisIndex");
21
21
  var _useChartSeries = require("../../corePlugins/useChartSeries");
22
+ var _checkHasInteractionPlugin = require("../useChartInteraction/checkHasInteractionPlugin");
22
23
  const useChartPolarAxis = ({
23
24
  params,
24
25
  store,
@@ -85,9 +86,10 @@ const useChartPolarAxis = ({
85
86
  const mousePosition = React.useRef({
86
87
  isInChart: false
87
88
  });
89
+ const hasInteractionPlugin = (0, _checkHasInteractionPlugin.checkHasInteractionPlugin)(instance);
88
90
  React.useEffect(() => {
89
91
  const element = svgRef.current;
90
- if (!isInteractionEnabled || element === null || params.disableAxisListener) {
92
+ if (!isInteractionEnabled || !hasInteractionPlugin || element === null || params.disableAxisListener) {
91
93
  return () => {};
92
94
  }
93
95
 
@@ -101,13 +103,13 @@ const useChartPolarAxis = ({
101
103
  const panEndHandler = instance.addInteractionListener('panEnd', event => {
102
104
  if (!event.detail.activeGestures.move) {
103
105
  mousePosition.current.isInChart = false;
104
- instance.cleanInteraction();
106
+ instance.cleanInteraction?.();
105
107
  }
106
108
  });
107
109
  const pressEndHandler = instance.addInteractionListener('quickPressEnd', event => {
108
110
  if (!event.detail.activeGestures.move && !event.detail.activeGestures.pan) {
109
111
  mousePosition.current.isInChart = false;
110
- instance.cleanInteraction();
112
+ instance.cleanInteraction?.();
111
113
  }
112
114
  });
113
115
  const gestureHandler = event => {
@@ -119,12 +121,12 @@ const useChartPolarAxis = ({
119
121
  const svgRect = element.getBoundingClientRect();
120
122
  if (srcEvent.clientX < svgRect.left || srcEvent.clientX > svgRect.right || srcEvent.clientY < svgRect.top || srcEvent.clientY > svgRect.bottom) {
121
123
  mousePosition.current.isInChart = false;
122
- instance.cleanInteraction();
124
+ instance.cleanInteraction?.();
123
125
  return;
124
126
  }
125
127
  const svgPoint = (0, _getSVGPoint.getSVGPoint)(element, srcEvent);
126
128
  mousePosition.current.isInChart = true;
127
- instance.setPointerCoordinate(svgPoint);
129
+ instance.setPointerCoordinate?.(svgPoint);
128
130
  return;
129
131
  }
130
132
 
@@ -135,7 +137,7 @@ const useChartPolarAxis = ({
135
137
  // Test if it's in the drawing area
136
138
  if (!instance.isPointInside(svgPoint.x, svgPoint.y, event.detail.target)) {
137
139
  if (mousePosition.current.isInChart) {
138
- instance?.cleanInteraction();
140
+ instance.cleanInteraction?.();
139
141
  mousePosition.current.isInChart = false;
140
142
  }
141
143
  return;
@@ -146,7 +148,7 @@ const useChartPolarAxis = ({
146
148
  const maxRadius = radiusAxisWithScale[usedRadiusAxisId].scale.range()[1];
147
149
  if (radiusSquare > maxRadius ** 2) {
148
150
  if (mousePosition.current.isInChart) {
149
- instance?.cleanInteraction();
151
+ instance.cleanInteraction?.();
150
152
  mousePosition.current.isInChart = false;
151
153
  }
152
154
  return;
@@ -165,7 +167,7 @@ const useChartPolarAxis = ({
165
167
  pressHandler.cleanup();
166
168
  pressEndHandler.cleanup();
167
169
  };
168
- }, [svgRef, store, center, radiusAxisWithScale, usedRadiusAxisId, rotationAxisWithScale, usedRotationAxisId, instance, params.disableAxisListener, isInteractionEnabled, svg2rotation]);
170
+ }, [svgRef, store, center, radiusAxisWithScale, usedRadiusAxisId, rotationAxisWithScale, usedRotationAxisId, instance, params.disableAxisListener, isInteractionEnabled, svg2rotation, hasInteractionPlugin]);
169
171
  React.useEffect(() => {
170
172
  const element = svgRef.current;
171
173
  const onAxisClick = params.onAxisClick;
@@ -69,5 +69,6 @@ export type UseChartPolarAxisSignature<SeriesType extends ChartSeriesType = Char
69
69
  defaultizedParams: UseChartPolarAxisDefaultizedParameters;
70
70
  state: UseChartPolarAxisState;
71
71
  instance: UseChartPolarAxisInstance;
72
- dependencies: [UseChartInteractionSignature, UseChartSeriesSignature<SeriesType>];
72
+ dependencies: [UseChartSeriesSignature<SeriesType>];
73
+ optionalDependencies: [UseChartInteractionSignature];
73
74
  }>;