@mui/x-charts 7.0.0-alpha.4 → 7.0.0-alpha.5

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 (121) hide show
  1. package/BarChart/BarPlot.js +7 -6
  2. package/BarChart/formatter.js +15 -3
  3. package/CHANGELOG.md +342 -0
  4. package/ChartsAxis/ChartsAxis.js +4 -4
  5. package/ChartsLegend/ChartsLegend.d.ts +1 -1
  6. package/ChartsLegend/ChartsLegend.js +3 -2
  7. package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  8. package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
  9. package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
  10. package/ChartsReferenceLine/common.d.ts +1 -1
  11. package/ChartsText/ChartsText.d.ts +17 -0
  12. package/{internals/components → ChartsText}/ChartsText.js +32 -17
  13. package/ChartsText/index.d.ts +3 -0
  14. package/ChartsText/index.js +12 -0
  15. package/ChartsText/package.json +6 -0
  16. package/ChartsXAxis/ChartsXAxis.js +3 -2
  17. package/ChartsYAxis/ChartsYAxis.js +1 -1
  18. package/LineChart/AreaPlot.js +3 -2
  19. package/LineChart/LineHighlightPlot.js +2 -1
  20. package/LineChart/LinePlot.js +3 -2
  21. package/LineChart/MarkPlot.js +2 -1
  22. package/LineChart/formatter.js +14 -2
  23. package/PieChart/PieArcLabelPlot.d.ts +2 -3
  24. package/PieChart/PieArcLabelPlot.js +0 -1
  25. package/PieChart/PieArcPlot.d.ts +2 -3
  26. package/PieChart/PieArcPlot.js +0 -1
  27. package/PieChart/PieChart.js +4 -4
  28. package/PieChart/PiePlot.js +20 -15
  29. package/PieChart/dataTransform/useTransformData.d.ts +2 -3
  30. package/ResponsiveChartContainer/index.js +2 -2
  31. package/context/CartesianContextProvider.js +2 -2
  32. package/context/SeriesContextProvider.js +1 -1
  33. package/esm/BarChart/BarPlot.js +7 -5
  34. package/esm/BarChart/formatter.js +20 -4
  35. package/esm/ChartsAxis/ChartsAxis.js +4 -4
  36. package/esm/ChartsLegend/ChartsLegend.js +2 -1
  37. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  38. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
  39. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
  40. package/esm/{internals/components → ChartsText}/ChartsText.js +33 -16
  41. package/esm/ChartsText/index.js +1 -0
  42. package/esm/ChartsXAxis/ChartsXAxis.js +2 -1
  43. package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
  44. package/esm/LineChart/AreaPlot.js +3 -2
  45. package/esm/LineChart/LineHighlightPlot.js +2 -1
  46. package/esm/LineChart/LinePlot.js +3 -2
  47. package/esm/LineChart/MarkPlot.js +2 -1
  48. package/esm/LineChart/formatter.js +16 -3
  49. package/esm/PieChart/PieArcLabelPlot.js +0 -1
  50. package/esm/PieChart/PieArcPlot.js +0 -1
  51. package/esm/PieChart/PieChart.js +4 -4
  52. package/esm/PieChart/PiePlot.js +20 -15
  53. package/esm/ResponsiveChartContainer/index.js +2 -2
  54. package/esm/context/CartesianContextProvider.js +2 -2
  55. package/esm/context/SeriesContextProvider.js +1 -1
  56. package/esm/index.js +1 -0
  57. package/esm/internals/getWordsByLines.js +14 -0
  58. package/esm/internals/utils.js +29 -0
  59. package/index.d.ts +1 -0
  60. package/index.js +12 -1
  61. package/internals/defaultizeColor.d.ts +4 -4
  62. package/internals/{components/ChartsText.d.ts → getWordsByLines.d.ts} +2 -11
  63. package/internals/getWordsByLines.js +21 -0
  64. package/internals/utils.d.ts +7 -0
  65. package/internals/utils.js +30 -0
  66. package/legacy/BarChart/BarPlot.js +7 -5
  67. package/legacy/BarChart/formatter.js +23 -9
  68. package/legacy/ChartsAxis/ChartsAxis.js +4 -4
  69. package/legacy/ChartsLegend/ChartsLegend.js +2 -1
  70. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  71. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
  72. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
  73. package/legacy/{internals/components → ChartsText}/ChartsText.js +38 -22
  74. package/legacy/ChartsText/index.js +1 -0
  75. package/legacy/ChartsXAxis/ChartsXAxis.js +2 -1
  76. package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
  77. package/legacy/LineChart/AreaPlot.js +3 -2
  78. package/legacy/LineChart/LineHighlightPlot.js +2 -1
  79. package/legacy/LineChart/LinePlot.js +3 -2
  80. package/legacy/LineChart/MarkPlot.js +2 -1
  81. package/legacy/LineChart/formatter.js +19 -8
  82. package/legacy/PieChart/PieArcLabelPlot.js +0 -1
  83. package/legacy/PieChart/PieArcPlot.js +0 -1
  84. package/legacy/PieChart/PieChart.js +4 -4
  85. package/legacy/PieChart/PiePlot.js +20 -15
  86. package/legacy/ResponsiveChartContainer/index.js +2 -2
  87. package/legacy/context/CartesianContextProvider.js +2 -2
  88. package/legacy/context/SeriesContextProvider.js +1 -1
  89. package/legacy/index.js +2 -1
  90. package/legacy/internals/getWordsByLines.js +15 -0
  91. package/legacy/internals/utils.js +29 -0
  92. package/models/axis.d.ts +1 -1
  93. package/models/seriesType/config.d.ts +4 -3
  94. package/models/seriesType/pie.d.ts +29 -7
  95. package/modern/BarChart/BarPlot.js +7 -5
  96. package/modern/BarChart/formatter.js +15 -3
  97. package/modern/ChartsAxis/ChartsAxis.js +4 -4
  98. package/modern/ChartsLegend/ChartsLegend.js +2 -1
  99. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  100. package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
  101. package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
  102. package/modern/{internals/components → ChartsText}/ChartsText.js +33 -16
  103. package/modern/ChartsText/index.js +1 -0
  104. package/modern/ChartsXAxis/ChartsXAxis.js +2 -1
  105. package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
  106. package/modern/LineChart/AreaPlot.js +3 -2
  107. package/modern/LineChart/LineHighlightPlot.js +2 -1
  108. package/modern/LineChart/LinePlot.js +3 -2
  109. package/modern/LineChart/MarkPlot.js +2 -1
  110. package/modern/LineChart/formatter.js +14 -2
  111. package/modern/PieChart/PieArcLabelPlot.js +0 -1
  112. package/modern/PieChart/PieArcPlot.js +0 -1
  113. package/modern/PieChart/PieChart.js +4 -4
  114. package/modern/PieChart/PiePlot.js +20 -15
  115. package/modern/ResponsiveChartContainer/index.js +2 -2
  116. package/modern/context/CartesianContextProvider.js +2 -2
  117. package/modern/context/SeriesContextProvider.js +1 -1
  118. package/modern/index.js +2 -1
  119. package/modern/internals/getWordsByLines.js +14 -0
  120. package/modern/internals/utils.js +29 -0
  121. package/package.json +4 -4
