@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
@@ -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) {
@@ -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
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
 
@@ -11,20 +11,17 @@ import { useUtils } from "../internals/hooks/useUtils.js";
11
11
  import { CLOCK_HOUR_WIDTH, getHours, getMinutes } from "./shared.js";
12
12
  import { getClockUtilityClass } from "./clockClasses.js";
13
13
  import { formatMeridiem } from "../internals/utils/date-utils.js";
14
+ import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
14
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
- const useUtilityClasses = ownerState => {
16
- const {
17
- classes,
18
- meridiemMode
19
- } = ownerState;
16
+ const useUtilityClasses = (classes, ownerState) => {
20
17
  const slots = {
21
18
  root: ['root'],
22
19
  clock: ['clock'],
23
20
  wrapper: ['wrapper'],
24
21
  squareMask: ['squareMask'],
25
22
  pin: ['pin'],
26
- amButton: ['amButton', meridiemMode === 'am' && 'selected'],
27
- pmButton: ['pmButton', meridiemMode === 'pm' && 'selected'],
23
+ amButton: ['amButton', ownerState.clockMeridiemMode === 'am' && 'selected'],
24
+ pmButton: ['pmButton', ownerState.clockMeridiemMode === 'pm' && 'selected'],
28
25
  meridiemText: ['meridiemText']
29
26
  };
30
27
  return composeClasses(slots, getClockUtilityClass, classes);
@@ -78,7 +75,7 @@ const ClockSquareMask = styled('div', {
78
75
  userSelect: 'none',
79
76
  variants: [{
80
77
  props: {
81
- disabled: false
78
+ isClockDisabled: false
82
79
  },
83
80
  style: {
84
81
  '@media (pointer: fine)': {
@@ -182,13 +179,20 @@ export function Clock(inProps) {
182
179
  viewValue,
183
180
  disabled = false,
184
181
  readOnly,
185
- className
182
+ className,
183
+ classes: classesProp
186
184
  } = props;
187
- const ownerState = props;
188
185
  const utils = useUtils();
189
186
  const translations = usePickerTranslations();
187
+ const {
188
+ ownerState: pickerOwnerState
189
+ } = usePickerPrivateContext();
190
+ const ownerState = _extends({}, pickerOwnerState, {
191
+ isClockDisabled: disabled,
192
+ clockMeridiemMode: meridiemMode
193
+ });
190
194
  const isMoving = React.useRef(false);
191
- const classes = useUtilityClasses(ownerState);
195
+ const classes = useUtilityClasses(classesProp, ownerState);
192
196
  const isSelectedTimeDisabled = isTimeDisabled(viewValue, type);
193
197
  const isPointerInner = !ampm && type === 'hours' && (viewValue < 1 || viewValue > 12);
194
198
  const handleValueChange = (newValue, isFinish) => {
@@ -236,12 +240,7 @@ export function Clock(inProps) {
236
240
  }
237
241
  setTime(event.nativeEvent, 'finish');
238
242
  };
239
- const hasSelected = React.useMemo(() => {
240
- if (type === 'hours') {
241
- return true;
242
- }
243
- return viewValue % 5 === 0;
244
- }, [type, viewValue]);
243
+ const isPointerBetweenTwoClockValues = type === 'hours' ? false : viewValue % 5 !== 0;
245
244
  const keyboardControlStep = type === 'minutes' ? minutesStep : 1;
246
245
  const listboxRef = React.useRef(null);
247
246
  // Since this is rendered when a Popper is opened we can't use passive effects.
@@ -302,9 +301,7 @@ export function Clock(inProps) {
302
301
  onTouchEnd: handleTouchEnd,
303
302
  onMouseUp: handleMouseUp,
304
303
  onMouseMove: handleMouseMove,
305
- ownerState: {
306
- disabled
307
- },
304
+ ownerState: ownerState,
308
305
  className: classes.squareMask
309
306
  }), !isSelectedTimeDisabled && /*#__PURE__*/_jsxs(React.Fragment, {
310
307
  children: [/*#__PURE__*/_jsx(ClockPin, {
@@ -313,7 +310,7 @@ export function Clock(inProps) {
313
310
  type: type,
314
311
  viewValue: viewValue,
315
312
  isInner: isPointerInner,
316
- hasSelected: hasSelected
313
+ isBetweenTwoClockValues: isPointerBetweenTwoClockValues
317
314
  })]
318
315
  }), /*#__PURE__*/_jsx(ClockWrapper, {
319
316
  "aria-activedescendant": selectedId,
@@ -1,21 +1,17 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["className", "disabled", "index", "inner", "label", "selected"];
3
+ const _excluded = ["className", "classes", "disabled", "index", "inner", "label", "selected"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { styled, useThemeProps } from '@mui/material/styles';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import { CLOCK_WIDTH, CLOCK_HOUR_WIDTH } from "./shared.js";
9
9
  import { getClockNumberUtilityClass, clockNumberClasses } from "./clockNumberClasses.js";
10
+ import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
- const useUtilityClasses = ownerState => {
12
- const {
13
- classes,
14
- selected,
15
- disabled
16
- } = ownerState;
12
+ const useUtilityClasses = (classes, ownerState) => {
17
13
  const slots = {
18
- root: ['root', selected && 'selected', disabled && 'disabled']
14
+ root: ['root', ownerState.isClockNumberSelected && 'selected', ownerState.isClockNumberDisabled && 'disabled']
19
15
  };
20
16
  return composeClasses(slots, getClockNumberUtilityClass, classes);
21
17
  };
@@ -52,7 +48,7 @@ const ClockNumberRoot = styled('span', {
52
48
  },
53
49
  variants: [{
54
50
  props: {
55
- inner: true
51
+ isClockNumberInInnerRing: true
56
52
  },
57
53
  style: _extends({}, theme.typography.body2, {
58
54
  color: (theme.vars || theme).palette.text.secondary
@@ -70,6 +66,7 @@ export function ClockNumber(inProps) {
70
66
  });
71
67
  const {
72
68
  className,
69
+ classes: classesProp,
73
70
  disabled,
74
71
  index,
75
72
  inner,
@@ -77,8 +74,15 @@ export function ClockNumber(inProps) {
77
74
  selected
78
75
  } = props,
79
76
  other = _objectWithoutPropertiesLoose(props, _excluded);
80
- const ownerState = props;
81
- const classes = useUtilityClasses(ownerState);
77
+ const {
78
+ ownerState: pickerOwnerState
79
+ } = usePickerPrivateContext();
80
+ const ownerState = _extends({}, pickerOwnerState, {
81
+ isClockNumberInInnerRing: inner,
82
+ isClockNumberSelected: selected,
83
+ isClockNumberDisabled: disabled
84
+ });
85
+ const classes = useUtilityClasses(classesProp, ownerState);
82
86
  const angle = index % 12 / 12 * Math.PI * 2 - Math.PI / 2;
83
87
  const length = (CLOCK_WIDTH - CLOCK_HOUR_WIDTH - 2) / 2 * (inner ? 0.65 : 1);
84
88
  const x = Math.round(Math.cos(angle) * length);
@@ -2,7 +2,12 @@ import * as React from 'react';
2
2
  import { TimeView } from '../models';
3
3
  import { ClockPointerClasses } from './clockPointerClasses';
4
4
  export interface ClockPointerProps extends React.HTMLAttributes<HTMLDivElement> {
5
- hasSelected: boolean;
5
+ /**
6
+ * `true` if the pointer is between two clock values.
7
+ * On the `hours` view, it is always false.
8
+ * On the `minutes` view, it is true if the pointer is on a value that is not a multiple of 5.
9
+ */
10
+ isBetweenTwoClockValues: boolean;
6
11
  isInner: boolean;
7
12
  type: TimeView;
8
13
  viewValue: number;
@@ -1,17 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["className", "hasSelected", "isInner", "type", "viewValue"];
3
+ const _excluded = ["className", "classes", "isBetweenTwoClockValues", "isInner", "type", "viewValue"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { styled, useThemeProps } from '@mui/material/styles';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import { CLOCK_WIDTH, CLOCK_HOUR_WIDTH } from "./shared.js";
9
9
  import { getClockPointerUtilityClass } from "./clockPointerClasses.js";
10
+ import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
- const useUtilityClasses = ownerState => {
12
- const {
13
- classes
14
- } = ownerState;
12
+ const useUtilityClasses = classes => {
15
13
  const slots = {
16
14
  root: ['root'],
17
15
  thumb: ['thumb']
@@ -33,7 +31,7 @@ const ClockPointerRoot = styled('div', {
33
31
  transformOrigin: 'center bottom 0px',
34
32
  variants: [{
35
33
  props: {
36
- shouldAnimate: true
34
+ isClockPointerAnimated: true
37
35
  },
38
36
  style: {
39
37
  transition: theme.transitions.create(['transform', 'height'])
@@ -58,7 +56,7 @@ const ClockPointerThumb = styled('div', {
58
56
  boxSizing: 'content-box',
59
57
  variants: [{
60
58
  props: {
61
- hasSelected: true
59
+ isBetweenTwoClockValues: false
62
60
  },
63
61
  style: {
64
62
  backgroundColor: (theme.vars || theme).palette.primary.main
@@ -76,6 +74,8 @@ export function ClockPointer(inProps) {
76
74
  });
77
75
  const {
78
76
  className,
77
+ classes: classesProp,
78
+ isBetweenTwoClockValues,
79
79
  isInner,
80
80
  type,
81
81
  viewValue
@@ -85,10 +85,14 @@ export function ClockPointer(inProps) {
85
85
  React.useEffect(() => {
86
86
  previousType.current = type;
87
87
  }, [type]);
88
- const ownerState = _extends({}, props, {
89
- shouldAnimate: previousType.current !== type
88
+ const {
89
+ ownerState: pickerOwnerState
90
+ } = usePickerPrivateContext();
91
+ const ownerState = _extends({}, pickerOwnerState, {
92
+ isClockPointerAnimated: previousType.current !== type,
93
+ isClockPointerBetweenTwoValues: isBetweenTwoClockValues
90
94
  });
91
- const classes = useUtilityClasses(ownerState);
95
+ const classes = useUtilityClasses(classesProp);
92
96
  const getAngleStyle = () => {
93
97
  const max = type === 'hours' ? 12 : 60;
94
98
  let angle = 360 / max * viewValue;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["ampm", "ampmInClock", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableTime", "showViewSwitcher", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "timezone"];
5
+ const _excluded = ["ampm", "ampmInClock", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableTime", "showViewSwitcher", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "classes", "disabled", "readOnly", "timezone"];
6
6
  import * as React from 'react';
7
7
  import clsx from 'clsx';
8
8
  import PropTypes from 'prop-types';
@@ -21,11 +21,9 @@ import { getHourNumbers, getMinutesNumbers } from "./ClockNumbers.js";
21
21
  import { useControlledValueWithTimezone } from "../internals/hooks/useValueWithTimezone.js";
22
22
  import { singleItemValueManager } from "../internals/utils/valueManagers.js";
23
23
  import { useClockReferenceDate } from "../internals/hooks/useClockReferenceDate.js";
24
+ import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
24
25
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
- const useUtilityClasses = ownerState => {
26
- const {
27
- classes
28
- } = ownerState;
26
+ const useUtilityClasses = classes => {
29
27
  const slots = {
30
28
  root: ['root'],
31
29
  arrowSwitcher: ['arrowSwitcher']
@@ -93,6 +91,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
93
91
  focusedView,
94
92
  onFocusedViewChange,
95
93
  className,
94
+ classes: classesProp,
96
95
  disabled,
97
96
  readOnly,
98
97
  timezone: timezoneProp
@@ -120,6 +119,10 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
120
119
  });
121
120
  const translations = usePickerTranslations();
122
121
  const now = useNow(timezone);
122
+ const selectedId = useId();
123
+ const {
124
+ ownerState
125
+ } = usePickerPrivateContext();
123
126
  const {
124
127
  view,
125
128
  setView,
@@ -214,7 +217,6 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
214
217
  throw new Error('not supported');
215
218
  }
216
219
  }, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableTime, utils, disableFuture, disablePast, now, views]);
217
- const selectedId = useId();
218
220
  const viewProps = React.useMemo(() => {
219
221
  switch (view) {
220
222
  case 'hours':
@@ -279,8 +281,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
279
281
  throw new Error('You must provide the type for ClockView');
280
282
  }
281
283
  }, [view, utils, value, ampm, translations.hoursClockNumberText, translations.minutesClockNumberText, translations.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, isTimeDisabled, selectedId, disabled]);
282
- const ownerState = props;
283
- const classes = useUtilityClasses(ownerState);
284
+ const classes = useUtilityClasses(classesProp);
284
285
  return /*#__PURE__*/_jsxs(TimeClockRoot, _extends({
285
286
  ref: ref,
286
287
  className: clsx(classes.root, className),
@@ -1,2 +1,2 @@
1
1
  import { UseTimeFieldProps } from './TimeField.types';
2
- export declare const useTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("../internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps> & Required<Pick<UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("../internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "formatDensity" | "enableAccessibleFieldDOMStructure" | "selectedSections" | "onSelectedSectionsChange" | "timezone" | "unstableFieldRef" | "referenceDate" | "shouldRespectLeadingZeros" | "ampm" | keyof import("../internals").BaseTimeValidationProps | keyof import("../internals").TimeValidationProps | "dateSeparator">>;
2
+ export declare const useTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("../internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps> & Required<Pick<UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("../internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "ampm" | "timezone" | "referenceDate" | "formatDensity" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "enableAccessibleFieldDOMStructure" | keyof import("../internals").BaseTimeValidationProps | keyof import("../internals").TimeValidationProps | "dateSeparator">>;
@@ -2,11 +2,10 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "view", "onViewChange", "views", "className"];
5
+ const _excluded = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "view", "onViewChange", "views", "className", "classes"];
6
6
  import * as React from 'react';
7
7
  import clsx from 'clsx';
8
8
  import PropTypes from 'prop-types';
9
- import { useRtl } from '@mui/system/RtlProvider';
10
9
  import { styled, useThemeProps } from '@mui/material/styles';
11
10
  import composeClasses from '@mui/utils/composeClasses';
12
11
  import { PickersToolbarText } from "../internals/components/PickersToolbarText.js";
@@ -19,18 +18,18 @@ import { useMeridiemMode } from "../internals/hooks/date-helpers-hooks.js";
19
18
  import { getTimePickerToolbarUtilityClass, timePickerToolbarClasses } from "./timePickerToolbarClasses.js";
20
19
  import { formatMeridiem } from "../internals/utils/date-utils.js";
21
20
  import { usePickerContext } from "../hooks/index.js";
21
+ import { useToolbarOwnerState } from "../internals/hooks/useToolbarOwnerState.js";
22
22
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
- const useUtilityClasses = ownerState => {
23
+ const useUtilityClasses = (classes, ownerState) => {
24
24
  const {
25
- isLandscape,
26
- classes,
27
- isRtl
25
+ pickerOrientation,
26
+ toolbarDirection
28
27
  } = ownerState;
29
28
  const slots = {
30
29
  root: ['root'],
31
30
  separator: ['separator'],
32
- hourMinuteLabel: ['hourMinuteLabel', isLandscape && 'hourMinuteLabelLandscape', isRtl && 'hourMinuteLabelReverse'],
33
- ampmSelection: ['ampmSelection', isLandscape && 'ampmLandscape'],
31
+ hourMinuteLabel: ['hourMinuteLabel', pickerOrientation === 'landscape' && 'hourMinuteLabelLandscape', toolbarDirection === 'rtl' && 'hourMinuteLabelReverse'],
32
+ ampmSelection: ['ampmSelection', pickerOrientation === 'landscape' && 'ampmLandscape'],
34
33
  ampmLabel: ['ampmLabel']
35
34
  };
36
35
  return composeClasses(slots, getTimePickerToolbarUtilityClass, classes);
@@ -62,14 +61,14 @@ const TimePickerToolbarHourMinuteLabel = styled('div', {
62
61
  alignItems: 'flex-end',
63
62
  variants: [{
64
63
  props: {
65
- isRtl: true
64
+ toolbarDirection: 'rtl'
66
65
  },
67
66
  style: {
68
67
  flexDirection: 'row-reverse'
69
68
  }
70
69
  }, {
71
70
  props: {
72
- isLandscape: true
71
+ pickerOrientation: 'landscape'
73
72
  },
74
73
  style: {
75
74
  marginTop: 'auto'
@@ -94,7 +93,7 @@ const TimePickerToolbarAmPmSelection = styled('div', {
94
93
  },
95
94
  variants: [{
96
95
  props: {
97
- isLandscape: true
96
+ pickerOrientation: 'landscape'
98
97
  },
99
98
  style: {
100
99
  margin: '4px 0 auto',
@@ -129,12 +128,14 @@ function TimePickerToolbar(inProps) {
129
128
  view,
130
129
  onViewChange,
131
130
  views,
132
- className
131
+ className,
132
+ classes: classesProp
133
133
  } = props,
134
134
  other = _objectWithoutPropertiesLoose(props, _excluded);
135
135
  const utils = useUtils();
136
136
  const translations = usePickerTranslations();
137
- const isRtl = useRtl();
137
+ const ownerState = useToolbarOwnerState();
138
+ const classes = useUtilityClasses(classesProp, ownerState);
138
139
  const {
139
140
  disabled,
140
141
  readOnly
@@ -145,10 +146,6 @@ function TimePickerToolbar(inProps) {
145
146
  handleMeridiemChange
146
147
  } = useMeridiemMode(value, ampm, onChange);
147
148
  const formatHours = time => ampm ? utils.format(time, 'hours12h') : utils.format(time, 'hours24h');
148
- const ownerState = _extends({}, props, {
149
- isRtl
150
- });
151
- const classes = useUtilityClasses(ownerState);
152
149
  const separator = /*#__PURE__*/_jsx(TimePickerToolbarSeparator, {
153
150
  tabIndex: -1,
154
151
  value: ":",