@mui/x-date-pickers 7.22.3 → 8.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 +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 +348 -12
- package/DateCalendar/DateCalendar.d.ts +1 -2
- package/DateCalendar/DateCalendar.js +21 -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 +2 -4
- 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 +5 -5
- package/DateTimePicker/DateTimePickerToolbar.js +8 -7
- 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 +0 -2
- 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 +8 -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 +18 -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 +8 -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 +0 -2
- package/PickersLayout/PickersLayout.types.d.ts +16 -19
- package/PickersLayout/index.d.ts +1 -1
- package/PickersLayout/usePickerLayout.d.ts +1 -2
- package/PickersLayout/usePickerLayout.js +18 -23
- package/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/PickersTextField/PickersTextField.js +2 -2
- package/README.md +4 -4
- 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 +4 -3
- package/TimeClock/ClockNumbers.d.ts +5 -5
- package/TimeClock/TimeClock.d.ts +1 -2
- package/TimeClock/TimeClock.js +8 -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 +8 -7
- package/TimePicker/shared.d.ts +10 -10
- package/YearCalendar/PickersYear.js +17 -13
- package/YearCalendar/YearCalendar.d.ts +1 -2
- package/YearCalendar/YearCalendar.js +18 -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/hooks/useSplitFieldProps.d.ts +3 -3
- package/index.js +1 -1
- package/internals/components/PickerProvider.d.ts +67 -0
- package/internals/components/PickerProvider.js +40 -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 +22 -18
- 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 +40 -50
- package/internals/hooks/useField/useField.utils.d.ts +15 -15
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +4 -4
- package/internals/hooks/useField/useFieldState.d.ts +4 -4
- package/internals/hooks/useField/useFieldState.js +4 -3
- package/internals/hooks/useField/useFieldV7TextField.js +4 -3
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.js +24 -19
- 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 +15 -10
- package/internals/hooks/usePicker/usePicker.types.d.ts +9 -7
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +6 -8
- package/internals/hooks/usePicker/usePickerLayoutProps.js +2 -5
- package/internals/hooks/usePicker/usePickerProvider.d.ts +26 -0
- package/internals/hooks/usePicker/usePickerProvider.js +77 -0
- package/internals/hooks/usePicker/usePickerValue.d.ts +2 -2
- package/internals/hooks/usePicker/usePickerValue.js +7 -10
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +38 -39
- package/internals/hooks/usePicker/usePickerViews.d.ts +7 -11
- package/internals/hooks/usePicker/usePickerViews.js +1 -0
- 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 +6 -5
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +6 -6
- package/internals/hooks/useUtils.d.ts +7 -7
- package/internals/hooks/useValueWithTimezone.d.ts +19 -15
- package/internals/hooks/useValueWithTimezone.js +13 -1
- package/internals/hooks/useViews.d.ts +3 -3
- package/internals/hooks/useViews.js +1 -1
- package/internals/index.d.ts +7 -5
- package/internals/index.js +2 -1
- package/internals/models/common.d.ts +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 +0 -2
- 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 +17 -17
- 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/common.d.ts +1 -0
- package/models/fields.d.ts +9 -42
- package/models/pickers.d.ts +28 -6
- package/modern/DateCalendar/DateCalendar.js +21 -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 +2 -4
- 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 +8 -7
- package/modern/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +0 -2
- package/modern/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/modern/DigitalClock/DigitalClock.js +8 -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 +18 -14
- package/modern/MonthCalendar/PickersMonth.js +17 -13
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -6
- package/modern/PickersActionBar/PickersActionBar.js +2 -2
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/modern/PickersLayout/PickersLayout.js +0 -2
- package/modern/PickersLayout/usePickerLayout.js +18 -23
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/modern/PickersTextField/PickersTextField.js +2 -2
- 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 +4 -3
- package/modern/TimeClock/TimeClock.js +8 -6
- package/modern/TimeField/TimeField.js +6 -6
- package/modern/TimePicker/TimePicker.js +9 -4
- package/modern/TimePicker/TimePickerToolbar.js +8 -7
- package/modern/YearCalendar/PickersYear.js +17 -13
- package/modern/YearCalendar/YearCalendar.js +18 -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 +40 -0
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +22 -18
- package/modern/internals/hooks/useField/useField.js +1 -1
- package/modern/internals/hooks/useField/useFieldState.js +4 -3
- package/modern/internals/hooks/useField/useFieldV7TextField.js +4 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +24 -19
- package/modern/internals/hooks/usePicker/usePicker.js +15 -10
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +2 -5
- package/modern/internals/hooks/usePicker/usePickerProvider.js +77 -0
- package/modern/internals/hooks/usePicker/usePickerValue.js +7 -10
- package/modern/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/modern/internals/hooks/usePickerPrivateContext.js +9 -0
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +6 -5
- package/modern/internals/hooks/useValueWithTimezone.js +13 -1
- 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 +21 -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 +2 -4
- 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 +8 -7
- package/node/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +0 -2
- package/node/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/node/DigitalClock/DigitalClock.js +8 -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 +18 -14
- package/node/MonthCalendar/PickersMonth.js +17 -13
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -6
- package/node/PickersActionBar/PickersActionBar.js +2 -2
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/node/PickersLayout/PickersLayout.js +0 -2
- package/node/PickersLayout/usePickerLayout.js +18 -23
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/node/PickersTextField/PickersTextField.js +2 -2
- 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 +4 -3
- package/node/TimeClock/TimeClock.js +8 -6
- package/node/TimeField/TimeField.js +6 -6
- package/node/TimePicker/TimePicker.js +9 -4
- package/node/TimePicker/TimePickerToolbar.js +8 -7
- package/node/YearCalendar/PickersYear.js +17 -13
- package/node/YearCalendar/YearCalendar.js +18 -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 +48 -0
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +22 -18
- package/node/internals/hooks/useField/useField.js +1 -1
- package/node/internals/hooks/useField/useFieldState.js +4 -3
- package/node/internals/hooks/useField/useFieldV7TextField.js +4 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +24 -19
- package/node/internals/hooks/usePicker/usePicker.js +15 -10
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +2 -5
- package/node/internals/hooks/usePicker/usePickerProvider.js +87 -0
- package/node/internals/hooks/usePicker/usePickerValue.js +6 -10
- package/node/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/node/internals/hooks/usePickerPrivateContext.js +15 -0
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +6 -5
- package/node/internals/hooks/useValueWithTimezone.js +13 -1
- 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 +5 -5
- 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.d.ts +0 -34
- package/internals/components/PickersProvider.js +0 -26
- package/internals/hooks/usePicker/usePickerOwnerState.d.ts +0 -9
- package/internals/hooks/usePicker/usePickerOwnerState.js +0 -13
- package/modern/hooks/usePickersContext.js +0 -15
- package/modern/internals/components/PickersProvider.js +0 -26
- package/modern/internals/hooks/usePicker/usePickerOwnerState.js +0 -13
- package/node/hooks/usePickersContext.js +0 -21
- package/node/hooks/usePickersTranslations.js +0 -10
- package/node/internals/components/PickersProvider.js +0 -34
- package/node/internals/hooks/usePicker/usePickerOwnerState.js +0 -20
- /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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TimeClockClasses } from './timeClockClasses';
|
|
2
2
|
import { PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps } from '../internals/components/PickersArrowSwitcher';
|
|
3
|
-
import { BaseClockProps, ExportedBaseClockProps } from '../internals/models/props/
|
|
4
|
-
import {
|
|
3
|
+
import { BaseClockProps, ExportedBaseClockProps } from '../internals/models/props/time';
|
|
4
|
+
import { TimeView } from '../models';
|
|
5
5
|
import { TimeViewWithMeridiem } from '../internals/models';
|
|
6
|
-
export interface ExportedTimeClockProps
|
|
6
|
+
export interface ExportedTimeClockProps extends ExportedBaseClockProps {
|
|
7
7
|
/**
|
|
8
8
|
* Display ampm controls under the clock (instead of in the toolbar).
|
|
9
9
|
* @default false
|
|
@@ -14,7 +14,7 @@ export interface TimeClockSlots extends PickersArrowSwitcherSlots {
|
|
|
14
14
|
}
|
|
15
15
|
export interface TimeClockSlotProps extends PickersArrowSwitcherSlotProps {
|
|
16
16
|
}
|
|
17
|
-
export interface TimeClockProps<
|
|
17
|
+
export interface TimeClockProps<TView extends TimeViewWithMeridiem = TimeView> extends ExportedTimeClockProps, BaseClockProps<TView> {
|
|
18
18
|
/**
|
|
19
19
|
* Available views.
|
|
20
20
|
* @default ['hours', 'minutes']
|
package/TimeField/TimeField.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TimeFieldProps } from './TimeField.types';
|
|
3
|
-
|
|
4
|
-
type TimeFieldComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: TimeFieldProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
3
|
+
type TimeFieldComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: TimeFieldProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
package/TimeField/TimeField.js
CHANGED
|
@@ -37,7 +37,7 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, inRe
|
|
|
37
37
|
} = themeProps,
|
|
38
38
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
39
39
|
const ownerState = themeProps;
|
|
40
|
-
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure ?
|
|
40
|
+
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
|
|
41
41
|
const textFieldProps = useSlotProps({
|
|
42
42
|
elementType: TextField,
|
|
43
43
|
externalSlotProps: slotProps?.textField,
|
|
@@ -94,6 +94,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
94
94
|
defaultValue: PropTypes.object,
|
|
95
95
|
/**
|
|
96
96
|
* If `true`, the component is disabled.
|
|
97
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
97
98
|
* @default false
|
|
98
99
|
*/
|
|
99
100
|
disabled: PropTypes.bool,
|
|
@@ -113,7 +114,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
113
114
|
*/
|
|
114
115
|
disablePast: PropTypes.bool,
|
|
115
116
|
/**
|
|
116
|
-
* @default
|
|
117
|
+
* @default true
|
|
117
118
|
*/
|
|
118
119
|
enableAccessibleFieldDOMStructure: PropTypes.bool,
|
|
119
120
|
/**
|
|
@@ -233,8 +234,8 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
233
234
|
*/
|
|
234
235
|
onSelectedSectionsChange: PropTypes.func,
|
|
235
236
|
/**
|
|
236
|
-
*
|
|
237
|
-
*
|
|
237
|
+
* If `true`, the component is read-only.
|
|
238
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
238
239
|
* @default false
|
|
239
240
|
*/
|
|
240
241
|
readOnly: PropTypes.bool,
|
|
@@ -261,8 +262,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
261
262
|
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number]),
|
|
262
263
|
/**
|
|
263
264
|
* Disable specific time.
|
|
264
|
-
* @
|
|
265
|
-
* @param {TDate} value The value to check.
|
|
265
|
+
* @param {PickerValidDate} value The value to check.
|
|
266
266
|
* @param {TimeView} view The clock type of the timeValue.
|
|
267
267
|
* @returns {boolean} If `true` the time will be disabled.
|
|
268
268
|
*/
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SlotComponentProps } from '@mui/utils';
|
|
3
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
4
|
import TextField from '@mui/material/TextField';
|
|
4
5
|
import { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
5
|
-
import { MakeOptional } from '../internals/models/helpers';
|
|
6
|
-
import { BaseTimeValidationProps, TimeValidationProps } from '../internals/models/validation';
|
|
7
6
|
import { FieldSection, PickerValidDate, TimeValidationError, BuiltInFieldTextFieldProps } from '../models';
|
|
8
7
|
import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '../hooks/useClearableField';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* @default utils.is12HourCycleInCurrentLocale()
|
|
13
|
-
*/
|
|
14
|
-
ampm?: boolean;
|
|
8
|
+
import { ExportedValidateTimeProps } from '../validation/validateTime';
|
|
9
|
+
import { AmPmProps } from '../internals/models/props/time';
|
|
10
|
+
export interface UseTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValidDate | null, FieldSection, TEnableAccessibleFieldDOMStructure, TimeValidationError>, 'format'>, ExportedValidateTimeProps, ExportedUseClearableFieldProps, AmPmProps {
|
|
15
11
|
}
|
|
16
|
-
export type
|
|
17
|
-
export type TimeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false> = UseTimeFieldComponentProps<TDate, TEnableAccessibleFieldDOMStructure, BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>> & {
|
|
12
|
+
export type TimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = UseTimeFieldProps<TEnableAccessibleFieldDOMStructure> & Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>> & {
|
|
18
13
|
/**
|
|
19
14
|
* Overridable component slots.
|
|
20
15
|
* @default {}
|
|
@@ -24,9 +19,9 @@ export type TimeFieldProps<TDate extends PickerValidDate, TEnableAccessibleField
|
|
|
24
19
|
* The props used for each component slot.
|
|
25
20
|
* @default {}
|
|
26
21
|
*/
|
|
27
|
-
slotProps?: TimeFieldSlotProps<
|
|
22
|
+
slotProps?: TimeFieldSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
28
23
|
};
|
|
29
|
-
export type TimeFieldOwnerState<
|
|
24
|
+
export type TimeFieldOwnerState<TEnableAccessibleFieldDOMStructure extends boolean> = TimeFieldProps<TEnableAccessibleFieldDOMStructure>;
|
|
30
25
|
export interface TimeFieldSlots extends UseClearableFieldSlots {
|
|
31
26
|
/**
|
|
32
27
|
* Form control with an input to render the value.
|
|
@@ -34,6 +29,6 @@ export interface TimeFieldSlots extends UseClearableFieldSlots {
|
|
|
34
29
|
*/
|
|
35
30
|
textField?: React.ElementType;
|
|
36
31
|
}
|
|
37
|
-
export interface TimeFieldSlotProps<
|
|
38
|
-
textField?: SlotComponentProps<typeof TextField, {}, TimeFieldOwnerState<
|
|
32
|
+
export interface TimeFieldSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends UseClearableFieldSlotProps {
|
|
33
|
+
textField?: SlotComponentProps<typeof TextField, {}, TimeFieldOwnerState<TEnableAccessibleFieldDOMStructure>>;
|
|
39
34
|
}
|
package/TimeField/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { TimeField } from './TimeField';
|
|
2
2
|
export { useTimeField as unstable_useTimeField } from './useTimeField';
|
|
3
|
-
export type { UseTimeFieldProps,
|
|
3
|
+
export type { UseTimeFieldProps, TimeFieldProps } from './TimeField.types';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { UseTimeFieldProps } from './TimeField.types';
|
|
2
|
-
import
|
|
3
|
-
export declare const useTimeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseTimeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseTimeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("../internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps> & Required<Pick<UseTimeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("../internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "ampm" | "timezone" | "referenceDate" | "formatDensity" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "enableAccessibleFieldDOMStructure" | keyof import("../internals").BaseTimeValidationProps | keyof import("../internals").TimeValidationProps<any> | "dateSeparator">>;
|
|
2
|
+
export declare const useTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("../internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps> & Required<Pick<UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("../internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "formatDensity" | "enableAccessibleFieldDOMStructure" | "selectedSections" | "onSelectedSectionsChange" | "timezone" | "unstableFieldRef" | "referenceDate" | "shouldRespectLeadingZeros" | "ampm" | keyof import("../internals").BaseTimeValidationProps | keyof import("../internals").TimeValidationProps | "dateSeparator">>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TimePickerProps } from './TimePicker.types';
|
|
3
|
-
|
|
4
|
-
type TimePickerComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: TimePickerProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
3
|
+
type TimePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: TimePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
package/TimePicker/TimePicker.js
CHANGED
|
@@ -85,7 +85,8 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
85
85
|
*/
|
|
86
86
|
desktopModeMediaQuery: PropTypes.string,
|
|
87
87
|
/**
|
|
88
|
-
* If `true`, the
|
|
88
|
+
* If `true`, the component is disabled.
|
|
89
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
89
90
|
* @default false
|
|
90
91
|
*/
|
|
91
92
|
disabled: PropTypes.bool,
|
|
@@ -110,7 +111,7 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
110
111
|
*/
|
|
111
112
|
disablePast: PropTypes.bool,
|
|
112
113
|
/**
|
|
113
|
-
* @default
|
|
114
|
+
* @default true
|
|
114
115
|
*/
|
|
115
116
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
116
117
|
/**
|
|
@@ -218,6 +219,11 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
218
219
|
* Force rendering in particular orientation.
|
|
219
220
|
*/
|
|
220
221
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
222
|
+
/**
|
|
223
|
+
* If `true`, the component is read-only.
|
|
224
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
225
|
+
* @default false
|
|
226
|
+
*/
|
|
221
227
|
readOnly: PropTypes.bool,
|
|
222
228
|
/**
|
|
223
229
|
* If `true`, disable heavy animations.
|
|
@@ -241,8 +247,7 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
241
247
|
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number]),
|
|
242
248
|
/**
|
|
243
249
|
* Disable specific time.
|
|
244
|
-
* @
|
|
245
|
-
* @param {TDate} value The value to check.
|
|
250
|
+
* @param {PickerValidDate} value The value to check.
|
|
246
251
|
* @param {TimeView} view The clock type of the timeValue.
|
|
247
252
|
* @returns {boolean} If `true` the time will be disabled.
|
|
248
253
|
*/
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { DesktopTimePickerProps, DesktopTimePickerSlots, DesktopTimePickerSlotProps } from '../DesktopTimePicker';
|
|
2
|
-
import { TimeViewWithMeridiem } from '../internals/models';
|
|
3
|
-
import { DefaultizedProps } from '../internals/models/helpers';
|
|
4
|
-
import { BaseTimeValidationProps } from '../internals/models/validation';
|
|
2
|
+
import { BaseSingleInputFieldProps, TimeViewWithMeridiem } from '../internals/models';
|
|
5
3
|
import { MobileTimePickerProps, MobileTimePickerSlots, MobileTimePickerSlotProps } from '../MobileTimePicker';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export interface TimePickerSlots
|
|
4
|
+
import { FieldSection, PickerValidDate, TimeValidationError } from '../models';
|
|
5
|
+
import { ValidateTimeProps } from '../validation/validateTime';
|
|
6
|
+
export interface TimePickerSlots extends DesktopTimePickerSlots, MobileTimePickerSlots<TimeViewWithMeridiem> {
|
|
9
7
|
}
|
|
10
|
-
export interface TimePickerSlotProps<
|
|
8
|
+
export interface TimePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopTimePickerSlotProps<TEnableAccessibleFieldDOMStructure>, MobileTimePickerSlotProps<TimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure> {
|
|
11
9
|
}
|
|
12
|
-
export interface TimePickerProps<
|
|
10
|
+
export interface TimePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends DesktopTimePickerProps<TEnableAccessibleFieldDOMStructure>, Omit<MobileTimePickerProps<TimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure>, 'views'> {
|
|
13
11
|
/**
|
|
14
12
|
* CSS media query when `Mobile` mode will be changed to `Desktop`.
|
|
15
13
|
* @default '@media (pointer: fine)'
|
|
@@ -20,15 +18,14 @@ export interface TimePickerProps<TDate extends PickerValidDate, TEnableAccessibl
|
|
|
20
18
|
* Overridable component slots.
|
|
21
19
|
* @default {}
|
|
22
20
|
*/
|
|
23
|
-
slots?: TimePickerSlots
|
|
21
|
+
slots?: TimePickerSlots;
|
|
24
22
|
/**
|
|
25
23
|
* The props used for each component slot.
|
|
26
24
|
* @default {}
|
|
27
25
|
*/
|
|
28
|
-
slotProps?: TimePickerSlotProps<
|
|
26
|
+
slotProps?: TimePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
29
27
|
}
|
|
30
28
|
/**
|
|
31
|
-
* Props the field can receive when used inside a time picker.
|
|
32
|
-
* (`TimePicker`, `DesktopTimePicker` or `MobileTimePicker` component).
|
|
29
|
+
* Props the field can receive when used inside a time picker (<TimePicker />, <DesktopTimePicker /> or <MobileTimePicker /> component).
|
|
33
30
|
*/
|
|
34
|
-
export type TimePickerFieldProps<
|
|
31
|
+
export type TimePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateTimeProps & BaseSingleInputFieldProps<PickerValidDate | null, FieldSection, TEnableAccessibleFieldDOMStructure, TimeValidationError>;
|
|
@@ -3,7 +3,7 @@ import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/
|
|
|
3
3
|
import { TimePickerToolbarClasses } from './timePickerToolbarClasses';
|
|
4
4
|
import { TimeViewWithMeridiem } from '../internals/models';
|
|
5
5
|
import { PickerValidDate } from '../models';
|
|
6
|
-
export interface TimePickerToolbarProps
|
|
6
|
+
export interface TimePickerToolbarProps extends BaseToolbarProps<PickerValidDate | null, TimeViewWithMeridiem>, ExportedTimePickerToolbarProps {
|
|
7
7
|
ampm?: boolean;
|
|
8
8
|
ampmInClock?: boolean;
|
|
9
9
|
}
|
|
@@ -23,7 +23,7 @@ export interface ExportedTimePickerToolbarProps extends ExportedBaseToolbarProps
|
|
|
23
23
|
*
|
|
24
24
|
* - [TimePickerToolbar API](https://mui.com/x/api/date-pickers/time-picker-toolbar/)
|
|
25
25
|
*/
|
|
26
|
-
declare function TimePickerToolbar
|
|
26
|
+
declare function TimePickerToolbar(inProps: TimePickerToolbarProps): React.JSX.Element;
|
|
27
27
|
declare namespace TimePickerToolbar {
|
|
28
28
|
var propTypes: any;
|
|
29
29
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "view", "onViewChange", "views", "
|
|
5
|
+
const _excluded = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "view", "onViewChange", "views", "className"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -13,11 +13,12 @@ import { PickersToolbarText } from "../internals/components/PickersToolbarText.j
|
|
|
13
13
|
import { PickersToolbarButton } from "../internals/components/PickersToolbarButton.js";
|
|
14
14
|
import { PickersToolbar } from "../internals/components/PickersToolbar.js";
|
|
15
15
|
import { arrayIncludes } from "../internals/utils/utils.js";
|
|
16
|
-
import {
|
|
16
|
+
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
17
17
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
18
18
|
import { useMeridiemMode } from "../internals/hooks/date-helpers-hooks.js";
|
|
19
19
|
import { getTimePickerToolbarUtilityClass, timePickerToolbarClasses } from "./timePickerToolbarClasses.js";
|
|
20
20
|
import { formatMeridiem } from "../internals/utils/date-utils.js";
|
|
21
|
+
import { usePickerContext } from "../hooks/index.js";
|
|
21
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
23
|
const useUtilityClasses = ownerState => {
|
|
23
24
|
const {
|
|
@@ -128,14 +129,16 @@ function TimePickerToolbar(inProps) {
|
|
|
128
129
|
view,
|
|
129
130
|
onViewChange,
|
|
130
131
|
views,
|
|
131
|
-
disabled,
|
|
132
|
-
readOnly,
|
|
133
132
|
className
|
|
134
133
|
} = props,
|
|
135
134
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
136
135
|
const utils = useUtils();
|
|
137
|
-
const translations =
|
|
136
|
+
const translations = usePickerTranslations();
|
|
138
137
|
const isRtl = useRtl();
|
|
138
|
+
const {
|
|
139
|
+
disabled,
|
|
140
|
+
readOnly
|
|
141
|
+
} = usePickerContext();
|
|
139
142
|
const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes('hours'));
|
|
140
143
|
const {
|
|
141
144
|
meridiemMode,
|
|
@@ -216,7 +219,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
|
|
216
219
|
*/
|
|
217
220
|
classes: PropTypes.object,
|
|
218
221
|
className: PropTypes.string,
|
|
219
|
-
disabled: PropTypes.bool,
|
|
220
222
|
/**
|
|
221
223
|
* If `true`, show the toolbar even in desktop mode.
|
|
222
224
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -230,7 +232,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
|
|
230
232
|
* @param {TView} view The view to open
|
|
231
233
|
*/
|
|
232
234
|
onViewChange: PropTypes.func.isRequired,
|
|
233
|
-
readOnly: PropTypes.bool,
|
|
234
235
|
/**
|
|
235
236
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
236
237
|
*/
|
package/TimePicker/shared.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DefaultizedProps } from '
|
|
2
|
+
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
import { TimeClockSlots, TimeClockSlotProps } from '../TimeClock/TimeClock.types';
|
|
4
4
|
import { BasePickerInputProps } from '../internals/models/props/basePickerProps';
|
|
5
5
|
import { BaseTimeValidationProps } from '../internals/models/validation';
|
|
@@ -8,20 +8,20 @@ import { TimePickerToolbarProps, ExportedTimePickerToolbarProps } from './TimePi
|
|
|
8
8
|
import { PickerValidDate, TimeValidationError } from '../models';
|
|
9
9
|
import { PickerViewRendererLookup } from '../internals/hooks/usePicker/usePickerViews';
|
|
10
10
|
import { TimeViewRendererProps } from '../timeViewRenderers';
|
|
11
|
-
import { BaseClockProps, ExportedBaseClockProps } from '../internals/models/props/
|
|
11
|
+
import { BaseClockProps, ExportedBaseClockProps } from '../internals/models/props/time';
|
|
12
12
|
import { TimeViewWithMeridiem } from '../internals/models';
|
|
13
|
-
export interface BaseTimePickerSlots
|
|
13
|
+
export interface BaseTimePickerSlots extends TimeClockSlots {
|
|
14
14
|
/**
|
|
15
15
|
* Custom component for the toolbar rendered above the views.
|
|
16
16
|
* @default TimePickerToolbar
|
|
17
17
|
*/
|
|
18
|
-
toolbar?: React.JSXElementConstructor<TimePickerToolbarProps
|
|
18
|
+
toolbar?: React.JSXElementConstructor<TimePickerToolbarProps>;
|
|
19
19
|
}
|
|
20
20
|
export interface BaseTimePickerSlotProps extends TimeClockSlotProps {
|
|
21
21
|
toolbar?: ExportedTimePickerToolbarProps;
|
|
22
22
|
}
|
|
23
|
-
export type TimePickerViewRenderers<
|
|
24
|
-
export interface BaseTimePickerProps<
|
|
23
|
+
export type TimePickerViewRenderers<TView extends TimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<PickerValidDate | null, TView, TimeViewRendererProps<TView, BaseClockProps<TView>>, TAdditionalProps>;
|
|
24
|
+
export interface BaseTimePickerProps<TView extends TimeViewWithMeridiem> extends BasePickerInputProps<PickerValidDate | null, TView, TimeValidationError>, ExportedBaseClockProps {
|
|
25
25
|
/**
|
|
26
26
|
* Display ampm controls under the clock (instead of in the toolbar).
|
|
27
27
|
* @default true on desktop, false on mobile
|
|
@@ -31,7 +31,7 @@ export interface BaseTimePickerProps<TDate extends PickerValidDate, TView extend
|
|
|
31
31
|
* Overridable component slots.
|
|
32
32
|
* @default {}
|
|
33
33
|
*/
|
|
34
|
-
slots?: BaseTimePickerSlots
|
|
34
|
+
slots?: BaseTimePickerSlots;
|
|
35
35
|
/**
|
|
36
36
|
* The props used for each component slot.
|
|
37
37
|
* @default {}
|
|
@@ -42,8 +42,8 @@ export interface BaseTimePickerProps<TDate extends PickerValidDate, TView extend
|
|
|
42
42
|
* If `null`, the section will only have field editing.
|
|
43
43
|
* If `undefined`, internally defined view will be used.
|
|
44
44
|
*/
|
|
45
|
-
viewRenderers?: Partial<TimePickerViewRenderers<
|
|
45
|
+
viewRenderers?: Partial<TimePickerViewRenderers<TView>>;
|
|
46
46
|
}
|
|
47
|
-
type UseTimePickerDefaultizedProps<
|
|
48
|
-
export declare function useTimePickerDefaultizedProps<
|
|
47
|
+
type UseTimePickerDefaultizedProps<TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TView>> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | 'ampm' | keyof BaseTimeValidationProps>>;
|
|
48
|
+
export declare function useTimePickerDefaultizedProps<TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TView>>(props: Props, name: string): UseTimePickerDefaultizedProps<TView, Props>;
|
|
49
49
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["autoFocus", "className", "children", "disabled", "selected", "value", "tabIndex", "onClick", "onKeyDown", "onFocus", "onBlur", "aria-current", "yearsPerRow", "slots", "slotProps"];
|
|
3
|
+
const _excluded = ["autoFocus", "className", "classes", "children", "disabled", "selected", "value", "tabIndex", "onClick", "onKeyDown", "onFocus", "onBlur", "aria-current", "yearsPerRow", "slots", "slotProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { styled, alpha, useThemeProps } from '@mui/material/styles';
|
|
@@ -8,16 +8,12 @@ import useSlotProps from '@mui/utils/useSlotProps';
|
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
9
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
10
10
|
import { getPickersYearUtilityClass, pickersYearClasses } from "./pickersYearClasses.js";
|
|
11
|
+
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const useUtilityClasses = ownerState => {
|
|
13
|
-
const {
|
|
14
|
-
disabled,
|
|
15
|
-
selected,
|
|
16
|
-
classes
|
|
17
|
-
} = ownerState;
|
|
13
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
18
14
|
const slots = {
|
|
19
15
|
root: ['root'],
|
|
20
|
-
yearButton: ['yearButton',
|
|
16
|
+
yearButton: ['yearButton', ownerState.isYearDisabled && 'disabled', ownerState.isYearSelected && 'selected']
|
|
21
17
|
};
|
|
22
18
|
return composeClasses(slots, getPickersYearUtilityClass, classes);
|
|
23
19
|
};
|
|
@@ -93,9 +89,10 @@ export const PickersYear = /*#__PURE__*/React.memo(function PickersYear(inProps)
|
|
|
93
89
|
const {
|
|
94
90
|
autoFocus,
|
|
95
91
|
className,
|
|
92
|
+
classes: classesProp,
|
|
96
93
|
children,
|
|
97
|
-
disabled,
|
|
98
|
-
selected,
|
|
94
|
+
disabled = false,
|
|
95
|
+
selected = false,
|
|
99
96
|
value,
|
|
100
97
|
tabIndex,
|
|
101
98
|
onClick,
|
|
@@ -111,7 +108,14 @@ export const PickersYear = /*#__PURE__*/React.memo(function PickersYear(inProps)
|
|
|
111
108
|
} = props,
|
|
112
109
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
113
110
|
const ref = React.useRef(null);
|
|
114
|
-
const
|
|
111
|
+
const {
|
|
112
|
+
ownerState: pickerOwnerState
|
|
113
|
+
} = usePickerPrivateContext();
|
|
114
|
+
const ownerState = _extends({}, pickerOwnerState, {
|
|
115
|
+
isYearDisabled: disabled,
|
|
116
|
+
isYearSelected: selected
|
|
117
|
+
});
|
|
118
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
115
119
|
|
|
116
120
|
// We can't forward the `autoFocus` to the button because it is a native button, not a MUI Button
|
|
117
121
|
useEnhancedEffect(() => {
|
|
@@ -138,12 +142,12 @@ export const PickersYear = /*#__PURE__*/React.memo(function PickersYear(inProps)
|
|
|
138
142
|
onFocus: event => onFocus(event, value),
|
|
139
143
|
onBlur: event => onBlur(event, value)
|
|
140
144
|
},
|
|
141
|
-
ownerState
|
|
145
|
+
ownerState,
|
|
142
146
|
className: classes.yearButton
|
|
143
147
|
});
|
|
144
148
|
return /*#__PURE__*/_jsx(PickersYearRoot, _extends({
|
|
145
149
|
className: clsx(classes.root, className),
|
|
146
|
-
ownerState:
|
|
150
|
+
ownerState: ownerState
|
|
147
151
|
}, other, {
|
|
148
152
|
children: /*#__PURE__*/_jsx(YearButton, _extends({}, yearButtonProps))
|
|
149
153
|
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { YearCalendarProps } from './YearCalendar.types';
|
|
3
|
-
|
|
4
|
-
type YearCalendarComponent = (<TDate extends PickerValidDate>(props: YearCalendarProps<TDate>) => React.JSX.Element) & {
|
|
3
|
+
type YearCalendarComponent = ((props: YearCalendarProps) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -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 = ["autoFocus", "className", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "readOnly", "shouldDisableYear", "disableHighlightToday", "onYearFocus", "hasFocus", "onFocusedViewChange", "yearsOrder", "yearsPerRow", "timezone", "gridLabelId", "slots", "slotProps"];
|
|
5
|
+
const _excluded = ["autoFocus", "className", "classes", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "readOnly", "shouldDisableYear", "disableHighlightToday", "onYearFocus", "hasFocus", "onFocusedViewChange", "yearsOrder", "yearsPerRow", "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, MAX_CALENDAR_HEIGHT } 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
|
};
|
|
@@ -74,6 +72,7 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
|
|
|
74
72
|
const {
|
|
75
73
|
autoFocus,
|
|
76
74
|
className,
|
|
75
|
+
classes: classesProp,
|
|
77
76
|
value: valueProp,
|
|
78
77
|
defaultValue,
|
|
79
78
|
referenceDate: referenceDateProp,
|
|
@@ -105,12 +104,16 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
|
|
|
105
104
|
timezone: timezoneProp,
|
|
106
105
|
value: valueProp,
|
|
107
106
|
defaultValue,
|
|
108
|
-
|
|
107
|
+
referenceDate: referenceDateProp,
|
|
108
|
+
onChange,
|
|
109
109
|
valueManager: singleItemValueManager
|
|
110
110
|
});
|
|
111
111
|
const now = useNow(timezone);
|
|
112
112
|
const isRtl = useRtl();
|
|
113
113
|
const utils = useUtils();
|
|
114
|
+
const {
|
|
115
|
+
ownerState
|
|
116
|
+
} = usePickerPrivateContext();
|
|
114
117
|
const referenceDate = React.useMemo(() => singleItemValueManager.getInitialReferenceValue({
|
|
115
118
|
value,
|
|
116
119
|
utils,
|
|
@@ -120,8 +123,7 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
|
|
|
120
123
|
granularity: SECTION_TYPE_GRANULARITY.year
|
|
121
124
|
}), [] // eslint-disable-line react-hooks/exhaustive-deps
|
|
122
125
|
);
|
|
123
|
-
const
|
|
124
|
-
const classes = useUtilityClasses(ownerState);
|
|
126
|
+
const classes = useUtilityClasses(classesProp);
|
|
125
127
|
const todayYear = React.useMemo(() => utils.getYear(now), [utils, now]);
|
|
126
128
|
const selectedYear = React.useMemo(() => {
|
|
127
129
|
if (value != null) {
|
|
@@ -284,7 +286,9 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
|
|
|
284
286
|
*/
|
|
285
287
|
defaultValue: PropTypes.object,
|
|
286
288
|
/**
|
|
287
|
-
* If `true
|
|
289
|
+
* If `true`, the component is disabled.
|
|
290
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
291
|
+
* @default false
|
|
288
292
|
*/
|
|
289
293
|
disabled: PropTypes.bool,
|
|
290
294
|
/**
|
|
@@ -316,14 +320,15 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
|
|
|
316
320
|
minDate: PropTypes.object,
|
|
317
321
|
/**
|
|
318
322
|
* Callback fired when the value changes.
|
|
319
|
-
* @
|
|
320
|
-
* @param {TDate} value The new value.
|
|
323
|
+
* @param {PickerValidDate} value The new value.
|
|
321
324
|
*/
|
|
322
325
|
onChange: PropTypes.func,
|
|
323
326
|
onFocusedViewChange: PropTypes.func,
|
|
324
327
|
onYearFocus: PropTypes.func,
|
|
325
328
|
/**
|
|
326
|
-
* If `true
|
|
329
|
+
* If `true`, the component is read-only.
|
|
330
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
331
|
+
* @default false
|
|
327
332
|
*/
|
|
328
333
|
readOnly: PropTypes.bool,
|
|
329
334
|
/**
|
|
@@ -333,8 +338,7 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
|
|
|
333
338
|
referenceDate: PropTypes.object,
|
|
334
339
|
/**
|
|
335
340
|
* Disable specific year.
|
|
336
|
-
* @
|
|
337
|
-
* @param {TDate} year The year to test.
|
|
341
|
+
* @param {PickerValidDate} year The year to test.
|
|
338
342
|
* @returns {boolean} If `true`, the year will be disabled.
|
|
339
343
|
*/
|
|
340
344
|
shouldDisableYear: PropTypes.func,
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps } from '@mui/system';
|
|
3
3
|
import { Theme } from '@mui/material/styles';
|
|
4
|
+
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
4
5
|
import { YearCalendarClasses } from './yearCalendarClasses';
|
|
5
6
|
import { BaseDateValidationProps, YearValidationProps } from '../internals/models/validation';
|
|
6
|
-
import { PickerValidDate, TimezoneProps } from '../models';
|
|
7
|
-
import
|
|
8
|
-
|
|
7
|
+
import { PickerOwnerState, PickerValidDate, TimezoneProps } from '../models';
|
|
8
|
+
import { FormProps } from '../internals/models/formProps';
|
|
9
|
+
export interface PickerYearOwnerState extends PickerOwnerState {
|
|
10
|
+
isYearSelected: boolean;
|
|
11
|
+
isYearDisabled: boolean;
|
|
12
|
+
}
|
|
9
13
|
export interface YearCalendarSlots {
|
|
10
14
|
/**
|
|
11
15
|
* Button displayed to render a single year in the `year` view.
|
|
@@ -16,7 +20,7 @@ export interface YearCalendarSlots {
|
|
|
16
20
|
export interface YearCalendarSlotProps {
|
|
17
21
|
yearButton?: SlotComponentPropsFromProps<React.HTMLAttributes<HTMLButtonElement> & {
|
|
18
22
|
sx: SxProps;
|
|
19
|
-
}, {},
|
|
23
|
+
}, {}, PickerYearOwnerState>;
|
|
20
24
|
}
|
|
21
25
|
export interface ExportedYearCalendarProps {
|
|
22
26
|
/**
|
|
@@ -31,7 +35,7 @@ export interface ExportedYearCalendarProps {
|
|
|
31
35
|
*/
|
|
32
36
|
yearsPerRow?: 3 | 4;
|
|
33
37
|
}
|
|
34
|
-
export interface YearCalendarProps
|
|
38
|
+
export interface YearCalendarProps extends ExportedYearCalendarProps, YearValidationProps, BaseDateValidationProps, TimezoneProps, FormProps {
|
|
35
39
|
autoFocus?: boolean;
|
|
36
40
|
className?: string;
|
|
37
41
|
/**
|
|
@@ -52,31 +56,26 @@ export interface YearCalendarProps<TDate extends PickerValidDate> extends Export
|
|
|
52
56
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
53
57
|
*/
|
|
54
58
|
sx?: SxProps<Theme>;
|
|
55
|
-
/** If `true` picker is disabled */
|
|
56
|
-
disabled?: boolean;
|
|
57
59
|
/**
|
|
58
60
|
* The selected value.
|
|
59
61
|
* Used when the component is controlled.
|
|
60
62
|
*/
|
|
61
|
-
value?:
|
|
63
|
+
value?: PickerValidDate | null;
|
|
62
64
|
/**
|
|
63
65
|
* The default selected value.
|
|
64
66
|
* Used when the component is not controlled.
|
|
65
67
|
*/
|
|
66
|
-
defaultValue?:
|
|
68
|
+
defaultValue?: PickerValidDate | null;
|
|
67
69
|
/**
|
|
68
70
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
69
71
|
* @default The closest valid year using the validation props, except callbacks such as `shouldDisableYear`.
|
|
70
72
|
*/
|
|
71
|
-
referenceDate?:
|
|
73
|
+
referenceDate?: PickerValidDate;
|
|
72
74
|
/**
|
|
73
75
|
* Callback fired when the value changes.
|
|
74
|
-
* @
|
|
75
|
-
* @param {TDate} value The new value.
|
|
76
|
+
* @param {PickerValidDate} value The new value.
|
|
76
77
|
*/
|
|
77
|
-
onChange?: (value:
|
|
78
|
-
/** If `true` picker is readonly */
|
|
79
|
-
readOnly?: boolean;
|
|
78
|
+
onChange?: (value: PickerValidDate) => void;
|
|
80
79
|
/**
|
|
81
80
|
* If `true`, today's date is rendering without highlighting with circle.
|
|
82
81
|
* @default false
|