@mui/x-date-pickers 6.13.0 → 6.15.0

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 (100) hide show
  1. package/CHANGELOG.md +162 -1
  2. package/DateCalendar/DateCalendar.js +2 -2
  3. package/DateField/DateField.js +2 -3
  4. package/DatePicker/DatePicker.js +2 -3
  5. package/DateTimeField/DateTimeField.js +2 -3
  6. package/DateTimePicker/DateTimePicker.js +2 -3
  7. package/DesktopDatePicker/DesktopDatePicker.js +2 -3
  8. package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -3
  9. package/DesktopTimePicker/DesktopTimePicker.js +2 -3
  10. package/MobileDatePicker/MobileDatePicker.js +2 -3
  11. package/MobileDateTimePicker/MobileDateTimePicker.js +2 -3
  12. package/MobileTimePicker/MobileTimePicker.js +2 -3
  13. package/MonthCalendar/MonthCalendar.js +9 -3
  14. package/MonthCalendar/MonthCalendar.types.d.ts +1 -0
  15. package/MonthCalendar/PickersMonth.d.ts +1 -0
  16. package/MonthCalendar/PickersMonth.js +7 -2
  17. package/README.md +4 -4
  18. package/TimeClock/Clock.js +29 -8
  19. package/TimeClock/clockClasses.d.ts +2 -0
  20. package/TimeClock/clockClasses.js +1 -1
  21. package/TimeField/TimeField.js +2 -3
  22. package/TimePicker/TimePicker.js +2 -3
  23. package/YearCalendar/PickersYear.js +3 -0
  24. package/YearCalendar/YearCalendar.js +7 -3
  25. package/YearCalendar/YearCalendar.types.d.ts +1 -0
  26. package/index.js +1 -1
  27. package/internals/components/PickersPopper.d.ts +2 -2
  28. package/internals/components/PickersPopper.js +3 -3
  29. package/internals/hooks/useField/useField.utils.js +8 -3
  30. package/legacy/DateCalendar/DateCalendar.js +2 -2
  31. package/legacy/DateField/DateField.js +2 -3
  32. package/legacy/DatePicker/DatePicker.js +2 -3
  33. package/legacy/DateTimeField/DateTimeField.js +2 -3
  34. package/legacy/DateTimePicker/DateTimePicker.js +2 -3
  35. package/legacy/DesktopDatePicker/DesktopDatePicker.js +2 -3
  36. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -3
  37. package/legacy/DesktopTimePicker/DesktopTimePicker.js +2 -3
  38. package/legacy/MobileDatePicker/MobileDatePicker.js +2 -3
  39. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +2 -3
  40. package/legacy/MobileTimePicker/MobileTimePicker.js +2 -3
  41. package/legacy/MonthCalendar/MonthCalendar.js +8 -2
  42. package/legacy/MonthCalendar/PickersMonth.js +5 -1
  43. package/legacy/TimeClock/Clock.js +31 -8
  44. package/legacy/TimeClock/clockClasses.js +1 -1
  45. package/legacy/TimeField/TimeField.js +2 -3
  46. package/legacy/TimePicker/TimePicker.js +2 -3
  47. package/legacy/YearCalendar/PickersYear.js +2 -0
  48. package/legacy/YearCalendar/YearCalendar.js +6 -2
  49. package/legacy/index.js +1 -1
  50. package/legacy/internals/components/PickersPopper.js +3 -3
  51. package/legacy/internals/hooks/useField/useField.utils.js +16 -8
  52. package/legacy/locales/fiFI.js +25 -11
  53. package/locales/fiFI.js +9 -11
  54. package/modern/DateCalendar/DateCalendar.js +2 -2
  55. package/modern/DateField/DateField.js +2 -3
  56. package/modern/DatePicker/DatePicker.js +2 -3
  57. package/modern/DateTimeField/DateTimeField.js +2 -3
  58. package/modern/DateTimePicker/DateTimePicker.js +2 -3
  59. package/modern/DesktopDatePicker/DesktopDatePicker.js +2 -3
  60. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -3
  61. package/modern/DesktopTimePicker/DesktopTimePicker.js +2 -3
  62. package/modern/MobileDatePicker/MobileDatePicker.js +2 -3
  63. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -3
  64. package/modern/MobileTimePicker/MobileTimePicker.js +2 -3
  65. package/modern/MonthCalendar/MonthCalendar.js +9 -3
  66. package/modern/MonthCalendar/PickersMonth.js +7 -2
  67. package/modern/TimeClock/Clock.js +29 -8
  68. package/modern/TimeClock/clockClasses.js +1 -1
  69. package/modern/TimeField/TimeField.js +2 -3
  70. package/modern/TimePicker/TimePicker.js +2 -3
  71. package/modern/YearCalendar/PickersYear.js +3 -0
  72. package/modern/YearCalendar/YearCalendar.js +7 -3
  73. package/modern/index.js +1 -1
  74. package/modern/internals/components/PickersPopper.js +3 -3
  75. package/modern/internals/hooks/useField/useField.utils.js +8 -3
  76. package/modern/locales/fiFI.js +9 -11
  77. package/node/DateCalendar/DateCalendar.js +2 -2
  78. package/node/DateField/DateField.js +2 -3
  79. package/node/DatePicker/DatePicker.js +4 -5
  80. package/node/DateTimeField/DateTimeField.js +2 -3
  81. package/node/DateTimePicker/DateTimePicker.js +4 -5
  82. package/node/DesktopDatePicker/DesktopDatePicker.js +2 -3
  83. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -3
  84. package/node/DesktopTimePicker/DesktopTimePicker.js +2 -3
  85. package/node/MobileDatePicker/MobileDatePicker.js +2 -3
  86. package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -3
  87. package/node/MobileTimePicker/MobileTimePicker.js +2 -3
  88. package/node/MonthCalendar/MonthCalendar.js +9 -3
  89. package/node/MonthCalendar/PickersMonth.js +7 -2
  90. package/node/TimeClock/Clock.js +28 -7
  91. package/node/TimeClock/clockClasses.js +1 -1
  92. package/node/TimeField/TimeField.js +2 -3
  93. package/node/TimePicker/TimePicker.js +4 -5
  94. package/node/YearCalendar/PickersYear.js +3 -0
  95. package/node/YearCalendar/YearCalendar.js +7 -3
  96. package/node/index.js +1 -1
  97. package/node/internals/components/PickersPopper.js +2 -2
  98. package/node/internals/hooks/useField/useField.utils.js +8 -3
  99. package/node/locales/fiFI.js +9 -11
  100. package/package.json +3 -3
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v6.13.0
2
+ * @mui/x-date-pickers v6.15.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -8,7 +8,7 @@ import Grow from '@mui/material/Grow';
8
8
  import Fade from '@mui/material/Fade';
