@mui/x-date-pickers 7.0.0-beta.7 → 7.1.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/AdapterDateFns/AdapterDateFns.js +1 -1
- package/AdapterDateFnsBase/AdapterDateFnsBase.js +1 -2
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +2 -4
- package/AdapterDateFnsV3/AdapterDateFnsV3.js +1 -1
- package/AdapterDayjs/AdapterDayjs.js +2 -4
- package/AdapterLuxon/AdapterLuxon.js +12 -9
- package/AdapterMoment/AdapterMoment.js +5 -6
- package/CHANGELOG.md +266 -12
- package/DateCalendar/DateCalendar.js +14 -16
- package/DateCalendar/DayCalendar.js +5 -6
- package/DateField/DateField.js +3 -4
- package/DatePicker/DatePicker.js +1 -1
- package/DatePicker/DatePickerToolbar.js +11 -6
- package/DatePicker/shared.d.ts +2 -1
- package/DatePicker/shared.js +3 -5
- package/DateTimeField/DateTimeField.js +3 -4
- package/DateTimePicker/DateTimePicker.js +1 -1
- package/DateTimePicker/DateTimePickerToolbar.js +98 -46
- package/DateTimePicker/shared.d.ts +2 -1
- package/DateTimePicker/shared.js +11 -13
- package/DayCalendarSkeleton/DayCalendarSkeleton.js +12 -8
- package/DesktopDatePicker/DesktopDatePicker.js +7 -11
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +72 -37
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +12 -0
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +101 -0
- package/DesktopDateTimePicker/index.d.ts +1 -0
- package/DesktopDateTimePicker/index.js +2 -1
- package/DesktopTimePicker/DesktopTimePicker.js +8 -12
- package/DigitalClock/DigitalClock.js +16 -9
- package/LocalizationProvider/LocalizationProvider.js +1 -2
- package/MobileDatePicker/MobileDatePicker.js +6 -10
- package/MobileDateTimePicker/MobileDateTimePicker.js +8 -12
- package/MobileTimePicker/MobileTimePicker.js +6 -10
- package/MonthCalendar/MonthCalendar.js +4 -4
- package/MonthCalendar/PickersMonth.js +13 -8
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +16 -9
- package/PickersActionBar/PickersActionBar.js +1 -1
- package/PickersCalendarHeader/PickersCalendarHeader.js +17 -14
- package/PickersDay/PickersDay.js +30 -15
- package/PickersLayout/PickersLayout.js +31 -17
- package/PickersLayout/usePickerLayout.js +8 -9
- package/PickersSectionList/PickersSectionList.js +9 -11
- package/PickersTextField/PickersFilledInput/PickersFilledInput.js +138 -74
- package/PickersTextField/PickersInput/PickersInput.js +77 -55
- package/PickersTextField/PickersInputBase/PickersInputBase.js +67 -28
- package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +7 -0
- package/PickersTextField/PickersOutlinedInput/Outline.js +58 -41
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +33 -14
- package/README.md +1 -1
- package/StaticDatePicker/StaticDatePicker.js +4 -5
- package/StaticDateTimePicker/StaticDateTimePicker.js +6 -7
- package/StaticTimePicker/StaticTimePicker.js +3 -4
- package/TimeClock/Clock.js +48 -35
- package/TimeClock/ClockNumber.js +12 -7
- package/TimeClock/ClockPointer.js +23 -13
- package/TimeClock/TimeClock.js +1 -1
- package/TimeField/TimeField.js +2 -3
- package/TimePicker/TimePickerToolbar.js +25 -16
- package/TimePicker/shared.d.ts +2 -1
- package/TimePicker/shared.js +5 -7
- package/YearCalendar/PickersYear.js +12 -6
- package/YearCalendar/YearCalendar.js +5 -6
- package/hooks/useClearableField.js +6 -7
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +19 -15
- package/internals/components/PickersModalDialog.js +6 -7
- package/internals/components/PickersPopper.js +25 -24
- package/internals/components/PickersToolbar.js +42 -24
- package/internals/hooks/date-helpers-hooks.js +1 -1
- package/internals/hooks/defaultizedFieldProps.js +15 -18
- package/internals/hooks/useClockReferenceDate.js +1 -1
- package/internals/hooks/useDesktopPicker/index.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +11 -12
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +2 -2
- package/internals/hooks/useField/buildSectionsFromFormat.js +35 -31
- package/internals/hooks/useField/useField.js +6 -4
- package/internals/hooks/useField/useField.types.d.ts +1 -0
- package/internals/hooks/useField/useField.utils.js +4 -7
- package/internals/hooks/useField/useFieldCharacterEditing.js +1 -2
- package/internals/hooks/useField/useFieldState.js +1 -1
- package/internals/hooks/useField/useFieldV6TextField.js +17 -18
- package/internals/hooks/useField/useFieldV7TextField.js +9 -11
- package/internals/hooks/useMobilePicker/useMobilePicker.js +7 -8
- package/internals/hooks/useOpenState.js +1 -1
- package/internals/hooks/usePicker/index.d.ts +1 -0
- package/internals/hooks/usePicker/usePickerViews.d.ts +4 -2
- package/internals/hooks/usePicker/usePickerViews.js +1 -2
- package/internals/hooks/useStaticPicker/useStaticPicker.js +13 -17
- package/internals/hooks/useValueWithTimezone.js +5 -6
- package/internals/hooks/useViews.js +3 -4
- package/internals/index.d.ts +1 -1
- package/internals/models/validation.d.ts +1 -1
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +3 -3
- package/internals/utils/date-time-utils.js +2 -5
- package/internals/utils/fields.js +1 -1
- package/internals/utils/getDefaultReferenceDate.js +2 -6
- package/internals/utils/views.js +1 -1
- package/locales/csCZ.js +1 -4
- package/locales/daDK.js +1 -4
- package/locales/deDE.js +1 -4
- package/locales/huHU.js +1 -4
- package/locales/itIT.js +16 -20
- package/locales/jaJP.js +1 -4
- package/locales/roRO.js +1 -4
- package/locales/skSK.js +1 -4
- package/locales/zhHK.js +14 -17
- package/modern/AdapterLuxon/AdapterLuxon.js +9 -4
- package/modern/DateCalendar/DateCalendar.js +1 -1
- package/modern/DateField/DateField.js +1 -1
- package/modern/DatePicker/DatePicker.js +1 -1
- package/modern/DatePicker/DatePickerToolbar.js +11 -6
- package/modern/DateTimeField/DateTimeField.js +1 -1
- package/modern/DateTimePicker/DateTimePicker.js +1 -1
- package/modern/DateTimePicker/DateTimePickerToolbar.js +97 -45
- package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +12 -8
- package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +64 -25
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +101 -0
- package/modern/DesktopDateTimePicker/index.js +2 -1
- package/modern/DigitalClock/DigitalClock.js +14 -6
- package/modern/MobileDatePicker/MobileDatePicker.js +1 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/modern/MonthCalendar/PickersMonth.js +12 -6
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -4
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +13 -9
- package/modern/PickersDay/PickersDay.js +30 -15
- package/modern/PickersLayout/PickersLayout.js +31 -17
- package/modern/PickersTextField/PickersFilledInput/PickersFilledInput.js +137 -72
- package/modern/PickersTextField/PickersInput/PickersInput.js +76 -54
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +64 -24
- package/modern/PickersTextField/PickersOutlinedInput/Outline.js +58 -41
- package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +31 -12
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -1
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/modern/TimeClock/Clock.js +48 -35
- package/modern/TimeClock/ClockNumber.js +12 -7
- package/modern/TimeClock/ClockPointer.js +23 -13
- package/modern/TimePicker/TimePickerToolbar.js +25 -16
- package/modern/YearCalendar/PickersYear.js +12 -6
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -6
- package/modern/internals/components/PickersPopper.js +13 -9
- package/modern/internals/components/PickersToolbar.js +39 -18
- package/modern/internals/hooks/useField/buildSectionsFromFormat.js +34 -30
- package/modern/internals/hooks/useField/useField.js +4 -2
- package/modern/internals/hooks/useField/useFieldV6TextField.js +8 -3
- package/modern/internals/hooks/useField/useFieldV7TextField.js +1 -1
- package/modern/internals/hooks/useOpenState.js +1 -1
- package/modern/internals/utils/fields.js +1 -1
- package/modern/locales/itIT.js +16 -20
- package/modern/locales/zhHK.js +14 -17
- package/node/AdapterLuxon/AdapterLuxon.js +9 -4
- package/node/DateCalendar/DateCalendar.js +1 -1
- package/node/DateField/DateField.js +1 -1
- package/node/DatePicker/DatePicker.js +1 -1
- package/node/DatePicker/DatePickerToolbar.js +11 -6
- package/node/DateTimeField/DateTimeField.js +1 -1
- package/node/DateTimePicker/DateTimePicker.js +1 -1
- package/node/DateTimePicker/DateTimePickerToolbar.js +97 -45
- package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +12 -8
- package/node/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +63 -25
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +108 -0
- package/node/DesktopDateTimePicker/index.js +8 -1
- package/node/DigitalClock/DigitalClock.js +14 -6
- package/node/MobileDatePicker/MobileDatePicker.js +1 -1
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/node/MonthCalendar/PickersMonth.js +12 -6
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -4
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +13 -9
- package/node/PickersDay/PickersDay.js +30 -15
- package/node/PickersLayout/PickersLayout.js +31 -17
- package/node/PickersTextField/PickersFilledInput/PickersFilledInput.js +137 -72
- package/node/PickersTextField/PickersInput/PickersInput.js +76 -54
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +64 -24
- package/node/PickersTextField/PickersOutlinedInput/Outline.js +58 -41
- package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +31 -12
- package/node/StaticDatePicker/StaticDatePicker.js +1 -1
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/node/TimeClock/Clock.js +48 -35
- package/node/TimeClock/ClockNumber.js +12 -7
- package/node/TimeClock/ClockPointer.js +23 -13
- package/node/TimePicker/TimePickerToolbar.js +25 -16
- package/node/YearCalendar/PickersYear.js +12 -6
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -6
- package/node/internals/components/PickersPopper.js +13 -9
- package/node/internals/components/PickersToolbar.js +39 -18
- package/node/internals/hooks/useField/buildSectionsFromFormat.js +34 -30
- package/node/internals/hooks/useField/useField.js +4 -2
- package/node/internals/hooks/useField/useFieldV6TextField.js +8 -3
- package/node/internals/hooks/useField/useFieldV7TextField.js +1 -1
- package/node/internals/hooks/useOpenState.js +1 -1
- package/node/internals/utils/fields.js +1 -1
- package/node/locales/itIT.js +16 -20
- package/node/locales/zhHK.js +14 -17
- package/package.json +5 -5
- package/timeViewRenderers/timeViewRenderers.js +1 -1
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +0 -15
- package/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -163
- package/dateTimeViewRenderers/index.d.ts +0 -2
- package/dateTimeViewRenderers/index.js +0 -1
- package/dateTimeViewRenderers/package.json +0 -6
- package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -162
- package/modern/dateTimeViewRenderers/index.js +0 -1
- package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -171
- package/node/dateTimeViewRenderers/index.js +0 -12
|
@@ -314,7 +314,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
314
314
|
items: viewOptions.items,
|
|
315
315
|
onChange: viewOptions.onChange,
|
|
316
316
|
active: view === timeView,
|
|
317
|
-
autoFocus: autoFocus
|
|
317
|
+
autoFocus: autoFocus ?? focusedView === timeView,
|
|
318
318
|
disabled: disabled,
|
|
319
319
|
readOnly: readOnly,
|
|
320
320
|
slots: slots,
|
|
@@ -11,7 +11,7 @@ export const getHourSectionOptions = ({
|
|
|
11
11
|
const currentHours = value ? utils.getHours(value) : null;
|
|
12
12
|
const result = [];
|
|
13
13
|
const isSelected = (hour, overriddenCurrentHours) => {
|
|
14
|
-
const resolvedCurrentHours = overriddenCurrentHours
|
|
14
|
+
const resolvedCurrentHours = overriddenCurrentHours ?? currentHours;
|
|
15
15
|
if (resolvedCurrentHours === null) {
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
@@ -26,15 +26,14 @@ const MultiSectionDigitalClockSectionRoot = styled(MenuList, {
|
|
|
26
26
|
slot: 'Root',
|
|
27
27
|
overridesResolver: (_, styles) => styles.root
|
|
28
28
|
})(({
|
|
29
|
-
theme
|
|
30
|
-
ownerState
|
|
29
|
+
theme
|
|
31
30
|
}) => ({
|
|
32
31
|
maxHeight: DIGITAL_CLOCK_VIEW_HEIGHT,
|
|
33
32
|
width: 56,
|
|
34
33
|
padding: 0,
|
|
35
34
|
overflow: 'hidden',
|
|
36
35
|
'@media (prefers-reduced-motion: no-preference)': {
|
|
37
|
-
scrollBehavior:
|
|
36
|
+
scrollBehavior: 'auto'
|
|
38
37
|
},
|
|
39
38
|
'@media (pointer: fine)': {
|
|
40
39
|
'&:hover': {
|
|
@@ -52,7 +51,17 @@ const MultiSectionDigitalClockSectionRoot = styled(MenuList, {
|
|
|
52
51
|
content: '""',
|
|
53
52
|
// subtracting the height of one item, extra margin and borders to make sure the max height is correct
|
|
54
53
|
height: 'calc(100% - 40px - 6px)'
|
|
55
|
-
}
|
|
54
|
+
},
|
|
55
|
+
variants: [{
|
|
56
|
+
props: {
|
|
57
|
+
alreadyRendered: true
|
|
58
|
+
},
|
|
59
|
+
style: {
|
|
60
|
+
'@media (prefers-reduced-motion: no-preference)': {
|
|
61
|
+
scrollBehavior: 'smooth'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}]
|
|
56
65
|
}));
|
|
57
66
|
const MultiSectionDigitalClockSectionItem = styled(MenuItem, {
|
|
58
67
|
name: 'MuiMultiSectionDigitalClockSection',
|
|
@@ -86,7 +95,6 @@ const MultiSectionDigitalClockSectionItem = styled(MenuItem, {
|
|
|
86
95
|
* @ignore - internal component.
|
|
87
96
|
*/
|
|
88
97
|
export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(function MultiSectionDigitalClockSection(inProps, ref) {
|
|
89
|
-
var _slots$digitalClockSe;
|
|
90
98
|
const containerRef = React.useRef(null);
|
|
91
99
|
const handleRef = useForkRef(ref, containerRef);
|
|
92
100
|
const previousActive = React.useRef(null);
|
|
@@ -111,7 +119,7 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
111
119
|
alreadyRendered: !!containerRef.current
|
|
112
120
|
}), [props]);
|
|
113
121
|
const classes = useUtilityClasses(ownerState);
|
|
114
|
-
const DigitalClockSectionItem =
|
|
122
|
+
const DigitalClockSectionItem = slots?.digitalClockSectionItem ?? MultiSectionDigitalClockSectionItem;
|
|
115
123
|
React.useEffect(() => {
|
|
116
124
|
if (containerRef.current === null) {
|
|
117
125
|
return;
|
|
@@ -138,8 +146,7 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
138
146
|
role: "listbox"
|
|
139
147
|
}, other, {
|
|
140
148
|
children: items.map((option, index) => {
|
|
141
|
-
|
|
142
|
-
const isItemDisabled = (_option$isDisabled = option.isDisabled) == null ? void 0 : _option$isDisabled.call(option, option.value);
|
|
149
|
+
const isItemDisabled = option.isDisabled?.(option.value);
|
|
143
150
|
const isDisabled = disabled || isItemDisabled;
|
|
144
151
|
if (skipDisabled && isDisabled) {
|
|
145
152
|
return null;
|
|
@@ -159,7 +166,7 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
159
166
|
"aria-selected": isSelected,
|
|
160
167
|
tabIndex: tabIndex,
|
|
161
168
|
className: classes.item
|
|
162
|
-
}, slotProps
|
|
169
|
+
}, slotProps?.digitalClockSectionItem, {
|
|
163
170
|
children: option.label
|
|
164
171
|
}), option.label);
|
|
165
172
|
})
|
|
@@ -30,7 +30,7 @@ function PickersActionBar(props) {
|
|
|
30
30
|
if (actions == null || actions.length === 0) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
|
-
const buttons = actions
|
|
33
|
+
const buttons = actions?.map(actionType => {
|
|
34
34
|
switch (actionType) {
|
|
35
35
|
case 'clear':
|
|
36
36
|
return /*#__PURE__*/_jsx(Button, {
|
|
@@ -72,15 +72,19 @@ const PickersCalendarHeaderSwitchViewButton = styled(IconButton, {
|
|
|
72
72
|
name: 'MuiPickersCalendarHeader',
|
|
73
73
|
slot: 'SwitchViewButton',
|
|
74
74
|
overridesResolver: (_, styles) => styles.switchViewButton
|
|
75
|
-
})(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
})({
|
|
76
|
+
marginRight: 'auto',
|
|
77
|
+
variants: [{
|
|
78
|
+
props: {
|
|
79
|
+
view: 'year'
|
|
80
|
+
},
|
|
81
|
+
style: {
|
|
82
|
+
[`.${pickersCalendarHeaderClasses.switchViewIcon}`]: {
|
|
83
|
+
transform: 'rotate(180deg)'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}]
|
|
87
|
+
});
|
|
84
88
|
const PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDownIcon, {
|
|
85
89
|
name: 'MuiPickersCalendarHeader',
|
|
86
90
|
slot: 'SwitchViewIcon',
|
|
@@ -104,7 +108,6 @@ const PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDownIcon, {
|
|
|
104
108
|
* - [PickersCalendarHeader API](https://mui.com/x/api/date-pickers/pickers-calendar-header/)
|
|
105
109
|
*/
|
|
106
110
|
const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalendarHeader(inProps, ref) {
|
|
107
|
-
var _slots$switchViewButt, _slots$switchViewIcon;
|
|
108
111
|
const localeText = useLocaleText();
|
|
109
112
|
const utils = useUtils();
|
|
110
113
|
const props = useThemeProps({
|
|
@@ -133,10 +136,10 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
133
136
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
134
137
|
const ownerState = props;
|
|
135
138
|
const classes = useUtilityClasses(props);
|
|
136
|
-
const SwitchViewButton =
|
|
139
|
+
const SwitchViewButton = slots?.switchViewButton ?? PickersCalendarHeaderSwitchViewButton;
|
|
137
140
|
const switchViewButtonProps = useSlotProps({
|
|
138
141
|
elementType: SwitchViewButton,
|
|
139
|
-
externalSlotProps: slotProps
|
|
142
|
+
externalSlotProps: slotProps?.switchViewButton,
|
|
140
143
|
additionalProps: {
|
|
141
144
|
size: 'small',
|
|
142
145
|
'aria-label': localeText.calendarViewSwitchingButtonAriaLabel(view)
|
|
@@ -144,11 +147,11 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
144
147
|
ownerState,
|
|
145
148
|
className: classes.switchViewButton
|
|
146
149
|
});
|
|
147
|
-
const SwitchViewIcon =
|
|
150
|
+
const SwitchViewIcon = slots?.switchViewIcon ?? PickersCalendarHeaderSwitchViewIcon;
|
|
148
151
|
// The spread is here to avoid this bug mui/material-ui#34056
|
|
149
152
|
const _useSlotProps = useSlotProps({
|
|
150
153
|
elementType: SwitchViewIcon,
|
|
151
|
-
externalSlotProps: slotProps
|
|
154
|
+
externalSlotProps: slotProps?.switchViewIcon,
|
|
152
155
|
ownerState: undefined,
|
|
153
156
|
className: classes.switchViewIcon
|
|
154
157
|
}),
|
package/PickersDay/PickersDay.js
CHANGED
|
@@ -30,8 +30,7 @@ const useUtilityClasses = ownerState => {
|
|
|
30
30
|
return composeClasses(slots, getPickersDayUtilityClass, classes);
|
|
31
31
|
};
|
|
32
32
|
const styleArg = ({
|
|
33
|
-
theme
|
|
34
|
-
ownerState
|
|
33
|
+
theme
|
|
35
34
|
}) => _extends({}, theme.typography.caption, {
|
|
36
35
|
width: DAY_SIZE,
|
|
37
36
|
height: DAY_SIZE,
|
|
@@ -69,15 +68,33 @@ const styleArg = ({
|
|
|
69
68
|
},
|
|
70
69
|
[`&.${pickersDayClasses.disabled}&.${pickersDayClasses.selected}`]: {
|
|
71
70
|
opacity: 0.6
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
71
|
+
},
|
|
72
|
+
variants: [{
|
|
73
|
+
props: {
|
|
74
|
+
disableMargin: false
|
|
75
|
+
},
|
|
76
|
+
style: {
|
|
77
|
+
margin: `0 ${DAY_MARGIN}px`
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
props: {
|
|
81
|
+
outsideCurrentMonth: true,
|
|
82
|
+
showDaysOutsideCurrentMonth: true
|
|
83
|
+
},
|
|
84
|
+
style: {
|
|
85
|
+
color: (theme.vars || theme).palette.text.secondary
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
props: {
|
|
89
|
+
disableHighlightToday: false,
|
|
90
|
+
today: true
|
|
91
|
+
},
|
|
92
|
+
style: {
|
|
93
|
+
[`&:not(.${pickersDayClasses.selected})`]: {
|
|
94
|
+
border: `1px solid ${(theme.vars || theme).palette.text.secondary}`
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}]
|
|
81
98
|
});
|
|
82
99
|
const overridesResolver = (props, styles) => {
|
|
83
100
|
const {
|
|
@@ -95,11 +112,9 @@ const PickersDayFiller = styled('div', {
|
|
|
95
112
|
slot: 'Root',
|
|
96
113
|
overridesResolver
|
|
97
114
|
})(({
|
|
98
|
-
theme
|
|
99
|
-
ownerState
|
|
115
|
+
theme
|
|
100
116
|
}) => _extends({}, styleArg({
|
|
101
|
-
theme
|
|
102
|
-
ownerState
|
|
117
|
+
theme
|
|
103
118
|
}), {
|
|
104
119
|
// visibility: 'hidden' does not work here as it hides the element from screen readers as well
|
|
105
120
|
opacity: 0,
|
|
@@ -23,30 +23,44 @@ const PickersLayoutRoot = styled('div', {
|
|
|
23
23
|
slot: 'Root',
|
|
24
24
|
overridesResolver: (props, styles) => styles.root
|
|
25
25
|
})(({
|
|
26
|
-
theme
|
|
27
|
-
ownerState
|
|
26
|
+
theme
|
|
28
27
|
}) => ({
|
|
29
28
|
display: 'grid',
|
|
30
29
|
gridAutoColumns: 'max-content auto max-content',
|
|
31
30
|
gridAutoRows: 'max-content auto max-content',
|
|
32
|
-
[`& .${pickersLayoutClasses.toolbar}`]: ownerState.isLandscape ? {
|
|
33
|
-
gridColumn: theme.direction === 'rtl' ? 3 : 1,
|
|
34
|
-
gridRow: '2 / 3'
|
|
35
|
-
} : {
|
|
36
|
-
gridColumn: '2 / 4',
|
|
37
|
-
gridRow: 1
|
|
38
|
-
},
|
|
39
|
-
[`.${pickersLayoutClasses.shortcuts}`]: ownerState.isLandscape ? {
|
|
40
|
-
gridColumn: '2 / 4',
|
|
41
|
-
gridRow: 1
|
|
42
|
-
} : {
|
|
43
|
-
gridColumn: theme.direction === 'rtl' ? 3 : 1,
|
|
44
|
-
gridRow: '2 / 3'
|
|
45
|
-
},
|
|
46
31
|
[`& .${pickersLayoutClasses.actionBar}`]: {
|
|
47
32
|
gridColumn: '1 / 4',
|
|
48
33
|
gridRow: 3
|
|
49
|
-
}
|
|
34
|
+
},
|
|
35
|
+
variants: [{
|
|
36
|
+
props: {
|
|
37
|
+
isLandscape: true
|
|
38
|
+
},
|
|
39
|
+
style: {
|
|
40
|
+
[`& .${pickersLayoutClasses.toolbar}`]: {
|
|
41
|
+
gridColumn: theme.direction === 'rtl' ? 3 : 1,
|
|
42
|
+
gridRow: '2 / 3'
|
|
43
|
+
},
|
|
44
|
+
[`.${pickersLayoutClasses.shortcuts}`]: {
|
|
45
|
+
gridColumn: '2 / 4',
|
|
46
|
+
gridRow: 1
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
props: {
|
|
51
|
+
isLandscape: false
|
|
52
|
+
},
|
|
53
|
+
style: {
|
|
54
|
+
[`& .${pickersLayoutClasses.toolbar}`]: {
|
|
55
|
+
gridColumn: '2 / 4',
|
|
56
|
+
gridRow: 1
|
|
57
|
+
},
|
|
58
|
+
[`& .${pickersLayoutClasses.shortcuts}`]: {
|
|
59
|
+
gridColumn: theme.direction === 'rtl' ? 3 : 1,
|
|
60
|
+
gridRow: '2 / 3'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}]
|
|
50
64
|
}));
|
|
51
65
|
PickersLayoutRoot.propTypes = {
|
|
52
66
|
// ----------------------------- Warning --------------------------------
|
|
@@ -26,7 +26,6 @@ const useUtilityClasses = ownerState => {
|
|
|
26
26
|
return composeClasses(slots, getPickersLayoutUtilityClass, classes);
|
|
27
27
|
};
|
|
28
28
|
const usePickerLayout = props => {
|
|
29
|
-
var _slots$actionBar, _slots$shortcuts;
|
|
30
29
|
const {
|
|
31
30
|
wrapperVariant,
|
|
32
31
|
onAccept,
|
|
@@ -55,10 +54,10 @@ const usePickerLayout = props => {
|
|
|
55
54
|
|
|
56
55
|
// Action bar
|
|
57
56
|
|
|
58
|
-
const ActionBar =
|
|
57
|
+
const ActionBar = slots?.actionBar ?? PickersActionBar;
|
|
59
58
|
const actionBarProps = useSlotProps({
|
|
60
59
|
elementType: ActionBar,
|
|
61
|
-
externalSlotProps: slotProps
|
|
60
|
+
externalSlotProps: slotProps?.actionBar,
|
|
62
61
|
additionalProps: {
|
|
63
62
|
onAccept,
|
|
64
63
|
onClear,
|
|
@@ -75,10 +74,10 @@ const usePickerLayout = props => {
|
|
|
75
74
|
|
|
76
75
|
// Toolbar
|
|
77
76
|
|
|
78
|
-
const Toolbar = slots
|
|
77
|
+
const Toolbar = slots?.toolbar;
|
|
79
78
|
const toolbarProps = useSlotProps({
|
|
80
79
|
elementType: Toolbar,
|
|
81
|
-
externalSlotProps: slotProps
|
|
80
|
+
externalSlotProps: slotProps?.toolbar,
|
|
82
81
|
additionalProps: {
|
|
83
82
|
isLandscape,
|
|
84
83
|
onChange,
|
|
@@ -102,19 +101,19 @@ const usePickerLayout = props => {
|
|
|
102
101
|
|
|
103
102
|
// Tabs
|
|
104
103
|
|
|
105
|
-
const Tabs = slots
|
|
104
|
+
const Tabs = slots?.tabs;
|
|
106
105
|
const tabs = view && Tabs ? /*#__PURE__*/_jsx(Tabs, _extends({
|
|
107
106
|
view: view,
|
|
108
107
|
onViewChange: onViewChange,
|
|
109
108
|
className: classes.tabs
|
|
110
|
-
}, slotProps
|
|
109
|
+
}, slotProps?.tabs)) : null;
|
|
111
110
|
|
|
112
111
|
// Shortcuts
|
|
113
112
|
|
|
114
|
-
const Shortcuts =
|
|
113
|
+
const Shortcuts = slots?.shortcuts ?? PickersShortcuts;
|
|
115
114
|
const shortcutsProps = useSlotProps({
|
|
116
115
|
elementType: Shortcuts,
|
|
117
|
-
externalSlotProps: slotProps
|
|
116
|
+
externalSlotProps: slotProps?.shortcuts,
|
|
118
117
|
additionalProps: {
|
|
119
118
|
isValid,
|
|
120
119
|
isLandscape,
|
|
@@ -58,25 +58,24 @@ const useUtilityClasses = ownerState => {
|
|
|
58
58
|
* - [PickersSectionList API](https://mui.com/x/api/date-pickers/pickers-section-list/)
|
|
59
59
|
*/
|
|
60
60
|
function PickersSection(props) {
|
|
61
|
-
var _slots$section, _slots$sectionContent, _slots$sectionSeparat;
|
|
62
61
|
const {
|
|
63
62
|
slots,
|
|
64
63
|
slotProps,
|
|
65
64
|
element,
|
|
66
65
|
classes
|
|
67
66
|
} = props;
|
|
68
|
-
const Section =
|
|
67
|
+
const Section = slots?.section ?? PickersSectionListSection;
|
|
69
68
|
const sectionProps = useSlotProps({
|
|
70
69
|
elementType: Section,
|
|
71
|
-
externalSlotProps: slotProps
|
|
70
|
+
externalSlotProps: slotProps?.section,
|
|
72
71
|
externalForwardedProps: element.container,
|
|
73
72
|
className: classes.section,
|
|
74
73
|
ownerState: {}
|
|
75
74
|
});
|
|
76
|
-
const SectionContent =
|
|
75
|
+
const SectionContent = slots?.sectionContent ?? PickersSectionListSectionContent;
|
|
77
76
|
const sectionContentProps = useSlotProps({
|
|
78
77
|
elementType: SectionContent,
|
|
79
|
-
externalSlotProps: slotProps
|
|
78
|
+
externalSlotProps: slotProps?.sectionContent,
|
|
80
79
|
externalForwardedProps: element.content,
|
|
81
80
|
additionalProps: {
|
|
82
81
|
suppressContentEditableWarning: true
|
|
@@ -84,10 +83,10 @@ function PickersSection(props) {
|
|
|
84
83
|
className: classes.sectionContent,
|
|
85
84
|
ownerState: {}
|
|
86
85
|
});
|
|
87
|
-
const SectionSeparator =
|
|
86
|
+
const SectionSeparator = slots?.sectionSeparator ?? PickersSectionListSectionSeparator;
|
|
88
87
|
const sectionSeparatorBeforeProps = useSlotProps({
|
|
89
88
|
elementType: SectionSeparator,
|
|
90
|
-
externalSlotProps: slotProps
|
|
89
|
+
externalSlotProps: slotProps?.sectionSeparator,
|
|
91
90
|
externalForwardedProps: element.before,
|
|
92
91
|
ownerState: {
|
|
93
92
|
position: 'before'
|
|
@@ -95,7 +94,7 @@ function PickersSection(props) {
|
|
|
95
94
|
});
|
|
96
95
|
const sectionSeparatorAfterProps = useSlotProps({
|
|
97
96
|
elementType: SectionSeparator,
|
|
98
|
-
externalSlotProps: slotProps
|
|
97
|
+
externalSlotProps: slotProps?.sectionSeparator,
|
|
99
98
|
externalForwardedProps: element.after,
|
|
100
99
|
ownerState: {
|
|
101
100
|
position: 'after'
|
|
@@ -106,7 +105,6 @@ function PickersSection(props) {
|
|
|
106
105
|
}));
|
|
107
106
|
}
|
|
108
107
|
const PickersSectionList = /*#__PURE__*/React.forwardRef(function PickersSectionList(inProps, ref) {
|
|
109
|
-
var _slots$root;
|
|
110
108
|
const props = useThemeProps({
|
|
111
109
|
props: inProps,
|
|
112
110
|
name: 'MuiPickersSectionList'
|
|
@@ -156,10 +154,10 @@ const PickersSectionList = /*#__PURE__*/React.forwardRef(function PickersSection
|
|
|
156
154
|
return Number(sectionContainer.dataset.sectionindex);
|
|
157
155
|
}
|
|
158
156
|
}));
|
|
159
|
-
const Root =
|
|
157
|
+
const Root = slots?.root ?? PickersSectionListRoot;
|
|
160
158
|
const rootProps = useSlotProps({
|
|
161
159
|
elementType: Root,
|
|
162
|
-
externalSlotProps: slotProps
|
|
160
|
+
externalSlotProps: slotProps?.root,
|
|
163
161
|
externalForwardedProps: other,
|
|
164
162
|
additionalProps: {
|
|
165
163
|
ref: handleRootRef,
|