@mui/x-date-pickers 8.0.0-alpha.0 → 8.0.0-alpha.2
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/AdapterMoment/AdapterMoment.js +10 -0
- package/CHANGELOG.md +651 -6
- package/DateCalendar/DateCalendar.js +1 -0
- package/DateCalendar/DateCalendar.types.d.ts +2 -1
- package/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/DateCalendar/PickersSlideTransition.js +12 -5
- package/DateCalendar/useCalendarState.d.ts +6 -4
- package/DateField/DateField.js +5 -4
- package/DateField/DateField.types.d.ts +10 -9
- package/DatePicker/DatePicker.types.d.ts +3 -3
- package/DatePicker/DatePickerToolbar.d.ts +3 -2
- package/DatePicker/DatePickerToolbar.js +0 -12
- package/DatePicker/shared.d.ts +6 -5
- package/DateTimeField/DateTimeField.js +5 -4
- package/DateTimeField/DateTimeField.types.d.ts +10 -10
- package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
- package/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/DateTimePicker/DateTimePickerToolbar.d.ts +3 -4
- package/DateTimePicker/DateTimePickerToolbar.js +6 -15
- package/DateTimePicker/shared.d.ts +6 -6
- package/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +2 -1
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -33
- package/DigitalClock/DigitalClock.js +1 -0
- package/MonthCalendar/MonthCalendar.js +1 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +6 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +4 -4
- package/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -4
- package/PickersLayout/PickersLayout.d.ts +7 -5
- package/PickersLayout/PickersLayout.js +22 -39
- package/PickersLayout/PickersLayout.types.d.ts +14 -15
- package/PickersLayout/usePickerLayout.d.ts +5 -4
- package/PickersLayout/usePickerLayout.js +20 -17
- package/PickersShortcuts/PickersShortcuts.d.ts +7 -6
- package/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/PickersTextField/PickersTextField.js +2 -2
- package/README.md +9 -6
- package/TimeClock/Clock.js +1 -0
- package/TimeClock/TimeClock.js +1 -0
- package/TimeField/TimeField.js +5 -4
- package/TimeField/TimeField.types.d.ts +10 -10
- package/TimePicker/TimePicker.types.d.ts +3 -3
- package/TimePicker/TimePickerToolbar.d.ts +2 -3
- package/TimePicker/TimePickerToolbar.js +6 -15
- package/TimePicker/shared.d.ts +6 -6
- package/YearCalendar/YearCalendar.js +1 -0
- package/hooks/useParsedFormat.d.ts +2 -2
- package/hooks/useParsedFormat.js +1 -1
- package/hooks/useSplitFieldProps.d.ts +3 -3
- package/index.js +1 -1
- package/internals/components/PickerProvider.d.ts +26 -0
- package/internals/components/PickerProvider.js +3 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +11 -8
- package/internals/components/PickersToolbar.d.ts +3 -3
- package/internals/components/PickersToolbar.js +2 -4
- package/internals/hooks/useClockReferenceDate.d.ts +2 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -14
- package/internals/hooks/useField/useField.d.ts +3 -3
- package/internals/hooks/useField/useField.types.d.ts +46 -46
- package/internals/hooks/useField/useField.utils.d.ts +4 -3
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +6 -5
- package/internals/hooks/useField/useFieldState.d.ts +9 -8
- package/internals/hooks/useField/useFieldState.js +1 -1
- package/internals/hooks/useField/useFieldV6TextField.d.ts +4 -3
- package/internals/hooks/useField/useFieldV7TextField.js +2 -1
- package/internals/hooks/useFieldOwnerState.d.ts +6 -0
- package/internals/hooks/useFieldOwnerState.js +12 -0
- package/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +11 -11
- package/internals/hooks/usePicker/usePicker.d.ts +3 -3
- package/internals/hooks/usePicker/usePicker.js +10 -19
- package/internals/hooks/usePicker/usePicker.types.d.ts +8 -8
- package/internals/hooks/usePicker/usePickerProvider.d.ts +21 -6
- package/internals/hooks/usePicker/usePickerProvider.js +61 -5
- package/internals/hooks/usePicker/usePickerValue.d.ts +3 -2
- package/internals/hooks/usePicker/usePickerValue.js +18 -7
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +32 -30
- package/internals/hooks/usePicker/usePickerViews.d.ts +11 -10
- package/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -6
- package/internals/hooks/useValueWithTimezone.d.ts +20 -15
- package/internals/hooks/useValueWithTimezone.js +13 -1
- package/internals/hooks/useViews.d.ts +5 -5
- package/internals/index.d.ts +5 -3
- package/internals/index.js +1 -0
- package/internals/models/common.d.ts +2 -1
- package/internals/models/fields.d.ts +6 -1
- package/internals/models/pickers.d.ts +1 -0
- package/internals/models/pickers.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +4 -3
- package/internals/models/props/time.d.ts +2 -1
- package/internals/models/props/toolbar.d.ts +2 -2
- package/internals/models/value.d.ts +9 -0
- package/internals/utils/date-utils.d.ts +3 -3
- package/internals/utils/valueManagers.d.ts +4 -3
- package/locales/nlNL.js +7 -7
- package/models/adapters.d.ts +4 -4
- package/models/common.d.ts +1 -0
- package/models/fields.d.ts +19 -6
- package/models/pickers.d.ts +18 -0
- package/models/validation.d.ts +2 -1
- package/modern/AdapterMoment/AdapterMoment.js +10 -0
- package/modern/DateCalendar/DateCalendar.js +1 -0
- package/modern/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/modern/DateCalendar/PickersSlideTransition.js +12 -5
- package/modern/DateField/DateField.js +5 -4
- package/modern/DatePicker/DatePickerToolbar.js +0 -12
- package/modern/DateTimeField/DateTimeField.js +5 -4
- package/modern/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/modern/DateTimePicker/DateTimePickerToolbar.js +6 -15
- package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -33
- package/modern/DigitalClock/DigitalClock.js +1 -0
- package/modern/MonthCalendar/MonthCalendar.js +1 -0
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/modern/PickersLayout/PickersLayout.js +22 -39
- package/modern/PickersLayout/usePickerLayout.js +20 -17
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/modern/PickersTextField/PickersTextField.js +2 -2
- package/modern/TimeClock/Clock.js +1 -0
- package/modern/TimeClock/TimeClock.js +1 -0
- package/modern/TimeField/TimeField.js +5 -4
- package/modern/TimePicker/TimePickerToolbar.js +6 -15
- package/modern/YearCalendar/YearCalendar.js +1 -0
- package/modern/hooks/useParsedFormat.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerProvider.js +3 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/modern/internals/components/PickersToolbar.js +2 -4
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
- package/modern/internals/hooks/useField/useFieldState.js +1 -1
- package/modern/internals/hooks/useField/useFieldV7TextField.js +2 -1
- package/modern/internals/hooks/useFieldOwnerState.js +12 -0
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
- package/modern/internals/hooks/usePicker/usePicker.js +10 -19
- package/modern/internals/hooks/usePicker/usePickerProvider.js +61 -5
- package/modern/internals/hooks/usePicker/usePickerValue.js +18 -7
- package/modern/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
- package/modern/internals/hooks/useValueWithTimezone.js +13 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/models/pickers.js +1 -0
- package/modern/locales/nlNL.js +7 -7
- package/modern/validation/useValidation.js +1 -1
- package/modern/validation/validateDate.js +8 -0
- package/modern/validation/validateDateTime.js +8 -0
- package/modern/validation/validateTime.js +8 -0
- package/node/AdapterMoment/AdapterMoment.js +10 -0
- package/node/DateCalendar/DateCalendar.js +1 -0
- package/node/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/node/DateCalendar/PickersSlideTransition.js +12 -5
- package/node/DateField/DateField.js +5 -4
- package/node/DatePicker/DatePickerToolbar.js +0 -12
- package/node/DateTimeField/DateTimeField.js +5 -4
- package/node/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/node/DateTimePicker/DateTimePickerToolbar.js +6 -15
- package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -34
- package/node/DigitalClock/DigitalClock.js +1 -0
- package/node/MonthCalendar/MonthCalendar.js +1 -0
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/node/PickersLayout/PickersLayout.js +22 -39
- package/node/PickersLayout/usePickerLayout.js +20 -17
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/node/PickersTextField/PickersTextField.js +2 -2
- package/node/TimeClock/Clock.js +1 -0
- package/node/TimeClock/TimeClock.js +1 -0
- package/node/TimeField/TimeField.js +5 -4
- package/node/TimePicker/TimePickerToolbar.js +6 -15
- package/node/YearCalendar/YearCalendar.js +1 -0
- package/node/hooks/useParsedFormat.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickerProvider.js +3 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/node/internals/components/PickersToolbar.js +2 -4
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
- package/node/internals/hooks/useField/useFieldState.js +1 -1
- package/node/internals/hooks/useField/useFieldV7TextField.js +2 -1
- package/node/internals/hooks/useFieldOwnerState.js +20 -0
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
- package/node/internals/hooks/usePicker/usePicker.js +11 -19
- package/node/internals/hooks/usePicker/usePickerProvider.js +64 -5
- package/node/internals/hooks/usePicker/usePickerValue.js +18 -6
- package/node/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
- package/node/internals/hooks/useValueWithTimezone.js +13 -1
- package/node/internals/index.js +7 -0
- package/node/internals/models/pickers.js +5 -0
- package/node/locales/nlNL.js +7 -7
- package/node/validation/useValidation.js +1 -1
- package/node/validation/validateDate.js +8 -0
- package/node/validation/validateDateTime.js +8 -0
- package/node/validation/validateTime.js +8 -0
- package/package.json +4 -4
- package/themeAugmentation/overrides.d.ts +1 -1
- package/themeAugmentation/props.d.ts +3 -2
- package/validation/useValidation.d.ts +7 -6
- package/validation/useValidation.js +1 -1
- package/validation/validateDate.d.ts +12 -3
- package/validation/validateDate.js +8 -0
- package/validation/validateDateTime.d.ts +12 -4
- package/validation/validateDateTime.js +8 -0
- package/validation/validateTime.d.ts +12 -3
- package/validation/validateTime.js +8 -0
- package/internals/hooks/useIsLandscape.d.ts +0 -4
- package/internals/hooks/useIsLandscape.js +0 -35
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +0 -33
- package/internals/hooks/usePicker/usePickerLayoutProps.js +0 -34
- package/internals/hooks/usePicker/usePickerOwnerState.d.ts +0 -10
- package/internals/hooks/usePicker/usePickerOwnerState.js +0 -16
- package/modern/internals/hooks/useIsLandscape.js +0 -35
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +0 -34
- package/modern/internals/hooks/usePicker/usePickerOwnerState.js +0 -16
- package/node/internals/hooks/useIsLandscape.js +0 -43
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +0 -41
- package/node/internals/hooks/usePicker/usePickerOwnerState.js +0 -23
|
@@ -11,6 +11,7 @@ import { TimeIcon, DateRangeIcon } from "../icons/index.js";
|
|
|
11
11
|
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
12
|
import { getDateTimePickerTabsUtilityClass } from "./dateTimePickerTabsClasses.js";
|
|
13
13
|
import { isDatePickerView } from "../internals/utils/date-utils.js";
|
|
14
|
+
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
const viewToTab = view => {
|
|
16
17
|
if (isDatePickerView(view)) {
|
|
@@ -24,10 +25,7 @@ const tabToView = tab => {
|
|
|
24
25
|
}
|
|
25
26
|
return 'hours';
|
|
26
27
|
};
|
|
27
|
-
const useUtilityClasses =
|
|
28
|
-
const {
|
|
29
|
-
classes
|
|
30
|
-
} = ownerState;
|
|
28
|
+
const useUtilityClasses = classes => {
|
|
31
29
|
const slots = {
|
|
32
30
|
root: ['root']
|
|
33
31
|
};
|
|
@@ -72,10 +70,14 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
72
70
|
view,
|
|
73
71
|
hidden = typeof window === 'undefined' || window.innerHeight < 667,
|
|
74
72
|
className,
|
|
73
|
+
classes: classesProp,
|
|
75
74
|
sx
|
|
76
75
|
} = props;
|
|
77
76
|
const translations = usePickerTranslations();
|
|
78
|
-
const
|
|
77
|
+
const {
|
|
78
|
+
ownerState
|
|
79
|
+
} = usePickerPrivateContext();
|
|
80
|
+
const classes = useUtilityClasses(classesProp);
|
|
79
81
|
const handleChange = (event, value) => {
|
|
80
82
|
onViewChange(tabToView(value));
|
|
81
83
|
};
|
|
@@ -83,7 +85,7 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
83
85
|
return null;
|
|
84
86
|
}
|
|
85
87
|
return /*#__PURE__*/_jsxs(DateTimePickerTabsRoot, {
|
|
86
|
-
ownerState:
|
|
88
|
+
ownerState: ownerState,
|
|
87
89
|
variant: "fullWidth",
|
|
88
90
|
value: viewToTab(view),
|
|
89
91
|
onChange: handleChange,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["ampm", "ampmInClock", "value", "onChange", "view", "isLandscape", "onViewChange", "toolbarFormat", "toolbarPlaceholder", "views", "
|
|
5
|
+
const _excluded = ["ampm", "ampmInClock", "value", "onChange", "view", "isLandscape", "onViewChange", "toolbarFormat", "toolbarPlaceholder", "views", "toolbarVariant", "toolbarTitle", "className"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
@@ -20,6 +20,7 @@ import { MULTI_SECTION_CLOCK_SECTION_WIDTH } from "../internals/constants/dimens
|
|
|
20
20
|
import { formatMeridiem } from "../internals/utils/date-utils.js";
|
|
21
21
|
import { pickersToolbarTextClasses } from "../internals/components/pickersToolbarTextClasses.js";
|
|
22
22
|
import { pickersToolbarClasses } from "../internals/components/pickersToolbarClasses.js";
|
|
23
|
+
import { usePickerContext } from "../hooks/usePickerContext.js";
|
|
23
24
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
25
|
const useUtilityClasses = ownerState => {
|
|
25
26
|
const {
|
|
@@ -226,14 +227,16 @@ function DateTimePickerToolbar(inProps) {
|
|
|
226
227
|
toolbarFormat,
|
|
227
228
|
toolbarPlaceholder = '––',
|
|
228
229
|
views,
|
|
229
|
-
disabled,
|
|
230
|
-
readOnly,
|
|
231
230
|
toolbarVariant = 'mobile',
|
|
232
231
|
toolbarTitle: inToolbarTitle,
|
|
233
232
|
className
|
|
234
233
|
} = props,
|
|
235
234
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
236
235
|
const isRtl = useRtl();
|
|
236
|
+
const {
|
|
237
|
+
disabled,
|
|
238
|
+
readOnly
|
|
239
|
+
} = usePickerContext();
|
|
237
240
|
const ownerState = _extends({}, props, {
|
|
238
241
|
isRtl
|
|
239
242
|
});
|
|
@@ -359,12 +362,6 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
|
|
|
359
362
|
*/
|
|
360
363
|
classes: PropTypes.object,
|
|
361
364
|
className: PropTypes.string,
|
|
362
|
-
/**
|
|
363
|
-
* If `true`, the component is disabled.
|
|
364
|
-
* When disabled, the value cannot be changed and no interaction is possible.
|
|
365
|
-
* @default false
|
|
366
|
-
*/
|
|
367
|
-
disabled: PropTypes.bool,
|
|
368
365
|
/**
|
|
369
366
|
* If `true`, show the toolbar even in desktop mode.
|
|
370
367
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -378,12 +375,6 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
|
|
|
378
375
|
* @param {TView} view The view to open
|
|
379
376
|
*/
|
|
380
377
|
onViewChange: PropTypes.func.isRequired,
|
|
381
|
-
/**
|
|
382
|
-
* If `true`, the component is read-only.
|
|
383
|
-
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
384
|
-
* @default false
|
|
385
|
-
*/
|
|
386
|
-
readOnly: PropTypes.bool,
|
|
387
378
|
/**
|
|
388
379
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
389
380
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["className"];
|
|
5
|
+
const _excluded = ["className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -12,10 +12,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
12
12
|
import { DAY_SIZE, DAY_MARGIN } from "../internals/constants/dimensions.js";
|
|
13
13
|
import { getDayCalendarSkeletonUtilityClass } from "./dayCalendarSkeletonClasses.js";
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
const useUtilityClasses =
|
|
16
|
-
const {
|
|
17
|
-
classes
|
|
18
|
-
} = ownerState;
|
|
15
|
+
const useUtilityClasses = classes => {
|
|
19
16
|
const slots = {
|
|
20
17
|
root: ['root'],
|
|
21
18
|
week: ['week'],
|
|
@@ -45,14 +42,9 @@ const DayCalendarSkeletonDay = styled(Skeleton, {
|
|
|
45
42
|
overridesResolver: (props, styles) => styles.daySkeleton
|
|
46
43
|
})({
|
|
47
44
|
margin: `0 ${DAY_MARGIN}px`,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
style: {
|
|
53
|
-
visibility: 'hidden'
|
|
54
|
-
}
|
|
55
|
-
}]
|
|
45
|
+
'&[data-day-in-month="0"]': {
|
|
46
|
+
visibility: 'hidden'
|
|
47
|
+
}
|
|
56
48
|
});
|
|
57
49
|
const monthMap = [[0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0]];
|
|
58
50
|
|
|
@@ -71,23 +63,22 @@ function DayCalendarSkeleton(inProps) {
|
|
|
71
63
|
name: 'MuiDayCalendarSkeleton'
|
|
72
64
|
});
|
|
73
65
|
const {
|
|
74
|
-
className
|
|
66
|
+
className,
|
|
67
|
+
classes: classesProp
|
|
75
68
|
} = props,
|
|
76
69
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
77
|
-
const classes = useUtilityClasses(
|
|
70
|
+
const classes = useUtilityClasses(classesProp);
|
|
78
71
|
return /*#__PURE__*/_jsx(DayCalendarSkeletonRoot, _extends({
|
|
79
72
|
className: clsx(classes.root, className)
|
|
80
73
|
}, other, {
|
|
81
74
|
children: monthMap.map((week, index) => /*#__PURE__*/_jsx(DayCalendarSkeletonWeek, {
|
|
82
75
|
className: classes.week,
|
|
83
|
-
children: week.map((
|
|
76
|
+
children: week.map((dayInMonth, index2) => /*#__PURE__*/_jsx(DayCalendarSkeletonDay, {
|
|
84
77
|
variant: "circular",
|
|
85
78
|
width: DAY_SIZE,
|
|
86
79
|
height: DAY_SIZE,
|
|
87
80
|
className: classes.daySkeleton,
|
|
88
|
-
|
|
89
|
-
day
|
|
90
|
-
}
|
|
81
|
+
"data-day-in-month": dayInMonth
|
|
91
82
|
}, index2))
|
|
92
83
|
}, index))
|
|
93
84
|
}));
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
|
-
import { useRtl } from '@mui/system/RtlProvider';
|
|
6
4
|
import Divider from '@mui/material/Divider';
|
|
7
5
|
import { PickersLayoutContentWrapper, PickersLayoutRoot, pickersLayoutClasses, usePickerLayout } from "../PickersLayout/index.js";
|
|
6
|
+
import { usePickerContext } from "../hooks/usePickerContext.js";
|
|
8
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
/**
|
|
10
9
|
* @ignore - internal component.
|
|
11
10
|
*/
|
|
12
11
|
const DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function DesktopDateTimePickerLayout(props, ref) {
|
|
13
|
-
const isRtl = useRtl();
|
|
14
12
|
const {
|
|
15
13
|
toolbar,
|
|
16
14
|
tabs,
|
|
17
15
|
content,
|
|
18
16
|
actionBar,
|
|
19
|
-
shortcuts
|
|
17
|
+
shortcuts,
|
|
18
|
+
ownerState
|
|
20
19
|
} = usePickerLayout(props);
|
|
20
|
+
const {
|
|
21
|
+
orientation
|
|
22
|
+
} = usePickerContext();
|
|
21
23
|
const {
|
|
22
24
|
sx,
|
|
23
25
|
className,
|
|
24
|
-
isLandscape,
|
|
25
26
|
classes
|
|
26
27
|
} = props;
|
|
27
28
|
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
28
|
-
const ownerState = _extends({}, props, {
|
|
29
|
-
isRtl
|
|
30
|
-
});
|
|
31
29
|
return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
|
|
32
30
|
ref: ref,
|
|
33
31
|
className: clsx(pickersLayoutClasses.root, classes?.root, className),
|
|
@@ -41,8 +39,9 @@ const DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function Deskt
|
|
|
41
39
|
}
|
|
42
40
|
}, ...(Array.isArray(sx) ? sx : [sx])],
|
|
43
41
|
ownerState: ownerState,
|
|
44
|
-
children: [
|
|
42
|
+
children: [orientation === 'landscape' ? shortcuts : toolbar, orientation === 'landscape' ? toolbar : shortcuts, /*#__PURE__*/_jsxs(PickersLayoutContentWrapper, {
|
|
45
43
|
className: clsx(pickersLayoutClasses.contentWrapper, classes?.contentWrapper),
|
|
44
|
+
ownerState: ownerState,
|
|
46
45
|
sx: {
|
|
47
46
|
display: 'grid'
|
|
48
47
|
},
|
|
@@ -66,17 +65,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
|
|
|
66
65
|
*/
|
|
67
66
|
classes: PropTypes.object,
|
|
68
67
|
className: PropTypes.string,
|
|
69
|
-
/**
|
|
70
|
-
* If `true`, the component is disabled.
|
|
71
|
-
* When disabled, the value cannot be changed and no interaction is possible.
|
|
72
|
-
* @default false
|
|
73
|
-
*/
|
|
74
|
-
disabled: PropTypes.bool,
|
|
75
|
-
isLandscape: PropTypes.bool.isRequired,
|
|
76
|
-
/**
|
|
77
|
-
* `true` if the application is in right-to-left direction.
|
|
78
|
-
*/
|
|
79
|
-
isRtl: PropTypes.bool.isRequired,
|
|
80
68
|
isValid: PropTypes.func.isRequired,
|
|
81
69
|
onAccept: PropTypes.func.isRequired,
|
|
82
70
|
onCancel: PropTypes.func.isRequired,
|
|
@@ -88,16 +76,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
|
|
|
88
76
|
onSelectShortcut: PropTypes.func.isRequired,
|
|
89
77
|
onSetToday: PropTypes.func.isRequired,
|
|
90
78
|
onViewChange: PropTypes.func.isRequired,
|
|
91
|
-
/**
|
|
92
|
-
* Force rendering in particular orientation.
|
|
93
|
-
*/
|
|
94
|
-
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
95
|
-
/**
|
|
96
|
-
* If `true`, the component is read-only.
|
|
97
|
-
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
98
|
-
* @default false
|
|
99
|
-
*/
|
|
100
|
-
readOnly: PropTypes.bool,
|
|
101
79
|
/**
|
|
102
80
|
* The props used for each component slot.
|
|
103
81
|
* @default {}
|
|
@@ -112,9 +90,8 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
|
|
|
112
90
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
113
91
|
*/
|
|
114
92
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
115
|
-
value: PropTypes.
|
|
93
|
+
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
116
94
|
view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
|
|
117
|
-
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
|
|
118
|
-
wrapperVariant: PropTypes.oneOf(['desktop', 'mobile'])
|
|
95
|
+
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
|
|
119
96
|
} : void 0;
|
|
120
97
|
export { DesktopDateTimePickerLayout };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone", "format"],
|
|
5
|
+
const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "classes", "timezone", "format"],
|
|
6
6
|
_excluded2 = ["ownerState"];
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -19,11 +19,9 @@ import { ArrowDropDownIcon } from "../icons/index.js";
|
|
|
19
19
|
import { PickersArrowSwitcher } from "../internals/components/PickersArrowSwitcher/index.js";
|
|
20
20
|
import { usePreviousMonthDisabled, useNextMonthDisabled } from "../internals/hooks/date-helpers-hooks.js";
|
|
21
21
|
import { getPickersCalendarHeaderUtilityClass, pickersCalendarHeaderClasses } from "./pickersCalendarHeaderClasses.js";
|
|
22
|
+
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
22
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
-
const useUtilityClasses =
|
|
24
|
-
const {
|
|
25
|
-
classes
|
|
26
|
-
} = ownerState;
|
|
24
|
+
const useUtilityClasses = classes => {
|
|
27
25
|
const slots = {
|
|
28
26
|
root: ['root'],
|
|
29
27
|
labelContainer: ['labelContainer'],
|
|
@@ -132,12 +130,15 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
132
130
|
views,
|
|
133
131
|
labelId,
|
|
134
132
|
className,
|
|
133
|
+
classes: classesProp,
|
|
135
134
|
timezone,
|
|
136
135
|
format = `${utils.formats.month} ${utils.formats.year}`
|
|
137
136
|
} = props,
|
|
138
137
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
139
|
-
const
|
|
140
|
-
|
|
138
|
+
const {
|
|
139
|
+
ownerState
|
|
140
|
+
} = usePickerPrivateContext();
|
|
141
|
+
const classes = useUtilityClasses(classesProp);
|
|
141
142
|
const SwitchViewButton = slots?.switchViewButton ?? PickersCalendarHeaderSwitchViewButton;
|
|
142
143
|
const switchViewButtonProps = useSlotProps({
|
|
143
144
|
elementType: SwitchViewButton,
|
|
@@ -7,14 +7,14 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
8
|
import { pickersLayoutClasses, getPickersLayoutUtilityClass } from "./pickersLayoutClasses.js";
|
|
9
9
|
import usePickerLayout from "./usePickerLayout.js";
|
|
10
|
+
import { usePickerContext } from "../hooks/usePickerContext.js";
|
|
10
11
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const useUtilityClasses = ownerState => {
|
|
12
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
12
13
|
const {
|
|
13
|
-
|
|
14
|
-
classes
|
|
14
|
+
pickerOrientation
|
|
15
15
|
} = ownerState;
|
|
16
16
|
const slots = {
|
|
17
|
-
root: ['root',
|
|
17
|
+
root: ['root', pickerOrientation === 'landscape' && 'landscape'],
|
|
18
18
|
contentWrapper: ['contentWrapper']
|
|
19
19
|
};
|
|
20
20
|
return composeClasses(slots, getPickersLayoutUtilityClass, classes);
|
|
@@ -33,7 +33,7 @@ export const PickersLayoutRoot = styled('div', {
|
|
|
33
33
|
},
|
|
34
34
|
variants: [{
|
|
35
35
|
props: {
|
|
36
|
-
|
|
36
|
+
pickerOrientation: 'landscape'
|
|
37
37
|
},
|
|
38
38
|
style: {
|
|
39
39
|
[`& .${pickersLayoutClasses.toolbar}`]: {
|
|
@@ -47,7 +47,7 @@ export const PickersLayoutRoot = styled('div', {
|
|
|
47
47
|
}
|
|
48
48
|
}, {
|
|
49
49
|
props: {
|
|
50
|
-
|
|
50
|
+
pickerOrientation: 'landscape',
|
|
51
51
|
isRtl: true
|
|
52
52
|
},
|
|
53
53
|
style: {
|
|
@@ -57,7 +57,7 @@ export const PickersLayoutRoot = styled('div', {
|
|
|
57
57
|
}
|
|
58
58
|
}, {
|
|
59
59
|
props: {
|
|
60
|
-
|
|
60
|
+
pickerOrientation: 'portrait'
|
|
61
61
|
},
|
|
62
62
|
style: {
|
|
63
63
|
[`& .${pickersLayoutClasses.toolbar}`]: {
|
|
@@ -71,7 +71,7 @@ export const PickersLayoutRoot = styled('div', {
|
|
|
71
71
|
}
|
|
72
72
|
}, {
|
|
73
73
|
props: {
|
|
74
|
-
|
|
74
|
+
pickerOrientation: 'portrait',
|
|
75
75
|
isRtl: true
|
|
76
76
|
},
|
|
77
77
|
style: {
|
|
@@ -110,23 +110,28 @@ const PickersLayout = /*#__PURE__*/React.forwardRef(function PickersLayout(inPro
|
|
|
110
110
|
content,
|
|
111
111
|
tabs,
|
|
112
112
|
actionBar,
|
|
113
|
-
shortcuts
|
|
113
|
+
shortcuts,
|
|
114
|
+
ownerState
|
|
114
115
|
} = usePickerLayout(props);
|
|
116
|
+
const {
|
|
117
|
+
orientation,
|
|
118
|
+
variant
|
|
119
|
+
} = usePickerContext();
|
|
115
120
|
const {
|
|
116
121
|
sx,
|
|
117
122
|
className,
|
|
118
|
-
|
|
119
|
-
wrapperVariant
|
|
123
|
+
classes: classesProp
|
|
120
124
|
} = props;
|
|
121
|
-
const classes = useUtilityClasses(
|
|
125
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
122
126
|
return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
|
|
123
127
|
ref: ref,
|
|
124
128
|
sx: sx,
|
|
125
129
|
className: clsx(classes.root, className),
|
|
126
|
-
ownerState:
|
|
127
|
-
children: [
|
|
130
|
+
ownerState: ownerState,
|
|
131
|
+
children: [orientation === 'landscape' ? shortcuts : toolbar, orientation === 'landscape' ? toolbar : shortcuts, /*#__PURE__*/_jsx(PickersLayoutContentWrapper, {
|
|
128
132
|
className: classes.contentWrapper,
|
|
129
|
-
|
|
133
|
+
ownerState: ownerState,
|
|
134
|
+
children: variant === 'desktop' ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
130
135
|
children: [content, tabs]
|
|
131
136
|
}) : /*#__PURE__*/_jsxs(React.Fragment, {
|
|
132
137
|
children: [tabs, content]
|
|
@@ -145,17 +150,6 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
|
|
|
145
150
|
*/
|
|
146
151
|
classes: PropTypes.object,
|
|
147
152
|
className: PropTypes.string,
|
|
148
|
-
/**
|
|
149
|
-
* If `true`, the component is disabled.
|
|
150
|
-
* When disabled, the value cannot be changed and no interaction is possible.
|
|
151
|
-
* @default false
|
|
152
|
-
*/
|
|
153
|
-
disabled: PropTypes.bool,
|
|
154
|
-
isLandscape: PropTypes.bool.isRequired,
|
|
155
|
-
/**
|
|
156
|
-
* `true` if the application is in right-to-left direction.
|
|
157
|
-
*/
|
|
158
|
-
isRtl: PropTypes.bool.isRequired,
|
|
159
153
|
isValid: PropTypes.func.isRequired,
|
|
160
154
|
onAccept: PropTypes.func.isRequired,
|
|
161
155
|
onCancel: PropTypes.func.isRequired,
|
|
@@ -167,16 +161,6 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
|
|
|
167
161
|
onSelectShortcut: PropTypes.func.isRequired,
|
|
168
162
|
onSetToday: PropTypes.func.isRequired,
|
|
169
163
|
onViewChange: PropTypes.func.isRequired,
|
|
170
|
-
/**
|
|
171
|
-
* Force rendering in particular orientation.
|
|
172
|
-
*/
|
|
173
|
-
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
174
|
-
/**
|
|
175
|
-
* If `true`, the component is read-only.
|
|
176
|
-
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
177
|
-
* @default false
|
|
178
|
-
*/
|
|
179
|
-
readOnly: PropTypes.bool,
|
|
180
164
|
/**
|
|
181
165
|
* The props used for each component slot.
|
|
182
166
|
* @default {}
|
|
@@ -191,9 +175,8 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
|
|
|
191
175
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
192
176
|
*/
|
|
193
177
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
194
|
-
value: PropTypes.
|
|
178
|
+
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
195
179
|
view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
|
|
196
|
-
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
|
|
197
|
-
wrapperVariant: PropTypes.oneOf(['desktop', 'mobile'])
|
|
180
|
+
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
|
|
198
181
|
} : void 0;
|
|
199
182
|
export { PickersLayout };
|
|
@@ -4,20 +4,22 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
7
8
|
import { PickersActionBar } from "../PickersActionBar/index.js";
|
|
8
9
|
import { getPickersLayoutUtilityClass } from "./pickersLayoutClasses.js";
|
|
9
10
|
import { PickersShortcuts } from "../PickersShortcuts/index.js";
|
|
10
11
|
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
12
|
+
import { usePickerContext } from "../hooks/index.js";
|
|
11
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
14
|
function toolbarHasView(toolbarProps) {
|
|
13
15
|
return toolbarProps.view !== null;
|
|
14
16
|
}
|
|
15
17
|
const useUtilityClasses = (classes, ownerState) => {
|
|
16
18
|
const {
|
|
17
|
-
|
|
19
|
+
pickerOrientation
|
|
18
20
|
} = ownerState;
|
|
19
21
|
const slots = {
|
|
20
|
-
root: ['root',
|
|
22
|
+
root: ['root', pickerOrientation === 'landscape' && 'landscape'],
|
|
21
23
|
contentWrapper: ['contentWrapper'],
|
|
22
24
|
toolbar: ['toolbar'],
|
|
23
25
|
actionBar: ['actionBar'],
|
|
@@ -29,10 +31,14 @@ const useUtilityClasses = (classes, ownerState) => {
|
|
|
29
31
|
};
|
|
30
32
|
const usePickerLayout = props => {
|
|
31
33
|
const {
|
|
32
|
-
ownerState:
|
|
34
|
+
ownerState: pickerOwnerState
|
|
33
35
|
} = usePickerPrivateContext();
|
|
34
36
|
const {
|
|
35
|
-
|
|
37
|
+
variant,
|
|
38
|
+
orientation
|
|
39
|
+
} = usePickerContext();
|
|
40
|
+
const isRtl = useRtl();
|
|
41
|
+
const {
|
|
36
42
|
onAccept,
|
|
37
43
|
onClear,
|
|
38
44
|
onCancel,
|
|
@@ -44,9 +50,6 @@ const usePickerLayout = props => {
|
|
|
44
50
|
onChange,
|
|
45
51
|
onSelectShortcut,
|
|
46
52
|
isValid,
|
|
47
|
-
isLandscape,
|
|
48
|
-
disabled,
|
|
49
|
-
readOnly,
|
|
50
53
|
children,
|
|
51
54
|
slots,
|
|
52
55
|
slotProps,
|
|
@@ -56,9 +59,8 @@ const usePickerLayout = props => {
|
|
|
56
59
|
// - For pickers value: PickerValidDate | null
|
|
57
60
|
// - For range pickers value: [PickerValidDate | null, PickerValidDate | null]
|
|
58
61
|
} = props;
|
|
59
|
-
const ownerState = _extends({},
|
|
60
|
-
|
|
61
|
-
isLandscape
|
|
62
|
+
const ownerState = _extends({}, pickerOwnerState, {
|
|
63
|
+
isRtl
|
|
62
64
|
});
|
|
63
65
|
const classes = useUtilityClasses(classesProp, ownerState);
|
|
64
66
|
|
|
@@ -72,7 +74,7 @@ const usePickerLayout = props => {
|
|
|
72
74
|
onClear,
|
|
73
75
|
onCancel,
|
|
74
76
|
onSetToday,
|
|
75
|
-
actions:
|
|
77
|
+
actions: variant === 'desktop' ? [] : ['cancel', 'accept']
|
|
76
78
|
},
|
|
77
79
|
className: classes.actionBar,
|
|
78
80
|
ownerState
|
|
@@ -85,14 +87,13 @@ const usePickerLayout = props => {
|
|
|
85
87
|
elementType: Toolbar,
|
|
86
88
|
externalSlotProps: slotProps?.toolbar,
|
|
87
89
|
additionalProps: {
|
|
88
|
-
isLandscape,
|
|
90
|
+
isLandscape: orientation === 'landscape',
|
|
91
|
+
// Will be removed in a follow up PR?
|
|
89
92
|
onChange,
|
|
90
93
|
value,
|
|
91
94
|
view,
|
|
92
95
|
onViewChange,
|
|
93
|
-
views
|
|
94
|
-
disabled,
|
|
95
|
-
readOnly
|
|
96
|
+
views
|
|
96
97
|
},
|
|
97
98
|
className: classes.toolbar,
|
|
98
99
|
ownerState
|
|
@@ -117,7 +118,8 @@ const usePickerLayout = props => {
|
|
|
117
118
|
externalSlotProps: slotProps?.shortcuts,
|
|
118
119
|
additionalProps: {
|
|
119
120
|
isValid,
|
|
120
|
-
isLandscape,
|
|
121
|
+
isLandscape: orientation === 'landscape',
|
|
122
|
+
// Will be removed in a follow up PR?
|
|
121
123
|
onChange: onSelectShortcut
|
|
122
124
|
},
|
|
123
125
|
className: classes.shortcuts,
|
|
@@ -129,7 +131,8 @@ const usePickerLayout = props => {
|
|
|
129
131
|
content,
|
|
130
132
|
tabs,
|
|
131
133
|
actionBar,
|
|
132
|
-
shortcuts
|
|
134
|
+
shortcuts,
|
|
135
|
+
ownerState
|
|
133
136
|
};
|
|
134
137
|
};
|
|
135
138
|
export default usePickerLayout;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef"];
|
|
3
|
+
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef", "onFocus", "onBlur"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useFormControl } from '@mui/material/FormControl';
|
|
@@ -194,7 +194,9 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
194
194
|
readOnly,
|
|
195
195
|
inputProps,
|
|
196
196
|
inputRef,
|
|
197
|
-
sectionListRef
|
|
197
|
+
sectionListRef,
|
|
198
|
+
onFocus,
|
|
199
|
+
onBlur
|
|
198
200
|
} = props,
|
|
199
201
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
200
202
|
const rootRef = React.useRef(null);
|
|
@@ -206,13 +208,12 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
206
208
|
throw new Error('MUI X: PickersInputBase should always be used inside a PickersTextField component');
|
|
207
209
|
}
|
|
208
210
|
const handleInputFocus = event => {
|
|
209
|
-
// Fix a bug with IE11 where the focus/blur events are triggered
|
|
210
|
-
// while the component is disabled.
|
|
211
|
-
if (muiFormControl.disabled) {
|
|
212
|
-
event.stopPropagation();
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
211
|
muiFormControl.onFocus?.(event);
|
|
212
|
+
onFocus?.(event);
|
|
213
|
+
};
|
|
214
|
+
const handleInputBlur = event => {
|
|
215
|
+
muiFormControl.onBlur?.(event);
|
|
216
|
+
onBlur?.(event);
|
|
216
217
|
};
|
|
217
218
|
React.useEffect(() => {
|
|
218
219
|
if (muiFormControl) {
|
|
@@ -254,7 +255,7 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
254
255
|
tabIndex: tabIndex,
|
|
255
256
|
className: classes.sectionsContainer,
|
|
256
257
|
onFocus: handleInputFocus,
|
|
257
|
-
onBlur:
|
|
258
|
+
onBlur: handleInputBlur,
|
|
258
259
|
onInput: onInput,
|
|
259
260
|
onPaste: onPaste,
|
|
260
261
|
onKeyDown: onKeyDown,
|
|
@@ -105,8 +105,6 @@ const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField
|
|
|
105
105
|
className: clsx(classes.root, className),
|
|
106
106
|
ref: handleRootRef,
|
|
107
107
|
focused: focused,
|
|
108
|
-
onFocus: onFocus,
|
|
109
|
-
onBlur: onBlur,
|
|
110
108
|
disabled: disabled,
|
|
111
109
|
variant: variant,
|
|
112
110
|
error: error,
|
|
@@ -128,6 +126,8 @@ const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField
|
|
|
128
126
|
onKeyUp: onKeyUp,
|
|
129
127
|
onInput: onInput,
|
|
130
128
|
onPaste: onPaste,
|
|
129
|
+
onFocus: onFocus,
|
|
130
|
+
onBlur: onBlur,
|
|
131
131
|
endAdornment: endAdornment,
|
|
132
132
|
startAdornment: startAdornment,
|
|
133
133
|
tabIndex: tabIndex,
|