@mui/x-charts 8.5.3 → 8.6.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 (104) hide show
  1. package/BarChart/AnimatedBarElement.js +3 -1
  2. package/BarChart/BarLabel/BarLabelPlot.d.ts +2 -2
  3. package/BarChart/BarLabel/BarLabelPlot.js +33 -25
  4. package/BarChart/BarPlot.js +55 -40
  5. package/BarChart/barClasses.d.ts +12 -0
  6. package/BarChart/barClasses.js +25 -0
  7. package/BarChart/index.d.ts +3 -1
  8. package/BarChart/index.js +23 -1
  9. package/BarChart/types.d.ts +5 -1
  10. package/CHANGELOG.md +107 -0
  11. package/ChartsLegend/ChartsLegend.js +1 -0
  12. package/ChartsXAxis/ChartsXAxis.js +4 -108
  13. package/ChartsXAxis/getVisibleLabels.d.ts +14 -0
  14. package/ChartsXAxis/getVisibleLabels.js +71 -0
  15. package/ChartsXAxis/shortenLabels.d.ts +4 -0
  16. package/ChartsXAxis/shortenLabels.js +48 -0
  17. package/ChartsYAxis/ChartsYAxis.js +2 -39
  18. package/ChartsYAxis/shortenLabels.d.ts +4 -0
  19. package/ChartsYAxis/shortenLabels.js +46 -0
  20. package/LineChart/AnimatedArea.js +4 -1
  21. package/LineChart/AnimatedLine.js +4 -1
  22. package/LineChart/CircleMarkElement.js +4 -1
  23. package/LineChart/MarkElement.js +4 -1
  24. package/LineChart/MarkPlot.js +1 -0
  25. package/PieChart/PieArc.js +3 -1
  26. package/PieChart/PiePlot.js +6 -0
  27. package/PieChart/index.d.ts +3 -1
  28. package/PieChart/index.js +18 -1
  29. package/PieChart/pieClasses.d.ts +12 -0
  30. package/PieChart/pieClasses.js +24 -0
  31. package/Toolbar/ToolbarButton.js +2 -0
  32. package/esm/BarChart/AnimatedBarElement.js +3 -1
  33. package/esm/BarChart/BarLabel/BarLabelPlot.d.ts +2 -2
  34. package/esm/BarChart/BarLabel/BarLabelPlot.js +33 -25
  35. package/esm/BarChart/BarPlot.js +55 -40
  36. package/esm/BarChart/barClasses.d.ts +12 -0
  37. package/esm/BarChart/barClasses.js +15 -0
  38. package/esm/BarChart/index.d.ts +3 -1
  39. package/esm/BarChart/index.js +2 -1
  40. package/esm/BarChart/types.d.ts +5 -1
  41. package/esm/ChartsLegend/ChartsLegend.js +1 -0
  42. package/esm/ChartsXAxis/ChartsXAxis.js +2 -106
  43. package/esm/ChartsXAxis/getVisibleLabels.d.ts +14 -0
  44. package/esm/ChartsXAxis/getVisibleLabels.js +67 -0
  45. package/esm/ChartsXAxis/shortenLabels.d.ts +4 -0
  46. package/esm/ChartsXAxis/shortenLabels.js +42 -0
  47. package/esm/ChartsYAxis/ChartsYAxis.js +1 -38
  48. package/esm/ChartsYAxis/shortenLabels.d.ts +4 -0
  49. package/esm/ChartsYAxis/shortenLabels.js +41 -0
  50. package/esm/LineChart/AnimatedArea.js +4 -1
  51. package/esm/LineChart/AnimatedLine.js +4 -1
  52. package/esm/LineChart/CircleMarkElement.js +4 -1
  53. package/esm/LineChart/MarkElement.js +4 -1
  54. package/esm/LineChart/MarkPlot.js +1 -0
  55. package/esm/PieChart/PieArc.js +3 -1
  56. package/esm/PieChart/PiePlot.js +6 -0
  57. package/esm/PieChart/index.d.ts +3 -1
  58. package/esm/PieChart/index.js +2 -1
  59. package/esm/PieChart/pieClasses.d.ts +12 -0
  60. package/esm/PieChart/pieClasses.js +15 -0
  61. package/esm/Toolbar/ToolbarButton.js +2 -0
  62. package/esm/index.js +1 -1
  63. package/esm/internals/components/NotRendered.d.ts +9 -0
  64. package/esm/internals/components/NotRendered.js +10 -0
  65. package/esm/internals/index.d.ts +1 -0
  66. package/esm/internals/index.js +1 -0
  67. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +30 -2
  68. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +8 -2
  69. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +20 -4
  70. package/esm/locales/enUS.d.ts +3 -0
  71. package/esm/locales/enUS.js +8 -2
  72. package/esm/locales/frFR.d.ts +3 -0
  73. package/esm/locales/frFR.js +7 -0
  74. package/esm/locales/ptBR.d.ts +3 -0
  75. package/esm/locales/ptBR.js +7 -1
  76. package/esm/locales/ptPT.d.ts +3 -0
  77. package/esm/locales/ptPT.js +7 -1
  78. package/esm/locales/utils/chartsLocaleTextApi.d.ts +17 -0
  79. package/esm/locales/utils/getChartsLocalization.d.ts +3 -0
  80. package/esm/locales/utils/imageMimeTypes.d.ts +2 -0
  81. package/esm/locales/utils/imageMimeTypes.js +5 -0
  82. package/esm/models/slots/chartsBaseSlotProps.d.ts +4 -0
  83. package/index.js +1 -1
  84. package/internals/components/NotRendered.d.ts +9 -0
  85. package/internals/components/NotRendered.js +16 -0
  86. package/internals/index.d.ts +1 -0
  87. package/internals/index.js +12 -0
  88. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +30 -2
  89. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +8 -2
  90. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +20 -4
  91. package/locales/enUS.d.ts +3 -0
  92. package/locales/enUS.js +8 -2
  93. package/locales/frFR.d.ts +3 -0
  94. package/locales/frFR.js +7 -0
  95. package/locales/ptBR.d.ts +3 -0
  96. package/locales/ptBR.js +7 -1
  97. package/locales/ptPT.d.ts +3 -0
  98. package/locales/ptPT.js +7 -1
  99. package/locales/utils/chartsLocaleTextApi.d.ts +17 -0
  100. package/locales/utils/getChartsLocalization.d.ts +3 -0
  101. package/locales/utils/imageMimeTypes.d.ts +2 -0
  102. package/locales/utils/imageMimeTypes.js +11 -0
  103. package/models/slots/chartsBaseSlotProps.d.ts +4 -0
  104. package/package.json +2 -2
