@mui/x-date-pickers 7.3.2 → 7.5.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 (55) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +5 -0
  2. package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +1 -5
  3. package/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -2
  4. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +3 -20
  5. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +14 -224
  6. package/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.d.ts +87 -0
  7. package/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js +332 -0
  8. package/AdapterDateFnsJalaliV3/index.d.ts +1 -0
  9. package/AdapterDateFnsJalaliV3/index.js +1 -0
  10. package/AdapterDateFnsJalaliV3/package.json +6 -0
  11. package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +5 -0
  12. package/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -1
  13. package/AdapterMomentJalaali/AdapterMomentJalaali.js +2 -6
  14. package/CHANGELOG.md +160 -2
  15. package/DateCalendar/DateCalendar.js +5 -4
  16. package/PickersLayout/usePickerLayout.js +6 -7
  17. package/PickersShortcuts/PickersShortcuts.d.ts +5 -0
  18. package/PickersShortcuts/PickersShortcuts.js +4 -3
  19. package/index.js +1 -1
  20. package/internals/components/PickersModalDialog.d.ts +2 -2
  21. package/internals/demo/DemoContainer.js +1 -1
  22. package/internals/hooks/useField/useField.js +0 -5
  23. package/internals/hooks/useField/useFieldV6TextField.js +1 -1
  24. package/internals/hooks/useField/useFieldV7TextField.js +5 -0
  25. package/internals/hooks/usePicker/usePickerViews.js +1 -0
  26. package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -2
  27. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +14 -224
  28. package/modern/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js +332 -0
  29. package/modern/AdapterDateFnsJalaliV3/index.js +1 -0
  30. package/modern/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -1
  31. package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +2 -6
  32. package/modern/DateCalendar/DateCalendar.js +5 -4
  33. package/modern/PickersLayout/usePickerLayout.js +6 -7
  34. package/modern/PickersShortcuts/PickersShortcuts.js +4 -3
  35. package/modern/index.js +1 -1
  36. package/modern/internals/demo/DemoContainer.js +1 -1
  37. package/modern/internals/hooks/useField/useField.js +0 -5
  38. package/modern/internals/hooks/useField/useFieldV6TextField.js +1 -1
  39. package/modern/internals/hooks/useField/useFieldV7TextField.js +5 -0
  40. package/modern/internals/hooks/usePicker/usePickerViews.js +1 -0
  41. package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -2
  42. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +14 -224
  43. package/node/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js +341 -0
  44. package/node/AdapterDateFnsJalaliV3/index.js +12 -0
  45. package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +2 -6
  46. package/node/DateCalendar/DateCalendar.js +5 -4
  47. package/node/PickersLayout/usePickerLayout.js +6 -7
  48. package/node/PickersShortcuts/PickersShortcuts.js +4 -3
  49. package/node/index.js +1 -1
  50. package/node/internals/demo/DemoContainer.js +1 -1
  51. package/node/internals/hooks/useField/useField.js +0 -5
  52. package/node/internals/hooks/useField/useFieldV6TextField.js +1 -1
  53. package/node/internals/hooks/useField/useFieldV7TextField.js +5 -0
  54. package/node/internals/hooks/usePicker/usePickerViews.js +1 -0
  55. package/package.json +4 -4
