@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
|
@@ -7,13 +7,13 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
7
7
|
import { PickersActionBar } from "../PickersActionBar/index.js";
|
|
8
8
|
import { getPickersLayoutUtilityClass } from "./pickersLayoutClasses.js";
|
|
9
9
|
import { PickersShortcuts } from "../PickersShortcuts/index.js";
|
|
10
|
+
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
function toolbarHasView(toolbarProps) {
|
|
12
13
|
return toolbarProps.view !== null;
|
|
13
14
|
}
|
|
14
|
-
const useUtilityClasses = ownerState => {
|
|
15
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
15
16
|
const {
|
|
16
|
-
classes,
|
|
17
17
|
isLandscape
|
|
18
18
|
} = ownerState;
|
|
19
19
|
const slots = {
|
|
@@ -28,6 +28,9 @@ const useUtilityClasses = ownerState => {
|
|
|
28
28
|
return composeClasses(slots, getPickersLayoutUtilityClass, classes);
|
|
29
29
|
};
|
|
30
30
|
const usePickerLayout = props => {
|
|
31
|
+
const {
|
|
32
|
+
ownerState: pickersOwnerState
|
|
33
|
+
} = usePickerPrivateContext();
|
|
31
34
|
const {
|
|
32
35
|
wrapperVariant,
|
|
33
36
|
onAccept,
|
|
@@ -42,17 +45,20 @@ const usePickerLayout = props => {
|
|
|
42
45
|
onSelectShortcut,
|
|
43
46
|
isValid,
|
|
44
47
|
isLandscape,
|
|
45
|
-
disabled,
|
|
46
|
-
readOnly,
|
|
47
48
|
children,
|
|
48
49
|
slots,
|
|
49
|
-
slotProps
|
|
50
|
+
slotProps,
|
|
51
|
+
classes: classesProp
|
|
50
52
|
// TODO: Remove this "as" hack. It get introduced to mark `value` prop in PickersLayoutProps as not required.
|
|
51
53
|
// The true type should be
|
|
52
|
-
// - For pickers value:
|
|
53
|
-
// - For range pickers value: [
|
|
54
|
+
// - For pickers value: PickerValidDate | null
|
|
55
|
+
// - For range pickers value: [PickerValidDate | null, PickerValidDate | null]
|
|
54
56
|
} = props;
|
|
55
|
-
const
|
|
57
|
+
const ownerState = _extends({}, pickersOwnerState, {
|
|
58
|
+
wrapperVariant,
|
|
59
|
+
isLandscape
|
|
60
|
+
});
|
|
61
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
56
62
|
|
|
57
63
|
// Action bar
|
|
58
64
|
const ActionBar = slots?.actionBar ?? PickersActionBar;
|
|
@@ -67,9 +73,7 @@ const usePickerLayout = props => {
|
|
|
67
73
|
actions: wrapperVariant === 'desktop' ? [] : ['cancel', 'accept']
|
|
68
74
|
},
|
|
69
75
|
className: classes.actionBar,
|
|
70
|
-
ownerState
|
|
71
|
-
wrapperVariant
|
|
72
|
-
})
|
|
76
|
+
ownerState
|
|
73
77
|
});
|
|
74
78
|
const actionBar = /*#__PURE__*/_jsx(ActionBar, _extends({}, actionBarProps));
|
|
75
79
|
|
|
@@ -84,14 +88,10 @@ const usePickerLayout = props => {
|
|
|
84
88
|
value,
|
|
85
89
|
view,
|
|
86
90
|
onViewChange,
|
|
87
|
-
views
|
|
88
|
-
disabled,
|
|
89
|
-
readOnly
|
|
91
|
+
views
|
|
90
92
|
},
|
|
91
93
|
className: classes.toolbar,
|
|
92
|
-
ownerState
|
|
93
|
-
wrapperVariant
|
|
94
|
-
})
|
|
94
|
+
ownerState
|
|
95
95
|
});
|
|
96
96
|
const toolbar = toolbarHasView(toolbarProps) && !!Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, toolbarProps)) : null;
|
|
97
97
|
|
|
@@ -117,12 +117,7 @@ const usePickerLayout = props => {
|
|
|
117
117
|
onChange: onSelectShortcut
|
|
118
118
|
},
|
|
119
119
|
className: classes.shortcuts,
|
|
120
|
-
ownerState
|
|
121
|
-
isValid,
|
|
122
|
-
isLandscape,
|
|
123
|
-
onChange: onSelectShortcut,
|
|
124
|
-
wrapperVariant
|
|
125
|
-
}
|
|
120
|
+
ownerState
|
|
126
121
|
});
|
|
127
122
|
const shortcuts = view && !!Shortcuts ? /*#__PURE__*/_jsx(Shortcuts, _extends({}, shortcutsProps)) : null;
|
|
128
123
|
return {
|
|
@@ -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 = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef"];
|
|
3
|
+
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef", "onFocus", "onBlur"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useFormControl } from '@mui/material/FormControl';
|
|
@@ -194,7 +194,9 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
194
194
|
readOnly,
|
|
195
195
|
inputProps,
|
|
196
196
|
inputRef,
|
|
197
|
-
sectionListRef
|
|
197
|
+
sectionListRef,
|
|
198
|
+
onFocus,
|
|
199
|
+
onBlur
|
|
198
200
|
} = props,
|
|
199
201
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
200
202
|
const rootRef = React.useRef(null);
|
|
@@ -206,13 +208,12 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
206
208
|
throw new Error('MUI X: PickersInputBase should always be used inside a PickersTextField component');
|
|
207
209
|
}
|
|
208
210
|
const handleInputFocus = event => {
|
|
209
|
-
// Fix a bug with IE11 where the focus/blur events are triggered
|
|
210
|
-
// while the component is disabled.
|
|
211
|
-
if (muiFormControl.disabled) {
|
|
212
|
-
event.stopPropagation();
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
211
|
muiFormControl.onFocus?.(event);
|
|
212
|
+
onFocus?.(event);
|
|
213
|
+
};
|
|
214
|
+
const handleInputBlur = event => {
|
|
215
|
+
muiFormControl.onBlur?.(event);
|
|
216
|
+
onBlur?.(event);
|
|
216
217
|
};
|
|
217
218
|
React.useEffect(() => {
|
|
218
219
|
if (muiFormControl) {
|
|
@@ -254,7 +255,7 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
254
255
|
tabIndex: tabIndex,
|
|
255
256
|
className: classes.sectionsContainer,
|
|
256
257
|
onFocus: handleInputFocus,
|
|
257
|
-
onBlur:
|
|
258
|
+
onBlur: handleInputBlur,
|
|
258
259
|
onInput: onInput,
|
|
259
260
|
onPaste: onPaste,
|
|
260
261
|
onKeyDown: onKeyDown,
|
|
@@ -105,8 +105,6 @@ const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField
|
|
|
105
105
|
className: clsx(classes.root, className),
|
|
106
106
|
ref: handleRootRef,
|
|
107
107
|
focused: focused,
|
|
108
|
-
onFocus: onFocus,
|
|
109
|
-
onBlur: onBlur,
|
|
110
108
|
disabled: disabled,
|
|
111
109
|
variant: variant,
|
|
112
110
|
error: error,
|
|
@@ -128,6 +126,8 @@ const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField
|
|
|
128
126
|
onKeyUp: onKeyUp,
|
|
129
127
|
onInput: onInput,
|
|
130
128
|
onPaste: onPaste,
|
|
129
|
+
onFocus: onFocus,
|
|
130
|
+
onBlur: onBlur,
|
|
131
131
|
endAdornment: endAdornment,
|
|
132
132
|
startAdornment: startAdornment,
|
|
133
133
|
tabIndex: tabIndex,
|
package/README.md
CHANGED
|
@@ -30,13 +30,13 @@ npm install luxon
|
|
|
30
30
|
npm install moment
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
This component has the following peer dependencies that you
|
|
33
|
+
This component has the following peer dependencies that you need to install as well.
|
|
34
34
|
|
|
35
35
|
```json
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@mui/material": "^5.15.14",
|
|
38
|
-
"react": "^17.0.0 || ^18.0.0",
|
|
39
|
-
"react-dom": "^17.0.0 || ^18.0.0"
|
|
37
|
+
"@mui/material": "^5.15.14 || ^6.0.0",
|
|
38
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
39
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
40
40
|
},
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { StaticDatePickerProps } from './StaticDatePicker.types';
|
|
3
|
-
|
|
4
|
-
type StaticDatePickerComponent = (<TDate extends PickerValidDate>(props: StaticDatePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
3
|
+
type StaticDatePickerComponent = ((props: StaticDatePickerProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -64,9 +64,9 @@ StaticDatePicker.propTypes = {
|
|
|
64
64
|
className: PropTypes.string,
|
|
65
65
|
/**
|
|
66
66
|
* Formats the day of week displayed in the calendar header.
|
|
67
|
-
* @param {
|
|
67
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
68
68
|
* @returns {string} The name to display.
|
|
69
|
-
* @default (date:
|
|
69
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
70
70
|
*/
|
|
71
71
|
dayOfWeekFormatter: PropTypes.func,
|
|
72
72
|
/**
|
|
@@ -75,7 +75,8 @@ StaticDatePicker.propTypes = {
|
|
|
75
75
|
*/
|
|
76
76
|
defaultValue: PropTypes.object,
|
|
77
77
|
/**
|
|
78
|
-
* If `true`, the
|
|
78
|
+
* If `true`, the component is disabled.
|
|
79
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
79
80
|
* @default false
|
|
80
81
|
*/
|
|
81
82
|
disabled: PropTypes.bool,
|
|
@@ -168,8 +169,7 @@ StaticDatePicker.propTypes = {
|
|
|
168
169
|
onError: PropTypes.func,
|
|
169
170
|
/**
|
|
170
171
|
* Callback fired on month change.
|
|
171
|
-
* @
|
|
172
|
-
* @param {TDate} month The new month.
|
|
172
|
+
* @param {PickerValidDate} month The new month.
|
|
173
173
|
*/
|
|
174
174
|
onMonthChange: PropTypes.func,
|
|
175
175
|
/**
|
|
@@ -180,8 +180,7 @@ StaticDatePicker.propTypes = {
|
|
|
180
180
|
onViewChange: PropTypes.func,
|
|
181
181
|
/**
|
|
182
182
|
* Callback fired on year change.
|
|
183
|
-
* @
|
|
184
|
-
* @param {TDate} year The new year.
|
|
183
|
+
* @param {PickerValidDate} year The new year.
|
|
185
184
|
*/
|
|
186
185
|
onYearChange: PropTypes.func,
|
|
187
186
|
/**
|
|
@@ -194,6 +193,11 @@ StaticDatePicker.propTypes = {
|
|
|
194
193
|
* Force rendering in particular orientation.
|
|
195
194
|
*/
|
|
196
195
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
196
|
+
/**
|
|
197
|
+
* If `true`, the component is read-only.
|
|
198
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
199
|
+
* @default false
|
|
200
|
+
*/
|
|
197
201
|
readOnly: PropTypes.bool,
|
|
198
202
|
/**
|
|
199
203
|
* If `true`, disable heavy animations.
|
|
@@ -216,22 +220,19 @@ StaticDatePicker.propTypes = {
|
|
|
216
220
|
*
|
|
217
221
|
* 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.
|
|
218
222
|
*
|
|
219
|
-
* @
|
|
220
|
-
* @param {TDate} day The date to test.
|
|
223
|
+
* @param {PickerValidDate} day The date to test.
|
|
221
224
|
* @returns {boolean} If `true` the date will be disabled.
|
|
222
225
|
*/
|
|
223
226
|
shouldDisableDate: PropTypes.func,
|
|
224
227
|
/**
|
|
225
228
|
* Disable specific month.
|
|
226
|
-
* @
|
|
227
|
-
* @param {TDate} month The month to test.
|
|
229
|
+
* @param {PickerValidDate} month The month to test.
|
|
228
230
|
* @returns {boolean} If `true`, the month will be disabled.
|
|
229
231
|
*/
|
|
230
232
|
shouldDisableMonth: PropTypes.func,
|
|
231
233
|
/**
|
|
232
234
|
* Disable specific year.
|
|
233
|
-
* @
|
|
234
|
-
* @param {TDate} year The year to test.
|
|
235
|
+
* @param {PickerValidDate} year The year to test.
|
|
235
236
|
* @returns {boolean} If `true`, the year will be disabled.
|
|
236
237
|
*/
|
|
237
238
|
shouldDisableYear: PropTypes.func,
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
1
2
|
import { BaseDatePickerProps, BaseDatePickerSlots, BaseDatePickerSlotProps } from '../DatePicker/shared';
|
|
2
3
|
import { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps } from '../internals/hooks/useStaticPicker';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export interface StaticDatePickerSlots<TDate extends PickerValidDate> extends BaseDatePickerSlots<TDate>, UseStaticPickerSlots<TDate, DateView> {
|
|
4
|
+
import { DateView } from '../models';
|
|
5
|
+
export interface StaticDatePickerSlots extends BaseDatePickerSlots, UseStaticPickerSlots<DateView> {
|
|
6
6
|
}
|
|
7
|
-
export interface StaticDatePickerSlotProps
|
|
7
|
+
export interface StaticDatePickerSlotProps extends BaseDatePickerSlotProps, UseStaticPickerSlotProps<DateView> {
|
|
8
8
|
}
|
|
9
|
-
export interface StaticDatePickerProps
|
|
9
|
+
export interface StaticDatePickerProps extends BaseDatePickerProps, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
|
|
10
10
|
/**
|
|
11
11
|
* Overridable component slots.
|
|
12
12
|
* @default {}
|
|
13
13
|
*/
|
|
14
|
-
slots?: StaticDatePickerSlots
|
|
14
|
+
slots?: StaticDatePickerSlots;
|
|
15
15
|
/**
|
|
16
16
|
* The props used for each component slot.
|
|
17
17
|
* @default {}
|
|
18
18
|
*/
|
|
19
|
-
slotProps?: StaticDatePickerSlotProps
|
|
19
|
+
slotProps?: StaticDatePickerSlotProps;
|
|
20
20
|
/**
|
|
21
21
|
* Years rendered per row.
|
|
22
22
|
* @default `4` when `displayStaticWrapperAs === 'desktop'`, `3` otherwise.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { StaticDateTimePickerProps } from './StaticDateTimePicker.types';
|
|
3
|
-
|
|
4
|
-
type StaticDateTimePickerComponent = (<TDate extends PickerValidDate>(props: StaticDateTimePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
3
|
+
type StaticDateTimePickerComponent = ((props: StaticDateTimePickerProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -84,9 +84,9 @@ StaticDateTimePicker.propTypes = {
|
|
|
84
84
|
className: PropTypes.string,
|
|
85
85
|
/**
|
|
86
86
|
* Formats the day of week displayed in the calendar header.
|
|
87
|
-
* @param {
|
|
87
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
88
88
|
* @returns {string} The name to display.
|
|
89
|
-
* @default (date:
|
|
89
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
90
90
|
*/
|
|
91
91
|
dayOfWeekFormatter: PropTypes.func,
|
|
92
92
|
/**
|
|
@@ -95,7 +95,8 @@ StaticDateTimePicker.propTypes = {
|
|
|
95
95
|
*/
|
|
96
96
|
defaultValue: PropTypes.object,
|
|
97
97
|
/**
|
|
98
|
-
* If `true`, the
|
|
98
|
+
* If `true`, the component is disabled.
|
|
99
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
99
100
|
* @default false
|
|
100
101
|
*/
|
|
101
102
|
disabled: PropTypes.bool,
|
|
@@ -216,8 +217,7 @@ StaticDateTimePicker.propTypes = {
|
|
|
216
217
|
onError: PropTypes.func,
|
|
217
218
|
/**
|
|
218
219
|
* Callback fired on month change.
|
|
219
|
-
* @
|
|
220
|
-
* @param {TDate} month The new month.
|
|
220
|
+
* @param {PickerValidDate} month The new month.
|
|
221
221
|
*/
|
|
222
222
|
onMonthChange: PropTypes.func,
|
|
223
223
|
/**
|
|
@@ -228,8 +228,7 @@ StaticDateTimePicker.propTypes = {
|
|
|
228
228
|
onViewChange: PropTypes.func,
|
|
229
229
|
/**
|
|
230
230
|
* Callback fired on year change.
|
|
231
|
-
* @
|
|
232
|
-
* @param {TDate} year The new year.
|
|
231
|
+
* @param {PickerValidDate} year The new year.
|
|
233
232
|
*/
|
|
234
233
|
onYearChange: PropTypes.func,
|
|
235
234
|
/**
|
|
@@ -242,6 +241,11 @@ StaticDateTimePicker.propTypes = {
|
|
|
242
241
|
* Force rendering in particular orientation.
|
|
243
242
|
*/
|
|
244
243
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
244
|
+
/**
|
|
245
|
+
* If `true`, the component is read-only.
|
|
246
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
247
|
+
* @default false
|
|
248
|
+
*/
|
|
245
249
|
readOnly: PropTypes.bool,
|
|
246
250
|
/**
|
|
247
251
|
* If `true`, disable heavy animations.
|
|
@@ -264,30 +268,26 @@ StaticDateTimePicker.propTypes = {
|
|
|
264
268
|
*
|
|
265
269
|
* 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.
|
|
266
270
|
*
|
|
267
|
-
* @
|
|
268
|
-
* @param {TDate} day The date to test.
|
|
271
|
+
* @param {PickerValidDate} day The date to test.
|
|
269
272
|
* @returns {boolean} If `true` the date will be disabled.
|
|
270
273
|
*/
|
|
271
274
|
shouldDisableDate: PropTypes.func,
|
|
272
275
|
/**
|
|
273
276
|
* Disable specific month.
|
|
274
|
-
* @
|
|
275
|
-
* @param {TDate} month The month to test.
|
|
277
|
+
* @param {PickerValidDate} month The month to test.
|
|
276
278
|
* @returns {boolean} If `true`, the month will be disabled.
|
|
277
279
|
*/
|
|
278
280
|
shouldDisableMonth: PropTypes.func,
|
|
279
281
|
/**
|
|
280
282
|
* Disable specific time.
|
|
281
|
-
* @
|
|
282
|
-
* @param {TDate} value The value to check.
|
|
283
|
+
* @param {PickerValidDate} value The value to check.
|
|
283
284
|
* @param {TimeView} view The clock type of the timeValue.
|
|
284
285
|
* @returns {boolean} If `true` the time will be disabled.
|
|
285
286
|
*/
|
|
286
287
|
shouldDisableTime: PropTypes.func,
|
|
287
288
|
/**
|
|
288
289
|
* Disable specific year.
|
|
289
|
-
* @
|
|
290
|
-
* @param {TDate} year The year to test.
|
|
290
|
+
* @param {PickerValidDate} year The year to test.
|
|
291
291
|
* @returns {boolean} If `true`, the year will be disabled.
|
|
292
292
|
*/
|
|
293
293
|
shouldDisableYear: PropTypes.func,
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
1
2
|
import { BaseDateTimePickerProps, BaseDateTimePickerSlots, BaseDateTimePickerSlotProps } from '../DateTimePicker/shared';
|
|
2
3
|
import { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps } from '../internals/hooks/useStaticPicker';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export interface StaticDateTimePickerSlots<TDate extends PickerValidDate> extends BaseDateTimePickerSlots<TDate>, UseStaticPickerSlots<TDate, DateOrTimeView> {
|
|
4
|
+
import { DateOrTimeView } from '../models';
|
|
5
|
+
export interface StaticDateTimePickerSlots extends BaseDateTimePickerSlots, UseStaticPickerSlots<DateOrTimeView> {
|
|
6
6
|
}
|
|
7
|
-
export interface StaticDateTimePickerSlotProps
|
|
7
|
+
export interface StaticDateTimePickerSlotProps extends BaseDateTimePickerSlotProps, UseStaticPickerSlotProps<DateOrTimeView> {
|
|
8
8
|
}
|
|
9
|
-
export interface StaticDateTimePickerProps
|
|
9
|
+
export interface StaticDateTimePickerProps extends BaseDateTimePickerProps<DateOrTimeView>, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
|
|
10
10
|
/**
|
|
11
11
|
* Overridable component slots.
|
|
12
12
|
* @default {}
|
|
13
13
|
*/
|
|
14
|
-
slots?: StaticDateTimePickerSlots
|
|
14
|
+
slots?: StaticDateTimePickerSlots;
|
|
15
15
|
/**
|
|
16
16
|
* The props used for each component slot.
|
|
17
17
|
* @default {}
|
|
18
18
|
*/
|
|
19
|
-
slotProps?: StaticDateTimePickerSlotProps
|
|
19
|
+
slotProps?: StaticDateTimePickerSlotProps;
|
|
20
20
|
/**
|
|
21
21
|
* Years rendered per row.
|
|
22
22
|
* @default `4` when `displayStaticWrapperAs === 'desktop'`, `3` otherwise.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '../models';
|
|
3
2
|
import { StaticTimePickerProps } from './StaticTimePicker.types';
|
|
4
|
-
type StaticTimePickerComponent = (
|
|
3
|
+
type StaticTimePickerComponent = ((props: StaticTimePickerProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -80,7 +80,8 @@ StaticTimePicker.propTypes = {
|
|
|
80
80
|
*/
|
|
81
81
|
defaultValue: PropTypes.object,
|
|
82
82
|
/**
|
|
83
|
-
* If `true`, the
|
|
83
|
+
* If `true`, the component is disabled.
|
|
84
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
84
85
|
* @default false
|
|
85
86
|
*/
|
|
86
87
|
disabled: PropTypes.bool,
|
|
@@ -172,6 +173,11 @@ StaticTimePicker.propTypes = {
|
|
|
172
173
|
* Force rendering in particular orientation.
|
|
173
174
|
*/
|
|
174
175
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
176
|
+
/**
|
|
177
|
+
* If `true`, the component is read-only.
|
|
178
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
179
|
+
* @default false
|
|
180
|
+
*/
|
|
175
181
|
readOnly: PropTypes.bool,
|
|
176
182
|
/**
|
|
177
183
|
* If `true`, disable heavy animations.
|
|
@@ -185,8 +191,7 @@ StaticTimePicker.propTypes = {
|
|
|
185
191
|
referenceDate: PropTypes.object,
|
|
186
192
|
/**
|
|
187
193
|
* Disable specific time.
|
|
188
|
-
* @
|
|
189
|
-
* @param {TDate} value The value to check.
|
|
194
|
+
* @param {PickerValidDate} value The value to check.
|
|
190
195
|
* @param {TimeView} view The clock type of the timeValue.
|
|
191
196
|
* @returns {boolean} If `true` the time will be disabled.
|
|
192
197
|
*/
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
1
2
|
import { BaseTimePickerProps, BaseTimePickerSlots, BaseTimePickerSlotProps } from '../TimePicker/shared';
|
|
2
3
|
import { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps } from '../internals/hooks/useStaticPicker';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export interface StaticTimePickerSlots<TDate extends PickerValidDate> extends BaseTimePickerSlots<TDate>, UseStaticPickerSlots<TDate, TimeView> {
|
|
4
|
+
import { TimeView } from '../models';
|
|
5
|
+
export interface StaticTimePickerSlots extends BaseTimePickerSlots, UseStaticPickerSlots<TimeView> {
|
|
6
6
|
}
|
|
7
|
-
export interface StaticTimePickerSlotProps
|
|
7
|
+
export interface StaticTimePickerSlotProps extends BaseTimePickerSlotProps, UseStaticPickerSlotProps<TimeView> {
|
|
8
8
|
}
|
|
9
|
-
export interface StaticTimePickerProps
|
|
9
|
+
export interface StaticTimePickerProps extends BaseTimePickerProps<TimeView>, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
|
|
10
10
|
/**
|
|
11
11
|
* Overridable component slots.
|
|
12
12
|
* @default {}
|
|
13
13
|
*/
|
|
14
|
-
slots?: StaticTimePickerSlots
|
|
14
|
+
slots?: StaticTimePickerSlots;
|
|
15
15
|
/**
|
|
16
16
|
* The props used for each component slot.
|
|
17
17
|
* @default {}
|
|
18
18
|
*/
|
|
19
|
-
slotProps?: StaticTimePickerSlotProps
|
|
19
|
+
slotProps?: StaticTimePickerSlotProps;
|
|
20
20
|
}
|
package/TimeClock/Clock.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { PickerSelectionState } from '../internals/hooks/usePicker';
|
|
|
3
3
|
import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
|
|
4
4
|
import { PickerValidDate, TimeView } from '../models';
|
|
5
5
|
import { ClockClasses } from './clockClasses';
|
|
6
|
-
|
|
6
|
+
import { FormProps } from '../internals/models/formProps';
|
|
7
|
+
export interface ClockProps extends ReturnType<typeof useMeridiemMode>, FormProps {
|
|
7
8
|
ampm: boolean;
|
|
8
9
|
ampmInClock: boolean;
|
|
9
10
|
autoFocus?: boolean;
|
|
@@ -24,13 +25,11 @@ export interface ClockProps<TDate extends PickerValidDate> extends ReturnType<ty
|
|
|
24
25
|
/**
|
|
25
26
|
* The current full date value.
|
|
26
27
|
*/
|
|
27
|
-
value:
|
|
28
|
-
disabled?: boolean;
|
|
29
|
-
readOnly?: boolean;
|
|
28
|
+
value: PickerValidDate | null;
|
|
30
29
|
className?: string;
|
|
31
30
|
classes?: Partial<ClockClasses>;
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
34
33
|
* @ignore - internal component.
|
|
35
34
|
*/
|
|
36
|
-
export declare function Clock
|
|
35
|
+
export declare function Clock(inProps: ClockProps): React.JSX.Element;
|
package/TimeClock/Clock.js
CHANGED
|
@@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography';
|
|
|
6
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import { unstable_useEnhancedEffect as useEnhancedEffect, unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
8
8
|
import { ClockPointer } from "./ClockPointer.js";
|
|
9
|
-
import {
|
|
9
|
+
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
10
10
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
11
11
|
import { CLOCK_HOUR_WIDTH, getHours, getMinutes } from "./shared.js";
|
|
12
12
|
import { getClockUtilityClass } from "./clockClasses.js";
|
|
@@ -186,7 +186,7 @@ export function Clock(inProps) {
|
|
|
186
186
|
} = props;
|
|
187
187
|
const ownerState = props;
|
|
188
188
|
const utils = useUtils();
|
|
189
|
-
const translations =
|
|
189
|
+
const translations = usePickerTranslations();
|
|
190
190
|
const isMoving = React.useRef(false);
|
|
191
191
|
const classes = useUtilityClasses(ownerState);
|
|
192
192
|
const isSelectedTimeDisabled = isTimeDisabled(viewValue, type);
|
|
@@ -222,6 +222,7 @@ export function Clock(inProps) {
|
|
|
222
222
|
setTime(event, 'finish');
|
|
223
223
|
isMoving.current = false;
|
|
224
224
|
}
|
|
225
|
+
event.preventDefault();
|
|
225
226
|
};
|
|
226
227
|
const handleMouseMove = event => {
|
|
227
228
|
// event.buttons & PRIMARY_MOUSE_BUTTON
|
|
@@ -316,7 +317,7 @@ export function Clock(inProps) {
|
|
|
316
317
|
})]
|
|
317
318
|
}), /*#__PURE__*/_jsx(ClockWrapper, {
|
|
318
319
|
"aria-activedescendant": selectedId,
|
|
319
|
-
"aria-label": translations.clockLabelText(type, value
|
|
320
|
+
"aria-label": translations.clockLabelText(type, value == null ? null : utils.format(value, 'fullTime')),
|
|
320
321
|
ref: listboxRef,
|
|
321
322
|
role: "listbox",
|
|
322
323
|
onKeyDown: handleKeyDown,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MuiPickersAdapter, PickerValidDate } from '../models';
|
|
3
3
|
import type { PickerSelectionState } from '../internals/hooks/usePicker';
|
|
4
|
-
interface GetHourNumbersOptions
|
|
4
|
+
interface GetHourNumbersOptions {
|
|
5
5
|
ampm: boolean;
|
|
6
|
-
value:
|
|
6
|
+
value: PickerValidDate | null;
|
|
7
7
|
getClockNumberText: (hour: string) => string;
|
|
8
8
|
isDisabled: (value: number) => boolean;
|
|
9
9
|
onChange: (value: number, isFinish?: PickerSelectionState) => void;
|
|
@@ -12,13 +12,13 @@ interface GetHourNumbersOptions<TDate extends PickerValidDate> {
|
|
|
12
12
|
* Should only be `undefined` on the server
|
|
13
13
|
*/
|
|
14
14
|
selectedId: string | undefined;
|
|
15
|
-
utils: MuiPickersAdapter
|
|
15
|
+
utils: MuiPickersAdapter;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* @ignore - internal component.
|
|
19
19
|
*/
|
|
20
|
-
export declare const getHourNumbers:
|
|
21
|
-
export declare const getMinutesNumbers:
|
|
20
|
+
export declare const getHourNumbers: ({ ampm, value, getClockNumberText, isDisabled, selectedId, utils, }: GetHourNumbersOptions) => React.JSX.Element[];
|
|
21
|
+
export declare const getMinutesNumbers: ({ utils, value, isDisabled, getClockNumberText, selectedId, }: Omit<GetHourNumbersOptions, "ampm" | "value"> & {
|
|
22
22
|
value: number;
|
|
23
23
|
}) => React.JSX.Element[];
|
|
24
24
|
export {};
|
package/TimeClock/TimeClock.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '../models';
|
|
3
2
|
import { TimeClockProps } from './TimeClock.types';
|
|
4
|
-
type TimeClockComponent = (
|
|
3
|
+
type TimeClockComponent = ((props: TimeClockProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
package/TimeClock/TimeClock.js
CHANGED
|
@@ -8,7 +8,7 @@ import clsx from 'clsx';
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
10
10
|
import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
|
|
11
|
-
import {
|
|
11
|
+
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
12
|
import { useUtils, useNow } from "../internals/hooks/useUtils.js";
|
|
13
13
|
import { PickersArrowSwitcher } from "../internals/components/PickersArrowSwitcher/index.js";
|
|
14
14
|
import { convertValueToMeridiem, createIsAfterIgnoreDatePart } from "../internals/utils/time-utils.js";
|
|
@@ -107,6 +107,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
107
107
|
timezone: timezoneProp,
|
|
108
108
|
value: valueProp,
|
|
109
109
|
defaultValue,
|
|
110
|
+
referenceDate: referenceDateProp,
|
|
110
111
|
onChange,
|
|
111
112
|
valueManager: singleItemValueManager
|
|
112
113
|
});
|
|
@@ -117,7 +118,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
117
118
|
props,
|
|
118
119
|
timezone
|
|
119
120
|
});
|
|
120
|
-
const translations =
|
|
121
|
+
const translations = usePickerTranslations();
|
|
121
122
|
const now = useNow(timezone);
|
|
122
123
|
const {
|
|
123
124
|
view,
|
|
@@ -345,7 +346,8 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
345
346
|
*/
|
|
346
347
|
defaultValue: PropTypes.object,
|
|
347
348
|
/**
|
|
348
|
-
* If `true`, the
|
|
349
|
+
* If `true`, the component is disabled.
|
|
350
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
349
351
|
* @default false
|
|
350
352
|
*/
|
|
351
353
|
disabled: PropTypes.bool,
|
|
@@ -412,7 +414,8 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
412
414
|
*/
|
|
413
415
|
openTo: PropTypes.oneOf(['hours', 'minutes', 'seconds']),
|
|
414
416
|
/**
|
|
415
|
-
* If `true`, the
|
|
417
|
+
* If `true`, the component is read-only.
|
|
418
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
416
419
|
* @default false
|
|
417
420
|
*/
|
|
418
421
|
readOnly: PropTypes.bool,
|
|
@@ -423,8 +426,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
423
426
|
referenceDate: PropTypes.object,
|
|
424
427
|
/**
|
|
425
428
|
* Disable specific time.
|
|
426
|
-
* @
|
|
427
|
-
* @param {TDate} value The value to check.
|
|
429
|
+
* @param {PickerValidDate} value The value to check.
|
|
428
430
|
* @param {TimeView} view The clock type of the timeValue.
|
|
429
431
|
* @returns {boolean} If `true` the time will be disabled.
|
|
430
432
|
*/
|