@mui/x-charts 7.1.1 → 7.2.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.
@@ -19,7 +19,7 @@ const getValueExtremum = params => {
19
19
  isDefaultAxis
20
20
  } = params;
21
21
  return Object.keys(series).filter(seriesId => series[seriesId].yAxisKey === axis.id || isDefaultAxis && series[seriesId].yAxisKey === undefined).reduce((acc, seriesId) => {
22
- const [seriesMin, seriesMax] = series[seriesId].stackedData.reduce((seriesAcc, values) => [Math.min(...values, ...(seriesAcc[0] === null ? [] : [seriesAcc[0]])), Math.max(...values, ...(seriesAcc[1] === null ? [] : [seriesAcc[1]]))], series[seriesId].stackedData[0]);
22
+ const [seriesMin, seriesMax] = series[seriesId].stackedData?.reduce((seriesAcc, values) => [Math.min(...values, ...(seriesAcc[0] === null ? [] : [seriesAcc[0]])), Math.max(...values, ...(seriesAcc[1] === null ? [] : [seriesAcc[1]]))], series[seriesId].stackedData[0]) ?? [null, null];
23
23
  return [acc[0] === null ? seriesMin : Math.min(seriesMin, acc[0]), acc[1] === null ? seriesMax : Math.max(seriesMax, acc[1])];
24
24
  }, [null, null]);
25
25
  };