@@ -0,0 +1,341 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.AdapterDateFnsJalali = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _addSeconds = require("date-fns-jalali/addSeconds");
10
+ var _addMinutes = require("date-fns-jalali/addMinutes");
11
+ var _addHours = require("date-fns-jalali/addHours");
12
+ var _addDays = require("date-fns-jalali/addDays");
13
+ var _addWeeks = require("date-fns-jalali/addWeeks");
14
+ var _addMonths = require("date-fns-jalali/addMonths");
15
+ var _addYears = require("date-fns-jalali/addYears");
16
+ var _endOfDay = require("date-fns-jalali/endOfDay");
17
+ var _endOfWeek = require("date-fns-jalali/endOfWeek");
18
+ var _endOfYear = require("date-fns-jalali/endOfYear");
19
+ var _format = require("date-fns-jalali/format");
20
+ var _getHours = require("date-fns-jalali/getHours");
21
+ var _getSeconds = require("date-fns-jalali/getSeconds");
22
+ var _getMilliseconds = require("date-fns-jalali/getMilliseconds");
23
+ var _getWeek = require("date-fns-jalali/getWeek");
24
+ var _getYear = require("date-fns-jalali/getYear");
25
+ var _getMonth = require("date-fns-jalali/getMonth");
26
+ var _getDate = require("date-fns-jalali/getDate");
27
+ var _getDaysInMonth = require("date-fns-jalali/getDaysInMonth");
28
+ var _getMinutes = require("date-fns-jalali/getMinutes");
29
+ var _isAfter = require("date-fns-jalali/isAfter");
30
+ var _isBefore = require("date-fns-jalali/isBefore");
31
+ var _isEqual = require("date-fns-jalali/isEqual");
32
+ var _isSameDay = require("date-fns-jalali/isSameDay");
33
+ var _isSameYear = require("date-fns-jalali/isSameYear");
34
+ var _isSameMonth = require("date-fns-jalali/isSameMonth");
35
+ var _isSameHour = require("date-fns-jalali/isSameHour");
36
+ var _isValid = require("date-fns-jalali/isValid");
37
+ var _parse = require("date-fns-jalali/parse");
38
+ var _setDate = require("date-fns-jalali/setDate");
39
+ var _setHours = require("date-fns-jalali/setHours");
40
+ var _setMinutes = require("date-fns-jalali/setMinutes");
41
+ var _setMonth = require("date-fns-jalali/setMonth");
42
+ var _setSeconds = require("date-fns-jalali/setSeconds");
43
+ var _setMilliseconds = require("date-fns-jalali/setMilliseconds");
44
+ var _setYear = require("date-fns-jalali/setYear");
45
+ var _startOfDay = require("date-fns-jalali/startOfDay");
46
+ var _startOfMonth = require("date-fns-jalali/startOfMonth");
47
+ var _endOfMonth = require("date-fns-jalali/endOfMonth");
48
+ var _startOfWeek = require("date-fns-jalali/startOfWeek");
49
+ var _startOfYear = require("date-fns-jalali/startOfYear");
50
+ var _isWithinInterval = require("date-fns-jalali/isWithinInterval");
51
+ var _faIR = require("date-fns-jalali/locale/fa-IR");
52
+ var _AdapterDateFnsBase = require("../AdapterDateFnsBase");
53
+ /* eslint-disable class-methods-use-this */
54
+ // TODO remove when date-fns-jalali-v3 is the default
55
+ // @ts-nocheck
56
+
57
+ // date-fns-jalali v2 does not export types
58
+ // @ts-ignore TODO remove when date-fns-jalali-v3 is the default
59
+
60
+ const defaultFormats = {
61
+ year: 'yyyy',
62
+ month: 'LLLL',
63
+ monthShort: 'MMM',
64
+ dayOfMonth: 'd',
65
+ dayOfMonthFull: 'do',
66
+ weekday: 'EEEE',
67
+ weekdayShort: 'EEEEEE',
68
+ hours24h: 'HH',
69
+ hours12h: 'hh',
70
+ meridiem: 'aa',
71
+ minutes: 'mm',
72
+ seconds: 'ss',
73
+ fullDate: 'PPP',
74
+ keyboardDate: 'P',
75
+ shortDate: 'd MMM',
76
+ normalDate: 'd MMMM',
77
+ normalDateWithWeekday: 'EEE, d MMMM',
78
+ fullTime: 'p',
79
+ fullTime12h: 'hh:mm aaa',
80
+ fullTime24h: 'HH:mm',
81
+ keyboardDateTime: 'P p',
82
+ keyboardDateTime12h: 'P hh:mm aa',
83
+ keyboardDateTime24h: 'P HH:mm'
84
+ };
85
+ const NUMBER_SYMBOL_MAP = {
86
+ '1': '۱',
87
+ '2': '۲',
88
+ '3': '۳',
89
+ '4': '۴',
90
+ '5': '۵',
91
+ '6': '۶',
92
+ '7': '۷',
93
+ '8': '۸',
94
+ '9': '۹',
95
+ '0': '۰'
96
+ };
97
+ /**
98
+ * Based on `@date-io/date-fns-jalali`
99
+ *
100
+ * MIT License
101
+ *
102
+ * Copyright (c) 2017 Dmitriy Kovalenko
103
+ *
104
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
105
+ * of this software and associated documentation files (the "Software"), to deal
106
+ * in the Software without restriction, including without limitation the rights
107
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
108
+ * copies of the Software, and to permit persons to whom the Software is
109
+ * furnished to do so, subject to the following conditions:
110
+ *
111
+ * The above copyright notice and this permission notice shall be included in all
112
+ * copies or substantial portions of the Software.
113
+ *
114
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
115
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
116
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
117
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
118
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
119
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
120
+ * SOFTWARE.
121
+ */
122
+ class AdapterDateFnsJalali extends _AdapterDateFnsBase.AdapterDateFnsBase {
123
+ constructor({
124
+ locale,
125
+ formats
126
+ } = {}) {
127
+ if (typeof _addDays.addDays !== 'function') {
128
+ throw new Error([`MUI: The \`date-fns-jalali\` package v2.x is not compatible with this adapter.`, 'Please, install v3.x of the package or use the `AdapterDateFnsJalali` instead.'].join('\n'));
129
+ }
130
+ if (!_format.longFormatters) {
131
+ throw new Error('MUI: The minimum supported `date-fns-jalali` package version compatible with this adapter is `3.2.x`.');
132
+ }
133
+ super({
134
+ locale: locale ?? _faIR.faIR,
135
+ // some formats are different in jalali adapter,
136
+ // this ensures that `AdapterDateFnsBase` formats are overridden
137
+ formats: (0, _extends2.default)({}, defaultFormats, formats),
138
+ longFormatters: _format.longFormatters,
139
+ lib: 'date-fns-jalali'
140
+ });
141
+ this.parse = (value, format) => {
142
+ if (value === '') {
143
+ return null;
144
+ }
145
+ return (0, _parse.parse)(value, format, new Date(), {
146
+ locale: this.locale
147
+ });
148
+ };
149
+ this.getCurrentLocaleCode = () => {
150
+ return this.locale?.code || 'fa-IR';
151
+ };
152
+ this.isValid = value => {
153
+ if (value == null) {
154
+ return false;
155
+ }
156
+ return (0, _isValid.isValid)(value);
157
+ };
158
+ this.format = (value, formatKey) => {
159
+ return this.formatByString(value, this.formats[formatKey]);
160
+ };
161
+ this.formatByString = (value, formatString) => {
162
+ return (0, _format.format)(value, formatString, {
163
+ locale: this.locale
164
+ });
165
+ };
166
+ this.formatNumber = numberToFormat => {
167
+ return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
168
+ };
169
+ this.isEqual = (value, comparing) => {
170
+ if (value === null && comparing === null) {
171
+ return true;
172
+ }
173
+ if (value === null || comparing === null) {
174
+ return false;
175
+ }
176
+ return (0, _isEqual.isEqual)(value, comparing);
177
+ };
178
+ this.isSameYear = (value, comparing) => {
179
+ return (0, _isSameYear.isSameYear)(value, comparing);
180
+ };
181
+ this.isSameMonth = (value, comparing) => {
182
+ return (0, _isSameMonth.isSameMonth)(value, comparing);
183
+ };
184
+ this.isSameDay = (value, comparing) => {
185
+ return (0, _isSameDay.isSameDay)(value, comparing);
186
+ };
187
+ this.isSameHour = (value, comparing) => {
188
+ return (0, _isSameHour.isSameHour)(value, comparing);
189
+ };
190
+ this.isAfter = (value, comparing) => {
191
+ return (0, _isAfter.isAfter)(value, comparing);
192
+ };
193
+ this.isAfterYear = (value, comparing) => {
194
+ return (0, _isAfter.isAfter)(value, this.endOfYear(comparing));
195
+ };
196
+ this.isAfterDay = (value, comparing) => {
197
+ return (0, _isAfter.isAfter)(value, this.endOfDay(comparing));
198
+ };
199
+ this.isBefore = (value, comparing) => {
200
+ return (0, _isBefore.isBefore)(value, comparing);
201
+ };
202
+ this.isBeforeYear = (value, comparing) => {
203
+ return (0, _isBefore.isBefore)(value, this.startOfYear(comparing));
204
+ };
205
+ this.isBeforeDay = (value, comparing) => {
206
+ return (0, _isBefore.isBefore)(value, this.startOfDay(comparing));
207
+ };
208
+ this.isWithinRange = (value, [start, end]) => {
209
+ return (0, _isWithinInterval.isWithinInterval)(value, {
210
+ start,
211
+ end
212
+ });
213
+ };
214
+ this.startOfYear = value => {
215
+ return (0, _startOfYear.startOfYear)(value);
216
+ };
217
+ this.startOfMonth = value => {
218
+ return (0, _startOfMonth.startOfMonth)(value);
219
+ };
220
+ this.startOfWeek = value => {
221
+ return (0, _startOfWeek.startOfWeek)(value, {
222
+ locale: this.locale
223
+ });
224
+ };
225
+ this.startOfDay = value => {
226
+ return (0, _startOfDay.startOfDay)(value);
227
+ };
228
+ this.endOfYear = value => {
229
+ return (0, _endOfYear.endOfYear)(value);
230
+ };
231
+ this.endOfMonth = value => {
232
+ return (0, _endOfMonth.endOfMonth)(value);
233
+ };
234
+ this.endOfWeek = value => {
235
+ return (0, _endOfWeek.endOfWeek)(value, {
236
+ locale: this.locale
237
+ });
238
+ };
239
+ this.endOfDay = value => {
240
+ return (0, _endOfDay.endOfDay)(value);
241
+ };
242
+ this.addYears = (value, amount) => {
243
+ return (0, _addYears.addYears)(value, amount);
244
+ };
245
+ this.addMonths = (value, amount) => {
246
+ return (0, _addMonths.addMonths)(value, amount);
247
+ };
248
+ this.addWeeks = (value, amount) => {
249
+ return (0, _addWeeks.addWeeks)(value, amount);
250
+ };
251
+ this.addDays = (value, amount) => {
252
+ return (0, _addDays.addDays)(value, amount);
253
+ };
254
+ this.addHours = (value, amount) => {
255
+ return (0, _addHours.addHours)(value, amount);
256
+ };
257
+ this.addMinutes = (value, amount) => {
258
+ return (0, _addMinutes.addMinutes)(value, amount);
259
+ };
260
+ this.addSeconds = (value, amount) => {
261
+ return (0, _addSeconds.addSeconds)(value, amount);
262
+ };
263
+ this.getYear = value => {
264
+ return (0, _getYear.getYear)(value);
265
+ };
266
+ this.getMonth = value => {
267
+ return (0, _getMonth.getMonth)(value);
268
+ };
269
+ this.getDate = value => {
270
+ return (0, _getDate.getDate)(value);
271
+ };
272
+ this.getHours = value => {
273
+ return (0, _getHours.getHours)(value);
274
+ };
275
+ this.getMinutes = value => {
276
+ return (0, _getMinutes.getMinutes)(value);
277
+ };
278
+ this.getSeconds = value => {
279
+ return (0, _getSeconds.getSeconds)(value);
280
+ };
281
+ this.getMilliseconds = value => {
282
+ return (0, _getMilliseconds.getMilliseconds)(value);
283
+ };
284
+ this.setYear = (value, year) => {
285
+ return (0, _setYear.setYear)(value, year);
286
+ };
287
+ this.setMonth = (value, month) => {
288
+ return (0, _setMonth.setMonth)(value, month);
289
+ };
290
+ this.setDate = (value, date) => {
291
+ return (0, _setDate.setDate)(value, date);
292
+ };
293
+ this.setHours = (value, hours) => {
294
+ return (0, _setHours.setHours)(value, hours);
295
+ };
296
+ this.setMinutes = (value, minutes) => {
297
+ return (0, _setMinutes.setMinutes)(value, minutes);
298
+ };
299
+ this.setSeconds = (value, seconds) => {
300
+ return (0, _setSeconds.setSeconds)(value, seconds);
301
+ };
302
+ this.setMilliseconds = (value, milliseconds) => {
303
+ return (0, _setMilliseconds.setMilliseconds)(value, milliseconds);
304
+ };
305
+ this.getDaysInMonth = value => {
306
+ return (0, _getDaysInMonth.getDaysInMonth)(value);
307
+ };
308
+ this.getWeekArray = value => {
309
+ const start = this.startOfWeek(this.startOfMonth(value));
310
+ const end = this.endOfWeek(this.endOfMonth(value));
311
+ let count = 0;
312
+ let current = start;
313
+ const nestedWeeks = [];
314
+ while (this.isBefore(current, end)) {
315
+ const weekNumber = Math.floor(count / 7);
316
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
317
+ nestedWeeks[weekNumber].push(current);
318
+ current = this.addDays(current, 1);
319
+ count += 1;
320
+ }
321
+ return nestedWeeks;
322
+ };
323
+ this.getWeekNumber = date => {
324
+ return (0, _getWeek.getWeek)(date, {
325
+ locale: this.locale
326
+ });
327
+ };
328
+ this.getYearRange = ([start, end]) => {
329
+ const startDate = this.startOfYear(start);
330
+ const endDate = this.endOfYear(end);
331
+ const years = [];
332
+ let current = startDate;
333
+ while (this.isBefore(current, endDate)) {
334
+ years.push(current);
335
+ current = this.addYears(current, 1);
336
+ }
337
+ return years;
338
+ };
339
+ }
340
+ }
341
+ exports.AdapterDateFnsJalali = AdapterDateFnsJalali;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "AdapterDateFnsJalali", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _AdapterDateFnsJalaliV.AdapterDateFnsJalali;
10
+ }
11
+ });
12
+ var _AdapterDateFnsJalaliV = require("./AdapterDateFnsJalaliV3");
@@ -171,14 +171,10 @@ class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
171
171
  return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
