@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,298 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
+ const _excluded = ["trigger", "classes", "children"];
6
+ import * as React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import useLazyRef from '@mui/utils/useLazyRef';
9
+ import { styled, useThemeProps } from '@mui/material/styles';
10
+ import Popper from '@mui/material/Popper';
11
+ import NoSsr from '@mui/material/NoSsr';
12
+ import { useSvgRef } from "../hooks/useSvgRef.js";
13
+ import { usePointerType } from "./utils.js";
14
+ import { useSelector } from "../internals/useSelector.js";
15
+ import { useStore } from "../internals/useStore.js";
16
+ import { useXAxis } from "../hooks/index.js";
17
+ import { selectorChartsInteractionItemIsDefined, selectorChartsInteractionXAxisIsDefined, selectorChartsInteractionYAxisIsDefined } from "../context/InteractionSelectors.js";
18
+ import { jsx as _jsx } from "react/jsx-runtime";
19
+ const ChartsTooltipRoot = styled(Popper, {
20
+ name: 'MuiChartsTooltip',
21
+ slot: 'Root',
22
+ overridesResolver: (_, styles) => styles.root
23
+ })(({
24
+ theme
25
+ }) => ({
26
+ pointerEvents: 'none',
27
+ zIndex: theme.zIndex.modal
28
+ }));
29
+
30
+ /**
31
+ * Demos:
32
+ *
33
+ * - [ChartsTooltip](https://mui.com/x/react-charts/tooltip/)
34
+ *
35
+ * API:
36
+ *
37
+ * - [ChartsTooltip API](https://mui.com/x/api/charts/charts-tool-tip/)
38
+ */
39
+ function ChartsTooltipContainer(inProps) {
40
+ const props = useThemeProps({
41
+ props: inProps,
42
+ name: 'MuiChartsTooltipContainer'
43
+ });
44
+ const {
45
+ trigger = 'axis',
46
+ classes,
47
+ children
48
+ } = props,
49
+ other = _objectWithoutPropertiesLoose(props, _excluded);
50
+ const svgRef = useSvgRef();
51
+ const pointerType = usePointerType();
52
+ const xAxis = useXAxis();
53
+ const xAxisHasData = xAxis.data !== undefined && xAxis.data.length !== 0;
54
+ const popperRef = React.useRef(null);
55
+ const positionRef = useLazyRef(() => ({
56
+ x: 0,
57
+ y: 0
58
+ }));
59
+ const store = useStore();
60
+ const isOpen = useSelector(store,
61
+ // eslint-disable-next-line no-nested-ternary
62
+ trigger === 'axis' ? xAxisHasData ? selectorChartsInteractionXAxisIsDefined : selectorChartsInteractionYAxisIsDefined : selectorChartsInteractionItemIsDefined);
63
+ const popperOpen = pointerType !== null && isOpen; // tooltipHasData;
64
+
65
+ React.useEffect(() => {
66
+ const element = svgRef.current;
67
+ if (element === null) {
68
+ return () => {};
69
+ }
70
+ const handleMove = event => {
71
+ // eslint-disable-next-line react-compiler/react-compiler
72
+ positionRef.current = {
73
+ x: event.clientX,
74
+ y: event.clientY
75
+ };
76
+ popperRef.current?.update();
77
+ };
78
+ element.addEventListener('pointermove', handleMove);
79
+ return () => {
80
+ element.removeEventListener('pointermove', handleMove);
81
+ };
82
+ }, [svgRef, positionRef]);
83
+ if (trigger === 'none') {
84
+ return null;
85
+ }
86
+ return /*#__PURE__*/_jsx(NoSsr, {
87
+ children: popperOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({
88
+ className: classes?.root,
89
+ open: popperOpen,
90
+ placement: pointerType?.pointerType === 'mouse' ? 'right-start' : 'top',
91
+ popperRef: popperRef,
92
+ anchorEl: {
93
+ getBoundingClientRect: () => ({
94
+ x: positionRef.current.x,
95
+ y: positionRef.current.y,
96
+ top: positionRef.current.y,
97
+ left: positionRef.current.x,
98
+ right: positionRef.current.x,
99
+ bottom: positionRef.current.y,
100
+ width: 0,
101
+ height: 0,
102
+ toJSON: () => ''
103
+ })
104
+ },
105
+ modifiers: [{
106
+ name: 'offset',
107
+ options: {
108
+ offset: [0, pointerType?.pointerType === 'touch' ? 40 - pointerType.height : 0]
109
+ }
110
+ }]
111
+ }, other, {
112
+ children: children
113
+ }))
114
+ });
115
+ }
116
+ process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
117
+ // ----------------------------- Warning --------------------------------
118
+ // | These PropTypes are generated from the TypeScript type definitions |
119
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
120
+ // ----------------------------------------------------------------------
121
+ /**
122
+ * An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
123
+ * or a function that returns either.
124
+ * It's used to set the position of the popper.
125
+ * The return value will passed as the reference object of the Popper instance.
126
+ */
127
+ anchorEl: PropTypes.oneOfType([(props, propName) => {
128
+ if (props[propName] == null) {
129
+ return new Error(`Prop '${propName}' is required but wasn't specified`);
130
+ }
131
+ if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
132
+ return new Error(`Expected prop '${propName}' to be of type Element`);
133
+ }
134
+ return null;
135
+ }, PropTypes.func, PropTypes.shape({
136
+ contextElement: (props, propName) => {
137
+ if (props[propName] == null) {
138
+ return null;
139
+ }
140
+ if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
141
+ return new Error(`Expected prop '${propName}' to be of type Element`);
142
+ }
143
+ return null;
144
+ },
145
+ getBoundingClientRect: PropTypes.func.isRequired
146
+ })]),
147
+ /**
148
+ * Popper render function or node.
149
+ */
150
+ children: PropTypes.node,
151
+ /**
152
+ * Override or extend the styles applied to the component.
153
+ */
154
+ classes: PropTypes.object,
155
+ /**
156
+ * The component used for the root node.
157
+ * Either a string to use a HTML element or a component.
158
+ */
159
+ component: PropTypes.elementType,
160
+ /**
161
+ * The components used for each slot inside the Popper.
162
+ * Either a string to use a HTML element or a component.
163
+ * @default {}
164
+ */
165
+ components: PropTypes.shape({
166
+ Root: PropTypes.elementType
167
+ }),
168
+ /**
169
+ * The props used for each slot inside the Popper.
170
+ * @default {}
171
+ */
172
+ componentsProps: PropTypes.shape({
173
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
174
+ }),
175
+ /**
176
+ * An HTML element or function that returns one.
177
+ * The `container` will have the portal children appended to it.
178
+ *
179
+ * You can also provide a callback, which is called in a React layout effect.
180
+ * This lets you set the container from a ref, and also makes server-side rendering possible.
181
+ *
182
+ * By default, it uses the body of the top-level document object,
183
+ * so it's simply `document.body` most of the time.
184
+ */
185
+ container: PropTypes.oneOfType([(props, propName) => {
186
+ if (props[propName] == null) {
187
+ return new Error(`Prop '${propName}' is required but wasn't specified`);
188
+ }
189
+ if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
190
+ return new Error(`Expected prop '${propName}' to be of type Element`);
191
+ }
192
+ return null;
193
+ }, PropTypes.func]),
194
+ /**
195
+ * The `children` will be under the DOM hierarchy of the parent component.
196
+ * @default false
197
+ */
198
+ disablePortal: PropTypes.bool,
199
+ /**
200
+ * Always keep the children in the DOM.
201
+ * This prop can be useful in SEO situation or
202
+ * when you want to maximize the responsiveness of the Popper.
203
+ * @default false
204
+ */
205
+ keepMounted: PropTypes.bool,
206
+ /**
207
+ * Popper.js is based on a "plugin-like" architecture,
208
+ * most of its features are fully encapsulated "modifiers".
209
+ *
210
+ * A modifier is a function that is called each time Popper.js needs to
211
+ * compute the position of the popper.
212
+ * For this reason, modifiers should be very performant to avoid bottlenecks.
213
+ * To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
214
+ */
215
+ modifiers: PropTypes.arrayOf(PropTypes.shape({
216
+ data: PropTypes.object,
217
+ effect: PropTypes.func,
218
+ enabled: PropTypes.bool,
219
+ fn: PropTypes.func,
220
+ name: PropTypes.any,
221
+ options: PropTypes.object,
222
+ phase: PropTypes.oneOf(['afterMain', 'afterRead', 'afterWrite', 'beforeMain', 'beforeRead', 'beforeWrite', 'main', 'read', 'write']),
223
+ requires: PropTypes.arrayOf(PropTypes.string),
224
+ requiresIfExists: PropTypes.arrayOf(PropTypes.string)
225
+ })),
226
+ /**
227
+ * If `true`, the component is shown.
228
+ */
229
+ open: PropTypes.bool,
230
+ /**
231
+ * Popper placement.
232
+ * @default 'bottom'
233
+ */
234
+ placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
235
+ /**
236
+ * Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
237
+ * @default {}
238
+ */
239
+ popperOptions: PropTypes.shape({
240
+ modifiers: PropTypes.array,
241
+ onFirstUpdate: PropTypes.func,
242
+ placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
243
+ strategy: PropTypes.oneOf(['absolute', 'fixed'])
244
+ }),
245
+ /**
246
+ * A ref that points to the used popper instance.
247
+ */
248
+ popperRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
249
+ current: PropTypes.shape({
250
+ destroy: PropTypes.func.isRequired,
251
+ forceUpdate: PropTypes.func.isRequired,
252
+ setOptions: PropTypes.func.isRequired,
253
+ state: PropTypes.shape({
254
+ attributes: PropTypes.object.isRequired,
255
+ elements: PropTypes.object.isRequired,
256
+ modifiersData: PropTypes.object.isRequired,
257
+ options: PropTypes.object.isRequired,
258
+ orderedModifiers: PropTypes.arrayOf(PropTypes.object).isRequired,
259
+ placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']).isRequired,
260
+ rects: PropTypes.object.isRequired,
261
+ reset: PropTypes.bool.isRequired,
262
+ scrollParents: PropTypes.object.isRequired,
263
+ strategy: PropTypes.oneOf(['absolute', 'fixed']).isRequired,
264
+ styles: PropTypes.object.isRequired
265
+ }).isRequired,
266
+ update: PropTypes.func.isRequired
267
+ })
268
+ })]),
269
+ /**
270
+ * The props used for each slot inside the Popper.
271
+ * @default {}
272
+ */
273
+ slotProps: PropTypes.object,
274
+ /**
275
+ * The components used for each slot inside the Popper.
276
+ * Either a string to use a HTML element or a component.
277
+ * @default {}
278
+ */
279
+ slots: PropTypes.object,
280
+ /**
281
+ * The system prop that allows defining system overrides as well as additional CSS styles.
282
+ */
283
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
284
+ /**
285
+ * Help supporting a react-transition-group/Transition component.
286
+ * @default false
287
+ */
288
+ transition: PropTypes.bool,
289
+ /**
290
+ * Select the kind of tooltip to display
291
+ * - 'item': Shows data about the item below the mouse.
292
+ * - 'axis': Shows values associated with the hovered x value
293
+ * - 'none': Does not display tooltip
294
+ * @default 'axis'
295
+ */
296
+ trigger: PropTypes.oneOf(['axis', 'item', 'none'])
297
+ } : void 0;
298
+ export { ChartsTooltipContainer };
@@ -21,3 +21,4 @@ export interface ChartsTooltipClasses {
21
21
  export type ChartsTooltipClassKey = keyof Omit<ChartsTooltipClasses, 'markCell' | 'labelCell' | 'valueCell'>;
22
22
  export declare function getChartsTooltipUtilityClass(slot: string): string;
23
23
  export declare const chartsTooltipClasses: ChartsTooltipClasses;
24
+ export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"cell" | "table" | "row" | "mark" | "root" | "paper" | "markCell" | "labelCell" | "valueCell", string>;
@@ -1,5 +1,21 @@
1
- import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
+ import composeClasses from '@mui/utils/composeClasses';
2
4
  export function getChartsTooltipUtilityClass(slot) {
3
5
  return generateUtilityClass('MuiChartsTooltip', slot);
4
6
  }
5
- export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'paper', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
7
+ export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'paper', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
8
+ export const useUtilityClasses = classes => {
9
+ const slots = {
10
+ root: ['root'],
11
+ paper: ['paper'],
12
+ table: ['table'],
13
+ row: ['row'],
14
+ cell: ['cell'],
15
+ mark: ['mark'],
16
+ markCell: ['markCell'],
17
+ labelCell: ['labelCell'],
18
+ valueCell: ['valueCell']
19
+ };
20
+ return composeClasses(slots, getChartsTooltipUtilityClass, classes);
21
+ };
@@ -1,9 +1,9 @@
1
1
  export * from './ChartsTooltip';
2
- export * from './chartsTooltipClasses';
2
+ export * from './ChartsTooltipContainer';
3
+ export type { ChartsTooltipClasses, ChartsTooltipClassKey } from './chartsTooltipClasses';
4
+ export { getChartsTooltipUtilityClass, chartsTooltipClasses } from './chartsTooltipClasses';
3
5
  export * from './ChartsAxisTooltipContent';
4
6
  export * from './ChartsItemTooltipContent';
5
- export * from './DefaultChartsAxisTooltipContent';
6
- export * from './DefaultChartsItemTooltipContent';
7
7
  export * from './ChartsTooltipTable';
8
8
  export * from './useItemTooltip';
9
9
  export * from './useAxisTooltip';
@@ -1,9 +1,8 @@
1
1
  export * from "./ChartsTooltip.js";
2
- export * from "./chartsTooltipClasses.js";
2
+ export * from "./ChartsTooltipContainer.js";
3
+ export { getChartsTooltipUtilityClass, chartsTooltipClasses } from "./chartsTooltipClasses.js";
3
4
  export * from "./ChartsAxisTooltipContent.js";
4
5
  export * from "./ChartsItemTooltipContent.js";
5
- export * from "./DefaultChartsAxisTooltipContent.js";
6
- export * from "./DefaultChartsItemTooltipContent.js";
7
6
  export * from "./ChartsTooltipTable.js";
8
7
  export * from "./useItemTooltip.js";
9
8
  export * from "./useAxisTooltip.js";
@@ -1,8 +1,8 @@
1
- import { AxisInteractionData } from '../context/InteractionProvider';
2
1
  import { SeriesId } from '../models/seriesType/common';
3
2
  import { CartesianChartSeriesType, ChartsSeriesConfig } from '../models/seriesType/config';
4
3
  export interface UseAxisTooltipReturnValue<SeriesT extends CartesianChartSeriesType = CartesianChartSeriesType, AxisValueT extends string | number | Date = string | number | Date> {
5
- identifier: AxisInteractionData;
4
+ axisDirection: 'x' | 'y';
5
+ dataIndex: number;
6
6
  seriesItems: SeriesItem<SeriesT>[];
7
7
  axisValue: AxisValueT;
8
8
  axisFormattedValue: string;
@@ -1,34 +1,33 @@
1
1
  'use client';
2
2
 
3
3
  import * as React from 'react';
4
- import { InteractionContext } from "../context/InteractionProvider.js";
5
4
  import { useSeries } from "../hooks/useSeries.js";
6
5
  import { useCartesianContext } from "../context/CartesianProvider/index.js";
7
6
  import { ZAxisContext } from "../context/ZAxisContextProvider.js";
8
7
  import { useColorProcessor } from "../context/PluginProvider/useColorProcessor.js";
8
+ import { useStore } from "../internals/useStore.js";
9
+ import { useSelector } from "../internals/useSelector.js";
9
10
  import { getLabel } from "../internals/getLabel.js";
10
11
  import { isCartesianSeriesType } from "../internals/isCartesian.js";
11
12
  import { utcFormatter } from "./utils.js";
13
+ import { useXAxis, useYAxis } from "../hooks/useAxis.js";
14
+ import { selectorChartsInteractionXAxis, selectorChartsInteractionYAxis } from "../context/InteractionSelectors.js";
12
15
  export function useAxisTooltip() {
13
- const {
14
- axis
15
- } = React.useContext(InteractionContext);
16
+ const defaultXAxis = useXAxis();
17
+ const defaultYAxis = useYAxis();
18
+ const xAxisHasData = defaultXAxis.data !== undefined && defaultXAxis.data.length !== 0;
19
+ const store = useStore();
20
+ const axisData = useSelector(store, xAxisHasData ? selectorChartsInteractionXAxis : selectorChartsInteractionYAxis);
16
21
  const series = useSeries();
17
22
  const {
18
23
  xAxis,
19
- yAxis,
20
- xAxisIds,
21
- yAxisIds
24
+ yAxis
22
25
  } = useCartesianContext();
23
26
  const {
24
27
  zAxis,
25
28
  zAxisIds
26
29
  } = React.useContext(ZAxisContext);
27
30
  const colorProcessors = useColorProcessor();
28
-
29
- // By default use the x-axis
30
- const isXaxis = axis.x !== null && axis.x.index !== -1;
31
- const axisData = isXaxis ? axis.x && axis.x : axis.y && axis.y;
32
31
  if (axisData === null) {
33
32
  return null;
34
33
  }
@@ -36,8 +35,8 @@ export function useAxisTooltip() {
36
35
  index: dataIndex,
37
36
  value: axisValue
38
37
  } = axisData;
39
- const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
40
- const usedAxis = isXaxis ? xAxis[USED_AXIS_ID] : yAxis[USED_AXIS_ID];
38
+ const USED_AXIS_ID = xAxisHasData ? defaultXAxis.id : defaultYAxis.id;
39
+ const usedAxis = xAxisHasData ? defaultXAxis : defaultYAxis;
41
40
  const relevantSeries = Object.keys(series).filter(isCartesianSeriesType).flatMap(seriesType => {
42
41
  const seriesOfType = series[seriesType];
43
42
  if (!seriesOfType) {
@@ -47,14 +46,14 @@ export function useAxisTooltip() {
47
46
  const seriesToAdd = seriesOfType.series[seriesId];
48
47
  const providedXAxisId = seriesToAdd.xAxisId;
49
48
  const providedYAxisId = seriesToAdd.yAxisId;
50
- const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
49
+ const axisKey = xAxisHasData ? providedXAxisId : providedYAxisId;
51
50
 
52
51
  // Test if the series uses the default axis
53
52
  if (axisKey === undefined || axisKey === USED_AXIS_ID) {
54
- const xAxisId = providedXAxisId ?? xAxisIds[0];
55
- const yAxisId = providedYAxisId ?? yAxisIds[0];
56
- const zAxisId = seriesToAdd.zAxisId ?? zAxisIds[0];
57
- const color = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId && zAxis[zAxisId])(dataIndex) ?? '';
53
+ const xAxisId = providedXAxisId ?? defaultXAxis.id;
54
+ const yAxisId = providedYAxisId ?? defaultYAxis.id;
55
+ const zAxisId = 'zAxisId' in seriesToAdd ? seriesToAdd.zAxisId : zAxisIds[0];
56
+ const color = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId ? zAxis[zAxisId] : undefined)(dataIndex) ?? '';
58
57
  const value = seriesToAdd.data[dataIndex] ?? null;
59
58
  const formattedValue = seriesToAdd.valueFormatter(value, {
60
59
  dataIndex
@@ -76,7 +75,8 @@ export function useAxisTooltip() {
76
75
  location: 'tooltip'
77
76
  });
78
77
  return {
79
- identifier: axis,
78
+ axisDirection: xAxisHasData ? 'x' : 'y',
79
+ dataIndex,
80
80
  seriesItems: relevantSeries,
81
81
  axisValue,
82
82
  axisFormattedValue
@@ -1,5 +1,5 @@
1
- import { ItemInteractionData } from '../context/InteractionProvider';
2
1
  import { ChartSeriesType, ChartsSeriesConfig } from '../models/seriesType/config';
2
+ import { ItemInteractionData } from '../internals/plugins/models';
3
3
  export interface UseItemTooltipReturnValue<T extends ChartSeriesType> {
4
4
  identifier: ItemInteractionData<T>;
5
5
  color: string;
@@ -2,16 +2,17 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
- import { InteractionContext } from "../context/InteractionProvider.js";
6
5
  import { useSeries } from "../hooks/useSeries.js";
7
6
  import { useCartesianContext } from "../context/CartesianProvider/index.js";
8
7
  import { ZAxisContext } from "../context/ZAxisContextProvider.js";
9
8
  import { useColorProcessor } from "../context/PluginProvider/useColorProcessor.js";
10
9
  import { getLabel } from "../internals/getLabel.js";
10
+ import { selectorChartsInteractionItem } from "../context/InteractionSelectors.js";
11
+ import { useSelector } from "../internals/useSelector.js";
12
+ import { useStore } from "../internals/useStore.js";
11
13
  export function useItemTooltip() {
12
- const {
13
- item
14
- } = React.useContext(InteractionContext);
14
+ const store = useStore();
15
+ const item = useSelector(store, selectorChartsInteractionItem);
15
16
  const series = useSeries();
16
17
  const {
17
18
  xAxis,
@@ -1,5 +1,3 @@
1
- import { AxisInteractionData, ItemInteractionData } from '../context/InteractionProvider';
2
- import { ChartSeriesType } from '../models/seriesType/config';
3
1
  type MousePosition = {
4
2
  x: number;
5
3
  y: number;
@@ -14,6 +12,5 @@ export declare function useMouseTracker(): UseMouseTrackerReturnValue;
14
12
  type PointerType = Pick<MousePosition, 'height' | 'pointerType'>;
15
13
  export declare function usePointerType(): null | PointerType;
16
14
  export type TriggerOptions = 'item' | 'axis' | 'none';
17
- export declare function getTooltipHasData(trigger: TriggerOptions, displayedData: null | AxisInteractionData | ItemInteractionData<ChartSeriesType>): boolean;
18
15
  export declare function utcFormatter(v: string | number | Date): string;
19
16
  export {};
@@ -74,14 +74,6 @@ export function usePointerType() {
74
74
  }, [svgRef]);
75
75
  return pointerType;
76
76
  }
77
- export function getTooltipHasData(trigger, displayedData) {
78
- if (trigger === 'item') {
79
- return displayedData !== null;
80
- }
81
- const hasAxisXData = displayedData.x !== null;
82
- const hasAxisYData = displayedData.y !== null;
83
- return hasAxisXData || hasAxisYData;
84
- }
85
77
  export function utcFormatter(v) {
86
78
  if (v instanceof Date) {
87
79
  return v.toUTCString();
@@ -1,12 +1,13 @@
1
1
  'use client';
2
2
 
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
4
  import * as React from 'react';
4
5
  import PropTypes from 'prop-types';
5
6
  import { Delaunay } from '@mui/x-charts-vendor/d3-delaunay';
6
7
  import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
7
- import { InteractionContext } from "../context/InteractionProvider.js";
8
8
  import { useCartesianContext } from "../context/CartesianProvider/index.js";
9
9
  import { getValueToPositionMapper } from "../hooks/useScale.js";
10
+ import { useStore } from "../internals/useStore.js";
10
11
  import { getSVGPoint } from "../internals/getSVGPoint.js";
11
12
  import { useDrawingArea, useSvgRef } from "../hooks/index.js";
12
13
  import { useHighlighted } from "../context/index.js";
@@ -25,9 +26,7 @@ function ChartsVoronoiHandler(props) {
25
26
  xAxisIds,
26
27
  yAxisIds
27
28
  } = useCartesianContext();
28
- const {
29
- dispatch
30
- } = React.useContext(InteractionContext);
29
+ const store = useStore();
31
30
  const {
32
31
  series,
33
32
  seriesOrder
@@ -42,17 +41,19 @@ function ChartsVoronoiHandler(props) {
42
41
  const defaultXAxisId = xAxisIds[0];
43
42
  const defaultYAxisId = yAxisIds[0];
44
43
  useEnhancedEffect(() => {
45
- dispatch({
46
- type: 'updateVoronoiUsage',
47
- useVoronoiInteraction: true
48
- });
44
+ store.update(prev => _extends({}, prev, {
45
+ interaction: _extends({}, prev.interaction, {
46
+ useVoronoiInteraction: true
47
+ })
48
+ }));
49
49
  return () => {
50
- dispatch({
51
- type: 'updateVoronoiUsage',
52
- useVoronoiInteraction: false
53
- });
50
+ store.update(prev => _extends({}, prev, {
51
+ interaction: _extends({}, prev.interaction, {
52
+ useVoronoiInteraction: false
53
+ })
54
+ }));
54
55
  };
55
- }, [dispatch]);
56
+ }, [store]);
56
57
  useEnhancedEffect(() => {
57
58
  // This effect generate and store the Delaunay object that's used to map coordinate to closest point.
58
59
 
@@ -141,27 +142,38 @@ function ChartsVoronoiHandler(props) {
141
142
  };
142
143
  }
143
144
  const handleMouseLeave = () => {
144
- dispatch({
145
- type: 'exitChart'
146
- });
145
+ store.update(prev => _extends({}, prev, {
146
+ interaction: _extends({}, prev.interaction, {
147
+ axis: {
148
+ x: null,
149
+ y: null
150
+ },
151
+ item: null
152
+ })
153
+ }));
147
154
  clearHighlighted();
148
155
  };
149
156
  const handleMouseMove = event => {
150
157
  const closestPoint = getClosestPoint(event);
151
158
  if (closestPoint === 'outside-chart') {
152
- dispatch({
153
- type: 'exitChart'
154
- });
159
+ store.update(prev => _extends({}, prev, {
160
+ interaction: _extends({}, prev.interaction, {
161
+ axis: {
162
+ x: null,
163
+ y: null
164
+ },
165
+ item: null
166
+ })
167
+ }));
155
168
  clearHighlighted();
156
169
  return;
157
170
  }
158
171
  if (closestPoint === 'outside-voronoi-max-radius' || closestPoint === 'no-point-found') {
159
- dispatch({
160
- type: 'leaveItem',
161
- data: {
162
- type: 'scatter'
163
- }
164
- });
172
+ store.update(prev => _extends({}, prev, {
173
+ interaction: _extends({}, prev.interaction, {
174
+ item: null
175
+ })
176
+ }));
165
177
  clearHighlighted();
166
178
  return;
167
179
  }
@@ -169,14 +181,15 @@ function ChartsVoronoiHandler(props) {
169
181
  seriesId,
170
182
  dataIndex
171
183
  } = closestPoint;
172
- dispatch({
173
- type: 'enterItem',
174
- data: {
175
- type: 'scatter',
176
- seriesId,
177
- dataIndex
178
- }
179
- });
184
+ store.update(prev => _extends({}, prev, {
185
+ interaction: _extends({}, prev.interaction, {
186
+ item: {
187
+ type: 'scatter',
188
+ seriesId,
189
+ dataIndex
190
+ }
191
+ })
192
+ }));
180
193
  setHighlighted({
181
194
  seriesId,
182
195
  dataIndex
@@ -209,7 +222,7 @@ function ChartsVoronoiHandler(props) {
209
222
  element.removeEventListener('pointermove', handleMouseMove);
210
223
  element.removeEventListener('click', handleMouseClick);
211
224
  };
212
- }, [svgRef, dispatch, yAxis, xAxis, voronoiMaxRadius, onItemClick, setHighlighted, clearHighlighted, drawingArea]);
225
+ }, [svgRef, yAxis, xAxis, voronoiMaxRadius, onItemClick, setHighlighted, clearHighlighted, drawingArea, store]);
213
226
 
214
227
  // eslint-disable-next-line react/jsx-no-useless-fragment
215
228
  return /*#__PURE__*/_jsx(React.Fragment, {});
package/Gauge/Gauge.d.ts CHANGED
@@ -6,5 +6,5 @@ export interface GaugeProps extends GaugeContainerProps, Pick<GaugeValueTextProp
6
6
  classes?: Partial<GaugeClasses>;
7
7
  children?: React.ReactNode;
8
8
  }
9
- declare const Gauge: React.ForwardRefExoticComponent<GaugeProps & React.RefAttributes<unknown>>;
9
+ declare const Gauge: React.ForwardRefExoticComponent<GaugeProps & React.RefAttributes<SVGSVGElement>>;
10
10
  export { Gauge };