@mui/x-date-pickers 7.22.1 → 8.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdapterDateFns/AdapterDateFns.d.ts +1 -1
- package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +3 -3
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -1
- package/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.d.ts +1 -1
- package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +1 -1
- package/AdapterDayjs/AdapterDayjs.d.ts +2 -2
- package/AdapterLuxon/AdapterLuxon.d.ts +2 -2
- package/AdapterMoment/AdapterMoment.d.ts +2 -2
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +2 -2
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +2 -2
- package/CHANGELOG.md +143 -92
- package/DateCalendar/DateCalendar.d.ts +1 -2
- package/DateCalendar/DateCalendar.js +20 -22
- package/DateCalendar/DateCalendar.types.d.ts +21 -31
- package/DateCalendar/DayCalendar.d.ts +25 -24
- package/DateCalendar/DayCalendar.js +13 -10
- package/DateCalendar/index.d.ts +1 -0
- package/DateCalendar/useCalendarState.d.ts +16 -16
- package/DateCalendar/useIsDateDisabled.d.ts +2 -2
- package/DateField/DateField.d.ts +1 -2
- package/DateField/DateField.js +8 -10
- package/DateField/DateField.types.d.ts +8 -9
- package/DateField/index.d.ts +1 -1
- package/DateField/useDateField.d.ts +1 -2
- package/DatePicker/DatePicker.d.ts +1 -2
- package/DatePicker/DatePicker.js +15 -14
- package/DatePicker/DatePicker.types.d.ts +10 -11
- package/DatePicker/DatePickerToolbar.d.ts +2 -2
- package/DatePicker/DatePickerToolbar.js +12 -2
- package/DatePicker/shared.d.ts +11 -11
- package/DateTimeField/DateTimeField.d.ts +1 -2
- package/DateTimeField/DateTimeField.js +9 -12
- package/DateTimeField/DateTimeField.types.d.ts +9 -14
- package/DateTimeField/index.d.ts +1 -1
- package/DateTimeField/useDateTimeField.d.ts +1 -2
- package/DateTimePicker/DateTimePicker.d.ts +1 -2
- package/DateTimePicker/DateTimePicker.js +16 -16
- package/DateTimePicker/DateTimePicker.types.d.ts +10 -13
- package/DateTimePicker/DateTimePickerTabs.d.ts +1 -2
- package/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/DateTimePicker/DateTimePickerToolbar.d.ts +3 -3
- package/DateTimePicker/DateTimePickerToolbar.js +12 -2
- package/DateTimePicker/shared.d.ts +12 -12
- package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -2
- package/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +7 -7
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -2
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +8 -8
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +1 -2
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -0
- package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -2
- package/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +8 -8
- package/DigitalClock/DigitalClock.d.ts +1 -2
- package/DigitalClock/DigitalClock.js +7 -6
- package/DigitalClock/DigitalClock.types.d.ts +4 -4
- package/LocalizationProvider/LocalizationProvider.d.ts +12 -12
- package/MobileDatePicker/MobileDatePicker.d.ts +1 -2
- package/MobileDatePicker/MobileDatePicker.js +17 -16
- package/MobileDatePicker/MobileDatePicker.types.d.ts +7 -7
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +2 -2
- package/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +7 -7
- package/MobileTimePicker/MobileTimePicker.d.ts +2 -2
- package/MobileTimePicker/MobileTimePicker.js +11 -6
- package/MobileTimePicker/MobileTimePicker.types.d.ts +7 -7
- package/MonthCalendar/MonthCalendar.d.ts +3 -4
- package/MonthCalendar/MonthCalendar.js +17 -14
- package/MonthCalendar/MonthCalendar.types.d.ts +14 -15
- package/MonthCalendar/PickersMonth.js +17 -13
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.d.ts +1 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +3 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +9 -9
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +2 -3
- package/PickersActionBar/PickersActionBar.js +2 -2
- package/PickersCalendarHeader/PickersCalendarHeader.d.ts +1 -2
- package/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +9 -9
- package/PickersDay/PickersDay.d.ts +8 -8
- package/PickersLayout/PickersLayout.d.ts +2 -3
- package/PickersLayout/PickersLayout.js +10 -0
- package/PickersLayout/PickersLayout.types.d.ts +14 -17
- package/PickersLayout/index.d.ts +1 -1
- package/PickersLayout/usePickerLayout.d.ts +1 -2
- package/PickersLayout/usePickerLayout.js +17 -18
- package/README.md +2 -2
- package/StaticDatePicker/StaticDatePicker.d.ts +1 -2
- package/StaticDatePicker/StaticDatePicker.js +14 -13
- package/StaticDatePicker/StaticDatePicker.types.d.ts +7 -7
- package/StaticDateTimePicker/StaticDateTimePicker.d.ts +1 -2
- package/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
- package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +7 -7
- package/StaticTimePicker/StaticTimePicker.d.ts +1 -2
- package/StaticTimePicker/StaticTimePicker.js +8 -3
- package/StaticTimePicker/StaticTimePicker.types.d.ts +7 -7
- package/TimeClock/Clock.d.ts +4 -5
- package/TimeClock/Clock.js +3 -3
- package/TimeClock/ClockNumbers.d.ts +5 -5
- package/TimeClock/TimeClock.d.ts +1 -2
- package/TimeClock/TimeClock.js +7 -6
- package/TimeClock/TimeClock.types.d.ts +4 -4
- package/TimeField/TimeField.d.ts +1 -2
- package/TimeField/TimeField.js +6 -6
- package/TimeField/TimeField.types.d.ts +9 -14
- package/TimeField/index.d.ts +1 -1
- package/TimeField/useTimeField.d.ts +1 -2
- package/TimePicker/TimePicker.d.ts +1 -2
- package/TimePicker/TimePicker.js +9 -4
- package/TimePicker/TimePicker.types.d.ts +10 -13
- package/TimePicker/TimePickerToolbar.d.ts +2 -2
- package/TimePicker/TimePickerToolbar.js +12 -2
- package/TimePicker/shared.d.ts +10 -10
- package/YearCalendar/PickersYear.js +17 -13
- package/YearCalendar/YearCalendar.d.ts +1 -2
- package/YearCalendar/YearCalendar.js +17 -14
- package/YearCalendar/YearCalendar.types.d.ts +14 -15
- package/dateViewRenderers/dateViewRenderers.d.ts +3 -3
- package/hooks/index.d.ts +2 -2
- package/hooks/index.js +2 -2
- package/hooks/useClearableField.js +4 -3
- package/hooks/useParsedFormat.d.ts +2 -3
- package/hooks/useParsedFormat.js +2 -2
- package/hooks/usePickerContext.d.ts +4 -0
- package/hooks/usePickerContext.js +15 -0
- package/hooks/usePickerTranslations.d.ts +1 -0
- package/{modern/hooks/usePickersTranslations.js → hooks/usePickerTranslations.js} +1 -1
- package/index.js +1 -1
- package/internals/components/{PickersProvider.d.ts → PickerProvider.d.ts} +15 -8
- package/internals/components/PickerProvider.js +38 -0
- package/internals/hooks/date-helpers-hooks.d.ts +6 -6
- package/internals/hooks/defaultizedFieldProps.d.ts +7 -8
- package/internals/hooks/useClockReferenceDate.d.ts +5 -5
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -17
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +15 -15
- package/internals/hooks/useField/buildSectionsFromFormat.d.ts +5 -5
- package/internals/hooks/useField/useField.d.ts +3 -3
- package/internals/hooks/useField/useField.js +1 -1
- package/internals/hooks/useField/useField.types.d.ts +38 -48
- package/internals/hooks/useField/useField.utils.d.ts +13 -13
- package/internals/hooks/useField/useField.utils.js +2 -1
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +4 -4
- package/internals/hooks/useField/useFieldState.d.ts +4 -4
- package/internals/hooks/useField/useFieldState.js +3 -3
- package/internals/hooks/useField/useFieldV7TextField.js +2 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.js +23 -18
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +12 -12
- package/internals/hooks/usePicker/usePicker.d.ts +2 -2
- package/internals/hooks/usePicker/usePicker.js +12 -4
- package/internals/hooks/usePicker/usePicker.types.d.ts +7 -5
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +2 -3
- package/internals/hooks/usePicker/usePickerOwnerState.d.ts +4 -3
- package/internals/hooks/usePicker/usePickerOwnerState.js +9 -6
- package/internals/hooks/usePicker/usePickerProvider.d.ts +10 -0
- package/internals/hooks/usePicker/usePickerProvider.js +21 -0
- package/internals/hooks/usePicker/usePickerValue.d.ts +2 -2
- package/internals/hooks/usePicker/usePickerValue.js +2 -7
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +32 -34
- package/internals/hooks/usePicker/usePickerViews.d.ts +6 -11
- package/internals/hooks/usePickerPrivateContext.d.ts +4 -0
- package/internals/hooks/usePickerPrivateContext.js +9 -0
- package/internals/hooks/useStaticPicker/useStaticPicker.d.ts +1 -2
- package/internals/hooks/useStaticPicker/useStaticPicker.js +5 -4
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +6 -6
- package/internals/hooks/useUtils.d.ts +7 -7
- package/internals/hooks/useValueWithTimezone.d.ts +5 -5
- package/internals/hooks/useViews.d.ts +3 -3
- package/internals/hooks/useViews.js +1 -1
- package/internals/index.d.ts +6 -4
- package/internals/index.js +2 -1
- package/internals/models/fields.d.ts +32 -7
- package/internals/models/formProps.d.ts +14 -0
- package/internals/models/helpers.d.ts +0 -4
- package/internals/models/index.d.ts +2 -0
- package/internals/models/index.js +3 -1
- package/internals/models/props/basePickerProps.d.ts +5 -6
- package/internals/models/props/{clock.d.ts → time.d.ts} +10 -17
- package/internals/models/props/toolbar.d.ts +2 -3
- package/internals/models/validation.d.ts +21 -25
- package/internals/models/value.d.ts +3 -0
- package/internals/models/value.js +1 -0
- package/internals/utils/date-time-utils.d.ts +7 -7
- package/internals/utils/date-utils.d.ts +16 -16
- package/internals/utils/getDefaultReferenceDate.d.ts +10 -10
- package/internals/utils/time-utils.d.ts +5 -5
- package/internals/utils/valueManagers.d.ts +3 -3
- package/locales/beBY.d.ts +3 -3
- package/locales/beBY.js +3 -3
- package/locales/bgBG.d.ts +3 -3
- package/locales/bgBG.js +3 -3
- package/locales/caES.d.ts +3 -3
- package/locales/caES.js +3 -3
- package/locales/csCZ.d.ts +3 -3
- package/locales/csCZ.js +3 -3
- package/locales/daDK.d.ts +3 -3
- package/locales/daDK.js +3 -3
- package/locales/deDE.d.ts +3 -3
- package/locales/deDE.js +3 -3
- package/locales/elGR.d.ts +3 -3
- package/locales/elGR.js +12 -13
- package/locales/enUS.d.ts +4 -4
- package/locales/enUS.js +3 -3
- package/locales/esES.d.ts +3 -3
- package/locales/esES.js +3 -3
- package/locales/eu.d.ts +3 -3
- package/locales/eu.js +3 -3
- package/locales/faIR.d.ts +3 -3
- package/locales/faIR.js +3 -3
- package/locales/fiFI.d.ts +3 -3
- package/locales/fiFI.js +3 -3
- package/locales/frFR.d.ts +3 -3
- package/locales/frFR.js +3 -3
- package/locales/heIL.d.ts +3 -3
- package/locales/heIL.js +3 -3
- package/locales/hrHR.d.ts +3 -3
- package/locales/hrHR.js +3 -3
- package/locales/huHU.d.ts +3 -3
- package/locales/huHU.js +3 -3
- package/locales/isIS.d.ts +3 -3
- package/locales/isIS.js +3 -3
- package/locales/itIT.d.ts +3 -3
- package/locales/itIT.js +3 -3
- package/locales/jaJP.d.ts +3 -3
- package/locales/jaJP.js +3 -3
- package/locales/koKR.d.ts +3 -3
- package/locales/koKR.js +3 -3
- package/locales/kzKZ.d.ts +3 -3
- package/locales/kzKZ.js +3 -3
- package/locales/mk.d.ts +3 -3
- package/locales/mk.js +3 -3
- package/locales/nbNO.d.ts +3 -3
- package/locales/nbNO.js +3 -3
- package/locales/nlNL.d.ts +3 -3
- package/locales/nlNL.js +3 -3
- package/locales/nnNO.d.ts +3 -3
- package/locales/nnNO.js +3 -3
- package/locales/plPL.d.ts +3 -3
- package/locales/plPL.js +3 -3
- package/locales/ptBR.d.ts +3 -3
- package/locales/ptBR.js +5 -3
- package/locales/ptPT.d.ts +3 -3
- package/locales/ptPT.js +3 -3
- package/locales/roRO.d.ts +3 -3
- package/locales/roRO.js +3 -3
- package/locales/ruRU.d.ts +3 -3
- package/locales/ruRU.js +3 -3
- package/locales/skSK.d.ts +3 -3
- package/locales/skSK.js +3 -3
- package/locales/svSE.d.ts +3 -3
- package/locales/svSE.js +3 -3
- package/locales/trTR.d.ts +3 -3
- package/locales/trTR.js +3 -3
- package/locales/ukUA.d.ts +3 -3
- package/locales/ukUA.js +3 -3
- package/locales/urPK.d.ts +3 -3
- package/locales/urPK.js +3 -3
- package/locales/utils/getPickersLocalization.d.ts +9 -9
- package/locales/utils/getPickersLocalization.js +1 -1
- package/locales/utils/pickersLocaleTextApi.d.ts +12 -36
- package/locales/viVN.d.ts +3 -3
- package/locales/viVN.js +3 -3
- package/locales/zhCN.d.ts +3 -3
- package/locales/zhCN.js +3 -3
- package/locales/zhHK.d.ts +3 -3
- package/locales/zhHK.js +3 -3
- package/models/adapters.d.ts +151 -202
- package/models/fields.d.ts +9 -41
- package/models/pickers.d.ts +10 -6
- package/modern/DateCalendar/DateCalendar.js +20 -22
- package/modern/DateCalendar/DayCalendar.js +13 -10
- package/modern/DateField/DateField.js +8 -10
- package/modern/DatePicker/DatePicker.js +15 -14
- package/modern/DatePicker/DatePickerToolbar.js +12 -2
- package/modern/DateTimeField/DateTimeField.js +9 -12
- package/modern/DateTimePicker/DateTimePicker.js +16 -16
- package/modern/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/modern/DateTimePicker/DateTimePickerToolbar.js +12 -2
- package/modern/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -0
- package/modern/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/modern/DigitalClock/DigitalClock.js +7 -6
- package/modern/MobileDatePicker/MobileDatePicker.js +17 -16
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/modern/MobileTimePicker/MobileTimePicker.js +11 -6
- package/modern/MonthCalendar/MonthCalendar.js +17 -14
- package/modern/MonthCalendar/PickersMonth.js +17 -13
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -6
- package/modern/PickersActionBar/PickersActionBar.js +2 -2
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/modern/PickersLayout/PickersLayout.js +10 -0
- package/modern/PickersLayout/usePickerLayout.js +17 -18
- package/modern/StaticDatePicker/StaticDatePicker.js +14 -13
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
- package/modern/StaticTimePicker/StaticTimePicker.js +8 -3
- package/modern/TimeClock/Clock.js +3 -3
- package/modern/TimeClock/TimeClock.js +7 -6
- package/modern/TimeField/TimeField.js +6 -6
- package/modern/TimePicker/TimePicker.js +9 -4
- package/modern/TimePicker/TimePickerToolbar.js +12 -2
- package/modern/YearCalendar/PickersYear.js +17 -13
- package/modern/YearCalendar/YearCalendar.js +17 -14
- package/modern/hooks/index.js +2 -2
- package/modern/hooks/useClearableField.js +4 -3
- package/modern/hooks/useParsedFormat.js +2 -2
- package/modern/hooks/usePickerContext.js +15 -0
- package/{hooks/usePickersTranslations.js → modern/hooks/usePickerTranslations.js} +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerProvider.js +38 -0
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -17
- package/modern/internals/hooks/useField/useField.js +1 -1
- package/modern/internals/hooks/useField/useField.utils.js +2 -1
- package/modern/internals/hooks/useField/useFieldState.js +3 -3
- package/modern/internals/hooks/useField/useFieldV7TextField.js +2 -2
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +23 -18
- package/modern/internals/hooks/usePicker/usePicker.js +12 -4
- package/modern/internals/hooks/usePicker/usePickerOwnerState.js +9 -6
- package/modern/internals/hooks/usePicker/usePickerProvider.js +21 -0
- package/modern/internals/hooks/usePicker/usePickerValue.js +2 -7
- package/modern/internals/hooks/usePickerPrivateContext.js +9 -0
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +5 -4
- package/modern/internals/hooks/useViews.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/internals/models/formProps.js +1 -0
- package/modern/internals/models/index.js +3 -1
- package/modern/internals/models/props/time.js +1 -0
- package/modern/internals/models/value.js +1 -0
- package/modern/locales/beBY.js +3 -3
- package/modern/locales/bgBG.js +3 -3
- package/modern/locales/caES.js +3 -3
- package/modern/locales/csCZ.js +3 -3
- package/modern/locales/daDK.js +3 -3
- package/modern/locales/deDE.js +3 -3
- package/modern/locales/elGR.js +12 -13
- package/modern/locales/enUS.js +3 -3
- package/modern/locales/esES.js +3 -3
- package/modern/locales/eu.js +3 -3
- package/modern/locales/faIR.js +3 -3
- package/modern/locales/fiFI.js +3 -3
- package/modern/locales/frFR.js +3 -3
- package/modern/locales/heIL.js +3 -3
- package/modern/locales/hrHR.js +3 -3
- package/modern/locales/huHU.js +3 -3
- package/modern/locales/isIS.js +3 -3
- package/modern/locales/itIT.js +3 -3
- package/modern/locales/jaJP.js +3 -3
- package/modern/locales/koKR.js +3 -3
- package/modern/locales/kzKZ.js +3 -3
- package/modern/locales/mk.js +3 -3
- package/modern/locales/nbNO.js +3 -3
- package/modern/locales/nlNL.js +3 -3
- package/modern/locales/nnNO.js +3 -3
- package/modern/locales/plPL.js +3 -3
- package/modern/locales/ptBR.js +5 -3
- package/modern/locales/ptPT.js +3 -3
- package/modern/locales/roRO.js +3 -3
- package/modern/locales/ruRU.js +3 -3
- package/modern/locales/skSK.js +3 -3
- package/modern/locales/svSE.js +3 -3
- package/modern/locales/trTR.js +3 -3
- package/modern/locales/ukUA.js +3 -3
- package/modern/locales/urPK.js +3 -3
- package/modern/locales/utils/getPickersLocalization.js +1 -1
- package/modern/locales/viVN.js +3 -3
- package/modern/locales/zhCN.js +3 -3
- package/modern/locales/zhHK.js +3 -3
- package/modern/validation/useValidation.js +2 -3
- package/modern/validation/validateDate.js +5 -0
- package/modern/validation/validateDateTime.js +5 -0
- package/modern/validation/validateTime.js +5 -0
- package/node/DateCalendar/DateCalendar.js +20 -22
- package/node/DateCalendar/DayCalendar.js +13 -10
- package/node/DateField/DateField.js +8 -10
- package/node/DatePicker/DatePicker.js +15 -14
- package/node/DatePicker/DatePickerToolbar.js +12 -2
- package/node/DateTimeField/DateTimeField.js +9 -12
- package/node/DateTimePicker/DateTimePicker.js +16 -16
- package/node/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/node/DateTimePicker/DateTimePickerToolbar.js +12 -2
- package/node/DesktopDatePicker/DesktopDatePicker.js +17 -16
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -0
- package/node/DesktopTimePicker/DesktopTimePicker.js +11 -6
- package/node/DigitalClock/DigitalClock.js +7 -6
- package/node/MobileDatePicker/MobileDatePicker.js +17 -16
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/node/MobileTimePicker/MobileTimePicker.js +11 -6
- package/node/MonthCalendar/MonthCalendar.js +17 -14
- package/node/MonthCalendar/PickersMonth.js +17 -13
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -6
- package/node/PickersActionBar/PickersActionBar.js +2 -2
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
- package/node/PickersLayout/PickersLayout.js +10 -0
- package/node/PickersLayout/usePickerLayout.js +17 -18
- package/node/StaticDatePicker/StaticDatePicker.js +14 -13
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
- package/node/StaticTimePicker/StaticTimePicker.js +8 -3
- package/node/TimeClock/Clock.js +3 -3
- package/node/TimeClock/TimeClock.js +7 -6
- package/node/TimeField/TimeField.js +6 -6
- package/node/TimePicker/TimePicker.js +9 -4
- package/node/TimePicker/TimePickerToolbar.js +12 -2
- package/node/YearCalendar/PickersYear.js +17 -13
- package/node/YearCalendar/YearCalendar.js +17 -14
- package/node/hooks/index.js +6 -6
- package/node/hooks/useClearableField.js +4 -3
- package/node/hooks/useParsedFormat.js +2 -2
- package/node/hooks/usePickerContext.js +21 -0
- package/node/hooks/usePickerTranslations.js +10 -0
- package/node/index.js +1 -1
- package/node/internals/components/PickerProvider.js +46 -0
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -17
- package/node/internals/hooks/useField/useField.js +1 -1
- package/node/internals/hooks/useField/useField.utils.js +2 -1
- package/node/internals/hooks/useField/useFieldState.js +3 -3
- package/node/internals/hooks/useField/useFieldV7TextField.js +2 -2
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +23 -18
- package/node/internals/hooks/usePicker/usePicker.js +12 -4
- package/node/internals/hooks/usePicker/usePickerOwnerState.js +9 -6
- package/node/internals/hooks/usePicker/usePickerProvider.js +28 -0
- package/node/internals/hooks/usePicker/usePickerValue.js +1 -7
- package/node/internals/hooks/usePickerPrivateContext.js +15 -0
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +5 -4
- package/node/internals/hooks/useViews.js +3 -3
- package/node/internals/index.js +14 -7
- package/node/internals/models/index.js +22 -0
- package/node/internals/models/props/time.js +5 -0
- package/node/internals/models/value.js +5 -0
- package/node/locales/beBY.js +3 -3
- package/node/locales/bgBG.js +3 -3
- package/node/locales/caES.js +3 -3
- package/node/locales/csCZ.js +3 -3
- package/node/locales/daDK.js +3 -3
- package/node/locales/deDE.js +3 -3
- package/node/locales/elGR.js +12 -13
- package/node/locales/enUS.js +3 -3
- package/node/locales/esES.js +3 -3
- package/node/locales/eu.js +3 -3
- package/node/locales/faIR.js +3 -3
- package/node/locales/fiFI.js +3 -3
- package/node/locales/frFR.js +3 -3
- package/node/locales/heIL.js +3 -3
- package/node/locales/hrHR.js +3 -3
- package/node/locales/huHU.js +3 -3
- package/node/locales/isIS.js +3 -3
- package/node/locales/itIT.js +3 -3
- package/node/locales/jaJP.js +3 -3
- package/node/locales/koKR.js +3 -3
- package/node/locales/kzKZ.js +3 -3
- package/node/locales/mk.js +3 -3
- package/node/locales/nbNO.js +3 -3
- package/node/locales/nlNL.js +3 -3
- package/node/locales/nnNO.js +3 -3
- package/node/locales/plPL.js +3 -3
- package/node/locales/ptBR.js +5 -3
- package/node/locales/ptPT.js +3 -3
- package/node/locales/roRO.js +3 -3
- package/node/locales/ruRU.js +3 -3
- package/node/locales/skSK.js +3 -3
- package/node/locales/svSE.js +3 -3
- package/node/locales/trTR.js +3 -3
- package/node/locales/ukUA.js +3 -3
- package/node/locales/urPK.js +3 -3
- package/node/locales/utils/getPickersLocalization.js +1 -1
- package/node/locales/viVN.js +3 -3
- package/node/locales/zhCN.js +3 -3
- package/node/locales/zhHK.js +3 -3
- package/node/validation/useValidation.js +2 -3
- package/node/validation/validateDate.js +4 -0
- package/node/validation/validateDateTime.js +4 -0
- package/node/validation/validateTime.js +4 -0
- package/package.json +4 -4
- package/themeAugmentation/props.d.ts +28 -28
- package/timeViewRenderers/timeViewRenderers.d.ts +6 -6
- package/validation/extractValidationProps.d.ts +4 -4
- package/validation/useValidation.d.ts +9 -10
- package/validation/useValidation.js +2 -3
- package/validation/validateDate.d.ts +7 -2
- package/validation/validateDate.js +5 -0
- package/validation/validateDateTime.d.ts +10 -4
- package/validation/validateDateTime.js +5 -0
- package/validation/validateTime.d.ts +7 -2
- package/validation/validateTime.js +5 -0
- package/hooks/usePickersContext.d.ts +0 -4
- package/hooks/usePickersContext.js +0 -15
- package/hooks/usePickersTranslations.d.ts +0 -2
- package/internals/components/PickersProvider.js +0 -26
- package/modern/hooks/usePickersContext.js +0 -15
- package/modern/internals/components/PickersProvider.js +0 -26
- package/node/hooks/usePickersContext.js +0 -21
- package/node/hooks/usePickersTranslations.js +0 -10
- package/node/internals/components/PickersProvider.js +0 -34
- /package/internals/models/{props/clock.js → formProps.js} +0 -0
- /package/{modern/internals/models/props/clock.js → internals/models/props/time.js} +0 -0
- /package/node/internals/models/{props/clock.js → formProps.js} +0 -0
|
@@ -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,14 +56,15 @@ 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
|
wrapperVariant: 'desktop'
|
|
@@ -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
|
};
|
|
@@ -571,7 +571,8 @@ export const parseSelectedSections = (selectedSections, sections) => {
|
|
|
571
571
|
return 'all';
|
|
572
572
|
}
|
|
573
573
|
if (typeof selectedSections === 'string') {
|
|
574
|
-
|
|
574
|
+
const index = sections.findIndex(section => section.type === selectedSections);
|
|
575
|
+
return index === -1 ? null : index;
|
|
575
576
|
}
|
|
576
577
|
return selectedSections;
|
|
577
578
|
};
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import useControlled from '@mui/utils/useControlled';
|
|
4
4
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
5
|
-
import {
|
|
5
|
+
import { usePickerTranslations } from "../../../hooks/usePickerTranslations.js";
|
|
6
6
|
import { useUtils, useLocalizationContext } from "../useUtils.js";
|
|
7
7
|
import { mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections, parseSelectedSections, getLocalizedDigits } from "./useField.utils.js";
|
|
8
8
|
import { buildSectionsFromFormat } from "./buildSectionsFromFormat.js";
|
|
@@ -10,7 +10,7 @@ import { useValueWithTimezone } from "../useValueWithTimezone.js";
|
|
|
10
10
|
import { getSectionTypeGranularity } from "../../utils/getDefaultReferenceDate.js";
|
|
11
11
|
export const useFieldState = params => {
|
|
12
12
|
const utils = useUtils();
|
|
13
|
-
const translations =
|
|
13
|
+
const translations = usePickerTranslations();
|
|
14
14
|
const adapter = useLocalizationContext();
|
|
15
15
|
const isRtl = useRtl();
|
|
16
16
|
const {
|
|
@@ -30,7 +30,7 @@ export const useFieldState = params => {
|
|
|
30
30
|
onSelectedSectionsChange,
|
|
31
31
|
shouldRespectLeadingZeros = false,
|
|
32
32
|
timezone: timezoneProp,
|
|
33
|
-
enableAccessibleFieldDOMStructure =
|
|
33
|
+
enableAccessibleFieldDOMStructure = true
|
|
34
34
|
}
|
|
35
35
|
} = params;
|
|
36
36
|
const {
|
|
@@ -5,7 +5,7 @@ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
|
5
5
|
import useId from '@mui/utils/useId';
|
|
6
6
|
import { getSectionValueNow, getSectionValueText, parseSelectedSections } from "./useField.utils.js";
|
|
7
7
|
import { getActiveElement } from "../../utils/utils.js";
|
|
8
|
-
import {
|
|
8
|
+
import { usePickerTranslations } from "../../../hooks/usePickerTranslations.js";
|
|
9
9
|
import { useUtils } from "../useUtils.js";
|
|
10
10
|
export const useFieldV7TextField = params => {
|
|
11
11
|
const {
|
|
@@ -39,7 +39,7 @@ export const useFieldV7TextField = params => {
|
|
|
39
39
|
} = params;
|
|
40
40
|
const sectionListRef = React.useRef(null);
|
|
41
41
|
const handleSectionListRef = useForkRef(inSectionListRef, sectionListRef);
|
|
42
|
-
const translations =
|
|
42
|
+
const translations = usePickerTranslations();
|
|
43
43
|
const utils = useUtils();
|
|
44
44
|
const id = useId();
|
|
45
45
|
const [focused, setFocused] = React.useState(false);
|
|
@@ -9,7 +9,7 @@ import { PickersModalDialog } from "../../components/PickersModalDialog.js";
|
|
|
9
9
|
import { usePicker } from "../usePicker/index.js";
|
|
10
10
|
import { onSpaceOrEnter } from "../../utils/utils.js";
|
|
11
11
|
import { PickersLayout } from "../../../PickersLayout/index.js";
|
|
12
|
-
import {
|
|
12
|
+
import { PickerProvider } from "../../components/PickerProvider.js";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Hook managing all the single-date mobile pickers:
|
|
@@ -49,12 +49,14 @@ export const useMobilePicker = _ref => {
|
|
|
49
49
|
open,
|
|
50
50
|
actions,
|
|
51
51
|
layoutProps,
|
|
52
|
+
providerProps,
|
|
52
53
|
renderCurrentView,
|
|
53
54
|
fieldProps: pickerFieldProps,
|
|
54
|
-
|
|
55
|
+
ownerState
|
|
55
56
|
} = usePicker(_extends({}, pickerParams, {
|
|
56
57
|
props,
|
|
57
58
|
fieldRef,
|
|
59
|
+
localeText,
|
|
58
60
|
autoFocusView: true,
|
|
59
61
|
additionalViewProps: {},
|
|
60
62
|
wrapperVariant: 'mobile'
|
|
@@ -63,28 +65,33 @@ export const useMobilePicker = _ref => {
|
|
|
63
65
|
const fieldProps = useSlotProps({
|
|
64
66
|
elementType: Field,
|
|
65
67
|
externalSlotProps: innerSlotProps?.field,
|
|
66
|
-
additionalProps: _extends({
|
|
67
|
-
|
|
68
|
-
}, !(disabled || readOnly) && {
|
|
69
|
-
onClick: actions.onOpen,
|
|
70
|
-
onKeyDown: onSpaceOrEnter(actions.onOpen)
|
|
71
|
-
}, {
|
|
68
|
+
additionalProps: _extends({
|
|
69
|
+
// Internal props
|
|
72
70
|
readOnly: readOnly ?? true,
|
|
73
71
|
disabled,
|
|
74
|
-
className,
|
|
75
|
-
sx,
|
|
76
72
|
format,
|
|
77
73
|
formatDensity,
|
|
78
74
|
enableAccessibleFieldDOMStructure,
|
|
79
75
|
selectedSections,
|
|
80
76
|
onSelectedSectionsChange,
|
|
81
|
-
timezone
|
|
77
|
+
timezone
|
|
78
|
+
}, pickerFieldProps, {
|
|
79
|
+
// onChange and value
|
|
80
|
+
|
|
81
|
+
// Forwarded props
|
|
82
|
+
className,
|
|
83
|
+
sx,
|
|
82
84
|
label,
|
|
83
85
|
name
|
|
84
|
-
},
|
|
86
|
+
}, isToolbarHidden && {
|
|
87
|
+
id: labelId
|
|
88
|
+
}, !(disabled || readOnly) && {
|
|
89
|
+
onClick: actions.onOpen,
|
|
90
|
+
onKeyDown: onSpaceOrEnter(actions.onOpen)
|
|
91
|
+
}, !!inputRef && {
|
|
85
92
|
inputRef
|
|
86
|
-
}
|
|
87
|
-
ownerState
|
|
93
|
+
}),
|
|
94
|
+
ownerState
|
|
88
95
|
});
|
|
89
96
|
|
|
90
97
|
// TODO: Move to `useSlotProps` when https://github.com/mui/material-ui/pull/35088 will be merged
|
|
@@ -112,9 +119,7 @@ export const useMobilePicker = _ref => {
|
|
|
112
119
|
}, innerSlotProps?.mobilePaper)
|
|
113
120
|
});
|
|
114
121
|
const handleFieldRef = useForkRef(fieldRef, fieldProps.unstableFieldRef);
|
|
115
|
-
const renderPicker = () => /*#__PURE__*/_jsxs(
|
|
116
|
-
contextValue: contextValue,
|
|
117
|
-
localeText: localeText,
|
|
122
|
+
const renderPicker = () => /*#__PURE__*/_jsxs(PickerProvider, _extends({}, providerProps, {
|
|
118
123
|
children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps, {
|
|
119
124
|
slots: slotsForField,
|
|
120
125
|
slotProps: slotProps,
|
|
@@ -129,7 +134,7 @@ export const useMobilePicker = _ref => {
|
|
|
129
134
|
children: renderCurrentView()
|
|
130
135
|
}))
|
|
131
136
|
}))]
|
|
132
|
-
});
|
|
137
|
+
}));
|
|
133
138
|
return {
|
|
134
139
|
renderPicker
|
|
135
140
|
};
|
|
@@ -3,6 +3,7 @@ import { usePickerValue } from "./usePickerValue.js";
|
|
|
3
3
|
import { usePickerViews } from "./usePickerViews.js";
|
|
4
4
|
import { usePickerLayoutProps } from "./usePickerLayoutProps.js";
|
|
5
5
|
import { usePickerOwnerState } from "./usePickerOwnerState.js";
|
|
6
|
+
import { usePickerProvider } from "./usePickerProvider.js";
|
|
6
7
|
export const usePicker = ({
|
|
7
8
|
props,
|
|
8
9
|
valueManager,
|
|
@@ -12,7 +13,8 @@ export const usePicker = ({
|
|
|
12
13
|
validator,
|
|
13
14
|
autoFocusView,
|
|
14
15
|
rendererInterceptor,
|
|
15
|
-
fieldRef
|
|
16
|
+
fieldRef,
|
|
17
|
+
localeText
|
|
16
18
|
}) => {
|
|
17
19
|
if (process.env.NODE_ENV !== 'production') {
|
|
18
20
|
if (props.renderInput != null) {
|
|
@@ -42,7 +44,13 @@ export const usePicker = ({
|
|
|
42
44
|
});
|
|
43
45
|
const pickerOwnerState = usePickerOwnerState({
|
|
44
46
|
props,
|
|
45
|
-
pickerValueResponse
|
|
47
|
+
pickerValueResponse,
|
|
48
|
+
valueManager
|
|
49
|
+
});
|
|
50
|
+
const providerProps = usePickerProvider({
|
|
51
|
+
pickerValueResponse,
|
|
52
|
+
ownerState: pickerOwnerState,
|
|
53
|
+
localeText
|
|
46
54
|
});
|
|
47
55
|
return {
|
|
48
56
|
// Picker value
|
|
@@ -55,8 +63,8 @@ export const usePicker = ({
|
|
|
55
63
|
shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
|
|
56
64
|
// Picker layout
|
|
57
65
|
layoutProps: pickerLayoutResponse.layoutProps,
|
|
58
|
-
// Picker
|
|
59
|
-
|
|
66
|
+
// Picker provider
|
|
67
|
+
providerProps,
|
|
60
68
|
// Picker owner state
|
|
61
69
|
ownerState: pickerOwnerState
|
|
62
70
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useUtils } from "../useUtils.js";
|
|
2
3
|
export function usePickerOwnerState(parameters) {
|
|
3
4
|
const {
|
|
4
5
|
props,
|
|
5
|
-
pickerValueResponse
|
|
6
|
+
pickerValueResponse,
|
|
7
|
+
valueManager
|
|
6
8
|
} = parameters;
|
|
9
|
+
const utils = useUtils();
|
|
7
10
|
return React.useMemo(() => ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}), [pickerValueResponse.viewProps.value, pickerValueResponse.open, props.disabled, props.readOnly]);
|
|
11
|
+
isPickerValueEmpty: valueManager.areValuesEqual(utils, pickerValueResponse.viewProps.value, valueManager.emptyValue),
|
|
12
|
+
isPickerOpen: pickerValueResponse.open,
|
|
13
|
+
isPickerDisabled: props.disabled ?? false,
|
|
14
|
+
isPickerReadOnly: props.readOnly ?? false
|
|
15
|
+
}), [utils, valueManager, pickerValueResponse.viewProps.value, pickerValueResponse.open, props.disabled, props.readOnly]);
|
|
13
16
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export function usePickerProvider(parameters) {
|
|
3
|
+
const {
|
|
4
|
+
pickerValueResponse,
|
|
5
|
+
ownerState,
|
|
6
|
+
localeText
|
|
7
|
+
} = parameters;
|
|
8
|
+
const contextValue = React.useMemo(() => ({
|
|
9
|
+
onOpen: pickerValueResponse.actions.onOpen,
|
|
10
|
+
onClose: pickerValueResponse.actions.onClose,
|
|
11
|
+
open: pickerValueResponse.open
|
|
12
|
+
}), [pickerValueResponse.actions.onOpen, pickerValueResponse.actions.onClose, pickerValueResponse.open]);
|
|
13
|
+
const privateContextValue = React.useMemo(() => ({
|
|
14
|
+
ownerState
|
|
15
|
+
}), [ownerState]);
|
|
16
|
+
return {
|
|
17
|
+
localeText,
|
|
18
|
+
contextValue,
|
|
19
|
+
privateContextValue
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -5,6 +5,7 @@ import { useOpenState } from "../useOpenState.js";
|
|
|
5
5
|
import { useLocalizationContext, useUtils } from "../useUtils.js";
|
|
6
6
|
import { useValidation } from "../../../validation/index.js";
|
|
7
7
|
import { useValueWithTimezone } from "../useValueWithTimezone.js";
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* Decide if the new value should be published
|
|
10
11
|
* The published value will be passed to `onChange` if defined.
|
|
@@ -333,17 +334,11 @@ export const usePickerValue = ({
|
|
|
333
334
|
onSelectShortcut: handleSelectShortcut,
|
|
334
335
|
isValid
|
|
335
336
|
});
|
|
336
|
-
const contextValue = React.useMemo(() => ({
|
|
337
|
-
onOpen: handleOpen,
|
|
338
|
-
onClose: handleClose,
|
|
339
|
-
open: isOpen
|
|
340
|
-
}), [isOpen, handleClose, handleOpen]);
|
|
341
337
|
return {
|
|
342
338
|
open: isOpen,
|
|
343
339
|
fieldProps: fieldResponse,
|
|
344
340
|
viewProps: viewResponse,
|
|
345
341
|
layoutProps: layoutResponse,
|
|
346
|
-
actions
|
|
347
|
-
contextValue
|
|
342
|
+
actions
|
|
348
343
|
};
|
|
349
344
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { PickerPrivateContext } from "../components/PickerProvider.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the private context passed by the picker that wraps the current component.
|
|
8
|
+
*/
|
|
9
|
+
export const usePickerPrivateContext = () => React.useContext(PickerPrivateContext);
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
7
7
|
import { usePicker } from "../usePicker/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { PickerProvider } from "../../components/PickerProvider.js";
|
|
9
9
|
import { PickersLayout } from "../../../PickersLayout/index.js";
|
|
10
10
|
import { DIALOG_WIDTH } from "../../constants/dimensions.js";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -40,17 +40,18 @@ export const useStaticPicker = _ref => {
|
|
|
40
40
|
} = props;
|
|
41
41
|
const {
|
|
42
42
|
layoutProps,
|
|
43
|
+
providerProps,
|
|
43
44
|
renderCurrentView
|
|
44
45
|
} = usePicker(_extends({}, pickerParams, {
|
|
45
46
|
props,
|
|
46
47
|
autoFocusView: autoFocus ?? false,
|
|
47
48
|
fieldRef: undefined,
|
|
49
|
+
localeText,
|
|
48
50
|
additionalViewProps: {},
|
|
49
51
|
wrapperVariant: displayStaticWrapperAs
|
|
50
52
|
}));
|
|
51
53
|
const Layout = slots?.layout ?? PickerStaticLayout;
|
|
52
|
-
const renderPicker = () => /*#__PURE__*/_jsx(
|
|
53
|
-
localeText: localeText,
|
|
54
|
+
const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
|
|
54
55
|
children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
|
|
55
56
|
slots: slots,
|
|
56
57
|
slotProps: slotProps,
|
|
@@ -59,7 +60,7 @@ export const useStaticPicker = _ref => {
|
|
|
59
60
|
ref: ref,
|
|
60
61
|
children: renderCurrentView()
|
|
61
62
|
}))
|
|
62
|
-
});
|
|
63
|
+
}));
|
|
63
64
|
return {
|
|
64
65
|
renderPicker
|
|
65
66
|
};
|
|
@@ -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,
|
|
@@ -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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/modern/locales/beBY.js
CHANGED
|
@@ -33,7 +33,7 @@ const beBYPickers = {
|
|
|
33
33
|
timePickerToolbarTitle: 'Абраць час',
|
|
34
34
|
dateRangePickerToolbarTitle: 'Абраць каляндарны перыяд',
|
|
35
35
|
// Clock labels
|
|
36
|
-
clockLabelText: (view,
|
|
36
|
+
clockLabelText: (view, formattedTime) => `Абярыце ${views[view]}. ${!formattedTime ? 'Час не абраны' : `Абраны час ${formattedTime}`}`,
|
|
37
37
|
hoursClockNumberText: hours => `${hours} гадзін`,
|
|
38
38
|
minutesClockNumberText: minutes => `${minutes} хвілін`,
|
|
39
39
|
secondsClockNumberText: seconds => `${seconds} секунд`,
|
|
@@ -45,8 +45,8 @@ const beBYPickers = {
|
|
|
45
45
|
calendarWeekNumberAriaLabelText: weekNumber => `Тыдзень ${weekNumber}`,
|
|
46
46
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
47
47
|
// Open picker labels
|
|
48
|
-
openDatePickerDialogue:
|
|
49
|
-
openTimePickerDialogue:
|
|
48
|
+
openDatePickerDialogue: formattedDate => formattedDate ? `Абраць дату, абрана дата ${formattedDate}` : 'Абраць дату',
|
|
49
|
+
openTimePickerDialogue: formattedTime => formattedTime ? `Абраць час, абрыны час ${formattedTime}` : 'Абраць час',
|
|
50
50
|
// fieldClearLabel: 'Clear',
|
|
51
51
|
|
|
52
52
|
// Table labels
|
package/modern/locales/bgBG.js
CHANGED
|
@@ -31,7 +31,7 @@ const bgBGPickers = {
|
|
|
31
31
|
timePickerToolbarTitle: 'Избери час',
|
|
32
32
|
dateRangePickerToolbarTitle: 'Избери времеви период',
|
|
33
33
|
// Clock labels
|
|
34
|
-
clockLabelText: (view,
|
|
34
|
+
clockLabelText: (view, formattedTime) => `Избери ${views[view]}. ${!formattedTime ? 'Не е избран час' : `Избраният час е ${formattedTime}`}`,
|
|
35
35
|
hoursClockNumberText: hours => `${hours} часа`,
|
|
36
36
|
minutesClockNumberText: minutes => `${minutes} минути`,
|
|
37
37
|
secondsClockNumberText: seconds => `${seconds} секунди`,
|
|
@@ -43,8 +43,8 @@ const bgBGPickers = {
|
|
|
43
43
|
calendarWeekNumberAriaLabelText: weekNumber => `Седмица ${weekNumber}`,
|
|
44
44
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
45
45
|
// Open picker labels
|
|
46
|
-
openDatePickerDialogue:
|
|
47
|
-
openTimePickerDialogue:
|
|
46
|
+
openDatePickerDialogue: formattedDate => formattedDate ? `Избери дата, избраната дата е ${formattedDate}` : 'Избери дата',
|
|
47
|
+
openTimePickerDialogue: formattedTime => formattedTime ? `Избери час, избраният час е ${formattedTime}` : 'Избери час',
|
|
48
48
|
fieldClearLabel: 'Изчисти стойност',
|
|
49
49
|
// Table labels
|
|
50
50
|
timeTableLabel: 'избери час',
|
package/modern/locales/caES.js
CHANGED
|
@@ -31,7 +31,7 @@ const caESPickers = {
|
|
|
31
31
|
timePickerToolbarTitle: 'Seleccionar hora',
|
|
32
32
|
dateRangePickerToolbarTitle: 'Seleccionar rang de dates',
|
|
33
33
|
// Clock labels
|
|
34
|
-
clockLabelText: (view,
|
|
34
|
+
clockLabelText: (view, formattedTime) => `Selecciona ${views[view]}. ${!formattedTime ? 'Hora no seleccionada' : `L'hora seleccionada és ${formattedTime}`}`,
|
|
35
35
|
hoursClockNumberText: hours => `${hours} hores`,
|
|
36
36
|
minutesClockNumberText: minutes => `${minutes} minuts`,
|
|
37
37
|
secondsClockNumberText: seconds => `${seconds} segons`,
|
|
@@ -43,8 +43,8 @@ const caESPickers = {
|
|
|
43
43
|
calendarWeekNumberAriaLabelText: weekNumber => `Setmana ${weekNumber}`,
|
|
44
44
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
45
45
|
// Open picker labels
|
|
46
|
-
openDatePickerDialogue:
|
|
47
|
-
openTimePickerDialogue:
|
|
46
|
+
openDatePickerDialogue: formattedDate => formattedDate ? `Tria la data, la data triada és ${formattedDate}` : 'Tria la data',
|
|
47
|
+
openTimePickerDialogue: formattedTime => formattedTime ? `Tria l'hora, l'hora triada és ${formattedTime}` : "Tria l'hora",
|
|
48
48
|
fieldClearLabel: 'Netega el valor',
|
|
49
49
|
// Table labels
|
|
50
50
|
timeTableLabel: 'tria la data',
|
package/modern/locales/csCZ.js
CHANGED
|
@@ -32,7 +32,7 @@ const csCZPickers = {
|
|
|
32
32
|
timePickerToolbarTitle: 'Vyberte čas',
|
|
33
33
|
dateRangePickerToolbarTitle: 'Vyberete rozmezí dat',
|
|
34
34
|
// Clock labels
|
|
35
|
-
clockLabelText: (view,
|
|
35
|
+
clockLabelText: (view, formattedTime) => `${timeViews[view] ?? view} vybrány. ${!formattedTime ? 'Není vybrán čas' : `Vybraný čas je ${formattedTime}`}`,
|
|
36
36
|
hoursClockNumberText: hours => `${hours} hodin`,
|
|
37
37
|
minutesClockNumberText: minutes => `${minutes} minut`,
|
|
38
38
|
secondsClockNumberText: seconds => `${seconds} sekund`,
|
|
@@ -44,8 +44,8 @@ const csCZPickers = {
|
|
|
44
44
|
calendarWeekNumberAriaLabelText: weekNumber => `${weekNumber} týden v roce`,
|
|
45
45
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
46
46
|
// Open picker labels
|
|
47
|
-
openDatePickerDialogue:
|
|
48
|
-
openTimePickerDialogue:
|
|
47
|
+
openDatePickerDialogue: formattedDate => formattedDate ? `Vyberte datum, vybrané datum je ${formattedDate}` : 'Vyberte datum',
|
|
48
|
+
openTimePickerDialogue: formattedTime => formattedTime ? `Vyberte čas, vybraný čas je ${formattedTime}` : 'Vyberte čas',
|
|
49
49
|
fieldClearLabel: 'Vymazat',
|
|
50
50
|
// Table labels
|
|
51
51
|
timeTableLabel: 'vyberte čas',
|
package/modern/locales/daDK.js
CHANGED
|
@@ -32,7 +32,7 @@ const daDKPickers = {
|
|
|
32
32
|
timePickerToolbarTitle: 'Vælg tidspunkt',
|
|
33
33
|
dateRangePickerToolbarTitle: 'Vælg datointerval',
|
|
34
34
|
// Clock labels
|
|
35
|
-
clockLabelText: (view,
|
|
35
|
+
clockLabelText: (view, formattedTime) => `Vælg ${timeViews[view] ?? view}. ${!formattedTime ? 'Intet tidspunkt valgt' : `Valgte tidspunkt er ${formattedTime}`}`,
|
|
36
36
|
hoursClockNumberText: hours => `${hours} timer`,
|
|
37
37
|
minutesClockNumberText: minutes => `${minutes} minutter`,
|
|
38
38
|
secondsClockNumberText: seconds => `${seconds} sekunder`,
|
|
@@ -44,8 +44,8 @@ const daDKPickers = {
|
|
|
44
44
|
calendarWeekNumberAriaLabelText: weekNumber => `Uge ${weekNumber}`,
|
|
45
45
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
46
46
|
// Open picker labels
|
|
47
|
-
openDatePickerDialogue:
|
|
48
|
-
openTimePickerDialogue:
|
|
47
|
+
openDatePickerDialogue: formattedDate => formattedDate ? `Vælg dato, valgte dato er ${formattedDate}` : 'Vælg dato',
|
|
48
|
+
openTimePickerDialogue: formattedTime => formattedTime ? `Vælg tidspunkt, valgte tidspunkt er ${formattedTime}` : 'Vælg tidspunkt',
|
|
49
49
|
fieldClearLabel: 'ryd felt',
|
|
50
50
|
// Table labels
|
|
51
51
|
timeTableLabel: 'vælg tidspunkt',
|
package/modern/locales/deDE.js
CHANGED
|
@@ -32,7 +32,7 @@ const deDEPickers = {
|
|
|
32
32
|
timePickerToolbarTitle: 'Uhrzeit auswählen',
|
|
33
33
|
dateRangePickerToolbarTitle: 'Datumsbereich auswählen',
|
|
34
34
|
// Clock labels
|
|
35
|
-
clockLabelText: (view,
|
|
35
|
+
clockLabelText: (view, formattedTime) => `${timeViews[view] ?? view} auswählen. ${!formattedTime ? 'Keine Uhrzeit ausgewählt' : `Gewählte Uhrzeit ist ${formattedTime}`}`,
|
|
36
36
|
hoursClockNumberText: hours => `${hours} ${timeViews.hours}`,
|
|
37
37
|
minutesClockNumberText: minutes => `${minutes} ${timeViews.minutes}`,
|
|
38
38
|
secondsClockNumberText: seconds => `${seconds} ${timeViews.seconds}`,
|
|
@@ -44,8 +44,8 @@ const deDEPickers = {
|
|
|
44
44
|
calendarWeekNumberAriaLabelText: weekNumber => `Woche ${weekNumber}`,
|
|
45
45
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
46
46
|
// Open picker labels
|
|
47
|
-
openDatePickerDialogue:
|
|
48
|
-
openTimePickerDialogue:
|
|
47
|
+
openDatePickerDialogue: formattedDate => formattedDate ? `Datum auswählen, gewähltes Datum ist ${formattedDate}` : 'Datum auswählen',
|
|
48
|
+
openTimePickerDialogue: formattedTime => formattedTime ? `Uhrzeit auswählen, gewählte Uhrzeit ist ${formattedTime}` : 'Uhrzeit auswählen',
|
|
49
49
|
fieldClearLabel: 'Wert leeren',
|
|
50
50
|
// Table labels
|
|
51
51
|
timeTableLabel: 'Uhrzeit auswählen',
|