package/CHANGELOG.md CHANGED
@@ -3,6 +3,92 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.2.0
7
+
8
+ _Apr 12, 2024_
9
+
10
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎨 Make grid colors customizable through the MUI themes API
13
+ - 🌍 Improve French (fr-FR), German (de-DE), and Swedish (sv-SE) locales on the Data Grid and Pickers
14
+ - 🐞 Bugfixes
15
+ - 📚 Documentation improvements
16
+
17
+ ### Data Grid
18
+
19
+ #### `@mui/x-data-grid@7.2.0`
20
+
21
+ - [DataGrid] Add missing `api` property to `GridCallbackDetails` (#12742) @sai6855
22
+ - [DataGrid] Do not escape double quotes when copying to clipboard (#12722) @cherniavskii
23
+ - [DataGrid] Fix column vertical border (#12741) @romgrk
24
+ - [DataGrid] Fix invalid date error when filtering `date`/`dateTime` columns (#12709) @cherniavskii
25
+ - [DataGrid] Fix overflow with dynamic row height (#12683) @romgrk
26
+ - [DataGrid] Make colors customizable (#12614) @romgrk
27
+ - [l10n] Improve French (fr-FR) locale (#12755) @derek-0000
28
+ - [l10n] Improve German (de-DE) locale (#12752) @Jens-Schoen
29
+ - [l10n] Improve Swedish (sv-SE) locale (#12731) @pontusdacke
30
+
31
+ #### `@mui/x-data-grid-pro@7.2.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
32
+
33
+ Same changes as in `@mui/x-data-grid@7.2.0`.
34
+
35
+ #### `@mui/x-data-grid-premium@7.2.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
36
+
37
+ Same changes as in `@mui/x-data-grid-pro@7.2.0`, plus:
38
+
39
+ - [DataGridPremium] Fix clipboard paste not working when cell loses focus (#12724) @cherniavskii
40
+
41
+ ### Date and Time Pickers
42
+
43
+ #### `@mui/x-date-pickers@7.2.0`
44
+
45
+ - [fields] Fix field editing after closing the picker (#12675) @LukasTy
46
+ - [l10n] Improve French (fr-FR) locale (#12692) @FaroukBel
47
+ - [l10n] Improve German (de-DE) locale (#12752) @Jens-Schoen
48
+ - [l10n] Improve Swedish (sv-SE) locale (#12731) @pontusdacke
49
+ - [pickers] Fix desktop date time Pickers grid layout (#12748) @LukasTy
50
+
51
+ #### `@mui/x-date-pickers-pro@7.2.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
52
+
53
+ Same changes as in `@mui/x-date-pickers@7.2.0`, plus:
54
+
55
+ - [DateTimeRangePicker] Fix desktop toolbar style (#12760) @LukasTy
56
+
57
+ ### Charts
58
+
59
+ #### `@mui/x-charts@7.2.0`
60
+
61
+ - [charts] Fix Bar chart with empty dataset throwing an error (#12708) @JCQuintas
62
+ - [charts] Fix `tickLabelInterval` not working on `YAxis` (#12746) @JCQuintas
63
+
64
+ ### Tree View
65
+
66
+ #### `@mui/x-tree-view@7.2.0`
67
+
68
+ - [TreeView] Add a new lookup to access an item index without expansive computation (#12729) @flaviendelangle
69
+ - [TreeView] Clean up usage of term "node" in internals (#12655) @noraleonte
70
+ - [TreeView] Improve performance by removing `getNavigableChildrenIds` method (#12713) @flaviendelangle
71
+ - [TreeView] Remove `state.items.itemTree` (#12717) @flaviendelangle
72
+ - [TreeView] Remove remaining occurences of the word "node" in the codebase (#12712) @flaviendelangle
73
+ - [TreeView] Return `instance` and `publicAPI` methods from plugin and populate the main objects inside `useTreeView` (#12650) @flaviendelangle
74
+ - [TreeView] Fix behaviors when the item order changes (#12369) @flaviendelangle
75
+
76
+ ### Docs
77
+
78
+ - [docs] Add `AxisFormatter` documentation for customizing tick/tooltip value formatting (#12700) @JCQuintas
79
+ - [docs] Add file explorer example to rich tree view customization docs (#12707) @noraleonte
80
+ - [docs] Do not use import of depth 3 in the doc (#12716) @flaviendelangle
81
+ - [docs] Explain how to clip plots with composition (#12679) @alexfauquette
82
+ - [docs] Fix typo in Data Grid v7 migration page (#12720) @bfaulk96
83
+ - [docs] Fix typo in Pickers v7 migration page (#12721) @bfaulk96
84
+
85
+ ### Core
86
+
87
+ - [core] Support multiple resolved `l10n` PR packages (#12735) @LukasTy
88
+ - [core] Update Netlify release references in release README (#12687) @LukasTy
89
+ - [core] Use `describeTreeView` for icons tests (#12672) @flaviendelangle
90
+ - [core] Use `describeTreeView` in existing tests for `useTreeViewItems` (#12732) @flaviendelangle
91
+
6
92
  ## 7.1.1
7
93
 
8
94
  _Apr 5, 2024_
@@ -71,7 +71,7 @@ function addLabelDimension(xTicks, {
71
71
 
72
72
  // Filter label to avoid overlap
73
73
  let currentTextLimit = 0;
74
- let previouseTextLimit = 0;
74
+ let previousTextLimit = 0;
75
75
  const direction = reverse ? -1 : 1;
76
76
  return withDimension.map((item, labelIndex) => {
77
77
  const {
@@ -85,14 +85,14 @@ function addLabelDimension(xTicks, {
85
85
  const gapRatio = 1.2; // Ratio applied to the minimal distance to add some margin.
86
86
 
87
87
  currentTextLimit = textPosition - direction * (gapRatio * distance) / 2;
88
- if (labelIndex > 0 && direction * currentTextLimit < direction * previouseTextLimit) {
88
+ if (labelIndex > 0 && direction * currentTextLimit < direction * previousTextLimit) {
89
89
  // Except for the first label, we skip all label that overlap with the last accepted.
90
- // Notice that the early return prevents `previouseTextLimit` from being updated.
90
+ // Notice that the early return prevents `previousTextLimit` from being updated.
91
91
  return (0, _extends2.default)({}, item, {
92
92
  skipLabel: true
93
93
  });
94
94
  }
95
- previouseTextLimit = textPosition + direction * (gapRatio * distance) / 2;
95
+ previousTextLimit = textPosition + direction * (gapRatio * distance) / 2;
96
96
  return item;
97
97
  });
98
98
  }
@@ -354,7 +354,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
354
354
  */
355
355
  tickMinStep: _propTypes.default.number,
356
356
  /**
357
- * The number of ticks. This number is not guaranted.
357
+ * The number of ticks. This number is not guaranteed.
358
358
  * Not supported by categorical axis (band, points).
359
359
  */
360
360
  tickNumber: _propTypes.default.number,
@@ -90,7 +90,8 @@ function ChartsYAxis(inProps) {
90
90
  slotProps,
91
91
  tickPlacement,
92
92
  tickLabelPlacement,
93
- tickInterval
93
+ tickInterval,
94
+ tickLabelInterval
94
95
  } = defaultizedProps;
95
96
  const theme = (0, _styles.useTheme)();
96
97
  const classes = useUtilityClasses((0, _extends2.default)({}, defaultizedProps, {
@@ -156,17 +157,19 @@ function ChartsYAxis(inProps) {
156
157
  }, slotProps?.axisLine)), yTicks.map(({
157
158
  formattedValue,
158
159
  offset,
159
- labelOffset
160
+ labelOffset,
161
+ value
160
162
  }, index) => {
161
163
  const xTickLabel = positionSign * (tickSize + 2);
162
164
  const yTickLabel = labelOffset;
165
+ const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
163
166
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
164
167
  transform: `translate(0, ${offset})`,
165
168
  className: classes.tickContainer,
166
169
  children: [!disableTicks && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tick, (0, _extends2.default)({
167
170
  x2: positionSign * tickSize,
168
171
  className: classes.tick
169
- }, slotProps?.axisTick)), formattedValue !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
172
+ }, slotProps?.axisTick)), formattedValue !== undefined && !skipLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
170
173
  x: xTickLabel,
171
174
  y: yTickLabel,
172
175
  text: formattedValue.toString()
@@ -286,7 +289,7 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
286
289
  */
287
290
  tickMinStep: _propTypes.default.number,
288
291
  /**
289
- * The number of ticks. This number is not guaranted.
292
+ * The number of ticks. This number is not guaranteed.
290
293
  * Not supported by categorical axis (band, points).
291
294
  */
292
295
  tickNumber: _propTypes.default.number,
@@ -13,7 +13,7 @@ const getValueExtremum = params => {
13
13
  isDefaultAxis
14
14
  } = params;
15
15
  return Object.keys(series).filter(seriesId => series[seriesId].yAxisKey === axis.id || isDefaultAxis && series[seriesId].yAxisKey === undefined).reduce((acc, seriesId) => {
16
- const [seriesMin, seriesMax] = series[seriesId].stackedData.reduce((seriesAcc, values) => [Math.min(...values, ...(seriesAcc[0] === null ? [] : [seriesAcc[0]])), Math.max(...values, ...(seriesAcc[1] === null ? [] : [seriesAcc[1]]))], series[seriesId].stackedData[0]);
16
+ const [seriesMin, seriesMax] = series[seriesId].stackedData?.reduce((seriesAcc, values) => [Math.min(...values, ...(seriesAcc[0] === null ? [] : [seriesAcc[0]])), Math.max(...values, ...(seriesAcc[1] === null ? [] : [seriesAcc[1]]))], series[seriesId].stackedData[0]) ?? [null, null];
17
17
  return [acc[0] === null ? seriesMin : Math.min(seriesMin, acc[0]), acc[1] === null ? seriesMax : Math.max(seriesMax, acc[1])];
18
18
  }, [null, null]);
19
19
  };
@@ -63,7 +63,7 @@ function addLabelDimension(xTicks, {
63
63
 
64
64
  // Filter label to avoid overlap
65
65
  let currentTextLimit = 0;
66
- let previouseTextLimit = 0;
66
+ let previousTextLimit = 0;
67
67
  const direction = reverse ? -1 : 1;
68
68
  return withDimension.map((item, labelIndex) => {
69
69
  const {
@@ -77,14 +77,14 @@ function addLabelDimension(xTicks, {
77
77
  const gapRatio = 1.2; // Ratio applied to the minimal distance to add some margin.
78
78
 
79
79
  currentTextLimit = textPosition - direction * (gapRatio * distance) / 2;
80
- if (labelIndex > 0 && direction * currentTextLimit < direction * previouseTextLimit) {
80
+ if (labelIndex > 0 && direction * currentTextLimit < direction * previousTextLimit) {
81
81
  // Except for the first label, we skip all label that overlap with the last accepted.
82
- // Notice that the early return prevents `previouseTextLimit` from being updated.
82
+ // Notice that the early return prevents `previousTextLimit` from being updated.
83
83
  return _extends({}, item, {
84
84
  skipLabel: true
85
85
  });
86
86
  }
87
- previouseTextLimit = textPosition + direction * (gapRatio * distance) / 2;
87
+ previousTextLimit = textPosition + direction * (gapRatio * distance) / 2;
88
88
  return item;
89
89
  });
90
90
  }
@@ -346,7 +346,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
346
346
  */
347
347
  tickMinStep: PropTypes.number,
348
348
  /**
349
- * The number of ticks. This number is not guaranted.
349
+ * The number of ticks. This number is not guaranteed.
350
350
  * Not supported by categorical axis (band, points).
351
351
  */
352
352
  tickNumber: PropTypes.number,
@@ -82,7 +82,8 @@ function ChartsYAxis(inProps) {
82
82
  slotProps,
83
83
  tickPlacement,
84
84
  tickLabelPlacement,
85
- tickInterval
85
+ tickInterval,
86
+ tickLabelInterval
86
87
  } = defaultizedProps;
87
88
  const theme = useTheme();
88
89
  const classes = useUtilityClasses(_extends({}, defaultizedProps, {
@@ -148,17 +149,19 @@ function ChartsYAxis(inProps) {
148
149
  }, slotProps?.axisLine)), yTicks.map(({
149
150
  formattedValue,
150
151
  offset,
151
- labelOffset
152
+ labelOffset,
153
+ value
152
154
  }, index) => {
153
155
  const xTickLabel = positionSign * (tickSize + 2);
154
156
  const yTickLabel = labelOffset;
157
+ const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
155
158
  return /*#__PURE__*/_jsxs("g", {
156
159
  transform: `translate(0, ${offset})`,
157
160
  className: classes.tickContainer,
158
161
  children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
159
162
  x2: positionSign * tickSize,
160
163
  className: classes.tick
161
- }, slotProps?.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
164
+ }, slotProps?.axisTick)), formattedValue !== undefined && !skipLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
162
165
  x: xTickLabel,
163
166
  y: yTickLabel,
164
167
  text: formattedValue.toString()
@@ -278,7 +281,7 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
278
281
  */
279
282
  tickMinStep: PropTypes.number,
280
283
  /**
281
- * The number of ticks. This number is not guaranted.
284
+ * The number of ticks. This number is not guaranteed.
282
285
  * Not supported by categorical axis (band, points).
283
286
  */
284
287
  tickNumber: PropTypes.number,
@@ -13,7 +13,7 @@ export interface TickParams {
13
13
  */
14
14
  tickMinStep?: number;
15
15
  /**
16
- * The number of ticks. This number is not guaranted.
16
+ * The number of ticks. This number is not guaranteed.
17
17
  * Not supported by categorical axis (band, points).
18
18
  */
19
19
  tickNumber?: number;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.1.1
2
+ * @mui/x-charts v7.2.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -13,7 +13,7 @@ const getValueExtremum = params => {
13
13
  isDefaultAxis
14
14
  } = params;
15
15
  return Object.keys(series).filter(seriesId => series[seriesId].yAxisKey === axis.id || isDefaultAxis && series[seriesId].yAxisKey === undefined).reduce((acc, seriesId) => {
16
- const [seriesMin, seriesMax] = series[seriesId].stackedData.reduce((seriesAcc, values) => [Math.min(...values, ...(seriesAcc[0] === null ? [] : [seriesAcc[0]])), Math.max(...values, ...(seriesAcc[1] === null ? [] : [seriesAcc[1]]))], series[seriesId].stackedData[0]);
16
+ const [seriesMin, seriesMax] = series[seriesId].stackedData?.reduce((seriesAcc, values) => [Math.min(...values, ...(seriesAcc[0] === null ? [] : [seriesAcc[0]])), Math.max(...values, ...(seriesAcc[1] === null ? [] : [seriesAcc[1]]))], series[seriesId].stackedData[0]) ?? [null, null];
17
17
  return [acc[0] === null ? seriesMin : Math.min(seriesMin, acc[0]), acc[1] === null ? seriesMax : Math.max(seriesMax, acc[1])];
18
18
  }, [null, null]);
19
19
  };
@@ -63,7 +63,7 @@ function addLabelDimension(xTicks, {
63
63
 
64
64
  // Filter label to avoid overlap
65
65
  let currentTextLimit = 0;
66
- let previouseTextLimit = 0;
66
+ let previousTextLimit = 0;
67
67
  const direction = reverse ? -1 : 1;
68
68
  return withDimension.map((item, labelIndex) => {
69
69
  const {
@@ -77,14 +77,14 @@ function addLabelDimension(xTicks, {
77
77
  const gapRatio = 1.2; // Ratio applied to the minimal distance to add some margin.
78
78
 
79
79
  currentTextLimit = textPosition - direction * (gapRatio * distance) / 2;
80
- if (labelIndex > 0 && direction * currentTextLimit < direction * previouseTextLimit) {
80
+ if (labelIndex > 0 && direction * currentTextLimit < direction * previousTextLimit) {
81
81
  // Except for the first label, we skip all label that overlap with the last accepted.
82
- // Notice that the early return prevents `previouseTextLimit` from being updated.
82
+ // Notice that the early return prevents `previousTextLimit` from being updated.
83
83
  return _extends({}, item, {
84
84
  skipLabel: true
85
85
  });
86
86
  }
87
- previouseTextLimit = textPosition + direction * (gapRatio * distance) / 2;
87
+ previousTextLimit = textPosition + direction * (gapRatio * distance) / 2;
88
88
  return item;
89
89
  });
90
90
  }
@@ -346,7 +346,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
346
346
  */
347
347
  tickMinStep: PropTypes.number,
348
348
  /**
349
- * The number of ticks. This number is not guaranted.
349
+ * The number of ticks. This number is not guaranteed.
350
350
  * Not supported by categorical axis (band, points).
351
351
  */
352
352
  tickNumber: PropTypes.number,
@@ -82,7 +82,8 @@ function ChartsYAxis(inProps) {
82
82
  slotProps,
83
83
  tickPlacement,
84
84
  tickLabelPlacement,
85
- tickInterval
85
+ tickInterval,
86
+ tickLabelInterval
86
87
  } = defaultizedProps;
87
88
  const theme = useTheme();
88
89
  const classes = useUtilityClasses(_extends({}, defaultizedProps, {
@@ -148,17 +149,19 @@ function ChartsYAxis(inProps) {
148
149
  }, slotProps?.axisLine)), yTicks.map(({
149
150
  formattedValue,
150
151
  offset,
151
- labelOffset
152
+ labelOffset,
153
+ value
152
154
  }, index) => {
153
155
  const xTickLabel = positionSign * (tickSize + 2);
154
156
  const yTickLabel = labelOffset;
157
+ const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
155
158
  return /*#__PURE__*/_jsxs("g", {
156
159
  transform: `translate(0, ${offset})`,
157
160
  className: classes.tickContainer,
158
161
  children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
159
162
  x2: positionSign * tickSize,
160
163
  className: classes.tick
161
- }, slotProps?.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
164
+ }, slotProps?.axisTick)), formattedValue !== undefined && !skipLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
162
165
  x: xTickLabel,
163
166
  y: yTickLabel,
164
167
  text: formattedValue.toString()
@@ -278,7 +281,7 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
278
281
  */
279
282
  tickMinStep: PropTypes.number,
280
283
  /**
281
- * The number of ticks. This number is not guaranted.
284
+ * The number of ticks. This number is not guaranteed.
282
285
  * Not supported by categorical axis (band, points).
283
286
  */
284
287
  tickNumber: PropTypes.number,
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.1.1
2
+ * @mui/x-charts v7.2.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "7.1.1",
3
+ "version": "7.2.0",
4
4
  "description": "The community edition of the Charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",