@mui/x-date-pickers 7.0.0-beta.7 → 7.1.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 (209) hide show
  1. package/AdapterDateFns/AdapterDateFns.js +1 -1
  2. package/AdapterDateFnsBase/AdapterDateFnsBase.js +1 -2
  3. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +2 -4
  4. package/AdapterDateFnsV3/AdapterDateFnsV3.js +1 -1
  5. package/AdapterDayjs/AdapterDayjs.js +2 -4
  6. package/AdapterLuxon/AdapterLuxon.js +12 -9
  7. package/AdapterMoment/AdapterMoment.js +5 -6
  8. package/CHANGELOG.md +266 -12
  9. package/DateCalendar/DateCalendar.js +14 -16
  10. package/DateCalendar/DayCalendar.js +5 -6
  11. package/DateField/DateField.js +3 -4
  12. package/DatePicker/DatePicker.js +1 -1
  13. package/DatePicker/DatePickerToolbar.js +11 -6
  14. package/DatePicker/shared.d.ts +2 -1
  15. package/DatePicker/shared.js +3 -5
  16. package/DateTimeField/DateTimeField.js +3 -4
  17. package/DateTimePicker/DateTimePicker.js +1 -1
  18. package/DateTimePicker/DateTimePickerToolbar.js +98 -46
  19. package/DateTimePicker/shared.d.ts +2 -1
  20. package/DateTimePicker/shared.js +11 -13
  21. package/DayCalendarSkeleton/DayCalendarSkeleton.js +12 -8
  22. package/DesktopDatePicker/DesktopDatePicker.js +7 -11
  23. package/DesktopDateTimePicker/DesktopDateTimePicker.js +72 -37
  24. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +12 -0
  25. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +101 -0
  26. package/DesktopDateTimePicker/index.d.ts +1 -0
  27. package/DesktopDateTimePicker/index.js +2 -1
  28. package/DesktopTimePicker/DesktopTimePicker.js +8 -12
  29. package/DigitalClock/DigitalClock.js +16 -9
  30. package/LocalizationProvider/LocalizationProvider.js +1 -2
  31. package/MobileDatePicker/MobileDatePicker.js +6 -10
  32. package/MobileDateTimePicker/MobileDateTimePicker.js +8 -12
  33. package/MobileTimePicker/MobileTimePicker.js +6 -10
  34. package/MonthCalendar/MonthCalendar.js +4 -4
  35. package/MonthCalendar/PickersMonth.js +13 -8
  36. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -1
  37. package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +1 -1
  38. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +16 -9
  39. package/PickersActionBar/PickersActionBar.js +1 -1
  40. package/PickersCalendarHeader/PickersCalendarHeader.js +17 -14
  41. package/PickersDay/PickersDay.js +30 -15
  42. package/PickersLayout/PickersLayout.js +31 -17
  43. package/PickersLayout/usePickerLayout.js +8 -9
  44. package/PickersSectionList/PickersSectionList.js +9 -11
  45. package/PickersTextField/PickersFilledInput/PickersFilledInput.js +138 -74
  46. package/PickersTextField/PickersInput/PickersInput.js +77 -55
  47. package/PickersTextField/PickersInputBase/PickersInputBase.js +67 -28
  48. package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +7 -0
  49. package/PickersTextField/PickersOutlinedInput/Outline.js +58 -41
  50. package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +33 -14
  51. package/README.md +1 -1
  52. package/StaticDatePicker/StaticDatePicker.js +4 -5
  53. package/StaticDateTimePicker/StaticDateTimePicker.js +6 -7
  54. package/StaticTimePicker/StaticTimePicker.js +3 -4
  55. package/TimeClock/Clock.js +48 -35
  56. package/TimeClock/ClockNumber.js +12 -7
  57. package/TimeClock/ClockPointer.js +23 -13
  58. package/TimeClock/TimeClock.js +1 -1
  59. package/TimeField/TimeField.js +2 -3
  60. package/TimePicker/TimePickerToolbar.js +25 -16
  61. package/TimePicker/shared.d.ts +2 -1
  62. package/TimePicker/shared.js +5 -7
  63. package/YearCalendar/PickersYear.js +12 -6
  64. package/YearCalendar/YearCalendar.js +5 -6
  65. package/hooks/useClearableField.js +6 -7
  66. package/index.js +1 -1
  67. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +19 -15
  68. package/internals/components/PickersModalDialog.js +6 -7
  69. package/internals/components/PickersPopper.js +25 -24
  70. package/internals/components/PickersToolbar.js +42 -24
  71. package/internals/hooks/date-helpers-hooks.js +1 -1
  72. package/internals/hooks/defaultizedFieldProps.js +15 -18
  73. package/internals/hooks/useClockReferenceDate.js +1 -1
  74. package/internals/hooks/useDesktopPicker/index.d.ts +1 -1
  75. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +11 -12
  76. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +2 -2
  77. package/internals/hooks/useField/buildSectionsFromFormat.js +35 -31
  78. package/internals/hooks/useField/useField.js +6 -4
  79. package/internals/hooks/useField/useField.types.d.ts +1 -0
  80. package/internals/hooks/useField/useField.utils.js +4 -7
  81. package/internals/hooks/useField/useFieldCharacterEditing.js +1 -2
  82. package/internals/hooks/useField/useFieldState.js +1 -1
  83. package/internals/hooks/useField/useFieldV6TextField.js +17 -18
  84. package/internals/hooks/useField/useFieldV7TextField.js +9 -11
  85. package/internals/hooks/useMobilePicker/useMobilePicker.js +7 -8
  86. package/internals/hooks/useOpenState.js +1 -1
  87. package/internals/hooks/usePicker/index.d.ts +1 -0
  88. package/internals/hooks/usePicker/usePickerViews.d.ts +4 -2
  89. package/internals/hooks/usePicker/usePickerViews.js +1 -2
  90. package/internals/hooks/useStaticPicker/useStaticPicker.js +13 -17
  91. package/internals/hooks/useValueWithTimezone.js +5 -6
  92. package/internals/hooks/useViews.js +3 -4
  93. package/internals/index.d.ts +1 -1
  94. package/internals/models/validation.d.ts +1 -1
  95. package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +3 -3
  96. package/internals/utils/date-time-utils.js +2 -5
  97. package/internals/utils/fields.js +1 -1
  98. package/internals/utils/getDefaultReferenceDate.js +2 -6
  99. package/internals/utils/views.js +1 -1
  100. package/locales/csCZ.js +1 -4
  101. package/locales/daDK.js +1 -4
  102. package/locales/deDE.js +1 -4
  103. package/locales/huHU.js +1 -4
  104. package/locales/itIT.js +16 -20
  105. package/locales/jaJP.js +1 -4
  106. package/locales/roRO.js +1 -4
  107. package/locales/skSK.js +1 -4
  108. package/locales/zhHK.js +14 -17
  109. package/modern/AdapterLuxon/AdapterLuxon.js +9 -4
  110. package/modern/DateCalendar/DateCalendar.js +1 -1
  111. package/modern/DateField/DateField.js +1 -1
  112. package/modern/DatePicker/DatePicker.js +1 -1
  113. package/modern/DatePicker/DatePickerToolbar.js +11 -6
  114. package/modern/DateTimeField/DateTimeField.js +1 -1
  115. package/modern/DateTimePicker/DateTimePicker.js +1 -1
  116. package/modern/DateTimePicker/DateTimePickerToolbar.js +97 -45
  117. package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +12 -8
  118. package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -1
  119. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +64 -25
  120. package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +101 -0
  121. package/modern/DesktopDateTimePicker/index.js +2 -1
  122. package/modern/DigitalClock/DigitalClock.js +14 -6
  123. package/modern/MobileDatePicker/MobileDatePicker.js +1 -1
  124. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
  125. package/modern/MonthCalendar/PickersMonth.js +12 -6
  126. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -4
  127. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +13 -9
  128. package/modern/PickersDay/PickersDay.js +30 -15
  129. package/modern/PickersLayout/PickersLayout.js +31 -17
  130. package/modern/PickersTextField/PickersFilledInput/PickersFilledInput.js +137 -72
  131. package/modern/PickersTextField/PickersInput/PickersInput.js +76 -54
  132. package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +64 -24
  133. package/modern/PickersTextField/PickersOutlinedInput/Outline.js +58 -41
  134. package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +31 -12
  135. package/modern/StaticDatePicker/StaticDatePicker.js +1 -1
  136. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
  137. package/modern/TimeClock/Clock.js +48 -35
  138. package/modern/TimeClock/ClockNumber.js +12 -7
  139. package/modern/TimeClock/ClockPointer.js +23 -13
  140. package/modern/TimePicker/TimePickerToolbar.js +25 -16
  141. package/modern/YearCalendar/PickersYear.js +12 -6
  142. package/modern/index.js +1 -1
  143. package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -6
  144. package/modern/internals/components/PickersPopper.js +13 -9
  145. package/modern/internals/components/PickersToolbar.js +39 -18
  146. package/modern/internals/hooks/useField/buildSectionsFromFormat.js +34 -30
  147. package/modern/internals/hooks/useField/useField.js +4 -2
  148. package/modern/internals/hooks/useField/useFieldV6TextField.js +8 -3
  149. package/modern/internals/hooks/useField/useFieldV7TextField.js +1 -1
  150. package/modern/internals/hooks/useOpenState.js +1 -1
  151. package/modern/internals/utils/fields.js +1 -1
  152. package/modern/locales/itIT.js +16 -20
  153. package/modern/locales/zhHK.js +14 -17
  154. package/node/AdapterLuxon/AdapterLuxon.js +9 -4
  155. package/node/DateCalendar/DateCalendar.js +1 -1
  156. package/node/DateField/DateField.js +1 -1
  157. package/node/DatePicker/DatePicker.js +1 -1
  158. package/node/DatePicker/DatePickerToolbar.js +11 -6
  159. package/node/DateTimeField/DateTimeField.js +1 -1
  160. package/node/DateTimePicker/DateTimePicker.js +1 -1
  161. package/node/DateTimePicker/DateTimePickerToolbar.js +97 -45
  162. package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +12 -8
  163. package/node/DesktopDatePicker/DesktopDatePicker.js +1 -1
  164. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +63 -25
  165. package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +108 -0
  166. package/node/DesktopDateTimePicker/index.js +8 -1
  167. package/node/DigitalClock/DigitalClock.js +14 -6
  168. package/node/MobileDatePicker/MobileDatePicker.js +1 -1
  169. package/node/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
  170. package/node/MonthCalendar/PickersMonth.js +12 -6
  171. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -4
  172. package/node/PickersCalendarHeader/PickersCalendarHeader.js +13 -9
  173. package/node/PickersDay/PickersDay.js +30 -15
  174. package/node/PickersLayout/PickersLayout.js +31 -17
  175. package/node/PickersTextField/PickersFilledInput/PickersFilledInput.js +137 -72
  176. package/node/PickersTextField/PickersInput/PickersInput.js +76 -54
  177. package/node/PickersTextField/PickersInputBase/PickersInputBase.js +64 -24
  178. package/node/PickersTextField/PickersOutlinedInput/Outline.js +58 -41
  179. package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +31 -12
  180. package/node/StaticDatePicker/StaticDatePicker.js +1 -1
  181. package/node/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
  182. package/node/TimeClock/Clock.js +48 -35
  183. package/node/TimeClock/ClockNumber.js +12 -7
  184. package/node/TimeClock/ClockPointer.js +23 -13
  185. package/node/TimePicker/TimePickerToolbar.js +25 -16
  186. package/node/YearCalendar/PickersYear.js +12 -6
  187. package/node/index.js +1 -1
  188. package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -6
  189. package/node/internals/components/PickersPopper.js +13 -9
  190. package/node/internals/components/PickersToolbar.js +39 -18
  191. package/node/internals/hooks/useField/buildSectionsFromFormat.js +34 -30
  192. package/node/internals/hooks/useField/useField.js +4 -2
  193. package/node/internals/hooks/useField/useFieldV6TextField.js +8 -3
  194. package/node/internals/hooks/useField/useFieldV7TextField.js +1 -1
  195. package/node/internals/hooks/useOpenState.js +1 -1
  196. package/node/internals/utils/fields.js +1 -1
  197. package/node/locales/itIT.js +16 -20
  198. package/node/locales/zhHK.js +14 -17
  199. package/package.json +5 -5
  200. package/timeViewRenderers/timeViewRenderers.js +1 -1
  201. package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +0 -15
  202. package/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -163
  203. package/dateTimeViewRenderers/index.d.ts +0 -2
  204. package/dateTimeViewRenderers/index.js +0 -1
  205. package/dateTimeViewRenderers/package.json +0 -6
  206. package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -162
  207. package/modern/dateTimeViewRenderers/index.js +0 -1
  208. package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -171
  209. package/node/dateTimeViewRenderers/index.js +0 -12
