@mui/x-date-pickers 7.0.0-alpha.0 → 7.0.0-alpha.1

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 (125) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +4 -15
  2. package/AdapterDateFns/AdapterDateFns.js +8 -90
  3. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +4 -15
  4. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
  5. package/AdapterDayjs/AdapterDayjs.d.ts +5 -17
  6. package/AdapterDayjs/AdapterDayjs.js +11 -60
  7. package/AdapterLuxon/AdapterLuxon.d.ts +4 -15
  8. package/AdapterLuxon/AdapterLuxon.js +3 -73
  9. package/AdapterMoment/AdapterMoment.d.ts +4 -20
  10. package/AdapterMoment/AdapterMoment.js +9 -66
  11. package/AdapterMomentHijri/AdapterMomentHijri.d.ts +1 -7
  12. package/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
  13. package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +1 -9
  14. package/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
  15. package/CHANGELOG.md +409 -1
  16. package/DateCalendar/DateCalendar.js +0 -1
  17. package/DateCalendar/DayCalendar.d.ts +1 -2
  18. package/DateCalendar/DayCalendar.js +9 -16
  19. package/DateCalendar/index.d.ts +0 -1
  20. package/DateCalendar/index.js +1 -3
  21. package/DatePicker/DatePicker.js +0 -1
  22. package/DatePicker/shared.d.ts +1 -1
  23. package/DateTimePicker/DateTimePicker.js +0 -1
  24. package/DateTimePicker/shared.d.ts +1 -1
  25. package/DesktopDatePicker/DesktopDatePicker.js +0 -1
  26. package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
  27. package/DigitalClock/DigitalClock.js +3 -2
  28. package/LocalizationProvider/LocalizationProvider.js +0 -6
  29. package/MobileDatePicker/MobileDatePicker.js +0 -1
  30. package/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
  31. package/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
  32. package/StaticDatePicker/StaticDatePicker.js +0 -1
  33. package/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  34. package/TimePicker/shared.d.ts +1 -1
  35. package/YearCalendar/YearCalendar.js +1 -1
  36. package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +1 -1
  37. package/index.d.ts +1 -0
  38. package/index.js +4 -1
  39. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +5 -0
  40. package/internals/hooks/useField/useField.utils.js +0 -1
  41. package/internals/hooks/useField/useFieldState.js +1 -1
  42. package/internals/utils/getDefaultReferenceDate.d.ts +1 -2
  43. package/internals/utils/getDefaultReferenceDate.js +0 -4
  44. package/legacy/AdapterDateFns/AdapterDateFns.js +11 -92
  45. package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +11 -92
  46. package/legacy/AdapterDayjs/AdapterDayjs.js +15 -63
  47. package/legacy/AdapterLuxon/AdapterLuxon.js +6 -75
  48. package/legacy/AdapterMoment/AdapterMoment.js +12 -70
  49. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -30
  50. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -40
  51. package/legacy/DateCalendar/DateCalendar.js +0 -1
  52. package/legacy/DateCalendar/DayCalendar.js +7 -11
  53. package/legacy/DateCalendar/index.js +1 -3
  54. package/legacy/DatePicker/DatePicker.js +0 -1
  55. package/legacy/DateTimePicker/DateTimePicker.js +0 -1
  56. package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -1
  57. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
  58. package/legacy/DigitalClock/DigitalClock.js +3 -2
  59. package/legacy/LocalizationProvider/LocalizationProvider.js +0 -6
  60. package/legacy/MobileDatePicker/MobileDatePicker.js +0 -1
  61. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
  62. package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +11 -3
  63. package/legacy/StaticDatePicker/StaticDatePicker.js +0 -1
  64. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  65. package/legacy/YearCalendar/YearCalendar.js +1 -1
  66. package/legacy/index.js +4 -1
  67. package/legacy/internals/hooks/useField/useField.utils.js +0 -1
  68. package/legacy/internals/hooks/useField/useFieldState.js +1 -1
  69. package/legacy/internals/utils/getDefaultReferenceDate.js +0 -6
  70. package/models/adapters.d.ts +10 -135
  71. package/models/fields.d.ts +0 -6
  72. package/modern/AdapterDateFns/AdapterDateFns.js +8 -90
  73. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
  74. package/modern/AdapterDayjs/AdapterDayjs.js +11 -59
  75. package/modern/AdapterLuxon/AdapterLuxon.js +3 -73
  76. package/modern/AdapterMoment/AdapterMoment.js +9 -65
  77. package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
  78. package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
  79. package/modern/DateCalendar/DateCalendar.js +0 -1
  80. package/modern/DateCalendar/DayCalendar.js +9 -15
  81. package/modern/DateCalendar/index.js +1 -3
  82. package/modern/DatePicker/DatePicker.js +0 -1
  83. package/modern/DateTimePicker/DateTimePicker.js +0 -1
  84. package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -1
  85. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
  86. package/modern/DigitalClock/DigitalClock.js +3 -2
  87. package/modern/LocalizationProvider/LocalizationProvider.js +0 -6
  88. package/modern/MobileDatePicker/MobileDatePicker.js +0 -1
  89. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
  90. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
  91. package/modern/StaticDatePicker/StaticDatePicker.js +0 -1
  92. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  93. package/modern/YearCalendar/YearCalendar.js +1 -1
  94. package/modern/index.js +4 -1
  95. package/modern/internals/hooks/useField/useField.utils.js +0 -1
  96. package/modern/internals/hooks/useField/useFieldState.js +1 -1
  97. package/modern/internals/utils/getDefaultReferenceDate.js +0 -1
  98. package/node/AdapterDateFns/AdapterDateFns.js +8 -90
  99. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
  100. package/node/AdapterDayjs/AdapterDayjs.js +11 -59
  101. package/node/AdapterLuxon/AdapterLuxon.js +3 -73
  102. package/node/AdapterMoment/AdapterMoment.js +9 -65
  103. package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
  104. package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
  105. package/node/DateCalendar/DateCalendar.js +0 -1
  106. package/node/DateCalendar/DayCalendar.js +9 -15
  107. package/node/DateCalendar/index.js +1 -21
  108. package/node/DatePicker/DatePicker.js +0 -1
  109. package/node/DateTimePicker/DateTimePicker.js +0 -1
  110. package/node/DesktopDatePicker/DesktopDatePicker.js +0 -1
  111. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
  112. package/node/DigitalClock/DigitalClock.js +3 -2
  113. package/node/LocalizationProvider/LocalizationProvider.js +0 -6
  114. package/node/MobileDatePicker/MobileDatePicker.js +0 -1
  115. package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
  116. package/node/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
  117. package/node/StaticDatePicker/StaticDatePicker.js +0 -1
  118. package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  119. package/node/YearCalendar/YearCalendar.js +1 -1
  120. package/node/index.js +13 -1
  121. package/node/internals/hooks/useField/useField.utils.js +0 -1
  122. package/node/internals/hooks/useField/useFieldState.js +1 -1
  123. package/node/internals/utils/getDefaultReferenceDate.js +1 -3
  124. package/package.json +1 -1
  125. package/themeAugmentation/overrides.d.ts +1 -1
