@mui/x-date-pickers 5.0.2 → 6.0.0-alpha.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 (252) hide show
  1. package/CHANGELOG.md +212 -3
  2. package/CalendarPicker/CalendarPicker.d.ts +8 -2
  3. package/CalendarPicker/CalendarPicker.js +54 -71
  4. package/CalendarPicker/DayPicker.d.ts +2 -2
  5. package/CalendarPicker/DayPicker.js +6 -2
  6. package/CalendarPicker/PickersCalendarHeader.d.ts +3 -10
  7. package/CalendarPicker/PickersCalendarHeader.js +7 -20
  8. package/CalendarPicker/useCalendarState.d.ts +2 -2
  9. package/CalendarPicker/useCalendarState.js +7 -7
  10. package/ClockPicker/Clock.d.ts +9 -4
  11. package/ClockPicker/Clock.js +13 -13
  12. package/ClockPicker/ClockNumbers.d.ts +3 -3
  13. package/ClockPicker/ClockNumbers.js +2 -2
  14. package/ClockPicker/ClockPicker.d.ts +8 -58
  15. package/ClockPicker/ClockPicker.js +52 -128
  16. package/ClockPicker/ClockPointer.d.ts +1 -1
  17. package/ClockPicker/ClockPointer.js +4 -4
  18. package/DateField/useDateField.d.ts +1 -1
  19. package/DateField/useDateField.js +5 -1
  20. package/DatePicker/DatePicker.js +10 -20
  21. package/DateTimePicker/DateTimePicker.js +10 -39
  22. package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -1
  23. package/DesktopDatePicker/DesktopDatePicker.js +14 -22
  24. package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -1
  25. package/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
  26. package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -1
  27. package/DesktopTimePicker/DesktopTimePicker.js +9 -21
  28. package/LocalizationProvider/LocalizationProvider.d.ts +10 -11
  29. package/LocalizationProvider/LocalizationProvider.js +31 -24
  30. package/MobileDatePicker/MobileDatePicker.d.ts +1 -1
  31. package/MobileDatePicker/MobileDatePicker.js +14 -22
  32. package/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -1
  33. package/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
  34. package/MobileTimePicker/MobileTimePicker.d.ts +1 -1
  35. package/MobileTimePicker/MobileTimePicker.js +9 -21
  36. package/MonthPicker/MonthPicker.d.ts +12 -9
  37. package/MonthPicker/MonthPicker.js +60 -57
  38. package/MonthPicker/PickersMonth.d.ts +10 -7
  39. package/MonthPicker/PickersMonth.js +76 -44
  40. package/MonthPicker/pickersMonthClasses.d.ts +9 -1
  41. package/MonthPicker/pickersMonthClasses.js +1 -1
  42. package/PickersDay/PickersDay.d.ts +0 -6
  43. package/PickersDay/PickersDay.js +0 -5
  44. package/StaticDatePicker/StaticDatePicker.d.ts +1 -1
  45. package/StaticDatePicker/StaticDatePicker.js +17 -23
  46. package/StaticDateTimePicker/StaticDateTimePicker.d.ts +1 -1
  47. package/StaticDateTimePicker/StaticDateTimePicker.js +17 -42
  48. package/StaticTimePicker/StaticTimePicker.d.ts +1 -1
  49. package/StaticTimePicker/StaticTimePicker.js +17 -22
  50. package/TimePicker/TimePicker.js +5 -19
  51. package/YearPicker/PickersYear.d.ts +7 -6
  52. package/YearPicker/PickersYear.js +34 -23
  53. package/YearPicker/YearPicker.d.ts +21 -4
  54. package/YearPicker/YearPicker.js +109 -49
  55. package/YearPicker/pickersYearClasses.d.ts +1 -1
  56. package/index.js +1 -1
  57. package/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
  58. package/internals/components/PickerStaticWrapper/PickerStaticWrapper.d.ts +20 -6
  59. package/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +38 -22
  60. package/internals/components/PickerStaticWrapper/index.d.ts +1 -1
  61. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.d.ts +3 -0
  62. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +166 -0
  63. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +63 -0
  64. package/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
  65. package/internals/components/PickersArrowSwitcher/index.d.ts +2 -0
  66. package/internals/components/PickersArrowSwitcher/index.js +1 -0
  67. package/internals/components/{pickersArrowSwitcherClasses.d.ts → PickersArrowSwitcher/pickersArrowSwitcherClasses.d.ts} +0 -0
  68. package/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
  69. package/internals/components/PickersPopper.d.ts +2 -6
  70. package/internals/components/PickersPopper.js +5 -5
  71. package/internals/components/PickersToolbar.d.ts +1 -1
  72. package/internals/components/PickersToolbar.js +1 -2
  73. package/internals/components/PickersToolbarText.d.ts +1 -1
  74. package/internals/components/wrappers/DesktopTooltipWrapper.d.ts +1 -1
  75. package/internals/components/wrappers/DesktopTooltipWrapper.js +29 -24
  76. package/internals/components/wrappers/DesktopWrapper.d.ts +8 -3
  77. package/internals/components/wrappers/DesktopWrapper.js +26 -21
  78. package/internals/components/wrappers/MobileWrapper.d.ts +8 -3
  79. package/internals/components/wrappers/MobileWrapper.js +23 -18
  80. package/internals/hooks/useField/useField.interfaces.d.ts +0 -1
  81. package/internals/hooks/useField/useField.js +19 -23
  82. package/internals/hooks/useField/useField.utils.js +10 -2
  83. package/internals/hooks/useUtils.d.ts +5 -2
  84. package/internals/hooks/useUtils.js +11 -2
  85. package/internals/hooks/validation/useDateValidation.d.ts +4 -4
  86. package/internals/hooks/validation/useDateValidation.js +12 -2
  87. package/internals/index.d.ts +5 -5
  88. package/internals/index.js +3 -3
  89. package/internals/models/muiPickersAdapter.d.ts +12 -7
  90. package/internals/models/props/baseToolbarProps.d.ts +0 -8
  91. package/internals/models/props/staticPickerProps.d.ts +2 -8
  92. package/legacy/CalendarPicker/CalendarPicker.js +52 -69
  93. package/legacy/CalendarPicker/DayPicker.js +6 -2
  94. package/legacy/CalendarPicker/PickersCalendarHeader.js +7 -20
  95. package/legacy/CalendarPicker/useCalendarState.js +7 -7
  96. package/legacy/ClockPicker/Clock.js +13 -13
  97. package/legacy/ClockPicker/ClockNumbers.js +2 -2
  98. package/legacy/ClockPicker/ClockPicker.js +57 -133
  99. package/legacy/ClockPicker/ClockPointer.js +4 -4
  100. package/legacy/DateField/useDateField.js +5 -1
  101. package/legacy/DatePicker/DatePicker.js +10 -20
  102. package/legacy/DateTimePicker/DateTimePicker.js +10 -39
  103. package/legacy/DesktopDatePicker/DesktopDatePicker.js +13 -21
  104. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
  105. package/legacy/DesktopTimePicker/DesktopTimePicker.js +8 -20
  106. package/legacy/LocalizationProvider/LocalizationProvider.js +28 -23
  107. package/legacy/MobileDatePicker/MobileDatePicker.js +13 -21
  108. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
  109. package/legacy/MobileTimePicker/MobileTimePicker.js +8 -20
  110. package/legacy/MonthPicker/MonthPicker.js +67 -62
  111. package/legacy/MonthPicker/PickersMonth.js +89 -57
  112. package/legacy/MonthPicker/pickersMonthClasses.js +1 -1
  113. package/legacy/PickersDay/PickersDay.js +0 -5
  114. package/legacy/StaticDatePicker/StaticDatePicker.js +17 -24
  115. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +17 -43
  116. package/legacy/StaticTimePicker/StaticTimePicker.js +17 -23
  117. package/legacy/TimePicker/TimePicker.js +5 -19
  118. package/legacy/YearPicker/PickersYear.js +35 -25
  119. package/legacy/YearPicker/YearPicker.js +111 -51
  120. package/legacy/index.js +1 -1
  121. package/legacy/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
  122. package/legacy/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +41 -24
  123. package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +180 -0
  124. package/legacy/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
  125. package/legacy/internals/components/PickersArrowSwitcher/index.js +1 -0
  126. package/legacy/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
  127. package/legacy/internals/components/PickersPopper.js +5 -5
  128. package/legacy/internals/components/PickersToolbar.js +1 -2
  129. package/legacy/internals/components/wrappers/DesktopTooltipWrapper.js +29 -24
  130. package/legacy/internals/components/wrappers/DesktopWrapper.js +26 -21
  131. package/legacy/internals/components/wrappers/MobileWrapper.js +22 -17
  132. package/legacy/internals/hooks/useField/useField.js +21 -23
  133. package/legacy/internals/hooks/useField/useField.utils.js +10 -2
  134. package/legacy/internals/hooks/useUtils.js +13 -2
  135. package/legacy/internals/hooks/validation/useDateValidation.js +12 -2
  136. package/legacy/internals/index.js +3 -3
  137. package/legacy/locales/faIR.js +52 -0
  138. package/legacy/locales/fiFI.js +61 -0
  139. package/legacy/locales/index.js +2 -0
  140. package/legacy/locales/isIS.js +0 -1
  141. package/locales/faIR.d.ts +35 -0
  142. package/locales/faIR.js +36 -0
  143. package/locales/fiFI.d.ts +35 -0
  144. package/locales/fiFI.js +45 -0
  145. package/locales/index.d.ts +2 -0
  146. package/locales/index.js +2 -0
  147. package/locales/isIS.js +0 -1
  148. package/locales/utils/pickersLocaleTextApi.d.ts +1 -0
  149. package/modern/CalendarPicker/CalendarPicker.js +54 -71
  150. package/modern/CalendarPicker/DayPicker.js +6 -2
  151. package/modern/CalendarPicker/PickersCalendarHeader.js +7 -20
  152. package/modern/CalendarPicker/useCalendarState.js +7 -7
  153. package/modern/ClockPicker/Clock.js +13 -13
  154. package/modern/ClockPicker/ClockNumbers.js +2 -2
  155. package/modern/ClockPicker/ClockPicker.js +52 -128
  156. package/modern/ClockPicker/ClockPointer.js +4 -4
  157. package/modern/DateField/useDateField.js +5 -1
  158. package/modern/DatePicker/DatePicker.js +10 -20
  159. package/modern/DateTimePicker/DateTimePicker.js +10 -39
  160. package/modern/DesktopDatePicker/DesktopDatePicker.js +14 -22
  161. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
  162. package/modern/DesktopTimePicker/DesktopTimePicker.js +9 -21
  163. package/modern/LocalizationProvider/LocalizationProvider.js +29 -24
  164. package/modern/MobileDatePicker/MobileDatePicker.js +14 -22
  165. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
  166. package/modern/MobileTimePicker/MobileTimePicker.js +9 -21
  167. package/modern/MonthPicker/MonthPicker.js +60 -57
  168. package/modern/MonthPicker/PickersMonth.js +76 -44
  169. package/modern/MonthPicker/pickersMonthClasses.js +1 -1
  170. package/modern/PickersDay/PickersDay.js +0 -5
  171. package/modern/StaticDatePicker/StaticDatePicker.js +17 -23
  172. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +17 -42
  173. package/modern/StaticTimePicker/StaticTimePicker.js +17 -22
  174. package/modern/TimePicker/TimePicker.js +5 -19
  175. package/modern/YearPicker/PickersYear.js +34 -23
  176. package/modern/YearPicker/YearPicker.js +109 -49
  177. package/modern/index.js +1 -1
  178. package/modern/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
  179. package/modern/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +38 -22
  180. package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +164 -0
  181. package/modern/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
  182. package/modern/internals/components/PickersArrowSwitcher/index.js +1 -0
  183. package/modern/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
  184. package/modern/internals/components/PickersPopper.js +5 -5
  185. package/modern/internals/components/PickersToolbar.js +1 -2
  186. package/modern/internals/components/wrappers/DesktopTooltipWrapper.js +29 -24
  187. package/modern/internals/components/wrappers/DesktopWrapper.js +26 -21
  188. package/modern/internals/components/wrappers/MobileWrapper.js +23 -18
  189. package/modern/internals/hooks/useField/useField.js +19 -21
  190. package/modern/internals/hooks/useField/useField.utils.js +10 -2
  191. package/modern/internals/hooks/useUtils.js +11 -2
  192. package/modern/internals/hooks/validation/useDateValidation.js +12 -2
  193. package/modern/internals/index.js +3 -3
  194. package/modern/locales/faIR.js +36 -0
  195. package/modern/locales/fiFI.js +45 -0
  196. package/modern/locales/index.js +2 -0
  197. package/modern/locales/isIS.js +0 -1
  198. package/node/CalendarPicker/CalendarPicker.js +54 -71
  199. package/node/CalendarPicker/DayPicker.js +5 -1
  200. package/node/CalendarPicker/PickersCalendarHeader.js +7 -21
  201. package/node/CalendarPicker/useCalendarState.js +6 -6
  202. package/node/ClockPicker/Clock.js +12 -12
  203. package/node/ClockPicker/ClockNumbers.js +2 -2
  204. package/node/ClockPicker/ClockPicker.js +52 -129
  205. package/node/ClockPicker/ClockPointer.js +4 -4
  206. package/node/DateField/useDateField.js +5 -1
  207. package/node/DatePicker/DatePicker.js +10 -20
  208. package/node/DateTimePicker/DateTimePicker.js +10 -39
  209. package/node/DesktopDatePicker/DesktopDatePicker.js +14 -22
  210. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
  211. package/node/DesktopTimePicker/DesktopTimePicker.js +9 -21
  212. package/node/LocalizationProvider/LocalizationProvider.js +31 -25
  213. package/node/MobileDatePicker/MobileDatePicker.js +14 -22
  214. package/node/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
  215. package/node/MobileTimePicker/MobileTimePicker.js +9 -21
  216. package/node/MonthPicker/MonthPicker.js +61 -58
  217. package/node/MonthPicker/PickersMonth.js +71 -43
  218. package/node/MonthPicker/pickersMonthClasses.js +1 -1
  219. package/node/PickersDay/PickersDay.js +0 -5
  220. package/node/StaticDatePicker/StaticDatePicker.js +17 -23
  221. package/node/StaticDateTimePicker/StaticDateTimePicker.js +17 -42
  222. package/node/StaticTimePicker/StaticTimePicker.js +17 -22
  223. package/node/TimePicker/TimePicker.js +5 -19
  224. package/node/YearPicker/PickersYear.js +33 -22
  225. package/node/YearPicker/YearPicker.js +111 -49
  226. package/node/index.js +1 -1
  227. package/node/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
  228. package/node/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +39 -22
  229. package/node/internals/components/{PickersArrowSwitcher.js → PickersArrowSwitcher/PickersArrowSwitcher.js} +102 -58
  230. package/node/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
  231. package/node/internals/components/PickersArrowSwitcher/index.js +13 -0
  232. package/node/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
  233. package/node/internals/components/PickersPopper.js +5 -5
  234. package/node/internals/components/PickersToolbar.js +1 -2
  235. package/node/internals/components/wrappers/DesktopTooltipWrapper.js +30 -24
  236. package/node/internals/components/wrappers/DesktopWrapper.js +27 -21
  237. package/node/internals/components/wrappers/MobileWrapper.js +24 -18
  238. package/node/internals/hooks/useField/useField.js +19 -23
  239. package/node/internals/hooks/useField/useField.utils.js +10 -2
  240. package/node/internals/hooks/useUtils.js +15 -2
  241. package/node/internals/hooks/validation/useDateValidation.js +14 -4
  242. package/node/internals/index.js +8 -2
  243. package/node/locales/faIR.js +45 -0
  244. package/node/locales/fiFI.js +54 -0
  245. package/node/locales/index.js +26 -0
  246. package/node/locales/isIS.js +0 -1
  247. package/package.json +4 -4
  248. package/themeAugmentation/props.d.ts +3 -3
  249. package/internals/components/PickersArrowSwitcher.d.ts +0 -62
  250. package/internals/components/PickersArrowSwitcher.js +0 -124
  251. package/legacy/internals/components/PickersArrowSwitcher.js +0 -128
  252. package/modern/internals/components/PickersArrowSwitcher.js +0 -124