@@ -14,10 +14,9 @@ var _SeriesContextProvider = require("../context/SeriesContextProvider");
14
14
  var _CartesianContextProvider = require("../context/CartesianContextProvider");
15
15
  var _BarElement = require("./BarElement");
16
16
  var _axis = require("../models/axis");
17
+ var _constants = require("../constants");
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
19
  const _excluded = ["skipAnimation"];
19
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
20
  /**
22
21
  * Solution of the equations
23
22
  * W = barWidth * N + offset * (N-1)
@@ -27,6 +26,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
27
26
  * @param gapRatio The ratio of the gap between bars over the bar width.
28
27
  * @returns The bar width and the offset between bars.
29
28
  */
29
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
30
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
30
31
  function getBandSize({
31
32
  bandWidth: W,
32
33
  numberOfGroups: N,
@@ -76,18 +77,18 @@ const useCompletedData = () => {
76
77
  let baseScaleConfig;
77
78
  if (verticalLayout) {
78
79
  if (!(0, _axis.isBandScaleConfig)(xAxisConfig)) {
79
- throw new Error(`Axis with id "${xAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
80
+ throw new Error(`MUI-X-Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} shoud be of type "band" to display the bar series of id "${seriesId}"`);
80
81
  }
81
82
  if (xAxis[xAxisKey].data === undefined) {
82
- throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
83
+ throw new Error(`MUI-X-Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} shoud have data property`);
83
84
  }
84
85
  baseScaleConfig = xAxisConfig;
85
86
  } else {
86
87
  if (!(0, _axis.isBandScaleConfig)(yAxisConfig)) {
87
- throw new Error(`Axis with id "${yAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
88
+ throw new Error(`MUI-X-Charts: ${yAxisKey === _constants.DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} shoud be of type "band" to display the bar series of id "${seriesId}"`);
88
89
  }
89
90
  if (yAxis[yAxisKey].data === undefined) {
90
- throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
91
+ throw new Error(`MUI-X-Charts: ${yAxisKey === _constants.DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} shoud have data property`);
91
92
  }
92
93
  baseScaleConfig = yAxisConfig;
93
94
  }
@@ -9,6 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var _d3Shape = require("d3-shape");
10
10
  var _stackSeries = require("../internals/stackSeries");
11
11
  var _defaultizeValueFormatter = _interopRequireDefault(require("../internals/defaultizeValueFormatter"));
12
+ let warnOnce = false;
12
13
  const formatter = (params, dataset) => {
13
14
  const {
14
15
  seriesOrder,
@@ -31,7 +32,7 @@ const formatter = (params, dataset) => {
31
32
  }
32
33
  });
33
34
  } else if (dataset === undefined) {
34
- throw new Error([`MUI: bar series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
35
+ throw new Error([`MUI-X-Charts: bar series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
35
36
  }
36
37
  });
37
38
  const completedSeries = {};
@@ -46,13 +47,24 @@ const formatter = (params, dataset) => {
46
47
  // Use dataKey if needed and available
47
48
  const dataKey = series[id].dataKey;
48
49
  return series[id].data === undefined && dataKey !== undefined ? dataKey : id;
49
- })).order(stackingOrder).offset(stackingOffset)(d3Dataset);
50
+ })).value((d, key) => d[key] ?? 0) // defaultize null value to 0
51
+ .order(stackingOrder).offset(stackingOffset)(d3Dataset);
50
52
  ids.forEach((id, index) => {
51
53
  const dataKey = series[id].dataKey;
52
54
  completedSeries[id] = (0, _extends2.default)({
53
55
  layout: 'vertical'
54
56
  }, series[id], {
55
- data: dataKey ? dataset.map(d => d[dataKey]) : series[id].data,
57
+ data: dataKey ? dataset.map(data => {
58
+ const value = data[dataKey];
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.']);
63
+ }
64
+ return 0;
65
+ }
66
+ return value;
67
+ }) : series[id].data,
56
68
  stackedData: stackedSeries[index].map(([a, b]) => [a, b])
57
69
  });
