@mui/x-charts 7.18.0 → 7.20.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 (90) hide show
  1. package/BarChart/BarChart.d.ts +1 -1
  2. package/BarChart/BarChart.js +1 -1
  3. package/BarChart/BarElement.d.ts +1 -1
  4. package/BarChart/BarLabel/BarLabel.d.ts +1 -1
  5. package/BarChart/formatter.js +5 -4
  6. package/CHANGELOG.md +213 -11
  7. package/ChartContainer/useDefaultizeAxis.d.ts +4 -4
  8. package/ChartContainer/useDefaultizeAxis.js +1 -1
  9. package/ChartsAxis/ChartsAxis.js +4 -4
  10. package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -1
  11. package/ChartsGrid/styledCommonents.d.ts +2 -2
  12. package/ChartsLegend/DefaultChartsLegend.js +1 -1
  13. package/ChartsLegend/LegendPerItem.d.ts +1 -1
  14. package/ChartsLegend/LegendPerItem.js +1 -1
  15. package/ChartsLegend/PiecewiseColorLegend.js +1 -1
  16. package/ChartsReferenceLine/common.d.ts +1 -1
  17. package/ChartsTooltip/ChartsTooltipTable.d.ts +5 -5
  18. package/LineChart/AnimatedArea.d.ts +1 -1
  19. package/LineChart/AnimatedArea.js +9 -45
  20. package/LineChart/AnimatedLine.d.ts +1 -1
  21. package/LineChart/AnimatedLine.js +9 -36
  22. package/LineChart/AppearingMask.d.ts +12 -0
  23. package/LineChart/AppearingMask.js +42 -0
  24. package/LineChart/LineChart.d.ts +1 -1
  25. package/LineChart/LineChart.js +1 -1
  26. package/LineChart/formatter.js +5 -5
  27. package/PieChart/PieChart.d.ts +1 -1
  28. package/PieChart/PieChart.js +1 -1
  29. package/ResponsiveChartContainer/ResizableContainer.d.ts +1 -1
  30. package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +1 -1
  31. package/ScatterChart/ScatterChart.d.ts +1 -1
  32. package/ScatterChart/ScatterChart.js +1 -1
  33. package/SparkLineChart/SparkLineChart.d.ts +1 -1
  34. package/context/CartesianProvider/defaultizeAxis.d.ts +4 -4
  35. package/context/PluginProvider/mergePlugins.d.ts +6 -6
  36. package/context/ZAxisContextProvider.js +1 -1
  37. package/hooks/useReducedMotion.js +2 -2
  38. package/hooks/useSeries.d.ts +4 -4
  39. package/hooks/useSeries.js +4 -4
  40. package/index.js +1 -1
  41. package/internals/components/AxisSharedComponents.d.ts +1 -1
  42. package/internals/configInit.d.ts +1 -1
  43. package/internals/defaultizeColor.d.ts +8 -8
  44. package/internals/domUtils.js +1 -1
  45. package/internals/geometry.js +3 -5
  46. package/internals/getPercentageValue.js +1 -1
  47. package/models/seriesType/line.d.ts +5 -0
  48. package/modern/BarChart/BarChart.js +1 -1
  49. package/modern/BarChart/formatter.js +5 -4
  50. package/modern/ChartContainer/useDefaultizeAxis.js +1 -1
  51. package/modern/ChartsAxis/ChartsAxis.js +4 -4
  52. package/modern/ChartsLegend/DefaultChartsLegend.js +1 -1
  53. package/modern/ChartsLegend/LegendPerItem.js +1 -1
  54. package/modern/ChartsLegend/PiecewiseColorLegend.js +1 -1
  55. package/modern/LineChart/AnimatedArea.js +9 -45
  56. package/modern/LineChart/AnimatedLine.js +9 -36
  57. package/modern/LineChart/AppearingMask.js +42 -0
  58. package/modern/LineChart/LineChart.js +1 -1
  59. package/modern/LineChart/formatter.js +5 -5
  60. package/modern/PieChart/PieChart.js +1 -1
  61. package/modern/ScatterChart/ScatterChart.js +1 -1
  62. package/modern/context/ZAxisContextProvider.js +1 -1
  63. package/modern/hooks/useReducedMotion.js +2 -2
  64. package/modern/hooks/useSeries.js +4 -4
  65. package/modern/index.js +1 -1
  66. package/modern/internals/domUtils.js +1 -1
  67. package/modern/internals/geometry.js +3 -5
  68. package/modern/internals/getPercentageValue.js +1 -1
  69. package/node/BarChart/BarChart.js +1 -1
  70. package/node/BarChart/formatter.js +5 -4
  71. package/node/ChartContainer/useDefaultizeAxis.js +1 -1
  72. package/node/ChartsAxis/ChartsAxis.js +4 -4
  73. package/node/ChartsLegend/DefaultChartsLegend.js +1 -1
  74. package/node/ChartsLegend/LegendPerItem.js +1 -1
  75. package/node/ChartsLegend/PiecewiseColorLegend.js +1 -1
  76. package/node/LineChart/AnimatedArea.js +8 -44
  77. package/node/LineChart/AnimatedLine.js +8 -35
  78. package/node/LineChart/AppearingMask.js +48 -0
  79. package/node/LineChart/LineChart.js +1 -1
  80. package/node/LineChart/formatter.js +5 -5
  81. package/node/PieChart/PieChart.js +1 -1
  82. package/node/ScatterChart/ScatterChart.js +1 -1
  83. package/node/context/ZAxisContextProvider.js +1 -1
  84. package/node/hooks/useReducedMotion.js +2 -2
  85. package/node/hooks/useSeries.js +4 -4
  86. package/node/index.js +1 -1
  87. package/node/internals/domUtils.js +1 -1
  88. package/node/internals/geometry.js +3 -5
  89. package/node/internals/getPercentageValue.js +1 -1
  90. package/package.json +5 -5
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
10
+ var _warning = require("@mui/x-internals/warning");
10
11
  var _stackSeries = require("../internals/stackSeries");
