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

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 (252) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +6 -17
  2. package/AdapterDateFns/AdapterDateFns.js +9 -93
  3. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +6 -17
  4. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +9 -93
  5. package/AdapterDayjs/AdapterDayjs.d.ts +7 -19
  6. package/AdapterDayjs/AdapterDayjs.js +13 -67
  7. package/AdapterLuxon/AdapterLuxon.d.ts +6 -17
  8. package/AdapterLuxon/AdapterLuxon.js +5 -96
  9. package/AdapterMoment/AdapterMoment.d.ts +6 -22
  10. package/AdapterMoment/AdapterMoment.js +11 -75
  11. package/AdapterMomentHijri/AdapterMomentHijri.d.ts +2 -9
  12. package/AdapterMomentHijri/AdapterMomentHijri.js +1 -33
  13. package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +2 -11
  14. package/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -43
  15. package/CHANGELOG.md +591 -5
  16. package/DateCalendar/DateCalendar.js +2 -9
  17. package/DateCalendar/DateCalendar.types.d.ts +0 -4
  18. package/DateCalendar/DayCalendar.d.ts +1 -2
  19. package/DateCalendar/DayCalendar.js +9 -16
  20. package/DateCalendar/dayCalendarClasses.d.ts +1 -1
  21. package/DateCalendar/dayCalendarClasses.js +1 -1
  22. package/DateCalendar/index.d.ts +1 -2
  23. package/DateCalendar/index.js +2 -4
  24. package/DateCalendar/useCalendarState.d.ts +1 -1
  25. package/DateCalendar/useCalendarState.js +1 -9
  26. package/DateField/DateField.js +1 -1
  27. package/DatePicker/DatePicker.js +1 -6
  28. package/DatePicker/shared.d.ts +1 -1
  29. package/DateTimeField/DateTimeField.js +1 -9
  30. package/DateTimePicker/DateTimePicker.js +1 -14
  31. package/DateTimePicker/shared.d.ts +1 -1
  32. package/DesktopDatePicker/DesktopDatePicker.js +1 -6
  33. package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
  34. package/DesktopTimePicker/DesktopTimePicker.js +1 -9
  35. package/DigitalClock/DigitalClock.js +6 -17
  36. package/LocalizationProvider/LocalizationProvider.js +0 -6
  37. package/MobileDatePicker/MobileDatePicker.js +1 -6
  38. package/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
  39. package/MobileTimePicker/MobileTimePicker.js +1 -9
  40. package/MonthCalendar/MonthCalendar.js +1 -1
  41. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
  42. package/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
  43. package/PickersDay/PickersDay.js +1 -1
  44. package/StaticDatePicker/StaticDatePicker.js +1 -6
  45. package/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
  46. package/StaticTimePicker/StaticTimePicker.js +1 -9
  47. package/TimeClock/Clock.js +1 -1
  48. package/TimeClock/TimeClock.js +3 -15
  49. package/TimeField/TimeField.js +1 -9
  50. package/TimePicker/TimePicker.js +1 -9
  51. package/TimePicker/shared.d.ts +1 -1
  52. package/YearCalendar/YearCalendar.js +2 -2
  53. package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +2 -2
  54. package/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
  55. package/dateViewRenderers/dateViewRenderers.d.ts +1 -1
  56. package/dateViewRenderers/dateViewRenderers.js +0 -2
  57. package/index.d.ts +1 -0
  58. package/index.js +4 -1
  59. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +5 -0
  60. package/internals/hooks/date-helpers-hooks.js +2 -2
  61. package/internals/hooks/useField/useField.utils.js +8 -9
  62. package/internals/hooks/useField/useFieldState.js +2 -2
  63. package/internals/hooks/usePicker/usePickerValue.types.d.ts +1 -1
  64. package/internals/hooks/useUtils.js +1 -1
  65. package/internals/hooks/useViews.js +2 -2
  66. package/internals/models/validation.d.ts +0 -8
  67. package/internals/utils/date-utils.js +2 -2
  68. package/internals/utils/getDefaultReferenceDate.d.ts +1 -2
  69. package/internals/utils/getDefaultReferenceDate.js +0 -4
  70. package/internals/utils/validation/extractValidationProps.d.ts +1 -1
  71. package/internals/utils/validation/extractValidationProps.js +1 -1
  72. package/internals/utils/validation/validateDate.js +1 -1
  73. package/internals/utils/validation/validateTime.js +1 -8
  74. package/legacy/AdapterDateFns/AdapterDateFns.js +13 -94
  75. package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +13 -94
  76. package/legacy/AdapterDayjs/AdapterDayjs.js +19 -69
  77. package/legacy/AdapterLuxon/AdapterLuxon.js +10 -97
  78. package/legacy/AdapterMoment/AdapterMoment.js +16 -78
  79. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -33
  80. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -43
  81. package/legacy/DateCalendar/DateCalendar.js +2 -9
  82. package/legacy/DateCalendar/DayCalendar.js +7 -11
  83. package/legacy/DateCalendar/PickersSlideTransition.js +8 -9
  84. package/legacy/DateCalendar/dayCalendarClasses.js +1 -1
  85. package/legacy/DateCalendar/index.js +2 -4
  86. package/legacy/DateCalendar/useCalendarState.js +1 -9
  87. package/legacy/DateField/DateField.js +1 -1
  88. package/legacy/DatePicker/DatePicker.js +1 -6
  89. package/legacy/DateTimeField/DateTimeField.js +1 -9
  90. package/legacy/DateTimePicker/DateTimePicker.js +1 -14
  91. package/legacy/DesktopDatePicker/DesktopDatePicker.js +1 -6
  92. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
  93. package/legacy/DesktopTimePicker/DesktopTimePicker.js +1 -9
  94. package/legacy/DigitalClock/DigitalClock.js +6 -17
  95. package/legacy/LocalizationProvider/LocalizationProvider.js +0 -6
  96. package/legacy/MobileDatePicker/MobileDatePicker.js +1 -6
  97. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
  98. package/legacy/MobileTimePicker/MobileTimePicker.js +1 -9
  99. package/legacy/MonthCalendar/MonthCalendar.js +1 -1
  100. package/legacy/MonthCalendar/PickersMonth.js +4 -5
  101. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
  102. package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +11 -3
  103. package/legacy/PickersDay/PickersDay.js +6 -7
  104. package/legacy/PickersLayout/PickersLayout.js +5 -6
  105. package/legacy/StaticDatePicker/StaticDatePicker.js +1 -6
  106. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
  107. package/legacy/StaticTimePicker/StaticTimePicker.js +1 -9
  108. package/legacy/TimeClock/Clock.js +1 -1
  109. package/legacy/TimeClock/ClockNumber.js +4 -5
  110. package/legacy/TimeClock/TimeClock.js +3 -15
  111. package/legacy/TimeField/TimeField.js +1 -9
  112. package/legacy/TimePicker/TimePicker.js +1 -9
  113. package/legacy/TimePicker/TimePickerToolbar.js +1 -2
  114. package/legacy/YearCalendar/PickersYear.js +4 -5
  115. package/legacy/YearCalendar/YearCalendar.js +2 -2
  116. package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
  117. package/legacy/dateViewRenderers/dateViewRenderers.js +0 -2
  118. package/legacy/index.js +4 -1
  119. package/legacy/internals/components/PickersModalDialog.js +3 -4
  120. package/legacy/internals/hooks/date-helpers-hooks.js +2 -2
  121. package/legacy/internals/hooks/useField/useField.utils.js +8 -9
  122. package/legacy/internals/hooks/useField/useFieldState.js +2 -2
  123. package/legacy/internals/hooks/useUtils.js +1 -1
  124. package/legacy/internals/hooks/useViews.js +2 -2
  125. package/legacy/internals/utils/date-utils.js +2 -2
  126. package/legacy/internals/utils/getDefaultReferenceDate.js +0 -6
  127. package/legacy/internals/utils/validation/extractValidationProps.js +1 -1
  128. package/legacy/internals/utils/validation/validateDate.js +1 -1
  129. package/legacy/internals/utils/validation/validateTime.js +1 -8
  130. package/legacy/locales/deDE.js +4 -3
  131. package/legacy/locales/index.js +1 -0
  132. package/legacy/locales/mk.js +91 -0
  133. package/legacy/timeViewRenderers/timeViewRenderers.js +0 -6
  134. package/locales/deDE.js +2 -3
  135. package/locales/index.d.ts +1 -0
  136. package/locales/index.js +1 -0
  137. package/locales/mk.d.ts +53 -0
  138. package/locales/mk.js +55 -0
  139. package/models/adapters.d.ts +16 -145
  140. package/models/fields.d.ts +0 -6
  141. package/models/timezone.d.ts +1 -1
  142. package/models/validation.d.ts +1 -1
  143. package/modern/AdapterDateFns/AdapterDateFns.js +9 -93
  144. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +9 -93
  145. package/modern/AdapterDayjs/AdapterDayjs.js +13 -66
  146. package/modern/AdapterLuxon/AdapterLuxon.js +5 -96
  147. package/modern/AdapterMoment/AdapterMoment.js +11 -74
  148. package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -33
  149. package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -43
  150. package/modern/DateCalendar/DateCalendar.js +2 -9
  151. package/modern/DateCalendar/DayCalendar.js +9 -15
  152. package/modern/DateCalendar/dayCalendarClasses.js +1 -1
  153. package/modern/DateCalendar/index.js +2 -4
  154. package/modern/DateCalendar/useCalendarState.js +1 -9
  155. package/modern/DateField/DateField.js +1 -1
  156. package/modern/DatePicker/DatePicker.js +1 -6
  157. package/modern/DateTimeField/DateTimeField.js +1 -9
  158. package/modern/DateTimePicker/DateTimePicker.js +1 -14
  159. package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -6
  160. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
  161. package/modern/DesktopTimePicker/DesktopTimePicker.js +1 -9
  162. package/modern/DigitalClock/DigitalClock.js +6 -17
  163. package/modern/LocalizationProvider/LocalizationProvider.js +0 -6
  164. package/modern/MobileDatePicker/MobileDatePicker.js +1 -6
  165. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
  166. package/modern/MobileTimePicker/MobileTimePicker.js +1 -9
  167. package/modern/MonthCalendar/MonthCalendar.js +1 -1
  168. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
  169. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
  170. package/modern/PickersDay/PickersDay.js +1 -1
  171. package/modern/StaticDatePicker/StaticDatePicker.js +1 -6
  172. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
  173. package/modern/StaticTimePicker/StaticTimePicker.js +1 -9
  174. package/modern/TimeClock/Clock.js +1 -1
  175. package/modern/TimeClock/TimeClock.js +3 -15
  176. package/modern/TimeField/TimeField.js +1 -9
  177. package/modern/TimePicker/TimePicker.js +1 -9
  178. package/modern/YearCalendar/YearCalendar.js +2 -2
  179. package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
  180. package/modern/dateViewRenderers/dateViewRenderers.js +0 -2
  181. package/modern/index.js +4 -1
  182. package/modern/internals/hooks/date-helpers-hooks.js +2 -2
  183. package/modern/internals/hooks/useField/useField.utils.js +8 -9
  184. package/modern/internals/hooks/useField/useFieldState.js +2 -2
  185. package/modern/internals/hooks/useUtils.js +1 -1
  186. package/modern/internals/hooks/useViews.js +2 -2
  187. package/modern/internals/utils/date-utils.js +2 -2
  188. package/modern/internals/utils/getDefaultReferenceDate.js +0 -1
  189. package/modern/internals/utils/validation/extractValidationProps.js +1 -1
  190. package/modern/internals/utils/validation/validateDate.js +1 -1
  191. package/modern/internals/utils/validation/validateTime.js +1 -8
  192. package/modern/locales/deDE.js +2 -3
  193. package/modern/locales/index.js +1 -0
  194. package/modern/locales/mk.js +55 -0
  195. package/modern/timeViewRenderers/timeViewRenderers.js +0 -6
  196. package/node/AdapterDateFns/AdapterDateFns.js +9 -93
  197. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +9 -93
  198. package/node/AdapterDayjs/AdapterDayjs.js +13 -66
  199. package/node/AdapterLuxon/AdapterLuxon.js +5 -96
  200. package/node/AdapterMoment/AdapterMoment.js +11 -74
  201. package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -33
  202. package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -43
  203. package/node/DateCalendar/DateCalendar.js +2 -9
  204. package/node/DateCalendar/DayCalendar.js +9 -15
  205. package/node/DateCalendar/dayCalendarClasses.js +2 -2
  206. package/node/DateCalendar/index.js +3 -23
  207. package/node/DateCalendar/useCalendarState.js +1 -9
  208. package/node/DateField/DateField.js +1 -1
  209. package/node/DatePicker/DatePicker.js +1 -6
  210. package/node/DateTimeField/DateTimeField.js +1 -9
  211. package/node/DateTimePicker/DateTimePicker.js +1 -14
  212. package/node/DesktopDatePicker/DesktopDatePicker.js +1 -6
  213. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
  214. package/node/DesktopTimePicker/DesktopTimePicker.js +1 -9
  215. package/node/DigitalClock/DigitalClock.js +6 -17
  216. package/node/LocalizationProvider/LocalizationProvider.js +0 -6
  217. package/node/MobileDatePicker/MobileDatePicker.js +1 -6
  218. package/node/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
  219. package/node/MobileTimePicker/MobileTimePicker.js +1 -9
  220. package/node/MonthCalendar/MonthCalendar.js +1 -1
  221. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
  222. package/node/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
  223. package/node/PickersDay/PickersDay.js +1 -1
  224. package/node/StaticDatePicker/StaticDatePicker.js +1 -6
  225. package/node/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
  226. package/node/StaticTimePicker/StaticTimePicker.js +1 -9
  227. package/node/TimeClock/Clock.js +1 -1
  228. package/node/TimeClock/TimeClock.js +3 -15
  229. package/node/TimeField/TimeField.js +1 -9
  230. package/node/TimePicker/TimePicker.js +1 -9
  231. package/node/YearCalendar/YearCalendar.js +2 -2
  232. package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
  233. package/node/dateViewRenderers/dateViewRenderers.js +0 -2
  234. package/node/index.js +13 -1
  235. package/node/internals/hooks/date-helpers-hooks.js +2 -2
  236. package/node/internals/hooks/useField/useField.utils.js +8 -9
  237. package/node/internals/hooks/useField/useFieldState.js +2 -2
  238. package/node/internals/hooks/useUtils.js +1 -1
  239. package/node/internals/hooks/useViews.js +2 -2
  240. package/node/internals/utils/date-utils.js +2 -2
  241. package/node/internals/utils/getDefaultReferenceDate.js +1 -3
  242. package/node/internals/utils/validation/extractValidationProps.js +1 -1
  243. package/node/internals/utils/validation/validateDate.js +1 -1
  244. package/node/internals/utils/validation/validateTime.js +1 -8
  245. package/node/locales/deDE.js +2 -3
  246. package/node/locales/index.js +11 -0
  247. package/node/locales/mk.js +60 -0
  248. package/node/timeViewRenderers/timeViewRenderers.js +0 -6
  249. package/package.json +7 -6
  250. package/themeAugmentation/overrides.d.ts +1 -1
  251. package/timeViewRenderers/timeViewRenderers.d.ts +3 -3
  252. package/timeViewRenderers/timeViewRenderers.js +0 -6
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["ampm", "timeSteps", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "skipDisabled", "timezone"];
3
+ const _excluded = ["ampm", "timeSteps", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableTime", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "skipDisabled", "timezone"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import PropTypes from 'prop-types';
@@ -72,7 +72,6 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
72
72
  disableFuture,
73
73
  disablePast,
74
74
  minutesStep = 1,
75
- shouldDisableClock,
76
75
  shouldDisableTime,
77
76
  onChange,
78
77
  view: inView,
@@ -166,9 +165,6 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
166
165
  if (timeValue % step !== 0) {
167
166
  return false;
168
167
  }
169
- if (shouldDisableClock != null && shouldDisableClock(timeValue, viewType)) {
170
- return false;
171
- }
172
168
  if (shouldDisableTime) {
173
169
  switch (viewType) {
174
170
  case 'hours':
@@ -218,7 +214,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
218
214
  default:
219
215
  throw new Error('not supported');
220
216
  }
221
- }, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableClock, shouldDisableTime, utils, disableFuture, disablePast, now, views]);
217
+ }, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableTime, utils, disableFuture, disablePast, now, views]);
222
218
  const handleSectionChange = useEventCallback((sectionView, newValue) => {
223
219
  const viewIndex = views.indexOf(sectionView);
224
220
  const nextView = views[viewIndex + 1];
@@ -434,14 +430,6 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
434
430
  * @default The closest valid time using the validation props, except callbacks such as `shouldDisableTime`.
435
431
  */
436
432
  referenceDate: PropTypes.any,
437
- /**
438
- * Disable specific clock time.
439
- * @param {number} clockValue The value to check.
440
- * @param {TimeView} view The clock type of the timeValue.
441
- * @returns {boolean} If `true` the time will be disabled.
442
- * @deprecated Consider using `shouldDisableTime`.
443
- */
444
- shouldDisableClock: PropTypes.func,
445
433
  /**
446
434
  * Disable specific time.
447
435
  * @template TDate
@@ -483,7 +471,7 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
483
471
  * Choose which timezone to use for the value.
484
472
  * Example: "default", "system", "UTC", "America/New_York".
485
473
  * If you pass values from other timezones to some props, they will be converted to this timezone before being used.
486
- * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
474
+ * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
487
475
  * @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
488
476
  */
489
477
  timezone: PropTypes.string,
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
3
+ const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone", "format"],
4
4
  _excluded2 = ["ownerState"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
@@ -127,7 +127,8 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
127
127
  views,
128
128
  labelId,
129
129
  className,
130
- timezone
130
+ timezone,
131
+ format = `${utils.formats.month} ${utils.formats.year}`
131
132
  } = props,
132
133
  other = _objectWithoutPropertiesLoose(props, _excluded);
133
134
  const ownerState = props;
@@ -181,6 +182,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
181
182
  if (views.length === 1 && views[0] === 'year') {
182
183
  return null;
183
184
  }
185
+ const label = utils.formatByString(month, format);
184
186
  return /*#__PURE__*/_jsxs(PickersCalendarHeaderRoot, _extends({}, other, {
185
187
  ownerState: ownerState,
186
188
  className: clsx(className, classes.root),
@@ -195,12 +197,12 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
195
197
  className: classes.labelContainer,
196
198
  children: [/*#__PURE__*/_jsx(PickersFadeTransitionGroup, {
197
199
  reduceAnimations: reduceAnimations,
198
- transKey: utils.format(month, 'monthAndYear'),
200
+ transKey: label,
199
201
  children: /*#__PURE__*/_jsx(PickersCalendarHeaderLabel, {
200
202
  id: labelId,
201
203
  ownerState: ownerState,
202
204
  className: classes.label,
203
- children: utils.format(month, 'monthAndYear')
205
+ children: label
204
206
  })
205
207
  }), views.length > 1 && !disabled && /*#__PURE__*/_jsx(SwitchViewButton, _extends({}, switchViewButtonProps, {
206
208
  children: /*#__PURE__*/_jsx(SwitchViewIcon, _extends({}, switchViewIconProps))
@@ -237,6 +239,11 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
237
239
  disabled: PropTypes.bool,
238
240
  disableFuture: PropTypes.bool,
239
241
  disablePast: PropTypes.bool,
242
+ /**
243
+ * Format used to display the date.
244
+ * @default `${adapter.formats.month} ${adapter.formats.year}`
245
+ */
246
+ format: PropTypes.string,
240
247
  labelId: PropTypes.string,
241
248
  maxDate: PropTypes.any.isRequired,
242
249
  minDate: PropTypes.any.isRequired,
@@ -156,7 +156,7 @@ const PickersDayRaw = /*#__PURE__*/React.forwardRef(function PickersDay(inProps,
156
156
  }
157
157
  }, [autoFocus, disabled, isAnimating, outsideCurrentMonth]);
158
158
 
159
- // For day outside of current month, move focus from mouseDown to mouseUp
159
+ // For a day outside the current month, move the focus from mouseDown to mouseUp
160
160
  // Goal: have the onClick ends before sliding to the new month
161
161
  const handleMouseDown = event => {
162
162
  onMouseDown(event);
@@ -66,16 +66,11 @@ StaticDatePicker.propTypes = {
66
66
  className: PropTypes.string,
67
67
  /**
68
68
  * Formats the day of week displayed in the calendar header.
69
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
70
69
  * @param {TDate} date The date of the day of week provided by the adapter.
71
70
  * @returns {string} The name to display.
72
71
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
73
72
  */
74
73
  dayOfWeekFormatter: PropTypes.func,
75
- /**
76
- * Default calendar month displayed when `value` and `defaultValue` are empty.
77
- */
78
- defaultCalendarMonth: PropTypes.any,
79
74
  /**
80
75
  * The default value.
81
76
  * Used when the component is not controlled.
@@ -268,7 +263,7 @@ StaticDatePicker.propTypes = {
268
263
  * Choose which timezone to use for the value.
269
264
  * Example: "default", "system", "UTC", "America/New_York".
270
265
  * If you pass values from other timezones to some props, they will be converted to this timezone before being used.
271
- * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
266
+ * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
272
267
  * @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
273
268
  */
274
269
  timezone: PropTypes.string,
@@ -86,16 +86,11 @@ StaticDateTimePicker.propTypes = {
86
86
  className: PropTypes.string,
87
87
  /**
88
88
  * Formats the day of week displayed in the calendar header.
89
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
90
89
  * @param {TDate} date The date of the day of week provided by the adapter.
91
90
  * @returns {string} The name to display.
92
91
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
93
92
  */
94
93
  dayOfWeekFormatter: PropTypes.func,
95
- /**
96
- * Default calendar month displayed when `value` and `defaultValue` are empty.
97
- */
98
- defaultCalendarMonth: PropTypes.any,
99
94
  /**
100
95
  * The default value.
101
96
  * Used when the component is not controlled.
@@ -263,14 +258,6 @@ StaticDateTimePicker.propTypes = {
263
258
  * @default () => <span data-mui-test="loading-progress">...</span>
264
259
  */
265
260
  renderLoading: PropTypes.func,
266
- /**
267
- * Disable specific clock time.
268
- * @param {number} clockValue The value to check.
269
- * @param {TimeView} view The clock type of the timeValue.
270
- * @returns {boolean} If `true` the time will be disabled.
271
- * @deprecated Consider using `shouldDisableTime`.
272
- */
273
- shouldDisableClock: PropTypes.func,
274
261
  /**
275
262
  * Disable specific date.
276
263
  *
@@ -332,7 +319,7 @@ StaticDateTimePicker.propTypes = {
332
319
  * Choose which timezone to use for the value.
333
320
  * Example: "default", "system", "UTC", "America/New_York".
334
321
  * If you pass values from other timezones to some props, they will be converted to this timezone before being used.
335
- * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
322
+ * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
336
323
  * @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
337
324
  */
338
325
  timezone: PropTypes.string,
@@ -183,14 +183,6 @@ StaticTimePicker.propTypes = {
183
183
  * @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
184
184
  */
185
185
  referenceDate: PropTypes.any,
186
- /**
187
- * Disable specific clock time.
188
- * @param {number} clockValue The value to check.
189
- * @param {TimeView} view The clock type of the timeValue.
190
- * @returns {boolean} If `true` the time will be disabled.
191
- * @deprecated Consider using `shouldDisableTime`.
192
- */
193
- shouldDisableClock: PropTypes.func,
194
186
  /**
195
187
  * Disable specific time.
196
188
  * @template TDate
@@ -217,7 +209,7 @@ StaticTimePicker.propTypes = {
217
209
  * Choose which timezone to use for the value.
218
210
  * Example: "default", "system", "UTC", "America/New_York".
219
211
  * If you pass values from other timezones to some props, they will be converted to this timezone before being used.
220
- * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
212
+ * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
221
213
  * @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
222
214
  */
223
215
  timezone: PropTypes.string,
@@ -256,7 +256,7 @@ export function Clock(inProps) {
256
256
  }
257
257
  switch (event.key) {
258
258
  case 'Home':
259
- // annulate both hours and minutes
259
+ // reset both hours and minutes
260
260
  handleValueChange(0, 'partial');
261
261
  event.preventDefault();
262
262
  break;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["ampm", "ampmInClock", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "showViewSwitcher", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "timezone"];
3
+ const _excluded = ["ampm", "ampmInClock", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableTime", "showViewSwitcher", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "timezone"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import PropTypes from 'prop-types';
@@ -81,7 +81,6 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
81
81
  disableFuture,
82
82
  disablePast,
83
83
  minutesStep = 1,
84
- shouldDisableClock,
85
84
  shouldDisableTime,
86
85
  showViewSwitcher,
87
86
  onChange,
@@ -162,9 +161,6 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
162
161
  if (timeValue % step !== 0) {
163
162
  return false;
164
163
  }
165
- if (shouldDisableClock != null && shouldDisableClock(timeValue, viewType)) {
166
- return false;
167
- }
168
164
  if (shouldDisableTime) {
169
165
  switch (viewType) {
170
166
  case 'hours':
@@ -214,7 +210,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
214
210
  default:
215
211
  throw new Error('not supported');
216
212
  }
217
- }, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableClock, shouldDisableTime, utils, disableFuture, disablePast, now, views]);
213
+ }, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableTime, utils, disableFuture, disablePast, now, views]);
218
214
  const selectedId = useId();
219
215
  const viewProps = React.useMemo(() => {
220
216
  switch (view) {
@@ -422,14 +418,6 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
422
418
  * @default The closest valid time using the validation props, except callbacks such as `shouldDisableTime`.
423
419
  */
424
420
  referenceDate: PropTypes.any,
425
- /**
426
- * Disable specific clock time.
427
- * @param {number} clockValue The value to check.
428
- * @param {TimeView} view The clock type of the timeValue.
429
- * @returns {boolean} If `true` the time will be disabled.
430
- * @deprecated Consider using `shouldDisableTime`.
431
- */
432
- shouldDisableClock: PropTypes.func,
433
421
  /**
434
422
  * Disable specific time.
435
423
  * @template TDate
@@ -457,7 +445,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
457
445
  * Choose which timezone to use for the value.
458
446
  * Example: "default", "system", "UTC", "America/New_York".
459
447
  * If you pass values from other timezones to some props, they will be converted to this timezone before being used.
460
- * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
448
+ * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
461
449
  * @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
462
450
  */
463
451
  timezone: PropTypes.string,
@@ -287,14 +287,6 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
287
287
  endIndex: PropTypes.number.isRequired,
288
288
  startIndex: PropTypes.number.isRequired
289
289
  })]),
290
- /**
291
- * Disable specific clock time.
292
- * @param {number} clockValue The value to check.
293
- * @param {TimeView} view The clock type of the timeValue.
294
- * @returns {boolean} If `true` the time will be disabled.
295
- * @deprecated Consider using `shouldDisableTime`.
296
- */
297
- shouldDisableClock: PropTypes.func,
298
290
  /**
299
291
  * Disable specific time.
300
292
  * @template TDate
@@ -341,7 +333,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
341
333
  * Choose which timezone to use for the value.
342
334
  * Example: "default", "system", "UTC", "America/New_York".
343
335
  * If you pass values from other timezones to some props, they will be converted to this timezone before being used.
344
- * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
336
+ * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
345
337
  * @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
346
338
  */
347
339
  timezone: PropTypes.string,
@@ -233,14 +233,6 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
233
233
  endIndex: PropTypes.number.isRequired,
234
234
  startIndex: PropTypes.number.isRequired
235
235
  })]),
236
- /**
237
- * Disable specific clock time.
238
- * @param {number} clockValue The value to check.
239
- * @param {TimeView} view The clock type of the timeValue.
240
- * @returns {boolean} If `true` the time will be disabled.
241
- * @deprecated Consider using `shouldDisableTime`.
242
- */
243
- shouldDisableClock: PropTypes.func,
244
236
  /**
245
237
  * Disable specific time.
246
238
  * @template TDate
@@ -288,7 +280,7 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
288
280
  * Choose which timezone to use for the value.
289
281
  * Example: "default", "system", "UTC", "America/New_York".
290
282
  * If you pass values from other timezones to some props, they will be converted to this timezone before being used.
291
- * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
283
+ * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
292
284
  * @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
293
285
  */
294
286
  timezone: PropTypes.string,
@@ -43,6 +43,6 @@ export interface BaseTimePickerProps<TDate, TView extends TimeViewWithMeridiem>
43
43
  */
44
44
  viewRenderers?: Partial<PickerViewRendererLookup<TDate | null, TView, TimeViewRendererProps<TView, BaseClockProps<TDate, TView>>, {}>>;
45
45
  }
46
- type UseTimePickerDefaultizedProps<TDate, TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TDate, TView>> = LocalizedComponent<TDate, Omit<DefaultizedProps<Props, 'views' | 'openTo' | 'ampm' | keyof BaseTimeValidationProps>, 'components' | 'componentsProps'>>;
46
+ type UseTimePickerDefaultizedProps<TDate, TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TDate, TView>> = LocalizedComponent<TDate, DefaultizedProps<Props, 'views' | 'openTo' | 'ampm' | keyof BaseTimeValidationProps>>;
47
47
  export declare function useTimePickerDefaultizedProps<TDate, TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TDate, TView>>(props: Props, name: string): UseTimePickerDefaultizedProps<TDate, TView, Props>;
48
48
  export {};
@@ -235,7 +235,7 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
235
235
  role: "radiogroup",
236
236
  "aria-labelledby": gridLabelId
237
237
  }, other, {
238
- children: utils.getYearRange(minDate, maxDate).map(year => {
238
+ children: utils.getYearRange([minDate, maxDate]).map(year => {
239
239
  const yearNumber = utils.getYear(year);
240
240
  const isSelected = yearNumber === selectedYear;
241
241
  const isDisabled = disabled || isYearDisabled(year);
@@ -336,7 +336,7 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
336
336
  * Choose which timezone to use for the value.
337
337
  * Example: "default", "system", "UTC", "America/New_York".
338
338
  * If you pass values from other timezones to some props, they will be converted to this timezone before being used.
339
- * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
339
+ * @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
340
340
  * @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
341
341
  */
342
342
  timezone: PropTypes.string,
@@ -3,7 +3,7 @@ import { DateCalendarProps } from '../DateCalendar';
3
3
  import { DateOrTimeViewWithMeridiem } from '../internals/models';
4
4
  import { MultiSectionDigitalClockProps } from '../MultiSectionDigitalClock';
5
5
  import type { DateTimePickerProps } from '../DateTimePicker/DateTimePicker.types';
6
- export interface DateTimeViewRendererProps<TDate> extends Omit<DateCalendarProps<TDate> & MultiSectionDigitalClockProps<TDate>, 'views' | 'openTo' | 'view' | 'onViewChange' | 'focusedView' | 'components' | 'componentsProps' | 'slots' | 'slotProps'>, Pick<DateTimePickerProps<TDate>, 'slots' | 'slotProps'> {
6
+ export interface DateTimeViewRendererProps<TDate> extends Omit<DateCalendarProps<TDate> & MultiSectionDigitalClockProps<TDate>, 'views' | 'openTo' | 'view' | 'onViewChange' | 'focusedView' | 'slots' | 'slotProps'>, Pick<DateTimePickerProps<TDate>, 'slots' | 'slotProps'> {
7
7
  view: DateOrTimeViewWithMeridiem;
8
8
  onViewChange?: (view: DateOrTimeViewWithMeridiem) => void;
9
9
  views: readonly DateOrTimeViewWithMeridiem[];
@@ -11,4 +11,4 @@ export interface DateTimeViewRendererProps<TDate> extends Omit<DateCalendarProps
11
11
  timeViewsCount: number;
12
12
  shouldRenderTimeInASingleColumn: boolean;
13
13
  }
14
- export declare const renderDesktopDateTimeView: <TDate extends unknown>({ view, onViewChange, views, focusedView, onFocusedViewChange, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minDate, minTime, maxDate, maxTime, shouldDisableDate, shouldDisableMonth, shouldDisableYear, shouldDisableTime, shouldDisableClock, reduceAnimations, minutesStep, ampm, onMonthChange, monthsPerRow, onYearChange, yearsPerRow, defaultCalendarMonth, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, sx, autoFocus, fixedWeekNumber, displayWeekNumber, timezone, disableIgnoringDatePartForTimeValidation, timeSteps, skipDisabled, timeViewsCount, shouldRenderTimeInASingleColumn, }: DateTimeViewRendererProps<TDate>) => React.JSX.Element;
14
+ export declare const renderDesktopDateTimeView: <TDate extends unknown>({ view, onViewChange, views, focusedView, onFocusedViewChange, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minDate, minTime, maxDate, maxTime, shouldDisableDate, shouldDisableMonth, shouldDisableYear, shouldDisableTime, reduceAnimations, minutesStep, ampm, onMonthChange, monthsPerRow, onYearChange, yearsPerRow, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, sx, autoFocus, fixedWeekNumber, displayWeekNumber, timezone, disableIgnoringDatePartForTimeValidation, timeSteps, skipDisabled, timeViewsCount, shouldRenderTimeInASingleColumn, }: DateTimeViewRendererProps<TDate>) => React.JSX.Element;
@@ -34,7 +34,6 @@ export const renderDesktopDateTimeView = ({
34
34
  shouldDisableMonth,
35
35
  shouldDisableYear,
36
36
  shouldDisableTime,
37
- shouldDisableClock,
38
37
  reduceAnimations,
39
38
  minutesStep,
40
39
  ampm,
@@ -42,7 +41,6 @@ export const renderDesktopDateTimeView = ({
42
41
  monthsPerRow,
43
42
  onYearChange,
44
43
  yearsPerRow,
45
- defaultCalendarMonth,
46
44
  slots,
47
45
  slotProps,
48
46
  loading,
@@ -82,7 +80,6 @@ export const renderDesktopDateTimeView = ({
82
80
  minTime,
83
81
  maxTime,
84
82
  shouldDisableTime,
85
- shouldDisableClock,
86
83
  minutesStep,
87
84
  ampm,
88
85
  slots,
@@ -121,7 +118,6 @@ export const renderDesktopDateTimeView = ({
121
118
  monthsPerRow: monthsPerRow,
122
119
  onYearChange: onYearChange,
123
120
  yearsPerRow: yearsPerRow,
124
- defaultCalendarMonth: defaultCalendarMonth,
125
121
  slots: slots,
126
122
  slotProps: slotProps,
127
123
  loading: loading,
@@ -8,4 +8,4 @@ export interface DateViewRendererProps<TDate, TView extends DateOrTimeViewWithMe
8
8
  views: readonly TView[];
9
9
  focusedView: TView | null;
10
10
  }
11
- export declare const renderDateViewCalendar: <TDate extends unknown>({ view, onViewChange, views, focusedView, onFocusedViewChange, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minDate, maxDate, shouldDisableDate, shouldDisableMonth, shouldDisableYear, reduceAnimations, onMonthChange, monthsPerRow, onYearChange, yearsPerRow, defaultCalendarMonth, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, sx, autoFocus, fixedWeekNumber, displayWeekNumber, timezone, }: DateViewRendererProps<TDate, DateView>) => React.JSX.Element;
11
+ export declare const renderDateViewCalendar: <TDate extends unknown>({ view, onViewChange, views, focusedView, onFocusedViewChange, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minDate, maxDate, shouldDisableDate, shouldDisableMonth, shouldDisableYear, reduceAnimations, onMonthChange, monthsPerRow, onYearChange, yearsPerRow, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, sx, autoFocus, fixedWeekNumber, displayWeekNumber, timezone, }: DateViewRendererProps<TDate, DateView>) => React.JSX.Element;
@@ -26,7 +26,6 @@ export const renderDateViewCalendar = ({
26
26
  monthsPerRow,
27
27
  onYearChange,
28
28
  yearsPerRow,
29
- defaultCalendarMonth,
30
29
  slots,
31
30
  slotProps,
32
31
  loading,
@@ -65,7 +64,6 @@ export const renderDateViewCalendar = ({
65
64
  monthsPerRow: monthsPerRow,
66
65
  onYearChange: onYearChange,
67
66
  yearsPerRow: yearsPerRow,
68
- defaultCalendarMonth: defaultCalendarMonth,
69
67
  slots: slots,
70
68
  slotProps: slotProps,
71
69
  loading: loading,
package/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export * from './timeViewRenderers';
28
28
  export * from './PickersLayout';
29
29
  export * from './PickersActionBar';
30
30
  export * from './PickersShortcuts';
31
+ export * from './PickersCalendarHeader';
31
32
  export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
32
33
  export * from './models';
33
34
  export * from './icons';
package/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.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -46,6 +46,9 @@ export * from './timeViewRenderers';
46
46
  export * from './PickersLayout';
47
47
  export * from './PickersActionBar';
48
48
  export * from './PickersShortcuts';
49
+
50
+ // Other slots
51
+ export * from './PickersCalendarHeader';
49
52
  export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
50
53
  export * from './models';
51
54
  export * from './icons';
@@ -15,6 +15,11 @@ export interface ExportedPickersArrowSwitcherProps {
15
15
  */
16
16
  slotProps?: PickersArrowSwitcherSlotsComponentsProps;
17
17
  classes?: Partial<PickersArrowSwitcherClasses>;
18
+ /**
19
+ * Format used to display the date.
20
+ * @default `${adapter.formats.month} ${adapter.formats.year}`
21
+ */
22
+ format?: string;
18
23
  }
19
24
  export interface PickersArrowSwitcherProps extends ExportedPickersArrowSwitcherProps, Omit<React.HTMLProps<HTMLDivElement>, 'ref' | 'as'> {
20
25
  children?: React.ReactNode;
@@ -8,7 +8,7 @@ export function useNextMonthDisabled(month, {
8
8
  }) {
9
9
  const utils = useUtils();
10
10
  return React.useMemo(() => {
11
- const now = utils.dateWithTimezone(undefined, timezone);
11
+ const now = utils.date(undefined, timezone);
12
12
  const lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now, maxDate) ? now : maxDate);
13
13
  return !utils.isAfter(lastEnabledMonth, month);
14
14
  }, [disableFuture, maxDate, month, utils, timezone]);
@@ -20,7 +20,7 @@ export function usePreviousMonthDisabled(month, {
20
20
  }) {
21
21
  const utils = useUtils();
22
22
  return React.useMemo(() => {
23
- const now = utils.dateWithTimezone(undefined, timezone);
23
+ const now = utils.date(undefined, timezone);
24
24
  const firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now, minDate) ? now : minDate);
25
25
  return !utils.isBefore(firstEnabledMonth, month);
26
26
  }, [disablePast, minDate, month, utils, timezone]);
@@ -34,7 +34,7 @@ const getDeltaFromKeyCode = keyCode => {
34
34
  };
35
35
  export const getDaysInWeekStr = (utils, timezone, format) => {
36
36
  const elements = [];
37
- const now = utils.dateWithTimezone(undefined, timezone);
37
+ const now = utils.date(undefined, timezone);
38
38
  const startDate = utils.startOfWeek(now);
39
39
  const endDate = utils.endOfWeek(now);
40
40
  let current = startDate;
@@ -48,7 +48,7 @@ export const getLetterEditingOptions = (utils, timezone, sectionType, format) =>
48
48
  switch (sectionType) {
49
49
  case 'month':
50
50
  {
51
- return getMonthsInYear(utils, utils.dateWithTimezone(undefined, timezone)).map(month => utils.formatByString(month, format));
51
+ return getMonthsInYear(utils, utils.date(undefined, timezone)).map(month => utils.formatByString(month, format));
52
52
  }
53
53
  case 'weekDay':
54
54
  {
@@ -56,7 +56,7 @@ export const getLetterEditingOptions = (utils, timezone, sectionType, format) =>
56
56
  }
57
57
  case 'meridiem':
58
58
  {
59
- const now = utils.dateWithTimezone(undefined, timezone);
59
+ const now = utils.date(undefined, timezone);
60
60
  return [utils.startOfDay(now), utils.endOfDay(now)].map(date => utils.formatByString(date, format));
61
61
  }
62
62
  default:
@@ -113,7 +113,7 @@ export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsVa
113
113
  let newSectionValueNumber = currentSectionValue + delta * step;
114
114
  if (shouldSetAbsolute) {
115
115
  if (section.type === 'year' && !isEnd && !isStart) {
116
- return utils.formatByString(utils.dateWithTimezone(undefined, timezone), section.format);
116
+ return utils.formatByString(utils.date(undefined, timezone), section.format);
117
117
  }
118
118
  if (delta > 0 || isStart) {
119
119
  newSectionValueNumber = sectionBoundaries.minimum;
@@ -212,7 +212,7 @@ const getSectionPlaceholder = (utils, timezone, localeText, sectionConfig, curre
212
212
  case 'year':
213
213
  {
214
214
  return localeText.fieldYearPlaceholder({
215
- digitAmount: utils.formatByString(utils.dateWithTimezone(undefined, timezone), currentTokenValue).length
215
+ digitAmount: utils.formatByString(utils.date(undefined, timezone), currentTokenValue).length
216
216
  });
217
217
  }
218
218
  case 'month':
@@ -261,12 +261,12 @@ export const changeSectionValueFormat = (utils, valueStr, currentFormat, newForm
261
261
  }
262
262
  return utils.formatByString(utils.parse(valueStr, currentFormat), newFormat);
263
263
  };
264
- const isFourDigitYearFormat = (utils, timezone, format) => utils.formatByString(utils.dateWithTimezone(undefined, timezone), format).length === 4;
264
+ const isFourDigitYearFormat = (utils, timezone, format) => utils.formatByString(utils.date(undefined, timezone), format).length === 4;
265
265
  export const doesSectionFormatHaveLeadingZeros = (utils, timezone, contentType, sectionType, format) => {
266
266
  if (contentType !== 'digit') {
267
267
  return false;
268
268
  }
269
- const now = utils.dateWithTimezone(undefined, timezone);
269
+ const now = utils.date(undefined, timezone);
270
270
  switch (sectionType) {
271
271
  // We can't use `changeSectionValueFormat`, because `utils.parse('1', 'YYYY')` returns `1971` instead of `1`.
272
272
  case 'year':
@@ -357,7 +357,6 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
357
357
  maxLength,
358
358
  value: sectionValue,
359
359
  placeholder: getSectionPlaceholder(utils, timezone, localeText, sectionConfig, token),
360
- hasLeadingZeros: hasLeadingZerosInFormat,
361
360
  hasLeadingZerosInFormat,
362
361
  hasLeadingZerosInInput,
363
362
  startSeparator: sections.length === 0 ? startSeparator : '',
@@ -473,7 +472,7 @@ export const createDateStrForInputFromSections = (sections, isRTL) => {
473
472
  return `\u2066${dateStr}\u2069`;
474
473
  };
475
474
  export const getSectionsBoundaries = (utils, timezone) => {
476
- const today = utils.dateWithTimezone(undefined, timezone);
475
+ const today = utils.date(undefined, timezone);
477
476
  const endOfYear = utils.endOfYear(today);
478
477
  const endOfDay = utils.endOfDay(today);
479
478
  const {
@@ -156,7 +156,7 @@ export const useFieldState = params => {
156
156
  const nonEmptySectionCountBefore = activeDateManager.getSections(state.sections).filter(section => section.value !== '').length;
157
157
  const hasNoOtherNonEmptySections = nonEmptySectionCountBefore === (activeSection.value === '' ? 0 : 1);
158
158
  const newSections = setSectionValue(selectedSectionIndexes.startIndex, '');
159
- const newActiveDate = hasNoOtherNonEmptySections ? null : utils.date(new Date(''));
159
+ const newActiveDate = hasNoOtherNonEmptySections ? null : utils.getInvalidDate();
160
160
  const newValues = activeDateManager.getNewValuesFromNewActiveDate(newActiveDate);
161
161
  if ((newActiveDate != null && !utils.isValid(newActiveDate)) !== (activeDateManager.date != null && !utils.isValid(activeDateManager.date))) {
162
162
  publishValue(_extends({}, newValues, {
@@ -249,7 +249,7 @@ export const useFieldState = params => {
249
249
  }, [format, utils.locale]); // eslint-disable-line react-hooks/exhaustive-deps
250
250
 
251
251
  React.useEffect(() => {
252
- let shouldUpdate = false;
252
+ let shouldUpdate;
253
253
  if (!valueManager.areValuesEqual(utils, state.value, valueFromTheOutside)) {
254
254
  shouldUpdate = true;
255
255
  } else {
@@ -132,7 +132,7 @@ export interface UsePickerValueState<TValue> {
132
132
  * Then we might want to apply some custom logic.
133
133
  *
134
134
  * For example, when the component is not controlled and `defaultValue` is defined.
135
- * Then clicking on "Accept", "Today" or "Clear" should fire `onAccept` with `defaultValue`, but clicking on "Cancel" or dimissing the picker should not.
135
+ * Then clicking on "Accept", "Today" or "Clear" should fire `onAccept` with `defaultValue`, but clicking on "Cancel" or dismissing the picker should not.
136
136
  */
137
137
  hasBeenModifiedSinceMount: boolean;
138
138
  }
@@ -22,7 +22,7 @@ export const useNow = timezone => {
22
22
  const utils = useUtils();
23
23
  const now = React.useRef();
24
24
  if (now.current === undefined) {
25
- now.current = utils.dateWithTimezone(undefined, timezone);
25
+ now.current = utils.date(undefined, timezone);
26
26
  }
27
27
  return now.current;
28
28
  };
@@ -84,7 +84,7 @@ export function useViews({
84
84
  const isSelectionFinishedOnCurrentView = currentViewSelectionState === 'finish';
85
85
  const hasMoreViews = selectedView ?
86
86
  // handles case like `DateTimePicker`, where a view might return a `finish` selection state
87
- // but we it's not the final view given all `views` -> overall selection state should be `partial`.
87
+ // but when it's not the final view given all `views` -> overall selection state should be `partial`.
88
88
  views.indexOf(selectedView) < views.length - 1 : Boolean(nextView);
89
89
  const globalSelectionState = isSelectionFinishedOnCurrentView && hasMoreViews ? 'partial' : currentViewSelectionState;
90
90
  onChange(value, globalSelectionState);
@@ -106,7 +106,7 @@ export function useViews({
106
106
  setFocusedView: handleFocusedViewChange,
107
107
  nextView,
108
108
  previousView,
109
- // Always return up to date default view instead of the initial one (i.e. defaultView.current)
109
+ // Always return up-to-date default view instead of the initial one (i.e. defaultView.current)
110
110
  defaultView: views.includes(openTo) ? openTo : views[0],
111
111
  goToNextView,
112
112
  setValueAndGoToNextView,