@@ -21,6 +21,8 @@ function AnimatedBarElement(props) {
21
21
  const animatedProps = (0, _useAnimateBar.useAnimateBar)(props);
22
22
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", (0, _extends2.default)({}, other, {
23
23
  filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
24
- opacity: ownerState.isFaded ? 0.3 : 1
24
+ opacity: ownerState.isFaded ? 0.3 : 1,
25
+ "data-highlighted": ownerState.isHighlighted || undefined,
26
+ "data-faded": ownerState.isFaded || undefined
25
27
  }, animatedProps));
26
28
  }
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import type { CompletedBarData } from "../types.js";
2
+ import type { ProcessedBarSeriesData } from "../types.js";
3
3
  import { BarLabelItemProps } from "./BarLabelItem.js";
4
4
  type BarLabelPlotProps = {
5
- bars: CompletedBarData[];
5
+ bars: ProcessedBarSeriesData[];
6
6
  skipAnimation?: boolean;
7
7
  barLabel?: BarLabelItemProps['barLabel'];
8
8
  };
@@ -10,6 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _BarLabelItem = require("./BarLabelItem");
13
+ var _barClasses = require("../barClasses");
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  const _excluded = ["bars", "skipAnimation"];
15
16
  /**
@@ -21,32 +22,39 @@ function BarLabelPlot(props) {
21
22
  skipAnimation
22
23
  } = props,
23
24
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
25
+ const classes = (0, _barClasses.useUtilityClasses)();
24
26
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
25
- children: bars.map(({
26
- xOrigin,
27
- yOrigin,
28
- x,
29
- y,
27
+ children: bars.flatMap(({
30
28
  seriesId,
31
- dataIndex,
32
- color,
33
- value,
34
- width,
35
- height,
36
- layout
37
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarLabelItem.BarLabelItem, (0, _extends2.default)({
38
- seriesId: seriesId,
39
- dataIndex: dataIndex,
40
- value: value,
41
- color: color,
42
- xOrigin: xOrigin,
43
- yOrigin: yOrigin,
44
- x: x,
45
- y: y,
46
- width: width,
47
- height: height,
48
- skipAnimation: skipAnimation ?? false,
49
- layout: layout ?? 'vertical'
50
- }, other), `${seriesId}-${dataIndex}`))
29
+ data
30
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
31
+ className: classes.seriesLabels,
32
+ "data-series": seriesId,
33
+ children: data.map(({
34
+ xOrigin,
35
+ yOrigin,
36
+ x,
37
+ y,
38
+ dataIndex,
39
+ color,
40
+ value,
41
+ width,
42
+ height,
43
+ layout
44
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarLabelItem.BarLabelItem, (0, _extends2.default)({
45
+ seriesId: seriesId,
46
+ dataIndex: dataIndex,
47
+ value: value,
48
+ color: color,
49
+ xOrigin: xOrigin,
50
+ yOrigin: yOrigin,
51
+ x: x,
52
+ y: y,
53
+ width: width,
54
+ height: height,
55
+ skipAnimation: skipAnimation ?? false,
56
+ layout: layout ?? 'vertical'
57
+ }, other), dataIndex))
58
+ }, seriesId))
51
59
  });
52
60
  }
@@ -22,6 +22,7 @@ var _checkScaleErrors = require("./checkScaleErrors");
22
22
  var _useBarSeries = require("../hooks/useBarSeries");
23
23
  var _useSkipAnimation = require("../hooks/useSkipAnimation");
24
24
  var _useInternalIsZoomInteracting = require("../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting");
25
+ var _barClasses = require("./barClasses");
25
26
  var _jsxRuntime = require("react/jsx-runtime");
26
27
  const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
27
28
  /**
@@ -75,13 +76,13 @@ const useAggregatedData = () => {
75
76
  const defaultYAxisId = yAxisIds[0];
76
77
  const masks = {};
77
78
  const data = stackingGroups.flatMap(({
78
- ids: groupIds
79
+ ids: seriesIds
79
80
  }, groupIndex) => {
80
81
  const xMin = drawingArea.left;
81
82
  const xMax = drawingArea.left + drawingArea.width;
82
83
  const yMin = drawingArea.top;
83
84
  const yMax = drawingArea.top + drawingArea.height;
84
- return groupIds.flatMap(seriesId => {
85
+ return seriesIds.map(seriesId => {
85
86
  const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
86
87
  const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
87
88
  const xAxisConfig = xAxis[xAxisId];
@@ -107,7 +108,7 @@ const useAggregatedData = () => {
107
108
  data: currentSeriesData,
108
109
  layout
109
110
  } = series[seriesId];
110
- return baseScaleConfig.data.map((baseValue, dataIndex) => {
111
+ const seriesDataPoints = baseScaleConfig.data.map((baseValue, dataIndex) => {
111
112
  if (currentSeriesData[dataIndex] == null) {
112
113
  return null;
113
114
  }
@@ -156,6 +157,10 @@ const useAggregatedData = () => {
156
157
  mask.hasPositive = mask.hasPositive || (result.value ?? 0) > 0;
157
158
  return result;
158
159
  }).filter(rectangle => rectangle !== null);
160
+ return {
161
+ seriesId,
162
+ data: seriesDataPoints
163
+ };
159
164
  });
160
165
  });
161
166
  return {
@@ -198,7 +203,9 @@ function BarPlot(props) {
198
203
  const isZoomInteracting = (0, _useInternalIsZoomInteracting.useInternalIsZoomInteracting)();
199
204
  const skipAnimation = (0, _useSkipAnimation.useSkipAnimation)(isZoomInteracting || inSkipAnimation);
200
205
  const withoutBorderRadius = !borderRadius || borderRadius <= 0;
206
+ const classes = (0, _barClasses.useUtilityClasses)();
201
207
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(BarPlotRoot, {
208
+ className: classes.root,
202
209
  children: [!withoutBorderRadius && masksData.map(({
203
210
  id,
204
211
  x,
@@ -223,45 +230,53 @@ function BarPlot(props) {
223
230
  }, id);
224
231
  }), completedData.map(({
225
232
  seriesId,
226
- dataIndex,
227
- color,
228
- maskId,
229
- layout,
230
- x,
231
- xOrigin,
232
- y,
233
- yOrigin,
234
- width,
235
- height
233
+ data
236
234
  }) => {
237
- const barElement = /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarElement.BarElement, (0, _extends2.default)({
238
- id: seriesId,
239
- dataIndex: dataIndex,
240
- color: color,
241
- skipAnimation: skipAnimation ?? false,
242
- layout: layout ?? 'vertical',
243
- x: x,
244
- xOrigin: xOrigin,
245
- y: y,
246
- yOrigin: yOrigin,
247
- width: width,
248
- height: height
249
- }, other, {
250
- onClick: onItemClick && (event => {
251
- onItemClick(event, {
252
- type: 'bar',
253
- seriesId,
254
- dataIndex
255
- });
256
- })
257
- }), `${seriesId}-${dataIndex}`);
258
- if (withoutBorderRadius) {
259
- return barElement;
260
- }
261
235
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
262
- clipPath: `url(#${maskId})`,
263
- children: barElement
264
- }, `${seriesId}-${dataIndex}`);
236
+ "data-series": seriesId,
237
+ className: classes.series,
238
+ children: data.map(({
239
+ dataIndex,
240
+ color,
241
+ maskId,
242
+ layout,
243
+ x,
244
+ xOrigin,
245
+ y,
246
+ yOrigin,
247
+ width,
248
+ height
249
+ }) => {
250
+ const barElement = /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarElement.BarElement, (0, _extends2.default)({
251
+ id: seriesId,
252
+ dataIndex: dataIndex,
253
+ color: color,
254
+ skipAnimation: skipAnimation ?? false,
255
+ layout: layout ?? 'vertical',
256
+ x: x,
257
+ xOrigin: xOrigin,
258
+ y: y,
259
+ yOrigin: yOrigin,
260
+ width: width,
261
+ height: height
262
+ }, other, {
263
+ onClick: onItemClick && (event => {
264
+ onItemClick(event, {
265
+ type: 'bar',
266
+ seriesId,
267
+ dataIndex
268
+ });
269
+ })
270
+ }), dataIndex);
271
+ if (withoutBorderRadius) {
272
+ return barElement;
273
+ }
274
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
275
+ clipPath: `url(#${maskId})`,
276
+ children: barElement
277
+ }, dataIndex);
278
+ })
279
+ }, seriesId);
265
280
  }), barLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarLabelPlot.BarLabelPlot, (0, _extends2.default)({
266
281
  bars: completedData,
267
282
  skipAnimation: skipAnimation,
@@ -0,0 +1,12 @@
1
+ export interface BarClasses {
2
+ /** Styles applied to the bar plot element. */
3
+ root: string;
4
+ /** Styles applied to the group surrounding a series' bar elements. */
5
+ series: string;
6
+ /** Styles applied to the group surrounding a series' labels. */
7
+ seriesLabels: string;
8
+ }
9
+ export type BarClassKey = keyof BarClasses;
10
+ export declare function getBarUtilityClass(slot: string): string;
11
+ export declare const barClasses: BarClasses;
12
+ export declare const useUtilityClasses: (classes?: Partial<BarClasses>) => Record<"root" | "series" | "seriesLabels", string>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.barClasses = void 0;
8
+ exports.getBarUtilityClass = getBarUtilityClass;
9
+ exports.useUtilityClasses = void 0;
10
+ var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
11
+ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
12
+ var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
13
+ function getBarUtilityClass(slot) {
14
+ return (0, _generateUtilityClass.default)('MuiBar', slot);
15
+ }
16
+ const barClasses = exports.barClasses = (0, _generateUtilityClasses.default)('MuiBar', ['root', 'series', 'seriesLabels']);
17
+ const useUtilityClasses = classes => {
18
+ const slots = {
19
+ root: ['root'],
20
+ series: ['series'],
21
+ seriesLabels: ['seriesLabels']
22
+ };
23
+ return (0, _composeClasses.default)(slots, getBarUtilityClass, classes);
24
+ };
25
+ exports.useUtilityClasses = useUtilityClasses;
@@ -2,4 +2,6 @@ export * from "./BarChart.js";
2
2
  export * from "./BarPlot.js";