@@ -314,7 +314,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
314
314
  items: viewOptions.items,
315
315
  onChange: viewOptions.onChange,
316
316
  active: view === timeView,
317
- autoFocus: autoFocus != null ? autoFocus : focusedView === timeView,
317
+ autoFocus: autoFocus ?? focusedView === timeView,
318
318
  disabled: disabled,
319
319
  readOnly: readOnly,
320
320
  slots: slots,
@@ -11,7 +11,7 @@ export const getHourSectionOptions = ({
11
11
  const currentHours = value ? utils.getHours(value) : null;
12
12
  const result = [];
13
13
  const isSelected = (hour, overriddenCurrentHours) => {
14
- const resolvedCurrentHours = overriddenCurrentHours != null ? overriddenCurrentHours : currentHours;
14
+ const resolvedCurrentHours = overriddenCurrentHours ?? currentHours;
15
15
  if (resolvedCurrentHours === null) {
16
16
  return false;
17
17
  }
@@ -26,15 +26,14 @@ const MultiSectionDigitalClockSectionRoot = styled(MenuList, {
26
26
  slot: 'Root',
27
27
  overridesResolver: (_, styles) => styles.root
28
28
  })(({
29
- theme,
30
- ownerState
29
+ theme
31
30
  }) => ({
32
31
  maxHeight: DIGITAL_CLOCK_VIEW_HEIGHT,
33
32
  width: 56,
34
33
  padding: 0,
35
34
  overflow: 'hidden',
36
35
  '@media (prefers-reduced-motion: no-preference)': {
37
- scrollBehavior: ownerState.alreadyRendered ? 'smooth' : 'auto'
36
+ scrollBehavior: 'auto'
38
37
  },
39
38
  '@media (pointer: fine)': {
40
39
  '&:hover': {
@@ -52,7 +51,17 @@ const MultiSectionDigitalClockSectionRoot = styled(MenuList, {
52
51
  content: '""',
53
52
  // subtracting the height of one item, extra margin and borders to make sure the max height is correct
54
53
  height: 'calc(100% - 40px - 6px)'
55
- }
54
+ },
55
+ variants: [{
56
+ props: {
57
+ alreadyRendered: true
58
+ },
59
+ style: {
60
+ '@media (prefers-reduced-motion: no-preference)': {
61
+ scrollBehavior: 'smooth'
62
+ }
63
+ }
64
+ }]
56
65
  }));
57
66
  const MultiSectionDigitalClockSectionItem = styled(MenuItem, {
58
67
  name: 'MuiMultiSectionDigitalClockSection',
@@ -86,7 +95,6 @@ const MultiSectionDigitalClockSectionItem = styled(MenuItem, {
86
95
  * @ignore - internal component.
87
96
  */
88
97
  export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(function MultiSectionDigitalClockSection(inProps, ref) {
89
- var _slots$digitalClockSe;
90
98
  const containerRef = React.useRef(null);
91
99
  const handleRef = useForkRef(ref, containerRef);
92
100
  const previousActive = React.useRef(null);
@@ -111,7 +119,7 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
111
119
  alreadyRendered: !!containerRef.current
112
120
  }), [props]);
113
121
  const classes = useUtilityClasses(ownerState);
114
- const DigitalClockSectionItem = (_slots$digitalClockSe = slots == null ? void 0 : slots.digitalClockSectionItem) != null ? _slots$digitalClockSe : MultiSectionDigitalClockSectionItem;
122
+ const DigitalClockSectionItem = slots?.digitalClockSectionItem ?? MultiSectionDigitalClockSectionItem;
115
123
  React.useEffect(() => {
116
124
  if (containerRef.current === null) {
117
125
  return;
@@ -138,8 +146,7 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
138
146
  role: "listbox"
139
147
  }, other, {
140
148
  children: items.map((option, index) => {
141
- var _option$isDisabled;
142
- const isItemDisabled = (_option$isDisabled = option.isDisabled) == null ? void 0 : _option$isDisabled.call(option, option.value);
149
+ const isItemDisabled = option.isDisabled?.(option.value);
143
150
  const isDisabled = disabled || isItemDisabled;
144
151
  if (skipDisabled && isDisabled) {
145
152
  return null;
@@ -159,7 +166,7 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
159
166
  "aria-selected": isSelected,
160
167
  tabIndex: tabIndex,
161
168
  className: classes.item
162
- }, slotProps == null ? void 0 : slotProps.digitalClockSectionItem, {
169
+ }, slotProps?.digitalClockSectionItem, {
163
170
  children: option.label
164
171
  }), option.label);
165
172
  })
@@ -30,7 +30,7 @@ function PickersActionBar(props) {
30
30
  if (actions == null || actions.length === 0) {
31
31
  return null;
32
32
  }
33
- const buttons = actions == null ? void 0 : actions.map(actionType => {
33
+ const buttons = actions?.map(actionType => {
34
34
  switch (actionType) {
35
35
  case 'clear':
36
36
  return /*#__PURE__*/_jsx(Button, {
@@ -72,15 +72,19 @@ const PickersCalendarHeaderSwitchViewButton = styled(IconButton, {
72
72
  name: 'MuiPickersCalendarHeader',
73
73
  slot: 'SwitchViewButton',
74
74
  overridesResolver: (_, styles) => styles.switchViewButton
75
- })(({
76
- ownerState
77
- }) => _extends({
78
- marginRight: 'auto'
79
- }, ownerState.view === 'year' && {
80
- [`.${pickersCalendarHeaderClasses.switchViewIcon}`]: {
81
- transform: 'rotate(180deg)'
82
- }
83
- }));
75
+ })({
76
+ marginRight: 'auto',
77
+ variants: [{
78
+ props: {
79
+ view: 'year'
80
+ },
81
+ style: {
82
+ [`.${pickersCalendarHeaderClasses.switchViewIcon}`]: {
83
+ transform: 'rotate(180deg)'
84
+ }
85
+ }
86
+ }]
87
+ });
84
88
  const PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDownIcon, {
85
89
  name: 'MuiPickersCalendarHeader',
86
90
  slot: 'SwitchViewIcon',
@@ -104,7 +108,6 @@ const PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDownIcon, {
104
108
  * - [PickersCalendarHeader API](https://mui.com/x/api/date-pickers/pickers-calendar-header/)
105
109
  */
106
110
  const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalendarHeader(inProps, ref) {
107
- var _slots$switchViewButt, _slots$switchViewIcon;
108
111
  const localeText = useLocaleText();
109
112
  const utils = useUtils();
110
113
  const props = useThemeProps({
@@ -133,10 +136,10 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
133
136
  other = _objectWithoutPropertiesLoose(props, _excluded);
134
137
  const ownerState = props;
135
138
  const classes = useUtilityClasses(props);
136
- const SwitchViewButton = (_slots$switchViewButt = slots == null ? void 0 : slots.switchViewButton) != null ? _slots$switchViewButt : PickersCalendarHeaderSwitchViewButton;
139
+ const SwitchViewButton = slots?.switchViewButton ?? PickersCalendarHeaderSwitchViewButton;
137
140
  const switchViewButtonProps = useSlotProps({
138
141
  elementType: SwitchViewButton,
139
- externalSlotProps: slotProps == null ? void 0 : slotProps.switchViewButton,
142
+ externalSlotProps: slotProps?.switchViewButton,
140
143
  additionalProps: {
141
144
  size: 'small',
142
145
  'aria-label': localeText.calendarViewSwitchingButtonAriaLabel(view)
@@ -144,11 +147,11 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
144
147
  ownerState,
145
148
  className: classes.switchViewButton
146
149
  });
147
- const SwitchViewIcon = (_slots$switchViewIcon = slots == null ? void 0 : slots.switchViewIcon) != null ? _slots$switchViewIcon : PickersCalendarHeaderSwitchViewIcon;
150
+ const SwitchViewIcon = slots?.switchViewIcon ?? PickersCalendarHeaderSwitchViewIcon;
148
151
  // The spread is here to avoid this bug mui/material-ui#34056
149
152
  const _useSlotProps = useSlotProps({
150
153
  elementType: SwitchViewIcon,
151
- externalSlotProps: slotProps == null ? void 0 : slotProps.switchViewIcon,
154
+ externalSlotProps: slotProps?.switchViewIcon,
152
155
  ownerState: undefined,
153
156
  className: classes.switchViewIcon
154
157
  }),
@@ -30,8 +30,7 @@ const useUtilityClasses = ownerState => {
30
30
  return composeClasses(slots, getPickersDayUtilityClass, classes);
31
31
  };
32
32
  const styleArg = ({
33
- theme,
34
- ownerState
33
+ theme
35
34
  }) => _extends({}, theme.typography.caption, {
36
35
  width: DAY_SIZE,
37
36
  height: DAY_SIZE,
@@ -69,15 +68,33 @@ const styleArg = ({
69
68
  },
70
69
  [`&.${pickersDayClasses.disabled}&.${pickersDayClasses.selected}`]: {
71
70
  opacity: 0.6
72
- }
73
- }, !ownerState.disableMargin && {
74
- margin: `0 ${DAY_MARGIN}px`
75
- }, ownerState.outsideCurrentMonth && ownerState.showDaysOutsideCurrentMonth && {
76
- color: (theme.vars || theme).palette.text.secondary
77
- }, !ownerState.disableHighlightToday && ownerState.today && {
78
- [`&:not(.${pickersDayClasses.selected})`]: {
79
- border: `1px solid ${(theme.vars || theme).palette.text.secondary}`
80
- }
71
+ },
72
+ variants: [{
73
+ props: {
74
+ disableMargin: false
75
+ },
76
+ style: {
77
+ margin: `0 ${DAY_MARGIN}px`
78
+ }
79
+ }, {
80
+ props: {
81
+ outsideCurrentMonth: true,
82
+ showDaysOutsideCurrentMonth: true
83
+ },
84
+ style: {
85
+ color: (theme.vars || theme).palette.text.secondary
86
+ }
87
+ }, {
88
+ props: {
89
+ disableHighlightToday: false,
90
+ today: true
91
+ },
92
+ style: {
93
+ [`&:not(.${pickersDayClasses.selected})`]: {
94
+ border: `1px solid ${(theme.vars || theme).palette.text.secondary}`
95
+ }
96
+ }
97
+ }]
81
98
  });
82
99
  const overridesResolver = (props, styles) => {
83
100
  const {
@@ -95,11 +112,9 @@ const PickersDayFiller = styled('div', {
95
112
  slot: 'Root',
96
113
  overridesResolver
97
114
  })(({
98
- theme,
99
- ownerState
115
+ theme
100
116
  }) => _extends({}, styleArg({
101
- theme,
102
- ownerState
117
+ theme
103
118
  }), {
104
119
  // visibility: 'hidden' does not work here as it hides the element from screen readers as well
105
120
  opacity: 0,
@@ -23,30 +23,44 @@ const PickersLayoutRoot = styled('div', {
23
23
  slot: 'Root',
24
24
  overridesResolver: (props, styles) => styles.root
25
25
  })(({
26
- theme,
27
- ownerState
26
+ theme
28
27
  }) => ({
29
28
  display: 'grid',
30
29
  gridAutoColumns: 'max-content auto max-content',
31
30
  gridAutoRows: 'max-content auto max-content',
32
- [`& .${pickersLayoutClasses.toolbar}`]: ownerState.isLandscape ? {
33
- gridColumn: theme.direction === 'rtl' ? 3 : 1,
34
- gridRow: '2 / 3'
35
- } : {
36
- gridColumn: '2 / 4',
37
- gridRow: 1
38
- },
39
- [`.${pickersLayoutClasses.shortcuts}`]: ownerState.isLandscape ? {
40
- gridColumn: '2 / 4',
41
- gridRow: 1
42
- } : {
43
- gridColumn: theme.direction === 'rtl' ? 3 : 1,
44
- gridRow: '2 / 3'
45
- },
46
31
  [`& .${pickersLayoutClasses.actionBar}`]: {
47
32
  gridColumn: '1 / 4',
48
33
  gridRow: 3
49
- }
34
+ },
35
+ variants: [{
36
+ props: {
37
+ isLandscape: true
38
+ },
39
+ style: {
40
+ [`& .${pickersLayoutClasses.toolbar}`]: {
41
+ gridColumn: theme.direction === 'rtl' ? 3 : 1,
42
+ gridRow: '2 / 3'
43
+ },
44
+ [`.${pickersLayoutClasses.shortcuts}`]: {
45
+ gridColumn: '2 / 4',
46
+ gridRow: 1
47
+ }
48
+ }
49
+ }, {
50
+ props: {
51
+ isLandscape: false
52
+ },
53
+ style: {
54
+ [`& .${pickersLayoutClasses.toolbar}`]: {
55
+ gridColumn: '2 / 4',
56
+ gridRow: 1
57
+ },
58
+ [`& .${pickersLayoutClasses.shortcuts}`]: {
59
+ gridColumn: theme.direction === 'rtl' ? 3 : 1,
60
+ gridRow: '2 / 3'
61
+ }
62
+ }
63
+ }]
50
64
  }));
51
65
  PickersLayoutRoot.propTypes = {
52
66
  // ----------------------------- Warning --------------------------------
@@ -26,7 +26,6 @@ const useUtilityClasses = ownerState => {
26
26
  return composeClasses(slots, getPickersLayoutUtilityClass, classes);
27
27
  };
28
28
  const usePickerLayout = props => {
29
- var _slots$actionBar, _slots$shortcuts;
30
29
  const {
31
30
  wrapperVariant,
32
31
  onAccept,
@@ -55,10 +54,10 @@ const usePickerLayout = props => {
55
54
 
56
55
  // Action bar
57
56
 
58
- const ActionBar = (_slots$actionBar = slots == null ? void 0 : slots.actionBar) != null ? _slots$actionBar : PickersActionBar;
57
+ const ActionBar = slots?.actionBar ?? PickersActionBar;
59
58
  const actionBarProps = useSlotProps({
60
59
  elementType: ActionBar,
61
- externalSlotProps: slotProps == null ? void 0 : slotProps.actionBar,
60
+ externalSlotProps: slotProps?.actionBar,
62
61
  additionalProps: {
63
62
  onAccept,
64
63
  onClear,
@@ -75,10 +74,10 @@ const usePickerLayout = props => {
75
74
 
76
75
  // Toolbar
77
76
 
78
- const Toolbar = slots == null ? void 0 : slots.toolbar;
77
+ const Toolbar = slots?.toolbar;
79
78
  const toolbarProps = useSlotProps({
80
79
  elementType: Toolbar,
81
- externalSlotProps: slotProps == null ? void 0 : slotProps.toolbar,
80
+ externalSlotProps: slotProps?.toolbar,
82
81
  additionalProps: {
83
82
  isLandscape,
84
83
  onChange,
@@ -102,19 +101,19 @@ const usePickerLayout = props => {
102
101
 
103
102
  // Tabs
104
103
 
105
- const Tabs = slots == null ? void 0 : slots.tabs;
104
+ const Tabs = slots?.tabs;
106
105
  const tabs = view && Tabs ? /*#__PURE__*/_jsx(Tabs, _extends({
107
106
  view: view,
108
107
  onViewChange: onViewChange,
109
108
  className: classes.tabs
110
- }, slotProps == null ? void 0 : slotProps.tabs)) : null;
109
+ }, slotProps?.tabs)) : null;
111
110
 
112
111
  // Shortcuts
113
112
 
114
- const Shortcuts = (_slots$shortcuts = slots == null ? void 0 : slots.shortcuts) != null ? _slots$shortcuts : PickersShortcuts;
113
+ const Shortcuts = slots?.shortcuts ?? PickersShortcuts;
115
114
  const shortcutsProps = useSlotProps({
116
115
  elementType: Shortcuts,
117
- externalSlotProps: slotProps == null ? void 0 : slotProps.shortcuts,
116
+ externalSlotProps: slotProps?.shortcuts,
118
117
  additionalProps: {
119
118
  isValid,
120
119
  isLandscape,
@@ -58,25 +58,24 @@ const useUtilityClasses = ownerState => {
58
58
  * - [PickersSectionList API](https://mui.com/x/api/date-pickers/pickers-section-list/)
59
59
  */
60
60
  function PickersSection(props) {
61
- var _slots$section, _slots$sectionContent, _slots$sectionSeparat;
62
61
  const {
63
62
  slots,
64
63
  slotProps,
65
64
  element,
66
65
  classes
67
66
  } = props;
68
- const Section = (_slots$section = slots == null ? void 0 : slots.section) != null ? _slots$section : PickersSectionListSection;
67
+ const Section = slots?.section ?? PickersSectionListSection;
69
68
  const sectionProps = useSlotProps({
70
69
  elementType: Section,
71
- externalSlotProps: slotProps == null ? void 0 : slotProps.section,
70
+ externalSlotProps: slotProps?.section,
72
71
  externalForwardedProps: element.container,
73
72
  className: classes.section,
74
73
  ownerState: {}
75
74
  });
76
- const SectionContent = (_slots$sectionContent = slots == null ? void 0 : slots.sectionContent) != null ? _slots$sectionContent : PickersSectionListSectionContent;
75
+ const SectionContent = slots?.sectionContent ?? PickersSectionListSectionContent;
77
76
  const sectionContentProps = useSlotProps({
78
77
  elementType: SectionContent,
79
- externalSlotProps: slotProps == null ? void 0 : slotProps.sectionContent,
78
+ externalSlotProps: slotProps?.sectionContent,
80
79
  externalForwardedProps: element.content,
81
80
  additionalProps: {
82
81
  suppressContentEditableWarning: true
@@ -84,10 +83,10 @@ function PickersSection(props) {
84
83
  className: classes.sectionContent,
85
84
  ownerState: {}
86
85
  });
87
- const SectionSeparator = (_slots$sectionSeparat = slots == null ? void 0 : slots.sectionSeparator) != null ? _slots$sectionSeparat : PickersSectionListSectionSeparator;
86
+ const SectionSeparator = slots?.sectionSeparator ?? PickersSectionListSectionSeparator;
88
87
  const sectionSeparatorBeforeProps = useSlotProps({
89
88
  elementType: SectionSeparator,
90
- externalSlotProps: slotProps == null ? void 0 : slotProps.sectionSeparator,
89
+ externalSlotProps: slotProps?.sectionSeparator,
91
90
  externalForwardedProps: element.before,
92
91
  ownerState: {
93
92
  position: 'before'
@@ -95,7 +94,7 @@ function PickersSection(props) {
95
94
  });
96
95
  const sectionSeparatorAfterProps = useSlotProps({
97
96
  elementType: SectionSeparator,
98
- externalSlotProps: slotProps == null ? void 0 : slotProps.sectionSeparator,
97
+ externalSlotProps: slotProps?.sectionSeparator,
99
98
  externalForwardedProps: element.after,
100
99
  ownerState: {
101
100
  position: 'after'
@@ -106,7 +105,6 @@ function PickersSection(props) {
106
105
  }));
107
106
  }
108
107
  const PickersSectionList = /*#__PURE__*/React.forwardRef(function PickersSectionList(inProps, ref) {
109
- var _slots$root;
110
108
  const props = useThemeProps({
111
109
  props: inProps,
112
110
  name: 'MuiPickersSectionList'
@@ -156,10 +154,10 @@ const PickersSectionList = /*#__PURE__*/React.forwardRef(function PickersSection
156
154
  return Number(sectionContainer.dataset.sectionindex);
157
155
  }
158
156
  }));
159
- const Root = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : PickersSectionListRoot;
157
+ const Root = slots?.root ?? PickersSectionListRoot;
160
158
  const rootProps = useSlotProps({
161
159
  elementType: Root,
162
- externalSlotProps: slotProps == null ? void 0 : slotProps.root,
160
+ externalSlotProps: slotProps?.root,
163
161
  externalForwardedProps: other,
164
162
  additionalProps: {
165
163
  ref: handleRootRef,