@mui/x-date-pickers 6.18.1 → 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 +149 -0
- 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/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/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/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/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
package/locales/index.d.ts
CHANGED
package/locales/index.js
CHANGED
|
@@ -272,15 +272,25 @@ export class AdapterLuxon {
|
|
|
272
272
|
};
|
|
273
273
|
this.expandFormat = format => {
|
|
274
274
|
// Extract escaped section to avoid extending them
|
|
275
|
-
const
|
|
276
|
-
|
|
275
|
+
const catchEscapedSectionsRegexp = /''|'(''|[^'])+('|$)|[^']*/g;
|
|
276
|
+
|
|
277
|
+
// Extract words to test if they are a token or a word to escape.
|
|
278
|
+
const catchWordsRegexp = /(?:^|[^a-z])([a-z]+)(?:[^a-z]|$)|([a-z]+)/gi;
|
|
279
|
+
return format.match(catchEscapedSectionsRegexp).map(token => {
|
|
277
280
|
const firstCharacter = token[0];
|
|
278
281
|
if (firstCharacter === "'") {
|
|
279
282
|
return token;
|
|
280
283
|
}
|
|
281
|
-
|
|
284
|
+
const expandedToken = DateTime.expandFormat(token, {
|
|
282
285
|
locale: this.locale
|
|
283
286
|
});
|
|
287
|
+
return expandedToken.replace(catchWordsRegexp, (correspondance, g1, g2) => {
|
|
288
|
+
const word = g1 || g2; // words are either in group 1 or group 2
|
|
289
|
+
if (word === 'yyyyy' || formatTokenMap[word] !== undefined) {
|
|
290
|
+
return correspondance;
|
|
291
|
+
}
|
|
292
|
+
return `'${correspondance}'`;
|
|
293
|
+
});
|
|
284
294
|
}).join('')
|
|
285
295
|
// The returned format can contain `yyyyy` which means year between 4 and 6 digits.
|
|
286
296
|
// This value is supported by luxon parser but not luxon formatter.
|
|
@@ -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 = ["autoFocus", "onViewChange", "value", "defaultValue", "referenceDate", "disableFuture", "disablePast", "defaultCalendarMonth", "onChange", "onYearChange", "onMonthChange", "reduceAnimations", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "view", "views", "openTo", "className", "disabled", "readOnly", "minDate", "maxDate", "disableHighlightToday", "focusedView", "onFocusedViewChange", "showDaysOutsideCurrentMonth", "fixedWeekNumber", "dayOfWeekFormatter", "
|
|
3
|
+
const _excluded = ["autoFocus", "onViewChange", "value", "defaultValue", "referenceDate", "disableFuture", "disablePast", "defaultCalendarMonth", "onChange", "onYearChange", "onMonthChange", "reduceAnimations", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "view", "views", "openTo", "className", "disabled", "readOnly", "minDate", "maxDate", "disableHighlightToday", "focusedView", "onFocusedViewChange", "showDaysOutsideCurrentMonth", "fixedWeekNumber", "dayOfWeekFormatter", "slots", "slotProps", "loading", "renderLoading", "displayWeekNumber", "yearsPerRow", "monthsPerRow", "timezone"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -115,8 +115,6 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
|
|
|
115
115
|
showDaysOutsideCurrentMonth,
|
|
116
116
|
fixedWeekNumber,
|
|
117
117
|
dayOfWeekFormatter,
|
|
118
|
-
components,
|
|
119
|
-
componentsProps,
|
|
120
118
|
slots,
|
|
121
119
|
slotProps,
|
|
122
120
|
loading,
|
|
@@ -183,10 +181,10 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
|
|
|
183
181
|
const maxDateWithDisabled = disabled && value || maxDate;
|
|
184
182
|
const gridLabelId = `${id}-grid-label`;
|
|
185
183
|
const hasFocus = focusedView !== null;
|
|
186
|
-
const CalendarHeader = slots?.calendarHeader ??
|
|
184
|
+
const CalendarHeader = slots?.calendarHeader ?? PickersCalendarHeader;
|
|
187
185
|
const calendarHeaderProps = useSlotProps({
|
|
188
186
|
elementType: CalendarHeader,
|
|
189
|
-
externalSlotProps: slotProps?.calendarHeader
|
|
187
|
+
externalSlotProps: slotProps?.calendarHeader,
|
|
190
188
|
additionalProps: {
|
|
191
189
|
views,
|
|
192
190
|
view,
|
|
@@ -337,8 +335,6 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
|
|
|
337
335
|
fixedWeekNumber: fixedWeekNumber,
|
|
338
336
|
dayOfWeekFormatter: dayOfWeekFormatter,
|
|
339
337
|
displayWeekNumber: displayWeekNumber,
|
|
340
|
-
components: components,
|
|
341
|
-
componentsProps: componentsProps,
|
|
342
338
|
slots: slots,
|
|
343
339
|
slotProps: slotProps,
|
|
344
340
|
loading: loading,
|
|
@@ -362,18 +358,6 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
|
|
|
362
358
|
autoFocus: PropTypes.bool,
|
|
363
359
|
classes: PropTypes.object,
|
|
364
360
|
className: PropTypes.string,
|
|
365
|
-
/**
|
|
366
|
-
* Overridable components.
|
|
367
|
-
* @default {}
|
|
368
|
-
* @deprecated Please use `slots`.
|
|
369
|
-
*/
|
|
370
|
-
components: PropTypes.object,
|
|
371
|
-
/**
|
|
372
|
-
* The props used for each component slot.
|
|
373
|
-
* @default {}
|
|
374
|
-
* @deprecated Please use `slotProps`.
|
|
375
|
-
*/
|
|
376
|
-
componentsProps: PropTypes.object,
|
|
377
361
|
/**
|
|
378
362
|
* Formats the day of week displayed in the calendar header.
|
|
379
363
|
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
@@ -148,8 +148,6 @@ function WrappedDay(_ref) {
|
|
|
148
148
|
disableHighlightToday,
|
|
149
149
|
isMonthSwitchingAnimating,
|
|
150
150
|
showDaysOutsideCurrentMonth,
|
|
151
|
-
components,
|
|
152
|
-
componentsProps,
|
|
153
151
|
slots,
|
|
154
152
|
slotProps,
|
|
155
153
|
timezone
|
|
@@ -159,11 +157,11 @@ function WrappedDay(_ref) {
|
|
|
159
157
|
const isFocusableDay = focusableDay !== null && utils.isSameDay(day, focusableDay);
|
|
160
158
|
const isSelected = selectedDays.some(selectedDay => utils.isSameDay(selectedDay, day));
|
|
161
159
|
const isToday = utils.isSameDay(day, now);
|
|
162
|
-
const Day = slots?.day ??
|
|
160
|
+
const Day = slots?.day ?? PickersDay;
|
|
163
161
|
// We don't want to pass to ownerState down, to avoid re-rendering all the day whenever a prop changes.
|
|
164
162
|
const _useSlotProps = useSlotProps({
|
|
165
163
|
elementType: Day,
|
|
166
|
-
externalSlotProps: slotProps?.day
|
|
164
|
+
externalSlotProps: slotProps?.day,
|
|
167
165
|
additionalProps: _extends({
|
|
168
166
|
disableHighlightToday,
|
|
169
167
|
showDaysOutsideCurrentMonth,
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
4
4
|
import { useIsDateDisabled } from './useIsDateDisabled';
|
|
5
|
-
import { useUtils
|
|
5
|
+
import { useUtils } from '../internals/hooks/useUtils';
|
|
6
6
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
7
7
|
import { SECTION_TYPE_GRANULARITY } from '../internals/utils/getDefaultReferenceDate';
|
|
8
8
|
export const createCalendarStateReducer = (reduceAnimations, disableSwitchToMonthOnDayFocus, utils) => (state, action) => {
|
|
@@ -49,7 +49,6 @@ export const useCalendarState = params => {
|
|
|
49
49
|
shouldDisableDate,
|
|
50
50
|
timezone
|
|
51
51
|
} = params;
|
|
52
|
-
const now = useNow(timezone);
|
|
53
52
|
const utils = useUtils();
|
|
54
53
|
const reducerFn = React.useRef(createCalendarStateReducer(Boolean(reduceAnimations), disableSwitchToMonthOnDayFocus, utils)).current;
|
|
55
54
|
const referenceDate = React.useMemo(() => {
|
|
@@ -73,7 +72,7 @@ export const useCalendarState = params => {
|
|
|
73
72
|
|
|
74
73
|
const [calendarState, dispatch] = React.useReducer(reducerFn, {
|
|
75
74
|
isMonthSwitchingAnimating: false,
|
|
76
|
-
focusedDay:
|
|
75
|
+
focusedDay: referenceDate,
|
|
77
76
|
currentMonth: utils.startOfMonth(referenceDate),
|
|
78
77
|
slideDirection: 'left'
|
|
79
78
|
});
|
|
@@ -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 = ["
|
|
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';
|
|
@@ -28,8 +28,6 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, ref)
|
|
|
28
28
|
name: 'MuiDateField'
|
|
29
29
|
});
|
|
30
30
|
const {
|
|
31
|
-
components,
|
|
32
|
-
componentsProps,
|
|
33
31
|
slots,
|
|
34
32
|
slotProps,
|
|
35
33
|
InputProps,
|
|
@@ -37,10 +35,10 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, ref)
|
|
|
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 DateField = /*#__PURE__*/React.forwardRef(function DateField(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
|
|
@@ -117,18 +113,6 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
117
113
|
*/
|
|
118
114
|
color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
|
119
115
|
component: PropTypes.elementType,
|
|
120
|
-
/**
|
|
121
|
-
* Overridable components.
|
|
122
|
-
* @default {}
|
|
123
|
-
* @deprecated Please use `slots`.
|
|
124
|
-
*/
|
|
125
|
-
components: PropTypes.object,
|
|
126
|
-
/**
|
|
127
|
-
* The props used for each component slot.
|
|
128
|
-
* @default {}
|
|
129
|
-
* @deprecated Please use `slotProps`.
|
|
130
|
-
*/
|
|
131
|
-
componentsProps: PropTypes.object,
|
|
132
116
|
/**
|
|
133
117
|
* The default value. Use when the component is not controlled.
|
|
134
118
|
*/
|
|
@@ -64,18 +64,6 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
64
64
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
65
65
|
*/
|
|
66
66
|
closeOnSelect: PropTypes.bool,
|
|
67
|
-
/**
|
|
68
|
-
* Overridable components.
|
|
69
|
-
* @default {}
|
|
70
|
-
* @deprecated Please use `slots`.
|
|
71
|
-
*/
|
|
72
|
-
components: PropTypes.object,
|
|
73
|
-
/**
|
|
74
|
-
* The props used for each component slot.
|
|
75
|
-
* @default {}
|
|
76
|
-
* @deprecated Please use `slotProps`.
|
|
77
|
-
*/
|
|
78
|
-
componentsProps: PropTypes.object,
|
|
79
67
|
/**
|
|
80
68
|
* Formats the day of week displayed in the calendar header.
|
|
81
69
|
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
@@ -5,7 +5,6 @@ import { useDefaultDates, useUtils } from '../internals/hooks/useUtils';
|
|
|
5
5
|
import { applyDefaultViewProps } from '../internals/utils/views';
|
|
6
6
|
import { applyDefaultDate } from '../internals/utils/date-utils';
|
|
7
7
|
import { DatePickerToolbar } from './DatePickerToolbar';
|
|
8
|
-
import { uncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
9
8
|
export function useDatePickerDefaultizedProps(props, name) {
|
|
10
9
|
const utils = useUtils();
|
|
11
10
|
const defaultDates = useDefaultDates();
|
|
@@ -21,7 +20,6 @@ export function useDatePickerDefaultizedProps(props, name) {
|
|
|
21
20
|
datePickerToolbarTitle: themeProps.localeText.toolbarTitle
|
|
22
21
|
});
|
|
23
22
|
}, [themeProps.localeText]);
|
|
24
|
-
const slots = themeProps.slots ?? uncapitalizeObjectKeys(themeProps.components);
|
|
25
23
|
return _extends({}, themeProps, {
|
|
26
24
|
localeText
|
|
27
25
|
}, applyDefaultViewProps({
|
|
@@ -36,7 +34,6 @@ export function useDatePickerDefaultizedProps(props, name) {
|
|
|
36
34
|
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
|
|
37
35
|
slots: _extends({
|
|
38
36
|
toolbar: DatePickerToolbar
|
|
39
|
-
}, slots)
|
|
40
|
-
slotProps: themeProps.slotProps ?? themeProps.componentsProps
|
|
37
|
+
}, themeProps.slots)
|
|
41
38
|
});
|
|
42
39
|
}
|
|
@@ -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 = ["
|
|
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';
|
|
@@ -28,8 +28,6 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
|
|
|
28
28
|
name: 'MuiDateTimeField'
|
|
29
29
|
});
|
|
30
30
|
const {
|
|
31
|
-
components,
|
|
32
|
-
componentsProps,
|
|
33
31
|
slots,
|
|
34
32
|
slotProps,
|
|
35
33
|
InputProps,
|
|
@@ -37,10 +35,10 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
|
|
|
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 DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
|
|
|
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" ? DateTimeField.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" ? DateTimePicker.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
|
* Formats the day of week displayed in the calendar header.
|
|
91
79
|
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
@@ -6,7 +6,6 @@ import { applyDefaultDate } from '../internals/utils/date-utils';
|
|
|
6
6
|
import { DateTimePickerTabs } from './DateTimePickerTabs';
|
|
7
7
|
import { DateTimePickerToolbar } from './DateTimePickerToolbar';
|
|
8
8
|
import { applyDefaultViewProps } from '../internals/utils/views';
|
|
9
|
-
import { uncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
10
9
|
export function useDateTimePickerDefaultizedProps(props, name) {
|
|
11
10
|
const utils = useUtils();
|
|
12
11
|
const defaultDates = useDefaultDates();
|
|
@@ -23,8 +22,6 @@ export function useDateTimePickerDefaultizedProps(props, name) {
|
|
|
23
22
|
dateTimePickerToolbarTitle: themeProps.localeText.toolbarTitle
|
|
24
23
|
});
|
|
25
24
|
}, [themeProps.localeText]);
|
|
26
|
-
const slots = themeProps.slots ?? uncapitalizeObjectKeys(themeProps.components);
|
|
27
|
-
const slotProps = themeProps.slotProps ?? themeProps.componentsProps;
|
|
28
25
|
return _extends({}, themeProps, applyDefaultViewProps({
|
|
29
26
|
views: themeProps.views,
|
|
30
27
|
openTo: themeProps.openTo,
|
|
@@ -47,11 +44,11 @@ export function useDateTimePickerDefaultizedProps(props, name) {
|
|
|
47
44
|
slots: _extends({
|
|
48
45
|
toolbar: DateTimePickerToolbar,
|
|
49
46
|
tabs: DateTimePickerTabs
|
|
50
|
-
}, slots),
|
|
51
|
-
slotProps: _extends({}, slotProps, {
|
|
47
|
+
}, themeProps.slots),
|
|
48
|
+
slotProps: _extends({}, themeProps.slotProps, {
|
|
52
49
|
toolbar: _extends({
|
|
53
50
|
ampm
|
|
54
|
-
}, slotProps?.toolbar)
|
|
51
|
+
}, themeProps.slotProps?.toolbar)
|
|
55
52
|
})
|
|
56
53
|
});
|
|
57
54
|
}
|
|
@@ -84,18 +84,6 @@ DesktopDatePicker.propTypes = {
|
|
|
84
84
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
85
85
|
*/
|
|
86
86
|
closeOnSelect: PropTypes.bool,
|
|
87
|
-
/**
|
|
88
|
-
* Overridable components.
|
|
89
|
-
* @default {}
|
|
90
|
-
* @deprecated Please use `slots`.
|
|
91
|
-
*/
|
|
92
|
-
components: PropTypes.object,
|
|
93
|
-
/**
|
|
94
|
-
* The props used for each component slot.
|
|
95
|
-
* @default {}
|
|
96
|
-
* @deprecated Please use `slotProps`.
|
|
97
|
-
*/
|
|
98
|
-
componentsProps: PropTypes.object,
|
|
99
87
|
/**
|
|
100
88
|
* Formats the day of week displayed in the calendar header.
|
|
101
89
|
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
@@ -133,18 +133,6 @@ DesktopDateTimePicker.propTypes = {
|
|
|
133
133
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
134
134
|
*/
|
|
135
135
|
closeOnSelect: PropTypes.bool,
|
|
136
|
-
/**
|
|
137
|
-
* Overridable components.
|
|
138
|
-
* @default {}
|
|
139
|
-
* @deprecated Please use `slots`.
|
|
140
|
-
*/
|
|
141
|
-
components: PropTypes.object,
|
|
142
|
-
/**
|
|
143
|
-
* The props used for each component slot.
|
|
144
|
-
* @default {}
|
|
145
|
-
* @deprecated Please use `slotProps`.
|
|
146
|
-
*/
|
|
147
|
-
componentsProps: PropTypes.object,
|
|
148
136
|
/**
|
|
149
137
|
* Formats the day of week displayed in the calendar header.
|
|
150
138
|
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
@@ -116,18 +116,6 @@ DesktopTimePicker.propTypes = {
|
|
|
116
116
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
117
117
|
*/
|
|
118
118
|
closeOnSelect: PropTypes.bool,
|
|
119
|
-
/**
|
|
120
|
-
* Overridable components.
|
|
121
|
-
* @default {}
|
|
122
|
-
* @deprecated Please use `slots`.
|
|
123
|
-
*/
|
|
124
|
-
components: PropTypes.object,
|
|
125
|
-
/**
|
|
126
|
-
* The props used for each component slot.
|
|
127
|
-
* @default {}
|
|
128
|
-
* @deprecated Please use `slotProps`.
|
|
129
|
-
*/
|
|
130
|
-
componentsProps: PropTypes.object,
|
|
131
119
|
/**
|
|
132
120
|
* The default value.
|
|
133
121
|
* 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", "timeStep", "autoFocus", "
|
|
3
|
+
const _excluded = ["ampm", "timeStep", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "onChange", "view", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "views", "skipDisabled", "timezone"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -101,8 +101,6 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
101
101
|
ampm = utils.is12HourCycleInCurrentLocale(),
|
|
102
102
|
timeStep = 30,
|
|
103
103
|
autoFocus,
|
|
104
|
-
components,
|
|
105
|
-
componentsProps,
|
|
106
104
|
slots,
|
|
107
105
|
slotProps,
|
|
108
106
|
value: valueProp,
|
|
@@ -148,10 +146,10 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
148
146
|
alreadyRendered: !!containerRef.current
|
|
149
147
|
}), [props]);
|
|
150
148
|
const classes = useUtilityClasses(ownerState);
|
|
151
|
-
const ClockItem = slots?.digitalClockItem ??
|
|
149
|
+
const ClockItem = slots?.digitalClockItem ?? DigitalClockItem;
|
|
152
150
|
const clockItemProps = useSlotProps({
|
|
153
151
|
elementType: ClockItem,
|
|
154
|
-
externalSlotProps: slotProps?.digitalClockItem
|
|
152
|
+
externalSlotProps: slotProps?.digitalClockItem,
|
|
155
153
|
ownerState: {},
|
|
156
154
|
className: classes.item
|
|
157
155
|
});
|
|
@@ -181,11 +179,14 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
181
179
|
if (containerRef.current === null) {
|
|
182
180
|
return;
|
|
183
181
|
}
|
|
184
|
-
const
|
|
185
|
-
if (!
|
|
182
|
+
const activeItem = containerRef.current.querySelector('[role="listbox"] [role="option"][tabindex="0"], [role="listbox"] [role="option"][aria-selected="true"]');
|
|
183
|
+
if (!activeItem) {
|
|
186
184
|
return;
|
|
187
185
|
}
|
|
188
|
-
const offsetTop =
|
|
186
|
+
const offsetTop = activeItem.offsetTop;
|
|
187
|
+
if (autoFocus || !!focusedView) {
|
|
188
|
+
activeItem.focus();
|
|
189
|
+
}
|
|
189
190
|
|
|
190
191
|
// Subtracting the 4px of extra margin intended for the first visible section item
|
|
191
192
|
containerRef.current.scrollTop = offsetTop - 4;
|
|
@@ -227,21 +228,22 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
227
228
|
length: Math.ceil(24 * 60 / timeStep) - 1
|
|
228
229
|
}, (_, index) => utils.addMinutes(startOfDay, timeStep * (index + 1)))];
|
|
229
230
|
}, [valueOrReferenceDate, timeStep, utils]);
|
|
231
|
+
const focusedOptionIndex = timeOptions.findIndex(option => utils.isEqual(option, valueOrReferenceDate));
|
|
230
232
|
return /*#__PURE__*/_jsx(DigitalClockRoot, _extends({
|
|
231
233
|
ref: handleRef,
|
|
232
234
|
className: clsx(classes.root, className),
|
|
233
235
|
ownerState: ownerState
|
|
234
236
|
}, other, {
|
|
235
237
|
children: /*#__PURE__*/_jsx(DigitalClockList, {
|
|
236
|
-
autoFocusItem: autoFocus || !!focusedView,
|
|
237
238
|
role: "listbox",
|
|
238
239
|
"aria-label": localeText.timePickerToolbarTitle,
|
|
239
240
|
className: classes.list,
|
|
240
|
-
children: timeOptions.map(option => {
|
|
241
|
+
children: timeOptions.map((option, index) => {
|
|
241
242
|
if (skipDisabled && isTimeDisabled(option)) {
|
|
242
243
|
return null;
|
|
243
244
|
}
|
|
244
245
|
const isSelected = utils.isEqual(option, value);
|
|
246
|
+
const tabIndex = focusedOptionIndex === index || focusedOptionIndex === -1 && index === 0 ? 0 : -1;
|
|
245
247
|
return /*#__PURE__*/_jsx(ClockItem, _extends({
|
|
246
248
|
onClick: () => !readOnly && handleItemSelect(option),
|
|
247
249
|
selected: isSelected,
|
|
@@ -251,7 +253,8 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
251
253
|
// aria-readonly is not supported here and does not have any effect
|
|
252
254
|
,
|
|
253
255
|
"aria-disabled": readOnly,
|
|
254
|
-
"aria-selected": isSelected
|
|
256
|
+
"aria-selected": isSelected,
|
|
257
|
+
tabIndex: tabIndex
|
|
255
258
|
}, clockItemProps, {
|
|
256
259
|
children: utils.format(option, ampm ? 'fullTime12h' : 'fullTime24h')
|
|
257
260
|
}), utils.toISO(option));
|
|
@@ -281,18 +284,6 @@ process.env.NODE_ENV !== "production" ? DigitalClock.propTypes = {
|
|
|
281
284
|
*/
|
|
282
285
|
classes: PropTypes.object,
|
|
283
286
|
className: PropTypes.string,
|
|
284
|
-
/**
|
|
285
|
-
* Overrideable components.
|
|
286
|
-
* @default {}
|
|
287
|
-
* @deprecated Please use `slots`.
|
|
288
|
-
*/
|
|
289
|
-
components: PropTypes.object,
|
|
290
|
-
/**
|
|
291
|
-
* The props used for each component slot.
|
|
292
|
-
* @default {}
|
|
293
|
-
* @deprecated Please use `slotProps`.
|
|
294
|
-
*/
|
|
295
|
-
componentsProps: PropTypes.object,
|
|
296
287
|
/**
|
|
297
288
|
* The default selected value.
|
|
298
289
|
* Used when the component is not controlled.
|
|
@@ -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',
|