@mui/x-charts 7.20.0 → 7.22.0

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 (93) hide show
  1. package/BarChart/BarChart.js +1 -1
  2. package/BarChart/BarPlot.d.ts +1 -1
  3. package/BarChart/BarPlot.js +6 -3
  4. package/BarChart/useBarChartProps.js +2 -2
  5. package/CHANGELOG.md +200 -31
  6. package/ChartContainer/ChartContainer.d.ts +3 -2
  7. package/ChartContainer/ChartContainer.js +11 -2
  8. package/ChartContainer/useChartContainerProps.d.ts +2 -0
  9. package/ChartContainer/useChartContainerProps.js +7 -5
  10. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.d.ts +2 -2
  11. package/LineChart/AreaPlot.js +3 -1
  12. package/LineChart/LinePlot.js +3 -1
  13. package/LineChart/MarkPlot.d.ts +1 -1
  14. package/LineChart/MarkPlot.js +10 -8
  15. package/LineChart/useLineChartProps.d.ts +10 -10
  16. package/LineChart/useLineChartProps.js +4 -5
  17. package/PieChart/PieChart.js +3 -3
  18. package/PieChart/PiePlot.js +3 -1
  19. package/ResponsiveChartContainer/ResponsiveChartContainer.js +5 -0
  20. package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +1 -1
  21. package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +4 -2
  22. package/ScatterChart/ScatterChart.js +5 -0
  23. package/ScatterChart/extremums.js +4 -4
  24. package/ScatterChart/formatter.js +22 -3
  25. package/SparkLineChart/SparkLineChart.js +5 -0
  26. package/context/AnimationProvider/Animation.types.d.ts +15 -0
  27. package/context/AnimationProvider/Animation.types.js +1 -0
  28. package/context/AnimationProvider/AnimationContext.d.ts +4 -0
  29. package/context/AnimationProvider/AnimationContext.js +10 -0
  30. package/context/AnimationProvider/AnimationProvider.d.ts +4 -0
  31. package/context/AnimationProvider/AnimationProvider.js +55 -0
  32. package/context/AnimationProvider/index.d.ts +4 -0
  33. package/context/AnimationProvider/index.js +4 -0
  34. package/context/AnimationProvider/useSkipAnimation.d.ts +6 -0
  35. package/context/AnimationProvider/useSkipAnimation.js +20 -0
  36. package/index.js +1 -1
  37. package/internals/defaultizeColor.d.ts +7 -1
  38. package/internals/index.d.ts +1 -1
  39. package/internals/index.js +1 -1
  40. package/models/seriesType/scatter.d.ts +25 -1
  41. package/modern/BarChart/BarChart.js +1 -1
  42. package/modern/BarChart/BarPlot.js +6 -3
  43. package/modern/BarChart/useBarChartProps.js +2 -2
  44. package/modern/ChartContainer/ChartContainer.js +11 -2
  45. package/modern/ChartContainer/useChartContainerProps.js +7 -5
  46. package/modern/LineChart/AreaPlot.js +3 -1
  47. package/modern/LineChart/LinePlot.js +3 -1
  48. package/modern/LineChart/MarkPlot.js +10 -8
  49. package/modern/LineChart/useLineChartProps.js +4 -5
  50. package/modern/PieChart/PieChart.js +3 -3
  51. package/modern/PieChart/PiePlot.js +3 -1
  52. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +5 -0
  53. package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +4 -2
  54. package/modern/ScatterChart/ScatterChart.js +5 -0
  55. package/modern/ScatterChart/extremums.js +4 -4
  56. package/modern/ScatterChart/formatter.js +22 -3
  57. package/modern/SparkLineChart/SparkLineChart.js +5 -0
  58. package/modern/context/AnimationProvider/Animation.types.js +1 -0
  59. package/modern/context/AnimationProvider/AnimationContext.js +10 -0
  60. package/modern/context/AnimationProvider/AnimationProvider.js +55 -0
  61. package/modern/context/AnimationProvider/index.js +4 -0
  62. package/modern/context/AnimationProvider/useSkipAnimation.js +20 -0
  63. package/modern/index.js +1 -1
  64. package/modern/internals/index.js +1 -1
  65. package/node/BarChart/BarChart.js +1 -1
  66. package/node/BarChart/BarPlot.js +4 -2
  67. package/node/BarChart/useBarChartProps.js +2 -2
  68. package/node/ChartContainer/ChartContainer.js +11 -2
  69. package/node/ChartContainer/useChartContainerProps.js +7 -5
  70. package/node/LineChart/AreaPlot.js +3 -1
  71. package/node/LineChart/LinePlot.js +3 -1
  72. package/node/LineChart/MarkPlot.js +10 -8
  73. package/node/LineChart/useLineChartProps.js +4 -5
  74. package/node/PieChart/PieChart.js +3 -3
  75. package/node/PieChart/PiePlot.js +3 -1
  76. package/node/ResponsiveChartContainer/ResponsiveChartContainer.js +5 -0
  77. package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +4 -2
  78. package/node/ScatterChart/ScatterChart.js +5 -0
  79. package/node/ScatterChart/extremums.js +4 -4
  80. package/node/ScatterChart/formatter.js +23 -3
  81. package/node/SparkLineChart/SparkLineChart.js +5 -0
  82. package/node/context/AnimationProvider/Animation.types.js +5 -0
  83. package/node/context/AnimationProvider/AnimationContext.js +17 -0
  84. package/node/context/AnimationProvider/AnimationProvider.js +60 -0
  85. package/node/context/AnimationProvider/index.js +49 -0
  86. package/node/context/AnimationProvider/useSkipAnimation.js +25 -0
  87. package/node/index.js +1 -1
  88. package/node/internals/index.js +12 -8
  89. package/package.json +4 -4
  90. package/hooks/useReducedMotion.d.ts +0 -8
  91. package/hooks/useReducedMotion.js +0 -39
  92. package/modern/hooks/useReducedMotion.js +0 -39
  93. package/node/hooks/useReducedMotion.js +0 -45
