@mui/x-charts 7.22.3 → 8.0.0-alpha.1

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 (415) hide show
  1. package/BarChart/AnimatedBarElement.d.ts +15 -0
  2. package/BarChart/AnimatedBarElement.js +21 -0
  3. package/BarChart/BarChart.d.ts +11 -16
  4. package/BarChart/BarChart.js +9 -59
  5. package/BarChart/BarElement.d.ts +6 -1343
  6. package/BarChart/BarElement.js +10 -20
  7. package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
  8. package/BarChart/BarPlot.js +24 -6
  9. package/BarChart/extremums.js +3 -3
  10. package/BarChart/useBarChartProps.d.ts +2 -4
  11. package/BarChart/useBarChartProps.js +4 -11
  12. package/CHANGELOG.md +348 -12
  13. package/ChartContainer/ChartContainer.d.ts +4 -38
  14. package/ChartContainer/ChartContainer.js +15 -44
  15. package/ChartContainer/ResizableContainer.d.ts +22 -0
  16. package/ChartContainer/ResizableContainer.js +60 -0
  17. package/ChartContainer/useChartContainerProps.d.ts +8 -92
  18. package/ChartContainer/useChartContainerProps.js +29 -59
  19. package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -17
  20. package/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
  21. package/ChartsAxisHighlight/ChartsAxisHighlight.types.d.ts +5 -0
  22. package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +6 -0
  23. package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
  24. package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +10 -0
  25. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
  26. package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +10 -0
  27. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
  28. package/ChartsAxisHighlight/chartsAxisHighlightClasses.d.ts +7 -0
  29. package/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
  30. package/ChartsAxisHighlight/index.d.ts +3 -0
  31. package/ChartsAxisHighlight/index.js +4 -1
  32. package/ChartsGrid/ChartsGrid.js +1 -1
  33. package/ChartsGrid/ChartsHorizontalGrid.d.ts +2 -2
  34. package/ChartsGrid/ChartsHorizontalGrid.js +3 -3
  35. package/ChartsGrid/ChartsVerticalGrid.d.ts +2 -2
  36. package/ChartsGrid/ChartsVerticalGrid.js +3 -3
  37. package/ChartsLegend/ChartsLegend.js +0 -3
  38. package/ChartsLegend/DefaultChartsLegend.d.ts +0 -5
  39. package/ChartsLegend/DefaultChartsLegend.js +1 -12
  40. package/ChartsLegend/LegendPerItem.d.ts +3 -3
  41. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
  42. package/ChartsOverlay/ChartsOverlay.d.ts +1 -1
  43. package/ChartsSurface/ChartsSurface.d.ts +0 -15
  44. package/ChartsSurface/ChartsSurface.js +35 -34
  45. package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
  46. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +7 -39
  47. package/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
  48. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -28
  49. package/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
  50. package/ChartsTooltip/ChartsTooltip.d.ts +3 -69
  51. package/ChartsTooltip/ChartsTooltip.js +162 -107
  52. package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
  53. package/ChartsTooltip/ChartsTooltipContainer.js +298 -0
  54. package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -0
  55. package/ChartsTooltip/chartsTooltipClasses.js +18 -2
  56. package/ChartsTooltip/index.d.ts +3 -3
  57. package/ChartsTooltip/index.js +2 -3
  58. package/ChartsTooltip/useAxisTooltip.d.ts +2 -2
  59. package/ChartsTooltip/useAxisTooltip.js +21 -21
  60. package/ChartsTooltip/useItemTooltip.d.ts +1 -1
  61. package/ChartsTooltip/useItemTooltip.js +8 -7
  62. package/ChartsTooltip/utils.d.ts +5 -16
  63. package/ChartsTooltip/utils.js +45 -50
  64. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -39
  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 +60 -61
  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/AreaElement.d.ts +1 -1
  74. package/LineChart/AreaPlot.js +14 -8
  75. package/LineChart/CircleMarkElement.js +6 -5
  76. package/LineChart/LineChart.d.ts +11 -17
  77. package/LineChart/LineChart.js +9 -60
  78. package/LineChart/LineElement.d.ts +1 -1
  79. package/LineChart/LineHighlightPlot.d.ts +1 -1
  80. package/LineChart/LineHighlightPlot.js +8 -11
  81. package/LineChart/LinePlot.js +14 -8
  82. package/LineChart/MarkElement.js +6 -5
  83. package/LineChart/MarkPlot.js +2 -6
  84. package/LineChart/extremums.js +10 -6
  85. package/LineChart/useLineChartProps.d.ts +2 -4
  86. package/LineChart/useLineChartProps.js +4 -11
  87. package/PieChart/PieArc.d.ts +0 -5
  88. package/PieChart/PieArc.js +1 -10
  89. package/PieChart/PieArcPlot.js +0 -5
  90. package/PieChart/PieChart.d.ts +10 -39
  91. package/PieChart/PieChart.js +20 -137
  92. package/PieChart/PiePlot.js +2 -2
  93. package/PieChart/getPieCoordinates.d.ts +2 -2
  94. package/README.md +4 -4
  95. package/ScatterChart/Scatter.js +6 -5
  96. package/ScatterChart/ScatterChart.d.ts +11 -17
  97. package/ScatterChart/ScatterChart.js +11 -60
  98. package/ScatterChart/ScatterPlot.js +3 -6
  99. package/ScatterChart/extremums.js +6 -6
  100. package/ScatterChart/useScatterChartProps.d.ts +2 -4
  101. package/ScatterChart/useScatterChartProps.js +3 -12
  102. package/SparkLineChart/SparkLineChart.d.ts +7 -8
  103. package/SparkLineChart/SparkLineChart.js +6 -33
  104. package/context/CartesianProvider/defaultizeAxis.d.ts +1 -1
  105. package/context/ChartDataProvider/ChartDataProvider.d.ts +31 -0
  106. package/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
  107. package/context/ChartDataProvider/index.d.ts +1 -0
  108. package/context/ChartDataProvider/index.js +1 -0
  109. package/context/ChartDataProvider/useChartDataProviderProps.d.ts +94 -0
  110. package/context/ChartDataProvider/useChartDataProviderProps.js +66 -0
  111. package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.d.ts +12 -12
  112. package/{modern/ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
  113. package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
  114. package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +8 -0
  115. package/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
  116. package/context/DrawingAreaProvider/DrawingAreaProvider.d.ts +3 -0
  117. package/{modern/context/DrawingProvider.js → context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
  118. package/context/DrawingAreaProvider/index.d.ts +3 -0
  119. package/context/DrawingAreaProvider/index.js +3 -0
  120. package/context/HighlightedProvider/HighlightedContext.d.ts +0 -8
  121. package/context/HighlightedProvider/HighlightedProvider.js +1 -16
  122. package/context/InteractionProvider.d.ts +5 -48
  123. package/context/InteractionProvider.js +8 -64
  124. package/context/InteractionSelectors.d.ts +359 -0
  125. package/context/InteractionSelectors.js +12 -0
  126. package/context/PluginProvider/ExtremumGetter.types.d.ts +2 -2
  127. package/context/SizeProvider/Size.types.d.ts +30 -0
  128. package/context/SizeProvider/SizeContext.d.ts +4 -0
  129. package/context/SizeProvider/SizeContext.js +13 -0
  130. package/context/SizeProvider/SizeProvider.d.ts +11 -0
  131. package/context/SizeProvider/SizeProvider.js +26 -0
  132. package/context/SizeProvider/index.d.ts +4 -0
  133. package/context/SizeProvider/index.js +4 -0
  134. package/context/SizeProvider/useChartContainerDimensions.d.ts +9 -0
  135. package/{modern/ResponsiveChartContainer → context/SizeProvider}/useChartContainerDimensions.js +15 -7
  136. package/context/SizeProvider/useSize.d.ts +5 -0
  137. package/context/SizeProvider/useSize.js +13 -0
  138. package/context/SvgRefProvider/SvgRef.types.d.ts +8 -0
  139. package/context/SvgRefProvider/SvgRef.types.js +1 -0
  140. package/context/SvgRefProvider/SvgRefContext.d.ts +4 -0
  141. package/context/SvgRefProvider/SvgRefContext.js +17 -0
  142. package/context/SvgRefProvider/SvgRefProvider.d.ts +3 -0
  143. package/context/SvgRefProvider/SvgRefProvider.js +24 -0
  144. package/context/SvgRefProvider/index.d.ts +4 -0
  145. package/context/SvgRefProvider/index.js +4 -0
  146. package/context/SvgRefProvider/useSurfaceRef.d.ts +2 -0
  147. package/context/SvgRefProvider/useSurfaceRef.js +14 -0
  148. package/context/ZAxisContextProvider.d.ts +1 -1
  149. package/context/index.d.ts +2 -0
  150. package/context/index.js +2 -1
  151. package/hooks/useAxisEvents.js +32 -19
  152. package/hooks/useChartId.js +2 -2
  153. package/hooks/useDrawingArea.d.ts +2 -2
  154. package/hooks/useDrawingArea.js +2 -2
  155. package/hooks/useInteractionItemProps.js +19 -12
  156. package/hooks/useSvgRef.js +3 -3
  157. package/index.d.ts +1 -2
  158. package/index.js +2 -3
  159. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
  160. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
  161. package/internals/computeAxisValue.d.ts +2 -2
  162. package/internals/defaultizeColor.d.ts +1 -8
  163. package/internals/getSymbol.js +19 -3
  164. package/internals/index.d.ts +7 -6
  165. package/internals/index.js +7 -6
  166. package/internals/plugins/models/index.d.ts +35 -0
  167. package/internals/plugins/models/index.js +1 -0
  168. package/internals/plugins/utils/ChartStore.d.ts +12 -0
  169. package/internals/plugins/utils/ChartStore.js +26 -0
  170. package/internals/plugins/utils/ChartsStore.d.ts +12 -0
  171. package/internals/plugins/utils/ChartsStore.js +26 -0
  172. package/internals/plugins/utils/selectors.d.ts +9 -0
  173. package/internals/plugins/utils/selectors.js +37 -0
  174. package/internals/useCharts.d.ts +6 -0
  175. package/internals/useCharts.js +29 -0
  176. package/internals/useSelector.d.ts +4 -0
  177. package/internals/useSelector.js +6 -0
  178. package/internals/useStore.d.ts +2 -0
  179. package/internals/useStore.js +17 -0
  180. package/internals/useStringInterpolator.js +1 -0
  181. package/models/seriesType/bar.d.ts +1 -1
  182. package/models/seriesType/common.d.ts +0 -10
  183. package/models/seriesType/config.d.ts +1 -1
  184. package/models/seriesType/line.d.ts +1 -1
  185. package/models/seriesType/pie.d.ts +1 -1
  186. package/models/seriesType/scatter.d.ts +1 -6
  187. package/modern/BarChart/AnimatedBarElement.js +21 -0
  188. package/modern/BarChart/BarChart.js +9 -59
  189. package/modern/BarChart/BarElement.js +10 -20
  190. package/modern/BarChart/BarPlot.js +24 -6
  191. package/modern/BarChart/extremums.js +3 -3
  192. package/modern/BarChart/useBarChartProps.js +4 -11
  193. package/modern/ChartContainer/ChartContainer.js +15 -44
  194. package/modern/ChartContainer/ResizableContainer.js +60 -0
  195. package/modern/ChartContainer/useChartContainerProps.js +29 -59
  196. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
  197. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
  198. package/modern/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
  199. package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
  200. package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
  201. package/modern/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
  202. package/modern/ChartsAxisHighlight/index.js +4 -1
  203. package/modern/ChartsGrid/ChartsGrid.js +1 -1
  204. package/modern/ChartsGrid/ChartsHorizontalGrid.js +3 -3
  205. package/modern/ChartsGrid/ChartsVerticalGrid.js +3 -3
  206. package/modern/ChartsLegend/ChartsLegend.js +0 -3
  207. package/modern/ChartsLegend/DefaultChartsLegend.js +1 -12
  208. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
  209. package/modern/ChartsSurface/ChartsSurface.js +35 -34
  210. package/modern/ChartsTooltip/ChartTooltip.types.js +1 -0
  211. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
  212. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
  213. package/modern/ChartsTooltip/ChartsTooltip.js +162 -107
  214. package/modern/ChartsTooltip/ChartsTooltipContainer.js +298 -0
  215. package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
  216. package/modern/ChartsTooltip/index.js +2 -3
  217. package/modern/ChartsTooltip/useAxisTooltip.js +21 -21
  218. package/modern/ChartsTooltip/useItemTooltip.js +8 -7
  219. package/modern/ChartsTooltip/utils.js +45 -50
  220. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -39
  221. package/modern/Gauge/Gauge.js +0 -6
  222. package/modern/Gauge/GaugeContainer.js +60 -61
  223. package/modern/LineChart/AnimatedArea.js +9 -18
  224. package/modern/LineChart/AnimatedLine.js +9 -20
  225. package/modern/LineChart/AreaPlot.js +14 -8
  226. package/modern/LineChart/CircleMarkElement.js +6 -5
  227. package/modern/LineChart/LineChart.js +9 -60
  228. package/modern/LineChart/LineHighlightPlot.js +8 -11
  229. package/modern/LineChart/LinePlot.js +14 -8
  230. package/modern/LineChart/MarkElement.js +6 -5
  231. package/modern/LineChart/MarkPlot.js +2 -6
  232. package/modern/LineChart/extremums.js +10 -6
  233. package/modern/LineChart/useLineChartProps.js +4 -11
  234. package/modern/PieChart/PieArc.js +1 -10
  235. package/modern/PieChart/PieArcPlot.js +0 -5
  236. package/modern/PieChart/PieChart.js +20 -137
  237. package/modern/PieChart/PiePlot.js +2 -2
  238. package/modern/ScatterChart/Scatter.js +6 -5
  239. package/modern/ScatterChart/ScatterChart.js +11 -60
  240. package/modern/ScatterChart/ScatterPlot.js +3 -6
  241. package/modern/ScatterChart/extremums.js +6 -6
  242. package/modern/ScatterChart/useScatterChartProps.js +3 -12
  243. package/modern/SparkLineChart/SparkLineChart.js +6 -33
  244. package/modern/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
  245. package/modern/context/ChartDataProvider/index.js +1 -0
  246. package/modern/context/ChartDataProvider/useChartDataProviderProps.js +66 -0
  247. package/{ChartContainer → modern/context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
  248. package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
  249. package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
  250. package/{context/DrawingProvider.js → modern/context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
  251. package/modern/context/DrawingAreaProvider/index.js +3 -0
  252. package/modern/context/HighlightedProvider/HighlightedProvider.js +1 -16
  253. package/modern/context/InteractionProvider.js +8 -64
  254. package/modern/context/InteractionSelectors.js +12 -0
  255. package/modern/context/SizeProvider/Size.types.js +1 -0
  256. package/modern/context/SizeProvider/SizeContext.js +13 -0
  257. package/modern/context/SizeProvider/SizeProvider.js +26 -0
  258. package/modern/context/SizeProvider/index.js +4 -0
  259. package/{ResponsiveChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +15 -7
  260. package/modern/context/SizeProvider/useSize.js +13 -0
  261. package/modern/context/SvgRefProvider/SvgRef.types.js +1 -0
  262. package/modern/context/SvgRefProvider/SvgRefContext.js +17 -0
  263. package/modern/context/SvgRefProvider/SvgRefProvider.js +24 -0
  264. package/modern/context/SvgRefProvider/index.js +4 -0
  265. package/modern/context/SvgRefProvider/useSurfaceRef.js +14 -0
  266. package/modern/context/index.js +2 -1
  267. package/modern/hooks/useAxisEvents.js +32 -19
  268. package/modern/hooks/useChartId.js +2 -2
  269. package/modern/hooks/useDrawingArea.js +2 -2
  270. package/modern/hooks/useInteractionItemProps.js +19 -12
  271. package/modern/hooks/useSvgRef.js +3 -3
  272. package/modern/index.js +2 -3
  273. package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
  274. package/modern/internals/getSymbol.js +19 -3
  275. package/modern/internals/index.js +7 -6
  276. package/modern/internals/plugins/models/index.js +1 -0
  277. package/modern/internals/plugins/utils/ChartStore.js +26 -0
  278. package/modern/internals/plugins/utils/ChartsStore.js +26 -0
  279. package/modern/internals/plugins/utils/selectors.js +37 -0
  280. package/modern/internals/useCharts.js +29 -0
  281. package/modern/internals/useSelector.js +6 -0
  282. package/modern/internals/useStore.js +17 -0
  283. package/modern/internals/useStringInterpolator.js +1 -0
  284. package/node/BarChart/AnimatedBarElement.js +28 -0
  285. package/node/BarChart/BarChart.js +9 -59
  286. package/node/BarChart/BarElement.js +11 -21
  287. package/node/BarChart/BarPlot.js +22 -4
  288. package/node/BarChart/extremums.js +3 -3
  289. package/node/BarChart/useBarChartProps.js +4 -11
  290. package/node/ChartContainer/ChartContainer.js +14 -43
  291. package/node/ChartContainer/ResizableContainer.js +68 -0
  292. package/node/ChartContainer/useChartContainerProps.js +29 -60
  293. package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
  294. package/node/ChartsAxisHighlight/ChartsAxisHighlightPath.js +40 -0
  295. package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +57 -0
  296. package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +57 -0
  297. package/node/ChartsAxisHighlight/chartsAxisHighlightClasses.js +14 -0
  298. package/node/ChartsAxisHighlight/index.js +33 -0
  299. package/node/ChartsGrid/ChartsGrid.js +2 -2
  300. package/node/ChartsGrid/ChartsHorizontalGrid.js +4 -4
  301. package/node/ChartsGrid/ChartsVerticalGrid.js +4 -4
  302. package/node/ChartsLegend/ChartsLegend.js +0 -3
  303. package/node/ChartsLegend/DefaultChartsLegend.js +1 -12
  304. package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
  305. package/node/ChartsSurface/ChartsSurface.js +35 -34
  306. package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
  307. package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
  308. package/node/ChartsTooltip/ChartsTooltip.js +161 -106
  309. package/node/ChartsTooltip/ChartsTooltipContainer.js +304 -0
  310. package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
  311. package/node/ChartsTooltip/index.js +19 -28
  312. package/node/ChartsTooltip/useAxisTooltip.js +21 -21
  313. package/node/ChartsTooltip/useItemTooltip.js +8 -7
  314. package/node/ChartsTooltip/utils.js +46 -53
  315. package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +51 -40
  316. package/node/Gauge/Gauge.js +0 -6
  317. package/node/Gauge/GaugeContainer.js +60 -61
  318. package/node/LineChart/AnimatedArea.js +9 -19
  319. package/node/LineChart/AnimatedLine.js +9 -21
  320. package/node/LineChart/AreaPlot.js +13 -7
  321. package/node/LineChart/CircleMarkElement.js +6 -5
  322. package/node/LineChart/LineChart.js +9 -60
  323. package/node/LineChart/LineHighlightPlot.js +8 -11
  324. package/node/LineChart/LinePlot.js +13 -7
  325. package/node/LineChart/MarkElement.js +6 -5
  326. package/node/LineChart/MarkPlot.js +2 -6
  327. package/node/LineChart/extremums.js +10 -6
  328. package/node/LineChart/useLineChartProps.js +4 -11
  329. package/node/PieChart/PieArc.js +1 -10
  330. package/node/PieChart/PieArcPlot.js +0 -5
  331. package/node/PieChart/PieChart.js +20 -137
  332. package/node/PieChart/PiePlot.js +2 -2
  333. package/node/ScatterChart/Scatter.js +6 -5
  334. package/node/ScatterChart/ScatterChart.js +11 -60
  335. package/node/ScatterChart/ScatterPlot.js +3 -6
  336. package/node/ScatterChart/extremums.js +6 -6
  337. package/node/ScatterChart/useScatterChartProps.js +3 -12
  338. package/node/SparkLineChart/SparkLineChart.js +6 -33
  339. package/node/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
  340. package/node/context/ChartDataProvider/index.js +16 -0
  341. package/node/context/ChartDataProvider/useChartDataProviderProps.js +72 -0
  342. package/node/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
  343. package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
  344. package/node/context/DrawingAreaProvider/DrawingAreaContext.js +22 -0
  345. package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
  346. package/node/context/DrawingAreaProvider/index.js +38 -0
  347. package/node/context/HighlightedProvider/HighlightedProvider.js +1 -16
  348. package/node/context/InteractionProvider.js +9 -66
  349. package/node/context/InteractionSelectors.js +18 -0
  350. package/node/context/SizeProvider/Size.types.js +5 -0
  351. package/node/context/SizeProvider/SizeContext.js +20 -0
  352. package/node/context/SizeProvider/SizeProvider.js +29 -0
  353. package/node/context/SizeProvider/index.js +49 -0
  354. package/node/{ResponsiveChartContainer → context/SizeProvider}/useChartContainerDimensions.js +15 -7
  355. package/node/context/SizeProvider/useSize.js +20 -0
  356. package/node/context/SvgRefProvider/SvgRef.types.js +5 -0
  357. package/node/context/SvgRefProvider/SvgRefContext.js +23 -0
  358. package/node/context/SvgRefProvider/SvgRefProvider.js +31 -0
  359. package/node/context/SvgRefProvider/index.js +49 -0
  360. package/node/context/SvgRefProvider/useSurfaceRef.js +20 -0
  361. package/node/context/index.js +10 -2
  362. package/node/hooks/useAxisEvents.js +33 -19
  363. package/node/hooks/useChartId.js +2 -2
  364. package/node/hooks/useDrawingArea.js +2 -2
  365. package/node/hooks/useInteractionItemProps.js +20 -13
  366. package/node/hooks/useSvgRef.js +3 -3
  367. package/node/index.js +5 -16
  368. package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
  369. package/node/internals/getSymbol.js +19 -3
  370. package/node/internals/index.js +64 -44
  371. package/node/internals/plugins/models/index.js +5 -0
  372. package/node/internals/plugins/utils/ChartStore.js +33 -0
  373. package/node/internals/plugins/utils/ChartsStore.js +33 -0
  374. package/node/internals/plugins/utils/selectors.js +44 -0
  375. package/node/internals/useCharts.js +36 -0
  376. package/node/internals/useSelector.js +13 -0
  377. package/node/internals/useStore.js +24 -0
  378. package/node/internals/useStringInterpolator.js +2 -0
  379. package/package.json +8 -6
  380. package/themeAugmentation/props.d.ts +1 -2
  381. package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +0 -7
  382. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
  383. package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +0 -8
  384. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
  385. package/ResponsiveChartContainer/ResizableContainer.d.ts +0 -9
  386. package/ResponsiveChartContainer/ResizableContainer.js +0 -26
  387. package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -24
  388. package/ResponsiveChartContainer/index.d.ts +0 -1
  389. package/ResponsiveChartContainer/index.js +0 -1
  390. package/ResponsiveChartContainer/package.json +0 -6
  391. package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +0 -6
  392. package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +0 -19
  393. package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
  394. package/internals/SlotComponentPropsFromProps.d.ts +0 -1
  395. package/models/helpers.d.ts +0 -3
  396. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
  397. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
  398. package/modern/ResponsiveChartContainer/ResizableContainer.js +0 -26
  399. package/modern/ResponsiveChartContainer/index.js +0 -1
  400. package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
  401. package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
  402. package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
  403. package/node/ResponsiveChartContainer/ResizableContainer.js +0 -32
  404. package/node/ResponsiveChartContainer/index.js +0 -16
  405. package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -77
  406. /package/{internals/SlotComponentPropsFromProps.js → ChartsAxisHighlight/ChartsAxisHighlight.types.js} +0 -0
  407. /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
  408. /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
  409. /package/{models/helpers.js → ChartsTooltip/ChartTooltip.types.js} +0 -0
  410. /package/{modern/internals/SlotComponentPropsFromProps.js → context/DrawingAreaProvider/DrawingArea.types.js} +0 -0
  411. /package/{modern/models/helpers.js → context/SizeProvider/Size.types.js} +0 -0
  412. /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
  413. /package/node/{internals/SlotComponentPropsFromProps.js → ChartsAxisHighlight/ChartsAxisHighlight.types.js} +0 -0
  414. /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
  415. /package/node/{models/helpers.js → ChartsTooltip/ChartTooltip.types.js} +0 -0
@@ -0,0 +1,60 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { styled } from '@mui/material/styles';
5
+ import { useSize } from "../context/SizeProvider/index.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ /**
8
+ * Wrapping div that take the shape of its parent.
9
+ *
10
+ * @ignore - do not document.
11
+ */
12
+ export const ResizableContainerRoot = styled('div', {
13
+ name: 'MuiResponsiveChart',
14
+ slot: 'Container'
15
+ })(({
16
+ ownerState
17
+ }) => ({
18
+ width: ownerState.width ?? '100%',
19
+ height: ownerState.height ?? '100%',
20
+ display: 'flex',
21
+ position: 'relative',
22
+ flexGrow: 1,
23
+ flexDirection: 'column',
24
+ alignItems: 'center',
25
+ justifyContent: 'center',
26
+ overflow: 'hidden',
27
+ '&>svg': {
28
+ width: '100%',
29
+ height: '100%'
30
+ }
31
+ }));
32
+
33
+ /**
34
+ * Wrapping div that take the shape of its parent.
35
+ *
36
+ * @ignore - do not document.
37
+ */
38
+ function ResizableContainer(props) {
39
+ const {
40
+ inHeight,
41
+ inWidth,
42
+ containerRef
43
+ } = useSize();
44
+ return /*#__PURE__*/_jsx(ResizableContainerRoot, _extends({}, props, {
45
+ ownerState: {
46
+ width: inWidth,
47
+ height: inHeight
48
+ },
49
+ ref: containerRef,
50
+ children: props.children
51
+ }));
52
+ }
53
+ process.env.NODE_ENV !== "production" ? ResizableContainer.propTypes = {
54
+ // ----------------------------- Warning --------------------------------
55
+ // | These PropTypes are generated from the TypeScript type definitions |
56
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
57
+ // ----------------------------------------------------------------------
58
+ children: PropTypes.node
59
+ } : void 0;
60
+ export { ResizableContainer };
@@ -1,97 +1,13 @@
1
1
  import * as React from 'react';
2
- import type { DrawingProviderProps } from '../context/DrawingProvider';
3
- import type { CartesianProviderProps } from '../context/CartesianProvider';
4
- import type { SeriesProviderProps } from '../context/SeriesProvider';
5
- import type { ZAxisContextProviderProps } from '../context/ZAxisContextProvider';
6
- import type { ChartContainerProps } from './ChartContainer';
7
- import { HighlightedProviderProps } from '../context';
8
2
  import { ChartsSurfaceProps } from '../ChartsSurface';
9
- import { PluginProviderProps } from '../context/PluginProvider';
10
- import { AnimationProviderProps } from '../context/AnimationProvider';
11
- export declare const useChartContainerProps: (props: ChartContainerProps, ref: React.ForwardedRef<unknown>) => {
12
- children: React.ReactNode;
13
- drawingProviderProps: Omit<DrawingProviderProps, "children">;
14
- seriesProviderProps: Omit<SeriesProviderProps, "children">;
15
- cartesianProviderProps: Omit<CartesianProviderProps, "children">;
16
- zAxisContextProps: Omit<ZAxisContextProviderProps, "children">;
17
- highlightedProviderProps: Omit<HighlightedProviderProps, "children">;
3
+ import { ChartDataProviderProps } from '../context/ChartDataProvider';
4
+ import type { ChartContainerProps } from './ChartContainer';
5
+ export type UseChartContainerPropsReturnValue = {
6
+ chartDataProviderProps: ChartDataProviderProps;
18
7
  chartsSurfaceProps: ChartsSurfaceProps & {
19
- ref: any;
8
+ ref: React.Ref<SVGSVGElement>;
20
9
  };
21
- pluginProviderProps: Omit<PluginProviderProps, "children">;
22
- animationProviderProps: Omit<AnimationProviderProps, "children">;
23
- xAxis: {
24
- reverse?: boolean | undefined;
25
- fill?: string | undefined;
26
- stroke?: string | undefined;
27
- data?: any[] | undefined;
28
- label?: string | undefined;
29
- max?: (number | Date) | undefined;
30
- min?: (number | Date) | undefined;
31
- valueFormatter?: ((value: any, context: import("../internals").AxisValueFormatterContext) => string) | undefined;
32
- dataKey?: string | undefined;
33
- sx?: import("@mui/system").SxProps | undefined;
34
- classes?: Partial<import("..").ChartsAxisClasses> | undefined;
35
- tickMaxStep?: number | undefined;
36
- tickMinStep?: number | undefined;
37
- tickNumber?: number | undefined;
38
- disableLine?: boolean | undefined;
39
- disableTicks?: boolean | undefined;
40
- tickFontSize?: number | undefined;
41
- tickLabelStyle?: import("..").ChartsTextProps["style"];
42
- labelStyle?: import("..").ChartsTextProps["style"];
43
- tickLabelInterval?: ("auto" | ((value: any, index: number) => boolean)) | undefined;
44
- labelFontSize?: number | undefined;
45
- tickSize?: number | undefined;
46
- slots?: Partial<import("../internals").ChartsAxisSlots> | undefined;
47
- slotProps?: Partial<import("../internals").ChartsAxisSlotProps> | undefined;
48
- tickInterval?: ("auto" | ((value: any, index: number) => boolean) | any[]) | undefined;
49
- tickPlacement?: ("start" | "end" | "middle" | "extremities") | undefined;
50
- tickLabelPlacement?: ("middle" | "tick") | undefined;
51
- scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
52
- colorMap?: import("../models/colorMapping").ContinuousColorConfig<number | Date> | import("../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
53
- hideTooltip?: boolean | undefined;
54
- domainLimit?: ("nice" | "strict" | ((min: number, max: number) => {
55
- min: number;
56
- max: number;
57
- })) | undefined;
58
- id: import("../internals").AxisId;
59
- }[];
60
- yAxis: {
61
- reverse?: boolean | undefined;
62
- fill?: string | undefined;
63
- stroke?: string | undefined;
64
- data?: any[] | undefined;
65
- label?: string | undefined;
66
- max?: (number | Date) | undefined;
67
- min?: (number | Date) | undefined;
68
- valueFormatter?: ((value: any, context: import("../internals").AxisValueFormatterContext) => string) | undefined;
69
- dataKey?: string | undefined;
70
- sx?: import("@mui/system").SxProps | undefined;
71
- classes?: Partial<import("..").ChartsAxisClasses> | undefined;
72
- tickMaxStep?: number | undefined;
73
- tickMinStep?: number | undefined;
74
- tickNumber?: number | undefined;
75
- disableLine?: boolean | undefined;
76
- disableTicks?: boolean | undefined;
77
- tickFontSize?: number | undefined;
78
- tickLabelStyle?: import("..").ChartsTextProps["style"];
79
- labelStyle?: import("..").ChartsTextProps["style"];
80
- tickLabelInterval?: ("auto" | ((value: any, index: number) => boolean)) | undefined;
81
- labelFontSize?: number | undefined;
82
- tickSize?: number | undefined;
83
- slots?: Partial<import("../internals").ChartsAxisSlots> | undefined;
84
- slotProps?: Partial<import("../internals").ChartsAxisSlotProps> | undefined;
85
- tickInterval?: ("auto" | ((value: any, index: number) => boolean) | any[]) | undefined;
86
- tickPlacement?: ("start" | "end" | "middle" | "extremities") | undefined;
87
- tickLabelPlacement?: ("middle" | "tick") | undefined;
88
- scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
89
- colorMap?: import("../models/colorMapping").ContinuousColorConfig<number | Date> | import("../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
90
- hideTooltip?: boolean | undefined;
91
- domainLimit?: ("nice" | "strict" | ((min: number, max: number) => {
92
- min: number;
93
- max: number;
94
- })) | undefined;
95
- id: import("../internals").AxisId;
96
- }[];
10
+ resizableContainerProps: any;
11
+ children: React.ReactNode;
97
12
  };
13
+ export declare const useChartContainerProps: (props: ChartContainerProps, ref: React.Ref<SVGSVGElement>) => UseChartContainerPropsReturnValue;
@@ -1,86 +1,56 @@
1
1
  'use client';
2
2
 
3
- import _extends from "@babel/runtime/helpers/esm/extends";
4
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["width", "height", "series", "margin", "xAxis", "yAxis", "zAxis", "colors", "dataset", "sx", "title", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "children", "skipAnimation"];
6
- import * as React from 'react';
7
- import useForkRef from '@mui/utils/useForkRef';
8
- import { useDefaultizeAxis } from "./useDefaultizeAxis.js";
4
+ const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "sx", "title", "xAxis", "yAxis", "zAxis", "skipAnimation"];
9
5
  export const useChartContainerProps = (props, ref) => {
10
6
  const {
11
7
  width,
12
8
  height,
13
- series,
14
9
  margin,
15
- xAxis,
16
- yAxis,
17
- zAxis,
10
+ children,
11
+ series,
18
12
  colors,
19
13
  dataset,
20
- sx,
21
- title,
22
14
  desc,
23
15
  disableAxisListener,
24
16
  highlightedItem,
25
17
  onHighlightChange,
26
18
  plugins,
27
- children,
19
+ sx,
20
+ title,
21
+ xAxis,
22
+ yAxis,
23
+ zAxis,
28
24
  skipAnimation
29
25
  } = props,
30
26
  other = _objectWithoutPropertiesLoose(props, _excluded);
31
- const svgRef = React.useRef(null);
32
- const chartSurfaceRef = useForkRef(ref, svgRef);
33
- const [defaultizedXAxis, defaultizedYAxis] = useDefaultizeAxis(xAxis, yAxis, dataset);
34
- const drawingProviderProps = {
35
- width,
36
- height,
37
- margin,
38
- svgRef
39
- };
40
- const animationProviderProps = {
41
- skipAnimation
42
- };
43
- const pluginProviderProps = {
44
- plugins
27
+ const resizableContainerProps = other;
28
+ const chartsSurfaceProps = {
29
+ title,
30
+ desc,
31
+ sx,
32
+ disableAxisListener,
33
+ ref
45
34
  };
46
- const seriesProviderProps = {
35
+ const chartDataProviderProps = {
36
+ margin,
47
37
  series,
48
38
  colors,
49
- dataset
50
- };
51
- const cartesianProviderProps = {
52
- xAxis: defaultizedXAxis,
53
- yAxis: defaultizedYAxis,
54
- dataset
55
- };
56
- const zAxisContextProps = {
57
- zAxis,
58
- dataset
59
- };
60
- const highlightedProviderProps = {
39
+ dataset,
61
40
  highlightedItem,
62
- onHighlightChange
63
- };
64
- const chartsSurfaceProps = _extends({}, other, {
41
+ onHighlightChange,
42
+ plugins,
43
+ xAxis,
44
+ yAxis,
45
+ zAxis,
46
+ skipAnimation,
65
47
  width,
66
- height,
67
- ref: chartSurfaceRef,
68
- sx,
69
- title,
70
- desc,
71
- disableAxisListener
72
- });
48
+ height
49
+ };
73
50
  return {
74
- children,
75
- drawingProviderProps,
76
- seriesProviderProps,
77
- cartesianProviderProps,
78
- zAxisContextProps,
79
- highlightedProviderProps,
51
+ chartDataProviderProps,
52
+ resizableContainerProps,
80
53
  chartsSurfaceProps,
81
- pluginProviderProps,
82
- animationProviderProps,
83
- xAxis: defaultizedXAxis,
84
- yAxis: defaultizedYAxis
54
+ children
85
55
  };
86
56
  };
@@ -1,21 +1,5 @@
1
1
  import * as React from 'react';
2
- export interface ChartsAxisHighlightClasses {
3
- /** Styles applied to the root element. */
4
- root: string;
5
- }
6
- export type ChartsAxisHighlightClassKey = keyof ChartsAxisHighlightClasses;
7
- export declare function getAxisHighlightUtilityClass(slot: string): string;
8
- export declare const chartsAxisHighlightClasses: ChartsAxisHighlightClasses;
9
- export declare const ChartsAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
10
- ownerState: {
11
- axisHighlight: AxisHighlight;
12
- };
13
- }, Pick<React.SVGProps<SVGPathElement>, keyof React.SVGProps<SVGPathElement>>, {}>;
14
- type AxisHighlight = 'none' | 'line' | 'band';
15
- export type ChartsAxisHighlightProps = {
16
- x?: AxisHighlight;
17
- y?: AxisHighlight;
18
- };
2
+ import { ChartsAxisHighlightProps } from './ChartsAxisHighlight.types';
19
3
  /**
20
4
  * Demos:
21
5
  *
@@ -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,5 @@
1
+ export type ChartsAxisHighlightType = 'none' | 'line' | 'band';
2
+ export type ChartsAxisHighlightProps = {
3
+ x?: ChartsAxisHighlightType;
4
+ y?: ChartsAxisHighlightType;
5
+ };
@@ -0,0 +1,6 @@
1
+ import { ChartsAxisHighlightType } from './ChartsAxisHighlight.types';
2
+ export declare const ChartsAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
3
+ ownerState: {
4
+ axisHighlight: ChartsAxisHighlightType;
5
+ };
6
+ }, Pick<import("react").SVGProps<SVGPathElement>, keyof import("react").SVGProps<SVGPathElement>>, {}>;
@@ -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,10 @@
1
+ import * as React from 'react';
2
+ import { ChartsAxisHighlightType } from './ChartsAxisHighlight.types';
3
+ import { ChartsAxisHighlightClasses } from './chartsAxisHighlightClasses';
4
+ /**
5
+ * @ignore - internal component.
6
+ */
7
+ export default function ChartsXHighlight(props: {
8
+ type: ChartsAxisHighlightType;
9
+ classes: ChartsAxisHighlightClasses;
10
+ }): React.JSX.Element;
@@ -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/useSelector.js";
7
+ import { useStore } from "../internals/useStore.js";
8
+ import { selectorChartsInteractionXAxis } from "../context/InteractionSelectors.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,10 @@
1
+ import * as React from 'react';
2
+ import { ChartsAxisHighlightType } from './ChartsAxisHighlight.types';
3
+ import { ChartsAxisHighlightClasses } from './chartsAxisHighlightClasses';
4
+ /**
5
+ * @ignore - internal component.
6
+ */
7
+ export default function ChartsYHighlight(props: {
8
+ type: ChartsAxisHighlightType;
9
+ classes: ChartsAxisHighlightClasses;
10
+ }): React.JSX.Element;
@@ -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/useSelector.js";
7
+ import { useStore } from "../internals/useStore.js";
8
+ import { selectorChartsInteractionYAxis } from "../context/InteractionSelectors.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,7 @@
1
+ export interface ChartsAxisHighlightClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ }
5
+ export type ChartsAxisHighlightClassKey = keyof ChartsAxisHighlightClasses;
6
+ export declare function getAxisHighlightUtilityClass(slot: string): string;
7
+ export declare const chartsAxisHighlightClasses: ChartsAxisHighlightClasses;
@@ -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
1
  export * from './ChartsAxisHighlight';
2
+ export * from './chartsAxisHighlightClasses';
3
+ export * from './ChartsAxisHighlight.types';
4
+ export * from './ChartsAxisHighlightPath';
@@ -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";