58
70
  });
package/CHANGELOG.md CHANGED
@@ -3,6 +3,257 @@
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.0.0-alpha.6
7
+
8
+ _Dec 22, 2023_
9
+
10
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Data Grid now supports `Date` objects in the `filterModel`
13
+ - 🌍 Improve Russian (ru-RU) locale on the Data Grid
14
+ - 🐞 Bugfixes
15
+
16
+ ### Data Grid
17
+
18
+ #### Breaking changes
19
+
20
+ - The filter panel no longer uses the native version of the [`Select`](https://mui.com/material-ui/react-select/) component for all components.
21
+ - The `getOptionValue` and `getOptionLabel` props were removed from the following components:
22
+
23
+ - `GridEditSingleSelectCell`
24
+ - `GridFilterInputSingleSelect`
25
+ - `GridFilterInputMultipleSingleSelect`
26
+
27
+ Use the `getOptionValue` and `getOptionLabel` properties on the `singleSelect` column definition instead:
28
+
29
+ ```tsx
30
+ const column: GridColDef = {
31
+ type: 'singleSelect',
32
+ field: 'country',
33
+ valueOptions: [
34
+ { code: 'BR', name: 'Brazil' },
35
+ { code: 'FR', name: 'France' },
36
+ ],
37
+ getOptionValue: (value: any) => value.code,
38
+ getOptionLabel: (value: any) => value.name,
39
+ };
40
+ ```
41
+ - The `filterModel` now supports `Date` objects as values for `date` and `dateTime` column types.
42
+ The `filterModel` still accepts strings as values for `date` and `dateTime` column types,
43
+ but all updates to the `filterModel` coming from the UI (e.g. filter panel) will set the value as a `Date` object.
44
+
45
+ #### `@mui/x-data-grid@7.0.0-alpha.6`
46
+
47
+ - [DataGrid] Fix typos in the JSDoc (#11451) @flaviendelangle
48
+ - [DataGrid] Make `checkboxSelection` respect the `disableMultipleRowSelection` prop (#11448) @cherniavskii
49
+ - [DataGrid] Support `Date` objects in filter model (#7069) @cherniavskii
50
+ - [DataGrid] Use non-native `Select`s by default (#11330) @cherniavskii
51
+ - [l10n] Improve Russian (ru-RU) locale (#11441) @wensiet
52
+
53
+ #### `@mui/x-data-grid-pro@7.0.0-alpha.6` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
54
+
55
+ Same changes as in `@mui/x-data-grid@7.0.0-alpha.6`.
56
+
57
+ #### `@mui/x-data-grid-premium@7.0.0-alpha.6` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
58
+
59
+ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.6`.
60
+
61
+ ### Date Pickers
62
+
63
+ #### `@mui/x-date-pickers@7.0.0-alpha.6`
64
+
65
+ - [fields] Adjust `PickersInput` sizing styles (#11392) @noraleonte
66
+ - [fields] Fix section pasting (#11447) @LukasTy
67
+ - [pickers] Add `PickersTextField` `standard` and `filled` variants (#11250) @noraleonte
68
+ - [pickers] Add missing breaking changes to changelog (#11420) @MBilalShafi
69
+ - [pickers] Cleanup error messages in `PickersSectionList` (#11449) @flaviendelangle
70
+ - [pickers] Create new component `PickersSectionList` (#11352) @flaviendelangle
71
+
72
+ #### `@mui/x-date-pickers-pro@7.0.0-alpha.6` [![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-date-pickers@7.0.0-alpha.6`.
75
+
76
+ ### Charts / `@mui/x-charts@7.0.0-alpha.6`
77
+
78
+ - [charts] Allow percentage values for pie chart center and radius (#11464) @alexfauquette
79
+ - [charts] Improve dataset typing (#11372) @alexfauquette
80
+ - [charts] Make error message more explicit (#11457) @alexfauquette
81
+ - [charts] Make the helper `ChartsText` component public (#11370) @alexfauquette
82
+
83
+ ### Docs
84
+
85
+ - [docs] Document `false` default values for boolean props (#11477) @cherniavskii
86
+ - [docs] Improve Pickers `name` prop examples (#11422) @LukasTy
87
+ - [docs] Limit `date-fns` package to v2 in codesandbox (#11463) @LukasTy
88
+
89
+ ### Core
90
+
91
+ - [core] Cherry pick follow up (#11469) @LukasTy
92
+ - [core] Fix `cherry-pick` action (#11446) @LukasTy
93
+ - [core] Fix security regressions in cherry-pick-next-to-master.yml (#11482) @MBilalShafi
94
+ - [test] Reload the page if its blank and there are no links to the remaining tests (#11466) @cherniavskii
95
+
96
+ ## 7.0.0-alpha.5
97
+
98
+ _Dec 14, 2023_
99
+
100
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
101
+
102
+ - 💫 New recipe added for the Data Grid
103
+ - 🌍 Improve Swedish (sv-SE) and Urdu (ur-PK) locales on the Data Grid
104
+ - 🐞 Bugfixes
105
+
106
+ ### Data Grid
107
+
108
+ #### Breaking changes
109
+
110
+ - The `instanceId` prop is now required for state selectors.
111
+ This prop is used to distinguish between multiple Data Grid instances on the same page.
112
+ See [migration docs](https://next.mui.com/x/migration/migration-data-grid-v6/#instanceid-prop-is-required-for-state-selectors) for more details.
113
+
114
+ #### `@mui/x-data-grid@7.0.0-alpha.5`
115
+
116
+ - [DataGrid] Make `instanceId` required for state selectors (#11395) @cherniavskii
117
+ - [DataGrid] Recipe for grouped rows autosizing (#11401) @michelengelen
118
+ - [l10n] Improve Swedish (sv-SE) locale (#11373) @fredrikcarlbom
119
+ - [l10n] Improve Urdu (ur-PK) locale (#11400) @MBilalShafi
120
+
121
+ #### `@mui/x-data-grid-pro@7.0.0-alpha.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
122
+
123
+ Same changes as in `@mui/x-data-grid@7.0.0-alpha.5`.
124
+
125
+ #### `@mui/x-data-grid-premium@7.0.0-alpha.5` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
126
+
127
+ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.5`.
128
+
129
+ ### Date Pickers
130
+
131
+ #### Breaking changes
132
+
133
+ - The slot interfaces got renamed to match with `@mui/base` naming.
134
+ The `SlotsComponent` suffix has been replaced with `Slots` and `SlotsComponentsProps` with `SlotProps`.
135
+
136
+ ```diff
137
+ - DateCalendarSlotsComponent
138
+ + DateCalendarSlots
139
+ - DateCalendarSlotsComponentsProps
140
+ + DateCalendarSlotProps
141
+ ```
142
+
143
+ - Move `inputRef` inside the props passed to the field hooks
144
+
145
+ The field hooks now only receive the props instead of an object containing both the props and the `inputRef`.
146
+
147
+ ```diff
148
+ - const { inputRef, ...otherProps } = props
149
+ - const fieldResponse = useDateField({ props: otherProps, inputRef });
150
+ + const fieldResponse = useDateField(props);
151
+ ```
152
+
153
+ If you are using a multi input range field hook, the same applies to `startInputRef` and `endInputRef` params
154
+
155
+ ```diff
156
+ - const { inputRef: startInputRef, ...otherStartTextFieldProps } = startTextFieldProps
157
+ - const { inputRef: endInputRef, ...otherEndTextFieldProps } = endTextFieldProps
158
+
159
+ const fieldResponse = useMultiInputDateRangeField({
160
+ sharedProps,
161
+ - startTextFieldProps: otherStartTextFieldProps,
162
+ - endTextFieldProps: otherEndTextFieldProps,
163
+ - startInputRef
164
+ - endInputRef,
165
+ + startTextFieldProps,
166
+ + endTextFieldProps
167
+ });
168
+ ```
169
+
170
+ - Rename the ref returned by the field hooks to `inputRef`
171
+
172
+ When used with the v6 TextField approach (where the input is an `<input />` HTML element), the field hooks return a ref that needs to be passed to the `<input />` element.
173
+ This ref was previously named `ref` and has been renamed `inputRef` for extra clarity.
174
+
175
+ ```diff
176
+ const fieldResponse = useDateField(props);
177
+
178
+ - return <input ref={fieldResponse.ref} />
179
+ + return <input ref={fieldResponse.inputRef} />
180
+ ```
181
+
182
+ If you are using a multi input range field hook, the same applies to the ref in the `startDate` and `endDate` objects
183
+
184
+ ```diff
185
+ const fieldResponse = useDateField(props);
186
+
187
+ return (
188
+ <div>
189
+ - <input ref={fieldResponse.startDate.ref} />
190
+ + <input ref={fieldResponse.startDate.inputRef} />
191
+ <span>–</span>
192
+ - <input ref={fieldResponse.endDate.ref} />
193
+ + <input ref={fieldResponse.endDate.inputRef} />
194
+ </div>
195
+ )
196
+ ```
197
+
198
+ - Restructure the API of `useClearableField`
199
+
200
+ The `useClearableField` hook API has been simplified to now take a `props` parameter instead of a `fieldProps`, `InputProps`, `clearable`, `onClear`, `slots` and `slotProps` parameters.
201
+
202
+ You should now be able to directly pass the returned value from your field hook (e.g: `useDateField`) to `useClearableField`
203
+
204
+ ```diff
205
+ const fieldResponse = useDateField(props);
206
+
207
+ - const { InputProps, onClear, clearable, slots, slotProps, ...otherFieldProps } = fieldResponse
208
+ - const { InputProps: ProcessedInputProps, fieldProps: processedFieldProps } = useClearableField({
209
+ - fieldProps: otherFieldProps,
210
+ - InputProps,
211
+ - clearable,
212
+ - onClear,
213
+ - slots,
214
+ - slotProps,
215
+ - });
216
+ -
217
+ - return <MyCustomTextField {...processedFieldProps} InputProps={ProcessedInputProps} />
218
+
219
+ + const processedFieldProps = useClearableField(fieldResponse);
220
+ +
221
+ + return <MyCustomTextField {...processedFieldProps} />
222
+ ```
223
+
224
+ #### `@mui/x-date-pickers@7.0.0-alpha.5`
225
+
226
+ - [fields] Support empty sections (#10307) @flaviendelangle
227
+ - [pickers] Fix field types to avoid error on latest `@types/react` version (#11397) @LukasTy
228
+ - [pickers] Remove all relative imports to the internals index file (#11375) @flaviendelangle
229
+ - [pickers] Rename slots interfaces (#11339) @alexfauquette
230
+ - [pickers] Simplify the API of the field hooks (#11371) @flaviendelangle
231
+ - [pickers] Support name prop (#11025) @gitstart
232
+
233
+ #### `@mui/x-date-pickers-pro@7.0.0-alpha.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
234
+
235
+ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.5`, plus:
236
+
237
+ - [DateRangePicker] Fix `autoFocus` behavior (#11273) @kealjones-wk
238
+
239
+ ### Charts / `@mui/x-charts@7.0.0-alpha.5`
240
+
241
+ - [charts] Fix size overflow (#11385) @alexfauquette
242
+
243
+ ### `@mui/x-codemod@7.0.0-alpha.5`
244
+
245
+ - [codemod] Add `cellSelection` codemod and update migration guide (#11353) @MBilalShafi
246
+
247
+ ### Docs
248
+
249
+ - [docs] Respect GoT books (@janoma) (#11387) @alexfauquette
250
+
251
+ ### Core
252
+
253
+ - [core] Automate cherry-pick of PRs from `next` -> `master` (#11382) @MBilalShafi
254
+ - [github] Update `no-response` workflow (#11369) @MBilalShafi
255
+ - [test] Fix flaky screenshots (#11388) @cherniavskii
256
+
6
257
  ## 7.0.0-alpha.4
7
258
 
8
259
  _Dec 8, 2023_
@@ -949,6 +1200,97 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
949
1200
  - [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
950
1201
  - [license] Correctly throw errors (#10924) @oliviertassinari
951
1202
 
1203
+ ## 6.18.6
1204
+
1205
+ _Dec 22, 2023_
1206
+
1207
+ We'd like to offer a big thanks to the 5 contributors who made this release possible. Here are some highlights ✨:
1208
+
1209
+ - 🌍 Improve Russian (ru-RU) locale (#11429) @wensiet
1210
+ - 🐞 Bugfixes
1211
+
1212
+ ### Data Grid
1213
+
1214
+ #### `@mui/x-data-grid@6.18.6`
1215
+
1216
+ - [DataGrid] Fix typos in the JSDoc (#11475) @flaviendelangle
1217
+ - [l10n] Improve Russian (ru-RU) locale (#11429) @wensiet
1218
+
1219
+ #### `@mui/x-data-grid-pro@6.18.6` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
1220
+
1221
+ Same changes as in `@mui/x-data-grid@6.18.6`.
1222
+
1223
+ #### `@mui/x-data-grid-premium@6.18.6` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
1224
+
1225
+ Same changes as in `@mui/x-data-grid-pro@6.18.6`.
1226
+
1227
+ ### Date Pickers
1228
+
1229
+ #### `@mui/x-date-pickers@6.18.6`
1230
+
1231
+ - [fields] Fix section pasting (#11467) @LukasTy
1232
+
1233
+ #### `@mui/x-date-pickers-pro@6.18.6` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
1234
+
1235
+ Same changes as in `@mui/x-date-pickers@6.18.6`.
1236
+
1237
+ ### Charts / `@mui/x-charts@6.18.6`
1238
+
1239
+ - [charts] Allow percentage values for pie chart center and radius (#11464) @alexfauquette
1240
+ - [charts] Make error message more explicit (#11457) @alexfauquette
1241
+ - [charts] Make the helper `ChartsText` component public (#11370) @alexfauquette
1242
+ - [charts] Improve dataset typing (#11372) @alexfauquette
1243
+ - [charts] Fix size overflow (#11385) @alexfauquette
1244
+
1245
+ ### Docs
1246
+
1247
+ - [docs] Document false default values for boolean props (#11489) @cherniavskii
1248
+ - [docs] Improve Pickers `name` prop examples (#11442) @LukasTy
1249
+ - [docs] Limit `date-fns` package to v2 in codesandbox (#11478) @LukasTy
1250
+ - [test] Reload the page if its blank and there are no links to the remaining tests (#11471) @cherniavskii
1251
+
1252
+ ## 6.18.5
1253
+
1254
+ _Dec 14, 2023_
1255
+
1256
+ We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
1257
+
1258
+ - 🌍 Improve Swedish (sv-SE) and Urdu (ur-PK) locales on the Data Grid
1259
+ - 🐞 Bugfixes
1260
+
1261
+ ### Data Grid
1262
+
1263
+ #### `@mui/x-data-grid@6.18.5`
1264
+
1265
+ - [l10n] Improve Swedish (sv-SE) locale (#11379) @fredrikcarlbom
1266
+ - [l10n] Improve Urdu (ur-PK) locale for data grid (#11409) @MBilalShafi
1267
+
1268
+ #### `@mui/x-data-grid-pro@6.18.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
1269
+
1270
+ Same changes as in `@mui/x-data-grid@6.18.5`.
1271
+
1272
+ #### `@mui/x-data-grid-premium@6.18.5` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
1273
+
1274
+ Same changes as in `@mui/x-data-grid-pro@6.18.5`.
1275
+
1276
+ ### Date Pickers
1277
+
1278
+ #### `@mui/x-date-pickers@6.18.5`
1279
+
1280
+ - [pickers] Fix field types to avoid error on latest `@types/react` version (#11398) @LukasTy
1281
+ - [pickers] Support name prop (#11380) @gitstart
1282
+
1283
+ #### `@mui/x-date-pickers-pro@6.18.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
1284
+
1285
+ Same changes as in `@mui/x-date-pickers@6.18.5`, plus:
1286
+
1287
+ - [DateRangePicker] Fix `autoFocus` behavior (#11376) @kealjones-wk
1288
+
1289
+ ### Docs
1290
+
1291
+ - [docs] Respect GoT books (#11294) @janoma
1292
+ - [test] Fix flaky screenshots (#11391) @cherniavskii
1293
+
952
1294
  ## 6.18.4
953
1295
 
954
1296
  _Dec 8, 2023_
@@ -66,16 +66,16 @@ function ChartsAxis(props) {
66
66
  const topId = getAxisId(topAxis);
67
67
  const rightId = getAxisId(rightAxis);
68
68
  if (topId !== null && !xAxis[topId]) {
69
- throw Error(`MUI: id used for top axis "${topId}" is not defined`);
69
+ throw Error([`MUI-X-Charts: 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: id used for left axis "${leftId}" is not defined`);
72
+ throw Error([`MUI-X-Charts: 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: id used for right axis "${rightId}" is not defined`);
75
+ throw Error([`MUI-X-Charts: 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: id used for bottom axis "${bottomId}" is not defined`);
78
+ throw Error([`MUI-X-Charts: 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);
@@ -6,7 +6,7 @@ import { FormattedSeries } from '../context/SeriesContextProvider';
6
6
  import { ChartsLegendClasses } from './chartsLegendClasses';
7
7
  import { DefaultizedProps } from '../models/helpers';
8
8
  import { LegendParams } from '../models/seriesType/config';
9
- import { ChartsTextStyle } from '../internals/components/ChartsText';
9
+ import { ChartsTextStyle } from '../ChartsText';
10
10
  import { CardinalDirections } from '../models/layout';
11
11
  export interface ChartsLegendSlots {
12
12
  legend?: React.JSXElementConstructor<LegendRendererProps>;
@@ -18,7 +18,8 @@ var _DrawingProvider = require("../context/DrawingProvider");
18
18
  var _utils3 = require("./utils");
19
19
  var _SeriesContextProvider = require("../context/SeriesContextProvider");
20
20
  var _chartsLegendClasses = require("./chartsLegendClasses");
21
- var _ChartsText = require("../internals/components/ChartsText");
21
+ var _ChartsText = require("../ChartsText");
22
+ var _getWordsByLines = require("../internals/getWordsByLines");
22
23
  var _jsxRuntime = require("react/jsx-runtime");
23
24
  const _excluded = ["rotate", "dominantBaseline"],
24
25
  _excluded2 = ["label"];
@@ -96,7 +97,7 @@ function DefaultChartsLegend(props) {
96
97
  const padding = React.useMemo(() => getStandardizedPadding(paddingProps), [paddingProps]);
97
98
  const getItemSpace = React.useCallback((label, inStyle = {}) => {
98
99
  const style = (0, _objectWithoutPropertiesLoose2.default)(inStyle, _excluded);
99
- const linesSize = (0, _ChartsText.getWordsByLines)({
100
+ const linesSize = (0, _getWordsByLines.getWordsByLines)({
100
101
  style,
101
102
  needsComputation: true,
102
103
  text: label
@@ -15,10 +15,10 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
15
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
16
  function ChartsReferenceLine(props) {
17
17
  if (props.x !== undefined && props.y !== undefined) {
18
- throw new Error('MUI-X: The ChartsReferenceLine can not have both `x` and `y` props set.');
18
+ throw new Error('MUI-X-Charts: The ChartsReferenceLine can not have both `x` and `y` props set.');
19
19
  }
20
20
  if (props.x === undefined && props.y === undefined) {
21
- throw new Error('MUI-X: The ChartsReferenceLine should have a value in `x` or `y` prop.');
21
+ throw new Error('MUI-X-Charts: The ChartsReferenceLine should have a value in `x` or `y` prop.');
22
22
  }
23
23
  if (props.x !== undefined) {
24
24
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsXReferenceLine.ChartsXReferenceLine, (0, _extends2.default)({}, props));
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
12
12
  var _hooks = require("../hooks");
13
13
  var _common = require("./common");
14
- var _ChartsText = require("../internals/components/ChartsText");
14
+ var _ChartsText = require("../ChartsText");
15
15
  var _chartsReferenceLineClasses = require("./chartsReferenceLineClasses");
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
12
12
  var _hooks = require("../hooks");
13
13
  var _common = require("./common");
14
- var _ChartsText = require("../internals/components/ChartsText");
14
+ var _ChartsText = require("../ChartsText");
15
15
  var _chartsReferenceLineClasses = require("./chartsReferenceLineClasses");
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ChartsReferenceLineClasses } from './chartsReferenceLineClasses';
3
- import { ChartsTextStyle } from '../internals/components/ChartsText';
3
+ import { ChartsTextStyle } from '../ChartsText';
4
4
  export type CommonChartsReferenceLineProps = {
5
5
  /**
6
6
  * The alignment if the label is in the chart drawing area.
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { GetWordsByLinesParams } from '../internals/getWordsByLines';
3
+ export interface ChartsTextProps extends Omit<React.SVGTextElementAttributes<SVGTextElement>, 'width' | 'ref' | 'style' | 'dominantBaseline'>, GetWordsByLinesParams {
4
+ /**
5
+ * Height of a text line (in `em`).
6
+ */
7
+ lineHeight?: number;
8
+ ownerState?: any;
9
+ }
10
+ /**
11
+ * Helper component to manage multiline text in SVG
12
+ */
13
+ declare function ChartsText(props: ChartsTextProps): React.JSX.Element;
14
+ declare namespace ChartsText {
15
+ var propTypes: any;
16
+ }
17
+ export { ChartsText };
@@ -5,28 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.ChartsText = ChartsText;
8
- exports.getWordsByLines = getWordsByLines;
9
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
10
  var React = _interopRequireWildcard(require("react"));
12
- var _domUtils = require("../domUtils");
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _getWordsByLines = require("../internals/getWordsByLines");
13
13
  var _jsxRuntime = require("react/jsx-runtime");
14
14
  const _excluded = ["x", "y", "style", "text", "ownerState"],
15
15
  _excluded2 = ["angle", "textAnchor", "dominantBaseline"];
16
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
- function getWordsByLines({
19
- style,
20
- needsComputation,
21
- text
22
- }) {
23
- return text.split('\n').map(subText => (0, _extends2.default)({
24
- text: subText
25
- }, needsComputation ? (0, _domUtils.getStringSize)(subText, style) : {
26
- width: 0,
27
- height: 0
28
- }));
29
- }
18
+ /**
19
+ * Helper component to manage multiline text in SVG
20
+ */
30
21
  function ChartsText(props) {
31
22
  const {
32
23
  x,
@@ -42,7 +33,7 @@ function ChartsText(props) {
42
33
  dominantBaseline
43
34
  } = _ref,
44
35
  style = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded2);
45
- const wordsByLines = React.useMemo(() => getWordsByLines({
36
+ const wordsByLines = React.useMemo(() => (0, _getWordsByLines.getWordsByLines)({
46
37
  style,
47
38
  needsComputation: text.includes('\n'),
48
39
  text
@@ -84,4 +75,28 @@ function ChartsText(props) {
84
75
  children: line.text
85
76
  }, index))
86
77
  }));
87
- }
78
+ }
79
+ process.env.NODE_ENV !== "production" ? ChartsText.propTypes = {
80
+ // ----------------------------- Warning --------------------------------
81
+ // | These PropTypes are generated from the TypeScript type definitions |
82
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
83
+ // ----------------------------------------------------------------------
84
+ /**
85
+ * Height of a text line (in `em`).
86
+ */
87
+ lineHeight: _propTypes.default.number,
88
+ /**
89
+ * If `true`, the line width is computed.
90
+ * @default false
91
+ */
92
+ needsComputation: _propTypes.default.bool,
93
+ ownerState: _propTypes.default.any,
94
+ /**
95
+ * Style applied to text elements.
96
+ */
97
+ style: _propTypes.default.object,
98
+ /**
99
+ * Text displayed.
100
+ */
101
+ text: _propTypes.default.string.isRequired
102
+ } : void 0;
@@ -0,0 +1,3 @@
1
+ export { ChartsText } from './ChartsText';
2
+ export type { ChartsTextProps } from './ChartsText';
3
+ export type { ChartsTextStyle } from '../internals/getWordsByLines';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ChartsText", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ChartsText.ChartsText;
10
+ }
11
+ });
12
+ var _ChartsText = require("./ChartsText");
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../esm/ChartsText/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }