@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.
- package/BarChart/BarChart.js +1 -1
- package/BarChart/BarPlot.d.ts +1 -1
- package/BarChart/BarPlot.js +6 -3
- package/BarChart/useBarChartProps.js +2 -2
- package/CHANGELOG.md +200 -31
- package/ChartContainer/ChartContainer.d.ts +3 -2
- package/ChartContainer/ChartContainer.js +11 -2
- package/ChartContainer/useChartContainerProps.d.ts +2 -0
- package/ChartContainer/useChartContainerProps.js +7 -5
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.d.ts +2 -2
- package/LineChart/AreaPlot.js +3 -1
- package/LineChart/LinePlot.js +3 -1
- package/LineChart/MarkPlot.d.ts +1 -1
- package/LineChart/MarkPlot.js +10 -8
- package/LineChart/useLineChartProps.d.ts +10 -10
- package/LineChart/useLineChartProps.js +4 -5
- package/PieChart/PieChart.js +3 -3
- package/PieChart/PiePlot.js +3 -1
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +5 -0
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +1 -1
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +4 -2
- package/ScatterChart/ScatterChart.js +5 -0
- package/ScatterChart/extremums.js +4 -4
- package/ScatterChart/formatter.js +22 -3
- package/SparkLineChart/SparkLineChart.js +5 -0
- package/context/AnimationProvider/Animation.types.d.ts +15 -0
- package/context/AnimationProvider/Animation.types.js +1 -0
- package/context/AnimationProvider/AnimationContext.d.ts +4 -0
- package/context/AnimationProvider/AnimationContext.js +10 -0
- package/context/AnimationProvider/AnimationProvider.d.ts +4 -0
- package/context/AnimationProvider/AnimationProvider.js +55 -0
- package/context/AnimationProvider/index.d.ts +4 -0
- package/context/AnimationProvider/index.js +4 -0
- package/context/AnimationProvider/useSkipAnimation.d.ts +6 -0
- package/context/AnimationProvider/useSkipAnimation.js +20 -0
- package/index.js +1 -1
- package/internals/defaultizeColor.d.ts +7 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/models/seriesType/scatter.d.ts +25 -1
- package/modern/BarChart/BarChart.js +1 -1
- package/modern/BarChart/BarPlot.js +6 -3
- package/modern/BarChart/useBarChartProps.js +2 -2
- package/modern/ChartContainer/ChartContainer.js +11 -2
- package/modern/ChartContainer/useChartContainerProps.js +7 -5
- package/modern/LineChart/AreaPlot.js +3 -1
- package/modern/LineChart/LinePlot.js +3 -1
- package/modern/LineChart/MarkPlot.js +10 -8
- package/modern/LineChart/useLineChartProps.js +4 -5
- package/modern/PieChart/PieChart.js +3 -3
- package/modern/PieChart/PiePlot.js +3 -1
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +5 -0
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +4 -2
- package/modern/ScatterChart/ScatterChart.js +5 -0
- package/modern/ScatterChart/extremums.js +4 -4
- package/modern/ScatterChart/formatter.js +22 -3
- package/modern/SparkLineChart/SparkLineChart.js +5 -0
- package/modern/context/AnimationProvider/Animation.types.js +1 -0
- package/modern/context/AnimationProvider/AnimationContext.js +10 -0
- package/modern/context/AnimationProvider/AnimationProvider.js +55 -0
- package/modern/context/AnimationProvider/index.js +4 -0
- package/modern/context/AnimationProvider/useSkipAnimation.js +20 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/node/BarChart/BarChart.js +1 -1
- package/node/BarChart/BarPlot.js +4 -2
- package/node/BarChart/useBarChartProps.js +2 -2
- package/node/ChartContainer/ChartContainer.js +11 -2
- package/node/ChartContainer/useChartContainerProps.js +7 -5
- package/node/LineChart/AreaPlot.js +3 -1
- package/node/LineChart/LinePlot.js +3 -1
- package/node/LineChart/MarkPlot.js +10 -8
- package/node/LineChart/useLineChartProps.js +4 -5
- package/node/PieChart/PieChart.js +3 -3
- package/node/PieChart/PiePlot.js +3 -1
- package/node/ResponsiveChartContainer/ResponsiveChartContainer.js +5 -0
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +4 -2
- package/node/ScatterChart/ScatterChart.js +5 -0
- package/node/ScatterChart/extremums.js +4 -4
- package/node/ScatterChart/formatter.js +23 -3
- package/node/SparkLineChart/SparkLineChart.js +5 -0
- package/node/context/AnimationProvider/Animation.types.js +5 -0
- package/node/context/AnimationProvider/AnimationContext.js +17 -0
- package/node/context/AnimationProvider/AnimationProvider.js +60 -0
- package/node/context/AnimationProvider/index.js +49 -0
- package/node/context/AnimationProvider/useSkipAnimation.js +25 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +12 -8
- package/package.json +4 -4
- package/hooks/useReducedMotion.d.ts +0 -8
- package/hooks/useReducedMotion.js +0 -39
- package/modern/hooks/useReducedMotion.js +0 -39
- 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;
|