@@ -117,19 +117,13 @@ const defaultFormats = {
117
117
  minutes: 'mm',
118
118
  seconds: 'ss',
119
119
  fullDate: 'll',
120
- fullDateWithWeekday: 'dddd, LL',
121
120
  keyboardDate: 'L',
122
121
  shortDate: 'MMM D',
123
122
  normalDate: 'D MMMM',
124
123
  normalDateWithWeekday: 'ddd, MMM D',
125
- monthAndYear: 'MMMM YYYY',
126
- monthAndDate: 'MMMM D',
127
124
  fullTime: 'LT',
128
125
  fullTime12h: 'hh:mm A',
129
126
  fullTime24h: 'HH:mm',
130
- fullDateTime: 'lll',
131
- fullDateTime12h: 'll hh:mm A',
132
- fullDateTime24h: 'll HH:mm',
133
127
  keyboardDateTime: 'L LT',
134
128
  keyboardDateTime12h: 'L hh:mm A',
135
129
  keyboardDateTime24h: 'L HH:mm'
@@ -185,21 +179,6 @@ class AdapterMoment {
185
179
  }
186
180
  return value.locale(expectedLocale);
187
181
  };
188
- /**
189
- * Some methods from moment can't take the locale as a parameter and always use the current locale.
190
- * To respect the adapter locale, we need to set it as the current locale and then reset the previous locale.
191
- */
192
- this.syncMomentLocale = runner => {
193
- const momentLocale = _moment.default.locale();
194
- const adapterLocale = this.locale ?? 'en-us';
195
- if (momentLocale !== adapterLocale) {
196
- _moment.default.locale(adapterLocale);
197
- const result = runner();
198
- _moment.default.locale(momentLocale);
199
- return result;
200
- }
201
- return runner();
202
- };
203
182
  this.hasTimezonePlugin = () => typeof this.moment.tz !== 'undefined';
