@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
@@ -16,6 +16,102 @@ export declare const getChartsLocalization: (chartsTranslations: Partial<ChartsL
16
16
  toolbarExport?: string | undefined;
17
17
  toolbarExportPrint?: string | undefined;
18
18
  toolbarExportImage?: ((mimeType: import("./imageMimeTypes.js").ChartImageExportMimeType | (string & {})) => string) | undefined;
19
+ chartTypeBar?: string | undefined;
20
+ chartTypeColumn?: string | undefined;
21
+ chartTypeLine?: string | undefined;
22
+ chartTypeArea?: string | undefined;
23
+ chartTypePie?: string | undefined;
24
+ chartPaletteLabel?: string | undefined;
25
+ chartPaletteNameRainbowSurge?: string | undefined;
26
+ chartPaletteNameBlueberryTwilight?: string | undefined;
27
+ chartPaletteNameMangoFusion?: string | undefined;
28
+ chartPaletteNameCheerfulFiesta?: string | undefined;
29
+ chartPaletteNameStrawberrySky?: string | undefined;
30
+ chartPaletteNameBlue?: string | undefined;
31
+ chartPaletteNameGreen?: string | undefined;
32
+ chartPaletteNamePurple?: string | undefined;
33
+ chartPaletteNameRed?: string | undefined;
34
+ chartPaletteNameOrange?: string | undefined;
35
+ chartPaletteNameYellow?: string | undefined;
36
+ chartPaletteNameCyan?: string | undefined;
37
+ chartPaletteNamePink?: string | undefined;
38
+ chartConfigurationSectionChart?: string | undefined;
39
+ chartConfigurationSectionAxes?: string | undefined;
40
+ chartConfigurationSectionTooltip?: string | undefined;
41
+ chartConfigurationSectionLegend?: string | undefined;
42
+ chartConfigurationSectionColumns?: string | undefined;
43
+ chartConfigurationSectionBars?: string | undefined;
44
+ chartConfigurationSectionLines?: string | undefined;
45
+ chartConfigurationSectionAreas?: string | undefined;
46
+ chartConfigurationSectionArcs?: string | undefined;
47
+ chartConfigurationGrid?: string | undefined;
48
+ chartConfigurationBorderRadius?: string | undefined;
49
+ chartConfigurationCategoryGapRatio?: string | undefined;
50
+ chartConfigurationBarGapRatio?: string | undefined;
51
+ chartConfigurationStacked?: string | undefined;
52
+ chartConfigurationShowToolbar?: string | undefined;
53
+ chartConfigurationSkipAnimation?: string | undefined;
54
+ chartConfigurationInnerRadius?: string | undefined;
55
+ chartConfigurationOuterRadius?: string | undefined;
56
+ chartConfigurationColors?: string | undefined;
57
+ chartConfigurationHideLegend?: string | undefined;
58
+ chartConfigurationShowMark?: string | undefined;
59
+ chartConfigurationHeight?: string | undefined;
60
+ chartConfigurationWidth?: string | undefined;
61
+ chartConfigurationSeriesGap?: string | undefined;
62
+ chartConfigurationTickPlacement?: string | undefined;
63
+ chartConfigurationTickLabelPlacement?: string | undefined;
64
+ chartConfigurationCategoriesAxisLabel?: string | undefined;
65
+ chartConfigurationSeriesAxisLabel?: string | undefined;
66
+ chartConfigurationXAxisPosition?: string | undefined;
67
+ chartConfigurationYAxisPosition?: string | undefined;
68
+ chartConfigurationSeriesAxisReverse?: string | undefined;
69
+ chartConfigurationTooltipPlacement?: string | undefined;
70
+ chartConfigurationTooltipTrigger?: string | undefined;
71
+ chartConfigurationLegendPosition?: string | undefined;
72
+ chartConfigurationLegendDirection?: string | undefined;
73
+ chartConfigurationBarLabels?: string | undefined;
74
+ chartConfigurationColumnLabels?: string | undefined;
75
+ chartConfigurationInterpolation?: string | undefined;
76
+ chartConfigurationPaddingAngle?: string | undefined;
77
+ chartConfigurationCornerRadius?: string | undefined;
78
+ chartConfigurationArcLabels?: string | undefined;
79
+ chartConfigurationStartAngle?: string | undefined;
80
+ chartConfigurationEndAngle?: string | undefined;
81
+ chartConfigurationPieTooltipTrigger?: string | undefined;
82
+ chartConfigurationPieLegendPosition?: string | undefined;
83
+ chartConfigurationPieLegendDirection?: string | undefined;
84
+ chartConfigurationOptionNone?: string | undefined;
85
+ chartConfigurationOptionValue?: string | undefined;
86
+ chartConfigurationOptionAuto?: string | undefined;
87
+ chartConfigurationOptionTop?: string | undefined;
88
+ chartConfigurationOptionTopLeft?: string | undefined;
89
+ chartConfigurationOptionTopRight?: string | undefined;
90
+ chartConfigurationOptionBottom?: string | undefined;
91
+ chartConfigurationOptionBottomLeft?: string | undefined;
92
+ chartConfigurationOptionBottomRight?: string | undefined;
93
+ chartConfigurationOptionLeft?: string | undefined;
94
+ chartConfigurationOptionRight?: string | undefined;
95
+ chartConfigurationOptionAxis?: string | undefined;
96
+ chartConfigurationOptionItem?: string | undefined;
97
+ chartConfigurationOptionHorizontal?: string | undefined;
98
+ chartConfigurationOptionVertical?: string | undefined;
99
+ chartConfigurationOptionBoth?: string | undefined;
100
+ chartConfigurationOptionStart?: string | undefined;
101
+ chartConfigurationOptionMiddle?: string | undefined;
102
+ chartConfigurationOptionEnd?: string | undefined;
103
+ chartConfigurationOptionExtremities?: string | undefined;
104
+ chartConfigurationOptionTick?: string | undefined;
105
+ chartConfigurationOptionMonotoneX?: string | undefined;
106
+ chartConfigurationOptionMonotoneY?: string | undefined;
107
+ chartConfigurationOptionCatmullRom?: string | undefined;
108
+ chartConfigurationOptionLinear?: string | undefined;
109
+ chartConfigurationOptionNatural?: string | undefined;
110
+ chartConfigurationOptionStep?: string | undefined;
111
+ chartConfigurationOptionStepBefore?: string | undefined;
112
+ chartConfigurationOptionStepAfter?: string | undefined;
113
+ chartConfigurationOptionBumpX?: string | undefined;
114
+ chartConfigurationOptionBumpY?: string | undefined;
19
115
  };