172
172
  };
173
173
  this.isSameYear = (value, comparing) => {
174
- // `isSame` seems to mutate the date on `moment-jalaali`
175
- // @ts-ignore
176
- return value.clone().isSame(comparing, 'jYear');
174
+ return value.jYear() === comparing.jYear();
177
175
  };
178
176
  this.isSameMonth = (value, comparing) => {
179
- // `isSame` seems to mutate the date on `moment-jalaali`
180
- // @ts-ignore
181
- return value.clone().isSame(comparing, 'jMonth');
177
+ return value.jYear() === comparing.jYear() && value.jMonth() === comparing.jMonth();
182
178
  };
183
179
  this.isAfterYear = (value, comparing) => {
184
180
  return value.jYear() > comparing.jYear();
@@ -207,9 +207,7 @@ const DateCalendar = exports.DateCalendar = /*#__PURE__*/React.forwardRef(functi
207
207
  disableFuture,
208
208
  reduceAnimations,
209
209
  timezone,
210
- labelId: gridLabelId,
211
- slots,
212
- slotProps
210
+ labelId: gridLabelId
213
211
  },
214
212
  ownerState: props
215
213
  });
@@ -303,7 +301,10 @@ const DateCalendar = exports.DateCalendar = /*#__PURE__*/React.forwardRef(functi
303
301
  className: (0, _clsx.default)(classes.root, className),
304
302
  ownerState: ownerState
305
303
  }, other, {
306
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CalendarHeader, (0, _extends2.default)({}, calendarHeaderProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(DateCalendarViewTransitionContainer, {
304
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CalendarHeader, (0, _extends2.default)({}, calendarHeaderProps, {
305
+ slots: slots,
306
+ slotProps: slotProps
307
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(DateCalendarViewTransitionContainer, {
307
308
  reduceAnimations: reduceAnimations,
308
309
  className: classes.viewTransitionContainer,
309
310
  transKey: view,
@@ -72,9 +72,9 @@ const usePickerLayout = props => {
72
72
  onClear,
73
73
  onCancel,
74
74
  onSetToday,
75
- actions: wrapperVariant === 'desktop' ? [] : ['cancel', 'accept'],
76
- className: classes.actionBar
75
+ actions: wrapperVariant === 'desktop' ? [] : ['cancel', 'accept']
77
76
  },
77
+ className: classes.actionBar,
78
78
  ownerState: (0, _extends2.default)({}, props, {
79
79
  wrapperVariant
80
80
  })
@@ -95,9 +95,9 @@ const usePickerLayout = props => {
95
95
  onViewChange,
96
96
  views,
97
97
  disabled,
98
- readOnly,
99
- className: classes.toolbar
98
+ readOnly
100
99
  },
100
+ className: classes.toolbar,
101
101
  ownerState: (0, _extends2.default)({}, props, {
102
102
  wrapperVariant
103
103
  })
@@ -126,14 +126,13 @@ const usePickerLayout = props => {
126
126
  additionalProps: {
127
127
  isValid,
128
128
  isLandscape,
129
- onChange: onSelectShortcut,
130
- className: classes.shortcuts
129
+ onChange: onSelectShortcut
131
130
  },
131
+ className: classes.shortcuts,
132
132
  ownerState: {
133
133
  isValid,
134
134
  isLandscape,
135
135
  onChange: onSelectShortcut,
136
- className: classes.shortcuts,
137
136
  wrapperVariant
138
137
  }
139
138
  });
@@ -46,13 +46,13 @@ function PickersShortcuts(props) {
46
46
  const newValue = getValue({
47
47
  isValid
48
48
  });
49
- return {
49
+ return (0, _extends2.default)({}, item, {
50
50
  label: item.label,
51
51
  onClick: () => {
52
52
  onChange(newValue, changeImportance, item);
53
53
  },
54
54
  disabled: !isValid(newValue)
55
- };
55
+ });
56
56
  });
57
57
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_List.default, (0, _extends2.default)({
58
58
  dense: true,
@@ -65,7 +65,7 @@ function PickersShortcuts(props) {
65
65
  children: resolvedItems.map(item => {
66
66
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItem.default, {
67
67
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, (0, _extends2.default)({}, item))
68
- }, item.label);
68
+ }, item.id ?? item.label);
69
69
  })
70
70
  }));
71
71
  }
@@ -104,6 +104,7 @@ process.env.NODE_ENV !== "production" ? PickersShortcuts.propTypes = {
104
104
  */
105
105
  items: _propTypes.default.arrayOf(_propTypes.default.shape({
106
106
  getValue: _propTypes.default.func.isRequired,
107
+ id: _propTypes.default.string,
107
108
  label: _propTypes.default.string.isRequired
108
109
  })),
109
110
  onChange: _propTypes.default.func.isRequired,
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.3.2
2
+ * @mui/x-date-pickers v7.5.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _Stack = _interopRequireWildcard(require("@mui/material/Stack"));
12
12
  var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
13
13
  var _TextField = require("@mui/material/TextField");
14
- var _PickersTextField = require("@mui/x-date-pickers/PickersTextField");
14
+ var _PickersTextField = require("../../PickersTextField");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
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 && {}.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; }
@@ -91,11 +91,6 @@ const useField = params => {
91
91
  setSelectedSections('all');
92
92
  break;
93
93
  }
94
- case event.key === 'Enter':
95
- {
96
- event.preventDefault();
97
- break;
98
- }
99
94
 
100
95
  // Move selection to next section
101
96
  case event.key === 'ArrowRight':
@@ -288,7 +288,7 @@ const useFieldV6TextField = params => {
288
288
  });
