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

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 (110) hide show
  1. package/CHANGELOG.md +376 -0
  2. package/DateField/useDateField.d.ts +1 -1
  3. package/DatePicker/DatePickerToolbar.js +8 -9
  4. package/DateTimeField/useDateTimeField.d.ts +1 -1
  5. package/DateTimePicker/DateTimePickerToolbar.d.ts +6 -2
  6. package/DateTimePicker/DateTimePickerToolbar.js +53 -39
  7. package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -2
  8. package/DigitalClock/DigitalClock.js +13 -11
  9. package/DigitalClock/DigitalClock.types.d.ts +8 -2
  10. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
  11. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +12 -10
  12. package/PickersActionBar/PickersActionBar.js +8 -1
  13. package/PickersLayout/PickersLayout.js +2 -2
  14. package/PickersLayout/PickersLayout.types.d.ts +4 -2
  15. package/PickersLayout/usePickerLayout.js +3 -3
  16. package/PickersShortcuts/PickersShortcuts.js +8 -1
  17. package/README.md +1 -1
  18. package/TimeClock/Clock.js +18 -21
  19. package/TimeClock/ClockNumber.js +15 -11
  20. package/TimeClock/ClockPointer.d.ts +6 -1
  21. package/TimeClock/ClockPointer.js +14 -10
  22. package/TimeClock/TimeClock.js +9 -8
  23. package/TimeField/useTimeField.d.ts +1 -1
  24. package/TimePicker/TimePickerToolbar.js +14 -17
  25. package/hooks/useClearableField.d.ts +5 -3
  26. package/hooks/useClearableField.js +4 -2
  27. package/index.js +1 -1
  28. package/internals/components/PickerProvider.d.ts +2 -15
  29. package/internals/components/PickersPopper.d.ts +11 -7
  30. package/internals/components/PickersPopper.js +18 -20
  31. package/internals/components/PickersToolbar.js +15 -12
  32. package/internals/components/PickersToolbarButton.js +4 -6
  33. package/internals/components/PickersToolbarText.js +11 -13
  34. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +3 -2
  35. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +3 -2
  36. package/internals/hooks/useOpenState.d.ts +3 -2
  37. package/internals/hooks/useOpenState.js +10 -9
  38. package/internals/hooks/usePicker/usePicker.js +3 -3
  39. package/internals/hooks/usePicker/usePicker.types.d.ts +3 -2
  40. package/internals/hooks/usePicker/usePickerProvider.d.ts +17 -6
  41. package/internals/hooks/usePicker/usePickerProvider.js +14 -12
  42. package/internals/hooks/usePicker/usePickerValue.js +22 -11
  43. package/internals/hooks/usePicker/usePickerValue.types.d.ts +26 -0
  44. package/internals/hooks/usePicker/usePickerViews.d.ts +5 -15
  45. package/internals/hooks/usePicker/usePickerViews.js +5 -6
  46. package/internals/hooks/useToolbarOwnerState.d.ts +10 -0
  47. package/internals/hooks/useToolbarOwnerState.js +13 -0
  48. package/internals/index.d.ts +5 -1
  49. package/internals/index.js +3 -1
  50. package/internals/models/common.d.ts +1 -1
  51. package/locales/roRO.js +15 -18
  52. package/modern/DatePicker/DatePickerToolbar.js +8 -9
  53. package/modern/DateTimePicker/DateTimePickerToolbar.js +53 -39
  54. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -2
  55. package/modern/DigitalClock/DigitalClock.js +13 -11
  56. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
  57. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +12 -10
  58. package/modern/PickersActionBar/PickersActionBar.js +8 -1
  59. package/modern/PickersLayout/PickersLayout.js +2 -2
  60. package/modern/PickersLayout/usePickerLayout.js +3 -3
  61. package/modern/PickersShortcuts/PickersShortcuts.js +8 -1
  62. package/modern/TimeClock/Clock.js +18 -21
  63. package/modern/TimeClock/ClockNumber.js +15 -11
  64. package/modern/TimeClock/ClockPointer.js +14 -10
  65. package/modern/TimeClock/TimeClock.js +9 -8
  66. package/modern/TimePicker/TimePickerToolbar.js +14 -17
  67. package/modern/hooks/useClearableField.js +4 -2
  68. package/modern/index.js +1 -1
  69. package/modern/internals/components/PickersPopper.js +18 -20
  70. package/modern/internals/components/PickersToolbar.js +15 -12
  71. package/modern/internals/components/PickersToolbarButton.js +4 -6
  72. package/modern/internals/components/PickersToolbarText.js +11 -13
  73. package/modern/internals/hooks/useOpenState.js +10 -9
  74. package/modern/internals/hooks/usePicker/usePicker.js +3 -3
  75. package/modern/internals/hooks/usePicker/usePickerProvider.js +14 -12
  76. package/modern/internals/hooks/usePicker/usePickerValue.js +22 -11
  77. package/modern/internals/hooks/usePicker/usePickerViews.js +5 -6
  78. package/modern/internals/hooks/useToolbarOwnerState.js +13 -0
  79. package/modern/internals/index.js +3 -1
  80. package/modern/locales/roRO.js +15 -18
  81. package/node/DatePicker/DatePickerToolbar.js +8 -9
  82. package/node/DateTimePicker/DateTimePickerToolbar.js +54 -39
  83. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -2
  84. package/node/DigitalClock/DigitalClock.js +13 -11
  85. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
  86. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +12 -10
  87. package/node/PickersActionBar/PickersActionBar.js +8 -1
  88. package/node/PickersLayout/PickersLayout.js +2 -2
  89. package/node/PickersLayout/usePickerLayout.js +3 -3
  90. package/node/PickersShortcuts/PickersShortcuts.js +8 -1
  91. package/node/TimeClock/Clock.js +18 -21
  92. package/node/TimeClock/ClockNumber.js +15 -11
  93. package/node/TimeClock/ClockPointer.js +14 -10
  94. package/node/TimeClock/TimeClock.js +9 -8
  95. package/node/TimePicker/TimePickerToolbar.js +14 -17
  96. package/node/hooks/useClearableField.js +4 -2
  97. package/node/index.js +1 -1
  98. package/node/internals/components/PickersPopper.js +18 -20
  99. package/node/internals/components/PickersToolbar.js +15 -12
  100. package/node/internals/components/PickersToolbarButton.js +4 -6
  101. package/node/internals/components/PickersToolbarText.js +10 -12
  102. package/node/internals/hooks/useOpenState.js +10 -9
  103. package/node/internals/hooks/usePicker/usePicker.js +3 -3
  104. package/node/internals/hooks/usePicker/usePickerProvider.js +15 -13
  105. package/node/internals/hooks/usePicker/usePickerValue.js +22 -11
  106. package/node/internals/hooks/usePicker/usePickerViews.js +5 -6
  107. package/node/internals/hooks/useToolbarOwnerState.js +21 -0
  108. package/node/internals/index.js +15 -1
  109. package/node/locales/roRO.js +15 -18
  110. package/package.json +1 -1