@@ -156,12 +156,20 @@ export const adjustInvalidDateSectionValue = (utils, section, keyCode) => {
156
156
 
157
157
  if (shouldSetAbsolute) {
158
158
  if (delta > 0 || isEnd) {
159
- newDate = utils.endOfMonth(today);
160
- } else {
161
159
  newDate = utils.startOfMonth(today);
160
+ } else {
161
+ newDate = utils.endOfMonth(today);
162
162
  }
163
163
  } else {
164
164
  newDate = utils.addDays(utils.parse(section.value, section.formatValue), delta);
165
+
166
+ if (!utils.isSameMonth(newDate, today)) {
167
+ if (delta > 0) {
168
+ newDate = utils.startOfMonth(today);
169
+ } else {
170
+ newDate = utils.endOfMonth(today);
171
+ }
172
+ }
165
173
  }
166
174
 
167
175
  return utils.formatByString(newDate, section.formatValue);
@@ -1,9 +1,12 @@
1
1
  import { MuiPickersAdapterContextValue } from '../../LocalizationProvider/LocalizationProvider';
2
- export declare const useLocalizationContext: <T>() => MuiPickersAdapterContextValue<T>;
2
+ import { PickersLocaleText } from '../../locales/utils/pickersLocaleTextApi';
3
+ export declare const useLocalizationContext: <TDate>() => Omit<MuiPickersAdapterContextValue<TDate>, "localeText"> & {
4
+ localeText: PickersLocaleText<TDate>;
5
+ };
3
6
  export declare const useUtils: <T>() => import("..").MuiPickersAdapter<T>;
4
7
  export declare const useDefaultDates: <T>() => {
5
8
  minDate: T;
6
9
  maxDate: T;
7
10
  };
8
- export declare const useLocaleText: <T>() => import("../..").PickersLocaleText<T>;
11
+ export declare const useLocaleText: <T>() => PickersLocaleText<T>;
9
12
  export declare const useNow: <TDate>() => TDate;
@@ -1,13 +1,22 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import * as React from 'react';
2
3
  import { MuiPickersAdapterContext } from '../../LocalizationProvider/LocalizationProvider';
4
+ import { DEFAULT_LOCALE } from '../../locales/enUS';
3
5
  export const useLocalizationContext = () => {
4
6
  const localization = React.useContext(MuiPickersAdapterContext);
5
7
 
6
8
  if (localization === null) {
7
- throw new Error('MUI: Can not find utils in context. It looks like you forgot to wrap your component in LocalizationProvider, or pass dateAdapter prop directly.');
9
+ throw new Error(['MUI: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
8
10
  }
9
11
 
10
- return localization;
12
+ if (localization.utils === null) {
13
+ throw new Error(['MUI: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
14
+ }
15
+
16
+ const localeText = React.useMemo(() => _extends({}, DEFAULT_LOCALE, localization.localeText), [localization.localeText]);
17
+ return _extends({}, localization, {
18
+ localeText
19
+ });
11
20
  };
12
21
  export const useUtils = () => useLocalizationContext().utils;
13
22
  export const useDefaultDates = () => useLocalizationContext().defaultDates;
@@ -1,11 +1,11 @@
1
1
  import { ValidationProps, Validator } from './useValidation';
2
- import { BaseDateValidationProps, DayValidationProps } from './models';
2
+ import { BaseDateValidationProps, DayValidationProps, MonthValidationProps, YearValidationProps } from './models';
3
3
  export interface ExportedDateValidationProps<TDate> extends DayValidationProps<TDate>, BaseDateValidationProps<TDate> {
4
4
  }
5
- export interface DateValidationProps<TInputDate, TDate> extends ValidationProps<DateValidationError, TInputDate | null>, DayValidationProps<TDate>, Required<BaseDateValidationProps<TDate>> {
5
+ export interface DateValidationProps<TInputDate, TDate> extends ValidationProps<DateValidationError, TInputDate | null>, DayValidationProps<TDate>, MonthValidationProps<TDate>, YearValidationProps<TDate>, Required<BaseDateValidationProps<TDate>> {
6
6
  }
7
- export declare type DateValidationError = 'invalidDate' | 'shouldDisableDate' | 'disableFuture' | 'disablePast' | 'minDate' | 'maxDate' | null;
7
+ export declare type DateValidationError = 'invalidDate' | 'shouldDisableDate' | 'shouldDisableMonth' | 'shouldDisableYear' | 'disableFuture' | 'disablePast' | 'minDate' | 'maxDate' | null;
8
8
  export declare const validateDate: Validator<any, DateValidationProps<any, any>>;
9
- export declare const useIsDayDisabled: <TDate>({ shouldDisableDate, minDate, maxDate, disableFuture, disablePast, }: DayValidationProps<TDate> & Required<BaseDateValidationProps<TDate>>) => (day: TDate | null) => boolean;
9
+ export declare const useIsDateDisabled: <TDate>({ shouldDisableDate, shouldDisableMonth, shouldDisableYear, minDate, maxDate, disableFuture, disablePast, }: Omit<DateValidationProps<any, TDate>, keyof ValidationProps<any, any>>) => (day: TDate | null) => boolean;
10
10
  export declare const isSameDateError: (a: DateValidationError, b: DateValidationError) => boolean;
11
11
  export declare const useDateValidation: <TInputDate, TDate>(props: DateValidationProps<TInputDate, TDate>) => DateValidationError;
@@ -23,6 +23,12 @@ export const validateDate = ({
23
23
  case Boolean(props.shouldDisableDate && props.shouldDisableDate(date)):
24
24
  return 'shouldDisableDate';
25
25
 
26
+ case Boolean(props.shouldDisableMonth && props.shouldDisableMonth(date)):
27
+ return 'shouldDisableMonth';
28
+
29
+ case Boolean(props.shouldDisableYear && props.shouldDisableYear(date)):
30
+ return 'shouldDisableYear';
31
+
26
32
  case Boolean(props.disableFuture && adapter.utils.isAfterDay(date, now)):
27
33
  return 'disableFuture';
28
34
 
@@ -39,8 +45,10 @@ export const validateDate = ({
39
45
  return null;
40
46
  }
41
47
  };
42
- export const useIsDayDisabled = ({
48
+ export const useIsDateDisabled = ({
43
49
  shouldDisableDate,
50
+ shouldDisableMonth,
51
+ shouldDisableYear,
44
52
  minDate,
45
53
  maxDate,
46
54
  disableFuture,
@@ -52,12 +60,14 @@ export const useIsDayDisabled = ({
52
60
  value: day,
53
61
  props: {
54
62
  shouldDisableDate,
63
+ shouldDisableMonth,
64
+ shouldDisableYear,
55
65
  minDate,
56
66
  maxDate,
57
67
  disableFuture,
58
68
  disablePast
59
69
  }
60
- }) !== null, [adapter, shouldDisableDate, minDate, maxDate, disableFuture, disablePast]);
70
+ }) !== null, [adapter, shouldDisableDate, shouldDisableMonth, shouldDisableYear, minDate, maxDate, disableFuture, disablePast]);
61
71
  };
62
72
  export const isSameDateError = (a, b) => a === b;
63
73
  export const useDateValidation = props => useValidation(props, validateDate, isSameDateError);
@@ -6,8 +6,8 @@ export { MobileKeyboardInputView } from './components/CalendarOrClockPicker/Cale
6
6
  export type { CalendarOrClockPickerProps } from './components/CalendarOrClockPicker/CalendarOrClockPicker';
7
7
  export { calendarOrClockPickerClasses } from './components/CalendarOrClockPicker/calendarOrClockPickerClasses';
8
8
  export type { CalendarOrClockPickerClassKey, CalendarOrClockPickerClasses, } from './components/CalendarOrClockPicker/calendarOrClockPickerClasses';
9
- export { PickersArrowSwitcher } from './components/PickersArrowSwitcher';
10
- export type { ExportedArrowSwitcherProps } from './components/PickersArrowSwitcher';
9
+ export { PickersArrowSwitcher } from './components/PickersArrowSwitcher/PickersArrowSwitcher';
10
+ export type { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlotsComponent, PickersArrowSwitcherSlotsComponentsProps, } from './components/PickersArrowSwitcher';
11
11
  export { PickerStaticWrapper } from './components/PickerStaticWrapper/PickerStaticWrapper';
12
12
  export type { PickerStaticWrapperProps } from './components/PickerStaticWrapper/PickerStaticWrapper';
13
13
  export type { PickersStaticWrapperSlotsComponent, PickersStaticWrapperSlotsComponentsProps, } from './components/PickerStaticWrapper/PickerStaticWrapper';
@@ -21,8 +21,8 @@ export type { PickersToolbarButtonClassKey, PickersToolbarButtonClasses, } from
21
21
  export type { PickersToolbarTextProps } from './components/PickersToolbarText';
22
22
  export { pickersToolbarTextClasses } from './components/pickersToolbarTextClasses';
23
23
  export type { PickersToolbarTextClassKey, PickersToolbarTextClasses, } from './components/pickersToolbarTextClasses';
24
- export { pickersArrowSwitcherClasses } from './components/pickersArrowSwitcherClasses';
25
- export type { PickersArrowSwitcherClassKey, PickersArrowSwitcherClasses, } from './components/pickersArrowSwitcherClasses';
24
+ export { pickersArrowSwitcherClasses } from './components/PickersArrowSwitcher/pickersArrowSwitcherClasses';
25
+ export type { PickersArrowSwitcherClassKey, PickersArrowSwitcherClasses, } from './components/PickersArrowSwitcher/pickersArrowSwitcherClasses';
26
26
  export type { PickerPopperProps } from './components/PickersPopper';
27
27
  export { pickersPopperClasses } from './components/pickersPopperClasses';
28
28
  export type { PickersPopperClassKey, PickersPopperClasses, } from './components/pickersPopperClasses';
@@ -38,7 +38,7 @@ export { useMaskedInput } from './hooks/useMaskedInput';
38
38
  export { usePickerState } from './hooks/usePickerState';
39
39
  export type { PickerStateProps, PickerStatePickerProps } from './hooks/usePickerState';
40
40
  export type { PickerStateValueManager, PickerSelectionState } from './hooks/usePickerState';
41
- export { useDefaultDates, useUtils, useLocaleText } from './hooks/useUtils';
41
+ export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText } from './hooks/useUtils';
42
42
  export type { BaseDateValidationProps, DayValidationProps } from './hooks/validation/models';
43
43
  export { useValidation } from './hooks/validation/useValidation';
44
44
  export type { ValidationProps, Validator } from './hooks/validation/useValidation';
@@ -2,13 +2,13 @@ export { DesktopTooltipWrapper } from './components/wrappers/DesktopTooltipWrapp
2
2
  export { MobileWrapper } from './components/wrappers/MobileWrapper';
3
3
  export { MobileKeyboardInputView } from './components/CalendarOrClockPicker/CalendarOrClockPicker';
4
4
  export { calendarOrClockPickerClasses } from './components/CalendarOrClockPicker/calendarOrClockPickerClasses';
5
- export { PickersArrowSwitcher } from './components/PickersArrowSwitcher';
5
+ export { PickersArrowSwitcher } from './components/PickersArrowSwitcher/PickersArrowSwitcher';
6
6
  export { PickerStaticWrapper } from './components/PickerStaticWrapper/PickerStaticWrapper';
7
7
  export { PickersToolbar } from './components/PickersToolbar';
8
8
  export { pickersToolbarClasses } from './components/pickersToolbarClasses';
9
9
  export { pickersToolbarButtonClasses } from './components/pickersToolbarButtonClasses';
10
10
  export { pickersToolbarTextClasses } from './components/pickersToolbarTextClasses';
11
- export { pickersArrowSwitcherClasses } from './components/pickersArrowSwitcherClasses';
11
+ export { pickersArrowSwitcherClasses } from './components/PickersArrowSwitcher/pickersArrowSwitcherClasses';
12
12
  export { pickersPopperClasses } from './components/pickersPopperClasses';
13
13
  export { PickersToolbarButton } from './components/PickersToolbarButton';
14
14
  export { pickerStaticWrapperClasses } from './components/PickerStaticWrapper/pickerStaticWrapperClasses';
@@ -16,7 +16,7 @@ export { WrapperVariantContext } from './components/wrappers/WrapperVariantConte
16
16
  export { DAY_MARGIN } from './constants/dimensions';
17
17
  export { useMaskedInput } from './hooks/useMaskedInput';
18
18
  export { usePickerState } from './hooks/usePickerState';
19
- export { useDefaultDates, useUtils, useLocaleText } from './hooks/useUtils';
19
+ export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText } from './hooks/useUtils';
20
20
  export { useValidation } from './hooks/validation/useValidation';
21
21
  export { validateDate } from './hooks/validation/useDateValidation';
22
22
  export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
@@ -1,10 +1,15 @@
1
1
  import { IUtils } from '@date-io/core/IUtils';
2
- export declare type MuiPickersAdapter<TDate> = IUtils<TDate>;
3
- export declare type MuiDateSectionName = 'day' | 'month' | 'year' | 'hour' | 'minute' | 'second' | 'am-pm';
4
- export declare type MuiFormatTokenMap = {
5
- [formatToken: string]: MuiDateSectionName;
6
- };
2
+
3
+ // TODO: Maybe we should add the same constraint.
4
+ // @ts-expect-error TDate in our codebase does not have the `ExtendableDateType` constraint.
5
+ export type MuiPickersAdapter<TDate> = IUtils<TDate>;
6
+
7
+ export type MuiDateSectionName = 'day' | 'month' | 'year' | 'hour' | 'minute' | 'second' | 'am-pm';
8
+
9
+ export type MuiFormatTokenMap = { [formatToken: string]: MuiDateSectionName };
10
+
7
11
  export interface MuiPickerFieldAdapter<TDate> extends MuiPickersAdapter<TDate> {
8
- formatTokenMap: MuiFormatTokenMap;
9
- expandFormat: (format: string) => string;
12
+ formatTokenMap: MuiFormatTokenMap;
13
+
14
+ expandFormat: (format: string) => string;
10
15
  }
@@ -7,14 +7,6 @@ import { PickerStatePickerProps } from '../../hooks/usePickerState';
7
7
  export interface BaseToolbarProps<TDate, TValue> extends ExportedCalendarPickerProps<TDate>, ExportedClockPickerProps<TDate>, Omit<PickerStatePickerProps<TValue>, 'onDateChange'> {
8
8
  ampmInClock?: boolean;
9
9
  dateRangeIcon?: React.ReactNode;
10
- /**
11
- * Text for aria label of the button switching between input and interactive view.
12
- * @deprecated Use the translation key `inputModeToggleButtonAriaLabel` instead, see https://mui.com/x/react-date-pickers/localization
13
- * @param {boolean} isKeyboardInputOpen Indicates if the interface is the keyboard input.
14
- * @param {'calendar' | 'clock' } viewType Indicates if the interface is about a date or a time.
15
- * @returns {string} The arial label
16
- */
17
- getMobileKeyboardInputViewButtonText?: (isKeyboardInputOpen: boolean, viewType: 'calendar' | 'clock') => string;
18
10
  isLandscape: boolean;
19
11
  onChange: PickerOnChangeFn<TDate>;
20
12
  openView: CalendarOrClockPickerView;
@@ -1,9 +1,3 @@
1
1
  import { BasePickerProps } from './basePickerProps';
2
- import { PickerStaticWrapperProps } from '../../components/PickerStaticWrapper';
3
- export declare type StaticPickerProps<BaseProps extends BasePickerProps<any, any>> = Omit<BaseProps, 'open' | 'onOpen' | 'onClose'> & {
4
- /**
5
- * Force static wrapper inner components to be rendered in mobile or desktop mode.
6
- * @default 'mobile'
7
- */
8
- displayStaticWrapperAs?: PickerStaticWrapperProps['displayStaticWrapperAs'];
9
- };
2
+ import { ExportedPickerStaticWrapperProps } from '../../components/PickerStaticWrapper';
3
+ export declare type StaticPickerProps<TDate, BaseProps extends BasePickerProps<any, any>> = Omit<BaseProps, 'open' | 'onOpen' | 'onClose'> & ExportedPickerStaticWrapperProps<TDate>;
@@ -1,7 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
2
  import _extends from "@babel/runtime/helpers/esm/extends";
4
- var _excluded = ["autoFocus", "onViewChange", "date", "disableFuture", "disablePast", "defaultCalendarMonth", "onChange", "onYearChange", "onMonthChange", "reduceAnimations", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "view", "views", "openTo", "className", "disabled", "readOnly", "minDate", "maxDate", "disableHighlightToday", "focusedView", "onFocusedViewChange", "classes"];
5
3
  import * as React from 'react';
6
4
  import PropTypes from 'prop-types';
7
5
  import clsx from 'clsx';
@@ -73,9 +71,7 @@ var CalendarPickerViewTransitionContainer = styled(PickersFadeTransitionGroup, {
73
71
  overridesResolver: function overridesResolver(props, styles) {
74
72
  return styles.viewTransitionContainer;
75
73
  }
76
- })({
77
- overflowY: 'auto'
78
- });
74
+ })({});
79
75
 
80
76
  /**
81
77
  *
@@ -91,10 +87,9 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
91
87
  var utils = useUtils();
92
88
  var id = useId();
93
89
  var props = useCalendarPickerDefaultizedProps(inProps, 'MuiCalendarPicker');
94
-
95
90
  var autoFocus = props.autoFocus,
96
91
  onViewChange = props.onViewChange,
97
- date = props.date,
92
+ value = props.value,
98
93
  disableFuture = props.disableFuture,
99
94
  disablePast = props.disablePast,
100
95
  defaultCalendarMonth = props.defaultCalendarMonth,
@@ -116,8 +111,14 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
116
111
  disableHighlightToday = props.disableHighlightToday,
117
112
  focusedView = props.focusedView,
118
113
  onFocusedViewChange = props.onFocusedViewChange,
119
- providedClasses = props.classes,
120
- other = _objectWithoutProperties(props, _excluded);
114
+ showDaysOutsideCurrentMonth = props.showDaysOutsideCurrentMonth,
115
+ dayOfWeekFormatter = props.dayOfWeekFormatter,
116
+ renderDay = props.renderDay,
117
+ components = props.components,
118
+ componentsProps = props.componentsProps,
119
+ loading = props.loading,
120
+ renderLoading = props.renderLoading,
121
+ sx = props.sx;
121
122
 
122
123
  var _useViews = useViews({
123
124
  view: view,
@@ -131,7 +132,7 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
131
132
  openNext = _useViews.openNext;
132
133
 
133
134
  var _useCalendarState = useCalendarState({
134
- date: date,
135
+ value: value,
135
136
  defaultCalendarMonth: defaultCalendarMonth,
136
137
  reduceAnimations: reduceAnimations,
137
138
  onMonthChange: onMonthChange,
@@ -148,7 +149,7 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
148
149
  isDateDisabled = _useCalendarState.isDateDisabled,
149
150
  onMonthSwitchingAnimationEnd = _useCalendarState.onMonthSwitchingAnimationEnd;
150
151
 
151
- var handleDateMonthChange = React.useCallback(function (newDate, selectionState) {
152
+ var handleDateMonthChange = React.useCallback(function (newDate) {
152
153
  var startOfMonth = utils.startOfMonth(newDate);
153
154
  var endOfMonth = utils.endOfMonth(newDate);
154
155
  var closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
@@ -162,7 +163,7 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
162
163
  }) : newDate;
163
164
 
164
165
  if (closestEnabledDate) {
165
- onChange(closestEnabledDate, selectionState);
166
+ onChange(closestEnabledDate, 'finish');
166
167
  onMonthChange == null ? void 0 : onMonthChange(startOfMonth);
167
168
  } else {
168
169
  openNext();
@@ -171,7 +172,7 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
171
172
 
172
173
  changeFocusedDay(closestEnabledDate, true);
173
174
  }, [changeFocusedDay, disableFuture, disablePast, isDateDisabled, maxDate, minDate, onChange, onMonthChange, changeMonth, openNext, utils]);
174
- var handleDateYearChange = React.useCallback(function (newDate, selectionState) {
175
+ var handleDateYearChange = React.useCallback(function (newDate) {
175
176
  var startOfYear = utils.startOfYear(newDate);
176
177
  var endOfYear = utils.endOfYear(newDate);
177
178
  var closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
@@ -185,7 +186,7 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
185
186
  }) : newDate;
186
187
 
187
188
  if (closestEnabledDate) {
188
- onChange(closestEnabledDate, selectionState);
189
+ onChange(closestEnabledDate, 'finish');
189
190
  onYearChange == null ? void 0 : onYearChange(closestEnabledDate);
190
191
  } else {
191
192
  openNext();
@@ -195,35 +196,18 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
195
196
  changeFocusedDay(closestEnabledDate, true);
196
197
  }, [changeFocusedDay, disableFuture, disablePast, isDateDisabled, maxDate, minDate, onChange, onYearChange, openNext, utils, changeMonth]);
197
198
  var onSelectedDayChange = React.useCallback(function (day, isFinish) {
198
- if (date && day) {
199
+ if (value && day) {
199
200
  // If there is a date already selected, then we want to keep its time
200
- return onChange(utils.mergeDateAndTime(day, date), isFinish);
201
+ return onChange(utils.mergeDateAndTime(day, value), isFinish);
201
202
  }
202
203
 
203
204
  return onChange(day, isFinish);
204
- }, [utils, date, onChange]);
205
+ }, [utils, value, onChange]);
205
206
  React.useEffect(function () {
206
- if (date && isDateDisabled(date)) {
207
- var closestEnabledDate = findClosestEnabledDate({
208
- utils: utils,
209
- date: date,
210
- minDate: minDate,
211
- maxDate: maxDate,
212
- disablePast: disablePast,
213
- disableFuture: disableFuture,
214
- isDateDisabled: isDateDisabled
215
- });
216
- onChange(closestEnabledDate, 'partial');
217
- } // This call is too expensive to run it on each prop change.
218
- // So just ensure that we are not rendering disabled as selected on mount.
219
-
220
- }, []); // eslint-disable-line
221
-
222
- React.useEffect(function () {
223
- if (date) {
224
- changeMonth(date);
207
+ if (value != null && utils.isValid(value)) {
208
+ changeMonth(value);
225
209
  }
226
- }, [date]); // eslint-disable-line
210
+ }, [value]); // eslint-disable-line
227
211
 
228
212
  var ownerState = props;
229
213
  var classes = useUtilityClasses(ownerState);
@@ -234,8 +218,8 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
234
218
  minDate: minDate
235
219
  }; // When disabled, limit the view to the selected date
236
220
 
237
- var minDateWithDisabled = disabled && date || minDate;
238
- var maxDateWithDisabled = disabled && date || maxDate;
221
+ var minDateWithDisabled = disabled && value || minDate;
222
+ var maxDateWithDisabled = disabled && value || maxDate;
239
223
  var commonViewProps = {
240
224
  disableHighlightToday: disableHighlightToday,
241
225
  readOnly: readOnly,
@@ -272,11 +256,16 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
272
256
  }
273
257
  };
274
258
  });
259
+ React.useEffect(function () {
260
+ // Set focus to the button when switching from a view to another
261
+ handleFocusedViewChange(openView)(true);
262
+ }, [openView, handleFocusedViewChange]);
275
263
  return /*#__PURE__*/_jsxs(CalendarPickerRoot, {
276
264
  ref: ref,
277
265
  className: clsx(classes.root, className),
278
266
  ownerState: ownerState,
279
- children: [/*#__PURE__*/_jsx(PickersCalendarHeader, _extends({}, other, {
267
+ sx: sx,
268
+ children: [/*#__PURE__*/_jsx(PickersCalendarHeader, {
280
269
  views: views,
281
270
  openView: openView,
282
271
  currentMonth: calendarState.currentMonth,
@@ -293,16 +282,18 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
293
282
  disablePast: disablePast,
294
283
  disableFuture: disableFuture,
295
284
  reduceAnimations: reduceAnimations,
296
- labelId: gridLabelId
297
- })), /*#__PURE__*/_jsx(CalendarPickerViewTransitionContainer, {
285
+ labelId: gridLabelId,
286
+ components: components,
287
+ componentsProps: componentsProps
288
+ }), /*#__PURE__*/_jsx(CalendarPickerViewTransitionContainer, {
298
289
  reduceAnimations: reduceAnimations,
299
290
  className: classes.viewTransitionContainer,
300
291
  transKey: openView,
301
292
  ownerState: ownerState,
302
293
  children: /*#__PURE__*/_jsxs("div", {
303
- children: [openView === 'year' && /*#__PURE__*/_jsx(YearPicker, _extends({}, other, baseDateValidationProps, commonViewProps, {
294
+ children: [openView === 'year' && /*#__PURE__*/_jsx(YearPicker, _extends({}, baseDateValidationProps, commonViewProps, {
304
295
  autoFocus: autoFocus,
305
- date: date,
296
+ value: value,
306
297
  onChange: handleDateYearChange,
307
298
  shouldDisableYear: shouldDisableYear,
308
299
  hasFocus: hasFocus,
@@ -311,21 +302,28 @@ export var CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicke
311
302
  autoFocus: autoFocus,
312
303
  hasFocus: hasFocus,
313
304
  className: className,
314
- date: date,
305
+ value: value,
315
306
  onChange: handleDateMonthChange,
316
307
  shouldDisableMonth: shouldDisableMonth,
317
308
  onFocusedViewChange: handleFocusedViewChange('month')
318
- })), openView === 'day' && /*#__PURE__*/_jsx(DayPicker, _extends({}, other, calendarState, baseDateValidationProps, commonViewProps, {
309
+ })), openView === 'day' && /*#__PURE__*/_jsx(DayPicker, _extends({}, calendarState, baseDateValidationProps, commonViewProps, {
319
310
  autoFocus: autoFocus,
320
311
  onMonthSwitchingAnimationEnd: onMonthSwitchingAnimationEnd,
321
312
  onFocusedDayChange: changeFocusedDay,
322
313
  reduceAnimations: reduceAnimations,
323
- selectedDays: [date],
314
+ selectedDays: [value],
324
315
  onSelectedDaysChange: onSelectedDayChange,
325
316
  shouldDisableDate: shouldDisableDate,
317
+ shouldDisableMonth: shouldDisableMonth,
318
+ shouldDisableYear: shouldDisableYear,
326
319
  hasFocus: hasFocus,
327
320
  onFocusedViewChange: handleFocusedViewChange('day'),
328
- gridLabelId: gridLabelId
321
+ gridLabelId: gridLabelId,
322
+ showDaysOutsideCurrentMonth: showDaysOutsideCurrentMonth,
323
+ dayOfWeekFormatter: dayOfWeekFormatter,
324
+ renderDay: renderDay,
325
+ loading: loading,
326
+ renderLoading: renderLoading
329
327
  }))]
330
328
  })
331
329
  })]
@@ -351,7 +349,6 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
351
349
  * @default {}
352
350
  */
353
351
  componentsProps: PropTypes.object,
354
- date: PropTypes.any,
355
352
 
356
353
  /**
357
354
  * Formats the day of week displayed in the calendar header.
@@ -391,20 +388,6 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
391
388
  disablePast: PropTypes.bool,
392
389
  focusedView: PropTypes.oneOf(['day', 'month', 'year']),
393
390
 
394
- /**
395
- * Get aria-label text for switching between views button.
396
- * @param {CalendarPickerView} currentView The view from which we want to get the button text.
397
- * @returns {string} The label of the view.
398
- * @deprecated Use the `localeText` prop of `LocalizationProvider` instead, see https://mui.com/x/react-date-pickers/localization
399
- */
400
- getViewSwitchingButtonText: PropTypes.func,
401
-
402
- /**
403
- * Left arrow icon aria-label text.
404
- * @deprecated
405
- */
406
- leftArrowButtonText: PropTypes.string,
407
-
408
391
  /**
409
392
  * If `true` renders `LoadingComponent` in calendar instead of calendar view.
410
393
  * Can be used to preload information and show it in calendar.
@@ -484,12 +467,6 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
484
467
  */
485
468
  renderLoading: PropTypes.func,
486
469
 
487
- /**
488
- * Right arrow icon aria-label text.
489
- * @deprecated
490
- */
491
- rightArrowButtonText: PropTypes.string,
492
-
493
470
  /**
494
471
  * Disable specific date. @DateIOType
495
472
  * @template TDate
@@ -522,6 +499,12 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
522
499
  */
523
500
  showDaysOutsideCurrentMonth: PropTypes.bool,
524
501
 
502
+ /**
503
+ * The system prop that allows defining system overrides as well as additional CSS styles.
504
+ */
505
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
506
+ value: PropTypes.any,
507
+
525
508
  /**
526
509
  * Controlled open view.
527
510
  */
@@ -9,7 +9,7 @@ import { PickersDay } from '../PickersDay/PickersDay';
9
9
  import { useUtils, useNow } from '../internals/hooks/useUtils';
10
10
  import { DAY_SIZE, DAY_MARGIN } from '../internals/constants/dimensions';
11
11
  import { PickersSlideTransition } from './PickersSlideTransition';
12
- import { useIsDayDisabled } from '../internals/hooks/validation/useDateValidation';
12
+ import { useIsDateDisabled } from '../internals/hooks/validation/useDateValidation';
13
13
  import { findClosestEnabledDate } from '../internals/utils/date-utils';
14
14
  import { getDayPickerUtilityClass } from './dayPickerClasses';
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -144,13 +144,17 @@ export function DayPicker(inProps) {
144
144
  minDate = props.minDate,
145
145
  maxDate = props.maxDate,
146
146
  shouldDisableDate = props.shouldDisableDate,
147
+ shouldDisableMonth = props.shouldDisableMonth,
148
+ shouldDisableYear = props.shouldDisableYear,
147
149
  _props$dayOfWeekForma = props.dayOfWeekFormatter,
148
150
  dayOfWeekFormatter = _props$dayOfWeekForma === void 0 ? defaultDayOfWeekFormatter : _props$dayOfWeekForma,
149
151
  hasFocus = props.hasFocus,
150
152
  onFocusedViewChange = props.onFocusedViewChange,
151
153
  gridLabelId = props.gridLabelId;
152
- var isDateDisabled = useIsDayDisabled({
154
+ var isDateDisabled = useIsDateDisabled({
153
155
  shouldDisableDate: shouldDisableDate,
156
+ shouldDisableMonth: shouldDisableMonth,
157
+ shouldDisableYear: shouldDisableYear,
154
158
  minDate: minDate,
155
159
  maxDate: maxDate,
156
160
  disablePast: disablePast,
@@ -9,7 +9,6 @@ import { PickersFadeTransitionGroup } from './PickersFadeTransitionGroup';
9
9
  import { ArrowDropDown } from '../internals/components/icons';
10
10
  import { PickersArrowSwitcher } from '../internals/components/PickersArrowSwitcher';
11
11
  import { usePreviousMonthDisabled, useNextMonthDisabled } from '../internals/hooks/date-helpers-hooks';
12
- import { buildDeprecatedPropsWarning } from '../internals/utils/warning';
13
12
  import { getPickersCalendarHeaderUtilityClass } from './pickersCalendarHeaderClasses';
14
13
  import { jsx as _jsx } from "react/jsx-runtime";
15
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -97,7 +96,6 @@ var PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDown, {
97
96
  transform: 'rotate(180deg)'
98
97
  });
99
98
  });
100
- var deprecatedPropsWarning = buildDeprecatedPropsWarning('Props for translation are deprecated. See https://mui.com/x/react-date-pickers/localization for more information.');
101
99
  /**
102
100
  * @ignore - do not document.
103
101
  */
@@ -115,26 +113,15 @@ export function PickersCalendarHeader(inProps) {
115
113
  disabled = props.disabled,
116
114
  disableFuture = props.disableFuture,
117
115
  disablePast = props.disablePast,
118
- getViewSwitchingButtonTextProp = props.getViewSwitchingButtonText,
119
- leftArrowButtonTextProp = props.leftArrowButtonText,
120
116
  maxDate = props.maxDate,
121
117
  minDate = props.minDate,
122
118
  onMonthChange = props.onMonthChange,
123
119
  onViewChange = props.onViewChange,
124
120
  currentView = props.openView,
125
121
  reduceAnimations = props.reduceAnimations,
126
- rightArrowButtonTextProp = props.rightArrowButtonText,
127
122
  views = props.views,
128
123
  labelId = props.labelId;
129
- deprecatedPropsWarning({
130
- leftArrowButtonText: leftArrowButtonTextProp,
131
- rightArrowButtonText: rightArrowButtonTextProp,
132
- getViewSwitchingButtonText: getViewSwitchingButtonTextProp
133
- });
134
124
  var localeText = useLocaleText();
135
- var leftArrowButtonText = leftArrowButtonTextProp != null ? leftArrowButtonTextProp : localeText.previousMonth;
136
- var rightArrowButtonText = rightArrowButtonTextProp != null ? rightArrowButtonTextProp : localeText.nextMonth;
137
- var getViewSwitchingButtonText = getViewSwitchingButtonTextProp != null ? getViewSwitchingButtonTextProp : localeText.calendarViewSwitchingButtonAriaLabel;
138
125
  var utils = useUtils();
139
126
  var classes = useUtilityClasses(props);
140
127
  var switchViewButtonProps = componentsProps.switchViewButton || {};
@@ -200,7 +187,7 @@ export function PickersCalendarHeader(inProps) {
200
187
  }), views.length > 1 && !disabled && /*#__PURE__*/_jsx(PickersCalendarHeaderSwitchViewButton, _extends({
201
188
  size: "small",
202
189
  as: components.SwitchViewButton,
203
- "aria-label": getViewSwitchingButtonText(currentView),
190
+ "aria-label": localeText.calendarViewSwitchingButtonAriaLabel(currentView),
204
191
  className: classes.switchViewButton
205
192
  }, switchViewButtonProps, {
206
193
  children: /*#__PURE__*/_jsx(PickersCalendarHeaderSwitchViewIcon, {
@@ -212,14 +199,14 @@ export function PickersCalendarHeader(inProps) {
212
199
  }), /*#__PURE__*/_jsx(Fade, {
213
200
  in: currentView === 'day',
214
201
  children: /*#__PURE__*/_jsx(PickersArrowSwitcher, {
215
- leftArrowButtonText: leftArrowButtonText,
216
- rightArrowButtonText: rightArrowButtonText,
217
202
  components: components,
218
203
  componentsProps: componentsProps,
219
- onLeftClick: selectPreviousMonth,
220
- onRightClick: selectNextMonth,
221
- isLeftDisabled: isPreviousMonthDisabled,
222
- isRightDisabled: isNextMonthDisabled
204
+ onGoToPrevious: selectPreviousMonth,
205
+ isPreviousDisabled: isPreviousMonthDisabled,
206
+ previousLabel: localeText.previousMonth,
207
+ onGoToNext: selectNextMonth,
208
+ isNextDisabled: isNextMonthDisabled,
209
+ nextLabel: localeText.nextMonth
223
210
  })
224
211
  })]
225
212
  });