289
289
  });
290
290
  const placeholder = React.useMemo(() => {
291
- if (inPlaceholder) {
291
+ if (inPlaceholder !== undefined) {
292
292
  return inPlaceholder;
293
293
  }
294
294
  return fieldValueManager.getV6InputValueFromSections(getSectionsFromValue(valueManager.emptyValue), localizedDigits, isRTL);
@@ -291,6 +291,11 @@ const useFieldV7TextField = params => {
291
291
  revertDOMSectionChange(sectionIndex);
292
292
  return;
293
293
  }
294
+ const inputType = event.nativeEvent.inputType;
295
+ if (inputType === 'insertParagraph' || inputType === 'insertLineBreak') {
296
+ revertDOMSectionChange(sectionIndex);
297
+ return;
298
+ }
294
299
  resetCharacterQuery();
295
300
  clearActiveSection();
296
301
  return;
@@ -108,6 +108,7 @@ const usePickerViews = ({
108
108
  if (currentViewMode === 'field' && open) {
109
109
  onClose();
110
110
  setTimeout(() => {
111
+ fieldRef?.current?.setSelectedSections(view);
111
112
  // focusing the input before the range selection is done
112
113
  // calling it outside of timeout results in an inconsistent behavior between Safari And Chrome
113
114
  fieldRef?.current?.focusField(view);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-date-pickers",
3
- "version": "7.3.2",
3
+ "version": "7.5.0",
4
4
  "description": "The community edition of the Date and Time Picker components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -35,12 +35,12 @@
35
35
  "directory": "packages/x-date-pickers"
36
36
  },
37
37
  "dependencies": {
38
- "@babel/runtime": "^7.24.0",
38
+ "@babel/runtime": "^7.24.5",
39
39
  "@mui/base": "^5.0.0-beta.40",
40
40
  "@mui/system": "^5.15.14",
41
41
  "@mui/utils": "^5.15.14",
42
42
  "@types/react-transition-group": "^4.4.10",
43
- "clsx": "^2.1.0",
43
+ "clsx": "^2.1.1",
44
44
  "prop-types": "^15.8.1",
45
45
  "react-transition-group": "^4.4.5"
46
46
  },
@@ -49,7 +49,7 @@
49
49
  "@emotion/styled": "^11.8.1",
50
50
  "@mui/material": "^5.15.14",
51
51
  "date-fns": "^2.25.0 || ^3.2.0",
52
- "date-fns-jalali": "^2.13.0-0",
52
+ "date-fns-jalali": "^2.13.0-0 || ^3.2.0-0",
53
53
  "dayjs": "^1.10.7",
54
54
  "luxon": "^3.0.2",
55
55
  "moment": "^2.29.4",