@mui/x-date-pickers 8.0.0-alpha.3 → 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 (96) hide show
  1. package/CHANGELOG.md +274 -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/PickersLayout/PickersLayout.js +2 -2
  13. package/PickersLayout/PickersLayout.types.d.ts +4 -2
  14. package/PickersLayout/usePickerLayout.js +3 -3
  15. package/README.md +1 -1
  16. package/TimeClock/Clock.js +18 -21
  17. package/TimeClock/ClockNumber.js +15 -11
  18. package/TimeClock/ClockPointer.d.ts +6 -1
  19. package/TimeClock/ClockPointer.js +14 -10
  20. package/TimeClock/TimeClock.js +9 -8
  21. package/TimeField/useTimeField.d.ts +1 -1
  22. package/TimePicker/TimePickerToolbar.js +14 -17
  23. package/hooks/useClearableField.d.ts +5 -3
  24. package/hooks/useClearableField.js +4 -2
  25. package/index.js +1 -1
  26. package/internals/components/PickerProvider.d.ts +1 -1
  27. package/internals/components/PickersPopper.d.ts +11 -7
  28. package/internals/components/PickersPopper.js +18 -20
  29. package/internals/components/PickersToolbar.js +15 -12
  30. package/internals/components/PickersToolbarButton.js +4 -6
  31. package/internals/components/PickersToolbarText.js +11 -13
  32. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +3 -2
  33. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +3 -2
  34. package/internals/hooks/usePicker/usePicker.js +3 -3
  35. package/internals/hooks/usePicker/usePicker.types.d.ts +3 -2
  36. package/internals/hooks/usePicker/usePickerProvider.d.ts +15 -4
  37. package/internals/hooks/usePicker/usePickerProvider.js +8 -4
  38. package/internals/hooks/usePicker/usePickerViews.d.ts +5 -15
  39. package/internals/hooks/usePicker/usePickerViews.js +5 -6
  40. package/internals/hooks/useToolbarOwnerState.d.ts +10 -0
  41. package/internals/hooks/useToolbarOwnerState.js +13 -0
  42. package/internals/index.d.ts +5 -1
  43. package/internals/index.js +3 -1
  44. package/internals/models/common.d.ts +1 -1
  45. package/locales/roRO.js +15 -18
  46. package/modern/DatePicker/DatePickerToolbar.js +8 -9
  47. package/modern/DateTimePicker/DateTimePickerToolbar.js +53 -39
  48. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -2
  49. package/modern/DigitalClock/DigitalClock.js +13 -11
  50. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
  51. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +12 -10
  52. package/modern/PickersLayout/PickersLayout.js +2 -2
  53. package/modern/PickersLayout/usePickerLayout.js +3 -3
  54. package/modern/TimeClock/Clock.js +18 -21
  55. package/modern/TimeClock/ClockNumber.js +15 -11
  56. package/modern/TimeClock/ClockPointer.js +14 -10
  57. package/modern/TimeClock/TimeClock.js +9 -8
  58. package/modern/TimePicker/TimePickerToolbar.js +14 -17
  59. package/modern/hooks/useClearableField.js +4 -2
  60. package/modern/index.js +1 -1
  61. package/modern/internals/components/PickersPopper.js +18 -20
  62. package/modern/internals/components/PickersToolbar.js +15 -12
  63. package/modern/internals/components/PickersToolbarButton.js +4 -6
  64. package/modern/internals/components/PickersToolbarText.js +11 -13
  65. package/modern/internals/hooks/usePicker/usePicker.js +3 -3
  66. package/modern/internals/hooks/usePicker/usePickerProvider.js +8 -4
  67. package/modern/internals/hooks/usePicker/usePickerViews.js +5 -6
  68. package/modern/internals/hooks/useToolbarOwnerState.js +13 -0
  69. package/modern/internals/index.js +3 -1
  70. package/modern/locales/roRO.js +15 -18
  71. package/node/DatePicker/DatePickerToolbar.js +8 -9
  72. package/node/DateTimePicker/DateTimePickerToolbar.js +54 -39
  73. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -2
  74. package/node/DigitalClock/DigitalClock.js +13 -11
  75. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
  76. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +12 -10
  77. package/node/PickersLayout/PickersLayout.js +2 -2
  78. package/node/PickersLayout/usePickerLayout.js +3 -3
  79. package/node/TimeClock/Clock.js +18 -21
  80. package/node/TimeClock/ClockNumber.js +15 -11
  81. package/node/TimeClock/ClockPointer.js +14 -10
  82. package/node/TimeClock/TimeClock.js +9 -8
  83. package/node/TimePicker/TimePickerToolbar.js +14 -17
  84. package/node/hooks/useClearableField.js +4 -2
  85. package/node/index.js +1 -1
  86. package/node/internals/components/PickersPopper.js +18 -20
  87. package/node/internals/components/PickersToolbar.js +15 -12
  88. package/node/internals/components/PickersToolbarButton.js +4 -6
  89. package/node/internals/components/PickersToolbarText.js +10 -12
  90. package/node/internals/hooks/usePicker/usePicker.js +3 -3
  91. package/node/internals/hooks/usePicker/usePickerProvider.js +8 -4
  92. package/node/internals/hooks/usePicker/usePickerViews.js +5 -6
  93. package/node/internals/hooks/useToolbarOwnerState.js +21 -0
  94. package/node/internals/index.js +15 -1
  95. package/node/locales/roRO.js +15 -18
  96. package/package.json +1 -1
