@mui/x-date-pickers 7.8.0 → 7.9.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 +66 -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/useFieldV7TextField.js +6 -5
- package/internals/hooks/useUtils.d.ts +0 -1
- package/internals/hooks/useUtils.js +0 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +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/useFieldV7TextField.js +6 -5
- package/modern/internals/hooks/useUtils.js +0 -1
- package/modern/internals/index.js +1 -1
- 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/useFieldV7TextField.js +5 -4
- package/node/internals/hooks/useUtils.js +1 -3
- package/node/internals/index.js +0 -6
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,72 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.9.0
|
|
7
|
+
|
|
8
|
+
_Jul 5, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🔄 Add loading overlay variants, including a skeleton loader option to the Data Grid component. See [Loading overlay docs](https://mui.com/x/react-data-grid/overlays/#loading-overlay) for more details.
|
|
13
|
+
- 🌳 Add `selectItem` and `getItemDOMElement` methods to the TreeView component public API
|
|
14
|
+
- ⛏️ Make the `usePickersTranslations` hook public in the pickers component
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
|
|
17
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
18
|
+
|
|
19
|
+
### Data Grid
|
|
20
|
+
|
|
21
|
+
#### `@mui/x-data-grid@7.9.0`
|
|
22
|
+
|
|
23
|
+
- [DataGrid] Add skeleton loading overlay support (#13293) @KenanYusuf
|
|
24
|
+
- [DataGrid] Fix pagination when `pagination={undefined}` (#13349) @sai6855
|
|
25
|
+
|
|
26
|
+
#### `@mui/x-data-grid-pro@7.9.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
27
|
+
|
|
28
|
+
Same changes as in `@mui/x-data-grid@7.9.0`.
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-premium@7.9.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid-pro@7.9.0`.
|
|
33
|
+
|
|
34
|
+
### Date and Time Pickers
|
|
35
|
+
|
|
36
|
+
#### `@mui/x-date-pickers@7.9.0`
|
|
37
|
+
|
|
38
|
+
- [pickers] Make the `usePickersTranslations` hook public (#13657) @flaviendelangle
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-date-pickers-pro@7.9.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
41
|
+
|
|
42
|
+
Same changes as in `@mui/x-date-pickers@7.9.0`.
|
|
43
|
+
|
|
44
|
+
### Charts
|
|
45
|
+
|
|
46
|
+
#### `@mui/x-charts@7.9.0`
|
|
47
|
+
|
|
48
|
+
- [charts] Add Heatmap (unreleased) (#13209) @alexfauquette
|
|
49
|
+
- [charts] Add initial `Zoom&Pan` to the Pro charts (unreleased) (#13405) @JCQuintas
|
|
50
|
+
- [charts] Fix Axis Highlight on horizontal bar charts regression (#13717) @JCQuintas
|
|
51
|
+
- [charts] Improve charts interaction for mobile users (#13692) @JCQuintas
|
|
52
|
+
- [charts] Add documentation on how to disable the tooltip on charts (#13724) @JCQuintas
|
|
53
|
+
|
|
54
|
+
### Tree View
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-tree-view@7.9.0`
|
|
57
|
+
|
|
58
|
+
- [TreeView] Add `selectItem` and `getItemDOMElement` methods to the public API (#13485) @flaviendelangle
|
|
59
|
+
|
|
60
|
+
### Docs
|
|
61
|
+
|
|
62
|
+
- [docs] Fix custom "no results overlay" demo in dark mode (#13715) @KenanYusuf
|
|
63
|
+
|
|
64
|
+
### Core
|
|
65
|
+
|
|
66
|
+
- [core] Add `react_next` workflow in CircleCI (#13360) @cherniavskii
|
|
67
|
+
- [core] Create a new package to share utils across X packages (#13528) @flaviendelangle
|
|
68
|
+
- [core] Fix dependency setup (#13684) @LukasTy
|
|
69
|
+
- [core] Remove `jscodeshift-add-imports` package (#13720) @LukasTy
|
|
70
|
+
- [code-infra] Cleanup monorepo and `@mui/docs` usage (#13713) @LukasTy
|
|
71
|
+
|
|
6
72
|
## 7.8.0
|
|
7
73
|
|
|
8
74
|
_Jun 28, 2024_
|
|
@@ -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, {
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { DateOrTimeViewWithMeridiem } from '../internals/models';
|
|
3
3
|
import { DateTimePickerTabsClasses } from './dateTimePickerTabsClasses';
|
|
4
4
|
import { BaseTabsProps, ExportedBaseTabsProps } from '../internals/models/props/tabs';
|
|
5
|
+
import { PickerValidDate } from '../models';
|
|
5
6
|
export interface ExportedDateTimePickerTabsProps extends ExportedBaseTabsProps {
|
|
6
7
|
/**
|
|
7
8
|
* Toggles visibility of the tabs allowing view switching.
|
|
@@ -36,7 +37,7 @@ export interface DateTimePickerTabsProps extends ExportedDateTimePickerTabsProps
|
|
|
36
37
|
* - [DateTimePickerTabs API](https://mui.com/x/api/date-pickers/date-time-picker-tabs/)
|
|
37
38
|
*/
|
|
38
39
|
declare const DateTimePickerTabs: {
|
|
39
|
-
(inProps: DateTimePickerTabsProps): React.JSX.Element | null;
|
|
40
|
+
<TDate extends PickerValidDate>(inProps: DateTimePickerTabsProps): React.JSX.Element | null;
|
|
40
41
|
propTypes: any;
|
|
41
42
|
};
|
|
42
43
|
export { DateTimePickerTabs };
|
|
@@ -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();
|
|
@@ -11,7 +11,8 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
11
11
|
import MenuItem from '@mui/material/MenuItem';
|
|
12
12
|
import MenuList from '@mui/material/MenuList';
|
|
13
13
|
import useForkRef from '@mui/utils/useForkRef';
|
|
14
|
-
import {
|
|
14
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
15
|
+
import { useUtils, useNow } from '../internals/hooks/useUtils';
|
|
15
16
|
import { createIsAfterIgnoreDatePart } from '../internals/utils/time-utils';
|
|
16
17
|
import { PickerViewRoot } from '../internals/components/PickerViewRoot';
|
|
17
18
|
import { getDigitalClockUtilityClass } from './digitalClockClasses';
|
|
@@ -147,7 +148,7 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
147
148
|
onChange,
|
|
148
149
|
valueManager: singleItemValueManager
|
|
149
150
|
});
|
|
150
|
-
const
|
|
151
|
+
const translations = usePickersTranslations();
|
|
151
152
|
const now = useNow(timezone);
|
|
152
153
|
const ownerState = React.useMemo(() => _extends({}, props, {
|
|
153
154
|
alreadyRendered: !!containerRef.current
|
|
@@ -240,7 +241,7 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
240
241
|
}, other, {
|
|
241
242
|
children: /*#__PURE__*/_jsx(DigitalClockList, {
|
|
242
243
|
role: "listbox",
|
|
243
|
-
"aria-label":
|
|
244
|
+
"aria-label": translations.timePickerToolbarTitle,
|
|
244
245
|
className: classes.list,
|
|
245
246
|
children: timeOptions.map((option, index) => {
|
|
246
247
|
if (skipDisabled && isTimeDisabled(option)) {
|
|
@@ -5,7 +5,8 @@ import { resolveComponentProps } from '@mui/base/utils';
|
|
|
5
5
|
import { refType } from '@mui/utils';
|
|
6
6
|
import { useMobilePicker } from '../internals/hooks/useMobilePicker';
|
|
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 { DateField } from '../DateField';
|
|
11
12
|
import { extractValidationProps } from '../internals/utils/validation/extractValidationProps';
|
|
@@ -23,7 +24,7 @@ import { resolveDateFormat } from '../internals/utils/date-utils';
|
|
|
23
24
|
* - [MobileDatePicker API](https://mui.com/x/api/date-pickers/mobile-date-picker/)
|
|
24
25
|
*/
|
|
25
26
|
const MobileDatePicker = /*#__PURE__*/React.forwardRef(function MobileDatePicker(inProps, ref) {
|
|
26
|
-
const
|
|
27
|
+
const translations = usePickersTranslations();
|
|
27
28
|
const utils = useUtils();
|
|
28
29
|
|
|
29
30
|
// Props with the default values common to all date pickers
|
|
@@ -56,7 +57,7 @@ const MobileDatePicker = /*#__PURE__*/React.forwardRef(function MobileDatePicker
|
|
|
56
57
|
props,
|
|
57
58
|
valueManager: singleItemValueManager,
|
|
58
59
|
valueType: 'date',
|
|
59
|
-
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ??
|
|
60
|
+
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ?? translations.openDatePickerDialogue,
|
|
60
61
|
validator: validateDate
|
|
61
62
|
});
|
|
62
63
|
return renderPicker();
|
|
@@ -6,7 +6,8 @@ import { refType } from '@mui/utils';
|
|
|
6
6
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
7
7
|
import { DateTimeField } from '../DateTimeField';
|
|
8
8
|
import { useDateTimePickerDefaultizedProps } from '../DateTimePicker/shared';
|
|
9
|
-
import {
|
|
9
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
10
|
+
import { useUtils } from '../internals/hooks/useUtils';
|
|
10
11
|
import { validateDateTime } from '../internals/utils/validation/validateDateTime';
|
|
11
12
|
import { useMobilePicker } from '../internals/hooks/useMobilePicker';
|
|
12
13
|
import { extractValidationProps } from '../internals/utils/validation/extractValidationProps';
|
|
@@ -24,7 +25,7 @@ import { resolveDateTimeFormat } from '../internals/utils/date-time-utils';
|
|
|
24
25
|
* - [MobileDateTimePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-picker/)
|
|
25
26
|
*/
|
|
26
27
|
const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimePicker(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 time pickers
|
|
@@ -66,7 +67,7 @@ const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTi
|
|
|
66
67
|
props,
|
|
67
68
|
valueManager: singleItemValueManager,
|
|
68
69
|
valueType: 'date-time',
|
|
69
|
-
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ??
|
|
70
|
+
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ?? translations.openDatePickerDialogue,
|
|
70
71
|
validator: validateDateTime
|
|
71
72
|
});
|
|
72
73
|
return renderPicker();
|
|
@@ -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 { useMobilePicker } from '../internals/hooks/useMobilePicker';
|
|
12
13
|
import { extractValidationProps } from '../internals/utils/validation/extractValidationProps';
|
|
@@ -23,7 +24,7 @@ import { resolveTimeFormat } from '../internals/utils/time-utils';
|
|
|
23
24
|
* - [MobileTimePicker API](https://mui.com/x/api/date-pickers/mobile-time-picker/)
|
|
24
25
|
*/
|
|
25
26
|
const MobileTimePicker = /*#__PURE__*/React.forwardRef(function MobileTimePicker(inProps, ref) {
|
|
26
|
-
const
|
|
27
|
+
const translations = usePickersTranslations();
|
|
27
28
|
const utils = useUtils();
|
|
28
29
|
|
|
29
30
|
// Props with the default values common to all time pickers
|
|
@@ -59,7 +60,7 @@ const MobileTimePicker = /*#__PURE__*/React.forwardRef(function MobileTimePicker
|
|
|
59
60
|
props,
|
|
60
61
|
valueManager: singleItemValueManager,
|
|
61
62
|
valueType: 'time',
|
|
62
|
-
getOpenDialogAriaText: props.localeText?.openTimePickerDialogue ??
|
|
63
|
+
getOpenDialogAriaText: props.localeText?.openTimePickerDialogue ?? translations.openTimePickerDialogue,
|
|
63
64
|
validator: validateTime
|
|
64
65
|
});
|
|
65
66
|
return renderPicker();
|
|
@@ -8,7 +8,8 @@ import { useRtl } from '@mui/system/RtlProvider';
|
|
|
8
8
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
9
9
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
10
10
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
|
-
import {
|
|
11
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
12
|
+
import { useUtils, useNow } from '../internals/hooks/useUtils';
|
|
12
13
|
import { convertValueToMeridiem, createIsAfterIgnoreDatePart } from '../internals/utils/time-utils';
|
|
13
14
|
import { useViews } from '../internals/hooks/useViews';
|
|
14
15
|
import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
|
|
@@ -101,7 +102,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
101
102
|
onChange,
|
|
102
103
|
valueManager: singleItemValueManager
|
|
103
104
|
});
|
|
104
|
-
const
|
|
105
|
+
const translations = usePickersTranslations();
|
|
105
106
|
const now = useNow(timezone);
|
|
106
107
|
const timeSteps = React.useMemo(() => _extends({
|
|
107
108
|
hours: 1,
|
|
@@ -233,7 +234,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
233
234
|
utils,
|
|
234
235
|
isDisabled: hours => isTimeDisabled(hours, 'hours'),
|
|
235
236
|
timeStep: timeSteps.hours,
|
|
236
|
-
resolveAriaLabel:
|
|
237
|
+
resolveAriaLabel: translations.hoursClockNumberText,
|
|
237
238
|
valueOrReferenceDate
|
|
238
239
|
})
|
|
239
240
|
};
|
|
@@ -251,7 +252,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
251
252
|
resolveLabel: minutes => utils.format(utils.setMinutes(now, minutes), 'minutes'),
|
|
252
253
|
timeStep: timeSteps.minutes,
|
|
253
254
|
hasValue: !!value,
|
|
254
|
-
resolveAriaLabel:
|
|
255
|
+
resolveAriaLabel: translations.minutesClockNumberText
|
|
255
256
|
})
|
|
256
257
|
};
|
|
257
258
|
}
|
|
@@ -268,7 +269,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
268
269
|
resolveLabel: seconds => utils.format(utils.setSeconds(now, seconds), 'seconds'),
|
|
269
270
|
timeStep: timeSteps.seconds,
|
|
270
271
|
hasValue: !!value,
|
|
271
|
-
resolveAriaLabel:
|
|
272
|
+
resolveAriaLabel: translations.secondsClockNumberText
|
|
272
273
|
})
|
|
273
274
|
};
|
|
274
275
|
}
|
|
@@ -296,7 +297,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
296
297
|
default:
|
|
297
298
|
throw new Error(`Unknown view: ${viewToBuild} found.`);
|
|
298
299
|
}
|
|
299
|
-
}, [now, value, ampm, utils, timeSteps.hours, timeSteps.minutes, timeSteps.seconds,
|
|
300
|
+
}, [now, value, ampm, utils, timeSteps.hours, timeSteps.minutes, timeSteps.seconds, translations.hoursClockNumberText, translations.minutesClockNumberText, translations.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, isTimeDisabled, handleMeridiemChange]);
|
|
300
301
|
const viewsToRender = React.useMemo(() => {
|
|
301
302
|
if (!isRtl) {
|
|
302
303
|
return views;
|
|
@@ -333,7 +334,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
333
334
|
slots: slots,
|
|
334
335
|
slotProps: slotProps,
|
|
335
336
|
skipDisabled: skipDisabled,
|
|
336
|
-
"aria-label":
|
|
337
|
+
"aria-label": translations.selectViewText(timeView)
|
|
337
338
|
}, timeView))
|
|
338
339
|
}));
|
|
339
340
|
});
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Button from '@mui/material/Button';
|
|
7
7
|
import DialogActions from '@mui/material/DialogActions';
|
|
8
|
-
import {
|
|
8
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
/**
|
|
11
11
|
* Demos:
|
|
@@ -26,7 +26,7 @@ function PickersActionBar(props) {
|
|
|
26
26
|
actions
|
|
27
27
|
} = props,
|
|
28
28
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
29
|
-
const
|
|
29
|
+
const translations = usePickersTranslations();
|
|
30
30
|
if (actions == null || actions.length === 0) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
@@ -35,22 +35,22 @@ function PickersActionBar(props) {
|
|
|
35
35
|
case 'clear':
|
|
36
36
|
return /*#__PURE__*/_jsx(Button, {
|
|
37
37
|
onClick: onClear,
|
|
38
|
-
children:
|
|
38
|
+
children: translations.clearButtonLabel
|
|
39
39
|
}, actionType);
|
|
40
40
|
case 'cancel':
|
|
41
41
|
return /*#__PURE__*/_jsx(Button, {
|
|
42
42
|
onClick: onCancel,
|
|
43
|
-
children:
|
|
43
|
+
children: translations.cancelButtonLabel
|
|
44
44
|
}, actionType);
|
|
45
45
|
case 'accept':
|
|
46
46
|
return /*#__PURE__*/_jsx(Button, {
|
|
47
47
|
onClick: onAccept,
|
|
48
|
-
children:
|
|
48
|
+
children: translations.okButtonLabel
|
|
49
49
|
}, actionType);
|
|
50
50
|
case 'today':
|
|
51
51
|
return /*#__PURE__*/_jsx(Button, {
|
|
52
52
|
onClick: onSetToday,
|
|
53
|
-
children:
|
|
53
|
+
children: translations.todayButtonLabel
|
|
54
54
|
}, actionType);
|
|
55
55
|
default:
|
|
56
56
|
return null;
|
|
@@ -10,7 +10,8 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
10
10
|
import { useSlotProps } from '@mui/base/utils';
|
|
11
11
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
12
12
|
import IconButton from '@mui/material/IconButton';
|
|
13
|
-
import {
|
|
13
|
+
import { usePickersTranslations } from '../hooks/usePickersTranslations';
|
|
14
|
+
import { useUtils } from '../internals/hooks/useUtils';
|
|
14
15
|
import { PickersFadeTransitionGroup } from '../DateCalendar/PickersFadeTransitionGroup';
|
|
15
16
|
import { ArrowDropDownIcon } from '../icons';
|
|
16
17
|
import { PickersArrowSwitcher } from '../internals/components/PickersArrowSwitcher';
|
|
@@ -107,7 +108,7 @@ const PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDownIcon, {
|
|
|
107
108
|
* - [PickersCalendarHeader API](https://mui.com/x/api/date-pickers/pickers-calendar-header/)
|
|
108
109
|
*/
|
|
109
110
|
const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalendarHeader(inProps, ref) {
|
|
110
|
-
const
|
|
111
|
+
const translations = usePickersTranslations();
|
|
111
112
|
const utils = useUtils();
|
|
112
113
|
const props = useThemeProps({
|
|
113
114
|
props: inProps,
|
|
@@ -141,7 +142,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
141
142
|
externalSlotProps: slotProps?.switchViewButton,
|
|
142
143
|
additionalProps: {
|
|
143
144
|
size: 'small',
|
|
144
|
-
'aria-label':
|
|
145
|
+
'aria-label': translations.calendarViewSwitchingButtonAriaLabel(view)
|
|
145
146
|
},
|
|
146
147
|
ownerState,
|
|
147
148
|
className: classes.switchViewButton
|
|
@@ -216,10 +217,10 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
216
217
|
slotProps: slotProps,
|
|
217
218
|
onGoToPrevious: selectPreviousMonth,
|
|
218
219
|
isPreviousDisabled: isPreviousMonthDisabled,
|
|
219
|
-
previousLabel:
|
|
220
|
+
previousLabel: translations.previousMonth,
|
|
220
221
|
onGoToNext: selectNextMonth,
|
|
221
222
|
isNextDisabled: isNextMonthDisabled,
|
|
222
|
-
nextLabel:
|
|
223
|
+
nextLabel: translations.nextMonth
|
|
223
224
|
})
|
|
224
225
|
})]
|
|
225
226
|
}));
|
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,
|