@@ -1,39 +0,0 @@
1
- 'use client';
2
-
3
- import { useIsomorphicLayoutEffect, Globals } from '@react-spring/web';
4
- const handleMediaChange = event => {
5
- Globals.assign({
6
- // Modification such the react-spring implementation such that this hook can remove animation but never activate animation.
7
- skipAnimation: event.matches || undefined
8
- });
9
- };
10
-
11
- /**
12
- * Returns `boolean` or `null`, used to automatically
13
- * set skipAnimations to the value of the user's
14
- * `prefers-reduced-motion` query.
15
- *
16
- * The return value, post-effect, is the value of their preferred setting
17
- */
18
- export const useReducedMotion = () => {
19
- // Taken from: https://github.com/pmndrs/react-spring/blob/fd65b605b85c3a24143c4ce9dd322fdfca9c66be/packages/shared/src/hooks/useReducedMotion.ts
20
-
21
- useIsomorphicLayoutEffect(() => {
22
- // Skip animation test/jsdom
23
- const shouldSkipAnimation = !window?.matchMedia;
24
- if (shouldSkipAnimation) {
25
- handleMediaChange({
26
- matches: true
27
- });
28
- return undefined;
29
- }
30
- const mql = window.matchMedia('(prefers-reduced-motion)');
31
- handleMediaChange(mql);
32
-
33
- // MatchMedia is not fully supported in all environments, so we need to check if it exists before calling addEventListener
34
- mql.addEventListener?.('change', handleMediaChange);
35
- return () => {
36
- mql.removeEventListener?.('change', handleMediaChange);
37
- };
38
- }, []);
39
- };
@@ -1,45 +0,0 @@
1
- "use strict";
2
- 'use client';
3
-
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.useReducedMotion = void 0;
8
- var _web = require("@react-spring/web");
9
- const handleMediaChange = event => {
10
- _web.Globals.assign({
11
- // Modification such the react-spring implementation such that this hook can remove animation but never activate animation.
12
- skipAnimation: event.matches || undefined
13
- });
14
- };
15
-
16
- /**
17
- * Returns `boolean` or `null`, used to automatically
18
- * set skipAnimations to the value of the user's
19
- * `prefers-reduced-motion` query.
20
- *
21
- * The return value, post-effect, is the value of their preferred setting
22
- */
23
- const useReducedMotion = () => {
24
- // Taken from: https://github.com/pmndrs/react-spring/blob/fd65b605b85c3a24143c4ce9dd322fdfca9c66be/packages/shared/src/hooks/useReducedMotion.ts
25
-
26
- (0, _web.useIsomorphicLayoutEffect)(() => {
27
- // Skip animation test/jsdom
28
- const shouldSkipAnimation = !window?.matchMedia;
29
- if (shouldSkipAnimation) {
30
- handleMediaChange({
31
- matches: true
32
- });
33
- return undefined;
34
- }
35
- const mql = window.matchMedia('(prefers-reduced-motion)');
36
- handleMediaChange(mql);
37
-
38
- // MatchMedia is not fully supported in all environments, so we need to check if it exists before calling addEventListener
39
- mql.addEventListener?.('change', handleMediaChange);
40
- return () => {
41
- mql.removeEventListener?.('change', handleMediaChange);
42
- };
43
- }, []);
44
- };
45
- exports.useReducedMotion = useReducedMotion;