@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
|
@@ -5,9 +5,9 @@ import { UsePickerParams } from '../usePicker';
|
|
|
5
5
|
import { UsePickerViewsProps } from '../usePicker/usePickerViews';
|
|
6
6
|
import { FieldSection, PickerValidDate } from '../../../models';
|
|
7
7
|
import { DateOrTimeViewWithMeridiem } from '../../models';
|
|
8
|
-
export interface UseStaticPickerSlots<
|
|
8
|
+
export interface UseStaticPickerSlots<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<PickerValidDate | null, TView> {
|
|
9
9
|
}
|
|
10
|
-
export interface UseStaticPickerSlotProps<
|
|
10
|
+
export interface UseStaticPickerSlotProps<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<PickerValidDate | null, TView> {
|
|
11
11
|
}
|
|
12
12
|
export interface StaticOnlyPickerProps {
|
|
13
13
|
/**
|
|
@@ -27,19 +27,19 @@ export interface StaticOnlyPickerProps {
|
|
|
27
27
|
*/
|
|
28
28
|
onClose?: () => void;
|
|
29
29
|
}
|
|
30
|
-
export interface UseStaticPickerProps<
|
|
30
|
+
export interface UseStaticPickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<PickerValidDate | null, TView, any, any>> extends BasePickerProps<PickerValidDate | null, TView, TError, TExternalProps, {}>, StaticOnlyPickerProps {
|
|
31
31
|
/**
|
|
32
32
|
* Overridable component slots.
|
|
33
33
|
* @default {}
|
|
34
34
|
*/
|
|
35
|
-
slots?: UseStaticPickerSlots<
|
|
35
|
+
slots?: UseStaticPickerSlots<TView>;
|
|
36
36
|
/**
|
|
37
37
|
* The props used for each component slot.
|
|
38
38
|
* @default {}
|
|
39
39
|
*/
|
|
40
|
-
slotProps?: UseStaticPickerSlotProps<
|
|
40
|
+
slotProps?: UseStaticPickerSlotProps<TView>;
|
|
41
41
|
}
|
|
42
|
-
export interface UseStaticPickerParams<
|
|
42
|
+
export interface UseStaticPickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticPickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerValidDate | null, TView, FieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
|
|
43
43
|
props: TExternalProps;
|
|
44
44
|
/**
|
|
45
45
|
* Ref to pass to the root element
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { MuiPickersAdapterContextValue } from '../../LocalizationProvider/LocalizationProvider';
|
|
2
2
|
import { PickersLocaleText } from '../../locales/utils/pickersLocaleTextApi';
|
|
3
3
|
import { PickersTimezone, PickerValidDate } from '../../models';
|
|
4
|
-
export declare const useLocalizationContext:
|
|
5
|
-
localeText: PickersLocaleText
|
|
4
|
+
export declare const useLocalizationContext: () => Omit<MuiPickersAdapterContextValue, "localeText"> & {
|
|
5
|
+
localeText: PickersLocaleText;
|
|
6
6
|
};
|
|
7
|
-
export declare const useUtils:
|
|
8
|
-
export declare const useDefaultDates:
|
|
9
|
-
minDate:
|
|
10
|
-
maxDate:
|
|
7
|
+
export declare const useUtils: () => import("@mui/x-date-pickers/models").MuiPickersAdapter<any>;
|
|
8
|
+
export declare const useDefaultDates: () => {
|
|
9
|
+
minDate: PickerValidDate;
|
|
10
|
+
maxDate: PickerValidDate;
|
|
11
11
|
};
|
|
12
|
-
export declare const useNow:
|
|
12
|
+
export declare const useNow: (timezone: PickersTimezone) => PickerValidDate;
|
|
@@ -5,13 +5,7 @@ import { PickersTimezone, PickerValidDate } from '../../models';
|
|
|
5
5
|
* - The value returned by `onChange` always have the timezone of `props.value` or `props.defaultValue` if defined
|
|
6
6
|
* - The value rendered is always the one from `props.timezone` if defined
|
|
7
7
|
*/
|
|
8
|
-
export declare const useValueWithTimezone: <
|
|
9
|
-
timezone: PickersTimezone | undefined;
|
|
10
|
-
value: TValue | undefined;
|
|
11
|
-
defaultValue: TValue | undefined;
|
|
12
|
-
onChange: TChange | undefined;
|
|
13
|
-
valueManager: PickerValueManager<TValue, TDate, any>;
|
|
14
|
-
}) => {
|
|
8
|
+
export declare const useValueWithTimezone: <TValue, TChange extends (...params: any[]) => void>({ timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange, valueManager, }: UseValueWithTimezoneParameters<TValue, TChange>) => {
|
|
15
9
|
value: TValue;
|
|
16
10
|
handleValueChange: TChange;
|
|
17
11
|
timezone: string;
|
|
@@ -19,15 +13,25 @@ export declare const useValueWithTimezone: <TDate extends PickerValidDate, TValu
|
|
|
19
13
|
/**
|
|
20
14
|
* Wrapper around `useControlled` and `useValueWithTimezone`
|
|
21
15
|
*/
|
|
22
|
-
export declare const useControlledValueWithTimezone: <
|
|
23
|
-
name: string;
|
|
24
|
-
timezone: PickersTimezone | undefined;
|
|
25
|
-
value: TValue | undefined;
|
|
26
|
-
defaultValue: TValue | undefined;
|
|
27
|
-
onChange: TChange | undefined;
|
|
28
|
-
valueManager: PickerValueManager<TValue, TDate, any>;
|
|
29
|
-
}) => {
|
|
16
|
+
export declare const useControlledValueWithTimezone: <TValue, TChange extends (...params: any[]) => void>({ name, timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange: onChangeProp, valueManager, }: UseControlledValueWithTimezoneParameters<TValue, TChange>) => {
|
|
30
17
|
value: TValue;
|
|
31
18
|
handleValueChange: TChange;
|
|
32
19
|
timezone: string;
|
|
33
20
|
};
|
|
21
|
+
interface UseValueWithTimezoneParameters<TValue, TChange extends (...params: any[]) => void> {
|
|
22
|
+
timezone: PickersTimezone | undefined;
|
|
23
|
+
value: TValue | undefined;
|
|
24
|
+
defaultValue: TValue | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The reference date as passed to `props.referenceDate`.
|
|
27
|
+
* It does not need to have its default value.
|
|
28
|
+
* This is only used to determine the timezone to use when `props.value` and `props.defaultValue` are not defined.
|
|
29
|
+
*/
|
|
30
|
+
referenceDate: PickerValidDate | undefined;
|
|
31
|
+
onChange: TChange | undefined;
|
|
32
|
+
valueManager: PickerValueManager<TValue, any>;
|
|
33
|
+
}
|
|
34
|
+
interface UseControlledValueWithTimezoneParameters<TValue, TChange extends (...params: any[]) => void> extends UseValueWithTimezoneParameters<TValue, TChange> {
|
|
35
|
+
name: string;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -11,6 +11,7 @@ export const useValueWithTimezone = ({
|
|
|
11
11
|
timezone: timezoneProp,
|
|
12
12
|
value: valueProp,
|
|
13
13
|
defaultValue,
|
|
14
|
+
referenceDate,
|
|
14
15
|
onChange,
|
|
15
16
|
valueManager
|
|
16
17
|
}) => {
|
|
@@ -24,7 +25,16 @@ export const useValueWithTimezone = ({
|
|
|
24
25
|
}
|
|
25
26
|
return valueManager.setTimezone(utils, inputTimezone, newValue);
|
|
26
27
|
});
|
|
27
|
-
|
|
28
|
+
let timezoneToRender;
|
|
29
|
+
if (timezoneProp) {
|
|
30
|
+
timezoneToRender = timezoneProp;
|
|
31
|
+
} else if (inputTimezone) {
|
|
32
|
+
timezoneToRender = inputTimezone;
|
|
33
|
+
} else if (referenceDate) {
|
|
34
|
+
timezoneToRender = utils.getTimezone(referenceDate);
|
|
35
|
+
} else {
|
|
36
|
+
timezoneToRender = 'default';
|
|
37
|
+
}
|
|
28
38
|
const valueWithTimezoneToRender = React.useMemo(() => valueManager.setTimezone(utils, timezoneToRender, inputValue), [valueManager, utils, timezoneToRender, inputValue]);
|
|
29
39
|
const handleValueChange = useEventCallback((newValue, ...otherParams) => {
|
|
30
40
|
const newValueWithInputTimezone = setInputTimezone(newValue);
|
|
@@ -45,6 +55,7 @@ export const useControlledValueWithTimezone = ({
|
|
|
45
55
|
timezone: timezoneProp,
|
|
46
56
|
value: valueProp,
|
|
47
57
|
defaultValue,
|
|
58
|
+
referenceDate,
|
|
48
59
|
onChange: onChangeProp,
|
|
49
60
|
valueManager
|
|
50
61
|
}) => {
|
|
@@ -62,6 +73,7 @@ export const useControlledValueWithTimezone = ({
|
|
|
62
73
|
timezone: timezoneProp,
|
|
63
74
|
value: valueWithInputTimezone,
|
|
64
75
|
defaultValue: undefined,
|
|
76
|
+
referenceDate,
|
|
65
77
|
onChange,
|
|
66
78
|
valueManager
|
|
67
79
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
1
2
|
import type { PickerSelectionState } from './usePicker';
|
|
2
|
-
import { MakeOptional } from '../models/helpers';
|
|
3
3
|
import { DateOrTimeViewWithMeridiem } from '../models';
|
|
4
4
|
import { PickerValidDate } from '../../models';
|
|
5
|
-
export type PickerOnChangeFn
|
|
5
|
+
export type PickerOnChangeFn = (date: PickerValidDate | null, selectionState?: PickerSelectionState) => void;
|
|
6
6
|
export interface UseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridiem> {
|
|
7
7
|
/**
|
|
8
8
|
* Callback fired when the value changes.
|
|
@@ -54,7 +54,7 @@ export interface UseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridie
|
|
|
54
54
|
*/
|
|
55
55
|
onFocusedViewChange?: (view: TView, hasFocus: boolean) => void;
|
|
56
56
|
}
|
|
57
|
-
export interface ExportedUseViewsOptions<TView extends DateOrTimeViewWithMeridiem> extends MakeOptional<UseViewsOptions<
|
|
57
|
+
export interface ExportedUseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridiem> extends MakeOptional<UseViewsOptions<TValue, TView>, 'onChange' | 'openTo' | 'views'> {
|
|
58
58
|
}
|
|
59
59
|
interface UseViewsResponse<TValue, TView extends DateOrTimeViewWithMeridiem> {
|
|
60
60
|
view: TView;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
|
-
import
|
|
3
|
+
import useControlled from '@mui/utils/useControlled';
|
|
4
4
|
let warnedOnceNotValidView = false;
|
|
5
5
|
export function useViews({
|
|
6
6
|
onChange,
|
package/internals/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { PickersArrowSwitcher } from './components/PickersArrowSwitcher/PickersArrowSwitcher';
|
|
2
2
|
export type { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, } from './components/PickersArrowSwitcher';
|
|
3
|
-
export {
|
|
3
|
+
export { PickerProvider } from './components/PickerProvider';
|
|
4
4
|
export { PickersModalDialog } from './components/PickersModalDialog';
|
|
5
5
|
export type { PickersModalDialogSlots, PickersModalDialogSlotProps, } from './components/PickersModalDialog';
|
|
6
6
|
export { PickersPopper } from './components/PickersPopper';
|
|
@@ -31,20 +31,22 @@ export { usePicker } from './hooks/usePicker';
|
|
|
31
31
|
export type { UsePickerResponse, UsePickerParams, UsePickerProps, UsePickerValueFieldResponse, PickerViewsRendererProps, } from './hooks/usePicker';
|
|
32
32
|
export type { UsePickerValueNonStaticProps, PickerValueManager, PickerSelectionState, } from './hooks/usePicker/usePickerValue.types';
|
|
33
33
|
export type { UsePickerViewsNonStaticProps, PickerViewRendererLookup, PickerViewRenderer, UsePickerViewsProps, } from './hooks/usePicker/usePickerViews';
|
|
34
|
+
export { usePickerPrivateContext } from './hooks/usePickerPrivateContext';
|
|
34
35
|
export { useStaticPicker } from './hooks/useStaticPicker';
|
|
35
36
|
export type { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps, } from './hooks/useStaticPicker';
|
|
36
37
|
export { useLocalizationContext, useDefaultDates, useUtils, useNow } from './hooks/useUtils';
|
|
37
38
|
export type { ExportedUseViewsOptions, UseViewsOptions } from './hooks/useViews';
|
|
38
39
|
export { useViews } from './hooks/useViews';
|
|
39
40
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
|
|
40
|
-
export type {
|
|
41
|
+
export type { BaseSingleInputFieldProps } from './models/fields';
|
|
41
42
|
export type { BasePickerProps, BasePickerInputProps, BaseNonStaticPickerProps, } from './models/props/basePickerProps';
|
|
42
|
-
export type { BaseClockProps, DesktopOnlyTimePickerProps } from './models/props/
|
|
43
|
+
export type { BaseClockProps, DesktopOnlyTimePickerProps, AmPmProps } from './models/props/time';
|
|
43
44
|
export type { BaseTabsProps, ExportedBaseTabsProps } from './models/props/tabs';
|
|
44
45
|
export type { BaseToolbarProps, ExportedBaseToolbarProps } from './models/props/toolbar';
|
|
45
|
-
export type {
|
|
46
|
-
export type {
|
|
46
|
+
export type { FormProps } from './models/formProps';
|
|
47
|
+
export type { PickerVariant, TimeViewWithMeridiem, DateOrTimeViewWithMeridiem, } from './models/common';
|
|
47
48
|
export type { BaseDateValidationProps, BaseTimeValidationProps, TimeValidationProps, MonthValidationProps, YearValidationProps, DayValidationProps, DateTimeValidationProps, } from './models/validation';
|
|
49
|
+
export type { PickerRangeValue } from './models/value';
|
|
48
50
|
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
49
51
|
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem, } from './utils/date-utils';
|
|
50
52
|
export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
|
package/internals/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { PickersArrowSwitcher } from "./components/PickersArrowSwitcher/PickersArrowSwitcher.js";
|
|
2
|
-
export {
|
|
2
|
+
export { PickerProvider } from "./components/PickerProvider.js";
|
|
3
3
|
export { PickersModalDialog } from "./components/PickersModalDialog.js";
|
|
4
4
|
export { PickersPopper } from "./components/PickersPopper.js";
|
|
5
5
|
export { PickersToolbar } from "./components/PickersToolbar.js";
|
|
@@ -13,6 +13,7 @@ export { DAY_MARGIN, DIALOG_WIDTH, VIEW_HEIGHT } from "./constants/dimensions.js
|
|
|
13
13
|
export { useControlledValueWithTimezone } from "./hooks/useValueWithTimezone.js";
|
|
14
14
|
export { useField, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./hooks/useField/index.js";
|
|
15
15
|
export { usePicker } from "./hooks/usePicker/index.js";
|
|
16
|
+
export { usePickerPrivateContext } from "./hooks/usePickerPrivateContext.js";
|
|
16
17
|
export { useStaticPicker } from "./hooks/useStaticPicker/index.js";
|
|
17
18
|
export { useLocalizationContext, useDefaultDates, useUtils, useNow } from "./hooks/useUtils.js";
|
|
18
19
|
export { useViews } from "./hooks/useViews.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DateView, TimeView } from '../../models/views';
|
|
2
|
-
export type
|
|
2
|
+
export type PickerOrientation = 'portrait' | 'landscape';
|
|
3
|
+
export type PickerVariant = 'mobile' | 'desktop' | null;
|
|
3
4
|
export type TimeViewWithMeridiem = TimeView | 'meridiem';
|
|
4
5
|
export type DateOrTimeViewWithMeridiem = DateView | TimeViewWithMeridiem;
|
|
@@ -1,10 +1,35 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SxProps } from '@mui/material/styles';
|
|
2
|
+
import { MakeRequired } from '@mui/x-internals/types';
|
|
3
|
+
import type { ExportedUseClearableFieldProps, UseClearableFieldSlotProps, UseClearableFieldSlots } from '../../hooks/useClearableField';
|
|
4
|
+
import type { FieldSection, PickerOwnerState } from '../../models';
|
|
2
5
|
import type { UseFieldInternalProps } from '../hooks/useField';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export interface BaseForwardedSingleInputFieldProps extends ExportedUseClearableFieldProps {
|
|
7
|
+
className: string | undefined;
|
|
8
|
+
sx: SxProps<any> | undefined;
|
|
9
|
+
label: React.ReactNode | undefined;
|
|
10
|
+
name: string | undefined;
|
|
11
|
+
id?: string;
|
|
12
|
+
focused?: boolean;
|
|
13
|
+
onKeyDown?: React.KeyboardEventHandler;
|
|
14
|
+
onBlur?: React.FocusEventHandler;
|
|
9
15
|
ref?: React.Ref<HTMLDivElement>;
|
|
16
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
17
|
+
InputProps?: {
|
|
18
|
+
ref?: React.Ref<any>;
|
|
19
|
+
endAdornment?: React.ReactNode;
|
|
20
|
+
startAdornment?: React.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
inputProps?: {
|
|
23
|
+
'aria-label'?: string;
|
|
24
|
+
};
|
|
25
|
+
slots?: UseClearableFieldSlots;
|
|
26
|
+
slotProps?: UseClearableFieldSlotProps & {
|
|
27
|
+
textField?: {};
|
|
28
|
+
};
|
|
29
|
+
ownerState: PickerOwnerState;
|
|
10
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Props the single input field can receive when used inside a picker.
|
|
33
|
+
* Only contains what the MUI components are passing to the field, not what users can pass using the `props.slotProps.field`.
|
|
34
|
+
*/
|
|
35
|
+
export type BaseSingleInputFieldProps<TValue, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> = MakeRequired<Pick<UseFieldInternalProps<TValue, TSection, TEnableAccessibleFieldDOMStructure, TError>, 'readOnly' | 'disabled' | 'format' | 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange' | 'timezone' | 'value' | 'onChange' | 'unstableFieldRef' | 'autoFocus'>, 'format' | 'value' | 'onChange' | 'timezone'> & BaseForwardedSingleInputFieldProps;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface FormProps {
|
|
2
|
+
/**
|
|
3
|
+
* If `true`, the component is disabled.
|
|
4
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* If `true`, the component is read-only.
|
|
10
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
}
|
|
@@ -4,7 +4,3 @@
|
|
|
4
4
|
* `style`.
|
|
5
5
|
*/
|
|
6
6
|
export type ExtendMui<C, Removals extends keyof C = never> = Omit<C, 'classes' | 'theme' | Removals>;
|
|
7
|
-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
8
|
-
export type MakeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
9
|
-
export type DefaultizedProps<P extends {}, RequiredProps extends keyof P, AdditionalProps extends {} = {}> = Omit<P, RequiredProps | keyof AdditionalProps> & Required<Pick<P, RequiredProps>> & AdditionalProps;
|
|
10
|
-
export type SlotComponentPropsFromProps<TProps extends {}, TOverrides extends {}, TOwnerState extends {}> = (Partial<TProps> & TOverrides) | ((ownerState: TOwnerState) => Partial<TProps> & TOverrides);
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Theme } from '@mui/material/styles';
|
|
3
3
|
import { SxProps } from '@mui/system';
|
|
4
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
4
5
|
import { UsePickerBaseProps } from '../../hooks/usePicker';
|
|
5
6
|
import { PickersInputComponentLocaleText } from '../../../locales/utils/pickersLocaleTextApi';
|
|
6
7
|
import type { UsePickerViewsProps } from '../../hooks/usePicker/usePickerViews';
|
|
7
|
-
import { MakeOptional } from '../helpers';
|
|
8
8
|
import { DateOrTimeViewWithMeridiem } from '../common';
|
|
9
9
|
import { UseFieldInternalProps } from '../../hooks/useField';
|
|
10
|
-
import { PickerValidDate } from '../../../models';
|
|
11
10
|
/**
|
|
12
11
|
* Props common to all pickers after applying the default props on each picker.
|
|
13
12
|
*/
|
|
14
|
-
export interface BasePickerProps<TValue,
|
|
13
|
+
export interface BasePickerProps<TValue, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TView, any, any>, TAdditionalProps extends {}> extends UsePickerBaseProps<TValue, TView, TError, TExternalProps, TAdditionalProps> {
|
|
15
14
|
className?: string;
|
|
16
15
|
/**
|
|
17
16
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
@@ -21,18 +20,18 @@ export interface BasePickerProps<TValue, TDate extends PickerValidDate, TView ex
|
|
|
21
20
|
* Locale for components texts.
|
|
22
21
|
* Allows overriding texts coming from `LocalizationProvider` and `theme`.
|
|
23
22
|
*/
|
|
24
|
-
localeText?: PickersInputComponentLocaleText
|
|
23
|
+
localeText?: PickersInputComponentLocaleText;
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
26
|
* Props common to all pickers before applying the default props on each picker.
|
|
28
27
|
*/
|
|
29
|
-
export interface BasePickerInputProps<TValue,
|
|
28
|
+
export interface BasePickerInputProps<TValue, TView extends DateOrTimeViewWithMeridiem, TError> extends Omit<MakeOptional<BasePickerProps<TValue, TView, TError, any, any>, 'openTo' | 'views'>, 'viewRenderers'> {
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
32
31
|
* Props common to all non-static pickers.
|
|
33
32
|
* These props are handled by the headless wrappers.
|
|
34
33
|
*/
|
|
35
|
-
export interface BaseNonStaticPickerProps extends Pick<UseFieldInternalProps<any, any, any, any
|
|
34
|
+
export interface BaseNonStaticPickerProps extends Pick<UseFieldInternalProps<any, any, any, any>, 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange'> {
|
|
36
35
|
/**
|
|
37
36
|
* Format of the date when rendered in the input(s).
|
|
38
37
|
* Defaults to localized format based on the used `views`.
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
2
|
-
import { BaseTimeValidationProps, TimeValidationProps } from '../validation';
|
|
3
2
|
import { PickerValidDate, TimeStepOptions, TimezoneProps } from '../../../models';
|
|
4
3
|
import type { ExportedDigitalClockProps } from '../../../DigitalClock/DigitalClock.types';
|
|
5
4
|
import type { ExportedMultiSectionDigitalClockProps } from '../../../MultiSectionDigitalClock/MultiSectionDigitalClock.types';
|
|
6
5
|
import type { ExportedUseViewsOptions } from '../../hooks/useViews';
|
|
7
6
|
import { TimeViewWithMeridiem } from '../common';
|
|
8
|
-
|
|
7
|
+
import { ExportedValidateTimeProps } from '../../../validation/validateTime';
|
|
8
|
+
import { FormProps } from '../formProps';
|
|
9
|
+
export interface AmPmProps {
|
|
9
10
|
/**
|
|
10
11
|
* 12h/24h view for hour selection clock.
|
|
11
12
|
* @default utils.is12HourCycleInCurrentLocale()
|
|
12
13
|
*/
|
|
13
14
|
ampm?: boolean;
|
|
14
15
|
}
|
|
15
|
-
export interface
|
|
16
|
+
export interface ExportedBaseClockProps extends ExportedValidateTimeProps, TimezoneProps, AmPmProps {
|
|
17
|
+
}
|
|
18
|
+
export interface BaseClockProps<TView extends TimeViewWithMeridiem> extends ExportedUseViewsOptions<PickerValidDate | null, TView>, ExportedBaseClockProps, FormProps {
|
|
16
19
|
className?: string;
|
|
17
20
|
/**
|
|
18
21
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
@@ -22,29 +25,19 @@ export interface BaseClockProps<TDate extends PickerValidDate, TView extends Tim
|
|
|
22
25
|
* The selected value.
|
|
23
26
|
* Used when the component is controlled.
|
|
24
27
|
*/
|
|
25
|
-
value?:
|
|
28
|
+
value?: PickerValidDate | null;
|
|
26
29
|
/**
|
|
27
30
|
* The default selected value.
|
|
28
31
|
* Used when the component is not controlled.
|
|
29
32
|
*/
|
|
30
|
-
defaultValue?:
|
|
31
|
-
/**
|
|
32
|
-
* If `true`, the picker views and text field are disabled.
|
|
33
|
-
* @default false
|
|
34
|
-
*/
|
|
35
|
-
disabled?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* If `true`, the picker views and text field are read-only.
|
|
38
|
-
* @default false
|
|
39
|
-
*/
|
|
40
|
-
readOnly?: boolean;
|
|
33
|
+
defaultValue?: PickerValidDate | null;
|
|
41
34
|
/**
|
|
42
35
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
43
36
|
* @default The closest valid time using the validation props, except callbacks such as `shouldDisableTime`.
|
|
44
37
|
*/
|
|
45
|
-
referenceDate?:
|
|
38
|
+
referenceDate?: PickerValidDate;
|
|
46
39
|
}
|
|
47
|
-
export interface DesktopOnlyTimePickerProps
|
|
40
|
+
export interface DesktopOnlyTimePickerProps extends Omit<ExportedDigitalClockProps, 'timeStep'>, Omit<ExportedMultiSectionDigitalClockProps, 'timeSteps'> {
|
|
48
41
|
/**
|
|
49
42
|
* Amount of time options below or at which the single column time renderer is used.
|
|
50
43
|
* @default 24
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PickerValidDate, TimeView } from '../../models';
|
|
1
|
+
import type { PickerValidDate, TimeView } from '../../models';
|
|
2
2
|
interface FutureAndPastValidationProps {
|
|
3
3
|
/**
|
|
4
4
|
* If `true`, disable values before the current date for date components, time for time components and both for date time components.
|
|
@@ -20,17 +20,17 @@ export interface BaseTimeValidationProps extends FutureAndPastValidationProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* Props used to validate a time value.
|
|
22
22
|
*/
|
|
23
|
-
export interface TimeValidationProps
|
|
23
|
+
export interface TimeValidationProps {
|
|
24
24
|
/**
|
|
25
25
|
* Minimal selectable time.
|
|
26
26
|
* The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
|
|
27
27
|
*/
|
|
28
|
-
minTime?:
|
|
28
|
+
minTime?: PickerValidDate;
|
|
29
29
|
/**
|
|
30
30
|
* Maximal selectable time.
|
|
31
31
|
* The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
|
|
32
32
|
*/
|
|
33
|
-
maxTime?:
|
|
33
|
+
maxTime?: PickerValidDate;
|
|
34
34
|
/**
|
|
35
35
|
* Step over minutes.
|
|
36
36
|
* @default 1
|
|
@@ -38,12 +38,11 @@ export interface TimeValidationProps<TDate extends PickerValidDate> {
|
|
|
38
38
|
minutesStep?: number;
|
|
39
39
|
/**
|
|
40
40
|
* Disable specific time.
|
|
41
|
-
* @
|
|
42
|
-
* @param {TDate} value The value to check.
|
|
41
|
+
* @param {PickerValidDate} value The value to check.
|
|
43
42
|
* @param {TimeView} view The clock type of the timeValue.
|
|
44
43
|
* @returns {boolean} If `true` the time will be disabled.
|
|
45
44
|
*/
|
|
46
|
-
shouldDisableTime?: (value:
|
|
45
|
+
shouldDisableTime?: (value: PickerValidDate, view: TimeView) => boolean;
|
|
47
46
|
/**
|
|
48
47
|
* Do not ignore date part when validating min/max time.
|
|
49
48
|
* @default false
|
|
@@ -54,68 +53,65 @@ export interface TimeValidationProps<TDate extends PickerValidDate> {
|
|
|
54
53
|
* Validation props common to all the date views.
|
|
55
54
|
* All these props have a default value when used inside a field / picker / calendar.
|
|
56
55
|
*/
|
|
57
|
-
export interface BaseDateValidationProps
|
|
56
|
+
export interface BaseDateValidationProps extends FutureAndPastValidationProps {
|
|
58
57
|
/**
|
|
59
58
|
* Maximal selectable date.
|
|
60
59
|
* @default 2099-12-31
|
|
61
60
|
*/
|
|
62
|
-
maxDate?:
|
|
61
|
+
maxDate?: PickerValidDate;
|
|
63
62
|
/**
|
|
64
63
|
* Minimal selectable date.
|
|
65
64
|
* @default 1900-01-01
|
|
66
65
|
*/
|
|
67
|
-
minDate?:
|
|
66
|
+
minDate?: PickerValidDate;
|
|
68
67
|
}
|
|
69
68
|
/**
|
|
70
69
|
* Props used to validate a date value (validates day + month + year).
|
|
71
70
|
*/
|
|
72
|
-
export interface DayValidationProps
|
|
71
|
+
export interface DayValidationProps {
|
|
73
72
|
/**
|
|
74
73
|
* Disable specific date.
|
|
75
74
|
*
|
|
76
75
|
* 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.
|
|
77
76
|
*
|
|
78
|
-
* @
|
|
79
|
-
* @param {TDate} day The date to test.
|
|
77
|
+
* @param {PickerValidDate} day The date to test.
|
|
80
78
|
* @returns {boolean} If `true` the date will be disabled.
|
|
81
79
|
*/
|
|
82
|
-
shouldDisableDate?: (day:
|
|
80
|
+
shouldDisableDate?: (day: PickerValidDate) => boolean;
|
|
83
81
|
}
|
|
84
82
|
/**
|
|
85
83
|
* Props used to validate a month value
|
|
86
84
|
*/
|
|
87
|
-
export interface MonthValidationProps
|
|
85
|
+
export interface MonthValidationProps {
|
|
88
86
|
/**
|
|
89
87
|
* Disable specific month.
|
|
90
|
-
* @
|
|
91
|
-
* @param {TDate} month The month to test.
|
|
88
|
+
* @param {PickerValidDate} month The month to test.
|
|
92
89
|
* @returns {boolean} If `true`, the month will be disabled.
|
|
93
90
|
*/
|
|
94
|
-
shouldDisableMonth?: (month:
|
|
91
|
+
shouldDisableMonth?: (month: PickerValidDate) => boolean;
|
|
95
92
|
}
|
|
96
93
|
/**
|
|
97
94
|
* Props used to validate a year value
|
|
98
95
|
*/
|
|
99
|
-
export interface YearValidationProps
|
|
96
|
+
export interface YearValidationProps {
|
|
100
97
|
/**
|
|
101
98
|
* Disable specific year.
|
|
102
|
-
* @
|
|
103
|
-
* @param {TDate} year The year to test.
|
|
99
|
+
* @param {PickerValidDate} year The year to test.
|
|
104
100
|
* @returns {boolean} If `true`, the year will be disabled.
|
|
105
101
|
*/
|
|
106
|
-
shouldDisableYear?: (year:
|
|
102
|
+
shouldDisableYear?: (year: PickerValidDate) => boolean;
|
|
107
103
|
}
|
|
108
104
|
/**
|
|
109
105
|
* Props used to validate a date time value.
|
|
110
106
|
*/
|
|
111
|
-
export interface DateTimeValidationProps
|
|
107
|
+
export interface DateTimeValidationProps {
|
|
112
108
|
/**
|
|
113
109
|
* Minimal selectable moment of time with binding to date, to set min time in each day use `minTime`.
|
|
114
110
|
*/
|
|
115
|
-
minDateTime?:
|
|
111
|
+
minDateTime?: PickerValidDate;
|
|
116
112
|
/**
|
|
117
113
|
* Maximal selectable moment of time with binding to date, to set max time in each day use `maxTime`.
|
|
118
114
|
*/
|
|
119
|
-
maxDateTime?:
|
|
115
|
+
maxDateTime?: PickerValidDate;
|
|
120
116
|
}
|
|
121
117
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
2
|
+
import { DateOrTimeView, MuiPickersAdapter } from '../../models';
|
|
2
3
|
import { DateOrTimeViewWithMeridiem } from '../models';
|
|
3
|
-
import { DesktopOnlyTimePickerProps } from '../models/props/
|
|
4
|
-
|
|
5
|
-
export declare const resolveDateTimeFormat: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, { views, format, ...other }: {
|
|
4
|
+
import { DesktopOnlyTimePickerProps } from '../models/props/time';
|
|
5
|
+
export declare const resolveDateTimeFormat: (utils: MuiPickersAdapter, { views, format, ...other }: {
|
|
6
6
|
format?: string;
|
|
7
7
|
views: readonly DateOrTimeViewWithMeridiem[];
|
|
8
8
|
ampm: boolean;
|
|
9
9
|
}, ignoreDateResolving?: boolean) => string;
|
|
10
|
-
interface DefaultizedTimeViewsProps<
|
|
10
|
+
interface DefaultizedTimeViewsProps<TView = DateOrTimeView> extends DefaultizedProps<DesktopOnlyTimePickerProps, 'ampm'> {
|
|
11
11
|
views: readonly TView[];
|
|
12
12
|
}
|
|
13
|
-
interface DefaultizedTimeViewsResponse<
|
|
13
|
+
interface DefaultizedTimeViewsResponse<TView = DateOrTimeViewWithMeridiem> extends Required<Pick<DefaultizedTimeViewsProps<TView>, 'thresholdToRenderTimeInASingleColumn' | 'timeSteps' | 'views'>> {
|
|
14
14
|
shouldRenderTimeInASingleColumn: boolean;
|
|
15
15
|
}
|
|
16
|
-
export declare function resolveTimeViewsResponse<
|
|
16
|
+
export declare function resolveTimeViewsResponse<InTView extends DateOrTimeView = DateOrTimeView, OutTView extends DateOrTimeViewWithMeridiem = DateOrTimeViewWithMeridiem>({ thresholdToRenderTimeInASingleColumn: inThreshold, ampm, timeSteps: inTimeSteps, views, }: DefaultizedTimeViewsProps<InTView>): DefaultizedTimeViewsResponse<OutTView>;
|
|
17
17
|
export {};
|