@mui/x-date-pickers 6.11.1 → 6.11.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 (158) hide show
  1. package/CHANGELOG.md +57 -1
  2. package/DateCalendar/DateCalendar.js +2 -2
  3. package/DateCalendar/DateCalendar.types.d.ts +2 -2
  4. package/DatePicker/DatePicker.js +2 -2
  5. package/DateTimePicker/DateTimePicker.js +2 -2
  6. package/DesktopDatePicker/DesktopDatePicker.js +2 -2
  7. package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  8. package/DesktopTimePicker/DesktopTimePicker.js +5 -0
  9. package/DigitalClock/DigitalClock.js +3 -1
  10. package/MobileDatePicker/MobileDatePicker.js +2 -2
  11. package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  12. package/MobileTimePicker/MobileTimePicker.js +5 -0
  13. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
  14. package/PickersShortcuts/PickersShortcuts.d.ts +2 -1
  15. package/PickersShortcuts/PickersShortcuts.js +9 -4
  16. package/PickersShortcuts/index.d.ts +1 -1
  17. package/StaticDatePicker/StaticDatePicker.js +2 -2
  18. package/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  19. package/StaticTimePicker/StaticTimePicker.js +5 -0
  20. package/TimePicker/TimePicker.js +5 -0
  21. package/index.js +1 -1
  22. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -11
  23. package/internals/components/PickersPopper.d.ts +2 -1
  24. package/internals/components/PickersPopper.js +7 -2
  25. package/internals/components/PickersToolbar.js +13 -13
  26. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
  27. package/internals/hooks/usePicker/usePickerValue.js +10 -2
  28. package/internals/hooks/usePicker/usePickerValue.types.d.ts +3 -5
  29. package/internals/hooks/usePicker/usePickerViews.d.ts +5 -0
  30. package/legacy/DateCalendar/DateCalendar.js +2 -2
  31. package/legacy/DatePicker/DatePicker.js +2 -2
  32. package/legacy/DateTimePicker/DateTimePicker.js +2 -2
  33. package/legacy/DesktopDatePicker/DesktopDatePicker.js +2 -2
  34. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  35. package/legacy/DesktopTimePicker/DesktopTimePicker.js +5 -0
  36. package/legacy/DigitalClock/DigitalClock.js +3 -1
  37. package/legacy/MobileDatePicker/MobileDatePicker.js +2 -2
  38. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  39. package/legacy/MobileTimePicker/MobileTimePicker.js +5 -0
  40. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
  41. package/legacy/PickersShortcuts/PickersShortcuts.js +7 -4
  42. package/legacy/StaticDatePicker/StaticDatePicker.js +2 -2
  43. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  44. package/legacy/StaticTimePicker/StaticTimePicker.js +5 -0
  45. package/legacy/TimePicker/TimePicker.js +5 -0
  46. package/legacy/index.js +1 -1
  47. package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -15
  48. package/legacy/internals/components/PickersPopper.js +7 -2
  49. package/legacy/internals/components/PickersToolbar.js +11 -14
  50. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
  51. package/legacy/internals/hooks/usePicker/usePickerValue.js +10 -2
  52. package/legacy/models/index.js +2 -1
  53. package/legacy/models/pickers.js +1 -0
  54. package/legacy/tests/describeAdapters/describeAdapters.js +1 -1
  55. package/legacy/tests/describeGregorianAdapter/testCalculations.js +1 -1
  56. package/legacy/tests/describeGregorianAdapter/testLocalization.js +1 -1
  57. package/legacy/tests/describeValidation/testDayViewValidation.js +1 -1
  58. package/legacy/tests/describeValidation/testMinutesViewValidation.js +2 -2
  59. package/legacy/tests/describeValidation/testMonthViewValidation.js +1 -1
  60. package/legacy/tests/describeValidation/testTextFieldValidation.js +1 -1
  61. package/legacy/tests/describeValidation/testYearViewValidation.js +1 -1
  62. package/legacy/tests/describeValue/describeValue.js +1 -1
  63. package/legacy/tests/describeValue/testControlledUnControlled.js +1 -1
  64. package/legacy/tests/describeValue/testPickerActionBar.js +1 -2
  65. package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +1 -1
  66. package/legacy/tests/describeValue/testShortcuts.js +1 -1
  67. package/models/index.d.ts +1 -0
  68. package/models/index.js +2 -1
  69. package/models/pickers.d.ts +9 -0
  70. package/models/pickers.js +1 -0
  71. package/modern/DateCalendar/DateCalendar.js +2 -2
  72. package/modern/DatePicker/DatePicker.js +2 -2
  73. package/modern/DateTimePicker/DateTimePicker.js +2 -2
  74. package/modern/DesktopDatePicker/DesktopDatePicker.js +2 -2
  75. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  76. package/modern/DesktopTimePicker/DesktopTimePicker.js +5 -0
  77. package/modern/DigitalClock/DigitalClock.js +3 -1
  78. package/modern/MobileDatePicker/MobileDatePicker.js +2 -2
  79. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  80. package/modern/MobileTimePicker/MobileTimePicker.js +5 -0
  81. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
  82. package/modern/PickersShortcuts/PickersShortcuts.js +9 -4
  83. package/modern/StaticDatePicker/StaticDatePicker.js +2 -2
  84. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  85. package/modern/StaticTimePicker/StaticTimePicker.js +5 -0
  86. package/modern/TimePicker/TimePicker.js +5 -0
  87. package/modern/index.js +1 -1
  88. package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -11
  89. package/modern/internals/components/PickersPopper.js +7 -2
  90. package/modern/internals/components/PickersToolbar.js +9 -12
  91. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
  92. package/modern/internals/hooks/usePicker/usePickerValue.js +10 -2
  93. package/modern/models/index.js +2 -1
  94. package/modern/models/pickers.js +1 -0
  95. package/modern/tests/describeAdapters/describeAdapters.js +1 -1
  96. package/modern/tests/describeGregorianAdapter/testCalculations.js +1 -1
  97. package/modern/tests/describeGregorianAdapter/testLocalization.js +1 -1
  98. package/modern/tests/describeValidation/testDayViewValidation.js +1 -1
  99. package/modern/tests/describeValidation/testMinutesViewValidation.js +2 -2
  100. package/modern/tests/describeValidation/testMonthViewValidation.js +1 -1
  101. package/modern/tests/describeValidation/testTextFieldValidation.js +1 -1
  102. package/modern/tests/describeValidation/testYearViewValidation.js +1 -1
  103. package/modern/tests/describeValue/describeValue.js +1 -1
  104. package/modern/tests/describeValue/testControlledUnControlled.js +1 -1
  105. package/modern/tests/describeValue/testPickerActionBar.js +1 -2
  106. package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +1 -1
  107. package/modern/tests/describeValue/testShortcuts.js +1 -1
  108. package/node/DateCalendar/DateCalendar.js +2 -2
  109. package/node/DatePicker/DatePicker.js +2 -2
  110. package/node/DateTimePicker/DateTimePicker.js +2 -2
  111. package/node/DesktopDatePicker/DesktopDatePicker.js +2 -2
  112. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  113. package/node/DesktopTimePicker/DesktopTimePicker.js +5 -0
  114. package/node/DigitalClock/DigitalClock.js +3 -1
  115. package/node/MobileDatePicker/MobileDatePicker.js +2 -2
  116. package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  117. package/node/MobileTimePicker/MobileTimePicker.js +5 -0
  118. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
  119. package/node/PickersShortcuts/PickersShortcuts.js +9 -4
  120. package/node/StaticDatePicker/StaticDatePicker.js +2 -2
  121. package/node/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  122. package/node/StaticTimePicker/StaticTimePicker.js +5 -0
  123. package/node/TimePicker/TimePicker.js +5 -0
  124. package/node/index.js +1 -1
  125. package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -11
  126. package/node/internals/components/PickersPopper.js +7 -2
  127. package/node/internals/components/PickersToolbar.js +9 -12
  128. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
  129. package/node/internals/hooks/usePicker/usePickerValue.js +10 -2
  130. package/node/models/index.js +11 -0
  131. package/node/models/pickers.js +5 -0
  132. package/node/tests/describeAdapters/describeAdapters.js +3 -3
  133. package/node/tests/describeGregorianAdapter/testCalculations.js +2 -2
  134. package/node/tests/describeGregorianAdapter/testLocalization.js +4 -4
  135. package/node/tests/describeValidation/testDayViewValidation.js +33 -33
  136. package/node/tests/describeValidation/testMinutesViewValidation.js +14 -14
  137. package/node/tests/describeValidation/testMonthViewValidation.js +22 -22
  138. package/node/tests/describeValidation/testTextFieldValidation.js +54 -54
  139. package/node/tests/describeValidation/testYearViewValidation.js +18 -18
  140. package/node/tests/describeValue/describeValue.js +2 -2
  141. package/node/tests/describeValue/testControlledUnControlled.js +3 -3
  142. package/node/tests/describeValue/testPickerActionBar.js +10 -11
  143. package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +10 -10
  144. package/node/tests/describeValue/testShortcuts.js +6 -6
  145. package/package.json +2 -2
  146. package/tests/describeAdapters/describeAdapters.js +1 -1
  147. package/tests/describeGregorianAdapter/testCalculations.js +1 -1
  148. package/tests/describeGregorianAdapter/testLocalization.js +1 -1
  149. package/tests/describeValidation/testDayViewValidation.js +1 -1
  150. package/tests/describeValidation/testMinutesViewValidation.js +2 -2
  151. package/tests/describeValidation/testMonthViewValidation.js +1 -1
  152. package/tests/describeValidation/testTextFieldValidation.js +1 -1
  153. package/tests/describeValidation/testYearViewValidation.js +1 -1
  154. package/tests/describeValue/describeValue.js +1 -1
  155. package/tests/describeValue/testControlledUnControlled.js +1 -1
  156. package/tests/describeValue/testPickerActionBar.js +1 -2
  157. package/tests/describeValue/testPickerOpenCloseLifeCycle.js +1 -1
  158. package/tests/describeValue/testShortcuts.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,62 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.11.2