11
12
  var _defaultizeValueFormatter = require("../internals/defaultizeValueFormatter");
12
- let warnOnce = false;
13
13
  const formatter = (params, dataset) => {
14
14
  const {
15
15
  seriesOrder,
@@ -57,9 +57,10 @@ const formatter = (params, dataset) => {
57
57
  data: dataKey ? dataset.map(data => {
58
58
  const value = data[dataKey];
59
59
  if (typeof value !== 'number') {
60
- if (process.env.NODE_ENV !== 'production' && !warnOnce && value !== null) {
61
- warnOnce = true;
62
- console.error([`MUI X charts: your dataset key "${dataKey}" is used for plotting bars, but contains nonnumerical elements.`, 'Bar plots only support numbers and null values.'].join('\n'));
60
+ if (process.env.NODE_ENV !== 'production') {
61
+ if (value !== null) {
62
+ (0, _warning.warnOnce)([`MUI X: your dataset key "${dataKey}" is used for plotting bars, but contains nonnumerical elements.`, 'Bar plots only support numbers and null values.']);
63
+ }
63
64
  }
64
65
  return 0;
65
66
  }
@@ -25,7 +25,7 @@ const defaultizeAxis = (inAxis, dataset, axisName) => {
25
25
  return axisConfig;
26
26
  }
27
27
  if (dataset === undefined) {
28
- throw Error(`MUI X: ${axisName}-axis uses \`dataKey\` but no \`dataset\` is provided.`);
28
+ throw new Error(`MUI X: ${axisName}-axis uses \`dataKey\` but no \`dataset\` is provided.`);
29
29
  }
30
30
  return (0, _extends2.default)({}, axisConfig, {
31
31
  data: dataset.map(d => d[dataKey])
@@ -66,16 +66,16 @@ function ChartsAxis(props) {
66
66
  const topId = getAxisId(topAxis, xAxisIds[0]);
67
67
  const rightId = getAxisId(rightAxis, yAxisIds[0]);
68
68
  if (topId !== null && !xAxis[topId]) {
69
- throw Error([`MUI X: id used for top axis "${topId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
69
+ throw new Error([`MUI X: id used for top axis "${topId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
70
70
  }
71
71
  if (leftId !== null && !yAxis[leftId]) {
72
- throw Error([`MUI X: id used for left axis "${leftId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
72
+ throw new Error([`MUI X: id used for left axis "${leftId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
73
73
  }
74
74
  if (rightId !== null && !yAxis[rightId]) {
75
- throw Error([`MUI X: id used for right axis "${rightId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
75
+ throw new Error([`MUI X: id used for right axis "${rightId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
76
76
  }
77
77
  if (bottomId !== null && !xAxis[bottomId]) {
78
- throw Error([`MUI X: id used for bottom axis "${bottomId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
78
+ throw new Error([`MUI X: id used for bottom axis "${bottomId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
79
79
  }
80
80
  const topAxisProps = mergeProps(topAxis, slots, slotProps);
81
81
  const bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
@@ -33,7 +33,7 @@ function DefaultChartsLegend(props) {
33
33
  }
34
34
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LegendPerItem.LegendPerItem, (0, _extends2.default)({}, other, {
35
35
  itemsToDisplay: seriesToDisplay,
36
- onItemClick: onItemClick ? (e, i) => onItemClick(e, seriesContextBuilder(seriesToDisplay[i]), i) : undefined
36
+ onItemClick: onItemClick ? (event, i) => onItemClick(event, seriesContextBuilder(seriesToDisplay[i]), i) : undefined
37
37
  }));
38
38
  }
39
39
  process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
@@ -130,7 +130,7 @@ function LegendPerItem(props) {
130
130
  markGap: markGap,
131
131
  labelStyle: labelStyle,
132
132
  classes: classes,
133
- onClick: onItemClick ? e => onItemClick(e, i) : undefined
133
+ onClick: onItemClick ? event => onItemClick(event, i) : undefined
134
134
  })))
135
135
  })
136
136
  });
@@ -87,7 +87,7 @@ function PiecewiseColorLegend(props) {
87
87
  }).filter(_notNull.notNull);
88
88
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LegendPerItem.LegendPerItem, (0, _extends2.default)({}, other, {
89
89
  itemsToDisplay: itemsToDisplay,
90
- onItemClick: onItemClick ? (e, i) => onItemClick(e, piecewiseColorContextBuilder(itemsToDisplay[i]), i) : undefined
90
+ onItemClick: onItemClick ? (event, i) => onItemClick(event, piecewiseColorContextBuilder(itemsToDisplay[i]), i) : undefined
91
91
  }));
92
92
  }
93
93
  process.env.NODE_ENV !== "production" ? PiecewiseColorLegend.propTypes = {
@@ -15,9 +15,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
  var _styles = require("@mui/material/styles");
16
16
  var _web = require("@react-spring/web");
17
17
  var _d3Color = require("@mui/x-charts-vendor/d3-color");
18
- var _cleanId = require("../internals/cleanId");
19
- var _hooks = require("../hooks");
20
18
  var _useStringInterpolator = require("../internals/useStringInterpolator");
19
+ var _AppearingMask = require("./AppearingMask");
21
20
  var _jsxRuntime = require("react/jsx-runtime");
22
21
  const _excluded = ["d", "skipAnimation", "ownerState"];
23
22
  const AreaElementPath = exports.AreaElementPath = (0, _styles.styled)(_web.animated.path, {
@@ -49,32 +48,7 @@ function AnimatedArea(props) {
49
48
  ownerState
50
49
  } = props,
51
50
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
52
- const {
53
- left,
54
- top,
55
- right,
56
- bottom,
57
- width,
58
- height
59
- } = (0, _hooks.useDrawingArea)();
60
- const chartId = (0, _hooks.useChartId)();
61
51
  const stringInterpolator = (0, _useStringInterpolator.useStringInterpolator)(d);
62
- const transitionAppear = (0, _web.useTransition)([1], {
63
- from: {
64
- animatedWidth: left
65
- },
66
- to: {
67
- animatedWidth: width + left + right
68
- },
69
- enter: {
70
- animatedWidth: width + left + right
71
- },
72
- leave: {
73
- animatedWidth: left
74
- },
75
- reset: false,
76
- immediate: skipAnimation
77
- });
78
52
  const transitionChange = (0, _web.useTransition)([stringInterpolator], {
79
53
  from: {
80
54
  value: 0
@@ -88,23 +62,13 @@ function AnimatedArea(props) {
88
62
  reset: false,
89
63
  immediate: skipAnimation
90
64
  });
91
- const clipId = (0, _cleanId.cleanId)(`${chartId}-${ownerState.id}-area-clip`);
92
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
93
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
94
- id: clipId,
95
- children: transitionAppear(style => /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.rect, {
96
- x: 0,
97
- y: 0,
98
- width: style.animatedWidth,
99
- height: top + height + bottom
100
- }))
101
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
102
- clipPath: `url(#${clipId})`,
103
- children: transitionChange((style, interpolator) => /*#__PURE__*/(0, _jsxRuntime.jsx)(AreaElementPath, (0, _extends2.default)({}, other, {
104
- ownerState: ownerState,
105
- d: style.value.to(interpolator)
106
- })))
107
- })]
65
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppearingMask.AppearingMask, {
66
+ skipAnimation: skipAnimation,
67
+ id: `${ownerState.id}-area-clip`,
68
+ children: transitionChange((style, interpolator) => /*#__PURE__*/(0, _jsxRuntime.jsx)(AreaElementPath, (0, _extends2.default)({}, other, {
69
+ ownerState: ownerState,
70
+ d: style.value.to(interpolator)
71
+ })))
108
72
  });
109
73
  }
110
74
  process.env.NODE_ENV !== "production" ? AnimatedArea.propTypes = {
@@ -15,10 +15,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
  var _web = require("@react-spring/web");
16
16
  var _d3Color = require("@mui/x-charts-vendor/d3-color");
17
17
  var _styles = require("@mui/material/styles");
18
- var _cleanId = require("../internals/cleanId");
19
- var _useChartId = require("../hooks/useChartId");
20
- var _useDrawingArea = require("../hooks/useDrawingArea");
21
18
  var _useStringInterpolator = require("../internals/useStringInterpolator");
19
+ var _AppearingMask = require("./AppearingMask");
22
20
  var _jsxRuntime = require("react/jsx-runtime");
23
21
  const _excluded = ["d", "skipAnimation", "ownerState"];
24
22
  const LineElementPath = exports.LineElementPath = (0, _styles.styled)(_web.animated.path, {
@@ -52,22 +50,7 @@ function AnimatedLine(props) {
52
50
  ownerState
53
51
  } = props,
54
52
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
55
- const drawingArea = (0, _useDrawingArea.useDrawingArea)();
56
- const chartId = (0, _useChartId.useChartId)();
57
53
  const stringInterpolator = (0, _useStringInterpolator.useStringInterpolator)(d);
58
- const transitionAppear = (0, _web.useTransition)([drawingArea], {
59
- from: v => ({
60
- animatedWidth: v.left
61
- }),
62
- enter: v => ({
63
- animatedWidth: v.width + v.left + v.right
64
- }),
65
- leave: v => ({
66
- animatedWidth: v.width + v.left + v.right
67
- }),
68
- reset: false,
69
- immediate: skipAnimation
70
- });
71
54
  const transitionChange = (0, _web.useTransition)([stringInterpolator], {
72
55
  from: {
73
56
  value: 0
@@ -81,23 +64,13 @@ function AnimatedLine(props) {
81
64
  reset: false,
82
65
  immediate: skipAnimation
83
66
  });
84
- const clipId = (0, _cleanId.cleanId)(`${chartId}-${ownerState.id}-line-clip`);
85
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
86
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
87
- id: clipId,
88
- children: transitionAppear(style => /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.rect, {
89
- x: 0,
90
- y: 0,
91
- width: style.animatedWidth,
92
- height: drawingArea.top + drawingArea.height + drawingArea.bottom
93
- }))
94
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
95
- clipPath: `url(#${clipId})`,
96
- children: transitionChange((style, interpolator) => /*#__PURE__*/(0, _jsxRuntime.jsx)(LineElementPath, (0, _extends2.default)({}, other, {
97
- ownerState: ownerState,
98
- d: style.value.to(interpolator)
99
- })))
100
- })]
67
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppearingMask.AppearingMask, {
68
+ skipAnimation: skipAnimation,
69
+ id: `${ownerState.id}-line-clip`,
70
+ children: transitionChange((style, interpolator) => /*#__PURE__*/(0, _jsxRuntime.jsx)(LineElementPath, (0, _extends2.default)({}, other, {
71
+ ownerState: ownerState,
72
+ d: style.value.to(interpolator)
73
+ })))
101
74
  });
102
75
  }
103
76
  process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.AppearingMask = AppearingMask;
9
+ var React = _interopRequireWildcard(require("react"));
10
+ var _web = require("@react-spring/web");
11
+ var _cleanId = require("../internals/cleanId");
12
+ var _hooks = require("../hooks");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ /**
15
+ * @ignore - internal component.
16
+ */
17
+ function AppearingMask(props) {
18
+ const drawingArea = (0, _hooks.useDrawingArea)();
19
+ const chartId = (0, _hooks.useChartId)();
20
+ const transitionAppear = (0, _web.useTransition)([drawingArea], {
21
+ from: 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
+ const clipId = (0, _cleanId.cleanId)(`${chartId}-${props.id}`);
34
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
35
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
36
+ id: clipId,
37
+ children: transitionAppear(style => /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.rect, {
38
+ x: 0,
39
+ y: 0,
40
+ width: style.animatedWidth,
41
+ height: drawingArea.top + drawingArea.height + drawingArea.bottom
42
+ }))
43
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
44
+ clipPath: `url(#${clipId})`,
45
+ children: props.children
46
+ })]
47
+ });
48
+ }
@@ -76,7 +76,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
76
76
  // ----------------------------------------------------------------------
