@mui/x-charts 8.0.0-alpha.0 → 8.0.0-alpha.2

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 (417) hide show
  1. package/BarChart/AnimatedBarElement.d.ts +15 -0
  2. package/BarChart/AnimatedBarElement.js +21 -0
  3. package/BarChart/BarChart.d.ts +4 -9
  4. package/BarChart/BarChart.js +3 -35
  5. package/BarChart/BarElement.d.ts +5 -1342
  6. package/BarChart/BarElement.js +10 -20
  7. package/BarChart/BarLabel/BarLabel.d.ts +298 -298
  8. package/BarChart/BarPlot.js +12 -2
  9. package/BarChart/useBarChartProps.d.ts +0 -2
  10. package/BarChart/useBarChartProps.js +2 -8
  11. package/CHANGELOG.md +651 -6
  12. package/ChartContainer/ChartContainer.d.ts +26 -19
  13. package/ChartContainer/ChartContainer.js +31 -25
  14. package/ChartContainer/useChartContainerProps.d.ts +5 -7
  15. package/ChartContainer/useChartContainerProps.js +12 -27
  16. package/ChartsAxis/axisClasses.js +2 -1
  17. package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -17
  18. package/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
  19. package/ChartsAxisHighlight/ChartsAxisHighlight.types.d.ts +5 -0
  20. package/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
  21. package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +6 -0
  22. package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
  23. package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +10 -0
  24. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
  25. package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +10 -0
  26. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
  27. package/ChartsAxisHighlight/chartsAxisHighlightClasses.d.ts +7 -0
  28. package/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
  29. package/ChartsAxisHighlight/index.d.ts +3 -0
  30. package/ChartsAxisHighlight/index.js +4 -1
  31. package/ChartsGrid/ChartsGrid.js +1 -1
  32. package/ChartsGrid/ChartsHorizontalGrid.d.ts +2 -2
  33. package/ChartsGrid/ChartsHorizontalGrid.js +3 -3
  34. package/ChartsGrid/ChartsVerticalGrid.d.ts +2 -2
  35. package/ChartsGrid/ChartsVerticalGrid.js +3 -3
  36. package/ChartsLegend/LegendPerItem.d.ts +2 -2
  37. package/ChartsLegend/chartsLegendClasses.js +2 -1
  38. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
  39. package/ChartsSurface/ChartsSurface.d.ts +14 -15
  40. package/ChartsSurface/ChartsSurface.js +68 -35
  41. package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
  42. package/ChartsTooltip/ChartTooltip.types.js +1 -0
  43. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +7 -39
  44. package/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
  45. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -28
  46. package/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
  47. package/ChartsTooltip/ChartsTooltip.d.ts +3 -69
  48. package/ChartsTooltip/ChartsTooltip.js +143 -145
  49. package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
  50. package/ChartsTooltip/ChartsTooltipContainer.js +280 -0
  51. package/ChartsTooltip/ChartsTooltipTable.js +1 -1
  52. package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -0
  53. package/ChartsTooltip/chartsTooltipClasses.js +18 -2
  54. package/ChartsTooltip/index.d.ts +3 -3
  55. package/ChartsTooltip/index.js +2 -3
  56. package/ChartsTooltip/useAxisTooltip.d.ts +2 -2
  57. package/ChartsTooltip/useAxisTooltip.js +19 -19
  58. package/ChartsTooltip/useItemTooltip.d.ts +2 -3
  59. package/ChartsTooltip/useItemTooltip.js +5 -4
  60. package/ChartsTooltip/utils.d.ts +0 -3
  61. package/ChartsTooltip/utils.js +0 -8
  62. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +49 -36
  63. package/ChartsXAxis/ChartsXAxis.js +3 -17
  64. package/ChartsYAxis/ChartsYAxis.js +2 -17
  65. package/Gauge/Gauge.d.ts +1 -1
  66. package/Gauge/Gauge.js +0 -6
  67. package/Gauge/GaugeContainer.d.ts +3 -3
  68. package/Gauge/GaugeContainer.js +42 -76
  69. package/LineChart/AnimatedArea.d.ts +0 -1333
  70. package/LineChart/AnimatedArea.js +9 -18
  71. package/LineChart/AnimatedLine.d.ts +0 -1333
  72. package/LineChart/AnimatedLine.js +9 -20
  73. package/LineChart/AreaPlot.js +12 -2
  74. package/LineChart/CircleMarkElement.js +6 -5
  75. package/LineChart/LineChart.d.ts +4 -10
  76. package/LineChart/LineChart.js +3 -36
  77. package/LineChart/LineHighlightPlot.js +6 -5
  78. package/LineChart/LinePlot.js +12 -2
  79. package/LineChart/MarkElement.js +6 -5
  80. package/LineChart/useLineChartProps.d.ts +0 -2
  81. package/LineChart/useLineChartProps.js +2 -8
  82. package/PieChart/PieChart.d.ts +3 -9
  83. package/PieChart/PieChart.js +5 -41
  84. package/PieChart/PiePlot.js +2 -2
  85. package/PieChart/getPieCoordinates.d.ts +2 -2
  86. package/README.md +2 -2
  87. package/ScatterChart/Scatter.js +6 -5
  88. package/ScatterChart/ScatterChart.d.ts +4 -10
  89. package/ScatterChart/ScatterChart.js +5 -36
  90. package/ScatterChart/useScatterChartProps.d.ts +0 -2
  91. package/ScatterChart/useScatterChartProps.js +1 -9
  92. package/SparkLineChart/SparkLineChart.d.ts +3 -4
  93. package/SparkLineChart/SparkLineChart.js +4 -35
  94. package/context/CartesianProvider/defaultizeAxis.d.ts +9 -11
  95. package/context/ChartDataProvider/ChartDataProvider.d.ts +36 -19
  96. package/context/ChartDataProvider/ChartDataProvider.js +55 -48
  97. package/context/ChartDataProvider/useChartDataProviderProps.d.ts +25 -32
  98. package/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
  99. package/context/ChartDataProvider/useDefaultizeAxis.d.ts +9 -11
  100. package/context/ChartProvider/ChartContext.d.ts +6 -0
  101. package/context/ChartProvider/ChartContext.js +8 -0
  102. package/context/ChartProvider/ChartProvider.d.ts +4 -0
  103. package/context/ChartProvider/ChartProvider.js +19 -0
  104. package/context/ChartProvider/ChartProvider.types.d.ts +24 -0
  105. package/context/ChartProvider/ChartProvider.types.js +1 -0
  106. package/context/ChartProvider/index.d.ts +3 -0
  107. package/context/ChartProvider/index.js +3 -0
  108. package/context/ChartProvider/useChartContext.d.ts +3 -0
  109. package/context/ChartProvider/useChartContext.js +11 -0
  110. package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
  111. package/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
  112. package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +3 -0
  113. package/context/DrawingAreaProvider/DrawingAreaContext.js +15 -0
  114. package/context/DrawingAreaProvider/DrawingAreaProvider.d.ts +3 -0
  115. package/{modern/context/DrawingProvider.js → context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
  116. package/context/DrawingAreaProvider/index.d.ts +3 -0
  117. package/context/DrawingAreaProvider/index.js +3 -0
  118. package/context/InteractionSelectors.d.ts +382 -0
  119. package/context/InteractionSelectors.js +12 -0
  120. package/context/SizeProvider/Size.types.d.ts +30 -0
  121. package/context/SizeProvider/Size.types.js +1 -0
  122. package/context/SizeProvider/SizeContext.d.ts +4 -0
  123. package/context/SizeProvider/SizeContext.js +15 -0
  124. package/context/SizeProvider/SizeProvider.d.ts +11 -0
  125. package/context/SizeProvider/SizeProvider.js +26 -0
  126. package/context/SizeProvider/index.d.ts +4 -0
  127. package/context/SizeProvider/index.js +4 -0
  128. package/context/SizeProvider/useChartContainerDimensions.d.ts +9 -0
  129. package/{modern/ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +16 -6
  130. package/context/SizeProvider/useSize.d.ts +5 -0
  131. package/context/SizeProvider/useSize.js +13 -0
  132. package/context/index.d.ts +2 -0
  133. package/context/index.js +2 -1
  134. package/hooks/useAxisEvents.js +32 -19
  135. package/hooks/useChartId.js +5 -6
  136. package/hooks/useDrawingArea.d.ts +2 -2
  137. package/hooks/useDrawingArea.js +2 -2
  138. package/hooks/useInteractionItemProps.js +22 -13
  139. package/hooks/useSvgRef.d.ts +1 -1
  140. package/hooks/useSvgRef.js +4 -8
  141. package/index.js +1 -1
  142. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
  143. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -7
  144. package/internals/computeAxisValue.d.ts +2 -2
  145. package/internals/defaultizeColor.d.ts +1 -1
  146. package/internals/index.d.ts +3 -4
  147. package/internals/index.js +3 -4
  148. package/internals/plugins/allPlugins.d.ts +1 -0
  149. package/internals/plugins/allPlugins.js +3 -0
  150. package/internals/plugins/corePlugins/corePlugins.d.ts +10 -0
  151. package/internals/plugins/corePlugins/corePlugins.js +7 -0
  152. package/internals/plugins/corePlugins/index.d.ts +2 -0
  153. package/internals/plugins/corePlugins/index.js +1 -0
  154. package/internals/plugins/corePlugins/useChartId/index.d.ts +2 -0
  155. package/internals/plugins/corePlugins/useChartId/index.js +1 -0
  156. package/internals/plugins/corePlugins/useChartId/useChartId.d.ts +3 -0
  157. package/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
  158. package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +36 -0
  159. package/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
  160. package/internals/plugins/corePlugins/useChartId/useChartId.types.d.ts +20 -0
  161. package/internals/plugins/corePlugins/useChartId/useChartId.types.js +1 -0
  162. package/internals/plugins/corePlugins/useChartId/useChartId.utils.d.ts +1 -0
  163. package/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
  164. package/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +3 -0
  165. package/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
  166. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.d.ts +3 -0
  167. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
  168. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +376 -0
  169. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
  170. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +57 -0
  171. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
  172. package/internals/plugins/models/chart.d.ts +14 -0
  173. package/internals/plugins/models/chart.js +1 -0
  174. package/internals/plugins/models/helpers.d.ts +7 -0
  175. package/internals/plugins/models/helpers.js +1 -0
  176. package/internals/plugins/models/index.d.ts +3 -0
  177. package/internals/plugins/models/index.js +3 -0
  178. package/internals/plugins/models/plugin.d.ts +75 -0
  179. package/internals/plugins/models/plugin.js +1 -0
  180. package/internals/plugins/utils/ChartStore.d.ts +13 -0
  181. package/internals/plugins/utils/ChartStore.js +24 -0
  182. package/internals/plugins/utils/selectors.d.ts +9 -0
  183. package/internals/plugins/utils/selectors.js +37 -0
  184. package/internals/store/useCharts.d.ts +14 -0
  185. package/internals/store/useCharts.js +72 -0
  186. package/internals/store/useCharts.types.d.ts +5 -0
  187. package/internals/store/useCharts.types.js +1 -0
  188. package/internals/store/useSelector.d.ts +4 -0
  189. package/internals/store/useSelector.js +6 -0
  190. package/internals/store/useStore.d.ts +3 -0
  191. package/internals/store/useStore.js +17 -0
  192. package/models/axis.d.ts +1 -13
  193. package/modern/BarChart/AnimatedBarElement.js +21 -0
  194. package/modern/BarChart/BarChart.js +3 -35
  195. package/modern/BarChart/BarElement.js +10 -20
  196. package/modern/BarChart/BarPlot.js +12 -2
  197. package/modern/BarChart/useBarChartProps.js +2 -8
  198. package/modern/ChartContainer/ChartContainer.js +31 -25
  199. package/modern/ChartContainer/useChartContainerProps.js +12 -27
  200. package/modern/ChartsAxis/axisClasses.js +2 -1
  201. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
  202. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
  203. package/modern/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
  204. package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
  205. package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
  206. package/modern/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
  207. package/modern/ChartsAxisHighlight/index.js +4 -1
  208. package/modern/ChartsGrid/ChartsGrid.js +1 -1
  209. package/modern/ChartsGrid/ChartsHorizontalGrid.js +3 -3
  210. package/modern/ChartsGrid/ChartsVerticalGrid.js +3 -3
  211. package/modern/ChartsLegend/chartsLegendClasses.js +2 -1
  212. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
  213. package/modern/ChartsSurface/ChartsSurface.js +68 -35
  214. package/modern/ChartsTooltip/ChartTooltip.types.js +1 -0
  215. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
  216. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
  217. package/modern/ChartsTooltip/ChartsTooltip.js +143 -145
  218. package/modern/ChartsTooltip/ChartsTooltipContainer.js +280 -0
  219. package/modern/ChartsTooltip/ChartsTooltipTable.js +1 -1
  220. package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
  221. package/modern/ChartsTooltip/index.js +2 -3
  222. package/modern/ChartsTooltip/useAxisTooltip.js +19 -19
  223. package/modern/ChartsTooltip/useItemTooltip.js +5 -4
  224. package/modern/ChartsTooltip/utils.js +0 -8
  225. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +49 -36
  226. package/modern/ChartsXAxis/ChartsXAxis.js +3 -17
  227. package/modern/ChartsYAxis/ChartsYAxis.js +2 -17
  228. package/modern/Gauge/Gauge.js +0 -6
  229. package/modern/Gauge/GaugeContainer.js +42 -76
  230. package/modern/LineChart/AnimatedArea.js +9 -18
  231. package/modern/LineChart/AnimatedLine.js +9 -20
  232. package/modern/LineChart/AreaPlot.js +12 -2
  233. package/modern/LineChart/CircleMarkElement.js +6 -5
  234. package/modern/LineChart/LineChart.js +3 -36
  235. package/modern/LineChart/LineHighlightPlot.js +6 -5
  236. package/modern/LineChart/LinePlot.js +12 -2
  237. package/modern/LineChart/MarkElement.js +6 -5
  238. package/modern/LineChart/useLineChartProps.js +2 -8
  239. package/modern/PieChart/PieChart.js +5 -41
  240. package/modern/PieChart/PiePlot.js +2 -2
  241. package/modern/ScatterChart/Scatter.js +6 -5
  242. package/modern/ScatterChart/ScatterChart.js +5 -36
  243. package/modern/ScatterChart/useScatterChartProps.js +1 -9
  244. package/modern/SparkLineChart/SparkLineChart.js +4 -35
  245. package/modern/context/ChartDataProvider/ChartDataProvider.js +55 -48
  246. package/modern/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
  247. package/modern/context/ChartProvider/ChartContext.js +8 -0
  248. package/modern/context/ChartProvider/ChartProvider.js +19 -0
  249. package/modern/context/ChartProvider/ChartProvider.types.js +1 -0
  250. package/modern/context/ChartProvider/index.js +3 -0
  251. package/modern/context/ChartProvider/useChartContext.js +11 -0
  252. package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
  253. package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +15 -0
  254. package/{context/DrawingProvider.js → modern/context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
  255. package/modern/context/DrawingAreaProvider/index.js +3 -0
  256. package/modern/context/InteractionSelectors.js +12 -0
  257. package/modern/context/SizeProvider/Size.types.js +1 -0
  258. package/modern/context/SizeProvider/SizeContext.js +15 -0
  259. package/modern/context/SizeProvider/SizeProvider.js +26 -0
  260. package/modern/context/SizeProvider/index.js +4 -0
  261. package/{ChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +16 -6
  262. package/modern/context/SizeProvider/useSize.js +13 -0
  263. package/modern/context/index.js +2 -1
  264. package/modern/hooks/useAxisEvents.js +32 -19
  265. package/modern/hooks/useChartId.js +5 -6
  266. package/modern/hooks/useDrawingArea.js +2 -2
  267. package/modern/hooks/useInteractionItemProps.js +22 -13
  268. package/modern/hooks/useSvgRef.js +4 -8
  269. package/modern/index.js +1 -1
  270. package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -7
  271. package/modern/internals/index.js +3 -4
  272. package/modern/internals/plugins/allPlugins.js +3 -0
  273. package/modern/internals/plugins/corePlugins/corePlugins.js +7 -0
  274. package/modern/internals/plugins/corePlugins/index.js +1 -0
  275. package/modern/internals/plugins/corePlugins/useChartId/index.js +1 -0
  276. package/modern/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
  277. package/modern/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
  278. package/modern/internals/plugins/corePlugins/useChartId/useChartId.types.js +1 -0
  279. package/modern/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
  280. package/modern/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
  281. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
  282. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
  283. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
  284. package/modern/internals/plugins/models/chart.js +1 -0
  285. package/modern/internals/plugins/models/helpers.js +1 -0
  286. package/modern/internals/plugins/models/index.js +3 -0
  287. package/modern/internals/plugins/models/plugin.js +1 -0
  288. package/modern/internals/plugins/utils/ChartStore.js +24 -0
  289. package/modern/internals/plugins/utils/selectors.js +37 -0
  290. package/modern/internals/store/useCharts.js +72 -0
  291. package/modern/internals/store/useCharts.types.js +1 -0
  292. package/modern/internals/store/useSelector.js +6 -0
  293. package/modern/internals/store/useStore.js +17 -0
  294. package/node/BarChart/AnimatedBarElement.js +28 -0
  295. package/node/BarChart/BarChart.js +3 -35
  296. package/node/BarChart/BarElement.js +11 -21
  297. package/node/BarChart/BarPlot.js +11 -1
  298. package/node/BarChart/useBarChartProps.js +2 -8
  299. package/node/ChartContainer/ChartContainer.js +31 -25
  300. package/node/ChartContainer/useChartContainerProps.js +12 -27
  301. package/node/ChartsAxis/axisClasses.js +5 -3
  302. package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
  303. package/node/ChartsAxisHighlight/ChartsAxisHighlight.types.js +5 -0
  304. package/node/ChartsAxisHighlight/ChartsAxisHighlightPath.js +40 -0
  305. package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +57 -0
  306. package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +57 -0
  307. package/node/ChartsAxisHighlight/chartsAxisHighlightClasses.js +14 -0
  308. package/node/ChartsAxisHighlight/index.js +33 -0
  309. package/node/ChartsGrid/ChartsGrid.js +2 -2
  310. package/node/ChartsGrid/ChartsHorizontalGrid.js +4 -4
  311. package/node/ChartsGrid/ChartsVerticalGrid.js +4 -4
  312. package/node/ChartsLegend/chartsLegendClasses.js +5 -3
  313. package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
  314. package/node/ChartsSurface/ChartsSurface.js +68 -35
  315. package/node/ChartsTooltip/ChartTooltip.types.js +5 -0
  316. package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
  317. package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
  318. package/node/ChartsTooltip/ChartsTooltip.js +142 -144
  319. package/node/ChartsTooltip/ChartsTooltipContainer.js +286 -0
  320. package/node/ChartsTooltip/ChartsTooltipTable.js +2 -2
  321. package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
  322. package/node/ChartsTooltip/index.js +19 -28
  323. package/node/ChartsTooltip/useAxisTooltip.js +19 -19
  324. package/node/ChartsTooltip/useItemTooltip.js +5 -4
  325. package/node/ChartsTooltip/utils.js +0 -9
  326. package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -37
  327. package/node/ChartsXAxis/ChartsXAxis.js +3 -17
  328. package/node/ChartsYAxis/ChartsYAxis.js +2 -17
  329. package/node/Gauge/Gauge.js +0 -6
  330. package/node/Gauge/GaugeContainer.js +42 -76
  331. package/node/LineChart/AnimatedArea.js +9 -19
  332. package/node/LineChart/AnimatedLine.js +9 -21
  333. package/node/LineChart/AreaPlot.js +11 -1
  334. package/node/LineChart/CircleMarkElement.js +6 -5
  335. package/node/LineChart/LineChart.js +3 -36
  336. package/node/LineChart/LineHighlightPlot.js +6 -5
  337. package/node/LineChart/LinePlot.js +11 -1
  338. package/node/LineChart/MarkElement.js +6 -5
  339. package/node/LineChart/useLineChartProps.js +2 -8
  340. package/node/PieChart/PieChart.js +5 -41
  341. package/node/PieChart/PiePlot.js +2 -2
  342. package/node/ScatterChart/Scatter.js +6 -5
  343. package/node/ScatterChart/ScatterChart.js +5 -36
  344. package/node/ScatterChart/useScatterChartProps.js +1 -9
  345. package/node/SparkLineChart/SparkLineChart.js +4 -35
  346. package/node/context/ChartDataProvider/ChartDataProvider.js +55 -48
  347. package/node/context/ChartDataProvider/useChartDataProviderProps.js +22 -44
  348. package/node/context/ChartProvider/ChartContext.js +15 -0
  349. package/node/context/ChartProvider/ChartProvider.js +24 -0
  350. package/node/context/ChartProvider/ChartProvider.types.js +5 -0
  351. package/node/context/ChartProvider/index.js +38 -0
  352. package/node/context/ChartProvider/useChartContext.js +18 -0
  353. package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
  354. package/node/context/DrawingAreaProvider/DrawingAreaContext.js +21 -0
  355. package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
  356. package/node/context/DrawingAreaProvider/index.js +38 -0
  357. package/node/context/InteractionSelectors.js +18 -0
  358. package/node/context/SizeProvider/Size.types.js +5 -0
  359. package/node/context/SizeProvider/SizeContext.js +22 -0
  360. package/node/context/SizeProvider/SizeProvider.js +29 -0
  361. package/node/context/SizeProvider/index.js +49 -0
  362. package/node/{ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +16 -6
  363. package/node/context/SizeProvider/useSize.js +20 -0
  364. package/node/context/index.js +10 -2
  365. package/node/hooks/useAxisEvents.js +33 -19
  366. package/node/hooks/useChartId.js +5 -7
  367. package/node/hooks/useDrawingArea.js +2 -2
  368. package/node/hooks/useInteractionItemProps.js +23 -14
  369. package/node/hooks/useSvgRef.js +4 -9
  370. package/node/index.js +1 -1
  371. package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +8 -6
  372. package/node/internals/index.js +28 -40
  373. package/node/internals/plugins/allPlugins.js +10 -0
  374. package/node/internals/plugins/corePlugins/corePlugins.js +12 -0
  375. package/node/internals/plugins/corePlugins/index.js +12 -0
  376. package/node/internals/plugins/corePlugins/useChartId/index.js +12 -0
  377. package/node/internals/plugins/corePlugins/useChartId/useChartId.js +41 -0
  378. package/node/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +15 -0
  379. package/node/internals/plugins/corePlugins/useChartId/useChartId.types.js +5 -0
  380. package/node/internals/plugins/corePlugins/useChartId/useChartId.utils.js +12 -0
  381. package/node/internals/plugins/featurePlugins/useChartInteraction/index.js +27 -0
  382. package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +81 -0
  383. package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +16 -0
  384. package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +5 -0
  385. package/node/internals/plugins/models/chart.js +5 -0
  386. package/node/internals/plugins/models/helpers.js +5 -0
  387. package/node/internals/plugins/models/index.js +38 -0
  388. package/node/internals/plugins/models/plugin.js +5 -0
  389. package/node/internals/plugins/utils/ChartStore.js +31 -0
  390. package/node/internals/plugins/utils/selectors.js +44 -0
  391. package/node/internals/store/useCharts.js +80 -0
  392. package/node/internals/store/useCharts.types.js +5 -0
  393. package/node/internals/store/useSelector.js +13 -0
  394. package/node/internals/store/useStore.js +23 -0
  395. package/package.json +7 -5
  396. package/themeAugmentation/props.d.ts +1 -2
  397. package/ChartContainer/ResizableContainer.d.ts +0 -9
  398. package/ChartContainer/ResizableContainer.js +0 -26
  399. package/ChartContainer/useChartContainerDimensions.d.ts +0 -6
  400. package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +0 -7
  401. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
  402. package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +0 -8
  403. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
  404. package/context/InteractionProvider.d.ts +0 -50
  405. package/context/InteractionProvider.js +0 -78
  406. package/modern/ChartContainer/ResizableContainer.js +0 -26
  407. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
  408. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
  409. package/modern/context/InteractionProvider.js +0 -78
  410. package/node/ChartContainer/ResizableContainer.js +0 -32
  411. package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
  412. package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
  413. package/node/context/InteractionProvider.js +0 -85
  414. /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
  415. /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
  416. /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
  417. /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
@@ -1,57 +1,19 @@
1
1
  'use client';
2
2
 
3
- import _extends from "@babel/runtime/helpers/esm/extends";
4
3
  import * as React from 'react';
5
4
  import PropTypes from 'prop-types';
6
5
  import composeClasses from '@mui/utils/composeClasses';
7
- import generateUtilityClass from '@mui/utils/generateUtilityClass';
8
- import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
9
- import { styled } from '@mui/material/styles';
10
- import { InteractionContext } from "../context/InteractionProvider.js";
11
- import { useCartesianContext } from "../context/CartesianProvider/index.js";
12
- import { getValueToPositionMapper } from "../hooks/useScale.js";
13
- import { isBandScale } from "../internals/isBandScale.js";
6
+ import { getAxisHighlightUtilityClass } from "./chartsAxisHighlightClasses.js";
7
+ import ChartsYHighlight from "./ChartsYAxisHighlight.js";
8
+ import ChartsXHighlight from "./ChartsXAxisHighlight.js";
14
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
- export function getAxisHighlightUtilityClass(slot) {
16
- return generateUtilityClass('MuiChartsAxisHighlight', slot);
17
- }
18
- export const chartsAxisHighlightClasses = generateUtilityClasses('MuiChartsAxisHighlight', ['root']);
19
10
  const useUtilityClasses = () => {
20
11
  const slots = {
21
12
  root: ['root']
22
13
  };
23
14
  return composeClasses(slots, getAxisHighlightUtilityClass);
24
15
  };
25
- export const ChartsAxisHighlightPath = styled('path', {
26
- name: 'MuiChartsAxisHighlight',
27
- slot: 'Root',
28
- overridesResolver: (_, styles) => styles.root
29
- })(({
30
- theme
31
- }) => ({
32
- pointerEvents: 'none',
33
- variants: [{
34
- props: {
35
- axisHighlight: 'band'
36
- },
37
- style: _extends({
38
- fill: 'white',
39
- fillOpacity: 0.1
40
- }, theme.applyStyles('light', {
41
- fill: 'gray'
42
- }))
43
- }, {
44
- props: {
45
- axisHighlight: 'line'
46
- },
47
- style: _extends({
48
- strokeDasharray: '5 2',
49
- stroke: '#ffffff'
50
- }, theme.applyStyles('light', {
51
- stroke: '#000000'
52
- }))
53
- }]
54
- }));
16
+
55
17
  /**
56
18
  * Demos:
57
19
  *
@@ -66,62 +28,14 @@ function ChartsAxisHighlight(props) {
66
28
  x: xAxisHighlight,
67
29
  y: yAxisHighlight
68
30
  } = props;
69
- const {
70
- xAxisIds,
71
- xAxis,
72
- yAxisIds,
73
- yAxis
74
- } = useCartesianContext();
75
31
  const classes = useUtilityClasses();
76
- const USED_X_AXIS_ID = xAxisIds[0];
77
- const USED_Y_AXIS_ID = yAxisIds[0];
78
- const xScale = xAxis[USED_X_AXIS_ID].scale;
79
- const yScale = yAxis[USED_Y_AXIS_ID].scale;
80
- const {
81
- axis
82
- } = React.useContext(InteractionContext);
83
- const getXPosition = getValueToPositionMapper(xScale);
84
- const getYPosition = getValueToPositionMapper(yScale);
85
- const axisX = axis.x;
86
- const axisY = axis.y;
87
- const isBandScaleX = xAxisHighlight === 'band' && axisX !== null && isBandScale(xScale);
88
- const isBandScaleY = yAxisHighlight === 'band' && axisY !== null && isBandScale(yScale);
89
- if (process.env.NODE_ENV !== 'production') {
90
- const isXError = isBandScaleX && xScale(axisX.value) === undefined;
91
- const isYError = isBandScaleY && yScale(axisY.value) === undefined;
92
- if (isXError || isYError) {
93
- console.error([`MUI X: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
94
- }
95
- }
96
32
  return /*#__PURE__*/_jsxs(React.Fragment, {
97
- children: [isBandScaleX && xScale(axisX.value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath
98
- // @ts-expect-error, xScale value is checked in the statement above
99
- , {
100
- d: `M ${xScale(axisX.value) - (xScale.step() - xScale.bandwidth()) / 2} ${yScale.range()[0]} l ${xScale.step()} 0 l 0 ${yScale.range()[1] - yScale.range()[0]} l ${-xScale.step()} 0 Z`,
101
- className: classes.root,
102
- ownerState: {
103
- axisHighlight: 'band'
104
- }
105
- }), isBandScaleY && yScale(axisY.value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
106
- d: `M ${xScale.range()[0]} ${
107
- // @ts-expect-error, yScale value is checked in the statement above
108
- yScale(axisY.value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${xScale.range()[1] - xScale.range()[0]} 0 l 0 ${-yScale.step()} Z`,
109
- className: classes.root,
110
- ownerState: {
111
- axisHighlight: 'band'
112
- }
113
- }), xAxisHighlight === 'line' && axis.x !== null && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
114
- d: `M ${getXPosition(axis.x.value)} ${yScale.range()[0]} L ${getXPosition(axis.x.value)} ${yScale.range()[1]}`,
115
- className: classes.root,
116
- ownerState: {
117
- axisHighlight: 'line'
118
- }
119
- }), yAxisHighlight === 'line' && axis.y !== null && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
120
- d: `M ${xScale.range()[0]} ${getYPosition(axis.y.value)} L ${xScale.range()[1]} ${getYPosition(axis.y.value)}`,
121
- className: classes.root,
122
- ownerState: {
123
- axisHighlight: 'line'
124
- }
33
+ children: [xAxisHighlight && /*#__PURE__*/_jsx(ChartsXHighlight, {
34
+ type: xAxisHighlight,
35
+ classes: classes
36
+ }), yAxisHighlight && /*#__PURE__*/_jsx(ChartsYHighlight, {
37
+ type: yAxisHighlight,
38
+ classes: classes
125
39
  })]
126
40
  });
127
41
  }
@@ -0,0 +1,34 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import { styled } from '@mui/material/styles';
5
+ export const ChartsAxisHighlightPath = styled('path', {
6
+ name: 'MuiChartsAxisHighlight',
7
+ slot: 'Root',
8
+ overridesResolver: (_, styles) => styles.root
9
+ })(({
10
+ theme
11
+ }) => ({
12
+ pointerEvents: 'none',
13
+ variants: [{
14
+ props: {
15
+ axisHighlight: 'band'
16
+ },
17
+ style: _extends({
18
+ fill: 'white',
19
+ fillOpacity: 0.1
20
+ }, theme.applyStyles('light', {
21
+ fill: 'gray'
22
+ }))
23
+ }, {
24
+ props: {
25
+ axisHighlight: 'line'
26
+ },
27
+ style: _extends({
28
+ strokeDasharray: '5 2',
29
+ stroke: '#ffffff'
30
+ }, theme.applyStyles('light', {
31
+ stroke: '#000000'
32
+ }))
33
+ }]
34
+ }));
@@ -0,0 +1,53 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { getValueToPositionMapper, useXScale } from "../hooks/useScale.js";
5
+ import { isBandScale } from "../internals/isBandScale.js";
6
+ import { useSelector } from "../internals/store/useSelector.js";
7
+ import { useStore } from "../internals/store/useStore.js";
8
+ import { selectorChartsInteractionXAxis } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
9
+ import { useDrawingArea } from "../hooks/index.js";
10
+ import { ChartsAxisHighlightPath } from "./ChartsAxisHighlightPath.js";
11
+
12
+ /**
13
+ * @ignore - internal component.
14
+ */
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ export default function ChartsXHighlight(props) {
17
+ const {
18
+ type,
19
+ classes
20
+ } = props;
21
+ const {
22
+ top,
23
+ height
24
+ } = useDrawingArea();
25
+ const xScale = useXScale();
26
+ const store = useStore();
27
+ const axisX = useSelector(store, selectorChartsInteractionXAxis);
28
+ const getXPosition = getValueToPositionMapper(xScale);
29
+ const isBandScaleX = type === 'band' && axisX !== null && isBandScale(xScale);
30
+ if (process.env.NODE_ENV !== 'production') {
31
+ const isError = isBandScaleX && xScale(axisX.value) === undefined;
32
+ if (isError) {
33
+ console.error([`MUI X: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
34
+ }
35
+ }
36
+ return /*#__PURE__*/_jsxs(React.Fragment, {
37
+ children: [isBandScaleX && xScale(axisX.value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath
38
+ // @ts-expect-error, xScale value is checked in the statement above
39
+ , {
40
+ d: `M ${xScale(axisX.value) - (xScale.step() - xScale.bandwidth()) / 2} ${top} l ${xScale.step()} 0 l 0 ${height} l ${-xScale.step()} 0 Z`,
41
+ className: classes.root,
42
+ ownerState: {
43
+ axisHighlight: 'band'
44
+ }
45
+ }), type === 'line' && axisX !== null && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
46
+ d: `M ${getXPosition(axisX.value)} ${top} L ${getXPosition(axisX.value)} ${top + height}`,
47
+ className: classes.root,
48
+ ownerState: {
49
+ axisHighlight: 'line'
50
+ }
51
+ })]
52
+ });
53
+ }
@@ -0,0 +1,53 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { getValueToPositionMapper, useYScale } from "../hooks/useScale.js";
5
+ import { isBandScale } from "../internals/isBandScale.js";
6
+ import { useSelector } from "../internals/store/useSelector.js";
7
+ import { useStore } from "../internals/store/useStore.js";
8
+ import { selectorChartsInteractionYAxis } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
9
+ import { useDrawingArea } from "../hooks/index.js";
10
+ import { ChartsAxisHighlightPath } from "./ChartsAxisHighlightPath.js";
11
+
12
+ /**
13
+ * @ignore - internal component.
14
+ */
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ export default function ChartsYHighlight(props) {
17
+ const {
18
+ type,
19
+ classes
20
+ } = props;
21
+ const {
22
+ left,
23
+ width
24
+ } = useDrawingArea();
25
+ const yScale = useYScale();
26
+ const store = useStore();
27
+ const axisY = useSelector(store, selectorChartsInteractionYAxis);
28
+ const getYPosition = getValueToPositionMapper(yScale);
29
+ const isBandScaleY = type === 'band' && axisY !== null && isBandScale(yScale);
30
+ if (process.env.NODE_ENV !== 'production') {
31
+ const isError = isBandScaleY && yScale(axisY.value) === undefined;
32
+ if (isError) {
33
+ console.error([`MUI X: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
34
+ }
35
+ }
36
+ return /*#__PURE__*/_jsxs(React.Fragment, {
37
+ children: [isBandScaleY && yScale(axisY.value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
38
+ d: `M ${left} ${
39
+ // @ts-expect-error, yScale value is checked in the statement above
40
+ yScale(axisY.value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
41
+ className: classes.root,
42
+ ownerState: {
43
+ axisHighlight: 'band'
44
+ }
45
+ }), type === 'line' && axisY !== null && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
46
+ d: `M ${left} ${getYPosition(axisY.value)} L ${left + width} ${getYPosition(axisY.value)}`,
47
+ className: classes.root,
48
+ ownerState: {
49
+ axisHighlight: 'line'
50
+ }
51
+ })]
52
+ });
53
+ }
@@ -0,0 +1,6 @@
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
+ export function getAxisHighlightUtilityClass(slot) {
4
+ return generateUtilityClass('MuiChartsAxisHighlight', slot);
5
+ }
6
+ export const chartsAxisHighlightClasses = generateUtilityClasses('MuiChartsAxisHighlight', ['root']);
@@ -1 +1,4 @@
1
- export * from "./ChartsAxisHighlight.js";
1
+ export * from "./ChartsAxisHighlight.js";
2
+ export * from "./chartsAxisHighlightClasses.js";
3
+ export * from "./ChartsAxisHighlight.types.js";
4
+ export * from "./ChartsAxisHighlightPath.js";
@@ -10,7 +10,7 @@ import { useThemeProps } from '@mui/material/styles';
10
10
  import { useCartesianContext } from "../context/CartesianProvider/index.js";
11
11
  import { getChartsGridUtilityClass } from "./chartsGridClasses.js";
12
12
  import { useDrawingArea } from "../hooks/useDrawingArea.js";
13
- import { GridRoot } from "./styledCommonents.js";
13
+ import { GridRoot } from "./styledComponents.js";
14
14
  import { ChartsGridVertical } from "./ChartsVerticalGrid.js";
15
15
  import { ChartsGridHorizontal } from "./ChartsHorizontalGrid.js";
16
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useTicks } from "../hooks/useTicks.js";
3
- import { GridLine } from "./styledCommonents.js";
3
+ import { GridLine } from "./styledComponents.js";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  /**
6
6
  * @ignore - internal component.
@@ -23,7 +23,7 @@ export function ChartsGridHorizontal(props) {
23
23
  });
24
24
  return /*#__PURE__*/_jsx(React.Fragment, {
25
25
  children: yTicks.map(({
26
- formattedValue,
26
+ value,
27
27
  offset
28
28
  }) => /*#__PURE__*/_jsx(GridLine, {
29
29
  y1: offset,
@@ -31,6 +31,6 @@ export function ChartsGridHorizontal(props) {
31
31
  x1: drawingArea.left,
32
32
  x2: drawingArea.left + drawingArea.width,
33
33
  className: classes.horizontalLine
34
- }, `horizontal-${formattedValue}`))
34
+ }, `horizontal-${value}`))
35
35
  });
36
36
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useTicks } from "../hooks/useTicks.js";
3
- import { GridLine } from "./styledCommonents.js";
3
+ import { GridLine } from "./styledComponents.js";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  /**
6
6
  * @ignore - internal component.
@@ -23,7 +23,7 @@ export function ChartsGridVertical(props) {
23
23
  });
24
24
  return /*#__PURE__*/_jsx(React.Fragment, {
25
25
  children: xTicks.map(({
26
- formattedValue,
26
+ value,
27
27
  offset
28
28
  }) => /*#__PURE__*/_jsx(GridLine, {
29
29
  y1: drawingArea.top,
@@ -31,6 +31,6 @@ export function ChartsGridVertical(props) {
31
31
  x1: offset,
32
32
  x2: offset,
33
33
  className: classes.verticalLine
34
- }, `vertical-${formattedValue}`))
34
+ }, `vertical-${value}`))
35
35
  });
36
36
  }
@@ -1,4 +1,5 @@
1
- import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
2
3
  export function getLegendUtilityClass(slot) {
3
4
  return generateUtilityClass('MuiChartsLegend', slot);
4
5
  }
@@ -2,10 +2,10 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import { InteractionContext } from "../context/InteractionProvider.js";
6
5
  import { useSeries } from "../hooks/useSeries.js";
7
6
  import { useSvgRef } from "../hooks/index.js";
8
7
  import { useCartesianContext } from "../context/CartesianProvider/index.js";
8
+ import { useStore } from "../internals/store/useStore.js";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  function ChartsOnAxisClickHandler(props) {
11
11
  const {
@@ -13,9 +13,7 @@ function ChartsOnAxisClickHandler(props) {
13
13
  } = props;
14
14
  const svgRef = useSvgRef();
15
15
  const series = useSeries();
16
- const {
17
- axis
18
- } = React.useContext(InteractionContext);
16
+ const store = useStore();
19
17
  const {
20
18
  xAxisIds,
21
19
  xAxis,
@@ -29,9 +27,13 @@ function ChartsOnAxisClickHandler(props) {
29
27
  }
30
28
  const handleMouseClick = event => {
31
29
  event.preventDefault();
32
- const isXaxis = axis.x && axis.x.index !== -1;
30
+ const {
31
+ x: axisX,
32
+ y: axisY
33
+ } = store.value.interaction.axis;
34
+ const isXaxis = axisX && axisX.index !== -1;
33
35
  const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
34
- const dataIndex = isXaxis ? axis.x && axis.x.index : axis.y && axis.y.index;
36
+ const dataIndex = isXaxis ? axisX && axisX.index : axisY && axisY.index;
35
37
  if (dataIndex == null) {
36
38
  return;
37
39
  }
@@ -58,7 +60,7 @@ function ChartsOnAxisClickHandler(props) {
58
60
  return () => {
59
61
  element.removeEventListener('click', handleMouseClick);
60
62
  };
61
- }, [axis.x, axis.y, onAxisClick, series, svgRef, xAxis, xAxisIds, yAxis, yAxisIds]);
63
+ }, [onAxisClick, series, store, svgRef, xAxis, xAxisIds, yAxis, yAxisIds]);
62
64
 
63
65
  // eslint-disable-next-line react/jsx-no-useless-fragment
64
66
  return /*#__PURE__*/_jsx(React.Fragment, {});
@@ -2,55 +2,102 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className", "title", "desc"];
5
+ const _excluded = ["children", "disableAxisListener", "className", "title", "desc"];
6
6
  import { styled, useThemeProps } from '@mui/material/styles';
7
7
  import PropTypes from 'prop-types';
8
8
  import * as React from 'react';
9
+ import useForkRef from '@mui/utils/useForkRef';
9
10
  import { useAxisEvents } from "../hooks/useAxisEvents.js";
11
+ import { ChartsAxesGradients } from "../internals/components/ChartsAxesGradients/index.js";
12
+ import { useDrawingArea, useSvgRef } from "../hooks/index.js";
13
+ import { useSize } from "../context/SizeProvider/index.js";
10
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
- const ChartChartsSurfaceStyles = styled('svg', {
15
+ const ChartsSurfaceStyles = styled('svg', {
12
16
  name: 'MuiChartsSurface',
13
17
  slot: 'Root'
14
- })(() => ({
18
+ })(({
19
+ ownerState
20
+ }) => ({
21
+ width: ownerState.width ?? '100%',
22
+ height: ownerState.height ?? '100%',
23
+ display: 'flex',
24
+ position: 'relative',
25
+ flexGrow: 1,
26
+ flexDirection: 'column',
27
+ alignItems: 'center',
28
+ justifyContent: 'center',
29
+ overflow: 'hidden',
15
30
  // This prevents default touch actions when using the svg on mobile devices.
16
31
  // For example, prevent page scroll & zoom.
17
32
  touchAction: 'none'
18
33
  }));
34
+
35
+ /**
36
+ * It provides the drawing area for the chart elements.
37
+ * It is the root `<svg>` of all the chart elements.
38
+ *
39
+ * It also provides the `title` and `desc` elements for the chart.
40
+ *
41
+ * Demos:
42
+ *
43
+ * - [Composition](http://localhost:3001/x/react-charts/composition/)
44
+ *
45
+ * API:
46
+ *
47
+ * - [ChartsSurface API](https://mui.com/x/api/charts/charts-surface/)
48
+ */
19
49
  const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(inProps, ref) {
20
- const props = useThemeProps({
50
+ const {
51
+ width,
52
+ height,
53
+ left,
54
+ right,
55
+ top,
56
+ bottom
57
+ } = useDrawingArea();
58
+ const {
59
+ hasIntrinsicSize,
60
+ svgRef: containerRef,
61
+ inHeight,
62
+ inWidth
63
+ } = useSize();
64
+ const svgRef = useSvgRef();
65
+ const handleRef = useForkRef(containerRef, svgRef, ref);
66
+ const themeProps = useThemeProps({
21
67
  props: inProps,
22
68
  name: 'MuiChartsSurface'
23
69
  });
24
70
  const {
25
71
  children,
26
- width,
27
- height,
28
- viewBox,
29
72
  disableAxisListener = false,
30
73
  className,
31
74
  title,
32
75
  desc
33
- } = props,
34
- other = _objectWithoutPropertiesLoose(props, _excluded);
35
- const svgView = _extends({
36
- width,
37
- height,
76
+ } = themeProps,
77
+ other = _objectWithoutPropertiesLoose(themeProps, _excluded);
78
+ const svgWidth = width + left + right;
79
+ const svgHeight = height + top + bottom;
80
+ const svgView = {
81
+ width: svgWidth,
82
+ height: svgHeight,
38
83
  x: 0,
39
84
  y: 0
40
- }, viewBox);
85
+ };
41
86
  useAxisEvents(disableAxisListener);
42
- return /*#__PURE__*/_jsxs(ChartChartsSurfaceStyles, _extends({
43
- width: width,
44
- height: height,
87
+ return /*#__PURE__*/_jsxs(ChartsSurfaceStyles, _extends({
88
+ ownerState: {
89
+ width: inWidth,
90
+ height: inHeight
91
+ },
45
92
  viewBox: `${svgView.x} ${svgView.y} ${svgView.width} ${svgView.height}`,
46
- ref: ref,
47
93
  className: className
48
94
  }, other, {
49
- children: [/*#__PURE__*/_jsx("title", {
95
+ ref: handleRef,
96
+ children: [title && /*#__PURE__*/_jsx("title", {
50
97
  children: title
51
- }), /*#__PURE__*/_jsx("desc", {
98
+ }), desc && /*#__PURE__*/_jsx("desc", {
52
99
  children: desc
53
- }), children]
100
+ }), /*#__PURE__*/_jsx(ChartsAxesGradients, {}), hasIntrinsicSize && children]
54
101
  }));
55
102
  });
56
103
  process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
@@ -67,21 +114,7 @@ process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
67
114
  * @default false
68
115
  */
69
116
  disableAxisListener: PropTypes.bool,
70
- /**
71
- * The height of the chart in px.
72
- */
73
- height: PropTypes.number.isRequired,
74
117
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
75
- title: PropTypes.string,
76
- viewBox: PropTypes.shape({
77
- height: PropTypes.number,
78
- width: PropTypes.number,
79
- x: PropTypes.number,
80
- y: PropTypes.number
81
- }),
82
- /**
83
- * The width of the chart in px.
84
- */
85
- width: PropTypes.number.isRequired
118
+ title: PropTypes.string
86
119
  } : void 0;
87
120
  export { ChartsSurface };
@@ -0,0 +1 @@
1
+ export {};