7
+
8
+ _Aug 17, 2023_
9
+
10
+ We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🏎️ Lower the filtering delay in the grid
13
+ - 🌍 Improve Spanish (es-ES) locale on the data grid
14
+ - 🐞 Bugfixes
15
+ - 📚 Documentation improvements
16
+
17
+ ### Data Grid
18
+
19
+ #### `@mui/x-data-grid@v6.11.2`
20
+
21
+ - [DataGrid] Fix `eval` blocked by CSP (#9863) @romgrk
22
+ - [DataGrid] Fix row id bug (#10051) @romgrk
23
+ - [DataGrid] Honor `disableExport` flag in Print Export (#10044) @MBilalShafi
24
+ - [DataGrid] Lower filter debounce delay (#9712) @romgrk
25
+ - [DataGrid] Unhide potential ref binding issue (#9965) @oliviertassinari
26
+ - [l10n] Improve Chinese (zh-CN) and Chinese(traditional) (zh-TW) locales (#9999) @MyNameIsTakenOMG
27
+ - [l10n] Improve Spanish (es-ES) locale (#10037) @Macampu420
28
+
29
+ #### `@mui/x-data-grid-pro@v6.11.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
30
+
31
+ Same changes as in `@mui/x-data-grid@v6.11.2`.
32
+
33
+ #### `@mui/x-data-grid-premium@v6.11.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link)
34
+
35
+ Same changes as in `@mui/x-data-grid-pro@v6.11.2`.
36
+
37
+ ### Date Pickers
38
+
39
+ #### `@mui/x-date-pickers@v6.11.2`
40
+
41
+ - [pickers] Fix month switcher RTL (#10003) @alexfauquette
42
+ - [pickers] Follow-up on using device motion reduction preference (#9858) @LukasTy
43
+ - [pickers] Pass the shortcut information in the `onChange` context (#9985) @flaviendelangle
44
+ - [pickers] Replace `Grid` toolbar component with a styled `div` (#10052) @LukasTy
45
+
46
+ #### `@mui/x-date-pickers-pro@v6.11.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
47
+
48
+ Same changes as in `@mui/x-date-pickers@v6.11.2`.
49
+
50
+ ### Docs
51
+
52
+ - [docs] Add migration guide for the Tree View (#9987) @flaviendelangle
53
+ - [docs] Fix en-US changelog @oliviertassinari
54
+ - [docs] Update column types (#10040) @romgrk
55
+
56
+ ### Core
57
+
58
+ - [core] Remove unnecessary Box (#9831) @oliviertassinari
59
+ - [core] Set GitHub Action top level permission @oliviertassinari
60
+ - [core] Split the pickers test utils (#9976) @flaviendelangle
61
+
6
62
  ## 6.11.1
7
63
 
8
64
  _Aug 11, 2023_
@@ -2872,7 +2928,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
2872
2928
 
2873
2929
  #### Changes
2874
2930
 
2875
- - [DateRangePicker] Fix input focused style and mobile behaviour (#6645) @LukasTy
2931
+ - [DateRangePicker] Fix input focused style and mobile behavior (#6645) @LukasTy
2876
2932
  - [fields] Update sections when the locale changes (#6649) @flaviendelangle
2877
2933
  - [pickers] Add Ukrainian (uk-UA) locale (#6661) @Dufran
2878
2934
  - [pickers] Allow non-controlled usage of the calendar components (#6643) @flaviendelangle
@@ -486,8 +486,8 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
486
486
  */
487
487
  readOnly: PropTypes.bool,
488
488
  /**
489
- * Disable heavy animations.
490
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
489
+ * If `true`, disable heavy animations.
490
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
491
491
  */
492
492
  reduceAnimations: PropTypes.bool,
493
493
  /**
@@ -40,8 +40,8 @@ export interface ExportedDateCalendarProps<TDate> extends ExportedDayCalendarPro
40
40
  */
41
41
  readOnly?: boolean;
42
42
  /**
43
- * Disable heavy animations.
44
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
43
+ * If `true`, disable heavy animations.
44
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
45
45
  */
46
46
  reduceAnimations?: boolean;
47
47
  /**
@@ -241,8 +241,8 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
241
241
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
242
242
  readOnly: PropTypes.bool,
243
243
  /**
244
- * Disable heavy animations.
245
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
244
+ * If `true`, disable heavy animations.
245
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
246
246
  */
247
247
  reduceAnimations: PropTypes.bool,
248
248
  /**
@@ -279,8 +279,8 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
279
279
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
280
280
  readOnly: PropTypes.bool,
281
281
  /**
282
- * Disable heavy animations.
283
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
282
+ * If `true`, disable heavy animations.
283
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
284
284
  */
285
285
  reduceAnimations: PropTypes.bool,
286
286
  /**
@@ -259,8 +259,8 @@ DesktopDatePicker.propTypes = {
259
259
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
260
260
  readOnly: PropTypes.bool,
261
261
  /**
262
- * Disable heavy animations.
263
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
262
+ * If `true`, disable heavy animations.
263
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
264
264
  */
265
265
  reduceAnimations: PropTypes.bool,
266
266
  /**
@@ -333,8 +333,8 @@ DesktopDateTimePicker.propTypes = {
333
333
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
334
334
  readOnly: PropTypes.bool,
335
335
  /**
336
- * Disable heavy animations.
337
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
336
+ * If `true`, disable heavy animations.
337
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
338
338
  */
339
339
  reduceAnimations: PropTypes.bool,
340
340
  /**
@@ -254,6 +254,11 @@ DesktopTimePicker.propTypes = {
254
254
  */
255
255
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
256
256
  readOnly: PropTypes.bool,
257
+ /**
258
+ * If `true`, disable heavy animations.
259
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
260
+ */
261
+ reduceAnimations: PropTypes.bool,
257
262
  /**
258
263
  * The currently selected sections.
259
264
  * This prop accept four formats:
@@ -41,7 +41,9 @@ const DigitalClockRoot = styled(PickerViewRoot, {
41
41
  }) => ({
42
42
  overflowY: 'auto',
43
43
  width: '100%',
44
- scrollBehavior: ownerState.alreadyRendered ? 'smooth' : 'auto',
44
+ '@media (prefers-reduced-motion: no-preference)': {
45
+ scrollBehavior: ownerState.alreadyRendered ? 'smooth' : 'auto'
46
+ },
45
47
  maxHeight: DIGITAL_CLOCK_VIEW_HEIGHT
46
48
  }));
47
49
  const DigitalClockList = styled(MenuList, {
@@ -256,8 +256,8 @@ MobileDatePicker.propTypes = {
256
256
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
257
257
  readOnly: PropTypes.bool,
258
258
  /**
259
- * Disable heavy animations.
260
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
259
+ * If `true`, disable heavy animations.
260
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
261
261
  */
262
262
  reduceAnimations: PropTypes.bool,
263
263
  /**
@@ -305,8 +305,8 @@ MobileDateTimePicker.propTypes = {
305
305
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
306
306
  readOnly: PropTypes.bool,
307
307
  /**
308
- * Disable heavy animations.
309
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
308
+ * If `true`, disable heavy animations.
309
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
310
310
  */
311
311
  reduceAnimations: PropTypes.bool,
312
312
  /**
@@ -232,6 +232,11 @@ MobileTimePicker.propTypes = {
232
232
  */
233
233
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
234
234
  readOnly: PropTypes.bool,
235
+ /**
236
+ * If `true`, disable heavy animations.
237
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
238
+ */
239
+ reduceAnimations: PropTypes.bool,
235
240
  /**
236
241
  * The currently selected sections.
237
242
  * This prop accept four formats:
@@ -33,7 +33,9 @@ const MultiSectionDigitalClockSectionRoot = styled(MenuList, {
33
33
  width: 56,
34
34
  padding: 0,
35
35
  overflow: 'hidden',
36
- scrollBehavior: ownerState.alreadyRendered ? 'smooth' : 'auto',
36
+ '@media (prefers-reduced-motion: no-preference)': {
37
+ scrollBehavior: ownerState.alreadyRendered ? 'smooth' : 'auto'
38
+ },
37
39
  '&:hover': {
38
40
  overflowY: 'auto'
39
41
  },
@@ -7,6 +7,7 @@ export interface PickersShortcutsItem<TValue> {
7
7
  label: string;
8
8
  getValue: (params: PickersShortcutsItemGetValueParams<TValue>) => TValue;
9
9
  }
10
+ export type PickersShortcutsItemContext = Omit<PickersShortcutsItem<unknown>, 'getValue'>;
10
11
  export type PickerShortcutChangeImportance = 'set' | 'accept';
11
12
  export interface ExportedPickersShortcutProps<TValue> extends Omit<ListProps, 'onChange'> {
12
13
  /**
@@ -25,7 +26,7 @@ export interface ExportedPickersShortcutProps<TValue> extends Omit<ListProps, 'o
25
26
  }
26
27
  export interface PickersShortcutsProps<TValue> extends ExportedPickersShortcutProps<TValue> {
27
28
  isLandscape: boolean;
28
- onChange: (newValue: TValue, changeImportance?: PickerShortcutChangeImportance) => void;
29
+ onChange: (newValue: TValue, changeImportance?: PickerShortcutChangeImportance, shortcut?: PickersShortcutsItemContext) => void;
29
30
  isValid: (value: TValue) => boolean;
30
31
  }
31
32
  declare function PickersShortcuts<TValue>(props: PickersShortcutsProps<TValue>): React.JSX.Element | null;
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["items", "changeImportance", "isLandscape", "onChange", "isValid"];
3
+ const _excluded = ["items", "changeImportance", "isLandscape", "onChange", "isValid"],
4
+ _excluded2 = ["getValue"];
4
5
  import * as React from 'react';
5
6
  import PropTypes from 'prop-types';
6
7
  import List from '@mui/material/List';
@@ -19,14 +20,18 @@ function PickersShortcuts(props) {
19
20
  if (items == null || items.length === 0) {
20
21
  return null;
21
22
  }
22
- const resolvedItems = items.map(item => {
23
- const newValue = item.getValue({
23
+ const resolvedItems = items.map(_ref => {
24
+ let {
25
+ getValue
26
+ } = _ref,
27
+ item = _objectWithoutPropertiesLoose(_ref, _excluded2);
28
+ const newValue = getValue({
24
29
  isValid
25
30
  });
26
31
  return {
27
32
  label: item.label,
28
33
  onClick: () => {
29
- onChange(newValue, changeImportance);
34
+ onChange(newValue, changeImportance, item);
30
35
  },
31
36
  disabled: !isValid(newValue)
32
37
  };
@@ -1,2 +1,2 @@
1
1
  export { PickersShortcuts } from './PickersShortcuts';
2
- export type { PickersShortcutsProps, PickersShortcutsItem, PickerShortcutChangeImportance, } from './PickersShortcuts';
2
+ export type { PickersShortcutsProps, PickersShortcutsItem, PickersShortcutsItemContext, PickerShortcutChangeImportance, } from './PickersShortcuts';
@@ -201,8 +201,8 @@ StaticDatePicker.propTypes = {
201
201
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
202
202
  readOnly: PropTypes.bool,
203
203
  /**
204
- * Disable heavy animations.
205
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
204
+ * If `true`, disable heavy animations.
205
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
206
206
  */
207
207
  reduceAnimations: PropTypes.bool,
208
208
  /**
@@ -249,8 +249,8 @@ StaticDateTimePicker.propTypes = {
249
249
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
250
250
  readOnly: PropTypes.bool,
251
251
  /**
252
- * Disable heavy animations.
253
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
252
+ * If `true`, disable heavy animations.
253
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
254
254
  */
255
255
  reduceAnimations: PropTypes.bool,
256
256
  /**
@@ -175,6 +175,11 @@ StaticTimePicker.propTypes = {
175
175
  */
176
176
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
177
177
  readOnly: PropTypes.bool,
178
+ /**
179
+ * If `true`, disable heavy animations.
180
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
181
+ */
182
+ reduceAnimations: PropTypes.bool,
178
183
  /**
179
184
  * Disable specific clock time.
180
185
  * @param {number} clockValue The value to check.
@@ -213,6 +213,11 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
213
213
  */
214
214
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
215
215
  readOnly: PropTypes.bool,
216
+ /**
217
+ * If `true`, disable heavy animations.
218
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
219
+ */
220
+ reduceAnimations: PropTypes.bool,
216
221
  /**
217
222
  * The currently selected sections.
218
223
  * This prop accept four formats:
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v6.11.1
2
+ * @mui/x-date-pickers v6.11.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -87,21 +87,20 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
87
87
  goTo: onGoToPrevious,
88
88
  label: previousLabel
89
89
  };
90
- const [leftProps, rightProps] = isRTL ? [nextProps, previousProps] : [previousProps, nextProps];
91
90
  const PreviousIconButton = (_slots$previousIconBu = slots == null ? void 0 : slots.previousIconButton) != null ? _slots$previousIconBu : PickersArrowSwitcherButton;
92
91
  const previousIconButtonProps = useSlotProps({
93
92
  elementType: PreviousIconButton,
94
93
  externalSlotProps: slotProps == null ? void 0 : slotProps.previousIconButton,
95
94
  additionalProps: {
96
95
  size: 'medium',
97
- title: leftProps.label,
98
- 'aria-label': leftProps.label,
99
- disabled: leftProps.isDisabled,
96
+ title: previousProps.label,
97
+ 'aria-label': previousProps.label,
98
+ disabled: previousProps.isDisabled,
100
99
  edge: 'end',
101
- onClick: leftProps.goTo
100
+ onClick: previousProps.goTo
102
101
  },
103
102
  ownerState: _extends({}, ownerState, {
104
- hidden: leftProps.isHidden
103
+ hidden: previousProps.isHidden
105
104
  }),
106
105
  className: classes.button
107
106
  });
@@ -111,14 +110,14 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
111
110
  externalSlotProps: slotProps == null ? void 0 : slotProps.nextIconButton,
112
111
  additionalProps: {
113
112
  size: 'medium',
114
- title: rightProps.label,
115
- 'aria-label': rightProps.label,
116
- disabled: rightProps.isDisabled,
113
+ title: nextProps.label,
114
+ 'aria-label': nextProps.label,
115
+ disabled: nextProps.isDisabled,
117
116
  edge: 'start',
118
- onClick: rightProps.goTo
117
+ onClick: nextProps.goTo
119
118
  },
120
119
  ownerState: _extends({}, ownerState, {
121
- hidden: rightProps.isHidden
120
+ hidden: nextProps.isHidden
122
121
  }),
123
122
  className: classes.button
124
123
  });
@@ -15,7 +15,7 @@ export interface PickersPopperSlotsComponent {
15
15
  DesktopPaper?: React.JSXElementConstructor<MuiPaperProps>;
16
16
  /**
17
17
  * Custom component for the desktop popper [Transition](https://mui.com/material-ui/transitions/).
18
- * @default Grow from '@mui/material'.
18
+ * @default Grow or Fade from '@mui/material' when `reduceAnimations` is `true`.
19
19
  */
20
20
  DesktopTransition?: React.JSXElementConstructor<MuiTransitionProps>;
21
21
  /**
@@ -61,5 +61,6 @@ export interface PickerPopperProps extends UsePickerValueActions {
61
61
  slotProps?: PickersPopperSlotsComponentsProps;
62
62
  classes?: Partial<PickersPopperClasses>;
63
63
  shouldRestoreFocus?: () => boolean;
64
+ reduceAnimations?: boolean;
64
65
  }
65
66
  export declare function PickersPopper(inProps: PickerPopperProps): React.JSX.Element;
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useSlotProps } from '@mui/base/utils';
4
4
  import Grow from '@mui/material/Grow';
5
+ import Fade from '@mui/material/Fade';
5
6
  import MuiPaper from '@mui/material/Paper';
6
7
  import MuiPopper from '@mui/material/Popper';
7
8
  import MuiTrapFocus from '@mui/material/Unstable_TrapFocus';
@@ -9,6 +10,7 @@ import { unstable_useForkRef as useForkRef, unstable_useEventCallback as useEven
9
10
  import { styled, useThemeProps } from '@mui/material/styles';
10
11
  import { getPickersPopperUtilityClass } from './pickersPopperClasses';
11
12
  import { getActiveElement } from '../utils/utils';
13
+ import { useDefaultReduceAnimations } from '../hooks/useDefaultReduceAnimations';
12
14
  import { jsx as _jsx } from "react/jsx-runtime";
13
15
  const useUtilityClasses = ownerState => {
14
16
  const {
@@ -173,7 +175,8 @@ export function PickersPopper(inProps) {
173
175
  role,
174
176
  placement,
175
177
  slots,
176
- slotProps
178
+ slotProps,
179
+ reduceAnimations: inReduceAnimations
177
180
  } = props;
178
181
  React.useEffect(() => {
179
182
  function handleKeyDown(nativeEvent) {
@@ -210,6 +213,8 @@ export function PickersPopper(inProps) {
210
213
  const handlePaperRef = useForkRef(handleRef, clickAwayRef);
211
214
  const ownerState = props;
212
215
  const classes = useUtilityClasses(ownerState);
216
+ const defaultReduceAnimations = useDefaultReduceAnimations();
217
+ const reduceAnimations = inReduceAnimations != null ? inReduceAnimations : defaultReduceAnimations;
213
218
  const handleKeyDown = event => {
214
219
  if (event.key === 'Escape') {
215
220
  // stop the propagation to avoid closing parent modal
@@ -217,7 +222,7 @@ export function PickersPopper(inProps) {
217
222
  onDismiss();
218
223
  }
219
224
  };
220
- const Transition = (_slots$desktopTransit = slots == null ? void 0 : slots.desktopTransition) != null ? _slots$desktopTransit : Grow;
225
+ const Transition = ((_slots$desktopTransit = slots == null ? void 0 : slots.desktopTransition) != null ? _slots$desktopTransit : reduceAnimations) ? Fade : Grow;
221
226
  const TrapFocus = (_slots$desktopTrapFoc = slots == null ? void 0 : slots.desktopTrapFocus) != null ? _slots$desktopTrapFoc : MuiTrapFocus;
222
227
  const Paper = (_slots$desktopPaper = slots == null ? void 0 : slots.desktopPaper) != null ? _slots$desktopPaper : PickersPopperPaper;
223
228
  const paperProps = useSlotProps({
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import clsx from 'clsx';
4
- import Grid from '@mui/material/Grid';
5
4
  import Typography from '@mui/material/Typography';
6
5
  import { styled, useThemeProps } from '@mui/material/styles';
7
6
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
@@ -40,17 +39,24 @@ const PickersToolbarRoot = styled('div', {
40
39
  justifyContent: 'flex-start',
41
40
  flexWrap: 'wrap'
42
41
  }));
43
- const PickersToolbarContent = styled(Grid, {
42
+ const PickersToolbarContent = styled('div', {
44
43
  name: 'MuiPickersToolbar',
45
44
  slot: 'Content',
46
45
  overridesResolver: (props, styles) => styles.content
47
46
  })(({
48
47
  ownerState
49
- }) => _extends({
50
- flex: 1
51
- }, !ownerState.isLandscape && {
52
- alignItems: 'center'
53
- }));
48
+ }) => {
49
+ var _ownerState$landscape;
50
+ return {
51
+ display: 'flex',
52
+ flexWrap: 'wrap',
53
+ width: '100%',
54
+ justifyContent: ownerState.isLandscape ? 'flex-start' : 'space-between',
55
+ flexDirection: ownerState.isLandscape ? (_ownerState$landscape = ownerState.landscapeDirection) != null ? _ownerState$landscape : 'column' : 'row',
56
+ flex: 1,
57
+ alignItems: ownerState.isLandscape ? 'flex-start' : 'center'
58
+ };
59
+ });
54
60
  export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersToolbar(inProps, ref) {
55
61
  const props = useThemeProps({
56
62
  props: inProps,
@@ -59,8 +65,6 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
59
65
  const {
60
66
  children,
61
67
  className,
62
- isLandscape,
63
- landscapeDirection = 'column',
64
68
  toolbarTitle,
65
69
  hidden,
66
70
  titleId
@@ -80,12 +84,8 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
80
84
  id: titleId,
81
85
  children: toolbarTitle
82
86
  }), /*#__PURE__*/_jsx(PickersToolbarContent, {
83
- container: true,
84
- justifyContent: isLandscape ? 'flex-start' : 'space-between',
85
87
  className: classes.content,
86
88
  ownerState: ownerState,
87
- direction: isLandscape ? landscapeDirection : 'row',
88
- alignItems: isLandscape ? 'flex-start' : 'flex-end',
89
89
  children: children
90
90
  })]
91
91
  });
@@ -42,7 +42,8 @@ export const useDesktopPicker = _ref => {
42
42
  readOnly,
43
43
  disabled,
44
44
  autoFocus,
45
- localeText
45
+ localeText,
46
+ reduceAnimations
46
47
  } = props;
47
48
  const utils = useUtils();
48
49
  const internalInputRef = React.useRef(null);
@@ -156,6 +157,7 @@ export const useDesktopPicker = _ref => {
156
157
  slots: slots,
157
158
  slotProps: slotProps,
158
159
  shouldRestoreFocus: shouldRestoreFocus,
160
+ reduceAnimations: reduceAnimations,
159
161
  children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps == null ? void 0 : slotProps.layout, {
160
162
  slots: slots,
161
163
  slotProps: slotProps,
@@ -221,6 +221,11 @@ export const usePickerValue = ({
221
221
  const context = {
222
222
  validationError
223
223
  };
224
+
225
+ // TODO v7: Remove 2nd condition
226
+ if (action.name === 'setValueFromShortcut' && action.shortcut != null) {
227
+ context.shortcut = action.shortcut;
228
+ }
224
229
  handleValueChange(action.value, context);
225
230
  }
226
231
  if (shouldCommit && onAccept) {
@@ -283,10 +288,13 @@ export const usePickerValue = ({
283
288
  value: newValue,
284
289
  selectionState
285
290
  }));
286
- const handleSelectShortcut = useEventCallback((newValue, changeImportance) => updateDate({
291
+
292
+ // TODO v7: Make changeImportance and label mandatory.
293
+ const handleSelectShortcut = useEventCallback((newValue, changeImportance, shortcut) => updateDate({
287
294
  name: 'setValueFromShortcut',
288
295
  value: newValue,
289
- changeImportance: changeImportance != null ? changeImportance : 'accept'
296
+ changeImportance: changeImportance != null ? changeImportance : 'accept',
297
+ shortcut
290
298
  }));
291
299
  const handleChangeFromField = useEventCallback((newValue, context) => updateDate({
292
300
  name: 'setValueFromField',
@@ -2,9 +2,9 @@ import { FieldChangeHandlerContext, UseFieldInternalProps } from '../useField';
2
2
  import { InferError, Validator } from '../useValidation';
3
3
  import { UseFieldValidationProps } from '../useField/useField.types';
4
4
  import { WrapperVariant } from '../../models/common';
5
- import { FieldSection, FieldSelectedSections, FieldValueType, TimezoneProps, MuiPickersAdapter, PickersTimezone } from '../../../models';
5
+ import { FieldSection, FieldSelectedSections, FieldValueType, TimezoneProps, MuiPickersAdapter, PickersTimezone, PickerChangeHandlerContext } from '../../../models';
6
6
  import { GetDefaultReferenceDateProps } from '../../utils/getDefaultReferenceDate';
7
- import { PickerShortcutChangeImportance } from '../../../PickersShortcuts';
7
+ import { PickerShortcutChangeImportance, PickersShortcutsItemContext } from '../../../PickersShortcuts';
8
8
  export interface PickerValueManager<TValue, TDate, TError> {
9
9
  /**
10
10
  * Determines if two values are equal.
@@ -105,9 +105,6 @@ export interface PickerValueManager<TValue, TDate, TError> {
105
105
  */
106
106
  setTimezone: (utils: MuiPickersAdapter<TDate>, timezone: PickersTimezone, value: TValue) => TValue;
107
107
  }
108
- export interface PickerChangeHandlerContext<TError> {
109
- validationError: TError;
110
- }
111
108
  export type PickerSelectionState = 'partial' | 'shallow' | 'finish';
112
109
  export interface UsePickerValueState<TValue> {
113
110
  /**
@@ -168,6 +165,7 @@ export type PickerValueUpdateAction<TValue, TError> = {
168
165
  name: 'setValueFromShortcut';
169
166
  value: TValue;
170
167
  changeImportance: PickerShortcutChangeImportance;
168
+ shortcut?: PickersShortcutsItemContext;
171
169
  };
172
170
  /**
173
171
  * Props used to handle the value that are common to all pickers.
@@ -31,6 +31,11 @@ export interface UsePickerViewsBaseProps<TValue, TView extends DateOrTimeViewWit
31
31
  * If `undefined`, internally defined view will be the used.
32
32
  */
33
33
  viewRenderers: PickerViewRendererLookup<TValue, TView, TExternalProps, TAdditionalProps>;
34
+ /**
35
+ * If `true`, disable heavy animations.
36
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
37
+ */
38
+ reduceAnimations?: boolean;
34
39
  }
35
40
  /**
36
41
  * Props used to handle the views of the pickers.
@@ -495,8 +495,8 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
495
495
  */
496
496
  readOnly: PropTypes.bool,
497
497
  /**
498
- * Disable heavy animations.
499
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
498
+ * If `true`, disable heavy animations.
499
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
500
500
  */
501
501
  reduceAnimations: PropTypes.bool,
502
502
  /**
@@ -240,8 +240,8 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
240
240
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
241
241
  readOnly: PropTypes.bool,
242
242
  /**
243
- * Disable heavy animations.
244
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
243
+ * If `true`, disable heavy animations.
244
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
245
245
  */
246
246
  reduceAnimations: PropTypes.bool,
247
247
  /**
@@ -278,8 +278,8 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
278
278
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
279
279
  readOnly: PropTypes.bool,
280
280
  /**
281
- * Disable heavy animations.
282
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
281
+ * If `true`, disable heavy animations.
282
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
283
283
  */
284
284
  reduceAnimations: PropTypes.bool,
285
285
  /**
@@ -258,8 +258,8 @@ DesktopDatePicker.propTypes = {
258
258
  orientation: PropTypes.oneOf(['landscape', 'portrait']),
259
259
  readOnly: PropTypes.bool,
260
260
  /**
261
- * Disable heavy animations.
262
- * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
261
+ * If `true`, disable heavy animations.
262
+ * @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
263
263
  */
264
264
  reduceAnimations: PropTypes.bool,
265
265
  /**