@mui/x-charts 8.0.0-beta.1 → 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 (450) 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/BarChart/useBarChartProps.d.ts +2 -1
  27. package/BarChart/useBarChartProps.js +20 -13
  28. package/CHANGELOG.md +235 -0
  29. package/ChartContainer/ChartContainer.js +4 -0
  30. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +8 -8
  31. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +8 -8
  32. package/ChartsLabel/ChartsLabelMark.js +0 -4
  33. package/ChartsLabel/index.d.ts +1 -0
  34. package/ChartsLabel/index.js +7 -0
  35. package/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
  36. package/ChartsOverlay/ChartsLoadingOverlay.js +1 -1
  37. package/ChartsOverlay/ChartsNoDataOverlay.js +1 -1
  38. package/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
  39. package/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
  40. package/ChartsTooltip/ChartsTooltip.js +2 -2
  41. package/ChartsTooltip/ChartsTooltipContainer.js +4 -8
  42. package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
  43. package/ChartsTooltip/ChartsTooltipTable.js +24 -9
  44. package/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
  45. package/ChartsTooltip/chartsTooltipClasses.js +2 -2
  46. package/ChartsTooltip/index.d.ts +1 -0
  47. package/ChartsTooltip/index.js +12 -0
  48. package/ChartsTooltip/useAxesTooltip.d.ts +7 -0
  49. package/ChartsTooltip/useAxesTooltip.js +18 -0
  50. package/ChartsTooltip/useAxisTooltip.d.ts +24 -3
  51. package/ChartsTooltip/useAxisTooltip.js +72 -38
  52. package/ChartsTooltip/useItemTooltip.js +4 -1
  53. package/ChartsXAxis/ChartsXAxis.js +5 -2
  54. package/ChartsYAxis/ChartsYAxis.js +69 -17
  55. package/LineChart/AnimatedArea.js +5 -22
  56. package/LineChart/AnimatedLine.d.ts +1 -4
  57. package/LineChart/AnimatedLine.js +10 -25
  58. package/LineChart/AppearingMask.d.ts +5 -0
  59. package/LineChart/AppearingMask.js +25 -18
  60. package/LineChart/CircleMarkElement.js +17 -23
  61. package/LineChart/LineChart.js +2 -0
  62. package/LineChart/LineHighlightPlot.js +3 -4
  63. package/LineChart/MarkElement.js +16 -27
  64. package/LineChart/MarkPlot.js +0 -1
  65. package/LineChart/markElementClasses.d.ts +3 -0
  66. package/LineChart/markElementClasses.js +4 -3
  67. package/LineChart/seriesConfig/index.js +3 -1
  68. package/LineChart/seriesConfig/tooltip.d.ts +2 -1
  69. package/LineChart/seriesConfig/tooltip.js +8 -1
  70. package/LineChart/useLineChartProps.d.ts +2 -1
  71. package/LineChart/useLineChartProps.js +7 -4
  72. package/PieChart/PieArc.d.ts +19 -11
  73. package/PieChart/PieArc.js +37 -24
  74. package/PieChart/PieArcLabel.d.ts +22 -13
  75. package/PieChart/PieArcLabel.js +52 -48
  76. package/PieChart/PieArcLabelPlot.js +16 -34
  77. package/PieChart/PieArcPlot.js +21 -34
  78. package/PieChart/seriesConfig/tooltip.js +3 -0
  79. package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +9 -5
  80. package/RadarChart/RadarGrid/RadarGrid.d.ts +1 -1
  81. package/RadarChart/RadarGrid/RadarGrid.js +5 -1
  82. package/RadarChart/RadarGrid/useRadarGridData.d.ts +1 -1
  83. package/RadarChart/RadarGrid/useRadarGridData.js +3 -0
  84. package/RadarChart/RadarSeriesPlot/useRadarSeriesData.js +2 -2
  85. package/ScatterChart/ScatterChart.js +2 -0
  86. package/ScatterChart/useScatterChartProps.d.ts +2 -1
  87. package/ScatterChart/useScatterChartProps.js +6 -3
  88. package/SparkLineChart/SparkLineChart.js +2 -0
  89. package/colorPalettes/colorPalettes.js +2 -2
  90. package/constants/index.d.ts +1 -1
  91. package/constants/index.js +1 -1
  92. package/context/AnimationProvider/AnimationProvider.js +4 -6
  93. package/esm/BarChart/AnimatedBarElement.d.ts +38 -8
  94. package/esm/BarChart/AnimatedBarElement.js +5 -5
  95. package/esm/BarChart/BarChart.js +2 -0
  96. package/esm/BarChart/BarClipPath.d.ts +19 -1
  97. package/esm/BarChart/BarClipPath.js +84 -17
  98. package/esm/BarChart/BarElement.d.ts +9 -20
  99. package/esm/BarChart/BarElement.js +28 -23
  100. package/esm/BarChart/BarLabel/BarLabel.d.ts +27 -854
  101. package/esm/BarChart/BarLabel/BarLabel.js +32 -5
  102. package/esm/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
  103. package/esm/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
  104. package/esm/BarChart/BarLabel/BarLabelItem.js +18 -6
  105. package/esm/BarChart/BarLabel/BarLabelPlot.js +16 -46
  106. package/esm/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
  107. package/esm/BarChart/BarLabel/barLabelClasses.js +4 -3
  108. package/esm/BarChart/BarPlot.js +37 -61
  109. package/esm/BarChart/barElementClasses.d.ts +21 -0
  110. package/esm/BarChart/barElementClasses.js +19 -0
  111. package/esm/BarChart/getRadius.d.ts +1 -1
  112. package/esm/BarChart/index.d.ts +2 -1
  113. package/esm/BarChart/index.js +2 -1
  114. package/esm/BarChart/seriesConfig/index.js +2 -1
  115. package/esm/BarChart/seriesConfig/tooltip.d.ts +2 -1
  116. package/esm/BarChart/seriesConfig/tooltip.js +12 -0
  117. package/esm/BarChart/types.d.ts +2 -2
  118. package/esm/BarChart/useBarChartProps.d.ts +2 -1
  119. package/esm/BarChart/useBarChartProps.js +19 -13
  120. package/esm/ChartContainer/ChartContainer.js +4 -0
  121. package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +8 -8
  122. package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +8 -8
  123. package/esm/ChartsLabel/ChartsLabelMark.js +0 -4
  124. package/esm/ChartsLabel/index.d.ts +1 -0
  125. package/esm/ChartsLabel/index.js +1 -0
  126. package/esm/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
  127. package/esm/ChartsOverlay/ChartsLoadingOverlay.js +1 -1
  128. package/esm/ChartsOverlay/ChartsNoDataOverlay.js +1 -1
  129. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
  130. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
  131. package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
  132. package/esm/ChartsTooltip/ChartsTooltipContainer.js +5 -9
  133. package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
  134. package/esm/ChartsTooltip/ChartsTooltipTable.js +23 -9
  135. package/esm/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
  136. package/esm/ChartsTooltip/chartsTooltipClasses.js +2 -2
  137. package/esm/ChartsTooltip/index.d.ts +1 -0
  138. package/esm/ChartsTooltip/index.js +1 -0
  139. package/esm/ChartsTooltip/useAxesTooltip.d.ts +7 -0
  140. package/esm/ChartsTooltip/useAxesTooltip.js +12 -0
  141. package/esm/ChartsTooltip/useAxisTooltip.d.ts +24 -3
  142. package/esm/ChartsTooltip/useAxisTooltip.js +72 -38
  143. package/esm/ChartsTooltip/useItemTooltip.js +4 -1
  144. package/esm/ChartsXAxis/ChartsXAxis.js +5 -2
  145. package/esm/ChartsYAxis/ChartsYAxis.js +69 -17
  146. package/esm/LineChart/AnimatedArea.js +5 -22
  147. package/esm/LineChart/AnimatedLine.d.ts +1 -4
  148. package/esm/LineChart/AnimatedLine.js +9 -24
  149. package/esm/LineChart/AppearingMask.d.ts +5 -0
  150. package/esm/LineChart/AppearingMask.js +23 -18
  151. package/esm/LineChart/CircleMarkElement.js +19 -25
  152. package/esm/LineChart/LineChart.js +2 -0
  153. package/esm/LineChart/LineHighlightPlot.js +3 -4
  154. package/esm/LineChart/MarkElement.js +17 -28
  155. package/esm/LineChart/MarkPlot.js +0 -1
  156. package/esm/LineChart/markElementClasses.d.ts +3 -0
  157. package/esm/LineChart/markElementClasses.js +4 -3
  158. package/esm/LineChart/seriesConfig/index.js +2 -1
  159. package/esm/LineChart/seriesConfig/tooltip.d.ts +2 -1
  160. package/esm/LineChart/seriesConfig/tooltip.js +6 -0
  161. package/esm/LineChart/useLineChartProps.d.ts +2 -1
  162. package/esm/LineChart/useLineChartProps.js +6 -4
  163. package/esm/PieChart/PieArc.d.ts +19 -11
  164. package/esm/PieChart/PieArc.js +36 -23
  165. package/esm/PieChart/PieArcLabel.d.ts +22 -13
  166. package/esm/PieChart/PieArcLabel.js +51 -47
  167. package/esm/PieChart/PieArcLabelPlot.js +16 -34
  168. package/esm/PieChart/PieArcPlot.js +21 -34
  169. package/esm/PieChart/seriesConfig/tooltip.js +3 -0
  170. package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +9 -5
  171. package/esm/RadarChart/RadarGrid/RadarGrid.d.ts +1 -1
  172. package/esm/RadarChart/RadarGrid/RadarGrid.js +5 -1
  173. package/esm/RadarChart/RadarGrid/useRadarGridData.d.ts +1 -1
  174. package/esm/RadarChart/RadarGrid/useRadarGridData.js +3 -0
  175. package/esm/RadarChart/RadarSeriesPlot/useRadarSeriesData.js +2 -2
  176. package/esm/ScatterChart/ScatterChart.js +2 -0
  177. package/esm/ScatterChart/useScatterChartProps.d.ts +2 -1
  178. package/esm/ScatterChart/useScatterChartProps.js +5 -3
  179. package/esm/SparkLineChart/SparkLineChart.js +2 -0
  180. package/esm/colorPalettes/colorPalettes.js +2 -2
  181. package/esm/constants/index.d.ts +1 -1
  182. package/esm/constants/index.js +1 -1
  183. package/esm/context/AnimationProvider/AnimationProvider.js +3 -6
  184. package/esm/hooks/animation/index.d.ts +6 -0
  185. package/esm/hooks/animation/index.js +6 -0
  186. package/esm/hooks/animation/useAnimateArea.d.ts +15 -0
  187. package/esm/hooks/animation/useAnimateArea.js +27 -0
  188. package/esm/hooks/animation/useAnimateBar.d.ts +17 -0
  189. package/esm/hooks/animation/useAnimateBar.js +56 -0
  190. package/esm/hooks/animation/useAnimateBarLabel.d.ts +19 -0
  191. package/esm/hooks/animation/useAnimateBarLabel.js +59 -0
  192. package/esm/hooks/animation/useAnimateLine.d.ts +14 -0
  193. package/esm/hooks/animation/useAnimateLine.js +26 -0
  194. package/esm/hooks/animation/useAnimatePieArc.d.ts +15 -0
  195. package/esm/hooks/animation/useAnimatePieArc.js +70 -0
  196. package/esm/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
  197. package/esm/hooks/animation/useAnimatePieArcLabel.js +72 -0
  198. package/esm/hooks/index.d.ts +2 -1
  199. package/esm/hooks/index.js +2 -1
  200. package/esm/hooks/useAxis.d.ts +5 -5
  201. package/esm/hooks/useInteractionItemProps.js +11 -0
  202. package/esm/hooks/useScale.d.ts +2 -2
  203. package/esm/hooks/useScale.js +2 -2
  204. package/esm/index.js +1 -1
  205. package/esm/internals/animation/Transition.d.ts +37 -0
  206. package/esm/internals/animation/Transition.js +83 -0
  207. package/esm/internals/animation/animation.d.ts +4 -0
  208. package/esm/internals/animation/animation.js +4 -0
  209. package/esm/internals/animation/useAnimate.d.ts +19 -0
  210. package/esm/internals/animation/useAnimate.js +74 -0
  211. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
  212. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
  213. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
  214. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +21 -0
  215. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +8 -6
  216. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +28 -22
  217. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -0
  218. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +1 -0
  219. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +9 -42
  220. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
  221. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -0
  222. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +75 -0
  223. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +7 -20
  224. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +36 -242
  225. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +4 -10
  226. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +9 -15
  227. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +12 -0
  228. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +8 -0
  229. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.d.ts +6 -4
  230. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.js +18 -13
  231. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +16 -32
  232. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3669 -0
  233. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +22 -0
  234. package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
  235. package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
  236. package/esm/internals/shallowEqual.d.ts +8 -0
  237. package/esm/internals/shallowEqual.js +31 -0
  238. package/esm/models/axis.d.ts +8 -0
  239. package/esm/themeAugmentation/overrides.d.ts +1 -1
  240. package/hooks/animation/index.d.ts +6 -0
  241. package/hooks/animation/index.js +71 -0
  242. package/hooks/animation/useAnimateArea.d.ts +15 -0
  243. package/hooks/animation/useAnimateArea.js +34 -0
  244. package/hooks/animation/useAnimateBar.d.ts +17 -0
  245. package/hooks/animation/useAnimateBar.js +62 -0
  246. package/hooks/animation/useAnimateBarLabel.d.ts +19 -0
  247. package/hooks/animation/useAnimateBarLabel.js +65 -0
  248. package/hooks/animation/useAnimateLine.d.ts +14 -0
  249. package/hooks/animation/useAnimateLine.js +33 -0
  250. package/hooks/animation/useAnimatePieArc.d.ts +15 -0
  251. package/hooks/animation/useAnimatePieArc.js +77 -0
  252. package/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
  253. package/hooks/animation/useAnimatePieArcLabel.js +79 -0
  254. package/hooks/index.d.ts +2 -1
  255. package/hooks/index.js +13 -1
  256. package/hooks/useAxis.d.ts +5 -5
  257. package/hooks/useInteractionItemProps.js +11 -0
  258. package/hooks/useScale.d.ts +2 -2
  259. package/hooks/useScale.js +2 -2
  260. package/index.js +1 -1
  261. package/internals/animation/Transition.d.ts +37 -0
  262. package/internals/animation/Transition.js +89 -0
  263. package/internals/animation/animation.d.ts +4 -0
  264. package/internals/animation/animation.js +11 -0
  265. package/internals/animation/useAnimate.d.ts +19 -0
  266. package/internals/animation/useAnimate.js +80 -0
  267. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
  268. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
  269. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
  270. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +28 -0
  271. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +8 -6
  272. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +29 -22
  273. package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -0
  274. package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +12 -0
  275. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +7 -40
  276. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
  277. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -0
  278. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +81 -0
  279. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +7 -20
  280. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +36 -242
  281. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +5 -11
  282. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +9 -15
  283. package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +12 -0
  284. package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +17 -0
  285. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.d.ts +6 -4
  286. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.js +19 -13
  287. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +16 -32
  288. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3669 -0
  289. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +28 -0
  290. package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
  291. package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
  292. package/internals/shallowEqual.d.ts +8 -0
  293. package/internals/shallowEqual.js +37 -0
  294. package/models/axis.d.ts +8 -0
  295. package/modern/BarChart/AnimatedBarElement.d.ts +38 -8
  296. package/modern/BarChart/AnimatedBarElement.js +5 -5
  297. package/modern/BarChart/BarChart.js +2 -0
  298. package/modern/BarChart/BarClipPath.d.ts +19 -1
  299. package/modern/BarChart/BarClipPath.js +84 -17
  300. package/modern/BarChart/BarElement.d.ts +9 -20
  301. package/modern/BarChart/BarElement.js +28 -23
  302. package/modern/BarChart/BarLabel/BarLabel.d.ts +27 -854
  303. package/modern/BarChart/BarLabel/BarLabel.js +32 -5
  304. package/modern/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
  305. package/modern/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
  306. package/modern/BarChart/BarLabel/BarLabelItem.js +18 -6
  307. package/modern/BarChart/BarLabel/BarLabelPlot.js +16 -46
  308. package/modern/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
  309. package/modern/BarChart/BarLabel/barLabelClasses.js +4 -3
  310. package/modern/BarChart/BarPlot.js +37 -61
  311. package/modern/BarChart/barElementClasses.d.ts +21 -0
  312. package/modern/BarChart/barElementClasses.js +19 -0
  313. package/modern/BarChart/getRadius.d.ts +1 -1
  314. package/modern/BarChart/index.d.ts +2 -1
  315. package/modern/BarChart/index.js +2 -1
  316. package/modern/BarChart/seriesConfig/index.js +2 -1
  317. package/modern/BarChart/seriesConfig/tooltip.d.ts +2 -1
  318. package/modern/BarChart/seriesConfig/tooltip.js +12 -0
  319. package/modern/BarChart/types.d.ts +2 -2
  320. package/modern/BarChart/useBarChartProps.d.ts +2 -1
  321. package/modern/BarChart/useBarChartProps.js +19 -13
  322. package/modern/ChartContainer/ChartContainer.js +4 -0
  323. package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +8 -8
  324. package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +8 -8
  325. package/modern/ChartsLabel/ChartsLabelMark.js +0 -4
  326. package/modern/ChartsLabel/index.d.ts +1 -0
  327. package/modern/ChartsLabel/index.js +1 -0
  328. package/modern/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
  329. package/modern/ChartsOverlay/ChartsLoadingOverlay.js +1 -1
  330. package/modern/ChartsOverlay/ChartsNoDataOverlay.js +1 -1
  331. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
  332. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
  333. package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
  334. package/modern/ChartsTooltip/ChartsTooltipContainer.js +5 -9
  335. package/modern/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
  336. package/modern/ChartsTooltip/ChartsTooltipTable.js +23 -9
  337. package/modern/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
  338. package/modern/ChartsTooltip/chartsTooltipClasses.js +2 -2
  339. package/modern/ChartsTooltip/index.d.ts +1 -0
  340. package/modern/ChartsTooltip/index.js +1 -0
  341. package/modern/ChartsTooltip/useAxesTooltip.d.ts +7 -0
  342. package/modern/ChartsTooltip/useAxesTooltip.js +12 -0
  343. package/modern/ChartsTooltip/useAxisTooltip.d.ts +24 -3
  344. package/modern/ChartsTooltip/useAxisTooltip.js +72 -38
  345. package/modern/ChartsTooltip/useItemTooltip.js +4 -1
  346. package/modern/ChartsXAxis/ChartsXAxis.js +5 -2
  347. package/modern/ChartsYAxis/ChartsYAxis.js +69 -17
  348. package/modern/LineChart/AnimatedArea.js +5 -22
  349. package/modern/LineChart/AnimatedLine.d.ts +1 -4
  350. package/modern/LineChart/AnimatedLine.js +9 -24
  351. package/modern/LineChart/AppearingMask.d.ts +5 -0
  352. package/modern/LineChart/AppearingMask.js +23 -18
  353. package/modern/LineChart/CircleMarkElement.js +19 -25
  354. package/modern/LineChart/LineChart.js +2 -0
  355. package/modern/LineChart/LineHighlightPlot.js +3 -4
  356. package/modern/LineChart/MarkElement.js +17 -28
  357. package/modern/LineChart/MarkPlot.js +0 -1
  358. package/modern/LineChart/markElementClasses.d.ts +3 -0
  359. package/modern/LineChart/markElementClasses.js +4 -3
  360. package/modern/LineChart/seriesConfig/index.js +2 -1
  361. package/modern/LineChart/seriesConfig/tooltip.d.ts +2 -1
  362. package/modern/LineChart/seriesConfig/tooltip.js +6 -0
  363. package/modern/LineChart/useLineChartProps.d.ts +2 -1
  364. package/modern/LineChart/useLineChartProps.js +6 -4
  365. package/modern/PieChart/PieArc.d.ts +19 -11
  366. package/modern/PieChart/PieArc.js +36 -23
  367. package/modern/PieChart/PieArcLabel.d.ts +22 -13
  368. package/modern/PieChart/PieArcLabel.js +51 -47
  369. package/modern/PieChart/PieArcLabelPlot.js +16 -34
  370. package/modern/PieChart/PieArcPlot.js +21 -34
  371. package/modern/PieChart/seriesConfig/tooltip.js +3 -0
  372. package/modern/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +9 -5
  373. package/modern/RadarChart/RadarGrid/RadarGrid.d.ts +1 -1
  374. package/modern/RadarChart/RadarGrid/RadarGrid.js +5 -1
  375. package/modern/RadarChart/RadarGrid/useRadarGridData.d.ts +1 -1
  376. package/modern/RadarChart/RadarGrid/useRadarGridData.js +3 -0
  377. package/modern/RadarChart/RadarSeriesPlot/useRadarSeriesData.js +2 -2
  378. package/modern/ScatterChart/ScatterChart.js +2 -0
  379. package/modern/ScatterChart/useScatterChartProps.d.ts +2 -1
  380. package/modern/ScatterChart/useScatterChartProps.js +5 -3
  381. package/modern/SparkLineChart/SparkLineChart.js +2 -0
  382. package/modern/colorPalettes/colorPalettes.js +2 -2
  383. package/modern/constants/index.d.ts +1 -1
  384. package/modern/constants/index.js +1 -1
  385. package/modern/context/AnimationProvider/AnimationProvider.js +3 -6
  386. package/modern/hooks/animation/index.d.ts +6 -0
  387. package/modern/hooks/animation/index.js +6 -0
  388. package/modern/hooks/animation/useAnimateArea.d.ts +15 -0
  389. package/modern/hooks/animation/useAnimateArea.js +27 -0
  390. package/modern/hooks/animation/useAnimateBar.d.ts +17 -0
  391. package/modern/hooks/animation/useAnimateBar.js +56 -0
  392. package/modern/hooks/animation/useAnimateBarLabel.d.ts +19 -0
  393. package/modern/hooks/animation/useAnimateBarLabel.js +59 -0
  394. package/modern/hooks/animation/useAnimateLine.d.ts +14 -0
  395. package/modern/hooks/animation/useAnimateLine.js +26 -0
  396. package/modern/hooks/animation/useAnimatePieArc.d.ts +15 -0
  397. package/modern/hooks/animation/useAnimatePieArc.js +70 -0
  398. package/modern/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
  399. package/modern/hooks/animation/useAnimatePieArcLabel.js +72 -0
  400. package/modern/hooks/index.d.ts +2 -1
  401. package/modern/hooks/index.js +2 -1
  402. package/modern/hooks/useAxis.d.ts +5 -5
  403. package/modern/hooks/useInteractionItemProps.js +11 -0
  404. package/modern/hooks/useScale.d.ts +2 -2
  405. package/modern/hooks/useScale.js +2 -2
  406. package/modern/index.js +1 -1
  407. package/modern/internals/animation/Transition.d.ts +37 -0
  408. package/modern/internals/animation/Transition.js +83 -0
  409. package/modern/internals/animation/animation.d.ts +4 -0
  410. package/modern/internals/animation/animation.js +4 -0
  411. package/modern/internals/animation/useAnimate.d.ts +19 -0
  412. package/modern/internals/animation/useAnimate.js +74 -0
  413. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
  414. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
  415. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
  416. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +21 -0
  417. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +8 -6
  418. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +28 -22
  419. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -0
  420. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +1 -0
  421. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +9 -42
  422. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
  423. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -0
  424. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +75 -0
  425. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +7 -20
  426. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +36 -242
  427. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +4 -10
  428. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +9 -15
  429. package/modern/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +12 -0
  430. package/modern/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +8 -0
  431. package/modern/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.d.ts +6 -4
  432. package/modern/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.js +18 -13
  433. package/modern/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +16 -32
  434. package/modern/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3669 -0
  435. package/modern/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +22 -0
  436. package/modern/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
  437. package/modern/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
  438. package/modern/internals/shallowEqual.d.ts +8 -0
  439. package/modern/internals/shallowEqual.js +31 -0
  440. package/modern/models/axis.d.ts +8 -0
  441. package/modern/themeAugmentation/overrides.d.ts +1 -1
  442. package/package.json +8 -9
  443. package/themeAugmentation/overrides.d.ts +1 -1
  444. package/tsconfig.build.tsbuildinfo +1 -1
  445. package/PieChart/dataTransform/transition.d.ts +0 -4
  446. package/PieChart/dataTransform/transition.js +0 -145
  447. package/esm/PieChart/dataTransform/transition.d.ts +0 -4
  448. package/esm/PieChart/dataTransform/transition.js +0 -137
  449. package/modern/PieChart/dataTransform/transition.d.ts +0 -4
  450. package/modern/PieChart/dataTransform/transition.js +0 -137
