@mui/x-charts 8.0.0-beta.2 → 8.0.0-beta.3

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 (345) hide show
  1. package/BarChart/AnimatedBarElement.d.ts +38 -8
  2. package/BarChart/AnimatedBarElement.js +5 -5
  3. package/BarChart/BarChart.js +2 -0
  4. package/BarChart/BarClipPath.d.ts +19 -1
  5. package/BarChart/BarClipPath.js +84 -17
  6. package/BarChart/BarElement.d.ts +9 -20
  7. package/BarChart/BarElement.js +29 -26
  8. package/BarChart/BarLabel/BarLabel.d.ts +27 -854
  9. package/BarChart/BarLabel/BarLabel.js +32 -5
  10. package/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
  11. package/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
  12. package/BarChart/BarLabel/BarLabelItem.js +18 -6
  13. package/BarChart/BarLabel/BarLabelPlot.js +16 -46
  14. package/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
  15. package/BarChart/BarLabel/barLabelClasses.js +4 -3
  16. package/BarChart/BarPlot.js +37 -61
  17. package/BarChart/barElementClasses.d.ts +21 -0
  18. package/BarChart/barElementClasses.js +29 -0
  19. package/BarChart/getRadius.d.ts +1 -1
  20. package/BarChart/index.d.ts +2 -1
  21. package/BarChart/index.js +11 -0
  22. package/BarChart/seriesConfig/index.js +3 -1
  23. package/BarChart/seriesConfig/tooltip.d.ts +2 -1
  24. package/BarChart/seriesConfig/tooltip.js +14 -1
  25. package/BarChart/types.d.ts +2 -2
  26. package/CHANGELOG.md +141 -0
  27. package/ChartContainer/ChartContainer.js +4 -0
  28. package/ChartsLabel/ChartsLabelMark.js +0 -4
  29. package/ChartsLabel/index.d.ts +1 -0
  30. package/ChartsLabel/index.js +7 -0
  31. package/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
  32. package/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
  33. package/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
  34. package/ChartsTooltip/ChartsTooltip.js +2 -2
  35. package/ChartsTooltip/ChartsTooltipContainer.js +3 -8
  36. package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
  37. package/ChartsTooltip/ChartsTooltipTable.js +24 -9
  38. package/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
  39. package/ChartsTooltip/chartsTooltipClasses.js +2 -2
  40. package/ChartsTooltip/index.d.ts +1 -0
  41. package/ChartsTooltip/index.js +12 -0
  42. package/ChartsTooltip/useAxesTooltip.d.ts +7 -0
  43. package/ChartsTooltip/useAxesTooltip.js +18 -0
  44. package/ChartsTooltip/useAxisTooltip.d.ts +24 -3
  45. package/ChartsTooltip/useAxisTooltip.js +71 -37
  46. package/ChartsTooltip/useItemTooltip.js +4 -1
  47. package/ChartsXAxis/ChartsXAxis.js +5 -2
  48. package/ChartsYAxis/ChartsYAxis.js +69 -17
  49. package/LineChart/AnimatedArea.js +5 -22
  50. package/LineChart/AnimatedLine.d.ts +1 -4
  51. package/LineChart/AnimatedLine.js +10 -25
  52. package/LineChart/AppearingMask.d.ts +5 -0
  53. package/LineChart/AppearingMask.js +25 -18
  54. package/LineChart/CircleMarkElement.js +16 -22
  55. package/LineChart/LineChart.js +2 -0
  56. package/LineChart/LineHighlightPlot.js +2 -3
  57. package/LineChart/MarkElement.js +16 -27
  58. package/LineChart/MarkPlot.js +0 -1
  59. package/LineChart/markElementClasses.d.ts +3 -0
  60. package/LineChart/markElementClasses.js +4 -3
  61. package/LineChart/seriesConfig/index.js +3 -1
  62. package/LineChart/seriesConfig/tooltip.d.ts +2 -1
  63. package/LineChart/seriesConfig/tooltip.js +8 -1
  64. package/PieChart/PieArc.d.ts +19 -11
  65. package/PieChart/PieArc.js +37 -24
  66. package/PieChart/PieArcLabel.d.ts +22 -13
  67. package/PieChart/PieArcLabel.js +52 -48
  68. package/PieChart/PieArcLabelPlot.js +16 -34
  69. package/PieChart/PieArcPlot.js +21 -34
  70. package/PieChart/seriesConfig/tooltip.js +3 -0
  71. package/ScatterChart/ScatterChart.js +2 -0
  72. package/SparkLineChart/SparkLineChart.js +2 -0
  73. package/colorPalettes/colorPalettes.js +2 -2
  74. package/constants/index.d.ts +1 -1
  75. package/constants/index.js +1 -1
  76. package/context/AnimationProvider/AnimationProvider.js +4 -6
  77. package/esm/BarChart/AnimatedBarElement.d.ts +38 -8
  78. package/esm/BarChart/AnimatedBarElement.js +5 -5
  79. package/esm/BarChart/BarChart.js +2 -0
  80. package/esm/BarChart/BarClipPath.d.ts +19 -1
  81. package/esm/BarChart/BarClipPath.js +84 -17
  82. package/esm/BarChart/BarElement.d.ts +9 -20
  83. package/esm/BarChart/BarElement.js +28 -23
  84. package/esm/BarChart/BarLabel/BarLabel.d.ts +27 -854
  85. package/esm/BarChart/BarLabel/BarLabel.js +32 -5
  86. package/esm/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
  87. package/esm/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
  88. package/esm/BarChart/BarLabel/BarLabelItem.js +18 -6
  89. package/esm/BarChart/BarLabel/BarLabelPlot.js +16 -46
  90. package/esm/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
  91. package/esm/BarChart/BarLabel/barLabelClasses.js +4 -3
  92. package/esm/BarChart/BarPlot.js +37 -61
  93. package/esm/BarChart/barElementClasses.d.ts +21 -0
  94. package/esm/BarChart/barElementClasses.js +19 -0
  95. package/esm/BarChart/getRadius.d.ts +1 -1
  96. package/esm/BarChart/index.d.ts +2 -1
  97. package/esm/BarChart/index.js +2 -1
  98. package/esm/BarChart/seriesConfig/index.js +2 -1
  99. package/esm/BarChart/seriesConfig/tooltip.d.ts +2 -1
  100. package/esm/BarChart/seriesConfig/tooltip.js +12 -0
  101. package/esm/BarChart/types.d.ts +2 -2
  102. package/esm/ChartContainer/ChartContainer.js +4 -0
  103. package/esm/ChartsLabel/ChartsLabelMark.js +0 -4
  104. package/esm/ChartsLabel/index.d.ts +1 -0
  105. package/esm/ChartsLabel/index.js +1 -0
  106. package/esm/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
  107. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
  108. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
  109. package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
  110. package/esm/ChartsTooltip/ChartsTooltipContainer.js +4 -9
  111. package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
  112. package/esm/ChartsTooltip/ChartsTooltipTable.js +23 -9
  113. package/esm/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
  114. package/esm/ChartsTooltip/chartsTooltipClasses.js +2 -2
  115. package/esm/ChartsTooltip/index.d.ts +1 -0
  116. package/esm/ChartsTooltip/index.js +1 -0
  117. package/esm/ChartsTooltip/useAxesTooltip.d.ts +7 -0
  118. package/esm/ChartsTooltip/useAxesTooltip.js +12 -0
  119. package/esm/ChartsTooltip/useAxisTooltip.d.ts +24 -3
  120. package/esm/ChartsTooltip/useAxisTooltip.js +72 -38
  121. package/esm/ChartsTooltip/useItemTooltip.js +4 -1
  122. package/esm/ChartsXAxis/ChartsXAxis.js +5 -2
  123. package/esm/ChartsYAxis/ChartsYAxis.js +69 -17
  124. package/esm/LineChart/AnimatedArea.js +5 -22
  125. package/esm/LineChart/AnimatedLine.d.ts +1 -4
  126. package/esm/LineChart/AnimatedLine.js +9 -24
  127. package/esm/LineChart/AppearingMask.d.ts +5 -0
  128. package/esm/LineChart/AppearingMask.js +23 -18
  129. package/esm/LineChart/CircleMarkElement.js +19 -25
  130. package/esm/LineChart/LineChart.js +2 -0
  131. package/esm/LineChart/LineHighlightPlot.js +3 -4
  132. package/esm/LineChart/MarkElement.js +17 -28
  133. package/esm/LineChart/MarkPlot.js +0 -1
  134. package/esm/LineChart/markElementClasses.d.ts +3 -0
  135. package/esm/LineChart/markElementClasses.js +4 -3
  136. package/esm/LineChart/seriesConfig/index.js +2 -1
  137. package/esm/LineChart/seriesConfig/tooltip.d.ts +2 -1
  138. package/esm/LineChart/seriesConfig/tooltip.js +6 -0
  139. package/esm/PieChart/PieArc.d.ts +19 -11
  140. package/esm/PieChart/PieArc.js +36 -23
  141. package/esm/PieChart/PieArcLabel.d.ts +22 -13
  142. package/esm/PieChart/PieArcLabel.js +51 -47
  143. package/esm/PieChart/PieArcLabelPlot.js +16 -34
  144. package/esm/PieChart/PieArcPlot.js +21 -34
  145. package/esm/PieChart/seriesConfig/tooltip.js +3 -0
  146. package/esm/ScatterChart/ScatterChart.js +2 -0
  147. package/esm/SparkLineChart/SparkLineChart.js +2 -0
  148. package/esm/colorPalettes/colorPalettes.js +2 -2
  149. package/esm/constants/index.d.ts +1 -1
  150. package/esm/constants/index.js +1 -1
  151. package/esm/context/AnimationProvider/AnimationProvider.js +3 -6
  152. package/esm/hooks/animation/index.d.ts +6 -0
  153. package/esm/hooks/animation/index.js +6 -0
  154. package/esm/hooks/animation/useAnimateArea.d.ts +15 -0
  155. package/esm/hooks/animation/useAnimateArea.js +27 -0
  156. package/esm/hooks/animation/useAnimateBar.d.ts +17 -0
  157. package/esm/hooks/animation/useAnimateBar.js +56 -0
  158. package/esm/hooks/animation/useAnimateBarLabel.d.ts +19 -0
  159. package/esm/hooks/animation/useAnimateBarLabel.js +59 -0
  160. package/esm/hooks/animation/useAnimateLine.d.ts +14 -0
  161. package/esm/hooks/animation/useAnimateLine.js +26 -0
  162. package/esm/hooks/animation/useAnimatePieArc.d.ts +15 -0
  163. package/esm/hooks/animation/useAnimatePieArc.js +70 -0
  164. package/esm/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
  165. package/esm/hooks/animation/useAnimatePieArcLabel.js +72 -0
  166. package/esm/hooks/index.d.ts +2 -1
  167. package/esm/hooks/index.js +2 -1
  168. package/esm/hooks/useInteractionItemProps.js +11 -0
  169. package/esm/index.js +1 -1
  170. package/esm/internals/animation/Transition.d.ts +37 -0
  171. package/esm/internals/animation/Transition.js +83 -0
  172. package/esm/internals/animation/animation.d.ts +4 -0
  173. package/esm/internals/animation/animation.js +4 -0
  174. package/esm/internals/animation/useAnimate.d.ts +19 -0
  175. package/esm/internals/animation/useAnimate.js +74 -0
  176. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
  177. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
  178. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
  179. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +21 -0
  180. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
  181. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
  182. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +60 -26
  183. package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
  184. package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
  185. package/esm/internals/shallowEqual.d.ts +8 -0
  186. package/esm/internals/shallowEqual.js +31 -0
  187. package/esm/models/axis.d.ts +8 -0
  188. package/esm/themeAugmentation/overrides.d.ts +1 -1
  189. package/hooks/animation/index.d.ts +6 -0
  190. package/hooks/animation/index.js +71 -0
  191. package/hooks/animation/useAnimateArea.d.ts +15 -0
  192. package/hooks/animation/useAnimateArea.js +34 -0
  193. package/hooks/animation/useAnimateBar.d.ts +17 -0
  194. package/hooks/animation/useAnimateBar.js +62 -0
  195. package/hooks/animation/useAnimateBarLabel.d.ts +19 -0
  196. package/hooks/animation/useAnimateBarLabel.js +65 -0
  197. package/hooks/animation/useAnimateLine.d.ts +14 -0
  198. package/hooks/animation/useAnimateLine.js +33 -0
  199. package/hooks/animation/useAnimatePieArc.d.ts +15 -0
  200. package/hooks/animation/useAnimatePieArc.js +77 -0
  201. package/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
  202. package/hooks/animation/useAnimatePieArcLabel.js +79 -0
  203. package/hooks/index.d.ts +2 -1
  204. package/hooks/index.js +13 -1
  205. package/hooks/useInteractionItemProps.js +11 -0
  206. package/index.js +1 -1
  207. package/internals/animation/Transition.d.ts +37 -0
  208. package/internals/animation/Transition.js +89 -0
  209. package/internals/animation/animation.d.ts +4 -0
  210. package/internals/animation/animation.js +11 -0
  211. package/internals/animation/useAnimate.d.ts +19 -0
  212. package/internals/animation/useAnimate.js +80 -0
  213. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
  214. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
  215. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
  216. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +28 -0
  217. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
  218. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
  219. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +61 -27
  220. package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
  221. package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
  222. package/internals/shallowEqual.d.ts +8 -0
  223. package/internals/shallowEqual.js +37 -0
  224. package/models/axis.d.ts +8 -0
  225. package/modern/BarChart/AnimatedBarElement.d.ts +38 -8
  226. package/modern/BarChart/AnimatedBarElement.js +5 -5
  227. package/modern/BarChart/BarChart.js +2 -0
  228. package/modern/BarChart/BarClipPath.d.ts +19 -1
  229. package/modern/BarChart/BarClipPath.js +84 -17
  230. package/modern/BarChart/BarElement.d.ts +9 -20
  231. package/modern/BarChart/BarElement.js +28 -23
  232. package/modern/BarChart/BarLabel/BarLabel.d.ts +27 -854
  233. package/modern/BarChart/BarLabel/BarLabel.js +32 -5
  234. package/modern/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
  235. package/modern/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
  236. package/modern/BarChart/BarLabel/BarLabelItem.js +18 -6
  237. package/modern/BarChart/BarLabel/BarLabelPlot.js +16 -46
  238. package/modern/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
  239. package/modern/BarChart/BarLabel/barLabelClasses.js +4 -3
  240. package/modern/BarChart/BarPlot.js +37 -61
  241. package/modern/BarChart/barElementClasses.d.ts +21 -0
  242. package/modern/BarChart/barElementClasses.js +19 -0
  243. package/modern/BarChart/getRadius.d.ts +1 -1
  244. package/modern/BarChart/index.d.ts +2 -1
  245. package/modern/BarChart/index.js +2 -1
  246. package/modern/BarChart/seriesConfig/index.js +2 -1
  247. package/modern/BarChart/seriesConfig/tooltip.d.ts +2 -1
  248. package/modern/BarChart/seriesConfig/tooltip.js +12 -0
  249. package/modern/BarChart/types.d.ts +2 -2
  250. package/modern/ChartContainer/ChartContainer.js +4 -0
  251. package/modern/ChartsLabel/ChartsLabelMark.js +0 -4
  252. package/modern/ChartsLabel/index.d.ts +1 -0
  253. package/modern/ChartsLabel/index.js +1 -0
  254. package/modern/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
  255. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
  256. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
  257. package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
  258. package/modern/ChartsTooltip/ChartsTooltipContainer.js +4 -9
  259. package/modern/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
  260. package/modern/ChartsTooltip/ChartsTooltipTable.js +23 -9
  261. package/modern/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
  262. package/modern/ChartsTooltip/chartsTooltipClasses.js +2 -2
  263. package/modern/ChartsTooltip/index.d.ts +1 -0
  264. package/modern/ChartsTooltip/index.js +1 -0
  265. package/modern/ChartsTooltip/useAxesTooltip.d.ts +7 -0
  266. package/modern/ChartsTooltip/useAxesTooltip.js +12 -0
  267. package/modern/ChartsTooltip/useAxisTooltip.d.ts +24 -3
  268. package/modern/ChartsTooltip/useAxisTooltip.js +72 -38
  269. package/modern/ChartsTooltip/useItemTooltip.js +4 -1
  270. package/modern/ChartsXAxis/ChartsXAxis.js +5 -2
  271. package/modern/ChartsYAxis/ChartsYAxis.js +69 -17
  272. package/modern/LineChart/AnimatedArea.js +5 -22
  273. package/modern/LineChart/AnimatedLine.d.ts +1 -4
  274. package/modern/LineChart/AnimatedLine.js +9 -24
  275. package/modern/LineChart/AppearingMask.d.ts +5 -0
  276. package/modern/LineChart/AppearingMask.js +23 -18
  277. package/modern/LineChart/CircleMarkElement.js +19 -25
  278. package/modern/LineChart/LineChart.js +2 -0
  279. package/modern/LineChart/LineHighlightPlot.js +3 -4
  280. package/modern/LineChart/MarkElement.js +17 -28
  281. package/modern/LineChart/MarkPlot.js +0 -1
  282. package/modern/LineChart/markElementClasses.d.ts +3 -0
  283. package/modern/LineChart/markElementClasses.js +4 -3
  284. package/modern/LineChart/seriesConfig/index.js +2 -1
  285. package/modern/LineChart/seriesConfig/tooltip.d.ts +2 -1
  286. package/modern/LineChart/seriesConfig/tooltip.js +6 -0
  287. package/modern/PieChart/PieArc.d.ts +19 -11
  288. package/modern/PieChart/PieArc.js +36 -23
  289. package/modern/PieChart/PieArcLabel.d.ts +22 -13
  290. package/modern/PieChart/PieArcLabel.js +51 -47
  291. package/modern/PieChart/PieArcLabelPlot.js +16 -34
  292. package/modern/PieChart/PieArcPlot.js +21 -34
  293. package/modern/PieChart/seriesConfig/tooltip.js +3 -0
  294. package/modern/ScatterChart/ScatterChart.js +2 -0
  295. package/modern/SparkLineChart/SparkLineChart.js +2 -0
  296. package/modern/colorPalettes/colorPalettes.js +2 -2
  297. package/modern/constants/index.d.ts +1 -1
  298. package/modern/constants/index.js +1 -1
  299. package/modern/context/AnimationProvider/AnimationProvider.js +3 -6
  300. package/modern/hooks/animation/index.d.ts +6 -0
  301. package/modern/hooks/animation/index.js +6 -0
  302. package/modern/hooks/animation/useAnimateArea.d.ts +15 -0
  303. package/modern/hooks/animation/useAnimateArea.js +27 -0
  304. package/modern/hooks/animation/useAnimateBar.d.ts +17 -0
  305. package/modern/hooks/animation/useAnimateBar.js +56 -0
  306. package/modern/hooks/animation/useAnimateBarLabel.d.ts +19 -0
  307. package/modern/hooks/animation/useAnimateBarLabel.js +59 -0
  308. package/modern/hooks/animation/useAnimateLine.d.ts +14 -0
  309. package/modern/hooks/animation/useAnimateLine.js +26 -0
  310. package/modern/hooks/animation/useAnimatePieArc.d.ts +15 -0
  311. package/modern/hooks/animation/useAnimatePieArc.js +70 -0
  312. package/modern/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
  313. package/modern/hooks/animation/useAnimatePieArcLabel.js +72 -0
  314. package/modern/hooks/index.d.ts +2 -1
  315. package/modern/hooks/index.js +2 -1
  316. package/modern/hooks/useInteractionItemProps.js +11 -0
  317. package/modern/index.js +1 -1
  318. package/modern/internals/animation/Transition.d.ts +37 -0
  319. package/modern/internals/animation/Transition.js +83 -0
  320. package/modern/internals/animation/animation.d.ts +4 -0
  321. package/modern/internals/animation/animation.js +4 -0
  322. package/modern/internals/animation/useAnimate.d.ts +19 -0
  323. package/modern/internals/animation/useAnimate.js +74 -0
  324. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
  325. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
  326. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
  327. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +21 -0
  328. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
  329. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
  330. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +60 -26
  331. package/modern/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
  332. package/modern/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
  333. package/modern/internals/shallowEqual.d.ts +8 -0
  334. package/modern/internals/shallowEqual.js +31 -0
  335. package/modern/models/axis.d.ts +8 -0
  336. package/modern/themeAugmentation/overrides.d.ts +1 -1
  337. package/package.json +8 -9
  338. package/themeAugmentation/overrides.d.ts +1 -1
  339. package/tsconfig.build.tsbuildinfo +1 -1
  340. package/PieChart/dataTransform/transition.d.ts +0 -4
  341. package/PieChart/dataTransform/transition.js +0 -145
  342. package/esm/PieChart/dataTransform/transition.d.ts +0 -4
  343. package/esm/PieChart/dataTransform/transition.js +0 -137
  344. package/modern/PieChart/dataTransform/transition.d.ts +0 -4
  345. package/modern/PieChart/dataTransform/transition.js +0 -137
