@mui/x-charts 8.0.0-alpha.0 → 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 (335) 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 -31
  5. package/BarChart/BarElement.d.ts +5 -1342
  6. package/BarChart/BarElement.js +10 -20
  7. package/BarChart/BarPlot.js +12 -2
  8. package/BarChart/useBarChartProps.d.ts +0 -2
  9. package/BarChart/useBarChartProps.js +2 -8
  10. package/CHANGELOG.md +429 -5
  11. package/ChartContainer/ChartContainer.d.ts +2 -19
  12. package/ChartContainer/ChartContainer.js +10 -20
  13. package/ChartContainer/ResizableContainer.d.ts +17 -4
  14. package/ChartContainer/ResizableContainer.js +36 -2
  15. package/ChartContainer/useChartContainerProps.d.ts +6 -7
  16. package/ChartContainer/useChartContainerProps.js +14 -28
  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/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
  38. package/ChartsSurface/ChartsSurface.d.ts +0 -15
  39. package/ChartsSurface/ChartsSurface.js +35 -34
  40. package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
  41. package/ChartsTooltip/ChartTooltip.types.js +1 -0
  42. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +7 -39
  43. package/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
  44. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -28
  45. package/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
  46. package/ChartsTooltip/ChartsTooltip.d.ts +3 -69
  47. package/ChartsTooltip/ChartsTooltip.js +161 -145
  48. package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
  49. package/ChartsTooltip/ChartsTooltipContainer.js +298 -0
  50. package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -0
  51. package/ChartsTooltip/chartsTooltipClasses.js +18 -2
  52. package/ChartsTooltip/index.d.ts +3 -3
  53. package/ChartsTooltip/index.js +2 -3
  54. package/ChartsTooltip/useAxisTooltip.d.ts +2 -2
  55. package/ChartsTooltip/useAxisTooltip.js +19 -19
  56. package/ChartsTooltip/useItemTooltip.d.ts +1 -1
  57. package/ChartsTooltip/useItemTooltip.js +5 -4
  58. package/ChartsTooltip/utils.d.ts +0 -3
  59. package/ChartsTooltip/utils.js +0 -8
  60. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +47 -34
  61. package/Gauge/Gauge.d.ts +1 -1
  62. package/Gauge/Gauge.js +0 -6
  63. package/Gauge/GaugeContainer.d.ts +3 -3
  64. package/Gauge/GaugeContainer.js +60 -61
  65. package/LineChart/AnimatedArea.d.ts +0 -1333
  66. package/LineChart/AnimatedArea.js +9 -18
  67. package/LineChart/AnimatedLine.d.ts +0 -1333
  68. package/LineChart/AnimatedLine.js +9 -20
  69. package/LineChart/AreaPlot.js +12 -2
  70. package/LineChart/CircleMarkElement.js +6 -5
  71. package/LineChart/LineChart.d.ts +4 -10
  72. package/LineChart/LineChart.js +3 -32
  73. package/LineChart/LineHighlightPlot.js +6 -5
  74. package/LineChart/LinePlot.js +12 -2
  75. package/LineChart/MarkElement.js +6 -5
  76. package/LineChart/useLineChartProps.d.ts +0 -2
  77. package/LineChart/useLineChartProps.js +2 -8
  78. package/PieChart/PieChart.d.ts +3 -9
  79. package/PieChart/PieChart.js +5 -37
  80. package/PieChart/PiePlot.js +2 -2
  81. package/PieChart/getPieCoordinates.d.ts +2 -2
  82. package/README.md +2 -2
  83. package/ScatterChart/Scatter.js +6 -5
  84. package/ScatterChart/ScatterChart.d.ts +4 -10
  85. package/ScatterChart/ScatterChart.js +5 -32
  86. package/ScatterChart/useScatterChartProps.d.ts +0 -2
  87. package/ScatterChart/useScatterChartProps.js +1 -9
  88. package/SparkLineChart/SparkLineChart.d.ts +3 -4
  89. package/SparkLineChart/SparkLineChart.js +4 -31
  90. package/context/ChartDataProvider/ChartDataProvider.d.ts +9 -19
  91. package/context/ChartDataProvider/ChartDataProvider.js +30 -43
  92. package/context/ChartDataProvider/useChartDataProviderProps.d.ts +7 -10
  93. package/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
  94. package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
  95. package/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
  96. package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +8 -0
  97. package/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
  98. package/context/DrawingAreaProvider/DrawingAreaProvider.d.ts +3 -0
  99. package/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
  100. package/context/DrawingAreaProvider/index.d.ts +3 -0
  101. package/context/DrawingAreaProvider/index.js +3 -0
  102. package/context/InteractionProvider.d.ts +5 -48
  103. package/context/InteractionProvider.js +8 -64
  104. package/context/InteractionSelectors.d.ts +359 -0
  105. package/context/InteractionSelectors.js +12 -0
  106. package/context/SizeProvider/Size.types.d.ts +30 -0
  107. package/context/SizeProvider/Size.types.js +1 -0
  108. package/context/SizeProvider/SizeContext.d.ts +4 -0
  109. package/context/SizeProvider/SizeContext.js +13 -0
  110. package/context/SizeProvider/SizeProvider.d.ts +11 -0
  111. package/context/SizeProvider/SizeProvider.js +26 -0
  112. package/context/SizeProvider/index.d.ts +4 -0
  113. package/context/SizeProvider/index.js +4 -0
  114. package/{ChartContainer → context/SizeProvider}/useChartContainerDimensions.d.ts +4 -1
  115. package/{modern/ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +11 -5
  116. package/context/SizeProvider/useSize.d.ts +5 -0
  117. package/context/SizeProvider/useSize.js +13 -0
  118. package/context/SvgRefProvider/SvgRef.types.d.ts +8 -0
  119. package/context/SvgRefProvider/SvgRef.types.js +1 -0
  120. package/context/SvgRefProvider/SvgRefContext.d.ts +4 -0
  121. package/context/SvgRefProvider/SvgRefContext.js +17 -0
  122. package/context/SvgRefProvider/SvgRefProvider.d.ts +3 -0
  123. package/context/SvgRefProvider/SvgRefProvider.js +24 -0
  124. package/context/SvgRefProvider/index.d.ts +4 -0
  125. package/context/SvgRefProvider/index.js +4 -0
  126. package/context/SvgRefProvider/useSurfaceRef.d.ts +2 -0
  127. package/context/SvgRefProvider/useSurfaceRef.js +14 -0
  128. package/context/index.d.ts +2 -0
  129. package/context/index.js +2 -1
  130. package/hooks/useAxisEvents.js +32 -19
  131. package/hooks/useChartId.js +2 -2
  132. package/hooks/useDrawingArea.d.ts +2 -2
  133. package/hooks/useDrawingArea.js +2 -2
  134. package/hooks/useInteractionItemProps.js +19 -12
  135. package/hooks/useSvgRef.js +3 -3
  136. package/index.js +1 -1
  137. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
  138. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
  139. package/internals/computeAxisValue.d.ts +2 -2
  140. package/internals/index.d.ts +3 -2
  141. package/internals/index.js +3 -2
  142. package/internals/plugins/models/index.d.ts +35 -0
  143. package/internals/plugins/models/index.js +1 -0
  144. package/internals/plugins/utils/ChartStore.d.ts +12 -0
  145. package/internals/plugins/utils/ChartStore.js +26 -0
  146. package/internals/plugins/utils/ChartsStore.d.ts +12 -0
  147. package/internals/plugins/utils/ChartsStore.js +26 -0
  148. package/internals/plugins/utils/selectors.d.ts +9 -0
  149. package/internals/plugins/utils/selectors.js +37 -0
  150. package/internals/useCharts.d.ts +6 -0
  151. package/internals/useCharts.js +29 -0
  152. package/internals/useSelector.d.ts +4 -0
  153. package/internals/useSelector.js +6 -0
  154. package/internals/useStore.d.ts +2 -0
  155. package/internals/useStore.js +17 -0
  156. package/modern/BarChart/AnimatedBarElement.js +21 -0
  157. package/modern/BarChart/BarChart.js +3 -31
  158. package/modern/BarChart/BarElement.js +10 -20
  159. package/modern/BarChart/BarPlot.js +12 -2
  160. package/modern/BarChart/useBarChartProps.js +2 -8
  161. package/modern/ChartContainer/ChartContainer.js +10 -20
  162. package/modern/ChartContainer/ResizableContainer.js +36 -2
  163. package/modern/ChartContainer/useChartContainerProps.js +14 -28
  164. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
  165. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
  166. package/modern/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
  167. package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
  168. package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
  169. package/modern/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
  170. package/modern/ChartsAxisHighlight/index.js +4 -1
  171. package/modern/ChartsGrid/ChartsGrid.js +1 -1
  172. package/modern/ChartsGrid/ChartsHorizontalGrid.js +3 -3
  173. package/modern/ChartsGrid/ChartsVerticalGrid.js +3 -3
  174. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
  175. package/modern/ChartsSurface/ChartsSurface.js +35 -34
  176. package/modern/ChartsTooltip/ChartTooltip.types.js +1 -0
  177. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
  178. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
  179. package/modern/ChartsTooltip/ChartsTooltip.js +161 -145
  180. package/modern/ChartsTooltip/ChartsTooltipContainer.js +298 -0
  181. package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
  182. package/modern/ChartsTooltip/index.js +2 -3
  183. package/modern/ChartsTooltip/useAxisTooltip.js +19 -19
  184. package/modern/ChartsTooltip/useItemTooltip.js +5 -4
  185. package/modern/ChartsTooltip/utils.js +0 -8
  186. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +47 -34
  187. package/modern/Gauge/Gauge.js +0 -6
  188. package/modern/Gauge/GaugeContainer.js +60 -61
  189. package/modern/LineChart/AnimatedArea.js +9 -18
  190. package/modern/LineChart/AnimatedLine.js +9 -20
  191. package/modern/LineChart/AreaPlot.js +12 -2
  192. package/modern/LineChart/CircleMarkElement.js +6 -5
  193. package/modern/LineChart/LineChart.js +3 -32
  194. package/modern/LineChart/LineHighlightPlot.js +6 -5
  195. package/modern/LineChart/LinePlot.js +12 -2
  196. package/modern/LineChart/MarkElement.js +6 -5
  197. package/modern/LineChart/useLineChartProps.js +2 -8
  198. package/modern/PieChart/PieChart.js +5 -37
  199. package/modern/PieChart/PiePlot.js +2 -2
  200. package/modern/ScatterChart/Scatter.js +6 -5
  201. package/modern/ScatterChart/ScatterChart.js +5 -32
  202. package/modern/ScatterChart/useScatterChartProps.js +1 -9
  203. package/modern/SparkLineChart/SparkLineChart.js +4 -31
  204. package/modern/context/ChartDataProvider/ChartDataProvider.js +30 -43
  205. package/modern/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
  206. package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
  207. package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
  208. package/modern/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
  209. package/modern/context/DrawingAreaProvider/index.js +3 -0
  210. package/modern/context/InteractionProvider.js +8 -64
  211. package/modern/context/InteractionSelectors.js +12 -0
  212. package/modern/context/SizeProvider/Size.types.js +1 -0
  213. package/modern/context/SizeProvider/SizeContext.js +13 -0
  214. package/modern/context/SizeProvider/SizeProvider.js +26 -0
  215. package/modern/context/SizeProvider/index.js +4 -0
  216. package/{ChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +11 -5
  217. package/modern/context/SizeProvider/useSize.js +13 -0
  218. package/modern/context/SvgRefProvider/SvgRef.types.js +1 -0
  219. package/modern/context/SvgRefProvider/SvgRefContext.js +17 -0
  220. package/modern/context/SvgRefProvider/SvgRefProvider.js +24 -0
  221. package/modern/context/SvgRefProvider/index.js +4 -0
  222. package/modern/context/SvgRefProvider/useSurfaceRef.js +14 -0
  223. package/modern/context/index.js +2 -1
  224. package/modern/hooks/useAxisEvents.js +32 -19
  225. package/modern/hooks/useChartId.js +2 -2
  226. package/modern/hooks/useDrawingArea.js +2 -2
  227. package/modern/hooks/useInteractionItemProps.js +19 -12
  228. package/modern/hooks/useSvgRef.js +3 -3
  229. package/modern/index.js +1 -1
  230. package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
  231. package/modern/internals/index.js +3 -2
  232. package/modern/internals/plugins/models/index.js +1 -0
  233. package/modern/internals/plugins/utils/ChartStore.js +26 -0
  234. package/modern/internals/plugins/utils/ChartsStore.js +26 -0
  235. package/modern/internals/plugins/utils/selectors.js +37 -0
  236. package/modern/internals/useCharts.js +29 -0
  237. package/modern/internals/useSelector.js +6 -0
  238. package/modern/internals/useStore.js +17 -0
  239. package/node/BarChart/AnimatedBarElement.js +28 -0
  240. package/node/BarChart/BarChart.js +3 -31
  241. package/node/BarChart/BarElement.js +11 -21
  242. package/node/BarChart/BarPlot.js +11 -1
  243. package/node/BarChart/useBarChartProps.js +2 -8
  244. package/node/ChartContainer/ChartContainer.js +10 -20
  245. package/node/ChartContainer/ResizableContainer.js +39 -3
  246. package/node/ChartContainer/useChartContainerProps.js +14 -28
  247. package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
  248. package/node/ChartsAxisHighlight/ChartsAxisHighlight.types.js +5 -0
  249. package/node/ChartsAxisHighlight/ChartsAxisHighlightPath.js +40 -0
  250. package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +57 -0
  251. package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +57 -0
  252. package/node/ChartsAxisHighlight/chartsAxisHighlightClasses.js +14 -0
  253. package/node/ChartsAxisHighlight/index.js +33 -0
  254. package/node/ChartsGrid/ChartsGrid.js +2 -2
  255. package/node/ChartsGrid/ChartsHorizontalGrid.js +4 -4
  256. package/node/ChartsGrid/ChartsVerticalGrid.js +4 -4
  257. package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
  258. package/node/ChartsSurface/ChartsSurface.js +35 -34
  259. package/node/ChartsTooltip/ChartTooltip.types.js +5 -0
  260. package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
  261. package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
  262. package/node/ChartsTooltip/ChartsTooltip.js +160 -144
  263. package/node/ChartsTooltip/ChartsTooltipContainer.js +304 -0
  264. package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
  265. package/node/ChartsTooltip/index.js +19 -28
  266. package/node/ChartsTooltip/useAxisTooltip.js +19 -19
  267. package/node/ChartsTooltip/useItemTooltip.js +5 -4
  268. package/node/ChartsTooltip/utils.js +0 -9
  269. package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +48 -35
  270. package/node/Gauge/Gauge.js +0 -6
  271. package/node/Gauge/GaugeContainer.js +60 -61
  272. package/node/LineChart/AnimatedArea.js +9 -19
  273. package/node/LineChart/AnimatedLine.js +9 -21
  274. package/node/LineChart/AreaPlot.js +11 -1
  275. package/node/LineChart/CircleMarkElement.js +6 -5
  276. package/node/LineChart/LineChart.js +3 -32
  277. package/node/LineChart/LineHighlightPlot.js +6 -5
  278. package/node/LineChart/LinePlot.js +11 -1
  279. package/node/LineChart/MarkElement.js +6 -5
  280. package/node/LineChart/useLineChartProps.js +2 -8
  281. package/node/PieChart/PieChart.js +5 -37
  282. package/node/PieChart/PiePlot.js +2 -2
  283. package/node/ScatterChart/Scatter.js +6 -5
  284. package/node/ScatterChart/ScatterChart.js +5 -32
  285. package/node/ScatterChart/useScatterChartProps.js +1 -9
  286. package/node/SparkLineChart/SparkLineChart.js +4 -31
  287. package/node/context/ChartDataProvider/ChartDataProvider.js +30 -43
  288. package/node/context/ChartDataProvider/useChartDataProviderProps.js +22 -44
  289. package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
  290. package/node/context/DrawingAreaProvider/DrawingAreaContext.js +22 -0
  291. package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
  292. package/node/context/DrawingAreaProvider/index.js +38 -0
  293. package/node/context/InteractionProvider.js +9 -66
  294. package/node/context/InteractionSelectors.js +18 -0
  295. package/node/context/SizeProvider/Size.types.js +5 -0
  296. package/node/context/SizeProvider/SizeContext.js +20 -0
  297. package/node/context/SizeProvider/SizeProvider.js +29 -0
  298. package/node/context/SizeProvider/index.js +49 -0
  299. package/node/{ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +11 -5
  300. package/node/context/SizeProvider/useSize.js +20 -0
  301. package/node/context/SvgRefProvider/SvgRef.types.js +5 -0
  302. package/node/context/SvgRefProvider/SvgRefContext.js +23 -0
  303. package/node/context/SvgRefProvider/SvgRefProvider.js +31 -0
  304. package/node/context/SvgRefProvider/index.js +49 -0
  305. package/node/context/SvgRefProvider/useSurfaceRef.js +20 -0
  306. package/node/context/index.js +10 -2
  307. package/node/hooks/useAxisEvents.js +33 -19
  308. package/node/hooks/useChartId.js +2 -2
  309. package/node/hooks/useDrawingArea.js +2 -2
  310. package/node/hooks/useInteractionItemProps.js +20 -13
  311. package/node/hooks/useSvgRef.js +3 -3
  312. package/node/index.js +1 -1
  313. package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
  314. package/node/internals/index.js +28 -16
  315. package/node/internals/plugins/models/index.js +5 -0
  316. package/node/internals/plugins/utils/ChartStore.js +33 -0
  317. package/node/internals/plugins/utils/ChartsStore.js +33 -0
  318. package/node/internals/plugins/utils/selectors.js +44 -0
  319. package/node/internals/useCharts.js +36 -0
  320. package/node/internals/useSelector.js +13 -0
  321. package/node/internals/useStore.js +24 -0
  322. package/package.json +7 -5
  323. package/themeAugmentation/props.d.ts +1 -2
  324. package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +0 -7
  325. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
  326. package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +0 -8
  327. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
  328. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
  329. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
  330. package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
  331. package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
  332. /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
  333. /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
  334. /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
  335. /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = ChartsXHighlight;
9
+ var React = _interopRequireWildcard(require("react"));
10
+ var _useScale = require("../hooks/useScale");
11
+ var _isBandScale = require("../internals/isBandScale");
12
+ var _useSelector = require("../internals/useSelector");
13
+ var _useStore = require("../internals/useStore");
14
+ var _InteractionSelectors = require("../context/InteractionSelectors");
15
+ var _hooks = require("../hooks");
16
+ var _ChartsAxisHighlightPath = require("./ChartsAxisHighlightPath");
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
+ /**
19
+ * @ignore - internal component.
20
+ */function ChartsXHighlight(props) {
21
+ const {
22
+ type,
23
+ classes
24
+ } = props;
25
+ const {
26
+ top,
27
+ height
28
+ } = (0, _hooks.useDrawingArea)();
29
+ const xScale = (0, _useScale.useXScale)();
30
+ const store = (0, _useStore.useStore)();
31
+ const axisX = (0, _useSelector.useSelector)(store, _InteractionSelectors.selectorChartsInteractionXAxis);
32
+ const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
33
+ const isBandScaleX = type === 'band' && axisX !== null && (0, _isBandScale.isBandScale)(xScale);
34
+ if (process.env.NODE_ENV !== 'production') {
35
+ const isError = isBandScaleX && xScale(axisX.value) === undefined;
36
+ if (isError) {
37
+ 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'));
38
+ }
39
+ }
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
41
+ children: [isBandScaleX && xScale(axisX.value) !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightPath.ChartsAxisHighlightPath
42
+ // @ts-expect-error, xScale value is checked in the statement above
43
+ , {
44
+ d: `M ${xScale(axisX.value) - (xScale.step() - xScale.bandwidth()) / 2} ${top} l ${xScale.step()} 0 l 0 ${height} l ${-xScale.step()} 0 Z`,
45
+ className: classes.root,
46
+ ownerState: {
47
+ axisHighlight: 'band'
48
+ }
49
+ }), type === 'line' && axisX !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightPath.ChartsAxisHighlightPath, {
50
+ d: `M ${getXPosition(axisX.value)} ${top} L ${getXPosition(axisX.value)} ${top + height}`,
51
+ className: classes.root,
52
+ ownerState: {
53
+ axisHighlight: 'line'
54
+ }
55
+ })]
56
+ });
57
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = ChartsYHighlight;
9
+ var React = _interopRequireWildcard(require("react"));
10
+ var _useScale = require("../hooks/useScale");
11
+ var _isBandScale = require("../internals/isBandScale");
12
+ var _useSelector = require("../internals/useSelector");
13
+ var _useStore = require("../internals/useStore");
14
+ var _InteractionSelectors = require("../context/InteractionSelectors");
15
+ var _hooks = require("../hooks");
16
+ var _ChartsAxisHighlightPath = require("./ChartsAxisHighlightPath");
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
+ /**
19
+ * @ignore - internal component.
20
+ */function ChartsYHighlight(props) {
21
+ const {
22
+ type,
23
+ classes
24
+ } = props;
25
+ const {
26
+ left,
27
+ width
28
+ } = (0, _hooks.useDrawingArea)();
29
+ const yScale = (0, _useScale.useYScale)();
30
+ const store = (0, _useStore.useStore)();
31
+ const axisY = (0, _useSelector.useSelector)(store, _InteractionSelectors.selectorChartsInteractionYAxis);
32
+ const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
33
+ const isBandScaleY = type === 'band' && axisY !== null && (0, _isBandScale.isBandScale)(yScale);
34
+ if (process.env.NODE_ENV !== 'production') {
35
+ const isError = isBandScaleY && yScale(axisY.value) === undefined;
36
+ if (isError) {
37
+ 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'));
38
+ }
39
+ }
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
41
+ children: [isBandScaleY && yScale(axisY.value) !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightPath.ChartsAxisHighlightPath, {
42
+ d: `M ${left} ${
43
+ // @ts-expect-error, yScale value is checked in the statement above
44
+ yScale(axisY.value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
45
+ className: classes.root,
46
+ ownerState: {
47
+ axisHighlight: 'band'
48
+ }
49
+ }), type === 'line' && axisY !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightPath.ChartsAxisHighlightPath, {
50
+ d: `M ${left} ${getYPosition(axisY.value)} L ${left + width} ${getYPosition(axisY.value)}`,
51
+ className: classes.root,
52
+ ownerState: {
53
+ axisHighlight: 'line'
54
+ }
55
+ })]
56
+ });
57
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.chartsAxisHighlightClasses = void 0;
8
+ exports.getAxisHighlightUtilityClass = getAxisHighlightUtilityClass;
9
+ var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
10
+ var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
11
+ function getAxisHighlightUtilityClass(slot) {
12
+ return (0, _generateUtilityClass.default)('MuiChartsAxisHighlight', slot);
13
+ }
14
+ const chartsAxisHighlightClasses = exports.chartsAxisHighlightClasses = (0, _generateUtilityClasses.default)('MuiChartsAxisHighlight', ['root']);
@@ -13,4 +13,37 @@ Object.keys(_ChartsAxisHighlight).forEach(function (key) {
13
13
  return _ChartsAxisHighlight[key];
14
14
  }
15
15
  });
16
+ });
17
+ var _chartsAxisHighlightClasses = require("./chartsAxisHighlightClasses");
18
+ Object.keys(_chartsAxisHighlightClasses).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _chartsAxisHighlightClasses[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _chartsAxisHighlightClasses[key];
25
+ }
26
+ });
27
+ });
28
+ var _ChartsAxisHighlight2 = require("./ChartsAxisHighlight.types");
29
+ Object.keys(_ChartsAxisHighlight2).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _ChartsAxisHighlight2[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _ChartsAxisHighlight2[key];
36
+ }
37
+ });
38
+ });
39
+ var _ChartsAxisHighlightPath = require("./ChartsAxisHighlightPath");
40
+ Object.keys(_ChartsAxisHighlightPath).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _ChartsAxisHighlightPath[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _ChartsAxisHighlightPath[key];
47
+ }
48
+ });
16
49
  });
@@ -16,7 +16,7 @@ var _styles = require("@mui/material/styles");
16
16
  var _CartesianProvider = require("../context/CartesianProvider");
17
17
  var _chartsGridClasses = require("./chartsGridClasses");
18
18
  var _useDrawingArea = require("../hooks/useDrawingArea");
19
- var _styledCommonents = require("./styledCommonents");
19
+ var _styledComponents = require("./styledComponents");
20
20
  var _ChartsVerticalGrid = require("./ChartsVerticalGrid");
21
21
  var _ChartsHorizontalGrid = require("./ChartsHorizontalGrid");
22
22
  var _jsxRuntime = require("react/jsx-runtime");
@@ -60,7 +60,7 @@ function ChartsGrid(inProps) {
60
60
  const classes = useUtilityClasses(props);
61
61
  const horizontalAxis = yAxis[yAxisIds[0]];
62
62
  const verticalAxis = xAxis[xAxisIds[0]];
63
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledCommonents.GridRoot, (0, _extends2.default)({}, other, {
63
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledComponents.GridRoot, (0, _extends2.default)({}, other, {
64
64
  className: classes.root,
65
65
  children: [vertical && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsVerticalGrid.ChartsGridVertical, {
66
66
  axis: verticalAxis,
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.ChartsGridHorizontal = ChartsGridHorizontal;
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
  var _useTicks = require("../hooks/useTicks");
10
- var _styledCommonents = require("./styledCommonents");
10
+ var _styledComponents = require("./styledComponents");
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  /**
13
13
  * @ignore - internal component.
@@ -30,14 +30,14 @@ function ChartsGridHorizontal(props) {
30
30
  });
31
31
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
32
32
  children: yTicks.map(({
33
- formattedValue,
33
+ value,
34
34
  offset
35
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledCommonents.GridLine, {
35
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledComponents.GridLine, {
36
36
  y1: offset,
37
37
  y2: offset,
38
38
  x1: drawingArea.left,
39
39
  x2: drawingArea.left + drawingArea.width,
40
40
  className: classes.horizontalLine
41
- }, `horizontal-${formattedValue}`))
41
+ }, `horizontal-${value}`))
42
42
  });
43
43
  }
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.ChartsGridVertical = ChartsGridVertical;
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
  var _useTicks = require("../hooks/useTicks");
10
- var _styledCommonents = require("./styledCommonents");
10
+ var _styledComponents = require("./styledComponents");
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  /**
13
13
  * @ignore - internal component.
@@ -30,14 +30,14 @@ function ChartsGridVertical(props) {
30
30
  });
31
31
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
32
32
  children: xTicks.map(({
33
- formattedValue,
33
+ value,
34
34
  offset
35
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledCommonents.GridLine, {
35
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledComponents.GridLine, {
36
36
  y1: drawingArea.top,
37
37
  y2: drawingArea.top + drawingArea.height,
38
38
  x1: offset,
39
39
  x2: offset,
40
40
  className: classes.verticalLine
41
- }, `vertical-${formattedValue}`))
41
+ }, `vertical-${value}`))
42
42
  });
43
43
  }
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.ChartsOnAxisClickHandler = ChartsOnAxisClickHandler;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
- var _InteractionProvider = require("../context/InteractionProvider");
13
12
  var _useSeries = require("../hooks/useSeries");
14
13
  var _hooks = require("../hooks");
15
14
  var _CartesianProvider = require("../context/CartesianProvider");
15
+ var _useStore = require("../internals/useStore");
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
  function ChartsOnAxisClickHandler(props) {
18
18
  const {
@@ -20,9 +20,7 @@ function ChartsOnAxisClickHandler(props) {
20
20
  } = props;
21
21
  const svgRef = (0, _hooks.useSvgRef)();
22
22
  const series = (0, _useSeries.useSeries)();
23
- const {
24
- axis
25
- } = React.useContext(_InteractionProvider.InteractionContext);
23
+ const store = (0, _useStore.useStore)();
26
24
  const {
27
25
  xAxisIds,
28
26
  xAxis,
@@ -36,9 +34,13 @@ function ChartsOnAxisClickHandler(props) {
36
34
  }
37
35
  const handleMouseClick = event => {
38
36
  event.preventDefault();
39
- const isXaxis = axis.x && axis.x.index !== -1;
37
+ const {
38
+ x: axisX,
39
+ y: axisY
40
+ } = store.value.interaction.axis;
41
+ const isXaxis = axisX && axisX.index !== -1;
40
42
  const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
41
- const dataIndex = isXaxis ? axis.x && axis.x.index : axis.y && axis.y.index;
43
+ const dataIndex = isXaxis ? axisX && axisX.index : axisY && axisY.index;
42
44
  if (dataIndex == null) {
43
45
  return;
44
46
  }
@@ -65,7 +67,7 @@ function ChartsOnAxisClickHandler(props) {
65
67
  return () => {
66
68
  element.removeEventListener('click', handleMouseClick);
67
69
  };
68
- }, [axis.x, axis.y, onAxisClick, series, svgRef, xAxis, xAxisIds, yAxis, yAxisIds]);
70
+ }, [onAxisClick, series, store, svgRef, xAxis, xAxisIds, yAxis, yAxisIds]);
69
71
 
70
72
  // eslint-disable-next-line react/jsx-no-useless-fragment
71
73
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {});
@@ -12,10 +12,15 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
12
12
  var _styles = require("@mui/material/styles");
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
14
  var React = _interopRequireWildcard(require("react"));
15
+ var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
15
16
  var _useAxisEvents = require("../hooks/useAxisEvents");
17
+ var _ChartsAxesGradients = require("../internals/components/ChartsAxesGradients");
18
+ var _hooks = require("../hooks");
19
+ var _SvgRefProvider = require("../context/SvgRefProvider");
20
+ var _SizeProvider = require("../context/SizeProvider");
16
21
  var _jsxRuntime = require("react/jsx-runtime");
17
- const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className", "title", "desc"];
18
- const ChartChartsSurfaceStyles = (0, _styles.styled)('svg', {
22
+ const _excluded = ["children", "disableAxisListener", "className", "title", "desc"];
23
+ const ChartsSurfaceStyles = (0, _styles.styled)('svg', {
19
24
  name: 'MuiChartsSurface',
20
25
  slot: 'Root'
21
26
  })(() => ({
@@ -24,40 +29,50 @@ const ChartChartsSurfaceStyles = (0, _styles.styled)('svg', {
24
29
  touchAction: 'none'
25
30
  }));
26
31
  const ChartsSurface = exports.ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(inProps, ref) {
27
- const props = (0, _styles.useThemeProps)({
32
+ const {
33
+ width,
34
+ height,
35
+ left,
36
+ right,
37
+ top,
38
+ bottom
39
+ } = (0, _hooks.useDrawingArea)();
40
+ const {
41
+ hasIntrinsicSize
42
+ } = (0, _SizeProvider.useSize)();
43
+ const surfaceRef = (0, _SvgRefProvider.useSurfaceRef)();
44
+ const handleRef = (0, _useForkRef.default)(surfaceRef, ref);
45
+ const themeProps = (0, _styles.useThemeProps)({
28
46
  props: inProps,
29
47
  name: 'MuiChartsSurface'
30
48
  });
31
49
  const {
32
50
  children,
33
- width,
34
- height,
35
- viewBox,
36
51
  disableAxisListener = false,
37
52
  className,
38
53
  title,
39
54
  desc
40
- } = props,
41
- other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
42
- const svgView = (0, _extends2.default)({
43
- width,
44
- height,
55
+ } = themeProps,
56
+ other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
57
+ const svgWidth = width + left + right;
58
+ const svgHeight = height + top + bottom;
59
+ const svgView = {
60
+ width: svgWidth,
61
+ height: svgHeight,
45
62
  x: 0,
46
63
  y: 0
47
- }, viewBox);
64
+ };
48
65
  (0, _useAxisEvents.useAxisEvents)(disableAxisListener);
49
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ChartChartsSurfaceStyles, (0, _extends2.default)({
50
- width: width,
51
- height: height,
66
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ChartsSurfaceStyles, (0, _extends2.default)({
52
67
  viewBox: `${svgView.x} ${svgView.y} ${svgView.width} ${svgView.height}`,
53
- ref: ref,
54
68
  className: className
55
69
  }, other, {
56
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("title", {
70
+ ref: handleRef,
71
+ children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("title", {
57
72
  children: title
58
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("desc", {
73
+ }), desc && /*#__PURE__*/(0, _jsxRuntime.jsx)("desc", {
59
74
  children: desc
60
- }), children]
75
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxesGradients.ChartsAxesGradients, {}), hasIntrinsicSize && children]
61
76
  }));
62
77
  });
63
78
  process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
@@ -74,20 +89,6 @@ process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
74
89
  * @default false
75
90
  */
76
91
  disableAxisListener: _propTypes.default.bool,
77
- /**
78
- * The height of the chart in px.
79
- */
80
- height: _propTypes.default.number.isRequired,
81
92
  sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
82
- title: _propTypes.default.string,
83
- viewBox: _propTypes.default.shape({
84
- height: _propTypes.default.number,
85
- width: _propTypes.default.number,
86
- x: _propTypes.default.number,
87
- y: _propTypes.default.number
88
- }),
89
- /**
90
- * The width of the chart in px.
91
- */
92
- width: _propTypes.default.number.isRequired
93
+ title: _propTypes.default.string
93
94
  } : void 0;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,87 +1,97 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
6
  Object.defineProperty(exports, "__esModule", {
6
7
  value: true
7
8
  });
8
9
  exports.ChartsAxisTooltipContent = ChartsAxisTooltipContent;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var React = _interopRequireWildcard(require("react"));
11
- var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
12
- var _CartesianProvider = require("../context/CartesianProvider");
13
- var _DefaultChartsAxisTooltipContent = require("./DefaultChartsAxisTooltipContent");
14
- var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
15
- var _useColorProcessor = require("../context/PluginProvider/useColorProcessor");
16
- var _isCartesian = require("../internals/isCartesian");
17
- var _useSeries = require("../hooks/useSeries");
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
13
+ var _clsx = _interopRequireDefault(require("clsx"));
14
+ var _chartsTooltipClasses = require("./chartsTooltipClasses");
15
+ var _ChartsTooltipTable = require("./ChartsTooltipTable");
16
+ var _useAxisTooltip = require("./useAxisTooltip");
17
+ var _hooks = require("../hooks");
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
- /**
20
- * @ignore - internal component.
21
- */
22
19
  function ChartsAxisTooltipContent(props) {
23
20
  const {
24
- content,
25
- contentProps,
26
- axisData,
27
- sx,
28
- classes
21
+ classes: propClasses,
22
+ sx
29
23
  } = props;
30
- const isXaxis = axisData.x && axisData.x.index !== -1;
31
- const dataIndex = isXaxis ? axisData.x && axisData.x.index : axisData.y && axisData.y.index;
32
- const axisValue = isXaxis ? axisData.x && axisData.x.value : axisData.y && axisData.y.value;
33
- const {
34
- xAxisIds,
35
- xAxis,
36
- yAxisIds,
37
- yAxis
38
- } = (0, _CartesianProvider.useCartesianContext)();
24
+ const tootlipData = (0, _useAxisTooltip.useAxisTooltip)();
25
+ const xAxis = (0, _hooks.useXAxis)();
26
+ const yAxis = (0, _hooks.useYAxis)();
27
+ const classes = (0, _chartsTooltipClasses.useUtilityClasses)(propClasses);
28
+ if (tootlipData === null) {
29
+ return null;
30
+ }
39
31
  const {
40
- zAxisIds,
41
- zAxis
42
- } = React.useContext(_ZAxisContextProvider.ZAxisContext);
43
- const series = (0, _useSeries.useSeries)();
44
- const colorProcessors = (0, _useColorProcessor.useColorProcessor)();
45
- const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
46
- const relevantSeries = React.useMemo(() => {
47
- const rep = [];
48
- Object.keys(series).filter(_isCartesian.isCartesianSeriesType).forEach(seriesType => {
49
- series[seriesType].seriesOrder.forEach(seriesId => {
50
- const item = series[seriesType].series[seriesId];
51
- const providedXAxisId = item.xAxisId;
52
- const providedYAxisId = item.yAxisId;
53
- const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
54
- if (axisKey === undefined || axisKey === USED_AXIS_ID) {
55
- const seriesToAdd = series[seriesType].series[seriesId];
56
- const xAxisId = providedXAxisId ?? xAxisIds[0];
57
- const yAxisId = providedYAxisId ?? yAxisIds[0];
58
- const zAxisId = seriesToAdd.zAxisId ?? zAxisIds[0];
59
- const getColor = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
60
- rep.push((0, _extends2.default)({}, seriesToAdd, {
61
- getColor
62
- }));
63
- }
64
- });
65
- });
66
- return rep;
67
- }, [USED_AXIS_ID, colorProcessors, isXaxis, series, xAxis, xAxisIds, yAxis, yAxisIds, zAxis, zAxisIds]);
68
- const relevantAxis = React.useMemo(() => {
69
- return isXaxis ? xAxis[USED_AXIS_ID] : yAxis[USED_AXIS_ID];
70
- }, [USED_AXIS_ID, isXaxis, xAxis, yAxis]);
71
- const Content = content ?? _DefaultChartsAxisTooltipContent.DefaultChartsAxisTooltipContent;
72
- const chartTooltipContentProps = (0, _useSlotProps.default)({
73
- elementType: Content,
74
- externalSlotProps: contentProps,
75
- additionalProps: {
76
- axisData,
77
- series: relevantSeries,
78
- axis: relevantAxis,
79
- dataIndex,
80
- axisValue,
81
- sx,
82
- classes
83
- },
84
- ownerState: {}
32
+ axisDirection,
33
+ axisValue,
34
+ axisFormattedValue,
35
+ seriesItems
36
+ } = tootlipData;
37
+ const axis = axisDirection === 'x' ? xAxis : yAxis;
38
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipPaper, {
39
+ sx: sx,
40
+ className: classes.paper,
41
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltipTable.ChartsTooltipTable, {
42
+ className: classes.table,
43
+ children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
44
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipRow, {
45
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
46
+ colSpan: 3,
47
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
48
+ children: axisFormattedValue
49
+ })
50
+ })
51
+ })
52
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
53
+ children: seriesItems.map(({
54
+ seriesId,
55
+ color,
56
+ formattedValue,
57
+ formattedLabel
58
+ }) => {
59
+ if (formattedValue == null) {
60
+ return null;
61
+ }
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltipTable.ChartsTooltipRow, {
63
+ className: classes.row,
64
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
65
+ className: (0, _clsx.default)(classes.markCell, classes.cell),
66
+ children: color && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipMark, {
67
+ color: color,
68
+ className: classes.mark
69
+ })
70
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
71
+ className: (0, _clsx.default)(classes.labelCell, classes.cell),
72
+ children: formattedLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
73
+ children: formattedLabel
74
+ }) : null
75
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
76
+ className: (0, _clsx.default)(classes.valueCell, classes.cell),
77
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
78
+ children: formattedValue
79
+ })
80
+ })]
81
+ }, seriesId);
82
+ })
83
+ })]
84
+ })
85
85
  });
86
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Content, (0, _extends2.default)({}, chartTooltipContentProps));
87
- }
86
+ }
87
+ process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
88
+ // ----------------------------- Warning --------------------------------
89
+ // | These PropTypes are generated from the TypeScript type definitions |
90
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
91
+ // ----------------------------------------------------------------------
92
+ /**
93
+ * Override or extend the styles applied to the component.
94
+ */
95
+ classes: _propTypes.default.object,
96
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
97
+ } : void 0;