@mui/x-charts 8.11.2 → 8.12.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 (330) 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 +2 -0
  7. package/BarChart/index.js +12 -0
  8. package/BarChart/useBarChartProps.d.ts +2 -2
  9. package/BarChart/useBarChartProps.js +4 -3
  10. package/CHANGELOG.md +231 -0
  11. package/ChartContainer/ChartContainer.js +4 -2
  12. package/ChartContainer/useChartContainerProps.js +4 -2
  13. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +4 -4
  14. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +4 -4
  15. package/ChartsLegend/ChartsLegend.js +2 -1
  16. package/ChartsLegend/ContinuousColorLegend.js +1 -0
  17. package/ChartsLegend/PiecewiseColorLegend.d.ts +2 -2
  18. package/ChartsLegend/PiecewiseColorLegend.js +33 -22
  19. package/ChartsLegend/piecewiseColorLegendClasses.d.ts +4 -0
  20. package/ChartsLegend/piecewiseColorLegendClasses.js +2 -2
  21. package/ChartsSurface/ChartsSurface.js +22 -2
  22. package/ChartsWrapper/ChartsWrapper.d.ts +5 -0
  23. package/ChartsWrapper/ChartsWrapper.js +87 -36
  24. package/ChartsXAxis/ChartsGroupedXAxisTicks.js +2 -2
  25. package/ChartsXAxis/ChartsXAxisImpl.js +3 -3
  26. package/ChartsXAxis/getVisibleLabels.js +5 -1
  27. package/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
  28. package/ChartsYAxis/ChartsGroupedYAxisTicks.js +2 -2
  29. package/ChartsYAxis/ChartsYAxisImpl.js +3 -3
  30. package/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
  31. package/LineChart/FocusedMark.d.ts +2 -0
  32. package/LineChart/FocusedMark.js +44 -0
  33. package/LineChart/LineChart.d.ts +2 -2
  34. package/LineChart/LineChart.js +3 -1
  35. package/LineChart/LineChart.plugins.d.ts +3 -2
  36. package/LineChart/LineChart.plugins.js +2 -1
  37. package/LineChart/index.d.ts +1 -0
  38. package/LineChart/index.js +12 -0
  39. package/LineChart/useAreaPlotData.js +2 -2
  40. package/LineChart/useLineChartProps.d.ts +2 -2
  41. package/LineChart/useLineChartProps.js +2 -1
  42. package/LineChart/useLinePlotData.js +2 -2
  43. package/PieChart/PieArc.d.ts +1 -0
  44. package/PieChart/PieArc.js +7 -3
  45. package/PieChart/PieArcPlot.js +1 -0
  46. package/PieChart/PieChart.js +2 -0
  47. package/PieChart/PieChart.plugins.d.ts +2 -1
  48. package/PieChart/PieChart.plugins.js +2 -1
  49. package/PieChart/dataTransform/useTransformData.d.ts +1 -0
  50. package/PieChart/dataTransform/useTransformData.js +9 -1
  51. package/PieChart/index.d.ts +1 -0
  52. package/PieChart/index.js +12 -0
  53. package/RadarChart/RadarAxis/useRadarAxis.js +2 -2
  54. package/RadarChart/RadarChart.plugins.d.ts +1 -1
  55. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
  56. package/RadarChart/index.d.ts +2 -1
  57. package/RadarChart/index.js +12 -0
  58. package/RadarChart/useRadarChartProps.d.ts +2 -2
  59. package/RadarChart/useRadarChartProps.js +2 -1
  60. package/ScatterChart/BatchScatter.d.ts +32 -0
  61. package/ScatterChart/BatchScatter.js +171 -0
  62. package/ScatterChart/Scatter.js +13 -5
  63. package/ScatterChart/ScatterChart.d.ts +4 -4
  64. package/ScatterChart/ScatterChart.js +13 -2
  65. package/ScatterChart/ScatterChart.plugins.d.ts +4 -3
  66. package/ScatterChart/ScatterChart.plugins.js +3 -2
  67. package/ScatterChart/ScatterPlot.d.ts +10 -0
  68. package/ScatterChart/ScatterPlot.js +14 -2
  69. package/ScatterChart/index.d.ts +1 -0
  70. package/ScatterChart/index.js +12 -0
  71. package/ScatterChart/useScatterChartProps.d.ts +2 -2
  72. package/ScatterChart/useScatterChartProps.js +10 -6
  73. package/SparkLineChart/SparkLineChart.js +10 -5
  74. package/colorPalettes/types.d.ts +1 -1
  75. package/context/ChartApi.d.ts +6 -6
  76. package/esm/BarChart/BarChart.d.ts +2 -2
  77. package/esm/BarChart/BarChart.js +1 -0
  78. package/esm/BarChart/BarChart.plugins.d.ts +3 -2
  79. package/esm/BarChart/BarChart.plugins.js +2 -1
  80. package/esm/BarChart/BarElement.js +10 -2
  81. package/esm/BarChart/index.d.ts +2 -0
  82. package/esm/BarChart/index.js +1 -0
  83. package/esm/BarChart/useBarChartProps.d.ts +2 -2
  84. package/esm/BarChart/useBarChartProps.js +4 -3
  85. package/esm/ChartContainer/ChartContainer.js +4 -2
  86. package/esm/ChartContainer/useChartContainerProps.js +4 -2
  87. package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +4 -4
  88. package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +4 -4
  89. package/esm/ChartsLegend/ChartsLegend.js +2 -1
  90. package/esm/ChartsLegend/ContinuousColorLegend.js +1 -0
  91. package/esm/ChartsLegend/PiecewiseColorLegend.d.ts +2 -2
  92. package/esm/ChartsLegend/PiecewiseColorLegend.js +33 -22
  93. package/esm/ChartsLegend/piecewiseColorLegendClasses.d.ts +4 -0
  94. package/esm/ChartsLegend/piecewiseColorLegendClasses.js +2 -2
  95. package/esm/ChartsSurface/ChartsSurface.js +22 -2
  96. package/esm/ChartsWrapper/ChartsWrapper.d.ts +5 -0
  97. package/esm/ChartsWrapper/ChartsWrapper.js +87 -36
  98. package/esm/ChartsXAxis/ChartsGroupedXAxisTicks.js +2 -2
  99. package/esm/ChartsXAxis/ChartsXAxisImpl.js +3 -3
  100. package/esm/ChartsXAxis/getVisibleLabels.js +5 -1
  101. package/esm/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
  102. package/esm/ChartsYAxis/ChartsGroupedYAxisTicks.js +2 -2
  103. package/esm/ChartsYAxis/ChartsYAxisImpl.js +3 -3
  104. package/esm/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
  105. package/esm/LineChart/FocusedMark.d.ts +2 -0
  106. package/esm/LineChart/FocusedMark.js +38 -0
  107. package/esm/LineChart/LineChart.d.ts +2 -2
  108. package/esm/LineChart/LineChart.js +3 -1
  109. package/esm/LineChart/LineChart.plugins.d.ts +3 -2
  110. package/esm/LineChart/LineChart.plugins.js +2 -1
  111. package/esm/LineChart/index.d.ts +1 -0
  112. package/esm/LineChart/index.js +1 -0
  113. package/esm/LineChart/useAreaPlotData.js +2 -2
  114. package/esm/LineChart/useLineChartProps.d.ts +2 -2
  115. package/esm/LineChart/useLineChartProps.js +2 -1
  116. package/esm/LineChart/useLinePlotData.js +2 -2
  117. package/esm/PieChart/PieArc.d.ts +1 -0
  118. package/esm/PieChart/PieArc.js +7 -3
  119. package/esm/PieChart/PieArcPlot.js +1 -0
  120. package/esm/PieChart/PieChart.js +2 -0
  121. package/esm/PieChart/PieChart.plugins.d.ts +2 -1
  122. package/esm/PieChart/PieChart.plugins.js +2 -1
  123. package/esm/PieChart/dataTransform/useTransformData.d.ts +1 -0
  124. package/esm/PieChart/dataTransform/useTransformData.js +9 -1
  125. package/esm/PieChart/index.d.ts +1 -0
  126. package/esm/PieChart/index.js +1 -0
  127. package/esm/RadarChart/RadarAxis/useRadarAxis.js +2 -2
  128. package/esm/RadarChart/RadarChart.plugins.d.ts +1 -1
  129. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
  130. package/esm/RadarChart/index.d.ts +2 -1
  131. package/esm/RadarChart/index.js +2 -1
  132. package/esm/RadarChart/useRadarChartProps.d.ts +2 -2
  133. package/esm/RadarChart/useRadarChartProps.js +2 -1
  134. package/esm/ScatterChart/BatchScatter.d.ts +32 -0
  135. package/esm/ScatterChart/BatchScatter.js +165 -0
  136. package/esm/ScatterChart/Scatter.js +13 -5
  137. package/esm/ScatterChart/ScatterChart.d.ts +4 -4
  138. package/esm/ScatterChart/ScatterChart.js +13 -2
  139. package/esm/ScatterChart/ScatterChart.plugins.d.ts +4 -3
  140. package/esm/ScatterChart/ScatterChart.plugins.js +3 -2
  141. package/esm/ScatterChart/ScatterPlot.d.ts +10 -0
  142. package/esm/ScatterChart/ScatterPlot.js +14 -2
  143. package/esm/ScatterChart/index.d.ts +1 -0
  144. package/esm/ScatterChart/index.js +1 -0
  145. package/esm/ScatterChart/useScatterChartProps.d.ts +2 -2
  146. package/esm/ScatterChart/useScatterChartProps.js +10 -6
  147. package/esm/SparkLineChart/SparkLineChart.js +10 -5
  148. package/esm/colorPalettes/types.d.ts +1 -1
  149. package/esm/context/ChartApi.d.ts +6 -6
  150. package/esm/hooks/useAxis.d.ts +5 -5
  151. package/esm/hooks/useDrawingArea.d.ts +20 -2
  152. package/esm/hooks/useFocusedItem.d.ts +15 -0
  153. package/esm/hooks/useFocusedItem.js +20 -0
  154. package/esm/hooks/useIsItemFocused.d.ts +12 -0
  155. package/esm/hooks/useIsItemFocused.js +15 -0
  156. package/esm/hooks/useIsItemFocusedGetter.d.ts +8 -0
  157. package/esm/hooks/useIsItemFocusedGetter.js +14 -0
  158. package/esm/hooks/useScale.js +8 -2
  159. package/esm/hooks/useTicks.js +2 -2
  160. package/esm/hooks/useTicksGrouped.js +2 -2
  161. package/esm/index.d.ts +1 -0
  162. package/esm/index.js +2 -1
  163. package/esm/internals/animation/Transition.js +1 -3
  164. package/esm/internals/index.d.ts +4 -3
  165. package/esm/internals/index.js +4 -3
  166. package/esm/internals/invertScale.js +2 -2
  167. package/esm/internals/plugins/allPlugins.d.ts +5 -4
  168. package/esm/internals/plugins/allPlugins.js +3 -2
  169. package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
  170. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
  171. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +66 -72
  172. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
  173. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
  174. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
  175. package/{internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts → esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.d.ts} +1 -1
  176. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +24 -0
  177. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +63 -0
  178. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +123 -0
  179. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -3
  180. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
  181. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
  182. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +46 -4
  183. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
  184. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +32 -21
  185. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
  186. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.js +2 -0
  187. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
  188. package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +9 -7
  189. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
  190. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +3 -0
  191. package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
  192. package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
  193. package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +32 -0
  194. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
  195. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +5 -0
  196. package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
  197. package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +3 -0
  198. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
  199. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +2 -0
  200. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
  201. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
  202. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +88 -0
  203. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +210 -0
  204. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +25 -0
  205. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +7 -0
  206. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +34 -0
  207. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +1 -0
  208. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +2 -2
  209. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
  210. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
  211. package/esm/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
  212. package/esm/internals/scaleGuards.d.ts +11 -0
  213. package/esm/internals/scaleGuards.js +9 -0
  214. package/esm/locales/elGR.d.ts +96 -0
  215. package/esm/locales/elGR.js +100 -0
  216. package/esm/locales/enUS.d.ts +96 -0
  217. package/esm/locales/enUS.js +99 -1
  218. package/esm/locales/frFR.d.ts +96 -0
  219. package/esm/locales/frFR.js +100 -2
  220. package/esm/locales/ptBR.d.ts +96 -0
  221. package/esm/locales/ptBR.js +100 -0
  222. package/esm/locales/ptPT.d.ts +96 -0
  223. package/esm/locales/ptPT.js +100 -0
  224. package/esm/locales/svSE.d.ts +97 -1
  225. package/esm/locales/svSE.js +100 -0
  226. package/esm/locales/utils/chartsLocaleTextApi.d.ts +384 -0
  227. package/esm/locales/utils/getChartsLocalization.d.ts +96 -0
  228. package/esm/models/axis.d.ts +3 -0
  229. package/esm/plugins/index.d.ts +6 -0
  230. package/esm/plugins/index.js +12 -0
  231. package/hooks/useAxis.d.ts +5 -5
  232. package/hooks/useDrawingArea.d.ts +20 -2
  233. package/hooks/useFocusedItem.d.ts +15 -0
  234. package/hooks/useFocusedItem.js +26 -0
  235. package/hooks/useIsItemFocused.d.ts +12 -0
  236. package/hooks/useIsItemFocused.js +20 -0
  237. package/hooks/useIsItemFocusedGetter.d.ts +8 -0
  238. package/hooks/useIsItemFocusedGetter.js +18 -0
  239. package/hooks/useScale.js +8 -2
  240. package/hooks/useTicks.js +2 -2
  241. package/hooks/useTicksGrouped.js +2 -2
  242. package/index.d.ts +1 -0
  243. package/index.js +13 -1
  244. package/internals/animation/Transition.js +0 -2
  245. package/internals/index.d.ts +4 -3
  246. package/internals/index.js +24 -12
  247. package/internals/invertScale.js +2 -2
  248. package/internals/plugins/allPlugins.d.ts +5 -4
  249. package/internals/plugins/allPlugins.js +3 -2
  250. package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
  251. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
  252. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +63 -69
  253. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
  254. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
  255. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
  256. package/{esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts → internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.d.ts} +1 -1
  257. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +30 -0
  258. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +63 -0
  259. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +134 -0
  260. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -3
  261. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
  262. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
  263. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +47 -5
  264. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
  265. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +33 -22
  266. package/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
  267. package/internals/plugins/featurePlugins/useChartClosestPoint/index.js +27 -0
  268. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
  269. package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +11 -9
  270. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
  271. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +9 -0
  272. package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
  273. package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
  274. package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +41 -0
  275. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
  276. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +6 -1
  277. package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
  278. package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +9 -0
  279. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
  280. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +27 -0
  281. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
  282. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
  283. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +96 -0
  284. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +218 -0
  285. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +25 -0
  286. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +13 -0
  287. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +34 -0
  288. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +5 -0
  289. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +2 -2
  290. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
  291. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
  292. package/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
  293. package/internals/scaleGuards.d.ts +11 -0
  294. package/internals/scaleGuards.js +17 -0
  295. package/locales/elGR.d.ts +96 -0
  296. package/locales/elGR.js +100 -0
  297. package/locales/enUS.d.ts +96 -0
  298. package/locales/enUS.js +99 -1
  299. package/locales/frFR.d.ts +96 -0
  300. package/locales/frFR.js +100 -2
  301. package/locales/ptBR.d.ts +96 -0
  302. package/locales/ptBR.js +100 -0
  303. package/locales/ptPT.d.ts +96 -0
  304. package/locales/ptPT.js +100 -0
  305. package/locales/svSE.d.ts +97 -1
  306. package/locales/svSE.js +100 -0
  307. package/locales/utils/chartsLocaleTextApi.d.ts +384 -0
  308. package/locales/utils/getChartsLocalization.d.ts +96 -0
  309. package/models/axis.d.ts +3 -0
  310. package/package.json +4 -4
  311. package/plugins/index.d.ts +6 -0
  312. package/plugins/index.js +47 -0
  313. package/esm/internals/isBandScale.d.ts +0 -5
  314. package/esm/internals/isBandScale.js +0 -3
  315. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -22
  316. package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
  317. package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -2
  318. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
  319. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
  320. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -3
  321. package/internals/isBandScale.d.ts +0 -5
  322. package/internals/isBandScale.js +0 -9
  323. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -29
  324. package/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
  325. package/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -27
  326. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
  327. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
  328. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -9
  329. /package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
  330. /package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