@@ -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
@@ -12,15 +12,23 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
14
  var _styles = require("@mui/material/styles");
15
- var _web = require("@react-spring/web");
15
+ var _animation = require("../internals/animation/animation");
16
16
  var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
17
17
  var _useItemHighlighted = require("../hooks/useItemHighlighted");
18
18
  var _markElementClasses = require("./markElementClasses");
19
19
  var _useSelector = require("../internals/store/useSelector");
20
- var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
20
+ var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
21
21
  var _useStore = require("../internals/store/useStore");
22
22
  var _jsxRuntime = require("react/jsx-runtime");
23
23
  const _excluded = ["x", "y", "id", "classes", "color", "dataIndex", "onClick", "skipAnimation"];
24
+ const Circle = (0, _styles.styled)('circle')({
25
+ [`&.${_markElementClasses.markElementClasses.animate}`]: {
26
+ transitionDuration: `${_animation.ANIMATION_DURATION_MS}ms`,
27
+ transitionProperty: 'cx, cy',
28
+ transitionTimingFunction: _animation.ANIMATION_TIMING_FUNCTION
29
+ }
30
+ });
31
+
24
32
  /**
25
33
  * The line mark element that only render circle for performance improvement.
26
34
  *
@@ -58,33 +66,19 @@ function CircleMarkElement(props) {
58
66
  seriesId: id
59
67
  });
60
68
  const store = (0, _useStore.useStore)();
61
- const xAxisIdentifier = (0, _useSelector.useSelector)(store, _useChartInteraction.selectorChartsInteractionXAxis);
62
- const cx = (0, _web.useSpringValue)(x, {
63
- immediate: skipAnimation
64
- });
65
- const cy = (0, _web.useSpringValue)(y, {
66
- immediate: skipAnimation
67
- });
68
- React.useEffect(() => {
69
- cy.start(y, {
70
- immediate: skipAnimation
71
- });
72
- cx.start(x, {
73
- immediate: skipAnimation
74
- });
75
- }, [cy, y, cx, x, skipAnimation]);
69
+ const xAxisInteractionIndex = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsInteractionXAxisIndex);
76
70
  const ownerState = {
77
71
  id,
78
72
  classes: innerClasses,
79
- isHighlighted: xAxisIdentifier?.index === dataIndex || isHighlighted,
73
+ isHighlighted: xAxisInteractionIndex === dataIndex || isHighlighted,
80
74
  isFaded,
81
- color
75
+ color,
76
+ skipAnimation
82
77
  };
83
78
  const classes = (0, _markElementClasses.useUtilityClasses)(ownerState);
84
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.circle, (0, _extends2.default)({}, other, {
85
- // @ts-expect-error
86
- cx: cx,
87
- cy: cy,
79
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Circle, (0, _extends2.default)({}, other, {
80
+ cx: x,
81
+ cy: y,
88
82
  r: 5,
89
83
  fill: (theme.vars || theme).palette.background.paper,
90
84
  stroke: color,
@@ -245,6 +245,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
245
245
  height: _propTypes.default.number,
246
246
  hideTooltip: _propTypes.default.bool,
247
247
  id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
248
+ ignoreTooltip: _propTypes.default.bool,
248
249
  label: _propTypes.default.string,
249
250
  labelStyle: _propTypes.default.object,
250
251
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
@@ -300,6 +301,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
300
301
  fill: _propTypes.default.string,
301
302
  hideTooltip: _propTypes.default.bool,
302
303
  id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
304
+ ignoreTooltip: _propTypes.default.bool,
303
305
  label: _propTypes.default.string,
304
306
  labelStyle: _propTypes.default.object,
305
307
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
@@ -19,7 +19,7 @@ var _constants = require("../constants");
19
19
  var _useLineSeries = require("../hooks/useLineSeries");
20
20
  var _getColor = _interopRequireDefault(require("./seriesConfig/getColor"));
21
21
  var _ChartProvider = require("../context/ChartProvider");
22
- var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
22
+ var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
23
23
  var _useAxis = require("../hooks/useAxis");
24
24
  var _jsxRuntime = require("react/jsx-runtime");
25
25
  const _excluded = ["slots", "slotProps"];
@@ -52,9 +52,8 @@ function LineHighlightPlot(props) {
52
52
  instance
53
53
  } = (0, _ChartProvider.useChartContext)();
54
54
  const store = (0, _useStore.useStore)();
55
- const xAxisIdentifier = (0, _useSelector.useSelector)(store, _useChartInteraction.selectorChartsInteractionXAxis);
56
- const highlightedIndex = xAxisIdentifier?.index;
57
- if (highlightedIndex === undefined) {
55
+ const highlightedIndex = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsInteractionXAxisIndex);
56
+ if (highlightedIndex === null) {
58
57
  return null;
59
58
  }
60
59
  if (seriesData === undefined) {
@@ -13,17 +13,17 @@ var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
14
  var _styles = require("@mui/material/styles");
15
15
  var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
16
- var _web = require("@react-spring/web");
16
+ var _animation = require("../internals/animation/animation");
17
17
  var _getSymbol = require("../internals/getSymbol");
18
18
  var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
19
19
  var _useItemHighlighted = require("../hooks/useItemHighlighted");
20
+ var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
20
21
  var _markElementClasses = require("./markElementClasses");
21
- var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
22
22
  var _useSelector = require("../internals/store/useSelector");
23
23
  var _useStore = require("../internals/store/useStore");
24
24
  var _jsxRuntime = require("react/jsx-runtime");
25
25
  const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "onClick", "skipAnimation"];
26
- const MarkElementPath = (0, _styles.styled)(_web.animated.path, {
26
+ const MarkElementPath = (0, _styles.styled)('path', {
27
27
  name: 'MuiMarkElement',
28
28
  slot: 'Root',
29
29
  overridesResolver: (_, styles) => styles.root
@@ -33,7 +33,12 @@ const MarkElementPath = (0, _styles.styled)(_web.animated.path, {
33
33
  }) => ({
34
34
  fill: (theme.vars || theme).palette.background.paper,
35
35
  stroke: ownerState.color,
36
- strokeWidth: 2
36
+ strokeWidth: 2,
37
+ [`&.${_markElementClasses.markElementClasses.animate}`]: {
38
+ transitionDuration: `${_animation.ANIMATION_DURATION_MS}ms`,
39
+ transitionProperty: 'transform, transform-origin',
40
+ transitionTimingFunction: _animation.ANIMATION_TIMING_FUNCTION
41
+ }
37
42
  }));
38
43
  /**
39
44
  * Demos:
@@ -70,37 +75,22 @@ function MarkElement(props) {
70
75
  seriesId: id
71
76
  });
72
77
  const store = (0, _useStore.useStore)();
73
- const xAxisIdentifier = (0, _useSelector.useSelector)(store, _useChartInteraction.selectorChartsInteractionXAxis);
74
- const cx = (0, _web.useSpringValue)(x, {
75
- immediate: skipAnimation
76
- });
77
- const cy = (0, _web.useSpringValue)(y, {
78
- immediate: skipAnimation
79
- });
80
- React.useEffect(() => {
81
- cy.start(y, {
82
- immediate: skipAnimation
83
- });
84
- cx.start(x, {
85
- immediate: skipAnimation
86
- });
87
- }, [cy, y, cx, x, skipAnimation]);
78
+ const xAxisInteractionIndex = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsInteractionXAxisIndex);
88
79
  const ownerState = {
89
80
  id,
90
81
  classes: innerClasses,
91
- isHighlighted: xAxisIdentifier?.index === dataIndex || isHighlighted,
82
+ isHighlighted: xAxisInteractionIndex === dataIndex || isHighlighted,
92
83
  isFaded,
93
- color
84
+ color,
85
+ skipAnimation
94
86
  };
95
87
  const classes = (0, _markElementClasses.useUtilityClasses)(ownerState);
96
88
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(MarkElementPath, (0, _extends2.default)({}, other, {
97
89
  style: {
98
- transform: (0, _web.to)([cx, cy], (pX, pY) => `translate(${pX}px, ${pY}px)`),
99
- transformOrigin: (0, _web.to)([cx, cy], (pX, pY) => `${pX}px ${pY}px`)
90
+ transform: `translate(${x}px, ${y}px)`,
91
+ transformOrigin: `${x}px ${y}px`
100
92
  },
101
- ownerState: ownerState
102
- // @ts-expect-error
103
- ,
93
+ ownerState: ownerState,
104
94
  className: classes.root,
105
95
  d: (0, _d3Shape.symbol)(_d3Shape.symbolsFill[(0, _getSymbol.getSymbol)(shape)])(),
106
96
  onClick: onClick,
@@ -124,7 +114,6 @@ process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
124
114
  shape: _propTypes.default.oneOf(['circle', 'cross', 'diamond', 'square', 'star', 'triangle', 'wye']).isRequired,
125
115
  /**
126
116
  * If `true`, animations are skipped.
127
- * @default false
128
117
  */
