@mui/x-date-pickers 7.22.1 → 8.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/AdapterDateFns/AdapterDateFns.d.ts +1 -1
- package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +3 -3
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -1
- package/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.d.ts +1 -1
- package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +1 -1
- package/AdapterDayjs/AdapterDayjs.d.ts +2 -2
- package/AdapterLuxon/AdapterLuxon.d.ts +2 -2
- package/AdapterMoment/AdapterMoment.d.ts +2 -2
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +2 -2
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +2 -2
- package/CHANGELOG.md +143 -92
- package/DateCalendar/DateCalendar.d.ts +1 -2
- package/DateCalendar/DateCalendar.js +20 -22
- package/DateCalendar/DateCalendar.types.d.ts +21 -31
- package/DateCalendar/DayCalendar.d.ts +25 -24
- package/DateCalendar/DayCalendar.js +13 -10
- package/DateCalendar/index.d.ts +1 -0
- package/DateCalendar/useCalendarState.d.ts +16 -16
- package/DateCalendar/useIsDateDisabled.d.ts +2 -2
- package/DateField/DateField.d.ts +1 -2
- package/DateField/DateField.js +8 -10
- package/DateField/DateField.types.d.ts +8 -9
- package/DateField/index.d.ts +1 -1
- package/DateField/useDateField.d.ts +1 -2
- package/DatePicker/DatePicker.d.ts +1 -2
- package/DatePicker/DatePicker.js +15 -14
- package/DatePicker/DatePicker.types.d.ts +10 -11
- package/DatePicker/DatePickerToolbar.d.ts +2 -2
- package/DatePicker/DatePickerToolbar.js +12 -2
- package/DatePicker/shared.d.ts +11 -11
- package/DateTimeField/DateTimeField.d.ts +1 -2
- package/DateTimeField/DateTimeField.js +9 -12
- package/DateTimeField/DateTimeField.types.d.ts +9 -14
- package/DateTimeField/index.d.ts +1 -1
- package/DateTimeField/useDateTimeField.d.ts +1 -2
- package/DateTimePicker/DateTimePicker.d.ts +1 -2
- package/DateTimePicker/DateTimePicker.js +16 -16
- package/DateTimePicker/DateTimePicker.types.d.ts +10 -13
- package/DateTimePicker/DateTimePickerTabs.d.ts +1 -2
- package/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/DateTimePicker/DateTimePickerToolbar.d.ts +3 -3
- package/DateTimePicker/DateTimePickerToolbar.js +12 -2
- package/DateTimePicker/shared.d.ts +12 -12
- package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -2
- package/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +7 -7
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -2
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +8 -8
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +1 -2
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -0
- package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -2
- package/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +8 -8
- package/DigitalClock/DigitalClock.d.ts +1 -2
- package/DigitalClock/DigitalClock.js +7 -6
- package/DigitalClock/DigitalClock.types.d.ts +4 -4
- package/LocalizationProvider/LocalizationProvider.d.ts +12 -12
- package/MobileDatePicker/MobileDatePicker.d.ts +1 -2
- package/MobileDatePicker/MobileDatePicker.js +17 -16
- package/MobileDatePicker/MobileDatePicker.types.d.ts +7 -7
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +2 -2
- package/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +7 -7
- package/MobileTimePicker/MobileTimePicker.d.ts +2 -2
- package/MobileTimePicker/MobileTimePicker.js +11 -6
- package/MobileTimePicker/MobileTimePicker.types.d.ts +7 -7
- package/MonthCalendar/MonthCalendar.d.ts +3 -4
- package/MonthCalendar/MonthCalendar.js +17 -14
- package/MonthCalendar/MonthCalendar.types.d.ts +14 -15
- package/MonthCalendar/PickersMonth.js +17 -13
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.d.ts +1 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +3 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +9 -9
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +2 -3
- package/PickersActionBar/PickersActionBar.js +2 -2
- package/PickersCalendarHeader/PickersCalendarHeader.d.ts +1 -2
- package/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +9 -9
- package/PickersDay/PickersDay.d.ts +8 -8
- package/PickersLayout/PickersLayout.d.ts +2 -3
- package/PickersLayout/PickersLayout.js +10 -0
- package/PickersLayout/PickersLayout.types.d.ts +14 -17
- package/PickersLayout/index.d.ts +1 -1
- package/PickersLayout/usePickerLayout.d.ts +1 -2
- package/PickersLayout/usePickerLayout.js +17 -18
- package/README.md +2 -2
- package/StaticDatePicker/StaticDatePicker.d.ts +1 -2
- package/StaticDatePicker/StaticDatePicker.js +14 -13
- package/StaticDatePicker/StaticDatePicker.types.d.ts +7 -7
- package/StaticDateTimePicker/StaticDateTimePicker.d.ts +1 -2
- package/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
- package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +7 -7
- package/StaticTimePicker/StaticTimePicker.d.ts +1 -2
- package/StaticTimePicker/StaticTimePicker.js +8 -3
- package/StaticTimePicker/StaticTimePicker.types.d.ts +7 -7
- package/TimeClock/Clock.d.ts +4 -5
- package/TimeClock/Clock.js +3 -3
- package/TimeClock/ClockNumbers.d.ts +5 -5
- package/TimeClock/TimeClock.d.ts +1 -2
- package/TimeClock/TimeClock.js +7 -6
- package/TimeClock/TimeClock.types.d.ts +4 -4
- package/TimeField/TimeField.d.ts +1 -2
- package/TimeField/TimeField.js +6 -6
- package/TimeField/TimeField.types.d.ts +9 -14
- package/TimeField/index.d.ts +1 -1
- package/TimeField/useTimeField.d.ts +1 -2
- package/TimePicker/TimePicker.d.ts +1 -2
- package/TimePicker/TimePicker.js +9 -4
- package/TimePicker/TimePicker.types.d.ts +10 -13
- package/TimePicker/TimePickerToolbar.d.ts +2 -2
- package/TimePicker/TimePickerToolbar.js +12 -2
- package/TimePicker/shared.d.ts +10 -10
- package/YearCalendar/PickersYear.js +17 -13
- package/YearCalendar/YearCalendar.d.ts +1 -2
- package/YearCalendar/YearCalendar.js +17 -14
- package/YearCalendar/YearCalendar.types.d.ts +14 -15
- package/dateViewRenderers/dateViewRenderers.d.ts +3 -3
- package/hooks/index.d.ts +2 -2
- package/hooks/index.js +2 -2
- package/hooks/useClearableField.js +4 -3
- package/hooks/useParsedFormat.d.ts +2 -3
- package/hooks/useParsedFormat.js +2 -2
- package/hooks/usePickerContext.d.ts +4 -0
- package/hooks/usePickerContext.js +15 -0
- package/hooks/usePickerTranslations.d.ts +1 -0
- package/{modern/hooks/usePickersTranslations.js → hooks/usePickerTranslations.js} +1 -1
- package/index.js +1 -1
- package/internals/components/{PickersProvider.d.ts → PickerProvider.d.ts} +15 -8
- package/internals/components/PickerProvider.js +38 -0
- package/internals/hooks/date-helpers-hooks.d.ts +6 -6
- package/internals/hooks/defaultizedFieldProps.d.ts +7 -8
- package/internals/hooks/useClockReferenceDate.d.ts +5 -5
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -17
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +15 -15
- package/internals/hooks/useField/buildSectionsFromFormat.d.ts +5 -5
- package/internals/hooks/useField/useField.d.ts +3 -3
- package/internals/hooks/useField/useField.js +1 -1
- package/internals/hooks/useField/useField.types.d.ts +38 -48
- package/internals/hooks/useField/useField.utils.d.ts +13 -13
- package/internals/hooks/useField/useField.utils.js +2 -1
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +4 -4
- package/internals/hooks/useField/useFieldState.d.ts +4 -4
- package/internals/hooks/useField/useFieldState.js +3 -3
- package/internals/hooks/useField/useFieldV7TextField.js +2 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.js +23 -18
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +12 -12
- package/internals/hooks/usePicker/usePicker.d.ts +2 -2
- package/internals/hooks/usePicker/usePicker.js +12 -4
- package/internals/hooks/usePicker/usePicker.types.d.ts +7 -5
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +2 -3
- package/internals/hooks/usePicker/usePickerOwnerState.d.ts +4 -3
- package/internals/hooks/usePicker/usePickerOwnerState.js +9 -6
- package/internals/hooks/usePicker/usePickerProvider.d.ts +10 -0
- package/internals/hooks/usePicker/usePickerProvider.js +21 -0
- package/internals/hooks/usePicker/usePickerValue.d.ts +2 -2
- package/internals/hooks/usePicker/usePickerValue.js +2 -7
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +32 -34
- package/internals/hooks/usePicker/usePickerViews.d.ts +6 -11
- package/internals/hooks/usePickerPrivateContext.d.ts +4 -0
- package/internals/hooks/usePickerPrivateContext.js +9 -0
- package/internals/hooks/useStaticPicker/useStaticPicker.d.ts +1 -2
- package/internals/hooks/useStaticPicker/useStaticPicker.js +5 -4
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +6 -6
- package/internals/hooks/useUtils.d.ts +7 -7
- package/internals/hooks/useValueWithTimezone.d.ts +5 -5
- package/internals/hooks/useViews.d.ts +3 -3
- package/internals/hooks/useViews.js +1 -1
- package/internals/index.d.ts +6 -4
- package/internals/index.js +2 -1
- package/internals/models/fields.d.ts +32 -7
- package/internals/models/formProps.d.ts +14 -0
- package/internals/models/helpers.d.ts +0 -4
- package/internals/models/index.d.ts +2 -0
- package/internals/models/index.js +3 -1
- package/internals/models/props/basePickerProps.d.ts +5 -6
- package/internals/models/props/{clock.d.ts → time.d.ts} +10 -17
- package/internals/models/props/toolbar.d.ts +2 -3
- package/internals/models/validation.d.ts +21 -25
- package/internals/models/value.d.ts +3 -0
- package/internals/models/value.js +1 -0
- package/internals/utils/date-time-utils.d.ts +7 -7
- package/internals/utils/date-utils.d.ts +16 -16
- package/internals/utils/getDefaultReferenceDate.d.ts +10 -10
- package/internals/utils/time-utils.d.ts +5 -5
- package/internals/utils/valueManagers.d.ts +3 -3
- package/locales/beBY.d.ts +3 -3
- package/locales/beBY.js +3 -3
- package/locales/bgBG.d.ts +3 -3
- package/locales/bgBG.js +3 -3
- package/locales/caES.d.ts +3 -3
- package/locales/caES.js +3 -3
- package/locales/csCZ.d.ts +3 -3
- package/locales/csCZ.js +3 -3
- package/locales/daDK.d.ts +3 -3
- package/locales/daDK.js +3 -3
- package/locales/deDE.d.ts +3 -3
- package/locales/deDE.js +3 -3
- package/locales/elGR.d.ts +3 -3
- package/locales/elGR.js +12 -13
- package/locales/enUS.d.ts +4 -4
- package/locales/enUS.js +3 -3
- package/locales/esES.d.ts +3 -3
- package/locales/esES.js +3 -3
- package/locales/eu.d.ts +3 -3
- package/locales/eu.js +3 -3
- package/locales/faIR.d.ts +3 -3
- package/locales/faIR.js +3 -3
- package/locales/fiFI.d.ts +3 -3
- package/locales/fiFI.js +3 -3
- package/locales/frFR.d.ts +3 -3
- package/locales/frFR.js +3 -3
- package/locales/heIL.d.ts +3 -3
- package/locales/heIL.js +3 -3
- package/locales/hrHR.d.ts +3 -3
- package/locales/hrHR.js +3 -3
- package/locales/huHU.d.ts +3 -3
- package/locales/huHU.js +3 -3
- package/locales/isIS.d.ts +3 -3
- package/locales/isIS.js +3 -3
- package/locales/itIT.d.ts +3 -3
- package/locales/itIT.js +3 -3
- package/locales/jaJP.d.ts +3 -3
- package/locales/jaJP.js +3 -3
- package/locales/koKR.d.ts +3 -3
- package/locales/koKR.js +3 -3
- package/locales/kzKZ.d.ts +3 -3
- package/locales/kzKZ.js +3 -3
- package/locales/mk.d.ts +3 -3
- package/locales/mk.js +3 -3
- package/locales/nbNO.d.ts +3 -3
- package/locales/nbNO.js +3 -3
- package/locales/nlNL.d.ts +3 -3
- package/locales/nlNL.js +3 -3
- package/locales/nnNO.d.ts +3 -3
- package/locales/nnNO.js +3 -3
- package/locales/plPL.d.ts +3 -3
- package/locales/plPL.js +3 -3
- package/locales/ptBR.d.ts +3 -3
- package/locales/ptBR.js +5 -3
- package/locales/ptPT.d.ts +3 -3
- package/locales/ptPT.js +3 -3
- package/locales/roRO.d.ts +3 -3
- package/locales/roRO.js +3 -3
- package/locales/ruRU.d.ts +3 -3
- package/locales/ruRU.js +3 -3
- package/locales/skSK.d.ts +3 -3
- package/locales/skSK.js +3 -3
- package/locales/svSE.d.ts +3 -3
- package/locales/svSE.js +3 -3
- package/locales/trTR.d.ts +3 -3
- package/locales/trTR.js +3 -3
- package/locales/ukUA.d.ts +3 -3
- package/locales/ukUA.js +3 -3
- package/locales/urPK.d.ts +3 -3
- package/locales/urPK.js +3 -3
- package/locales/utils/getPickersLocalization.d.ts +9 -9
- package/locales/utils/getPickersLocalization.js +1 -1
- package/locales/utils/pickersLocaleTextApi.d.ts +12 -36
- package/locales/viVN.d.ts +3 -3
- package/locales/viVN.js +3 -3
- package/locales/zhCN.d.ts +3 -3
- package/locales/zhCN.js +3 -3
- package/locales/zhHK.d.ts +3 -3
- package/locales/zhHK.js +3 -3
- package/models/adapters.d.ts +151 -202
- package/models/fields.d.ts +9 -41
- package/models/pickers.d.ts +10 -6
- package/modern/DateCalendar/DateCalendar.js +20 -22
- package/modern/DateCalendar/DayCalendar.js +13 -10
- package/modern/DateField/DateField.js +8 -10
- package/modern/DatePicker/DatePicker.js +15 -14
- package/modern/DatePicker/DatePickerToolbar.js +12 -2
- package/modern/DateTimeField/DateTimeField.js +9 -12
- package/modern/DateTimePicker/DateTimePicker.js +16 -16
- package/modern/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/modern/DateTimePicker/DateTimePickerToolbar.js +12 -2
- package/modern/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -0
- package/modern/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/modern/DigitalClock/DigitalClock.js +7 -6
- package/modern/MobileDatePicker/MobileDatePicker.js +17 -16
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/modern/MobileTimePicker/MobileTimePicker.js +11 -6
- package/modern/MonthCalendar/MonthCalendar.js +17 -14
- package/modern/MonthCalendar/PickersMonth.js +17 -13
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -6
- package/modern/PickersActionBar/PickersActionBar.js +2 -2
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/modern/PickersLayout/PickersLayout.js +10 -0
- package/modern/PickersLayout/usePickerLayout.js +17 -18
- package/modern/StaticDatePicker/StaticDatePicker.js +14 -13
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
- package/modern/StaticTimePicker/StaticTimePicker.js +8 -3
- package/modern/TimeClock/Clock.js +3 -3
- package/modern/TimeClock/TimeClock.js +7 -6
- package/modern/TimeField/TimeField.js +6 -6
- package/modern/TimePicker/TimePicker.js +9 -4
- package/modern/TimePicker/TimePickerToolbar.js +12 -2
- package/modern/YearCalendar/PickersYear.js +17 -13
- package/modern/YearCalendar/YearCalendar.js +17 -14
- package/modern/hooks/index.js +2 -2
- package/modern/hooks/useClearableField.js +4 -3
- package/modern/hooks/useParsedFormat.js +2 -2
- package/modern/hooks/usePickerContext.js +15 -0
- package/{hooks/usePickersTranslations.js → modern/hooks/usePickerTranslations.js} +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerProvider.js +38 -0
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -17
- package/modern/internals/hooks/useField/useField.js +1 -1
- package/modern/internals/hooks/useField/useField.utils.js +2 -1
- package/modern/internals/hooks/useField/useFieldState.js +3 -3
- package/modern/internals/hooks/useField/useFieldV7TextField.js +2 -2
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +23 -18
- package/modern/internals/hooks/usePicker/usePicker.js +12 -4
- package/modern/internals/hooks/usePicker/usePickerOwnerState.js +9 -6
- package/modern/internals/hooks/usePicker/usePickerProvider.js +21 -0
- package/modern/internals/hooks/usePicker/usePickerValue.js +2 -7
- package/modern/internals/hooks/usePickerPrivateContext.js +9 -0
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +5 -4
- package/modern/internals/hooks/useViews.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/internals/models/formProps.js +1 -0
- package/modern/internals/models/index.js +3 -1
- package/modern/internals/models/props/time.js +1 -0
- package/modern/internals/models/value.js +1 -0
- package/modern/locales/beBY.js +3 -3
- package/modern/locales/bgBG.js +3 -3
- package/modern/locales/caES.js +3 -3
- package/modern/locales/csCZ.js +3 -3
- package/modern/locales/daDK.js +3 -3
- package/modern/locales/deDE.js +3 -3
- package/modern/locales/elGR.js +12 -13
- package/modern/locales/enUS.js +3 -3
- package/modern/locales/esES.js +3 -3
- package/modern/locales/eu.js +3 -3
- package/modern/locales/faIR.js +3 -3
- package/modern/locales/fiFI.js +3 -3
- package/modern/locales/frFR.js +3 -3
- package/modern/locales/heIL.js +3 -3
- package/modern/locales/hrHR.js +3 -3
- package/modern/locales/huHU.js +3 -3
- package/modern/locales/isIS.js +3 -3
- package/modern/locales/itIT.js +3 -3
- package/modern/locales/jaJP.js +3 -3
- package/modern/locales/koKR.js +3 -3
- package/modern/locales/kzKZ.js +3 -3
- package/modern/locales/mk.js +3 -3
- package/modern/locales/nbNO.js +3 -3
- package/modern/locales/nlNL.js +3 -3
- package/modern/locales/nnNO.js +3 -3
- package/modern/locales/plPL.js +3 -3
- package/modern/locales/ptBR.js +5 -3
- package/modern/locales/ptPT.js +3 -3
- package/modern/locales/roRO.js +3 -3
- package/modern/locales/ruRU.js +3 -3
- package/modern/locales/skSK.js +3 -3
- package/modern/locales/svSE.js +3 -3
- package/modern/locales/trTR.js +3 -3
- package/modern/locales/ukUA.js +3 -3
- package/modern/locales/urPK.js +3 -3
- package/modern/locales/utils/getPickersLocalization.js +1 -1
- package/modern/locales/viVN.js +3 -3
- package/modern/locales/zhCN.js +3 -3
- package/modern/locales/zhHK.js +3 -3
- package/modern/validation/useValidation.js +2 -3
- package/modern/validation/validateDate.js +5 -0
- package/modern/validation/validateDateTime.js +5 -0
- package/modern/validation/validateTime.js +5 -0
- package/node/DateCalendar/DateCalendar.js +20 -22
- package/node/DateCalendar/DayCalendar.js +13 -10
- package/node/DateField/DateField.js +8 -10
- package/node/DatePicker/DatePicker.js +15 -14
- package/node/DatePicker/DatePickerToolbar.js +12 -2
- package/node/DateTimeField/DateTimeField.js +9 -12
- package/node/DateTimePicker/DateTimePicker.js +16 -16
- package/node/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/node/DateTimePicker/DateTimePickerToolbar.js +12 -2
- package/node/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -0
- package/node/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/node/DigitalClock/DigitalClock.js +7 -6
- package/node/MobileDatePicker/MobileDatePicker.js +17 -16
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/node/MobileTimePicker/MobileTimePicker.js +11 -6
- package/node/MonthCalendar/MonthCalendar.js +17 -14
- package/node/MonthCalendar/PickersMonth.js +17 -13
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -6
- package/node/PickersActionBar/PickersActionBar.js +2 -2
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/node/PickersLayout/PickersLayout.js +10 -0
- package/node/PickersLayout/usePickerLayout.js +17 -18
- package/node/StaticDatePicker/StaticDatePicker.js +14 -13
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
- package/node/StaticTimePicker/StaticTimePicker.js +8 -3
- package/node/TimeClock/Clock.js +3 -3
- package/node/TimeClock/TimeClock.js +7 -6
- package/node/TimeField/TimeField.js +6 -6
- package/node/TimePicker/TimePicker.js +9 -4
- package/node/TimePicker/TimePickerToolbar.js +12 -2
- package/node/YearCalendar/PickersYear.js +17 -13
- package/node/YearCalendar/YearCalendar.js +17 -14
- package/node/hooks/index.js +6 -6
- package/node/hooks/useClearableField.js +4 -3
- package/node/hooks/useParsedFormat.js +2 -2
- package/node/hooks/usePickerContext.js +21 -0
- package/node/hooks/usePickerTranslations.js +10 -0
- package/node/index.js +1 -1
- package/node/internals/components/PickerProvider.js +46 -0
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -17
- package/node/internals/hooks/useField/useField.js +1 -1
- package/node/internals/hooks/useField/useField.utils.js +2 -1
- package/node/internals/hooks/useField/useFieldState.js +3 -3
- package/node/internals/hooks/useField/useFieldV7TextField.js +2 -2
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +23 -18
- package/node/internals/hooks/usePicker/usePicker.js +12 -4
- package/node/internals/hooks/usePicker/usePickerOwnerState.js +9 -6
- package/node/internals/hooks/usePicker/usePickerProvider.js +28 -0
- package/node/internals/hooks/usePicker/usePickerValue.js +1 -7
- package/node/internals/hooks/usePickerPrivateContext.js +15 -0
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +5 -4
- package/node/internals/hooks/useViews.js +3 -3
- package/node/internals/index.js +14 -7
- package/node/internals/models/index.js +22 -0
- package/node/internals/models/props/time.js +5 -0
- package/node/internals/models/value.js +5 -0
- package/node/locales/beBY.js +3 -3
- package/node/locales/bgBG.js +3 -3
- package/node/locales/caES.js +3 -3
- package/node/locales/csCZ.js +3 -3
- package/node/locales/daDK.js +3 -3
- package/node/locales/deDE.js +3 -3
- package/node/locales/elGR.js +12 -13
- package/node/locales/enUS.js +3 -3
- package/node/locales/esES.js +3 -3
- package/node/locales/eu.js +3 -3
- package/node/locales/faIR.js +3 -3
- package/node/locales/fiFI.js +3 -3
- package/node/locales/frFR.js +3 -3
- package/node/locales/heIL.js +3 -3
- package/node/locales/hrHR.js +3 -3
- package/node/locales/huHU.js +3 -3
- package/node/locales/isIS.js +3 -3
- package/node/locales/itIT.js +3 -3
- package/node/locales/jaJP.js +3 -3
- package/node/locales/koKR.js +3 -3
- package/node/locales/kzKZ.js +3 -3
- package/node/locales/mk.js +3 -3
- package/node/locales/nbNO.js +3 -3
- package/node/locales/nlNL.js +3 -3
- package/node/locales/nnNO.js +3 -3
- package/node/locales/plPL.js +3 -3
- package/node/locales/ptBR.js +5 -3
- package/node/locales/ptPT.js +3 -3
- package/node/locales/roRO.js +3 -3
- package/node/locales/ruRU.js +3 -3
- package/node/locales/skSK.js +3 -3
- package/node/locales/svSE.js +3 -3
- package/node/locales/trTR.js +3 -3
- package/node/locales/ukUA.js +3 -3
- package/node/locales/urPK.js +3 -3
- package/node/locales/utils/getPickersLocalization.js +1 -1
- package/node/locales/viVN.js +3 -3
- package/node/locales/zhCN.js +3 -3
- package/node/locales/zhHK.js +3 -3
- package/node/validation/useValidation.js +2 -3
- package/node/validation/validateDate.js +4 -0
- package/node/validation/validateDateTime.js +4 -0
- package/node/validation/validateTime.js +4 -0
- package/package.json +4 -4
- package/themeAugmentation/props.d.ts +28 -28
- package/timeViewRenderers/timeViewRenderers.d.ts +6 -6
- package/validation/extractValidationProps.d.ts +4 -4
- package/validation/useValidation.d.ts +9 -10
- package/validation/useValidation.js +2 -3
- package/validation/validateDate.d.ts +7 -2
- package/validation/validateDate.js +5 -0
- package/validation/validateDateTime.d.ts +10 -4
- package/validation/validateDateTime.js +5 -0
- package/validation/validateTime.d.ts +7 -2
- package/validation/validateTime.js +5 -0
- package/hooks/usePickersContext.d.ts +0 -4
- package/hooks/usePickersContext.js +0 -15
- package/hooks/usePickersTranslations.d.ts +0 -2
- package/internals/components/PickersProvider.js +0 -26
- package/modern/hooks/usePickersContext.js +0 -15
- package/modern/internals/components/PickersProvider.js +0 -26
- package/node/hooks/usePickersContext.js +0 -21
- package/node/hooks/usePickersTranslations.js +0 -10
- package/node/internals/components/PickersProvider.js +0 -34
- /package/internals/models/{props/clock.js → formProps.js} +0 -0
- /package/{modern/internals/models/props/clock.js → internals/models/props/time.js} +0 -0
- /package/node/internals/models/{props/clock.js → formProps.js} +0 -0
|
@@ -2,9 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import { SlotComponentProps } from '@mui/utils';
|
|
3
3
|
import MenuItem from '@mui/material/MenuItem';
|
|
4
4
|
import { DigitalClockClasses } from './digitalClockClasses';
|
|
5
|
-
import { BaseClockProps, DigitalClockOnlyProps, ExportedBaseClockProps } from '../internals/models/props/
|
|
6
|
-
import {
|
|
7
|
-
export interface ExportedDigitalClockProps
|
|
5
|
+
import { BaseClockProps, DigitalClockOnlyProps, ExportedBaseClockProps } from '../internals/models/props/time';
|
|
6
|
+
import { TimeView } from '../models';
|
|
7
|
+
export interface ExportedDigitalClockProps extends ExportedBaseClockProps, DigitalClockOnlyProps {
|
|
8
8
|
}
|
|
9
9
|
export interface DigitalClockSlots {
|
|
10
10
|
/**
|
|
@@ -16,7 +16,7 @@ export interface DigitalClockSlots {
|
|
|
16
16
|
export interface DigitalClockSlotProps {
|
|
17
17
|
digitalClockItem?: SlotComponentProps<typeof MenuItem, {}, Record<string, any>>;
|
|
18
18
|
}
|
|
19
|
-
export interface DigitalClockProps
|
|
19
|
+
export interface DigitalClockProps extends ExportedDigitalClockProps, BaseClockProps<Extract<TimeView, 'hours'>> {
|
|
20
20
|
/**
|
|
21
21
|
* Available views.
|
|
22
22
|
* @default ['hours']
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AdapterFormats, MuiPickersAdapter, PickerValidDate } from '../models';
|
|
3
3
|
import { PickersInputLocaleText } from '../locales';
|
|
4
|
-
export interface MuiPickersAdapterContextValue
|
|
4
|
+
export interface MuiPickersAdapterContextValue {
|
|
5
5
|
defaultDates: {
|
|
6
|
-
minDate:
|
|
7
|
-
maxDate:
|
|
6
|
+
minDate: PickerValidDate;
|
|
7
|
+
maxDate: PickerValidDate;
|
|
8
8
|
};
|
|
9
|
-
utils: MuiPickersAdapter
|
|
10
|
-
localeText: PickersInputLocaleText
|
|
9
|
+
utils: MuiPickersAdapter;
|
|
10
|
+
localeText: PickersInputLocaleText | undefined;
|
|
11
11
|
}
|
|
12
|
-
export type MuiPickersAdapterContextNullableValue
|
|
13
|
-
[K in keyof MuiPickersAdapterContextValue
|
|
12
|
+
export type MuiPickersAdapterContextNullableValue = {
|
|
13
|
+
[K in keyof MuiPickersAdapterContextValue]: MuiPickersAdapterContextValue[K] | null;
|
|
14
14
|
};
|
|
15
|
-
export declare const MuiPickersAdapterContext: React.Context<MuiPickersAdapterContextNullableValue
|
|
16
|
-
export interface LocalizationProviderProps<
|
|
15
|
+
export declare const MuiPickersAdapterContext: React.Context<MuiPickersAdapterContextNullableValue | null>;
|
|
16
|
+
export interface LocalizationProviderProps<TLocale> {
|
|
17
17
|
children?: React.ReactNode;
|
|
18
18
|
/**
|
|
19
19
|
* Date library adapter class function.
|
|
20
20
|
* @see See the localization provider {@link https://mui.com/x/react-date-pickers/getting-started/#setup-your-date-library-adapter date adapter setup section} for more details.
|
|
21
21
|
*/
|
|
22
|
-
dateAdapter?: new (...args: any) => MuiPickersAdapter<
|
|
22
|
+
dateAdapter?: new (...args: any) => MuiPickersAdapter<TLocale>;
|
|
23
23
|
/** Formats that are used for any child pickers */
|
|
24
24
|
dateFormats?: Partial<AdapterFormats>;
|
|
25
25
|
/**
|
|
@@ -36,9 +36,9 @@ export interface LocalizationProviderProps<TDate extends PickerValidDate, TLocal
|
|
|
36
36
|
/**
|
|
37
37
|
* Locale for components texts
|
|
38
38
|
*/
|
|
39
|
-
localeText?: PickersInputLocaleText
|
|
39
|
+
localeText?: PickersInputLocaleText;
|
|
40
40
|
}
|
|
41
|
-
type LocalizationProviderComponent = (<
|
|
41
|
+
type LocalizationProviderComponent = (<TLocale>(props: LocalizationProviderProps<TLocale>) => React.JSX.Element) & {
|
|
42
42
|
propTypes?: any;
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MobileDatePickerProps } from './MobileDatePicker.types';
|
|
3
|
-
|
|
4
|
-
type MobileDatePickerComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: MobileDatePickerProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
3
|
+
type MobileDatePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: MobileDatePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -7,7 +7,7 @@ import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
|
7
7
|
import { refType } from '@mui/utils';
|
|
8
8
|
import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
|
|
9
9
|
import { useDatePickerDefaultizedProps } from "../DatePicker/shared.js";
|
|
10
|
-
import {
|
|
10
|
+
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
11
11
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
12
12
|
import { extractValidationProps, validateDate } from "../validation/index.js";
|
|
13
13
|
import { DateField } from "../DateField/index.js";
|
|
@@ -26,7 +26,7 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
|
|
|
26
26
|
* - [MobileDatePicker API](https://mui.com/x/api/date-pickers/mobile-date-picker/)
|
|
27
27
|
*/
|
|
28
28
|
const MobileDatePicker = /*#__PURE__*/React.forwardRef(function MobileDatePicker(inProps, ref) {
|
|
29
|
-
const translations =
|
|
29
|
+
const translations = usePickerTranslations();
|
|
30
30
|
const utils = useUtils();
|
|
31
31
|
|
|
32
32
|
// Props with the default values common to all date pickers
|
|
@@ -89,9 +89,9 @@ MobileDatePicker.propTypes = {
|
|
|
89
89
|
closeOnSelect: PropTypes.bool,
|
|
90
90
|
/**
|
|
91
91
|
* Formats the day of week displayed in the calendar header.
|
|
92
|
-
* @param {
|
|
92
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
93
93
|
* @returns {string} The name to display.
|
|
94
|
-
* @default (date:
|
|
94
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
95
95
|
*/
|
|
96
96
|
dayOfWeekFormatter: PropTypes.func,
|
|
97
97
|
/**
|
|
@@ -100,7 +100,8 @@ MobileDatePicker.propTypes = {
|
|
|
100
100
|
*/
|
|
101
101
|
defaultValue: PropTypes.object,
|
|
102
102
|
/**
|
|
103
|
-
* If `true`, the
|
|
103
|
+
* If `true`, the component is disabled.
|
|
104
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
104
105
|
* @default false
|
|
105
106
|
*/
|
|
106
107
|
disabled: PropTypes.bool,
|
|
@@ -129,7 +130,7 @@ MobileDatePicker.propTypes = {
|
|
|
129
130
|
*/
|
|
130
131
|
displayWeekNumber: PropTypes.bool,
|
|
131
132
|
/**
|
|
132
|
-
* @default
|
|
133
|
+
* @default true
|
|
133
134
|
*/
|
|
134
135
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
135
136
|
/**
|
|
@@ -219,8 +220,7 @@ MobileDatePicker.propTypes = {
|
|
|
219
220
|
onError: PropTypes.func,
|
|
220
221
|
/**
|
|
221
222
|
* Callback fired on month change.
|
|
222
|
-
* @
|
|
223
|
-
* @param {TDate} month The new month.
|
|
223
|
+
* @param {PickerValidDate} month The new month.
|
|
224
224
|
*/
|
|
225
225
|
onMonthChange: PropTypes.func,
|
|
226
226
|
/**
|
|
@@ -241,8 +241,7 @@ MobileDatePicker.propTypes = {
|
|
|
241
241
|
onViewChange: PropTypes.func,
|
|
242
242
|
/**
|
|
243
243
|
* Callback fired on year change.
|
|
244
|
-
* @
|
|
245
|
-
* @param {TDate} year The new year.
|
|
244
|
+
* @param {PickerValidDate} year The new year.
|
|
246
245
|
*/
|
|
247
246
|
onYearChange: PropTypes.func,
|
|
248
247
|
/**
|
|
@@ -260,6 +259,11 @@ MobileDatePicker.propTypes = {
|
|
|
260
259
|
* Force rendering in particular orientation.
|
|
261
260
|
*/
|
|
262
261
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
262
|
+
/**
|
|
263
|
+
* If `true`, the component is read-only.
|
|
264
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
265
|
+
* @default false
|
|
266
|
+
*/
|
|
263
267
|
readOnly: PropTypes.bool,
|
|
264
268
|
/**
|
|
265
269
|
* If `true`, disable heavy animations.
|
|
@@ -292,22 +296,19 @@ MobileDatePicker.propTypes = {
|
|
|
292
296
|
*
|
|
293
297
|
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
294
298
|
*
|
|
295
|
-
* @
|
|
296
|
-
* @param {TDate} day The date to test.
|
|
299
|
+
* @param {PickerValidDate} day The date to test.
|
|
297
300
|
* @returns {boolean} If `true` the date will be disabled.
|
|
298
301
|
*/
|
|
299
302
|
shouldDisableDate: PropTypes.func,
|
|
300
303
|
/**
|
|
301
304
|
* Disable specific month.
|
|
302
|
-
* @
|
|
303
|
-
* @param {TDate} month The month to test.
|
|
305
|
+
* @param {PickerValidDate} month The month to test.
|
|
304
306
|
* @returns {boolean} If `true`, the month will be disabled.
|
|
305
307
|
*/
|
|
306
308
|
shouldDisableMonth: PropTypes.func,
|
|
307
309
|
/**
|
|
308
310
|
* Disable specific year.
|
|
309
|
-
* @
|
|
310
|
-
* @param {TDate} year The year to test.
|
|
311
|
+
* @param {PickerValidDate} year The year to test.
|
|
311
312
|
* @returns {boolean} If `true`, the year will be disabled.
|
|
312
313
|
*/
|
|
313
314
|
shouldDisableYear: PropTypes.func,
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
1
2
|
import { UseMobilePickerSlots, MobileOnlyPickerProps, ExportedUseMobilePickerSlotProps } from '../internals/hooks/useMobilePicker';
|
|
2
3
|
import { BaseDatePickerProps, BaseDatePickerSlots, BaseDatePickerSlotProps } from '../DatePicker/shared';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export interface MobileDatePickerSlots<TDate extends PickerValidDate> extends BaseDatePickerSlots<TDate>, MakeOptional<UseMobilePickerSlots<TDate, DateView>, 'field'> {
|
|
4
|
+
import { DateView } from '../models';
|
|
5
|
+
export interface MobileDatePickerSlots extends BaseDatePickerSlots, MakeOptional<UseMobilePickerSlots<DateView>, 'field'> {
|
|
6
6
|
}
|
|
7
|
-
export interface MobileDatePickerSlotProps<
|
|
7
|
+
export interface MobileDatePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDatePickerSlotProps, ExportedUseMobilePickerSlotProps<DateView, TEnableAccessibleFieldDOMStructure> {
|
|
8
8
|
}
|
|
9
|
-
export interface MobileDatePickerProps<
|
|
9
|
+
export interface MobileDatePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseDatePickerProps, MobileOnlyPickerProps {
|
|
10
10
|
/**
|
|
11
11
|
* Overridable component slots.
|
|
12
12
|
* @default {}
|
|
13
13
|
*/
|
|
14
|
-
slots?: MobileDatePickerSlots
|
|
14
|
+
slots?: MobileDatePickerSlots;
|
|
15
15
|
/**
|
|
16
16
|
* The props used for each component slot.
|
|
17
17
|
* @default {}
|
|
18
18
|
*/
|
|
19
|
-
slotProps?: MobileDatePickerSlotProps<
|
|
19
|
+
slotProps?: MobileDatePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
20
20
|
/**
|
|
21
21
|
* Years rendered per row.
|
|
22
22
|
* @default 3
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MobileDateTimePickerProps } from './MobileDateTimePicker.types';
|
|
3
|
-
import { DateOrTimeView
|
|
4
|
-
type MobileDateTimePickerComponent = (<
|
|
3
|
+
import { DateOrTimeView } from '../models';
|
|
4
|
+
type MobileDateTimePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: MobileDateTimePickerProps<DateOrTimeView, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
5
|
propTypes?: any;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
@@ -8,7 +8,7 @@ import { refType } from '@mui/utils';
|
|
|
8
8
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
9
9
|
import { DateTimeField } from "../DateTimeField/index.js";
|
|
10
10
|
import { useDateTimePickerDefaultizedProps } from "../DateTimePicker/shared.js";
|
|
11
|
-
import {
|
|
11
|
+
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
12
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
13
13
|
import { extractValidationProps, validateDateTime } from "../validation/index.js";
|
|
14
14
|
import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
|
|
@@ -27,7 +27,7 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
|
|
|
27
27
|
* - [MobileDateTimePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-picker/)
|
|
28
28
|
*/
|
|
29
29
|
const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimePicker(inProps, ref) {
|
|
30
|
-
const translations =
|
|
30
|
+
const translations = usePickerTranslations();
|
|
31
31
|
const utils = useUtils();
|
|
32
32
|
|
|
33
33
|
// Props with the default values common to all date time pickers
|
|
@@ -109,9 +109,9 @@ MobileDateTimePicker.propTypes = {
|
|
|
109
109
|
closeOnSelect: PropTypes.bool,
|
|
110
110
|
/**
|
|
111
111
|
* Formats the day of week displayed in the calendar header.
|
|
112
|
-
* @param {
|
|
112
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
113
113
|
* @returns {string} The name to display.
|
|
114
|
-
* @default (date:
|
|
114
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
115
115
|
*/
|
|
116
116
|
dayOfWeekFormatter: PropTypes.func,
|
|
117
117
|
/**
|
|
@@ -120,7 +120,8 @@ MobileDateTimePicker.propTypes = {
|
|
|
120
120
|
*/
|
|
121
121
|
defaultValue: PropTypes.object,
|
|
122
122
|
/**
|
|
123
|
-
* If `true`, the
|
|
123
|
+
* If `true`, the component is disabled.
|
|
124
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
124
125
|
* @default false
|
|
125
126
|
*/
|
|
126
127
|
disabled: PropTypes.bool,
|
|
@@ -154,7 +155,7 @@ MobileDateTimePicker.propTypes = {
|
|
|
154
155
|
*/
|
|
155
156
|
displayWeekNumber: PropTypes.bool,
|
|
156
157
|
/**
|
|
157
|
-
* @default
|
|
158
|
+
* @default true
|
|
158
159
|
*/
|
|
159
160
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
160
161
|
/**
|
|
@@ -267,8 +268,7 @@ MobileDateTimePicker.propTypes = {
|
|
|
267
268
|
onError: PropTypes.func,
|
|
268
269
|
/**
|
|
269
270
|
* Callback fired on month change.
|
|
270
|
-
* @
|
|
271
|
-
* @param {TDate} month The new month.
|
|
271
|
+
* @param {PickerValidDate} month The new month.
|
|
272
272
|
*/
|
|
273
273
|
onMonthChange: PropTypes.func,
|
|
274
274
|
/**
|
|
@@ -289,8 +289,7 @@ MobileDateTimePicker.propTypes = {
|
|
|
289
289
|
onViewChange: PropTypes.func,
|
|
290
290
|
/**
|
|
291
291
|
* Callback fired on year change.
|
|
292
|
-
* @
|
|
293
|
-
* @param {TDate} year The new year.
|
|
292
|
+
* @param {PickerValidDate} year The new year.
|
|
294
293
|
*/
|
|
295
294
|
onYearChange: PropTypes.func,
|
|
296
295
|
/**
|
|
@@ -308,6 +307,11 @@ MobileDateTimePicker.propTypes = {
|
|
|
308
307
|
* Force rendering in particular orientation.
|
|
309
308
|
*/
|
|
310
309
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
310
|
+
/**
|
|
311
|
+
* If `true`, the component is read-only.
|
|
312
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
313
|
+
* @default false
|
|
314
|
+
*/
|
|
311
315
|
readOnly: PropTypes.bool,
|
|
312
316
|
/**
|
|
313
317
|
* If `true`, disable heavy animations.
|
|
@@ -340,30 +344,26 @@ MobileDateTimePicker.propTypes = {
|
|
|
340
344
|
*
|
|
341
345
|
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
342
346
|
*
|
|
343
|
-
* @
|
|
344
|
-
* @param {TDate} day The date to test.
|
|
347
|
+
* @param {PickerValidDate} day The date to test.
|
|
345
348
|
* @returns {boolean} If `true` the date will be disabled.
|
|
346
349
|
*/
|
|
347
350
|
shouldDisableDate: PropTypes.func,
|
|
348
351
|
/**
|
|
349
352
|
* Disable specific month.
|
|
350
|
-
* @
|
|
351
|
-
* @param {TDate} month The month to test.
|
|
353
|
+
* @param {PickerValidDate} month The month to test.
|
|
352
354
|
* @returns {boolean} If `true`, the month will be disabled.
|
|
353
355
|
*/
|
|
354
356
|
shouldDisableMonth: PropTypes.func,
|
|
355
357
|
/**
|
|
356
358
|
* Disable specific time.
|
|
357
|
-
* @
|
|
358
|
-
* @param {TDate} value The value to check.
|
|
359
|
+
* @param {PickerValidDate} value The value to check.
|
|
359
360
|
* @param {TimeView} view The clock type of the timeValue.
|
|
360
361
|
* @returns {boolean} If `true` the time will be disabled.
|
|
361
362
|
*/
|
|
362
363
|
shouldDisableTime: PropTypes.func,
|
|
363
364
|
/**
|
|
364
365
|
* Disable specific year.
|
|
365
|
-
* @
|
|
366
|
-
* @param {TDate} year The year to test.
|
|
366
|
+
* @param {PickerValidDate} year The year to test.
|
|
367
367
|
* @returns {boolean} If `true`, the year will be disabled.
|
|
368
368
|
*/
|
|
369
369
|
shouldDisableYear: PropTypes.func,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
1
2
|
import { UseMobilePickerSlots, ExportedUseMobilePickerSlotProps, MobileOnlyPickerProps } from '../internals/hooks/useMobilePicker';
|
|
2
3
|
import { BaseDateTimePickerProps, BaseDateTimePickerSlots, BaseDateTimePickerSlotProps } from '../DateTimePicker/shared';
|
|
3
|
-
import {
|
|
4
|
-
import { DateOrTimeView, PickerValidDate } from '../models';
|
|
4
|
+
import { DateOrTimeView } from '../models';
|
|
5
5
|
import { DateOrTimeViewWithMeridiem } from '../internals/models';
|
|
6
|
-
export interface MobileDateTimePickerSlots<
|
|
6
|
+
export interface MobileDateTimePickerSlots<TView extends DateOrTimeViewWithMeridiem> extends BaseDateTimePickerSlots, MakeOptional<UseMobilePickerSlots<TView>, 'field'> {
|
|
7
7
|
}
|
|
8
|
-
export interface MobileDateTimePickerSlotProps<
|
|
8
|
+
export interface MobileDateTimePickerSlotProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateTimePickerSlotProps, ExportedUseMobilePickerSlotProps<TView, TEnableAccessibleFieldDOMStructure> {
|
|
9
9
|
}
|
|
10
|
-
export interface MobileDateTimePickerProps<
|
|
10
|
+
export interface MobileDateTimePickerProps<TView extends DateOrTimeViewWithMeridiem = DateOrTimeView, TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseDateTimePickerProps<TView>, MobileOnlyPickerProps {
|
|
11
11
|
/**
|
|
12
12
|
* Overridable component slots.
|
|
13
13
|
* @default {}
|
|
14
14
|
*/
|
|
15
|
-
slots?: MobileDateTimePickerSlots<
|
|
15
|
+
slots?: MobileDateTimePickerSlots<TView>;
|
|
16
16
|
/**
|
|
17
17
|
* The props used for each component slot.
|
|
18
18
|
* @default {}
|
|
19
19
|
*/
|
|
20
|
-
slotProps?: MobileDateTimePickerSlotProps<
|
|
20
|
+
slotProps?: MobileDateTimePickerSlotProps<TView, TEnableAccessibleFieldDOMStructure>;
|
|
21
21
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MobileTimePickerProps } from './MobileTimePicker.types';
|
|
3
|
-
import {
|
|
4
|
-
type MobileTimePickerComponent = (<
|
|
3
|
+
import { TimeView } from '../models';
|
|
4
|
+
type MobileTimePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: MobileTimePickerProps<TimeView, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
5
|
propTypes?: any;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
@@ -8,7 +8,7 @@ import { refType } from '@mui/utils';
|
|
|
8
8
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
9
9
|
import { TimeField } from "../TimeField/index.js";
|
|
10
10
|
import { useTimePickerDefaultizedProps } from "../TimePicker/shared.js";
|
|
11
|
-
import {
|
|
11
|
+
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
12
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
13
13
|
import { extractValidationProps, validateTime } from "../validation/index.js";
|
|
14
14
|
import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
|
|
@@ -26,7 +26,7 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
|
|
|
26
26
|
* - [MobileTimePicker API](https://mui.com/x/api/date-pickers/mobile-time-picker/)
|
|
27
27
|
*/
|
|
28
28
|
const MobileTimePicker = /*#__PURE__*/React.forwardRef(function MobileTimePicker(inProps, ref) {
|
|
29
|
-
const translations =
|
|
29
|
+
const translations = usePickerTranslations();
|
|
30
30
|
const utils = useUtils();
|
|
31
31
|
|
|
32
32
|
// Props with the default values common to all time pickers
|
|
@@ -106,7 +106,8 @@ MobileTimePicker.propTypes = {
|
|
|
106
106
|
*/
|
|
107
107
|
defaultValue: PropTypes.object,
|
|
108
108
|
/**
|
|
109
|
-
* If `true`, the
|
|
109
|
+
* If `true`, the component is disabled.
|
|
110
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
110
111
|
* @default false
|
|
111
112
|
*/
|
|
112
113
|
disabled: PropTypes.bool,
|
|
@@ -131,7 +132,7 @@ MobileTimePicker.propTypes = {
|
|
|
131
132
|
*/
|
|
132
133
|
disablePast: PropTypes.bool,
|
|
133
134
|
/**
|
|
134
|
-
* @default
|
|
135
|
+
* @default true
|
|
135
136
|
*/
|
|
136
137
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
137
138
|
/**
|
|
@@ -239,6 +240,11 @@ MobileTimePicker.propTypes = {
|
|
|
239
240
|
* Force rendering in particular orientation.
|
|
240
241
|
*/
|
|
241
242
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
243
|
+
/**
|
|
244
|
+
* If `true`, the component is read-only.
|
|
245
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
246
|
+
* @default false
|
|
247
|
+
*/
|
|
242
248
|
readOnly: PropTypes.bool,
|
|
243
249
|
/**
|
|
244
250
|
* If `true`, disable heavy animations.
|
|
@@ -262,8 +268,7 @@ MobileTimePicker.propTypes = {
|
|
|
262
268
|
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number]),
|
|
263
269
|
/**
|
|
264
270
|
* Disable specific time.
|
|
265
|
-
* @
|
|
266
|
-
* @param {TDate} value The value to check.
|
|
271
|
+
* @param {PickerValidDate} value The value to check.
|
|
267
272
|
* @param {TimeView} view The clock type of the timeValue.
|
|
268
273
|
* @returns {boolean} If `true` the time will be disabled.
|
|
269
274
|
*/
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
1
2
|
import { UseMobilePickerSlots, ExportedUseMobilePickerSlotProps, MobileOnlyPickerProps } from '../internals/hooks/useMobilePicker';
|
|
2
3
|
import { BaseTimePickerProps, BaseTimePickerSlots, BaseTimePickerSlotProps } from '../TimePicker/shared';
|
|
3
|
-
import {
|
|
4
|
-
import { PickerValidDate, TimeView } from '../models';
|
|
4
|
+
import { TimeView } from '../models';
|
|
5
5
|
import { TimeViewWithMeridiem } from '../internals/models';
|
|
6
|
-
export interface MobileTimePickerSlots<
|
|
6
|
+
export interface MobileTimePickerSlots<TView extends TimeViewWithMeridiem> extends BaseTimePickerSlots, MakeOptional<UseMobilePickerSlots<TView>, 'field'> {
|
|
7
7
|
}
|
|
8
|
-
export interface MobileTimePickerSlotProps<
|
|
8
|
+
export interface MobileTimePickerSlotProps<TView extends TimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends BaseTimePickerSlotProps, ExportedUseMobilePickerSlotProps<TView, TEnableAccessibleFieldDOMStructure> {
|
|
9
9
|
}
|
|
10
|
-
export interface MobileTimePickerProps<
|
|
10
|
+
export interface MobileTimePickerProps<TView extends TimeViewWithMeridiem = TimeView, TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseTimePickerProps<TView>, MobileOnlyPickerProps {
|
|
11
11
|
/**
|
|
12
12
|
* Overridable component slots.
|
|
13
13
|
* @default {}
|
|
14
14
|
*/
|
|
15
|
-
slots?: MobileTimePickerSlots<
|
|
15
|
+
slots?: MobileTimePickerSlots<TView>;
|
|
16
16
|
/**
|
|
17
17
|
* The props used for each component slot.
|
|
18
18
|
* @default {}
|
|
19
19
|
*/
|
|
20
|
-
slotProps?: MobileTimePickerSlotProps<
|
|
20
|
+
slotProps?: MobileTimePickerSlotProps<TView, TEnableAccessibleFieldDOMStructure>;
|
|
21
21
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DefaultizedProps } from '
|
|
2
|
+
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
import { MonthCalendarProps } from './MonthCalendar.types';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type MonthCalendarComponent = (<TDate extends PickerValidDate>(props: MonthCalendarProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
4
|
+
export declare function useMonthCalendarDefaultizedProps(props: MonthCalendarProps, name: string): DefaultizedProps<MonthCalendarProps, 'minDate' | 'maxDate' | 'disableFuture' | 'disablePast'>;
|
|
5
|
+
type MonthCalendarComponent = ((props: MonthCalendarProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
7
6
|
propTypes?: any;
|
|
8
7
|
};
|
|
9
8
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["className", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "autoFocus", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow", "timezone", "gridLabelId", "slots", "slotProps"];
|
|
5
|
+
const _excluded = ["className", "classes", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "autoFocus", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow", "timezone", "gridLabelId", "slots", "slotProps"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -17,11 +17,9 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
|
17
17
|
import { SECTION_TYPE_GRANULARITY } from "../internals/utils/getDefaultReferenceDate.js";
|
|
18
18
|
import { useControlledValueWithTimezone } from "../internals/hooks/useValueWithTimezone.js";
|
|
19
19
|
import { DIALOG_WIDTH } from "../internals/constants/dimensions.js";
|
|
20
|
+
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
20
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
-
const useUtilityClasses =
|
|
22
|
-
const {
|
|
23
|
-
classes
|
|
24
|
-
} = ownerState;
|
|
22
|
+
const useUtilityClasses = classes => {
|
|
25
23
|
const slots = {
|
|
26
24
|
root: ['root']
|
|
27
25
|
};
|
|
@@ -68,6 +66,7 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
68
66
|
const props = useMonthCalendarDefaultizedProps(inProps, 'MuiMonthCalendar');
|
|
69
67
|
const {
|
|
70
68
|
className,
|
|
69
|
+
classes: classesProp,
|
|
71
70
|
value: valueProp,
|
|
72
71
|
defaultValue,
|
|
73
72
|
referenceDate: referenceDateProp,
|
|
@@ -99,12 +98,15 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
99
98
|
timezone: timezoneProp,
|
|
100
99
|
value: valueProp,
|
|
101
100
|
defaultValue,
|
|
102
|
-
onChange
|
|
101
|
+
onChange,
|
|
103
102
|
valueManager: singleItemValueManager
|
|
104
103
|
});
|
|
105
104
|
const now = useNow(timezone);
|
|
106
105
|
const isRtl = useRtl();
|
|
107
106
|
const utils = useUtils();
|
|
107
|
+
const {
|
|
108
|
+
ownerState
|
|
109
|
+
} = usePickerPrivateContext();
|
|
108
110
|
const referenceDate = React.useMemo(() => singleItemValueManager.getInitialReferenceValue({
|
|
109
111
|
value,
|
|
110
112
|
utils,
|
|
@@ -114,8 +116,7 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
114
116
|
granularity: SECTION_TYPE_GRANULARITY.month
|
|
115
117
|
}), [] // eslint-disable-line react-hooks/exhaustive-deps
|
|
116
118
|
);
|
|
117
|
-
const
|
|
118
|
-
const classes = useUtilityClasses(ownerState);
|
|
119
|
+
const classes = useUtilityClasses(classesProp);
|
|
119
120
|
const todayMonth = React.useMemo(() => utils.getMonth(now), [utils, now]);
|
|
120
121
|
const selectedMonth = React.useMemo(() => {
|
|
121
122
|
if (value != null) {
|
|
@@ -252,7 +253,9 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
|
|
|
252
253
|
*/
|
|
253
254
|
defaultValue: PropTypes.object,
|
|
254
255
|
/**
|
|
255
|
-
* If `true
|
|
256
|
+
* If `true`, the component is disabled.
|
|
257
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
258
|
+
* @default false
|
|
256
259
|
*/
|
|
257
260
|
disabled: PropTypes.bool,
|
|
258
261
|
/**
|
|
@@ -289,14 +292,15 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
|
|
|
289
292
|
monthsPerRow: PropTypes.oneOf([3, 4]),
|
|
290
293
|
/**
|
|
291
294
|
* Callback fired when the value changes.
|
|
292
|
-
* @
|
|
293
|
-
* @param {TDate} value The new value.
|
|
295
|
+
* @param {PickerValidDate} value The new value.
|
|
294
296
|
*/
|
|
295
297
|
onChange: PropTypes.func,
|
|
296
298
|
onFocusedViewChange: PropTypes.func,
|
|
297
299
|
onMonthFocus: PropTypes.func,
|
|
298
300
|
/**
|
|
299
|
-
* If `true
|
|
301
|
+
* If `true`, the component is read-only.
|
|
302
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
303
|
+
* @default false
|
|
300
304
|
*/
|
|
301
305
|
readOnly: PropTypes.bool,
|
|
302
306
|
/**
|
|
@@ -306,8 +310,7 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
|
|
|
306
310
|
referenceDate: PropTypes.object,
|
|
307
311
|
/**
|
|
308
312
|
* Disable specific month.
|
|
309
|
-
* @
|
|
310
|
-
* @param {TDate} month The month to test.
|
|
313
|
+
* @param {PickerValidDate} month The month to test.
|
|
311
314
|
* @returns {boolean} If `true`, the month will be disabled.
|
|
312
315
|
*/
|
|
313
316
|
shouldDisableMonth: PropTypes.func,
|