@mui/x-date-pickers 6.18.1 → 7.0.0-alpha.1
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/AdapterDateFns/AdapterDateFns.d.ts +4 -15
- package/AdapterDateFns/AdapterDateFns.js +8 -90
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +4 -15
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
- package/AdapterDayjs/AdapterDayjs.d.ts +5 -17
- package/AdapterDayjs/AdapterDayjs.js +11 -60
- package/AdapterLuxon/AdapterLuxon.d.ts +4 -15
- package/AdapterLuxon/AdapterLuxon.js +16 -76
- package/AdapterMoment/AdapterMoment.d.ts +4 -20
- package/AdapterMoment/AdapterMoment.js +9 -66
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +1 -7
- package/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +1 -9
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
- package/CHANGELOG.md +558 -1
- package/DateCalendar/DateCalendar.js +4 -21
- package/DateCalendar/DateCalendar.types.d.ts +12 -3
- package/DateCalendar/DayCalendar.d.ts +13 -5
- package/DateCalendar/DayCalendar.js +12 -21
- package/DateCalendar/index.d.ts +0 -1
- package/DateCalendar/index.js +1 -3
- 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 -13
- package/DatePicker/DatePicker.types.d.ts +1 -14
- package/DatePicker/shared.d.ts +4 -16
- 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 -13
- package/DateTimePicker/DateTimePicker.types.d.ts +1 -14
- package/DateTimePicker/shared.d.ts +4 -17
- package/DateTimePicker/shared.js +4 -7
- package/DesktopDatePicker/DesktopDatePicker.js +0 -13
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +2 -15
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -13
- 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 +18 -26
- package/DigitalClock/DigitalClock.types.d.ts +2 -15
- package/LocalizationProvider/LocalizationProvider.js +0 -6
- package/MobileDatePicker/MobileDatePicker.js +0 -13
- package/MobileDatePicker/MobileDatePicker.types.d.ts +2 -15
- package/MobileDateTimePicker/MobileDateTimePicker.js +0 -13
- 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 +14 -20
- 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 -13
- package/StaticDatePicker/StaticDatePicker.types.d.ts +2 -14
- package/StaticDateTimePicker/StaticDateTimePicker.js +0 -13
- 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 +3 -16
- package/TimePicker/shared.js +4 -7
- package/YearCalendar/YearCalendar.js +4 -8
- 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.d.ts +1 -0
- package/index.js +4 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +10 -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/useField/useField.utils.js +0 -1
- package/internals/hooks/useField/useFieldState.js +1 -1
- 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/internals/utils/getDefaultReferenceDate.d.ts +1 -2
- package/internals/utils/getDefaultReferenceDate.js +0 -4
- package/legacy/AdapterDateFns/AdapterDateFns.js +11 -92
- package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +11 -92
- package/legacy/AdapterDayjs/AdapterDayjs.js +15 -63
- package/legacy/AdapterLuxon/AdapterLuxon.js +19 -78
- package/legacy/AdapterMoment/AdapterMoment.js +12 -70
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -30
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -40
- package/legacy/DateCalendar/DateCalendar.js +4 -21
- package/legacy/DateCalendar/DayCalendar.js +10 -16
- package/legacy/DateCalendar/index.js +1 -3
- package/legacy/DateCalendar/useCalendarState.js +2 -3
- package/legacy/DateField/DateField.js +6 -22
- package/legacy/DatePicker/DatePicker.js +0 -13
- package/legacy/DatePicker/shared.js +2 -5
- package/legacy/DateTimeField/DateTimeField.js +6 -22
- package/legacy/DateTimePicker/DateTimePicker.js +0 -13
- package/legacy/DateTimePicker/shared.js +4 -7
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -13
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -13
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/legacy/DigitalClock/DigitalClock.js +20 -26
- package/legacy/LocalizationProvider/LocalizationProvider.js +0 -6
- package/legacy/MobileDatePicker/MobileDatePicker.js +0 -13
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -13
- 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 +14 -20
- package/legacy/PickersLayout/PickersLayout.js +0 -12
- package/legacy/PickersLayout/usePickerLayout.js +2 -7
- package/legacy/StaticDatePicker/StaticDatePicker.js +0 -13
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -13
- 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 +4 -7
- 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 +4 -1
- package/legacy/internals/hooks/useField/useField.utils.js +0 -1
- package/legacy/internals/hooks/useField/useFieldState.js +1 -1
- package/legacy/internals/index.js +0 -1
- package/legacy/internals/utils/getDefaultReferenceDate.js +0 -6
- 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/models/adapters.d.ts +10 -135
- package/models/fields.d.ts +0 -6
- package/modern/AdapterDateFns/AdapterDateFns.js +8 -90
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
- package/modern/AdapterDayjs/AdapterDayjs.js +11 -59
- package/modern/AdapterLuxon/AdapterLuxon.js +16 -76
- package/modern/AdapterMoment/AdapterMoment.js +9 -65
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
- package/modern/DateCalendar/DateCalendar.js +3 -20
- package/modern/DateCalendar/DayCalendar.js +11 -19
- package/modern/DateCalendar/index.js +1 -3
- package/modern/DateCalendar/useCalendarState.js +2 -3
- package/modern/DateField/DateField.js +4 -20
- package/modern/DatePicker/DatePicker.js +0 -13
- package/modern/DatePicker/shared.js +1 -4
- package/modern/DateTimeField/DateTimeField.js +4 -20
- package/modern/DateTimePicker/DateTimePicker.js +0 -13
- package/modern/DateTimePicker/shared.js +3 -6
- package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -13
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -13
- package/modern/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/modern/DigitalClock/DigitalClock.js +17 -25
- package/modern/LocalizationProvider/LocalizationProvider.js +0 -6
- package/modern/MobileDatePicker/MobileDatePicker.js +0 -13
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -13
- 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 +13 -19
- package/modern/PickersLayout/PickersLayout.js +0 -12
- package/modern/PickersLayout/usePickerLayout.js +2 -7
- package/modern/StaticDatePicker/StaticDatePicker.js +0 -13
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -13
- 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 +4 -8
- 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 +4 -1
- package/modern/internals/hooks/useField/useField.utils.js +0 -1
- package/modern/internals/hooks/useField/useFieldState.js +1 -1
- package/modern/internals/index.js +0 -1
- package/modern/internals/utils/getDefaultReferenceDate.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/AdapterDateFns/AdapterDateFns.js +8 -90
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
- package/node/AdapterDayjs/AdapterDayjs.js +11 -59
- package/node/AdapterLuxon/AdapterLuxon.js +16 -76
- package/node/AdapterMoment/AdapterMoment.js +9 -65
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
- package/node/DateCalendar/DateCalendar.js +3 -20
- package/node/DateCalendar/DayCalendar.js +11 -19
- package/node/DateCalendar/index.js +1 -21
- package/node/DateCalendar/useCalendarState.js +1 -2
- package/node/DateField/DateField.js +4 -20
- package/node/DatePicker/DatePicker.js +0 -13
- package/node/DatePicker/shared.js +1 -4
- package/node/DateTimeField/DateTimeField.js +4 -20
- package/node/DateTimePicker/DateTimePicker.js +0 -13
- package/node/DateTimePicker/shared.js +3 -6
- package/node/DesktopDatePicker/DesktopDatePicker.js +0 -13
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -13
- package/node/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/node/DigitalClock/DigitalClock.js +17 -25
- package/node/LocalizationProvider/LocalizationProvider.js +0 -6
- package/node/MobileDatePicker/MobileDatePicker.js +0 -13
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -13
- 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 +13 -19
- package/node/PickersLayout/PickersLayout.js +0 -12
- package/node/PickersLayout/usePickerLayout.js +2 -7
- package/node/StaticDatePicker/StaticDatePicker.js +0 -13
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -13
- 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 +4 -8
- 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 +13 -1
- package/node/internals/hooks/useField/useField.utils.js +0 -1
- package/node/internals/hooks/useField/useFieldState.js +1 -1
- package/node/internals/index.js +0 -7
- package/node/internals/utils/getDefaultReferenceDate.js +1 -3
- 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/themeAugmentation/overrides.d.ts +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
|
@@ -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 != null ? 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.
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
3
|
import MenuItem from '@mui/material/MenuItem';
|
|
4
4
|
import { MultiSectionDigitalClockClasses } from './multiSectionDigitalClockClasses';
|
|
5
|
-
import { UncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
6
5
|
import { BaseClockProps, ExportedBaseClockProps, MultiSectionDigitalClockOnlyProps } from '../internals/models/props/clock';
|
|
7
6
|
import { MultiSectionDigitalClockSectionProps } from './MultiSectionDigitalClockSection';
|
|
8
7
|
import { TimeViewWithMeridiem } from '../internals/models';
|
|
9
8
|
export interface MultiSectionDigitalClockOption<TValue> {
|
|
10
9
|
isDisabled?: (value: TValue) => boolean;
|
|
11
10
|
isSelected: (value: TValue) => boolean;
|
|
11
|
+
isFocused: (value: TValue) => boolean;
|
|
12
12
|
label: string;
|
|
13
13
|
value: TValue;
|
|
14
14
|
ariaLabel: string;
|
|
@@ -22,7 +22,7 @@ export interface MultiSectionDigitalClockSlotsComponent {
|
|
|
22
22
|
* Component responsible for rendering a single multi section digital clock section item.
|
|
23
23
|
* @default MenuItem from '@mui/material'
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
digitalClockSectionItem?: React.ElementType;
|
|
26
26
|
}
|
|
27
27
|
export interface MultiSectionDigitalClockSlotsComponentsProps {
|
|
28
28
|
digitalClockSectionItem?: SlotComponentProps<typeof MenuItem, {}, Record<string, any>>;
|
|
@@ -32,23 +32,11 @@ export interface MultiSectionDigitalClockProps<TDate> extends ExportedMultiSecti
|
|
|
32
32
|
* Override or extend the styles applied to the component.
|
|
33
33
|
*/
|
|
34
34
|
classes?: Partial<MultiSectionDigitalClockClasses>;
|
|
35
|
-
/**
|
|
36
|
-
* Overrideable components.
|
|
37
|
-
* @default {}
|
|
38
|
-
* @deprecated Please use `slots`.
|
|
39
|
-
*/
|
|
40
|
-
components?: MultiSectionDigitalClockSlotsComponent;
|
|
41
|
-
/**
|
|
42
|
-
* The props used for each component slot.
|
|
43
|
-
* @default {}
|
|
44
|
-
* @deprecated Please use `slotProps`.
|
|
45
|
-
*/
|
|
46
|
-
componentsProps?: MultiSectionDigitalClockSlotsComponentsProps;
|
|
47
35
|
/**
|
|
48
36
|
* Overrideable component slots.
|
|
49
37
|
* @default {}
|
|
50
38
|
*/
|
|
51
|
-
slots?:
|
|
39
|
+
slots?: MultiSectionDigitalClockSlotsComponent;
|
|
52
40
|
/**
|
|
53
41
|
* The props used for each component slot.
|
|
54
42
|
* @default {}
|
|
@@ -8,8 +8,9 @@ interface IGetHoursSectionOptions<TDate> {
|
|
|
8
8
|
isDisabled: (value: number) => boolean;
|
|
9
9
|
timeStep: number;
|
|
10
10
|
resolveAriaLabel: (value: string) => string;
|
|
11
|
+
valueOrReferenceDate: TDate;
|
|
11
12
|
}
|
|
12
|
-
export declare const getHourSectionOptions: <TDate>({ now, value, utils, ampm, isDisabled, resolveAriaLabel, timeStep, }: IGetHoursSectionOptions<TDate>) => MultiSectionDigitalClockOption<number>[];
|
|
13
|
+
export declare const getHourSectionOptions: <TDate>({ now, value, utils, ampm, isDisabled, resolveAriaLabel, timeStep, valueOrReferenceDate, }: IGetHoursSectionOptions<TDate>) => MultiSectionDigitalClockOption<number>[];
|
|
13
14
|
interface IGetTimeSectionOptions {
|
|
14
15
|
value: number | null;
|
|
15
16
|
isDisabled: (value: number) => boolean;
|
|
@@ -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 != null ? 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
|
})];
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MultiSectionDigitalClockSectionClasses } from './multiSectionDigitalClockSectionClasses';
|
|
3
3
|
import type { MultiSectionDigitalClockOption, MultiSectionDigitalClockSlotsComponent, MultiSectionDigitalClockSlotsComponentsProps } from './MultiSectionDigitalClock.types';
|
|
4
|
-
import { UncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
5
4
|
export interface ExportedMultiSectionDigitalClockSectionProps {
|
|
6
5
|
className?: string;
|
|
7
6
|
classes?: Partial<MultiSectionDigitalClockSectionClasses>;
|
|
8
|
-
slots?:
|
|
7
|
+
slots?: MultiSectionDigitalClockSlotsComponent;
|
|
9
8
|
slotProps?: MultiSectionDigitalClockSlotsComponentsProps;
|
|
10
9
|
}
|
|
11
10
|
export interface MultiSectionDigitalClockSectionProps<TValue> extends ExportedMultiSectionDigitalClockSectionProps {
|
|
@@ -84,7 +84,7 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
84
84
|
var _slots$digitalClockSe;
|
|
85
85
|
const containerRef = React.useRef(null);
|
|
86
86
|
const handleRef = useForkRef(ref, containerRef);
|
|
87
|
-
const
|
|
87
|
+
const previousActive = React.useRef(null);
|
|
88
88
|
const props = useThemeProps({
|
|
89
89
|
props: inProps,
|
|
90
90
|
name: 'MuiMultiSectionDigitalClockSection'
|
|
@@ -111,23 +111,24 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
111
111
|
if (containerRef.current === null) {
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
114
|
+
const activeItem = containerRef.current.querySelector('[role="option"][tabindex="0"], [role="option"][aria-selected="true"]');
|
|
115
|
+
if (!activeItem || previousActive.current === activeItem) {
|
|
116
116
|
// Handle setting the ref to null if the selected item is ever reset via UI
|
|
117
|
-
if (
|
|
118
|
-
|
|
117
|
+
if (previousActive.current !== activeItem) {
|
|
118
|
+
previousActive.current = activeItem;
|
|
119
119
|
}
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
previousActive.current = activeItem;
|
|
123
123
|
if (active && autoFocus) {
|
|
124
|
-
|
|
124
|
+
activeItem.focus();
|
|
125
125
|
}
|
|
126
|
-
const offsetTop =
|
|
126
|
+
const offsetTop = activeItem.offsetTop;
|
|
127
127
|
|
|
128
128
|
// Subtracting the 4px of extra margin intended for the first visible section item
|
|
129
129
|
containerRef.current.scrollTop = offsetTop - 4;
|
|
130
130
|
});
|
|
131
|
+
const focusedOptionIndex = items.findIndex(item => item.isFocused(item.value));
|
|
131
132
|
return /*#__PURE__*/_jsx(MultiSectionDigitalClockSectionRoot, _extends({
|
|
132
133
|
ref: handleRef,
|
|
133
134
|
className: clsx(classes.root, className),
|
|
@@ -135,12 +136,13 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
135
136
|
autoFocusItem: autoFocus && active,
|
|
136
137
|
role: "listbox"
|
|
137
138
|
}, other, {
|
|
138
|
-
children: items.map(option => {
|
|
139
|
+
children: items.map((option, index) => {
|
|
139
140
|
var _option$isDisabled, _option$isDisabled2;
|
|
140
141
|
if (skipDisabled && (_option$isDisabled = option.isDisabled) != null && _option$isDisabled.call(option, option.value)) {
|
|
141
142
|
return null;
|
|
142
143
|
}
|
|
143
144
|
const isSelected = option.isSelected(option.value);
|
|
145
|
+
const tabIndex = focusedOptionIndex === index || focusedOptionIndex === -1 && index === 0 ? 0 : -1;
|
|
144
146
|
return /*#__PURE__*/_jsx(DigitalClockSectionItem, _extends({
|
|
145
147
|
onClick: () => !readOnly && onChange(option.value),
|
|
146
148
|
selected: isSelected,
|
|
@@ -151,7 +153,8 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
|
|
|
151
153
|
,
|
|
152
154
|
"aria-disabled": readOnly,
|
|
153
155
|
"aria-label": option.ariaLabel,
|
|
154
|
-
"aria-selected": isSelected
|
|
156
|
+
"aria-selected": isSelected,
|
|
157
|
+
tabIndex: tabIndex
|
|
155
158
|
}, slotProps == null ? void 0 : slotProps.digitalClockSectionItem, {
|
|
156
159
|
children: option.label
|
|
157
160
|
}), 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", "format"],
|
|
4
4
|
_excluded2 = ["ownerState"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -104,7 +104,7 @@ const PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDownIcon, {
|
|
|
104
104
|
* - [PickersCalendarHeader API](https://mui.com/x/api/date-pickers/pickers-calendar-header/)
|
|
105
105
|
*/
|
|
106
106
|
const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalendarHeader(inProps, ref) {
|
|
107
|
-
var
|
|
107
|
+
var _slots$switchViewButt, _slots$switchViewIcon;
|
|
108
108
|
const localeText = useLocaleText();
|
|
109
109
|
const utils = useUtils();
|
|
110
110
|
const props = useThemeProps({
|
|
@@ -114,7 +114,6 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
114
114
|
const {
|
|
115
115
|
slots,
|
|
116
116
|
slotProps,
|
|
117
|
-
components,
|
|
118
117
|
currentMonth: month,
|
|
119
118
|
disabled,
|
|
120
119
|
disableFuture,
|
|
@@ -128,12 +127,13 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
128
127
|
views,
|
|
129
128
|
labelId,
|
|
130
129
|
className,
|
|
131
|
-
timezone
|
|
130
|
+
timezone,
|
|
131
|
+
format = `${utils.formats.month} ${utils.formats.year}`
|
|
132
132
|
} = props,
|
|
133
133
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
134
134
|
const ownerState = props;
|
|
135
135
|
const classes = useUtilityClasses(props);
|
|
136
|
-
const SwitchViewButton = (
|
|
136
|
+
const SwitchViewButton = (_slots$switchViewButt = slots == null ? void 0 : slots.switchViewButton) != null ? _slots$switchViewButt : PickersCalendarHeaderSwitchViewButton;
|
|
137
137
|
const switchViewButtonProps = useSlotProps({
|
|
138
138
|
elementType: SwitchViewButton,
|
|
139
139
|
externalSlotProps: slotProps == null ? void 0 : slotProps.switchViewButton,
|
|
@@ -144,7 +144,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
144
144
|
ownerState,
|
|
145
145
|
className: classes.switchViewButton
|
|
146
146
|
});
|
|
147
|
-
const SwitchViewIcon = (
|
|
147
|
+
const SwitchViewIcon = (_slots$switchViewIcon = slots == null ? void 0 : slots.switchViewIcon) != null ? _slots$switchViewIcon : PickersCalendarHeaderSwitchViewIcon;
|
|
148
148
|
// The spread is here to avoid this bug mui/material-ui#34056
|
|
149
149
|
const _useSlotProps = useSlotProps({
|
|
150
150
|
elementType: SwitchViewIcon,
|
|
@@ -182,6 +182,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
182
182
|
if (views.length === 1 && views[0] === 'year') {
|
|
183
183
|
return null;
|
|
184
184
|
}
|
|
185
|
+
const label = utils.formatByString(month, format);
|
|
185
186
|
return /*#__PURE__*/_jsxs(PickersCalendarHeaderRoot, _extends({}, other, {
|
|
186
187
|
ownerState: ownerState,
|
|
187
188
|
className: clsx(className, classes.root),
|
|
@@ -196,12 +197,12 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
196
197
|
className: classes.labelContainer,
|
|
197
198
|
children: [/*#__PURE__*/_jsx(PickersFadeTransitionGroup, {
|
|
198
199
|
reduceAnimations: reduceAnimations,
|
|
199
|
-
transKey:
|
|
200
|
+
transKey: label,
|
|
200
201
|
children: /*#__PURE__*/_jsx(PickersCalendarHeaderLabel, {
|
|
201
202
|
id: labelId,
|
|
202
203
|
ownerState: ownerState,
|
|
203
204
|
className: classes.label,
|
|
204
|
-
children:
|
|
205
|
+
children: label
|
|
205
206
|
})
|
|
206
207
|
}), views.length > 1 && !disabled && /*#__PURE__*/_jsx(SwitchViewButton, _extends({}, switchViewButtonProps, {
|
|
207
208
|
children: /*#__PURE__*/_jsx(SwitchViewIcon, _extends({}, switchViewIconProps))
|
|
@@ -234,22 +235,15 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
|
|
|
234
235
|
* className applied to the root element.
|
|
235
236
|
*/
|
|
236
237
|
className: PropTypes.string,
|
|
237
|
-
/**
|
|
238
|
-
* Overridable components.
|
|
239
|
-
* @default {}
|
|
240
|
-
* @deprecated Please use `slots`.
|
|
241
|
-
*/
|
|
242
|
-
components: PropTypes.object,
|
|
243
|
-
/**
|
|
244
|
-
* The props used for each component slot.
|
|
245
|
-
* @default {}
|
|
246
|
-
* @deprecated Please use `slotProps`.
|
|
247
|
-
*/
|
|
248
|
-
componentsProps: PropTypes.object,
|
|
249
238
|
currentMonth: PropTypes.any.isRequired,
|
|
250
239
|
disabled: PropTypes.bool,
|
|
251
240
|
disableFuture: PropTypes.bool,
|
|
252
241
|
disablePast: PropTypes.bool,
|
|
242
|
+
/**
|
|
243
|
+
* Format used to display the date.
|
|
244
|
+
* @default `${adapter.formats.month} ${adapter.formats.year}`
|
|
245
|
+
*/
|
|
246
|
+
format: PropTypes.string,
|
|
253
247
|
labelId: PropTypes.string,
|
|
254
248
|
maxDate: PropTypes.any.isRequired,
|
|
255
249
|
minDate: PropTypes.any.isRequired,
|
|
@@ -5,7 +5,6 @@ import SvgIcon from '@mui/material/SvgIcon';
|
|
|
5
5
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
6
6
|
import { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlotsComponent, PickersArrowSwitcherSlotsComponentsProps } from '../internals/components/PickersArrowSwitcher';
|
|
7
7
|
import { MonthValidationOptions } from '../internals/hooks/date-helpers-hooks';
|
|
8
|
-
import { UncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
9
8
|
import { DateView } from '../models/views';
|
|
10
9
|
import { SlideDirection } from '../DateCalendar/PickersSlideTransition';
|
|
11
10
|
import { PickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
|
|
@@ -14,12 +13,12 @@ export interface PickersCalendarHeaderSlotsComponent extends PickersArrowSwitche
|
|
|
14
13
|
* Button displayed to switch between different calendar views.
|
|
15
14
|
* @default IconButton
|
|
16
15
|
*/
|
|
17
|
-
|
|
16
|
+
switchViewButton?: React.ElementType;
|
|
18
17
|
/**
|
|
19
18
|
* Icon displayed in the SwitchViewButton. Rotated by 180° when the open view is 'year'.
|
|
20
19
|
* @default ArrowDropDown
|
|
21
20
|
*/
|
|
22
|
-
|
|
21
|
+
switchViewIcon?: React.ElementType;
|
|
23
22
|
}
|
|
24
23
|
export interface PickersCalendarHeaderComponentsPropsOverrides {
|
|
25
24
|
}
|
|
@@ -29,23 +28,11 @@ export interface PickersCalendarHeaderSlotsComponentsProps<TDate> extends Picker
|
|
|
29
28
|
switchViewIcon?: SlotComponentProps<typeof SvgIcon, PickersCalendarHeaderComponentsPropsOverrides, undefined>;
|
|
30
29
|
}
|
|
31
30
|
export interface PickersCalendarHeaderProps<TDate> extends ExportedPickersArrowSwitcherProps, MonthValidationOptions<TDate> {
|
|
32
|
-
/**
|
|
33
|
-
* Overridable components.
|
|
34
|
-
* @default {}
|
|
35
|
-
* @deprecated Please use `slots`.
|
|
36
|
-
*/
|
|
37
|
-
components?: PickersCalendarHeaderSlotsComponent;
|
|
38
|
-
/**
|
|
39
|
-
* The props used for each component slot.
|
|
40
|
-
* @default {}
|
|
41
|
-
* @deprecated Please use `slotProps`.
|
|
42
|
-
*/
|
|
43
|
-
componentsProps?: PickersCalendarHeaderSlotsComponentsProps<TDate>;
|
|
44
31
|
/**
|
|
45
32
|
* Overridable component slots.
|
|
46
33
|
* @default {}
|
|
47
34
|
*/
|
|
48
|
-
slots?:
|
|
35
|
+
slots?: PickersCalendarHeaderSlotsComponent;
|
|
49
36
|
/**
|
|
50
37
|
* The props used for each component slot.
|
|
51
38
|
* @default {}
|
|
@@ -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 { PickersActionBarProps } from '../PickersActionBar';
|
|
|
5
5
|
import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar';
|
|
6
6
|
import { BaseTabsProps, ExportedBaseTabsProps } from '../internals/models/props/tabs';
|
|
7
7
|
import { UsePickerLayoutPropsResponseLayoutProps } from '../internals/hooks/usePicker/usePickerLayoutProps';
|
|
8
|
-
import { UncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
9
8
|
import { PickersLayoutClasses } from './pickersLayoutClasses';
|
|
10
9
|
import { DateOrTimeViewWithMeridiem, WrapperVariant } from '../internals/models/common';
|
|
11
10
|
import { PickersShortcutsProps } from '../PickersShortcuts';
|
|
@@ -14,17 +13,17 @@ export interface ExportedPickersLayoutSlotsComponent<TValue, TDate, TView extend
|
|
|
14
13
|
* Custom component for the action bar, it is placed below the picker views.
|
|
15
14
|
* @default PickersActionBar
|
|
16
15
|
*/
|
|
17
|
-
|
|
16
|
+
actionBar?: React.ElementType<PickersActionBarProps>;
|
|
18
17
|
/**
|
|
19
18
|
* Custom component for the shortcuts.
|
|
20
19
|
* @default PickersShortcuts
|
|
21
20
|
*/
|
|
22
|
-
|
|
21
|
+
shortcuts?: React.JSXElementConstructor<PickersShortcutsProps<TValue>>;
|
|
23
22
|
/**
|
|
24
23
|
* Custom component for wrapping the layout.
|
|
25
24
|
* It wraps the toolbar, views, action bar, and shortcuts.
|
|
26
25
|
*/
|
|
27
|
-
|
|
26
|
+
layout?: React.JSXElementConstructor<PickersLayoutProps<TValue, TDate, TView> & React.RefAttributes<HTMLDivElement>>;
|
|
28
27
|
}
|
|
29
28
|
interface PickersLayoutActionBarOwnerState<TValue, TDate, TView extends DateOrTimeViewWithMeridiem> extends PickersLayoutProps<TValue, TDate, TView> {
|
|
30
29
|
wrapperVariant: WrapperVariant;
|
|
@@ -50,12 +49,12 @@ export interface PickersLayoutSlotsComponent<TValue, TDate, TView extends DateOr
|
|
|
50
49
|
/**
|
|
51
50
|
* Tabs enabling toggling between views.
|
|
52
51
|
*/
|
|
53
|
-
|
|
52
|
+
tabs?: React.ElementType<BaseTabsProps<TView>>;
|
|
54
53
|
/**
|
|
55
54
|
* Custom component for the toolbar.
|
|
56
55
|
* It is placed above the picker views.
|
|
57
56
|
*/
|
|
58
|
-
|
|
57
|
+
toolbar?: React.JSXElementConstructor<BaseToolbarProps<TValue, TView>>;
|
|
59
58
|
}
|
|
60
59
|
export interface PickersLayoutSlotsComponentsProps<TValue, TDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotsComponentsProps<TValue, TDate, TView> {
|
|
61
60
|
/**
|
|
@@ -77,23 +76,11 @@ export interface PickersLayoutProps<TValue, TDate, TView extends DateOrTimeViewW
|
|
|
77
76
|
*/
|
|
78
77
|
ref?: React.Ref<HTMLDivElement>;
|
|
79
78
|
classes?: Partial<PickersLayoutClasses>;
|
|
80
|
-
/**
|
|
81
|
-
* Overridable components.
|
|
82
|
-
* @default {}
|
|
83
|
-
* @deprecated Please use `slots`.
|
|
84
|
-
*/
|
|
85
|
-
components?: PickersLayoutSlotsComponent<TValue, TDate, TView>;
|
|
86
|
-
/**
|
|
87
|
-
* The props used for each component slot.
|
|
88
|
-
* @default {}
|
|
89
|
-
* @deprecated Please use `slotProps`.
|
|
90
|
-
*/
|
|
91
|
-
componentsProps?: PickersLayoutSlotsComponentsProps<TValue, TDate, TView>;
|
|
92
79
|
/**
|
|
93
80
|
* Overridable component slots.
|
|
94
81
|
* @default {}
|
|
95
82
|
*/
|
|
96
|
-
slots?:
|
|
83
|
+
slots?: PickersLayoutSlotsComponent<TValue, TDate, TView>;
|
|
97
84
|
/**
|
|
98
85
|
* The props used for each component slot.
|
|
99
86
|
* @default {}
|
|
@@ -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;
|
|
@@ -45,17 +44,13 @@ const usePickerLayout = props => {
|
|
|
45
44
|
disabled,
|
|
46
45
|
readOnly,
|
|
47
46
|
children,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
slots: innerSlots,
|
|
51
|
-
slotProps: innerSlotProps
|
|
47
|
+
slots,
|
|
48
|
+
slotProps
|
|
52
49
|
// TODO: Remove this "as" hack. It get introduced to mark `value` prop in PickersLayoutProps as not required.
|
|
53
50
|
// The true type should be
|
|
54
51
|
// - For pickers value: TDate | null
|
|
55
52
|
// - For range pickers value: [TDate | null, TDate | null]
|
|
56
53
|
} = props;
|
|
57
|
-
const slots = innerSlots != null ? innerSlots : uncapitalizeObjectKeys(components);
|
|
58
|
-
const slotProps = innerSlotProps != null ? innerSlotProps : componentsProps;
|
|
59
54
|
const classes = useUtilityClasses(props);
|
|
60
55
|
|
|
61
56
|
// Action bar
|
|
@@ -64,21 +64,8 @@ StaticDatePicker.propTypes = {
|
|
|
64
64
|
* Class name applied to the root element.
|
|
65
65
|
*/
|
|
66
66
|
className: PropTypes.string,
|
|
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
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
82
69
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
83
70
|
* @returns {string} The name to display.
|
|
84
71
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
import { BaseDatePickerProps, BaseDatePickerSlotsComponent, BaseDatePickerSlotsComponentsProps } from '../DatePicker/shared';
|
|
2
2
|
import { StaticOnlyPickerProps, UseStaticPickerSlotsComponent, UseStaticPickerSlotsComponentsProps } from '../internals/hooks/useStaticPicker';
|
|
3
|
-
import { MakeOptional
|
|
3
|
+
import { MakeOptional } from '../internals';
|
|
4
4
|
import { DateView } from '../models';
|
|
5
5
|
export interface StaticDatePickerSlotsComponent<TDate> extends BaseDatePickerSlotsComponent<TDate>, UseStaticPickerSlotsComponent<TDate, DateView> {
|
|
6
6
|
}
|
|
7
7
|
export interface StaticDatePickerSlotsComponentsProps<TDate> extends BaseDatePickerSlotsComponentsProps<TDate>, UseStaticPickerSlotsComponentsProps<TDate, DateView> {
|
|
8
8
|
}
|
|
9
9
|
export interface StaticDatePickerProps<TDate> extends BaseDatePickerProps<TDate>, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
|
|
10
|
-
/**
|
|
11
|
-
* Overridable components.
|
|
12
|
-
* @default {}
|
|
13
|
-
* @deprecated Please use `slots`.
|
|
14
|
-
*/
|
|
15
|
-
components?: StaticDatePickerSlotsComponent<TDate>;
|
|
16
|
-
/**
|
|
17
|
-
* The props used for each component slot.
|
|
18
|
-
* @default {}
|
|
19
|
-
* @deprecated Please use `slotProps`.
|
|
20
|
-
*/
|
|
21
|
-
componentsProps?: StaticDatePickerSlotsComponentsProps<TDate>;
|
|
22
10
|
/**
|
|
23
11
|
* Overridable component slots.
|
|
24
12
|
* @default {}
|
|
25
13
|
*/
|
|
26
|
-
slots?:
|
|
14
|
+
slots?: StaticDatePickerSlotsComponent<TDate>;
|
|
27
15
|
/**
|
|
28
16
|
* The props used for each component slot.
|
|
29
17
|
* @default {}
|
|
@@ -84,21 +84,8 @@ StaticDateTimePicker.propTypes = {
|
|
|
84
84
|
* Class name applied to the root element.
|
|
85
85
|
*/
|
|
86
86
|
className: PropTypes.string,
|
|
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
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
102
89
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
103
90
|
* @returns {string} The name to display.
|
|
104
91
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
import { BaseDateTimePickerProps, BaseDateTimePickerSlotsComponent, BaseDateTimePickerSlotsComponentsProps } from '../DateTimePicker/shared';
|
|
2
2
|
import { StaticOnlyPickerProps, UseStaticPickerSlotsComponent, UseStaticPickerSlotsComponentsProps } from '../internals/hooks/useStaticPicker';
|
|
3
|
-
import { MakeOptional
|
|
3
|
+
import { MakeOptional } from '../internals';
|
|
4
4
|
import { DateOrTimeView } from '../models';
|
|
5
5
|
export interface StaticDateTimePickerSlotsComponent<TDate> extends BaseDateTimePickerSlotsComponent<TDate>, UseStaticPickerSlotsComponent<TDate, DateOrTimeView> {
|
|
6
6
|
}
|
|
7
7
|
export interface StaticDateTimePickerSlotsComponentsProps<TDate> extends BaseDateTimePickerSlotsComponentsProps<TDate>, UseStaticPickerSlotsComponentsProps<TDate, DateOrTimeView> {
|
|
8
8
|
}
|
|
9
9
|
export interface StaticDateTimePickerProps<TDate> extends BaseDateTimePickerProps<TDate, DateOrTimeView>, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
|
|
10
|
-
/**
|
|
11
|
-
* Overridable components.
|
|
12
|
-
* @default {}
|
|
13
|
-
* @deprecated Please use `slots`.
|
|
14
|
-
*/
|
|
15
|
-
components?: StaticDateTimePickerSlotsComponent<TDate>;
|
|
16
|
-
/**
|
|
17
|
-
* The props used for each component slot.
|
|
18
|
-
* @default {}
|
|
19
|
-
* @deprecated Please use `slotProps`.
|
|
20
|
-
*/
|
|
21
|
-
componentsProps?: StaticDateTimePickerSlotsComponentsProps<TDate>;
|
|
22
10
|
/**
|
|
23
11
|
* Overridable component slots.
|
|
24
12
|
* @default {}
|
|
25
13
|
*/
|
|
26
|
-
slots?:
|
|
14
|
+
slots?: StaticDateTimePickerSlotsComponent<TDate>;
|
|
27
15
|
/**
|
|
28
16
|
* The props used for each component slot.
|
|
29
17
|
* @default {}
|