@@ -1,35 +1,29 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["className", "selected", "value"];
3
+ const _excluded = ["className", "classes", "selected", "value"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import Typography from '@mui/material/Typography';
7
7
  import { styled, useThemeProps } from '@mui/material/styles';
8
8
  import composeClasses from '@mui/utils/composeClasses';
9
- import { getPickersToolbarTextUtilityClass, pickersToolbarTextClasses } from "./pickersToolbarTextClasses.js";
9
+ import { getPickersToolbarTextUtilityClass } from "./pickersToolbarTextClasses.js";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
- const useUtilityClasses = ownerState => {
12
- const {
13
- classes,
14
- selected
15
- } = ownerState;
11
+ const useUtilityClasses = classes => {
16
12
  const slots = {
17
- root: ['root', selected && 'selected']
13
+ root: ['root']
18
14
  };
19
15
  return composeClasses(slots, getPickersToolbarTextUtilityClass, classes);
20
16
  };
21
17
  const PickersToolbarTextRoot = styled(Typography, {
22
18
  name: 'MuiPickersToolbarText',
23
19
  slot: 'Root',
24
- overridesResolver: (_, styles) => [styles.root, {
25
- [`&.${pickersToolbarTextClasses.selected}`]: styles.selected
26
- }]
20
+ overridesResolver: (_, styles) => [styles.root]
27
21
  })(({
28
22
  theme
29
23
  }) => ({
30
24
  transition: theme.transitions.create('color'),
31
25
  color: (theme.vars || theme).palette.text.secondary,
32
- [`&.${pickersToolbarTextClasses.selected}`]: {
26
+ [`&[data-selected]`]: {
33
27
  color: (theme.vars || theme).palette.text.primary
34
28
  }
35
29
  }));
@@ -40,14 +34,18 @@ export const PickersToolbarText = /*#__PURE__*/React.forwardRef(function Pickers
40
34
  });
41
35
  const {
42
36
  className,
37
+ classes: classesProp,
38
+ selected,
43
39
  value
44
40
  } = props,
45
41
  other = _objectWithoutPropertiesLoose(props, _excluded);
46
- const classes = useUtilityClasses(props);
42
+ const classes = useUtilityClasses(classesProp);
47
43
  return /*#__PURE__*/_jsx(PickersToolbarTextRoot, _extends({
48
44
  ref: ref,
49
45
  className: clsx(classes.root, className),
50
46
  component: "span"
47
+ }, selected && {
48
+ 'data-selected': true
51
49
  }, other, {
52
50
  children: value
53
51
  }));
@@ -40,8 +40,8 @@ export const usePicker = ({
40
40
  localeText,
41
41
  valueManager,
42
42
  variant,
43
- views: pickerViewsResponse.views,
44
- paramsFromUsePickerValue: pickerValueResponse.provider
43
+ paramsFromUsePickerValue: pickerValueResponse.provider,
44
+ paramsFromUsePickerViews: pickerViewsResponse.provider
45
45
  });
46
46
  return {
47
47
  // Picker value
@@ -50,7 +50,7 @@ export const usePicker = ({
50
50
  fieldProps: pickerValueResponse.fieldProps,
51
51
  // Picker views
52
52
  renderCurrentView: pickerViewsResponse.renderCurrentView,
53
- hasUIView: pickerViewsResponse.hasUIView,
53
+ hasUIView: pickerViewsResponse.provider.hasUIView,
54
54
  shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
55
55
  // Picker layout
56
56
  layoutProps: _extends({}, pickerViewsResponse.layoutProps, pickerValueResponse.layoutProps),
@@ -40,11 +40,11 @@ export function usePickerProvider(parameters) {
40
40
  valueManager,
41
41
  localeText,
42
42
  variant,
43
- views,
44
- paramsFromUsePickerValue
43
+ paramsFromUsePickerValue,
44
+ paramsFromUsePickerViews
45
45
  } = parameters;
46
46
  const utils = useUtils();
47
- const orientation = usePickerOrientation(views, props.orientation);
47
+ const orientation = usePickerOrientation(paramsFromUsePickerViews.views, props.orientation);
48
48
  const ownerState = React.useMemo(() => ({
49
49
  isPickerValueEmpty: valueManager.areValuesEqual(utils, paramsFromUsePickerValue.value, valueManager.emptyValue),
50
50
  isPickerOpen: paramsFromUsePickerValue.contextValue.open,
@@ -70,6 +70,10 @@ export function usePickerProvider(parameters) {
70
70
  }
71
71
 
72
72
  /**
73
- * Props used to create the private context.
73
+ * Props used to create the picker's contexts.
74
74
  * Those props are exposed on all the pickers.
75
+ */
76
+
77
+ /**
78
+ * Props used to create the picker's contexts and that are not available on static pickers.
75
79
  */
@@ -11,10 +11,6 @@ import { isTimeView } from "../../utils/time-utils.js";
11
11
  * Props used to handle the views that are common to all pickers.
12
12
  */
13
13
 
14
- /**
15
- * Props used to handle the views of the pickers.
16
- */
17
-
18
14
  /**
19
15
  * Props used to handle the value of the pickers.
20
16
  */
@@ -132,11 +128,14 @@ export const usePickerViews = ({
132
128
  view: popperView,
133
129
  onViewChange: setView
134
130
  };
135
- return {
131
+ const providerParams = {
136
132
  hasUIView,
137
- views,
133
+ views
134
+ };
135
+ return {
138
136
  shouldRestoreFocus,
139
137
  layoutProps,
138
+ provider: providerParams,
140
139
  renderCurrentView: () => {
141
140
  if (popperView == null) {
142
141
  return null;
@@ -0,0 +1,13 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import { useRtl } from '@mui/system/RtlProvider';
4
+ import { usePickerPrivateContext } from "./usePickerPrivateContext.js";
5
+ export function useToolbarOwnerState() {
6
+ const {
7
+ ownerState: pickerOwnerState
8
+ } = usePickerPrivateContext();
9
+ const isRtl = useRtl();
10
+ return React.useMemo(() => _extends({}, pickerOwnerState, {
11
+ toolbarDirection: isRtl ? 'rtl' : 'ltr'
12
+ }), [pickerOwnerState, isRtl]);
13
+ }
@@ -16,6 +16,7 @@ export { useFieldOwnerState } from "./hooks/useFieldOwnerState.js";
16
16
  export { usePicker } from "./hooks/usePicker/index.js";
17
17
  export { usePickerPrivateContext } from "./hooks/usePickerPrivateContext.js";
18
18
  export { useStaticPicker } from "./hooks/useStaticPicker/index.js";
19
+ export { useToolbarOwnerState } from "./hooks/useToolbarOwnerState.js";
19
20
  export { useLocalizationContext, useDefaultDates, useUtils, useNow } from "./hooks/useUtils.js";
20
21
  export { useViews } from "./hooks/useViews.js";
21
22
  export { usePreviousMonthDisabled, useNextMonthDisabled } from "./hooks/date-helpers-hooks.js";
@@ -29,4 +30,5 @@ export { useDefaultReduceAnimations } from "./hooks/useDefaultReduceAnimations.j
29
30
  export { applyDefaultViewProps } from "./utils/views.js";
30
31
  export { DayCalendar } from "../DateCalendar/DayCalendar.js";
31
32
  export { useCalendarState } from "../DateCalendar/useCalendarState.js";
32
- export { isInternalTimeView, isTimeView } from "./utils/time-utils.js";
33
+ export { isInternalTimeView, isTimeView } from "./utils/time-utils.js";
34
+ export { DateTimePickerToolbarForceDesktopVariant } from "../DateTimePicker/DateTimePickerToolbar.js";
@@ -17,11 +17,10 @@ const roROPickers = {
17
17
  // DateRange labels
18
18
  start: 'Început',
19
19
  end: 'Sfârșit',
20
- // startDate: 'Start date',
21
- // startTime: 'Start time',
22
- // endDate: 'End date',
23
- // endTime: 'End time',
24
-
20
+ startDate: 'Data de început',
21
+ startTime: 'Ora de început',
22
+ endDate: 'Data de sfârșit',
23
+ endTime: 'Ora de sfârșit',
25
24
  // Action bar
26
25
  cancelButtonLabel: 'Anulare',
27
26
  clearButtonLabel: 'Ștergere',
@@ -55,23 +54,21 @@ const roROPickers = {
55
54
  fieldYearPlaceholder: params => 'A'.repeat(params.digitAmount),
56
55
  fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'LLLL' : 'LL',
57
56
  fieldDayPlaceholder: () => 'ZZ',
58
- // fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
57
+ fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'ZZZZ' : 'ZZ',
59
58
  fieldHoursPlaceholder: () => 'hh',
60
59
  fieldMinutesPlaceholder: () => 'mm',
61
60
  fieldSecondsPlaceholder: () => 'ss',
62
- fieldMeridiemPlaceholder: () => 'aa'
63
-
61
+ fieldMeridiemPlaceholder: () => 'aa',
64
62
  // View names
65
- // year: 'Year',
66
- // month: 'Month',
67
- // day: 'Day',
68
- // weekDay: 'Week day',
69
- // hours: 'Hours',
70
- // minutes: 'Minutes',
71
- // seconds: 'Seconds',
72
- // meridiem: 'Meridiem',
73
-
63
+ year: 'An',
64
+ month: 'Luna',
65
+ day: 'Ziua',
66
+ weekDay: 'Ziua saptămânii',
67
+ hours: 'Ore',
68
+ minutes: 'Minute',
69
+ seconds: 'Secunde',
70
+ meridiem: 'Meridiem',
74
71
  // Common
75
- // empty: 'Empty',
72
+ empty: 'Gol'
76
73
  };
77
74
  export const roRO = getPickersLocalization(roROPickers);
@@ -20,12 +20,10 @@ var _usePickerTranslations = require("../hooks/usePickerTranslations");
20
20
  var _useUtils = require("../internals/hooks/useUtils");
21
21
  var _datePickerToolbarClasses = require("./datePickerToolbarClasses");
22
22
  var _dateUtils = require("../internals/utils/date-utils");
23
+ var _useToolbarOwnerState = require("../internals/hooks/useToolbarOwnerState");
23
24
  var _jsxRuntime = require("react/jsx-runtime");
24
- const _excluded = ["value", "isLandscape", "onChange", "toolbarFormat", "toolbarPlaceholder", "views", "className", "onViewChange", "view"];
25
- const useUtilityClasses = ownerState => {
26
- const {
27
- classes
28
- } = ownerState;
25
+ const _excluded = ["value", "isLandscape", "onChange", "toolbarFormat", "toolbarPlaceholder", "views", "className", "classes", "onViewChange", "view"];
26
+ const useUtilityClasses = classes => {
29
27
  const slots = {
30
28
  root: ['root'],
31
29
  title: ['title']
@@ -44,7 +42,7 @@ const DatePickerToolbarTitle = (0, _styles.styled)(_Typography.default, {
44
42
  })({
45
43
  variants: [{
46
44
  props: {
47
- isLandscape: true
45
+ pickerOrientation: 'landscape'
48
46
  },
49
47
  style: {
50
48
  margin: 'auto 16px auto auto'
@@ -72,12 +70,14 @@ const DatePickerToolbar = exports.DatePickerToolbar = /*#__PURE__*/React.forward
72
70
  toolbarFormat,
73
71
  toolbarPlaceholder = '––',
74
72
  views,
75
- className
73
+ className,
74
+ classes: classesProp
76
75
  } = props,
77
76
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
78
77
  const utils = (0, _useUtils.useUtils)();
79
78
  const translations = (0, _usePickerTranslations.usePickerTranslations)();
80
- const classes = useUtilityClasses(props);
79
+ const ownerState = (0, _useToolbarOwnerState.useToolbarOwnerState)();
80
+ const classes = useUtilityClasses(classesProp);
81
81
  const dateText = React.useMemo(() => {
82
82
  if (!value) {
83
83
  return toolbarPlaceholder;
@@ -88,7 +88,6 @@ const DatePickerToolbar = exports.DatePickerToolbar = /*#__PURE__*/React.forward
88
88
  }, true);
89
89
  return utils.formatByString(value, formatFromViews);
90
90
  }, [value, toolbarFormat, toolbarPlaceholder, utils, views]);
91
- const ownerState = props;
92
91
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(DatePickerToolbarRoot, (0, _extends2.default)({
93
92
  ref: ref,
94
93
  toolbarTitle: translations.datePickerToolbarTitle,
@@ -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),