@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,33 +1,31 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import * as React from 'react';
3
2
  import PropTypes from 'prop-types';
4
3
  import clsx from 'clsx';
5
- import { useRtl } from '@mui/system/RtlProvider';
6
4
  import Divider from '@mui/material/Divider';
7
5
  import { PickersLayoutContentWrapper, PickersLayoutRoot, pickersLayoutClasses, usePickerLayout } from "../PickersLayout/index.js";
6
+ import { usePickerContext } from "../hooks/usePickerContext.js";
8
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
8
  /**
10
9
  * @ignore - internal component.
11
10
  */
12
11
  const DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function DesktopDateTimePickerLayout(props, ref) {
13
- const isRtl = useRtl();
14
12
  const {
15
13
  toolbar,
16
14
  tabs,
17
15
  content,
18
16
  actionBar,
19
- shortcuts
17
+ shortcuts,
18
+ ownerState
20
19
  } = usePickerLayout(props);
20
+ const {
21
+ orientation
22
+ } = usePickerContext();
21
23
  const {
22
24
  sx,
23
25
  className,
24
- isLandscape,
25
26
  classes
26
27
  } = props;
27
28
  const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
28
- const ownerState = _extends({}, props, {
29
- isRtl
30
- });
31
29
  return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
32
30
  ref: ref,
33
31
  className: clsx(pickersLayoutClasses.root, classes?.root, className),
@@ -41,8 +39,9 @@ const DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function Deskt
41
39
  }
42
40
  }, ...(Array.isArray(sx) ? sx : [sx])],
43
41
  ownerState: ownerState,
44
- children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/_jsxs(PickersLayoutContentWrapper, {
42
+ children: [orientation === 'landscape' ? shortcuts : toolbar, orientation === 'landscape' ? toolbar : shortcuts, /*#__PURE__*/_jsxs(PickersLayoutContentWrapper, {
45
43
  className: clsx(pickersLayoutClasses.contentWrapper, classes?.contentWrapper),
44
+ ownerState: ownerState,
46
45
  sx: {
47
46
  display: 'grid'
48
47
  },
@@ -66,17 +65,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
66
65
  */
67
66
  classes: PropTypes.object,
68
67
  className: PropTypes.string,
69
- /**
70
- * If `true`, the component is disabled.
71
- * When disabled, the value cannot be changed and no interaction is possible.
72
- * @default false
73
- */
74
- disabled: PropTypes.bool,
75
- isLandscape: PropTypes.bool.isRequired,
76
- /**
77
- * `true` if the application is in right-to-left direction.
78
- */
79
- isRtl: PropTypes.bool.isRequired,
80
68
  isValid: PropTypes.func.isRequired,
81
69
  onAccept: PropTypes.func.isRequired,
82
70
  onCancel: PropTypes.func.isRequired,
@@ -88,16 +76,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
88
76
  onSelectShortcut: PropTypes.func.isRequired,
89
77
  onSetToday: PropTypes.func.isRequired,
90
78
  onViewChange: PropTypes.func.isRequired,
91
- /**
92
- * Force rendering in particular orientation.
93
- */
94
- orientation: PropTypes.oneOf(['landscape', 'portrait']),
95
- /**
96
- * If `true`, the component is read-only.
97
- * When read-only, the value cannot be changed but the user can interact with the interface.
98
- * @default false
99
- */
100
- readOnly: PropTypes.bool,
101
79
  /**
102
80
  * The props used for each component slot.
103
81
  * @default {}
@@ -112,9 +90,8 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
112
90
  * The system prop that allows defining system overrides as well as additional CSS styles.
113
91
  */
114
92
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
115
- value: PropTypes.any,
93
+ value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
116
94
  view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
117
- views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired,
118
- wrapperVariant: PropTypes.oneOf(['desktop', 'mobile'])
95
+ views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
119
96
  } : void 0;
120
97
  export { DesktopDateTimePickerLayout };
@@ -149,6 +149,7 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
149
149
  timezone: timezoneProp,
150
150
  value: valueProp,
151
151
  defaultValue,
152
+ referenceDate: referenceDateProp,
152
153
  onChange,
153
154
  valueManager: singleItemValueManager
154
155
  });
@@ -98,6 +98,7 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
98
98
  timezone: timezoneProp,
99
99
  value: valueProp,
100
100
  defaultValue,
101
+ referenceDate: referenceDateProp,
101
102
  onChange,
102
103
  valueManager: singleItemValueManager
103
104
  });