3
3
  export * from "./BarElement.js";
4
4
  export * from "./BarLabel/index.js";
5
- export * from "./barElementClasses.js";
5
+ export * from "./barElementClasses.js";
6
+ export { barClasses, getBarUtilityClass } from "./barClasses.js";
7
+ export type { BarClassKey, BarClasses } from "./barClasses.js";
package/BarChart/index.js CHANGED
@@ -3,9 +3,26 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ barClasses: true,
8
+ getBarUtilityClass: true
9
+ };
10
+ Object.defineProperty(exports, "barClasses", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _barClasses.barClasses;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "getBarUtilityClass", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _barClasses.getBarUtilityClass;
20
+ }
21
+ });
6
22
  var _BarChart = require("./BarChart");
7
23
  Object.keys(_BarChart).forEach(function (key) {
8
24
  if (key === "default" || key === "__esModule") return;
25
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
9
26
  if (key in exports && exports[key] === _BarChart[key]) return;
10
27
  Object.defineProperty(exports, key, {
11
28
  enumerable: true,
@@ -17,6 +34,7 @@ Object.keys(_BarChart).forEach(function (key) {
17
34
  var _BarPlot = require("./BarPlot");
18
35
  Object.keys(_BarPlot).forEach(function (key) {
19
36
  if (key === "default" || key === "__esModule") return;
37
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
38
  if (key in exports && exports[key] === _BarPlot[key]) return;
21
39
  Object.defineProperty(exports, key, {
22
40
  enumerable: true,
@@ -28,6 +46,7 @@ Object.keys(_BarPlot).forEach(function (key) {
28
46
  var _BarElement = require("./BarElement");
29
47
  Object.keys(_BarElement).forEach(function (key) {
30
48
  if (key === "default" || key === "__esModule") return;
49
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
31
50
  if (key in exports && exports[key] === _BarElement[key]) return;
32
51
  Object.defineProperty(exports, key, {
33
52
  enumerable: true,
@@ -39,6 +58,7 @@ Object.keys(_BarElement).forEach(function (key) {
39
58
  var _BarLabel = require("./BarLabel");
40
59
  Object.keys(_BarLabel).forEach(function (key) {
41
60
  if (key === "default" || key === "__esModule") return;
61
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
42
62
  if (key in exports && exports[key] === _BarLabel[key]) return;
43
63
  Object.defineProperty(exports, key, {
44
64
  enumerable: true,
@@ -50,6 +70,7 @@ Object.keys(_BarLabel).forEach(function (key) {
50
70
  var _barElementClasses = require("./barElementClasses");
51
71
  Object.keys(_barElementClasses).forEach(function (key) {
52
72
  if (key === "default" || key === "__esModule") return;
73
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
53
74
  if (key in exports && exports[key] === _barElementClasses[key]) return;
54
75
  Object.defineProperty(exports, key, {
55
76
  enumerable: true,
@@ -57,4 +78,5 @@ Object.keys(_barElementClasses).forEach(function (key) {
57
78
  return _barElementClasses[key];
58
79
  }
59
80
  });
60
- });
81
+ });
82
+ var _barClasses = require("./barClasses");
@@ -9,7 +9,11 @@ export type AnimationData = {
9
9
  xOrigin: number;
10
10
  layout: BarSeriesType['layout'];
11
11
  };
12
- export interface CompletedBarData extends AnimationData {
12
+ export interface ProcessedBarSeriesData {
13
+ seriesId: SeriesId;
14
+ data: ProcessedBarData[];
15
+ }
16
+ export interface ProcessedBarData extends AnimationData {
13
17
  seriesId: SeriesId;
14
18
  dataIndex: number;
15
19
  color: string;
package/CHANGELOG.md CHANGED
@@ -5,6 +5,113 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.6.0
9
+
10
+ _Jun 27, 2025_
11
+
12
+ We'd like to extend a big thank you to the 12 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 📊 Add export menu to charts toolbar
15
+ - 📅 Add `usePickerAdapter` hook to access the date adapter.
16
+
17
+ You can use the adapter in your custom components if you need them to work with multiple date libraries — [Learn more](https://mui.com/x/react-date-pickers/custom-components/#access-date-adapter).
18
+ - 🌎 Improve Danish (da-DK) locale
19
+ - 🌎 Improve German (de-DE) locale
20
+
21
+ Special thanks go out to the community members for their valuable contributions:
22
+ @ShahrazH, @vadimka123
23
+
24
+ The following are all team members who have contributed to this release:
25
+ @arminmeh, @bernardobelchior, @JCQuintas, @KenanYusuf, @LukasTy, @MBilalShafi, @michelengelen, @noraleonte, @rita-codes, @sai6855
26
+
27
+ ### Data Grid
28
+
29
+ #### `@mui/x-data-grid@8.6.0`
30
+
31
+ - [DataGrid] Fix `label` type in `GridActionsCellItem` type (#18175) @sai6855
32
+ - [DataGrid] Fix grid menu not closing when pressing escape/tab (#18300) @KenanYusuf
33
+ - [l10n] Improve Danish (da-DK) locale (#18428) @ShahrazH
34
+ - [l10n] Improve German (de-DE) locale (#18388) @omalyutin
35
+
36
+ #### `@mui/x-data-grid-pro@8.6.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
37
+
38
+ Same changes as in `@mui/x-data-grid@8.6.0`, plus:
39
+
40
+ - [DataGridPro] Fix lazy loading params calculated from rendering context (#18460) @arminmeh
41
+
42
+ #### `@mui/x-data-grid-premium@8.6.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link "Premium plan")
43
+
44
+ Same changes as in `@mui/x-data-grid-pro@8.6.0`.
45
+
46
+ ### Date and Time Pickers
47
+
48
+ #### `@mui/x-date-pickers@8.6.0`
49
+
50
+ - [pickers] Add `usePickerAdapter` hook (#18457) @LukasTy
51
+ - [pickers] Fix to use latest `value` when updating `lastCommittedValue` in internal state (#18518) @LukasTy
52
+ - [pickers] Use `usePickerAdapter` hook internally instead of `useUtils` (#18465) @LukasTy
53
+
54
+ #### `@mui/x-date-pickers-pro@8.6.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
55
+
56
+ Same changes as in `@mui/x-date-pickers@8.6.0`.
57
+
58
+ ### Charts
59
+
60
+ #### `@mui/x-charts@8.6.0`
61
+
62
+ - [charts] Add `data-series` to charts legend item (#18414) @bernardobelchior
63
+ - [charts] Add `data-series` to bar charts (#18413) @bernardobelchior
64
+ - [charts] Add `data-series` to elements of line chart (#18409) @bernardobelchior
65
+ - [charts] Add `data-series` to pie charts (#18432) @bernardobelchior
66
+ - [charts] Fix missing key in bar plot (#18502) @bernardobelchior
67
+ - [charts] Split axis utils from main file (#18517) @JCQuintas
68
+ - [charts] Improve touch behavior for polar axis (#18531) @JCQuintas
69
+ - [charts] Add `isElementInside` helper (#18530) @JCQuintas
70
+
71
+ #### `@mui/x-charts-pro@8.6.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
72
+
73
+ Same changes as in `@mui/x-charts@8.6.0`, plus:
74
+
75
+ - [charts-pro] Add export menu to charts toolbar (#18210) @bernardobelchior
76
+ - [charts-pro] Fix export docs mentioning tooltip instead of toolbar (#18490) @bernardobelchior
77
+ - [charts-pro] Fix iframe not being removed after print export (#18500) @bernardobelchior
78
+
79
+ ### Tree View
80
+
81
+ #### `@mui/x-tree-view@8.6.0`
82
+
83
+ Internal changes.
84
+
85
+ #### `@mui/x-tree-view-pro@8.6.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
86
+
87
+ Same changes as in `@mui/x-tree-view@8.6.0`, plus:
88
+
89
+ - [tree view pro] Fix theme augmentation (#18437) @LukasTy
90
+
91
+ ### Codemod
92
+
93
+ #### `@mui/x-codemod@8.6.0`
94
+
95
+ Internal changes.
96
+
97
+ ### Docs
98
+
99
+ - [docs] Document `GridRenderContext` (#18492) @arminmeh
100
+ - [docs] Prevent stale rows to appear on sort and filter change in the lazy loading demo (#18461) @arminmeh
101
+ - [docs][pickers] Update action bar demo to use the `nextOrAccept` action (#18505) @LukasTy
102
+ - [docs] Update indeterminate checkbox section in migration guide (#18229) @michelengelen
103
+ - [docs] Data source nested pagination recipe (#14777) @MBilalShafi
104
+
105
+ ### Core
106
+
107
+ - [core] Avoid json stringify whole window object (#18512) @vadimka123
108
+
109
+ ### Miscellaneous
110
+
111
+ - [code-infra] Dynamically get pickers adapters dependencies versions (#18446) @JCQuintas
112
+ - [infra] Adjust inquirer version and usage (#18495) @michelengelen
113
+ - [infra] Use `String.raw` for creating the remote regex (#18462) @michelengelen
114
+
8
115
  ## 8.5.3
9
116
 
10
117
  _Jun 19, 2025_
@@ -88,6 +88,7 @@ const ChartsLegend = exports.ChartsLegend = (0, _consumeSlots.consumeSlots)('Mui
88
88
  children: data.items.map((item, i) => {
89
89
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
90
90
  className: classes?.item,
91
+ "data-series": item.id,
91
92
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Element, {
92
93
  className: classes?.series,
93
94
  role: onItemClick ? 'button' : undefined,
@@ -15,24 +15,22 @@ 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 _clampAngle = require("../internals/clampAngle");
19
18
  var _useIsHydrated = require("../hooks/useIsHydrated");
20
- var _ellipsize = require("../internals/ellipsize");
21
19
  var _domUtils = require("../internals/domUtils");
22
20
  var _useTicks = require("../hooks/useTicks");
23
21
  var _axisClasses = require("../ChartsAxis/axisClasses");
24
22
  var _AxisSharedComponents = require("../internals/components/AxisSharedComponents");
25
23
  var _ChartsText = require("../ChartsText");
26
- var _geometry = require("../internals/geometry");
27
24
  var _useMounted = require("../hooks/useMounted");
28
25
  var _useDrawingArea = require("../hooks/useDrawingArea");
29
- var _getWordsByLines = require("../internals/getWordsByLines");
30
26
  var _isInfinity = require("../internals/isInfinity");
31
27
  var _isBandScale = require("../internals/isBandScale");
32
28
  var _useChartContext = require("../context/ChartProvider/useChartContext");
33
29
  var _useAxis = require("../hooks/useAxis");
34
30
  var _defaultTextPlacement = require("../ChartsText/defaultTextPlacement");
35
31
  var _invertTextAnchor = require("../internals/invertTextAnchor");
32
+ var _shortenLabels = require("./shortenLabels");
33
+ var _getVisibleLabels = require("./getVisibleLabels");
36
34
  var _jsxRuntime = require("react/jsx-runtime");
37
35
  const _excluded = ["scale", "tickNumber", "reverse"];
38
36
  const useUtilityClasses = ownerState => {
@@ -56,108 +54,6 @@ const useUtilityClasses = ownerState => {
56
54
  const TICK_LABEL_GAP = 3;
57
55
  /* Gap between the axis label and tick labels. */
58
56
  const AXIS_LABEL_TICK_LABEL_GAP = 4;
59
-
60
- /* Returns a set of indices of the tick labels that should be visible. */
61
- function getVisibleLabels(xTicks, {
62
- tickLabelStyle: style,
63
- tickLabelInterval,
64
- tickLabelMinGap,
65
- reverse,
66
- isMounted,
67
- isXInside
68
- }) {
69
- const getTickLabelSize = tick => {
70
- if (!isMounted || tick.formattedValue === undefined) {
71
- return {
72
- width: 0,
73
- height: 0
74
- };
75
- }
76
- const tickSizes = (0, _getWordsByLines.getWordsByLines)({
77
- style,
78
- needsComputation: true,
79
- text: tick.formattedValue
80
- });
81
- return {
82
- width: Math.max(...tickSizes.map(size => size.width)),
83
- height: Math.max(tickSizes.length * tickSizes[0].height)
84
- };
85
- };
86
- if (typeof tickLabelInterval === 'function') {
87
- return new Set(xTicks.filter((item, index) => tickLabelInterval(item.value, index)));
88
- }
89
-
90
- // Filter label to avoid overlap
91
- let previousTextLimit = 0;
92
- const direction = reverse ? -1 : 1;
93
- return new Set(xTicks.filter((item, labelIndex) => {
94
- const {
95
- offset,
96
- labelOffset
97
- } = item;
98
- const textPosition = offset + labelOffset;
99
- if (labelIndex > 0 && direction * textPosition < direction * (previousTextLimit + tickLabelMinGap)) {
100
- return false;
101
- }
102
- if (!isXInside(textPosition)) {
103
- return false;
104
- }
105
-
106
- /* Measuring text width is expensive, so we need to delay it as much as possible to improve performance. */
107
- const {
108
- width,
109
- height
110
- } = getTickLabelSize(item);
111
- const distance = (0, _geometry.getMinXTranslation)(width, height, style?.angle);
112
- const currentTextLimit = textPosition - direction * distance / 2;
113
- if (labelIndex > 0 && direction * currentTextLimit < direction * (previousTextLimit + tickLabelMinGap)) {
114
- // Except for the first label, we skip all label that overlap with the last accepted.
115
- // Notice that the early return prevents `previousTextLimit` from being updated.
116
- return false;
117
- }
118
- previousTextLimit = textPosition + direction * distance / 2;
119
- return true;
120
- }));
121
- }
122
- function shortenLabels(visibleLabels, drawingArea, maxHeight, isRtl, tickLabelStyle) {
123
- const shortenedLabels = new Map();
124
- const angle = (0, _clampAngle.clampAngle)(tickLabelStyle?.angle ?? 0);
125
-
126
- // Multiplying the space available to the left of the text position by leftBoundFactor returns the max width of the text.
127
- // Same for rightBoundFactor
128
- let leftBoundFactor = 1;
129
- let rightBoundFactor = 1;
130
- if (tickLabelStyle?.textAnchor === 'start') {
131
- leftBoundFactor = Infinity;
132
- rightBoundFactor = 1;
133
- } else if (tickLabelStyle?.textAnchor === 'end') {
134
- leftBoundFactor = 1;
135
- rightBoundFactor = Infinity;
136
- } else {
137
- leftBoundFactor = 2;
138
- rightBoundFactor = 2;
139
- }
140
- if (angle > 90 && angle < 270) {
141
- [leftBoundFactor, rightBoundFactor] = [rightBoundFactor, leftBoundFactor];
142
- }
143
- if (isRtl) {
144
- [leftBoundFactor, rightBoundFactor] = [rightBoundFactor, leftBoundFactor];
145
- }
146
- for (const item of visibleLabels) {
147
- if (item.formattedValue) {
148
- // That maximum width of the tick depends on its proximity to the axis bounds.
149
- const width = Math.min((item.offset + item.labelOffset) * leftBoundFactor, (drawingArea.left + drawingArea.width + drawingArea.right - item.offset - item.labelOffset) * rightBoundFactor);
150
- const doesTextFit = text => (0, _ellipsize.doesTextFitInRect)(text, {
151
- width,
152
- height: maxHeight,
153
- angle,
154
- measureText: string => (0, _domUtils.getStringSize)(string, tickLabelStyle)
155
- });
156
- shortenedLabels.set(item, (0, _ellipsize.ellipsize)(item.formattedValue.toString(), doesTextFit));
157
- }
158
- }
159
- return shortenedLabels;
160
- }
161
57
  const XAxisRoot = (0, _styles.styled)(_AxisSharedComponents.AxisRoot, {
162
58
  name: 'MuiChartsXAxis',
163
59
  slot: 'Root'
@@ -261,7 +157,7 @@ function ChartsXAxis(inProps) {
261
157
  tickLabelPlacement,
262
158
  direction: 'x'
263
159
  });
264
- const visibleLabels = getVisibleLabels(xTicks, {
160
+ const visibleLabels = (0, _getVisibleLabels.getVisibleLabels)(xTicks, {
265
161
  tickLabelStyle: axisTickLabelProps.style,
266
162
  tickLabelInterval,
267
163
  tickLabelMinGap,
@@ -299,7 +195,7 @@ function ChartsXAxis(inProps) {
299
195
 
300
196
  /* If there's an axis title, the tick labels have less space to render */
301
197
  const tickLabelsMaxHeight = Math.max(0, axisHeight - (label ? labelHeight + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
302
- const tickLabels = isHydrated ? shortenLabels(visibleLabels, drawingArea, tickLabelsMaxHeight, isRtl, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
198
+ const tickLabels = isHydrated ? (0, _shortenLabels.shortenLabels)(visibleLabels, drawingArea, tickLabelsMaxHeight, isRtl, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
303
199
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(XAxisRoot, {
304
200
  transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
305
201
  className: classes.root,
@@ -0,0 +1,14 @@
1
+ import { TickItemType } from "../hooks/useTicks.js";
2
+ import { ChartsXAxisProps, ComputedXAxis } from "../models/axis.js";
3
+ export declare function getVisibleLabels(xTicks: TickItemType[], {
4
+ tickLabelStyle: style,
5
+ tickLabelInterval,
6
+ tickLabelMinGap,
7
+ reverse,
8
+ isMounted,
9
+ isXInside
10
+ }: Pick<ChartsXAxisProps, 'tickLabelInterval' | 'tickLabelStyle'> & Pick<ComputedXAxis, 'reverse'> & {
11
+ isMounted: boolean;
12
+ tickLabelMinGap: NonNullable<ChartsXAxisProps['tickLabelMinGap']>;
13
+ isXInside: (x: number) => boolean;
14
+ }): Set<TickItemType>;