@mui/x-date-pickers 7.6.1 → 7.7.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/AdapterDayjs/AdapterDayjs.js +5 -1
- package/CHANGELOG.md +147 -0
- package/DateCalendar/DateCalendar.js +3 -3
- package/DateCalendar/DateCalendar.types.d.ts +4 -4
- package/DateCalendar/DayCalendar.d.ts +3 -4
- package/DateCalendar/DayCalendar.js +11 -11
- package/DateTimePicker/DateTimePickerToolbar.js +59 -49
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -1
- package/MonthCalendar/MonthCalendar.js +21 -7
- package/MonthCalendar/MonthCalendar.types.d.ts +25 -0
- package/MonthCalendar/PickersMonth.d.ts +4 -0
- package/MonthCalendar/PickersMonth.js +38 -21
- package/MonthCalendar/index.d.ts +1 -1
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +1 -1
- package/PickersLayout/PickersLayout.d.ts +1 -3
- package/PickersLayout/PickersLayout.js +30 -9
- package/PickersLayout/PickersLayout.types.d.ts +8 -4
- package/PickersTextField/PickersInputBase/PickersInputBase.d.ts +1 -0
- package/PickersTextField/PickersInputBase/PickersInputBase.js +14 -6
- package/TimePicker/TimePickerToolbar.js +21 -18
- package/YearCalendar/PickersYear.d.ts +3 -0
- package/YearCalendar/PickersYear.js +34 -22
- package/YearCalendar/YearCalendar.js +21 -7
- package/YearCalendar/YearCalendar.types.d.ts +25 -0
- package/YearCalendar/index.d.ts +1 -1
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +5 -5
- package/internals/components/PickersToolbarButton.d.ts +1 -1
- package/internals/hooks/useField/buildSectionsFromFormat.d.ts +1 -1
- package/internals/hooks/useField/buildSectionsFromFormat.js +3 -3
- package/internals/hooks/useField/useField.js +3 -4
- package/internals/hooks/useField/useField.types.d.ts +2 -2
- package/internals/hooks/useField/useField.utils.d.ts +1 -1
- package/internals/hooks/useField/useField.utils.js +6 -5
- package/internals/hooks/useField/useFieldState.js +6 -7
- package/internals/hooks/useField/useFieldV6TextField.d.ts +1 -1
- package/internals/hooks/useField/useFieldV6TextField.js +10 -11
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +1 -0
- package/internals/hooks/usePicker/usePickerLayoutProps.js +3 -0
- package/locales/faIR.js +19 -22
- package/locales/koKR.js +2 -2
- package/modern/AdapterDayjs/AdapterDayjs.js +5 -1
- package/modern/DateCalendar/DateCalendar.js +3 -3
- package/modern/DateCalendar/DayCalendar.js +11 -11
- package/modern/DateTimePicker/DateTimePickerToolbar.js +59 -49
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -1
- package/modern/MonthCalendar/MonthCalendar.js +21 -7
- package/modern/MonthCalendar/PickersMonth.js +38 -21
- package/modern/PickersLayout/PickersLayout.js +30 -9
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +14 -6
- package/modern/TimePicker/TimePickerToolbar.js +21 -18
- package/modern/YearCalendar/PickersYear.js +34 -22
- package/modern/YearCalendar/YearCalendar.js +21 -7
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +5 -5
- package/modern/internals/hooks/useField/buildSectionsFromFormat.js +3 -3
- package/modern/internals/hooks/useField/useField.js +3 -4
- package/modern/internals/hooks/useField/useField.utils.js +6 -5
- package/modern/internals/hooks/useField/useFieldState.js +6 -7
- package/modern/internals/hooks/useField/useFieldV6TextField.js +10 -11
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +3 -0
- package/modern/locales/faIR.js +19 -22
- package/modern/locales/koKR.js +2 -2
- package/node/AdapterDayjs/AdapterDayjs.js +5 -1
- package/node/DateCalendar/DateCalendar.js +3 -3
- package/node/DateCalendar/DayCalendar.js +10 -10
- package/node/DateTimePicker/DateTimePickerToolbar.js +58 -48
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -1
- package/node/MonthCalendar/MonthCalendar.js +21 -7
- package/node/MonthCalendar/PickersMonth.js +40 -23
- package/node/PickersLayout/PickersLayout.js +30 -9
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +14 -6
- package/node/TimePicker/TimePickerToolbar.js +20 -17
- package/node/YearCalendar/PickersYear.js +34 -22
- package/node/YearCalendar/YearCalendar.js +21 -7
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +4 -4
- package/node/internals/hooks/useField/buildSectionsFromFormat.js +3 -3
- package/node/internals/hooks/useField/useField.js +3 -4
- package/node/internals/hooks/useField/useField.utils.js +6 -5
- package/node/internals/hooks/useField/useFieldState.js +6 -7
- package/node/internals/hooks/useField/useFieldV6TextField.js +10 -11
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +3 -0
- package/node/locales/faIR.js +19 -22
- package/node/locales/koKR.js +2 -2
- package/package.json +2 -2
|
@@ -256,7 +256,11 @@ export class AdapterDayjs {
|
|
|
256
256
|
if ((fixedValue.$offset ?? 0) === (value.$offset ?? 0)) {
|
|
257
257
|
return value;
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
// Change only what is needed to avoid creating a new object with unwanted data
|
|
260
|
+
// Especially important when used in an environment where utc or timezone dates are used only in some places
|
|
261
|
+
// Reference: https://github.com/mui/mui-x/issues/13290
|
|
262
|
+
// @ts-ignore
|
|
263
|
+
value.$offset = fixedValue.$offset;
|
|
260
264
|
}
|
|
261
265
|
return value;
|
|
262
266
|
};
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,153 @@
|
|
|
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.7.0
|
|
7
|
+
|
|
8
|
+
_Jun 13, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Allow customization of the Pickers month and the year buttons
|
|
13
|
+
- 🌍 Improve Persian (fa-IR), Portuguese (pt-PT), and Russian (ru-RU) locales on the Data Grid
|
|
14
|
+
- 🌍 Improve Korean (ko-KR) and Persian (fa-IR) locales on the Date and Time Pickers
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
- 📚 Documentation improvements
|
|
17
|
+
|
|
18
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
19
|
+
|
|
20
|
+
### Data Grid
|
|
21
|
+
|
|
22
|
+
#### `@mui/x-data-grid@7.7.0`
|
|
23
|
+
|
|
24
|
+
- [DataGrid] Add `getFilterState` method (#13418) @cherniavskii
|
|
25
|
+
- [DataGrid] Do not show resize separators for column groups (#13455) @cherniavskii
|
|
26
|
+
- [l10n] Improve Persian (fa-IR) locale (#13402) @fakhamatia
|
|
27
|
+
- [l10n] Improve Portuguese (pt-PT) locale (#13384) @olavocarvalho
|
|
28
|
+
- [l10n] Improve Russian (ru-RU) locale (#11210) @dastan-akhmetov-scity
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-pro@7.7.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid@7.7.0`, plus:
|
|
33
|
+
|
|
34
|
+
- [DataGridPro] Do not render detail panel if the focused cell is not visible (#13456) @cherniavskii
|
|
35
|
+
|
|
36
|
+
#### `@mui/x-data-grid-premium@7.7.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
37
|
+
|
|
38
|
+
Same changes as in `@mui/x-data-grid-pro@7.7.0`.
|
|
39
|
+
|
|
40
|
+
### Date and Time Pickers
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-date-pickers@7.7.0`
|
|
43
|
+
|
|
44
|
+
- [l10n] Improve Korean (ko-KR) locale (#13452) @ryxxn
|
|
45
|
+
- [l10n] Improve Persian (fa-IR) locale (#13402) @fakhamatia
|
|
46
|
+
- [pickers] Allow to customize the month and the year buttons (#13321) @flaviendelangle
|
|
47
|
+
|
|
48
|
+
#### `@mui/x-date-pickers-pro@7.7.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
49
|
+
|
|
50
|
+
Same changes as in `@mui/x-date-pickers@7.7.0`.
|
|
51
|
+
|
|
52
|
+
### Charts
|
|
53
|
+
|
|
54
|
+
#### `@mui/x-charts@7.7.0`
|
|
55
|
+
|
|
56
|
+
- [charts] Add watermark on the pro `ResponsiveChartContainer` (#13398) @alexfauquette
|
|
57
|
+
- [charts] Allow to specify y-axis configuration (#13438) @alexfauquette
|
|
58
|
+
- [charts] Fix eslint for react compiler (#13444) @alexfauquette
|
|
59
|
+
- [charts] Improve themeAugmentation typing (#13433) @noraleonte
|
|
60
|
+
- [charts] Move the `ZAxisContextProvider` by default in the `ChartContainer` (#13465) @alexfauquette
|
|
61
|
+
- [charts] Use plugins to define series extremum and colors (#13397) @alexfauquette
|
|
62
|
+
|
|
63
|
+
### Tree View
|
|
64
|
+
|
|
65
|
+
#### `@mui/x-tree-view@7.7.0`
|
|
66
|
+
|
|
67
|
+
- [TreeView] Improve TypeScript for plugins (#13380) @flaviendelangle
|
|
68
|
+
- [TreeView] Improve the typing of the cancelable events (#13152) @flaviendelangle
|
|
69
|
+
- [TreeView] Prepare support for PigmentCSS (#13412) @flaviendelangle
|
|
70
|
+
- [TreeView] Refactor the tree view internals to prepare for headless API (#13311) @flaviendelangle
|
|
71
|
+
|
|
72
|
+
### Docs
|
|
73
|
+
|
|
74
|
+
- [docs] Add `renderHeader` recipe to the Master Details docs (#13370) @michelengelen
|
|
75
|
+
- [docs] Add lazy loading detail panel demo (#13453) @cherniavskii
|
|
76
|
+
- [docs] Add small edits to the Data Grid overview page (#13060) @danilo-leal
|
|
77
|
+
- [docs] Update a11y pages description (#13417) @danilo-leal
|
|
78
|
+
- [docs] improve the writing on the "Quick filter outside of the grid" example (#13155) @michelengelen
|
|
79
|
+
|
|
80
|
+
### Core
|
|
81
|
+
|
|
82
|
+
- [core] Add `eslint-plugin-react-compiler` experimental version and rules (#13415) @JCQuintas
|
|
83
|
+
- [core] Minor setup cleanup (#13467) @LukasTy
|
|
84
|
+
- [infra] Adjust CI setup (#13448) @LukasTy
|
|
85
|
+
- [test] Add tests for the custom slots of `TreeItem2` (#13314) @flaviendelangle
|
|
86
|
+
|
|
87
|
+
## 7.6.2
|
|
88
|
+
|
|
89
|
+
_Jun 6, 2024_
|
|
90
|
+
|
|
91
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
92
|
+
|
|
93
|
+
- 📚 Adds Date and Time Pickers accessibility page
|
|
94
|
+
- 🐞 Bugfixes
|
|
95
|
+
- 📚 Documentation improvements
|
|
96
|
+
|
|
97
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
98
|
+
|
|
99
|
+
### Data Grid
|
|
100
|
+
|
|
101
|
+
#### `@mui/x-data-grid@7.6.2`
|
|
102
|
+
|
|
103
|
+
- [DataGrid] Add the `areElementSizesEqual` utility to improve code readability (#13254) @layerok
|
|
104
|
+
- [DataGrid] Clean up IE remnants from the codebase (#13390) @MBilalShafi
|
|
105
|
+
|
|
106
|
+
#### `@mui/x-data-grid-pro@7.6.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
107
|
+
|
|
108
|
+
Same changes as in `@mui/x-data-grid@7.6.2`.
|
|
109
|
+
|
|
110
|
+
#### `@mui/x-data-grid-premium@7.6.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
111
|
+
|
|
112
|
+
Same changes as in `@mui/x-data-grid-pro@7.6.2`.
|
|
113
|
+
|
|
114
|
+
### Date and Time Pickers
|
|
115
|
+
|
|
116
|
+
#### `@mui/x-date-pickers@7.6.2`
|
|
117
|
+
|
|
118
|
+
- [fields] Fix `PageUp` and `PageDown` editing on letter sections (#13310) @arthurbalduini
|
|
119
|
+
- [pickers] Fix `AdapterDayjs` timezone behavior (#13362) @LukasTy
|
|
120
|
+
- [pickers] Use `useRtl` instead of `useTheme` to access direction (#13363) @flaviendelangle
|
|
121
|
+
|
|
122
|
+
#### `@mui/x-date-pickers-pro@7.6.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
123
|
+
|
|
124
|
+
Same changes as in `@mui/x-date-pickers@7.6.2`.
|
|
125
|
+
|
|
126
|
+
### Charts
|
|
127
|
+
|
|
128
|
+
#### `@mui/x-charts@7.6.2`
|
|
129
|
+
|
|
130
|
+
- [charts] Add `Initializable` type and behaviour to allow checking if a complex context has been initialized. (#13365) @JCQuintas
|
|
131
|
+
- [charts] Fix some props not working in `xAxis` and `yAxis` (#13372) @Valyok26
|
|
132
|
+
- [charts] Harmonize charts types (#13366) @alexfauquette
|
|
133
|
+
- [charts] Introduce plugins system (#13367) @alexfauquette
|
|
134
|
+
- [charts] Simplify plugin types (#13396) @JCQuintas
|
|
135
|
+
|
|
136
|
+
### Docs
|
|
137
|
+
|
|
138
|
+
- [docs] Add badges like in Material UI @oliviertassinari
|
|
139
|
+
- [docs] Update twitter.com to x.com @oliviertassinari
|
|
140
|
+
- [docs] Fix the description of `tickInterval` (#13355) @alexfauquette
|
|
141
|
+
- [docs] Adjust the code example for `quickFilterValues` (#12919) @michelengelen
|
|
142
|
+
- [docs] Create Pickers accessibility page (#13274) @arthurbalduini
|
|
143
|
+
|
|
144
|
+
### Core
|
|
145
|
+
|
|
146
|
+
- [core] Comment on `CSS.escape` for the future @oliviertassinari
|
|
147
|
+
- [core] Fix `l10n` action setup (#13382) @LukasTy
|
|
148
|
+
- [core] Fixes in preparation for React 18.3 (#13378) @LukasTy
|
|
149
|
+
- [core] Remove explicit `marked` dependency (#13383) @LukasTy
|
|
150
|
+
- [core] Remove unused `@types/prettier` dependency (#13389) @LukasTy
|
|
151
|
+
- [core] Add `docs/.env.local` to `.gitignore` (#13377) @KenanYusuf
|
|
152
|
+
|
|
6
153
|
## 7.6.1
|
|
7
154
|
|
|
8
155
|
_May 31, 2024_
|
|
@@ -272,7 +272,9 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
|
|
|
272
272
|
readOnly,
|
|
273
273
|
disabled,
|
|
274
274
|
timezone,
|
|
275
|
-
gridLabelId
|
|
275
|
+
gridLabelId,
|
|
276
|
+
slots,
|
|
277
|
+
slotProps
|
|
276
278
|
};
|
|
277
279
|
const prevOpenViewRef = React.useRef(view);
|
|
278
280
|
React.useEffect(() => {
|
|
@@ -333,8 +335,6 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
|
|
|
333
335
|
fixedWeekNumber: fixedWeekNumber,
|
|
334
336
|
dayOfWeekFormatter: dayOfWeekFormatter,
|
|
335
337
|
displayWeekNumber: displayWeekNumber,
|
|
336
|
-
slots: slots,
|
|
337
|
-
slotProps: slotProps,
|
|
338
338
|
loading: loading,
|
|
339
339
|
renderLoading: renderLoading
|
|
340
340
|
}))]
|
|
@@ -9,9 +9,9 @@ import { BaseDateValidationProps, YearValidationProps, MonthValidationProps, Day
|
|
|
9
9
|
import { ExportedUseViewsOptions } from '../internals/hooks/useViews';
|
|
10
10
|
import { DateView, PickerValidDate, TimezoneProps } from '../models';
|
|
11
11
|
import { DefaultizedProps } from '../internals/models/helpers';
|
|
12
|
-
import { ExportedYearCalendarProps } from '../YearCalendar/YearCalendar.types';
|
|
13
|
-
import { ExportedMonthCalendarProps } from '../MonthCalendar/MonthCalendar.types';
|
|
14
|
-
export interface DateCalendarSlots<TDate extends PickerValidDate> extends PickersCalendarHeaderSlots, DayCalendarSlots<TDate
|
|
12
|
+
import { ExportedYearCalendarProps, YearCalendarSlots, YearCalendarSlotProps } from '../YearCalendar/YearCalendar.types';
|
|
13
|
+
import { ExportedMonthCalendarProps, MonthCalendarSlots, MonthCalendarSlotProps } from '../MonthCalendar/MonthCalendar.types';
|
|
14
|
+
export interface DateCalendarSlots<TDate extends PickerValidDate> extends PickersCalendarHeaderSlots, DayCalendarSlots<TDate>, MonthCalendarSlots, YearCalendarSlots {
|
|
15
15
|
/**
|
|
16
16
|
* Custom component for calendar header.
|
|
17
17
|
* Check the [PickersCalendarHeader](https://mui.com/x/api/date-pickers/pickers-calendar-header/) component.
|
|
@@ -19,7 +19,7 @@ export interface DateCalendarSlots<TDate extends PickerValidDate> extends Picker
|
|
|
19
19
|
*/
|
|
20
20
|
calendarHeader?: React.ElementType<PickersCalendarHeaderProps<TDate>>;
|
|
21
21
|
}
|
|
22
|
-
export interface DateCalendarSlotProps<TDate extends PickerValidDate> extends PickersCalendarHeaderSlotProps<TDate>, DayCalendarSlotProps<TDate
|
|
22
|
+
export interface DateCalendarSlotProps<TDate extends PickerValidDate> extends PickersCalendarHeaderSlotProps<TDate>, DayCalendarSlotProps<TDate>, MonthCalendarSlotProps, YearCalendarSlotProps {
|
|
23
23
|
calendarHeader?: SlotComponentProps<typeof PickersCalendarHeader, {}, DateCalendarProps<TDate>>;
|
|
24
24
|
}
|
|
25
25
|
export interface ExportedDateCalendarProps<TDate extends PickerValidDate> extends ExportedDayCalendarProps<TDate>, ExportedMonthCalendarProps, ExportedYearCalendarProps, BaseDateValidationProps<TDate>, DayValidationProps<TDate>, YearValidationProps<TDate>, MonthValidationProps<TDate>, TimezoneProps {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { PickersDay, PickersDayProps, ExportedPickersDayProps } from '../PickersDay/PickersDay';
|
|
2
|
+
import { PickersDayProps, ExportedPickersDayProps } from '../PickersDay/PickersDay';
|
|
4
3
|
import { PickerOnChangeFn } from '../internals/hooks/useViews';
|
|
5
4
|
import { SlideDirection, SlideTransitionProps } from './PickersSlideTransition';
|
|
6
5
|
import { BaseDateValidationProps, DayValidationProps, MonthValidationProps, YearValidationProps } from '../internals/models/validation';
|
|
7
6
|
import { DayCalendarClasses } from './dayCalendarClasses';
|
|
8
7
|
import { PickerValidDate, TimezoneProps } from '../models';
|
|
9
|
-
import { DefaultizedProps } from '../internals/models/helpers';
|
|
8
|
+
import { DefaultizedProps, SlotComponentPropsFromProps } from '../internals/models/helpers';
|
|
10
9
|
export interface DayCalendarSlots<TDate extends PickerValidDate> {
|
|
11
10
|
/**
|
|
12
11
|
* Custom component for day.
|
|
@@ -16,7 +15,7 @@ export interface DayCalendarSlots<TDate extends PickerValidDate> {
|
|
|
16
15
|
day?: React.ElementType<PickersDayProps<TDate>>;
|
|
17
16
|
}
|
|
18
17
|
export interface DayCalendarSlotProps<TDate extends PickerValidDate> {
|
|
19
|
-
day?:
|
|
18
|
+
day?: SlotComponentPropsFromProps<PickersDayProps<TDate>, {}, DayCalendarProps<TDate> & {
|
|
20
19
|
day: TDate;
|
|
21
20
|
selected: boolean;
|
|
22
21
|
}>;
|
|
@@ -6,7 +6,8 @@ import * as React from 'react';
|
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
7
|
import Typography from '@mui/material/Typography';
|
|
8
8
|
import { useSlotProps } from '@mui/base/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
10
|
+
import { styled, useThemeProps } from '@mui/material/styles';
|
|
10
11
|
import { unstable_composeClasses as composeClasses, unstable_useControlled as useControlled } from '@mui/utils';
|
|
11
12
|
import clsx from 'clsx';
|
|
12
13
|
import { PickersDay } from '../PickersDay/PickersDay';
|
|
@@ -249,8 +250,7 @@ export function DayCalendar(inProps) {
|
|
|
249
250
|
} = props;
|
|
250
251
|
const now = useNow(timezone);
|
|
251
252
|
const classes = useUtilityClasses(props);
|
|
252
|
-
const
|
|
253
|
-
const isRTL = theme.direction === 'rtl';
|
|
253
|
+
const isRtl = useRtl();
|
|
254
254
|
const isDateDisabled = useIsDateDisabled({
|
|
255
255
|
shouldDisableDate,
|
|
256
256
|
shouldDisableMonth,
|
|
@@ -295,13 +295,13 @@ export function DayCalendar(inProps) {
|
|
|
295
295
|
break;
|
|
296
296
|
case 'ArrowLeft':
|
|
297
297
|
{
|
|
298
|
-
const newFocusedDayDefault = utils.addDays(day,
|
|
299
|
-
const nextAvailableMonth = utils.addMonths(day,
|
|
298
|
+
const newFocusedDayDefault = utils.addDays(day, isRtl ? 1 : -1);
|
|
299
|
+
const nextAvailableMonth = utils.addMonths(day, isRtl ? 1 : -1);
|
|
300
300
|
const closestDayToFocus = findClosestEnabledDate({
|
|
301
301
|
utils,
|
|
302
302
|
date: newFocusedDayDefault,
|
|
303
|
-
minDate:
|
|
304
|
-
maxDate:
|
|
303
|
+
minDate: isRtl ? newFocusedDayDefault : utils.startOfMonth(nextAvailableMonth),
|
|
304
|
+
maxDate: isRtl ? utils.endOfMonth(nextAvailableMonth) : newFocusedDayDefault,
|
|
305
305
|
isDateDisabled,
|
|
306
306
|
timezone
|
|
307
307
|
});
|
|
@@ -311,13 +311,13 @@ export function DayCalendar(inProps) {
|
|
|
311
311
|
}
|
|
312
312
|
case 'ArrowRight':
|
|
313
313
|
{
|
|
314
|
-
const newFocusedDayDefault = utils.addDays(day,
|
|
315
|
-
const nextAvailableMonth = utils.addMonths(day,
|
|
314
|
+
const newFocusedDayDefault = utils.addDays(day, isRtl ? -1 : 1);
|
|
315
|
+
const nextAvailableMonth = utils.addMonths(day, isRtl ? -1 : 1);
|
|
316
316
|
const closestDayToFocus = findClosestEnabledDate({
|
|
317
317
|
utils,
|
|
318
318
|
date: newFocusedDayDefault,
|
|
319
|
-
minDate:
|
|
320
|
-
maxDate:
|
|
319
|
+
minDate: isRtl ? utils.startOfMonth(nextAvailableMonth) : newFocusedDayDefault,
|
|
320
|
+
maxDate: isRtl ? newFocusedDayDefault : utils.endOfMonth(nextAvailableMonth),
|
|
321
321
|
isDateDisabled,
|
|
322
322
|
timezone
|
|
323
323
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["ampm", "ampmInClock", "value", "onChange", "view", "isLandscape", "onViewChange", "toolbarFormat", "toolbarPlaceholder", "views", "disabled", "readOnly", "toolbarVariant", "toolbarTitle", "className"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
6
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
7
|
+
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
9
|
import clsx from 'clsx';
|
|
9
10
|
import { PickersToolbarText } from '../internals/components/PickersToolbarText';
|
|
@@ -20,14 +21,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
20
21
|
const useUtilityClasses = ownerState => {
|
|
21
22
|
const {
|
|
22
23
|
classes,
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
isLandscape,
|
|
25
|
+
isRtl
|
|
25
26
|
} = ownerState;
|
|
26
27
|
const slots = {
|
|
27
28
|
root: ['root'],
|
|
28
29
|
dateContainer: ['dateContainer'],
|
|
29
|
-
timeContainer: ['timeContainer',
|
|
30
|
-
timeDigitsContainer: ['timeDigitsContainer',
|
|
30
|
+
timeContainer: ['timeContainer', isRtl && 'timeLabelReverse'],
|
|
31
|
+
timeDigitsContainer: ['timeDigitsContainer', isRtl && 'timeLabelReverse'],
|
|
31
32
|
separator: ['separator'],
|
|
32
33
|
ampmSelection: ['ampmSelection', isLandscape && 'ampmLandscape'],
|
|
33
34
|
ampmLabel: ['ampmLabel']
|
|
@@ -88,50 +89,59 @@ const DateTimePickerToolbarTimeContainer = styled('div', {
|
|
|
88
89
|
name: 'MuiDateTimePickerToolbar',
|
|
89
90
|
slot: 'TimeContainer',
|
|
90
91
|
overridesResolver: (props, styles) => styles.timeContainer
|
|
91
|
-
})(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
})({
|
|
93
|
+
display: 'flex',
|
|
94
|
+
flexDirection: 'row',
|
|
95
|
+
variants: [{
|
|
96
|
+
props: {
|
|
97
|
+
isRtl: true
|
|
98
|
+
},
|
|
99
|
+
style: {
|
|
100
|
+
flexDirection: 'row-reverse'
|
|
101
|
+
}
|
|
99
102
|
}, {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
103
|
+
props: {
|
|
104
|
+
toolbarVariant: 'desktop',
|
|
105
|
+
isLandscape: false
|
|
106
|
+
},
|
|
107
|
+
style: {
|
|
108
|
+
gap: 9,
|
|
109
|
+
marginRight: 4,
|
|
110
|
+
alignSelf: 'flex-end'
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
props: ({
|
|
114
|
+
isLandscape,
|
|
115
|
+
toolbarVariant
|
|
116
|
+
}) => isLandscape && toolbarVariant !== 'desktop',
|
|
117
|
+
style: {
|
|
118
|
+
flexDirection: 'column'
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
props: ({
|
|
122
|
+
isLandscape,
|
|
123
|
+
toolbarVariant,
|
|
124
|
+
isRtl
|
|
125
|
+
}) => isLandscape && toolbarVariant !== 'desktop' && isRtl,
|
|
126
|
+
style: {
|
|
127
|
+
flexDirection: 'column-reverse'
|
|
128
|
+
}
|
|
129
|
+
}]
|
|
122
130
|
});
|
|
123
131
|
const DateTimePickerToolbarTimeDigitsContainer = styled('div', {
|
|
124
132
|
name: 'MuiDateTimePickerToolbar',
|
|
125
133
|
slot: 'TimeDigitsContainer',
|
|
126
134
|
overridesResolver: (props, styles) => styles.timeDigitsContainer
|
|
127
|
-
})(
|
|
128
|
-
|
|
129
|
-
}) => _extends({
|
|
130
|
-
display: 'flex'
|
|
131
|
-
}, theme.direction === 'rtl' && {
|
|
132
|
-
flexDirection: 'row-reverse'
|
|
133
|
-
}, {
|
|
135
|
+
})({
|
|
136
|
+
display: 'flex',
|
|
134
137
|
variants: [{
|
|
138
|
+
props: {
|
|
139
|
+
isRtl: true
|
|
140
|
+
},
|
|
141
|
+
style: {
|
|
142
|
+
flexDirection: 'row-reverse'
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
135
145
|
props: {
|
|
136
146
|
toolbarVariant: 'desktop'
|
|
137
147
|
},
|
|
@@ -139,7 +149,7 @@ const DateTimePickerToolbarTimeDigitsContainer = styled('div', {
|
|
|
139
149
|
gap: 1.5
|
|
140
150
|
}
|
|
141
151
|
}]
|
|
142
|
-
})
|
|
152
|
+
});
|
|
143
153
|
const DateTimePickerToolbarSeparator = styled(PickersToolbarText, {
|
|
144
154
|
name: 'MuiDateTimePickerToolbar',
|
|
145
155
|
slot: 'Separator',
|
|
@@ -220,7 +230,10 @@ function DateTimePickerToolbar(inProps) {
|
|
|
220
230
|
className
|
|
221
231
|
} = props,
|
|
222
232
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
223
|
-
const
|
|
233
|
+
const isRtl = useRtl();
|
|
234
|
+
const ownerState = _extends({}, props, {
|
|
235
|
+
isRtl
|
|
236
|
+
});
|
|
224
237
|
const utils = useUtils();
|
|
225
238
|
const {
|
|
226
239
|
meridiemMode,
|
|
@@ -229,10 +242,7 @@ function DateTimePickerToolbar(inProps) {
|
|
|
229
242
|
const showAmPmControl = Boolean(ampm && !ampmInClock);
|
|
230
243
|
const isDesktop = toolbarVariant === 'desktop';
|
|
231
244
|
const localeText = useLocaleText();
|
|
232
|
-
const
|
|
233
|
-
const classes = useUtilityClasses(_extends({}, ownerState, {
|
|
234
|
-
theme
|
|
235
|
-
}));
|
|
245
|
+
const classes = useUtilityClasses(ownerState);
|
|
236
246
|
const toolbarTitle = inToolbarTitle ?? localeText.dateTimePickerToolbarTitle;
|
|
237
247
|
const formatHours = time => ampm ? utils.format(time, 'hours12h') : utils.format(time, 'hours24h');
|
|
238
248
|
const dateText = React.useMemo(() => {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import clsx from 'clsx';
|
|
5
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
4
6
|
import Divider from '@mui/material/Divider';
|
|
5
7
|
import { PickersLayoutContentWrapper, PickersLayoutRoot, pickersLayoutClasses, usePickerLayout } from '../PickersLayout';
|
|
6
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -8,6 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
10
|
* @ignore - internal component.
|
|
9
11
|
*/
|
|
10
12
|
function DesktopDateTimePickerLayout(props) {
|
|
13
|
+
const isRtl = useRtl();
|
|
11
14
|
const {
|
|
12
15
|
toolbar,
|
|
13
16
|
tabs,
|
|
@@ -23,6 +26,9 @@ function DesktopDateTimePickerLayout(props) {
|
|
|
23
26
|
classes
|
|
24
27
|
} = props;
|
|
25
28
|
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
29
|
+
const ownerState = _extends({}, props, {
|
|
30
|
+
isRtl
|
|
31
|
+
});
|
|
26
32
|
return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
|
|
27
33
|
ref: ref,
|
|
28
34
|
className: clsx(className, pickersLayoutClasses.root, classes?.root),
|
|
@@ -35,7 +41,7 @@ function DesktopDateTimePickerLayout(props) {
|
|
|
35
41
|
gridRow: 5
|
|
36
42
|
}
|
|
37
43
|
}, ...(Array.isArray(sx) ? sx : [sx])],
|
|
38
|
-
ownerState:
|
|
44
|
+
ownerState: ownerState,
|
|
39
45
|
children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/_jsxs(PickersLayoutContentWrapper, {
|
|
40
46
|
className: clsx(pickersLayoutClasses.contentWrapper, classes?.contentWrapper),
|
|
41
47
|
sx: {
|
|
@@ -63,6 +69,10 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
|
|
|
63
69
|
className: PropTypes.string,
|
|
64
70
|
disabled: PropTypes.bool,
|
|
65
71
|
isLandscape: PropTypes.bool.isRequired,
|
|
72
|
+
/**
|
|
73
|
+
* `true` if the application is in right-to-left direction.
|
|
74
|
+
*/
|
|
75
|
+
isRtl: PropTypes.bool.isRequired,
|
|
66
76
|
isValid: PropTypes.func.isRequired,
|
|
67
77
|
onAccept: PropTypes.func.isRequired,
|
|
68
78
|
onCancel: PropTypes.func.isRequired,
|
|
@@ -1,10 +1,10 @@
|
|
|
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", "gridLabelId"];
|
|
3
|
+
const _excluded = ["className", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "autoFocus", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow", "timezone", "gridLabelId", "slots", "slotProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import {
|
|
7
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
8
8
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
9
9
|
import { unstable_useControlled as useControlled, unstable_composeClasses as composeClasses, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
10
10
|
import { PickersMonth } from './PickersMonth';
|
|
@@ -83,7 +83,9 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
83
83
|
onFocusedViewChange,
|
|
84
84
|
monthsPerRow = 3,
|
|
85
85
|
timezone: timezoneProp,
|
|
86
|
-
gridLabelId
|
|
86
|
+
gridLabelId,
|
|
87
|
+
slots,
|
|
88
|
+
slotProps
|
|
87
89
|
} = props,
|
|
88
90
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
89
91
|
const {
|
|
@@ -99,7 +101,7 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
99
101
|
valueManager: singleItemValueManager
|
|
100
102
|
});
|
|
101
103
|
const now = useNow(timezone);
|
|
102
|
-
const
|
|
104
|
+
const isRtl = useRtl();
|
|
103
105
|
const utils = useUtils();
|
|
104
106
|
const referenceDate = React.useMemo(() => singleItemValueManager.getInitialReferenceValue({
|
|
105
107
|
value,
|
|
@@ -179,11 +181,11 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
179
181
|
event.preventDefault();
|
|
180
182
|
break;
|
|
181
183
|
case 'ArrowLeft':
|
|
182
|
-
focusMonth((monthsInYear + month + (
|
|
184
|
+
focusMonth((monthsInYear + month + (isRtl ? 1 : -1)) % monthsInYear);
|
|
183
185
|
event.preventDefault();
|
|
184
186
|
break;
|
|
185
187
|
case 'ArrowRight':
|
|
186
|
-
focusMonth((monthsInYear + month + (
|
|
188
|
+
focusMonth((monthsInYear + month + (isRtl ? -1 : 1)) % monthsInYear);
|
|
187
189
|
event.preventDefault();
|
|
188
190
|
break;
|
|
189
191
|
default:
|
|
@@ -218,12 +220,14 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
218
220
|
onKeyDown: handleKeyDown,
|
|
219
221
|
autoFocus: internalHasFocus && monthNumber === focusedMonth,
|
|
220
222
|
disabled: isDisabled,
|
|
221
|
-
tabIndex: monthNumber === focusedMonth ? 0 : -1,
|
|
223
|
+
tabIndex: monthNumber === focusedMonth && !isDisabled ? 0 : -1,
|
|
222
224
|
onFocus: handleMonthFocus,
|
|
223
225
|
onBlur: handleMonthBlur,
|
|
224
226
|
"aria-current": todayMonth === monthNumber ? 'date' : undefined,
|
|
225
227
|
"aria-label": monthLabel,
|
|
226
228
|
monthsPerRow: monthsPerRow,
|
|
229
|
+
slots: slots,
|
|
230
|
+
slotProps: slotProps,
|
|
227
231
|
children: monthText
|
|
228
232
|
}, monthText);
|
|
229
233
|
})
|
|
@@ -303,6 +307,16 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
|
|
|
303
307
|
* @returns {boolean} If `true`, the month will be disabled.
|
|
304
308
|
*/
|
|
305
309
|
shouldDisableMonth: PropTypes.func,
|
|
310
|
+
/**
|
|
311
|
+
* The props used for each component slot.
|
|
312
|
+
* @default {}
|
|
313
|
+
*/
|
|
314
|
+
slotProps: PropTypes.object,
|
|
315
|
+
/**
|
|
316
|
+
* Overridable component slots.
|
|
317
|
+
* @default {}
|
|
318
|
+
*/
|
|
319
|
+
slots: PropTypes.object,
|
|
306
320
|
/**
|
|
307
321
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
308
322
|
*/
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { SxProps } from '@mui/system';
|
|
2
3
|
import { Theme } from '@mui/material/styles';
|
|
3
4
|
import { MonthCalendarClasses } from './monthCalendarClasses';
|
|
4
5
|
import { BaseDateValidationProps, MonthValidationProps } from '../internals/models/validation';
|
|
5
6
|
import { PickerValidDate, TimezoneProps } from '../models';
|
|
7
|
+
import type { PickersMonthProps } from './PickersMonth';
|
|
8
|
+
import { SlotComponentPropsFromProps } from '../internals/models/helpers';
|
|
9
|
+
export interface MonthCalendarSlots {
|
|
10
|
+
/**
|
|
11
|
+
* Button displayed to render a single month in the "month" view.
|
|
12
|
+
* @default MonthCalendarButton
|
|
13
|
+
*/
|
|
14
|
+
monthButton?: React.ElementType;
|
|
15
|
+
}
|
|
16
|
+
export interface MonthCalendarSlotProps {
|
|
17
|
+
monthButton?: SlotComponentPropsFromProps<React.HTMLAttributes<HTMLButtonElement> & {
|
|
18
|
+
sx: SxProps;
|
|
19
|
+
}, {}, PickersMonthProps>;
|
|
20
|
+
}
|
|
6
21
|
export interface ExportedMonthCalendarProps {
|
|
7
22
|
/**
|
|
8
23
|
* Months rendered per row.
|
|
@@ -17,6 +32,16 @@ export interface MonthCalendarProps<TDate extends PickerValidDate> extends Expor
|
|
|
17
32
|
* Override or extend the styles applied to the component.
|
|
18
33
|
*/
|
|
19
34
|
classes?: Partial<MonthCalendarClasses>;
|
|
35
|
+
/**
|
|
36
|
+
* Overridable component slots.
|
|
37
|
+
* @default {}
|
|
38
|
+
*/
|
|
39
|
+
slots?: MonthCalendarSlots;
|
|
40
|
+
/**
|
|
41
|
+
* The props used for each component slot.
|
|
42
|
+
* @default {}
|
|
43
|
+
*/
|
|
44
|
+
slotProps?: MonthCalendarSlotProps;
|
|
20
45
|
/**
|
|
21
46
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
22
47
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PickersMonthClasses } from './pickersMonthClasses';
|
|
3
|
+
import { MonthCalendarSlotProps, MonthCalendarSlots } from './MonthCalendar.types';
|
|
3
4
|
export interface ExportedPickersMonthProps {
|
|
4
5
|
classes?: Partial<PickersMonthClasses>;
|
|
5
6
|
}
|
|
@@ -8,6 +9,7 @@ export interface PickersMonthProps extends ExportedPickersMonthProps {
|
|
|
8
9
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
9
10
|
autoFocus: boolean;
|
|
10
11
|
children: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
11
13
|
disabled?: boolean;
|
|
12
14
|
onClick: (event: React.MouseEvent, month: number) => void;
|
|
13
15
|
onKeyDown: (event: React.KeyboardEvent, month: number) => void;
|
|
@@ -17,6 +19,8 @@ export interface PickersMonthProps extends ExportedPickersMonthProps {
|
|
|
17
19
|
value: number;
|
|
18
20
|
tabIndex: number;
|
|
19
21
|
monthsPerRow: 3 | 4;
|
|
22
|
+
slots?: MonthCalendarSlots;
|
|
23
|
+
slotProps?: MonthCalendarSlotProps;
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* @ignore - do not document.
|