@@ -0,0 +1,7 @@
1
+ import { UseAxisTooltipParams, UseAxisTooltipReturnValue } from "./useAxisTooltip.js";
2
+ type UseAxesTooltipParams = Omit<UseAxisTooltipParams, 'multipleAxes'>;
3
+ /**
4
+ * Returns the axes to display in the tooltip and the series item related to them.
5
+ */
6
+ export declare function useAxesTooltip(params?: UseAxesTooltipParams): UseAxisTooltipReturnValue[] | null;
7
+ export {};
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useAxesTooltip = useAxesTooltip;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _useAxisTooltip = require("./useAxisTooltip");
11
+ /**
12
+ * Returns the axes to display in the tooltip and the series item related to them.
13
+ */
14
+ function useAxesTooltip(params) {
15
+ return (0, _useAxisTooltip.useAxisTooltip)((0, _extends2.default)({}, params, {
16
+ multipleAxes: true
17
+ }));
18
+ }
@@ -1,12 +1,25 @@
1
1
  import { SeriesId } from "../models/seriesType/common.js";
2
+ import { AxisId } from "../models/axis.js";
2
3
  import { CartesianChartSeriesType, ChartsSeriesConfig } from "../models/seriesType/config.js";
3
4
  import { ChartsLabelMarkProps } from "../ChartsLabel/index.js";
