@mui/x-date-pickers 9.0.0-alpha.3 → 9.0.0-rc.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/AdapterDateFnsBase/AdapterDateFnsBase.mjs +1 -1
- package/AdapterDayjs/AdapterDayjs.mjs +1 -1
- package/AdapterLuxon/AdapterLuxon.mjs +1 -1
- package/AdapterMoment/AdapterMoment.mjs +1 -1
- package/AdapterMomentHijri/AdapterMomentHijri.mjs +1 -1
- package/AdapterMomentJalaali/AdapterMomentJalaali.mjs +1 -1
- package/CHANGELOG.md +384 -1
- package/DateCalendar/DateCalendar.js +1 -1
- package/DateCalendar/DateCalendar.mjs +1 -1
- package/DateCalendar/DayCalendar.d.mts +7 -7
- package/DateCalendar/DayCalendar.d.ts +7 -7
- package/DateCalendar/DayCalendar.js +23 -25
- package/DateCalendar/DayCalendar.mjs +23 -25
- package/DateField/DateField.d.mts +1 -1
- package/DateField/DateField.d.ts +1 -1
- package/DateField/DateField.js +26 -8
- package/DateField/DateField.mjs +26 -8
- package/DateField/DateField.types.d.mts +3 -3
- package/DateField/DateField.types.d.ts +3 -3
- package/DateField/useDateField.d.mts +1 -1
- package/DateField/useDateField.d.ts +1 -1
- package/DateField/useDateField.js +1 -1
- package/DateField/useDateField.mjs +1 -1
- package/DatePicker/DatePicker.d.mts +1 -1
- package/DatePicker/DatePicker.d.ts +1 -1
- package/DatePicker/DatePicker.js +1 -5
- package/DatePicker/DatePicker.mjs +1 -5
- package/DatePicker/DatePicker.types.d.mts +3 -3
- package/DatePicker/DatePicker.types.d.ts +3 -3
- package/DateTimeField/DateTimeField.d.mts +1 -1
- package/DateTimeField/DateTimeField.d.ts +1 -1
- package/DateTimeField/DateTimeField.js +26 -8
- package/DateTimeField/DateTimeField.mjs +26 -8
- package/DateTimeField/DateTimeField.types.d.mts +2 -2
- package/DateTimeField/DateTimeField.types.d.ts +2 -2
- package/DateTimeField/useDateTimeField.d.mts +1 -1
- package/DateTimeField/useDateTimeField.d.ts +1 -1
- package/DateTimeField/useDateTimeField.js +1 -1
- package/DateTimeField/useDateTimeField.mjs +1 -1
- package/DateTimePicker/DateTimePicker.d.mts +1 -1
- package/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/DateTimePicker/DateTimePicker.js +1 -5
- package/DateTimePicker/DateTimePicker.mjs +1 -5
- package/DateTimePicker/DateTimePicker.types.d.mts +3 -3
- package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
- package/DesktopDatePicker/DesktopDatePicker.d.mts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +1 -5
- package/DesktopDatePicker/DesktopDatePicker.mjs +1 -5
- package/DesktopDatePicker/DesktopDatePicker.types.d.mts +3 -3
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +3 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.mts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -5
- package/DesktopDateTimePicker/DesktopDateTimePicker.mjs +1 -5
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.mts +3 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +3 -3
- package/DesktopTimePicker/DesktopTimePicker.d.mts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.js +0 -4
- package/DesktopTimePicker/DesktopTimePicker.mjs +0 -4
- package/DesktopTimePicker/DesktopTimePicker.types.d.mts +3 -3
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +3 -3
- package/DigitalClock/DigitalClock.d.mts +1 -1
- package/DigitalClock/DigitalClock.d.ts +1 -1
- package/DigitalClock/DigitalClock.js +5 -3
- package/DigitalClock/DigitalClock.mjs +6 -4
- package/MobileDatePicker/MobileDatePicker.d.mts +1 -1
- package/MobileDatePicker/MobileDatePicker.d.ts +1 -1
- package/MobileDatePicker/MobileDatePicker.js +1 -5
- package/MobileDatePicker/MobileDatePicker.mjs +1 -5
- package/MobileDatePicker/MobileDatePicker.types.d.mts +3 -3
- package/MobileDatePicker/MobileDatePicker.types.d.ts +3 -3
- package/MobileDateTimePicker/MobileDateTimePicker.d.mts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +1 -5
- package/MobileDateTimePicker/MobileDateTimePicker.mjs +1 -5
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.mts +3 -3
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +3 -3
- package/MobileTimePicker/MobileTimePicker.d.mts +1 -1
- package/MobileTimePicker/MobileTimePicker.d.ts +1 -1
- package/MobileTimePicker/MobileTimePicker.js +0 -4
- package/MobileTimePicker/MobileTimePicker.mjs +0 -4
- package/MobileTimePicker/MobileTimePicker.types.d.mts +3 -3
- package/MobileTimePicker/MobileTimePicker.types.d.ts +3 -3
- package/MonthCalendar/MonthCalendarButton.js +2 -2
- package/MonthCalendar/MonthCalendarButton.mjs +3 -3
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +46 -9
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.mjs +47 -10
- package/PickerDay/PickerDay.d.mts +14 -0
- package/PickerDay/PickerDay.d.ts +14 -0
- package/{PickerDay2/PickerDay2.js → PickerDay/PickerDay.js} +110 -45
- package/{PickerDay2/PickerDay2.mjs → PickerDay/PickerDay.mjs} +110 -45
- package/PickerDay/PickerDay.types.d.mts +137 -0
- package/PickerDay/PickerDay.types.d.ts +137 -0
- package/PickerDay/index.d.mts +4 -0
- package/PickerDay/index.d.ts +4 -0
- package/PickerDay/index.js +25 -0
- package/PickerDay/index.mjs +2 -0
- package/{PickerDay2/pickerDay2Classes.d.mts → PickerDay/pickerDayClasses.d.mts} +4 -4
- package/{PickerDay2/pickerDay2Classes.d.ts → PickerDay/pickerDayClasses.d.ts} +4 -4
- package/PickerDay/pickerDayClasses.js +14 -0
- package/PickerDay/pickerDayClasses.mjs +6 -0
- package/PickersTextField/PickersFilledInput/PickersFilledInput.js +27 -1
- package/PickersTextField/PickersFilledInput/PickersFilledInput.mjs +27 -1
- package/PickersTextField/PickersInput/PickersInput.js +27 -1
- package/PickersTextField/PickersInput/PickersInput.mjs +27 -1
- package/PickersTextField/PickersInputBase/PickersInputBase.js +26 -0
- package/PickersTextField/PickersInputBase/PickersInputBase.mjs +26 -0
- package/PickersTextField/PickersInputBase/PickersInputBase.types.d.mts +26 -0
- package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +26 -0
- package/PickersTextField/PickersOutlinedInput/Outline.js +1 -1
- package/PickersTextField/PickersOutlinedInput/Outline.mjs +1 -1
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +27 -1
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.mjs +27 -1
- package/PickersTextField/PickersTextField.js +42 -2
- package/PickersTextField/PickersTextField.mjs +42 -2
- package/PickersTextField/PickersTextField.types.d.mts +22 -6
- package/PickersTextField/PickersTextField.types.d.ts +22 -6
- package/StaticDatePicker/StaticDatePicker.js +1 -1
- package/StaticDatePicker/StaticDatePicker.mjs +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.mjs +1 -1
- package/TimeField/TimeField.d.mts +1 -1
- package/TimeField/TimeField.d.ts +1 -1
- package/TimeField/TimeField.js +26 -8
- package/TimeField/TimeField.mjs +26 -8
- package/TimeField/TimeField.types.d.mts +2 -2
- package/TimeField/TimeField.types.d.ts +2 -2
- package/TimeField/useTimeField.d.mts +1 -1
- package/TimeField/useTimeField.d.ts +1 -1
- package/TimePicker/TimePicker.d.mts +1 -1
- package/TimePicker/TimePicker.d.ts +1 -1
- package/TimePicker/TimePicker.js +0 -4
- package/TimePicker/TimePicker.mjs +0 -4
- package/TimePicker/TimePicker.types.d.mts +3 -3
- package/TimePicker/TimePicker.types.d.ts +3 -3
- package/YearCalendar/YearCalendarButton.js +2 -2
- package/YearCalendar/YearCalendarButton.mjs +3 -3
- package/hooks/useParsedFormat.js +5 -7
- package/hooks/useParsedFormat.mjs +5 -7
- package/hooks/useSplitFieldProps.d.mts +1 -1
- package/hooks/useSplitFieldProps.d.ts +1 -1
- package/hooks/useSplitFieldProps.js +1 -1
- package/hooks/useSplitFieldProps.mjs +1 -1
- package/index.d.mts +1 -2
- package/index.d.ts +1 -2
- package/index.js +2 -14
- package/index.mjs +2 -3
- package/internals/components/PickerFieldUI.d.mts +22 -13
- package/internals/components/PickerFieldUI.d.ts +22 -13
- package/internals/components/PickerFieldUI.js +22 -80
- package/internals/components/PickerFieldUI.mjs +22 -80
- package/internals/components/PickerPopper/PickerPopper.js +20 -2
- package/internals/components/PickerPopper/PickerPopper.mjs +20 -2
- package/internals/components/PickersToolbar.js +3 -1
- package/internals/components/PickersToolbar.mjs +3 -1
- package/internals/demo/DemoContainer.js +6 -8
- package/internals/demo/DemoContainer.mjs +6 -8
- package/internals/hooks/PickerDay.types.d.mts +12 -0
- package/internals/hooks/PickerDay.types.d.ts +12 -0
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.mts +2 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +2 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.mts +6 -6
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +6 -6
- package/internals/hooks/useField/buildSectionsFromFormat.d.mts +0 -1
- package/internals/hooks/useField/buildSectionsFromFormat.d.ts +0 -1
- package/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/internals/hooks/useField/buildSectionsFromFormat.mjs +1 -1
- package/internals/hooks/useField/index.d.mts +1 -1
- package/internals/hooks/useField/index.d.ts +1 -1
- package/internals/hooks/useField/index.js +2 -8
- package/internals/hooks/useField/index.mjs +1 -1
- package/internals/hooks/useField/useField.d.mts +2 -2
- package/internals/hooks/useField/useField.d.ts +2 -2
- package/internals/hooks/useField/useField.js +265 -8
- package/internals/hooks/useField/useField.mjs +264 -8
- package/internals/hooks/useField/useField.types.d.mts +12 -51
- package/internals/hooks/useField/useField.types.d.ts +12 -51
- package/internals/hooks/useField/useField.utils.d.mts +2 -3
- package/internals/hooks/useField/useField.utils.d.ts +2 -3
- package/internals/hooks/useField/useField.utils.js +8 -65
- package/internals/hooks/useField/useField.utils.mjs +6 -62
- package/internals/hooks/useField/useFieldHiddenInputProps.d.mts +2 -4
- package/internals/hooks/useField/useFieldHiddenInputProps.d.ts +2 -4
- package/internals/hooks/useField/useFieldHiddenInputProps.js +1 -3
- package/internals/hooks/useField/useFieldHiddenInputProps.mjs +1 -3
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +2 -3
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.mjs +2 -3
- package/internals/hooks/useField/useFieldRootProps.d.mts +5 -5
- package/internals/hooks/useField/useFieldRootProps.d.ts +5 -5
- package/internals/hooks/useField/useFieldRootProps.js +183 -11
- package/internals/hooks/useField/useFieldRootProps.mjs +183 -11
- package/internals/hooks/useField/useFieldSectionContainerProps.d.mts +3 -5
- package/internals/hooks/useField/useFieldSectionContainerProps.d.ts +3 -5
- package/internals/hooks/useField/useFieldSectionContainerProps.js +2 -4
- package/internals/hooks/useField/useFieldSectionContainerProps.mjs +2 -4
- package/internals/hooks/useField/useFieldSectionContentProps.d.mts +6 -7
- package/internals/hooks/useField/useFieldSectionContentProps.d.ts +6 -7
- package/internals/hooks/useField/useFieldSectionContentProps.js +2 -4
- package/internals/hooks/useField/useFieldSectionContentProps.mjs +2 -4
- package/internals/hooks/useField/useFieldState.d.mts +4 -4
- package/internals/hooks/useField/useFieldState.d.ts +4 -4
- package/internals/hooks/useField/useFieldState.js +3 -6
- package/internals/hooks/useField/useFieldState.mjs +3 -6
- package/internals/hooks/useMobilePicker/useMobilePicker.d.mts +2 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +2 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.mts +6 -6
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +6 -6
- package/internals/hooks/useNullableFieldPrivateContext.d.mts +3 -2
- package/internals/hooks/useNullableFieldPrivateContext.d.ts +3 -2
- package/internals/hooks/usePicker/usePicker.js +13 -10
- package/internals/hooks/usePicker/usePicker.mjs +13 -10
- package/internals/hooks/usePicker/usePicker.types.d.mts +2 -1
- package/internals/hooks/usePicker/usePicker.types.d.ts +2 -1
- package/{PickersDay → internals/hooks}/usePickerDayOwnerState.d.mts +2 -3
- package/{PickersDay → internals/hooks}/usePickerDayOwnerState.d.ts +2 -3
- package/{PickersDay → internals/hooks}/usePickerDayOwnerState.js +3 -5
- package/{PickersDay → internals/hooks}/usePickerDayOwnerState.mjs +3 -5
- package/internals/index.d.mts +5 -4
- package/internals/index.d.ts +5 -4
- package/internals/index.js +16 -9
- package/internals/index.mjs +4 -3
- package/internals/models/manager.d.mts +3 -5
- package/internals/models/manager.d.ts +3 -5
- package/internals/utils/isElementInteractive.d.mts +1 -0
- package/internals/utils/isElementInteractive.d.ts +1 -0
- package/internals/utils/isElementInteractive.js +34 -0
- package/internals/utils/isElementInteractive.mjs +28 -0
- package/internals/utils/valueManagers.js +1 -2
- package/internals/utils/valueManagers.mjs +2 -3
- package/managers/index.d.mts +2 -2
- package/managers/index.d.ts +2 -2
- package/managers/useDateManager.d.mts +3 -6
- package/managers/useDateManager.d.ts +3 -6
- package/managers/useDateManager.js +2 -6
- package/managers/useDateManager.mjs +2 -6
- package/managers/useDateTimeManager.d.mts +3 -6
- package/managers/useDateTimeManager.d.ts +3 -6
- package/managers/useDateTimeManager.js +2 -6
- package/managers/useDateTimeManager.mjs +2 -6
- package/managers/useTimeManager.d.mts +4 -6
- package/managers/useTimeManager.d.ts +4 -6
- package/managers/useTimeManager.js +1 -3
- package/managers/useTimeManager.mjs +1 -3
- package/models/fields.d.mts +7 -4
- package/models/fields.d.ts +7 -4
- package/models/manager.d.mts +2 -8
- package/models/manager.d.ts +2 -8
- package/package.json +12 -26
- package/themeAugmentation/components.d.mts +4 -8
- package/themeAugmentation/components.d.ts +4 -8
- package/themeAugmentation/overrides.d.mts +2 -4
- package/themeAugmentation/overrides.d.ts +2 -4
- package/themeAugmentation/props.d.mts +5 -7
- package/themeAugmentation/props.d.ts +5 -7
- package/PickerDay2/PickerDay2.d.mts +0 -7
- package/PickerDay2/PickerDay2.d.ts +0 -7
- package/PickerDay2/PickerDay2.types.d.mts +0 -18
- package/PickerDay2/PickerDay2.types.d.ts +0 -18
- package/PickerDay2/index.d.mts +0 -4
- package/PickerDay2/index.d.ts +0 -4
- package/PickerDay2/index.js +0 -25
- package/PickerDay2/index.mjs +0 -2
- package/PickerDay2/pickerDay2Classes.js +0 -14
- package/PickerDay2/pickerDay2Classes.mjs +0 -6
- package/PickersDay/PickersDay.d.mts +0 -15
- package/PickersDay/PickersDay.d.ts +0 -15
- package/PickersDay/PickersDay.js +0 -384
- package/PickersDay/PickersDay.mjs +0 -377
- package/PickersDay/PickersDay.types.d.mts +0 -114
- package/PickersDay/PickersDay.types.d.ts +0 -114
- package/PickersDay/index.d.mts +0 -4
- package/PickersDay/index.d.ts +0 -4
- package/PickersDay/index.js +0 -25
- package/PickersDay/index.mjs +0 -2
- package/PickersDay/pickersDayClasses.d.mts +0 -19
- package/PickersDay/pickersDayClasses.d.ts +0 -19
- package/PickersDay/pickersDayClasses.js +0 -14
- package/PickersDay/pickersDayClasses.mjs +0 -6
- package/internals/hooks/useField/useFieldRootHandleKeyDown.d.mts +0 -16
- package/internals/hooks/useField/useFieldRootHandleKeyDown.d.ts +0 -16
- package/internals/hooks/useField/useFieldRootHandleKeyDown.js +0 -211
- package/internals/hooks/useField/useFieldRootHandleKeyDown.mjs +0 -205
- package/internals/hooks/useField/useFieldV6TextField.d.mts +0 -26
- package/internals/hooks/useField/useFieldV6TextField.d.ts +0 -26
- package/internals/hooks/useField/useFieldV6TextField.js +0 -421
- package/internals/hooks/useField/useFieldV6TextField.mjs +0 -412
- package/internals/hooks/useField/useFieldV7TextField.d.mts +0 -3
- package/internals/hooks/useField/useFieldV7TextField.d.ts +0 -3
- package/internals/hooks/useField/useFieldV7TextField.js +0 -271
- package/internals/hooks/useField/useFieldV7TextField.mjs +0 -263
- /package/{PickerDay2/PickerDay2.types.js → PickerDay/PickerDay.types.js} +0 -0
- /package/{PickerDay2/PickerDay2.types.mjs → PickerDay/PickerDay.types.mjs} +0 -0
- /package/{PickersDay/PickersDay.types.js → internals/hooks/PickerDay.types.js} +0 -0
- /package/{PickersDay/PickersDay.types.mjs → internals/hooks/PickerDay.types.mjs} +0 -0
|
@@ -17,6 +17,7 @@ var _MenuList = _interopRequireDefault(require("@mui/material/MenuList"));
|
|
|
17
17
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
18
18
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
19
19
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
20
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
20
21
|
var _multiSectionDigitalClockSectionClasses = require("./multiSectionDigitalClockSectionClasses");
|
|
21
22
|
var _dimensions = require("../internals/constants/dimensions");
|
|
22
23
|
var _utils = require("../internals/utils/utils");
|
|
@@ -80,7 +81,7 @@ const MultiSectionDigitalClockSectionItem = (0, _styles.styled)(_MenuItem.defaul
|
|
|
80
81
|
marginTop: 4
|
|
81
82
|
},
|
|
82
83
|
'&:hover': {
|
|
83
|
-
backgroundColor: theme.
|
|
84
|
+
backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, (theme.vars || theme).palette.action.hoverOpacity)
|
|
84
85
|
},
|
|
85
86
|
'&.Mui-selected': {
|
|
86
87
|
backgroundColor: (theme.vars || theme).palette.primary.main,
|
|
@@ -90,7 +91,7 @@ const MultiSectionDigitalClockSectionItem = (0, _styles.styled)(_MenuItem.defaul
|
|
|
90
91
|
}
|
|
91
92
|
},
|
|
92
93
|
'&.Mui-focusVisible': {
|
|
93
|
-
backgroundColor: theme.
|
|
94
|
+
backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, (theme.vars || theme).palette.action.focusOpacity)
|
|
94
95
|
}
|
|
95
96
|
}));
|
|
96
97
|
/**
|
|
@@ -100,6 +101,7 @@ const MultiSectionDigitalClockSection = exports.MultiSectionDigitalClockSection
|
|
|
100
101
|
const containerRef = React.useRef(null);
|
|
101
102
|
const handleRef = (0, _useForkRef.default)(ref, containerRef);
|
|
102
103
|
const previousActive = React.useRef(null);
|
|
104
|
+
const shouldRefocusOnNextRender = React.useRef(false);
|
|
103
105
|
const props = (0, _styles.useThemeProps)({
|
|
104
106
|
props: inProps,
|
|
105
107
|
name: 'MuiMultiSectionDigitalClockSection'
|
|
@@ -131,13 +133,21 @@ const MultiSectionDigitalClockSection = exports.MultiSectionDigitalClockSection
|
|
|
131
133
|
return;
|
|
132
134
|
}
|
|
133
135
|
const activeItem = containerRef.current.querySelector('[role="option"][tabindex="0"], [role="option"][aria-selected="true"]');
|
|
134
|
-
if (
|
|
136
|
+
if (!activeItem) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const activeElement = document.activeElement;
|
|
140
|
+
const isSameItemAsPrevious = previousActive.current === activeItem;
|
|
141
|
+
const isFocusInsideSection = !!activeElement && containerRef.current.contains(activeElement);
|
|
142
|
+
const shouldRefocusSameItem = isSameItemAsPrevious && shouldRefocusOnNextRender.current;
|
|
143
|
+
if (active && autoFocus && (!isSameItemAsPrevious || shouldRefocusSameItem) && (previousActive.current == null || shouldRefocusOnNextRender.current || isFocusInsideSection)) {
|
|
144
|
+
previousActive.current = activeItem;
|
|
145
|
+
shouldRefocusOnNextRender.current = false;
|
|
135
146
|
activeItem.focus();
|
|
136
147
|
}
|
|
137
|
-
if (
|
|
148
|
+
if (isSameItemAsPrevious) {
|
|
138
149
|
return;
|
|
139
150
|
}
|
|
140
|
-
previousActive.current = activeItem;
|
|
141
151
|
const offsetTop = activeItem.offsetTop;
|
|
142
152
|
const itemHeight = activeItem.offsetHeight;
|
|
143
153
|
const containerHeight = containerRef.current.clientHeight;
|
|
@@ -155,9 +165,35 @@ const MultiSectionDigitalClockSection = exports.MultiSectionDigitalClockSection
|
|
|
155
165
|
// Ensure we don't scroll past the top
|
|
156
166
|
containerRef.current.scrollTop = Math.max(0, scrollPosition);
|
|
157
167
|
});
|
|
168
|
+
const handleBlur = (0, _useEventCallback.default)(event => {
|
|
169
|
+
// Keep focus restoration only for in-picker keyboard navigation.
|
|
170
|
+
// Do not restore focus after leaving the picker, which would steal focus from external inputs.
|
|
171
|
+
const relatedTarget = event.relatedTarget;
|
|
172
|
+
const blurParent = relatedTarget?.parentElement;
|
|
173
|
+
const relatedTargetRole = relatedTarget?.getAttribute('role');
|
|
174
|
+
const shouldRefocus = blurParent?.nodeName === 'UL' && blurParent !== containerRef.current || relatedTargetRole === 'gridcell';
|
|
175
|
+
shouldRefocusOnNextRender.current = shouldRefocus;
|
|
176
|
+
if (previousActive.current && blurParent?.nodeName === 'UL' && blurParent !== containerRef.current) {
|
|
177
|
+
previousActive.current = null;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Reset tracking when section becomes inactive
|
|
182
|
+
// so focus can be reapplied when user returns via keyboard
|
|
183
|
+
React.useEffect(() => {
|
|
184
|
+
if (!active) {
|
|
185
|
+
previousActive.current = null;
|
|
186
|
+
}
|
|
187
|
+
}, [active]);
|
|
158
188
|
const focusedOptionIndex = items.findIndex(item => item.isFocused(item.value));
|
|
159
|
-
const handleKeyDown = event => {
|
|
189
|
+
const handleKeyDown = (0, _useEventCallback.default)(event => {
|
|
160
190
|
switch (event.key) {
|
|
191
|
+
case 'Tab':
|
|
192
|
+
{
|
|
193
|
+
// Preserve focus restoration when leaving the section with keyboard navigation.
|
|
194
|
+
shouldRefocusOnNextRender.current = true;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
161
197
|
case 'PageUp':
|
|
162
198
|
{
|
|
163
199
|
const newIndex = (0, _utils.getFocusedListItemIndex)(containerRef.current) - 5;
|
|
@@ -183,15 +219,16 @@ const MultiSectionDigitalClockSection = exports.MultiSectionDigitalClockSection
|
|
|
183
219
|
break;
|
|
184
220
|
}
|
|
185
221
|
default:
|
|
222
|
+
break;
|
|
186
223
|
}
|
|
187
|
-
};
|
|
224
|
+
});
|
|
188
225
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MultiSectionDigitalClockSectionRoot, (0, _extends2.default)({
|
|
189
226
|
ref: handleRef,
|
|
190
227
|
className: (0, _clsx.default)(classes.root, className),
|
|
191
228
|
ownerState: ownerState,
|
|
192
|
-
autoFocusItem: autoFocus && active,
|
|
193
229
|
role: "listbox",
|
|
194
|
-
onKeyDown: handleKeyDown
|
|
230
|
+
onKeyDown: handleKeyDown,
|
|
231
|
+
onBlur: handleBlur
|
|
195
232
|
}, other, {
|
|
196
233
|
children: items.map((option, index) => {
|
|
197
234
|
const isItemDisabled = option.isDisabled?.(option.value);
|
|
@@ -5,12 +5,13 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["autoFocus", "onChange", "className", "classes", "disabled", "readOnly", "items", "active", "slots", "slotProps", "skipDisabled"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
|
-
import {
|
|
8
|
+
import { styled, useThemeProps } from '@mui/material/styles';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import MenuList from '@mui/material/MenuList';
|
|
11
11
|
import MenuItem from '@mui/material/MenuItem';
|
|
12
12
|
import useForkRef from '@mui/utils/useForkRef';
|
|
13
13
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
14
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
14
15
|
import { getMultiSectionDigitalClockSectionUtilityClass } from "./multiSectionDigitalClockSectionClasses.mjs";
|
|
15
16
|
import { DIGITAL_CLOCK_VIEW_HEIGHT, MULTI_SECTION_CLOCK_SECTION_WIDTH } from "../internals/constants/dimensions.mjs";
|
|
16
17
|
import { getFocusedListItemIndex } from "../internals/utils/utils.mjs";
|
|
@@ -73,7 +74,7 @@ const MultiSectionDigitalClockSectionItem = styled(MenuItem, {
|
|
|
73
74
|
marginTop: 4
|
|
74
75
|
},
|
|
75
76
|
'&:hover': {
|
|
76
|
-
backgroundColor: theme.
|
|
77
|
+
backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, (theme.vars || theme).palette.action.hoverOpacity)
|
|
77
78
|
},
|
|
78
79
|
'&.Mui-selected': {
|
|
79
80
|
backgroundColor: (theme.vars || theme).palette.primary.main,
|
|
@@ -83,7 +84,7 @@ const MultiSectionDigitalClockSectionItem = styled(MenuItem, {
|
|
|
83
84
|
}
|
|
84
85
|
},
|
|
85
86
|
'&.Mui-focusVisible': {
|
|
86
|
-
backgroundColor: theme.
|
|
87
|
+
backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, (theme.vars || theme).palette.action.focusOpacity)
|
|
87
88
|
}
|
|
88
89
|
}));
|
|
89
90
|
/**
|
|
@@ -93,6 +94,7 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
93
94
|
const containerRef = React.useRef(null);
|
|
94
95
|
const handleRef = useForkRef(ref, containerRef);
|
|
95
96
|
const previousActive = React.useRef(null);
|
|
97
|
+
const shouldRefocusOnNextRender = React.useRef(false);
|
|
96
98
|
const props = useThemeProps({
|
|
97
99
|
props: inProps,
|
|
98
100
|
name: 'MuiMultiSectionDigitalClockSection'
|
|
@@ -124,13 +126,21 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
124
126
|
return;
|
|
125
127
|
}
|
|
126
128
|
const activeItem = containerRef.current.querySelector('[role="option"][tabindex="0"], [role="option"][aria-selected="true"]');
|
|
127
|
-
if (
|
|
129
|
+
if (!activeItem) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const activeElement = document.activeElement;
|
|
133
|
+
const isSameItemAsPrevious = previousActive.current === activeItem;
|
|
134
|
+
const isFocusInsideSection = !!activeElement && containerRef.current.contains(activeElement);
|
|
135
|
+
const shouldRefocusSameItem = isSameItemAsPrevious && shouldRefocusOnNextRender.current;
|
|
136
|
+
if (active && autoFocus && (!isSameItemAsPrevious || shouldRefocusSameItem) && (previousActive.current == null || shouldRefocusOnNextRender.current || isFocusInsideSection)) {
|
|
137
|
+
previousActive.current = activeItem;
|
|
138
|
+
shouldRefocusOnNextRender.current = false;
|
|
128
139
|
activeItem.focus();
|
|
129
140
|
}
|
|
130
|
-
if (
|
|
141
|
+
if (isSameItemAsPrevious) {
|
|
131
142
|
return;
|
|
132
143
|
}
|
|
133
|
-
previousActive.current = activeItem;
|
|
134
144
|
const offsetTop = activeItem.offsetTop;
|
|
135
145
|
const itemHeight = activeItem.offsetHeight;
|
|
136
146
|
const containerHeight = containerRef.current.clientHeight;
|
|
@@ -148,9 +158,35 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
148
158
|
// Ensure we don't scroll past the top
|
|
149
159
|
containerRef.current.scrollTop = Math.max(0, scrollPosition);
|
|
150
160
|
});
|
|
161
|
+
const handleBlur = useEventCallback(event => {
|
|
162
|
+
// Keep focus restoration only for in-picker keyboard navigation.
|
|
163
|
+
// Do not restore focus after leaving the picker, which would steal focus from external inputs.
|
|
164
|
+
const relatedTarget = event.relatedTarget;
|
|
165
|
+
const blurParent = relatedTarget?.parentElement;
|
|
166
|
+
const relatedTargetRole = relatedTarget?.getAttribute('role');
|
|
167
|
+
const shouldRefocus = blurParent?.nodeName === 'UL' && blurParent !== containerRef.current || relatedTargetRole === 'gridcell';
|
|
168
|
+
shouldRefocusOnNextRender.current = shouldRefocus;
|
|
169
|
+
if (previousActive.current && blurParent?.nodeName === 'UL' && blurParent !== containerRef.current) {
|
|
170
|
+
previousActive.current = null;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Reset tracking when section becomes inactive
|
|
175
|
+
// so focus can be reapplied when user returns via keyboard
|
|
176
|
+
React.useEffect(() => {
|
|
177
|
+
if (!active) {
|
|
178
|
+
previousActive.current = null;
|
|
179
|
+
}
|
|
180
|
+
}, [active]);
|
|
151
181
|
const focusedOptionIndex = items.findIndex(item => item.isFocused(item.value));
|
|
152
|
-
const handleKeyDown = event => {
|
|
182
|
+
const handleKeyDown = useEventCallback(event => {
|
|
153
183
|
switch (event.key) {
|
|
184
|
+
case 'Tab':
|
|
185
|
+
{
|
|
186
|
+
// Preserve focus restoration when leaving the section with keyboard navigation.
|
|
187
|
+
shouldRefocusOnNextRender.current = true;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
154
190
|
case 'PageUp':
|
|
155
191
|
{
|
|
156
192
|
const newIndex = getFocusedListItemIndex(containerRef.current) - 5;
|
|
@@ -176,15 +212,16 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
176
212
|
break;
|
|
177
213
|
}
|
|
178
214
|
default:
|
|
215
|
+
break;
|
|
179
216
|
}
|
|
180
|
-
};
|
|
217
|
+
});
|
|
181
218
|
return /*#__PURE__*/_jsx(MultiSectionDigitalClockSectionRoot, _extends({
|
|
182
219
|
ref: handleRef,
|
|
183
220
|
className: clsx(classes.root, className),
|
|
184
221
|
ownerState: ownerState,
|
|
185
|
-
autoFocusItem: autoFocus && active,
|
|
186
222
|
role: "listbox",
|
|
187
|
-
onKeyDown: handleKeyDown
|
|
223
|
+
onKeyDown: handleKeyDown,
|
|
224
|
+
onBlur: handleBlur
|
|
188
225
|
}, other, {
|
|
189
226
|
children: items.map((option, index) => {
|
|
190
227
|
const isItemDisabled = option.isDisabled?.(option.value);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PickerDayProps } from "./PickerDay.types.mjs";
|
|
3
|
+
type PickerDayComponent = ((props: PickerDayProps & React.RefAttributes<HTMLButtonElement>) => React.JSX.Element) & {
|
|
4
|
+
propTypes?: any;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Demos:
|
|
8
|
+
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
|
9
|
+
*
|
|
10
|
+
* API:
|
|
11
|
+
* - [PickerDay API](https://mui.com/x/api/date-pickers/picker-day/)
|
|
12
|
+
*/
|
|
13
|
+
export declare const PickerDay: PickerDayComponent;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PickerDayProps } from "./PickerDay.types.js";
|
|
3
|
+
type PickerDayComponent = ((props: PickerDayProps & React.RefAttributes<HTMLButtonElement>) => React.JSX.Element) & {
|
|
4
|
+
propTypes?: any;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Demos:
|
|
8
|
+
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
|
9
|
+
*
|
|
10
|
+
* API:
|
|
11
|
+
* - [PickerDay API](https://mui.com/x/api/date-pickers/picker-day/)
|
|
12
|
+
*/
|
|
13
|
+
export declare const PickerDay: PickerDayComponent;
|
|
14
|
+
export {};
|
|
@@ -6,7 +6,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.
|
|
9
|
+
exports.PickerDay = void 0;
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
@@ -18,11 +18,11 @@ var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
|
18
18
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
19
19
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
20
20
|
var _dimensions = require("../internals/constants/dimensions");
|
|
21
|
-
var
|
|
21
|
+
var _pickerDayClasses = require("./pickerDayClasses");
|
|
22
22
|
var _usePickerAdapter = require("../hooks/usePickerAdapter");
|
|
23
|
-
var _usePickerDayOwnerState = require("../
|
|
23
|
+
var _usePickerDayOwnerState = require("../internals/hooks/usePickerDayOwnerState");
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
-
const _excluded = ["autoFocus", "className", "classes", "hidden", "isAnimating", "onClick", "onDaySelect", "onFocus", "onBlur", "onKeyDown", "onMouseDown", "onMouseEnter", "children", "isFirstVisibleCell", "isLastVisibleCell", "day", "selected", "disabled", "today", "outsideCurrentMonth", "
|
|
25
|
+
const _excluded = ["autoFocus", "className", "classes", "hidden", "isAnimating", "onClick", "onDaySelect", "onFocus", "onBlur", "onKeyDown", "onMouseDown", "onMouseEnter", "children", "isFirstVisibleCell", "isLastVisibleCell", "day", "selected", "disabled", "today", "outsideCurrentMonth", "disableHighlightToday", "showDaysOutsideCurrentMonth", "isVisuallySelected", "isDayFillerCell"];
|
|
26
26
|
const useUtilityClasses = (ownerState, classes) => {
|
|
27
27
|
const {
|
|
28
28
|
isDaySelected,
|
|
@@ -35,16 +35,16 @@ const useUtilityClasses = (ownerState, classes) => {
|
|
|
35
35
|
const slots = {
|
|
36
36
|
root: ['root', isDaySelected && !isDayFillerCell && 'selected', isDayDisabled && 'disabled', !disableHighlightToday && isDayCurrent && !isDaySelected && !isDayFillerCell && 'today', isDayOutsideMonth && 'dayOutsideMonth', isDayFillerCell && 'fillerCell']
|
|
37
37
|
};
|
|
38
|
-
return (0, _composeClasses.default)(slots,
|
|
38
|
+
return (0, _composeClasses.default)(slots, _pickerDayClasses.getPickerDayUtilityClass, classes);
|
|
39
39
|
};
|
|
40
|
-
const
|
|
41
|
-
name: '
|
|
40
|
+
const PickerDayRoot = (0, _styles.styled)(_ButtonBase.default, {
|
|
41
|
+
name: 'MuiPickerDay',
|
|
42
42
|
slot: 'Root',
|
|
43
43
|
overridesResolver: (props, styles) => {
|
|
44
44
|
const {
|
|
45
45
|
ownerState
|
|
46
46
|
} = props;
|
|
47
|
-
return [styles.root, !ownerState.disableHighlightToday && ownerState.isDayCurrent && styles.today,
|
|
47
|
+
return [styles.root, !ownerState.disableHighlightToday && ownerState.isDayCurrent && styles.today, ownerState.isDayOutsideMonth && styles.dayOutsideMonth, ownerState.isDayFillerCell && styles.fillerCell];
|
|
48
48
|
}
|
|
49
49
|
})(({
|
|
50
50
|
theme
|
|
@@ -52,6 +52,8 @@ const PickerDay2Root = (0, _styles.styled)(_ButtonBase.default, {
|
|
|
52
52
|
'--PickerDay-horizontalMargin': `${_dimensions.DAY_MARGIN}px`,
|
|
53
53
|
'--PickerDay-size': `${_dimensions.DAY_SIZE}px`
|
|
54
54
|
}, theme.typography.caption, {
|
|
55
|
+
lineHeight: 1,
|
|
56
|
+
display: 'flex',
|
|
55
57
|
width: 'var(--PickerDay-size)',
|
|
56
58
|
height: 'var(--PickerDay-size)',
|
|
57
59
|
borderRadius: 'calc(var(--PickerDay-size) / 2)',
|
|
@@ -64,11 +66,11 @@ const PickerDay2Root = (0, _styles.styled)(_ButtonBase.default, {
|
|
|
64
66
|
color: (theme.vars || theme).palette.text.primary,
|
|
65
67
|
'@media (pointer: fine)': {
|
|
66
68
|
'&:hover': {
|
|
67
|
-
backgroundColor: theme.
|
|
69
|
+
backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, (theme.vars || theme).palette.action.hoverOpacity)
|
|
68
70
|
}
|
|
69
71
|
},
|
|
70
72
|
'&:focus': {
|
|
71
|
-
backgroundColor: theme.
|
|
73
|
+
backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, (theme.vars || theme).palette.action.focusOpacity)
|
|
72
74
|
},
|
|
73
75
|
marginLeft: 'var(--PickerDay-horizontalMargin)',
|
|
74
76
|
marginRight: 'var(--PickerDay-horizontalMargin)',
|
|
@@ -84,7 +86,7 @@ const PickerDay2Root = (0, _styles.styled)(_ButtonBase.default, {
|
|
|
84
86
|
willChange: 'background-color',
|
|
85
87
|
backgroundColor: (theme.vars || theme).palette.primary.dark
|
|
86
88
|
},
|
|
87
|
-
[`&.${
|
|
89
|
+
[`&.${_pickerDayClasses.pickerDayClasses.disabled}`]: {
|
|
88
90
|
opacity: 0.6
|
|
89
91
|
}
|
|
90
92
|
}
|
|
@@ -124,10 +126,10 @@ const PickerDay2Root = (0, _styles.styled)(_ButtonBase.default, {
|
|
|
124
126
|
}]
|
|
125
127
|
}));
|
|
126
128
|
const noop = () => {};
|
|
127
|
-
const
|
|
129
|
+
const PickerDayRaw = /*#__PURE__*/React.forwardRef(function PickerDay(inProps, forwardedRef) {
|
|
128
130
|
const props = (0, _styles.useThemeProps)({
|
|
129
131
|
props: inProps,
|
|
130
|
-
name: '
|
|
132
|
+
name: 'MuiPickerDay'
|
|
131
133
|
});
|
|
132
134
|
const adapter = (0, _usePickerAdapter.usePickerAdapter)();
|
|
133
135
|
const {
|
|
@@ -148,24 +150,23 @@ const PickerDay2Raw = /*#__PURE__*/React.forwardRef(function PickerDay2(inProps,
|
|
|
148
150
|
disabled,
|
|
149
151
|
today,
|
|
150
152
|
outsideCurrentMonth,
|
|
151
|
-
disableMargin,
|
|
152
153
|
disableHighlightToday,
|
|
153
|
-
showDaysOutsideCurrentMonth
|
|
154
|
+
showDaysOutsideCurrentMonth,
|
|
155
|
+
isDayFillerCell: isDayFillerCellProp
|
|
154
156
|
} = props,
|
|
155
157
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
156
|
-
const
|
|
158
|
+
const pickerDayOwnerState = (0, _usePickerDayOwnerState.usePickerDayOwnerState)({
|
|
157
159
|
day,
|
|
158
160
|
selected,
|
|
159
161
|
disabled,
|
|
160
162
|
today,
|
|
161
163
|
outsideCurrentMonth,
|
|
162
|
-
disableMargin,
|
|
163
164
|
disableHighlightToday,
|
|
164
165
|
showDaysOutsideCurrentMonth
|
|
165
166
|
});
|
|
166
|
-
const ownerState = (0, _extends2.default)({},
|
|
167
|
+
const ownerState = (0, _extends2.default)({}, pickerDayOwnerState, {
|
|
167
168
|
// Properties specific to the MUI implementation (some might be removed in the next major)
|
|
168
|
-
isDayFillerCell: outsideCurrentMonth && !showDaysOutsideCurrentMonth
|
|
169
|
+
isDayFillerCell: isDayFillerCellProp ?? (outsideCurrentMonth && !showDaysOutsideCurrentMonth)
|
|
169
170
|
});
|
|
170
171
|
const classes = useUtilityClasses(ownerState, classesProp);
|
|
171
172
|
const ref = React.useRef(null);
|
|
@@ -200,12 +201,18 @@ const PickerDay2Raw = /*#__PURE__*/React.forwardRef(function PickerDay2(inProps,
|
|
|
200
201
|
onClick(event);
|
|
201
202
|
}
|
|
202
203
|
};
|
|
203
|
-
|
|
204
|
+
if (ownerState.isDayFillerCell) {
|
|
205
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickerDayRoot, {
|
|
206
|
+
ref: handleRef,
|
|
207
|
+
role: other.role,
|
|
208
|
+
ownerState: ownerState,
|
|
209
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
210
|
+
as: "div"
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickerDayRoot, (0, _extends2.default)({
|
|
204
214
|
ref: handleRef,
|
|
205
|
-
centerRipple: true
|
|
206
|
-
// compat with PickersDay for tests
|
|
207
|
-
,
|
|
208
|
-
|
|
215
|
+
centerRipple: true,
|
|
209
216
|
disabled: disabled,
|
|
210
217
|
tabIndex: selected ? 0 : -1,
|
|
211
218
|
onKeyDown: event => onKeyDown(event, day),
|
|
@@ -217,11 +224,11 @@ const PickerDay2Raw = /*#__PURE__*/React.forwardRef(function PickerDay2(inProps,
|
|
|
217
224
|
}, other, {
|
|
218
225
|
ownerState: ownerState,
|
|
219
226
|
className: (0, _clsx.default)(classes.root, className),
|
|
220
|
-
children: children ??
|
|
227
|
+
children: children ?? adapter.format(day, 'dayOfMonth')
|
|
221
228
|
}));
|
|
222
229
|
});
|
|
223
|
-
if (process.env.NODE_ENV !== "production")
|
|
224
|
-
process.env.NODE_ENV !== "production" ?
|
|
230
|
+
if (process.env.NODE_ENV !== "production") PickerDayRaw.displayName = "PickerDayRaw";
|
|
231
|
+
process.env.NODE_ENV !== "production" ? PickerDayRaw.propTypes = {
|
|
225
232
|
// ----------------------------- Warning --------------------------------
|
|
226
233
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
227
234
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
@@ -252,20 +259,15 @@ process.env.NODE_ENV !== "production" ? PickerDay2Raw.propTypes = {
|
|
|
252
259
|
*/
|
|
253
260
|
day: _propTypes.default.object.isRequired,
|
|
254
261
|
/**
|
|
255
|
-
* If `true`,
|
|
262
|
+
* If `true`, the day is disabled.
|
|
256
263
|
* @default false
|
|
257
264
|
*/
|
|
258
265
|
disabled: _propTypes.default.bool,
|
|
259
266
|
/**
|
|
260
|
-
* If `true`, today's
|
|
267
|
+
* If `true`, today's day is not highlighted.
|
|
261
268
|
* @default false
|
|
262
269
|
*/
|
|
263
270
|
disableHighlightToday: _propTypes.default.bool,
|
|
264
|
-
/**
|
|
265
|
-
* If `true`, days are rendering without margin. Useful for displaying linked range of days.
|
|
266
|
-
* @default false
|
|
267
|
-
*/
|
|
268
|
-
disableMargin: _propTypes.default.bool,
|
|
269
271
|
/**
|
|
270
272
|
* If `true`, the ripple effect is disabled.
|
|
271
273
|
*
|
|
@@ -293,35 +295,90 @@ process.env.NODE_ENV !== "production" ? PickerDay2Raw.propTypes = {
|
|
|
293
295
|
* if needed.
|
|
294
296
|
*/
|
|
295
297
|
focusVisibleClassName: _propTypes.default.string,
|
|
298
|
+
/**
|
|
299
|
+
* If `true`, the day is being animated.
|
|
300
|
+
* @default false
|
|
301
|
+
*/
|
|
296
302
|
isAnimating: _propTypes.default.bool,
|
|
297
303
|
/**
|
|
298
|
-
* If `true`, day is
|
|
299
|
-
*
|
|
304
|
+
* If `true`, the day is a filler day (its content is hidden).
|
|
305
|
+
* @default false
|
|
306
|
+
*/
|
|
307
|
+
isDayFillerCell: _propTypes.default.bool,
|
|
308
|
+
/**
|
|
309
|
+
* If `true`, the day is the first visible cell of the month.
|
|
310
|
+
* @default false
|
|
300
311
|
*/
|
|
301
|
-
isFirstVisibleCell: _propTypes.default.bool
|
|
312
|
+
isFirstVisibleCell: _propTypes.default.bool,
|
|
302
313
|
/**
|
|
303
|
-
* If `true`, day is the last visible cell of the month.
|
|
304
|
-
*
|
|
314
|
+
* If `true`, the day is the last visible cell of the month.
|
|
315
|
+
* @default false
|
|
305
316
|
*/
|
|
306
|
-
isLastVisibleCell: _propTypes.default.bool
|
|
317
|
+
isLastVisibleCell: _propTypes.default.bool,
|
|
307
318
|
/**
|
|
308
319
|
* Indicates if the day should be visually selected.
|
|
309
320
|
*/
|
|
310
321
|
isVisuallySelected: _propTypes.default.bool,
|
|
322
|
+
/**
|
|
323
|
+
* Whether the custom component is expected to render a native `<button>` element
|
|
324
|
+
* when passing a React component to the `component` or `slots` prop.
|
|
325
|
+
*/
|
|
326
|
+
nativeButton: _propTypes.default.bool,
|
|
327
|
+
/**
|
|
328
|
+
* Callback fired when the component is blurred.
|
|
329
|
+
* @param {React.FocusEvent<HTMLButtonElement>} event The event object.
|
|
330
|
+
* @param {PickerValidDate} day The day.
|
|
331
|
+
* @default () => {}
|
|
332
|
+
*/
|
|
311
333
|
onBlur: _propTypes.default.func,
|
|
334
|
+
/**
|
|
335
|
+
* Callback fired when the component is clicked.
|
|
336
|
+
* @param {MuiEvent<React.MouseEvent<HTMLButtonElement>>} event The event object.
|
|
337
|
+
* @default () => {}
|
|
338
|
+
*/
|
|
339
|
+
onClick: _propTypes.default.func,
|
|
340
|
+
/**
|
|
341
|
+
* Callback fired when the day is selected.
|
|
342
|
+
* @param {PickerValidDate} day The day to select.
|
|
343
|
+
*/
|
|
312
344
|
onDaySelect: _propTypes.default.func.isRequired,
|
|
345
|
+
/**
|
|
346
|
+
* Callback fired when the component is focused.
|
|
347
|
+
* @param {React.FocusEvent<HTMLButtonElement>} event The event object.
|
|
348
|
+
* @param {PickerValidDate} day The day.
|
|
349
|
+
* @default () => {}
|
|
350
|
+
*/
|
|
313
351
|
onFocus: _propTypes.default.func,
|
|
314
352
|
/**
|
|
315
353
|
* Callback fired when the component is focused with a keyboard.
|
|
316
354
|
* We trigger a `onFocus` callback too.
|
|
317
355
|
*/
|
|
318
356
|
onFocusVisible: _propTypes.default.func,
|
|
357
|
+
/**
|
|
358
|
+
* Callback fired when a key is pressed.
|
|
359
|
+
* @param {React.KeyboardEvent<HTMLButtonElement>} event The event object.
|
|
360
|
+
* @param {PickerValidDate} day The day.
|
|
361
|
+
* @default () => {}
|
|
362
|
+
*/
|
|
319
363
|
onKeyDown: _propTypes.default.func,
|
|
364
|
+
/**
|
|
365
|
+
* Callback fired when the mouse button is pressed.
|
|
366
|
+
* @param {React.MouseEvent<HTMLButtonElement>} event The event object.
|
|
367
|
+
* @default () => {}
|
|
368
|
+
*/
|
|
369
|
+
onMouseDown: _propTypes.default.func,
|
|
370
|
+
/**
|
|
371
|
+
* Callback fired when the mouse enters the component.
|
|
372
|
+
* @param {React.MouseEvent<HTMLButtonElement>} event The event object.
|
|
373
|
+
* @param {PickerValidDate} day The day.
|
|
374
|
+
* @default () => {}
|
|
375
|
+
*/
|
|
320
376
|
onMouseEnter: _propTypes.default.func,
|
|
321
377
|
/**
|
|
322
|
-
* If `true`, day is outside
|
|
378
|
+
* If `true`, the day is outside the current month.
|
|
379
|
+
* @default false
|
|
323
380
|
*/
|
|
324
|
-
outsideCurrentMonth: _propTypes.default.bool
|
|
381
|
+
outsideCurrentMonth: _propTypes.default.bool,
|
|
325
382
|
/**
|
|
326
383
|
* If `true`, renders as selected.
|
|
327
384
|
* @default false
|
|
@@ -348,7 +405,7 @@ process.env.NODE_ENV !== "production" ? PickerDay2Raw.propTypes = {
|
|
|
348
405
|
*/
|
|
349
406
|
tabIndex: _propTypes.default.number,
|
|
350
407
|
/**
|
|
351
|
-
* If `true`,
|
|
408
|
+
* If `true`, today's day is highlighted.
|
|
352
409
|
* @default false
|
|
353
410
|
*/
|
|
354
411
|
today: _propTypes.default.bool,
|
|
@@ -367,5 +424,13 @@ process.env.NODE_ENV !== "production" ? PickerDay2Raw.propTypes = {
|
|
|
367
424
|
})
|
|
368
425
|
})])
|
|
369
426
|
} : void 0;
|
|
370
|
-
|
|
371
|
-
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Demos:
|
|
430
|
+
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
|
431
|
+
*
|
|
432
|
+
* API:
|
|
433
|
+
* - [PickerDay API](https://mui.com/x/api/date-pickers/picker-day/)
|
|
434
|
+
*/
|
|
435
|
+
const PickerDay = exports.PickerDay = /*#__PURE__*/React.memo(PickerDayRaw);
|
|
436
|
+
if (process.env.NODE_ENV !== "production") PickerDay.displayName = "PickerDay";
|