@mui/x-date-pickers 7.22.3 → 8.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdapterDateFns/AdapterDateFns.d.ts +1 -1
- package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +3 -3
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -1
- package/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.d.ts +1 -1
- package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +1 -1
- package/AdapterDayjs/AdapterDayjs.d.ts +2 -2
- package/AdapterLuxon/AdapterLuxon.d.ts +2 -2
- package/AdapterMoment/AdapterMoment.d.ts +2 -2
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +2 -2
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +2 -2
- package/CHANGELOG.md +348 -12
- package/DateCalendar/DateCalendar.d.ts +1 -2
- package/DateCalendar/DateCalendar.js +21 -22
- package/DateCalendar/DateCalendar.types.d.ts +21 -31
- package/DateCalendar/DayCalendar.d.ts +25 -24
- package/DateCalendar/DayCalendar.js +13 -10
- package/DateCalendar/index.d.ts +1 -0
- package/DateCalendar/useCalendarState.d.ts +16 -16
- package/DateCalendar/useIsDateDisabled.d.ts +2 -2
- package/DateField/DateField.d.ts +1 -2
- package/DateField/DateField.js +8 -10
- package/DateField/DateField.types.d.ts +8 -9
- package/DateField/index.d.ts +1 -1
- package/DateField/useDateField.d.ts +1 -2
- package/DatePicker/DatePicker.d.ts +1 -2
- package/DatePicker/DatePicker.js +15 -14
- package/DatePicker/DatePicker.types.d.ts +10 -11
- package/DatePicker/DatePickerToolbar.d.ts +2 -2
- package/DatePicker/DatePickerToolbar.js +2 -4
- package/DatePicker/shared.d.ts +11 -11
- package/DateTimeField/DateTimeField.d.ts +1 -2
- package/DateTimeField/DateTimeField.js +9 -12
- package/DateTimeField/DateTimeField.types.d.ts +9 -14
- package/DateTimeField/index.d.ts +1 -1
- package/DateTimeField/useDateTimeField.d.ts +1 -2
- package/DateTimePicker/DateTimePicker.d.ts +1 -2
- package/DateTimePicker/DateTimePicker.js +16 -16
- package/DateTimePicker/DateTimePicker.types.d.ts +10 -13
- package/DateTimePicker/DateTimePickerTabs.d.ts +1 -2
- package/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/DateTimePicker/DateTimePickerToolbar.d.ts +5 -5
- package/DateTimePicker/DateTimePickerToolbar.js +8 -7
- package/DateTimePicker/shared.d.ts +12 -12
- package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -2
- package/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +7 -7
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -2
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +8 -8
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +1 -2
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +0 -2
- package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -2
- package/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +8 -8
- package/DigitalClock/DigitalClock.d.ts +1 -2
- package/DigitalClock/DigitalClock.js +8 -6
- package/DigitalClock/DigitalClock.types.d.ts +4 -4
- package/LocalizationProvider/LocalizationProvider.d.ts +12 -12
- package/MobileDatePicker/MobileDatePicker.d.ts +1 -2
- package/MobileDatePicker/MobileDatePicker.js +17 -16
- package/MobileDatePicker/MobileDatePicker.types.d.ts +7 -7
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +2 -2
- package/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +7 -7
- package/MobileTimePicker/MobileTimePicker.d.ts +2 -2
- package/MobileTimePicker/MobileTimePicker.js +11 -6
- package/MobileTimePicker/MobileTimePicker.types.d.ts +7 -7
- package/MonthCalendar/MonthCalendar.d.ts +3 -4
- package/MonthCalendar/MonthCalendar.js +18 -14
- package/MonthCalendar/MonthCalendar.types.d.ts +14 -15
- package/MonthCalendar/PickersMonth.js +17 -13
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.d.ts +1 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +3 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +9 -9
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +2 -3
- package/PickersActionBar/PickersActionBar.js +2 -2
- package/PickersCalendarHeader/PickersCalendarHeader.d.ts +1 -2
- package/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +9 -9
- package/PickersDay/PickersDay.d.ts +8 -8
- package/PickersLayout/PickersLayout.d.ts +2 -3
- package/PickersLayout/PickersLayout.js +0 -2
- package/PickersLayout/PickersLayout.types.d.ts +16 -19
- package/PickersLayout/index.d.ts +1 -1
- package/PickersLayout/usePickerLayout.d.ts +1 -2
- package/PickersLayout/usePickerLayout.js +18 -23
- package/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/PickersTextField/PickersTextField.js +2 -2
- package/README.md +4 -4
- package/StaticDatePicker/StaticDatePicker.d.ts +1 -2
- package/StaticDatePicker/StaticDatePicker.js +14 -13
- package/StaticDatePicker/StaticDatePicker.types.d.ts +7 -7
- package/StaticDateTimePicker/StaticDateTimePicker.d.ts +1 -2
- package/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
- package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +7 -7
- package/StaticTimePicker/StaticTimePicker.d.ts +1 -2
- package/StaticTimePicker/StaticTimePicker.js +8 -3
- package/StaticTimePicker/StaticTimePicker.types.d.ts +7 -7
- package/TimeClock/Clock.d.ts +4 -5
- package/TimeClock/Clock.js +4 -3
- package/TimeClock/ClockNumbers.d.ts +5 -5
- package/TimeClock/TimeClock.d.ts +1 -2
- package/TimeClock/TimeClock.js +8 -6
- package/TimeClock/TimeClock.types.d.ts +4 -4
- package/TimeField/TimeField.d.ts +1 -2
- package/TimeField/TimeField.js +6 -6
- package/TimeField/TimeField.types.d.ts +9 -14
- package/TimeField/index.d.ts +1 -1
- package/TimeField/useTimeField.d.ts +1 -2
- package/TimePicker/TimePicker.d.ts +1 -2
- package/TimePicker/TimePicker.js +9 -4
- package/TimePicker/TimePicker.types.d.ts +10 -13
- package/TimePicker/TimePickerToolbar.d.ts +2 -2
- package/TimePicker/TimePickerToolbar.js +8 -7
- package/TimePicker/shared.d.ts +10 -10
- package/YearCalendar/PickersYear.js +17 -13
- package/YearCalendar/YearCalendar.d.ts +1 -2
- package/YearCalendar/YearCalendar.js +18 -14
- package/YearCalendar/YearCalendar.types.d.ts +14 -15
- package/dateViewRenderers/dateViewRenderers.d.ts +3 -3
- package/hooks/index.d.ts +2 -2
- package/hooks/index.js +2 -2
- package/hooks/useClearableField.js +4 -3
- package/hooks/useParsedFormat.d.ts +2 -3
- package/hooks/useParsedFormat.js +2 -2
- package/hooks/usePickerContext.d.ts +4 -0
- package/hooks/usePickerContext.js +15 -0
- package/hooks/usePickerTranslations.d.ts +1 -0
- package/{modern/hooks/usePickersTranslations.js → hooks/usePickerTranslations.js} +1 -1
- package/hooks/useSplitFieldProps.d.ts +3 -3
- package/index.js +1 -1
- package/internals/components/PickerProvider.d.ts +67 -0
- package/internals/components/PickerProvider.js +40 -0
- package/internals/hooks/date-helpers-hooks.d.ts +6 -6
- package/internals/hooks/defaultizedFieldProps.d.ts +7 -8
- package/internals/hooks/useClockReferenceDate.d.ts +5 -5
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +22 -18
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +15 -15
- package/internals/hooks/useField/buildSectionsFromFormat.d.ts +5 -5
- package/internals/hooks/useField/useField.d.ts +3 -3
- package/internals/hooks/useField/useField.js +1 -1
- package/internals/hooks/useField/useField.types.d.ts +40 -50
- package/internals/hooks/useField/useField.utils.d.ts +15 -15
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +4 -4
- package/internals/hooks/useField/useFieldState.d.ts +4 -4
- package/internals/hooks/useField/useFieldState.js +4 -3
- package/internals/hooks/useField/useFieldV7TextField.js +4 -3
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.js +24 -19
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +12 -12
- package/internals/hooks/usePicker/usePicker.d.ts +2 -2
- package/internals/hooks/usePicker/usePicker.js +15 -10
- package/internals/hooks/usePicker/usePicker.types.d.ts +9 -7
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +6 -8
- package/internals/hooks/usePicker/usePickerLayoutProps.js +2 -5
- package/internals/hooks/usePicker/usePickerProvider.d.ts +26 -0
- package/internals/hooks/usePicker/usePickerProvider.js +77 -0
- package/internals/hooks/usePicker/usePickerValue.d.ts +2 -2
- package/internals/hooks/usePicker/usePickerValue.js +7 -10
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +38 -39
- package/internals/hooks/usePicker/usePickerViews.d.ts +7 -11
- package/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/internals/hooks/usePickerPrivateContext.d.ts +4 -0
- package/internals/hooks/usePickerPrivateContext.js +9 -0
- package/internals/hooks/useStaticPicker/useStaticPicker.d.ts +1 -2
- package/internals/hooks/useStaticPicker/useStaticPicker.js +6 -5
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +6 -6
- package/internals/hooks/useUtils.d.ts +7 -7
- package/internals/hooks/useValueWithTimezone.d.ts +19 -15
- package/internals/hooks/useValueWithTimezone.js +13 -1
- package/internals/hooks/useViews.d.ts +3 -3
- package/internals/hooks/useViews.js +1 -1
- package/internals/index.d.ts +7 -5
- package/internals/index.js +2 -1
- package/internals/models/common.d.ts +2 -1
- package/internals/models/fields.d.ts +32 -7
- package/internals/models/formProps.d.ts +14 -0
- package/internals/models/helpers.d.ts +0 -4
- package/internals/models/index.d.ts +2 -0
- package/internals/models/index.js +3 -1
- package/internals/models/props/basePickerProps.d.ts +5 -6
- package/internals/models/props/{clock.d.ts → time.d.ts} +10 -17
- package/internals/models/props/toolbar.d.ts +0 -2
- package/internals/models/validation.d.ts +21 -25
- package/internals/models/value.d.ts +3 -0
- package/internals/models/value.js +1 -0
- package/internals/utils/date-time-utils.d.ts +7 -7
- package/internals/utils/date-utils.d.ts +17 -17
- package/internals/utils/getDefaultReferenceDate.d.ts +10 -10
- package/internals/utils/time-utils.d.ts +5 -5
- package/internals/utils/valueManagers.d.ts +3 -3
- package/locales/beBY.d.ts +3 -3
- package/locales/beBY.js +3 -3
- package/locales/bgBG.d.ts +3 -3
- package/locales/bgBG.js +3 -3
- package/locales/caES.d.ts +3 -3
- package/locales/caES.js +3 -3
- package/locales/csCZ.d.ts +3 -3
- package/locales/csCZ.js +3 -3
- package/locales/daDK.d.ts +3 -3
- package/locales/daDK.js +3 -3
- package/locales/deDE.d.ts +3 -3
- package/locales/deDE.js +3 -3
- package/locales/elGR.d.ts +3 -3
- package/locales/elGR.js +12 -13
- package/locales/enUS.d.ts +4 -4
- package/locales/enUS.js +3 -3
- package/locales/esES.d.ts +3 -3
- package/locales/esES.js +3 -3
- package/locales/eu.d.ts +3 -3
- package/locales/eu.js +3 -3
- package/locales/faIR.d.ts +3 -3
- package/locales/faIR.js +3 -3
- package/locales/fiFI.d.ts +3 -3
- package/locales/fiFI.js +3 -3
- package/locales/frFR.d.ts +3 -3
- package/locales/frFR.js +3 -3
- package/locales/heIL.d.ts +3 -3
- package/locales/heIL.js +3 -3
- package/locales/hrHR.d.ts +3 -3
- package/locales/hrHR.js +3 -3
- package/locales/huHU.d.ts +3 -3
- package/locales/huHU.js +3 -3
- package/locales/isIS.d.ts +3 -3
- package/locales/isIS.js +3 -3
- package/locales/itIT.d.ts +3 -3
- package/locales/itIT.js +3 -3
- package/locales/jaJP.d.ts +3 -3
- package/locales/jaJP.js +3 -3
- package/locales/koKR.d.ts +3 -3
- package/locales/koKR.js +3 -3
- package/locales/kzKZ.d.ts +3 -3
- package/locales/kzKZ.js +3 -3
- package/locales/mk.d.ts +3 -3
- package/locales/mk.js +3 -3
- package/locales/nbNO.d.ts +3 -3
- package/locales/nbNO.js +3 -3
- package/locales/nlNL.d.ts +3 -3
- package/locales/nlNL.js +3 -3
- package/locales/nnNO.d.ts +3 -3
- package/locales/nnNO.js +3 -3
- package/locales/plPL.d.ts +3 -3
- package/locales/plPL.js +3 -3
- package/locales/ptBR.d.ts +3 -3
- package/locales/ptBR.js +5 -3
- package/locales/ptPT.d.ts +3 -3
- package/locales/ptPT.js +3 -3
- package/locales/roRO.d.ts +3 -3
- package/locales/roRO.js +3 -3
- package/locales/ruRU.d.ts +3 -3
- package/locales/ruRU.js +3 -3
- package/locales/skSK.d.ts +3 -3
- package/locales/skSK.js +3 -3
- package/locales/svSE.d.ts +3 -3
- package/locales/svSE.js +3 -3
- package/locales/trTR.d.ts +3 -3
- package/locales/trTR.js +3 -3
- package/locales/ukUA.d.ts +3 -3
- package/locales/ukUA.js +3 -3
- package/locales/urPK.d.ts +3 -3
- package/locales/urPK.js +3 -3
- package/locales/utils/getPickersLocalization.d.ts +9 -9
- package/locales/utils/getPickersLocalization.js +1 -1
- package/locales/utils/pickersLocaleTextApi.d.ts +12 -36
- package/locales/viVN.d.ts +3 -3
- package/locales/viVN.js +3 -3
- package/locales/zhCN.d.ts +3 -3
- package/locales/zhCN.js +3 -3
- package/locales/zhHK.d.ts +3 -3
- package/locales/zhHK.js +3 -3
- package/models/adapters.d.ts +151 -202
- package/models/common.d.ts +1 -0
- package/models/fields.d.ts +9 -42
- package/models/pickers.d.ts +28 -6
- package/modern/DateCalendar/DateCalendar.js +21 -22
- package/modern/DateCalendar/DayCalendar.js +13 -10
- package/modern/DateField/DateField.js +8 -10
- package/modern/DatePicker/DatePicker.js +15 -14
- package/modern/DatePicker/DatePickerToolbar.js +2 -4
- package/modern/DateTimeField/DateTimeField.js +9 -12
- package/modern/DateTimePicker/DateTimePicker.js +16 -16
- package/modern/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/modern/DateTimePicker/DateTimePickerToolbar.js +8 -7
- package/modern/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +0 -2
- package/modern/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/modern/DigitalClock/DigitalClock.js +8 -6
- package/modern/MobileDatePicker/MobileDatePicker.js +17 -16
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/modern/MobileTimePicker/MobileTimePicker.js +11 -6
- package/modern/MonthCalendar/MonthCalendar.js +18 -14
- package/modern/MonthCalendar/PickersMonth.js +17 -13
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -6
- package/modern/PickersActionBar/PickersActionBar.js +2 -2
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/modern/PickersLayout/PickersLayout.js +0 -2
- package/modern/PickersLayout/usePickerLayout.js +18 -23
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/modern/PickersTextField/PickersTextField.js +2 -2
- package/modern/StaticDatePicker/StaticDatePicker.js +14 -13
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
- package/modern/StaticTimePicker/StaticTimePicker.js +8 -3
- package/modern/TimeClock/Clock.js +4 -3
- package/modern/TimeClock/TimeClock.js +8 -6
- package/modern/TimeField/TimeField.js +6 -6
- package/modern/TimePicker/TimePicker.js +9 -4
- package/modern/TimePicker/TimePickerToolbar.js +8 -7
- package/modern/YearCalendar/PickersYear.js +17 -13
- package/modern/YearCalendar/YearCalendar.js +18 -14
- package/modern/hooks/index.js +2 -2
- package/modern/hooks/useClearableField.js +4 -3
- package/modern/hooks/useParsedFormat.js +2 -2
- package/modern/hooks/usePickerContext.js +15 -0
- package/{hooks/usePickersTranslations.js → modern/hooks/usePickerTranslations.js} +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerProvider.js +40 -0
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +22 -18
- package/modern/internals/hooks/useField/useField.js +1 -1
- package/modern/internals/hooks/useField/useFieldState.js +4 -3
- package/modern/internals/hooks/useField/useFieldV7TextField.js +4 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +24 -19
- package/modern/internals/hooks/usePicker/usePicker.js +15 -10
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +2 -5
- package/modern/internals/hooks/usePicker/usePickerProvider.js +77 -0
- package/modern/internals/hooks/usePicker/usePickerValue.js +7 -10
- package/modern/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/modern/internals/hooks/usePickerPrivateContext.js +9 -0
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +6 -5
- package/modern/internals/hooks/useValueWithTimezone.js +13 -1
- package/modern/internals/hooks/useViews.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/internals/models/formProps.js +1 -0
- package/modern/internals/models/index.js +3 -1
- package/modern/internals/models/props/time.js +1 -0
- package/modern/internals/models/value.js +1 -0
- package/modern/locales/beBY.js +3 -3
- package/modern/locales/bgBG.js +3 -3
- package/modern/locales/caES.js +3 -3
- package/modern/locales/csCZ.js +3 -3
- package/modern/locales/daDK.js +3 -3
- package/modern/locales/deDE.js +3 -3
- package/modern/locales/elGR.js +12 -13
- package/modern/locales/enUS.js +3 -3
- package/modern/locales/esES.js +3 -3
- package/modern/locales/eu.js +3 -3
- package/modern/locales/faIR.js +3 -3
- package/modern/locales/fiFI.js +3 -3
- package/modern/locales/frFR.js +3 -3
- package/modern/locales/heIL.js +3 -3
- package/modern/locales/hrHR.js +3 -3
- package/modern/locales/huHU.js +3 -3
- package/modern/locales/isIS.js +3 -3
- package/modern/locales/itIT.js +3 -3
- package/modern/locales/jaJP.js +3 -3
- package/modern/locales/koKR.js +3 -3
- package/modern/locales/kzKZ.js +3 -3
- package/modern/locales/mk.js +3 -3
- package/modern/locales/nbNO.js +3 -3
- package/modern/locales/nlNL.js +3 -3
- package/modern/locales/nnNO.js +3 -3
- package/modern/locales/plPL.js +3 -3
- package/modern/locales/ptBR.js +5 -3
- package/modern/locales/ptPT.js +3 -3
- package/modern/locales/roRO.js +3 -3
- package/modern/locales/ruRU.js +3 -3
- package/modern/locales/skSK.js +3 -3
- package/modern/locales/svSE.js +3 -3
- package/modern/locales/trTR.js +3 -3
- package/modern/locales/ukUA.js +3 -3
- package/modern/locales/urPK.js +3 -3
- package/modern/locales/utils/getPickersLocalization.js +1 -1
- package/modern/locales/viVN.js +3 -3
- package/modern/locales/zhCN.js +3 -3
- package/modern/locales/zhHK.js +3 -3
- package/modern/validation/useValidation.js +2 -3
- package/modern/validation/validateDate.js +5 -0
- package/modern/validation/validateDateTime.js +5 -0
- package/modern/validation/validateTime.js +5 -0
- package/node/DateCalendar/DateCalendar.js +21 -22
- package/node/DateCalendar/DayCalendar.js +13 -10
- package/node/DateField/DateField.js +8 -10
- package/node/DatePicker/DatePicker.js +15 -14
- package/node/DatePicker/DatePickerToolbar.js +2 -4
- package/node/DateTimeField/DateTimeField.js +9 -12
- package/node/DateTimePicker/DateTimePicker.js +16 -16
- package/node/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/node/DateTimePicker/DateTimePickerToolbar.js +8 -7
- package/node/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +0 -2
- package/node/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/node/DigitalClock/DigitalClock.js +8 -6
- package/node/MobileDatePicker/MobileDatePicker.js +17 -16
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/node/MobileTimePicker/MobileTimePicker.js +11 -6
- package/node/MonthCalendar/MonthCalendar.js +18 -14
- package/node/MonthCalendar/PickersMonth.js +17 -13
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -6
- package/node/PickersActionBar/PickersActionBar.js +2 -2
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/node/PickersLayout/PickersLayout.js +0 -2
- package/node/PickersLayout/usePickerLayout.js +18 -23
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/node/PickersTextField/PickersTextField.js +2 -2
- package/node/StaticDatePicker/StaticDatePicker.js +14 -13
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
- package/node/StaticTimePicker/StaticTimePicker.js +8 -3
- package/node/TimeClock/Clock.js +4 -3
- package/node/TimeClock/TimeClock.js +8 -6
- package/node/TimeField/TimeField.js +6 -6
- package/node/TimePicker/TimePicker.js +9 -4
- package/node/TimePicker/TimePickerToolbar.js +8 -7
- package/node/YearCalendar/PickersYear.js +17 -13
- package/node/YearCalendar/YearCalendar.js +18 -14
- package/node/hooks/index.js +6 -6
- package/node/hooks/useClearableField.js +4 -3
- package/node/hooks/useParsedFormat.js +2 -2
- package/node/hooks/usePickerContext.js +21 -0
- package/node/hooks/usePickerTranslations.js +10 -0
- package/node/index.js +1 -1
- package/node/internals/components/PickerProvider.js +48 -0
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +22 -18
- package/node/internals/hooks/useField/useField.js +1 -1
- package/node/internals/hooks/useField/useFieldState.js +4 -3
- package/node/internals/hooks/useField/useFieldV7TextField.js +4 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +24 -19
- package/node/internals/hooks/usePicker/usePicker.js +15 -10
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +2 -5
- package/node/internals/hooks/usePicker/usePickerProvider.js +87 -0
- package/node/internals/hooks/usePicker/usePickerValue.js +6 -10
- package/node/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/node/internals/hooks/usePickerPrivateContext.js +15 -0
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +6 -5
- package/node/internals/hooks/useValueWithTimezone.js +13 -1
- package/node/internals/hooks/useViews.js +3 -3
- package/node/internals/index.js +14 -7
- package/node/internals/models/index.js +22 -0
- package/node/internals/models/props/time.js +5 -0
- package/node/internals/models/value.js +5 -0
- package/node/locales/beBY.js +3 -3
- package/node/locales/bgBG.js +3 -3
- package/node/locales/caES.js +3 -3
- package/node/locales/csCZ.js +3 -3
- package/node/locales/daDK.js +3 -3
- package/node/locales/deDE.js +3 -3
- package/node/locales/elGR.js +12 -13
- package/node/locales/enUS.js +3 -3
- package/node/locales/esES.js +3 -3
- package/node/locales/eu.js +3 -3
- package/node/locales/faIR.js +3 -3
- package/node/locales/fiFI.js +3 -3
- package/node/locales/frFR.js +3 -3
- package/node/locales/heIL.js +3 -3
- package/node/locales/hrHR.js +3 -3
- package/node/locales/huHU.js +3 -3
- package/node/locales/isIS.js +3 -3
- package/node/locales/itIT.js +3 -3
- package/node/locales/jaJP.js +3 -3
- package/node/locales/koKR.js +3 -3
- package/node/locales/kzKZ.js +3 -3
- package/node/locales/mk.js +3 -3
- package/node/locales/nbNO.js +3 -3
- package/node/locales/nlNL.js +3 -3
- package/node/locales/nnNO.js +3 -3
- package/node/locales/plPL.js +3 -3
- package/node/locales/ptBR.js +5 -3
- package/node/locales/ptPT.js +3 -3
- package/node/locales/roRO.js +3 -3
- package/node/locales/ruRU.js +3 -3
- package/node/locales/skSK.js +3 -3
- package/node/locales/svSE.js +3 -3
- package/node/locales/trTR.js +3 -3
- package/node/locales/ukUA.js +3 -3
- package/node/locales/urPK.js +3 -3
- package/node/locales/utils/getPickersLocalization.js +1 -1
- package/node/locales/viVN.js +3 -3
- package/node/locales/zhCN.js +3 -3
- package/node/locales/zhHK.js +3 -3
- package/node/validation/useValidation.js +2 -3
- package/node/validation/validateDate.js +4 -0
- package/node/validation/validateDateTime.js +4 -0
- package/node/validation/validateTime.js +4 -0
- package/package.json +5 -5
- package/themeAugmentation/props.d.ts +28 -28
- package/timeViewRenderers/timeViewRenderers.d.ts +6 -6
- package/validation/extractValidationProps.d.ts +4 -4
- package/validation/useValidation.d.ts +9 -10
- package/validation/useValidation.js +2 -3
- package/validation/validateDate.d.ts +7 -2
- package/validation/validateDate.js +5 -0
- package/validation/validateDateTime.d.ts +10 -4
- package/validation/validateDateTime.js +5 -0
- package/validation/validateTime.d.ts +7 -2
- package/validation/validateTime.js +5 -0
- package/hooks/usePickersContext.d.ts +0 -4
- package/hooks/usePickersContext.js +0 -15
- package/hooks/usePickersTranslations.d.ts +0 -2
- package/internals/components/PickersProvider.d.ts +0 -34
- package/internals/components/PickersProvider.js +0 -26
- package/internals/hooks/usePicker/usePickerOwnerState.d.ts +0 -9
- package/internals/hooks/usePicker/usePickerOwnerState.js +0 -13
- package/modern/hooks/usePickersContext.js +0 -15
- package/modern/internals/components/PickersProvider.js +0 -26
- package/modern/internals/hooks/usePicker/usePickerOwnerState.js +0 -13
- package/node/hooks/usePickersContext.js +0 -21
- package/node/hooks/usePickersTranslations.js +0 -10
- package/node/internals/components/PickersProvider.js +0 -34
- package/node/internals/hooks/usePicker/usePickerOwnerState.js +0 -20
- /package/internals/models/{props/clock.js → formProps.js} +0 -0
- /package/{modern/internals/models/props/clock.js → internals/models/props/time.js} +0 -0
- /package/node/internals/models/{props/clock.js → formProps.js} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DateCalendarProps } from '../DateCalendar';
|
|
3
|
-
import { DateView
|
|
3
|
+
import { DateView } from '../models';
|
|
4
4
|
import { DateOrTimeViewWithMeridiem } from '../internals/models';
|
|
5
|
-
export interface DateViewRendererProps<
|
|
5
|
+
export interface DateViewRendererProps<TView extends DateOrTimeViewWithMeridiem> extends Omit<DateCalendarProps, 'views' | 'openTo' | 'view' | 'onViewChange' | 'focusedView'> {
|
|
6
6
|
view: TView;
|
|
7
7
|
onViewChange?: (view: TView) => void;
|
|
8
8
|
views: readonly TView[];
|
|
9
9
|
focusedView: TView | null;
|
|
10
10
|
}
|
|
11
|
-
export declare const renderDateViewCalendar:
|
|
11
|
+
export declare const renderDateViewCalendar: ({ view, onViewChange, views, focusedView, onFocusedViewChange, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minDate, maxDate, shouldDisableDate, shouldDisableMonth, shouldDisableYear, reduceAnimations, onMonthChange, monthsPerRow, onYearChange, yearsOrder, yearsPerRow, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, sx, autoFocus, fixedWeekNumber, displayWeekNumber, timezone, }: DateViewRendererProps<DateView>) => React.JSX.Element;
|
package/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { useClearableField } from './useClearableField';
|
|
2
2
|
export type { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps, UseClearableFieldResponse, } from './useClearableField';
|
|
3
|
-
export {
|
|
3
|
+
export { usePickerTranslations } from './usePickerTranslations';
|
|
4
4
|
export { useSplitFieldProps } from './useSplitFieldProps';
|
|
5
5
|
export { useParsedFormat } from './useParsedFormat';
|
|
6
|
-
export {
|
|
6
|
+
export { usePickerContext } from './usePickerContext';
|
package/hooks/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useClearableField } from "./useClearableField.js";
|
|
2
|
-
export {
|
|
2
|
+
export { usePickerTranslations } from "./usePickerTranslations.js";
|
|
3
3
|
export { useSplitFieldProps } from "./useSplitFieldProps.js";
|
|
4
4
|
export { useParsedFormat } from "./useParsedFormat.js";
|
|
5
|
-
export {
|
|
5
|
+
export { usePickerContext } from "./usePickerContext.js";
|
|
@@ -9,10 +9,10 @@ import useSlotProps from '@mui/utils/useSlotProps';
|
|
|
9
9
|
import MuiIconButton from '@mui/material/IconButton';
|
|
10
10
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
11
11
|
import { ClearIcon } from "../icons/index.js";
|
|
12
|
-
import {
|
|
12
|
+
import { usePickerTranslations } from "./usePickerTranslations.js";
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
export const useClearableField = props => {
|
|
15
|
-
const translations =
|
|
15
|
+
const translations = usePickerTranslations();
|
|
16
16
|
const {
|
|
17
17
|
clearable,
|
|
18
18
|
onClear,
|
|
@@ -30,7 +30,8 @@ export const useClearableField = props => {
|
|
|
30
30
|
ownerState: {},
|
|
31
31
|
className: 'clearButton',
|
|
32
32
|
additionalProps: {
|
|
33
|
-
title: translations.fieldClearLabel
|
|
33
|
+
title: translations.fieldClearLabel,
|
|
34
|
+
tabIndex: -1
|
|
34
35
|
}
|
|
35
36
|
}),
|
|
36
37
|
iconButtonProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { PickerValidDate } from '../models';
|
|
2
1
|
import type { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
3
|
-
interface UseParsedFormatParameters extends Pick<UseFieldInternalProps<any, any, any, any
|
|
2
|
+
interface UseParsedFormatParameters extends Pick<UseFieldInternalProps<any, any, any, any>, 'format' | 'formatDensity' | 'shouldRespectLeadingZeros'> {
|
|
4
3
|
}
|
|
5
4
|
/**
|
|
6
5
|
* Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
|
|
@@ -11,5 +10,5 @@ interface UseParsedFormatParameters extends Pick<UseFieldInternalProps<any, any,
|
|
|
11
10
|
* @param {boolean} params.shouldRespectLeadingZeros If `true`, the format will respect the leading zeroes, if `false`, the format will always add leading zeroes.
|
|
12
11
|
* @returns
|
|
13
12
|
*/
|
|
14
|
-
export declare const useParsedFormat:
|
|
13
|
+
export declare const useParsedFormat: (parameters: UseParsedFormatParameters) => string;
|
|
15
14
|
export {};
|
package/hooks/useParsedFormat.js
CHANGED
|
@@ -5,7 +5,7 @@ import { useRtl } from '@mui/system/RtlProvider';
|
|
|
5
5
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
6
6
|
import { buildSectionsFromFormat } from "../internals/hooks/useField/buildSectionsFromFormat.js";
|
|
7
7
|
import { getLocalizedDigits } from "../internals/hooks/useField/useField.utils.js";
|
|
8
|
-
import {
|
|
8
|
+
import { usePickerTranslations } from "./usePickerTranslations.js";
|
|
9
9
|
/**
|
|
10
10
|
* Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
|
|
11
11
|
* This format is localized (e.g: `AAAA` for the year with the French locale) and cannot be parsed by your date library.
|
|
@@ -23,7 +23,7 @@ export const useParsedFormat = parameters => {
|
|
|
23
23
|
} = parameters;
|
|
24
24
|
const utils = useUtils();
|
|
25
25
|
const isRtl = useRtl();
|
|
26
|
-
const translations =
|
|
26
|
+
const translations = usePickerTranslations();
|
|
27
27
|
const localizedDigits = React.useMemo(() => getLocalizedDigits(utils), [utils]);
|
|
28
28
|
return React.useMemo(() => {
|
|
29
29
|
const sections = buildSectionsFromFormat({
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { PickerContext } from "../internals/components/PickerProvider.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the context passed by the picker that wraps the current component.
|
|
8
|
+
*/
|
|
9
|
+
export const usePickerContext = () => {
|
|
10
|
+
const value = React.useContext(PickerContext);
|
|
11
|
+
if (value == null) {
|
|
12
|
+
throw new Error(['MUI X: The `usePickerContext` can only be called in fields that are used as a slot of a picker component'].join('\n'));
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePickerTranslations: () => import("..").PickersLocaleText;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FieldValueType } from '../models';
|
|
2
1
|
import { DATE_TIME_VALIDATION_PROP_NAMES, DATE_VALIDATION_PROP_NAMES, TIME_VALIDATION_PROP_NAMES } from '../validation/extractValidationProps';
|
|
2
|
+
import { PickerValueType } from '../models/common';
|
|
3
3
|
declare const SHARED_FIELD_INTERNAL_PROP_NAMES: readonly ["value", "defaultValue", "referenceDate", "format", "formatDensity", "onChange", "timezone", "onError", "shouldRespectLeadingZeros", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef", "enableAccessibleFieldDOMStructure", "disabled", "readOnly", "dateSeparator"];
|
|
4
|
-
type InternalPropNames<TValueType extends
|
|
4
|
+
type InternalPropNames<TValueType extends PickerValueType> = (typeof SHARED_FIELD_INTERNAL_PROP_NAMES)[number] | (TValueType extends 'date' | 'date-time' ? (typeof DATE_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'time' | 'date-time' ? (typeof TIME_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'date-time' ? (typeof DATE_TIME_VALIDATION_PROP_NAMES)[number] : never);
|
|
5
5
|
/**
|
|
6
6
|
* Split the props received by the field component into:
|
|
7
7
|
* - `internalProps` which are used by the various hooks called by the field component.
|
|
@@ -12,7 +12,7 @@ type InternalPropNames<TValueType extends FieldValueType> = (typeof SHARED_FIELD
|
|
|
12
12
|
* @param {TProps} props The props received by the field component.
|
|
13
13
|
* @param {TValueType} valueType The type of the field value ('date', 'time', or 'date-time').
|
|
14
14
|
*/
|
|
15
|
-
export declare const useSplitFieldProps: <TValueType extends
|
|
15
|
+
export declare const useSplitFieldProps: <TValueType extends PickerValueType, TProps extends { [key in InternalPropNames<TValueType>]?: any; }>(props: TProps, valueType: TValueType) => {
|
|
16
16
|
forwardedProps: Omit<TProps, InternalPropNames<TValueType>>;
|
|
17
17
|
internalProps: Pick<TProps, InternalPropNames<TValueType>>;
|
|
18
18
|
};
|
package/index.js
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PickerOwnerState } from '../../models';
|
|
3
|
+
import { PickersInputLocaleText } from '../../locales';
|
|
4
|
+
import { PickerOrientation, PickerVariant } from '../models';
|
|
5
|
+
export declare const PickerContext: React.Context<PickerContextValue | null>;
|
|
6
|
+
export declare const PickerPrivateContext: React.Context<PickerPrivateContextValue>;
|
|
7
|
+
/**
|
|
8
|
+
* Provides the context for the various parts of a picker component:
|
|
9
|
+
* - contextValue: the context for the picker sub-components.
|
|
10
|
+
* - localizationProvider: the translations passed through the props and through a parent LocalizationProvider.
|
|
11
|
+
*
|
|
12
|
+
* @ignore - do not document.
|
|
13
|
+
*/
|
|
14
|
+
export declare function PickerProvider(props: PickerProviderProps): React.JSX.Element;
|
|
15
|
+
export interface PickerProviderProps {
|
|
16
|
+
contextValue: PickerContextValue;
|
|
17
|
+
privateContextValue: PickerPrivateContextValue;
|
|
18
|
+
localeText: PickersInputLocaleText | undefined;
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export interface PickerContextValue {
|
|
22
|
+
/**
|
|
23
|
+
* Open the picker.
|
|
24
|
+
* @param {React.UIEvent} event The DOM event that triggered the change.
|
|
25
|
+
*/
|
|
26
|
+
onOpen: (event: React.UIEvent) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Close the picker.
|
|
29
|
+
* @param {React.UIEvent} event The DOM event that triggered the change.
|
|
30
|
+
*/
|
|
31
|
+
onClose: (event: React.UIEvent) => void;
|
|
32
|
+
/**
|
|
33
|
+
* `true` if the picker is open, `false` otherwise.
|
|
34
|
+
*/
|
|
35
|
+
open: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* `true` if the picker is disabled, `false` otherwise.
|
|
38
|
+
*/
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* `true` if the picker is read-only, `false` otherwise.
|
|
42
|
+
*/
|
|
43
|
+
readOnly: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The responsive variant of the picker.
|
|
46
|
+
* Is equal to "desktop" when using a desktop picker (like <DesktopDatePicker />).
|
|
47
|
+
* Is equal to "mobile" when using a mobile picker (like <MobileDatePicker />).
|
|
48
|
+
* Is equal to "mobile" or "desktop" when using a responsive picker (like <DatePicker />) depending on the `desktopModeMediaQuery` prop.
|
|
49
|
+
* Is equal to "mobile" or "desktop" when using a static picker (like <StaticDatePicker />) depending on the `displayStaticWrapperAs` prop.
|
|
50
|
+
* Is always equal to "desktop" if the component you are accessing the ownerState from is not wrapped by a picker.
|
|
51
|
+
*/
|
|
52
|
+
variant: PickerVariant;
|
|
53
|
+
/**
|
|
54
|
+
* The orientation of the picker.
|
|
55
|
+
* Is equal to "landscape" when the picker is in landscape orientation.
|
|
56
|
+
* Is equal to "portrait" when the picker is in portrait orientation.
|
|
57
|
+
* You can use the "orientation" on any picker component to force the orientation.
|
|
58
|
+
* Is always equal to "portrait" if the component you are accessing the ownerState from is not wrapped by a picker.
|
|
59
|
+
*/
|
|
60
|
+
orientation: PickerOrientation;
|
|
61
|
+
}
|
|
62
|
+
export interface PickerPrivateContextValue {
|
|
63
|
+
/**
|
|
64
|
+
* The ownerState of the picker.
|
|
65
|
+
*/
|
|
66
|
+
ownerState: PickerOwnerState;
|
|
67
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LocalizationProvider } from "../../LocalizationProvider/index.js";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export const PickerContext = /*#__PURE__*/React.createContext(null);
|
|
5
|
+
export const PickerPrivateContext = /*#__PURE__*/React.createContext({
|
|
6
|
+
ownerState: {
|
|
7
|
+
isPickerDisabled: false,
|
|
8
|
+
isPickerReadOnly: false,
|
|
9
|
+
isPickerValueEmpty: false,
|
|
10
|
+
isPickerOpen: false,
|
|
11
|
+
pickerVariant: 'desktop',
|
|
12
|
+
pickerOrientation: 'portrait'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Provides the context for the various parts of a picker component:
|
|
18
|
+
* - contextValue: the context for the picker sub-components.
|
|
19
|
+
* - localizationProvider: the translations passed through the props and through a parent LocalizationProvider.
|
|
20
|
+
*
|
|
21
|
+
* @ignore - do not document.
|
|
22
|
+
*/
|
|
23
|
+
export function PickerProvider(props) {
|
|
24
|
+
const {
|
|
25
|
+
contextValue,
|
|
26
|
+
privateContextValue,
|
|
27
|
+
localeText,
|
|
28
|
+
children
|
|
29
|
+
} = props;
|
|
30
|
+
return /*#__PURE__*/_jsx(PickerContext.Provider, {
|
|
31
|
+
value: contextValue,
|
|
32
|
+
children: /*#__PURE__*/_jsx(PickerPrivateContext.Provider, {
|
|
33
|
+
value: privateContextValue,
|
|
34
|
+
children: /*#__PURE__*/_jsx(LocalizationProvider, {
|
|
35
|
+
localeText: localeText,
|
|
36
|
+
children: children
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { PickerOnChangeFn } from './useViews';
|
|
2
2
|
import { PickerSelectionState } from './usePicker';
|
|
3
3
|
import { PickersTimezone, PickerValidDate } from '../../models';
|
|
4
|
-
export interface MonthValidationOptions
|
|
4
|
+
export interface MonthValidationOptions {
|
|
5
5
|
disablePast?: boolean;
|
|
6
6
|
disableFuture?: boolean;
|
|
7
|
-
minDate:
|
|
8
|
-
maxDate:
|
|
7
|
+
minDate: PickerValidDate;
|
|
8
|
+
maxDate: PickerValidDate;
|
|
9
9
|
timezone: PickersTimezone;
|
|
10
10
|
}
|
|
11
|
-
export declare function useNextMonthDisabled
|
|
12
|
-
export declare function usePreviousMonthDisabled
|
|
13
|
-
export declare function useMeridiemMode
|
|
11
|
+
export declare function useNextMonthDisabled(month: PickerValidDate, { disableFuture, maxDate, timezone, }: Pick<MonthValidationOptions, 'disableFuture' | 'maxDate' | 'timezone'>): boolean;
|
|
12
|
+
export declare function usePreviousMonthDisabled(month: PickerValidDate, { disablePast, minDate, timezone, }: Pick<MonthValidationOptions, 'disablePast' | 'minDate' | 'timezone'>): boolean;
|
|
13
|
+
export declare function useMeridiemMode(date: PickerValidDate | null, ampm: boolean | undefined, onChange: PickerOnChangeFn, selectionState?: PickerSelectionState): {
|
|
14
14
|
meridiemMode: import("../utils/time-utils").Meridiem | null;
|
|
15
15
|
handleMeridiemChange: (mode: "am" | "pm") => void;
|
|
16
16
|
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
1
2
|
import { BaseDateValidationProps, BaseTimeValidationProps, DateTimeValidationProps, TimeValidationProps } from '../models/validation';
|
|
2
|
-
|
|
3
|
-
import { PickerValidDate } from '../../models';
|
|
4
|
-
export interface UseDefaultizedDateFieldBaseProps<TDate extends PickerValidDate> extends BaseDateValidationProps<TDate> {
|
|
3
|
+
export interface UseDefaultizedDateFieldBaseProps extends BaseDateValidationProps {
|
|
5
4
|
format?: string;
|
|
6
5
|
}
|
|
7
|
-
export declare const useDefaultizedDateField: <
|
|
6
|
+
export declare const useDefaultizedDateField: <TKnownProps extends UseDefaultizedDateFieldBaseProps, TAllProps extends {}>(props: TKnownProps & TAllProps) => TAllProps & DefaultizedProps<TKnownProps, keyof UseDefaultizedDateFieldBaseProps>;
|
|
8
7
|
export interface UseDefaultizedTimeFieldBaseProps extends BaseTimeValidationProps {
|
|
9
8
|
format?: string;
|
|
10
9
|
}
|
|
11
|
-
export declare const useDefaultizedTimeField: <
|
|
10
|
+
export declare const useDefaultizedTimeField: <TKnownProps extends UseDefaultizedTimeFieldBaseProps & {
|
|
12
11
|
ampm?: boolean;
|
|
13
12
|
}, TAllProps extends {}>(props: TKnownProps & TAllProps) => TAllProps & DefaultizedProps<TKnownProps, keyof UseDefaultizedTimeFieldBaseProps>;
|
|
14
|
-
export interface UseDefaultizedDateTimeFieldBaseProps
|
|
13
|
+
export interface UseDefaultizedDateTimeFieldBaseProps extends BaseDateValidationProps, BaseTimeValidationProps {
|
|
15
14
|
format?: string;
|
|
16
15
|
}
|
|
17
|
-
export declare const useDefaultizedDateTimeField: <
|
|
16
|
+
export declare const useDefaultizedDateTimeField: <TKnownProps extends UseDefaultizedDateTimeFieldBaseProps & DateTimeValidationProps & TimeValidationProps & {
|
|
18
17
|
ampm?: boolean;
|
|
19
|
-
}, TAllProps extends {}>(props: TKnownProps & TAllProps) => TAllProps & DefaultizedProps<TKnownProps, keyof UseDefaultizedDateTimeFieldBaseProps
|
|
18
|
+
}, TAllProps extends {}>(props: TKnownProps & TAllProps) => TAllProps & DefaultizedProps<TKnownProps, keyof UseDefaultizedDateTimeFieldBaseProps>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MuiPickersAdapter, PickersTimezone, PickerValidDate } from '../../models';
|
|
2
|
-
export declare const useClockReferenceDate: <
|
|
3
|
-
value:
|
|
4
|
-
referenceDate:
|
|
5
|
-
utils: MuiPickersAdapter
|
|
2
|
+
export declare const useClockReferenceDate: <TProps extends {}>({ value, referenceDate: referenceDateProp, utils, props, timezone, }: {
|
|
3
|
+
value: PickerValidDate;
|
|
4
|
+
referenceDate: PickerValidDate | undefined;
|
|
5
|
+
utils: MuiPickersAdapter;
|
|
6
6
|
props: TProps;
|
|
7
7
|
timezone: PickersTimezone;
|
|
8
|
-
}) =>
|
|
8
|
+
}) => PickerValidDate;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { UseDesktopPickerParams, UseDesktopPickerProps } from './useDesktopPicker.types';
|
|
3
|
-
import { PickerValidDate } from '../../../models';
|
|
4
3
|
import { DateOrTimeViewWithMeridiem } from '../../models';
|
|
5
4
|
/**
|
|
6
5
|
* Hook managing all the single-date desktop pickers:
|
|
@@ -8,6 +7,6 @@ import { DateOrTimeViewWithMeridiem } from '../../models';
|
|
|
8
7
|
* - DesktopDateTimePicker
|
|
9
8
|
* - DesktopTimePicker
|
|
10
9
|
*/
|
|
11
|
-
export declare const useDesktopPicker: <
|
|
10
|
+
export declare const useDesktopPicker: <TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopPickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>>({ props, getOpenDialogAriaText, ...pickerParams }: UseDesktopPickerParams<TView, TEnableAccessibleFieldDOMStructure, TExternalProps>) => {
|
|
12
11
|
renderPicker: () => React.JSX.Element;
|
|
13
12
|
};
|
|
@@ -12,7 +12,7 @@ import useId from '@mui/utils/useId';
|
|
|
12
12
|
import { PickersPopper } from "../../components/PickersPopper.js";
|
|
13
13
|
import { usePicker } from "../usePicker/index.js";
|
|
14
14
|
import { PickersLayout } from "../../../PickersLayout/index.js";
|
|
15
|
-
import {
|
|
15
|
+
import { PickerProvider } from "../../components/PickerProvider.js";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Hook managing all the single-date desktop pickers:
|
|
@@ -56,17 +56,18 @@ export const useDesktopPicker = _ref => {
|
|
|
56
56
|
actions,
|
|
57
57
|
hasUIView,
|
|
58
58
|
layoutProps,
|
|
59
|
+
providerProps,
|
|
59
60
|
renderCurrentView,
|
|
60
61
|
shouldRestoreFocus,
|
|
61
62
|
fieldProps: pickerFieldProps,
|
|
62
|
-
contextValue,
|
|
63
63
|
ownerState
|
|
64
64
|
} = usePicker(_extends({}, pickerParams, {
|
|
65
65
|
props,
|
|
66
66
|
fieldRef,
|
|
67
|
+
localeText,
|
|
67
68
|
autoFocusView: true,
|
|
68
69
|
additionalViewProps: {},
|
|
69
|
-
|
|
70
|
+
variant: 'desktop'
|
|
70
71
|
}));
|
|
71
72
|
const InputAdornment = slots.inputAdornment ?? MuiInputAdornment;
|
|
72
73
|
const _useSlotProps = useSlotProps({
|
|
@@ -75,7 +76,7 @@ export const useDesktopPicker = _ref => {
|
|
|
75
76
|
additionalProps: {
|
|
76
77
|
position: 'end'
|
|
77
78
|
},
|
|
78
|
-
ownerState
|
|
79
|
+
ownerState
|
|
79
80
|
}),
|
|
80
81
|
inputAdornmentProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
|
81
82
|
const OpenPickerButton = slots.openPickerButton ?? IconButton;
|
|
@@ -88,7 +89,7 @@ export const useDesktopPicker = _ref => {
|
|
|
88
89
|
'aria-label': getOpenDialogAriaText(pickerFieldProps.value),
|
|
89
90
|
edge: inputAdornmentProps.position
|
|
90
91
|
},
|
|
91
|
-
ownerState
|
|
92
|
+
ownerState
|
|
92
93
|
}),
|
|
93
94
|
openPickerButtonProps = _objectWithoutPropertiesLoose(_useSlotProps2, _excluded3);
|
|
94
95
|
const OpenPickerIcon = slots.openPickerIcon;
|
|
@@ -101,27 +102,32 @@ export const useDesktopPicker = _ref => {
|
|
|
101
102
|
const fieldProps = useSlotProps({
|
|
102
103
|
elementType: Field,
|
|
103
104
|
externalSlotProps: innerSlotProps?.field,
|
|
104
|
-
additionalProps: _extends({
|
|
105
|
-
|
|
106
|
-
}, {
|
|
105
|
+
additionalProps: _extends({
|
|
106
|
+
// Internal props
|
|
107
107
|
readOnly,
|
|
108
108
|
disabled,
|
|
109
|
-
className,
|
|
110
|
-
sx,
|
|
111
109
|
format,
|
|
112
110
|
formatDensity,
|
|
113
111
|
enableAccessibleFieldDOMStructure,
|
|
114
112
|
selectedSections,
|
|
115
113
|
onSelectedSectionsChange,
|
|
116
114
|
timezone,
|
|
115
|
+
autoFocus: autoFocus && !props.open
|
|
116
|
+
}, pickerFieldProps, {
|
|
117
|
+
// onChange and value
|
|
118
|
+
|
|
119
|
+
// Forwarded props
|
|
120
|
+
className,
|
|
121
|
+
sx,
|
|
117
122
|
label,
|
|
118
123
|
name,
|
|
119
|
-
autoFocus: autoFocus && !props.open,
|
|
120
124
|
focused: open ? true : undefined
|
|
121
|
-
},
|
|
125
|
+
}, isToolbarHidden && {
|
|
126
|
+
id: labelId
|
|
127
|
+
}, !!inputRef && {
|
|
122
128
|
inputRef
|
|
123
|
-
}
|
|
124
|
-
ownerState
|
|
129
|
+
}),
|
|
130
|
+
ownerState
|
|
125
131
|
});
|
|
126
132
|
|
|
127
133
|
// TODO: Move to `useSlotProps` when https://github.com/mui/material-ui/pull/35088 will be merged
|
|
@@ -159,9 +165,7 @@ export const useDesktopPicker = _ref => {
|
|
|
159
165
|
}, innerSlotProps?.popper)
|
|
160
166
|
});
|
|
161
167
|
const handleFieldRef = useForkRef(fieldRef, fieldProps.unstableFieldRef);
|
|
162
|
-
const renderPicker = () => /*#__PURE__*/_jsxs(
|
|
163
|
-
contextValue: contextValue,
|
|
164
|
-
localeText: localeText,
|
|
168
|
+
const renderPicker = () => /*#__PURE__*/_jsxs(PickerProvider, _extends({}, providerProps, {
|
|
165
169
|
children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps, {
|
|
166
170
|
slots: slotsForField,
|
|
167
171
|
slotProps: slotProps,
|
|
@@ -182,7 +186,7 @@ export const useDesktopPicker = _ref => {
|
|
|
182
186
|
children: renderCurrentView()
|
|
183
187
|
}))
|
|
184
188
|
}))]
|
|
185
|
-
});
|
|
189
|
+
}));
|
|
186
190
|
return {
|
|
187
191
|
renderPicker
|
|
188
192
|
};
|
|
@@ -3,17 +3,17 @@ import IconButton, { IconButtonProps } from '@mui/material/IconButton';
|
|
|
3
3
|
import { InputAdornmentProps } from '@mui/material/InputAdornment';
|
|
4
4
|
import TextField from '@mui/material/TextField';
|
|
5
5
|
import { SlotComponentProps } from '@mui/utils';
|
|
6
|
+
import { MakeRequired, SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
6
7
|
import { BaseNonStaticPickerProps, BasePickerProps, BaseNonRangeNonStaticPickerProps } from '../../models/props/basePickerProps';
|
|
7
8
|
import { PickersPopperSlots, PickersPopperSlotProps } from '../../components/PickersPopper';
|
|
8
|
-
import { UsePickerParams
|
|
9
|
-
import {
|
|
9
|
+
import { UsePickerParams } from '../usePicker';
|
|
10
|
+
import { FieldSection, PickerFieldSlotProps, PickerOwnerState, PickerValidDate } from '../../../models';
|
|
10
11
|
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, PickersLayoutSlotProps } from '../../../PickersLayout/PickersLayout.types';
|
|
11
12
|
import { UsePickerValueNonStaticProps } from '../usePicker/usePickerValue.types';
|
|
12
13
|
import { UsePickerViewsNonStaticProps, UsePickerViewsProps } from '../usePicker/usePickerViews';
|
|
13
14
|
import { DateOrTimeViewWithMeridiem } from '../../models';
|
|
14
15
|
import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '../../../hooks/useClearableField';
|
|
15
|
-
|
|
16
|
-
export interface UseDesktopPickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends Pick<PickersPopperSlots, 'desktopPaper' | 'desktopTransition' | 'desktopTrapFocus' | 'popper'>, ExportedPickersLayoutSlots<TDate | null, TDate, TView>, UseClearableFieldSlots {
|
|
16
|
+
export interface UseDesktopPickerSlots<TView extends DateOrTimeViewWithMeridiem> extends Pick<PickersPopperSlots, 'desktopPaper' | 'desktopTransition' | 'desktopTrapFocus' | 'popper'>, ExportedPickersLayoutSlots<PickerValidDate | null, TView>, UseClearableFieldSlots {
|
|
17
17
|
/**
|
|
18
18
|
* Component used to enter the date with the keyboard.
|
|
19
19
|
*/
|
|
@@ -38,14 +38,14 @@ export interface UseDesktopPickerSlots<TDate extends PickerValidDate, TView exte
|
|
|
38
38
|
*/
|
|
39
39
|
openPickerIcon: React.ElementType;
|
|
40
40
|
}
|
|
41
|
-
export interface UseDesktopPickerSlotProps<
|
|
41
|
+
export interface UseDesktopPickerSlotProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends ExportedUseDesktopPickerSlotProps<TView, TEnableAccessibleFieldDOMStructure>, Pick<PickersLayoutSlotProps<PickerValidDate | null, TView>, 'toolbar'> {
|
|
42
42
|
}
|
|
43
|
-
export interface ExportedUseDesktopPickerSlotProps<
|
|
44
|
-
field?: SlotComponentPropsFromProps<
|
|
43
|
+
export interface ExportedUseDesktopPickerSlotProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends PickersPopperSlotProps, ExportedPickersLayoutSlotProps<PickerValidDate | null, TView>, UseClearableFieldSlotProps {
|
|
44
|
+
field?: SlotComponentPropsFromProps<PickerFieldSlotProps<PickerValidDate | null, FieldSection, TEnableAccessibleFieldDOMStructure>, {}, PickerOwnerState>;
|
|
45
45
|
textField?: SlotComponentProps<typeof TextField, {}, Record<string, any>>;
|
|
46
|
-
inputAdornment?:
|
|
47
|
-
openPickerButton?: SlotComponentProps<typeof IconButton, {},
|
|
48
|
-
openPickerIcon?: SlotComponentPropsFromProps<Record<string, any>, {}, PickerOwnerState
|
|
46
|
+
inputAdornment?: SlotComponentPropsFromProps<InputAdornmentProps, {}, PickerOwnerState>;
|
|
47
|
+
openPickerButton?: SlotComponentProps<typeof IconButton, {}, PickerOwnerState>;
|
|
48
|
+
openPickerIcon?: SlotComponentPropsFromProps<Record<string, any>, {}, PickerOwnerState>;
|
|
49
49
|
}
|
|
50
50
|
export interface DesktopOnlyPickerProps extends BaseNonStaticPickerProps, BaseNonRangeNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps {
|
|
51
51
|
/**
|
|
@@ -54,19 +54,19 @@ export interface DesktopOnlyPickerProps extends BaseNonStaticPickerProps, BaseNo
|
|
|
54
54
|
*/
|
|
55
55
|
autoFocus?: boolean;
|
|
56
56
|
}
|
|
57
|
-
export interface UseDesktopPickerProps<
|
|
57
|
+
export interface UseDesktopPickerProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<PickerValidDate | null, TView, any, {}>> extends BasePickerProps<PickerValidDate | null, TView, TError, TExternalProps, {}>, MakeRequired<DesktopOnlyPickerProps, 'format'> {
|
|
58
58
|
/**
|
|
59
59
|
* Overridable component slots.
|
|
60
60
|
* @default {}
|
|
61
61
|
*/
|
|
62
|
-
slots: UseDesktopPickerSlots<
|
|
62
|
+
slots: UseDesktopPickerSlots<TView>;
|
|
63
63
|
/**
|
|
64
64
|
* The props used for each component slot.
|
|
65
65
|
* @default {}
|
|
66
66
|
*/
|
|
67
|
-
slotProps?: UseDesktopPickerSlotProps<
|
|
67
|
+
slotProps?: UseDesktopPickerSlotProps<TView, TEnableAccessibleFieldDOMStructure>;
|
|
68
68
|
}
|
|
69
|
-
export interface UseDesktopPickerParams<
|
|
69
|
+
export interface UseDesktopPickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopPickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends Pick<UsePickerParams<PickerValidDate | null, TView, FieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator' | 'rendererInterceptor'> {
|
|
70
70
|
props: TExternalProps;
|
|
71
|
-
getOpenDialogAriaText: (date:
|
|
71
|
+
getOpenDialogAriaText: (date: PickerValidDate | null) => string;
|
|
72
72
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { FieldSection, MuiPickersAdapter, PickerValidDate } from '../../../models';
|
|
2
2
|
import { PickersLocaleText } from '../../../locales';
|
|
3
|
-
interface BuildSectionsFromFormatParams
|
|
4
|
-
utils: MuiPickersAdapter
|
|
3
|
+
interface BuildSectionsFromFormatParams {
|
|
4
|
+
utils: MuiPickersAdapter;
|
|
5
5
|
format: string;
|
|
6
6
|
formatDensity: 'dense' | 'spacious';
|
|
7
7
|
isRtl: boolean;
|
|
8
8
|
shouldRespectLeadingZeros: boolean;
|
|
9
|
-
localeText: PickersLocaleText
|
|
9
|
+
localeText: PickersLocaleText;
|
|
10
10
|
localizedDigits: string[];
|
|
11
|
-
date:
|
|
11
|
+
date: PickerValidDate | null;
|
|
12
12
|
enableAccessibleFieldDOMStructure: boolean;
|
|
13
13
|
}
|
|
14
|
-
export declare const buildSectionsFromFormat:
|
|
14
|
+
export declare const buildSectionsFromFormat: (params: BuildSectionsFromFormatParams) => FieldSection[];
|
|
15
15
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseFieldParams, UseFieldResponse, UseFieldCommonForwardedProps, UseFieldInternalProps, UseFieldForwardedProps } from './useField.types';
|
|
2
|
-
import {
|
|
3
|
-
export declare const useField: <TValue,
|
|
2
|
+
import { FieldSection } from '../../../models';
|
|
3
|
+
export declare const useField: <TValue, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends UseFieldCommonForwardedProps & UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure>, TInternalProps extends UseFieldInternalProps<any, any, TEnableAccessibleFieldDOMStructure, any> & {
|
|
4
4
|
minutesStep?: number;
|
|
5
|
-
}>(params: UseFieldParams<TValue,
|
|
5
|
+
}>(params: UseFieldParams<TValue, TSection, TEnableAccessibleFieldDOMStructure, TForwardedProps, TInternalProps>) => UseFieldResponse<TEnableAccessibleFieldDOMStructure, TForwardedProps>;
|