@@ -7,14 +7,15 @@ Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.DateTimePickerToolbar = DateTimePickerToolbar;
10
+ exports.DateTimePickerToolbarForceDesktopVariant = void 0;
10
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
12
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
13
  var React = _interopRequireWildcard(require("react"));
14
+ var _clsx = _interopRequireDefault(require("clsx"));
13
15
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
- var _RtlProvider = require("@mui/system/RtlProvider");
15
16
  var _styles = require("@mui/material/styles");
16
17
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
17
- var _clsx = _interopRequireDefault(require("clsx"));
18
+ var _createStyled = require("@mui/system/createStyled");
18
19
  var _PickersToolbarText = require("../internals/components/PickersToolbarText");
19
20
  var _PickersToolbar = require("../internals/components/PickersToolbar");
20
21
  var _PickersToolbarButton = require("../internals/components/PickersToolbarButton");
@@ -27,21 +28,21 @@ var _dateUtils = require("../internals/utils/date-utils");
27
28
  var _pickersToolbarTextClasses = require("../internals/components/pickersToolbarTextClasses");
28
29
  var _pickersToolbarClasses = require("../internals/components/pickersToolbarClasses");
29
30
  var _usePickerContext = require("../hooks/usePickerContext");
31
+ var _useToolbarOwnerState = require("../internals/hooks/useToolbarOwnerState");
30
32
  var _jsxRuntime = require("react/jsx-runtime");
