@mui/x-date-pickers 5.0.2 → 6.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +212 -3
- package/CalendarPicker/CalendarPicker.d.ts +8 -2
- package/CalendarPicker/CalendarPicker.js +54 -71
- package/CalendarPicker/DayPicker.d.ts +2 -2
- package/CalendarPicker/DayPicker.js +6 -2
- package/CalendarPicker/PickersCalendarHeader.d.ts +3 -10
- package/CalendarPicker/PickersCalendarHeader.js +7 -20
- package/CalendarPicker/useCalendarState.d.ts +2 -2
- package/CalendarPicker/useCalendarState.js +7 -7
- package/ClockPicker/Clock.d.ts +9 -4
- package/ClockPicker/Clock.js +13 -13
- package/ClockPicker/ClockNumbers.d.ts +3 -3
- package/ClockPicker/ClockNumbers.js +2 -2
- package/ClockPicker/ClockPicker.d.ts +8 -58
- package/ClockPicker/ClockPicker.js +52 -128
- package/ClockPicker/ClockPointer.d.ts +1 -1
- package/ClockPicker/ClockPointer.js +4 -4
- package/DateField/useDateField.d.ts +1 -1
- package/DateField/useDateField.js +5 -1
- package/DatePicker/DatePicker.js +10 -20
- package/DateTimePicker/DateTimePicker.js +10 -39
- package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +14 -22
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
- package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.js +9 -21
- package/LocalizationProvider/LocalizationProvider.d.ts +10 -11
- package/LocalizationProvider/LocalizationProvider.js +31 -24
- package/MobileDatePicker/MobileDatePicker.d.ts +1 -1
- package/MobileDatePicker/MobileDatePicker.js +14 -22
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
- package/MobileTimePicker/MobileTimePicker.d.ts +1 -1
- package/MobileTimePicker/MobileTimePicker.js +9 -21
- package/MonthPicker/MonthPicker.d.ts +12 -9
- package/MonthPicker/MonthPicker.js +60 -57
- package/MonthPicker/PickersMonth.d.ts +10 -7
- package/MonthPicker/PickersMonth.js +76 -44
- package/MonthPicker/pickersMonthClasses.d.ts +9 -1
- package/MonthPicker/pickersMonthClasses.js +1 -1
- package/PickersDay/PickersDay.d.ts +0 -6
- package/PickersDay/PickersDay.js +0 -5
- package/StaticDatePicker/StaticDatePicker.d.ts +1 -1
- package/StaticDatePicker/StaticDatePicker.js +17 -23
- package/StaticDateTimePicker/StaticDateTimePicker.d.ts +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +17 -42
- package/StaticTimePicker/StaticTimePicker.d.ts +1 -1
- package/StaticTimePicker/StaticTimePicker.js +17 -22
- package/TimePicker/TimePicker.js +5 -19
- package/YearPicker/PickersYear.d.ts +7 -6
- package/YearPicker/PickersYear.js +34 -23
- package/YearPicker/YearPicker.d.ts +21 -4
- package/YearPicker/YearPicker.js +109 -49
- package/YearPicker/pickersYearClasses.d.ts +1 -1
- package/index.js +1 -1
- package/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
- package/internals/components/PickerStaticWrapper/PickerStaticWrapper.d.ts +20 -6
- package/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +38 -22
- package/internals/components/PickerStaticWrapper/index.d.ts +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.d.ts +3 -0
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +166 -0
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +63 -0
- package/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
- package/internals/components/PickersArrowSwitcher/index.d.ts +2 -0
- package/internals/components/PickersArrowSwitcher/index.js +1 -0
- package/internals/components/{pickersArrowSwitcherClasses.d.ts → PickersArrowSwitcher/pickersArrowSwitcherClasses.d.ts} +0 -0
- package/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
- package/internals/components/PickersPopper.d.ts +2 -6
- package/internals/components/PickersPopper.js +5 -5
- package/internals/components/PickersToolbar.d.ts +1 -1
- package/internals/components/PickersToolbar.js +1 -2
- package/internals/components/PickersToolbarText.d.ts +1 -1
- package/internals/components/wrappers/DesktopTooltipWrapper.d.ts +1 -1
- package/internals/components/wrappers/DesktopTooltipWrapper.js +29 -24
- package/internals/components/wrappers/DesktopWrapper.d.ts +8 -3
- package/internals/components/wrappers/DesktopWrapper.js +26 -21
- package/internals/components/wrappers/MobileWrapper.d.ts +8 -3
- package/internals/components/wrappers/MobileWrapper.js +23 -18
- package/internals/hooks/useField/useField.interfaces.d.ts +0 -1
- package/internals/hooks/useField/useField.js +19 -23
- package/internals/hooks/useField/useField.utils.js +10 -2
- package/internals/hooks/useUtils.d.ts +5 -2
- package/internals/hooks/useUtils.js +11 -2
- package/internals/hooks/validation/useDateValidation.d.ts +4 -4
- package/internals/hooks/validation/useDateValidation.js +12 -2
- package/internals/index.d.ts +5 -5
- package/internals/index.js +3 -3
- package/internals/models/muiPickersAdapter.d.ts +12 -7
- package/internals/models/props/baseToolbarProps.d.ts +0 -8
- package/internals/models/props/staticPickerProps.d.ts +2 -8
- package/legacy/CalendarPicker/CalendarPicker.js +52 -69
- package/legacy/CalendarPicker/DayPicker.js +6 -2
- package/legacy/CalendarPicker/PickersCalendarHeader.js +7 -20
- package/legacy/CalendarPicker/useCalendarState.js +7 -7
- package/legacy/ClockPicker/Clock.js +13 -13
- package/legacy/ClockPicker/ClockNumbers.js +2 -2
- package/legacy/ClockPicker/ClockPicker.js +57 -133
- package/legacy/ClockPicker/ClockPointer.js +4 -4
- package/legacy/DateField/useDateField.js +5 -1
- package/legacy/DatePicker/DatePicker.js +10 -20
- package/legacy/DateTimePicker/DateTimePicker.js +10 -39
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +13 -21
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +8 -20
- package/legacy/LocalizationProvider/LocalizationProvider.js +28 -23
- package/legacy/MobileDatePicker/MobileDatePicker.js +13 -21
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
- package/legacy/MobileTimePicker/MobileTimePicker.js +8 -20
- package/legacy/MonthPicker/MonthPicker.js +67 -62
- package/legacy/MonthPicker/PickersMonth.js +89 -57
- package/legacy/MonthPicker/pickersMonthClasses.js +1 -1
- package/legacy/PickersDay/PickersDay.js +0 -5
- package/legacy/StaticDatePicker/StaticDatePicker.js +17 -24
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +17 -43
- package/legacy/StaticTimePicker/StaticTimePicker.js +17 -23
- package/legacy/TimePicker/TimePicker.js +5 -19
- package/legacy/YearPicker/PickersYear.js +35 -25
- package/legacy/YearPicker/YearPicker.js +111 -51
- package/legacy/index.js +1 -1
- package/legacy/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
- package/legacy/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +41 -24
- package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +180 -0
- package/legacy/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
- package/legacy/internals/components/PickersArrowSwitcher/index.js +1 -0
- package/legacy/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
- package/legacy/internals/components/PickersPopper.js +5 -5
- package/legacy/internals/components/PickersToolbar.js +1 -2
- package/legacy/internals/components/wrappers/DesktopTooltipWrapper.js +29 -24
- package/legacy/internals/components/wrappers/DesktopWrapper.js +26 -21
- package/legacy/internals/components/wrappers/MobileWrapper.js +22 -17
- package/legacy/internals/hooks/useField/useField.js +21 -23
- package/legacy/internals/hooks/useField/useField.utils.js +10 -2
- package/legacy/internals/hooks/useUtils.js +13 -2
- package/legacy/internals/hooks/validation/useDateValidation.js +12 -2
- package/legacy/internals/index.js +3 -3
- package/legacy/locales/faIR.js +52 -0
- package/legacy/locales/fiFI.js +61 -0
- package/legacy/locales/index.js +2 -0
- package/legacy/locales/isIS.js +0 -1
- package/locales/faIR.d.ts +35 -0
- package/locales/faIR.js +36 -0
- package/locales/fiFI.d.ts +35 -0
- package/locales/fiFI.js +45 -0
- package/locales/index.d.ts +2 -0
- package/locales/index.js +2 -0
- package/locales/isIS.js +0 -1
- package/locales/utils/pickersLocaleTextApi.d.ts +1 -0
- package/modern/CalendarPicker/CalendarPicker.js +54 -71
- package/modern/CalendarPicker/DayPicker.js +6 -2
- package/modern/CalendarPicker/PickersCalendarHeader.js +7 -20
- package/modern/CalendarPicker/useCalendarState.js +7 -7
- package/modern/ClockPicker/Clock.js +13 -13
- package/modern/ClockPicker/ClockNumbers.js +2 -2
- package/modern/ClockPicker/ClockPicker.js +52 -128
- package/modern/ClockPicker/ClockPointer.js +4 -4
- package/modern/DateField/useDateField.js +5 -1
- package/modern/DatePicker/DatePicker.js +10 -20
- package/modern/DateTimePicker/DateTimePicker.js +10 -39
- package/modern/DesktopDatePicker/DesktopDatePicker.js +14 -22
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
- package/modern/DesktopTimePicker/DesktopTimePicker.js +9 -21
- package/modern/LocalizationProvider/LocalizationProvider.js +29 -24
- package/modern/MobileDatePicker/MobileDatePicker.js +14 -22
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
- package/modern/MobileTimePicker/MobileTimePicker.js +9 -21
- package/modern/MonthPicker/MonthPicker.js +60 -57
- package/modern/MonthPicker/PickersMonth.js +76 -44
- package/modern/MonthPicker/pickersMonthClasses.js +1 -1
- package/modern/PickersDay/PickersDay.js +0 -5
- package/modern/StaticDatePicker/StaticDatePicker.js +17 -23
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +17 -42
- package/modern/StaticTimePicker/StaticTimePicker.js +17 -22
- package/modern/TimePicker/TimePicker.js +5 -19
- package/modern/YearPicker/PickersYear.js +34 -23
- package/modern/YearPicker/YearPicker.js +109 -49
- package/modern/index.js +1 -1
- package/modern/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
- package/modern/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +38 -22
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +164 -0
- package/modern/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
- package/modern/internals/components/PickersArrowSwitcher/index.js +1 -0
- package/modern/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
- package/modern/internals/components/PickersPopper.js +5 -5
- package/modern/internals/components/PickersToolbar.js +1 -2
- package/modern/internals/components/wrappers/DesktopTooltipWrapper.js +29 -24
- package/modern/internals/components/wrappers/DesktopWrapper.js +26 -21
- package/modern/internals/components/wrappers/MobileWrapper.js +23 -18
- package/modern/internals/hooks/useField/useField.js +19 -21
- package/modern/internals/hooks/useField/useField.utils.js +10 -2
- package/modern/internals/hooks/useUtils.js +11 -2
- package/modern/internals/hooks/validation/useDateValidation.js +12 -2
- package/modern/internals/index.js +3 -3
- package/modern/locales/faIR.js +36 -0
- package/modern/locales/fiFI.js +45 -0
- package/modern/locales/index.js +2 -0
- package/modern/locales/isIS.js +0 -1
- package/node/CalendarPicker/CalendarPicker.js +54 -71
- package/node/CalendarPicker/DayPicker.js +5 -1
- package/node/CalendarPicker/PickersCalendarHeader.js +7 -21
- package/node/CalendarPicker/useCalendarState.js +6 -6
- package/node/ClockPicker/Clock.js +12 -12
- package/node/ClockPicker/ClockNumbers.js +2 -2
- package/node/ClockPicker/ClockPicker.js +52 -129
- package/node/ClockPicker/ClockPointer.js +4 -4
- package/node/DateField/useDateField.js +5 -1
- package/node/DatePicker/DatePicker.js +10 -20
- package/node/DateTimePicker/DateTimePicker.js +10 -39
- package/node/DesktopDatePicker/DesktopDatePicker.js +14 -22
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
- package/node/DesktopTimePicker/DesktopTimePicker.js +9 -21
- package/node/LocalizationProvider/LocalizationProvider.js +31 -25
- package/node/MobileDatePicker/MobileDatePicker.js +14 -22
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
- package/node/MobileTimePicker/MobileTimePicker.js +9 -21
- package/node/MonthPicker/MonthPicker.js +61 -58
- package/node/MonthPicker/PickersMonth.js +71 -43
- package/node/MonthPicker/pickersMonthClasses.js +1 -1
- package/node/PickersDay/PickersDay.js +0 -5
- package/node/StaticDatePicker/StaticDatePicker.js +17 -23
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +17 -42
- package/node/StaticTimePicker/StaticTimePicker.js +17 -22
- package/node/TimePicker/TimePicker.js +5 -19
- package/node/YearPicker/PickersYear.js +33 -22
- package/node/YearPicker/YearPicker.js +111 -49
- package/node/index.js +1 -1
- package/node/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
- package/node/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +39 -22
- package/node/internals/components/{PickersArrowSwitcher.js → PickersArrowSwitcher/PickersArrowSwitcher.js} +102 -58
- package/node/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
- package/node/internals/components/PickersArrowSwitcher/index.js +13 -0
- package/node/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
- package/node/internals/components/PickersPopper.js +5 -5
- package/node/internals/components/PickersToolbar.js +1 -2
- package/node/internals/components/wrappers/DesktopTooltipWrapper.js +30 -24
- package/node/internals/components/wrappers/DesktopWrapper.js +27 -21
- package/node/internals/components/wrappers/MobileWrapper.js +24 -18
- package/node/internals/hooks/useField/useField.js +19 -23
- package/node/internals/hooks/useField/useField.utils.js +10 -2
- package/node/internals/hooks/useUtils.js +15 -2
- package/node/internals/hooks/validation/useDateValidation.js +14 -4
- package/node/internals/index.js +8 -2
- package/node/locales/faIR.js +45 -0
- package/node/locales/fiFI.js +54 -0
- package/node/locales/index.js +26 -0
- package/node/locales/isIS.js +0 -1
- package/package.json +4 -4
- package/themeAugmentation/props.d.ts +3 -3
- package/internals/components/PickersArrowSwitcher.d.ts +0 -62
- package/internals/components/PickersArrowSwitcher.js +0 -124
- package/legacy/internals/components/PickersArrowSwitcher.js +0 -128
- package/modern/internals/components/PickersArrowSwitcher.js +0 -124
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["children", "className", "components", "componentsProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel"],
|
|
4
|
+
_excluded2 = ["ownerState"],
|
|
5
|
+
_excluded3 = ["ownerState"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import Typography from '@mui/material/Typography';
|
|
9
|
+
import { useTheme, styled, useThemeProps } from '@mui/material/styles';
|
|
10
|
+
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
11
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
12
|
+
import IconButton from '@mui/material/IconButton';
|
|
13
|
+
import { ArrowLeft, ArrowRight } from '../icons';
|
|
14
|
+
import { getPickersArrowSwitcherUtilityClass } from './pickersArrowSwitcherClasses';
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
const PickersArrowSwitcherRoot = styled('div', {
|
|
18
|
+
name: 'MuiPickersArrowSwitcher',
|
|
19
|
+
slot: 'Root',
|
|
20
|
+
overridesResolver: (props, styles) => styles.root
|
|
21
|
+
})({
|
|
22
|
+
display: 'flex'
|
|
23
|
+
});
|
|
24
|
+
const PickersArrowSwitcherSpacer = styled('div', {
|
|
25
|
+
name: 'MuiPickersArrowSwitcher',
|
|
26
|
+
slot: 'Spacer',
|
|
27
|
+
overridesResolver: (props, styles) => styles.spacer
|
|
28
|
+
})(({
|
|
29
|
+
theme
|
|
30
|
+
}) => ({
|
|
31
|
+
width: theme.spacing(3)
|
|
32
|
+
}));
|
|
33
|
+
const PickersArrowSwitcherButton = styled(IconButton, {
|
|
34
|
+
name: 'MuiPickersArrowSwitcher',
|
|
35
|
+
slot: 'Button',
|
|
36
|
+
overridesResolver: (props, styles) => styles.button
|
|
37
|
+
})(({
|
|
38
|
+
ownerState
|
|
39
|
+
}) => _extends({}, ownerState.hidden && {
|
|
40
|
+
visibility: 'hidden'
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
const useUtilityClasses = ownerState => {
|
|
44
|
+
const {
|
|
45
|
+
classes
|
|
46
|
+
} = ownerState;
|
|
47
|
+
const slots = {
|
|
48
|
+
root: ['root'],
|
|
49
|
+
spacer: ['spacer'],
|
|
50
|
+
button: ['button']
|
|
51
|
+
};
|
|
52
|
+
return composeClasses(slots, getPickersArrowSwitcherUtilityClass, classes);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function PickersArrowSwitcher(inProps, ref) {
|
|
56
|
+
const theme = useTheme();
|
|
57
|
+
const isRTL = theme.direction === 'rtl';
|
|
58
|
+
const props = useThemeProps({
|
|
59
|
+
props: inProps,
|
|
60
|
+
name: 'MuiPickersArrowSwitcher'
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const {
|
|
64
|
+
children,
|
|
65
|
+
className,
|
|
66
|
+
components = {},
|
|
67
|
+
componentsProps = {},
|
|
68
|
+
isNextDisabled,
|
|
69
|
+
isNextHidden,
|
|
70
|
+
onGoToNext,
|
|
71
|
+
nextLabel,
|
|
72
|
+
isPreviousDisabled,
|
|
73
|
+
isPreviousHidden,
|
|
74
|
+
onGoToPrevious,
|
|
75
|
+
previousLabel
|
|
76
|
+
} = props,
|
|
77
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
78
|
+
|
|
79
|
+
const ownerState = props;
|
|
80
|
+
const classes = useUtilityClasses(ownerState);
|
|
81
|
+
const nextProps = {
|
|
82
|
+
isDisabled: isNextDisabled,
|
|
83
|
+
isHidden: isNextHidden,
|
|
84
|
+
goTo: onGoToNext,
|
|
85
|
+
label: nextLabel
|
|
86
|
+
};
|
|
87
|
+
const previousProps = {
|
|
88
|
+
isDisabled: isPreviousDisabled,
|
|
89
|
+
isHidden: isPreviousHidden,
|
|
90
|
+
goTo: onGoToPrevious,
|
|
91
|
+
label: previousLabel
|
|
92
|
+
};
|
|
93
|
+
const [leftProps, rightProps] = isRTL ? [nextProps, previousProps] : [previousProps, nextProps];
|
|
94
|
+
const PreviousIconButton = components.PreviousIconButton ?? PickersArrowSwitcherButton;
|
|
95
|
+
const previousIconButtonProps = useSlotProps({
|
|
96
|
+
elementType: PreviousIconButton,
|
|
97
|
+
externalSlotProps: componentsProps.previousIconButton,
|
|
98
|
+
additionalProps: {
|
|
99
|
+
size: 'small',
|
|
100
|
+
title: leftProps.label,
|
|
101
|
+
'aria-label': leftProps.label,
|
|
102
|
+
disabled: leftProps.isDisabled,
|
|
103
|
+
edge: 'end',
|
|
104
|
+
onClick: leftProps.goTo
|
|
105
|
+
},
|
|
106
|
+
ownerState: _extends({}, ownerState, {
|
|
107
|
+
hidden: leftProps.isHidden
|
|
108
|
+
}),
|
|
109
|
+
className: classes.button
|
|
110
|
+
});
|
|
111
|
+
const NextIconButton = components.NextIconButton ?? PickersArrowSwitcherButton;
|
|
112
|
+
const nextIconButtonProps = useSlotProps({
|
|
113
|
+
elementType: NextIconButton,
|
|
114
|
+
externalSlotProps: componentsProps.nextIconButton,
|
|
115
|
+
additionalProps: {
|
|
116
|
+
size: 'small',
|
|
117
|
+
title: rightProps.label,
|
|
118
|
+
'aria-label': rightProps.label,
|
|
119
|
+
disabled: rightProps.isDisabled,
|
|
120
|
+
edge: 'start',
|
|
121
|
+
onClick: rightProps.goTo
|
|
122
|
+
},
|
|
123
|
+
ownerState: _extends({}, ownerState, {
|
|
124
|
+
hidden: rightProps.isHidden
|
|
125
|
+
}),
|
|
126
|
+
className: classes.button
|
|
127
|
+
});
|
|
128
|
+
const LeftArrowIcon = components?.LeftArrowIcon ?? ArrowLeft; // The spread is here to avoid this bug mui/material-ui#34056
|
|
129
|
+
|
|
130
|
+
const _useSlotProps = useSlotProps({
|
|
131
|
+
elementType: LeftArrowIcon,
|
|
132
|
+
externalSlotProps: componentsProps.leftArrowIcon,
|
|
133
|
+
ownerState: undefined
|
|
134
|
+
}),
|
|
135
|
+
leftArrowIconProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
|
136
|
+
|
|
137
|
+
const RightArrowIcon = components?.RightArrowIcon ?? ArrowRight; // The spread is here to avoid this bug mui/material-ui#34056
|
|
138
|
+
|
|
139
|
+
const _useSlotProps2 = useSlotProps({
|
|
140
|
+
elementType: RightArrowIcon,
|
|
141
|
+
externalSlotProps: componentsProps.rightArrowIcon,
|
|
142
|
+
ownerState: undefined
|
|
143
|
+
}),
|
|
144
|
+
rightArrowIconProps = _objectWithoutPropertiesLoose(_useSlotProps2, _excluded3);
|
|
145
|
+
|
|
146
|
+
return /*#__PURE__*/_jsxs(PickersArrowSwitcherRoot, _extends({
|
|
147
|
+
ref: ref,
|
|
148
|
+
className: clsx(classes.root, className),
|
|
149
|
+
ownerState: ownerState
|
|
150
|
+
}, other, {
|
|
151
|
+
children: [/*#__PURE__*/_jsx(PreviousIconButton, _extends({}, previousIconButtonProps, {
|
|
152
|
+
children: isRTL ? /*#__PURE__*/_jsx(RightArrowIcon, _extends({}, rightArrowIconProps)) : /*#__PURE__*/_jsx(LeftArrowIcon, _extends({}, leftArrowIconProps))
|
|
153
|
+
})), children ? /*#__PURE__*/_jsx(Typography, {
|
|
154
|
+
variant: "subtitle1",
|
|
155
|
+
component: "span",
|
|
156
|
+
children: children
|
|
157
|
+
}) : /*#__PURE__*/_jsx(PickersArrowSwitcherSpacer, {
|
|
158
|
+
className: classes.spacer,
|
|
159
|
+
ownerState: ownerState
|
|
160
|
+
}), /*#__PURE__*/_jsx(NextIconButton, _extends({}, nextIconButtonProps, {
|
|
161
|
+
children: isRTL ? /*#__PURE__*/_jsx(LeftArrowIcon, _extends({}, leftArrowIconProps)) : /*#__PURE__*/_jsx(RightArrowIcon, _extends({}, rightArrowIconProps))
|
|
162
|
+
}))]
|
|
163
|
+
}));
|
|
164
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PickersArrowSwitcher } from './PickersArrowSwitcher';
|
|
File without changes
|
|
@@ -177,7 +177,7 @@ export function PickersPopper(inProps) {
|
|
|
177
177
|
children,
|
|
178
178
|
containerRef = null,
|
|
179
179
|
onBlur,
|
|
180
|
-
|
|
180
|
+
onDismiss,
|
|
181
181
|
onClear,
|
|
182
182
|
onAccept,
|
|
183
183
|
onCancel,
|
|
@@ -195,7 +195,7 @@ export function PickersPopper(inProps) {
|
|
|
195
195
|
function handleKeyDown(nativeEvent) {
|
|
196
196
|
// IE11, Edge (prior to using Bink?) use 'Esc'
|
|
197
197
|
if (open && (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc')) {
|
|
198
|
-
|
|
198
|
+
onDismiss();
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
|
|
@@ -203,7 +203,7 @@ export function PickersPopper(inProps) {
|
|
|
203
203
|
return () => {
|
|
204
204
|
document.removeEventListener('keydown', handleKeyDown);
|
|
205
205
|
};
|
|
206
|
-
}, [
|
|
206
|
+
}, [onDismiss, open]);
|
|
207
207
|
const lastFocusedElementRef = React.useRef(null);
|
|
208
208
|
React.useEffect(() => {
|
|
209
209
|
if (role === 'tooltip') {
|
|
@@ -222,7 +222,7 @@ export function PickersPopper(inProps) {
|
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
}, [open, role]);
|
|
225
|
-
const [clickAwayRef, onPaperClick, onPaperTouchStart] = useClickAwayListener(open, onBlur ??
|
|
225
|
+
const [clickAwayRef, onPaperClick, onPaperTouchStart] = useClickAwayListener(open, onBlur ?? onDismiss);
|
|
226
226
|
const paperRef = React.useRef(null);
|
|
227
227
|
const handleRef = useForkRef(paperRef, containerRef);
|
|
228
228
|
const handlePaperRef = useForkRef(handleRef, clickAwayRef);
|
|
@@ -239,7 +239,7 @@ export function PickersPopper(inProps) {
|
|
|
239
239
|
if (event.key === 'Escape') {
|
|
240
240
|
// stop the propagation to avoid closing parent modal
|
|
241
241
|
event.stopPropagation();
|
|
242
|
-
|
|
242
|
+
onDismiss();
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
245
|
|
|
@@ -74,7 +74,6 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
|
|
|
74
74
|
const {
|
|
75
75
|
children,
|
|
76
76
|
className,
|
|
77
|
-
getMobileKeyboardInputViewButtonText,
|
|
78
77
|
isLandscape,
|
|
79
78
|
isMobileKeyboardViewOpen,
|
|
80
79
|
landscapeDirection = 'column',
|
|
@@ -105,7 +104,7 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
|
|
|
105
104
|
className: classes.penIconButton,
|
|
106
105
|
ownerState: ownerState,
|
|
107
106
|
color: "inherit",
|
|
108
|
-
"aria-label":
|
|
107
|
+
"aria-label": localeText.inputModeToggleButtonAriaLabel(isMobileKeyboardViewOpen, viewType),
|
|
109
108
|
children: isMobileKeyboardViewOpen ? getViewTypeIcon(viewType) : /*#__PURE__*/_jsx(Pen, {
|
|
110
109
|
color: "inherit"
|
|
111
110
|
})
|
|
@@ -4,6 +4,7 @@ import { useForkRef } from '@mui/material/utils';
|
|
|
4
4
|
import { WrapperVariantContext } from './WrapperVariantContext';
|
|
5
5
|
import { executeInTheNextEventLoopTick } from '../../utils/utils';
|
|
6
6
|
import { PickersPopper } from '../PickersPopper';
|
|
7
|
+
import { LocalizationProvider } from '../../../LocalizationProvider';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
export function DesktopTooltipWrapper(props) {
|
|
@@ -21,7 +22,8 @@ export function DesktopTooltipWrapper(props) {
|
|
|
21
22
|
onAccept,
|
|
22
23
|
onSetToday,
|
|
23
24
|
components,
|
|
24
|
-
componentsProps
|
|
25
|
+
componentsProps,
|
|
26
|
+
localeText
|
|
25
27
|
} = props;
|
|
26
28
|
const inputContainerRef = React.useRef(null);
|
|
27
29
|
const popperRef = React.useRef(null);
|
|
@@ -37,28 +39,31 @@ export function DesktopTooltipWrapper(props) {
|
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
const inputComponentRef = useForkRef(DateInputProps.ref, inputContainerRef);
|
|
40
|
-
return /*#__PURE__*/
|
|
41
|
-
|
|
42
|
-
children:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
42
|
+
return /*#__PURE__*/_jsx(LocalizationProvider, {
|
|
43
|
+
localeText: localeText,
|
|
44
|
+
children: /*#__PURE__*/_jsxs(WrapperVariantContext.Provider, {
|
|
45
|
+
value: "desktop",
|
|
46
|
+
children: [/*#__PURE__*/_jsx(KeyboardDateInputComponent, _extends({}, DateInputProps, {
|
|
47
|
+
ref: inputComponentRef,
|
|
48
|
+
onBlur: handleBlur
|
|
49
|
+
})), /*#__PURE__*/_jsx(PickersPopper, {
|
|
50
|
+
role: "tooltip",
|
|
51
|
+
open: open,
|
|
52
|
+
containerRef: popperRef,
|
|
53
|
+
anchorEl: inputContainerRef.current,
|
|
54
|
+
TransitionComponent: TransitionComponent,
|
|
55
|
+
PopperProps: PopperProps,
|
|
56
|
+
PaperProps: PaperProps,
|
|
57
|
+
onBlur: handleBlur,
|
|
58
|
+
onDismiss: onDismiss,
|
|
59
|
+
onClear: onClear,
|
|
60
|
+
onCancel: onCancel,
|
|
61
|
+
onAccept: onAccept,
|
|
62
|
+
onSetToday: onSetToday,
|
|
63
|
+
components: components,
|
|
64
|
+
componentsProps: componentsProps,
|
|
65
|
+
children: children
|
|
66
|
+
})]
|
|
67
|
+
})
|
|
63
68
|
});
|
|
64
69
|
}
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useForkRef } from '@mui/material/utils';
|
|
4
4
|
import { WrapperVariantContext } from './WrapperVariantContext';
|
|
5
5
|
import { PickersPopper } from '../PickersPopper';
|
|
6
|
+
import { LocalizationProvider } from '../../../LocalizationProvider';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
9
|
export function DesktopWrapper(props) {
|
|
@@ -20,29 +21,33 @@ export function DesktopWrapper(props) {
|
|
|
20
21
|
PaperProps,
|
|
21
22
|
TransitionComponent,
|
|
22
23
|
components,
|
|
23
|
-
componentsProps
|
|
24
|
+
componentsProps,
|
|
25
|
+
localeText
|
|
24
26
|
} = props;
|
|
25
27
|
const ownInputRef = React.useRef(null);
|
|
26
28
|
const inputRef = useForkRef(DateInputProps.inputRef, ownInputRef);
|
|
27
|
-
return /*#__PURE__*/
|
|
28
|
-
|
|
29
|
-
children:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
return /*#__PURE__*/_jsx(LocalizationProvider, {
|
|
30
|
+
localeText: localeText,
|
|
31
|
+
children: /*#__PURE__*/_jsxs(WrapperVariantContext.Provider, {
|
|
32
|
+
value: "desktop",
|
|
33
|
+
children: [/*#__PURE__*/_jsx(KeyboardDateInputComponent, _extends({}, DateInputProps, {
|
|
34
|
+
inputRef: inputRef
|
|
35
|
+
})), /*#__PURE__*/_jsx(PickersPopper, {
|
|
36
|
+
role: "dialog",
|
|
37
|
+
open: open,
|
|
38
|
+
anchorEl: ownInputRef.current,
|
|
39
|
+
TransitionComponent: TransitionComponent,
|
|
40
|
+
PopperProps: PopperProps,
|
|
41
|
+
PaperProps: PaperProps,
|
|
42
|
+
onDismiss: onDismiss,
|
|
43
|
+
onCancel: onCancel,
|
|
44
|
+
onClear: onClear,
|
|
45
|
+
onAccept: onAccept,
|
|
46
|
+
onSetToday: onSetToday,
|
|
47
|
+
components: components,
|
|
48
|
+
componentsProps: componentsProps,
|
|
49
|
+
children: children
|
|
50
|
+
})]
|
|
51
|
+
})
|
|
47
52
|
});
|
|
48
53
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["children", "DateInputProps", "DialogProps", "onAccept", "onClear", "onDismiss", "onCancel", "onSetToday", "open", "PureDateInputComponent", "components", "componentsProps"];
|
|
3
|
+
const _excluded = ["children", "DateInputProps", "DialogProps", "onAccept", "onClear", "onDismiss", "onCancel", "onSetToday", "open", "PureDateInputComponent", "components", "componentsProps", "localeText"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { WrapperVariantContext } from './WrapperVariantContext';
|
|
6
6
|
import { PickersModalDialog } from '../PickersModalDialog';
|
|
7
|
+
import { LocalizationProvider } from '../../../LocalizationProvider';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
export function MobileWrapper(props) {
|
|
@@ -19,25 +20,29 @@ export function MobileWrapper(props) {
|
|
|
19
20
|
open,
|
|
20
21
|
PureDateInputComponent,
|
|
21
22
|
components,
|
|
22
|
-
componentsProps
|
|
23
|
+
componentsProps,
|
|
24
|
+
localeText
|
|
23
25
|
} = props,
|
|
24
26
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
25
27
|
|
|
26
|
-
return /*#__PURE__*/
|
|
27
|
-
|
|
28
|
-
children:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
return /*#__PURE__*/_jsx(LocalizationProvider, {
|
|
29
|
+
localeText: localeText,
|
|
30
|
+
children: /*#__PURE__*/_jsxs(WrapperVariantContext.Provider, {
|
|
31
|
+
value: "mobile",
|
|
32
|
+
children: [/*#__PURE__*/_jsx(PureDateInputComponent, _extends({
|
|
33
|
+
components: components
|
|
34
|
+
}, other, DateInputProps)), /*#__PURE__*/_jsx(PickersModalDialog, {
|
|
35
|
+
DialogProps: DialogProps,
|
|
36
|
+
onAccept: onAccept,
|
|
37
|
+
onClear: onClear,
|
|
38
|
+
onDismiss: onDismiss,
|
|
39
|
+
onCancel: onCancel,
|
|
40
|
+
onSetToday: onSetToday,
|
|
41
|
+
open: open,
|
|
42
|
+
components: components,
|
|
43
|
+
componentsProps: componentsProps,
|
|
44
|
+
children: children
|
|
45
|
+
})]
|
|
46
|
+
})
|
|
42
47
|
});
|
|
43
48
|
}
|
|
@@ -48,7 +48,6 @@ export const useField = params => {
|
|
|
48
48
|
return {
|
|
49
49
|
sections,
|
|
50
50
|
valueParsed,
|
|
51
|
-
valueStr: fieldValueManager.getValueStrFromSections(sections),
|
|
52
51
|
selectedSectionIndexes: null
|
|
53
52
|
};
|
|
54
53
|
});
|
|
@@ -60,7 +59,6 @@ export const useField = params => {
|
|
|
60
59
|
} = fieldValueManager.getValueFromSections(utils, state.sections, sections, format);
|
|
61
60
|
setState(prevState => _extends({}, prevState, {
|
|
62
61
|
sections,
|
|
63
|
-
valueStr: fieldValueManager.getValueStrFromSections(sections),
|
|
64
62
|
valueParsed: newValueParsed
|
|
65
63
|
}));
|
|
66
64
|
|
|
@@ -81,22 +79,25 @@ export const useField = params => {
|
|
|
81
79
|
|
|
82
80
|
const handleInputClick = useEventCallback((...args) => {
|
|
83
81
|
onClick?.(...args);
|
|
84
|
-
|
|
85
|
-
if (state.sections.length === 0) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const nextSectionIndex = state.sections.findIndex(section => section.start > (inputRef.current?.selectionStart ?? 0));
|
|
82
|
+
const nextSectionIndex = state.sections.findIndex(section => section.start > (inputRef.current.selectionStart ?? 0));
|
|
90
83
|
const sectionIndex = nextSectionIndex === -1 ? state.sections.length - 1 : nextSectionIndex - 1;
|
|
91
84
|
updateSelectedSections(sectionIndex);
|
|
92
85
|
});
|
|
93
86
|
const handleInputFocus = useEventCallback((...args) => {
|
|
94
|
-
onFocus?.(...args);
|
|
87
|
+
onFocus?.(...args); // The ref is guaranteed to be resolved that this point.
|
|
88
|
+
|
|
89
|
+
const input = inputRef.current;
|
|
90
|
+
clearTimeout(focusTimeoutRef.current);
|
|
95
91
|
focusTimeoutRef.current = setTimeout(() => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
// The ref changed, the component got remounted, the focus event is no longer relevant.
|
|
93
|
+
if (input !== inputRef.current) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (Number(input.selectionEnd) - Number(input.selectionStart) === input.value.length) {
|
|
99
98
|
updateSelectedSections(0, state.sections.length - 1);
|
|
99
|
+
} else {
|
|
100
|
+
handleInputClick();
|
|
100
101
|
}
|
|
101
102
|
});
|
|
102
103
|
});
|
|
@@ -105,17 +106,14 @@ export const useField = params => {
|
|
|
105
106
|
updateSelectedSections();
|
|
106
107
|
});
|
|
107
108
|
const handleInputKeyDown = useEventCallback(event => {
|
|
108
|
-
onKeyDown?.(event);
|
|
109
|
-
|
|
110
|
-
if (!inputRef.current || state.sections.length === 0) {
|
|
111
|
-
return;
|
|
112
|
-
} // eslint-disable-next-line default-case
|
|
113
|
-
|
|
109
|
+
onKeyDown?.(event); // eslint-disable-next-line default-case
|
|
114
110
|
|
|
115
111
|
switch (true) {
|
|
116
112
|
// Select all
|
|
117
113
|
case event.key === 'a' && (event.ctrlKey || event.metaKey):
|
|
118
114
|
{
|
|
115
|
+
// prevent default to make sure that the next line "select all" while updating
|
|
116
|
+
// the internal state at the same time.
|
|
119
117
|
event.preventDefault();
|
|
120
118
|
updateSelectedSections(0, state.sections.length - 1);
|
|
121
119
|
return;
|
|
@@ -256,7 +254,7 @@ export const useField = params => {
|
|
|
256
254
|
}
|
|
257
255
|
});
|
|
258
256
|
useEnhancedEffect(() => {
|
|
259
|
-
if (
|
|
257
|
+
if (state.selectedSectionIndexes == null) {
|
|
260
258
|
return;
|
|
261
259
|
}
|
|
262
260
|
|
|
@@ -275,7 +273,6 @@ export const useField = params => {
|
|
|
275
273
|
const sections = fieldValueManager.getSectionsFromValue(utils, state.sections, valueParsed, format);
|
|
276
274
|
setState(prevState => _extends({}, prevState, {
|
|
277
275
|
valueParsed,
|
|
278
|
-
valueStr: fieldValueManager.getValueStrFromSections(sections),
|
|
279
276
|
sections
|
|
280
277
|
}));
|
|
281
278
|
}
|
|
@@ -289,9 +286,10 @@ export const useField = params => {
|
|
|
289
286
|
React.useEffect(() => {
|
|
290
287
|
return () => window.clearTimeout(focusTimeoutRef.current);
|
|
291
288
|
}, []);
|
|
289
|
+
const valueStr = React.useMemo(() => fieldValueManager.getValueStrFromSections(state.sections), [state.sections, fieldValueManager]);
|
|
292
290
|
return {
|
|
293
291
|
inputProps: _extends({}, otherForwardedProps, {
|
|
294
|
-
value:
|
|
292
|
+
value: valueStr,
|
|
295
293
|
onClick: handleInputClick,
|
|
296
294
|
onFocus: handleInputFocus,
|
|
297
295
|
onBlur: handleInputBlur,
|
|
@@ -156,12 +156,20 @@ export const adjustInvalidDateSectionValue = (utils, section, keyCode) => {
|
|
|
156
156
|
|
|
157
157
|
if (shouldSetAbsolute) {
|
|
158
158
|
if (delta > 0 || isEnd) {
|
|
159
|
-
newDate = utils.endOfMonth(today);
|
|
160
|
-
} else {
|
|
161
159
|
newDate = utils.startOfMonth(today);
|
|
160
|
+
} else {
|
|
161
|
+
newDate = utils.endOfMonth(today);
|
|
162
162
|
}
|
|
163
163
|
} else {
|
|
164
164
|
newDate = utils.addDays(utils.parse(section.value, section.formatValue), delta);
|
|
165
|
+
|
|
166
|
+
if (!utils.isSameMonth(newDate, today)) {
|
|
167
|
+
if (delta > 0) {
|
|
168
|
+
newDate = utils.startOfMonth(today);
|
|
169
|
+
} else {
|
|
170
|
+
newDate = utils.endOfMonth(today);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
165
173
|
}
|
|
166
174
|
|
|
167
175
|
return utils.formatByString(newDate, section.formatValue);
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { MuiPickersAdapterContext } from '../../LocalizationProvider/LocalizationProvider';
|
|
4
|
+
import { DEFAULT_LOCALE } from '../../locales/enUS';
|
|
3
5
|
export const useLocalizationContext = () => {
|
|
4
6
|
const localization = React.useContext(MuiPickersAdapterContext);
|
|
5
7
|
|
|
6
8
|
if (localization === null) {
|
|
7
|
-
throw new Error('MUI: Can not find
|
|
9
|
+
throw new Error(['MUI: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
if (localization.utils === null) {
|
|
13
|
+
throw new Error(['MUI: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const localeText = React.useMemo(() => _extends({}, DEFAULT_LOCALE, localization.localeText), [localization.localeText]);
|
|
17
|
+
return _extends({}, localization, {
|
|
18
|
+
localeText
|
|
19
|
+
});
|
|
11
20
|
};
|
|
12
21
|
export const useUtils = () => useLocalizationContext().utils;
|
|
13
22
|
export const useDefaultDates = () => useLocalizationContext().defaultDates;
|
|
@@ -23,6 +23,12 @@ export const validateDate = ({
|
|
|
23
23
|
case Boolean(props.shouldDisableDate && props.shouldDisableDate(date)):
|
|
24
24
|
return 'shouldDisableDate';
|
|
25
25
|
|
|
26
|
+
case Boolean(props.shouldDisableMonth && props.shouldDisableMonth(date)):
|
|
27
|
+
return 'shouldDisableMonth';
|
|
28
|
+
|
|
29
|
+
case Boolean(props.shouldDisableYear && props.shouldDisableYear(date)):
|
|
30
|
+
return 'shouldDisableYear';
|
|
31
|
+
|
|
26
32
|
case Boolean(props.disableFuture && adapter.utils.isAfterDay(date, now)):
|
|
27
33
|
return 'disableFuture';
|
|
28
34
|
|
|
@@ -39,8 +45,10 @@ export const validateDate = ({
|
|
|
39
45
|
return null;
|
|
40
46
|
}
|
|
41
47
|
};
|
|
42
|
-
export const
|
|
48
|
+
export const useIsDateDisabled = ({
|
|
43
49
|
shouldDisableDate,
|
|
50
|
+
shouldDisableMonth,
|
|
51
|
+
shouldDisableYear,
|
|
44
52
|
minDate,
|
|
45
53
|
maxDate,
|
|
46
54
|
disableFuture,
|
|
@@ -52,12 +60,14 @@ export const useIsDayDisabled = ({
|
|
|
52
60
|
value: day,
|
|
53
61
|
props: {
|
|
54
62
|
shouldDisableDate,
|
|
63
|
+
shouldDisableMonth,
|
|
64
|
+
shouldDisableYear,
|
|
55
65
|
minDate,
|
|
56
66
|
maxDate,
|
|
57
67
|
disableFuture,
|
|
58
68
|
disablePast
|
|
59
69
|
}
|
|
60
|
-
}) !== null, [adapter, shouldDisableDate, minDate, maxDate, disableFuture, disablePast]);
|
|
70
|
+
}) !== null, [adapter, shouldDisableDate, shouldDisableMonth, shouldDisableYear, minDate, maxDate, disableFuture, disablePast]);
|
|
61
71
|
};
|
|
62
72
|
export const isSameDateError = (a, b) => a === b;
|
|
63
73
|
export const useDateValidation = props => useValidation(props, validateDate, isSameDateError);
|
|
@@ -2,13 +2,13 @@ export { DesktopTooltipWrapper } from './components/wrappers/DesktopTooltipWrapp
|
|
|
2
2
|
export { MobileWrapper } from './components/wrappers/MobileWrapper';
|
|
3
3
|
export { MobileKeyboardInputView } from './components/CalendarOrClockPicker/CalendarOrClockPicker';
|
|
4
4
|
export { calendarOrClockPickerClasses } from './components/CalendarOrClockPicker/calendarOrClockPickerClasses';
|
|
5
|
-
export { PickersArrowSwitcher } from './components/PickersArrowSwitcher';
|
|
5
|
+
export { PickersArrowSwitcher } from './components/PickersArrowSwitcher/PickersArrowSwitcher';
|
|
6
6
|
export { PickerStaticWrapper } from './components/PickerStaticWrapper/PickerStaticWrapper';
|
|
7
7
|
export { PickersToolbar } from './components/PickersToolbar';
|
|
8
8
|
export { pickersToolbarClasses } from './components/pickersToolbarClasses';
|
|
9
9
|
export { pickersToolbarButtonClasses } from './components/pickersToolbarButtonClasses';
|
|
10
10
|
export { pickersToolbarTextClasses } from './components/pickersToolbarTextClasses';
|
|
11
|
-
export { pickersArrowSwitcherClasses } from './components/pickersArrowSwitcherClasses';
|
|
11
|
+
export { pickersArrowSwitcherClasses } from './components/PickersArrowSwitcher/pickersArrowSwitcherClasses';
|
|
12
12
|
export { pickersPopperClasses } from './components/pickersPopperClasses';
|
|
13
13
|
export { PickersToolbarButton } from './components/PickersToolbarButton';
|
|
14
14
|
export { pickerStaticWrapperClasses } from './components/PickerStaticWrapper/pickerStaticWrapperClasses';
|
|
@@ -16,7 +16,7 @@ export { WrapperVariantContext } from './components/wrappers/WrapperVariantConte
|
|
|
16
16
|
export { DAY_MARGIN } from './constants/dimensions';
|
|
17
17
|
export { useMaskedInput } from './hooks/useMaskedInput';
|
|
18
18
|
export { usePickerState } from './hooks/usePickerState';
|
|
19
|
-
export { useDefaultDates, useUtils, useLocaleText } from './hooks/useUtils';
|
|
19
|
+
export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText } from './hooks/useUtils';
|
|
20
20
|
export { useValidation } from './hooks/validation/useValidation';
|
|
21
21
|
export { validateDate } from './hooks/validation/useDateValidation';
|
|
22
22
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
|