@mui/x-charts 7.0.0-beta.7 → 7.0.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 (57) hide show
  1. package/CHANGELOG.md +195 -12
  2. package/README.md +1 -1
  3. package/context/CartesianContextProvider.js +2 -2
  4. package/esm/BarChart/BarChart.js +6 -9
  5. package/esm/BarChart/BarElement.js +2 -3
  6. package/esm/BarChart/BarPlot.js +5 -8
  7. package/esm/BarChart/extremums.js +2 -3
  8. package/esm/BarChart/formatter.js +2 -6
  9. package/esm/ChartsAxis/ChartsAxis.js +3 -4
  10. package/esm/ChartsLegend/ChartsLegend.js +2 -3
  11. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -4
  12. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +2 -3
  13. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +2 -3
  14. package/esm/ChartsText/ChartsText.js +1 -1
  15. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  16. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
  17. package/esm/ChartsTooltip/ChartsTooltip.js +6 -7
  18. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -4
  19. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -2
  20. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +4 -6
  21. package/esm/ChartsXAxis/ChartsXAxis.js +13 -14
  22. package/esm/ChartsYAxis/ChartsYAxis.js +9 -10
  23. package/esm/Gauge/GaugeContainer.js +18 -21
  24. package/esm/Gauge/GaugeProvider.js +3 -3
  25. package/esm/LineChart/AreaElement.js +2 -3
  26. package/esm/LineChart/AreaPlot.js +2 -3
  27. package/esm/LineChart/LineChart.js +3 -6
  28. package/esm/LineChart/LineElement.js +2 -3
  29. package/esm/LineChart/LineHighlightPlot.js +3 -4
  30. package/esm/LineChart/LinePlot.js +2 -3
  31. package/esm/LineChart/MarkElement.js +1 -2
  32. package/esm/LineChart/MarkPlot.js +3 -4
  33. package/esm/LineChart/extremums.js +2 -3
  34. package/esm/LineChart/formatter.js +2 -6
  35. package/esm/PieChart/PieArcLabelPlot.js +3 -5
  36. package/esm/PieChart/PieArcPlot.js +2 -3
  37. package/esm/PieChart/PieChart.js +2 -2
  38. package/esm/PieChart/PiePlot.js +9 -9
  39. package/esm/PieChart/dataTransform/useTransformData.js +5 -6
  40. package/esm/PieChart/formatter.js +6 -13
  41. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +15 -18
  42. package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +2 -2
  43. package/esm/ScatterChart/ScatterPlot.js +5 -6
  44. package/esm/SparkLineChart/SparkLineChart.js +1 -1
  45. package/esm/context/CartesianContextProvider.js +18 -24
  46. package/esm/context/DrawingProvider.js +1 -1
  47. package/esm/context/SeriesContextProvider.js +2 -4
  48. package/esm/hooks/useAxisEvents.js +1 -1
  49. package/esm/hooks/useInteractionItemProps.js +2 -2
  50. package/esm/hooks/useScale.js +2 -2
  51. package/esm/hooks/useTicks.js +23 -32
  52. package/esm/internals/defaultizeValueFormatter.js +1 -2
  53. package/esm/internals/stackSeries.js +2 -3
  54. package/index.js +1 -1
  55. package/modern/context/CartesianContextProvider.js +2 -2
  56. package/modern/index.js +1 -1
  57. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -3,6 +3,189 @@
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
+ ## v7.0.0
7
+
8
+ _Mar 22, 2024_
9
+
10
+ We're excited to [announce the first v7 stable release](https://mui.com/blog/mui-x-v7/)! 🎉🚀
11
+
12
+ This is now the officially supported major version, where we'll keep rolling out new features, bug fixes, and improvements.
13
+ Migration guides are available with a complete list of the breaking changes:
14
+
15
+ - [Data Grid](https://mui.com/x/migration/migration-data-grid-v6/)
16
+ - [Date and Time Pickers](https://mui.com/x/migration/migration-pickers-v6/)
17
+ - [Tree View](https://mui.com/x/migration/migration-tree-view-v6/)
18
+ - [Charts](https://mui.com/x/migration/migration-charts-v6/)
19
+
20
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
21
+
22
+ - 🚀 Improve the usage of custom `viewRenderers` on `DateTimePicker` (#12441) @LukasTy
23
+ - ✨ Set focus on the focused Tree Item instead of the Tree View (#12226) @flaviendelangle
24
+ - đŸ•šī¸ Support controlled `density` for the Data Grid (#12332) @MBilalShafi
25
+ - 🎁 Dynamic virtualization range for the Data Grid (#12353) @romgrk
26
+ - 🐞 Bugfixes
27
+ - 📚 Documentation improvements
28
+
29
+ ### Data Grid
30
+
31
+ #### Breaking changes
32
+
33
+ - The `density` is a [controlled prop](https://mui.com/x/react-data-grid/accessibility/#set-the-density-programmatically) now, if you were previously passing the `density` prop to the Data Grid, you will need to do one of the following:
34
+
35
+ 1. Move it to the `initialState.density` to initialize it.
36
+
37
+ ```diff
38
+ <DataGrid
39
+ - density="compact"
40
+ + initialState={{ density: "compact" }}
41
+ />
42
+ ```
43
+
44
+ 2. Move it to the state and use `onDensityChange` callback to update the `density` prop accordingly for it to work as expected.
45
+
46
+ ```diff
47
+ + const [density, setDensity] = React.useState<GridDensity>('compact');
48
+ <DataGrid
49
+ - density="compact"
50
+ + density={density}
51
+ + onDensityChange={(newDensity) => setDensity(newDensity)}
52
+ />
53
+ ```
54
+
55
+ - The selector `gridDensityValueSelector` was removed, use the `gridDensitySelector` instead.
56
+
57
+ - The props `rowBuffer` and `columnBuffer` were renamed to `rowBufferPx` and `columnBufferPx`.
58
+ Their value is now a pixel value rather than a number of items. Their default value is now `150`.
59
+
60
+ - The props `rowThreshold` and `columnThreshold` have been removed.
61
+ If you had the `rowThreshold` prop set to `0` to force new rows to be rendered more often – this is no longer necessary.
62
+
63
+ #### `@mui/x-data-grid@7.0.0`
64
+
65
+ - [DataGrid] Allow to control the grid density (#12332) @MBilalShafi
66
+ - [DataGrid] Dynamic virtualization range (#12353) @romgrk
67
+ - [DataGrid] Fix `ElementType` usage (#12479) @cherniavskii
68
+ - [DataGrid] Fix cell value formatting on copy (#12357) @sai6855
69
+ - [DataGrid] Fix checkbox selection is keeping selection when filtering (#11751) @g1mishra
70
+ - [DataGrid] Make `rows` an optional prop (#12478) @MBilalShafi
71
+
72
+ #### `@mui/x-data-grid-pro@7.0.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
73
+
74
+ Same changes as in `@mui/x-data-grid@7.0.0`.
75
+
76
+ #### `@mui/x-data-grid-premium@7.0.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
77
+
78
+ Same changes as in `@mui/x-data-grid-pro@7.0.0`, plus:
79
+
80
+ - [DataGridPremium] Add support for confirmation before clipboard paste (#12225) @cherniavskii
81
+ - [DataGridPremium] Fix single grouping column sorting (#9679) @cherniavskii
82
+ - [DataGridPremium] Fix boolean cell not rendered in group rows (#12492) @sai6855
83
+
84
+ ### Date and Time Pickers
85
+
86
+ #### Breaking changes
87
+
88
+ - The `DesktopDateTimePicker` view rendering has been optimized by using the same technique as for `DesktopDateTimeRangePicker`.
89
+ - The `dateTimeViewRenderers` have been removed in favor of reusing existing time view renderers (`renderTimeViewClock`, `renderDigitalClockTimeView` and `renderMultiSectionDigitalClockTimeView`) and date view renderer (`renderDateViewCalendar`).
90
+ - Passing `renderTimeViewClock` to time view renderers will no longer revert to the old behavior of rendering only date or time view.
91
+
92
+ #### `@mui/x-date-pickers@7.0.0`
93
+
94
+ - [fields] Allow to override the separator between the start and the end date in all range fields (#12174) @flaviendelangle
95
+ - [fields] Support format without separator (#12489) @flaviendelangle
96
+ - [pickers] Use renderer interceptor on `DesktopDateTimePicker` (#12441) @LukasTy
97
+
98
+ #### `@mui/x-date-pickers-pro@7.0.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
99
+
100
+ Same changes as in `@mui/x-date-pickers@7.0.0`, plus:
101
+
102
+ - [DateTimeRangePicker] Add component `JSDoc` (#12518) @LukasTy
103
+ - [DateTimeRangePicker] Fix views behavior regression (#12529) @LukasTy
104
+
105
+ ### Charts
106
+
107
+ #### `@mui/x-charts@7.0.0`
108
+
109
+ - [charts] Fix small typo in `CartesianContextProvider` (#12461) @Janpot
110
+
111
+ ### Tree View
112
+
113
+ #### Breaking changes
114
+
115
+ - The required `nodeId` prop used by the `TreeItem` has been renamed to `itemId` for consistency:
116
+
117
+ ```diff
118
+ <TreeView>
119
+ - <TreeItem label="Item 1" nodeId="one">
120
+ + <TreeItem label="Item 1" itemId="one">
121
+ </TreeView>
122
+ ```
123
+
124
+ - The focus is now applied to the Tree Item root element instead of the Tree View root element.
125
+
126
+ This change will allow new features that require the focus to be on the Tree Item,
127
+ like the drag and drop reordering of items.
128
+ It also solves several issues with focus management,
129
+ like the inability to scroll to the focused item when a lot of items are rendered.
130
+
131
+ This will mostly impact how you write tests to interact with the Tree View:
132
+
133
+ For example, if you were writing a test with `react-testing-library`, here is what the changes could look like:
134
+
135
+ ```diff
136
+ it('test example on first item', () => {
137
+ - const { getByRole } = render(
138
+ + const { getAllByRole } = render(
139
+ <SimpleTreeView>
140
+ <TreeItem nodeId="one" />
141
+ <TreeItem nodeId="two" />
142
+ </SimpleTreeView>
143
+ );
144
+
145
+ - const tree = getByRole('tree');
146
+ + const firstTreeItem = getAllByRole('treeitem')[0];
147
+ act(() => {
148
+ - tree.focus();
149
+ + firstTreeItem.focus();
150
+ });
151
+ - fireEvent.keyDown(tree, { key: 'ArrowDown' });
152
+ + fireEvent.keyDown(firstTreeItem, { key: 'ArrowDown' });
153
+ })
154
+ ```
155
+
156
+ #### `@mui/x-tree-view@7.0.0`
157
+
158
+ - [TreeView] Rename `nodeId` to `itemId` (#12418) @noraleonte
159
+ - [TreeView] Set focus on the focused Tree Item instead of the Tree View (#12226) @flaviendelangle
160
+ - [TreeView] Update JSDoc of the `ContentComponent` prop to avoid using the word "node" (#12476) @flaviendelangle
161
+
162
+ ### `@mui/x-codemod@7.0.0`
163
+
164
+ - [codemod] Add a codemod and update the grid migration guide (#12488) @MBilalShafi
165
+
166
+ ### Docs
167
+
168
+ - [docs] Finalize migration guide (#12501) @noraleonte
169
+ - [docs] Fix nested cells alignment in the popular features demo (#12450) @cherniavskii
170
+ - [docs] Fix some Vale errors (#12469) @oliviertassinari
171
+ - [docs] Remove mentions of pre release (#12513) @noraleonte
172
+ - [docs] Update branch name and tags (#12498) @cherniavskii
173
+ - [docs] Update links to v6 (#12496) @cherniavskii
174
+ - [docs] Update links to v7 docs (#12500) @noraleonte
175
+ - [docs] Update supported versions (#12508) @joserodolfofreitas
176
+ - [docs] Update "What's new in MUI X" page #12527 @cherniavskii
177
+
178
+ ### Core
179
+
180
+ - [core] Bump `@mui/material` peer dependency for all packages (#12516) @LukasTy
181
+ - [core] Fix `no-restricted-imports` ESLint rule not working for Data Grid packages (#12477) @cherniavskii
182
+ - [core] Lower the frequency of `no-response` action runs (#12491) @michaldudak
183
+ - [core] Remove leftover `legacy` `browserlistrc` entry (#12415) @LukasTy
184
+ - [core] Update NPM tag (#12511) @cherniavskii
185
+ - [core] Update supported browsers (browserlistrc) (#12521) @LukasTy
186
+ - [core] Use Circle CI context @oliviertassinari
187
+ - [license] Fix grammar on expired license error message (#12460) @joserodolfofreitas
188
+
6
189
  ## 7.0.0-beta.7
7
190
 
8
191
  _Mar 14, 2024_
@@ -90,7 +273,7 @@ The `onNodeFocus` callback has been renamed to `onItemFocus` for consistency:
90
273
  - [docs] Add `legacy` bundle drop mention in migration pages (#12424) @LukasTy
91
274
  - [docs] Add missing luxon `Info` import (#12427) @LukasTy
92
275
  - [docs] Improve slots definitions for charts (#12408) @alexfauquette
93
- - [docs] Polish What's new in MUI X blog titles (#12309) @oliviertassinari
276
+ - [docs] Polish What's new in MUI X blog titles (#12309) @oliviertassinari
94
277
  - [docs] Replace `rel="noreferrer"` by `rel="noopener"` @oliviertassinari
95
278
  - [docs] Update `date-fns` `weekStarsOn` overriding example (#12416) @LukasTy
96
279
 
@@ -252,7 +435,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-beta.5`.
252
435
  ### Docs
253
436
 
254
437
  - [docs] Fix image layout shift when loading @oliviertassinari
255
- - [docs] Match Material UI repo comment for redirections @oliviertassinari
438
+ - [docs] Match Material UI repo comment for redirections @oliviertassinari
256
439
  - [docs] Non breaking spaces @oliviertassinari
257
440
  - [docs] Polish the Date Picker playground (#11869) @zanivan
258
441
  - [docs] Standardize WAI-ARIA references @oliviertassinari
@@ -263,9 +446,9 @@ Same changes as in `@mui/x-date-pickers@7.0.0-beta.5`.
263
446
  - [core] Remove grid folder from `getComponentInfo` RegExp (#12241) @flaviendelangle
264
447
  - [core] Remove `window.` reference for common globals @oliviertassinari
265
448
  - [core] Use runtime agnostic setTimeout type @oliviertassinari
266
- - [docs-infra] Fix Stack Overflow breaking space @oliviertassinari
449
+ - [docs-infra] Fix Stack Overflow breaking space @oliviertassinari
267
450
  - [docs-infra] Fix missing non breaking spaces @oliviertassinari
268
- - [github] Update `no-response` workflow (#12193) @MBilalShafi
451
+ - [infra] Update `no-response` workflow (#12193) @MBilalShafi
269
452
  - [infra] Fix missing permission reset @oliviertassinari
270
453
 
271
454
  ## 7.0.0-beta.4
@@ -282,7 +465,7 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
282
465
 
283
466
  ### Breaking changes
284
467
 
285
- - The support for IE11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE11 is no longer included.
468
+ - The support for IE11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE11 is no longer included.
286
469
 
287
470
  ### Data Grid
288
471
 
@@ -324,7 +507,7 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.4`.
324
507
  - The headless field hooks (e.g.: `useDateField`) now returns a new prop called `enableAccessibleFieldDOMStructure`.
325
508
  This property is utilized to determine whether the anticipated UI is constructed using an accessible DOM structure. Learn more about this new [accessible DOM structure](/x/react-date-pickers/fields/#accessible-dom-structure).
326
509
 
327
- When building a custom UI, you are most-likely only supporting one DOM structure, so you can remove `enableAccessibleFieldDOMStructure` before it is passed to the DOM:
510
+ When building a custom UI, you are most-likely only supporting one DOM structure, so you can remove `enableAccessibleFieldDOMStructure` before it is passed to the DOM:
328
511
 
329
512
  ```diff
330
513
  function MyCustomTextField(props) {
@@ -392,7 +575,7 @@ These components are no longer exported from `@mui/x-charts`:
392
575
  ### Docs
393
576
 
394
577
  - [docs] Add recipe for hiding separator on non-resizable columns (#12134) @michelengelen
395
- - [docs] Add small improvements to the Gauge Chart page (#12076) @danilo-leal
578
+ - [docs] Add small improvements to the Gauge page (#12076) @danilo-leal
396
579
  - [docs] Add the 'point' scaleType to the axis documentation (#12179) @alexfauquette
397
580
  - [docs] Clarify Pickers 'Component composition' section (#12097) @LukasTy
398
581
  - [docs] Fix "Licensing" page link (#12156) @LukasTy
@@ -975,7 +1158,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.9`.
975
1158
 
976
1159
  - [charts] Do not propagate `innerRadius` and `outerRadius` to the DOM (#11689) @alexfauquette
977
1160
  - [charts] Fix default `stackOffset` for `LineChart` (#11647) @alexfauquette
978
- - [charts] Remove a TS ignore (#11688) @alexfauquette
1161
+ - [charts] Remove a TypeScript ignore (#11688) @alexfauquette
979
1162
 
980
1163
  ### Tree View
981
1164
 
@@ -1404,7 +1587,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.7`.
1404
1587
  - [core] Fix release changelog (#11496) @romgrk
1405
1588
  - [core] Fix use of ::before & ::after (#11515) @oliviertassinari
1406
1589
  - [core] Localize the issue template to MUI X (#11511) @oliviertassinari
1407
- - [core] Regen api files (#11542) @flaviendelangle
1590
+ - [core] Regenerate API files (#11542) @flaviendelangle
1408
1591
  - [core] Remove issue emoji @oliviertassinari
1409
1592
  - [core] Sync the release instructions with MUI Core @oliviertassinari
1410
1593
  - [core] Yaml format match most common convention @oliviertassinari
@@ -1447,7 +1630,7 @@ We'd like to offer a big thanks to the 6 contributors who made this release poss
1447
1630
 
1448
1631
  - The `filterModel` now supports `Date` objects as values for `date` and `dateTime` column types.
1449
1632
  The `filterModel` still accepts strings as values for `date` and `dateTime` column types,
1450
- but all updates to the `filterModel` coming from the UI (e.g. filter panel) will set the value as a `Date` object.
1633
+ but all updates to the `filterModel` coming from the UI (for example filter panel) will set the value as a `Date` object.
1451
1634
 
1452
1635
  #### `@mui/x-data-grid@7.0.0-alpha.6`
1453
1636
 
@@ -1658,7 +1841,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.5`, plus:
1658
1841
  ### Core
1659
1842
 
1660
1843
  - [core] Automate cherry-pick of PRs from `next` -> `master` (#11382) @MBilalShafi
1661
- - [github] Update `no-response` workflow (#11369) @MBilalShafi
1844
+ - [infra] Update `no-response` workflow (#11369) @MBilalShafi
1662
1845
  - [test] Fix flaky screenshots (#11388) @cherniavskii
1663
1846
 
1664
1847
  ## 7.0.0-alpha.4
@@ -1896,7 +2079,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.3`.
1896
2079
 
1897
2080
  - [charts] Adjusted `defaultizeValueFormatter` util to accept an optional `series.valueFormatter` value (#11144) @michelengelen
1898
2081
  - [charts] Apply `labelStyle` and `tickLabelStyle` props on `<ChartsYAxis />` (#11180) @akamfoad
1899
- - [charts] Fix TS config (#11259) @alexfauquette
2082
+ - [charts] Fix TypeScript config (#11259) @alexfauquette
1900
2083
  - [charts] Fix error with empty dataset (#11063) @alexfauquette
1901
2084
  - [charts] Fix export strategy (#11235) @alexfauquette
1902
2085
  - [charts] Remove outdated prop-types (#11045) @alexfauquette
package/README.md CHANGED
@@ -15,7 +15,7 @@ This component has the following peer dependencies that you will need to install
15
15
 
16
16
  ```json
17
17
  "peerDependencies": {
18
- "@mui/material": "^5.15.0",
18
+ "@mui/material": "^5.15.14",
19
19
  "react": "^17.0.0 || ^18.0.0",
20
20
  "react-dom": "^17.0.0 || ^18.0.0"
21
21
  },
@@ -100,7 +100,7 @@ function CartesianContextProvider(props) {
100
100
  return charTypes.reduce((acc, charType) => axisExtremumCallback(acc, charType, axis, getters, isDefaultAxis), [null, null]);
101
101
  };
102
102
  const allXAxis = [...(xAxis?.map((axis, index) => (0, _extends2.default)({
103
- id: `deaultized-x-axis-${index}`
103
+ id: `defaultized-x-axis-${index}`
104
104
  }, axis)) ?? []),
105
105
  // Allows to specify an axis with id=DEFAULT_X_AXIS_KEY
106
106
  ...(xAxis === undefined || xAxis.findIndex(({
@@ -151,7 +151,7 @@ function CartesianContextProvider(props) {
151
151
  });
152
152
  });
153
153
  const allYAxis = [...(yAxis?.map((axis, index) => (0, _extends2.default)({
154
- id: `deaultized-y-axis-${index}`
154
+ id: `defaultized-y-axis-${index}`
155
155
  }, axis)) ?? []), ...(yAxis === undefined || yAxis.findIndex(({
156
156
  id
157
157
  }) => id === _constants.DEFAULT_Y_AXIS_KEY) === -1 ? [{
@@ -58,10 +58,7 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
58
58
  const defaultAxisConfig = {
59
59
  scaleType: 'band',
60
60
  data: Array.from({
61
- length: Math.max(...series.map(s => {
62
- var _ref, _s$data;
63
- return ((_ref = (_s$data = s.data) != null ? _s$data : dataset) != null ? _ref : []).length;
64
- }))
61
+ length: Math.max(...series.map(s => (s.data ?? dataset ?? []).length))
65
62
  }, (_, index) => index)
66
63
  };
67
64
  const defaultizedAxisHighlight = _extends({}, hasHorizontalSeries ? {
@@ -79,16 +76,16 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
79
76
  width: width,
80
77
  height: height,
81
78
  margin: margin,
82
- xAxis: xAxis != null ? xAxis : hasHorizontalSeries ? undefined : [_extends({
79
+ xAxis: xAxis ?? (hasHorizontalSeries ? undefined : [_extends({
83
80
  id: DEFAULT_X_AXIS_KEY
84
- }, defaultAxisConfig)],
85
- yAxis: yAxis != null ? yAxis : hasHorizontalSeries ? [_extends({
81
+ }, defaultAxisConfig)]),
82
+ yAxis: yAxis ?? (hasHorizontalSeries ? [_extends({
86
83
  id: DEFAULT_Y_AXIS_KEY
87
- }, defaultAxisConfig)] : undefined,
84
+ }, defaultAxisConfig)] : undefined),
88
85
  colors: colors,
89
86
  dataset: dataset,
90
87
  sx: sx,
91
- disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none' && !onAxisClick,
88
+ disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
92
89
  children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
93
90
  onAxisClick: onAxisClick
94
91
  }), grid && /*#__PURE__*/_jsx(ChartsGrid, {
@@ -41,7 +41,6 @@ export const BarElementPath = styled(animated.rect, {
41
41
  opacity: ownerState.isFaded && 0.3 || 1
42
42
  }));
43
43
  function BarElement(props) {
44
- var _slots$bar;
45
44
  const {
46
45
  id,
47
46
  dataIndex,
@@ -77,10 +76,10 @@ function BarElement(props) {
77
76
  isHighlighted
78
77
  };
79
78
  const classes = useUtilityClasses(ownerState);
80
- const Bar = (_slots$bar = slots == null ? void 0 : slots.bar) != null ? _slots$bar : BarElementPath;
79
+ const Bar = slots?.bar ?? BarElementPath;
81
80
  const barProps = useSlotProps({
82
81
  elementType: Bar,
83
- externalSlotProps: slotProps == null ? void 0 : slotProps.bar,
82
+ externalSlotProps: slotProps?.bar,
84
83
  additionalProps: _extends({}, other, getInteractionItemProps({
85
84
  type: 'bar',
86
85
  seriesId: id,
@@ -38,8 +38,7 @@ function getBandSize({
38
38
  };
39
39
  }
40
40
  const useAggregatedData = () => {
41
- var _React$useContext$bar;
42
- const seriesData = (_React$useContext$bar = React.useContext(SeriesContext).bar) != null ? _React$useContext$bar : {
41
+ const seriesData = React.useContext(SeriesContext).bar ?? {
43
42
  series: {},
44
43
  stackingGroups: [],
45
44
  seriesOrder: []
@@ -61,9 +60,8 @@ const useAggregatedData = () => {
61
60
  ids: groupIds
62
61
  }, groupIndex) => {
63
62
  return groupIds.flatMap(seriesId => {
64
- var _series$seriesId$xAxi, _series$seriesId$yAxi;
65
- const xAxisKey = (_series$seriesId$xAxi = series[seriesId].xAxisKey) != null ? _series$seriesId$xAxi : defaultXAxisId;
66
- const yAxisKey = (_series$seriesId$yAxi = series[seriesId].yAxisKey) != null ? _series$seriesId$yAxi : defaultYAxisId;
63
+ const xAxisKey = series[seriesId].xAxisKey ?? defaultXAxisId;
64
+ const yAxisKey = series[seriesId].yAxisKey ?? defaultYAxisId;
67
65
  const xAxisConfig = xAxis[xAxisKey];
68
66
  const yAxisConfig = yAxis[yAxisKey];
69
67
  const verticalLayout = series[seriesId].layout === 'vertical';
@@ -102,7 +100,6 @@ const useAggregatedData = () => {
102
100
  color
103
101
  } = series[seriesId];
104
102
  return stackedData.map((values, dataIndex) => {
105
- var _xAxis$xAxisKey$data, _yAxis$yAxisKey$data;
106
103
  const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
107
104
  const minValueCoord = Math.min(...valueCoordinates);
108
105
  const maxValueCoord = Math.max(...valueCoordinates);
@@ -110,8 +107,8 @@ const useAggregatedData = () => {
110
107
  seriesId,
111
108
  dataIndex,
112
109
  layout: series[seriesId].layout,
113
- x: verticalLayout ? xScale((_xAxis$xAxisKey$data = xAxis[xAxisKey].data) == null ? void 0 : _xAxis$xAxisKey$data[dataIndex]) + barOffset : minValueCoord,
114
- y: verticalLayout ? minValueCoord : yScale((_yAxis$yAxisKey$data = yAxis[yAxisKey].data) == null ? void 0 : _yAxis$yAxisKey$data[dataIndex]) + barOffset,
110
+ x: verticalLayout ? xScale(xAxis[xAxisKey].data?.[dataIndex]) + barOffset : minValueCoord,
111
+ y: verticalLayout ? minValueCoord : yScale(yAxis[yAxisKey].data?.[dataIndex]) + barOffset,
115
112
  xOrigin: xScale(0),
116
113
  yOrigin: yScale(0),
117
114
  height: verticalLayout ? maxValueCoord - minValueCoord : barWidth,
@@ -1,10 +1,9 @@
1
1
  const getBaseExtremum = params => {
2
- var _axis$data, _axis$data2;
3
2
  const {
4
3
  axis
5
4
  } = params;
6
- const minX = Math.min(...((_axis$data = axis.data) != null ? _axis$data : []));
7
- const maxX = Math.max(...((_axis$data2 = axis.data) != null ? _axis$data2 : []));
5
+ const minX = Math.min(...(axis.data ?? []));
6
+ const maxX = Math.max(...(axis.data ?? []));
8
7
  return [minX, maxX];
9
8
  };
10
9
  const getValueExtremum = params => {
@@ -4,7 +4,6 @@ import { getStackingGroups } from '../internals/stackSeries';
4
4
  import defaultizeValueFormatter from '../internals/defaultizeValueFormatter';
5
5
  let warnOnce = false;
6
6
  const formatter = (params, dataset) => {
7
- var _ref;
8
7
  const {
9
8
  seriesOrder,
10
9
  series
@@ -12,7 +11,7 @@ const formatter = (params, dataset) => {
12
11
  const stackingGroups = getStackingGroups(params);
13
12
 
14
13
  // Create a data set with format adapted to d3
15
- const d3Dataset = (_ref = dataset) != null ? _ref : [];
14
+ const d3Dataset = dataset ?? [];
16
15
  seriesOrder.forEach(id => {
17
16
  const data = series[id].data;
18
17
  if (data !== undefined) {
@@ -41,10 +40,7 @@ const formatter = (params, dataset) => {
41
40
  // Use dataKey if needed and available
42
41
  const dataKey = series[id].dataKey;
43
42
  return series[id].data === undefined && dataKey !== undefined ? dataKey : id;
44
- })).value((d, key) => {
45
- var _d$key;
46
- return (_d$key = d[key]) != null ? _d$key : 0;
47
- }) // defaultize null value to 0
43
+ })).value((d, key) => d[key] ?? 0) // defaultize null value to 0
48
44
  .order(stackingOrder).offset(stackingOffset)(d3Dataset);
49
45
  ids.forEach((id, index) => {
50
46
  const dataKey = series[id].dataKey;
@@ -11,15 +11,14 @@ const getAxisId = propsValue => {
11
11
  return null;
12
12
  }
13
13
  if (typeof propsValue === 'object') {
14
- var _propsValue$axisId;
15
- return (_propsValue$axisId = propsValue.axisId) != null ? _propsValue$axisId : null;
14
+ return propsValue.axisId ?? null;
16
15
  }
17
16
  return propsValue;
18
17
  };
19
18
  const mergeProps = (axisConfig, slots, slotProps) => {
20
19
  return typeof axisConfig === 'object' ? _extends({}, axisConfig, {
21
- slots: _extends({}, slots, axisConfig == null ? void 0 : axisConfig.slots),
22
- slotProps: _extends({}, slotProps, axisConfig == null ? void 0 : axisConfig.slotProps)
20
+ slots: _extends({}, slots, axisConfig?.slots),
21
+ slotProps: _extends({}, slotProps, axisConfig?.slotProps)
23
22
  }) : {
24
23
  slots,
25
24
  slotProps
@@ -31,7 +31,6 @@ const defaultProps = {
31
31
  direction: 'row'
32
32
  };
33
33
  function ChartsLegend(inProps) {
34
- var _slots$legend;
35
34
  const props = useThemeProps({
36
35
  props: _extends({}, defaultProps, inProps),
37
36
  name: 'MuiChartsLegend'
@@ -50,10 +49,10 @@ function ChartsLegend(inProps) {
50
49
  const drawingArea = React.useContext(DrawingContext);
51
50
  const series = React.useContext(SeriesContext);
52
51
  const seriesToDisplay = getSeriesToDisplay(series);
53
- const ChartLegendRender = (_slots$legend = slots == null ? void 0 : slots.legend) != null ? _slots$legend : DefaultChartsLegend;
52
+ const ChartLegendRender = slots?.legend ?? DefaultChartsLegend;
54
53
  const chartLegendRenderProps = useSlotProps({
55
54
  elementType: ChartLegendRender,
56
- externalSlotProps: slotProps == null ? void 0 : slotProps.legend,
55
+ externalSlotProps: slotProps?.legend,
57
56
  additionalProps: {
58
57
  position,
59
58
  direction,
@@ -26,7 +26,6 @@ function ChartsOnAxisClickHandler(props) {
26
26
  return () => {};
27
27
  }
28
28
  const handleMouseClick = event => {
29
- var _USED_AXIS_ID$data;
30
29
  event.preventDefault();
31
30
  const isXaxis = (axis.x && axis.x.index) !== undefined;
32
31
  const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
@@ -36,8 +35,7 @@ function ChartsOnAxisClickHandler(props) {
36
35
  }
37
36
  const seriesValues = {};
38
37
  Object.keys(series).filter(seriesType => ['bar', 'line'].includes(seriesType)).forEach(seriesType => {
39
- var _series$seriesType;
40
- (_series$seriesType = series[seriesType]) == null || _series$seriesType.seriesOrder.forEach(seriesId => {
38
+ series[seriesType]?.seriesOrder.forEach(seriesId => {
41
39
  const seriesItem = series[seriesType].series[seriesId];
42
40
  const axisKey = isXaxis ? seriesItem.xAxisKey : seriesItem.yAxisKey;
43
41
  if (axisKey === undefined || axisKey === USED_AXIS_ID) {
@@ -45,7 +43,7 @@ function ChartsOnAxisClickHandler(props) {
45
43
  }
46
44
  });
47
45
  });
48
- const axisValue = (_USED_AXIS_ID$data = (isXaxis ? xAxis : yAxis)[USED_AXIS_ID].data) == null ? void 0 : _USED_AXIS_ID$data[dataIndex];
46
+ const axisValue = (isXaxis ? xAxis : yAxis)[USED_AXIS_ID].data?.[dataIndex];
49
47
  onAxisClick(event, {
50
48
  dataIndex,
51
49
  axisValue,
@@ -49,7 +49,6 @@ export function getXReferenceLineClasses(classes) {
49
49
  }
50
50
  let warnedOnce = false;
51
51
  function ChartsXReferenceLine(props) {
52
- var _spacing$x, _spacing$y;
53
52
  const {
54
53
  x,
55
54
  label = '',
@@ -77,8 +76,8 @@ function ChartsXReferenceLine(props) {
77
76
  }
78
77
  const d = `M ${xPosition} ${top} l 0 ${height}`;
79
78
  const classes = getXReferenceLineClasses(inClasses);
80
- const spacingX = typeof spacing === 'object' ? (_spacing$x = spacing.x) != null ? _spacing$x : 0 : spacing;
81
- const spacingY = typeof spacing === 'object' ? (_spacing$y = spacing.y) != null ? _spacing$y : 0 : spacing;
79
+ const spacingX = typeof spacing === 'object' ? spacing.x ?? 0 : spacing;
80
+ const spacingY = typeof spacing === 'object' ? spacing.y ?? 0 : spacing;
82
81
  const textParams = _extends({
83
82
  x: xPosition + spacingX,
84
83
  text: label,
@@ -49,7 +49,6 @@ export function getYReferenceLineClasses(classes) {
49
49
  }, getReferenceLineUtilityClass, classes);
50
50
  }
51
51
  function ChartsYReferenceLine(props) {
52
- var _spacing$x, _spacing$y;
53
52
  const {
54
53
  y,
55
54
  label = '',
@@ -77,8 +76,8 @@ function ChartsYReferenceLine(props) {
77
76
  }
78
77
  const d = `M ${left} ${yPosition} l ${width} 0`;
79
78
  const classes = getYReferenceLineClasses(inClasses);
80
- const spacingX = typeof spacing === 'object' ? (_spacing$x = spacing.x) != null ? _spacing$x : 0 : spacing;
81
- const spacingY = typeof spacing === 'object' ? (_spacing$y = spacing.y) != null ? _spacing$y : 0 : spacing;
79
+ const spacingX = typeof spacing === 'object' ? spacing.x ?? 0 : spacing;
80
+ const spacingY = typeof spacing === 'object' ? spacing.y ?? 0 : spacing;
82
81
  const textParams = _extends({
83
82
  y: yPosition - spacingY,
84
83
  text: label,
@@ -17,7 +17,7 @@ function ChartsText(props) {
17
17
  text
18
18
  } = props,
19
19
  textProps = _objectWithoutPropertiesLoose(props, _excluded);
20
- const _ref = styleProps != null ? styleProps : {},
20
+ const _ref = styleProps ?? {},
21
21
  {
22
22
  angle,
23
23
  textAnchor,
@@ -42,7 +42,7 @@ function ChartsAxisTooltipContent(props) {
42
42
  const relevantAxis = React.useMemo(() => {
43
43
  return isXaxis ? xAxis[USED_AXIS_ID] : yAxis[USED_AXIS_ID];
44
44
  }, [USED_AXIS_ID, isXaxis, xAxis, yAxis]);
45
- const Content = content != null ? content : DefaultChartsAxisTooltipContent;
45
+ const Content = content ?? DefaultChartsAxisTooltipContent;
46
46
  const chartTooltipContentProps = useSlotProps({
47
47
  elementType: Content,
48
48
  externalSlotProps: contentProps,
@@ -14,7 +14,7 @@ function ChartsItemTooltipContent(props) {
14
14
  contentProps
15
15
  } = props;
16
16
  const series = React.useContext(SeriesContext)[itemData.type].series[itemData.seriesId];
17
- const Content = content != null ? content : DefaultChartsItemTooltipContent;
17
+ const Content = content ?? DefaultChartsItemTooltipContent;
18
18
  const chartTooltipContentProps = useSlotProps({
19
19
  elementType: Content,
20
20
  externalSlotProps: contentProps,
@@ -49,7 +49,6 @@ const ChartsTooltipRoot = styled(Popper, {
49
49
  * - [ChartsTooltip API](https://mui.com/x/api/charts/charts-tool-tip/)
50
50
  */
51
51
  function ChartsTooltip(props) {
52
- var _slots$popper, _slots$itemContent, _slots$axisContent;
53
52
  const themeProps = useThemeProps({
54
53
  props,
55
54
  name: 'MuiChartsTooltip'
@@ -72,10 +71,10 @@ function ChartsTooltip(props) {
72
71
  const classes = useUtilityClasses({
73
72
  classes: themeProps.classes
74
73
  });
75
- const PopperComponent = (_slots$popper = slots == null ? void 0 : slots.popper) != null ? _slots$popper : ChartsTooltipRoot;
74
+ const PopperComponent = slots?.popper ?? ChartsTooltipRoot;
76
75
  const popperProps = useSlotProps({
77
76
  elementType: PopperComponent,
78
- externalSlotProps: slotProps == null ? void 0 : slotProps.popper,
77
+ externalSlotProps: slotProps?.popper,
79
78
  additionalProps: {
80
79
  open: popperOpen,
81
80
  placement: 'right-start',
@@ -90,16 +89,16 @@ function ChartsTooltip(props) {
90
89
  children: popperOpen && /*#__PURE__*/_jsx(PopperComponent, _extends({}, popperProps, {
91
90
  children: trigger === 'item' ? /*#__PURE__*/_jsx(ChartsItemTooltipContent, {
92
91
  itemData: displayedData,
93
- content: (_slots$itemContent = slots == null ? void 0 : slots.itemContent) != null ? _slots$itemContent : itemContent,
94
- contentProps: slotProps == null ? void 0 : slotProps.itemContent,
92
+ content: slots?.itemContent ?? itemContent,
93
+ contentProps: slotProps?.itemContent,
95
94
  sx: {
96
95
  mx: 2
97
96
  },
98
97
  classes: classes
99
98
  }) : /*#__PURE__*/_jsx(ChartsAxisTooltipContent, {
100
99
  axisData: displayedData,
101
- content: (_slots$axisContent = slots == null ? void 0 : slots.axisContent) != null ? _slots$axisContent : axisContent,
102
- contentProps: slotProps == null ? void 0 : slotProps.axisContent,
100
+ content: slots?.axisContent ?? axisContent,
101
+ contentProps: slotProps?.axisContent,
103
102
  sx: {
104
103
  mx: 2
105
104
  },