31
- const _excluded = ["ampm", "ampmInClock", "value", "onChange", "view", "isLandscape", "onViewChange", "toolbarFormat", "toolbarPlaceholder", "views", "toolbarVariant", "toolbarTitle", "className"];
32
- const useUtilityClasses = ownerState => {
33
+ const _excluded = ["ampm", "ampmInClock", "value", "onChange", "view", "isLandscape", "onViewChange", "toolbarFormat", "toolbarPlaceholder", "views", "toolbarTitle", "className", "classes"];
34
+ const useUtilityClasses = (classes, ownerState) => {
33
35
  const {
34
- classes,
35
- isLandscape,
36
- isRtl
36
+ pickerOrientation,
37
+ toolbarDirection
37
38
  } = ownerState;
38
39
  const slots = {
39
40
  root: ['root'],
40
41
  dateContainer: ['dateContainer'],
41
- timeContainer: ['timeContainer', isRtl && 'timeLabelReverse'],
42
- timeDigitsContainer: ['timeDigitsContainer', isRtl && 'timeLabelReverse'],
42
+ timeContainer: ['timeContainer', toolbarDirection === 'rtl' && 'timeLabelReverse'],
43
+ timeDigitsContainer: ['timeDigitsContainer', toolbarDirection === 'rtl' && 'timeLabelReverse'],
43
44
  separator: ['separator'],
44
- ampmSelection: ['ampmSelection', isLandscape && 'ampmLandscape'],
45
+ ampmSelection: ['ampmSelection', pickerOrientation === 'landscape' && 'ampmLandscape'],
45
46
  ampmLabel: ['ampmLabel']
46
47
  };
47
48
  return (0, _composeClasses.default)(slots, _dateTimePickerToolbarClasses.getDateTimePickerToolbarUtilityClass, classes);
@@ -49,7 +50,8 @@ const useUtilityClasses = ownerState => {
49
50
  const DateTimePickerToolbarRoot = (0, _styles.styled)(_PickersToolbar.PickersToolbar, {
50
51
  name: 'MuiDateTimePickerToolbar',
51
52
  slot: 'Root',
52
- overridesResolver: (props, styles) => styles.root
53
+ overridesResolver: (props, styles) => styles.root,
54
+ shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'toolbarVariant'
53
55
  })(({
54
56
  theme
55
57
  }) => ({
@@ -71,7 +73,7 @@ const DateTimePickerToolbarRoot = (0, _styles.styled)(_PickersToolbar.PickersToo
71
73
  }, {
72
74
  props: {
73
75
  toolbarVariant: 'desktop',
74
- isLandscape: true
76
+ pickerOrientation: 'landscape'
75
77
  },
76
78
  style: {
77
79
  borderRight: `1px solid ${(theme.vars || theme).palette.divider}`
@@ -79,7 +81,7 @@ const DateTimePickerToolbarRoot = (0, _styles.styled)(_PickersToolbar.PickersToo
79
81
  }, {
80
82
  props: {
81
83
  toolbarVariant: 'desktop',
82
- isLandscape: false
84
+ pickerOrientation: 'portrait'
83
85
  },
84
86
  style: {
85
87
  paddingLeft: 24,
@@ -99,13 +101,14 @@ const DateTimePickerToolbarDateContainer = (0, _styles.styled)('div', {
99
101
  const DateTimePickerToolbarTimeContainer = (0, _styles.styled)('div', {
100
102
  name: 'MuiDateTimePickerToolbar',
101
103
  slot: 'TimeContainer',
102
- overridesResolver: (props, styles) => styles.timeContainer
104
+ overridesResolver: (props, styles) => styles.timeContainer,
105
+ shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'toolbarVariant'
103
106
  })({
104
107
  display: 'flex',
105
108
  flexDirection: 'row',
106
109
  variants: [{
107
110
  props: {
108
- isRtl: true
111
+ toolbarDirection: 'rtl'
109
112
  },
110
113
  style: {
111
114
  flexDirection: 'row-reverse'
@@ -113,7 +116,7 @@ const DateTimePickerToolbarTimeContainer = (0, _styles.styled)('div', {
113
116
  }, {
114
117
  props: {
115
118
  toolbarVariant: 'desktop',
116
- isLandscape: false
119
+ pickerOrientation: 'portrait'
117
120
  },
118
121
  style: {
119
122
  gap: 9,
@@ -122,18 +125,18 @@ const DateTimePickerToolbarTimeContainer = (0, _styles.styled)('div', {
122
125
  }
123
126
  }, {
124
127
  props: ({
125
- isLandscape,
128
+ pickerOrientation,
126
129
  toolbarVariant
127
- }) => isLandscape && toolbarVariant !== 'desktop',
130
+ }) => pickerOrientation === 'landscape' && toolbarVariant !== 'desktop',
128
131
  style: {
129
132
  flexDirection: 'column'
130
133
  }
131
134
  }, {
132
135
  props: ({
133
- isLandscape,
136
+ pickerOrientation,
134
137
  toolbarVariant,
135
- isRtl
136
- }) => isLandscape && toolbarVariant !== 'desktop' && isRtl,
138
+ toolbarDirection
139
+ }) => pickerOrientation === 'landscape' && toolbarVariant !== 'desktop' && toolbarDirection === 'rtl',
137
140
  style: {
138
141
  flexDirection: 'column-reverse'
139
142
  }
@@ -142,12 +145,13 @@ const DateTimePickerToolbarTimeContainer = (0, _styles.styled)('div', {
142
145
  const DateTimePickerToolbarTimeDigitsContainer = (0, _styles.styled)('div', {
143
146
  name: 'MuiDateTimePickerToolbar',
144
147
  slot: 'TimeDigitsContainer',
145
- overridesResolver: (props, styles) => styles.timeDigitsContainer
148
+ overridesResolver: (props, styles) => styles.timeDigitsContainer,
149
+ shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'toolbarVariant'
146
150
  })({
147
151
  display: 'flex',
148
152
  variants: [{
149
153
  props: {
150
- isRtl: true
154
+ toolbarDirection: 'rtl'
151
155
  },
152
156
  style: {
153
157
  flexDirection: 'row-reverse'
@@ -164,7 +168,8 @@ const DateTimePickerToolbarTimeDigitsContainer = (0, _styles.styled)('div', {
164
168
  const DateTimePickerToolbarSeparator = (0, _styles.styled)(_PickersToolbarText.PickersToolbarText, {
165
169
  name: 'MuiDateTimePickerToolbar',
166
170
  slot: 'Separator',
167
- overridesResolver: (props, styles) => styles.separator
171
+ overridesResolver: (props, styles) => styles.separator,
172
+ shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'toolbarVariant'
168
173
  })({
169
174
  margin: '0 4px 0 2px',
170
175
  cursor: 'default',
@@ -197,7 +202,7 @@ const DateTimePickerToolbarAmPmSelection = (0, _styles.styled)('div', {
197
202
  },
198
203
  variants: [{
199
204
  props: {
200
- isLandscape: true
205
+ pickerOrientation: 'landscape'
201
206
  },
202
207
  style: {
203
208
  margin: '4px 0 auto',
@@ -208,6 +213,12 @@ const DateTimePickerToolbarAmPmSelection = (0, _styles.styled)('div', {
208
213
  }]
209
214
  });
210
215
 
216
+ /**
217
+ * If this context value is set to true, the toolbar will always be rendered in the desktop mode.
218
+ * This is used by the Date Time Range Picker Toolbar.
219
+ */
220
+ const DateTimePickerToolbarForceDesktopVariant = exports.DateTimePickerToolbarForceDesktopVariant = /*#__PURE__*/React.createContext(false);
221
+
211
222
  /**
212
223
  * Demos:
213
224
  *
@@ -234,28 +245,28 @@ function DateTimePickerToolbar(inProps) {
234
245
  toolbarFormat,
235
246
  toolbarPlaceholder = '––',
236
247
  views,
237
- toolbarVariant = 'mobile',
238
248
  toolbarTitle: inToolbarTitle,
239
- className
249
+ className,
250
+ classes: classesProp
240
251
  } = props,
241
252
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
242
- const isRtl = (0, _RtlProvider.useRtl)();
243
253
  const {
244
254
  disabled,
245
- readOnly
255
+ readOnly,
256
+ variant
246
257
  } = (0, _usePickerContext.usePickerContext)();
247
- const ownerState = (0, _extends2.default)({}, props, {
248
- isRtl
249
- });
258
+ const ownerState = (0, _useToolbarOwnerState.useToolbarOwnerState)();
259
+ const classes = useUtilityClasses(classesProp, ownerState);
250
260
  const utils = (0, _useUtils.useUtils)();
251
261
  const {
252
262
  meridiemMode,
253
263
  handleMeridiemChange
254
264
  } = (0, _dateHelpersHooks.useMeridiemMode)(value, ampm, onChange);
255
- const showAmPmControl = Boolean(ampm && !ampmInClock);
256
- const isDesktop = toolbarVariant === 'desktop';
257
265
  const translations = (0, _usePickerTranslations.usePickerTranslations)();
258
- const classes = useUtilityClasses(ownerState);
266
+ const forceDesktopVariant = React.useContext(DateTimePickerToolbarForceDesktopVariant);
267
+ const toolbarVariant = forceDesktopVariant ? 'desktop' : variant;
268
+ const isDesktop = toolbarVariant === 'desktop';
269
+ const showAmPmControl = Boolean(ampm && !ampmInClock);
259
270
  const toolbarTitle = inToolbarTitle ?? translations.dateTimePickerToolbarTitle;
260
271
  const formatHours = time => ampm ? utils.format(time, 'hours12h') : utils.format(time, 'hours24h');
261
272
  const dateText = React.useMemo(() => {
@@ -270,7 +281,8 @@ function DateTimePickerToolbar(inProps) {
270
281
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DateTimePickerToolbarRoot, (0, _extends2.default)({
271
282
  isLandscape: isLandscape,
272
283
  className: (0, _clsx.default)(classes.root, className),
273
- toolbarTitle: toolbarTitle
284
+ toolbarTitle: toolbarTitle,
285
+ toolbarVariant: toolbarVariant
274
286
  }, other, {
275
287
  ownerState: ownerState,
276
288
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(DateTimePickerToolbarDateContainer, {
@@ -292,9 +304,11 @@ function DateTimePickerToolbar(inProps) {
292
304
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(DateTimePickerToolbarTimeContainer, {
293
305
  className: classes.timeContainer,
294
306
  ownerState: ownerState,
307
+ toolbarVariant: toolbarVariant,
295
308
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(DateTimePickerToolbarTimeDigitsContainer, {
296
309
  className: classes.timeDigitsContainer,
297
310
  ownerState: ownerState,
311
+ toolbarVariant: toolbarVariant,
298
312
  children: [views.includes('hours') && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
299
313
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersToolbarButton.PickersToolbarButton, {
300
314
  variant: isDesktop ? 'h5' : 'h3',
@@ -306,7 +320,8 @@ function DateTimePickerToolbar(inProps) {
306
320
  variant: isDesktop ? 'h5' : 'h3',
307
321
  value: ":",
308
322
  className: classes.separator,
309
- ownerState: ownerState
323
+ ownerState: ownerState,
324
+ toolbarVariant: toolbarVariant
310
325
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersToolbarButton.PickersToolbarButton, {
311
326
  variant: isDesktop ? 'h5' : 'h3',
312
327
  width: isDesktop && !isLandscape ? _dimensions.MULTI_SECTION_CLOCK_SECTION_WIDTH : undefined,
@@ -320,7 +335,8 @@ function DateTimePickerToolbar(inProps) {
320
335
  variant: isDesktop ? 'h5' : 'h3',
321
336
  value: ":",
322
337
  className: classes.separator,
323
- ownerState: ownerState
338
+ ownerState: ownerState,
339
+ toolbarVariant: toolbarVariant
324
340
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersToolbarButton.PickersToolbarButton, {
325
341
  variant: isDesktop ? 'h5' : 'h3',
326
342
  width: isDesktop && !isLandscape ? _dimensions.MULTI_SECTION_CLOCK_SECTION_WIDTH : undefined,
@@ -400,7 +416,6 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
400
416
  * If provided, it will be used instead of `dateTimePickerToolbarTitle` from localization.
401
417
  */
402
418
  toolbarTitle: _propTypes.default.node,
403
- toolbarVariant: _propTypes.default.oneOf(['desktop', 'mobile']),
404
419
  value: _propTypes.default.object,
405
420
  /**
406
421
  * Currently visible picker view.
@@ -138,8 +138,7 @@ const DesktopDateTimePicker = exports.DesktopDateTimePicker = /*#__PURE__*/React
138
138
  }),
139
139
  toolbar: (0, _extends2.default)({
140
140
  hidden: true,
141
- ampmInClock,
142
- toolbarVariant: 'desktop'
141
+ ampmInClock
143
142
  }, defaultizedProps.slotProps?.toolbar),
144
143
  tabs: (0, _extends2.default)({
145
144
  hidden: true
@@ -30,12 +30,10 @@ var _useValueWithTimezone = require("../internals/hooks/useValueWithTimezone");
30
30
  var _valueManagers = require("../internals/utils/valueManagers");
31
31
  var _useClockReferenceDate = require("../internals/hooks/useClockReferenceDate");
32
32
  var _utils = require("../internals/utils/utils");
33
+ var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
33
34
  var _jsxRuntime = require("react/jsx-runtime");
34
- const _excluded = ["ampm", "timeStep", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableTime", "onChange", "view", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "views", "skipDisabled", "timezone"];
35
- const useUtilityClasses = ownerState => {
36
- const {
37
- classes
38
- } = ownerState;
35
+ const _excluded = ["ampm", "timeStep", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableTime", "onChange", "view", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "classes", "disabled", "readOnly", "views", "skipDisabled", "timezone"];
36
+ const useUtilityClasses = classes => {
39
37
  const slots = {
40
38
  root: ['root'],
41
39
  list: ['list'],
@@ -56,7 +54,7 @@ const DigitalClockRoot = (0, _styles.styled)(_PickerViewRoot.PickerViewRoot, {
56
54
  maxHeight: _dimensions.DIGITAL_CLOCK_VIEW_HEIGHT,
57
55
  variants: [{
58
56
  props: {
59
- alreadyRendered: true
57
+ hasDigitalClockAlreadyBeenRendered: true
60
58
  },
61
59
  style: {
62
60
  '@media (prefers-reduced-motion: no-preference)': {
@@ -140,6 +138,7 @@ const DigitalClock = exports.DigitalClock = /*#__PURE__*/React.forwardRef(functi
140
138
  focusedView,
141
139
  onFocusedViewChange,
142
140
  className,
141
+ classes: classesProp,
143
142
  disabled,
144
143
  readOnly,
145
144
  views = ['hours'],
@@ -162,15 +161,18 @@ const DigitalClock = exports.DigitalClock = /*#__PURE__*/React.forwardRef(functi
162
161
  });
163
162
  const translations = (0, _usePickerTranslations.usePickerTranslations)();
164
163
  const now = (0, _useUtils.useNow)(timezone);
165
- const ownerState = React.useMemo(() => (0, _extends2.default)({}, props, {
166
- alreadyRendered: !!containerRef.current
167
- }), [props]);
168
- const classes = useUtilityClasses(ownerState);
164
+ const {
165
+ ownerState: pickerOwnerState
166
+ } = (0, _usePickerPrivateContext.usePickerPrivateContext)();
167
+ const ownerState = (0, _extends2.default)({}, pickerOwnerState, {
168
+ hasDigitalClockAlreadyBeenRendered: !!containerRef.current
169
+ });
170
+ const classes = useUtilityClasses(classesProp);
169
171
  const ClockItem = slots?.digitalClockItem ?? DigitalClockItem;
170
172
  const clockItemProps = (0, _useSlotProps.default)({
171
173
  elementType: ClockItem,
172
174
  externalSlotProps: slotProps?.digitalClockItem,
173
- ownerState: {},
175
+ ownerState,
174
176
  className: classes.item
175
177
  });
176
178
  const valueOrReferenceDate = (0, _useClockReferenceDate.useClockReferenceDate)({
@@ -29,12 +29,10 @@ var _useValueWithTimezone = require("../internals/hooks/useValueWithTimezone");
29
29
  var _valueManagers = require("../internals/utils/valueManagers");
30
30
  var _useClockReferenceDate = require("../internals/hooks/useClockReferenceDate");
31
31
  var _dateUtils = require("../internals/utils/date-utils");
32
+ var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
32
33
  var _jsxRuntime = require("react/jsx-runtime");
33
- const _excluded = ["ampm", "timeSteps", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableTime", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "skipDisabled", "timezone"];
34
- const useUtilityClasses = ownerState => {
35
- const {
36
- classes
37
- } = ownerState;
34
+ const _excluded = ["ampm", "timeSteps", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableTime", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "classes", "disabled", "readOnly", "skipDisabled", "timezone"];
35
+ const useUtilityClasses = classes => {
38
36
  const slots = {
39
37
  root: ['root']
40
38
  };
@@ -93,6 +91,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
93
91
  focusedView: inFocusedView,
94
92
  onFocusedViewChange,
95
93
  className,
94
+ classes: classesProp,
96
95
  disabled,
97
96
  readOnly,
98
97
  skipDisabled = false,
@@ -326,8 +325,10 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
326
325
  });
327
326
  }, {});
328
327
  }, [views, buildViewProps]);
329
- const ownerState = props;
330
- const classes = useUtilityClasses(ownerState);
328
+ const {
329
+ ownerState
330
+ } = (0, _usePickerPrivateContext.usePickerPrivateContext)();
331
+ const classes = useUtilityClasses(classesProp);
331
332
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(MultiSectionDigitalClockRoot, (0, _extends2.default)({
332
333
  ref: ref,
333
334
  className: (0, _clsx.default)(classes.root, className),
@@ -18,12 +18,10 @@ var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
18
18
  var _multiSectionDigitalClockSectionClasses = require("./multiSectionDigitalClockSectionClasses");
19
19
  var _dimensions = require("../internals/constants/dimensions");
20
20
  var _utils = require("../internals/utils/utils");
21
+ var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
21
22
  var _jsxRuntime = require("react/jsx-runtime");
22
- const _excluded = ["autoFocus", "onChange", "className", "disabled", "readOnly", "items", "active", "slots", "slotProps", "skipDisabled"];
23
- const useUtilityClasses = ownerState => {
24
- const {
25
- classes
26
- } = ownerState;
23
+ const _excluded = ["autoFocus", "onChange", "className", "classes", "disabled", "readOnly", "items", "active", "slots", "slotProps", "skipDisabled"];
24
+ const useUtilityClasses = classes => {
27
25
  const slots = {
28
26
  root: ['root'],
29
27
  item: ['item']
@@ -63,7 +61,7 @@ const MultiSectionDigitalClockSectionRoot = (0, _styles.styled)(_MenuList.defaul
63
61
  },
64
62
  variants: [{
65
63
  props: {
66
- alreadyRendered: true
64
+ hasDigitalClockAlreadyBeenRendered: true
67
65
  },
68
66
  style: {
69
67
  '@media (prefers-reduced-motion: no-preference)': {
@@ -115,6 +113,7 @@ const MultiSectionDigitalClockSection = exports.MultiSectionDigitalClockSection
115
113
  autoFocus,
116
114
  onChange,
117
115
  className,
116
+ classes: classesProp,
118
117
  disabled,
119
118
  readOnly,
120
119
  items,
@@ -124,10 +123,13 @@ const MultiSectionDigitalClockSection = exports.MultiSectionDigitalClockSection
124
123
  skipDisabled
125
124
  } = props,
126
125
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
127
- const ownerState = React.useMemo(() => (0, _extends2.default)({}, props, {
128
- alreadyRendered: !!containerRef.current
129
- }), [props]);
130
- const classes = useUtilityClasses(ownerState);
126
+ const {
127
+ ownerState: pickerOwnerState
128
+ } = (0, _usePickerPrivateContext.usePickerPrivateContext)();
129
+ const ownerState = (0, _extends2.default)({}, pickerOwnerState, {
130
+ hasDigitalClockAlreadyBeenRendered: !!containerRef.current
131
+ });
132
+ const classes = useUtilityClasses(classesProp);
131
133
  const DigitalClockSectionItem = slots?.digitalClockSectionItem ?? MultiSectionDigitalClockSectionItem;
132
134
  React.useEffect(() => {
133
135
  if (containerRef.current === null) {
@@ -11,11 +11,18 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
+ var _styles = require("@mui/material/styles");
14
15
  var _Button = _interopRequireDefault(require("@mui/material/Button"));
15
16
  var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
16
17
  var _usePickerTranslations = require("../hooks/usePickerTranslations");
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
19
  const _excluded = ["onAccept", "onClear", "onCancel", "onSetToday", "actions"];
20
+ const PickersActionBarRoot = (0, _styles.styled)(_DialogActions.default, {
21
+ name: 'MuiPickersLayout',
22
+ slot: 'ActionBar',
23
+ overridesResolver: (_, styles) => styles.actionBar
24
+ })({});
25
+
19
26
  /**
20
27
  * Demos:
21
28
  *
@@ -65,7 +72,7 @@ function PickersActionBar(props) {
65
72
  return null;
66
73
  }
67
74
  });
68
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogActions.default, (0, _extends2.default)({}, other, {
75
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersActionBarRoot, (0, _extends2.default)({}, other, {
69
76
  children: buttons
70
77
  }));
71
78
  }
@@ -55,7 +55,7 @@ const PickersLayoutRoot = exports.PickersLayoutRoot = (0, _styles.styled)('div',
55
55
  }, {
56
56
  props: {
57
57
  pickerOrientation: 'landscape',
58
- isRtl: true
58
+ layoutDirection: 'rtl'
59
59
  },
60
60
  style: {
61
61
  [`& .${_pickersLayoutClasses.pickersLayoutClasses.toolbar}`]: {
@@ -79,7 +79,7 @@ const PickersLayoutRoot = exports.PickersLayoutRoot = (0, _styles.styled)('div',
79
79
  }, {
80
80
  props: {
81
81
  pickerOrientation: 'portrait',
82
- isRtl: true
82
+ layoutDirection: 'rtl'
83
83
  },
84
84
  style: {
85
85
  [`& .${_pickersLayoutClasses.pickersLayoutClasses.shortcuts}`]: {
@@ -66,9 +66,9 @@ const usePickerLayout = props => {
66
66
  // - For pickers value: PickerValidDate | null
67
67
  // - For range pickers value: [PickerValidDate | null, PickerValidDate | null]
68
68
  } = props;
69
- const ownerState = (0, _extends2.default)({}, pickerOwnerState, {
70
- isRtl
71
- });
69
+ const ownerState = React.useMemo(() => (0, _extends2.default)({}, pickerOwnerState, {
70
+ layoutDirection: isRtl ? 'rtl' : 'ltr'
71
+ }), [pickerOwnerState, isRtl]);
72
72
  const classes = useUtilityClasses(classesProp, ownerState);
73
73
 
74
74
  // Action bar
@@ -10,6 +10,7 @@ exports.PickersShortcuts = PickersShortcuts;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
+ var _styles = require("@mui/material/styles");
13
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
15
  var _List = _interopRequireDefault(require("@mui/material/List"));
15
16
  var _ListItem = _interopRequireDefault(require("@mui/material/ListItem"));
@@ -18,6 +19,12 @@ var _dimensions = require("../internals/constants/dimensions");
18
19
  var _jsxRuntime = require("react/jsx-runtime");
19
20
  const _excluded = ["items", "changeImportance", "isLandscape", "onChange", "isValid"],
20
21
  _excluded2 = ["getValue"];
22
+ const PickersShortcutsRoot = (0, _styles.styled)(_List.default, {
23
+ name: 'MuiPickersLayout',
24
+ slot: 'Shortcuts',
25
+ overridesResolver: (_, styles) => styles.shortcuts
26
+ })({});
27
+
21
28
  /**
22
29
  * Demos:
23
30
  *
@@ -54,7 +61,7 @@ function PickersShortcuts(props) {
54
61
  disabled: !isValid(newValue)
55
62
  });
56
63
  });
57
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_List.default, (0, _extends2.default)({
64
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersShortcutsRoot, (0, _extends2.default)({
58
65
  dense: true,
59
66
  sx: [{
60
67
  maxHeight: _dimensions.VIEW_HEIGHT,
@@ -19,20 +19,17 @@ var _useUtils = require("../internals/hooks/useUtils");
19
19
  var _shared = require("./shared");
20
20
  var _clockClasses = require("./clockClasses");
21
21
  var _dateUtils = require("../internals/utils/date-utils");
22
+ var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
22
23
  var _jsxRuntime = require("react/jsx-runtime");
23
- const useUtilityClasses = ownerState => {
24
- const {
25
- classes,
26
- meridiemMode
27
- } = ownerState;
24
+ const useUtilityClasses = (classes, ownerState) => {
28
25
  const slots = {
29
26
  root: ['root'],
30
27
  clock: ['clock'],
31
28
  wrapper: ['wrapper'],
32
29
  squareMask: ['squareMask'],
33
30
  pin: ['pin'],
34
- amButton: ['amButton', meridiemMode === 'am' && 'selected'],
35
- pmButton: ['pmButton', meridiemMode === 'pm' && 'selected'],
31
+ amButton: ['amButton', ownerState.clockMeridiemMode === 'am' && 'selected'],
32
+ pmButton: ['pmButton', ownerState.clockMeridiemMode === 'pm' && 'selected'],
36
33
  meridiemText: ['meridiemText']
37
34
  };
38
35
  return (0, _utils.unstable_composeClasses)(slots, _clockClasses.getClockUtilityClass, classes);
@@ -86,7 +83,7 @@ const ClockSquareMask = (0, _styles.styled)('div', {
86
83
  userSelect: 'none',
87
84
  variants: [{
88
85
  props: {
89
- disabled: false
86
+ isClockDisabled: false
90
87
  },
91
88
  style: {
92
89
  '@media (pointer: fine)': {
@@ -190,13 +187,20 @@ function Clock(inProps) {
190
187
  viewValue,
191
188
  disabled = false,
192
189
  readOnly,
193
- className
190
+ className,
191
+ classes: classesProp
194
192
  } = props;
195
- const ownerState = props;
196
193
  const utils = (0, _useUtils.useUtils)();
197
194
  const translations = (0, _usePickerTranslations.usePickerTranslations)();
195
+ const {
196
+ ownerState: pickerOwnerState
197
+ } = (0, _usePickerPrivateContext.usePickerPrivateContext)();
198
+ const ownerState = (0, _extends2.default)({}, pickerOwnerState, {
199
+ isClockDisabled: disabled,
200
+ clockMeridiemMode: meridiemMode
201
+ });
198
202
  const isMoving = React.useRef(false);
199
- const classes = useUtilityClasses(ownerState);
203
+ const classes = useUtilityClasses(classesProp, ownerState);
200
204
  const isSelectedTimeDisabled = isTimeDisabled(viewValue, type);
201
205
  const isPointerInner = !ampm && type === 'hours' && (viewValue < 1 || viewValue > 12);
202
206
  const handleValueChange = (newValue, isFinish) => {
@@ -244,12 +248,7 @@ function Clock(inProps) {
244
248
  }
245
249
  setTime(event.nativeEvent, 'finish');
246
250
  };
247
- const hasSelected = React.useMemo(() => {
248
- if (type === 'hours') {
249
- return true;
250
- }
251
- return viewValue % 5 === 0;
252
- }, [type, viewValue]);
251
+ const isPointerBetweenTwoClockValues = type === 'hours' ? false : viewValue % 5 !== 0;
253
252
  const keyboardControlStep = type === 'minutes' ? minutesStep : 1;
254
253
  const listboxRef = React.useRef(null);
255
254
  // Since this is rendered when a Popper is opened we can't use passive effects.
@@ -310,9 +309,7 @@ function Clock(inProps) {
310
309
  onTouchEnd: handleTouchEnd,
311
310
  onMouseUp: handleMouseUp,
312
311
  onMouseMove: handleMouseMove,
313
- ownerState: {
314
- disabled
315
- },
312
+ ownerState: ownerState,
316
313
  className: classes.squareMask
317
314
  }), !isSelectedTimeDisabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
318
315
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ClockPin, {
@@ -321,7 +318,7 @@ function Clock(inProps) {
321
318
  type: type,
322
319
  viewValue: viewValue,
323
320
  isInner: isPointerInner,
324
- hasSelected: hasSelected
321
+ isBetweenTwoClockValues: isPointerBetweenTwoClockValues
325
322
  })]
326
323
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ClockWrapper, {
327
324
  "aria-activedescendant": selectedId,
@@ -14,16 +14,12 @@ var _styles = require("@mui/material/styles");
14
14
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
15
15
  var _shared = require("./shared");
16
16
  var _clockNumberClasses = require("./clockNumberClasses");
17
+ var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
- const _excluded = ["className", "disabled", "index", "inner", "label", "selected"];
19
- const useUtilityClasses = ownerState => {
20
- const {
21
- classes,
22
- selected,
23
- disabled
24
- } = ownerState;
19
+ const _excluded = ["className", "classes", "disabled", "index", "inner", "label", "selected"];
20
+ const useUtilityClasses = (classes, ownerState) => {
25
21
  const slots = {
26
- root: ['root', selected && 'selected', disabled && 'disabled']
22
+ root: ['root', ownerState.isClockNumberSelected && 'selected', ownerState.isClockNumberDisabled && 'disabled']
27
23
  };
28
24
  return (0, _composeClasses.default)(slots, _clockNumberClasses.getClockNumberUtilityClass, classes);
29
25
  };
@@ -60,7 +56,7 @@ const ClockNumberRoot = (0, _styles.styled)('span', {
60
56
  },
61
57
  variants: [{
62
58
  props: {
63
- inner: true
59
+ isClockNumberInInnerRing: true
64
60
  },
65
61
  style: (0, _extends2.default)({}, theme.typography.body2, {
66
62
  color: (theme.vars || theme).palette.text.secondary
@@ -78,6 +74,7 @@ function ClockNumber(inProps) {
78
74
  });
79
75
  const {
80
76
  className,
77
+ classes: classesProp,
81
78
  disabled,
82
79
  index,
83
80
  inner,
@@ -85,8 +82,15 @@ function ClockNumber(inProps) {
85
82
  selected
86
83
  } = props,
87
84
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
88
- const ownerState = props;
89
- const classes = useUtilityClasses(ownerState);
85
+ const {
86
+ ownerState: pickerOwnerState
87
+ } = (0, _usePickerPrivateContext.usePickerPrivateContext)();
88
+ const ownerState = (0, _extends2.default)({}, pickerOwnerState, {
89
+ isClockNumberInInnerRing: inner,
90
+ isClockNumberSelected: selected,
91
+ isClockNumberDisabled: disabled
92
+ });
93
+ const classes = useUtilityClasses(classesProp, ownerState);
90
94
  const angle = index % 12 / 12 * Math.PI * 2 - Math.PI / 2;
91
95
  const length = (_shared.CLOCK_WIDTH - _shared.CLOCK_HOUR_WIDTH - 2) / 2 * (inner ? 0.65 : 1);
92
96
  const x = Math.round(Math.cos(angle) * length);