@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
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["autoFocus", "onViewChange", "date", "disableFuture", "disablePast", "defaultCalendarMonth", "onChange", "onYearChange", "onMonthChange", "reduceAnimations", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "view", "views", "openTo", "className", "disabled", "readOnly", "minDate", "maxDate", "disableHighlightToday", "focusedView", "onFocusedViewChange", "classes"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
6
4
|
import clsx from 'clsx';
|
|
@@ -68,9 +66,7 @@ const CalendarPickerViewTransitionContainer = styled(PickersFadeTransitionGroup,
|
|
|
68
66
|
name: 'MuiCalendarPicker',
|
|
69
67
|
slot: 'ViewTransitionContainer',
|
|
70
68
|
overridesResolver: (props, styles) => styles.viewTransitionContainer
|
|
71
|
-
})({
|
|
72
|
-
overflowY: 'auto'
|
|
73
|
-
});
|
|
69
|
+
})({});
|
|
74
70
|
|
|
75
71
|
/**
|
|
76
72
|
*
|
|
@@ -86,11 +82,10 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
86
82
|
const utils = useUtils();
|
|
87
83
|
const id = useId();
|
|
88
84
|
const props = useCalendarPickerDefaultizedProps(inProps, 'MuiCalendarPicker');
|
|
89
|
-
|
|
90
85
|
const {
|
|
91
86
|
autoFocus,
|
|
92
87
|
onViewChange,
|
|
93
|
-
|
|
88
|
+
value,
|
|
94
89
|
disableFuture,
|
|
95
90
|
disablePast,
|
|
96
91
|
defaultCalendarMonth,
|
|
@@ -111,10 +106,16 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
111
106
|
maxDate,
|
|
112
107
|
disableHighlightToday,
|
|
113
108
|
focusedView,
|
|
114
|
-
onFocusedViewChange
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
onFocusedViewChange,
|
|
110
|
+
showDaysOutsideCurrentMonth,
|
|
111
|
+
dayOfWeekFormatter,
|
|
112
|
+
renderDay,
|
|
113
|
+
components,
|
|
114
|
+
componentsProps,
|
|
115
|
+
loading,
|
|
116
|
+
renderLoading,
|
|
117
|
+
sx
|
|
118
|
+
} = props;
|
|
118
119
|
const {
|
|
119
120
|
openView,
|
|
120
121
|
setOpenView,
|
|
@@ -134,7 +135,7 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
134
135
|
isDateDisabled,
|
|
135
136
|
onMonthSwitchingAnimationEnd
|
|
136
137
|
} = useCalendarState({
|
|
137
|
-
|
|
138
|
+
value,
|
|
138
139
|
defaultCalendarMonth,
|
|
139
140
|
reduceAnimations,
|
|
140
141
|
onMonthChange,
|
|
@@ -144,7 +145,7 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
144
145
|
disablePast,
|
|
145
146
|
disableFuture
|
|
146
147
|
});
|
|
147
|
-
const handleDateMonthChange = React.useCallback(
|
|
148
|
+
const handleDateMonthChange = React.useCallback(newDate => {
|
|
148
149
|
const startOfMonth = utils.startOfMonth(newDate);
|
|
149
150
|
const endOfMonth = utils.endOfMonth(newDate);
|
|
150
151
|
const closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
|
|
@@ -158,7 +159,7 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
158
159
|
}) : newDate;
|
|
159
160
|
|
|
160
161
|
if (closestEnabledDate) {
|
|
161
|
-
onChange(closestEnabledDate,
|
|
162
|
+
onChange(closestEnabledDate, 'finish');
|
|
162
163
|
onMonthChange?.(startOfMonth);
|
|
163
164
|
} else {
|
|
164
165
|
openNext();
|
|
@@ -167,7 +168,7 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
167
168
|
|
|
168
169
|
changeFocusedDay(closestEnabledDate, true);
|
|
169
170
|
}, [changeFocusedDay, disableFuture, disablePast, isDateDisabled, maxDate, minDate, onChange, onMonthChange, changeMonth, openNext, utils]);
|
|
170
|
-
const handleDateYearChange = React.useCallback(
|
|
171
|
+
const handleDateYearChange = React.useCallback(newDate => {
|
|
171
172
|
const startOfYear = utils.startOfYear(newDate);
|
|
172
173
|
const endOfYear = utils.endOfYear(newDate);
|
|
173
174
|
const closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
|
|
@@ -181,7 +182,7 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
181
182
|
}) : newDate;
|
|
182
183
|
|
|
183
184
|
if (closestEnabledDate) {
|
|
184
|
-
onChange(closestEnabledDate,
|
|
185
|
+
onChange(closestEnabledDate, 'finish');
|
|
185
186
|
onYearChange?.(closestEnabledDate);
|
|
186
187
|
} else {
|
|
187
188
|
openNext();
|
|
@@ -191,35 +192,18 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
191
192
|
changeFocusedDay(closestEnabledDate, true);
|
|
192
193
|
}, [changeFocusedDay, disableFuture, disablePast, isDateDisabled, maxDate, minDate, onChange, onYearChange, openNext, utils, changeMonth]);
|
|
193
194
|
const onSelectedDayChange = React.useCallback((day, isFinish) => {
|
|
194
|
-
if (
|
|
195
|
+
if (value && day) {
|
|
195
196
|
// If there is a date already selected, then we want to keep its time
|
|
196
|
-
return onChange(utils.mergeDateAndTime(day,
|
|
197
|
+
return onChange(utils.mergeDateAndTime(day, value), isFinish);
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
return onChange(day, isFinish);
|
|
200
|
-
}, [utils,
|
|
201
|
-
React.useEffect(() => {
|
|
202
|
-
if (date && isDateDisabled(date)) {
|
|
203
|
-
const closestEnabledDate = findClosestEnabledDate({
|
|
204
|
-
utils,
|
|
205
|
-
date,
|
|
206
|
-
minDate,
|
|
207
|
-
maxDate,
|
|
208
|
-
disablePast,
|
|
209
|
-
disableFuture,
|
|
210
|
-
isDateDisabled
|
|
211
|
-
});
|
|
212
|
-
onChange(closestEnabledDate, 'partial');
|
|
213
|
-
} // This call is too expensive to run it on each prop change.
|
|
214
|
-
// So just ensure that we are not rendering disabled as selected on mount.
|
|
215
|
-
|
|
216
|
-
}, []); // eslint-disable-line
|
|
217
|
-
|
|
201
|
+
}, [utils, value, onChange]);
|
|
218
202
|
React.useEffect(() => {
|
|
219
|
-
if (
|
|
220
|
-
changeMonth(
|
|
203
|
+
if (value != null && utils.isValid(value)) {
|
|
204
|
+
changeMonth(value);
|
|
221
205
|
}
|
|
222
|
-
}, [
|
|
206
|
+
}, [value]); // eslint-disable-line
|
|
223
207
|
|
|
224
208
|
const ownerState = props;
|
|
225
209
|
const classes = useUtilityClasses(ownerState);
|
|
@@ -230,8 +214,8 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
230
214
|
minDate
|
|
231
215
|
}; // When disabled, limit the view to the selected date
|
|
232
216
|
|
|
233
|
-
const minDateWithDisabled = disabled &&
|
|
234
|
-
const maxDateWithDisabled = disabled &&
|
|
217
|
+
const minDateWithDisabled = disabled && value || minDate;
|
|
218
|
+
const maxDateWithDisabled = disabled && value || maxDate;
|
|
235
219
|
const commonViewProps = {
|
|
236
220
|
disableHighlightToday,
|
|
237
221
|
readOnly,
|
|
@@ -259,11 +243,16 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
259
243
|
setInternalFocusedView(prevView => prevView === eventView ? null : prevView);
|
|
260
244
|
}
|
|
261
245
|
});
|
|
246
|
+
React.useEffect(() => {
|
|
247
|
+
// Set focus to the button when switching from a view to another
|
|
248
|
+
handleFocusedViewChange(openView)(true);
|
|
249
|
+
}, [openView, handleFocusedViewChange]);
|
|
262
250
|
return /*#__PURE__*/_jsxs(CalendarPickerRoot, {
|
|
263
251
|
ref: ref,
|
|
264
252
|
className: clsx(classes.root, className),
|
|
265
253
|
ownerState: ownerState,
|
|
266
|
-
|
|
254
|
+
sx: sx,
|
|
255
|
+
children: [/*#__PURE__*/_jsx(PickersCalendarHeader, {
|
|
267
256
|
views: views,
|
|
268
257
|
openView: openView,
|
|
269
258
|
currentMonth: calendarState.currentMonth,
|
|
@@ -278,16 +267,18 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
278
267
|
disablePast: disablePast,
|
|
279
268
|
disableFuture: disableFuture,
|
|
280
269
|
reduceAnimations: reduceAnimations,
|
|
281
|
-
labelId: gridLabelId
|
|
282
|
-
|
|
270
|
+
labelId: gridLabelId,
|
|
271
|
+
components: components,
|
|
272
|
+
componentsProps: componentsProps
|
|
273
|
+
}), /*#__PURE__*/_jsx(CalendarPickerViewTransitionContainer, {
|
|
283
274
|
reduceAnimations: reduceAnimations,
|
|
284
275
|
className: classes.viewTransitionContainer,
|
|
285
276
|
transKey: openView,
|
|
286
277
|
ownerState: ownerState,
|
|
287
278
|
children: /*#__PURE__*/_jsxs("div", {
|
|
288
|
-
children: [openView === 'year' && /*#__PURE__*/_jsx(YearPicker, _extends({},
|
|
279
|
+
children: [openView === 'year' && /*#__PURE__*/_jsx(YearPicker, _extends({}, baseDateValidationProps, commonViewProps, {
|
|
289
280
|
autoFocus: autoFocus,
|
|
290
|
-
|
|
281
|
+
value: value,
|
|
291
282
|
onChange: handleDateYearChange,
|
|
292
283
|
shouldDisableYear: shouldDisableYear,
|
|
293
284
|
hasFocus: hasFocus,
|
|
@@ -296,21 +287,28 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
296
287
|
autoFocus: autoFocus,
|
|
297
288
|
hasFocus: hasFocus,
|
|
298
289
|
className: className,
|
|
299
|
-
|
|
290
|
+
value: value,
|
|
300
291
|
onChange: handleDateMonthChange,
|
|
301
292
|
shouldDisableMonth: shouldDisableMonth,
|
|
302
293
|
onFocusedViewChange: handleFocusedViewChange('month')
|
|
303
|
-
})), openView === 'day' && /*#__PURE__*/_jsx(DayPicker, _extends({},
|
|
294
|
+
})), openView === 'day' && /*#__PURE__*/_jsx(DayPicker, _extends({}, calendarState, baseDateValidationProps, commonViewProps, {
|
|
304
295
|
autoFocus: autoFocus,
|
|
305
296
|
onMonthSwitchingAnimationEnd: onMonthSwitchingAnimationEnd,
|
|
306
297
|
onFocusedDayChange: changeFocusedDay,
|
|
307
298
|
reduceAnimations: reduceAnimations,
|
|
308
|
-
selectedDays: [
|
|
299
|
+
selectedDays: [value],
|
|
309
300
|
onSelectedDaysChange: onSelectedDayChange,
|
|
310
301
|
shouldDisableDate: shouldDisableDate,
|
|
302
|
+
shouldDisableMonth: shouldDisableMonth,
|
|
303
|
+
shouldDisableYear: shouldDisableYear,
|
|
311
304
|
hasFocus: hasFocus,
|
|
312
305
|
onFocusedViewChange: handleFocusedViewChange('day'),
|
|
313
|
-
gridLabelId: gridLabelId
|
|
306
|
+
gridLabelId: gridLabelId,
|
|
307
|
+
showDaysOutsideCurrentMonth: showDaysOutsideCurrentMonth,
|
|
308
|
+
dayOfWeekFormatter: dayOfWeekFormatter,
|
|
309
|
+
renderDay: renderDay,
|
|
310
|
+
loading: loading,
|
|
311
|
+
renderLoading: renderLoading
|
|
314
312
|
}))]
|
|
315
313
|
})
|
|
316
314
|
})]
|
|
@@ -336,7 +334,6 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
336
334
|
* @default {}
|
|
337
335
|
*/
|
|
338
336
|
componentsProps: PropTypes.object,
|
|
339
|
-
date: PropTypes.any,
|
|
340
337
|
|
|
341
338
|
/**
|
|
342
339
|
* Formats the day of week displayed in the calendar header.
|
|
@@ -376,20 +373,6 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
376
373
|
disablePast: PropTypes.bool,
|
|
377
374
|
focusedView: PropTypes.oneOf(['day', 'month', 'year']),
|
|
378
375
|
|
|
379
|
-
/**
|
|
380
|
-
* Get aria-label text for switching between views button.
|
|
381
|
-
* @param {CalendarPickerView} currentView The view from which we want to get the button text.
|
|
382
|
-
* @returns {string} The label of the view.
|
|
383
|
-
* @deprecated Use the `localeText` prop of `LocalizationProvider` instead, see https://mui.com/x/react-date-pickers/localization
|
|
384
|
-
*/
|
|
385
|
-
getViewSwitchingButtonText: PropTypes.func,
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Left arrow icon aria-label text.
|
|
389
|
-
* @deprecated
|
|
390
|
-
*/
|
|
391
|
-
leftArrowButtonText: PropTypes.string,
|
|
392
|
-
|
|
393
376
|
/**
|
|
394
377
|
* If `true` renders `LoadingComponent` in calendar instead of calendar view.
|
|
395
378
|
* Can be used to preload information and show it in calendar.
|
|
@@ -469,12 +452,6 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
469
452
|
*/
|
|
470
453
|
renderLoading: PropTypes.func,
|
|
471
454
|
|
|
472
|
-
/**
|
|
473
|
-
* Right arrow icon aria-label text.
|
|
474
|
-
* @deprecated
|
|
475
|
-
*/
|
|
476
|
-
rightArrowButtonText: PropTypes.string,
|
|
477
|
-
|
|
478
455
|
/**
|
|
479
456
|
* Disable specific date. @DateIOType
|
|
480
457
|
* @template TDate
|
|
@@ -507,6 +484,12 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
507
484
|
*/
|
|
508
485
|
showDaysOutsideCurrentMonth: PropTypes.bool,
|
|
509
486
|
|
|
487
|
+
/**
|
|
488
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
489
|
+
*/
|
|
490
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
491
|
+
value: PropTypes.any,
|
|
492
|
+
|
|
510
493
|
/**
|
|
511
494
|
* Controlled open view.
|
|
512
495
|
*/
|
|
@@ -8,7 +8,7 @@ import { PickersDay } from '../PickersDay/PickersDay';
|
|
|
8
8
|
import { useUtils, useNow } from '../internals/hooks/useUtils';
|
|
9
9
|
import { DAY_SIZE, DAY_MARGIN } from '../internals/constants/dimensions';
|
|
10
10
|
import { PickersSlideTransition } from './PickersSlideTransition';
|
|
11
|
-
import {
|
|
11
|
+
import { useIsDateDisabled } from '../internals/hooks/validation/useDateValidation';
|
|
12
12
|
import { findClosestEnabledDate } from '../internals/utils/date-utils';
|
|
13
13
|
import { getDayPickerUtilityClass } from './dayPickerClasses';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -128,13 +128,17 @@ export function DayPicker(inProps) {
|
|
|
128
128
|
minDate,
|
|
129
129
|
maxDate,
|
|
130
130
|
shouldDisableDate,
|
|
131
|
+
shouldDisableMonth,
|
|
132
|
+
shouldDisableYear,
|
|
131
133
|
dayOfWeekFormatter = defaultDayOfWeekFormatter,
|
|
132
134
|
hasFocus,
|
|
133
135
|
onFocusedViewChange,
|
|
134
136
|
gridLabelId
|
|
135
137
|
} = props;
|
|
136
|
-
const isDateDisabled =
|
|
138
|
+
const isDateDisabled = useIsDateDisabled({
|
|
137
139
|
shouldDisableDate,
|
|
140
|
+
shouldDisableMonth,
|
|
141
|
+
shouldDisableYear,
|
|
138
142
|
minDate,
|
|
139
143
|
maxDate,
|
|
140
144
|
disablePast,
|
|
@@ -9,7 +9,6 @@ import { PickersFadeTransitionGroup } from './PickersFadeTransitionGroup';
|
|
|
9
9
|
import { ArrowDropDown } from '../internals/components/icons';
|
|
10
10
|
import { PickersArrowSwitcher } from '../internals/components/PickersArrowSwitcher';
|
|
11
11
|
import { usePreviousMonthDisabled, useNextMonthDisabled } from '../internals/hooks/date-helpers-hooks';
|
|
12
|
-
import { buildDeprecatedPropsWarning } from '../internals/utils/warning';
|
|
13
12
|
import { getPickersCalendarHeaderUtilityClass } from './pickersCalendarHeaderClasses';
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -87,7 +86,6 @@ const PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDown, {
|
|
|
87
86
|
}, ownerState.openView === 'year' && {
|
|
88
87
|
transform: 'rotate(180deg)'
|
|
89
88
|
}));
|
|
90
|
-
const deprecatedPropsWarning = buildDeprecatedPropsWarning('Props for translation are deprecated. See https://mui.com/x/react-date-pickers/localization for more information.');
|
|
91
89
|
/**
|
|
92
90
|
* @ignore - do not document.
|
|
93
91
|
*/
|
|
@@ -104,27 +102,16 @@ export function PickersCalendarHeader(inProps) {
|
|
|
104
102
|
disabled,
|
|
105
103
|
disableFuture,
|
|
106
104
|
disablePast,
|
|
107
|
-
getViewSwitchingButtonText: getViewSwitchingButtonTextProp,
|
|
108
|
-
leftArrowButtonText: leftArrowButtonTextProp,
|
|
109
105
|
maxDate,
|
|
110
106
|
minDate,
|
|
111
107
|
onMonthChange,
|
|
112
108
|
onViewChange,
|
|
113
109
|
openView: currentView,
|
|
114
110
|
reduceAnimations,
|
|
115
|
-
rightArrowButtonText: rightArrowButtonTextProp,
|
|
116
111
|
views,
|
|
117
112
|
labelId
|
|
118
113
|
} = props;
|
|
119
|
-
deprecatedPropsWarning({
|
|
120
|
-
leftArrowButtonText: leftArrowButtonTextProp,
|
|
121
|
-
rightArrowButtonText: rightArrowButtonTextProp,
|
|
122
|
-
getViewSwitchingButtonText: getViewSwitchingButtonTextProp
|
|
123
|
-
});
|
|
124
114
|
const localeText = useLocaleText();
|
|
125
|
-
const leftArrowButtonText = leftArrowButtonTextProp ?? localeText.previousMonth;
|
|
126
|
-
const rightArrowButtonText = rightArrowButtonTextProp ?? localeText.nextMonth;
|
|
127
|
-
const getViewSwitchingButtonText = getViewSwitchingButtonTextProp ?? localeText.calendarViewSwitchingButtonAriaLabel;
|
|
128
115
|
const utils = useUtils();
|
|
129
116
|
const classes = useUtilityClasses(props);
|
|
130
117
|
const switchViewButtonProps = componentsProps.switchViewButton || {};
|
|
@@ -184,7 +171,7 @@ export function PickersCalendarHeader(inProps) {
|
|
|
184
171
|
}), views.length > 1 && !disabled && /*#__PURE__*/_jsx(PickersCalendarHeaderSwitchViewButton, _extends({
|
|
185
172
|
size: "small",
|
|
186
173
|
as: components.SwitchViewButton,
|
|
187
|
-
"aria-label":
|
|
174
|
+
"aria-label": localeText.calendarViewSwitchingButtonAriaLabel(currentView),
|
|
188
175
|
className: classes.switchViewButton
|
|
189
176
|
}, switchViewButtonProps, {
|
|
190
177
|
children: /*#__PURE__*/_jsx(PickersCalendarHeaderSwitchViewIcon, {
|
|
@@ -196,14 +183,14 @@ export function PickersCalendarHeader(inProps) {
|
|
|
196
183
|
}), /*#__PURE__*/_jsx(Fade, {
|
|
197
184
|
in: currentView === 'day',
|
|
198
185
|
children: /*#__PURE__*/_jsx(PickersArrowSwitcher, {
|
|
199
|
-
leftArrowButtonText: leftArrowButtonText,
|
|
200
|
-
rightArrowButtonText: rightArrowButtonText,
|
|
201
186
|
components: components,
|
|
202
187
|
componentsProps: componentsProps,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
188
|
+
onGoToPrevious: selectPreviousMonth,
|
|
189
|
+
isPreviousDisabled: isPreviousMonthDisabled,
|
|
190
|
+
previousLabel: localeText.previousMonth,
|
|
191
|
+
onGoToNext: selectNextMonth,
|
|
192
|
+
isNextDisabled: isNextMonthDisabled,
|
|
193
|
+
nextLabel: localeText.nextMonth
|
|
207
194
|
})
|
|
208
195
|
})]
|
|
209
196
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useIsDateDisabled } from '../internals/hooks/validation/useDateValidation';
|
|
4
4
|
import { useUtils, useNow } from '../internals/hooks/useUtils';
|
|
5
5
|
export const createCalendarStateReducer = (reduceAnimations, disableSwitchToMonthOnDayFocus, utils) => (state, action) => {
|
|
6
6
|
switch (action.type) {
|
|
@@ -36,7 +36,7 @@ export const createCalendarStateReducer = (reduceAnimations, disableSwitchToMont
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
export const useCalendarState = ({
|
|
39
|
-
|
|
39
|
+
value,
|
|
40
40
|
defaultCalendarMonth,
|
|
41
41
|
disableFuture,
|
|
42
42
|
disablePast,
|
|
@@ -52,8 +52,8 @@ export const useCalendarState = ({
|
|
|
52
52
|
const reducerFn = React.useRef(createCalendarStateReducer(Boolean(reduceAnimations), disableSwitchToMonthOnDayFocus, utils)).current;
|
|
53
53
|
const [calendarState, dispatch] = React.useReducer(reducerFn, {
|
|
54
54
|
isMonthSwitchingAnimating: false,
|
|
55
|
-
focusedDay:
|
|
56
|
-
currentMonth: utils.startOfMonth(
|
|
55
|
+
focusedDay: value || now,
|
|
56
|
+
currentMonth: utils.startOfMonth(value ?? defaultCalendarMonth ?? now),
|
|
57
57
|
slideDirection: 'left'
|
|
58
58
|
});
|
|
59
59
|
const handleChangeMonth = React.useCallback(payload => {
|
|
@@ -66,7 +66,7 @@ export const useCalendarState = ({
|
|
|
66
66
|
}
|
|
67
67
|
}, [onMonthChange]);
|
|
68
68
|
const changeMonth = React.useCallback(newDate => {
|
|
69
|
-
const newDateRequested = newDate
|
|
69
|
+
const newDateRequested = newDate;
|
|
70
70
|
|
|
71
71
|
if (utils.isSameMonth(newDateRequested, calendarState.currentMonth)) {
|
|
72
72
|
return;
|
|
@@ -76,8 +76,8 @@ export const useCalendarState = ({
|
|
|
76
76
|
newMonth: utils.startOfMonth(newDateRequested),
|
|
77
77
|
direction: utils.isAfterDay(newDateRequested, calendarState.currentMonth) ? 'left' : 'right'
|
|
78
78
|
});
|
|
79
|
-
}, [calendarState.currentMonth, handleChangeMonth,
|
|
80
|
-
const isDateDisabled =
|
|
79
|
+
}, [calendarState.currentMonth, handleChangeMonth, utils]);
|
|
80
|
+
const isDateDisabled = useIsDateDisabled({
|
|
81
81
|
shouldDisableDate,
|
|
82
82
|
minDate,
|
|
83
83
|
maxDate,
|
|
@@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography';
|
|
|
6
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import { unstable_useEnhancedEffect as useEnhancedEffect, unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
8
8
|
import { ClockPointer } from './ClockPointer';
|
|
9
|
-
import { useUtils } from '../internals/hooks/useUtils';
|
|
9
|
+
import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
|
|
10
10
|
import { WrapperVariantContext } from '../internals/components/wrappers/WrapperVariantContext';
|
|
11
11
|
import { getHours, getMinutes } from './shared';
|
|
12
12
|
import { getClockUtilityClass } from './clockClasses';
|
|
@@ -155,8 +155,7 @@ export function Clock(inProps) {
|
|
|
155
155
|
ampmInClock,
|
|
156
156
|
autoFocus,
|
|
157
157
|
children,
|
|
158
|
-
|
|
159
|
-
getClockLabelText,
|
|
158
|
+
value,
|
|
160
159
|
handleMeridiemChange,
|
|
161
160
|
isTimeDisabled,
|
|
162
161
|
meridiemMode,
|
|
@@ -164,18 +163,19 @@ export function Clock(inProps) {
|
|
|
164
163
|
onChange,
|
|
165
164
|
selectedId,
|
|
166
165
|
type,
|
|
167
|
-
|
|
166
|
+
viewValue,
|
|
168
167
|
disabled,
|
|
169
168
|
readOnly,
|
|
170
169
|
className
|
|
171
170
|
} = props;
|
|
172
171
|
const ownerState = props;
|
|
173
172
|
const utils = useUtils();
|
|
173
|
+
const localeText = useLocaleText();
|
|
174
174
|
const wrapperVariant = React.useContext(WrapperVariantContext);
|
|
175
175
|
const isMoving = React.useRef(false);
|
|
176
176
|
const classes = useUtilityClasses(ownerState);
|
|
177
|
-
const isSelectedTimeDisabled = isTimeDisabled(
|
|
178
|
-
const isPointerInner = !ampm && type === 'hours' && (
|
|
177
|
+
const isSelectedTimeDisabled = isTimeDisabled(viewValue, type);
|
|
178
|
+
const isPointerInner = !ampm && type === 'hours' && (viewValue < 1 || viewValue > 12);
|
|
179
179
|
|
|
180
180
|
const handleValueChange = (newValue, isFinish) => {
|
|
181
181
|
if (disabled || readOnly) {
|
|
@@ -237,8 +237,8 @@ export function Clock(inProps) {
|
|
|
237
237
|
return true;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
return
|
|
241
|
-
}, [type,
|
|
240
|
+
return viewValue % 5 === 0;
|
|
241
|
+
}, [type, viewValue]);
|
|
242
242
|
const keyboardControlStep = type === 'minutes' ? minutesStep : 1;
|
|
243
243
|
const listboxRef = React.useRef(null); // Since this is rendered when a Popper is opened we can't use passive effects.
|
|
244
244
|
// Focusing in passive effects in Popper causes scroll jump.
|
|
@@ -269,12 +269,12 @@ export function Clock(inProps) {
|
|
|
269
269
|
break;
|
|
270
270
|
|
|
271
271
|
case 'ArrowUp':
|
|
272
|
-
handleValueChange(
|
|
272
|
+
handleValueChange(viewValue + keyboardControlStep, 'partial');
|
|
273
273
|
event.preventDefault();
|
|
274
274
|
break;
|
|
275
275
|
|
|
276
276
|
case 'ArrowDown':
|
|
277
|
-
handleValueChange(
|
|
277
|
+
handleValueChange(viewValue - keyboardControlStep, 'partial');
|
|
278
278
|
event.preventDefault();
|
|
279
279
|
break;
|
|
280
280
|
|
|
@@ -299,15 +299,15 @@ export function Clock(inProps) {
|
|
|
299
299
|
}), !isSelectedTimeDisabled && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
300
300
|
children: [/*#__PURE__*/_jsx(ClockPin, {
|
|
301
301
|
className: classes.pin
|
|
302
|
-
}),
|
|
302
|
+
}), value != null && /*#__PURE__*/_jsx(ClockPointer, {
|
|
303
303
|
type: type,
|
|
304
|
-
|
|
304
|
+
viewValue: viewValue,
|
|
305
305
|
isInner: isPointerInner,
|
|
306
306
|
hasSelected: hasSelected
|
|
307
307
|
})]
|
|
308
308
|
}), /*#__PURE__*/_jsx(ClockWrapper, {
|
|
309
309
|
"aria-activedescendant": selectedId,
|
|
310
|
-
"aria-label":
|
|
310
|
+
"aria-label": localeText.clockLabelText(type, value, utils),
|
|
311
311
|
ref: listboxRef,
|
|
312
312
|
role: "listbox",
|
|
313
313
|
onKeyDown: handleKeyDown,
|
|
@@ -7,13 +7,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
7
|
*/
|
|
8
8
|
export const getHourNumbers = ({
|
|
9
9
|
ampm,
|
|
10
|
-
|
|
10
|
+
value,
|
|
11
11
|
getClockNumberText,
|
|
12
12
|
isDisabled,
|
|
13
13
|
selectedId,
|
|
14
14
|
utils
|
|
15
15
|
}) => {
|
|
16
|
-
const currentHours =
|
|
16
|
+
const currentHours = value ? utils.getHours(value) : null;
|
|
17
17
|
const hourNumbers = [];
|
|
18
18
|
const startHour = ampm ? 1 : 0;
|
|
19
19
|
const endHour = ampm ? 12 : 23;
|