204
183
  this.createSystemDate = value => {
205
184
  const parsedValue = this.moment(value).local();
@@ -285,12 +264,6 @@ class AdapterMoment {
285
264
  this.toJsDate = value => {
286
265
  return value.toDate();
287
266
  };
288
- this.parseISO = isoString => {
289
- return this.moment(isoString, true);
290
- };
291
- this.toISO = value => {
292
- return value.toISOString();
293
- };
294
267
  this.parse = (value, format) => {
295
268
  if (value === '') {
296
269
  return null;
@@ -317,14 +290,11 @@ class AdapterMoment {
317
290
  return token;
318
291
  }).join('');
319
292
  };
320
- this.getFormatHelperText = format => {
321
- return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
322
- };
323
- this.isNull = value => {
324
- return value === null;
325
- };
326
293
  this.isValid = value => {
327
- return this.moment(value).isValid();
294
+ if (value == null) {
295
+ return false;
296
+ }
297
+ return value.isValid();
328
298
  };
329
299
  this.format = (value, formatKey) => {
330
300
  return this.formatByString(value, this.formats[formatKey]);
@@ -337,14 +307,14 @@ class AdapterMoment {
337
307
  this.formatNumber = numberToFormat => {
338
308
  return numberToFormat;
339
309
  };
340
- this.getDiff = (value, comparing, unit) => {
341
- return value.diff(comparing, unit);
342
- };
343
310
  this.isEqual = (value, comparing) => {
344
311
  if (value === null && comparing === null) {
345
312
  return true;
346
313
  }
347
- return this.moment(value).isSame(comparing);
314
+ if (value === null || comparing === null) {
315
+ return false;
316
+ }
317
+ return value.isSame(comparing);
348
318
  };
349
319
  this.isSameYear = (value, comparing) => {
350
320
  return value.isSame(comparing, 'year');
@@ -469,25 +439,6 @@ class AdapterMoment {
469
439
  this.getDaysInMonth = value => {
470
440
  return value.daysInMonth();
471
441
  };
472
- this.getNextMonth = value => {
473
- return value.clone().add(1, 'month');
474
- };
475
- this.getPreviousMonth = value => {
476
- return value.clone().subtract(1, 'month');
477
- };
478
- this.getMonthArray = value => {
479
- const firstMonth = this.startOfYear(value);
480
- const monthArray = [firstMonth];
481
- while (monthArray.length < 12) {
482
- const prevMonth = monthArray[monthArray.length - 1];
483
- monthArray.push(this.getNextMonth(prevMonth));
484
- }
485
- return monthArray;
486
- };
487
- this.mergeDateAndTime = (dateParam, timeParam) => {
488
- return dateParam.clone().hour(timeParam.hour()).minute(timeParam.minute()).second(timeParam.second());
489
- };
490
- this.getWeekdays = () => this.syncMomentLocale(() => _moment.default.weekdaysShort(true));
491
442
  this.getWeekArray = value => {
492
443
  const cleanValue = this.setLocaleToValue(value);
493
444
  const start = cleanValue.clone().startOf('month').startOf('week');
@@ -507,7 +458,7 @@ class AdapterMoment {
507
458
  this.getWeekNumber = value => {
508
459
  return value.week();
509
460
  };
510
- this.getYearRange = (start, end) => {
461
+ this.getYearRange = ([start, end]) => {
511
462
  const startDate = this.moment(start).startOf('year');
512
463
  const endDate = this.moment(end).endOf('year');
513
464
  const years = [];
@@ -518,13 +469,6 @@ class AdapterMoment {
518
469
  }
519
470
  return years;
520
471
  };
521
- this.getMeridiemText = ampm => {
522
- if (this.is12HourCycleInCurrentLocale()) {
523
- // AM/PM translation only possible in those who have 12 hour cycle in locale.
524
- return _moment.default.localeData(this.getCurrentLocaleCode()).meridiem(ampm === 'am' ? 0 : 13, 0, false);
525
- }
526
- return ampm === 'am' ? 'AM' : 'PM'; // fallback for de, ru, ...etc
527
- };
528
472
  this.moment = instance || _moment.default;
529
473
  this.locale = locale;
530
474
  this.formats = (0, _extends2.default)({}, defaultFormats, formats);
@@ -87,19 +87,13 @@ const defaultFormats = {
87
87
  minutes: 'mm',
88
88
  seconds: 'ss',
89
89
  fullDate: 'iYYYY, iMMMM Do',
90
- fullDateWithWeekday: 'iYYYY, iMMMM Do, dddd',
91
90
  keyboardDateTime: 'iYYYY/iMM/iDD LT',
92
91
  shortDate: 'iD iMMM',
93
92
  normalDate: 'dddd, iD iMMM',
94
93
  normalDateWithWeekday: 'DD iMMMM',
95
- monthAndYear: 'iMMMM iYYYY',
96
- monthAndDate: 'iD iMMMM',
97
94
  fullTime: 'LT',
98
95
  fullTime12h: 'hh:mm A',
99
96
  fullTime24h: 'HH:mm',
100
- fullDateTime: 'iYYYY, iMMMM Do, hh:mm A',
101
- fullDateTime12h: 'iD iMMMM hh:mm A',
102
- fullDateTime24h: 'iD iMMMM HH:mm',
103
97
  keyboardDate: 'iYYYY/iMM/iDD',
104
98
  keyboardDateTime12h: 'iYYYY/iMM/iDD hh:mm A',
105
99
  keyboardDateTime24h: 'iYYYY/iMM/iDD HH:mm'
@@ -176,18 +170,9 @@ class AdapterMomentHijri extends _AdapterMoment.AdapterMoment {
176
170
  }
177
171
  return this.moment(value, format, true).locale('ar-SA');
178
172
  };
179
- this.getFormatHelperText = format => {
180
- return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('iY', 'Y').replace('iM', 'M').replace('iD', 'D').toLocaleLowerCase();
181
- };
182
173
  this.formatNumber = numberToFormat => {
183
174
  return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
184
175
  };
185
- this.isEqual = (value, comparing) => {
186
- if (value === null && comparing === null) {
187
- return true;
188
- }
189
- return this.moment(value).isSame(comparing);
190
- };
191
176
  this.startOfYear = value => {
192
177
  return value.clone().startOf('iYear');
193
178
  };
@@ -224,17 +209,6 @@ class AdapterMomentHijri extends _AdapterMoment.AdapterMoment {
224
209
  this.setDate = (value, date) => {
225
210
  return value.clone().iDate(date);
226
211
  };
227
- this.getNextMonth = value => {
228
- return value.clone().add(1, 'iMonth');
229
- };
230
- this.getPreviousMonth = value => {
231
- return value.clone().subtract(1, 'iMonth');
232
- };
233
- this.getWeekdays = () => {
234
- return [0, 1, 2, 3, 4, 5, 6].map(dayOfWeek => {
235
- return this.date().weekday(dayOfWeek).format('dd');
236
- });
237
- };
238
212
  this.getWeekArray = value => {
239
213
  const start = value.clone().startOf('iMonth').startOf('week');
240
214
  const end = value.clone().endOf('iMonth').endOf('week');
@@ -253,7 +227,7 @@ class AdapterMomentHijri extends _AdapterMoment.AdapterMoment {
253
227
  this.getWeekNumber = value => {
254
228
  return value.iWeek();
255
229
  };
256
- this.getYearRange = (start, end) => {
230
+ this.getYearRange = ([start, end]) => {
257
231
  // moment-hijri only supports dates between 1356-01-01 H and 1499-12-29 H
258
232
  // We need to throw if outside min/max bounds, otherwise the while loop below will be infinite.
259
233
  if (start.isBefore('1937-03-14')) {
@@ -272,9 +246,6 @@ class AdapterMomentHijri extends _AdapterMoment.AdapterMoment {
272
246
  }
273
247
  return years;
274
248
  };
275
- this.getMeridiemText = ampm => {
276
- return ampm === 'am' ? this.date().hours(2).format('A') : this.date().hours(14).format('A');
277
- };
278
249
  this.moment = instance || _momentHijri.default;
279
250
  this.locale = 'ar-SA';
280
251
  this.formats = (0, _extends2.default)({}, defaultFormats, formats);
@@ -85,19 +85,13 @@ const defaultFormats = {
85
85
  minutes: 'mm',
86
86
  seconds: 'ss',
87
87
  fullDate: 'jYYYY, jMMMM Do',
88
- fullDateWithWeekday: 'dddd Do jMMMM jYYYY',
89
88
  keyboardDate: 'jYYYY/jMM/jDD',
90
89
  shortDate: 'jD jMMM',
91
90
  normalDate: 'dddd, jD jMMM',
92
91
  normalDateWithWeekday: 'DD MMMM',
93
- monthAndYear: 'jMMMM jYYYY',
94
- monthAndDate: 'jD jMMMM',
95
92
  fullTime: 'LT',
96
93
  fullTime12h: 'hh:mm A',
97
94
  fullTime24h: 'HH:mm',
98
- fullDateTime: 'jYYYY, jMMMM Do, hh:mm A',
99
- fullDateTime12h: 'jD jMMMM hh:mm A',
100
- fullDateTime24h: 'jD jMMMM HH:mm',
101
95
  keyboardDateTime: 'jYYYY/jMM/jDD LT',
102
96
  keyboardDateTime12h: 'jYYYY/jMM/jDD hh:mm A',
103
97
  keyboardDateTime24h: 'jYYYY/jMM/jDD HH:mm'
@@ -168,34 +162,15 @@ class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
168
162
  this.setTimezone = value => {
169
163
  return value;
170
164
  };
171
- this.parseISO = isoString => {
172
- return this.moment(isoString).locale('fa');
173
- };
174
165
  this.parse = (value, format) => {
175
166
  if (value === '') {
176
167
  return null;
177
168
  }
178
169
  return this.moment(value, format, true).locale('fa');
179
170
  };
180
- this.getFormatHelperText = format => {
181
- return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('jY', 'Y').replace('jM', 'M').replace('jD', 'D').toLocaleLowerCase();
182
- };
183
- this.isValid = value => {
184
- // We can't to `this.moment(value)` because moment-jalaali looses the invalidity information when creating a new moment object from an existing one
185
- if (!this.moment.isMoment(value)) {
186
- return false;
187
- }
188
- return value.isValid();
189
- };
190
171
  this.formatNumber = numberToFormat => {
191
172
  return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
192
173
  };
193
- this.isEqual = (value, comparing) => {
194
- if (value === null && comparing === null) {
195
- return true;
196
- }
197
- return this.moment(value).isSame(comparing);
198
- };
199
174
  this.isSameYear = (value, comparing) => {
200
175
  // `isSame` seems to mutate the date on `moment-jalaali`
201
176
  // @ts-ignore
@@ -248,17 +223,6 @@ class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
248
223
  this.setDate = (value, date) => {
249
224
  return value.clone().jDate(date);
250
225
  };
251
- this.getNextMonth = value => {
252
- return value.clone().add(1, 'jMonth');
253
- };
254
- this.getPreviousMonth = value => {
255
- return value.clone().subtract(1, 'jMonth');
256
- };
257
- this.getWeekdays = () => {
258
- return [0, 1, 2, 3, 4, 5, 6].map(dayOfWeek => {
259
- return this.date().weekday(dayOfWeek).format('dd');
260
- });
261
- };
262
226
  this.getWeekArray = value => {
263
227
  const start = value.clone().startOf('jMonth').startOf('week');
264
228
  const end = value.clone().endOf('jMonth').endOf('week');
@@ -277,7 +241,7 @@ class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
277
241
  this.getWeekNumber = value => {
278
242
  return value.jWeek();
279
243
  };
280
- this.getYearRange = (start, end) => {
244
+ this.getYearRange = ([start, end]) => {
281
245
  const startDate = this.moment(start).startOf('jYear');
282
246
  const endDate = this.moment(end).endOf('jYear');
283
247
  const years = [];
@@ -288,9 +252,6 @@ class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
288
252
  }
289
253
  return years;
290
254
  };
291
- this.getMeridiemText = ampm => {
292
- return ampm === 'am' ? this.date().hours(2).format('A') : this.date().hours(14).format('A');
293
- };
294
255
  this.moment = instance || _momentJalaali.default;
295
256
  this.locale = 'fa';
296
257
  this.formats = (0, _extends2.default)({}, defaultFormats, formats);
@@ -368,7 +368,6 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
368
368
  className: _propTypes.default.string,
369
369
  /**
370
370
  * Formats the day of week displayed in the calendar header.
371
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
372
371
  * @param {TDate} date The date of the day of week provided by the adapter.
373
372
  * @returns {string} The name to display.
374
373
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
@@ -223,6 +223,7 @@ function DayCalendar(inProps) {
223
223
  props: inProps,
224
224
  name: 'MuiDayCalendar'
225
225
  });
226
+ const utils = (0, _useUtils.useUtils)();
226
227
  const {
227
228
  onFocusedDayChange,
228
229
  className,
@@ -246,7 +247,7 @@ function DayCalendar(inProps) {
246
247
  shouldDisableDate,
247
248
  shouldDisableMonth,
248
249
  shouldDisableYear,
249
- dayOfWeekFormatter: dayOfWeekFormatterFromProps,
250
+ dayOfWeekFormatter = date => utils.format(date, 'weekdayShort').charAt(0).toUpperCase(),
250
251
  hasFocus,
251
252
  onFocusedViewChange,
252
253
  gridLabelId,
@@ -256,13 +257,9 @@ function DayCalendar(inProps) {
256
257
  timezone
257
258
  } = props;
258
259
  const now = (0, _useUtils.useNow)(timezone);
259
- const utils = (0, _useUtils.useUtils)();
260
260
  const classes = useUtilityClasses(props);
261
261
  const theme = (0, _styles.useTheme)();
262
262
  const isRTL = theme.direction === 'rtl';
263
-
264
- // before we could define this outside of the component scope, but now we need utils, which is only defined here
265
- const dayOfWeekFormatter = dayOfWeekFormatterFromProps || ((_day, date) => utils.format(date, 'weekdayShort').charAt(0).toUpperCase());
266
263
  const isDateDisabled = (0, _useIsDateDisabled.useIsDateDisabled)({
267
264
  shouldDisableDate,
268
265
  shouldDisableMonth,
@@ -417,16 +414,13 @@ function DayCalendar(inProps) {
417
414
  "aria-label": localeText.calendarWeekNumberHeaderLabel,
418
415
  className: classes.weekNumberLabel,
419
416
  children: localeText.calendarWeekNumberHeaderText
420
- }), (0, _dateUtils.getWeekdays)(utils, now).map((weekday, i) => {
421
- const day = utils.format(weekday, 'weekdayShort');
422
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarWeekDayLabel, {
423
- variant: "caption",
424
- role: "columnheader",
425
- "aria-label": utils.format(utils.addDays(startOfCurrentWeek, i), 'weekday'),
426
- className: classes.weekDayLabel,
427
- children: dayOfWeekFormatter?.(day, weekday) ?? day
428
- }, day + i.toString());
429
- })]
417
+ }), (0, _dateUtils.getWeekdays)(utils, now).map((weekday, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarWeekDayLabel, {
418
+ variant: "caption",
419
+ role: "columnheader",
420
+ "aria-label": utils.format(utils.addDays(startOfCurrentWeek, i), 'weekday'),
421
+ className: classes.weekDayLabel,
422
+ children: dayOfWeekFormatter(weekday)
423
+ }, i.toString()))]
430
424
  }), loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarLoadingContainer, {
431
425
  className: classes.loadingContainer,
432
426
  children: renderLoading()
@@ -3,14 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _exportNames = {
7
- DateCalendar: true,
8
- getDateCalendarUtilityClass: true,
9
- dateCalendarClasses: true,
10
- dayPickerClasses: true,
11
- pickersFadeTransitionGroupClasses: true,
12
- pickersSlideTransitionClasses: true
13
- };
14
6
  Object.defineProperty(exports, "DateCalendar", {
15
7
  enumerable: true,
16
8
  get: function () {
@@ -51,16 +43,4 @@ var _DateCalendar = require("./DateCalendar");
51
43
  var _dateCalendarClasses = require("./dateCalendarClasses");
52
44
  var _dayCalendarClasses = require("./dayCalendarClasses");
53
45
  var _pickersFadeTransitionGroupClasses = require("./pickersFadeTransitionGroupClasses");
54
- var _pickersSlideTransitionClasses = require("./pickersSlideTransitionClasses");
55
- var _PickersCalendarHeader = require("../PickersCalendarHeader");
56
- Object.keys(_PickersCalendarHeader).forEach(function (key) {
57
- if (key === "default" || key === "__esModule") return;
58
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
59
- if (key in exports && exports[key] === _PickersCalendarHeader[key]) return;
60
- Object.defineProperty(exports, key, {
61
- enumerable: true,
62
- get: function () {
63
- return _PickersCalendarHeader[key];
64
- }
65
- });
66
- });
46
+ var _pickersSlideTransitionClasses = require("./pickersSlideTransitionClasses");
@@ -75,7 +75,6 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
75
75
  closeOnSelect: _propTypes.default.bool,
76
76
  /**
77
77
  * Formats the day of week displayed in the calendar header.
78
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
79
78
  * @param {TDate} date The date of the day of week provided by the adapter.
80
79
  * @returns {string} The name to display.
81
80
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
@@ -85,7 +85,6 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
85
85
  closeOnSelect: _propTypes.default.bool,
86
86
  /**
87
87
  * Formats the day of week displayed in the calendar header.
88
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
89
88
  * @param {TDate} date The date of the day of week provided by the adapter.
90
89
  * @returns {string} The name to display.
91
90
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
@@ -95,7 +95,6 @@ DesktopDatePicker.propTypes = {
95
95
  closeOnSelect: _propTypes.default.bool,
96
96
  /**
97
97
  * Formats the day of week displayed in the calendar header.
98
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
99
98
  * @param {TDate} date The date of the day of week provided by the adapter.
100
99
  * @returns {string} The name to display.
101
100
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
@@ -144,7 +144,6 @@ DesktopDateTimePicker.propTypes = {
144
144
  closeOnSelect: _propTypes.default.bool,
145
145
  /**
146
146
  * Formats the day of week displayed in the calendar header.
147
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
148
147
  * @param {TDate} date The date of the day of week provided by the adapter.
149
148
  * @returns {string} The name to display.
150
149
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
@@ -252,6 +252,7 @@ const DigitalClock = exports.DigitalClock = /*#__PURE__*/React.forwardRef(functi
252
252
  return null;
253
253
  }
254
254
  const isSelected = utils.isEqual(option, value);
255
+ const formattedValue = utils.format(option, ampm ? 'fullTime12h' : 'fullTime24h');
255
256
  const tabIndex = focusedOptionIndex === index || focusedOptionIndex === -1 && index === 0 ? 0 : -1;
256
257
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(ClockItem, (0, _extends2.default)({
257
258
  onClick: () => !readOnly && handleItemSelect(option),
@@ -265,8 +266,8 @@ const DigitalClock = exports.DigitalClock = /*#__PURE__*/React.forwardRef(functi
265
266
  "aria-selected": isSelected,
266
267
  tabIndex: tabIndex
267
268
  }, clockItemProps, {
268
- children: utils.format(option, ampm ? 'fullTime12h' : 'fullTime24h')
269
- }), utils.toISO(option));
269
+ children: formattedValue
270
+ }), formattedValue);
270
271
  })
271
272
  })
272
273
  }));
@@ -116,10 +116,6 @@ process.env.NODE_ENV !== "production" ? LocalizationProvider.propTypes = {
116
116
  dateFormats: _propTypes.default.shape({
117
117
  dayOfMonth: _propTypes.default.string,
118
118
  fullDate: _propTypes.default.string,
119
- fullDateTime: _propTypes.default.string,
120
- fullDateTime12h: _propTypes.default.string,
121
- fullDateTime24h: _propTypes.default.string,
122
- fullDateWithWeekday: _propTypes.default.string,
123
119
  fullTime: _propTypes.default.string,
124
120
  fullTime12h: _propTypes.default.string,
125
121
  fullTime24h: _propTypes.default.string,
@@ -132,8 +128,6 @@ process.env.NODE_ENV !== "production" ? LocalizationProvider.propTypes = {
132
128
  meridiem: _propTypes.default.string,
133
129
  minutes: _propTypes.default.string,
134
130
  month: _propTypes.default.string,
135
- monthAndDate: _propTypes.default.string,
136
- monthAndYear: _propTypes.default.string,
137
131
  monthShort: _propTypes.default.string,
138
132
  normalDate: _propTypes.default.string,
139
133
  normalDateWithWeekday: _propTypes.default.string,
@@ -92,7 +92,6 @@ MobileDatePicker.propTypes = {
92
92
  closeOnSelect: _propTypes.default.bool,
93
93
  /**
94
94
  * Formats the day of week displayed in the calendar header.
95
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
96
95
  * @param {TDate} date The date of the day of week provided by the adapter.
97
96
  * @returns {string} The name to display.
98
97
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
@@ -113,7 +113,6 @@ MobileDateTimePicker.propTypes = {
113
113
  closeOnSelect: _propTypes.default.bool,
114
114
  /**
115
115
  * Formats the day of week displayed in the calendar header.
116
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
117
116
  * @param {TDate} date The date of the day of week provided by the adapter.
118
117
  * @returns {string} The name to display.
119
118
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
@@ -22,7 +22,7 @@ var _PickersArrowSwitcher = require("../internals/components/PickersArrowSwitche
22
22
  var _dateHelpersHooks = require("../internals/hooks/date-helpers-hooks");
23
23
  var _pickersCalendarHeaderClasses = require("./pickersCalendarHeaderClasses");
24
24
  var _jsxRuntime = require("react/jsx-runtime");
25
- const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
25
+ const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone", "format"],
26
26
  _excluded2 = ["ownerState"];
27
27
  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); }
28
28
  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; }
@@ -134,7 +134,8 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
134
134
  views,
135
135
  labelId,
136
136
  className,
137
- timezone
137
+ timezone,
138
+ format = `${utils.formats.month} ${utils.formats.year}`
138
139
  } = props,
139
140
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
140
141
  const ownerState = props;
@@ -188,6 +189,7 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
188
189
  if (views.length === 1 && views[0] === 'year') {
189
190
  return null;
190
191
  }
192
+ const label = utils.formatByString(month, format);
191
193
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PickersCalendarHeaderRoot, (0, _extends2.default)({}, other, {
192
194
  ownerState: ownerState,
193
195
  className: (0, _clsx.default)(className, classes.root),
@@ -202,12 +204,12 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
202
204
  className: classes.labelContainer,
203
205
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersFadeTransitionGroup.PickersFadeTransitionGroup, {
204
206
  reduceAnimations: reduceAnimations,
205
- transKey: utils.format(month, 'monthAndYear'),
207
+ transKey: label,
206
208
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarHeaderLabel, {
207
209
  id: labelId,
208
210
  ownerState: ownerState,
209
211
  className: classes.label,
210
- children: utils.format(month, 'monthAndYear')
212
+ children: label
211
213
  })
212
214
  }), views.length > 1 && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(SwitchViewButton, (0, _extends2.default)({}, switchViewButtonProps, {
213
215
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SwitchViewIcon, (0, _extends2.default)({}, switchViewIconProps))
@@ -244,6 +246,11 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
244
246
  disabled: _propTypes.default.bool,
245
247
  disableFuture: _propTypes.default.bool,
246
248
  disablePast: _propTypes.default.bool,
249
+ /**
250
+ * Format used to display the date.
251
+ * @default `${adapter.formats.month} ${adapter.formats.year}`
252
+ */
253
+ format: _propTypes.default.string,
247
254
  labelId: _propTypes.default.string,
248
255
  maxDate: _propTypes.default.any.isRequired,
249
256
  minDate: _propTypes.default.any.isRequired,
@@ -74,7 +74,6 @@ StaticDatePicker.propTypes = {
74
74
  className: _propTypes.default.string,
75
75
  /**
76
76
  * Formats the day of week displayed in the calendar header.
77
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
78
77
  * @param {TDate} date The date of the day of week provided by the adapter.
79
78
  * @returns {string} The name to display.
80
79
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
@@ -94,7 +94,6 @@ StaticDateTimePicker.propTypes = {
94
94
  className: _propTypes.default.string,
95
95
  /**
96
96
  * Formats the day of week displayed in the calendar header.
97
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
98
97
  * @param {TDate} date The date of the day of week provided by the adapter.
99
98
  * @returns {string} The name to display.
100
99
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
@@ -243,7 +243,7 @@ const YearCalendar = exports.YearCalendar = /*#__PURE__*/React.forwardRef(functi
243
243
  role: "radiogroup",
244
244
  "aria-labelledby": gridLabelId
245
245
  }, other, {
246
- children: utils.getYearRange(minDate, maxDate).map(year => {
246
+ children: utils.getYearRange([minDate, maxDate]).map(year => {
247
247
  const yearNumber = utils.getYear(year);
248
248
  const isSelected = yearNumber === selectedYear;
249
249
  const isDisabled = disabled || isYearDisabled(year);
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.0.0-alpha.0
2
+ * @mui/x-date-pickers v7.0.0-alpha.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -379,6 +379,18 @@ Object.keys(_PickersShortcuts).forEach(function (key) {
379
379
  }
380
380
  });
381
381
  });
382
+ var _PickersCalendarHeader = require("./PickersCalendarHeader");
383
+ Object.keys(_PickersCalendarHeader).forEach(function (key) {
384
+ if (key === "default" || key === "__esModule") return;
385
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
386
+ if (key in exports && exports[key] === _PickersCalendarHeader[key]) return;
387
+ Object.defineProperty(exports, key, {
388
+ enumerable: true,
389
+ get: function () {
390
+ return _PickersCalendarHeader[key];
391
+ }
392
+ });
393
+ });
382
394
  var _utils = require("./internals/utils/utils");
383
395
  var _models = require("./models");
384
396
  Object.keys(_models).forEach(function (key) {
@@ -375,7 +375,6 @@ const splitFormatIntoSections = (utils, timezone, localeText, format, date, form
375
375
  maxLength,
376
376
  value: sectionValue,
377
377
  placeholder: getSectionPlaceholder(utils, timezone, localeText, sectionConfig, token),
378
- hasLeadingZeros: hasLeadingZerosInFormat,
379
378
  hasLeadingZerosInFormat,
380
379
  hasLeadingZerosInInput,
381
380
  startSeparator: sections.length === 0 ? startSeparator : '',
@@ -258,7 +258,7 @@ const useFieldState = params => {
258
258
  }, [format, utils.locale]); // eslint-disable-line react-hooks/exhaustive-deps
259
259
 
260
260
  React.useEffect(() => {
261
- let shouldUpdate = false;
261
+ let shouldUpdate;
262
262
  if (!valueManager.areValuesEqual(utils, state.value, valueFromTheOutside)) {
263
263
  shouldUpdate = true;
264
264
  } else {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getViewsGranularity = exports.getSectionTypeGranularity = exports.getDefaultReferenceDate = exports.SECTION_TYPE_GRANULARITY = void 0;
6
+ exports.getSectionTypeGranularity = exports.getDefaultReferenceDate = exports.SECTION_TYPE_GRANULARITY = void 0;
7
7
  var _timeUtils = require("./time-utils");
8
8
  var _dateUtils = require("./date-utils");
9
9
  const SECTION_TYPE_GRANULARITY = exports.SECTION_TYPE_GRANULARITY = {
@@ -17,8 +17,6 @@ const SECTION_TYPE_GRANULARITY = exports.SECTION_TYPE_GRANULARITY = {
17
17
  };
18
18
  const getSectionTypeGranularity = sections => Math.max(...sections.map(section => SECTION_TYPE_GRANULARITY[section.type] ?? 1));
19
19
  exports.getSectionTypeGranularity = getSectionTypeGranularity;
20
- const getViewsGranularity = views => Math.max(...views.map(view => SECTION_TYPE_GRANULARITY[view] ?? 1));
21
- exports.getViewsGranularity = getViewsGranularity;
22
20
  const roundDate = (utils, granularity, date) => {
23
21
  if (granularity === SECTION_TYPE_GRANULARITY.year) {
24
22
  return utils.startOfYear(date);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-date-pickers",
3
- "version": "7.0.0-alpha.0",
3
+ "version": "7.0.0-alpha.1",
4
4
  "description": "The community edition of the date picker components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",