4
5
  export interface UseAxisTooltipReturnValue<SeriesT extends CartesianChartSeriesType = CartesianChartSeriesType, AxisValueT extends string | number | Date = string | number | Date> {
5
6
  axisDirection: 'x' | 'y';
6
- dataIndex: number;
7
- seriesItems: SeriesItem<SeriesT>[];
7
+ axisId: AxisId;
8
8
  axisValue: AxisValueT;
9
9
  axisFormattedValue: string;
10
+ dataIndex: number;
11
+ seriesItems: SeriesItem<SeriesT>[];
12
+ }
13
+ export interface UseAxisTooltipParams {
14
+ /**
15
+ * If `true`, the hook returns an array with an object per active axis.
16
+ */
17
+ multipleAxes?: boolean;
18
+ /**
19
+ * The axis directions to consider.
20
+ * If not defined, all directions are considered
21
+ */
22
+ directions?: ('x' | 'y')[];
10
23
  }
11
24
  interface SeriesItem<T extends CartesianChartSeriesType> {
12
25
  seriesId: SeriesId;
@@ -16,5 +29,13 @@ interface SeriesItem<T extends CartesianChartSeriesType> {
16
29
  formattedLabel: string | null;
17
30
  markType: ChartsLabelMarkProps['type'];
18
31
  }
19
- export declare function useAxisTooltip(): UseAxisTooltipReturnValue | null;
32
+ /**
33
+ * @deprecated Use `useAxesTooltip` instead.
34
+ */
35
+ export declare function useAxisTooltip(params: UseAxisTooltipParams & {
36
+ multipleAxes: true;
37
+ }): UseAxisTooltipReturnValue[] | null;
38
+ export declare function useAxisTooltip(params?: UseAxisTooltipParams & {
39
+ multipleAxes?: false;
40
+ }): UseAxisTooltipReturnValue | null;
20
41
  export {};
@@ -15,12 +15,37 @@ var _utils = require("./utils");
15
15
  var _useAxis = require("../hooks/useAxis");
16
16
  var _useZAxis = require("../hooks/useZAxis");
17
17
  var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
18
- function useAxisTooltip() {
18
+ function defaultAxisTooltipConfig(axis, dataIndex, axisDirection) {
19
+ const axisValue = axis.data?.[dataIndex] ?? null;
20
+ const axisFormatter = axis.valueFormatter ?? (v => axis.scaleType === 'utc' ? (0, _utils.utcFormatter)(v) : v.toLocaleString());
21
+ const axisFormattedValue = axisFormatter(axisValue, {
22
+ location: 'tooltip',
23
+ scale: axis.scale
24
+ });
25
+ return {
26
+ axisDirection,
27
+ axisId: axis.id,
28
+ dataIndex,
29
+ axisValue,
30
+ axisFormattedValue,
31
+ seriesItems: []
32
+ };
33
+ }
34
+
35
+ /**
36
+ * @deprecated Use `useAxesTooltip` instead.
37
+ */
38
+
39
+ function useAxisTooltip(params = {}) {
40
+ const {
41
+ multipleAxes,
42
+ directions
43
+ } = params;
19
44
  const defaultXAxis = (0, _useAxis.useXAxis)();
20
45
  const defaultYAxis = (0, _useAxis.useYAxis)();
21
- const xAxisHasData = defaultXAxis.data !== undefined && defaultXAxis.data.length !== 0;
22
46
  const store = (0, _useStore.useStore)();
23
- const axisData = (0, _useSelector.useSelector)(store, xAxisHasData ? _useChartCartesianAxis.selectorChartsInteractionXAxis : _useChartCartesianAxis.selectorChartsInteractionYAxis);
47
+ const tooltipXAxes = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsInteractionTooltipXAxes);
48
+ const tooltipYAxes = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsInteractionTooltipYAxes);
24
49
  const series = (0, _useSeries.useSeries)();
25
50
  const {
26
51
  xAxis
@@ -33,61 +58,70 @@ function useAxisTooltip() {
33
58
  zAxisIds
34
59
  } = (0, _useZAxis.useZAxes)();
35
60
  const colorProcessors = (0, _useColorProcessor.useColorProcessor)();
36
- if (axisData === null) {
61
+ if (tooltipXAxes.length === 0 && tooltipYAxes.length === 0) {
37
62
  return null;
38
63
  }
39
- const {
40
- index: dataIndex,
41
- value: axisValue
42
- } = axisData;
43
- const USED_AXIS_ID = xAxisHasData ? defaultXAxis.id : defaultYAxis.id;
44
- const usedAxis = xAxisHasData ? defaultXAxis : defaultYAxis;
45
- const relevantSeries = Object.keys(series).filter(_isCartesian.isCartesianSeriesType).flatMap(seriesType => {
64
+ const tooltipAxes = [];
65
+ if (directions === undefined || directions.includes('x')) {
66
+ tooltipXAxes.forEach(({
67
+ axisId,
68
+ dataIndex
69
+ }) => {
70
+ if (!multipleAxes && tooltipAxes.length > 1) {
71
+ return;
72
+ }
73
+ tooltipAxes.push(defaultAxisTooltipConfig(xAxis[axisId], dataIndex, 'x'));
74
+ });
75
+ }
76
+ if (directions === undefined || directions.includes('y')) {
77
+ tooltipYAxes.forEach(({
78
+ axisId,
79
+ dataIndex
80
+ }) => {
81
+ if (!multipleAxes && tooltipAxes.length > 1) {
82
+ return;
83
+ }
84
+ tooltipAxes.push(defaultAxisTooltipConfig(yAxis[axisId], dataIndex, 'y'));
85
+ });
86
+ }
87
+ Object.keys(series).filter(_isCartesian.isCartesianSeriesType).flatMap(seriesType => {
46
88
  const seriesOfType = series[seriesType];
47
89
  if (!seriesOfType) {
48
90
  return [];
49
91
  }
50
- return seriesOfType.seriesOrder.map(seriesId => {
92
+ return seriesOfType.seriesOrder.forEach(seriesId => {
51
93
  const seriesToAdd = seriesOfType.series[seriesId];
52
- const providedXAxisId = seriesToAdd.xAxisId;
53
- const providedYAxisId = seriesToAdd.yAxisId;
54
- const axisKey = xAxisHasData ? providedXAxisId : providedYAxisId;
55
-
94
+ const providedXAxisId = seriesToAdd.xAxisId ?? defaultXAxis.id;
95
+ const providedYAxisId = seriesToAdd.yAxisId ?? defaultYAxis.id;
96
+ const tooltipItemIndex = tooltipAxes.findIndex(({
97
+ axisDirection,
98
+ axisId
99
+ }) => axisDirection === 'x' && axisId === providedXAxisId || axisDirection === 'y' && axisId === providedYAxisId);
56
100
  // Test if the series uses the default axis
57
- if (axisKey === undefined || axisKey === USED_AXIS_ID) {
58
- const xAxisId = providedXAxisId ?? defaultXAxis.id;
59
- const yAxisId = providedYAxisId ?? defaultYAxis.id;
101
+ if (tooltipItemIndex >= 0) {
60
102
  const zAxisId = 'zAxisId' in seriesToAdd ? seriesToAdd.zAxisId : zAxisIds[0];
61
- const color = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId ? zAxis[zAxisId] : undefined)(dataIndex) ?? '';
103
+ const {
104
+ dataIndex
105
+ } = tooltipAxes[tooltipItemIndex];
106
+ const color = colorProcessors[seriesType]?.(seriesToAdd, xAxis[providedXAxisId], yAxis[providedYAxisId], zAxisId ? zAxis[zAxisId] : undefined)(dataIndex) ?? '';
62
107
  const value = seriesToAdd.data[dataIndex] ?? null;
63
108
  const formattedValue = seriesToAdd.valueFormatter(value, {
64
109
  dataIndex
65
110
  });
66
111
  const formattedLabel = (0, _getLabel.getLabel)(seriesToAdd.label, 'tooltip') ?? null;
67
- return {
112
+ tooltipAxes[tooltipItemIndex].seriesItems.push({
68
113
  seriesId,
69
114
  color,
70
115
  value,
71
116
  formattedValue,
72
117
  formattedLabel,
73
118
  markType: seriesToAdd.labelMarkType
74
- };
119
+ });
75
120
  }
76
- return undefined;
77
121
  });
78
- }).filter(function truthy(item) {
79
- return Boolean(item);
80
- });
81
- const axisFormatter = usedAxis.valueFormatter ?? (v => usedAxis.scaleType === 'utc' ? (0, _utils.utcFormatter)(v) : v.toLocaleString());
82
- const axisFormattedValue = axisFormatter(axisValue, {
83
- location: 'tooltip',
84
- scale: usedAxis.scale
85
122
  });
86
- return {
87
- axisDirection: xAxisHasData ? 'x' : 'y',
88
- dataIndex,
89
- seriesItems: relevantSeries,
90
- axisValue,
91
- axisFormattedValue
92
- };
123
+ if (!multipleAxes) {
124
+ return tooltipAxes.length === 0 ? tooltipAxes[0] : null;
125
+ }
126
+ return tooltipAxes;
93
127
  }
@@ -35,7 +35,10 @@ function useItemTooltip() {
35
35
  if (!identifier || identifier.dataIndex === undefined) {
36
36
  return null;
37
37
  }
38
- const itemSeries = series[identifier.type].series[identifier.seriesId];
38
+ const itemSeries = series[identifier.type]?.series[identifier.seriesId];
39
+ if (!itemSeries) {
40
+ return null;
41
+ }
39
42
  const getColor = seriesConfig[itemSeries.type].colorProcessor?.(itemSeries, xAxisId && xAxis[xAxisId], yAxisId && yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
40
43
  return seriesConfig[itemSeries.type].tooltipGetter({
41
44
  series: itemSeries,
@@ -118,7 +118,7 @@ function getVisibleLabels(xTicks, {
118
118
  return true;
119
119
  }));
120
120
  }
121
- function shortenLabels(visibleLabels, drawingArea, maxHeight, tickLabelStyle) {
121
+ function shortenLabels(visibleLabels, drawingArea, maxHeight, isRtl, tickLabelStyle) {
122
122
  const shortenedLabels = new Map();
123
123
  const angle = (0, _clampAngle.clampAngle)(tickLabelStyle?.angle ?? 0);
124
124
 
@@ -139,6 +139,9 @@ function shortenLabels(visibleLabels, drawingArea, maxHeight, tickLabelStyle) {
139
139
  if (angle > 90 && angle < 270) {
140
140
  [leftBoundFactor, rightBoundFactor] = [rightBoundFactor, leftBoundFactor];
141
141
  }
142
+ if (isRtl) {
143
+ [leftBoundFactor, rightBoundFactor] = [rightBoundFactor, leftBoundFactor];
144
+ }
142
145
  for (const item of visibleLabels) {
143
146
  if (item.formattedValue) {
144
147
  // That maximum width of the tick depends on its proximity to the axis bounds.
@@ -300,7 +303,7 @@ function ChartsXAxis(inProps) {
300
303
 
301
304
  /* If there's an axis title, the tick labels have less space to render */
302
305
  const tickLabelsMaxHeight = Math.max(0, axisHeight - (label ? labelHeight + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
303
- const tickLabels = isHydrated ? shortenLabels(visibleLabels, drawingArea, tickLabelsMaxHeight, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
306
+ const tickLabels = isHydrated ? shortenLabels(visibleLabels, drawingArea, tickLabelsMaxHeight, isRtl, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
304
307
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(XAxisRoot, {
305
308
  transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
306
309
  className: classes.root,
@@ -15,6 +15,9 @@ var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
15
15
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
16
16
  var _styles = require("@mui/material/styles");
17
17
  var _RtlProvider = require("@mui/system/RtlProvider");
18
+ var _useIsHydrated = require("../hooks/useIsHydrated");
19
+ var _defaultTextPlacement = require("../ChartsText/defaultTextPlacement");
20
+ var _ellipsize = require("../internals/ellipsize");
18
21
  var _domUtils = require("../internals/domUtils");
19
22
  var _useTicks = require("../hooks/useTicks");
20
23
  var _useDrawingArea = require("../hooks/useDrawingArea");
@@ -25,6 +28,8 @@ var _isInfinity = require("../internals/isInfinity");
25
28
  var _isBandScale = require("../internals/isBandScale");
26
29
  var _ChartProvider = require("../context/ChartProvider");
27
30
  var _hooks = require("../hooks");
31
+ var _clampAngle = require("../internals/clampAngle");
32
+ var _invertTextAnchor = require("../internals/invertTextAnchor");
28
33
  var _jsxRuntime = require("react/jsx-runtime");
29
34
  const _excluded = ["scale", "tickNumber"];
30
35
  const useUtilityClasses = ownerState => {
@@ -42,6 +47,47 @@ const useUtilityClasses = ownerState => {
42
47
  };
43
48
  return (0, _composeClasses.default)(slots, _axisClasses.getAxisUtilityClass, classes);
44
49
  };
50
+
51
+ /* Gap between a tick and its label. */
52
+ const TICK_LABEL_GAP = 2;
53
+ /* Gap between the axis label and tick labels. */
54
+ const AXIS_LABEL_TICK_LABEL_GAP = 2;
55
+ function shortenLabels(visibleLabels, drawingArea, maxWidth, isRtl, tickLabelStyle) {
56
+ const shortenedLabels = new Map();
57
+ const angle = (0, _clampAngle.clampAngle)(tickLabelStyle?.angle ?? 0);
58
+ let topBoundFactor = 1;
59
+ let bottomBoundFactor = 1;
60
+ if (tickLabelStyle?.textAnchor === 'start') {
61
+ topBoundFactor = Infinity;
62
+ bottomBoundFactor = 1;
63
+ } else if (tickLabelStyle?.textAnchor === 'end') {
64
+ topBoundFactor = 1;
65
+ bottomBoundFactor = Infinity;
66
+ } else {
67
+ topBoundFactor = 2;
68
+ bottomBoundFactor = 2;
69
+ }
70
+ if (angle > 180) {
71
+ [topBoundFactor, bottomBoundFactor] = [bottomBoundFactor, topBoundFactor];
72
+ }
73
+ if (isRtl) {
74
+ [topBoundFactor, bottomBoundFactor] = [bottomBoundFactor, topBoundFactor];
75
+ }
76
+ for (const item of visibleLabels) {
77
+ if (item.formattedValue) {
78
+ // That maximum height of the tick depends on its proximity to the axis bounds.
79
+ const height = Math.min((item.offset + item.labelOffset) * topBoundFactor, (drawingArea.top + drawingArea.height + drawingArea.bottom - item.offset - item.labelOffset) * bottomBoundFactor);
80
+ const doesTextFit = text => (0, _ellipsize.doesTextFitInRect)(text, {
81
+ width: maxWidth,
82
+ height,
83
+ angle,
84
+ measureText: string => (0, _domUtils.getStringSize)(string, tickLabelStyle)
85
+ });
86
+ shortenedLabels.set(item, (0, _ellipsize.ellipsize)(item.formattedValue.toString(), doesTextFit));
87
+ }
88
+ }
89
+ return shortenedLabels;
90
+ }
45
91
  const YAxisRoot = (0, _styles.styled)(_AxisSharedComponents.AxisRoot, {
46
92
  name: 'MuiChartsYAxis',
47
93
  slot: 'Root',
@@ -99,16 +145,18 @@ function ChartsYAxis(inProps) {
99
145
  } = defaultizedProps;
100
146
  const theme = (0, _styles.useTheme)();
101
147
  const isRtl = (0, _RtlProvider.useRtl)();
148
+ const isHydrated = (0, _useIsHydrated.useIsHydrated)();
102
149
  const classes = useUtilityClasses(defaultizedProps);
103
150
  const {
104
151
  instance
105
152
  } = (0, _ChartProvider.useChartContext)();
153
+ const drawingArea = (0, _useDrawingArea.useDrawingArea)();
106
154
  const {
107
155
  left,
108
156
  top,
109
157
  width,
110
158
  height
111
- } = (0, _useDrawingArea.useDrawingArea)();
159
+ } = drawingArea;
112
160
  const tickSize = disableTicks ? 4 : tickSizeProp;
113
161
  const yTicks = (0, _useTicks.useTicks)({
114
162
  scale: yScale,
@@ -124,15 +172,16 @@ function ChartsYAxis(inProps) {
124
172
  const Tick = slots?.axisTick ?? 'line';
125
173
  const TickLabel = slots?.axisTickLabel ?? _ChartsText.ChartsText;
126
174
  const Label = slots?.axisLabel ?? _ChartsText.ChartsText;
127
- const revertAnchor = !isRtl && position === 'right' || isRtl && position !== 'right';
175
+ const defaultTextAnchor = (0, _defaultTextPlacement.getDefaultTextAnchor)((position === 'right' ? -90 : 90) - (tickLabelStyle?.angle ?? 0));
176
+ const defaultDominantBaseline = (0, _defaultTextPlacement.getDefaultBaseline)((position === 'right' ? -90 : 90) - (tickLabelStyle?.angle ?? 0));
128
177
  const axisTickLabelProps = (0, _useSlotProps.default)({
129
178
  elementType: TickLabel,
130
179
  externalSlotProps: slotProps?.axisTickLabel,
131
180
  additionalProps: {
132
181
  style: (0, _extends2.default)({}, theme.typography.caption, {
133
182
  fontSize: tickFontSize,
134
- textAnchor: revertAnchor ? 'start' : 'end',
135
- dominantBaseline: 'central'
183
+ textAnchor: isRtl ? (0, _invertTextAnchor.invertTextAnchor)(defaultTextAnchor) : defaultTextAnchor,
184
+ dominantBaseline: defaultDominantBaseline
136
185
  }, tickLabelStyle)
137
186
  },
138
187
  className: classes.tickLabel,
@@ -147,7 +196,7 @@ function ChartsYAxis(inProps) {
147
196
  fontSize: 14,
148
197
  angle: positionSign * 90,
149
198
  textAnchor: 'middle',
150
- dominantBaseline: 'auto'
199
+ dominantBaseline: 'text-before-edge'
151
200
  }, labelStyle)
152
201
  },
153
202
  ownerState: {}
@@ -170,11 +219,13 @@ function ChartsYAxis(inProps) {
170
219
  if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(_isInfinity.isInfinity) || position === 'none') {
171
220
  return null;
172
221
  }
173
- const labelHeight = label ? (0, _domUtils.getStringSize)(label, axisLabelProps.style).height : 0;
174
222
  const labelRefPoint = {
175
- x: positionSign * (axisWidth - labelHeight),
223
+ x: positionSign * axisWidth,
176
224
  y: top + height / 2
177
225
  };
226
+ /* If there's an axis title, the tick labels have less space to render */
227
+ const tickLabelsMaxWidth = Math.max(0, axisWidth - (label ? (0, _domUtils.getStringSize)(label, axisLabelProps.style).height + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
228
+ const tickLabels = isHydrated ? shortenLabels(yTicks, drawingArea, tickLabelsMaxWidth, isRtl, axisTickLabelProps.style) : new Map(Array.from(yTicks).map(item => [item, item.formattedValue]));
178
229
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(YAxisRoot, {
179
230
  transform: `translate(${position === 'right' ? left + width + offset : left - offset}, 0)`,
180
231
  className: classes.root,
@@ -183,13 +234,13 @@ function ChartsYAxis(inProps) {
183
234
  y1: top,
184
235
  y2: top + height,
185
236
  className: classes.line
186
- }, lineSlotProps)), yTicks.map(({
187
- formattedValue,
188
- offset: tickOffset,
189
- labelOffset,
190
- value
191
- }, index) => {
192
- const xTickLabel = positionSign * (tickSize + 2);
237
+ }, lineSlotProps)), yTicks.map((item, index) => {
238
+ const {
239
+ offset: tickOffset,
240
+ labelOffset,
241
+ value
242
+ } = item;
243
+ const xTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
193
244
  const yTickLabel = labelOffset;
194
245
  const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
195
246
  const showLabel = instance.isPointInside({
@@ -198,6 +249,7 @@ function ChartsYAxis(inProps) {
198
249
  }, {
199
250
  direction: 'y'
200
251
  });
252
+ const tickLabel = tickLabels.get(item);
201
253
  if (!showLabel) {
202
254
  return null;
203
255
  }
@@ -207,13 +259,13 @@ function ChartsYAxis(inProps) {
207
259
  children: [!disableTicks && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tick, (0, _extends2.default)({
208
260
  x2: positionSign * tickSize,
209
261
  className: classes.tick
210
- }, slotProps?.axisTick)), formattedValue !== undefined && !skipLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
262
+ }, slotProps?.axisTick)), tickLabel !== undefined && !skipLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
211
263
  x: xTickLabel,
212
264
  y: yTickLabel,
213
- text: formattedValue.toString()
265
+ text: tickLabel
214
266
  }, axisTickLabelProps))]
215
267
  }, index);
216
- }), label && /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
268
+ }), label && isHydrated && /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
217
269
  className: classes.label,
218
270
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Label, (0, _extends2.default)({}, labelRefPoint, axisLabelProps, {
219
271
  text: label
@@ -11,11 +11,10 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
- var _web = require("@react-spring/web");
15
- var _useStringInterpolator = require("../internals/useStringInterpolator");
14
+ var _useAnimateArea = require("../hooks/animation/useAnimateArea");
16
15
  var _AppearingMask = require("./AppearingMask");
17
16
  var _jsxRuntime = require("react/jsx-runtime");
18
- const _excluded = ["d", "skipAnimation", "ownerState"];
17
+ const _excluded = ["skipAnimation", "ownerState"];
19
18
  /**
20
19
  * Demos:
21
20
  *
@@ -28,38 +27,22 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
28
27
  */
29
28
  function AnimatedArea(props) {
30
29
  const {
31
- d,
32
30
  skipAnimation,
33
31
  ownerState
34
32
  } = props,
35
33
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
36
- const stringInterpolator = (0, _useStringInterpolator.useStringInterpolator)(d);
37
- const transitionChange = (0, _web.useTransition)([stringInterpolator], {
38
- from: skipAnimation ? undefined : {
39
- value: 0
40
- },
41
- to: {
42
- value: 1
43
- },
44
- enter: {
45
- value: 1
46
- },
47
- reset: false,
48
- immediate: skipAnimation
49
- });
34
+ const animatedProps = (0, _useAnimateArea.useAnimateArea)(props);
50
35
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppearingMask.AppearingMask, {
51
36
  skipAnimation: skipAnimation,
52
37
  id: `${ownerState.id}-area-clip`,
53
- children: transitionChange((style, interpolator) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.path, (0, _extends2.default)({
54
- // @ts-expect-error
55
- d: style.value.to(interpolator),
38
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
56
39
  fill: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
57
40
  filter:
58
41
  // eslint-disable-next-line no-nested-ternary
59
42
  ownerState.isHighlighted ? 'brightness(140%)' : ownerState.gradientId ? undefined : 'brightness(120%)',
60
43
  opacity: ownerState.isFaded ? 0.3 : 1,
61
44
  stroke: "none"
62
- }, other)))
45
+ }, other, animatedProps))
63
46
  });
64
47
  }
65
48
  process.env.NODE_ENV !== "production" ? AnimatedArea.propTypes = {
@@ -19,8 +19,5 @@ export interface AnimatedLineProps extends React.ComponentPropsWithoutRef<'path'
19
19
  *
20
20
  * - [AnimatedLine API](https://mui.com/x/api/charts/animated-line/)
21
21
  */
22
- declare function AnimatedLine(props: AnimatedLineProps): React.JSX.Element;
23
- declare namespace AnimatedLine {
24
- var propTypes: any;
25
- }
22
+ declare const AnimatedLine: React.ForwardRefExoticComponent<AnimatedLineProps & React.RefAttributes<SVGPathElement>>;
26
23
  export { AnimatedLine };
@@ -6,16 +6,15 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
- exports.AnimatedLine = AnimatedLine;
9
+ exports.AnimatedLine = void 0;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
- var _web = require("@react-spring/web");
15
- var _useStringInterpolator = require("../internals/useStringInterpolator");
14
+ var _hooks = require("../hooks");
16
15
  var _AppearingMask = require("./AppearingMask");
17
16
  var _jsxRuntime = require("react/jsx-runtime");
18
- const _excluded = ["d", "skipAnimation", "ownerState"];
17
+ const _excluded = ["skipAnimation", "ownerState"];
19
18
  /**
20
19
  * Demos:
21
20
  *
@@ -26,42 +25,28 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
26
25
  *
27
26
  * - [AnimatedLine API](https://mui.com/x/api/charts/animated-line/)
28
27
  */
29
- function AnimatedLine(props) {
28
+ const AnimatedLine = exports.AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props, ref) {
30
29
  const {
31
- d,
32
30
  skipAnimation,
33
31
  ownerState
34
32
  } = props,
35
33
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
36
- const stringInterpolator = (0, _useStringInterpolator.useStringInterpolator)(d);
37
- const transitionChange = (0, _web.useTransition)([stringInterpolator], {
38
- from: skipAnimation ? undefined : {
39
- value: 0
40
- },
41
- to: {
42
- value: 1
43
- },
44
- enter: {
45
- value: 1
46
- },
47
- reset: false,
48
- immediate: skipAnimation
49
- });
34
+ const animateProps = (0, _hooks.useAnimateLine)((0, _extends2.default)({}, props, {
35
+ ref
36
+ }));
50
37
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppearingMask.AppearingMask, {
51
38
  skipAnimation: skipAnimation,
52
39
  id: `${ownerState.id}-line-clip`,
53
- children: transitionChange((style, interpolator) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.path, (0, _extends2.default)({
54
- // @ts-expect-error
55
- d: style.value.to(interpolator),
40
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
56
41
  stroke: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
57
42
  strokeWidth: 2,
58
43
  strokeLinejoin: "round",
59
44
  fill: "none",
60
45
  filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
61
46
  opacity: ownerState.isFaded ? 0.3 : 1
62
- }, other)))
47
+ }, other, animateProps))
63
48
  });
64
- }
49
+ });
65
50
  process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
66
51
  // ----------------------------- Warning --------------------------------
67
52
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -5,6 +5,11 @@ interface AppearingMaskProps {
5
5
  skipAnimation?: boolean;
6
6
  children: React.ReactNode;
7
7
  }
8
+ export interface AppearingMaskClasses {
9
+ /** Styles applied if the element should be animated. */
10
+ animate: string;
11
+ }
12
+ export declare const appearingMaskClasses: AppearingMaskClasses;
8
13
  /**
9
14
  * @ignore - internal component.
10
15
  */
@@ -1,46 +1,53 @@
1
1
  "use strict";
2
2
  'use client';
3
3
 
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
6
  Object.defineProperty(exports, "__esModule", {
6
7
  value: true
7
8
  });
8
9
  exports.AppearingMask = AppearingMask;
10
+ exports.appearingMaskClasses = void 0;
9
11
  var React = _interopRequireWildcard(require("react"));
10
- var _web = require("@react-spring/web");
12
+ var _styles = require("@mui/material/styles");
13
+ var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
14
+ var _clsx = _interopRequireDefault(require("clsx"));
15
+ var _animation = require("../internals/animation/animation");
11
16
  var _cleanId = require("../internals/cleanId");
12
17
  var _hooks = require("../hooks");
13
18
  var _jsxRuntime = require("react/jsx-runtime");
19
+ const appearingMaskClasses = exports.appearingMaskClasses = (0, _generateUtilityClasses.default)('MuiAppearingMask', ['animate']);
20
+ const AnimatedRect = (0, _styles.styled)('rect')({
21
+ animationName: 'animate-width',
22
+ animationTimingFunction: _animation.ANIMATION_TIMING_FUNCTION,
23
+ animationDuration: '0s',
24
+ [`&.${appearingMaskClasses.animate}`]: {
25
+ animationDuration: `${_animation.ANIMATION_DURATION_MS}ms`
26
+ },
27
+ '@keyframes animate-width': {
28
+ from: {
29
+ width: 0
30
+ }
31
+ }
32
+ });
33
+
14
34
  /**
15
35
  * @ignore - internal component.
16
36
  */
17
37
  function AppearingMask(props) {
18
38
  const drawingArea = (0, _hooks.useDrawingArea)();
19
39
  const chartId = (0, _hooks.useChartId)();
20
- const transitionAppear = (0, _web.useTransition)([drawingArea], {
21
- from: props.skipAnimation ? undefined : v => ({
22
- animatedWidth: v.left
23
- }),
24
- enter: v => ({
25
- animatedWidth: v.width + v.left + v.right
26
- }),
27
- leave: v => ({
28
- animatedWidth: v.width + v.left + v.right
29
- }),
30
- reset: false,
31
- immediate: props.skipAnimation
32
- });
33
40
  const clipId = (0, _cleanId.cleanId)(`${chartId}-${props.id}`);
34
41
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
35
42
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
36
43
  id: clipId,
37
- children: transitionAppear(style => /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.rect, {
38
- // @ts-expect-error
44
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedRect, {
45
+ className: (0, _clsx.default)(!props.skipAnimation && appearingMaskClasses.animate),
39
46
  x: 0,
40
47
  y: 0,
41
- width: style.animatedWidth,
48
+ width: drawingArea.left + drawingArea.width + drawingArea.right,
42
49
  height: drawingArea.top + drawingArea.height + drawingArea.bottom
43
- }))
50
+ })
44
51
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
45
52
  clipPath: `url(#${clipId})`,
46
53
  children: props.children