@@ -101,6 +101,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
101
101
  timezone: timezoneProp,
102
102
  value: valueProp,
103
103
  defaultValue,
104
+ referenceDate: referenceDateProp,
104
105
  onChange,
105
106
  valueManager: singleItemValueManager
106
107
  });
@@ -5,17 +5,17 @@ import { MultiSectionDigitalClockClasses } from './multiSectionDigitalClockClass
5
5
  import { BaseClockProps, ExportedBaseClockProps, MultiSectionDigitalClockOnlyProps } from '../internals/models/props/time';
6
6
  import { MultiSectionDigitalClockSectionProps } from './MultiSectionDigitalClockSection';
7
7
  import { TimeViewWithMeridiem } from '../internals/models';
8
- export interface MultiSectionDigitalClockOption<TValue> {
9
- isDisabled?: (value: TValue) => boolean;
10
- isSelected: (value: TValue) => boolean;
11
- isFocused: (value: TValue) => boolean;
8
+ export interface MultiSectionDigitalClockOption<TSectionValue extends number | string> {
9
+ isDisabled?: (value: TSectionValue) => boolean;
10
+ isSelected: (value: TSectionValue) => boolean;
11
+ isFocused: (value: TSectionValue) => boolean;
12
12
  label: string;
13
- value: TValue;
13
+ value: TSectionValue;
14
14
  ariaLabel: string;
15
15
  }
16
16
  export interface ExportedMultiSectionDigitalClockProps extends ExportedBaseClockProps, MultiSectionDigitalClockOnlyProps {
17
17
  }
18
- export interface MultiSectionDigitalClockViewProps<TValue> extends Pick<MultiSectionDigitalClockSectionProps<TValue>, 'onChange' | 'items'> {
18
+ export interface MultiSectionDigitalClockViewProps<TSectionValue extends number | string> extends Pick<MultiSectionDigitalClockSectionProps<TSectionValue>, 'onChange' | 'items'> {
19
19
  }
20
20
  export interface MultiSectionDigitalClockSlots {
21
21
  /**
@@ -8,15 +8,15 @@ export interface ExportedMultiSectionDigitalClockSectionProps {
8
8
  slots?: MultiSectionDigitalClockSlots;
9
9
  slotProps?: MultiSectionDigitalClockSlotProps;
10
10
  }
11
- export interface MultiSectionDigitalClockSectionProps<TValue> extends FormProps, ExportedMultiSectionDigitalClockSectionProps {
11
+ export interface MultiSectionDigitalClockSectionProps<TSectionValue extends number | string> extends FormProps, ExportedMultiSectionDigitalClockSectionProps {
12
12
  autoFocus?: boolean;
13
- items: MultiSectionDigitalClockOption<TValue>[];
14
- onChange: (value: TValue) => void;
13
+ items: MultiSectionDigitalClockOption<TSectionValue>[];
14
+ onChange: (value: TSectionValue) => void;
15
15
  active?: boolean;
16
16
  skipDisabled?: boolean;
17
17
  role?: string;
18
18
  }
19
- type MultiSectionDigitalClockSectionComponent = <TValue>(props: MultiSectionDigitalClockSectionProps<TValue> & React.RefAttributes<HTMLUListElement>) => React.JSX.Element & {
19
+ type MultiSectionDigitalClockSectionComponent = <TSectionValue extends number | string>(props: MultiSectionDigitalClockSectionProps<TSectionValue> & React.RefAttributes<HTMLUListElement>) => React.JSX.Element & {
20
20
  propTypes?: any;
21
21
  };
22
22
  /**
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
- const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone", "format"],
5
+ const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "classes", "timezone", "format"],
6
6
  _excluded2 = ["ownerState"];
7
7
  import * as React from 'react';
8
8
  import PropTypes from 'prop-types';
@@ -19,11 +19,9 @@ import { ArrowDropDownIcon } from "../icons/index.js";
19
19
  import { PickersArrowSwitcher } from "../internals/components/PickersArrowSwitcher/index.js";
20
20
  import { usePreviousMonthDisabled, useNextMonthDisabled } from "../internals/hooks/date-helpers-hooks.js";
21
21
  import { getPickersCalendarHeaderUtilityClass, pickersCalendarHeaderClasses } from "./pickersCalendarHeaderClasses.js";
22
+ import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
22
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
- const useUtilityClasses = ownerState => {
24
- const {
25
- classes
26
- } = ownerState;
24
+ const useUtilityClasses = classes => {
27
25
  const slots = {
28
26
  root: ['root'],
29
27
  labelContainer: ['labelContainer'],
@@ -132,12 +130,15 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
132
130
  views,
133
131
  labelId,
134
132
  className,
133
+ classes: classesProp,
135
134
  timezone,
136
135
  format = `${utils.formats.month} ${utils.formats.year}`
137
136
  } = props,
138
137
  other = _objectWithoutPropertiesLoose(props, _excluded);
139
- const ownerState = props;
140
- const classes = useUtilityClasses(props);
138
+ const {
139
+ ownerState
140
+ } = usePickerPrivateContext();
141
+ const classes = useUtilityClasses(classesProp);
141
142
  const SwitchViewButton = slots?.switchViewButton ?? PickersCalendarHeaderSwitchViewButton;
142
143
  const switchViewButtonProps = useSlotProps({
143
144
  elementType: SwitchViewButton,
@@ -5,7 +5,7 @@ import SvgIcon from '@mui/material/SvgIcon';
5
5
  import { SxProps, Theme } from '@mui/material/styles';
6
6
  import { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps } from '../internals/components/PickersArrowSwitcher';
7
7
  import { MonthValidationOptions } from '../internals/hooks/date-helpers-hooks';
8
- import { PickerValidDate, DateView } from '../models';
8
+ import { PickerValidDate, DateView, PickerOwnerState } from '../models';
9
9
  import { SlideDirection } from '../DateCalendar/PickersSlideTransition';
10
10
  import { PickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
11
11
  export interface PickersCalendarHeaderSlots extends PickersArrowSwitcherSlots {
@@ -22,10 +22,9 @@ export interface PickersCalendarHeaderSlots extends PickersArrowSwitcherSlots {
22
22
  }
23
23
  export interface PickersCalendarHeaderSlotPropsOverrides {
24
24
  }
25
- export type PickersCalendarHeaderOwnerState = PickersCalendarHeaderProps;
26
25
  export interface PickersCalendarHeaderSlotProps extends PickersArrowSwitcherSlotProps {
27
- switchViewButton?: SlotComponentProps<typeof IconButton, PickersCalendarHeaderSlotPropsOverrides, PickersCalendarHeaderOwnerState>;
28
- switchViewIcon?: SlotComponentProps<typeof SvgIcon, PickersCalendarHeaderSlotPropsOverrides, PickersCalendarHeaderOwnerState>;
26
+ switchViewButton?: SlotComponentProps<typeof IconButton, PickersCalendarHeaderSlotPropsOverrides, PickerOwnerState>;
27
+ switchViewIcon?: SlotComponentProps<typeof SvgIcon, PickersCalendarHeaderSlotPropsOverrides, PickerOwnerState>;
29
28
  }
30
29
  export interface PickersCalendarHeaderProps extends ExportedPickersArrowSwitcherProps, MonthValidationOptions {
31
30
  /**
@@ -1,11 +1,13 @@
1
1
  import * as React from 'react';
2
- import { PickersLayoutProps } from './PickersLayout.types';
3
- import { DateOrTimeViewWithMeridiem } from '../internals/models';
2
+ import { PickerLayoutOwnerState, PickersLayoutProps } from './PickersLayout.types';
3
+ import { DateOrTimeViewWithMeridiem, PickerValidValue } from '../internals/models';
4
4
  export declare const PickersLayoutRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
5
- ownerState: PickersLayoutProps<any, any>;
5
+ ownerState: PickerLayoutOwnerState;
6
6
  }, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
7
- export declare const PickersLayoutContentWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
8
- type PickersLayoutComponent = (<TValue, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TView> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
7
+ export declare const PickersLayoutContentWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
8
+ ownerState: PickerLayoutOwnerState;
9
+ }, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
10
+ type PickersLayoutComponent = (<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TView> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
9
11
  propTypes?: any;
10
12
  };
11
13
  /**
@@ -7,14 +7,14 @@ import { styled, useThemeProps } from '@mui/material/styles';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import { pickersLayoutClasses, getPickersLayoutUtilityClass } from "./pickersLayoutClasses.js";
9
9
  import usePickerLayout from "./usePickerLayout.js";
10
+ import { usePickerContext } from "../hooks/usePickerContext.js";
10
11
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
11
- const useUtilityClasses = ownerState => {
12
+ const useUtilityClasses = (classes, ownerState) => {
12
13
  const {
13
- isLandscape,
14
- classes
14
+ pickerOrientation
15
15
  } = ownerState;
16
16
  const slots = {
17
- root: ['root', isLandscape && 'landscape'],
17
+ root: ['root', pickerOrientation === 'landscape' && 'landscape'],
18
18
  contentWrapper: ['contentWrapper']
19
19
  };
20
20
  return composeClasses(slots, getPickersLayoutUtilityClass, classes);
@@ -33,7 +33,7 @@ export const PickersLayoutRoot = styled('div', {
33
33
  },
34
34
  variants: [{
35
35
  props: {
36
- isLandscape: true
36
+ pickerOrientation: 'landscape'
37
37
  },
38
38
  style: {
39
39
  [`& .${pickersLayoutClasses.toolbar}`]: {
@@ -47,7 +47,7 @@ export const PickersLayoutRoot = styled('div', {
47
47
  }
48
48
  }, {
49
49
  props: {
50
- isLandscape: true,
50
+ pickerOrientation: 'landscape',
51
51
  isRtl: true
52
52
  },
53
53
  style: {
@@ -57,7 +57,7 @@ export const PickersLayoutRoot = styled('div', {
57
57
  }
58
58
  }, {
59
59
  props: {
60
- isLandscape: false
60
+ pickerOrientation: 'portrait'
61
61
  },
62
62
  style: {
63
63
  [`& .${pickersLayoutClasses.toolbar}`]: {
@@ -71,7 +71,7 @@ export const PickersLayoutRoot = styled('div', {
71
71
  }
72
72
  }, {
73
73
  props: {
74
- isLandscape: false,
74
+ pickerOrientation: 'portrait',
75
75
  isRtl: true
76
76
  },
77
77
  style: {
@@ -110,23 +110,28 @@ const PickersLayout = /*#__PURE__*/React.forwardRef(function PickersLayout(inPro
110
110
  content,
111
111
  tabs,
112
112
  actionBar,
113
- shortcuts
113
+ shortcuts,
114
+ ownerState
114
115
  } = usePickerLayout(props);
116
+ const {
117
+ orientation,
118
+ variant
119
+ } = usePickerContext();
115
120
  const {
116
121
  sx,
117
122
  className,
118
- isLandscape,
119
- wrapperVariant
123
+ classes: classesProp
120
124
  } = props;
121
- const classes = useUtilityClasses(props);
125
+ const classes = useUtilityClasses(classesProp, ownerState);
122
126
  return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
123
127
  ref: ref,
124
128
  sx: sx,
125
129
  className: clsx(classes.root, className),
126
- ownerState: props,
127
- children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/_jsx(PickersLayoutContentWrapper, {
130
+ ownerState: ownerState,
131
+ children: [orientation === 'landscape' ? shortcuts : toolbar, orientation === 'landscape' ? toolbar : shortcuts, /*#__PURE__*/_jsx(PickersLayoutContentWrapper, {
128
132
  className: classes.contentWrapper,
129
- children: wrapperVariant === 'desktop' ? /*#__PURE__*/_jsxs(React.Fragment, {
133
+ ownerState: ownerState,
134
+ children: variant === 'desktop' ? /*#__PURE__*/_jsxs(React.Fragment, {
130
135
  children: [content, tabs]
131
136
  }) : /*#__PURE__*/_jsxs(React.Fragment, {
132
137
  children: [tabs, content]
@@ -145,17 +150,6 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
145
150
  */
146
151
  classes: PropTypes.object,
147
152
  className: PropTypes.string,
148
- /**
149
- * If `true`, the component is disabled.
150
- * When disabled, the value cannot be changed and no interaction is possible.
151
- * @default false
152
- */
153
- disabled: PropTypes.bool,
154
- isLandscape: PropTypes.bool.isRequired,
155
- /**
156
- * `true` if the application is in right-to-left direction.
157
- */
158
- isRtl: PropTypes.bool.isRequired,
159
153
  isValid: PropTypes.func.isRequired,
160
154
  onAccept: PropTypes.func.isRequired,
161
155
  onCancel: PropTypes.func.isRequired,
@@ -167,16 +161,6 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
167
161
  onSelectShortcut: PropTypes.func.isRequired,
168
162
  onSetToday: PropTypes.func.isRequired,
169
163
  onViewChange: PropTypes.func.isRequired,
170
- /**
171
- * Force rendering in particular orientation.
172
- */
173
- orientation: PropTypes.oneOf(['landscape', 'portrait']),
174
- /**
175
- * If `true`, the component is read-only.
176
- * When read-only, the value cannot be changed but the user can interact with the interface.
177
- * @default false
178
- */
179
- readOnly: PropTypes.bool,
180
164
  /**
181
165
  * The props used for each component slot.
182
166
  * @default {}
@@ -191,9 +175,8 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
191
175
  * The system prop that allows defining system overrides as well as additional CSS styles.
192
176
  */
193
177
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
194
- value: PropTypes.any,
178
+ value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
195
179
  view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
196
- views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired,
197
- wrapperVariant: PropTypes.oneOf(['desktop', 'mobile'])
180
+ views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
198
181
  } : void 0;
199
182
  export { PickersLayout };
@@ -4,13 +4,15 @@ import { SlotComponentProps } from '@mui/utils';
4
4
  import { PickersActionBar, PickersActionBarProps } from '../PickersActionBar';
5
5
  import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar';
6
6
  import { BaseTabsProps, ExportedBaseTabsProps } from '../internals/models/props/tabs';
7
- import { UsePickerLayoutPropsResponseLayoutProps } from '../internals/hooks/usePicker/usePickerLayoutProps';
8
7
  import { PickersLayoutClasses } from './pickersLayoutClasses';
9
- import { DateOrTimeViewWithMeridiem, WrapperVariant } from '../internals/models/common';
8
+ import { DateOrTimeViewWithMeridiem } from '../internals/models/common';
10
9
  import { PickersShortcutsProps } from '../PickersShortcuts';
11
10
  import { ExportedPickersShortcutProps, PickersShortcuts } from '../PickersShortcuts/PickersShortcuts';
12
11
  import { PickerOwnerState } from '../models';
13
- export interface ExportedPickersLayoutSlots<TValue, TView extends DateOrTimeViewWithMeridiem> {
12
+ import { PickerValidValue } from '../internals/models';
13
+ import { UsePickerViewsLayoutResponse } from '../internals/hooks/usePicker/usePickerViews';
14
+ import { UsePickerValueLayoutResponse } from '../internals/hooks/usePicker/usePickerValue.types';
15
+ export interface ExportedPickersLayoutSlots<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> {
14
16
  /**
15
17
  * Custom component for the action bar, it is placed below the picker views.
16
18
  * @default PickersActionBar
@@ -28,10 +30,12 @@ export interface ExportedPickersLayoutSlots<TValue, TView extends DateOrTimeView
28
30
  layout?: React.JSXElementConstructor<PickersLayoutProps<TValue, TView> & React.RefAttributes<HTMLDivElement>>;
29
31
  }
30
32
  export interface PickerLayoutOwnerState extends PickerOwnerState {
31
- wrapperVariant: WrapperVariant;
32
- isLandscape: boolean;
33
+ /**
34
+ * `true` if the application is in right-to-left direction.
35
+ */
36
+ isRtl: boolean;
33
37
  }
34
- export interface ExportedPickersLayoutSlotProps<TValue, TView extends DateOrTimeViewWithMeridiem> {
38
+ export interface ExportedPickersLayoutSlotProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> {
35
39
  /**
36
40
  * Props passed down to the action bar component.
37
41
  */
@@ -45,7 +49,7 @@ export interface ExportedPickersLayoutSlotProps<TValue, TView extends DateOrTime
45
49
  */
46
50
  layout?: Partial<PickersLayoutProps<TValue, TView>>;
47
51
  }
48
- export interface PickersLayoutSlots<TValue, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<TValue, TView> {
52
+ export interface PickersLayoutSlots<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<TValue, TView> {
49
53
  /**
50
54
  * Tabs enabling toggling between views.
51
55
  */
@@ -56,7 +60,7 @@ export interface PickersLayoutSlots<TValue, TView extends DateOrTimeViewWithMeri
56
60
  */
57
61
  toolbar?: React.JSXElementConstructor<BaseToolbarProps<TValue, TView>>;
58
62
  }
59
- export interface PickersLayoutSlotProps<TValue, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<TValue, TView> {
63
+ export interface PickersLayoutSlotProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<TValue, TView> {
60
64
  /**
61
65
  * Props passed down to the tabs component.
62
66
  */
@@ -66,8 +70,7 @@ export interface PickersLayoutSlotProps<TValue, TView extends DateOrTimeViewWith
66
70
  */
67
71
  toolbar?: ExportedBaseToolbarProps;
68
72
  }
69
- export interface PickersLayoutProps<TValue, TView extends DateOrTimeViewWithMeridiem> extends Omit<UsePickerLayoutPropsResponseLayoutProps<TValue, TView>, 'value'> {
70
- value?: TValue;
73
+ export interface PickersLayoutProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> extends UsePickerViewsLayoutResponse<TView>, UsePickerValueLayoutResponse<TValue> {
71
74
  className?: string;
72
75
  children?: React.ReactNode;
73
76
  /**
@@ -88,12 +91,8 @@ export interface PickersLayoutProps<TValue, TView extends DateOrTimeViewWithMeri
88
91
  * @default {}
89
92
  */
90
93
  slotProps?: PickersLayoutSlotProps<TValue, TView>;
91
- /**
92
- * `true` if the application is in right-to-left direction.
93
- */
94
- isRtl: boolean;
95
94
  }
96
- export interface SubComponents<TValue> {
95
+ export interface SubComponents<TValue extends PickerValidValue> {
97
96
  toolbar: React.ReactElement<ExportedBaseToolbarProps> | null;
98
97
  content: React.ReactNode;
99
98
  tabs: React.ReactElement<ExportedBaseTabsProps> | null;
@@ -1,6 +1,7 @@
1
- import { PickersLayoutProps, SubComponents } from './PickersLayout.types';
2
- import { DateOrTimeViewWithMeridiem } from '../internals/models';
3
- interface UsePickerLayoutResponse<TValue> extends SubComponents<TValue> {
1
+ import { PickerLayoutOwnerState, PickersLayoutProps, SubComponents } from './PickersLayout.types';
2
+ import { DateOrTimeViewWithMeridiem, PickerValidValue } from '../internals/models';
3
+ interface UsePickerLayoutResponse<TValue extends PickerValidValue> extends SubComponents<TValue> {
4
+ ownerState: PickerLayoutOwnerState;
4
5
  }
5
- declare const usePickerLayout: <TValue, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TView>) => UsePickerLayoutResponse<TValue>;
6
+ declare const usePickerLayout: <TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TView>) => UsePickerLayoutResponse<TValue>;
6
7
  export default usePickerLayout;
@@ -4,20 +4,22 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import useSlotProps from '@mui/utils/useSlotProps';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
+ import { useRtl } from '@mui/system/RtlProvider';
7
8
  import { PickersActionBar } from "../PickersActionBar/index.js";
8
9
  import { getPickersLayoutUtilityClass } from "./pickersLayoutClasses.js";
9
10
  import { PickersShortcuts } from "../PickersShortcuts/index.js";
10
11
  import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
12
+ import { usePickerContext } from "../hooks/index.js";
11
13
  import { jsx as _jsx } from "react/jsx-runtime";
12
14
  function toolbarHasView(toolbarProps) {
13
15
  return toolbarProps.view !== null;
14
16
  }
15
17
  const useUtilityClasses = (classes, ownerState) => {
16
18
  const {
17
- isLandscape
19
+ pickerOrientation
18
20
  } = ownerState;
19
21
  const slots = {
20
- root: ['root', isLandscape && 'landscape'],
22
+ root: ['root', pickerOrientation === 'landscape' && 'landscape'],
21
23
  contentWrapper: ['contentWrapper'],
22
24
  toolbar: ['toolbar'],
23
25
  actionBar: ['actionBar'],
@@ -29,10 +31,14 @@ const useUtilityClasses = (classes, ownerState) => {
29
31
  };
30
32
  const usePickerLayout = props => {
31
33
  const {
32
- ownerState: pickersOwnerState
34
+ ownerState: pickerOwnerState
33
35
  } = usePickerPrivateContext();
34
36
  const {
35
- wrapperVariant,
37
+ variant,
38
+ orientation
39
+ } = usePickerContext();
40
+ const isRtl = useRtl();
41
+ const {
36
42
  onAccept,
37
43
  onClear,
38
44
  onCancel,
@@ -44,9 +50,6 @@ const usePickerLayout = props => {
44
50
  onChange,
45
51
  onSelectShortcut,
46
52
  isValid,
47
- isLandscape,
48
- disabled,
49
- readOnly,
50
53
  children,
51
54
  slots,
52
55
  slotProps,
@@ -56,9 +59,8 @@ const usePickerLayout = props => {
56
59
  // - For pickers value: PickerValidDate | null
57
60
  // - For range pickers value: [PickerValidDate | null, PickerValidDate | null]
58
61
  } = props;
59
- const ownerState = _extends({}, pickersOwnerState, {
60
- wrapperVariant,
61
- isLandscape
62
+ const ownerState = _extends({}, pickerOwnerState, {
63
+ isRtl
62
64
  });
63
65
  const classes = useUtilityClasses(classesProp, ownerState);
64
66
 
@@ -72,7 +74,7 @@ const usePickerLayout = props => {
72
74
  onClear,
73
75
  onCancel,
74
76
  onSetToday,
75
- actions: wrapperVariant === 'desktop' ? [] : ['cancel', 'accept']
77
+ actions: variant === 'desktop' ? [] : ['cancel', 'accept']
76
78
  },
77
79
  className: classes.actionBar,
78
80
  ownerState
@@ -85,14 +87,13 @@ const usePickerLayout = props => {
85
87
  elementType: Toolbar,
86
88
  externalSlotProps: slotProps?.toolbar,
87
89
  additionalProps: {
88
- isLandscape,
90
+ isLandscape: orientation === 'landscape',
91
+ // Will be removed in a follow up PR?
89
92
  onChange,
90
93
  value,
91
94
  view,
92
95
  onViewChange,
93
- views,
94
- disabled,
95
- readOnly
96
+ views
96
97
  },
97
98
  className: classes.toolbar,
98
99
  ownerState
@@ -117,7 +118,8 @@ const usePickerLayout = props => {
117
118
  externalSlotProps: slotProps?.shortcuts,
118
119
  additionalProps: {
119
120
  isValid,
120
- isLandscape,
121
+ isLandscape: orientation === 'landscape',
122
+ // Will be removed in a follow up PR?
121
123
  onChange: onSelectShortcut
122
124
  },
123
125
  className: classes.shortcuts,
@@ -129,7 +131,8 @@ const usePickerLayout = props => {
129
131
  content,
130
132
  tabs,
131
133
  actionBar,
132
- shortcuts
134
+ shortcuts,
135
+ ownerState
133
136
  };
134
137
  };
135
138
  export default usePickerLayout;
@@ -1,9 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { ListProps } from '@mui/material/List';
3
- interface PickersShortcutsItemGetValueParams<TValue> {
3
+ import { PickerValidValue } from '../internals/models';
4
+ interface PickersShortcutsItemGetValueParams<TValue extends PickerValidValue> {
4
5
  isValid: (value: TValue) => boolean;
5
6
  }
6
- export interface PickersShortcutsItem<TValue> {
7
+ export interface PickersShortcutsItem<TValue extends PickerValidValue> {
7
8
  label: string;
8
9
  getValue: (params: PickersShortcutsItemGetValueParams<TValue>) => TValue;
9
10
  /**
@@ -12,9 +13,9 @@ export interface PickersShortcutsItem<TValue> {
12
13
  */
13
14
  id?: string;
14
15
  }
15
- export type PickersShortcutsItemContext = Omit<PickersShortcutsItem<unknown>, 'getValue'>;
16
+ export type PickersShortcutsItemContext = Omit<PickersShortcutsItem<PickerValidValue>, 'getValue'>;
16
17
  export type PickerShortcutChangeImportance = 'set' | 'accept';
17
- export interface ExportedPickersShortcutProps<TValue> extends Omit<ListProps, 'onChange'> {
18
+ export interface ExportedPickersShortcutProps<TValue extends PickerValidValue> extends Omit<ListProps, 'onChange'> {
18
19
  /**
19
20
  * Ordered array of shortcuts to display.
20
21
  * If empty, does not display the shortcuts.
@@ -29,7 +30,7 @@ export interface ExportedPickersShortcutProps<TValue> extends Omit<ListProps, 'o
29
30
  */
30
31
  changeImportance?: PickerShortcutChangeImportance;
31
32
  }
32
- export interface PickersShortcutsProps<TValue> extends ExportedPickersShortcutProps<TValue> {
33
+ export interface PickersShortcutsProps<TValue extends PickerValidValue> extends ExportedPickersShortcutProps<TValue> {
33
34
  isLandscape: boolean;
34
35
  onChange: (newValue: TValue, changeImportance: PickerShortcutChangeImportance, shortcut: PickersShortcutsItemContext) => void;
35
36
  isValid: (value: TValue) => boolean;
@@ -43,7 +44,7 @@ export interface PickersShortcutsProps<TValue> extends ExportedPickersShortcutPr
43
44
  *
44
45
  * - [PickersShortcuts API](https://mui.com/x/api/date-pickers/pickers-shortcuts/)
45
46
  */
46
- declare function PickersShortcuts<TValue>(props: PickersShortcutsProps<TValue>): React.JSX.Element | null;
47
+ declare function PickersShortcuts<TValue extends PickerValidValue>(props: PickersShortcutsProps<TValue>): React.JSX.Element | null;
47
48
  declare namespace PickersShortcuts {
48
49
  var propTypes: any;
49
50
  }