@mui/x-date-pickers 7.8.0 → 7.10.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.
- package/CHANGELOG.md +140 -0
- package/DateCalendar/DayCalendar.js +7 -6
- package/DatePicker/DatePickerToolbar.js +4 -3
- package/DateTimePicker/DateTimePickerTabs.d.ts +2 -1
- package/DateTimePicker/DateTimePickerTabs.js +4 -4
- package/DateTimePicker/DateTimePickerToolbar.js +4 -3
- package/DesktopDatePicker/DesktopDatePicker.js +4 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -3
- package/DesktopTimePicker/DesktopTimePicker.js +4 -3
- package/DigitalClock/DigitalClock.js +4 -3
- package/MobileDatePicker/MobileDatePicker.js +4 -3
- package/MobileDateTimePicker/MobileDateTimePicker.js +4 -3
- package/MobileTimePicker/MobileTimePicker.js +4 -3
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
- package/PickersActionBar/PickersActionBar.js +6 -6
- package/PickersCalendarHeader/PickersCalendarHeader.js +6 -5
- package/TimeClock/Clock.js +4 -3
- package/TimeClock/TimeClock.js +9 -8
- package/TimePicker/TimePickerToolbar.js +4 -3
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- package/hooks/useClearableField.js +3 -3
- package/hooks/usePickersTranslations.d.ts +2 -0
- package/hooks/usePickersTranslations.js +2 -0
- package/index.js +1 -1
- package/internals/hooks/useField/useFieldState.js +6 -5
- package/internals/hooks/useField/useFieldV6TextField.js +10 -9
- package/internals/hooks/useField/useFieldV7TextField.js +7 -9
- package/internals/hooks/useUtils.d.ts +0 -1
- package/internals/hooks/useUtils.js +0 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +2 -2
- package/internals/utils/date-time-utils.d.ts +1 -1
- package/internals/utils/validation/extractValidationProps.d.ts +1 -1
- package/modern/DateCalendar/DayCalendar.js +7 -6
- package/modern/DatePicker/DatePickerToolbar.js +4 -3
- package/modern/DateTimePicker/DateTimePickerTabs.js +4 -4
- package/modern/DateTimePicker/DateTimePickerToolbar.js +4 -3
- package/modern/DesktopDatePicker/DesktopDatePicker.js +4 -3
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -3
- package/modern/DesktopTimePicker/DesktopTimePicker.js +4 -3
- package/modern/DigitalClock/DigitalClock.js +4 -3
- package/modern/MobileDatePicker/MobileDatePicker.js +4 -3
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +4 -3
- package/modern/MobileTimePicker/MobileTimePicker.js +4 -3
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
- package/modern/PickersActionBar/PickersActionBar.js +6 -6
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +6 -5
- package/modern/TimeClock/Clock.js +4 -3
- package/modern/TimeClock/TimeClock.js +9 -8
- package/modern/TimePicker/TimePickerToolbar.js +4 -3
- package/modern/hooks/index.js +2 -1
- package/modern/hooks/useClearableField.js +3 -3
- package/modern/hooks/usePickersTranslations.js +2 -0
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useField/useFieldState.js +6 -5
- package/modern/internals/hooks/useField/useFieldV6TextField.js +10 -9
- package/modern/internals/hooks/useField/useFieldV7TextField.js +7 -9
- package/modern/internals/hooks/useUtils.js +0 -1
- package/modern/internals/index.js +2 -2
- package/node/DateCalendar/DayCalendar.js +6 -5
- package/node/DatePicker/DatePickerToolbar.js +3 -2
- package/node/DateTimePicker/DateTimePickerTabs.js +4 -4
- package/node/DateTimePicker/DateTimePickerToolbar.js +3 -2
- package/node/DesktopDatePicker/DesktopDatePicker.js +3 -2
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -2
- package/node/DesktopTimePicker/DesktopTimePicker.js +3 -2
- package/node/DigitalClock/DigitalClock.js +3 -2
- package/node/MobileDatePicker/MobileDatePicker.js +3 -2
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +3 -2
- package/node/MobileTimePicker/MobileTimePicker.js +3 -2
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -6
- package/node/PickersActionBar/PickersActionBar.js +6 -6
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +5 -4
- package/node/TimeClock/Clock.js +3 -2
- package/node/TimeClock/TimeClock.js +8 -7
- package/node/TimePicker/TimePickerToolbar.js +3 -2
- package/node/hooks/index.js +8 -1
- package/node/hooks/useClearableField.js +3 -3
- package/node/hooks/usePickersTranslations.js +9 -0
- package/node/index.js +1 -1
- package/node/internals/hooks/useField/useFieldState.js +5 -4
- package/node/internals/hooks/useField/useFieldV6TextField.js +10 -9
- package/node/internals/hooks/useField/useFieldV7TextField.js +6 -8
- package/node/internals/hooks/useUtils.js +1 -3
- package/node/internals/index.js +6 -6
- package/package.json +3 -3
package/TimeClock/Clock.js
CHANGED
|
@@ -5,7 +5,8 @@ import Typography from '@mui/material/Typography';
|
|
|
5
5
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
6
6
|
import { unstable_useEnhancedEffect as useEnhancedEffect, unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
7
7
|
import { ClockPointer } from './ClockPointer';
|
|
8
|
-
import {
|
|
8
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
9
|
+
import { useUtils } from '../internals/hooks/useUtils';
|
|
9
10
|
import { CLOCK_HOUR_WIDTH, getHours, getMinutes } from './shared';
|
|
10
11
|
import { getClockUtilityClass } from './clockClasses';
|
|
11
12
|
import { formatMeridiem } from '../internals/utils/date-utils';
|
|
@@ -196,7 +197,7 @@ export function Clock(inProps) {
|
|
|
196
197
|
} = props;
|
|
197
198
|
const ownerState = props;
|
|
198
199
|
const utils = useUtils();
|
|
199
|
-
const
|
|
200
|
+
const translations = usePickersTranslations();
|
|
200
201
|
const isMoving = React.useRef(false);
|
|
201
202
|
const classes = useUtilityClasses(ownerState);
|
|
202
203
|
const isSelectedTimeDisabled = isTimeDisabled(viewValue, type);
|
|
@@ -312,7 +313,7 @@ export function Clock(inProps) {
|
|
|
312
313
|
})]
|
|
313
314
|
}), /*#__PURE__*/_jsx(ClockWrapper, {
|
|
314
315
|
"aria-activedescendant": selectedId,
|
|
315
|
-
"aria-label":
|
|
316
|
+
"aria-label": translations.clockLabelText(type, value, utils),
|
|
316
317
|
ref: listboxRef,
|
|
317
318
|
role: "listbox",
|
|
318
319
|
onKeyDown: handleKeyDown,
|
package/TimeClock/TimeClock.js
CHANGED
|
@@ -6,7 +6,8 @@ import clsx from 'clsx';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
8
|
import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
10
|
+
import { useUtils, useNow } from '../internals/hooks/useUtils';
|
|
10
11
|
import { PickersArrowSwitcher } from '../internals/components/PickersArrowSwitcher';
|
|
11
12
|
import { convertValueToMeridiem, createIsAfterIgnoreDatePart } from '../internals/utils/time-utils';
|
|
12
13
|
import { useViews } from '../internals/hooks/useViews';
|
|
@@ -114,7 +115,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
114
115
|
props,
|
|
115
116
|
timezone
|
|
116
117
|
});
|
|
117
|
-
const
|
|
118
|
+
const translations = usePickersTranslations();
|
|
118
119
|
const now = useNow(timezone);
|
|
119
120
|
const {
|
|
120
121
|
view,
|
|
@@ -227,7 +228,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
227
228
|
utils,
|
|
228
229
|
ampm,
|
|
229
230
|
onChange: handleHoursChange,
|
|
230
|
-
getClockNumberText:
|
|
231
|
+
getClockNumberText: translations.hoursClockNumberText,
|
|
231
232
|
isDisabled: hourValue => disabled || isTimeDisabled(hourValue, 'hours'),
|
|
232
233
|
selectedId
|
|
233
234
|
})
|
|
@@ -246,7 +247,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
246
247
|
utils,
|
|
247
248
|
value: minutesValue,
|
|
248
249
|
onChange: handleMinutesChange,
|
|
249
|
-
getClockNumberText:
|
|
250
|
+
getClockNumberText: translations.minutesClockNumberText,
|
|
250
251
|
isDisabled: minuteValue => disabled || isTimeDisabled(minuteValue, 'minutes'),
|
|
251
252
|
selectedId
|
|
252
253
|
})
|
|
@@ -265,7 +266,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
265
266
|
utils,
|
|
266
267
|
value: secondsValue,
|
|
267
268
|
onChange: handleSecondsChange,
|
|
268
|
-
getClockNumberText:
|
|
269
|
+
getClockNumberText: translations.secondsClockNumberText,
|
|
269
270
|
isDisabled: secondValue => disabled || isTimeDisabled(secondValue, 'seconds'),
|
|
270
271
|
selectedId
|
|
271
272
|
})
|
|
@@ -274,7 +275,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
274
275
|
default:
|
|
275
276
|
throw new Error('You must provide the type for ClockView');
|
|
276
277
|
}
|
|
277
|
-
}, [view, utils, value, ampm,
|
|
278
|
+
}, [view, utils, value, ampm, translations.hoursClockNumberText, translations.minutesClockNumberText, translations.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, isTimeDisabled, selectedId, disabled]);
|
|
278
279
|
const ownerState = props;
|
|
279
280
|
const classes = useUtilityClasses(ownerState);
|
|
280
281
|
return /*#__PURE__*/_jsxs(TimeClockRoot, _extends({
|
|
@@ -301,10 +302,10 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
301
302
|
slotProps: slotProps,
|
|
302
303
|
onGoToPrevious: () => setView(previousView),
|
|
303
304
|
isPreviousDisabled: !previousView,
|
|
304
|
-
previousLabel:
|
|
305
|
+
previousLabel: translations.openPreviousView,
|
|
305
306
|
onGoToNext: () => setView(nextView),
|
|
306
307
|
isNextDisabled: !nextView,
|
|
307
|
-
nextLabel:
|
|
308
|
+
nextLabel: translations.openNextView,
|
|
308
309
|
ownerState: ownerState
|
|
309
310
|
})]
|
|
310
311
|
}));
|
|
@@ -11,7 +11,8 @@ import { PickersToolbarText } from '../internals/components/PickersToolbarText';
|
|
|
11
11
|
import { PickersToolbarButton } from '../internals/components/PickersToolbarButton';
|
|
12
12
|
import { PickersToolbar } from '../internals/components/PickersToolbar';
|
|
13
13
|
import { arrayIncludes } from '../internals/utils/utils';
|
|
14
|
-
import {
|
|
14
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
15
|
+
import { useUtils } from '../internals/hooks/useUtils';
|
|
15
16
|
import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
|
|
16
17
|
import { getTimePickerToolbarUtilityClass, timePickerToolbarClasses } from './timePickerToolbarClasses';
|
|
17
18
|
import { formatMeridiem } from '../internals/utils/date-utils';
|
|
@@ -131,7 +132,7 @@ function TimePickerToolbar(inProps) {
|
|
|
131
132
|
} = props,
|
|
132
133
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
133
134
|
const utils = useUtils();
|
|
134
|
-
const
|
|
135
|
+
const translations = usePickersTranslations();
|
|
135
136
|
const isRtl = useRtl();
|
|
136
137
|
const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes('hours'));
|
|
137
138
|
const {
|
|
@@ -152,7 +153,7 @@ function TimePickerToolbar(inProps) {
|
|
|
152
153
|
});
|
|
153
154
|
return /*#__PURE__*/_jsxs(TimePickerToolbarRoot, _extends({
|
|
154
155
|
landscapeDirection: "row",
|
|
155
|
-
toolbarTitle:
|
|
156
|
+
toolbarTitle: translations.timePickerToolbarTitle,
|
|
156
157
|
isLandscape: isLandscape,
|
|
157
158
|
ownerState: ownerState,
|
|
158
159
|
className: clsx(classes.root, className)
|
package/hooks/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { useClearableField } from './useClearableField';
|
|
2
2
|
export type { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps, UseClearableFieldResponse, } from './useClearableField';
|
|
3
|
+
export { usePickersTranslations } from './usePickersTranslations';
|
package/hooks/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { useClearableField } from './useClearableField';
|
|
1
|
+
export { useClearableField } from './useClearableField';
|
|
2
|
+
export { usePickersTranslations } from './usePickersTranslations';
|
|
@@ -7,10 +7,10 @@ import { useSlotProps } from '@mui/base/utils';
|
|
|
7
7
|
import MuiIconButton from '@mui/material/IconButton';
|
|
8
8
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
9
9
|
import { ClearIcon } from '../icons';
|
|
10
|
-
import {
|
|
10
|
+
import { usePickersTranslations } from './usePickersTranslations';
|
|
11
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
export const useClearableField = props => {
|
|
13
|
-
const
|
|
13
|
+
const translations = usePickersTranslations();
|
|
14
14
|
const {
|
|
15
15
|
clearable,
|
|
16
16
|
onClear,
|
|
@@ -28,7 +28,7 @@ export const useClearableField = props => {
|
|
|
28
28
|
ownerState: {},
|
|
29
29
|
className: 'clearButton',
|
|
30
30
|
additionalProps: {
|
|
31
|
-
title:
|
|
31
|
+
title: translations.fieldClearLabel
|
|
32
32
|
}
|
|
33
33
|
}),
|
|
34
34
|
iconButtonProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
package/index.js
CHANGED
|
@@ -2,14 +2,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import useControlled from '@mui/utils/useControlled';
|
|
4
4
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
5
|
-
import {
|
|
5
|
+
import { usePickersTranslations } from '../../../hooks/usePickersTranslations';
|
|
6
|
+
import { useUtils, useLocalizationContext } from '../useUtils';
|
|
6
7
|
import { mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections, parseSelectedSections, getLocalizedDigits } from './useField.utils';
|
|
7
8
|
import { buildSectionsFromFormat } from './buildSectionsFromFormat';
|
|
8
9
|
import { useValueWithTimezone } from '../useValueWithTimezone';
|
|
9
10
|
import { getSectionTypeGranularity } from '../../utils/getDefaultReferenceDate';
|
|
10
11
|
export const useFieldState = params => {
|
|
11
12
|
const utils = useUtils();
|
|
12
|
-
const
|
|
13
|
+
const translations = usePickersTranslations();
|
|
13
14
|
const adapter = useLocalizationContext();
|
|
14
15
|
const isRtl = useRtl();
|
|
15
16
|
const {
|
|
@@ -48,7 +49,7 @@ export const useFieldState = params => {
|
|
|
48
49
|
const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, date => buildSectionsFromFormat({
|
|
49
50
|
utils,
|
|
50
51
|
timezone,
|
|
51
|
-
localeText,
|
|
52
|
+
localeText: translations,
|
|
52
53
|
localizedDigits,
|
|
53
54
|
format,
|
|
54
55
|
date,
|
|
@@ -56,7 +57,7 @@ export const useFieldState = params => {
|
|
|
56
57
|
shouldRespectLeadingZeros,
|
|
57
58
|
enableAccessibleFieldDOMStructure,
|
|
58
59
|
isRtl
|
|
59
|
-
})), [fieldValueManager, format,
|
|
60
|
+
})), [fieldValueManager, format, translations, localizedDigits, isRtl, shouldRespectLeadingZeros, utils, formatDensity, timezone, enableAccessibleFieldDOMStructure]);
|
|
60
61
|
const [state, setState] = React.useState(() => {
|
|
61
62
|
const sections = getSectionsFromValue(valueFromTheOutside);
|
|
62
63
|
validateSections(sections, valueType);
|
|
@@ -156,7 +157,7 @@ export const useFieldState = params => {
|
|
|
156
157
|
const sections = buildSectionsFromFormat({
|
|
157
158
|
utils,
|
|
158
159
|
timezone,
|
|
159
|
-
localeText,
|
|
160
|
+
localeText: translations,
|
|
160
161
|
localizedDigits,
|
|
161
162
|
format,
|
|
162
163
|
date,
|
|
@@ -36,6 +36,7 @@ export const addPositionPropertiesToSections = (sections, localizedDigits, isRtl
|
|
|
36
36
|
export const useFieldV6TextField = params => {
|
|
37
37
|
const isRtl = useRtl();
|
|
38
38
|
const focusTimeoutRef = React.useRef();
|
|
39
|
+
const selectionSyncTimeoutRef = React.useRef();
|
|
39
40
|
const {
|
|
40
41
|
forwardedProps: {
|
|
41
42
|
onFocus,
|
|
@@ -103,10 +104,14 @@ export const useFieldV6TextField = params => {
|
|
|
103
104
|
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
+
clearTimeout(selectionSyncTimeoutRef.current);
|
|
108
|
+
selectionSyncTimeoutRef.current = setTimeout(() => {
|
|
107
109
|
// handle case when the selection is not updated correctly
|
|
108
110
|
// could happen on Android
|
|
109
|
-
if (inputRef.current && inputRef.current === getActiveElement(document) &&
|
|
111
|
+
if (inputRef.current && inputRef.current === getActiveElement(document) &&
|
|
112
|
+
// The section might loose all selection, where `selectionStart === selectionEnd`
|
|
113
|
+
// https://github.com/mui/mui-x/pull/13652
|
|
114
|
+
inputRef.current.selectionStart === inputRef.current.selectionEnd && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
|
|
110
115
|
interactions.syncSelectionToDOM();
|
|
111
116
|
}
|
|
112
117
|
});
|
|
@@ -118,8 +123,7 @@ export const useFieldV6TextField = params => {
|
|
|
118
123
|
getActiveSectionIndexFromDOM: () => {
|
|
119
124
|
const browserStartIndex = inputRef.current.selectionStart ?? 0;
|
|
120
125
|
const browserEndIndex = inputRef.current.selectionEnd ?? 0;
|
|
121
|
-
|
|
122
|
-
if (browserStartIndex === 0 && browserEndIndex === 0 || isInputReadOnly) {
|
|
126
|
+
if (browserStartIndex === 0 && browserEndIndex === 0) {
|
|
123
127
|
return null;
|
|
124
128
|
}
|
|
125
129
|
const nextSectionIndex = browserStartIndex <= sections[0].startInInput ? 1 // Special case if browser index is in invisible characters at the beginning.
|
|
@@ -134,10 +138,6 @@ export const useFieldV6TextField = params => {
|
|
|
134
138
|
isFieldFocused: () => inputRef.current === getActiveElement(document)
|
|
135
139
|
}), [inputRef, parsedSelectedSections, sections, setSelectedSections]);
|
|
136
140
|
const syncSelectionFromDOM = () => {
|
|
137
|
-
if (readOnly) {
|
|
138
|
-
setSelectedSections(null);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
141
|
const browserStartIndex = inputRef.current.selectionStart ?? 0;
|
|
142
142
|
let nextSectionIndex;
|
|
143
143
|
if (browserStartIndex <= sections[0].startInInput) {
|
|
@@ -162,7 +162,7 @@ export const useFieldV6TextField = params => {
|
|
|
162
162
|
if (!input || input !== inputRef.current) {
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
|
-
if (activeSectionIndex != null
|
|
165
|
+
if (activeSectionIndex != null) {
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
if (
|
|
@@ -296,6 +296,7 @@ export const useFieldV6TextField = params => {
|
|
|
296
296
|
}
|
|
297
297
|
return () => {
|
|
298
298
|
clearTimeout(focusTimeoutRef.current);
|
|
299
|
+
clearTimeout(selectionSyncTimeoutRef.current);
|
|
299
300
|
};
|
|
300
301
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
301
302
|
|
|
@@ -5,7 +5,8 @@ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
|
5
5
|
import useId from '@mui/utils/useId';
|
|
6
6
|
import { getSectionValueNow, getSectionValueText, parseSelectedSections } from './useField.utils';
|
|
7
7
|
import { getActiveElement } from '../../utils/utils';
|
|
8
|
-
import {
|
|
8
|
+
import { usePickersTranslations } from '../../../hooks/usePickersTranslations';
|
|
9
|
+
import { useUtils } from '../useUtils';
|
|
9
10
|
export const useFieldV7TextField = params => {
|
|
10
11
|
const {
|
|
11
12
|
internalProps: {
|
|
@@ -38,7 +39,7 @@ export const useFieldV7TextField = params => {
|
|
|
38
39
|
} = params;
|
|
39
40
|
const sectionListRef = React.useRef(null);
|
|
40
41
|
const handleSectionListRef = useForkRef(inSectionListRef, sectionListRef);
|
|
41
|
-
const
|
|
42
|
+
const translations = usePickersTranslations();
|
|
42
43
|
const utils = useUtils();
|
|
43
44
|
const id = useId();
|
|
44
45
|
const [focused, setFocused] = React.useState(false);
|
|
@@ -220,7 +221,7 @@ export const useFieldV7TextField = params => {
|
|
|
220
221
|
const getInputContainerClickHandler = useEventCallback(sectionIndex => event => {
|
|
221
222
|
// The click event on the clear button would propagate to the input, trigger this handler and result in a wrong section selection.
|
|
222
223
|
// We avoid this by checking if the call to this function is actually intended, or a side effect.
|
|
223
|
-
if (event.isDefaultPrevented()
|
|
224
|
+
if (event.isDefaultPrevented()) {
|
|
224
225
|
return;
|
|
225
226
|
}
|
|
226
227
|
setSelectedSections(sectionIndex);
|
|
@@ -230,9 +231,6 @@ export const useFieldV7TextField = params => {
|
|
|
230
231
|
event.preventDefault();
|
|
231
232
|
});
|
|
232
233
|
const getInputContentFocusHandler = useEventCallback(sectionIndex => () => {
|
|
233
|
-
if (readOnly) {
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
234
|
setSelectedSections(sectionIndex);
|
|
237
235
|
});
|
|
238
236
|
const handleInputContentPaste = useEventCallback(event => {
|
|
@@ -341,8 +339,8 @@ export const useFieldV7TextField = params => {
|
|
|
341
339
|
'aria-valuenow': getSectionValueNow(section, utils),
|
|
342
340
|
'aria-valuemin': sectionBoundaries[section.type].minimum,
|
|
343
341
|
'aria-valuemax': sectionBoundaries[section.type].maximum,
|
|
344
|
-
'aria-valuetext': section.value ? getSectionValueText(section, utils) :
|
|
345
|
-
'aria-label':
|
|
342
|
+
'aria-valuetext': section.value ? getSectionValueText(section, utils) : translations.empty,
|
|
343
|
+
'aria-label': translations[section.type],
|
|
346
344
|
'aria-disabled': disabled,
|
|
347
345
|
spellCheck: isEditable ? false : undefined,
|
|
348
346
|
autoCapitalize: isEditable ? 'off' : undefined,
|
|
@@ -364,7 +362,7 @@ export const useFieldV7TextField = params => {
|
|
|
364
362
|
}
|
|
365
363
|
};
|
|
366
364
|
});
|
|
367
|
-
}, [state.sections, getInputContentFocusHandler, handleInputContentPaste, handleInputContentDragOver, handleInputContentInput, getInputContainerClickHandler, handleInputContentMouseUp, disabled, readOnly, isContainerEditable,
|
|
365
|
+
}, [state.sections, getInputContentFocusHandler, handleInputContentPaste, handleInputContentDragOver, handleInputContentInput, getInputContainerClickHandler, handleInputContentMouseUp, disabled, readOnly, isContainerEditable, translations, utils, sectionBoundaries, id]);
|
|
368
366
|
const handleValueStrChange = useEventCallback(event => {
|
|
369
367
|
updateValueFromValueStr(event.target.value);
|
|
370
368
|
});
|
|
@@ -9,5 +9,4 @@ export declare const useDefaultDates: <TDate extends PickerValidDate>() => {
|
|
|
9
9
|
minDate: TDate;
|
|
10
10
|
maxDate: TDate;
|
|
11
11
|
};
|
|
12
|
-
export declare const useLocaleText: <TDate extends PickerValidDate>() => PickersLocaleText<TDate>;
|
|
13
12
|
export declare const useNow: <TDate extends PickerValidDate>(timezone: PickersTimezone) => TDate;
|
|
@@ -17,7 +17,6 @@ export const useLocalizationContext = () => {
|
|
|
17
17
|
};
|
|
18
18
|
export const useUtils = () => useLocalizationContext().utils;
|
|
19
19
|
export const useDefaultDates = () => useLocalizationContext().defaultDates;
|
|
20
|
-
export const useLocaleText = () => useLocalizationContext().localeText;
|
|
21
20
|
export const useNow = timezone => {
|
|
22
21
|
const utils = useUtils();
|
|
23
22
|
const now = React.useRef();
|
package/internals/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export type { UsePickerValueNonStaticProps, PickerValueManager, PickerSelectionS
|
|
|
32
32
|
export type { UsePickerViewsNonStaticProps, PickerViewRendererLookup, PickerViewRenderer, UsePickerViewsProps, } from './hooks/usePicker/usePickerViews';
|
|
33
33
|
export { useStaticPicker } from './hooks/useStaticPicker';
|
|
34
34
|
export type { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps, } from './hooks/useStaticPicker';
|
|
35
|
-
export { useLocalizationContext, useDefaultDates, useUtils,
|
|
35
|
+
export { useLocalizationContext, useDefaultDates, useUtils, useNow } from './hooks/useUtils';
|
|
36
36
|
export type { ExportedUseViewsOptions, UseViewsOptions } from './hooks/useViews';
|
|
37
37
|
export { useViews } from './hooks/useViews';
|
|
38
38
|
export { useValidation } from './hooks/useValidation';
|
|
@@ -48,7 +48,7 @@ export type { WrapperVariant, TimeViewWithMeridiem, DateOrTimeViewWithMeridiem,
|
|
|
48
48
|
export type { BaseDateValidationProps, BaseTimeValidationProps, TimeValidationProps, MonthValidationProps, YearValidationProps, DayValidationProps, DateTimeValidationProps, } from './models/validation';
|
|
49
49
|
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
50
50
|
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem, } from './utils/date-utils';
|
|
51
|
-
export { resolveTimeViewsResponse } from './utils/date-time-utils';
|
|
51
|
+
export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
|
|
52
52
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
53
53
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
54
54
|
export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, } from './utils/utils';
|
package/internals/index.js
CHANGED
|
@@ -13,13 +13,13 @@ export { useControlledValueWithTimezone } from './hooks/useValueWithTimezone';
|
|
|
13
13
|
export { useField, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from './hooks/useField';
|
|
14
14
|
export { usePicker } from './hooks/usePicker';
|
|
15
15
|
export { useStaticPicker } from './hooks/useStaticPicker';
|
|
16
|
-
export { useLocalizationContext, useDefaultDates, useUtils,
|
|
16
|
+
export { useLocalizationContext, useDefaultDates, useUtils, useNow } from './hooks/useUtils';
|
|
17
17
|
export { useViews } from './hooks/useViews';
|
|
18
18
|
export { useValidation } from './hooks/useValidation';
|
|
19
19
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
|
|
20
20
|
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
21
21
|
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem } from './utils/date-utils';
|
|
22
|
-
export { resolveTimeViewsResponse } from './utils/date-time-utils';
|
|
22
|
+
export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
|
|
23
23
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
24
24
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
25
25
|
export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './utils/utils';
|
|
@@ -4,7 +4,7 @@ import { DesktopOnlyTimePickerProps } from '../models/props/clock';
|
|
|
4
4
|
import { DefaultizedProps } from '../models/helpers';
|
|
5
5
|
export declare const resolveDateTimeFormat: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, { views, format, ...other }: {
|
|
6
6
|
format?: string;
|
|
7
|
-
views: readonly
|
|
7
|
+
views: readonly DateOrTimeViewWithMeridiem[];
|
|
8
8
|
ampm: boolean;
|
|
9
9
|
}) => string;
|
|
10
10
|
interface DefaultizedTimeViewsProps<TDate extends PickerValidDate, TView = DateOrTimeView> extends DefaultizedProps<DesktopOnlyTimePickerProps<TDate>, 'ampm'> {
|
|
@@ -8,4 +8,4 @@ export declare const DATE_TIME_VALIDATION_PROP_NAMES: (keyof DateTimeValidationP
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const extractValidationProps: <Props extends {
|
|
10
10
|
[key: string]: any;
|
|
11
|
-
}>(props: Props) => Pick<Props, "
|
|
11
|
+
}>(props: Props) => Pick<Props, "minDate" | "maxDate" | "ampm" | "disableFuture" | "disablePast" | "minutesStep" | "shouldDisableDate" | "shouldDisableMonth" | "shouldDisableYear" | "minTime" | "maxTime" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "minDateTime" | "maxDateTime">;
|
|
@@ -11,7 +11,8 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
11
11
|
import { unstable_composeClasses as composeClasses, unstable_useControlled as useControlled } from '@mui/utils';
|
|
12
12
|
import clsx from 'clsx';
|
|
13
13
|
import { PickersDay } from '../PickersDay/PickersDay';
|
|
14
|
-
import {
|
|
14
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
15
|
+
import { useUtils, useNow } from '../internals/hooks/useUtils';
|
|
15
16
|
import { DAY_SIZE, DAY_MARGIN } from '../internals/constants/dimensions';
|
|
16
17
|
import { PickersSlideTransition } from './PickersSlideTransition';
|
|
17
18
|
import { useIsDateDisabled } from './useIsDateDisabled';
|
|
@@ -261,7 +262,7 @@ export function DayCalendar(inProps) {
|
|
|
261
262
|
disableFuture,
|
|
262
263
|
timezone
|
|
263
264
|
});
|
|
264
|
-
const
|
|
265
|
+
const translations = usePickersTranslations();
|
|
265
266
|
const [internalHasFocus, setInternalHasFocus] = useControlled({
|
|
266
267
|
name: 'DayCalendar',
|
|
267
268
|
state: 'hasFocus',
|
|
@@ -403,9 +404,9 @@ export function DayCalendar(inProps) {
|
|
|
403
404
|
children: [displayWeekNumber && /*#__PURE__*/_jsx(PickersCalendarWeekNumberLabel, {
|
|
404
405
|
variant: "caption",
|
|
405
406
|
role: "columnheader",
|
|
406
|
-
"aria-label":
|
|
407
|
+
"aria-label": translations.calendarWeekNumberHeaderLabel,
|
|
407
408
|
className: classes.weekNumberLabel,
|
|
408
|
-
children:
|
|
409
|
+
children: translations.calendarWeekNumberHeaderText
|
|
409
410
|
}), getWeekdays(utils, now).map((weekday, i) => /*#__PURE__*/_jsx(PickersCalendarWeekDayLabel, {
|
|
410
411
|
variant: "caption",
|
|
411
412
|
role: "columnheader",
|
|
@@ -438,8 +439,8 @@ export function DayCalendar(inProps) {
|
|
|
438
439
|
children: [displayWeekNumber && /*#__PURE__*/_jsx(PickersCalendarWeekNumber, {
|
|
439
440
|
className: classes.weekNumber,
|
|
440
441
|
role: "rowheader",
|
|
441
|
-
"aria-label":
|
|
442
|
-
children:
|
|
442
|
+
"aria-label": translations.calendarWeekNumberAriaLabelText(utils.getWeekNumber(week[0])),
|
|
443
|
+
children: translations.calendarWeekNumberText(utils.getWeekNumber(week[0]))
|
|
443
444
|
}), week.map((day, dayIndex) => /*#__PURE__*/_jsx(WrappedDay, {
|
|
444
445
|
parentProps: props,
|
|
445
446
|
day: day,
|
|
@@ -8,7 +8,8 @@ import Typography from '@mui/material/Typography';
|
|
|
8
8
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
9
9
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
10
10
|
import { PickersToolbar } from '../internals/components/PickersToolbar';
|
|
11
|
-
import {
|
|
11
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
12
|
+
import { useUtils } from '../internals/hooks/useUtils';
|
|
12
13
|
import { getDatePickerToolbarUtilityClass } from './datePickerToolbarClasses';
|
|
13
14
|
import { resolveDateFormat } from '../internals/utils/date-utils';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -66,7 +67,7 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
|
|
|
66
67
|
} = props,
|
|
67
68
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
68
69
|
const utils = useUtils();
|
|
69
|
-
const
|
|
70
|
+
const translations = usePickersTranslations();
|
|
70
71
|
const classes = useUtilityClasses(props);
|
|
71
72
|
const dateText = React.useMemo(() => {
|
|
72
73
|
if (!value) {
|
|
@@ -81,7 +82,7 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
|
|
|
81
82
|
const ownerState = props;
|
|
82
83
|
return /*#__PURE__*/_jsx(DatePickerToolbarRoot, _extends({
|
|
83
84
|
ref: ref,
|
|
84
|
-
toolbarTitle:
|
|
85
|
+
toolbarTitle: translations.datePickerToolbarTitle,
|
|
85
86
|
isLandscape: isLandscape,
|
|
86
87
|
className: clsx(classes.root, className)
|
|
87
88
|
}, other, {
|
|
@@ -6,7 +6,7 @@ import Tabs, { tabsClasses } from '@mui/material/Tabs';
|
|
|
6
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
8
|
import { TimeIcon, DateRangeIcon } from '../icons';
|
|
9
|
-
import {
|
|
9
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
10
10
|
import { getDateTimePickerTabsUtilityClass } from './dateTimePickerTabsClasses';
|
|
11
11
|
import { isDatePickerView } from '../internals/utils/date-utils';
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -72,7 +72,7 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
72
72
|
className,
|
|
73
73
|
sx
|
|
74
74
|
} = props;
|
|
75
|
-
const
|
|
75
|
+
const translations = usePickersTranslations();
|
|
76
76
|
const classes = useUtilityClasses(props);
|
|
77
77
|
const handleChange = (event, value) => {
|
|
78
78
|
onViewChange(tabToView(value));
|
|
@@ -89,13 +89,13 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
89
89
|
sx: sx,
|
|
90
90
|
children: [/*#__PURE__*/_jsx(Tab, {
|
|
91
91
|
value: "date",
|
|
92
|
-
"aria-label":
|
|
92
|
+
"aria-label": translations.dateTableLabel,
|
|
93
93
|
icon: /*#__PURE__*/_jsx(React.Fragment, {
|
|
94
94
|
children: dateIcon
|
|
95
95
|
})
|
|
96
96
|
}), /*#__PURE__*/_jsx(Tab, {
|
|
97
97
|
value: "time",
|
|
98
|
-
"aria-label":
|
|
98
|
+
"aria-label": translations.timeTableLabel,
|
|
99
99
|
icon: /*#__PURE__*/_jsx(React.Fragment, {
|
|
100
100
|
children: timeIcon
|
|
101
101
|
})
|
|
@@ -10,7 +10,8 @@ import clsx from 'clsx';
|
|
|
10
10
|
import { PickersToolbarText } from '../internals/components/PickersToolbarText';
|
|
11
11
|
import { PickersToolbar } from '../internals/components/PickersToolbar';
|
|
12
12
|
import { PickersToolbarButton } from '../internals/components/PickersToolbarButton';
|
|
13
|
-
import {
|
|
13
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
14
|
+
import { useUtils } from '../internals/hooks/useUtils';
|
|
14
15
|
import { dateTimePickerToolbarClasses, getDateTimePickerToolbarUtilityClass } from './dateTimePickerToolbarClasses';
|
|
15
16
|
import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
|
|
16
17
|
import { MULTI_SECTION_CLOCK_SECTION_WIDTH } from '../internals/constants/dimensions';
|
|
@@ -241,9 +242,9 @@ function DateTimePickerToolbar(inProps) {
|
|
|
241
242
|
} = useMeridiemMode(value, ampm, onChange);
|
|
242
243
|
const showAmPmControl = Boolean(ampm && !ampmInClock);
|
|
243
244
|
const isDesktop = toolbarVariant === 'desktop';
|
|
244
|
-
const
|
|
245
|
+
const translations = usePickersTranslations();
|
|
245
246
|
const classes = useUtilityClasses(ownerState);
|
|
246
|
-
const toolbarTitle = inToolbarTitle ??
|
|
247
|
+
const toolbarTitle = inToolbarTitle ?? translations.dateTimePickerToolbarTitle;
|
|
247
248
|
const formatHours = time => ampm ? utils.format(time, 'hours12h') : utils.format(time, 'hours24h');
|
|
248
249
|
const dateText = React.useMemo(() => {
|
|
249
250
|
if (!value) {
|
|
@@ -5,7 +5,8 @@ import { resolveComponentProps } from '@mui/base/utils';
|
|
|
5
5
|
import { refType } from '@mui/utils';
|
|
6
6
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
7
7
|
import { useDatePickerDefaultizedProps } from '../DatePicker/shared';
|
|
8
|
-
import {
|
|
8
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
9
|
+
import { useUtils } from '../internals/hooks/useUtils';
|
|
9
10
|
import { validateDate } from '../internals/utils/validation/validateDate';
|
|
10
11
|
import { useDesktopPicker } from '../internals/hooks/useDesktopPicker';
|
|
11
12
|
import { CalendarIcon } from '../icons';
|
|
@@ -24,7 +25,7 @@ import { resolveDateFormat } from '../internals/utils/date-utils';
|
|
|
24
25
|
* - [DesktopDatePicker API](https://mui.com/x/api/date-pickers/desktop-date-picker/)
|
|
25
26
|
*/
|
|
26
27
|
const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePicker(inProps, ref) {
|
|
27
|
-
const
|
|
28
|
+
const translations = usePickersTranslations();
|
|
28
29
|
const utils = useUtils();
|
|
29
30
|
|
|
30
31
|
// Props with the default values common to all date pickers
|
|
@@ -59,7 +60,7 @@ const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePick
|
|
|
59
60
|
props,
|
|
60
61
|
valueManager: singleItemValueManager,
|
|
61
62
|
valueType: 'date',
|
|
62
|
-
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ??
|
|
63
|
+
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ?? translations.openDatePickerDialogue,
|
|
63
64
|
validator: validateDate
|
|
64
65
|
});
|
|
65
66
|
return renderPicker();
|
|
@@ -10,7 +10,8 @@ import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
|
10
10
|
import { DateTimeField } from '../DateTimeField';
|
|
11
11
|
import { useDateTimePickerDefaultizedProps } from '../DateTimePicker/shared';
|
|
12
12
|
import { renderDateViewCalendar } from '../dateViewRenderers/dateViewRenderers';
|
|
13
|
-
import {
|
|
13
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
14
|
+
import { useUtils } from '../internals/hooks/useUtils';
|
|
14
15
|
import { validateDateTime } from '../internals/utils/validation/validateDateTime';
|
|
15
16
|
import { CalendarIcon } from '../icons';
|
|
16
17
|
import { useDesktopPicker } from '../internals/hooks/useDesktopPicker';
|
|
@@ -80,7 +81,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
80
81
|
* - [DesktopDateTimePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-picker/)
|
|
81
82
|
*/
|
|
82
83
|
const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimePicker(inProps, ref) {
|
|
83
|
-
const
|
|
84
|
+
const translations = usePickersTranslations();
|
|
84
85
|
const utils = useUtils();
|
|
85
86
|
|
|
86
87
|
// Props with the default values common to all date time pickers
|
|
@@ -145,7 +146,7 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
|
|
|
145
146
|
props,
|
|
146
147
|
valueManager: singleItemValueManager,
|
|
147
148
|
valueType: 'date-time',
|
|
148
|
-
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ??
|
|
149
|
+
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ?? translations.openDatePickerDialogue,
|
|
149
150
|
validator: validateDateTime,
|
|
150
151
|
rendererInterceptor
|
|
151
152
|
});
|
|
@@ -6,7 +6,8 @@ import { refType } from '@mui/utils';
|
|
|
6
6
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
7
7
|
import { TimeField } from '../TimeField';
|
|
8
8
|
import { useTimePickerDefaultizedProps } from '../TimePicker/shared';
|
|
9
|
-
import {
|
|
9
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
10
|
+
import { useUtils } from '../internals/hooks/useUtils';
|
|
10
11
|
import { validateTime } from '../internals/utils/validation/validateTime';
|
|
11
12
|
import { ClockIcon } from '../icons';
|
|
12
13
|
import { useDesktopPicker } from '../internals/hooks/useDesktopPicker';
|
|
@@ -25,7 +26,7 @@ import { resolveTimeViewsResponse } from '../internals/utils/date-time-utils';
|
|
|
25
26
|
* - [DesktopTimePicker API](https://mui.com/x/api/date-pickers/desktop-time-picker/)
|
|
26
27
|
*/
|
|
27
28
|
const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePicker(inProps, ref) {
|
|
28
|
-
const
|
|
29
|
+
const translations = usePickersTranslations();
|
|
29
30
|
const utils = useUtils();
|
|
30
31
|
|
|
31
32
|
// Props with the default values common to all time pickers
|
|
@@ -80,7 +81,7 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
|
|
|
80
81
|
props,
|
|
81
82
|
valueManager: singleItemValueManager,
|
|
82
83
|
valueType: 'time',
|
|
83
|
-
getOpenDialogAriaText: props.localeText?.openTimePickerDialogue ??
|
|
84
|
+
getOpenDialogAriaText: props.localeText?.openTimePickerDialogue ?? translations.openTimePickerDialogue,
|
|
84
85
|
validator: validateTime
|
|
85
86
|
});
|
|
86
87
|
return renderPicker();
|