@@ -28,6 +28,7 @@ const RootElement = (0, _styles.styled)('ul', {
28
28
  theme,
29
29
  ownerState
30
30
  }) => {
31
+ const classes = _piecewiseColorLegendClasses.piecewiseColorLegendClasses;
31
32
  return (0, _extends2.default)({}, theme.typography.caption, {
32
33
  color: (theme.vars || theme).palette.text.primary,
33
34
  lineHeight: '100%',
@@ -39,8 +40,9 @@ const RootElement = (0, _styles.styled)('ul', {
39
40
  paddingInlineStart: 0,
40
41
  marginBlock: theme.spacing(1),
41
42
  marginInline: theme.spacing(1),
42
- width: 'max-content',
43
- [`button.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.item}`]: {
43
+ width: 'fit-content',
44
+ gridArea: 'legend',
45
+ [`button.${classes.item}`]: {
44
46
  // Reset button styles
45
47
  background: 'none',
46
48
  border: 'none',
@@ -52,55 +54,62 @@ const RootElement = (0, _styles.styled)('ul', {
52
54
  letterSpacing: 'inherit',
53
55
  color: 'inherit'
54
56
  },
55
- [`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.item}`]: {
57
+ [`.${classes.item}`]: {
56
58
  display: 'flex',
57
59
  gap: theme.spacing(0.5)
58
60
  },
59
- [`li :not(.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.minLabel}, .${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.maxLabel}) .${_piecewiseColorLegendClasses.piecewiseColorLegendClasses?.mark}`]: {
61
+ [`li :not(.${classes.minLabel}, .${classes.maxLabel}) .${classes?.mark}`]: {
60
62
  alignSelf: 'center'
61
63
  },
62
- [`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.start}`]: {
64
+ [`&.${classes.start}`]: {
63
65
  alignItems: 'end'
64
66
  },
65
- [`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.end}`]: {
67
+ [`&.${classes.end}`]: {
66
68
  alignItems: 'start'
67
69
  },
68
- [`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.horizontal}`]: {
70
+ [`&.${classes.horizontal}`]: {
69
71
  alignItems: 'center',
70
- [`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.item}`]: {
72
+ [`.${classes.item}`]: {
71
73
  flexDirection: 'column'
72
74
  },
73
- [`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.start}`]: {
75
+ [`&.${classes.inlineStart}, &.${classes.inlineEnd}`]: {
76
+ gap: theme.spacing(1.5),
77
+ flexWrap: 'wrap',
78
+ [`.${classes.item}`]: {
79
+ flexDirection: 'row'
80
+ }
81
+ },
82
+ [`&.${classes.start}`]: {
74
83
  alignItems: 'end'
75
84
  },
76
- [`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.end}`]: {
85
+ [`&.${classes.end}`]: {
77
86
  alignItems: 'start'
78
87
  },
79
- [`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.minLabel}`]: {
88
+ [`.${classes.minLabel}`]: {
80
89
  alignItems: 'end'
81
90
  },
82
- [`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.extremes}`]: {
83
- [`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.minLabel}, .${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.maxLabel}`]: {
91
+ [`&.${classes.extremes}`]: {
92
+ [`.${classes.minLabel}, .${classes.maxLabel}`]: {
84
93
  alignItems: 'center',
85
94
  display: 'flex',
86
95
  flexDirection: 'row'
87
96
  }
88
97
  }
89
98
  },
90
- [`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.vertical}`]: {
91
- [`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.item}`]: {
99
+ [`&.${classes.vertical}`]: {
100
+ [`.${classes.item}`]: {
92
101
  flexDirection: 'row',
93
102
  alignItems: 'center'
94
103
  },
95
- [`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.start}`]: {
104
+ [`&.${classes.start}, &.${classes.inlineStart}`]: {
96
105
  alignItems: 'end'
97
106
  },
98
- [`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.end}`]: {
107
+ [`&.${classes.end}, &.${classes.inlineEnd}`]: {
99
108
  alignItems: 'start'
100
109
  },
101
- [`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.extremes}`]: {
110
+ [`&.${classes.extremes}`]: {
102
111
  alignItems: 'center',
103
- [`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.minLabel}, .${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.maxLabel}`]: {
112
+ [`.${classes.minLabel}, .${classes.maxLabel}`]: {
104
113
  alignItems: 'center',
105
114
  display: 'flex',
106
115
  flexDirection: 'column'
@@ -153,6 +162,8 @@ const PiecewiseColorLegend = exports.PiecewiseColorLegend = (0, _consumeThemePro
153
162
  const isStart = labelPosition === 'start';
154
163
  const isEnd = labelPosition === 'end';
155
164
  const isExtremes = labelPosition === 'extremes';
165
+ const isInlineStart = labelPosition === 'inline-start';
166
+ const isInlineEnd = labelPosition === 'inline-end';
156
167
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(RootElement, (0, _extends2.default)({
157
168
  className: (0, _clsx.default)(classes?.root, className),
158
169
  ref: ref
@@ -186,8 +197,8 @@ const PiecewiseColorLegend = exports.PiecewiseColorLegend = (0, _consumeThemePro
186
197
  if (label === null || label === undefined) {
187
198
  return null;
188
199
  }
189
- const isTextBefore = isStart || isExtremes && isFirst;
190
- const isTextAfter = isEnd || isExtremes && isLast;
200
+ const isTextBefore = isStart || isExtremes && isFirst || isInlineStart;
201
+ const isTextAfter = isEnd || isExtremes && isLast || isInlineEnd;
191
202
  const clickObject = {
192
203
  type: 'piecewiseColor',
193
204
  color,
@@ -255,7 +266,7 @@ process.env.NODE_ENV !== "production" ? PiecewiseColorLegend.propTypes = {
255
266
  * Where to position the labels relative to the gradient.
256
267
  * @default 'extremes'
257
268
  */
258
- labelPosition: _propTypes.default.oneOf(['start', 'end', 'extremes']),
269
+ labelPosition: _propTypes.default.oneOf(['start', 'end', 'extremes', 'inline-start', 'inline-end']),
259
270
  /**
260
271
  * The type of the mark.
261
272
  * @default 'square'
@@ -19,6 +19,10 @@ export interface PiecewiseColorLegendClasses {
19
19
  end: string;
20
20
  /** Styles applied to the legend with the labels on the extremes of the color marks. */
21
21
  extremes: string;
22
+ /** Styles applied to the legend with the labels inlined before the color marks. */
23
+ inlineStart: string;
24
+ /** Styles applied to the legend with the labels inlined after the color marks. */
25
+ inlineEnd: string;
22
26
  /** Styles applied to the marks. */
23
27
  mark: string;
24
28
  /** Styles applied to the series label. */
@@ -18,7 +18,7 @@ const useUtilityClasses = props => {
18
18
  labelPosition
19
19
  } = props;
20
20
  const slots = {
21
- root: ['root', direction, labelPosition],
21
+ root: ['root', direction, labelPosition?.replaceAll(/-(\w)/g, match => match[1].toUpperCase())],
22
22
  minLabel: ['minLabel'],
23
23
  maxLabel: ['maxLabel'],
24
24
  item: ['item'],
@@ -28,4 +28,4 @@ const useUtilityClasses = props => {
28
28
  return (0, _composeClasses.default)(slots, getLegendUtilityClass, classes);
29
29
  };
30
30
  exports.useUtilityClasses = useUtilityClasses;
31
- const piecewiseColorLegendClasses = exports.piecewiseColorLegendClasses = (0, _generateUtilityClasses.default)('MuiPiecewiseColorLegendClasses', ['root', 'minLabel', 'maxLabel', 'item', 'vertical', 'horizontal', 'start', 'end', 'extremes', 'mark', 'label']);
31
+ const piecewiseColorLegendClasses = exports.piecewiseColorLegendClasses = (0, _generateUtilityClasses.default)('MuiPiecewiseColorLegendClasses', ['root', 'minLabel', 'maxLabel', 'item', 'vertical', 'horizontal', 'start', 'end', 'extremes', 'inlineStart', 'inlineEnd', 'mark', 'label']);
@@ -18,6 +18,7 @@ var _useSvgRef = require("../hooks/useSvgRef");
18
18
  var _useSelector = require("../internals/store/useSelector");
19
19
  var _useStore = require("../internals/store/useStore");
20
20
  var _useChartDimensions = require("../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors");
21
+ var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
21
22
  var _jsxRuntime = require("react/jsx-runtime");
22
23
  const _excluded = ["children", "className", "title", "desc"];
23
24
  const ChartsSurfaceStyles = (0, _styles.styled)('svg', {
@@ -37,7 +38,22 @@ const ChartsSurfaceStyles = (0, _styles.styled)('svg', {
37
38
  // This prevents default touch actions when using the svg on mobile devices.
38
39
  // For example, prevent page scroll & zoom.
39
40
  touchAction: 'pan-y',
40
- userSelect: 'none'
41
+ userSelect: 'none',
42
+ gridArea: 'chart',
43
+ '&:focus': {
44
+ outline: 'none' // By default don't show focus on the SVG container
45
+ },
46
+ '&:focus-visible': {
47
+ // Show focus outline on the SVG container only when using keyboard navigation
48
+ outline: 'auto',
49
+ '&[data-has-focused-item=true]': {
50
+ // But not if the chart has a focused children item
51
+ outline: 'none'
52
+ }
53
+ },
54
+ '& [data-focused=true]': {
55
+ outline: 'auto'
56
+ }
41
57
  }));
42
58
 
43
59
  /**
@@ -64,6 +80,8 @@ const ChartsSurface = exports.ChartsSurface = /*#__PURE__*/React.forwardRef(func
64
80
  width: propsWidth,
65
81
  height: propsHeight
66
82
  } = (0, _useSelector.useSelector)(store, _useChartDimensions.selectorChartPropsSize);
83
+ const isKeyboardNavigationEnabled = (0, _useSelector.useSelector)(store, _useChartKeyboardNavigation.selectorChartsIsKeyboardNavigationEnabled);
84
+ const hasFocusedItem = (0, _useSelector.useSelector)(store, _useChartKeyboardNavigation.selectorChartsHasFocusedItem);
67
85
  const svgRef = (0, _useSvgRef.useSvgRef)();
68
86
  const handleRef = (0, _useForkRef.default)(svgRef, ref);
69
87
  const themeProps = (0, _styles.useThemeProps)({
@@ -84,7 +102,9 @@ const ChartsSurface = exports.ChartsSurface = /*#__PURE__*/React.forwardRef(func
84
102
  height: propsHeight
85
103
  },
86
104
  viewBox: `${0} ${0} ${svgWidth} ${svgHeight}`,
87
- className: className
105
+ className: className,
106
+ tabIndex: isKeyboardNavigationEnabled ? 0 : undefined,
107
+ "data-has-focused-item": hasFocusedItem || undefined
88
108
  }, other, {
89
109
  ref: handleRef,
90
110
  children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("title", {
@@ -13,6 +13,11 @@ export interface ChartsWrapperProps {
13
13
  * @default 'horizontal'
14
14
  */
15
15
  legendDirection?: Direction;
16
+ /**
17
+ * If `true`, the legend is not rendered.
18
+ * @default false
19
+ */
20
+ hideLegend?: boolean;
16
21
  /**
17
22
  * If `true`, the chart wrapper set `height: 100%`.
18
23
  * @default `false` if the `height` prop is set. And `true` otherwise.
@@ -14,59 +14,103 @@ var _useChartRootRef = require("../hooks/useChartRootRef");
14
14
  var _useStore = require("../internals/store/useStore");
15
15
  var _useSelector = require("../internals/store/useSelector");
16
16
  var _useChartDimensions = require("../internals/plugins/corePlugins/useChartDimensions");
17
+ var _Toolbar = require("../Toolbar");
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
- const getDirection = (direction, position) => {
19
+ const getJustifyItems = position => {
20
+ if (position?.horizontal === 'start') {
21
+ return 'start';
22
+ }
23
+ if (position?.horizontal === 'end') {
24
+ return 'end';
25
+ }
26
+ return 'center';
27
+ };
28
+ const getAlignItems = position => {
29
+ if (position?.vertical === 'top') {
30
+ return 'flex-start';
31
+ }
32
+ if (position?.vertical === 'bottom') {
33
+ return 'flex-end';
34
+ }
35
+ return 'center';
36
+ };
37
+ const getGridTemplateAreas = (hideLegend, direction, position) => {
38
+ if (hideLegend) {
39
+ return `"chart"`;
40
+ }
19
41
  if (direction === 'vertical') {
20
42
  if (position?.horizontal === 'start') {
21
- return 'row';
43
+ return `"legend chart"`;
22
44
  }
23
- return 'row-reverse';
45
+ return `"chart legend"`;
24
46
  }
25
47
  if (position?.vertical === 'bottom') {
26
- return 'column-reverse';
48
+ return `"chart"
49
+ "legend"`;
50
+ }
51
+ return `"legend"
52
+ "chart"`;
53
+ };
54
+ const getTemplateColumns = (hideLegend = false, direction = 'horizontal', horizontalPosition = 'end', width = undefined) => {
55
+ const drawingAreaColumn = width ? 'auto' : '1fr';
56
+ if (direction === 'horizontal') {
57
+ return drawingAreaColumn;
27
58
  }
28
- return 'column';
59
+ if (hideLegend) {
60
+ return drawingAreaColumn;
61
+ }
62
+ return horizontalPosition === 'start' ? `auto ${drawingAreaColumn}` : `${drawingAreaColumn} auto`;
29
63
  };
30
- const getAlign = (direction, position) => {
64
+ const getTemplateRows = (hideLegend = false, direction = 'horizontal', verticalPosition = 'top') => {
65
+ const drawingAreaRow = '1fr';
31
66
  if (direction === 'vertical') {
32
- if (position?.vertical === 'top') {
33
- return 'flex-start';
34
- }
35
- if (position?.vertical === 'bottom') {
36
- return 'flex-end';
37
- }
67
+ return drawingAreaRow;
38
68
  }
39
- if (direction === 'horizontal') {
40
- if (position?.horizontal === 'start') {
41
- return 'flex-start';
42
- }
43
- if (position?.horizontal === 'end') {
44
- return 'flex-end';
45
- }
69
+ if (hideLegend) {
70
+ return drawingAreaRow;
46
71
  }
47
- return 'center';
72
+ return verticalPosition === 'bottom' ? `${drawingAreaRow} auto` : `auto ${drawingAreaRow}`;
48
73
  };
49
74
  const Root = (0, _styles.styled)('div', {
50
75
  name: 'MuiChartsWrapper',
51
76
  slot: 'Root',
52
- shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'extendVertically'
77
+ shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'extendVertically' && prop !== 'width'
53
78
  })(({
54
- ownerState
55
- }) => ({
56
- display: 'flex',
57
- flexDirection: getDirection(ownerState.legendDirection, ownerState.legendPosition),
58
- flex: 1,
59
- justifyContent: 'center',
60
- alignItems: getAlign(ownerState.legendDirection, ownerState.legendPosition),
61
- variants: [{
62
- props: {
63
- extendVertically: true
79
+ ownerState,
80
+ width
81
+ }) => {
82
+ const gridTemplateColumns = getTemplateColumns(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition?.horizontal, width);
83
+ const gridTemplateRows = getTemplateRows(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition?.vertical);
84
+ const gridTemplateAreas = getGridTemplateAreas(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition);
85
+ return {
86
+ variants: [{
87
+ props: {
88
+ extendVertically: true
89
+ },
90
+ style: {
91
+ height: '100%'
92
+ }
93
+ }],
94
+ flex: 1,
95
+ display: 'grid',
96
+ gridTemplateColumns,
97
+ gridTemplateRows,
98
+ gridTemplateAreas,
99
+ [`&:has(.${_Toolbar.chartsToolbarClasses.root})`]: {
100
+ // Add a row for toolbar if there is one.
101
+ gridTemplateRows: `auto ${gridTemplateRows}`,
102
+ gridTemplateAreas: `"${gridTemplateColumns.split(' ').map(() => 'toolbar').join(' ')}"
103
+ ${gridTemplateAreas}`
64
104
  },
65
- style: {
66
- height: '100%'
67
- }
68
- }]
69
- }));
105
+ [`& .${_Toolbar.chartsToolbarClasses.root}`]: {
106
+ gridArea: 'toolbar',
107
+ justifySelf: 'center'
108
+ },
109
+ justifyContent: 'center',
110
+ justifyItems: getJustifyItems(ownerState.legendPosition),
111
+ alignItems: getAlignItems(ownerState.legendPosition)
112
+ };
113
+ });
70
114
 
71
115
  /**
72
116
  * Wrapper for the charts components.
@@ -81,6 +125,7 @@ function ChartsWrapper(props) {
81
125
  const chartRootRef = (0, _useChartRootRef.useChartRootRef)();
82
126
  const store = (0, _useStore.useStore)();
83
127
  const {
128
+ width: propsWidth,
84
129
  height: propsHeight
85
130
  } = (0, _useSelector.useSelector)(store, _useChartDimensions.selectorChartPropsSize);
86
131
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, {
@@ -88,6 +133,7 @@ function ChartsWrapper(props) {
88
133
  ownerState: props,
89
134
  sx: sx,
90
135
  extendVertically: extendVertically ?? propsHeight === undefined,
136
+ width: propsWidth,
91
137
  children: children
92
138
  });
93
139
  }
@@ -102,6 +148,11 @@ process.env.NODE_ENV !== "production" ? ChartsWrapper.propTypes = {
102
148
  * @default `false` if the `height` prop is set. And `true` otherwise.
103
149
  */
104
150
  extendVertically: _propTypes.default.bool,
151
+ /**
152
+ * If `true`, the legend is not rendered.
153
+ * @default false
154
+ */
155
+ hideLegend: _propTypes.default.bool,
105
156
  /**
106
157
  * The direction of the legend.
107
158
  * @default 'horizontal'
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.ChartsGroupedXAxisTicks = ChartsGroupedXAxisTicks;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var React = _interopRequireWildcard(require("react"));
12
- var _isBandScale = require("../internals/isBandScale");
12
+ var _scaleGuards = require("../internals/scaleGuards");
13
13
  var _useChartContext = require("../context/ChartProvider/useChartContext");
14
14
  var _utilities = require("./utilities");
15
15
  var _useTicksGrouped = require("../hooks/useTicksGrouped");
@@ -40,7 +40,7 @@ function ChartsGroupedXAxisTicks(inProps) {
40
40
  TickLabel,
41
41
  axisTickLabelProps
42
42
  } = (0, _useAxisTicksProps.useAxisTicksProps)(inProps);
43
- if (!(0, _isBandScale.isBandScale)(xScale)) {
43
+ if (!(0, _scaleGuards.isOrdinalScale)(xScale)) {
44
44
  throw new Error('MUI X Charts: ChartsGroupedXAxis only supports the `band` and `point` scale types.');
45
45
  }
46
46
  const {
@@ -15,7 +15,7 @@ var _styles = require("@mui/material/styles");
15
15
  var _ChartsSingleXAxisTicks = require("./ChartsSingleXAxisTicks");
16
16
  var _ChartsGroupedXAxisTicks = require("./ChartsGroupedXAxisTicks");
17
17
  var _ChartsText = require("../ChartsText");
18
- var _isBandScale = require("../internals/isBandScale");
18
+ var _scaleGuards = require("../internals/scaleGuards");
19
19
  var _isInfinity = require("../internals/isInfinity");
20
20
  var _utilities = require("./utilities");
21
21
  var _hooks = require("../hooks");
@@ -87,8 +87,8 @@ function ChartsXAxisImpl(_ref) {
87
87
  }
88
88
  const labelHeight = label ? (0, _domUtils.getStringSize)(label, axisLabelProps.style).height : 0;
89
89
  const domain = xScale.domain();
90
- const isScaleBand = (0, _isBandScale.isBandScale)(xScale);
91
- const skipTickRendering = isScaleBand && domain.length === 0 || !isScaleBand && domain.some(_isInfinity.isInfinity);
90
+ const isScaleOrdinal = (0, _scaleGuards.isOrdinalScale)(xScale);
91
+ const skipTickRendering = isScaleOrdinal ? domain.length === 0 : domain.some(_isInfinity.isInfinity);
92
92
  let children = null;
93
93
  if (!skipTickRendering) {
94
94
  children = 'groups' in axis && Array.isArray(axis.groups) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGroupedXAxisTicks.ChartsGroupedXAxisTicks, (0, _extends2.default)({}, inProps)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSingleXAxisTicks.ChartsSingleXAxisTicks, (0, _extends2.default)({}, inProps, {
@@ -43,8 +43,12 @@ function getVisibleLabels(xTicks, {
43
43
  return new Set(xTicks.filter((item, labelIndex) => {
44
44
  const {
45
45
  offset,
46
- labelOffset
46
+ labelOffset,
47
+ formattedValue
47
48
  } = item;
49
+ if (formattedValue === '') {
50
+ return false;
51
+ }
48
52
  const textPosition = offset + labelOffset;
49
53
  if (labelIndex > 0 && direction * textPosition < direction * (previousTextLimit + tickLabelMinGap)) {
50
54
  return false;
@@ -3685,9 +3685,11 @@ export declare function useAxisTicksProps(inProps: ChartsXAxisProps): {
3685
3685
  x?: number | string | undefined | undefined;
3686
3686
  y?: number | string | undefined | undefined;
3687
3687
  radius?: number | string | undefined | undefined;
3688
+ href?: string | undefined | undefined;
3688
3689
  media?: string | undefined | undefined;
3689
- method?: string | undefined | undefined;
3690
3690
  target?: string | undefined | undefined;
3691
+ from?: number | string | undefined | undefined;
3692
+ method?: string | undefined | undefined;
3691
3693
  crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
3692
3694
  accentHeight?: number | string | undefined | undefined;
3693
3695
  accumulate?: "none" | "sum" | undefined | undefined;
@@ -3731,7 +3733,6 @@ export declare function useAxisTicksProps(inProps: ChartsXAxisProps): {
3731
3733
  focusable?: "auto" | (boolean | "true" | "false") | undefined;
3732
3734
  format?: number | string | undefined | undefined;
3733
3735
  fr?: number | string | undefined | undefined;
3734
- from?: number | string | undefined | undefined;
3735
3736
  fx?: number | string | undefined | undefined;
3736
3737
  fy?: number | string | undefined | undefined;
3737
3738
  g1?: number | string | undefined | undefined;
@@ -3744,7 +3745,6 @@ export declare function useAxisTicksProps(inProps: ChartsXAxisProps): {
3744
3745
  hanging?: number | string | undefined | undefined;
3745
3746
  horizAdvX?: number | string | undefined | undefined;
3746
3747
  horizOriginX?: number | string | undefined | undefined;
3747
- href?: string | undefined | undefined;
3748
3748
  ideographic?: number | string | undefined | undefined;
3749
3749
  in2?: number | string | undefined | undefined;
3750
3750
  in?: string | undefined | undefined;
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.ChartsGroupedYAxisTicks = ChartsGroupedYAxisTicks;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var React = _interopRequireWildcard(require("react"));
12
- var _isBandScale = require("../internals/isBandScale");
12
+ var _scaleGuards = require("../internals/scaleGuards");
13
13
  var _useChartContext = require("../context/ChartProvider/useChartContext");
14
14
  var _utilities = require("./utilities");
15
15
  var _useTicksGrouped = require("../hooks/useTicksGrouped");
@@ -41,7 +41,7 @@ function ChartsGroupedYAxisTicks(inProps) {
41
41
  TickLabel,
42
42
  axisTickLabelProps
43
43
  } = (0, _useAxisTicksProps.useAxisTicksProps)(inProps);
44
- if (!(0, _isBandScale.isBandScale)(yScale)) {
44
+ if (!(0, _scaleGuards.isOrdinalScale)(yScale)) {
45
45
  throw new Error('MUI X Charts: ChartsGroupedYAxis only supports the `band` and `point` scale types.');
46
46
  }
47
47
  const {
@@ -19,7 +19,7 @@ var _utilities = require("./utilities");
19
19
  var _isInfinity = require("../internals/isInfinity");
20
20
  var _useDrawingArea = require("../hooks/useDrawingArea");
21
21
  var _useIsHydrated = require("../hooks/useIsHydrated");
22
- var _isBandScale = require("../internals/isBandScale");
22
+ var _scaleGuards = require("../internals/scaleGuards");
23
23
  var _domUtils = require("../internals/domUtils");
24
24
  var _AxisSharedComponents = require("../internals/components/AxisSharedComponents");
25
25
  var _jsxRuntime = require("react/jsx-runtime");
@@ -107,8 +107,8 @@ function ChartsYAxisImpl(_ref) {
107
107
  };
108
108
  const axisLabelHeight = label == null ? 0 : (0, _domUtils.getStringSize)(label, axisLabelProps.style).height;
109
109
  const domain = yScale.domain();
110
- const isScaleBand = (0, _isBandScale.isBandScale)(yScale);
111
- const skipTickRendering = isScaleBand && domain.length === 0 || !isScaleBand && domain.some(_isInfinity.isInfinity);
110
+ const isScaleOrdinal = (0, _scaleGuards.isOrdinalScale)(yScale);
111
+ const skipTickRendering = isScaleOrdinal ? domain.length === 0 : domain.some(_isInfinity.isInfinity);
112
112
  let children = null;
113
113
  if (!skipTickRendering) {
114
114
  children = 'groups' in axis && Array.isArray(axis.groups) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGroupedYAxisTicks.ChartsGroupedYAxisTicks, (0, _extends2.default)({}, inProps)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSingleYAxisTicks.ChartsSingleYAxisTicks, (0, _extends2.default)({}, inProps, {
@@ -3604,9 +3604,11 @@ export declare function useAxisTicksProps(inProps: ChartsYAxisProps): {
3604
3604
  x?: number | string | undefined | undefined;
3605
3605
  y?: number | string | undefined | undefined;
3606
3606
  radius?: number | string | undefined | undefined;
3607
+ href?: string | undefined | undefined;
3607
3608
  media?: string | undefined | undefined;
3608
- method?: string | undefined | undefined;
3609
3609
  target?: string | undefined | undefined;
3610
+ from?: number | string | undefined | undefined;
3611
+ method?: string | undefined | undefined;
3610
3612
  crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
3611
3613
  accentHeight?: number | string | undefined | undefined;
3612
3614
  accumulate?: "none" | "sum" | undefined | undefined;
@@ -3650,7 +3652,6 @@ export declare function useAxisTicksProps(inProps: ChartsYAxisProps): {
3650
3652
  focusable?: "auto" | (boolean | "true" | "false") | undefined;
3651
3653
  format?: number | string | undefined | undefined;
3652
3654
  fr?: number | string | undefined | undefined;
3653
- from?: number | string | undefined | undefined;
3654
3655
  fx?: number | string | undefined | undefined;
3655
3656
  fy?: number | string | undefined | undefined;
3656
3657
  g1?: number | string | undefined | undefined;
@@ -3663,7 +3664,6 @@ export declare function useAxisTicksProps(inProps: ChartsYAxisProps): {
3663
3664
  hanging?: number | string | undefined | undefined;
3664
3665
  horizAdvX?: number | string | undefined | undefined;
3665
3666
  horizOriginX?: number | string | undefined | undefined;
3666
- href?: string | undefined | undefined;
3667
3667
  ideographic?: number | string | undefined | undefined;
3668
3668
  in2?: number | string | undefined | undefined;
3669
3669
  in?: string | undefined | undefined;
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare function FocusedMark(): React.JSX.Element | null;
@@ -0,0 +1,44 @@
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.FocusedMark = FocusedMark;
9
+ var React = _interopRequireWildcard(require("react"));
10
+ var _styles = require("@mui/material/styles");
11
+ var _useFocusedItem = require("../hooks/useFocusedItem");
12
+ var _hooks = require("../hooks");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ const RADIUS = 6;
15
+ function FocusedMark() {
16
+ const theme = (0, _styles.useTheme)();
17
+ const focusedItem = (0, _useFocusedItem.useFocusedItem)();
18
+ const lineSeries = (0, _hooks.useLineSeriesContext)();
19
+ const {
20
+ xAxis,
21
+ xAxisIds
22
+ } = (0, _hooks.useXAxes)();
23
+ const {
24
+ yAxis,
25
+ yAxisIds
26
+ } = (0, _hooks.useYAxes)();
27
+ if (focusedItem === null || focusedItem.seriesType !== 'line' || !lineSeries) {
28
+ return null;
29
+ }
30
+ const series = lineSeries?.series[focusedItem.seriesId];
31
+ const xAxisId = series.xAxisId ?? xAxisIds[0];
32
+ const yAxisId = series.yAxisId ?? yAxisIds[0];
33
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
34
+ fill: "none",
35
+ stroke: (theme.vars ?? theme).palette.text.primary,
36
+ strokeWidth: 2,
37
+ x: xAxis[xAxisId].scale(xAxis[xAxisId].data[focusedItem.dataIndex]) - RADIUS,
38
+ y: yAxis[yAxisId].scale(series.stackedData[focusedItem.dataIndex][1]) - RADIUS,
39
+ width: 2 * RADIUS,
40
+ height: 2 * RADIUS,
41
+ rx: 3,
42
+ ry: 3
43
+ });
44
+ }
@@ -14,12 +14,12 @@ import { ChartsAxisSlotProps, ChartsAxisSlots } from "../models/axis.js";
14
14
  import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from "./LineHighlightPlot.js";
15
15
  import { ChartsGridProps } from "../ChartsGrid/index.js";
16
16
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
17
- import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
17
+ import { LineChartPluginSignatures } from "./LineChart.plugins.js";
18
18
  import { ChartsToolbarSlots, ChartsToolbarSlotProps } from "../Toolbar/index.js";
19
19
  export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
20
20
  export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
21
21
  export type LineSeries = MakeOptional<LineSeriesType, 'type'>;
22
- export interface LineChartProps extends Omit<ChartContainerProps<'line', LineChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
22
+ export interface LineChartProps extends Omit<ChartContainerProps<'line', LineChartPluginSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
23
23
  /**
24
24
  * The series to display in the line chart.
25
25
  * An array of [[LineSeries]] objects.
@@ -27,6 +27,7 @@ var _useChartContainerProps = require("../ChartContainer/useChartContainerProps"
27
27
  var _ChartDataProvider = require("../ChartDataProvider");
28
28
  var _ChartsSurface = require("../ChartsSurface");
29
29
  var _ChartsWrapper = require("../ChartsWrapper");
30
+ var _FocusedMark = require("./FocusedMark");
30
31
  var _jsxRuntime = require("react/jsx-runtime");
31
32
  /**
32
33
  * Demos:
@@ -70,7 +71,7 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
70
71
  children: [props.showToolbar && Toolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
71
72
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
72
73
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, (0, _extends2.default)({}, areaPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, (0, _extends2.default)({}, linePlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
73
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
74
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusedMark.FocusedMark, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
74
75
  "data-drawing-container": true,
75
76
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, (0, _extends2.default)({}, markPlotProps))
76
77
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, (0, _extends2.default)({}, lineHighlightPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
@@ -118,6 +119,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
118
119
  * If `true`, render the line highlight item.
119
120
  */
120
121
  disableLineItemHighlight: _propTypes.default.bool,
122
+ enableKeyboardNavigation: _propTypes.default.bool,
121
123
  /**
122
124
  * Options to enable features planned for the next major.
123
125
  */
@@ -2,6 +2,7 @@ import { UseChartZAxisSignature } from "../internals/plugins/featurePlugins/useC
2
2
  import { UseChartCartesianAxisSignature } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
3
3
  import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
4
4
  import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
5
+ import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
5
6
  import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
6
- export type LineChartPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature];
7
- export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<LineChartPluginsSignatures>;
7
+ export type LineChartPluginSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
8
+ export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<LineChartPluginSignatures>;