@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
@@ -2,13 +2,13 @@
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", "onChange", "view", "isLandscape", "onViewChange", "toolbarFormat", "toolbarPlaceholder", "views", "toolbarVariant", "toolbarTitle", "className"];
5
+ const _excluded = ["ampm", "ampmInClock", "value", "onChange", "view", "isLandscape", "onViewChange", "toolbarFormat", "toolbarPlaceholder", "views", "toolbarTitle", "className", "classes"];
6
6
  import * as React from 'react';
7
+ import clsx from 'clsx';
7
8
  import PropTypes from 'prop-types';
8
- import { useRtl } from '@mui/system/RtlProvider';
9
9
  import { styled, useThemeProps } from '@mui/material/styles';
10
10
  import composeClasses from '@mui/utils/composeClasses';
11
- import clsx from 'clsx';
11
+ import { shouldForwardProp } from '@mui/system/createStyled';
12
12
  import { PickersToolbarText } from "../internals/components/PickersToolbarText.js";
13
13
  import { PickersToolbar } from "../internals/components/PickersToolbar.js";
14
14
  import { PickersToolbarButton } from "../internals/components/PickersToolbarButton.js";
@@ -21,20 +21,20 @@ import { formatMeridiem } from "../internals/utils/date-utils.js";
21
21
  import { pickersToolbarTextClasses } from "../internals/components/pickersToolbarTextClasses.js";
22
22
  import { pickersToolbarClasses } from "../internals/components/pickersToolbarClasses.js";
23
23
  import { usePickerContext } from "../hooks/usePickerContext.js";
