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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/AdapterMoment/AdapterMoment.js +10 -0
  2. package/CHANGELOG.md +651 -6
  3. package/DateCalendar/DateCalendar.js +1 -0
  4. package/DateCalendar/DateCalendar.types.d.ts +2 -1
  5. package/DateCalendar/PickersFadeTransitionGroup.js +4 -6
  6. package/DateCalendar/PickersSlideTransition.js +12 -5
  7. package/DateCalendar/useCalendarState.d.ts +6 -4
  8. package/DateField/DateField.js +5 -4
  9. package/DateField/DateField.types.d.ts +10 -9
  10. package/DatePicker/DatePicker.types.d.ts +3 -3
  11. package/DatePicker/DatePickerToolbar.d.ts +3 -2
  12. package/DatePicker/DatePickerToolbar.js +0 -12
  13. package/DatePicker/shared.d.ts +6 -5
  14. package/DateTimeField/DateTimeField.js +5 -4
  15. package/DateTimeField/DateTimeField.types.d.ts +10 -10
  16. package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
  17. package/DateTimePicker/DateTimePickerTabs.js +8 -6
  18. package/DateTimePicker/DateTimePickerToolbar.d.ts +3 -4
  19. package/DateTimePicker/DateTimePickerToolbar.js +6 -15
  20. package/DateTimePicker/shared.d.ts +6 -6
  21. package/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
  22. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +2 -1
  23. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -33
  24. package/DigitalClock/DigitalClock.js +1 -0
  25. package/MonthCalendar/MonthCalendar.js +1 -0
  26. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  27. package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +6 -6
  28. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +4 -4
  29. package/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
  30. package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -4
  31. package/PickersLayout/PickersLayout.d.ts +7 -5
  32. package/PickersLayout/PickersLayout.js +22 -39
  33. package/PickersLayout/PickersLayout.types.d.ts +14 -15
  34. package/PickersLayout/usePickerLayout.d.ts +5 -4
  35. package/PickersLayout/usePickerLayout.js +20 -17
  36. package/PickersShortcuts/PickersShortcuts.d.ts +7 -6
  37. package/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
  38. package/PickersTextField/PickersTextField.js +2 -2
  39. package/README.md +9 -6
  40. package/TimeClock/Clock.js +1 -0
  41. package/TimeClock/TimeClock.js +1 -0
  42. package/TimeField/TimeField.js +5 -4
  43. package/TimeField/TimeField.types.d.ts +10 -10
  44. package/TimePicker/TimePicker.types.d.ts +3 -3
  45. package/TimePicker/TimePickerToolbar.d.ts +2 -3
  46. package/TimePicker/TimePickerToolbar.js +6 -15
  47. package/TimePicker/shared.d.ts +6 -6
  48. package/YearCalendar/YearCalendar.js +1 -0
  49. package/hooks/useParsedFormat.d.ts +2 -2
  50. package/hooks/useParsedFormat.js +1 -1
  51. package/hooks/useSplitFieldProps.d.ts +3 -3
  52. package/index.js +1 -1
  53. package/internals/components/PickerProvider.d.ts +26 -0
  54. package/internals/components/PickerProvider.js +3 -1
  55. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
  56. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +11 -8
  57. package/internals/components/PickersToolbar.d.ts +3 -3
  58. package/internals/components/PickersToolbar.js +2 -4
  59. package/internals/hooks/useClockReferenceDate.d.ts +2 -1
  60. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
  61. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -14
  62. package/internals/hooks/useField/useField.d.ts +3 -3
  63. package/internals/hooks/useField/useField.types.d.ts +46 -46
  64. package/internals/hooks/useField/useField.utils.d.ts +4 -3
  65. package/internals/hooks/useField/useFieldCharacterEditing.d.ts +6 -5
  66. package/internals/hooks/useField/useFieldState.d.ts +9 -8
  67. package/internals/hooks/useField/useFieldState.js +1 -1
  68. package/internals/hooks/useField/useFieldV6TextField.d.ts +4 -3
  69. package/internals/hooks/useField/useFieldV7TextField.js +2 -1
  70. package/internals/hooks/useFieldOwnerState.d.ts +6 -0
  71. package/internals/hooks/useFieldOwnerState.js +12 -0
  72. package/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
  73. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +11 -11
  74. package/internals/hooks/usePicker/usePicker.d.ts +3 -3
  75. package/internals/hooks/usePicker/usePicker.js +10 -19
  76. package/internals/hooks/usePicker/usePicker.types.d.ts +8 -8
  77. package/internals/hooks/usePicker/usePickerProvider.d.ts +21 -6
  78. package/internals/hooks/usePicker/usePickerProvider.js +61 -5
  79. package/internals/hooks/usePicker/usePickerValue.d.ts +3 -2
  80. package/internals/hooks/usePicker/usePickerValue.js +18 -7
  81. package/internals/hooks/usePicker/usePickerValue.types.d.ts +32 -30
  82. package/internals/hooks/usePicker/usePickerViews.d.ts +11 -10
  83. package/internals/hooks/usePicker/usePickerViews.js +1 -0
  84. package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
  85. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -6
  86. package/internals/hooks/useValueWithTimezone.d.ts +20 -15
  87. package/internals/hooks/useValueWithTimezone.js +13 -1
  88. package/internals/hooks/useViews.d.ts +5 -5
  89. package/internals/index.d.ts +5 -3
  90. package/internals/index.js +1 -0
  91. package/internals/models/common.d.ts +2 -1
  92. package/internals/models/fields.d.ts +6 -1
  93. package/internals/models/pickers.d.ts +1 -0
  94. package/internals/models/pickers.js +1 -0
  95. package/internals/models/props/basePickerProps.d.ts +4 -3
  96. package/internals/models/props/time.d.ts +2 -1
  97. package/internals/models/props/toolbar.d.ts +2 -2
  98. package/internals/models/value.d.ts +9 -0
  99. package/internals/utils/date-utils.d.ts +3 -3
  100. package/internals/utils/valueManagers.d.ts +4 -3
  101. package/locales/nlNL.js +7 -7
  102. package/models/adapters.d.ts +4 -4
  103. package/models/common.d.ts +1 -0
  104. package/models/fields.d.ts +19 -6
  105. package/models/pickers.d.ts +18 -0
  106. package/models/validation.d.ts +2 -1
  107. package/modern/AdapterMoment/AdapterMoment.js +10 -0
  108. package/modern/DateCalendar/DateCalendar.js +1 -0
  109. package/modern/DateCalendar/PickersFadeTransitionGroup.js +4 -6
  110. package/modern/DateCalendar/PickersSlideTransition.js +12 -5
  111. package/modern/DateField/DateField.js +5 -4
  112. package/modern/DatePicker/DatePickerToolbar.js +0 -12
  113. package/modern/DateTimeField/DateTimeField.js +5 -4
  114. package/modern/DateTimePicker/DateTimePickerTabs.js +8 -6
  115. package/modern/DateTimePicker/DateTimePickerToolbar.js +6 -15
  116. package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
  117. package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -33
  118. package/modern/DigitalClock/DigitalClock.js +1 -0
  119. package/modern/MonthCalendar/MonthCalendar.js +1 -0
  120. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  121. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
  122. package/modern/PickersLayout/PickersLayout.js +22 -39
  123. package/modern/PickersLayout/usePickerLayout.js +20 -17
  124. package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
  125. package/modern/PickersTextField/PickersTextField.js +2 -2
  126. package/modern/TimeClock/Clock.js +1 -0
  127. package/modern/TimeClock/TimeClock.js +1 -0
  128. package/modern/TimeField/TimeField.js +5 -4
  129. package/modern/TimePicker/TimePickerToolbar.js +6 -15
  130. package/modern/YearCalendar/YearCalendar.js +1 -0
  131. package/modern/hooks/useParsedFormat.js +1 -1
  132. package/modern/index.js +1 -1
  133. package/modern/internals/components/PickerProvider.js +3 -1
  134. package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
  135. package/modern/internals/components/PickersToolbar.js +2 -4
  136. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
  137. package/modern/internals/hooks/useField/useFieldState.js +1 -1
  138. package/modern/internals/hooks/useField/useFieldV7TextField.js +2 -1
  139. package/modern/internals/hooks/useFieldOwnerState.js +12 -0
  140. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
  141. package/modern/internals/hooks/usePicker/usePicker.js +10 -19
  142. package/modern/internals/hooks/usePicker/usePickerProvider.js +61 -5
  143. package/modern/internals/hooks/usePicker/usePickerValue.js +18 -7
  144. package/modern/internals/hooks/usePicker/usePickerViews.js +1 -0
  145. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
  146. package/modern/internals/hooks/useValueWithTimezone.js +13 -1
  147. package/modern/internals/index.js +1 -0
  148. package/modern/internals/models/pickers.js +1 -0
  149. package/modern/locales/nlNL.js +7 -7
  150. package/modern/validation/useValidation.js +1 -1
  151. package/modern/validation/validateDate.js +8 -0
  152. package/modern/validation/validateDateTime.js +8 -0
  153. package/modern/validation/validateTime.js +8 -0
  154. package/node/AdapterMoment/AdapterMoment.js +10 -0
  155. package/node/DateCalendar/DateCalendar.js +1 -0
  156. package/node/DateCalendar/PickersFadeTransitionGroup.js +4 -6
  157. package/node/DateCalendar/PickersSlideTransition.js +12 -5
  158. package/node/DateField/DateField.js +5 -4
  159. package/node/DatePicker/DatePickerToolbar.js +0 -12
  160. package/node/DateTimeField/DateTimeField.js +5 -4
  161. package/node/DateTimePicker/DateTimePickerTabs.js +8 -6
  162. package/node/DateTimePicker/DateTimePickerToolbar.js +6 -15
  163. package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
  164. package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -34
  165. package/node/DigitalClock/DigitalClock.js +1 -0
  166. package/node/MonthCalendar/MonthCalendar.js +1 -0
  167. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  168. package/node/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
  169. package/node/PickersLayout/PickersLayout.js +22 -39
  170. package/node/PickersLayout/usePickerLayout.js +20 -17
  171. package/node/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
  172. package/node/PickersTextField/PickersTextField.js +2 -2
  173. package/node/TimeClock/Clock.js +1 -0
  174. package/node/TimeClock/TimeClock.js +1 -0
  175. package/node/TimeField/TimeField.js +5 -4
  176. package/node/TimePicker/TimePickerToolbar.js +6 -15
  177. package/node/YearCalendar/YearCalendar.js +1 -0
  178. package/node/hooks/useParsedFormat.js +1 -1
  179. package/node/index.js +1 -1
  180. package/node/internals/components/PickerProvider.js +3 -1
  181. package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
  182. package/node/internals/components/PickersToolbar.js +2 -4
  183. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
  184. package/node/internals/hooks/useField/useFieldState.js +1 -1
  185. package/node/internals/hooks/useField/useFieldV7TextField.js +2 -1
  186. package/node/internals/hooks/useFieldOwnerState.js +20 -0
  187. package/node/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
  188. package/node/internals/hooks/usePicker/usePicker.js +11 -19
  189. package/node/internals/hooks/usePicker/usePickerProvider.js +64 -5
  190. package/node/internals/hooks/usePicker/usePickerValue.js +18 -6
  191. package/node/internals/hooks/usePicker/usePickerViews.js +1 -0
  192. package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
  193. package/node/internals/hooks/useValueWithTimezone.js +13 -1
  194. package/node/internals/index.js +7 -0
  195. package/node/internals/models/pickers.js +5 -0
  196. package/node/locales/nlNL.js +7 -7
  197. package/node/validation/useValidation.js +1 -1
  198. package/node/validation/validateDate.js +8 -0
  199. package/node/validation/validateDateTime.js +8 -0
  200. package/node/validation/validateTime.js +8 -0
  201. package/package.json +4 -4
  202. package/themeAugmentation/overrides.d.ts +1 -1
  203. package/themeAugmentation/props.d.ts +3 -2
  204. package/validation/useValidation.d.ts +7 -6
  205. package/validation/useValidation.js +1 -1
  206. package/validation/validateDate.d.ts +12 -3
  207. package/validation/validateDate.js +8 -0
  208. package/validation/validateDateTime.d.ts +12 -4
  209. package/validation/validateDateTime.js +8 -0
  210. package/validation/validateTime.d.ts +12 -3
  211. package/validation/validateTime.js +8 -0
  212. package/internals/hooks/useIsLandscape.d.ts +0 -4
  213. package/internals/hooks/useIsLandscape.js +0 -35
  214. package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +0 -33
  215. package/internals/hooks/usePicker/usePickerLayoutProps.js +0 -34
  216. package/internals/hooks/usePicker/usePickerOwnerState.d.ts +0 -10
  217. package/internals/hooks/usePicker/usePickerOwnerState.js +0 -16
  218. package/modern/internals/hooks/useIsLandscape.js +0 -35
  219. package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +0 -34
  220. package/modern/internals/hooks/usePicker/usePickerOwnerState.js +0 -16
  221. package/node/internals/hooks/useIsLandscape.js +0 -43
  222. package/node/internals/hooks/usePicker/usePickerLayoutProps.js +0 -41
  223. package/node/internals/hooks/usePicker/usePickerOwnerState.js +0 -23
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef"];
3
+ const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef", "onFocus", "onBlur"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useFormControl } from '@mui/material/FormControl';
@@ -194,7 +194,9 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
194
194
  readOnly,