9
9
  import MuiPaper from '@mui/material/Paper';
10
10
  import MuiPopper from '@mui/material/Popper';
11
- import MuiTrapFocus from '@mui/material/Unstable_TrapFocus';
11
+ import BaseFocusTrap from '@mui/material/Unstable_TrapFocus';
12
12
  import { unstable_useForkRef as useForkRef, unstable_useEventCallback as useEventCallback, unstable_ownerDocument as ownerDocument, unstable_composeClasses as composeClasses } from '@mui/utils';
13
13
  import { styled, useThemeProps } from '@mui/material/styles';
14
14
  import { getPickersPopperUtilityClass } from './pickersPopperClasses';
@@ -272,7 +272,7 @@ export function PickersPopper(inProps) {
272
272
  }
273
273
  };
274
274
  var Transition = ((_slots$desktopTransit = slots == null ? void 0 : slots.desktopTransition) != null ? _slots$desktopTransit : reduceAnimations) ? Fade : Grow;
275
- var TrapFocus = (_slots$desktopTrapFoc = slots == null ? void 0 : slots.desktopTrapFocus) != null ? _slots$desktopTrapFoc : MuiTrapFocus;
275
+ var FocusTrap = (_slots$desktopTrapFoc = slots == null ? void 0 : slots.desktopTrapFocus) != null ? _slots$desktopTrapFoc : BaseFocusTrap;
276
276
  var Paper = (_slots$desktopPaper = slots == null ? void 0 : slots.desktopPaper) != null ? _slots$desktopPaper : PickersPopperPaper;
277
277
  var Popper = (_slots$popper = slots == null ? void 0 : slots.popper) != null ? _slots$popper : PickersPopperRoot;