129
118
  skipAnimation: _propTypes.default.bool
130
119
  } : void 0;
@@ -171,7 +171,6 @@ process.env.NODE_ENV !== "production" ? MarkPlot.propTypes = {
171
171
  onItemClick: _propTypes.default.func,
172
172
  /**
173
173
  * If `true`, animations are skipped.
174
- * @default false
175
174
  */
176
175
  skipAnimation: _propTypes.default.bool,
177
176
  /**
@@ -6,6 +6,8 @@ export interface MarkElementClasses {
6
6
  highlighted: string;
7
7
  /** Styles applied to the root element when faded. */
8
8
  faded: string;
9
+ /** Styles applied to the root element when animation is not skipped. */
10
+ animate: string;
9
11
  }
10
12
  export type MarkElementClassKey = keyof MarkElementClasses;
11
13
  export interface MarkElementOwnerState {
@@ -14,6 +16,7 @@ export interface MarkElementOwnerState {
14
16
  isFaded: boolean;
15
17
  isHighlighted: boolean;
16
18
  classes?: Partial<MarkElementClasses>;
19
+ skipAnimation?: boolean;
17
20
  }
18
21
  export declare function getMarkElementUtilityClass(slot: string): string;
19
22
  export declare const markElementClasses: MarkElementClasses;
@@ -12,16 +12,17 @@ var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generat
12
12
  function getMarkElementUtilityClass(slot) {
13
13
  return (0, _generateUtilityClass.default)('MuiMarkElement', slot);
14
14
  }
15
- const markElementClasses = exports.markElementClasses = (0, _generateUtilityClasses.default)('MuiMarkElement', ['root', 'highlighted', 'faded']);
15
+ const markElementClasses = exports.markElementClasses = (0, _generateUtilityClasses.default)('MuiMarkElement', ['root', 'highlighted', 'faded', 'animate']);
16
16
  const useUtilityClasses = ownerState => {
17
17
  const {
18
18
  classes,
19
19
  id,
20
20
  isFaded,
21
- isHighlighted
21
+ isHighlighted,
22
+ skipAnimation
22
23
  } = ownerState;
23
24
  const slots = {
24
- root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded']
25
+ root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded', skipAnimation ? undefined : 'animate']
25
26
  };
26
27
  return (0, _composeClasses.default)(slots, getMarkElementUtilityClass, classes);
27
28
  };