195
195
  inputProps,
196
196
  inputRef,
197
- sectionListRef
197
+ sectionListRef,
198
+ onFocus,
199
+ onBlur
198
200
  } = props,
199
201
  other = _objectWithoutPropertiesLoose(props, _excluded);
200
202
  const rootRef = React.useRef(null);
@@ -206,13 +208,12 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
206
208
  throw new Error('MUI X: PickersInputBase should always be used inside a PickersTextField component');
207
209
  }
208
210
  const handleInputFocus = event => {
209
- // Fix a bug with IE11 where the focus/blur events are triggered
210
- // while the component is disabled.
211
- if (muiFormControl.disabled) {
212
- event.stopPropagation();
213
- return;
214
- }
215
211
  muiFormControl.onFocus?.(event);
212
+ onFocus?.(event);
213
+ };
214
+ const handleInputBlur = event => {
215
+ muiFormControl.onBlur?.(event);
216
+ onBlur?.(event);
216
217
  };
217
218
  React.useEffect(() => {
218
219
  if (muiFormControl) {
@@ -254,7 +255,7 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
254
255
  tabIndex: tabIndex,
255
256
  className: classes.sectionsContainer,
256
257
  onFocus: handleInputFocus,
257
- onBlur: muiFormControl.onBlur,
258
+ onBlur: handleInputBlur,
258
259
  onInput: onInput,
259
260
  onPaste: onPaste,
260
261
  onKeyDown: onKeyDown,
@@ -105,8 +105,6 @@ const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField
105
105
  className: clsx(classes.root, className),
106
106
  ref: handleRootRef,
107
107
  focused: focused,
108
- onFocus: onFocus,
109
- onBlur: onBlur,
110
108
  disabled: disabled,
111
109
  variant: variant,
112
110
  error: error,
@@ -128,6 +126,8 @@ const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField
128
126
  onKeyUp: onKeyUp,
129
127
  onInput: onInput,
130
128
  onPaste: onPaste,
129
+ onFocus: onFocus,
130
+ onBlur: onBlur,
131
131
  endAdornment: endAdornment,
132
132
  startAdornment: startAdornment,
133
133
  tabIndex: tabIndex,
package/README.md CHANGED
@@ -20,13 +20,16 @@ The pickers currently support the following date libraries:
20
20
  - [Moment.js](https://momentjs.com/)
21
21
 
22
22
  ```bash
23
- // date-fns
23
+ # date-fns
24
24
  npm install date-fns
25
- // or dayjs
25
+
26
+ # or dayjs
26
27
  npm install dayjs
27
- // or luxon
28
+
29
+ # or luxon
28
30
  npm install luxon
29
- // or moment
31
+
32
+ # or moment
30
33
  npm install moment
31
34
  ```
32
35
 
@@ -35,8 +38,8 @@ This component has the following peer dependencies that you need to install as w
35
38
  ```json
36
39
  "peerDependencies": {
37
40
  "@mui/material": "^5.15.14 || ^6.0.0",
38
- "react": "^17.0.0 || ^18.0.0",
39
- "react-dom": "^17.0.0 || ^18.0.0"
41
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
42
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
40
43
  },
41
44
  ```
42
45
 
@@ -222,6 +222,7 @@ export function Clock(inProps) {
222
222
  setTime(event, 'finish');
223
223
  isMoving.current = false;
224
224
  }
225
+ event.preventDefault();
225
226
  };
226
227
  const handleMouseMove = event => {
227
228
  // event.buttons & PRIMARY_MOUSE_BUTTON
@@ -107,6 +107,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
107
107
  timezone: timezoneProp,
108
108
  value: valueProp,
109
109
  defaultValue,
110
+ referenceDate: referenceDateProp,
110
111
  onChange,
111
112
  valueManager: singleItemValueManager
112
113
  });
@@ -13,6 +13,7 @@ import { useTimeField } from "./useTimeField.js";
13
13
  import { useClearableField } from "../hooks/index.js";
14
14
  import { PickersTextField } from "../PickersTextField/index.js";
15
15
  import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
16
+ import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  /**
18
19
  * Demos:
@@ -36,7 +37,7 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, inRe
36
37
  inputProps
37
38
  } = themeProps,
38
39
  other = _objectWithoutPropertiesLoose(themeProps, _excluded);
39
- const ownerState = themeProps;
40
+ const ownerState = useFieldOwnerState(themeProps);
40
41
  const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
41
42
  const textFieldProps = useSlotProps({
42
43
  elementType: TextField,
@@ -268,10 +269,10 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
268
269
  */
269
270
  shouldDisableTime: PropTypes.func,
270
271
  /**
271
- * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
272
- * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
272
+ * If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
273
+ * If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
273
274
  *
274
- * Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (e.g: "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
275
+ * Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
275
276
  *
276
277
  * Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
277
278
  * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
@@ -1,13 +1,14 @@
1
1
  import * as React from 'react';
2
- import { SlotComponentProps } from '@mui/utils';
3
- import { MakeOptional } from '@mui/x-internals/types';
4
- import TextField from '@mui/material/TextField';
2
+ import type { TextFieldProps } from '@mui/material/TextField';
3
+ import { MakeOptional, SlotComponentPropsFromProps } from '@mui/x-internals/types';
5
4
  import { UseFieldInternalProps } from '../internals/hooks/useField';
6
- import { FieldSection, PickerValidDate, TimeValidationError, BuiltInFieldTextFieldProps } from '../models';
5
+ import { TimeValidationError, BuiltInFieldTextFieldProps, FieldOwnerState } from '../models';
7
6
  import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '../hooks/useClearableField';
8
7
  import { ExportedValidateTimeProps } from '../validation/validateTime';
9
8
  import { AmPmProps } from '../internals/models/props/time';
10
- export interface UseTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValidDate | null, FieldSection, TEnableAccessibleFieldDOMStructure, TimeValidationError>, 'format'>, ExportedValidateTimeProps, ExportedUseClearableFieldProps, AmPmProps {
9
+ import { PickerValue } from '../internals/models';
10
+ import { PickersTextFieldProps } from '../PickersTextField';
11
+ export interface UseTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, TimeValidationError>, 'format'>, ExportedValidateTimeProps, ExportedUseClearableFieldProps, AmPmProps {
11
12
  }
12
13
  export type TimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = UseTimeFieldProps<TEnableAccessibleFieldDOMStructure> & Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>> & {
13
14
  /**
@@ -19,16 +20,15 @@ export type TimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean =
19
20
  * The props used for each component slot.
20
21
  * @default {}
21
22
  */
22
- slotProps?: TimeFieldSlotProps<TEnableAccessibleFieldDOMStructure>;
23
+ slotProps?: TimeFieldSlotProps;
23
24
  };
24
- export type TimeFieldOwnerState<TEnableAccessibleFieldDOMStructure extends boolean> = TimeFieldProps<TEnableAccessibleFieldDOMStructure>;
25
25
  export interface TimeFieldSlots extends UseClearableFieldSlots {
26
26
  /**
27
27
  * Form control with an input to render the value.
28
- * @default TextField from '@mui/material' or PickersTextField if `enableAccessibleFieldDOMStructure` is `true`.
28
+ * @default <PickersTextField />, or <TextField /> from '@mui/material' if `enableAccessibleFieldDOMStructure` is `false`.
29
29
  */
30
30
  textField?: React.ElementType;
31
31
  }
32
- export interface TimeFieldSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends UseClearableFieldSlotProps {
33
- textField?: SlotComponentProps<typeof TextField, {}, TimeFieldOwnerState<TEnableAccessibleFieldDOMStructure>>;
32
+ export interface TimeFieldSlotProps extends UseClearableFieldSlotProps {
33
+ textField?: SlotComponentPropsFromProps<PickersTextFieldProps | TextFieldProps, {}, FieldOwnerState>;
34
34
  }
@@ -1,7 +1,7 @@
1
1
  import { DesktopTimePickerProps, DesktopTimePickerSlots, DesktopTimePickerSlotProps } from '../DesktopTimePicker';
2
- import { BaseSingleInputFieldProps, TimeViewWithMeridiem } from '../internals/models';
2
+ import { BaseSingleInputFieldProps, PickerValue, TimeViewWithMeridiem } from '../internals/models';
3
3
  import { MobileTimePickerProps, MobileTimePickerSlots, MobileTimePickerSlotProps } from '../MobileTimePicker';
4
- import { FieldSection, PickerValidDate, TimeValidationError } from '../models';
4
+ import { TimeValidationError } from '../models';
5
5
  import { ValidateTimeProps } from '../validation/validateTime';
6
6
  export interface TimePickerSlots extends DesktopTimePickerSlots, MobileTimePickerSlots<TimeViewWithMeridiem> {
7
7
  }
@@ -28,4 +28,4 @@ export interface TimePickerProps<TEnableAccessibleFieldDOMStructure extends bool
28
28
  /**
29
29
  * Props the field can receive when used inside a time picker (<TimePicker />, <DesktopTimePicker /> or <MobileTimePicker /> component).
30
30
  */
31
- export type TimePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateTimeProps & BaseSingleInputFieldProps<PickerValidDate | null, FieldSection, TEnableAccessibleFieldDOMStructure, TimeValidationError>;
31
+ export type TimePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateTimeProps & BaseSingleInputFieldProps<PickerValue, TEnableAccessibleFieldDOMStructure, TimeValidationError>;
@@ -1,9 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar';
3
3
  import { TimePickerToolbarClasses } from './timePickerToolbarClasses';
4
- import { TimeViewWithMeridiem } from '../internals/models';
5
- import { PickerValidDate } from '../models';
6
- export interface TimePickerToolbarProps extends BaseToolbarProps<PickerValidDate | null, TimeViewWithMeridiem>, ExportedTimePickerToolbarProps {
4
+ import { PickerValue, TimeViewWithMeridiem } from '../internals/models';
5
+ export interface TimePickerToolbarProps extends BaseToolbarProps<PickerValue, TimeViewWithMeridiem>, ExportedTimePickerToolbarProps {
7
6
  ampm?: boolean;
8
7
  ampmInClock?: boolean;
9
8
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "view", "onViewChange", "views", "disabled", "readOnly", "className"];
5
+ const _excluded = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "view", "onViewChange", "views", "className"];
6
6
  import * as React from 'react';
7
7
  import clsx from 'clsx';
8
8
  import PropTypes from 'prop-types';
@@ -18,6 +18,7 @@ import { useUtils } from "../internals/hooks/useUtils.js";
18
18
  import { useMeridiemMode } from "../internals/hooks/date-helpers-hooks.js";
19
19
  import { getTimePickerToolbarUtilityClass, timePickerToolbarClasses } from "./timePickerToolbarClasses.js";
20
20
  import { formatMeridiem } from "../internals/utils/date-utils.js";
21
+ import { usePickerContext } from "../hooks/index.js";
21
22
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
23
  const useUtilityClasses = ownerState => {
23
24
  const {
@@ -128,14 +129,16 @@ function TimePickerToolbar(inProps) {
128
129
  view,
129
130
  onViewChange,
130
131
  views,
131
- disabled,
132
- readOnly,
133
132
  className
134
133
  } = props,
135
134
  other = _objectWithoutPropertiesLoose(props, _excluded);
136
135
  const utils = useUtils();
137
136
  const translations = usePickerTranslations();
138
137
  const isRtl = useRtl();
138
+ const {
139
+ disabled,
140
+ readOnly
141
+ } = usePickerContext();
139
142
  const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes('hours'));
140
143
  const {
141
144
  meridiemMode,
@@ -216,12 +219,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
216
219
  */
217
220
  classes: PropTypes.object,
218
221
  className: PropTypes.string,
219
- /**
220
- * If `true`, the component is disabled.
221
- * When disabled, the value cannot be changed and no interaction is possible.
222
- * @default false
223
- */
224
- disabled: PropTypes.bool,
225
222
  /**
226
223
  * If `true`, show the toolbar even in desktop mode.
227
224
  * @default `true` for Desktop, `false` for Mobile.
@@ -235,12 +232,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
235
232
  * @param {TView} view The view to open
236
233
  */
237
234
  onViewChange: PropTypes.func.isRequired,
238
- /**
239
- * If `true`, the component is read-only.
240
- * When read-only, the value cannot be changed but the user can interact with the interface.
241
- * @default false
242
- */
243
- readOnly: PropTypes.bool,
244
235
  /**
245
236
  * The system prop that allows defining system overrides as well as additional CSS styles.
246
237
  */
@@ -2,14 +2,14 @@ import * as React from 'react';
2
2
  import { DefaultizedProps } from '@mui/x-internals/types';
3
3
  import { TimeClockSlots, TimeClockSlotProps } from '../TimeClock/TimeClock.types';
4
4
  import { BasePickerInputProps } from '../internals/models/props/basePickerProps';
5
- import { BaseTimeValidationProps } from '../internals/models/validation';
6
5
  import { LocalizedComponent } from '../locales/utils/pickersLocaleTextApi';
7
6
  import { TimePickerToolbarProps, ExportedTimePickerToolbarProps } from './TimePickerToolbar';
8
- import { PickerValidDate, TimeValidationError } from '../models';
7
+ import { TimeValidationError } from '../models';
9
8
  import { PickerViewRendererLookup } from '../internals/hooks/usePicker/usePickerViews';
10
9
  import { TimeViewRendererProps } from '../timeViewRenderers';
11
10
  import { BaseClockProps, ExportedBaseClockProps } from '../internals/models/props/time';
12
- import { TimeViewWithMeridiem } from '../internals/models';
11
+ import { PickerValue, TimeViewWithMeridiem } from '../internals/models';
12
+ import { ValidateTimePropsToDefault } from '../validation/validateTime';
13
13
  export interface BaseTimePickerSlots extends TimeClockSlots {
14
14
  /**
15
15
  * Custom component for the toolbar rendered above the views.
@@ -20,8 +20,8 @@ export interface BaseTimePickerSlots extends TimeClockSlots {
20
20
  export interface BaseTimePickerSlotProps extends TimeClockSlotProps {
21
21
  toolbar?: ExportedTimePickerToolbarProps;
22
22
  }
23
- export type TimePickerViewRenderers<TView extends TimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<PickerValidDate | null, TView, TimeViewRendererProps<TView, BaseClockProps<TView>>, TAdditionalProps>;
24
- export interface BaseTimePickerProps<TView extends TimeViewWithMeridiem> extends BasePickerInputProps<PickerValidDate | null, TView, TimeValidationError>, ExportedBaseClockProps {
23
+ export type TimePickerViewRenderers<TView extends TimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<PickerValue, TView, TimeViewRendererProps<TView, BaseClockProps<TView>>, TAdditionalProps>;
24
+ export interface BaseTimePickerProps<TView extends TimeViewWithMeridiem> extends BasePickerInputProps<PickerValue, TView, TimeValidationError>, ExportedBaseClockProps {
25
25
  /**
26
26
  * Display ampm controls under the clock (instead of in the toolbar).
27
27
  * @default true on desktop, false on mobile
@@ -44,6 +44,6 @@ export interface BaseTimePickerProps<TView extends TimeViewWithMeridiem> extends
44
44
  */
45
45
  viewRenderers?: Partial<TimePickerViewRenderers<TView>>;
46
46
  }
47
- type UseTimePickerDefaultizedProps<TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TView>> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | 'ampm' | keyof BaseTimeValidationProps>>;
47
+ type UseTimePickerDefaultizedProps<TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TView>> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | 'ampm' | ValidateTimePropsToDefault>>;
48
48
  export declare function useTimePickerDefaultizedProps<TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TView>>(props: Props, name: string): UseTimePickerDefaultizedProps<TView, Props>;
49
49
  export {};
@@ -104,6 +104,7 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
104
104
  timezone: timezoneProp,
105
105
  value: valueProp,
106
106
  defaultValue,
107
+ referenceDate: referenceDateProp,
107
108
  onChange,
108
109
  valueManager: singleItemValueManager
109
110
  });
@@ -1,9 +1,9 @@
1
1
  import type { UseFieldInternalProps } from '../internals/hooks/useField';
2
- interface UseParsedFormatParameters extends Pick<UseFieldInternalProps<any, any, any, any>, 'format' | 'formatDensity' | 'shouldRespectLeadingZeros'> {
2
+ interface UseParsedFormatParameters extends Pick<UseFieldInternalProps<any, any, any>, 'format' | 'formatDensity' | 'shouldRespectLeadingZeros'> {
3
3
  }
4
4
  /**
5
5
  * Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
6
- * This format is localized (e.g: `AAAA` for the year with the French locale) and cannot be parsed by your date library.
6
+ * This format is localized (for example `AAAA` for the year with the French locale) and cannot be parsed by your date library.
7
7
  * @param {object} The parameters needed to build the placeholder.
8
8
  * @param {string} params.format Format of the date to use.
9
9
  * @param {'dense' | 'spacious'} params.formatDensity Density of the format (setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character).
@@ -8,7 +8,7 @@ import { getLocalizedDigits } from "../internals/hooks/useField/useField.utils.j
8
8
  import { usePickerTranslations } from "./usePickerTranslations.js";
9
9
  /**
10
10
  * Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
11
- * This format is localized (e.g: `AAAA` for the year with the French locale) and cannot be parsed by your date library.
11
+ * This format is localized (for example `AAAA` for the year with the French locale) and cannot be parsed by your date library.
12
12
  * @param {object} The parameters needed to build the placeholder.
13
13
  * @param {string} params.format Format of the date to use.
14
14
  * @param {'dense' | 'spacious'} params.formatDensity Density of the format (setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character).
@@ -1,7 +1,7 @@
1
- import { FieldValueType } from '../models';
2
1
  import { DATE_TIME_VALIDATION_PROP_NAMES, DATE_VALIDATION_PROP_NAMES, TIME_VALIDATION_PROP_NAMES } from '../validation/extractValidationProps';
2
+ import { PickerValueType } from '../models/common';
3
3
  declare const SHARED_FIELD_INTERNAL_PROP_NAMES: readonly ["value", "defaultValue", "referenceDate", "format", "formatDensity", "onChange", "timezone", "onError", "shouldRespectLeadingZeros", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef", "enableAccessibleFieldDOMStructure", "disabled", "readOnly", "dateSeparator"];
4
- type InternalPropNames<TValueType extends FieldValueType> = (typeof SHARED_FIELD_INTERNAL_PROP_NAMES)[number] | (TValueType extends 'date' | 'date-time' ? (typeof DATE_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'time' | 'date-time' ? (typeof TIME_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'date-time' ? (typeof DATE_TIME_VALIDATION_PROP_NAMES)[number] : never);
4
+ type InternalPropNames<TValueType extends PickerValueType> = (typeof SHARED_FIELD_INTERNAL_PROP_NAMES)[number] | (TValueType extends 'date' | 'date-time' ? (typeof DATE_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'time' | 'date-time' ? (typeof TIME_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'date-time' ? (typeof DATE_TIME_VALIDATION_PROP_NAMES)[number] : never);
5
5
  /**
6
6
  * Split the props received by the field component into:
7
7
  * - `internalProps` which are used by the various hooks called by the field component.
@@ -12,7 +12,7 @@ type InternalPropNames<TValueType extends FieldValueType> = (typeof SHARED_FIELD
12
12
  * @param {TProps} props The props received by the field component.
13
13
  * @param {TValueType} valueType The type of the field value ('date', 'time', or 'date-time').
14
14
  */
15
- export declare const useSplitFieldProps: <TValueType extends FieldValueType, TProps extends { [key in InternalPropNames<TValueType>]?: any; }>(props: TProps, valueType: TValueType) => {
15
+ export declare const useSplitFieldProps: <TValueType extends PickerValueType, TProps extends { [key in InternalPropNames<TValueType>]?: any; }>(props: TProps, valueType: TValueType) => {
16
16
  forwardedProps: Omit<TProps, InternalPropNames<TValueType>>;
17
17
  internalProps: Pick<TProps, InternalPropNames<TValueType>>;
18
18
  };
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v8.0.0-alpha.0
2
+ * @mui/x-date-pickers v8.0.0-alpha.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { PickerOwnerState } from '../../models';
3
3
  import { PickersInputLocaleText } from '../../locales';
4
+ import { PickerOrientation, PickerVariant } from '../models';
4
5
  export declare const PickerContext: React.Context<PickerContextValue | null>;
5
6
  export declare const PickerPrivateContext: React.Context<PickerPrivateContextValue>;
6
7
  /**
@@ -32,6 +33,31 @@ export interface PickerContextValue {
32
33
  * `true` if the picker is open, `false` otherwise.
33
34
  */
34
35
  open: boolean;
36
+ /**
37
+ * `true` if the picker is disabled, `false` otherwise.
38
+ */
39
+ disabled: boolean;
40
+ /**
41
+ * `true` if the picker is read-only, `false` otherwise.
42
+ */
43
+ readOnly: boolean;
44
+ /**
45
+ * The responsive variant of the picker.
46
+ * Is equal to "desktop" when using a desktop picker (like <DesktopDatePicker />).
47
+ * Is equal to "mobile" when using a mobile picker (like <MobileDatePicker />).
48
+ * Is equal to "mobile" or "desktop" when using a responsive picker (like <DatePicker />) depending on the `desktopModeMediaQuery` prop.
49
+ * Is equal to "mobile" or "desktop" when using a static picker (like <StaticDatePicker />) depending on the `displayStaticWrapperAs` prop.
50
+ * Is always equal to "desktop" if the component you are accessing the ownerState from is not wrapped by a picker.
51
+ */
52
+ variant: PickerVariant;
53
+ /**
54
+ * The orientation of the picker.
55
+ * Is equal to "landscape" when the picker is in landscape orientation.
56
+ * Is equal to "portrait" when the picker is in portrait orientation.
57
+ * You can use the "orientation" on any picker component to force the orientation.
58
+ * Is always equal to "portrait" if the component you are accessing the ownerState from is not wrapped by a picker.
59
+ */
60
+ orientation: PickerOrientation;
35
61
  }
36
62
  export interface PickerPrivateContextValue {
37
63
  /**
@@ -7,7 +7,9 @@ export const PickerPrivateContext = /*#__PURE__*/React.createContext({
7
7
  isPickerDisabled: false,
8
8
  isPickerReadOnly: false,
9
9
  isPickerValueEmpty: false,
10
- isPickerOpen: false
10
+ isPickerOpen: false,
11
+ pickerVariant: 'desktop',
12
+ pickerOrientation: 'portrait'
11
13
  }
12
14
  });
13
15
 
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["children", "className", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel", "labelId"],
3
+ const _excluded = ["children", "className", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel", "labelId", "classes"],
4
4
  _excluded2 = ["ownerState"],
5
5
  _excluded3 = ["ownerState"];
6
6
  import * as React from 'react';
@@ -13,6 +13,7 @@ import useSlotProps from '@mui/utils/useSlotProps';
13
13
  import IconButton from '@mui/material/IconButton';
14
14
  import { ArrowLeftIcon, ArrowRightIcon } from "../../../icons/index.js";
15
15
  import { getPickersArrowSwitcherUtilityClass } from "./pickersArrowSwitcherClasses.js";
16
+ import { usePickerPrivateContext } from "../../hooks/usePickerPrivateContext.js";
16
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
18
  const PickersArrowSwitcherRoot = styled('div', {
18
19
  name: 'MuiPickersArrowSwitcher',
@@ -44,10 +45,7 @@ const PickersArrowSwitcherButton = styled(IconButton, {
44
45
  }
45
46
  }]
46
47
  });
47
- const useUtilityClasses = ownerState => {
48
- const {
49
- classes
50
- } = ownerState;
48
+ const useUtilityClasses = classes => {
51
49
  const slots = {
52
50
  root: ['root'],
53
51
  spacer: ['spacer'],
@@ -78,11 +76,14 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
78
76
  isPreviousHidden,
79
77
  onGoToPrevious,
80
78
  previousLabel,
81
- labelId
79
+ labelId,
80
+ classes: classesProp
82
81
  } = props,
83
82
  other = _objectWithoutPropertiesLoose(props, _excluded);
84
- const ownerState = props;
85
- const classes = useUtilityClasses(ownerState);
83
+ const {
84
+ ownerState
85
+ } = usePickerPrivateContext();
86
+ const classes = useUtilityClasses(classesProp);
86
87
  const nextProps = {
87
88
  isDisabled: isNextDisabled,
88
89
  isHidden: isNextHidden,
@@ -108,7 +109,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
108
109
  onClick: previousProps.goTo
109
110
  },
110
111
  ownerState: _extends({}, ownerState, {
111
- hidden: previousProps.isHidden
112
+ hidden: previousProps.isHidden ?? false
112
113
  }),
113
114
  className: clsx(classes.button, classes.previousIconButton)
114
115
  });
@@ -125,7 +126,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
125
126
  onClick: nextProps.goTo
126
127
  },
127
128
  ownerState: _extends({}, ownerState, {
128
- hidden: nextProps.isHidden
129
+ hidden: nextProps.isHidden ?? false
129
130
  }),
130
131
  className: clsx(classes.button, classes.nextIconButton)
131
132
  });
@@ -3,6 +3,7 @@ import { SlotComponentProps } from '@mui/utils';
3
3
  import IconButton from '@mui/material/IconButton';
4
4
  import SvgIcon from '@mui/material/SvgIcon';
5
5
  import { PickersArrowSwitcherClasses } from './pickersArrowSwitcherClasses';
6
+ import { PickerOwnerState } from '../../../models';
6
7
  export interface ExportedPickersArrowSwitcherProps {
7
8
  /**
8
9
  * Overridable component slots.
@@ -36,7 +37,12 @@ export interface PickersArrowSwitcherProps extends ExportedPickersArrowSwitcherP
36
37
  nextLabel: string;
37
38
  labelId?: string;
38
39
  }
39
- export type PickersArrowSwitcherOwnerState = PickersArrowSwitcherProps;
40
+ export interface PickersArrowSwitcherOwnerState extends PickerOwnerState {
41
+ /**
42
+ * If `true`, this button should be hidden.
43
+ */
44
+ hidden: boolean;
45
+ }
40
46
  export interface PickersArrowSwitcherSlotPropsOverrides {
41
47
  }
42
48
  export interface PickersArrowSwitcherSlots {
@@ -61,12 +67,9 @@ export interface PickersArrowSwitcherSlots {
61
67
  */
62
68
  rightArrowIcon?: React.ElementType;
63
69
  }
64
- export interface PickersArrowSwitcherButtonSlotOwnerState extends PickersArrowSwitcherOwnerState {
65
- hidden?: boolean;
66
- }
67
70
  export interface PickersArrowSwitcherSlotProps {
68
- previousIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherButtonSlotOwnerState>;
69
- nextIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherButtonSlotOwnerState>;
70
- leftArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherButtonSlotOwnerState>;
71
- rightArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherButtonSlotOwnerState>;
71
+ previousIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherOwnerState>;
72
+ nextIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherOwnerState>;
73
+ leftArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, PickerOwnerState>;
74
+ rightArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, PickerOwnerState>;
72
75
  }
@@ -1,14 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import { BaseToolbarProps } from '../models/props/toolbar';
3
3
  import { PickersToolbarClasses } from './pickersToolbarClasses';
4
- import { DateOrTimeViewWithMeridiem } from '../models';
5
- export interface PickersToolbarProps<TValue, TView extends DateOrTimeViewWithMeridiem> extends Pick<BaseToolbarProps<TValue, TView>, 'isLandscape' | 'hidden' | 'titleId'> {
4
+ import { DateOrTimeViewWithMeridiem, PickerValidValue } from '../models';
5
+ export interface PickersToolbarProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> extends Pick<BaseToolbarProps<TValue, TView>, 'isLandscape' | 'hidden' | 'titleId'> {
6
6
  className?: string;
7
7
  landscapeDirection?: 'row' | 'column';
8
8
  toolbarTitle: React.ReactNode;
9
9
  classes?: Partial<PickersToolbarClasses>;
10
10
  }
11
- type PickersToolbarComponent = (<TValue, TView extends DateOrTimeViewWithMeridiem>(props: React.PropsWithChildren<PickersToolbarProps<TValue, TView>> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
11
+ type PickersToolbarComponent = (<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem>(props: React.PropsWithChildren<PickersToolbarProps<TValue, TView>> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
12
12
  propTypes?: any;
13
13
  };
14
14
  export declare const PickersToolbar: PickersToolbarComponent;
@@ -10,13 +10,11 @@ import { getPickersToolbarUtilityClass } from "./pickersToolbarClasses.js";
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  const useUtilityClasses = ownerState => {
12
12
  const {
13
- classes,
14
- isLandscape
13
+ classes
15
14
  } = ownerState;
16
15
  const slots = {
17
16
  root: ['root'],
18
- content: ['content'],
19
- penIconButton: ['penIconButton', isLandscape && 'penIconButtonLandscape']
17
+ content: ['content']
20
18
  };
21
19
  return composeClasses(slots, getPickersToolbarUtilityClass, classes);
22
20
  };
@@ -1,6 +1,7 @@
1
1
  import { MuiPickersAdapter, PickersTimezone, PickerValidDate } from '../../models';
2
+ import { PickerValue } from '../models';
2
3
  export declare const useClockReferenceDate: <TProps extends {}>({ value, referenceDate: referenceDateProp, utils, props, timezone, }: {
3
- value: PickerValidDate;
4
+ value: PickerValue;
4
5
  referenceDate: PickerValidDate | undefined;
5
6
  utils: MuiPickersAdapter;
6
7
  props: TProps;
@@ -67,7 +67,7 @@ export const useDesktopPicker = _ref => {
67
67
  localeText,
68
68
  autoFocusView: true,
69
69
  additionalViewProps: {},
70
- wrapperVariant: 'desktop'
70
+ variant: 'desktop'
71
71
  }));
72
72
  const InputAdornment = slots.inputAdornment ?? MuiInputAdornment;
73
73
  const _useSlotProps = useSlotProps({