@mui/x-date-pickers 6.18.0 → 7.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/AdapterLuxon/AdapterLuxon.js +13 -3
- package/CHANGELOG.md +212 -5
- package/DateCalendar/DateCalendar.js +4 -20
- package/DateCalendar/DateCalendar.types.d.ts +12 -3
- package/DateCalendar/DayCalendar.d.ts +12 -3
- package/DateCalendar/DayCalendar.js +3 -5
- package/DateCalendar/useCalendarState.js +2 -3
- package/DateField/DateField.js +5 -21
- package/DateField/DateField.types.d.ts +12 -3
- package/DatePicker/DatePicker.js +0 -12
- package/DatePicker/DatePicker.types.d.ts +1 -14
- package/DatePicker/shared.d.ts +3 -15
- package/DatePicker/shared.js +2 -5
- package/DateTimeField/DateTimeField.js +5 -21
- package/DateTimeField/DateTimeField.types.d.ts +2 -15
- package/DateTimePicker/DateTimePicker.js +0 -12
- package/DateTimePicker/DateTimePicker.types.d.ts +1 -14
- package/DateTimePicker/shared.d.ts +3 -16
- package/DateTimePicker/shared.js +4 -7
- package/DesktopDatePicker/DesktopDatePicker.js +0 -12
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +2 -15
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -12
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +2 -15
- package/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -15
- package/DigitalClock/DigitalClock.js +15 -24
- package/DigitalClock/DigitalClock.types.d.ts +2 -15
- package/MobileDatePicker/MobileDatePicker.js +0 -12
- package/MobileDatePicker/MobileDatePicker.types.d.ts +2 -15
- package/MobileDateTimePicker/MobileDateTimePicker.js +0 -12
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +2 -15
- package/MobileTimePicker/MobileTimePicker.js +0 -12
- package/MobileTimePicker/MobileTimePicker.types.d.ts +2 -15
- package/MonthCalendar/MonthCalendar.js +3 -7
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -18
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +3 -15
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +2 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +16 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +1 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -10
- package/PickersCalendarHeader/PickersCalendarHeader.js +4 -17
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -16
- package/PickersLayout/PickersLayout.js +0 -12
- package/PickersLayout/PickersLayout.types.d.ts +6 -19
- package/PickersLayout/usePickerLayout.js +2 -7
- package/StaticDatePicker/StaticDatePicker.js +0 -12
- package/StaticDatePicker/StaticDatePicker.types.d.ts +2 -14
- package/StaticDateTimePicker/StaticDateTimePicker.js +0 -12
- package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +2 -14
- package/StaticTimePicker/StaticTimePicker.js +0 -12
- package/StaticTimePicker/StaticTimePicker.types.d.ts +2 -14
- package/TimeClock/TimeClock.js +3 -20
- package/TimeClock/TimeClock.types.d.ts +1 -14
- package/TimeField/TimeField.js +5 -21
- package/TimeField/TimeField.types.d.ts +2 -15
- package/TimePicker/TimePicker.js +0 -12
- package/TimePicker/TimePicker.types.d.ts +1 -14
- package/TimePicker/shared.d.ts +2 -15
- package/TimePicker/shared.js +4 -7
- package/YearCalendar/YearCalendar.js +3 -7
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +2 -2
- package/dateTimeViewRenderers/dateTimeViewRenderers.js +2 -8
- package/dateViewRenderers/dateViewRenderers.d.ts +1 -1
- package/dateViewRenderers/dateViewRenderers.js +0 -4
- package/hooks/useClearableField.d.ts +1 -3
- package/hooks/useClearableField.js +6 -8
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +5 -6
- package/internals/components/PickersModalDialog.d.ts +4 -5
- package/internals/components/PickersPopper.d.ts +5 -6
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +7 -8
- package/internals/hooks/useField/useField.types.d.ts +2 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +3 -4
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +1 -14
- package/internals/hooks/useViews.js +2 -1
- package/internals/index.d.ts +0 -2
- package/internals/index.js +0 -1
- package/legacy/AdapterLuxon/AdapterLuxon.js +13 -3
- package/legacy/DateCalendar/DateCalendar.js +4 -20
- package/legacy/DateCalendar/DayCalendar.js +3 -5
- package/legacy/DateCalendar/useCalendarState.js +2 -3
- package/legacy/DateField/DateField.js +6 -22
- package/legacy/DatePicker/DatePicker.js +0 -12
- package/legacy/DatePicker/shared.js +2 -5
- package/legacy/DateTimeField/DateTimeField.js +6 -22
- package/legacy/DateTimePicker/DateTimePicker.js +0 -12
- package/legacy/DateTimePicker/shared.js +4 -7
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -12
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -12
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/legacy/DigitalClock/DigitalClock.js +17 -24
- package/legacy/MobileDatePicker/MobileDatePicker.js +0 -12
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -12
- package/legacy/MobileTimePicker/MobileTimePicker.js +0 -12
- package/legacy/MonthCalendar/MonthCalendar.js +3 -6
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +11 -18
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +16 -6
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +15 -10
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +4 -18
- package/legacy/PickersLayout/PickersLayout.js +0 -12
- package/legacy/PickersLayout/usePickerLayout.js +2 -7
- package/legacy/StaticDatePicker/StaticDatePicker.js +0 -12
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -12
- package/legacy/StaticTimePicker/StaticTimePicker.js +0 -12
- package/legacy/TimeClock/TimeClock.js +3 -20
- package/legacy/TimeField/TimeField.js +5 -21
- package/legacy/TimePicker/TimePicker.js +0 -12
- package/legacy/TimePicker/shared.js +4 -7
- package/legacy/YearCalendar/YearCalendar.js +3 -6
- package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +2 -8
- package/legacy/dateViewRenderers/dateViewRenderers.js +0 -4
- package/legacy/hooks/useClearableField.js +6 -8
- package/legacy/index.js +1 -1
- package/legacy/internals/hooks/useViews.js +2 -1
- package/legacy/internals/index.js +0 -1
- package/legacy/locales/esES.js +6 -7
- package/legacy/locales/eu.js +94 -0
- package/legacy/locales/index.js +1 -0
- package/legacy/timeViewRenderers/timeViewRenderers.js +0 -12
- package/locales/esES.js +6 -7
- package/locales/eu.d.ts +54 -0
- package/locales/eu.js +58 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/modern/AdapterLuxon/AdapterLuxon.js +13 -3
- package/modern/DateCalendar/DateCalendar.js +3 -19
- package/modern/DateCalendar/DayCalendar.js +2 -4
- package/modern/DateCalendar/useCalendarState.js +2 -3
- package/modern/DateField/DateField.js +4 -20
- package/modern/DatePicker/DatePicker.js +0 -12
- package/modern/DatePicker/shared.js +1 -4
- package/modern/DateTimeField/DateTimeField.js +4 -20
- package/modern/DateTimePicker/DateTimePicker.js +0 -12
- package/modern/DateTimePicker/shared.js +3 -6
- package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -12
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -12
- package/modern/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/modern/DigitalClock/DigitalClock.js +14 -23
- package/modern/MobileDatePicker/MobileDatePicker.js +0 -12
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -12
- package/modern/MobileTimePicker/MobileTimePicker.js +0 -12
- package/modern/MonthCalendar/MonthCalendar.js +3 -7
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -18
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +16 -6
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -10
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +3 -16
- package/modern/PickersLayout/PickersLayout.js +0 -12
- package/modern/PickersLayout/usePickerLayout.js +2 -7
- package/modern/StaticDatePicker/StaticDatePicker.js +0 -12
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -12
- package/modern/StaticTimePicker/StaticTimePicker.js +0 -12
- package/modern/TimeClock/TimeClock.js +3 -20
- package/modern/TimeField/TimeField.js +4 -20
- package/modern/TimePicker/TimePicker.js +0 -12
- package/modern/TimePicker/shared.js +3 -6
- package/modern/YearCalendar/YearCalendar.js +3 -7
- package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +1 -7
- package/modern/dateViewRenderers/dateViewRenderers.js +0 -4
- package/modern/hooks/useClearableField.js +5 -7
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useViews.js +2 -1
- package/modern/internals/index.js +0 -1
- package/modern/locales/esES.js +6 -7
- package/modern/locales/eu.js +58 -0
- package/modern/locales/index.js +1 -0
- package/modern/timeViewRenderers/timeViewRenderers.js +0 -12
- package/node/AdapterLuxon/AdapterLuxon.js +13 -3
- package/node/DateCalendar/DateCalendar.js +3 -19
- package/node/DateCalendar/DayCalendar.js +2 -4
- package/node/DateCalendar/useCalendarState.js +1 -2
- package/node/DateField/DateField.js +4 -20
- package/node/DatePicker/DatePicker.js +0 -12
- package/node/DatePicker/shared.js +1 -4
- package/node/DateTimeField/DateTimeField.js +4 -20
- package/node/DateTimePicker/DateTimePicker.js +0 -12
- package/node/DateTimePicker/shared.js +3 -6
- package/node/DesktopDatePicker/DesktopDatePicker.js +0 -12
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -12
- package/node/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/node/DigitalClock/DigitalClock.js +14 -23
- package/node/MobileDatePicker/MobileDatePicker.js +0 -12
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -12
- package/node/MobileTimePicker/MobileTimePicker.js +0 -12
- package/node/MonthCalendar/MonthCalendar.js +3 -7
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -18
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +16 -6
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -10
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +3 -16
- package/node/PickersLayout/PickersLayout.js +0 -12
- package/node/PickersLayout/usePickerLayout.js +2 -7
- package/node/StaticDatePicker/StaticDatePicker.js +0 -12
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -12
- package/node/StaticTimePicker/StaticTimePicker.js +0 -12
- package/node/TimeClock/TimeClock.js +3 -20
- package/node/TimeField/TimeField.js +4 -20
- package/node/TimePicker/TimePicker.js +0 -12
- package/node/TimePicker/shared.js +3 -6
- package/node/YearCalendar/YearCalendar.js +3 -7
- package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +1 -7
- package/node/dateViewRenderers/dateViewRenderers.js +0 -4
- package/node/hooks/useClearableField.js +5 -7
- package/node/index.js +1 -1
- package/node/internals/hooks/useViews.js +2 -1
- package/node/internals/index.js +0 -7
- package/node/locales/esES.js +6 -7
- package/node/locales/eu.js +64 -0
- package/node/locales/index.js +11 -0
- package/node/timeViewRenderers/timeViewRenderers.js +0 -12
- package/package.json +1 -1
- package/timeViewRenderers/timeViewRenderers.d.ts +3 -3
- package/timeViewRenderers/timeViewRenderers.js +0 -12
- package/internals/utils/slots-migration.d.ts +0 -36
- package/internals/utils/slots-migration.js +0 -13
- package/legacy/internals/utils/slots-migration.js +0 -14
- package/modern/internals/utils/slots-migration.js +0 -13
- package/node/internals/utils/slots-migration.js +0 -21
|
@@ -81,18 +81,6 @@ MobileDatePicker.propTypes = {
|
|
|
81
81
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
82
82
|
*/
|
|
83
83
|
closeOnSelect: PropTypes.bool,
|
|
84
|
-
/**
|
|
85
|
-
* Overridable components.
|
|
86
|
-
* @default {}
|
|
87
|
-
* @deprecated Please use `slots`.
|
|
88
|
-
*/
|
|
89
|
-
components: PropTypes.object,
|
|
90
|
-
/**
|
|
91
|
-
* The props used for each component slot.
|
|
92
|
-
* @default {}
|
|
93
|
-
* @deprecated Please use `slotProps`.
|
|
94
|
-
*/
|
|
95
|
-
componentsProps: PropTypes.object,
|
|
96
84
|
/**
|
|
97
85
|
* Formats the day of week displayed in the calendar header.
|
|
98
86
|
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
@@ -102,18 +102,6 @@ MobileDateTimePicker.propTypes = {
|
|
|
102
102
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
103
103
|
*/
|
|
104
104
|
closeOnSelect: PropTypes.bool,
|
|
105
|
-
/**
|
|
106
|
-
* Overridable components.
|
|
107
|
-
* @default {}
|
|
108
|
-
* @deprecated Please use `slots`.
|
|
109
|
-
*/
|
|
110
|
-
components: PropTypes.object,
|
|
111
|
-
/**
|
|
112
|
-
* The props used for each component slot.
|
|
113
|
-
* @default {}
|
|
114
|
-
* @deprecated Please use `slotProps`.
|
|
115
|
-
*/
|
|
116
|
-
componentsProps: PropTypes.object,
|
|
117
105
|
/**
|
|
118
106
|
* Formats the day of week displayed in the calendar header.
|
|
119
107
|
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
@@ -95,18 +95,6 @@ MobileTimePicker.propTypes = {
|
|
|
95
95
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
96
96
|
*/
|
|
97
97
|
closeOnSelect: PropTypes.bool,
|
|
98
|
-
/**
|
|
99
|
-
* Overridable components.
|
|
100
|
-
* @default {}
|
|
101
|
-
* @deprecated Please use `slots`.
|
|
102
|
-
*/
|
|
103
|
-
components: PropTypes.object,
|
|
104
|
-
/**
|
|
105
|
-
* The props used for each component slot.
|
|
106
|
-
* @default {}
|
|
107
|
-
* @deprecated Please use `slotProps`.
|
|
108
|
-
*/
|
|
109
|
-
componentsProps: PropTypes.object,
|
|
110
98
|
/**
|
|
111
99
|
* The default value.
|
|
112
100
|
* Used when the component is not controlled.
|
|
@@ -77,7 +77,6 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
77
77
|
onChange,
|
|
78
78
|
shouldDisableMonth,
|
|
79
79
|
readOnly,
|
|
80
|
-
disableHighlightToday,
|
|
81
80
|
autoFocus = false,
|
|
82
81
|
onMonthFocus,
|
|
83
82
|
hasFocus,
|
|
@@ -119,12 +118,9 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
119
118
|
if (value != null) {
|
|
120
119
|
return utils.getMonth(value);
|
|
121
120
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return utils.getMonth(referenceDate);
|
|
126
|
-
}, [value, utils, disableHighlightToday, referenceDate]);
|
|
127
|
-
const [focusedMonth, setFocusedMonth] = React.useState(() => selectedMonth || todayMonth);
|
|
121
|
+
return null;
|
|
122
|
+
}, [value, utils]);
|
|
123
|
+
const [focusedMonth, setFocusedMonth] = React.useState(() => selectedMonth || utils.getMonth(referenceDate));
|
|
128
124
|
const [internalHasFocus, setInternalHasFocus] = useControlled({
|
|
129
125
|
name: 'MonthCalendar',
|
|
130
126
|
state: 'hasFocus',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["ampm", "timeSteps", "autoFocus", "
|
|
3
|
+
const _excluded = ["ampm", "timeSteps", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "skipDisabled", "timezone"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -61,8 +61,6 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
61
61
|
ampm = utils.is12HourCycleInCurrentLocale(),
|
|
62
62
|
timeSteps: inTimeSteps,
|
|
63
63
|
autoFocus,
|
|
64
|
-
components,
|
|
65
|
-
componentsProps,
|
|
66
64
|
slots,
|
|
67
65
|
slotProps,
|
|
68
66
|
value: valueProp,
|
|
@@ -242,7 +240,8 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
242
240
|
utils,
|
|
243
241
|
isDisabled: hours => disabled || isTimeDisabled(hours, 'hours'),
|
|
244
242
|
timeStep: timeSteps.hours,
|
|
245
|
-
resolveAriaLabel: localeText.hoursClockNumberText
|
|
243
|
+
resolveAriaLabel: localeText.hoursClockNumberText,
|
|
244
|
+
valueOrReferenceDate
|
|
246
245
|
})
|
|
247
246
|
};
|
|
248
247
|
}
|
|
@@ -288,11 +287,13 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
288
287
|
value: 'am',
|
|
289
288
|
label: amLabel,
|
|
290
289
|
isSelected: () => !!value && meridiemMode === 'am',
|
|
290
|
+
isFocused: () => !!valueOrReferenceDate && meridiemMode === 'am',
|
|
291
291
|
ariaLabel: amLabel
|
|
292
292
|
}, {
|
|
293
293
|
value: 'pm',
|
|
294
294
|
label: pmLabel,
|
|
295
295
|
isSelected: () => !!value && meridiemMode === 'pm',
|
|
296
|
+
isFocused: () => !!valueOrReferenceDate && meridiemMode === 'pm',
|
|
296
297
|
ariaLabel: pmLabel
|
|
297
298
|
}]
|
|
298
299
|
};
|
|
@@ -323,8 +324,8 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
323
324
|
autoFocus: autoFocus ?? focusedView === timeView,
|
|
324
325
|
disabled: disabled,
|
|
325
326
|
readOnly: readOnly,
|
|
326
|
-
slots: slots
|
|
327
|
-
slotProps: slotProps
|
|
327
|
+
slots: slots,
|
|
328
|
+
slotProps: slotProps,
|
|
328
329
|
skipDisabled: skipDisabled,
|
|
329
330
|
"aria-label": localeText.selectViewText(timeView)
|
|
330
331
|
}, timeView))
|
|
@@ -352,18 +353,6 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
|
|
|
352
353
|
*/
|
|
353
354
|
classes: PropTypes.object,
|
|
354
355
|
className: PropTypes.string,
|
|
355
|
-
/**
|
|
356
|
-
* Overrideable components.
|
|
357
|
-
* @default {}
|
|
358
|
-
* @deprecated Please use `slots`.
|
|
359
|
-
*/
|
|
360
|
-
components: PropTypes.object,
|
|
361
|
-
/**
|
|
362
|
-
* The props used for each component slot.
|
|
363
|
-
* @default {}
|
|
364
|
-
* @deprecated Please use `slotProps`.
|
|
365
|
-
*/
|
|
366
|
-
componentsProps: PropTypes.object,
|
|
367
356
|
/**
|
|
368
357
|
* The default selected value.
|
|
369
358
|
* Used when the component is not controlled.
|
|
@@ -5,21 +5,26 @@ export const getHourSectionOptions = ({
|
|
|
5
5
|
ampm,
|
|
6
6
|
isDisabled,
|
|
7
7
|
resolveAriaLabel,
|
|
8
|
-
timeStep
|
|
8
|
+
timeStep,
|
|
9
|
+
valueOrReferenceDate
|
|
9
10
|
}) => {
|
|
10
11
|
const currentHours = value ? utils.getHours(value) : null;
|
|
11
12
|
const result = [];
|
|
12
|
-
const isSelected = hour => {
|
|
13
|
-
|
|
13
|
+
const isSelected = (hour, overriddenCurrentHours) => {
|
|
14
|
+
const resolvedCurrentHours = overriddenCurrentHours ?? currentHours;
|
|
15
|
+
if (resolvedCurrentHours === null) {
|
|
14
16
|
return false;
|
|
15
17
|
}
|
|
16
18
|
if (ampm) {
|
|
17
19
|
if (hour === 12) {
|
|
18
|
-
return
|
|
20
|
+
return resolvedCurrentHours === 12 || resolvedCurrentHours === 0;
|
|
19
21
|
}
|
|
20
|
-
return
|
|
22
|
+
return resolvedCurrentHours === hour || resolvedCurrentHours - 12 === hour;
|
|
21
23
|
}
|
|
22
|
-
return
|
|
24
|
+
return resolvedCurrentHours === hour;
|
|
25
|
+
};
|
|
26
|
+
const isFocused = hour => {
|
|
27
|
+
return isSelected(hour, utils.getHours(valueOrReferenceDate));
|
|
23
28
|
};
|
|
24
29
|
const endHour = ampm ? 11 : 23;
|
|
25
30
|
for (let hour = 0; hour <= endHour; hour += timeStep) {
|
|
@@ -31,6 +36,7 @@ export const getHourSectionOptions = ({
|
|
|
31
36
|
label,
|
|
32
37
|
isSelected,
|
|
33
38
|
isDisabled,
|
|
39
|
+
isFocused,
|
|
34
40
|
ariaLabel
|
|
35
41
|
});
|
|
36
42
|
}
|
|
@@ -50,6 +56,9 @@ export const getTimeSectionOptions = ({
|
|
|
50
56
|
}
|
|
51
57
|
return hasValue && value === timeValue;
|
|
52
58
|
};
|
|
59
|
+
const isFocused = timeValue => {
|
|
60
|
+
return value === timeValue;
|
|
61
|
+
};
|
|
53
62
|
return [...Array.from({
|
|
54
63
|
length: Math.ceil(60 / timeStep)
|
|
55
64
|
}, (_, index) => {
|
|
@@ -59,6 +68,7 @@ export const getTimeSectionOptions = ({
|
|
|
59
68
|
label: resolveLabel(timeValue),
|
|
60
69
|
isDisabled,
|
|
61
70
|
isSelected,
|
|
71
|
+
isFocused,
|
|
62
72
|
ariaLabel: resolveAriaLabel(timeValue.toString())
|
|
63
73
|
};
|
|
64
74
|
})];
|
|
@@ -83,7 +83,7 @@ const MultiSectionDigitalClockSectionItem = styled(MenuItem, {
|
|
|
83
83
|
export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(function MultiSectionDigitalClockSection(inProps, ref) {
|
|
84
84
|
const containerRef = React.useRef(null);
|
|
85
85
|
const handleRef = useForkRef(ref, containerRef);
|
|
86
|
-
const
|
|
86
|
+
const previousActive = React.useRef(null);
|
|
87
87
|
const props = useThemeProps({
|
|
88
88
|
props: inProps,
|
|
89
89
|
name: 'MuiMultiSectionDigitalClockSection'
|
|
@@ -110,23 +110,24 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
110
110
|
if (containerRef.current === null) {
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
113
|
+
const activeItem = containerRef.current.querySelector('[role="option"][tabindex="0"], [role="option"][aria-selected="true"]');
|
|
114
|
+
if (!activeItem || previousActive.current === activeItem) {
|
|
115
115
|
// Handle setting the ref to null if the selected item is ever reset via UI
|
|
116
|
-
if (
|
|
117
|
-
|
|
116
|
+
if (previousActive.current !== activeItem) {
|
|
117
|
+
previousActive.current = activeItem;
|
|
118
118
|
}
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
previousActive.current = activeItem;
|
|
122
122
|
if (active && autoFocus) {
|
|
123
|
-
|
|
123
|
+
activeItem.focus();
|
|
124
124
|
}
|
|
125
|
-
const offsetTop =
|
|
125
|
+
const offsetTop = activeItem.offsetTop;
|
|
126
126
|
|
|
127
127
|
// Subtracting the 4px of extra margin intended for the first visible section item
|
|
128
128
|
containerRef.current.scrollTop = offsetTop - 4;
|
|
129
129
|
});
|
|
130
|
+
const focusedOptionIndex = items.findIndex(item => item.isFocused(item.value));
|
|
130
131
|
return /*#__PURE__*/_jsx(MultiSectionDigitalClockSectionRoot, _extends({
|
|
131
132
|
ref: handleRef,
|
|
132
133
|
className: clsx(classes.root, className),
|
|
@@ -134,11 +135,12 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
134
135
|
autoFocusItem: autoFocus && active,
|
|
135
136
|
role: "listbox"
|
|
136
137
|
}, other, {
|
|
137
|
-
children: items.map(option => {
|
|
138
|
+
children: items.map((option, index) => {
|
|
138
139
|
if (skipDisabled && option.isDisabled?.(option.value)) {
|
|
139
140
|
return null;
|
|
140
141
|
}
|
|
141
142
|
const isSelected = option.isSelected(option.value);
|
|
143
|
+
const tabIndex = focusedOptionIndex === index || focusedOptionIndex === -1 && index === 0 ? 0 : -1;
|
|
142
144
|
return /*#__PURE__*/_jsx(DigitalClockSectionItem, _extends({
|
|
143
145
|
onClick: () => !readOnly && onChange(option.value),
|
|
144
146
|
selected: isSelected,
|
|
@@ -149,7 +151,8 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
149
151
|
,
|
|
150
152
|
"aria-disabled": readOnly,
|
|
151
153
|
"aria-label": option.ariaLabel,
|
|
152
|
-
"aria-selected": isSelected
|
|
154
|
+
"aria-selected": isSelected,
|
|
155
|
+
tabIndex: tabIndex
|
|
153
156
|
}, slotProps?.digitalClockSectionItem, {
|
|
154
157
|
children: option.label
|
|
155
158
|
}), option.label);
|
|
@@ -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 = ["slots", "slotProps", "
|
|
3
|
+
const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
|
|
4
4
|
_excluded2 = ["ownerState"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -113,7 +113,6 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
113
113
|
const {
|
|
114
114
|
slots,
|
|
115
115
|
slotProps,
|
|
116
|
-
components,
|
|
117
116
|
currentMonth: month,
|
|
118
117
|
disabled,
|
|
119
118
|
disableFuture,
|
|
@@ -132,7 +131,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
132
131
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
133
132
|
const ownerState = props;
|
|
134
133
|
const classes = useUtilityClasses(props);
|
|
135
|
-
const SwitchViewButton = slots?.switchViewButton ??
|
|
134
|
+
const SwitchViewButton = slots?.switchViewButton ?? PickersCalendarHeaderSwitchViewButton;
|
|
136
135
|
const switchViewButtonProps = useSlotProps({
|
|
137
136
|
elementType: SwitchViewButton,
|
|
138
137
|
externalSlotProps: slotProps?.switchViewButton,
|
|
@@ -143,7 +142,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
143
142
|
ownerState,
|
|
144
143
|
className: classes.switchViewButton
|
|
145
144
|
});
|
|
146
|
-
const SwitchViewIcon = slots?.switchViewIcon ??
|
|
145
|
+
const SwitchViewIcon = slots?.switchViewIcon ?? PickersCalendarHeaderSwitchViewIcon;
|
|
147
146
|
// The spread is here to avoid this bug mui/material-ui#34056
|
|
148
147
|
const _useSlotProps = useSlotProps({
|
|
149
148
|
elementType: SwitchViewIcon,
|
|
@@ -233,18 +232,6 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
|
|
|
233
232
|
* className applied to the root element.
|
|
234
233
|
*/
|
|
235
234
|
className: PropTypes.string,
|
|
236
|
-
/**
|
|
237
|
-
* Overridable components.
|
|
238
|
-
* @default {}
|
|
239
|
-
* @deprecated Please use `slots`.
|
|
240
|
-
*/
|
|
241
|
-
components: PropTypes.object,
|
|
242
|
-
/**
|
|
243
|
-
* The props used for each component slot.
|
|
244
|
-
* @default {}
|
|
245
|
-
* @deprecated Please use `slotProps`.
|
|
246
|
-
*/
|
|
247
|
-
componentsProps: PropTypes.object,
|
|
248
235
|
currentMonth: PropTypes.any.isRequired,
|
|
249
236
|
disabled: PropTypes.bool,
|
|
250
237
|
disableFuture: PropTypes.bool,
|
|
@@ -124,18 +124,6 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
|
|
|
124
124
|
children: PropTypes.node,
|
|
125
125
|
classes: PropTypes.object,
|
|
126
126
|
className: PropTypes.string,
|
|
127
|
-
/**
|
|
128
|
-
* Overridable components.
|
|
129
|
-
* @default {}
|
|
130
|
-
* @deprecated Please use `slots`.
|
|
131
|
-
*/
|
|
132
|
-
components: PropTypes.object,
|
|
133
|
-
/**
|
|
134
|
-
* The props used for each component slot.
|
|
135
|
-
* @default {}
|
|
136
|
-
* @deprecated Please use `slotProps`.
|
|
137
|
-
*/
|
|
138
|
-
componentsProps: PropTypes.object,
|
|
139
127
|
disabled: PropTypes.bool,
|
|
140
128
|
isLandscape: PropTypes.bool.isRequired,
|
|
141
129
|
isValid: PropTypes.func.isRequired,
|
|
@@ -5,7 +5,6 @@ import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
|
5
5
|
import { PickersActionBar } from '../PickersActionBar';
|
|
6
6
|
import { getPickersLayoutUtilityClass } from './pickersLayoutClasses';
|
|
7
7
|
import { PickersShortcuts } from '../PickersShortcuts';
|
|
8
|
-
import { uncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
9
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
9
|
function toolbarHasView(toolbarProps) {
|
|
11
10
|
return toolbarProps.view !== null;
|
|
@@ -44,17 +43,13 @@ const usePickerLayout = props => {
|
|
|
44
43
|
disabled,
|
|
45
44
|
readOnly,
|
|
46
45
|
children,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
slots: innerSlots,
|
|
50
|
-
slotProps: innerSlotProps
|
|
46
|
+
slots,
|
|
47
|
+
slotProps
|
|
51
48
|
// TODO: Remove this "as" hack. It get introduced to mark `value` prop in PickersLayoutProps as not required.
|
|
52
49
|
// The true type should be
|
|
53
50
|
// - For pickers value: TDate | null
|
|
54
51
|
// - For range pickers value: [TDate | null, TDate | null]
|
|
55
52
|
} = props;
|
|
56
|
-
const slots = innerSlots ?? uncapitalizeObjectKeys(components);
|
|
57
|
-
const slotProps = innerSlotProps ?? componentsProps;
|
|
58
53
|
const classes = useUtilityClasses(props);
|
|
59
54
|
|
|
60
55
|
// Action bar
|
|
@@ -63,18 +63,6 @@ StaticDatePicker.propTypes = {
|
|
|
63
63
|
* Class name applied to the root element.
|
|
64
64
|
*/
|
|
65
65
|
className: PropTypes.string,
|
|
66
|
-
/**
|
|
67
|
-
* Overridable components.
|
|
68
|
-
* @default {}
|
|
69
|
-
* @deprecated Please use `slots`.
|
|
70
|
-
*/
|
|
71
|
-
components: PropTypes.object,
|
|
72
|
-
/**
|
|
73
|
-
* The props used for each component slot.
|
|
74
|
-
* @default {}
|
|
75
|
-
* @deprecated Please use `slotProps`.
|
|
76
|
-
*/
|
|
77
|
-
componentsProps: PropTypes.object,
|
|
78
66
|
/**
|
|
79
67
|
* Formats the day of week displayed in the calendar header.
|
|
80
68
|
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
@@ -83,18 +83,6 @@ StaticDateTimePicker.propTypes = {
|
|
|
83
83
|
* Class name applied to the root element.
|
|
84
84
|
*/
|
|
85
85
|
className: PropTypes.string,
|
|
86
|
-
/**
|
|
87
|
-
* Overridable components.
|
|
88
|
-
* @default {}
|
|
89
|
-
* @deprecated Please use `slots`.
|
|
90
|
-
*/
|
|
91
|
-
components: PropTypes.object,
|
|
92
|
-
/**
|
|
93
|
-
* The props used for each component slot.
|
|
94
|
-
* @default {}
|
|
95
|
-
* @deprecated Please use `slotProps`.
|
|
96
|
-
*/
|
|
97
|
-
componentsProps: PropTypes.object,
|
|
98
86
|
/**
|
|
99
87
|
* Formats the day of week displayed in the calendar header.
|
|
100
88
|
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
@@ -75,18 +75,6 @@ StaticTimePicker.propTypes = {
|
|
|
75
75
|
* Class name applied to the root element.
|
|
76
76
|
*/
|
|
77
77
|
className: PropTypes.string,
|
|
78
|
-
/**
|
|
79
|
-
* Overridable components.
|
|
80
|
-
* @default {}
|
|
81
|
-
* @deprecated Please use `slots`.
|
|
82
|
-
*/
|
|
83
|
-
components: PropTypes.object,
|
|
84
|
-
/**
|
|
85
|
-
* The props used for each component slot.
|
|
86
|
-
* @default {}
|
|
87
|
-
* @deprecated Please use `slotProps`.
|
|
88
|
-
*/
|
|
89
|
-
componentsProps: PropTypes.object,
|
|
90
78
|
/**
|
|
91
79
|
* The default value.
|
|
92
80
|
* Used when the component is not controlled.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["ampm", "ampmInClock", "autoFocus", "
|
|
3
|
+
const _excluded = ["ampm", "ampmInClock", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "showViewSwitcher", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "timezone"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -17,7 +17,6 @@ import { Clock } from './Clock';
|
|
|
17
17
|
import { getHourNumbers, getMinutesNumbers } from './ClockNumbers';
|
|
18
18
|
import { useControlledValueWithTimezone } from '../internals/hooks/useValueWithTimezone';
|
|
19
19
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
20
|
-
import { uncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
21
20
|
import { useClockReferenceDate } from '../internals/hooks/useClockReferenceDate';
|
|
22
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -71,10 +70,8 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
71
70
|
ampm = utils.is12HourCycleInCurrentLocale(),
|
|
72
71
|
ampmInClock = false,
|
|
73
72
|
autoFocus,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
slots: innerSlots,
|
|
77
|
-
slotProps: innerSlotProps,
|
|
73
|
+
slots,
|
|
74
|
+
slotProps,
|
|
78
75
|
value: valueProp,
|
|
79
76
|
defaultValue,
|
|
80
77
|
referenceDate: referenceDateProp,
|
|
@@ -100,8 +97,6 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
100
97
|
timezone: timezoneProp
|
|
101
98
|
} = props,
|
|
102
99
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
103
|
-
const slots = innerSlots ?? uncapitalizeObjectKeys(components);
|
|
104
|
-
const slotProps = innerSlotProps ?? componentsProps;
|
|
105
100
|
const {
|
|
106
101
|
value,
|
|
107
102
|
handleValueChange,
|
|
@@ -346,18 +341,6 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
346
341
|
*/
|
|
347
342
|
classes: PropTypes.object,
|
|
348
343
|
className: PropTypes.string,
|
|
349
|
-
/**
|
|
350
|
-
* Overridable components.
|
|
351
|
-
* @default {}
|
|
352
|
-
* @deprecated Please use `slots`.
|
|
353
|
-
*/
|
|
354
|
-
components: PropTypes.object,
|
|
355
|
-
/**
|
|
356
|
-
* The props used for each component slot.
|
|
357
|
-
* @default {}
|
|
358
|
-
* @deprecated Please use `slotProps`.
|
|
359
|
-
*/
|
|
360
|
-
componentsProps: PropTypes.object,
|
|
361
344
|
/**
|
|
362
345
|
* The default selected value.
|
|
363
346
|
* Used when the component is not controlled.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["slots", "slotProps", "
|
|
3
|
+
const _excluded = ["slots", "slotProps", "InputProps", "inputProps"],
|
|
4
4
|
_excluded2 = ["inputRef"],
|
|
5
5
|
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
|
|
6
6
|
import * as React from 'react';
|
|
@@ -30,17 +30,15 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, ref)
|
|
|
30
30
|
const {
|
|
31
31
|
slots,
|
|
32
32
|
slotProps,
|
|
33
|
-
components,
|
|
34
|
-
componentsProps,
|
|
35
33
|
InputProps,
|
|
36
34
|
inputProps
|
|
37
35
|
} = themeProps,
|
|
38
36
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
39
37
|
const ownerState = themeProps;
|
|
40
|
-
const TextField = slots?.textField ??
|
|
38
|
+
const TextField = slots?.textField ?? MuiTextField;
|
|
41
39
|
const _useSlotProps = useSlotProps({
|
|
42
40
|
elementType: TextField,
|
|
43
|
-
externalSlotProps: slotProps?.textField
|
|
41
|
+
externalSlotProps: slotProps?.textField,
|
|
44
42
|
externalForwardedProps: other,
|
|
45
43
|
ownerState
|
|
46
44
|
}),
|
|
@@ -75,9 +73,7 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, ref)
|
|
|
75
73
|
fieldProps,
|
|
76
74
|
InputProps: fieldProps.InputProps,
|
|
77
75
|
slots,
|
|
78
|
-
slotProps
|
|
79
|
-
components,
|
|
80
|
-
componentsProps
|
|
76
|
+
slotProps
|
|
81
77
|
});
|
|
82
78
|
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
83
79
|
ref: ref
|
|
@@ -122,18 +118,6 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
122
118
|
*/
|
|
123
119
|
color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
|
124
120
|
component: PropTypes.elementType,
|
|
125
|
-
/**
|
|
126
|
-
* Overridable components.
|
|
127
|
-
* @default {}
|
|
128
|
-
* @deprecated Please use `slots`.
|
|
129
|
-
*/
|
|
130
|
-
components: PropTypes.object,
|
|
131
|
-
/**
|
|
132
|
-
* The props used for each component slot.
|
|
133
|
-
* @default {}
|
|
134
|
-
* @deprecated Please use `slotProps`.
|
|
135
|
-
*/
|
|
136
|
-
componentsProps: PropTypes.object,
|
|
137
121
|
/**
|
|
138
122
|
* The default value. Use when the component is not controlled.
|
|
139
123
|
*/
|
|
@@ -74,18 +74,6 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
74
74
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
75
75
|
*/
|
|
76
76
|
closeOnSelect: PropTypes.bool,
|
|
77
|
-
/**
|
|
78
|
-
* Overridable components.
|
|
79
|
-
* @default {}
|
|
80
|
-
* @deprecated Please use `slots`.
|
|
81
|
-
*/
|
|
82
|
-
components: PropTypes.object,
|
|
83
|
-
/**
|
|
84
|
-
* The props used for each component slot.
|
|
85
|
-
* @default {}
|
|
86
|
-
* @deprecated Please use `slotProps`.
|
|
87
|
-
*/
|
|
88
|
-
componentsProps: PropTypes.object,
|
|
89
77
|
/**
|
|
90
78
|
* The default value.
|
|
91
79
|
* Used when the component is not controlled.
|
|
@@ -4,7 +4,6 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
4
4
|
import { useUtils } from '../internals/hooks/useUtils';
|
|
5
5
|
import { TimePickerToolbar } from './TimePickerToolbar';
|
|
6
6
|
import { applyDefaultViewProps } from '../internals/utils/views';
|
|
7
|
-
import { uncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
8
7
|
export function useTimePickerDefaultizedProps(props, name) {
|
|
9
8
|
const utils = useUtils();
|
|
10
9
|
const themeProps = useThemeProps({
|
|
@@ -20,8 +19,6 @@ export function useTimePickerDefaultizedProps(props, name) {
|
|
|
20
19
|
timePickerToolbarTitle: themeProps.localeText.toolbarTitle
|
|
21
20
|
});
|
|
22
21
|
}, [themeProps.localeText]);
|
|
23
|
-
const slots = themeProps.slots ?? uncapitalizeObjectKeys(themeProps.components);
|
|
24
|
-
const slotProps = themeProps.slotProps ?? themeProps.componentsProps;
|
|
25
22
|
return _extends({}, themeProps, {
|
|
26
23
|
ampm,
|
|
27
24
|
localeText
|
|
@@ -35,12 +32,12 @@ export function useTimePickerDefaultizedProps(props, name) {
|
|
|
35
32
|
disablePast: themeProps.disablePast ?? false,
|
|
36
33
|
slots: _extends({
|
|
37
34
|
toolbar: TimePickerToolbar
|
|
38
|
-
}, slots),
|
|
39
|
-
slotProps: _extends({}, slotProps, {
|
|
35
|
+
}, themeProps.slots),
|
|
36
|
+
slotProps: _extends({}, themeProps.slotProps, {
|
|
40
37
|
toolbar: _extends({
|
|
41
38
|
ampm,
|
|
42
39
|
ampmInClock: themeProps.ampmInClock
|
|
43
|
-
}, slotProps?.toolbar)
|
|
40
|
+
}, themeProps.slotProps?.toolbar)
|
|
44
41
|
})
|
|
45
42
|
});
|
|
46
43
|
}
|
|
@@ -83,7 +83,6 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
|
|
|
83
83
|
onChange,
|
|
84
84
|
readOnly,
|
|
85
85
|
shouldDisableYear,
|
|
86
|
-
disableHighlightToday,
|
|
87
86
|
onYearFocus,
|
|
88
87
|
hasFocus,
|
|
89
88
|
onFocusedViewChange,
|
|
@@ -124,12 +123,9 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
|
|
|
124
123
|
if (value != null) {
|
|
125
124
|
return utils.getYear(value);
|
|
126
125
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return utils.getYear(referenceDate);
|
|
131
|
-
}, [value, utils, disableHighlightToday, referenceDate]);
|
|
132
|
-
const [focusedYear, setFocusedYear] = React.useState(() => selectedYear || todayYear);
|
|
126
|
+
return null;
|
|
127
|
+
}, [value, utils]);
|
|
128
|
+
const [focusedYear, setFocusedYear] = React.useState(() => selectedYear || utils.getYear(referenceDate));
|
|
133
129
|
const [internalHasFocus, setInternalHasFocus] = useControlled({
|
|
134
130
|
name: 'YearCalendar',
|
|
135
131
|
state: 'hasFocus',
|
|
@@ -43,8 +43,6 @@ export const renderDesktopDateTimeView = ({
|
|
|
43
43
|
onYearChange,
|
|
44
44
|
yearsPerRow,
|
|
45
45
|
defaultCalendarMonth,
|
|
46
|
-
components,
|
|
47
|
-
componentsProps,
|
|
48
46
|
slots,
|
|
49
47
|
slotProps,
|
|
50
48
|
loading,
|
|
@@ -65,7 +63,7 @@ export const renderDesktopDateTimeView = ({
|
|
|
65
63
|
timeViewsCount,
|
|
66
64
|
shouldRenderTimeInASingleColumn
|
|
67
65
|
}) => {
|
|
68
|
-
const isActionBarVisible = !!resolveComponentProps(slotProps?.actionBar
|
|
66
|
+
const isActionBarVisible = !!resolveComponentProps(slotProps?.actionBar, {})?.actions?.length;
|
|
69
67
|
const commonTimeProps = {
|
|
70
68
|
view: isInternalTimeView(view) ? view : 'hours',
|
|
71
69
|
onViewChange,
|
|
@@ -86,8 +84,6 @@ export const renderDesktopDateTimeView = ({
|
|
|
86
84
|
shouldDisableClock,
|
|
87
85
|
minutesStep,
|
|
88
86
|
ampm,
|
|
89
|
-
components,
|
|
90
|
-
componentsProps,
|
|
91
87
|
slots,
|
|
92
88
|
slotProps,
|
|
93
89
|
readOnly,
|
|
@@ -125,8 +121,6 @@ export const renderDesktopDateTimeView = ({
|
|
|
125
121
|
onYearChange: onYearChange,
|
|
126
122
|
yearsPerRow: yearsPerRow,
|
|
127
123
|
defaultCalendarMonth: defaultCalendarMonth,
|
|
128
|
-
components: components,
|
|
129
|
-
componentsProps: componentsProps,
|
|
130
124
|
slots: slots,
|
|
131
125
|
slotProps: slotProps,
|
|
132
126
|
loading: loading,
|