77
77
  /**
78
78
  * The configuration of axes highlight.
79
- * @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
79
+ * @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
80
80
  * @default { x: 'line' }
81
81
  */
82
82
  axisHighlight: _propTypes.default.shape({
@@ -7,10 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
10
+ var _warning = require("@mui/x-internals/warning");
10
11
  var _stackSeries = require("../internals/stackSeries");
11
12
  var _defaultizeValueFormatter = require("../internals/defaultizeValueFormatter");
12
- let warnedOnce = false;
13
-
14
13
  // For now it's a copy past of bar charts formatter, but maybe will diverge later
15
14
  const formatter = (params, dataset) => {
16
15
  const {
@@ -61,9 +60,10 @@ const formatter = (params, dataset) => {
61
60
  data: dataKey ? dataset.map(data => {
62
61
  const value = data[dataKey];
63
62
  if (typeof value !== 'number') {
64
- if (process.env.NODE_ENV !== 'production' && !warnedOnce && value !== null) {
65
- warnedOnce = true;
66
- console.error([`MUI X: Your dataset key "${dataKey}" is used for plotting line, but contains nonnumerical elements.`, 'Line plots only support numbers and null values.']);
63
+ if (process.env.NODE_ENV !== 'production') {
64
+ if (value !== null) {
65
+ (0, _warning.warnOnce)([`MUI X: Your dataset key "${dataKey}" is used for plotting line, but contains nonnumerical elements.`, 'Line plots only support numbers and null values.']);
66
+ }
67
67
  }
68
68
  return null;
69
69
  }
@@ -144,7 +144,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
144
144
  // ----------------------------------------------------------------------
145
145
  /**
146
146
  * The configuration of axes highlight.
147
- * @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
147
+ * @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
148
148
  * @default { x: 'none', y: 'none' }
149
149
  */
150
150
  axisHighlight: _propTypes.default.shape({
@@ -69,7 +69,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
69
69
  // ----------------------------------------------------------------------
70
70
  /**
71
71
  * The configuration of axes highlight.
72
- * @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
72
+ * @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
73
73
  * @default { x: 'none', y: 'none' }
74
74
  */
75
75
  axisHighlight: _propTypes.default.shape({
@@ -32,7 +32,7 @@ function ZAxisContextProvider(props) {
32
32
  return axisConfig;
33
33
  }
34
34
  if (dataset === undefined) {
35
- throw Error('MUI X: z-axis uses `dataKey` but no `dataset` is provided.');
35
+ throw new Error('MUI X: z-axis uses `dataKey` but no `dataset` is provided.');
36
36
  }
37
37
  return (0, _extends2.default)({}, axisConfig, {
38
38
  data: dataset.map(d => d[dataKey])
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.useReducedMotion = void 0;
8
8
  var _web = require("@react-spring/web");
9
- const handleMediaChange = e => {
9
+ const handleMediaChange = event => {
10
10
  _web.Globals.assign({
11
11
  // Modification such the react-spring implementation such that this hook can remove animation but never activate animation.
12
- skipAnimation: e.matches || undefined
12
+ skipAnimation: event.matches || undefined
13
13
  });
14
14
  };
15
15
 
@@ -34,7 +34,7 @@ function useSeries() {
34
34
  * The returned object contains:
35
35
  * - series: a mapping from ids to series attributes.
36
36
  * - seriesOrder: the array of series ids.
37
- * @returns { series: Record<SeriesId, DefaultizedPieSeriesType>; seriesOrder: SeriesId[]; } | undefined pieSeries
37
+ * @returns {{ series: Record<SeriesId, DefaultizedPieSeriesType>; seriesOrder: SeriesId[]; } | undefined} pieSeries
38
38
  */
39
39
  function usePieSeries() {
40
40
  const series = useSeries();
@@ -46,7 +46,7 @@ function usePieSeries() {
46
46
  * The returned object contains:
47
47
  * - series: a mapping from ids to series attributes.
48
48
  * - seriesOrder: the array of series ids.
49
- * @returns { series: Record<SeriesId, DefaultizedLineSeriesType>; seriesOrder: SeriesId[]; } | undefined lineSeries
49
+ * @returns {{ series: Record<SeriesId, DefaultizedLineSeriesType>; seriesOrder: SeriesId[]; } | undefined} lineSeries
50
50
  */
51
51
  function useLineSeries() {
52
52
  const series = useSeries();
@@ -58,7 +58,7 @@ function useLineSeries() {
58
58
  * The returned object contains:
59
59
  * - series: a mapping from ids to series attributes.
60
60
  * - seriesOrder: the array of series ids.
61
- * @returns { series: Record<SeriesId, DefaultizedBarSeriesType>; seriesOrder: SeriesId[]; } | undefined barSeries
61
+ * @returns {{ series: Record<SeriesId, DefaultizedBarSeriesType>; seriesOrder: SeriesId[]; } | undefined} barSeries
62
62
  */
63
63
  function useBarSeries() {
64
64
  const series = useSeries();
@@ -70,7 +70,7 @@ function useBarSeries() {
70
70
  * The returned object contains:
71
71
  * - series: a mapping from ids to series attributes.
72
72
  * - seriesOrder: the array of series ids.
73
- * @returns { series: Record<SeriesId, DefaultizedScatterSeriesType>; seriesOrder: SeriesId[]; } | undefined scatterSeries
73
+ * @returns {{ series: Record<SeriesId, DefaultizedScatterSeriesType>; seriesOrder: SeriesId[]; } | undefined} scatterSeries
74
74
  */
75
75
  function useScatterSeries() {
76
76
  const series = useSeries();
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.18.0
2
+ * @mui/x-charts v7.20.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -122,7 +122,7 @@ const getStringSize = (text, style = {}) => {
122
122
  measurementSpan.textContent = '';
123
123
  }, 0);
124
124
  return result;
125
- } catch (e) {
125
+ } catch {
126
126
  return {
127
127
  width: 0,
128
128
  height: 0
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getMinXTranslation = getMinXTranslation;
7
+ var _warning = require("@mui/x-internals/warning");
7
8
  const ANGLE_APPROX = 5; // Angle (in deg) for which we approximate the rectangle as perfectly horizontal/vertical
8
9
 
9
- let warnedOnce = false;
10
-
11
10
  /**
12
11
  * Return the minimal translation along the x-axis to avoid overflow of a rectangle of a given width, height, and rotation.
13
12
  * This assumes that all rectangles have the same height and angle between -90 and 90.
@@ -18,9 +17,8 @@ let warnedOnce = false;
18
17
  */
19
18
  function getMinXTranslation(width, height, angle = 0) {
20
19
  if (process.env.NODE_ENV !== 'production') {
21
- if (!warnedOnce && angle > 90 && angle < -90) {
22
- warnedOnce = true;
23
- console.warn([`MUI X: It seems you applied an angle larger than 90° or smaller than -90° to an axis text.`, `This could cause some text overlapping.`, `If you encounter a use case where it's needed, please open an issue.`].join('\n'));
20
+ if (angle > 90 && angle < -90) {
21
+ (0, _warning.warnOnce)([`MUI X: It seems you applied an angle larger than 90° or smaller than -90° to an axis text.`, `This could cause some text overlapping.`, `If you encounter a use case where it's needed, please open an issue.`]);
24
22
  }
25
23
  }
26
24
  const standardAngle = Math.min(Math.abs(angle) % 180, Math.abs(Math.abs(angle) % 180 - 180) % 180); // Map from R to [0, 90]
@@ -30,5 +30,5 @@ function getPercentageValue(value, refValue) {
30
30
  return val;
31
31
  }
32
32
  }
33
- throw Error(`MUI X: Received an unknown value "${value}". It should be a number, or a string with a percentage value.`);
33
+ throw new Error(`MUI X: Received an unknown value "${value}". It should be a number, or a string with a percentage value.`);
34
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "7.18.0",
3
+ "version": "7.20.0",
4
4
  "description": "The community edition of the Charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -29,14 +29,14 @@
29
29
  "directory": "packages/x-charts"
30
30
  },
31
31
  "dependencies": {
32
- "@babel/runtime": "^7.25.6",
33
- "@mui/utils": "^5.16.6",
32
+ "@babel/runtime": "^7.25.7",
33
+ "@mui/utils": "^5.16.6 || ^6.0.0",
34
34
  "@react-spring/rafz": "^9.7.4",
35
35
  "@react-spring/web": "^9.7.4",
36
36
  "clsx": "^2.1.1",
37
37
  "prop-types": "^15.8.1",
38
- "@mui/x-charts-vendor": "7.18.0",
39
- "@mui/x-internals": "7.18.0"
38
+ "@mui/x-charts-vendor": "7.20.0",
39
+ "@mui/x-internals": "7.20.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@emotion/react": "^11.9.0",