20
116
  };
21
117
  };
@@ -0,0 +1,6 @@
1
+ export { useChartCartesianAxis, type UseChartCartesianAxisSignature } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
2
+ export { useChartHighlight, type UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
3
+ export { useChartInteraction, type UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
4
+ export { useChartPolarAxis, type UseChartPolarAxisSignature } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
5
+ export { useChartClosestPoint, type UseChartClosestPointSignature } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
6
+ export { useChartZAxis, type UseChartZAxisSignature } from "../internals/plugins/featurePlugins/useChartZAxis/index.js";
@@ -0,0 +1,12 @@
1
+ // Core plugins
2
+
3
+ // We don't export the core plugins since they are run in the useCharts() in any case.
4
+ // Plus there is a naming conflict with `useChartId()`: The plugin managing chart id, or the hook used to retrieve this same id.
5
+
6
+ // Feature plugins
7
+ export { useChartCartesianAxis } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
8
+ export { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
9
+ export { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
10
+ export { useChartPolarAxis } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
11
+ export { useChartClosestPoint } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
12
+ export { useChartZAxis } from "../internals/plugins/featurePlugins/useChartZAxis/index.js";
@@ -1,4 +1,4 @@
1
- import { AxisId, ChartsRadiusAxisProps, ChartsRotationAxisProps, PolarAxisDefaultized, ScaleName } from "../models/axis.js";
1
+ import { AxisId, ChartsRadiusAxisProps, ChartsRotationAxisProps, PolarAxisDefaultized, ScaleName, type AxisScaleConfig, type ChartsXAxisProps, type ChartsYAxisProps, type ComputedAxis } from "../models/axis.js";
2
2
  /**
3
3
  * Get all the x-axes.
4
4
  *
@@ -10,7 +10,7 @@ import { AxisId, ChartsRadiusAxisProps, ChartsRotationAxisProps, PolarAxisDefaul
10
10
  * @returns `{ xAxis, xAxisIds }` - The x-axes and their IDs.
11
11
  */
12
12
  export declare function useXAxes(): {
13
- xAxis: import("../internals/index.js").ComputedAxisConfig<import("../index.js").ChartsXAxisProps>;
13
+ xAxis: import("../internals/index.js").ComputedAxisConfig<ChartsXAxisProps>;
14
14
  xAxisIds: AxisId[];
15
15
  };
16
16
  /**
@@ -24,7 +24,7 @@ export declare function useXAxes(): {
24
24
  * @returns `{ yAxis, yAxisIds }` - The y-axes and their IDs.
25
25
  */
26
26
  export declare function useYAxes(): {
27
- yAxis: import("../internals/index.js").ComputedAxisConfig<import("../index.js").ChartsYAxisProps>;
27
+ yAxis: import("../internals/index.js").ComputedAxisConfig<ChartsYAxisProps>;
28
28
  yAxisIds: AxisId[];
29
29
  };
30
30
  /**
@@ -32,13 +32,13 @@ export declare function useYAxes(): {
32
32
  * @param {AxisId | undefined} axisId - If provided returns the x axis with axisId, else returns the values for the default x axis.
33
33
  * @returns The X axis.
34
34
  */
35
- export declare function useXAxis(axisId?: AxisId): import("../internals/index.js").ComputedAxis<keyof import("../internals/index.js").AxisScaleConfig, any, import("../index.js").ChartsXAxisProps>;
35
+ export declare function useXAxis<T extends keyof AxisScaleConfig>(axisId?: AxisId): ComputedAxis<T, any, ChartsXAxisProps>;
36
36
  /**
37
37
  * Get the Y axis.
38
38
  * @param {AxisId | undefined} axisId - If provided returns the y axis with axisId, else returns the values for the default y axis.
39
39
  * @returns The Y axis.
40
40
  */
41
- export declare function useYAxis(axisId?: AxisId): import("../internals/index.js").ComputedAxis<keyof import("../internals/index.js").AxisScaleConfig, any, import("../index.js").ChartsYAxisProps>;
41
+ export declare function useYAxis<T extends keyof AxisScaleConfig>(axisId?: AxisId): ComputedAxis<T, any, ChartsYAxisProps>;
42
42
  export declare function useRotationAxes(): {
43
43
  rotationAxis: import("../internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js").DefaultizedAxisConfig<ChartsRotationAxisProps>;
44
44
  rotationAxisIds: string[];
@@ -1,9 +1,27 @@
1
1
  export type ChartDrawingArea = {
2
- top: number;
2
+ /**
3
+ * The gap between the left border of the SVG and the drawing area.
4
+ */
3
5
  left: number;
4
- right: number;
6
+ /**
7
+ * The gap between the top border of the SVG and the drawing area.
8
+ */
9
+ top: number;
10
+ /**
11
+ * The gap between the bottom border of the SVG and the drawing area.
12
+ */
5
13
  bottom: number;
14
+ /**
15
+ * The gap between the right border of the SVG and the drawing area.
16
+ */
17
+ right: number;
18
+ /**
19
+ * The width of the drawing area.
20
+ */
6
21
  width: number;
22
+ /**
23
+ * The height of the drawing area.
24
+ */
7
25
  height: number;
8
26
  };
9
27
  /**
@@ -0,0 +1,15 @@
1
+ import { ChartSeriesType } from "../models/seriesType/config.js";
2
+ import { SeriesId } from "../models/seriesType/common.js";
3
+ export type FocusedItemData = {
4
+ seriesType: ChartSeriesType;
5
+ seriesId: SeriesId;
6
+ dataIndex: number;
7
+ };
8
+ /**
9
+ * Get the focused item from keyboard navigation.
10
+ */
11
+ export declare function useFocusedItem(): {
12
+ seriesType: keyof import("../internals/index.js").ChartsSeriesConfig;
13
+ seriesId: SeriesId;
14
+ dataIndex: number;
15
+ } | null;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useFocusedItem = useFocusedItem;
9
+ var React = _interopRequireWildcard(require("react"));
10
+ var _useStore = require("../internals/store/useStore");
11
+ var _useSelector = require("../internals/store/useSelector");
12
+ var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
13
+ /**
14
+ * Get the focused item from keyboard navigation.
15
+ */
16
+ function useFocusedItem() {
17
+ const store = (0, _useStore.useStore)();
18
+ const focusedSeriesType = (0, _useSelector.useSelector)(store, _useChartKeyboardNavigation.selectorChartsFocusedSeriesType);
19
+ const focusedSeriesId = (0, _useSelector.useSelector)(store, _useChartKeyboardNavigation.selectorChartsFocusedSeriesId);
20
+ const focusedDataIndex = (0, _useSelector.useSelector)(store, _useChartKeyboardNavigation.selectorChartsFocusedDataIndex);
21
+ return React.useMemo(() => focusedSeriesType === undefined || focusedSeriesId === undefined || focusedDataIndex === undefined ? null : {
22
+ seriesType: focusedSeriesType,
23
+ seriesId: focusedSeriesId,
24
+ dataIndex: focusedDataIndex
25
+ }, [focusedSeriesType, focusedSeriesId, focusedDataIndex]);
26
+ }
@@ -0,0 +1,12 @@
1
+ import { FocusedItemData } from "./useFocusedItem.js";
2
+ type UseItemFocusedParams = FocusedItemData;
3
+ /**
4
+ * A hook to check if an item has the focus.
5
+ *
6
+ * If you need to process multiple points, use the `useIsItemFocusedGetter` hook instead.
7
+ *
8
+ * @param {FocusedItemData} item is the item to check
9
+ * @returns {boolean} the focus state
10
+ */
11
+ export declare function useIsItemFocused(item: UseItemFocusedParams): boolean;
12
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useIsItemFocused = useIsItemFocused;
8
+ var _useFocusedItem = require("./useFocusedItem");
9
+ /**
10
+ * A hook to check if an item has the focus.
11
+ *
12
+ * If you need to process multiple points, use the `useIsItemFocusedGetter` hook instead.
13
+ *
14
+ * @param {FocusedItemData} item is the item to check
15
+ * @returns {boolean} the focus state
16
+ */
17
+ function useIsItemFocused(item) {
18
+ const focusedItem = (0, _useFocusedItem.useFocusedItem)();
19
+ return focusedItem !== null && focusedItem.seriesType === item.seriesType && focusedItem.seriesId === item.seriesId && focusedItem.dataIndex === item.dataIndex;
20
+ }
@@ -0,0 +1,8 @@
1
+ import { FocusedItemData } from "./useFocusedItem.js";
2
+ /**
3
+ * A hook to check focus state of multiple items.
4
+ * If you're interested by a single one, consider using `useIsItemFocused`.
5
+ *
6
+ * @returns {(item: FocusedItemData) => boolean} callback to get the state of the item.
7
+ */
8
+ export declare function useIsItemFocusedGetter(): (item: FocusedItemData) => boolean;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useIsItemFocusedGetter = useIsItemFocusedGetter;
8
+ var _useFocusedItem = require("./useFocusedItem");
9
+ /**
10
+ * A hook to check focus state of multiple items.
11
+ * If you're interested by a single one, consider using `useIsItemFocused`.
12
+ *
13
+ * @returns {(item: FocusedItemData) => boolean} callback to get the state of the item.
14
+ */
15
+ function useIsItemFocusedGetter() {
16
+ const focusedItem = (0, _useFocusedItem.useFocusedItem)();
17
+ return item => focusedItem !== null && focusedItem.seriesType === item.seriesType && focusedItem.seriesId === item.seriesId && focusedItem.dataIndex === item.dataIndex;
18
+ }
package/hooks/useScale.js CHANGED
@@ -21,6 +21,12 @@ function getValueToPositionMapper(scale) {
21
21
  if ((0, _scaleGuards.isOrdinalScale)(scale)) {
22
22
  return value => (scale(value) ?? 0) + scale.bandwidth() / 2;
23
23
  }
24
+ const domain = scale.domain();
25
+
26
+ // Fixes https://github.com/mui/mui-x/issues/18999#issuecomment-3173787401
27
+ if (domain[0] === domain[1]) {
28
+ return value => value === domain[0] ? scale(value) : NaN;
29
+ }
24
30
  return value => scale(value);
25
31
  }
26
32
 
package/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./constants/index.js";
2
2
  export * from "./context/index.js";
3
3
  export * from "./hooks/index.js";
4
+ export * from "./plugins/index.js";
4
5
  export * from "./colorPalettes/index.js";
5
6
  export * from "./models/index.js";
6
7
  export * from "./ChartsClipPath/index.js";
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v8.11.3
2
+ * @mui/x-charts v8.13.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -55,6 +55,18 @@ Object.keys(_hooks).forEach(function (key) {
55
55
  }
56
56
  });
57
57
  });
58
+ var _plugins = require("./plugins");
59
+ Object.keys(_plugins).forEach(function (key) {
60
+ if (key === "default" || key === "__esModule") return;
61
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
62
+ if (key in exports && exports[key] === _plugins[key]) return;
63
+ Object.defineProperty(exports, key, {
64
+ enumerable: true,
65
+ get: function () {
66
+ return _plugins[key];
67
+ }
68
+ });
69
+ });
58
70
  var _colorPalettes = require("./colorPalettes");
59
71
  Object.keys(_colorPalettes).forEach(function (key) {
60
72
  if (key === "default" || key === "__esModule") return;
@@ -55,7 +55,6 @@ class Transition {
55
55
  /* If we're resuming the transition, then subtract elapsed to continue the easing. */
56
56
  const time = (0, _d3Timer.now)() - this.elapsed;
57
57
  this.timer = (0, _d3Timer.timer)(elapsed => this.timerCallback(elapsed), 0, time);
58
- (0, _d3Timer.timerFlush)();
59
58
  return this;
60
59
  }
61
60
 
@@ -79,7 +78,6 @@ class Transition {
79
78
  finish() {
80
79
  this.stop();
81
80
  (0, _d3Timer.timeout)(() => this.timerCallback(this.duration));
82
- (0, _d3Timer.timerFlush)();
83
81
  return this;
84
82
  }
85
83
  }
@@ -25,7 +25,8 @@ export * from "./plugins/featurePlugins/useChartCartesianAxis/index.js";
25
25
  export * from "./plugins/featurePlugins/useChartPolarAxis/index.js";
26
26
  export * from "./plugins/featurePlugins/useChartInteraction/index.js";
27
27
  export * from "./plugins/featurePlugins/useChartHighlight/index.js";
28
- export * from "./plugins/featurePlugins/useChartVoronoi/index.js";
28
+ export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
29
+ export * from "./plugins/featurePlugins/useChartClosestPoint/index.js";
29
30
  export * from "./plugins/utils/selectors.js";
30
31
  export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js";
31
32
  export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js";
@@ -54,7 +55,7 @@ export * from "./dateHelpers.js";
54
55
  export * from "./invertScale.js";
55
56
  export * from "./scaleGuards.js";
56
57
  export * from "./findMinMax.js";
57
- export { getAxisExtremum } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js";
58
+ export { getAxisExtrema } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js";
58
59
  export * from "../context/ChartProvider/index.js";
59
60
  export * from "../context/ChartsSlotsContext.js";
60
61
  export * from "../models/seriesType/config.js";
@@ -18,12 +18,12 @@ var _exportNames = {
18
18
  useRadarChartProps: true,
19
19
  getCartesianAxisTriggerTooltip: true,
20
20
  getCartesianAxisIndex: true,
21
- getAxisExtremum: true
21
+ getAxisExtrema: true
22
22
  };
23
- Object.defineProperty(exports, "getAxisExtremum", {
23
+ Object.defineProperty(exports, "getAxisExtrema", {
24
24
  enumerable: true,
25
25
  get: function () {
26
- return _getAxisExtremum.getAxisExtremum;
26
+ return _getAxisExtrema.getAxisExtrema;
27
27
  }
28
28
  });
29
29
  Object.defineProperty(exports, "getCartesianAxisIndex", {
@@ -302,15 +302,27 @@ Object.keys(_useChartHighlight).forEach(function (key) {
302
302
  }
303
303
  });
304
304
  });
305
- var _useChartVoronoi = require("./plugins/featurePlugins/useChartVoronoi");
306
- Object.keys(_useChartVoronoi).forEach(function (key) {
305
+ var _useChartKeyboardNavigation = require("./plugins/featurePlugins/useChartKeyboardNavigation");
306
+ Object.keys(_useChartKeyboardNavigation).forEach(function (key) {
307
307
  if (key === "default" || key === "__esModule") return;
308
308
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
309
- if (key in exports && exports[key] === _useChartVoronoi[key]) return;
309
+ if (key in exports && exports[key] === _useChartKeyboardNavigation[key]) return;
310
310
  Object.defineProperty(exports, key, {
311
311
  enumerable: true,
312
312
  get: function () {
313
- return _useChartVoronoi[key];
313
+ return _useChartKeyboardNavigation[key];
314
+ }
315
+ });
316
+ });
317
+ var _useChartClosestPoint = require("./plugins/featurePlugins/useChartClosestPoint");
318
+ Object.keys(_useChartClosestPoint).forEach(function (key) {
319
+ if (key === "default" || key === "__esModule") return;
320
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
321
+ if (key in exports && exports[key] === _useChartClosestPoint[key]) return;
322
+ Object.defineProperty(exports, key, {
323
+ enumerable: true,
324
+ get: function () {
325
+ return _useChartClosestPoint[key];
314
326
  }
315
327
  });
316
328
  });
@@ -628,7 +640,7 @@ Object.keys(_findMinMax).forEach(function (key) {
628
640
  }
629
641
  });
630
642
  });
631
- var _getAxisExtremum = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum");
643
+ var _getAxisExtrema = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema");
632
644
  var _ChartProvider = require("../context/ChartProvider");
633
645
  Object.keys(_ChartProvider).forEach(function (key) {
634
646
  if (key === "default" || key === "__esModule") return;
@@ -2,9 +2,10 @@ import { ChartSeriesType } from "../../models/seriesType/config.js";
2
2
  import { UseChartCartesianAxisSignature } from "./featurePlugins/useChartCartesianAxis/index.js";
3
3
  import { UseChartHighlightSignature } from "./featurePlugins/useChartHighlight/index.js";
4
4
  import { UseChartInteractionSignature } from "./featurePlugins/useChartInteraction/index.js";
5
+ import { UseChartKeyboardNavigationSignature } from "./featurePlugins/useChartKeyboardNavigation/index.js";
5
6
  import { UseChartPolarAxisSignature } from "./featurePlugins/useChartPolarAxis/index.js";
6
- import { UseChartVoronoiSignature } from "./featurePlugins/useChartVoronoi/index.js";
7
+ import { UseChartClosestPointSignature } from "./featurePlugins/useChartClosestPoint/index.js";
7
8
  import { UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/index.js";
8
- export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature];
9
- export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature];
10
- export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartVoronoiSignature>];
9
+ export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
10
+ export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
11
+ export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartClosestPointSignature>, import("./models/index.js").ChartPlugin<UseChartKeyboardNavigationSignature>];
@@ -7,8 +7,9 @@ exports.DEFAULT_PLUGINS = void 0;
7
7
  var _useChartCartesianAxis = require("./featurePlugins/useChartCartesianAxis");
8
8
  var _useChartHighlight = require("./featurePlugins/useChartHighlight");
9
9
  var _useChartInteraction = require("./featurePlugins/useChartInteraction");
10
- var _useChartVoronoi = require("./featurePlugins/useChartVoronoi");
10
+ var _useChartKeyboardNavigation = require("./featurePlugins/useChartKeyboardNavigation");
11
+ var _useChartClosestPoint = require("./featurePlugins/useChartClosestPoint");
11
12
  var _useChartZAxis = require("./featurePlugins/useChartZAxis");
12
13
  // This file should be removed after creating all plugins in favor of a file per chart type.
13
14
 
14
- const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartCartesianAxis.useChartCartesianAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight, _useChartVoronoi.useChartVoronoi];
15
+ const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartCartesianAxis.useChartCartesianAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation];
@@ -12,43 +12,62 @@ const preventDefault = event => event.preventDefault();
12
12
  const useChartInteractionListener = ({
13
13
  svgRef
14
14
  }) => {
15
+ const gestureManagerRef = React.useRef(null);
15
16
  React.useEffect(() => {
16
17
  const svg = svgRef.current;
17
- if (!svg) {
18
+ if (!gestureManagerRef.current) {
19
+ gestureManagerRef.current = new _core.GestureManager({
20
+ gestures: [
21
+ // We separate the zoom gestures from the gestures that are not zoom related
22
+ // This allows us to configure the zoom gestures based on the zoom configuration.
23
+ new _core.PanGesture({
24
+ name: 'pan',
25
+ threshold: 0,
26
+ maxPointers: 1
27
+ }), new _core.PanGesture({
28
+ name: 'zoomPan',
29
+ threshold: 0,
30
+ maxPointers: 1,
31
+ preventIf: ['zoomTapAndDrag']
32
+ }), new _core.MoveGesture({
33
+ name: 'move',
34
+ preventIf: ['pan', 'zoomPinch', 'zoomPan'] // Prevent move gesture when pan is active
35
+ }), new _core.PinchGesture({
36
+ name: 'zoomPinch',
37
+ threshold: 5,
38
+ preventIf: ['pan', 'zoomPan']
39
+ }), new _core.TurnWheelGesture({
40
+ name: 'zoomTurnWheel',
41
+ sensitivity: 0.01,
42
+ initialDelta: 1
43
+ }), new _core.TapGesture({
44
+ name: 'tap',
45
+ maxDistance: 10,
46
+ preventIf: ['pan', 'zoomPan', 'zoomPinch']
47
+ }), new _core.PressGesture({
48
+ name: 'quickPress',
49
+ duration: 50,
50
+ maxDistance: 10
51
+ }), new _core.TapAndDragGesture({
52
+ name: 'zoomTapAndDrag',
53
+ tapMaxDistance: 10,
54
+ dragThreshold: 10,
55
+ dragTimeout: 1000
56
+ })]
57
+ });
58
+ }
59
+
60
+ // Assign gesture manager after initialization
61
+ const gestureManager = gestureManagerRef.current;
62
+ if (!svg || !gestureManager) {
18
63
  return undefined;
19
64
  }
20
- const gestureManager = new _core.GestureManager({
21
- gestures: [new _core.PanGesture({
22
- name: 'pan',
23
- threshold: 0,
24
- maxPointers: 1
25
- }), new _core.MoveGesture({
26
- name: 'move',
27
- preventIf: ['pan', 'pinch'] // Prevent move gesture when pan is active
28
- }), new _core.PinchGesture({
29
- name: 'pinch',
30
- threshold: 5,
31
- preventIf: ['pan']
32
- }), new _core.TurnWheelGesture({
33
- name: 'turnWheel',
34
- sensitivity: 0.01,
35
- initialDelta: 1
36
- }), new _core.TapGesture({
37
- name: 'tap',
38
- maxDistance: 10,
39
- preventIf: ['pan', 'pinch']
40
- }), new _core.PressGesture({
41
- name: 'quickPress',
42
- duration: 50,
43
- maxDistance: 10
44
- })]
45
- });
46
- gestureManager.registerElement(['pan', 'move', 'pinch', 'turnWheel', 'tap', 'quickPress'], svg);
65
+ gestureManager.registerElement(['pan', 'move', 'zoomPinch', 'zoomPan', 'zoomTurnWheel', 'tap', 'quickPress', 'zoomTapAndDrag'], svg);
47
66
  return () => {
48
67
  // Cleanup gesture manager
49
- gestureManager.destroy();
68
+ gestureManager.unregisterAllGestures(svg);
50
69
  };
51
- }, [svgRef]);
70
+ }, [svgRef, gestureManagerRef]);
52
71
  const addInteractionListener = React.useCallback((interaction, callback, options) => {
53
72
  // Forcefully cast the svgRef to any, it is annoying to fix the types.
54
73
  const svg = svgRef.current;
@@ -57,6 +76,14 @@ const useChartInteractionListener = ({
57
76
  cleanup: () => svg?.removeEventListener(interaction, callback)
58
77
  };
59
78
  }, [svgRef]);
79
+ const updateZoomInteractionListeners = React.useCallback((interaction, options) => {
80
+ const svg = svgRef.current;
81
+ const gestureManager = gestureManagerRef.current;
82
+ if (!gestureManager || !svg) {
83
+ return;
84
+ }
85
+ gestureManager.setGestureOptions(interaction, svg, options ?? {});
86
+ }, [svgRef, gestureManagerRef]);
60
87
  React.useEffect(() => {
61
88
  const svg = svgRef.current;
62
89
 
@@ -73,7 +100,8 @@ const useChartInteractionListener = ({
73
100
  }, [svgRef]);
74
101
  return {
75
102
  instance: {
76
- addInteractionListener
103
+ addInteractionListener,
104
+ updateZoomInteractionListeners
77
105
  }
78
106
  };
79
107
  };
@@ -1,16 +1,23 @@
1
- import { MoveEvent, PanEvent, PinchEvent, PressEvent, TapEvent, TurnWheelEvent } from '@mui/x-internal-gestures/core';
1
+ import { MoveEvent, PanEvent, PanGestureOptions, PinchEvent, PinchGestureOptions, PressEvent, TapEvent, TurnWheelEvent, type TapAndDragEvent, type TapAndDragGestureOptions, type TurnWheelGestureOptions } from '@mui/x-internal-gestures/core';
2
2
  import { ChartPluginSignature } from "../../models/index.js";
3
- export type ChartInteraction = 'pan' | 'panStart' | 'panEnd' | 'pinch' | 'pinchStart' | 'pinchEnd' | 'move' | 'moveStart' | 'moveEnd' | 'quickPress' | 'quickPressEnd' | 'turnWheel' | 'tap';
3
+ export type ChartInteraction = 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd' | 'move' | 'moveStart' | 'moveEnd' | 'quickPress' | 'quickPressEnd' | 'zoomTurnWheel' | 'tap';
4
4
  export type InteractionListenerResult = {
5
5
  cleanup: () => void;
6
6
  };
7
7
  export type AddInteractionListener = {
8
- <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'pan' | 'panStart' | 'panEnd', callback: (event: PanEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
9
- <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'pinch' | 'pinchStart' | 'pinchEnd', callback: (event: PinchEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
10
- <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'turnWheel', callback: (event: TurnWheelEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
8
+ <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd', callback: (event: PanEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
9
+ <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd', callback: (event: PinchEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
10
+ <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomTurnWheel', callback: (event: TurnWheelEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
11
11
  <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'move' | 'moveStart' | 'moveEnd', callback: (event: MoveEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
12
12
  <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'tap', callback: (event: TapEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
13
13
  <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'quickPress' | 'quickPressEnd', callback: (event: PressEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
14
+ <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd', callback: (event: TapAndDragEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
15
+ };
16
+ export type UpdateZoomInteractionListeners = {
17
+ (interaction: 'zoomPan', options?: Omit<PanGestureOptions<'zoomPan'>, 'name'>): void;
18
+ (interaction: 'zoomPinch', options?: Omit<PinchGestureOptions<'zoomPinch'>, 'name'>): void;
19
+ (interaction: 'zoomTurnWheel', options?: Omit<TurnWheelGestureOptions<'zoomTurnWheel'>, 'name'>): void;
20
+ (interaction: 'zoomTapAndDrag', options?: Omit<TapAndDragGestureOptions<'zoomTapAndDrag'>, 'name'>): void;
14
21
  };
15
22
  export interface UseChartInteractionListenerParameters {}
16
23
  export interface UseChartInteractionListenerState {}
@@ -22,6 +29,13 @@ export interface UseChartInteractionListenerInstance {
22
29
  * @param callback The callback to call when the interaction occurs.
23
30
  */
24
31
  addInteractionListener: AddInteractionListener;
32
+ /**
33
+ * Updates the zoom interaction listeners with the provided options.
34
+ *
35
+ * @param interaction The interaction to update.
36
+ * @param options The options to apply to the interaction.
37
+ */
38
+ updateZoomInteractionListeners: UpdateZoomInteractionListeners;
25
39
  }
26
40
  export type UseChartInteractionListenerSignature = ChartPluginSignature<{
27
41
  params: UseChartInteractionListenerParameters;