278
278
  var popperProps = useSlotProps({
@@ -293,7 +293,7 @@ export function PickersPopper(inProps) {
293
293
  children: function children(_ref3) {
294
294
  var TransitionProps = _ref3.TransitionProps,
295
295
  popperPlacement = _ref3.placement;
296
- return /*#__PURE__*/_jsx(TrapFocus, _extends({
296
+ return /*#__PURE__*/_jsx(FocusTrap, _extends({
297
297
  open: open,
298
298
  disableAutoFocus: true
299
299
  // pickers are managing focus position manually
@@ -396,21 +396,28 @@ export var splitFormatIntoSections = function splitFormatIntoSections(utils, tim
396
396
  var escapedParts = getEscapedPartsFromFormat(utils, expandedFormat);
397
397
 
398
398
  // This RegExp test if the beginning of a string correspond to a supported token
399
- var isTokenStartRegExp = new RegExp("^(".concat(Object.keys(utils.formatTokenMap).join('|'), ")"));
399
+ var isTokenStartRegExp = new RegExp("^(".concat(Object.keys(utils.formatTokenMap).sort(function (a, b) {
400
+ return b.length - a.length;
401
+ }) // Sort to put longest word first
402
+ .join('|'), ")"), 'g') // used to get access to lastIndex state
403
+ ;
404
+
400
405
  var currentTokenValue = '';
401
- var _loop = function _loop(i) {
406
+ var _loop = function _loop(_i) {
402
407
  var escapedPartOfCurrentChar = escapedParts.find(function (escapeIndex) {
403
- return escapeIndex.start <= i && escapeIndex.end >= i;
408
+ return escapeIndex.start <= _i && escapeIndex.end >= _i;
404
409
  });
405
- var char = expandedFormat[i];
410
+ var char = expandedFormat[_i];
406
411
  var isEscapedChar = escapedPartOfCurrentChar != null;
407
- var potentialToken = "".concat(currentTokenValue).concat(expandedFormat.slice(i));
408
- if (!isEscapedChar && char.match(/([A-Za-z]+)/) && isTokenStartRegExp.test(potentialToken)) {
409
- currentTokenValue += char;
412
+ var potentialToken = "".concat(currentTokenValue).concat(expandedFormat.slice(_i));
413
+ var regExpMatch = isTokenStartRegExp.test(potentialToken);
414
+ if (!isEscapedChar && char.match(/([A-Za-z]+)/) && regExpMatch) {
415
+ currentTokenValue = potentialToken.slice(0, isTokenStartRegExp.lastIndex);
416
+ _i += isTokenStartRegExp.lastIndex - 1;
410
417
  } else {
411
418
  // If we are on the opening or closing character of an escaped part of the format,
412
419
  // Then we ignore this character.
413
- var isEscapeBoundary = isEscapedChar && (escapedPartOfCurrentChar == null ? void 0 : escapedPartOfCurrentChar.start) === i || (escapedPartOfCurrentChar == null ? void 0 : escapedPartOfCurrentChar.end) === i;
420
+ var isEscapeBoundary = isEscapedChar && (escapedPartOfCurrentChar == null ? void 0 : escapedPartOfCurrentChar.start) === _i || (escapedPartOfCurrentChar == null ? void 0 : escapedPartOfCurrentChar.end) === _i;
414
421
  if (!isEscapeBoundary) {
415
422
  commitToken(currentTokenValue);
416
423
  currentTokenValue = '';
@@ -421,6 +428,7 @@ export var splitFormatIntoSections = function splitFormatIntoSections(utils, tim
421
428
  }
422
429
  }
423
430
  }
431
+ i = _i;
424
432
  };
425
433
  for (var i = 0; i < expandedFormat.length; i += 1) {
426
434
  _loop(i);
@@ -63,17 +63,31 @@ var fiFIPickers = {
63
63
  },
64
64
  // Table labels
65
65
  timeTableLabel: 'valitse aika',
66
- dateTableLabel: 'valitse päivä'
67
-
66
+ dateTableLabel: 'valitse päivä',
68
67
  // Field section placeholders
69
- // fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
70
- // fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
71
- // fieldDayPlaceholder: () => 'DD',
72
- // fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
73
- // fieldHoursPlaceholder: () => 'hh',
74
- // fieldMinutesPlaceholder: () => 'mm',
75
- // fieldSecondsPlaceholder: () => 'ss',
76
- // fieldMeridiemPlaceholder: () => 'aa',
68
+ fieldYearPlaceholder: function fieldYearPlaceholder(params) {
69
+ return 'V'.repeat(params.digitAmount);
70
+ },
71
+ fieldMonthPlaceholder: function fieldMonthPlaceholder(params) {
72
+ return params.contentType === 'letter' ? 'KKKK' : 'KK';
73
+ },
74
+ fieldDayPlaceholder: function fieldDayPlaceholder() {
75
+ return 'PP';
76
+ },
77
+ fieldWeekDayPlaceholder: function fieldWeekDayPlaceholder(params) {
78
+ return params.contentType === 'letter' ? 'EEEE' : 'EE';
79
+ },
80
+ fieldHoursPlaceholder: function fieldHoursPlaceholder() {
81
+ return 'tt';
82
+ },
83
+ fieldMinutesPlaceholder: function fieldMinutesPlaceholder() {
84
+ return 'mm';
85
+ },
86
+ fieldSecondsPlaceholder: function fieldSecondsPlaceholder() {
87
+ return 'ss';
88
+ },
89
+ fieldMeridiemPlaceholder: function fieldMeridiemPlaceholder() {
90
+ return 'aa';
91
+ }
77
92
  };
78
-
79
93
  export var fiFI = getPickersLocalization(fiFIPickers);
package/locales/fiFI.js CHANGED
@@ -43,17 +43,15 @@ const fiFIPickers = {
43
43
  openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Valitse aika, valittu aika on ${utils.format(value, 'fullTime')}` : 'Valitse aika',
44
44
  // Table labels
45
45
  timeTableLabel: 'valitse aika',
46
- dateTableLabel: 'valitse päivä'
47
-
46
+ dateTableLabel: 'valitse päivä',
48
47
  // Field section placeholders
49
- // fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
50
- // fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
51
- // fieldDayPlaceholder: () => 'DD',
52
- // fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
53
- // fieldHoursPlaceholder: () => 'hh',
54
- // fieldMinutesPlaceholder: () => 'mm',
55
- // fieldSecondsPlaceholder: () => 'ss',
56
- // fieldMeridiemPlaceholder: () => 'aa',
48
+ fieldYearPlaceholder: params => 'V'.repeat(params.digitAmount),
49
+ fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'KKKK' : 'KK',
50
+ fieldDayPlaceholder: () => 'PP',
51
+ fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
52
+ fieldHoursPlaceholder: () => 'tt',
53
+ fieldMinutesPlaceholder: () => 'mm',
54
+ fieldSecondsPlaceholder: () => 'ss',
55
+ fieldMeridiemPlaceholder: () => 'aa'
57
56
  };
58
-
59
57
  export const fiFI = getPickersLocalization(fiFIPickers);
@@ -275,7 +275,8 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
275
275
  disableHighlightToday,
276
276
  readOnly,
277
277
  disabled,
278
- timezone
278
+ timezone,
279
+ gridLabelId
279
280
  };
280
281
  const prevOpenViewRef = React.useRef(view);
281
282
  React.useEffect(() => {
@@ -329,7 +330,6 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
329
330
  shouldDisableYear: shouldDisableYear,
330
331
  hasFocus: hasFocus,
331
332
  onFocusedViewChange: isViewFocused => setFocusedView('day', isViewFocused),
332
- gridLabelId: gridLabelId,
333
333
  showDaysOutsideCurrentMonth: showDaysOutsideCurrentMonth,
334
334
  fixedWeekNumber: fixedWeekNumber,
335
335
  dayOfWeekFormatter: dayOfWeekFormatter,
@@ -8,6 +8,7 @@ import PropTypes from 'prop-types';
8
8
  import MuiTextField from '@mui/material/TextField';
9
9
  import { useThemeProps } from '@mui/material/styles';
10
10
  import { useSlotProps } from '@mui/base/utils';
11
+ import { refType } from '@mui/utils';
11
12
  import { useDateField } from './useDateField';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, ref) {
@@ -174,9 +175,7 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
174
175
  /**
175
176
  * Pass a ref to the `input` element.
176
177
  */
177
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
178
- current: PropTypes.any.isRequired
179
- })]),
178
+ inputRef: refType,
180
179
  /**
181
180
  * The label content.
182
181
  */
@@ -5,6 +5,7 @@ import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import useMediaQuery from '@mui/material/useMediaQuery';
7
7
  import { useThemeProps } from '@mui/material/styles';
8
+ import { refType } from '@mui/utils';
8
9
  import { DesktopDatePicker } from '../DesktopDatePicker';
9
10
  import { MobileDatePicker } from '../MobileDatePicker';
10
11
  import { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from '../internals/utils/utils';
@@ -136,9 +137,7 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
136
137
  /**
137
138
  * Pass a ref to the `input` element.
138
139
  */
139
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
140
- current: PropTypes.object
141
- })]),
140
+ inputRef: refType,
142
141
  /**
143
142
  * The label content.
144
143
  */
@@ -8,6 +8,7 @@ import PropTypes from 'prop-types';
8
8
  import MuiTextField from '@mui/material/TextField';
9
9
  import { useThemeProps } from '@mui/material/styles';
10
10
  import { useSlotProps } from '@mui/base/utils';
11
+ import { refType } from '@mui/utils';
11
12
  import { useDateTimeField } from './useDateTimeField';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inProps, ref) {
@@ -184,9 +185,7 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
184
185
  /**
185
186
  * Pass a ref to the `input` element.
186
187
  */
187
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
188
- current: PropTypes.any.isRequired
189
- })]),
188
+ inputRef: refType,
190
189
  /**
191
190
  * The label content.
192
191
  */
@@ -5,6 +5,7 @@ import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import useMediaQuery from '@mui/material/useMediaQuery';
7
7
  import { useThemeProps } from '@mui/material/styles';
8
+ import { refType } from '@mui/utils';
8
9
  import { DesktopDateTimePicker } from '../DesktopDateTimePicker';
9
10
  import { MobileDateTimePicker } from '../MobileDateTimePicker';
10
11
  import { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from '../internals/utils/utils';
@@ -151,9 +152,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
151
152
  /**
152
153
  * Pass a ref to the `input` element.
153
154
  */
154
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
155
- current: PropTypes.object
156
- })]),
155
+ inputRef: refType,
157
156
  /**
158
157
  * The label content.
159
158
  */
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { resolveComponentProps } from '@mui/base/utils';
5
+ import { refType } from '@mui/utils';
5
6
  import { singleItemValueManager } from '../internals/utils/valueManagers';
6
7
  import { useDatePickerDefaultizedProps } from '../DatePicker/shared';
7
8
  import { useLocaleText, useUtils, validateDate } from '../internals';
@@ -150,9 +151,7 @@ DesktopDatePicker.propTypes = {
150
151
  /**
151
152
  * Pass a ref to the `input` element.
152
153
  */
153
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
154
- current: PropTypes.object
155
- })]),
154
+ inputRef: refType,
156
155
  /**
157
156
  * The label content.
158
157
  */
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { resolveComponentProps } from '@mui/base/utils';
5
+ import { refType } from '@mui/utils';
5
6
  import { singleItemValueManager } from '../internals/utils/valueManagers';
6
7
  import { DateTimeField } from '../DateTimeField';
7
8
  import { useDateTimePickerDefaultizedProps } from '../DateTimePicker/shared';
@@ -201,9 +202,7 @@ DesktopDateTimePicker.propTypes = {
201
202
  /**
202
203
  * Pass a ref to the `input` element.
203
204
  */
204
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
205
- current: PropTypes.object
206
- })]),
205
+ inputRef: refType,
207
206
  /**
208
207
  * The label content.
209
208
  */
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { resolveComponentProps } from '@mui/base/utils';
5
+ import { refType } from '@mui/utils';
5
6
  import { singleItemValueManager } from '../internals/utils/valueManagers';
6
7
  import { TimeField } from '../TimeField';
7
8
  import { useTimePickerDefaultizedProps } from '../TimePicker/shared';
@@ -162,9 +163,7 @@ DesktopTimePicker.propTypes = {
162
163
  /**
163
164
  * Pass a ref to the `input` element.
164
165
  */
165
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
166
- current: PropTypes.object
167
- })]),
166
+ inputRef: refType,
168
167
  /**
169
168
  * The label content.
170
169
  */
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { resolveComponentProps } from '@mui/base/utils';
5
+ import { refType } from '@mui/utils';
5
6
  import { useMobilePicker } from '../internals/hooks/useMobilePicker';
6
7
  import { useDatePickerDefaultizedProps } from '../DatePicker/shared';
7
8
  import { useLocaleText, useUtils, validateDate } from '../internals';
@@ -147,9 +148,7 @@ MobileDatePicker.propTypes = {
147
148
  /**
148
149
  * Pass a ref to the `input` element.
149
150
  */
150
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
151
- current: PropTypes.object
152
- })]),
151
+ inputRef: refType,
153
152
  /**
154
153
  * The label content.
155
154
  */
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { resolveComponentProps } from '@mui/base/utils';
5
+ import { refType } from '@mui/utils';
5
6
  import { singleItemValueManager } from '../internals/utils/valueManagers';
6
7
  import { DateTimeField } from '../DateTimeField';
7
8
  import { useDateTimePickerDefaultizedProps } from '../DateTimePicker/shared';
@@ -173,9 +174,7 @@ MobileDateTimePicker.propTypes = {
173
174
  /**
174
175
  * Pass a ref to the `input` element.
175
176
  */
176
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
177
- current: PropTypes.object
178
- })]),
177
+ inputRef: refType,
179
178
  /**
180
179
  * The label content.
181
180
  */
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { resolveComponentProps } from '@mui/base/utils';
5
+ import { refType } from '@mui/utils';
5
6
  import { singleItemValueManager } from '../internals/utils/valueManagers';
6
7
  import { TimeField } from '../TimeField';
7
8
  import { useTimePickerDefaultizedProps } from '../TimePicker/shared';
@@ -140,9 +141,7 @@ MobileTimePicker.propTypes = {
140
141
  /**
141
142
  * Pass a ref to the `input` element.
142
143
  */
143
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
144
- current: PropTypes.object
145
- })]),
144
+ inputRef: refType,
146
145
  /**
147
146
  * The label content.
148
147
  */
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["className", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "autoFocus", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow", "timezone"];
3
+ const _excluded = ["className", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "autoFocus", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow", "timezone", "gridLabelId"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -71,7 +71,8 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
71
71
  hasFocus,
72
72
  onFocusedViewChange,
73
73
  monthsPerRow = 3,
74
- timezone: timezoneProp
74
+ timezone: timezoneProp,
75
+ gridLabelId
75
76
  } = props,
76
77
  other = _objectWithoutPropertiesLoose(props, _excluded);
77
78
  const {
@@ -193,11 +194,14 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
193
194
  return /*#__PURE__*/_jsx(MonthCalendarRoot, _extends({
194
195
  ref: ref,
195
196
  className: clsx(classes.root, className),
196
- ownerState: ownerState
197
+ ownerState: ownerState,
198
+ role: "radiogroup",
199
+ "aria-labelledby": gridLabelId
197
200
  }, other, {
198
201
  children: getMonthsInYear(utils, value ?? referenceDate).map(month => {
199
202
  const monthNumber = utils.getMonth(month);
200
203
  const monthText = utils.format(month, 'monthShort');
204
+ const monthLabel = utils.format(month, 'month');
201
205
  const isSelected = monthNumber === selectedMonth;
202
206
  const isDisabled = disabled || isMonthDisabled(month);
203
207
  return /*#__PURE__*/_jsx(PickersMonth, {
@@ -211,6 +215,7 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
211
215
  onFocus: handleMonthFocus,
212
216
  onBlur: handleMonthBlur,
213
217
  "aria-current": todayMonth === monthNumber ? 'date' : undefined,
218
+ "aria-label": monthLabel,
214
219
  monthsPerRow: monthsPerRow,
215
220
  children: monthText
216
221
  }, monthText);
@@ -255,6 +260,7 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
255
260
  * @default false
256
261
  */
257
262
  disablePast: PropTypes.bool,
263
+ gridLabelId: PropTypes.string,
258
264
  hasFocus: PropTypes.bool,
259
265
  /**
260
266
  * Maximal selectable date.
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["autoFocus", "children", "disabled", "selected", "value", "tabIndex", "onClick", "onKeyDown", "onFocus", "onBlur", "aria-current", "monthsPerRow"];
3
+ const _excluded = ["autoFocus", "children", "disabled", "selected", "value", "tabIndex", "onClick", "onKeyDown", "onFocus", "onBlur", "aria-current", "aria-label", "monthsPerRow"];
4
4
  import * as React from 'react';
5
5
  import { styled, alpha, useThemeProps } from '@mui/material/styles';
6
6
  import { unstable_composeClasses as composeClasses, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
@@ -85,13 +85,15 @@ export const PickersMonth = /*#__PURE__*/React.memo(function PickersMonth(inProp
85
85
  autoFocus,
86
86
  children,
87
87
  disabled,
88
+ selected,
88
89
  value,
89
90
  tabIndex,
90
91
  onClick,
91
92
  onKeyDown,
92
93
  onFocus,
93
94
  onBlur,
94
- 'aria-current': ariaCurrent
95
+ 'aria-current': ariaCurrent,
96
+ 'aria-label': ariaLabel
95
97
  // We don't want to forward this prop to the root element
96
98
  } = props,
97
99
  other = _objectWithoutPropertiesLoose(props, _excluded);
@@ -110,8 +112,11 @@ export const PickersMonth = /*#__PURE__*/React.memo(function PickersMonth(inProp
110
112
  ref: ref,
111
113
  disabled: disabled,
112
114
  type: "button",
115
+ role: "radio",
113
116
  tabIndex: disabled ? -1 : tabIndex,
114
117
  "aria-current": ariaCurrent,
118
+ "aria-checked": selected,
119
+ "aria-label": ariaLabel,
115
120
  onClick: event => onClick(event, value),
116
121
  onKeyDown: event => onKeyDown(event, value),
117
122
  onFocus: event => onFocus(event, value),
@@ -7,8 +7,9 @@ import { styled, useThemeProps } from '@mui/material/styles';
7
7
  import { unstable_useEnhancedEffect as useEnhancedEffect, unstable_composeClasses as composeClasses } from '@mui/utils';
8
8
  import { ClockPointer } from './ClockPointer';
9
9
  import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
10
- import { getHours, getMinutes } from './shared';
10
+ import { CLOCK_HOUR_WIDTH, getHours, getMinutes } from './shared';
11
11
  import { getClockUtilityClass } from './clockClasses';
12
+ import { formatMeridiem } from '../internals/utils/date-utils';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
15
  const useUtilityClasses = ownerState => {
@@ -22,7 +23,8 @@ const useUtilityClasses = ownerState => {
22
23
  squareMask: ['squareMask'],
23
24
  pin: ['pin'],
24
25
  amButton: ['amButton'],
25
- pmButton: ['pmButton']
26
+ pmButton: ['pmButton'],
27
+ meridiemText: ['meridiemText']
26
28
  };
27
29
  return composeClasses(slots, getClockUtilityClass, classes);
28
30
  };
@@ -111,7 +113,10 @@ const ClockAmButton = styled(IconButton, {
111
113
  zIndex: 1,
112
114
  position: 'absolute',
113
115
  bottom: 8,
114
- left: 8
116
+ left: 8,
117
+ paddingLeft: 4,
118
+ paddingRight: 4,
119
+ width: CLOCK_HOUR_WIDTH
115
120
  }, ownerState.meridiemMode === 'am' && {
116
121
  backgroundColor: (theme.vars || theme).palette.primary.main,
117
122
  color: (theme.vars || theme).palette.primary.contrastText,
@@ -130,7 +135,10 @@ const ClockPmButton = styled(IconButton, {
130
135
  zIndex: 1,
131
136
  position: 'absolute',
132
137
  bottom: 8,
133
- right: 8
138
+ right: 8,
139
+ paddingLeft: 4,
140
+ paddingRight: 4,
141
+ width: CLOCK_HOUR_WIDTH
134
142
  }, ownerState.meridiemMode === 'pm' && {
135
143
  backgroundColor: (theme.vars || theme).palette.primary.main,
136
144
  color: (theme.vars || theme).palette.primary.contrastText,
@@ -138,6 +146,15 @@ const ClockPmButton = styled(IconButton, {
138
146
  backgroundColor: (theme.vars || theme).palette.primary.light
139
147
  }
140
148
  }));
149
+ const ClockMeridiemText = styled(Typography, {
150
+ name: 'MuiClock',
151
+ slot: 'meridiemText',
152
+ overridesResolver: (_, styles) => styles.meridiemText
153
+ })({
154
+ overflow: 'hidden',
155
+ whiteSpace: 'nowrap',
156
+ textOverflow: 'ellipsis'
157
+ });
141
158
 
142
159
  /**
143
160
  * @ignore - internal component.
@@ -298,18 +315,22 @@ export function Clock(inProps) {
298
315
  disabled: disabled || meridiemMode === null,
299
316
  ownerState: ownerState,
300
317
  className: classes.amButton,
301
- children: /*#__PURE__*/_jsx(Typography, {
318
+ title: formatMeridiem(utils, 'am'),
319
+ children: /*#__PURE__*/_jsx(ClockMeridiemText, {
302
320
  variant: "caption",
303
- children: "AM"
321
+ className: classes.meridiemText,
322
+ children: formatMeridiem(utils, 'am')
304
323
  })
305
324
  }), /*#__PURE__*/_jsx(ClockPmButton, {
306
325
  disabled: disabled || meridiemMode === null,
307
326
  onClick: readOnly ? undefined : () => handleMeridiemChange('pm'),
308
327
  ownerState: ownerState,
309
328
  className: classes.pmButton,
310
- children: /*#__PURE__*/_jsx(Typography, {
329
+ title: formatMeridiem(utils, 'pm'),
330
+ children: /*#__PURE__*/_jsx(ClockMeridiemText, {
311
331
  variant: "caption",
312
- children: "PM"
332
+ className: classes.meridiemText,
333
+ children: formatMeridiem(utils, 'pm')
313
334
  })
314
335
  })]
315
336
  })]
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClass as generateUtilityClass, unstable_generat
2
2
  export function getClockUtilityClass(slot) {
3
3
  return generateUtilityClass('MuiClock', slot);
4
4
  }
5
- export const clockClasses = generateUtilityClasses('MuiClock', ['root', 'clock', 'wrapper', 'squareMask', 'pin', 'amButton', 'pmButton']);
5
+ export const clockClasses = generateUtilityClasses('MuiClock', ['root', 'clock', 'wrapper', 'squareMask', 'pin', 'amButton', 'pmButton', 'meridiemText']);
@@ -8,6 +8,7 @@ import PropTypes from 'prop-types';
8
8
  import MuiTextField from '@mui/material/TextField';
9
9
  import { useThemeProps } from '@mui/material/styles';
10
10
  import { useSlotProps } from '@mui/base/utils';
11
+ import { refType } from '@mui/utils';
11
12
  import { useTimeField } from './useTimeField';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, ref) {
@@ -184,9 +185,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
184
185
  /**
185
186
  * Pass a ref to the `input` element.
186
187
  */
187
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
188
- current: PropTypes.any.isRequired
189
- })]),
188
+ inputRef: refType,
190
189
  /**
191
190
  * The label content.
192
191
  */
@@ -5,6 +5,7 @@ import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import useMediaQuery from '@mui/material/useMediaQuery';
7
7
  import { useThemeProps } from '@mui/material/styles';
8
+ import { refType } from '@mui/utils';
8
9
  import { DesktopTimePicker } from '../DesktopTimePicker';
9
10
  import { MobileTimePicker } from '../MobileTimePicker';
10
11
  import { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from '../internals/utils/utils';
@@ -125,9 +126,7 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
125
126
  /**
126
127
  * Pass a ref to the `input` element.
127
128
  */
128
- inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
129
- current: PropTypes.object
130
- })]),
129
+ inputRef: refType,
131
130
  /**
132
131
  * The label content.
133
132
  */
@@ -87,6 +87,7 @@ export const PickersYear = /*#__PURE__*/React.memo(function PickersYear(inProps)
87
87
  className,
88
88
  children,
89
89
  disabled,
90
+ selected,
90
91
  value,
91
92
  tabIndex,
92
93
  onClick,
@@ -115,8 +116,10 @@ export const PickersYear = /*#__PURE__*/React.memo(function PickersYear(inProps)
115
116
  ref: ref,
116
117
  disabled: disabled,
117
118
  type: "button",
119
+ role: "radio",
118
120
  tabIndex: disabled ? -1 : tabIndex,
119
121
  "aria-current": ariaCurrent,
122
+ "aria-checked": selected,
120
123
  onClick: event => onClick(event, value),
121
124
  onKeyDown: event => onKeyDown(event, value),
122
125
  onFocus: event => onFocus(event, value),
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["autoFocus", "className", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "readOnly", "shouldDisableYear", "disableHighlightToday", "onYearFocus", "hasFocus", "onFocusedViewChange", "yearsPerRow", "timezone"];
3
+ const _excluded = ["autoFocus", "className", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "readOnly", "shouldDisableYear", "disableHighlightToday", "onYearFocus", "hasFocus", "onFocusedViewChange", "yearsPerRow", "timezone", "gridLabelId"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -77,7 +77,8 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
77
77
  hasFocus,
78
78
  onFocusedViewChange,
79
79
  yearsPerRow = 3,
80
- timezone: timezoneProp
80
+ timezone: timezoneProp,
81
+ gridLabelId
81
82
  } = props,
82
83
  other = _objectWithoutPropertiesLoose(props, _excluded);
83
84
  const {
@@ -222,7 +223,9 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
222
223
  return /*#__PURE__*/_jsx(YearCalendarRoot, _extends({
223
224
  ref: handleRef,
224
225
  className: clsx(classes.root, className),
225
- ownerState: ownerState
226
+ ownerState: ownerState,
227
+ role: "radiogroup",
228
+ "aria-labelledby": gridLabelId
226
229
  }, other, {
227
230
  children: utils.getYearRange(minDate, maxDate).map(year => {
228
231
  const yearNumber = utils.getYear(year);
@@ -283,6 +286,7 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
283
286
  * @default false
284
287
  */
285
288
  disablePast: PropTypes.bool,
289
+ gridLabelId: PropTypes.string,
286
290
  hasFocus: PropTypes.bool,
287
291
  /**
288
292
  * Maximal selectable date.