24
+ import { useToolbarOwnerState } from "../internals/hooks/useToolbarOwnerState.js";
24
25
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
- const useUtilityClasses = ownerState => {
26
+ const useUtilityClasses = (classes, ownerState) => {
26
27
  const {
27
- classes,
28
- isLandscape,
29
- isRtl
28
+ pickerOrientation,
29
+ toolbarDirection
30
30
  } = ownerState;
31
31
  const slots = {
32
32
  root: ['root'],
33
33
  dateContainer: ['dateContainer'],
34
- timeContainer: ['timeContainer', isRtl && 'timeLabelReverse'],
35
- timeDigitsContainer: ['timeDigitsContainer', isRtl && 'timeLabelReverse'],
34
+ timeContainer: ['timeContainer', toolbarDirection === 'rtl' && 'timeLabelReverse'],
35
+ timeDigitsContainer: ['timeDigitsContainer', toolbarDirection === 'rtl' && 'timeLabelReverse'],
36
36
  separator: ['separator'],
37
- ampmSelection: ['ampmSelection', isLandscape && 'ampmLandscape'],
37
+ ampmSelection: ['ampmSelection', pickerOrientation === 'landscape' && 'ampmLandscape'],
38
38
  ampmLabel: ['ampmLabel']
39
39
  };
40
40
  return composeClasses(slots, getDateTimePickerToolbarUtilityClass, classes);
@@ -42,7 +42,8 @@ const useUtilityClasses = ownerState => {
42
42
  const DateTimePickerToolbarRoot = styled(PickersToolbar, {
43
43
  name: 'MuiDateTimePickerToolbar',
44
44
  slot: 'Root',
45
- overridesResolver: (props, styles) => styles.root
45
+ overridesResolver: (props, styles) => styles.root,
46
+ shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'toolbarVariant'
46
47
  })(({
47
48
  theme
48
49
  }) => ({
@@ -64,7 +65,7 @@ const DateTimePickerToolbarRoot = styled(PickersToolbar, {
64
65
  }, {
65
66
  props: {
66
67
  toolbarVariant: 'desktop',
67
- isLandscape: true
68
+ pickerOrientation: 'landscape'
68
69
  },
69
70
  style: {
70
71
  borderRight: `1px solid ${(theme.vars || theme).palette.divider}`
@@ -72,7 +73,7 @@ const DateTimePickerToolbarRoot = styled(PickersToolbar, {
72
73
  }, {
73
74
  props: {
74
75
  toolbarVariant: 'desktop',
75
- isLandscape: false
76
+ pickerOrientation: 'portrait'
76
77
  },
77
78
  style: {
78
79
  paddingLeft: 24,
@@ -92,13 +93,14 @@ const DateTimePickerToolbarDateContainer = styled('div', {
92
93
  const DateTimePickerToolbarTimeContainer = styled('div', {
93
94
  name: 'MuiDateTimePickerToolbar',
94
95
  slot: 'TimeContainer',
95
- overridesResolver: (props, styles) => styles.timeContainer
96
+ overridesResolver: (props, styles) => styles.timeContainer,
97
+ shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'toolbarVariant'
96
98
  })({
97
99
  display: 'flex',
98
100
  flexDirection: 'row',
99
101
  variants: [{
100
102
  props: {
101
- isRtl: true
103
+ toolbarDirection: 'rtl'
102
104
  },
103
105
  style: {
104
106
  flexDirection: 'row-reverse'
@@ -106,7 +108,7 @@ const DateTimePickerToolbarTimeContainer = styled('div', {
106
108
  }, {
107
109
  props: {
108
110
  toolbarVariant: 'desktop',
109
- isLandscape: false
111
+ pickerOrientation: 'portrait'
110
112
  },
111
113
  style: {
112
114
  gap: 9,
@@ -115,18 +117,18 @@ const DateTimePickerToolbarTimeContainer = styled('div', {
115
117
  }
116
118
  }, {
117
119
  props: ({
118
- isLandscape,
120
+ pickerOrientation,
119
121
  toolbarVariant
120
- }) => isLandscape && toolbarVariant !== 'desktop',
122
+ }) => pickerOrientation === 'landscape' && toolbarVariant !== 'desktop',
121
123
  style: {
122
124
  flexDirection: 'column'
123
125
  }
124
126
  }, {
125
127
  props: ({
126
- isLandscape,
128
+ pickerOrientation,
127
129
  toolbarVariant,
128
- isRtl
129
- }) => isLandscape && toolbarVariant !== 'desktop' && isRtl,
130
+ toolbarDirection
131
+ }) => pickerOrientation === 'landscape' && toolbarVariant !== 'desktop' && toolbarDirection === 'rtl',
130
132
  style: {
131
133
  flexDirection: 'column-reverse'
132
134
  }
@@ -135,12 +137,13 @@ const DateTimePickerToolbarTimeContainer = styled('div', {
135
137
  const DateTimePickerToolbarTimeDigitsContainer = styled('div', {
136
138
  name: 'MuiDateTimePickerToolbar',
137
139
  slot: 'TimeDigitsContainer',
138
- overridesResolver: (props, styles) => styles.timeDigitsContainer
140
+ overridesResolver: (props, styles) => styles.timeDigitsContainer,
141
+ shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'toolbarVariant'
139
142
  })({
140
143
  display: 'flex',
141
144
  variants: [{
142
145
  props: {
143
- isRtl: true
146
+ toolbarDirection: 'rtl'
144
147
  },
145
148
  style: {
146
149
  flexDirection: 'row-reverse'
@@ -157,7 +160,8 @@ const DateTimePickerToolbarTimeDigitsContainer = styled('div', {
157
160
  const DateTimePickerToolbarSeparator = styled(PickersToolbarText, {
158
161
  name: 'MuiDateTimePickerToolbar',
159
162
  slot: 'Separator',
160
- overridesResolver: (props, styles) => styles.separator
163
+ overridesResolver: (props, styles) => styles.separator,
164
+ shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'toolbarVariant'
161
165
  })({
162
166
  margin: '0 4px 0 2px',
163
167
  cursor: 'default',
@@ -190,7 +194,7 @@ const DateTimePickerToolbarAmPmSelection = styled('div', {
190
194
  },
191
195
  variants: [{
192
196
  props: {
193
- isLandscape: true
197
+ pickerOrientation: 'landscape'
194
198
  },
195
199
  style: {
196
200
  margin: '4px 0 auto',
@@ -201,6 +205,12 @@ const DateTimePickerToolbarAmPmSelection = styled('div', {
201
205
  }]
202
206
  });
203
207
 
208
+ /**
209
+ * If this context value is set to true, the toolbar will always be rendered in the desktop mode.
210
+ * This is used by the Date Time Range Picker Toolbar.
211
+ */
212
+ export const DateTimePickerToolbarForceDesktopVariant = /*#__PURE__*/React.createContext(false);
213
+
204
214
  /**
205
215
  * Demos:
206
216
  *
@@ -227,28 +237,28 @@ function DateTimePickerToolbar(inProps) {
227
237
  toolbarFormat,
228
238
  toolbarPlaceholder = '––',
229
239
  views,
230
- toolbarVariant = 'mobile',
231
240
  toolbarTitle: inToolbarTitle,
232
- className
241
+ className,
242
+ classes: classesProp
233
243
  } = props,
234
244
  other = _objectWithoutPropertiesLoose(props, _excluded);
235
- const isRtl = useRtl();
236
245
  const {
237
246
  disabled,
238
- readOnly
247
+ readOnly,
248
+ variant
239
249
  } = usePickerContext();
240
- const ownerState = _extends({}, props, {
241
- isRtl
242
- });
250
+ const ownerState = useToolbarOwnerState();
251
+ const classes = useUtilityClasses(classesProp, ownerState);
243
252
  const utils = useUtils();
244
253
  const {
245
254
  meridiemMode,
246
255
  handleMeridiemChange
247
256
  } = useMeridiemMode(value, ampm, onChange);
248
- const showAmPmControl = Boolean(ampm && !ampmInClock);
249
- const isDesktop = toolbarVariant === 'desktop';
250
257
  const translations = usePickerTranslations();
251
- const classes = useUtilityClasses(ownerState);
258
+ const forceDesktopVariant = React.useContext(DateTimePickerToolbarForceDesktopVariant);
259
+ const toolbarVariant = forceDesktopVariant ? 'desktop' : variant;
260
+ const isDesktop = toolbarVariant === 'desktop';
261
+ const showAmPmControl = Boolean(ampm && !ampmInClock);
252
262
  const toolbarTitle = inToolbarTitle ?? translations.dateTimePickerToolbarTitle;
253
263
  const formatHours = time => ampm ? utils.format(time, 'hours12h') : utils.format(time, 'hours24h');
254
264
  const dateText = React.useMemo(() => {
@@ -263,7 +273,8 @@ function DateTimePickerToolbar(inProps) {
263
273
  return /*#__PURE__*/_jsxs(DateTimePickerToolbarRoot, _extends({
264
274
  isLandscape: isLandscape,
265
275
  className: clsx(classes.root, className),
266
- toolbarTitle: toolbarTitle
276
+ toolbarTitle: toolbarTitle,
277
+ toolbarVariant: toolbarVariant
267
278
  }, other, {
268
279
  ownerState: ownerState,
269
280
  children: [/*#__PURE__*/_jsxs(DateTimePickerToolbarDateContainer, {
@@ -285,9 +296,11 @@ function DateTimePickerToolbar(inProps) {
285
296
  }), /*#__PURE__*/_jsxs(DateTimePickerToolbarTimeContainer, {
286
297
  className: classes.timeContainer,
287
298
  ownerState: ownerState,
299
+ toolbarVariant: toolbarVariant,
288
300
  children: [/*#__PURE__*/_jsxs(DateTimePickerToolbarTimeDigitsContainer, {
289
301
  className: classes.timeDigitsContainer,
290
302
  ownerState: ownerState,
303
+ toolbarVariant: toolbarVariant,
291
304
  children: [views.includes('hours') && /*#__PURE__*/_jsxs(React.Fragment, {
292
305
  children: [/*#__PURE__*/_jsx(PickersToolbarButton, {
293
306
  variant: isDesktop ? 'h5' : 'h3',
@@ -299,7 +312,8 @@ function DateTimePickerToolbar(inProps) {
299
312
  variant: isDesktop ? 'h5' : 'h3',
300
313
  value: ":",
301
314
  className: classes.separator,
302
- ownerState: ownerState
315
+ ownerState: ownerState,
316
+ toolbarVariant: toolbarVariant
303
317
  }), /*#__PURE__*/_jsx(PickersToolbarButton, {
304
318
  variant: isDesktop ? 'h5' : 'h3',
305
319
  width: isDesktop && !isLandscape ? MULTI_SECTION_CLOCK_SECTION_WIDTH : undefined,
@@ -313,7 +327,8 @@ function DateTimePickerToolbar(inProps) {
313
327
  variant: isDesktop ? 'h5' : 'h3',
314
328
  value: ":",
315
329
  className: classes.separator,
316
- ownerState: ownerState
330
+ ownerState: ownerState,
331
+ toolbarVariant: toolbarVariant
317
332
  }), /*#__PURE__*/_jsx(PickersToolbarButton, {
318
333
  variant: isDesktop ? 'h5' : 'h3',
319
334
  width: isDesktop && !isLandscape ? MULTI_SECTION_CLOCK_SECTION_WIDTH : undefined,
@@ -393,7 +408,6 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
393
408
  * If provided, it will be used instead of `dateTimePickerToolbarTitle` from localization.
394
409
  */
395
410
  toolbarTitle: PropTypes.node,
396
- toolbarVariant: PropTypes.oneOf(['desktop', 'mobile']),
397
411
  value: PropTypes.object,
398
412
  /**
399
413
  * Currently visible picker view.
@@ -131,8 +131,7 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
131
131
  }),
132
132
  toolbar: _extends({
133
133
  hidden: true,
134
- ampmInClock,
135
- toolbarVariant: 'desktop'
134
+ ampmInClock
136
135
  }, defaultizedProps.slotProps?.toolbar),
137
136
  tabs: _extends({
138
137
  hidden: true
@@ -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", "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"];
5
+ 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"];
6
6
  import * as React from 'react';
7
7
  import clsx from 'clsx';
8
8
  import PropTypes from 'prop-types';
@@ -24,11 +24,9 @@ import { useControlledValueWithTimezone } from "../internals/hooks/useValueWithT
24
24
  import { singleItemValueManager } from "../internals/utils/valueManagers.js";
25
25
  import { useClockReferenceDate } from "../internals/hooks/useClockReferenceDate.js";
26
26
  import { getFocusedListItemIndex } from "../internals/utils/utils.js";
27
+ import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
27
28
  import { jsx as _jsx } from "react/jsx-runtime";
28
- const useUtilityClasses = ownerState => {
29
- const {
30
- classes
31
- } = ownerState;
29
+ const useUtilityClasses = classes => {
32
30
  const slots = {
33
31
  root: ['root'],
34
32
  list: ['list'],
@@ -49,7 +47,7 @@ const DigitalClockRoot = styled(PickerViewRoot, {
49
47
  maxHeight: DIGITAL_CLOCK_VIEW_HEIGHT,
50
48
  variants: [{
51
49
  props: {
52
- alreadyRendered: true
50
+ hasDigitalClockAlreadyBeenRendered: true
53
51
  },
54
52
  style: {
55
53
  '@media (prefers-reduced-motion: no-preference)': {
@@ -133,6 +131,7 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
133
131
  focusedView,
134
132
  onFocusedViewChange,
135
133
  className,
134
+ classes: classesProp,
136
135
  disabled,
137
136
  readOnly,
138
137
  views = ['hours'],
@@ -155,15 +154,18 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
155
154
  });
156
155
  const translations = usePickerTranslations();
157
156
  const now = useNow(timezone);
158
- const ownerState = React.useMemo(() => _extends({}, props, {
159
- alreadyRendered: !!containerRef.current
160
- }), [props]);
161
- const classes = useUtilityClasses(ownerState);
157
+ const {
158
+ ownerState: pickerOwnerState
159
+ } = usePickerPrivateContext();
160
+ const ownerState = _extends({}, pickerOwnerState, {
161
+ hasDigitalClockAlreadyBeenRendered: !!containerRef.current
162
+ });
163
+ const classes = useUtilityClasses(classesProp);
162
164
  const ClockItem = slots?.digitalClockItem ?? DigitalClockItem;
163
165
  const clockItemProps = useSlotProps({
164
166
  elementType: ClockItem,
165
167
  externalSlotProps: slotProps?.digitalClockItem,
166
- ownerState: {},
168
+ ownerState,
167
169
  className: classes.item
168
170
  });
169
171
  const valueOrReferenceDate = useClockReferenceDate({
@@ -3,7 +3,7 @@ import { SlotComponentProps } from '@mui/utils';
3
3
  import MenuItem from '@mui/material/MenuItem';
4
4
  import { DigitalClockClasses } from './digitalClockClasses';
5
5
  import { BaseClockProps, DigitalClockOnlyProps, ExportedBaseClockProps } from '../internals/models/props/time';
6
- import { TimeView } from '../models';
6
+ import { PickerOwnerState, TimeView } from '../models';
7
7
  export interface ExportedDigitalClockProps extends ExportedBaseClockProps, DigitalClockOnlyProps {
8
8
  }
9
9
  export interface DigitalClockSlots {
@@ -14,7 +14,7 @@ export interface DigitalClockSlots {
14
14
  digitalClockItem?: React.ElementType;
15
15
  }
16
16
  export interface DigitalClockSlotProps {
17
- digitalClockItem?: SlotComponentProps<typeof MenuItem, {}, Record<string, any>>;
17
+ digitalClockItem?: SlotComponentProps<typeof MenuItem, {}, DigitalClockOwnerState>;
18
18
  }
19
19
  export interface DigitalClockProps extends ExportedDigitalClockProps, BaseClockProps<Extract<TimeView, 'hours'>> {
20
20
  /**
@@ -37,3 +37,9 @@ export interface DigitalClockProps extends ExportedDigitalClockProps, BaseClockP
37
37
  */
38
38
  slotProps?: DigitalClockSlotProps;
39
39
  }
40
+ export interface DigitalClockOwnerState extends PickerOwnerState {
41
+ /**
42
+ * `true` if this is not the initial render of the digital clock.
43
+ */
44
+ hasDigitalClockAlreadyBeenRendered: boolean;
45
+ }
@@ -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", "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"];
5
+ 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"];
6
6
  import * as React from 'react';
7
7
  import clsx from 'clsx';
8
8
  import PropTypes from 'prop-types';
@@ -23,11 +23,9 @@ import { useControlledValueWithTimezone } from "../internals/hooks/useValueWithT
23
23
  import { singleItemValueManager } from "../internals/utils/valueManagers.js";
24
24
  import { useClockReferenceDate } from "../internals/hooks/useClockReferenceDate.js";
25
25
  import { formatMeridiem } from "../internals/utils/date-utils.js";
26
+ import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
26
27
  import { jsx as _jsx } from "react/jsx-runtime";
27
- const useUtilityClasses = ownerState => {
28
- const {
29
- classes
30
- } = ownerState;
28
+ const useUtilityClasses = classes => {
31
29
  const slots = {
32
30
  root: ['root']
33
31
  };
@@ -86,6 +84,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
86
84
  focusedView: inFocusedView,
87
85
  onFocusedViewChange,
88
86
  className,
87
+ classes: classesProp,
89
88
  disabled,
90
89
  readOnly,
91
90
  skipDisabled = false,
@@ -319,8 +318,10 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
319
318
  });
320
319
  }, {});
321
320
  }, [views, buildViewProps]);
322
- const ownerState = props;
323
- const classes = useUtilityClasses(ownerState);
321
+ const {
322
+ ownerState
323
+ } = usePickerPrivateContext();
324
+ const classes = useUtilityClasses(classesProp);
324
325
  return /*#__PURE__*/_jsx(MultiSectionDigitalClockRoot, _extends({
325
326
  ref: ref,
326
327
  className: clsx(classes.root, className),
@@ -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 = ["autoFocus", "onChange", "className", "disabled", "readOnly", "items", "active", "slots", "slotProps", "skipDisabled"];
3
+ const _excluded = ["autoFocus", "onChange", "className", "classes", "disabled", "readOnly", "items", "active", "slots", "slotProps", "skipDisabled"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { alpha, styled, useThemeProps } from '@mui/material/styles';
@@ -11,11 +11,9 @@ import useForkRef from '@mui/utils/useForkRef';
11
11
  import { getMultiSectionDigitalClockSectionUtilityClass } from "./multiSectionDigitalClockSectionClasses.js";
12
12
  import { DIGITAL_CLOCK_VIEW_HEIGHT, MULTI_SECTION_CLOCK_SECTION_WIDTH } from "../internals/constants/dimensions.js";
13
13
  import { getFocusedListItemIndex } from "../internals/utils/utils.js";
14
+ import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
- const useUtilityClasses = ownerState => {
16
- const {
17
- classes
18
- } = ownerState;
16
+ const useUtilityClasses = classes => {
19
17
  const slots = {
20
18
  root: ['root'],
21
19
  item: ['item']
@@ -55,7 +53,7 @@ const MultiSectionDigitalClockSectionRoot = styled(MenuList, {
55
53
  },
56
54
  variants: [{
57
55
  props: {
58
- alreadyRendered: true
56
+ hasDigitalClockAlreadyBeenRendered: true
59
57
  },
60
58
  style: {
61
59
  '@media (prefers-reduced-motion: no-preference)': {
@@ -107,6 +105,7 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
107
105
  autoFocus,
108
106
  onChange,
109
107
  className,
108
+ classes: classesProp,
110
109
  disabled,
111
110
  readOnly,
112
111
  items,
@@ -116,10 +115,13 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
116
115
  skipDisabled
117
116
  } = props,
118
117
  other = _objectWithoutPropertiesLoose(props, _excluded);
119
- const ownerState = React.useMemo(() => _extends({}, props, {
120
- alreadyRendered: !!containerRef.current
121
- }), [props]);
122
- const classes = useUtilityClasses(ownerState);
118
+ const {
119
+ ownerState: pickerOwnerState
120
+ } = usePickerPrivateContext();
121
+ const ownerState = _extends({}, pickerOwnerState, {
122
+ hasDigitalClockAlreadyBeenRendered: !!containerRef.current
123
+ });
124
+ const classes = useUtilityClasses(classesProp);
123
125
  const DigitalClockSectionItem = slots?.digitalClockSectionItem ?? MultiSectionDigitalClockSectionItem;
124
126
  React.useEffect(() => {
125
127
  if (containerRef.current === null) {
@@ -5,10 +5,17 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
5
5
  const _excluded = ["onAccept", "onClear", "onCancel", "onSetToday", "actions"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import { styled } from '@mui/material/styles';
8
9
  import Button from '@mui/material/Button';
9
10
  import DialogActions from '@mui/material/DialogActions';
10
11
  import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ const PickersActionBarRoot = styled(DialogActions, {
14
+ name: 'MuiPickersLayout',
15
+ slot: 'ActionBar',
16
+ overridesResolver: (_, styles) => styles.actionBar
17
+ })({});
18
+
12
19
  /**
13
20
  * Demos:
14
21
  *
@@ -58,7 +65,7 @@ function PickersActionBar(props) {
58
65
  return null;
59
66
  }
60
67
  });
61
- return /*#__PURE__*/_jsx(DialogActions, _extends({}, other, {
68
+ return /*#__PURE__*/_jsx(PickersActionBarRoot, _extends({}, other, {
62
69
  children: buttons
63
70
  }));
64
71
  }
@@ -48,7 +48,7 @@ export const PickersLayoutRoot = styled('div', {
48
48
  }, {
49
49
  props: {
50
50
  pickerOrientation: 'landscape',
51
- isRtl: true
51
+ layoutDirection: 'rtl'
52
52
  },
53
53
  style: {
54
54
  [`& .${pickersLayoutClasses.toolbar}`]: {
@@ -72,7 +72,7 @@ export const PickersLayoutRoot = styled('div', {
72
72
  }, {
73
73
  props: {
74
74
  pickerOrientation: 'portrait',
75
- isRtl: true
75
+ layoutDirection: 'rtl'
76
76
  },
77
77
  style: {
78
78
  [`& .${pickersLayoutClasses.shortcuts}`]: {
@@ -31,9 +31,11 @@ export interface ExportedPickersLayoutSlots<TValue extends PickerValidValue, TVi
31
31
  }
32
32
  export interface PickerLayoutOwnerState extends PickerOwnerState {
33
33
  /**
34
- * `true` if the application is in right-to-left direction.
34
+ * The direction of the layout.
35
+ * Is equal to "ltr" when the layout is in left-to-right direction.
36
+ * Is equal to "rtl" when the layout is in right-to-left direction.
35
37
  */
36
- isRtl: boolean;
38
+ layoutDirection: 'ltr' | 'rtl';
37
39
  }
38
40
  export interface ExportedPickersLayoutSlotProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> {
39
41
  /**
@@ -59,9 +59,9 @@ const usePickerLayout = props => {
59
59
  // - For pickers value: PickerValidDate | null
60
60
  // - For range pickers value: [PickerValidDate | null, PickerValidDate | null]
61
61
  } = props;
62
- const ownerState = _extends({}, pickerOwnerState, {
63
- isRtl
64
- });
62
+ const ownerState = React.useMemo(() => _extends({}, pickerOwnerState, {
63
+ layoutDirection: isRtl ? 'rtl' : 'ltr'
64
+ }), [pickerOwnerState, isRtl]);
65
65
  const classes = useUtilityClasses(classesProp, ownerState);
66
66
 
67
67
  // Action bar
@@ -5,12 +5,19 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
5
5
  const _excluded = ["items", "changeImportance", "isLandscape", "onChange", "isValid"],
6
6
  _excluded2 = ["getValue"];
7
7
  import * as React from 'react';
8
+ import { styled } from '@mui/material/styles';
8
9
  import PropTypes from 'prop-types';
9
10
  import List from '@mui/material/List';
10
11
  import ListItem from '@mui/material/ListItem';
11
12
  import Chip from '@mui/material/Chip';
12
13
  import { VIEW_HEIGHT } from "../internals/constants/dimensions.js";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
+ const PickersShortcutsRoot = styled(List, {
16
+ name: 'MuiPickersLayout',
17
+ slot: 'Shortcuts',
18
+ overridesResolver: (_, styles) => styles.shortcuts
19
+ })({});
20
+
14
21
  /**
15
22
  * Demos:
16
23
  *
@@ -47,7 +54,7 @@ function PickersShortcuts(props) {
47
54
  disabled: !isValid(newValue)
48
55
  });
49
56
  });
50
- return /*#__PURE__*/_jsx(List, _extends({
57
+ return /*#__PURE__*/_jsx(PickersShortcutsRoot, _extends({
51
58
  dense: true,
52
59
  sx: [{
53
60
  maxHeight: VIEW_HEIGHT,
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # MUI X Date Pickers
2
2
 
3
3
  This package is the Community plan edition of the Date and Time Picker components.
4
- It's part of [MUI X](https://mui.com/x/), an open-core extension of MUI Core, with advanced components.
4
+ It's part of [MUI X](https://mui.com/x/), an open-core extension of our Core libraries, with advanced components.
5
5
 
6
6
  ## Installation
7
7