@mui/x-date-pickers 8.0.0-beta.1 → 8.0.0-beta.3
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/CHANGELOG.md +235 -0
- package/DateCalendar/DateCalendar.js +4 -8
- package/DateCalendar/DayCalendar.js +2 -2
- package/DateField/DateField.js +4 -4
- package/DatePicker/shared.js +3 -9
- package/DateTimeField/DateTimeField.js +4 -4
- package/DateTimePicker/shared.js +3 -13
- package/DesktopDatePicker/DesktopDatePicker.js +2 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -1
- package/DesktopTimePicker/DesktopTimePicker.js +2 -1
- package/DigitalClock/DigitalClock.js +1 -0
- package/LocalizationProvider/LocalizationProvider.d.ts +1 -1
- package/LocalizationProvider/LocalizationProvider.js +2 -2
- package/MobileDatePicker/MobileDatePicker.js +2 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +9 -1
- package/MobileTimePicker/MobileTimePicker.js +2 -1
- package/MonthCalendar/MonthCalendar.js +4 -9
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +1 -0
- package/PickersActionBar/PickersActionBar.d.ts +1 -1
- package/PickersActionBar/PickersActionBar.js +21 -3
- package/PickersSectionList/PickersSectionList.d.ts +1 -1
- package/PickersSectionList/PickersSectionList.types.d.ts +2 -6
- package/StaticDatePicker/StaticDatePicker.js +2 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +9 -1
- package/StaticTimePicker/StaticTimePicker.js +2 -1
- package/TimeField/TimeField.js +4 -4
- package/TimePicker/shared.js +3 -3
- package/YearCalendar/YearCalendar.js +4 -10
- package/esm/DateCalendar/DateCalendar.js +6 -10
- package/esm/DateCalendar/DayCalendar.js +2 -2
- package/esm/DateField/DateField.js +4 -4
- package/esm/DatePicker/shared.js +3 -9
- package/esm/DateTimeField/DateTimeField.js +4 -4
- package/esm/DateTimePicker/shared.js +4 -14
- package/esm/DesktopDatePicker/DesktopDatePicker.js +2 -1
- package/esm/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -1
- package/esm/DesktopTimePicker/DesktopTimePicker.js +2 -1
- package/esm/DigitalClock/DigitalClock.js +1 -0
- package/esm/LocalizationProvider/LocalizationProvider.d.ts +1 -1
- package/esm/LocalizationProvider/LocalizationProvider.js +2 -2
- package/esm/MobileDatePicker/MobileDatePicker.js +2 -1
- package/esm/MobileDateTimePicker/MobileDateTimePicker.js +9 -1
- package/esm/MobileTimePicker/MobileTimePicker.js +2 -1
- package/esm/MonthCalendar/MonthCalendar.js +6 -11
- package/esm/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +1 -0
- package/esm/PickersActionBar/PickersActionBar.d.ts +1 -1
- package/esm/PickersActionBar/PickersActionBar.js +22 -4
- package/esm/PickersSectionList/PickersSectionList.d.ts +1 -1
- package/esm/PickersSectionList/PickersSectionList.types.d.ts +2 -6
- package/esm/StaticDatePicker/StaticDatePicker.js +2 -1
- package/esm/StaticDateTimePicker/StaticDateTimePicker.js +9 -1
- package/esm/StaticTimePicker/StaticTimePicker.js +2 -1
- package/esm/TimeField/TimeField.js +4 -4
- package/esm/TimePicker/shared.js +3 -3
- package/esm/YearCalendar/YearCalendar.js +5 -11
- package/esm/index.js +1 -1
- package/esm/internals/components/PickerProvider.d.ts +9 -0
- package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -0
- package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.js +9 -3
- package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +7 -0
- package/esm/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/esm/internals/hooks/useField/syncSelectionToDOM.d.ts +9 -0
- package/esm/internals/hooks/useField/syncSelectionToDOM.js +50 -0
- package/esm/internals/hooks/useField/useField.types.d.ts +8 -1
- package/esm/internals/hooks/useField/useField.utils.d.ts +1 -3
- package/esm/internals/hooks/useField/useField.utils.js +0 -57
- package/esm/internals/hooks/useField/useFieldHiddenInputProps.d.ts +20 -0
- package/esm/internals/hooks/useField/useFieldHiddenInputProps.js +31 -0
- package/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +8 -10
- package/esm/internals/hooks/useField/useFieldRootHandleKeyDown.js +1 -0
- package/esm/internals/hooks/useField/useFieldRootProps.d.ts +32 -0
- package/esm/internals/hooks/useField/useFieldRootProps.js +150 -0
- package/esm/internals/hooks/useField/useFieldSectionContainerProps.d.ts +15 -0
- package/esm/internals/hooks/useField/useFieldSectionContainerProps.js +29 -0
- package/esm/internals/hooks/useField/useFieldSectionContentProps.d.ts +23 -0
- package/esm/internals/hooks/useField/useFieldSectionContentProps.js +226 -0
- package/esm/internals/hooks/useField/useFieldV7TextField.js +76 -307
- package/esm/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -0
- package/esm/internals/hooks/useMobilePicker/useMobilePicker.js +9 -3
- package/esm/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -0
- package/esm/internals/hooks/usePicker/usePicker.d.ts +2 -1
- package/esm/internals/hooks/usePicker/usePicker.js +14 -4
- package/esm/internals/hooks/usePicker/usePicker.types.d.ts +2 -0
- package/esm/internals/hooks/useStaticPicker/useStaticPicker.d.ts +1 -0
- package/esm/internals/hooks/useStaticPicker/useStaticPicker.js +9 -3
- package/esm/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +7 -0
- package/esm/internals/index.d.ts +7 -6
- package/esm/internals/index.js +6 -5
- package/esm/internals/utils/createNonRangePickerStepNavigation.d.ts +13 -0
- package/esm/internals/utils/createNonRangePickerStepNavigation.js +24 -0
- package/esm/internals/utils/createStepNavigation.d.ts +32 -0
- package/esm/internals/utils/createStepNavigation.js +34 -0
- package/esm/internals/utils/date-utils.d.ts +1 -0
- package/esm/internals/utils/date-utils.js +2 -2
- package/esm/internals/utils/time-utils.d.ts +2 -0
- package/esm/internals/utils/time-utils.js +4 -3
- package/esm/locales/beBY.d.ts +1 -0
- package/esm/locales/beBY.js +1 -0
- package/esm/locales/bgBG.d.ts +1 -0
- package/esm/locales/bgBG.js +1 -0
- package/esm/locales/bnBD.d.ts +1 -0
- package/esm/locales/bnBD.js +1 -0
- package/esm/locales/caES.d.ts +1 -0
- package/esm/locales/caES.js +1 -0
- package/esm/locales/csCZ.d.ts +1 -0
- package/esm/locales/csCZ.js +1 -0
- package/esm/locales/daDK.d.ts +1 -0
- package/esm/locales/daDK.js +1 -0
- package/esm/locales/deDE.d.ts +1 -0
- package/esm/locales/deDE.js +3 -3
- package/esm/locales/elGR.d.ts +1 -0
- package/esm/locales/elGR.js +1 -0
- package/esm/locales/enUS.d.ts +1 -0
- package/esm/locales/enUS.js +1 -0
- package/esm/locales/esES.d.ts +1 -0
- package/esm/locales/esES.js +1 -0
- package/esm/locales/eu.d.ts +1 -0
- package/esm/locales/eu.js +1 -0
- package/esm/locales/faIR.d.ts +1 -0
- package/esm/locales/faIR.js +1 -0
- package/esm/locales/fiFI.d.ts +1 -0
- package/esm/locales/fiFI.js +1 -0
- package/esm/locales/frFR.d.ts +1 -0
- package/esm/locales/frFR.js +1 -0
- package/esm/locales/heIL.d.ts +1 -0
- package/esm/locales/heIL.js +1 -0
- package/esm/locales/hrHR.d.ts +1 -0
- package/esm/locales/hrHR.js +1 -0
- package/esm/locales/huHU.d.ts +1 -0
- package/esm/locales/huHU.js +1 -0
- package/esm/locales/isIS.d.ts +1 -0
- package/esm/locales/isIS.js +1 -0
- package/esm/locales/itIT.d.ts +1 -0
- package/esm/locales/itIT.js +1 -0
- package/esm/locales/jaJP.d.ts +1 -0
- package/esm/locales/jaJP.js +1 -0
- package/esm/locales/koKR.d.ts +1 -0
- package/esm/locales/koKR.js +1 -0
- package/esm/locales/kzKZ.d.ts +1 -0
- package/esm/locales/kzKZ.js +1 -0
- package/esm/locales/mk.d.ts +1 -0
- package/esm/locales/mk.js +1 -0
- package/esm/locales/nbNO.d.ts +1 -0
- package/esm/locales/nbNO.js +1 -0
- package/esm/locales/nlNL.d.ts +1 -0
- package/esm/locales/nlNL.js +1 -0
- package/esm/locales/nnNO.d.ts +1 -0
- package/esm/locales/nnNO.js +1 -0
- package/esm/locales/plPL.d.ts +1 -0
- package/esm/locales/plPL.js +1 -0
- package/esm/locales/ptBR.d.ts +1 -0
- package/esm/locales/ptBR.js +1 -0
- package/esm/locales/ptPT.d.ts +1 -0
- package/esm/locales/ptPT.js +1 -0
- package/esm/locales/roRO.d.ts +1 -0
- package/esm/locales/roRO.js +1 -0
- package/esm/locales/ruRU.d.ts +1 -0
- package/esm/locales/ruRU.js +1 -0
- package/esm/locales/skSK.d.ts +1 -0
- package/esm/locales/skSK.js +1 -0
- package/esm/locales/svSE.d.ts +1 -0
- package/esm/locales/svSE.js +1 -0
- package/esm/locales/trTR.d.ts +1 -0
- package/esm/locales/trTR.js +1 -0
- package/esm/locales/ukUA.d.ts +1 -0
- package/esm/locales/ukUA.js +1 -0
- package/esm/locales/urPK.d.ts +1 -0
- package/esm/locales/urPK.js +1 -0
- package/esm/locales/utils/getPickersLocalization.d.ts +1 -0
- package/esm/locales/utils/pickersLocaleTextApi.d.ts +1 -0
- package/esm/locales/viVN.d.ts +1 -0
- package/esm/locales/viVN.js +1 -0
- package/esm/locales/zhCN.d.ts +1 -0
- package/esm/locales/zhCN.js +1 -0
- package/esm/locales/zhHK.d.ts +1 -0
- package/esm/locales/zhHK.js +1 -0
- package/esm/locales/zhTW.d.ts +1 -0
- package/esm/locales/zhTW.js +1 -0
- package/esm/managers/useDateManager.d.ts +4 -13
- package/esm/managers/useDateManager.js +18 -28
- package/esm/managers/useDateTimeManager.d.ts +4 -13
- package/esm/managers/useDateTimeManager.js +23 -33
- package/esm/managers/useTimeManager.d.ts +4 -13
- package/esm/managers/useTimeManager.js +14 -24
- package/esm/models/manager.d.ts +3 -8
- package/esm/validation/validateDate.js +3 -4
- package/index.js +1 -1
- package/internals/components/PickerProvider.d.ts +9 -0
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -0
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +9 -3
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +7 -0
- package/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/internals/hooks/useField/syncSelectionToDOM.d.ts +9 -0
- package/internals/hooks/useField/syncSelectionToDOM.js +56 -0
- package/internals/hooks/useField/useField.types.d.ts +8 -1
- package/internals/hooks/useField/useField.utils.d.ts +1 -3
- package/internals/hooks/useField/useField.utils.js +2 -61
- package/internals/hooks/useField/useFieldHiddenInputProps.d.ts +20 -0
- package/internals/hooks/useField/useFieldHiddenInputProps.js +39 -0
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +8 -10
- package/internals/hooks/useField/useFieldRootHandleKeyDown.js +1 -0
- package/internals/hooks/useField/useFieldRootProps.d.ts +32 -0
- package/internals/hooks/useField/useFieldRootProps.js +156 -0
- package/internals/hooks/useField/useFieldSectionContainerProps.d.ts +15 -0
- package/internals/hooks/useField/useFieldSectionContainerProps.js +37 -0
- package/internals/hooks/useField/useFieldSectionContentProps.d.ts +23 -0
- package/internals/hooks/useField/useFieldSectionContentProps.js +234 -0
- package/internals/hooks/useField/useFieldV7TextField.js +75 -306
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -0
- package/internals/hooks/useMobilePicker/useMobilePicker.js +9 -3
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -0
- package/internals/hooks/usePicker/usePicker.d.ts +2 -1
- package/internals/hooks/usePicker/usePicker.js +14 -4
- package/internals/hooks/usePicker/usePicker.types.d.ts +2 -0
- package/internals/hooks/useStaticPicker/useStaticPicker.d.ts +1 -0
- package/internals/hooks/useStaticPicker/useStaticPicker.js +9 -3
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +7 -0
- package/internals/index.d.ts +7 -6
- package/internals/index.js +37 -18
- package/internals/utils/createNonRangePickerStepNavigation.d.ts +13 -0
- package/internals/utils/createNonRangePickerStepNavigation.js +30 -0
- package/internals/utils/createStepNavigation.d.ts +32 -0
- package/internals/utils/createStepNavigation.js +41 -0
- package/internals/utils/date-utils.d.ts +1 -0
- package/internals/utils/date-utils.js +3 -3
- package/internals/utils/time-utils.d.ts +2 -0
- package/internals/utils/time-utils.js +5 -4
- package/locales/beBY.d.ts +1 -0
- package/locales/beBY.js +1 -0
- package/locales/bgBG.d.ts +1 -0
- package/locales/bgBG.js +1 -0
- package/locales/bnBD.d.ts +1 -0
- package/locales/bnBD.js +1 -0
- package/locales/caES.d.ts +1 -0
- package/locales/caES.js +1 -0
- package/locales/csCZ.d.ts +1 -0
- package/locales/csCZ.js +1 -0
- package/locales/daDK.d.ts +1 -0
- package/locales/daDK.js +1 -0
- package/locales/deDE.d.ts +1 -0
- package/locales/deDE.js +3 -3
- package/locales/elGR.d.ts +1 -0
- package/locales/elGR.js +1 -0
- package/locales/enUS.d.ts +1 -0
- package/locales/enUS.js +1 -0
- package/locales/esES.d.ts +1 -0
- package/locales/esES.js +1 -0
- package/locales/eu.d.ts +1 -0
- package/locales/eu.js +1 -0
- package/locales/faIR.d.ts +1 -0
- package/locales/faIR.js +1 -0
- package/locales/fiFI.d.ts +1 -0
- package/locales/fiFI.js +1 -0
- package/locales/frFR.d.ts +1 -0
- package/locales/frFR.js +1 -0
- package/locales/heIL.d.ts +1 -0
- package/locales/heIL.js +1 -0
- package/locales/hrHR.d.ts +1 -0
- package/locales/hrHR.js +1 -0
- package/locales/huHU.d.ts +1 -0
- package/locales/huHU.js +1 -0
- package/locales/isIS.d.ts +1 -0
- package/locales/isIS.js +1 -0
- package/locales/itIT.d.ts +1 -0
- package/locales/itIT.js +1 -0
- package/locales/jaJP.d.ts +1 -0
- package/locales/jaJP.js +1 -0
- package/locales/koKR.d.ts +1 -0
- package/locales/koKR.js +1 -0
- package/locales/kzKZ.d.ts +1 -0
- package/locales/kzKZ.js +1 -0
- package/locales/mk.d.ts +1 -0
- package/locales/mk.js +1 -0
- package/locales/nbNO.d.ts +1 -0
- package/locales/nbNO.js +1 -0
- package/locales/nlNL.d.ts +1 -0
- package/locales/nlNL.js +1 -0
- package/locales/nnNO.d.ts +1 -0
- package/locales/nnNO.js +1 -0
- package/locales/plPL.d.ts +1 -0
- package/locales/plPL.js +1 -0
- package/locales/ptBR.d.ts +1 -0
- package/locales/ptBR.js +1 -0
- package/locales/ptPT.d.ts +1 -0
- package/locales/ptPT.js +1 -0
- package/locales/roRO.d.ts +1 -0
- package/locales/roRO.js +1 -0
- package/locales/ruRU.d.ts +1 -0
- package/locales/ruRU.js +1 -0
- package/locales/skSK.d.ts +1 -0
- package/locales/skSK.js +1 -0
- package/locales/svSE.d.ts +1 -0
- package/locales/svSE.js +1 -0
- package/locales/trTR.d.ts +1 -0
- package/locales/trTR.js +1 -0
- package/locales/ukUA.d.ts +1 -0
- package/locales/ukUA.js +1 -0
- package/locales/urPK.d.ts +1 -0
- package/locales/urPK.js +1 -0
- package/locales/utils/getPickersLocalization.d.ts +1 -0
- package/locales/utils/pickersLocaleTextApi.d.ts +1 -0
- package/locales/viVN.d.ts +1 -0
- package/locales/viVN.js +1 -0
- package/locales/zhCN.d.ts +1 -0
- package/locales/zhCN.js +1 -0
- package/locales/zhHK.d.ts +1 -0
- package/locales/zhHK.js +1 -0
- package/locales/zhTW.d.ts +1 -0
- package/locales/zhTW.js +1 -0
- package/managers/useDateManager.d.ts +4 -13
- package/managers/useDateManager.js +18 -28
- package/managers/useDateTimeManager.d.ts +4 -13
- package/managers/useDateTimeManager.js +23 -33
- package/managers/useTimeManager.d.ts +4 -13
- package/managers/useTimeManager.js +15 -25
- package/models/manager.d.ts +3 -8
- package/modern/DateCalendar/DateCalendar.js +6 -10
- package/modern/DateCalendar/DayCalendar.js +2 -2
- package/modern/DateField/DateField.js +4 -4
- package/modern/DatePicker/shared.js +3 -9
- package/modern/DateTimeField/DateTimeField.js +4 -4
- package/modern/DateTimePicker/shared.js +4 -14
- package/modern/DesktopDatePicker/DesktopDatePicker.js +2 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -1
- package/modern/DesktopTimePicker/DesktopTimePicker.js +2 -1
- package/modern/DigitalClock/DigitalClock.js +1 -0
- package/modern/LocalizationProvider/LocalizationProvider.d.ts +1 -1
- package/modern/LocalizationProvider/LocalizationProvider.js +2 -2
- package/modern/MobileDatePicker/MobileDatePicker.js +2 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +9 -1
- package/modern/MobileTimePicker/MobileTimePicker.js +2 -1
- package/modern/MonthCalendar/MonthCalendar.js +6 -11
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +1 -0
- package/modern/PickersActionBar/PickersActionBar.d.ts +1 -1
- package/modern/PickersActionBar/PickersActionBar.js +22 -4
- package/modern/PickersSectionList/PickersSectionList.d.ts +1 -1
- package/modern/PickersSectionList/PickersSectionList.types.d.ts +2 -6
- package/modern/StaticDatePicker/StaticDatePicker.js +2 -1
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +9 -1
- package/modern/StaticTimePicker/StaticTimePicker.js +2 -1
- package/modern/TimeField/TimeField.js +4 -4
- package/modern/TimePicker/shared.js +3 -3
- package/modern/YearCalendar/YearCalendar.js +5 -11
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerProvider.d.ts +9 -0
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -0
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +9 -3
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +7 -0
- package/modern/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/modern/internals/hooks/useField/syncSelectionToDOM.d.ts +9 -0
- package/modern/internals/hooks/useField/syncSelectionToDOM.js +50 -0
- package/modern/internals/hooks/useField/useField.types.d.ts +8 -1
- package/modern/internals/hooks/useField/useField.utils.d.ts +1 -3
- package/modern/internals/hooks/useField/useField.utils.js +0 -57
- package/modern/internals/hooks/useField/useFieldHiddenInputProps.d.ts +20 -0
- package/modern/internals/hooks/useField/useFieldHiddenInputProps.js +31 -0
- package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +8 -10
- package/modern/internals/hooks/useField/useFieldRootHandleKeyDown.js +1 -0
- package/modern/internals/hooks/useField/useFieldRootProps.d.ts +32 -0
- package/modern/internals/hooks/useField/useFieldRootProps.js +150 -0
- package/modern/internals/hooks/useField/useFieldSectionContainerProps.d.ts +15 -0
- package/modern/internals/hooks/useField/useFieldSectionContainerProps.js +29 -0
- package/modern/internals/hooks/useField/useFieldSectionContentProps.d.ts +23 -0
- package/modern/internals/hooks/useField/useFieldSectionContentProps.js +226 -0
- package/modern/internals/hooks/useField/useFieldV7TextField.js +76 -307
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -0
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +9 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -0
- package/modern/internals/hooks/usePicker/usePicker.d.ts +2 -1
- package/modern/internals/hooks/usePicker/usePicker.js +14 -4
- package/modern/internals/hooks/usePicker/usePicker.types.d.ts +2 -0
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.d.ts +1 -0
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +9 -3
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +7 -0
- package/modern/internals/index.d.ts +7 -6
- package/modern/internals/index.js +6 -5
- package/modern/internals/utils/createNonRangePickerStepNavigation.d.ts +13 -0
- package/modern/internals/utils/createNonRangePickerStepNavigation.js +24 -0
- package/modern/internals/utils/createStepNavigation.d.ts +32 -0
- package/modern/internals/utils/createStepNavigation.js +34 -0
- package/modern/internals/utils/date-utils.d.ts +1 -0
- package/modern/internals/utils/date-utils.js +2 -2
- package/modern/internals/utils/time-utils.d.ts +2 -0
- package/modern/internals/utils/time-utils.js +4 -3
- package/modern/locales/beBY.d.ts +1 -0
- package/modern/locales/beBY.js +1 -0
- package/modern/locales/bgBG.d.ts +1 -0
- package/modern/locales/bgBG.js +1 -0
- package/modern/locales/bnBD.d.ts +1 -0
- package/modern/locales/bnBD.js +1 -0
- package/modern/locales/caES.d.ts +1 -0
- package/modern/locales/caES.js +1 -0
- package/modern/locales/csCZ.d.ts +1 -0
- package/modern/locales/csCZ.js +1 -0
- package/modern/locales/daDK.d.ts +1 -0
- package/modern/locales/daDK.js +1 -0
- package/modern/locales/deDE.d.ts +1 -0
- package/modern/locales/deDE.js +3 -3
- package/modern/locales/elGR.d.ts +1 -0
- package/modern/locales/elGR.js +1 -0
- package/modern/locales/enUS.d.ts +1 -0
- package/modern/locales/enUS.js +1 -0
- package/modern/locales/esES.d.ts +1 -0
- package/modern/locales/esES.js +1 -0
- package/modern/locales/eu.d.ts +1 -0
- package/modern/locales/eu.js +1 -0
- package/modern/locales/faIR.d.ts +1 -0
- package/modern/locales/faIR.js +1 -0
- package/modern/locales/fiFI.d.ts +1 -0
- package/modern/locales/fiFI.js +1 -0
- package/modern/locales/frFR.d.ts +1 -0
- package/modern/locales/frFR.js +1 -0
- package/modern/locales/heIL.d.ts +1 -0
- package/modern/locales/heIL.js +1 -0
- package/modern/locales/hrHR.d.ts +1 -0
- package/modern/locales/hrHR.js +1 -0
- package/modern/locales/huHU.d.ts +1 -0
- package/modern/locales/huHU.js +1 -0
- package/modern/locales/isIS.d.ts +1 -0
- package/modern/locales/isIS.js +1 -0
- package/modern/locales/itIT.d.ts +1 -0
- package/modern/locales/itIT.js +1 -0
- package/modern/locales/jaJP.d.ts +1 -0
- package/modern/locales/jaJP.js +1 -0
- package/modern/locales/koKR.d.ts +1 -0
- package/modern/locales/koKR.js +1 -0
- package/modern/locales/kzKZ.d.ts +1 -0
- package/modern/locales/kzKZ.js +1 -0
- package/modern/locales/mk.d.ts +1 -0
- package/modern/locales/mk.js +1 -0
- package/modern/locales/nbNO.d.ts +1 -0
- package/modern/locales/nbNO.js +1 -0
- package/modern/locales/nlNL.d.ts +1 -0
- package/modern/locales/nlNL.js +1 -0
- package/modern/locales/nnNO.d.ts +1 -0
- package/modern/locales/nnNO.js +1 -0
- package/modern/locales/plPL.d.ts +1 -0
- package/modern/locales/plPL.js +1 -0
- package/modern/locales/ptBR.d.ts +1 -0
- package/modern/locales/ptBR.js +1 -0
- package/modern/locales/ptPT.d.ts +1 -0
- package/modern/locales/ptPT.js +1 -0
- package/modern/locales/roRO.d.ts +1 -0
- package/modern/locales/roRO.js +1 -0
- package/modern/locales/ruRU.d.ts +1 -0
- package/modern/locales/ruRU.js +1 -0
- package/modern/locales/skSK.d.ts +1 -0
- package/modern/locales/skSK.js +1 -0
- package/modern/locales/svSE.d.ts +1 -0
- package/modern/locales/svSE.js +1 -0
- package/modern/locales/trTR.d.ts +1 -0
- package/modern/locales/trTR.js +1 -0
- package/modern/locales/ukUA.d.ts +1 -0
- package/modern/locales/ukUA.js +1 -0
- package/modern/locales/urPK.d.ts +1 -0
- package/modern/locales/urPK.js +1 -0
- package/modern/locales/utils/getPickersLocalization.d.ts +1 -0
- package/modern/locales/utils/pickersLocaleTextApi.d.ts +1 -0
- package/modern/locales/viVN.d.ts +1 -0
- package/modern/locales/viVN.js +1 -0
- package/modern/locales/zhCN.d.ts +1 -0
- package/modern/locales/zhCN.js +1 -0
- package/modern/locales/zhHK.d.ts +1 -0
- package/modern/locales/zhHK.js +1 -0
- package/modern/locales/zhTW.d.ts +1 -0
- package/modern/locales/zhTW.js +1 -0
- package/modern/managers/useDateManager.d.ts +4 -13
- package/modern/managers/useDateManager.js +18 -28
- package/modern/managers/useDateTimeManager.d.ts +4 -13
- package/modern/managers/useDateTimeManager.js +23 -33
- package/modern/managers/useTimeManager.d.ts +4 -13
- package/modern/managers/useTimeManager.js +14 -24
- package/modern/models/manager.d.ts +3 -8
- package/modern/validation/validateDate.js +3 -4
- package/package.json +6 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/validation/validateDate.js +3 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DialogActionsProps } from '@mui/material/DialogActions';
|
|
3
|
-
export type PickersActionBarAction = 'clear' | 'cancel' | 'accept' | 'today';
|
|
3
|
+
export type PickersActionBarAction = 'clear' | 'cancel' | 'accept' | 'today' | 'next' | 'nextOrAccept';
|
|
4
4
|
export interface PickersActionBarProps extends DialogActionsProps {
|
|
5
5
|
/**
|
|
6
6
|
* Ordered array of actions to display.
|
|
@@ -9,7 +9,7 @@ import { styled } from '@mui/material/styles';
|
|
|
9
9
|
import Button from '@mui/material/Button';
|
|
10
10
|
import DialogActions from '@mui/material/DialogActions';
|
|
11
11
|
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
|
-
import {
|
|
12
|
+
import { usePickerContext } from "../hooks/index.js";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
const PickersActionBarRoot = styled(DialogActions, {
|
|
15
15
|
name: 'MuiPickersLayout',
|
|
@@ -37,8 +37,10 @@ function PickersActionBarComponent(props) {
|
|
|
37
37
|
clearValue,
|
|
38
38
|
setValueToToday,
|
|
39
39
|
acceptValueChanges,
|
|
40
|
-
cancelValueChanges
|
|
41
|
-
|
|
40
|
+
cancelValueChanges,
|
|
41
|
+
goToNextStep,
|
|
42
|
+
hasNextStep
|
|
43
|
+
} = usePickerContext();
|
|
42
44
|
if (actions == null || actions.length === 0) {
|
|
43
45
|
return null;
|
|
44
46
|
}
|
|
@@ -64,6 +66,22 @@ function PickersActionBarComponent(props) {
|
|
|
64
66
|
onClick: setValueToToday,
|
|
65
67
|
children: translations.todayButtonLabel
|
|
66
68
|
}, actionType);
|
|
69
|
+
case 'next':
|
|
70
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
71
|
+
onClick: goToNextStep,
|
|
72
|
+
children: translations.nextStepButtonLabel
|
|
73
|
+
}, actionType);
|
|
74
|
+
case 'nextOrAccept':
|
|
75
|
+
if (hasNextStep) {
|
|
76
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
77
|
+
onClick: goToNextStep,
|
|
78
|
+
children: translations.nextStepButtonLabel
|
|
79
|
+
}, actionType);
|
|
80
|
+
}
|
|
81
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
82
|
+
onClick: acceptValueChanges,
|
|
83
|
+
children: translations.okButtonLabel
|
|
84
|
+
}, actionType);
|
|
67
85
|
default:
|
|
68
86
|
return null;
|
|
69
87
|
}
|
|
@@ -84,7 +102,7 @@ process.env.NODE_ENV !== "production" ? PickersActionBarComponent.propTypes = {
|
|
|
84
102
|
* - `[]` for Desktop Date Picker and Desktop Date Range Picker
|
|
85
103
|
* - `['cancel', 'accept']` for all other Pickers
|
|
86
104
|
*/
|
|
87
|
-
actions: PropTypes.arrayOf(PropTypes.oneOf(['accept', 'cancel', 'clear', 'today']).isRequired),
|
|
105
|
+
actions: PropTypes.arrayOf(PropTypes.oneOf(['accept', 'cancel', 'clear', 'next', 'nextOrAccept', 'today']).isRequired),
|
|
88
106
|
/**
|
|
89
107
|
* If `true`, the actions do not have additional margin.
|
|
90
108
|
* @default false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickersSectionListProps } from
|
|
2
|
+
import type { PickersSectionListProps } from './PickersSectionList.types';
|
|
3
3
|
export declare const PickersSectionListRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
4
4
|
export declare const PickersSectionListSection: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof React.ClassAttributes<HTMLSpanElement> | keyof React.HTMLAttributes<HTMLSpanElement>>, {}>;
|
|
5
5
|
export declare const PickersSectionListSectionSeparator: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof React.ClassAttributes<HTMLSpanElement> | keyof React.HTMLAttributes<HTMLSpanElement>>, {}>;
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { SlotComponentProps } from '@mui/utils';
|
|
3
3
|
import { PickersSectionListClasses } from "./pickersSectionListClasses.js";
|
|
4
4
|
import { PickerOwnerState } from "../models/index.js";
|
|
5
|
+
import type { UseFieldDOMGetters } from '../internals/hooks/useField/useField.types';
|
|
5
6
|
export interface PickersSectionListSlots {
|
|
6
7
|
root: React.ElementType;
|
|
7
8
|
section: React.ElementType;
|
|
@@ -28,12 +29,7 @@ export interface PickersSectionElement {
|
|
|
28
29
|
before: React.HTMLAttributes<HTMLSpanElement>;
|
|
29
30
|
after: React.HTMLAttributes<HTMLSpanElement>;
|
|
30
31
|
}
|
|
31
|
-
export interface PickersSectionListRef {
|
|
32
|
-
getRoot: () => HTMLElement;
|
|
33
|
-
getSectionContainer: (sectionIndex: number) => HTMLElement;
|
|
34
|
-
getSectionContent: (sectionIndex: number) => HTMLElement;
|
|
35
|
-
getSectionIndexFromDOMElement: (element: Element | null | undefined) => number | null;
|
|
36
|
-
}
|
|
32
|
+
export interface PickersSectionListRef extends Omit<UseFieldDOMGetters, 'isReady'> {}
|
|
37
33
|
export interface ExportedPickersSectionListProps extends Pick<React.HTMLAttributes<HTMLDivElement>, 'tabIndex'> {
|
|
38
34
|
/**
|
|
39
35
|
* The elements to render.
|
|
@@ -45,7 +45,8 @@ const StaticDatePicker = /*#__PURE__*/React.forwardRef(function StaticDatePicker
|
|
|
45
45
|
props,
|
|
46
46
|
valueManager: singleItemValueManager,
|
|
47
47
|
valueType: 'date',
|
|
48
|
-
validator: validateDate
|
|
48
|
+
validator: validateDate,
|
|
49
|
+
steps: null
|
|
49
50
|
});
|
|
50
51
|
return renderPicker();
|
|
51
52
|
});
|
|
@@ -13,6 +13,13 @@ import { mergeSx } from "../internals/utils/utils.js";
|
|
|
13
13
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from "../MultiSectionDigitalClock/index.js";
|
|
14
14
|
import { DIALOG_WIDTH, VIEW_HEIGHT } from "../internals/constants/dimensions.js";
|
|
15
15
|
import { digitalClockClasses } from "../DigitalClock/index.js";
|
|
16
|
+
import { DATE_VIEWS } from "../internals/utils/date-utils.js";
|
|
17
|
+
import { EXPORTED_TIME_VIEWS } from "../internals/utils/time-utils.js";
|
|
18
|
+
const STEPS = [{
|
|
19
|
+
views: DATE_VIEWS
|
|
20
|
+
}, {
|
|
21
|
+
views: EXPORTED_TIME_VIEWS
|
|
22
|
+
}];
|
|
16
23
|
/**
|
|
17
24
|
* Demos:
|
|
18
25
|
*
|
|
@@ -87,7 +94,8 @@ const StaticDateTimePicker = /*#__PURE__*/React.forwardRef(function StaticDateTi
|
|
|
87
94
|
props,
|
|
88
95
|
valueManager: singleItemValueManager,
|
|
89
96
|
valueType: 'date-time',
|
|
90
|
-
validator: validateDateTime
|
|
97
|
+
validator: validateDateTime,
|
|
98
|
+
steps: STEPS
|
|
91
99
|
});
|
|
92
100
|
return renderPicker();
|
|
93
101
|
});
|
|
@@ -47,7 +47,8 @@ const StaticTimePicker = /*#__PURE__*/React.forwardRef(function StaticTimePicker
|
|
|
47
47
|
props,
|
|
48
48
|
valueManager: singleItemValueManager,
|
|
49
49
|
valueType: 'time',
|
|
50
|
-
validator: validateTime
|
|
50
|
+
validator: validateTime,
|
|
51
|
+
steps: null
|
|
51
52
|
});
|
|
52
53
|
return renderPicker();
|
|
53
54
|
});
|
|
@@ -123,7 +123,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
123
123
|
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
124
124
|
/**
|
|
125
125
|
* Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
|
|
126
|
-
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in
|
|
126
|
+
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
127
127
|
*/
|
|
128
128
|
FormHelperTextProps: PropTypes.object,
|
|
129
129
|
/**
|
|
@@ -150,12 +150,12 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
150
150
|
/**
|
|
151
151
|
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
|
|
152
152
|
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
153
|
-
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in
|
|
153
|
+
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
154
154
|
*/
|
|
155
155
|
InputLabelProps: PropTypes.object,
|
|
156
156
|
/**
|
|
157
157
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
158
|
-
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in
|
|
158
|
+
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
159
159
|
*/
|
|
160
160
|
inputProps: PropTypes.object,
|
|
161
161
|
/**
|
|
@@ -163,7 +163,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
163
163
|
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
|
|
164
164
|
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
|
|
165
165
|
* component depending on the `variant` prop value.
|
|
166
|
-
* @deprecated Use `slotProps.input` instead. This prop will be removed in
|
|
166
|
+
* @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
167
167
|
*/
|
|
168
168
|
InputProps: PropTypes.object,
|
|
169
169
|
/**
|
package/esm/TimePicker/shared.js
CHANGED
|
@@ -4,12 +4,14 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
4
4
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
5
5
|
import { TimePickerToolbar } from "./TimePickerToolbar.js";
|
|
6
6
|
import { applyDefaultViewProps } from "../internals/utils/views.js";
|
|
7
|
+
import { useApplyDefaultValuesToTimeValidationProps } from "../managers/useTimeManager.js";
|
|
7
8
|
export function useTimePickerDefaultizedProps(props, name) {
|
|
8
9
|
const utils = useUtils();
|
|
9
10
|
const themeProps = useThemeProps({
|
|
10
11
|
props,
|
|
11
12
|
name
|
|
12
13
|
});
|
|
14
|
+
const validationProps = useApplyDefaultValuesToTimeValidationProps(themeProps);
|
|
13
15
|
const ampm = themeProps.ampm ?? utils.is12HourCycleInCurrentLocale();
|
|
14
16
|
const localeText = React.useMemo(() => {
|
|
15
17
|
if (themeProps.localeText?.toolbarTitle == null) {
|
|
@@ -19,7 +21,7 @@ export function useTimePickerDefaultizedProps(props, name) {
|
|
|
19
21
|
timePickerToolbarTitle: themeProps.localeText.toolbarTitle
|
|
20
22
|
});
|
|
21
23
|
}, [themeProps.localeText]);
|
|
22
|
-
return _extends({}, themeProps, {
|
|
24
|
+
return _extends({}, themeProps, validationProps, {
|
|
23
25
|
ampm,
|
|
24
26
|
localeText
|
|
25
27
|
}, applyDefaultViewProps({
|
|
@@ -28,8 +30,6 @@ export function useTimePickerDefaultizedProps(props, name) {
|
|
|
28
30
|
defaultViews: ['hours', 'minutes'],
|
|
29
31
|
defaultOpenTo: 'hours'
|
|
30
32
|
}), {
|
|
31
|
-
disableFuture: themeProps.disableFuture ?? false,
|
|
32
|
-
disablePast: themeProps.disablePast ?? false,
|
|
33
33
|
slots: _extends({
|
|
34
34
|
toolbar: TimePickerToolbar
|
|
35
35
|
}, themeProps.slots),
|
|
@@ -11,14 +11,14 @@ import { shouldForwardProp } from '@mui/system/createStyled';
|
|
|
11
11
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
12
12
|
import { unstable_useForkRef as useForkRef, unstable_composeClasses as composeClasses, unstable_useControlled as useControlled, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
13
13
|
import { YearCalendarButton } from "./YearCalendarButton.js";
|
|
14
|
-
import { useUtils, useNow
|
|
14
|
+
import { useUtils, useNow } from "../internals/hooks/useUtils.js";
|
|
15
15
|
import { getYearCalendarUtilityClass } from "./yearCalendarClasses.js";
|
|
16
|
-
import { applyDefaultDate } from "../internals/utils/date-utils.js";
|
|
17
16
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
18
17
|
import { SECTION_TYPE_GRANULARITY } from "../internals/utils/getDefaultReferenceDate.js";
|
|
19
18
|
import { useControlledValue } from "../internals/hooks/useControlledValue.js";
|
|
20
19
|
import { DIALOG_WIDTH, MAX_CALENDAR_HEIGHT } from "../internals/constants/dimensions.js";
|
|
21
20
|
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
21
|
+
import { useApplyDefaultValuesToDateValidationProps } from "../managers/useDateManager.js";
|
|
22
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
23
|
const useUtilityClasses = classes => {
|
|
24
24
|
const slots = {
|
|
@@ -27,20 +27,14 @@ const useUtilityClasses = classes => {
|
|
|
27
27
|
return composeClasses(slots, getYearCalendarUtilityClass, classes);
|
|
28
28
|
};
|
|
29
29
|
function useYearCalendarDefaultizedProps(props, name) {
|
|
30
|
-
const utils = useUtils();
|
|
31
|
-
const defaultDates = useDefaultDates();
|
|
32
30
|
const themeProps = useThemeProps({
|
|
33
31
|
props,
|
|
34
32
|
name
|
|
35
33
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
disableFuture: false
|
|
39
|
-
}, themeProps, {
|
|
34
|
+
const validationProps = useApplyDefaultValuesToDateValidationProps(themeProps);
|
|
35
|
+
return _extends({}, themeProps, validationProps, {
|
|
40
36
|
yearsPerRow: themeProps.yearsPerRow ?? 3,
|
|
41
|
-
yearsOrder: themeProps.yearsOrder ?? 'asc'
|
|
42
|
-
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
|
|
43
|
-
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate)
|
|
37
|
+
yearsOrder: themeProps.yearsOrder ?? 'asc'
|
|
44
38
|
});
|
|
45
39
|
}
|
|
46
40
|
const YearCalendarRoot = styled('div', {
|
package/esm/index.js
CHANGED
|
@@ -109,6 +109,10 @@ export interface PickerContextValue<TValue extends PickerValidValue, TView exten
|
|
|
109
109
|
* If it is "enabled", the field should render an interactive UI to open the Picker.
|
|
110
110
|
*/
|
|
111
111
|
triggerStatus: 'hidden' | 'disabled' | 'enabled';
|
|
112
|
+
/**
|
|
113
|
+
* Whether the Picker has any value picking steps left.
|
|
114
|
+
*/
|
|
115
|
+
hasNextStep: boolean;
|
|
112
116
|
/**
|
|
113
117
|
* The ref to attach to the popup's outermost element that contains the view, if any.
|
|
114
118
|
* When using a built-in popup component, this property is automatically attached to the appropriate element.
|
|
@@ -203,6 +207,11 @@ export interface PickerActionsContextValue<TValue extends PickerValidValue, TVie
|
|
|
203
207
|
* The value will be reset to the last accepted value.
|
|
204
208
|
*/
|
|
205
209
|
cancelValueChanges: () => void;
|
|
210
|
+
/**
|
|
211
|
+
* Go to the next step in the value picking process.
|
|
212
|
+
* For example, on the Mobile Date Time Picker, if the user is editing the date, it will switch to editing the time.
|
|
213
|
+
*/
|
|
214
|
+
goToNextStep: () => void;
|
|
206
215
|
}
|
|
207
216
|
export interface SetValueActionOptions<TError = string | null> {
|
|
208
217
|
/**
|
|
@@ -9,6 +9,7 @@ import { DateOrTimeViewWithMeridiem } from "../../models/index.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const useDesktopPicker: <TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopPickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>>({
|
|
11
11
|
props,
|
|
12
|
+
steps,
|
|
12
13
|
...pickerParams
|
|
13
14
|
}: UseDesktopPickerParams<TView, TEnableAccessibleFieldDOMStructure, TExternalProps>) => {
|
|
14
15
|
renderPicker: () => React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["props"],
|
|
3
|
+
const _excluded = ["props", "steps"],
|
|
4
4
|
_excluded2 = ["ownerState"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
@@ -9,6 +9,7 @@ import { usePicker } from "../usePicker/index.js";
|
|
|
9
9
|
import { PickersLayout } from "../../../PickersLayout/index.js";
|
|
10
10
|
import { PickerProvider } from "../../components/PickerProvider.js";
|
|
11
11
|
import { PickerFieldUIContextProvider } from "../../components/PickerFieldUI.js";
|
|
12
|
+
import { createNonRangePickerStepNavigation } from "../../utils/createNonRangePickerStepNavigation.js";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Hook managing all the single-date desktop pickers:
|
|
@@ -19,7 +20,8 @@ import { PickerFieldUIContextProvider } from "../../components/PickerFieldUI.js"
|
|
|
19
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
21
|
export const useDesktopPicker = _ref => {
|
|
21
22
|
let {
|
|
22
|
-
props
|
|
23
|
+
props,
|
|
24
|
+
steps
|
|
23
25
|
} = _ref,
|
|
24
26
|
pickerParams = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
25
27
|
const {
|
|
@@ -29,6 +31,9 @@ export const useDesktopPicker = _ref => {
|
|
|
29
31
|
inputRef,
|
|
30
32
|
localeText
|
|
31
33
|
} = props;
|
|
34
|
+
const getStepNavigation = createNonRangePickerStepNavigation({
|
|
35
|
+
steps
|
|
36
|
+
});
|
|
32
37
|
const {
|
|
33
38
|
providerProps,
|
|
34
39
|
renderCurrentView,
|
|
@@ -38,7 +43,8 @@ export const useDesktopPicker = _ref => {
|
|
|
38
43
|
localeText,
|
|
39
44
|
autoFocusView: true,
|
|
40
45
|
viewContainerRole: 'dialog',
|
|
41
|
-
variant: 'desktop'
|
|
46
|
+
variant: 'desktop',
|
|
47
|
+
getStepNavigation
|
|
42
48
|
}));
|
|
43
49
|
const labelId = providerProps.privateContextValue.labelId;
|
|
44
50
|
const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
|
|
@@ -7,6 +7,7 @@ import { PickerFieldSlotProps, PickerOwnerState } from "../../../models/index.js
|
|
|
7
7
|
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, PickersLayoutSlotProps } from "../../../PickersLayout/PickersLayout.types.js";
|
|
8
8
|
import { DateOrTimeViewWithMeridiem, PickerValue } from "../../models/index.js";
|
|
9
9
|
import { PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from "../../components/PickerFieldUI.js";
|
|
10
|
+
import { PickerStep } from "../../utils/createNonRangePickerStepNavigation.js";
|
|
10
11
|
export interface UseDesktopPickerSlots extends Pick<PickerPopperSlots, 'desktopPaper' | 'desktopTransition' | 'desktopTrapFocus' | 'popper'>, ExportedPickersLayoutSlots<PickerValue>, PickerFieldUISlotsFromContext {
|
|
11
12
|
/**
|
|
12
13
|
* Component used to enter the date with the keyboard.
|
|
@@ -38,4 +39,10 @@ export interface UseDesktopPickerProps<TView extends DateOrTimeViewWithMeridiem,
|
|
|
38
39
|
}
|
|
39
40
|
export interface UseDesktopPickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopPickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends Pick<UsePickerParameters<PickerValue, TView, TExternalProps>, 'valueManager' | 'valueType' | 'validator' | 'rendererInterceptor' | 'ref'> {
|
|
40
41
|
props: TExternalProps;
|
|
42
|
+
/**
|
|
43
|
+
* Steps available for the picker.
|
|
44
|
+
* This will be used to define the behavior of navigation actions.
|
|
45
|
+
* If null, the picker will not have any step navigation.
|
|
46
|
+
*/
|
|
47
|
+
steps: PickerStep[] | null;
|
|
41
48
|
}
|
|
@@ -121,7 +121,7 @@ const createSection = ({
|
|
|
121
121
|
maxLength = sectionValue === '' ? utils.formatByString(now, token).length : sectionValue.length;
|
|
122
122
|
} else {
|
|
123
123
|
if (sectionConfig.maxLength == null) {
|
|
124
|
-
throw new Error(`MUI X: The token ${token} should have a '
|
|
124
|
+
throw new Error(`MUI X: The token ${token} should have a 'maxLength' property on it's adapter`);
|
|
125
125
|
}
|
|
126
126
|
maxLength = sectionConfig.maxLength;
|
|
127
127
|
if (isValidDate) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PickerValidValue } from "../../models/index.js";
|
|
2
|
+
import { UseFieldDOMGetters } from "./useField.types.js";
|
|
3
|
+
import { UseFieldStateReturnValue } from "./useFieldState.js";
|
|
4
|
+
export declare function syncSelectionToDOM<TValue extends PickerValidValue>(parameters: SyncSelectionToDOMParameters<TValue>): void;
|
|
5
|
+
export interface SyncSelectionToDOMParameters<TValue extends PickerValidValue> {
|
|
6
|
+
domGetters: UseFieldDOMGetters;
|
|
7
|
+
stateResponse: UseFieldStateReturnValue<TValue>;
|
|
8
|
+
focused: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getActiveElement } from "../../utils/utils.js";
|
|
2
|
+
export function syncSelectionToDOM(parameters) {
|
|
3
|
+
const {
|
|
4
|
+
focused,
|
|
5
|
+
domGetters,
|
|
6
|
+
stateResponse: {
|
|
7
|
+
// States and derived states
|
|
8
|
+
parsedSelectedSections,
|
|
9
|
+
state
|
|
10
|
+
}
|
|
11
|
+
} = parameters;
|
|
12
|
+
if (!domGetters.isReady()) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const selection = document.getSelection();
|
|
16
|
+
if (!selection) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (parsedSelectedSections == null) {
|
|
20
|
+
// If the selection contains an element inside the field, we reset it.
|
|
21
|
+
if (selection.rangeCount > 0 && domGetters.getRoot().contains(selection.getRangeAt(0).startContainer)) {
|
|
22
|
+
selection.removeAllRanges();
|
|
23
|
+
}
|
|
24
|
+
if (focused) {
|
|
25
|
+
domGetters.getRoot().blur();
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// On multi input range pickers we want to update selection range only for the active input
|
|
31
|
+
if (!domGetters.getRoot().contains(getActiveElement(document))) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const range = new window.Range();
|
|
35
|
+
let target;
|
|
36
|
+
if (parsedSelectedSections === 'all') {
|
|
37
|
+
target = domGetters.getRoot();
|
|
38
|
+
} else {
|
|
39
|
+
const section = state.sections[parsedSelectedSections];
|
|
40
|
+
if (section.type === 'empty') {
|
|
41
|
+
target = domGetters.getSectionContainer(parsedSelectedSections);
|
|
42
|
+
} else {
|
|
43
|
+
target = domGetters.getSectionContent(parsedSelectedSections);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
range.selectNodeContents(target);
|
|
47
|
+
target.focus();
|
|
48
|
+
selection.removeAllRanges();
|
|
49
|
+
selection.addRange(range);
|
|
50
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapter, TimezoneProps, FieldSectionContentType, PickerValidDate, FieldRef, OnErrorProps, InferFieldSection, PickerManager, PickerValueType } from "../../../models/index.js";
|
|
3
3
|
import { InternalPropNames } from "../../../hooks/useSplitFieldProps.js";
|
|
4
|
-
import { PickersSectionElement, PickersSectionListRef } from
|
|
4
|
+
import type { PickersSectionElement, PickersSectionListRef } from '../../../PickersSectionList';
|
|
5
5
|
import { FormProps, InferNonNullablePickerValue, PickerValidValue } from "../../models/index.js";
|
|
6
6
|
export interface UseFieldParameters<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean, TError, TValidationProps extends {}, TProps extends UseFieldProps<TEnableAccessibleFieldDOMStructure>> {
|
|
7
7
|
manager: PickerManager<TValue, TEnableAccessibleFieldDOMStructure, TError, TValidationProps, any>;
|
|
@@ -319,4 +319,11 @@ export interface CharacterEditingQuery {
|
|
|
319
319
|
export type UseFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure> & {
|
|
320
320
|
enableAccessibleFieldDOMStructure?: boolean;
|
|
321
321
|
};
|
|
322
|
+
export interface UseFieldDOMGetters {
|
|
323
|
+
isReady: () => boolean;
|
|
324
|
+
getRoot: () => HTMLElement;
|
|
325
|
+
getSectionContainer: (sectionIndex: number) => HTMLElement;
|
|
326
|
+
getSectionContent: (sectionIndex: number) => HTMLElement;
|
|
327
|
+
getSectionIndexFromDOMElement: (element: Element | null | undefined) => number | null;
|
|
328
|
+
}
|
|
322
329
|
export {};
|
|
@@ -33,6 +33,4 @@ export declare const validateSections: <TValue extends PickerValidValue>(section
|
|
|
33
33
|
export declare const mergeDateIntoReferenceDate: (utils: MuiPickersAdapter, dateToTransferFrom: PickerValidDate, sections: FieldSection[], referenceDate: PickerValidDate, shouldLimitToEditedSections: boolean) => PickerValidDate;
|
|
34
34
|
export declare const isAndroid: () => boolean;
|
|
35
35
|
export declare const getSectionOrder: (sections: FieldSection[], shouldApplyRTL: boolean) => SectionOrdering;
|
|
36
|
-
export declare const parseSelectedSections: (selectedSections: FieldSelectedSections, sections: FieldSection[]) => FieldParsedSelectedSections;
|
|
37
|
-
export declare const getSectionValueText: (section: FieldSection, utils: MuiPickersAdapter) => string | undefined;
|
|
38
|
-
export declare const getSectionValueNow: (section: FieldSection, utils: MuiPickersAdapter) => number | undefined;
|
|
36
|
+
export declare const parseSelectedSections: (selectedSections: FieldSelectedSections, sections: FieldSection[]) => FieldParsedSelectedSections;
|
|
@@ -493,61 +493,4 @@ export const parseSelectedSections = (selectedSections, sections) => {
|
|
|
493
493
|
return index === -1 ? null : index;
|
|
494
494
|
}
|
|
495
495
|
return selectedSections;
|
|
496
|
-
};
|
|
497
|
-
export const getSectionValueText = (section, utils) => {
|
|
498
|
-
if (!section.value) {
|
|
499
|
-
return undefined;
|
|
500
|
-
}
|
|
501
|
-
switch (section.type) {
|
|
502
|
-
case 'month':
|
|
503
|
-
{
|
|
504
|
-
if (section.contentType === 'digit') {
|
|
505
|
-
return utils.format(utils.setMonth(utils.date(), Number(section.value) - 1), 'month');
|
|
506
|
-
}
|
|
507
|
-
const parsedDate = utils.parse(section.value, section.format);
|
|
508
|
-
return parsedDate ? utils.format(parsedDate, 'month') : undefined;
|
|
509
|
-
}
|
|
510
|
-
case 'day':
|
|
511
|
-
return section.contentType === 'digit' ? utils.format(utils.setDate(utils.startOfYear(utils.date()), Number(section.value)), 'dayOfMonthFull') : section.value;
|
|
512
|
-
case 'weekDay':
|
|
513
|
-
// TODO: improve by providing the label of the week day
|
|
514
|
-
return undefined;
|
|
515
|
-
default:
|
|
516
|
-
return undefined;
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
export const getSectionValueNow = (section, utils) => {
|
|
520
|
-
if (!section.value) {
|
|
521
|
-
return undefined;
|
|
522
|
-
}
|
|
523
|
-
switch (section.type) {
|
|
524
|
-
case 'weekDay':
|
|
525
|
-
{
|
|
526
|
-
if (section.contentType === 'letter') {
|
|
527
|
-
// TODO: improve by resolving the week day number from a letter week day
|
|
528
|
-
return undefined;
|
|
529
|
-
}
|
|
530
|
-
return Number(section.value);
|
|
531
|
-
}
|
|
532
|
-
case 'meridiem':
|
|
533
|
-
{
|
|
534
|
-
const parsedDate = utils.parse(`01:00 ${section.value}`, `${utils.formats.hours12h}:${utils.formats.minutes} ${section.format}`);
|
|
535
|
-
if (parsedDate) {
|
|
536
|
-
return utils.getHours(parsedDate) >= 12 ? 1 : 0;
|
|
537
|
-
}
|
|
538
|
-
return undefined;
|
|
539
|
-
}
|
|
540
|
-
case 'day':
|
|
541
|
-
return section.contentType === 'digit-with-letter' ? parseInt(section.value, 10) : Number(section.value);
|
|
542
|
-
case 'month':
|
|
543
|
-
{
|
|
544
|
-
if (section.contentType === 'digit') {
|
|
545
|
-
return Number(section.value);
|
|
546
|
-
}
|
|
547
|
-
const parsedDate = utils.parse(section.value, section.format);
|
|
548
|
-
return parsedDate ? utils.getMonth(parsedDate) + 1 : undefined;
|
|
549
|
-
}
|
|
550
|
-
default:
|
|
551
|
-
return section.contentType !== 'letter' ? Number(section.value) : undefined;
|
|
552
|
-
}
|
|
553
496
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PickerManager } from "../../../models/index.js";
|
|
3
|
+
import { UseFieldStateReturnValue } from "./useFieldState.js";
|
|
4
|
+
/**
|
|
5
|
+
* Generate the props to pass to the hidden input element of the field.
|
|
6
|
+
* It is not used by the non-accessible DOM structure (with an <input /> element for editing).
|
|
7
|
+
* It should be used in the MUI accessible DOM structure and the Base UI implementation.
|
|
8
|
+
* @param {UseFieldHiddenInputPropsParameters} parameters The parameters of the hook.
|
|
9
|
+
* @returns {UseFieldHiddenInputPropsReturnValue} The props to forward to the hidden input element of the field.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useFieldHiddenInputProps(parameters: UseFieldHiddenInputPropsParameters): UseFieldHiddenInputPropsReturnValue;
|
|
12
|
+
interface UseFieldHiddenInputPropsParameters {
|
|
13
|
+
manager: PickerManager<any, any, any, any, any>;
|
|
14
|
+
stateResponse: UseFieldStateReturnValue<any>;
|
|
15
|
+
}
|
|
16
|
+
interface UseFieldHiddenInputPropsReturnValue {
|
|
17
|
+
value: string;
|
|
18
|
+
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
|
+
/**
|
|
4
|
+
* Generate the props to pass to the hidden input element of the field.
|
|
5
|
+
* It is not used by the non-accessible DOM structure (with an <input /> element for editing).
|
|
6
|
+
* It should be used in the MUI accessible DOM structure and the Base UI implementation.
|
|
7
|
+
* @param {UseFieldHiddenInputPropsParameters} parameters The parameters of the hook.
|
|
8
|
+
* @returns {UseFieldHiddenInputPropsReturnValue} The props to forward to the hidden input element of the field.
|
|
9
|
+
*/
|
|
10
|
+
export function useFieldHiddenInputProps(parameters) {
|
|
11
|
+
const {
|
|
12
|
+
manager: {
|
|
13
|
+
internal_fieldValueManager: fieldValueManager
|
|
14
|
+
},
|
|
15
|
+
stateResponse: {
|
|
16
|
+
// States and derived states
|
|
17
|
+
areAllSectionsEmpty,
|
|
18
|
+
state,
|
|
19
|
+
// Methods to update the states
|
|
20
|
+
updateValueFromValueStr
|
|
21
|
+
}
|
|
22
|
+
} = parameters;
|
|
23
|
+
const handleChange = useEventCallback(event => {
|
|
24
|
+
updateValueFromValueStr(event.target.value);
|
|
25
|
+
});
|
|
26
|
+
const valueStr = React.useMemo(() => areAllSectionsEmpty ? '' : fieldValueManager.getV7HiddenInputValueFromSections(state.sections), [areAllSectionsEmpty, state.sections, fieldValueManager]);
|
|
27
|
+
return {
|
|
28
|
+
value: valueStr,
|
|
29
|
+
onChange: handleChange
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import useForkRef from '@mui/utils/useForkRef';
|
|
4
|
-
import { useLocalizationContext } from "../useUtils.js";
|
|
5
4
|
import { useNullablePickerContext } from "../useNullablePickerContext.js";
|
|
6
5
|
import { useNullableFieldPrivateContext } from "../useNullableFieldPrivateContext.js";
|
|
7
6
|
|
|
@@ -12,11 +11,12 @@ import { useNullableFieldPrivateContext } from "../useNullableFieldPrivateContex
|
|
|
12
11
|
*/
|
|
13
12
|
export function useFieldInternalPropsWithDefaults(parameters) {
|
|
14
13
|
const {
|
|
15
|
-
manager
|
|
14
|
+
manager: {
|
|
15
|
+
internal_useApplyDefaultValuesToFieldInternalProps: useApplyDefaultValuesToFieldInternalProps
|
|
16
|
+
},
|
|
16
17
|
internalProps,
|
|
17
18
|
skipContextFieldRefAssignment
|
|
18
19
|
} = parameters;
|
|
19
|
-
const localizationContext = useLocalizationContext();
|
|
20
20
|
const pickerContext = useNullablePickerContext();
|
|
21
21
|
const fieldPrivateContext = useNullableFieldPrivateContext();
|
|
22
22
|
const handleFieldRef = useForkRef(internalProps.unstableFieldRef, skipContextFieldRefAssignment ? null : fieldPrivateContext?.fieldRef);
|
|
@@ -27,12 +27,11 @@ export function useFieldInternalPropsWithDefaults(parameters) {
|
|
|
27
27
|
shouldClose: false
|
|
28
28
|
});
|
|
29
29
|
}, [setValue]);
|
|
30
|
-
|
|
31
|
-
let internalPropsWithDefaultsFromContext = internalProps;
|
|
30
|
+
const internalPropsWithDefaultsFromContext = React.useMemo(() => {
|
|
32
31
|
// If one of the context is null,
|
|
33
32
|
// Then the field is used as a standalone component and the other context will be null as well.
|
|
34
33
|
if (fieldPrivateContext != null && pickerContext != null) {
|
|
35
|
-
|
|
34
|
+
return _extends({
|
|
36
35
|
value: pickerContext.value,
|
|
37
36
|
onChange: handleChangeFromPicker,
|
|
38
37
|
timezone: pickerContext.timezone,
|
|
@@ -48,8 +47,7 @@ export function useFieldInternalPropsWithDefaults(parameters) {
|
|
|
48
47
|
unstableFieldRef: handleFieldRef
|
|
49
48
|
}, internalProps);
|
|
50
49
|
}
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, [manager, localizationContext, pickerContext, fieldPrivateContext, internalProps, handleChangeFromPicker, handleFieldRef]);
|
|
50
|
+
return internalProps;
|
|
51
|
+
}, [pickerContext, fieldPrivateContext, internalProps, handleChangeFromPicker, handleFieldRef]);
|
|
52
|
+
return useApplyDefaultValuesToFieldInternalProps(internalPropsWithDefaultsFromContext);
|
|
55
53
|
}
|