@mui/x-date-pickers 7.0.0-beta.2 → 7.0.0-beta.5
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/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +1 -0
- package/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -0
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -0
- package/AdapterDayjs/AdapterDayjs.d.ts +1 -0
- package/AdapterDayjs/AdapterDayjs.js +6 -0
- package/AdapterLuxon/AdapterLuxon.d.ts +1 -0
- package/AdapterLuxon/AdapterLuxon.js +6 -0
- package/AdapterMoment/AdapterMoment.d.ts +1 -0
- package/AdapterMoment/AdapterMoment.js +4 -0
- package/AdapterMomentHijri/AdapterMomentHijri.js +3 -0
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -0
- package/CHANGELOG.md +429 -30
- package/DateCalendar/DateCalendar.js +3 -1
- package/DateCalendar/DateCalendar.types.d.ts +3 -0
- package/DateCalendar/DayCalendar.d.ts +3 -1
- package/DateCalendar/DayCalendar.js +1 -1
- package/DateCalendar/PickersFadeTransitionGroup.d.ts +3 -0
- package/DateCalendar/PickersSlideTransition.d.ts +3 -0
- package/DateField/DateField.d.ts +1 -1
- package/DateField/DateField.js +11 -9
- package/DateField/DateField.types.d.ts +12 -15
- package/DateField/index.d.ts +1 -1
- package/DateField/useDateField.d.ts +2 -2
- package/DateField/useDateField.js +1 -15
- package/DatePicker/DatePicker.d.ts +1 -1
- package/DatePicker/DatePicker.js +9 -9
- package/DatePicker/DatePicker.types.d.ts +3 -3
- package/DatePicker/DatePickerToolbar.d.ts +5 -4
- package/DatePicker/DatePickerToolbar.js +14 -3
- package/DateTimeField/DateTimeField.d.ts +1 -1
- package/DateTimeField/DateTimeField.js +11 -9
- package/DateTimeField/DateTimeField.types.d.ts +12 -15
- package/DateTimeField/index.d.ts +1 -1
- package/DateTimeField/useDateTimeField.d.ts +2 -2
- package/DateTimeField/useDateTimeField.js +1 -20
- package/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/DateTimePicker/DateTimePicker.js +9 -9
- package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
- package/DateTimePicker/DateTimePickerTabs.d.ts +2 -2
- package/DateTimePicker/DateTimePickerTabs.js +7 -1
- package/DateTimePicker/DateTimePickerToolbar.d.ts +4 -4
- package/DateTimePicker/DateTimePickerToolbar.js +6 -0
- package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +9 -9
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +3 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -9
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +3 -3
- package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.js +9 -8
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +3 -3
- package/LocalizationProvider/LocalizationProvider.js +1 -0
- package/MobileDatePicker/MobileDatePicker.d.ts +1 -1
- package/MobileDatePicker/MobileDatePicker.js +9 -9
- package/MobileDatePicker/MobileDatePicker.types.d.ts +3 -3
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +2 -2
- package/MobileDateTimePicker/MobileDateTimePicker.js +9 -9
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +4 -4
- package/MobileTimePicker/MobileTimePicker.d.ts +2 -2
- package/MobileTimePicker/MobileTimePicker.js +9 -8
- package/MobileTimePicker/MobileTimePicker.types.d.ts +4 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +4 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +6 -4
- package/PickersLayout/PickersLayout.js +6 -0
- package/PickersLayout/PickersLayout.types.d.ts +6 -0
- package/PickersSectionList/PickersSectionList.d.ts +4 -4
- package/PickersSectionList/PickersSectionList.js +1 -2
- package/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
- package/PickersTextField/PickersInput/PickersInput.js +3 -3
- package/PickersTextField/PickersInputBase/PickersInputBase.d.ts +1 -1
- package/PickersTextField/PickersInputBase/PickersInputBase.js +11 -5
- package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +1 -0
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +3 -3
- package/PickersTextField/PickersTextField.d.ts +1 -1
- package/PickersTextField/PickersTextField.js +9 -5
- package/StaticDatePicker/StaticDatePicker.js +0 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
- package/TimeField/TimeField.d.ts +1 -1
- package/TimeField/TimeField.js +11 -9
- package/TimeField/TimeField.types.d.ts +12 -15
- package/TimeField/index.d.ts +1 -1
- package/TimeField/useTimeField.d.ts +2 -2
- package/TimeField/useTimeField.js +1 -13
- package/TimePicker/TimePicker.d.ts +1 -1
- package/TimePicker/TimePicker.js +9 -8
- package/TimePicker/TimePicker.types.d.ts +3 -3
- package/TimePicker/TimePickerToolbar.d.ts +5 -4
- package/TimePicker/TimePickerToolbar.js +14 -3
- package/hooks/index.d.ts +1 -1
- package/hooks/useClearableField.d.ts +10 -2
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +3 -0
- package/internals/components/PickersPopper.d.ts +3 -0
- package/internals/components/PickersPopper.js +1 -2
- package/internals/components/PickersToolbar.js +13 -9
- package/internals/demo/DemoContainer.js +6 -5
- package/internals/hooks/defaultizedFieldProps.d.ts +19 -0
- package/internals/hooks/defaultizedFieldProps.js +43 -0
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -5
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -13
- package/internals/hooks/useField/buildSectionsFromFormat.d.ts +16 -0
- package/internals/hooks/useField/buildSectionsFromFormat.js +251 -0
- package/internals/hooks/useField/index.d.ts +2 -2
- package/internals/hooks/useField/index.js +1 -1
- package/internals/hooks/useField/useField.d.ts +4 -4
- package/internals/hooks/useField/useField.js +82 -309
- package/internals/hooks/useField/useField.types.d.ts +92 -56
- package/internals/hooks/useField/useField.utils.d.ts +10 -10
- package/internals/hooks/useField/useField.utils.js +78 -228
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +7 -6
- package/internals/hooks/useField/useFieldCharacterEditing.js +7 -7
- package/internals/hooks/useField/useFieldState.d.ts +13 -11
- package/internals/hooks/useField/useFieldState.js +45 -61
- package/internals/hooks/useField/useFieldV6TextField.d.ts +25 -0
- package/internals/hooks/useField/useFieldV6TextField.js +326 -0
- package/internals/hooks/useField/useFieldV7TextField.d.ts +2 -0
- package/internals/hooks/useField/useFieldV7TextField.js +402 -0
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.js +13 -5
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +12 -12
- package/internals/hooks/usePicker/usePicker.d.ts +1 -1
- package/internals/hooks/usePicker/usePicker.js +3 -3
- package/internals/hooks/usePicker/usePicker.types.d.ts +2 -2
- package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +2 -18
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +5 -6
- package/internals/hooks/usePicker/usePickerViews.d.ts +4 -4
- package/internals/hooks/usePicker/usePickerViews.js +5 -6
- package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -0
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +1 -0
- package/internals/index.d.ts +5 -4
- package/internals/index.js +2 -1
- package/internals/models/fields.d.ts +2 -4
- package/internals/models/helpers.d.ts +1 -0
- package/internals/models/props/basePickerProps.d.ts +2 -7
- package/internals/models/props/tabs.d.ts +6 -0
- package/internals/models/props/toolbar.d.ts +6 -0
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +1 -1
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +21 -3
- package/internals/utils/fields.js +1 -1
- package/internals/utils/valueManagers.js +5 -4
- package/locales/beBY.d.ts +9 -0
- package/locales/beBY.js +13 -0
- package/locales/caES.d.ts +9 -0
- package/locales/caES.js +13 -0
- package/locales/csCZ.d.ts +9 -0
- package/locales/csCZ.js +13 -0
- package/locales/daDK.d.ts +9 -0
- package/locales/daDK.js +13 -0
- package/locales/deDE.d.ts +9 -0
- package/locales/deDE.js +13 -0
- package/locales/elGR.d.ts +9 -0
- package/locales/elGR.js +13 -0
- package/locales/enUS.d.ts +9 -0
- package/locales/enUS.js +12 -1
- package/locales/esES.d.ts +9 -0
- package/locales/esES.js +13 -0
- package/locales/eu.d.ts +9 -0
- package/locales/eu.js +13 -0
- package/locales/faIR.d.ts +9 -0
- package/locales/faIR.js +13 -0
- package/locales/fiFI.d.ts +9 -0
- package/locales/fiFI.js +13 -0
- package/locales/frFR.d.ts +9 -0
- package/locales/frFR.js +13 -0
- package/locales/heIL.d.ts +9 -0
- package/locales/heIL.js +13 -0
- package/locales/huHU.d.ts +9 -0
- package/locales/huHU.js +13 -0
- package/locales/isIS.d.ts +9 -0
- package/locales/isIS.js +13 -0
- package/locales/itIT.d.ts +9 -0
- package/locales/itIT.js +13 -0
- package/locales/jaJP.d.ts +9 -0
- package/locales/jaJP.js +13 -0
- package/locales/koKR.d.ts +9 -0
- package/locales/koKR.js +14 -2
- package/locales/kzKZ.d.ts +9 -0
- package/locales/kzKZ.js +13 -0
- package/locales/mk.d.ts +9 -0
- package/locales/mk.js +13 -0
- package/locales/nbNO.d.ts +9 -0
- package/locales/nbNO.js +13 -0
- package/locales/nlNL.d.ts +9 -0
- package/locales/nlNL.js +13 -0
- package/locales/plPL.d.ts +9 -0
- package/locales/plPL.js +13 -0
- package/locales/ptBR.d.ts +9 -0
- package/locales/ptBR.js +13 -0
- package/locales/roRO.d.ts +9 -0
- package/locales/roRO.js +13 -0
- package/locales/ruRU.d.ts +9 -0
- package/locales/ruRU.js +13 -0
- package/locales/skSK.d.ts +9 -0
- package/locales/skSK.js +13 -0
- package/locales/svSE.d.ts +9 -0
- package/locales/svSE.js +13 -0
- package/locales/trTR.d.ts +9 -0
- package/locales/trTR.js +13 -0
- package/locales/ukUA.d.ts +9 -0
- package/locales/ukUA.js +13 -0
- package/locales/urPK.d.ts +9 -0
- package/locales/urPK.js +13 -0
- package/locales/utils/getPickersLocalization.d.ts +9 -0
- package/locales/utils/pickersLocaleTextApi.d.ts +9 -0
- package/locales/viVN.d.ts +9 -0
- package/locales/viVN.js +13 -0
- package/locales/zhCN.d.ts +9 -0
- package/locales/zhCN.js +18 -9
- package/locales/zhHK.d.ts +9 -0
- package/locales/zhHK.js +13 -0
- package/models/adapters.d.ts +13 -0
- package/models/fields.d.ts +47 -32
- package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -0
- package/modern/AdapterDayjs/AdapterDayjs.js +6 -0
- package/modern/AdapterLuxon/AdapterLuxon.js +6 -0
- package/modern/AdapterMoment/AdapterMoment.js +4 -0
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +3 -0
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -0
- package/modern/DateCalendar/DateCalendar.js +3 -1
- package/modern/DateCalendar/DayCalendar.js +1 -1
- package/modern/DateField/DateField.js +11 -9
- package/modern/DateField/useDateField.js +1 -14
- package/modern/DatePicker/DatePicker.js +9 -9
- package/modern/DatePicker/DatePickerToolbar.js +14 -3
- package/modern/DateTimeField/DateTimeField.js +11 -9
- package/modern/DateTimeField/useDateTimeField.js +1 -19
- package/modern/DateTimePicker/DateTimePicker.js +9 -9
- package/modern/DateTimePicker/DateTimePickerTabs.js +7 -1
- package/modern/DateTimePicker/DateTimePickerToolbar.js +6 -0
- package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -9
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -9
- package/modern/DesktopTimePicker/DesktopTimePicker.js +9 -8
- package/modern/LocalizationProvider/LocalizationProvider.js +1 -0
- package/modern/MobileDatePicker/MobileDatePicker.js +9 -9
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +9 -9
- package/modern/MobileTimePicker/MobileTimePicker.js +9 -8
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +4 -4
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +5 -3
- package/modern/PickersLayout/PickersLayout.js +6 -0
- package/modern/PickersSectionList/PickersSectionList.js +1 -2
- package/modern/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
- package/modern/PickersTextField/PickersInput/PickersInput.js +3 -3
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +11 -5
- package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +3 -3
- package/modern/PickersTextField/PickersTextField.js +9 -5
- package/modern/StaticDatePicker/StaticDatePicker.js +0 -1
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
- package/modern/TimeField/TimeField.js +11 -9
- package/modern/TimeField/useTimeField.js +1 -12
- package/modern/TimePicker/TimePicker.js +9 -8
- package/modern/TimePicker/TimePickerToolbar.js +14 -3
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersPopper.js +1 -2
- package/modern/internals/components/PickersToolbar.js +13 -9
- package/modern/internals/demo/DemoContainer.js +6 -5
- package/modern/internals/hooks/defaultizedFieldProps.js +40 -0
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -5
- package/modern/internals/hooks/useField/buildSectionsFromFormat.js +251 -0
- package/modern/internals/hooks/useField/index.js +1 -1
- package/modern/internals/hooks/useField/useField.js +82 -303
- package/modern/internals/hooks/useField/useField.utils.js +78 -228
- package/modern/internals/hooks/useField/useFieldCharacterEditing.js +7 -7
- package/modern/internals/hooks/useField/useFieldState.js +45 -61
- package/modern/internals/hooks/useField/useFieldV6TextField.js +320 -0
- package/modern/internals/hooks/useField/useFieldV7TextField.js +400 -0
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +13 -5
- package/modern/internals/hooks/usePicker/usePicker.js +3 -3
- package/modern/internals/hooks/usePicker/usePickerValue.js +2 -18
- package/modern/internals/hooks/usePicker/usePickerViews.js +4 -6
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -0
- package/modern/internals/index.js +2 -1
- package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +21 -3
- package/modern/internals/utils/fields.js +1 -1
- package/modern/internals/utils/valueManagers.js +5 -4
- package/modern/locales/beBY.js +13 -0
- package/modern/locales/caES.js +13 -0
- package/modern/locales/csCZ.js +13 -0
- package/modern/locales/daDK.js +13 -0
- package/modern/locales/deDE.js +13 -0
- package/modern/locales/elGR.js +13 -0
- package/modern/locales/enUS.js +12 -1
- package/modern/locales/esES.js +13 -0
- package/modern/locales/eu.js +13 -0
- package/modern/locales/faIR.js +13 -0
- package/modern/locales/fiFI.js +13 -0
- package/modern/locales/frFR.js +13 -0
- package/modern/locales/heIL.js +13 -0
- package/modern/locales/huHU.js +13 -0
- package/modern/locales/isIS.js +13 -0
- package/modern/locales/itIT.js +13 -0
- package/modern/locales/jaJP.js +13 -0
- package/modern/locales/koKR.js +14 -2
- package/modern/locales/kzKZ.js +13 -0
- package/modern/locales/mk.js +13 -0
- package/modern/locales/nbNO.js +13 -0
- package/modern/locales/nlNL.js +13 -0
- package/modern/locales/plPL.js +13 -0
- package/modern/locales/ptBR.js +13 -0
- package/modern/locales/roRO.js +13 -0
- package/modern/locales/ruRU.js +13 -0
- package/modern/locales/skSK.js +13 -0
- package/modern/locales/svSE.js +13 -0
- package/modern/locales/trTR.js +13 -0
- package/modern/locales/ukUA.js +13 -0
- package/modern/locales/urPK.js +13 -0
- package/modern/locales/viVN.js +13 -0
- package/modern/locales/zhCN.js +18 -9
- package/modern/locales/zhHK.js +13 -0
- package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -0
- package/node/AdapterDayjs/AdapterDayjs.js +6 -0
- package/node/AdapterLuxon/AdapterLuxon.js +6 -0
- package/node/AdapterMoment/AdapterMoment.js +4 -0
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +3 -0
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -0
- package/node/DateCalendar/DateCalendar.js +3 -1
- package/node/DateCalendar/DayCalendar.js +1 -1
- package/node/DateField/DateField.js +11 -9
- package/node/DateField/useDateField.js +2 -16
- package/node/DatePicker/DatePicker.js +9 -9
- package/node/DatePicker/DatePickerToolbar.js +14 -3
- package/node/DateTimeField/DateTimeField.js +11 -9
- package/node/DateTimeField/useDateTimeField.js +2 -21
- package/node/DateTimePicker/DateTimePicker.js +9 -9
- package/node/DateTimePicker/DateTimePickerTabs.js +7 -1
- package/node/DateTimePicker/DateTimePickerToolbar.js +6 -0
- package/node/DesktopDatePicker/DesktopDatePicker.js +9 -9
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -9
- package/node/DesktopTimePicker/DesktopTimePicker.js +9 -8
- package/node/LocalizationProvider/LocalizationProvider.js +1 -0
- package/node/MobileDatePicker/MobileDatePicker.js +9 -9
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +9 -9
- package/node/MobileTimePicker/MobileTimePicker.js +9 -8
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +4 -4
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +5 -3
- package/node/PickersLayout/PickersLayout.js +6 -0
- package/node/PickersSectionList/PickersSectionList.js +4 -5
- package/node/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
- package/node/PickersTextField/PickersInput/PickersInput.js +3 -3
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +11 -5
- package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +3 -3
- package/node/PickersTextField/PickersTextField.js +9 -5
- package/node/StaticDatePicker/StaticDatePicker.js +0 -1
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
- package/node/TimeField/TimeField.js +11 -9
- package/node/TimeField/useTimeField.js +2 -14
- package/node/TimePicker/TimePicker.js +9 -8
- package/node/TimePicker/TimePickerToolbar.js +14 -3
- package/node/index.js +1 -1
- package/node/internals/components/PickersPopper.js +1 -2
- package/node/internals/components/PickersToolbar.js +13 -9
- package/node/internals/demo/DemoContainer.js +6 -5
- package/node/internals/hooks/defaultizedFieldProps.js +50 -0
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -5
- package/node/internals/hooks/useField/buildSectionsFromFormat.js +259 -0
- package/node/internals/hooks/useField/index.js +4 -10
- package/node/internals/hooks/useField/useField.js +81 -302
- package/node/internals/hooks/useField/useField.utils.js +86 -236
- package/node/internals/hooks/useField/useFieldCharacterEditing.js +7 -7
- package/node/internals/hooks/useField/useFieldState.js +44 -60
- package/node/internals/hooks/useField/useFieldV6TextField.js +331 -0
- package/node/internals/hooks/useField/useFieldV7TextField.js +410 -0
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +13 -5
- package/node/internals/hooks/usePicker/usePicker.js +3 -3
- package/node/internals/hooks/usePicker/usePickerValue.js +2 -18
- package/node/internals/hooks/usePicker/usePickerViews.js +4 -6
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -0
- package/node/internals/index.js +27 -8
- package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +21 -3
- package/node/internals/utils/fields.js +1 -1
- package/node/internals/utils/valueManagers.js +4 -3
- package/node/locales/beBY.js +13 -0
- package/node/locales/caES.js +13 -0
- package/node/locales/csCZ.js +13 -0
- package/node/locales/daDK.js +13 -0
- package/node/locales/deDE.js +13 -0
- package/node/locales/elGR.js +13 -0
- package/node/locales/enUS.js +12 -1
- package/node/locales/esES.js +13 -0
- package/node/locales/eu.js +13 -0
- package/node/locales/faIR.js +13 -0
- package/node/locales/fiFI.js +13 -0
- package/node/locales/frFR.js +13 -0
- package/node/locales/heIL.js +13 -0
- package/node/locales/huHU.js +13 -0
- package/node/locales/isIS.js +13 -0
- package/node/locales/itIT.js +13 -0
- package/node/locales/jaJP.js +13 -0
- package/node/locales/koKR.js +14 -2
- package/node/locales/kzKZ.js +13 -0
- package/node/locales/mk.js +13 -0
- package/node/locales/nbNO.js +13 -0
- package/node/locales/nlNL.js +13 -0
- package/node/locales/plPL.js +13 -0
- package/node/locales/ptBR.js +13 -0
- package/node/locales/roRO.js +13 -0
- package/node/locales/ruRU.js +13 -0
- package/node/locales/skSK.js +13 -0
- package/node/locales/svSE.js +13 -0
- package/node/locales/trTR.js +13 -0
- package/node/locales/ukUA.js +13 -0
- package/node/locales/urPK.js +13 -0
- package/node/locales/viVN.js +13 -0
- package/node/locales/zhCN.js +18 -9
- package/node/locales/zhHK.js +13 -0
- package/package.json +4 -4
- package/themeAugmentation/props.d.ts +12 -13
- package/timeViewRenderers/timeViewRenderers.d.ts +1 -1
- package/legacy/AdapterDateFns/AdapterDateFns.js +0 -298
- package/legacy/AdapterDateFns/index.js +0 -1
- package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +0 -293
- package/legacy/AdapterDateFnsBase/index.js +0 -1
- package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +0 -547
- package/legacy/AdapterDateFnsJalali/index.js +0 -1
- package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -306
- package/legacy/AdapterDateFnsV3/index.js +0 -1
- package/legacy/AdapterDayjs/AdapterDayjs.js +0 -568
- package/legacy/AdapterDayjs/index.js +0 -1
- package/legacy/AdapterLuxon/AdapterLuxon.js +0 -508
- package/legacy/AdapterLuxon/index.js +0 -1
- package/legacy/AdapterMoment/AdapterMoment.js +0 -481
- package/legacy/AdapterMoment/index.js +0 -1
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +0 -238
- package/legacy/AdapterMomentHijri/index.js +0 -1
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -235
- package/legacy/AdapterMomentJalaali/index.js +0 -1
- package/legacy/DateCalendar/DateCalendar.js +0 -573
- package/legacy/DateCalendar/DateCalendar.types.js +0 -1
- package/legacy/DateCalendar/DayCalendar.js +0 -515
- package/legacy/DateCalendar/PickersFadeTransitionGroup.js +0 -58
- package/legacy/DateCalendar/PickersSlideTransition.js +0 -118
- package/legacy/DateCalendar/dateCalendarClasses.js +0 -5
- package/legacy/DateCalendar/dayCalendarClasses.js +0 -5
- package/legacy/DateCalendar/index.js +0 -5
- package/legacy/DateCalendar/pickersFadeTransitionGroupClasses.js +0 -5
- package/legacy/DateCalendar/pickersSlideTransitionClasses.js +0 -5
- package/legacy/DateCalendar/useCalendarState.js +0 -124
- package/legacy/DateCalendar/useIsDateDisabled.js +0 -30
- package/legacy/DateField/DateField.js +0 -319
- package/legacy/DateField/DateField.types.js +0 -1
- package/legacy/DateField/index.js +0 -2
- package/legacy/DateField/useDateField.js +0 -33
- package/legacy/DatePicker/DatePicker.js +0 -353
- package/legacy/DatePicker/DatePicker.types.js +0 -1
- package/legacy/DatePicker/DatePickerToolbar.js +0 -132
- package/legacy/DatePicker/datePickerToolbarClasses.js +0 -5
- package/legacy/DatePicker/index.js +0 -3
- package/legacy/DatePicker/shared.js +0 -41
- package/legacy/DateTimeField/DateTimeField.js +0 -360
- package/legacy/DateTimeField/DateTimeField.types.js +0 -1
- package/legacy/DateTimeField/index.js +0 -2
- package/legacy/DateTimeField/useDateTimeField.js +0 -38
- package/legacy/DateTimePicker/DateTimePicker.js +0 -424
- package/legacy/DateTimePicker/DateTimePicker.types.js +0 -1
- package/legacy/DateTimePicker/DateTimePickerTabs.js +0 -142
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +0 -385
- package/legacy/DateTimePicker/dateTimePickerTabsClasses.js +0 -5
- package/legacy/DateTimePicker/dateTimePickerToolbarClasses.js +0 -5
- package/legacy/DateTimePicker/index.js +0 -5
- package/legacy/DateTimePicker/shared.js +0 -56
- package/legacy/DayCalendarSkeleton/DayCalendarSkeleton.js +0 -119
- package/legacy/DayCalendarSkeleton/dayCalendarSkeletonClasses.js +0 -5
- package/legacy/DayCalendarSkeleton/index.js +0 -2
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -372
- package/legacy/DesktopDatePicker/DesktopDatePicker.types.js +0 -1
- package/legacy/DesktopDatePicker/index.js +0 -1
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -480
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -1
- package/legacy/DesktopDateTimePicker/index.js +0 -1
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -355
- package/legacy/DesktopTimePicker/DesktopTimePicker.types.js +0 -1
- package/legacy/DesktopTimePicker/index.js +0 -1
- package/legacy/DigitalClock/DigitalClock.js +0 -443
- package/legacy/DigitalClock/DigitalClock.types.js +0 -1
- package/legacy/DigitalClock/digitalClockClasses.js +0 -6
- package/legacy/DigitalClock/index.js +0 -2
- package/legacy/LocalizationProvider/LocalizationProvider.js +0 -140
- package/legacy/LocalizationProvider/index.js +0 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +0 -369
- package/legacy/MobileDatePicker/MobileDatePicker.types.js +0 -1
- package/legacy/MobileDatePicker/index.js +0 -1
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -428
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.types.js +0 -1
- package/legacy/MobileDateTimePicker/index.js +0 -1
- package/legacy/MobileTimePicker/MobileTimePicker.js +0 -311
- package/legacy/MobileTimePicker/MobileTimePicker.types.js +0 -1
- package/legacy/MobileTimePicker/index.js +0 -1
- package/legacy/MonthCalendar/MonthCalendar.js +0 -338
- package/legacy/MonthCalendar/MonthCalendar.types.js +0 -1
- package/legacy/MonthCalendar/PickersMonth.js +0 -135
- package/legacy/MonthCalendar/index.js +0 -3
- package/legacy/MonthCalendar/monthCalendarClasses.js +0 -5
- package/legacy/MonthCalendar/pickersMonthClasses.js +0 -5
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +0 -521
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +0 -1
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +0 -76
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +0 -173
- package/legacy/MultiSectionDigitalClock/index.js +0 -3
- package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +0 -6
- package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +0 -6
- package/legacy/PickersActionBar/PickersActionBar.js +0 -86
- package/legacy/PickersActionBar/index.js +0 -1
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +0 -284
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.types.js +0 -1
- package/legacy/PickersCalendarHeader/index.js +0 -2
- package/legacy/PickersCalendarHeader/pickersCalendarHeaderClasses.js +0 -5
- package/legacy/PickersDay/PickersDay.js +0 -367
- package/legacy/PickersDay/index.js +0 -2
- package/legacy/PickersDay/pickersDayClasses.js +0 -5
- package/legacy/PickersLayout/PickersLayout.js +0 -159
- package/legacy/PickersLayout/PickersLayout.types.js +0 -1
- package/legacy/PickersLayout/index.js +0 -3
- package/legacy/PickersLayout/pickersLayoutClasses.js +0 -6
- package/legacy/PickersLayout/usePickerLayout.js +0 -134
- package/legacy/PickersSectionList/PickersSectionList.js +0 -235
- package/legacy/PickersSectionList/PickersSectionList.types.js +0 -1
- package/legacy/PickersSectionList/index.js +0 -2
- package/legacy/PickersSectionList/pickersSectionListClasses.js +0 -6
- package/legacy/PickersShortcuts/PickersShortcuts.js +0 -110
- package/legacy/PickersShortcuts/index.js +0 -1
- package/legacy/PickersTextField/PickersFilledInput/PickersFilledInput.js +0 -234
- package/legacy/PickersTextField/PickersFilledInput/index.js +0 -2
- package/legacy/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +0 -8
- package/legacy/PickersTextField/PickersInput/PickersInput.js +0 -190
- package/legacy/PickersTextField/PickersInput/index.js +0 -2
- package/legacy/PickersTextField/PickersInput/pickersInputClasses.js +0 -8
- package/legacy/PickersTextField/PickersInputBase/PickersInputBase.js +0 -340
- package/legacy/PickersTextField/PickersInputBase/PickersInputBase.types.js +0 -1
- package/legacy/PickersTextField/PickersInputBase/index.js +0 -2
- package/legacy/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +0 -6
- package/legacy/PickersTextField/PickersOutlinedInput/Outline.js +0 -121
- package/legacy/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +0 -183
- package/legacy/PickersTextField/PickersOutlinedInput/index.js +0 -2
- package/legacy/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +0 -8
- package/legacy/PickersTextField/PickersTextField.js +0 -258
- package/legacy/PickersTextField/PickersTextField.types.js +0 -1
- package/legacy/PickersTextField/index.js +0 -6
- package/legacy/PickersTextField/pickersTextFieldClasses.js +0 -6
- package/legacy/StaticDatePicker/StaticDatePicker.js +0 -297
- package/legacy/StaticDatePicker/StaticDatePicker.types.js +0 -1
- package/legacy/StaticDatePicker/index.js +0 -1
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -356
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.types.js +0 -1
- package/legacy/StaticDateTimePicker/index.js +0 -1
- package/legacy/StaticTimePicker/StaticTimePicker.js +0 -238
- package/legacy/StaticTimePicker/StaticTimePicker.types.js +0 -1
- package/legacy/StaticTimePicker/index.js +0 -1
- package/legacy/TimeClock/Clock.js +0 -358
- package/legacy/TimeClock/ClockNumber.js +0 -87
- package/legacy/TimeClock/ClockNumbers.js +0 -73
- package/legacy/TimeClock/ClockPointer.js +0 -106
- package/legacy/TimeClock/TimeClock.js +0 -481
- package/legacy/TimeClock/TimeClock.types.js +0 -1
- package/legacy/TimeClock/clockClasses.js +0 -5
- package/legacy/TimeClock/clockNumberClasses.js +0 -5
- package/legacy/TimeClock/clockPointerClasses.js +0 -5
- package/legacy/TimeClock/index.js +0 -5
- package/legacy/TimeClock/shared.js +0 -53
- package/legacy/TimeClock/timeClockClasses.js +0 -5
- package/legacy/TimeField/TimeField.js +0 -320
- package/legacy/TimeField/TimeField.types.js +0 -1
- package/legacy/TimeField/index.js +0 -2
- package/legacy/TimeField/useTimeField.js +0 -31
- package/legacy/TimePicker/TimePicker.js +0 -314
- package/legacy/TimePicker/TimePicker.types.js +0 -1
- package/legacy/TimePicker/TimePickerToolbar.js +0 -260
- package/legacy/TimePicker/index.js +0 -3
- package/legacy/TimePicker/shared.js +0 -45
- package/legacy/TimePicker/timePickerToolbarClasses.js +0 -5
- package/legacy/YearCalendar/PickersYear.js +0 -137
- package/legacy/YearCalendar/YearCalendar.js +0 -362
- package/legacy/YearCalendar/YearCalendar.types.js +0 -1
- package/legacy/YearCalendar/index.js +0 -3
- package/legacy/YearCalendar/pickersYearClasses.js +0 -5
- package/legacy/YearCalendar/yearCalendarClasses.js +0 -5
- package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -162
- package/legacy/dateTimeViewRenderers/index.js +0 -1
- package/legacy/dateViewRenderers/dateViewRenderers.js +0 -82
- package/legacy/dateViewRenderers/index.js +0 -1
- package/legacy/hooks/index.js +0 -1
- package/legacy/hooks/useClearableField.js +0 -76
- package/legacy/icons/index.js +0 -68
- package/legacy/index.js +0 -59
- package/legacy/internals/components/DateTimeViewWrapper/DateTimeViewWrapper.js +0 -5
- package/legacy/internals/components/DateTimeViewWrapper/index.js +0 -1
- package/legacy/internals/components/PickerViewRoot/PickerViewRoot.js +0 -10
- package/legacy/internals/components/PickerViewRoot/index.js +0 -1
- package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +0 -170
- package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.js +0 -1
- package/legacy/internals/components/PickersArrowSwitcher/index.js +0 -2
- package/legacy/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +0 -5
- package/legacy/internals/components/PickersModalDialog.js +0 -42
- package/legacy/internals/components/PickersPopper.js +0 -325
- package/legacy/internals/components/PickersToolbar.js +0 -92
- package/legacy/internals/components/PickersToolbarButton.js +0 -61
- package/legacy/internals/components/PickersToolbarText.js +0 -52
- package/legacy/internals/components/pickersPopperClasses.js +0 -5
- package/legacy/internals/components/pickersToolbarButtonClasses.js +0 -5
- package/legacy/internals/components/pickersToolbarClasses.js +0 -5
- package/legacy/internals/components/pickersToolbarTextClasses.js +0 -5
- package/legacy/internals/constants/dimensions.js +0 -7
- package/legacy/internals/demo/DemoContainer.js +0 -163
- package/legacy/internals/demo/index.js +0 -1
- package/legacy/internals/hooks/date-helpers-hooks.js +0 -37
- package/legacy/internals/hooks/useClockReferenceDate.js +0 -28
- package/legacy/internals/hooks/useDefaultReduceAnimations.js +0 -14
- package/legacy/internals/hooks/useDesktopPicker/index.js +0 -1
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +0 -174
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.types.js +0 -1
- package/legacy/internals/hooks/useField/index.js +0 -2
- package/legacy/internals/hooks/useField/useField.js +0 -470
- package/legacy/internals/hooks/useField/useField.types.js +0 -1
- package/legacy/internals/hooks/useField/useField.utils.js +0 -828
- package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +0 -277
- package/legacy/internals/hooks/useField/useFieldState.js +0 -321
- package/legacy/internals/hooks/useIsLandscape.js +0 -39
- package/legacy/internals/hooks/useMobilePicker/index.js +0 -1
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +0 -126
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.types.js +0 -1
- package/legacy/internals/hooks/useOpenState.js +0 -38
- package/legacy/internals/hooks/usePicker/index.js +0 -1
- package/legacy/internals/hooks/usePicker/usePicker.js +0 -54
- package/legacy/internals/hooks/usePicker/usePicker.types.js +0 -1
- package/legacy/internals/hooks/usePicker/usePickerLayoutProps.js +0 -28
- package/legacy/internals/hooks/usePicker/usePickerValue.js +0 -365
- package/legacy/internals/hooks/usePicker/usePickerValue.types.js +0 -1
- package/legacy/internals/hooks/usePicker/usePickerViews.js +0 -172
- package/legacy/internals/hooks/useStaticPicker/index.js +0 -1
- package/legacy/internals/hooks/useStaticPicker/useStaticPicker.js +0 -66
- package/legacy/internals/hooks/useStaticPicker/useStaticPicker.types.js +0 -1
- package/legacy/internals/hooks/useUtils.js +0 -38
- package/legacy/internals/hooks/useValidation.js +0 -20
- package/legacy/internals/hooks/useValueWithTimezone.js +0 -81
- package/legacy/internals/hooks/useViews.js +0 -124
- package/legacy/internals/index.js +0 -35
- package/legacy/internals/models/common.js +0 -1
- package/legacy/internals/models/fields.js +0 -1
- package/legacy/internals/models/helpers.js +0 -1
- package/legacy/internals/models/index.js +0 -2
- package/legacy/internals/models/props/basePickerProps.js +0 -1
- package/legacy/internals/models/props/clock.js +0 -1
- package/legacy/internals/models/props/tabs.js +0 -1
- package/legacy/internals/models/props/toolbar.js +0 -1
- package/legacy/internals/models/validation.js +0 -1
- package/legacy/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -24
- package/legacy/internals/utils/date-time-utils.js +0 -71
- package/legacy/internals/utils/date-utils.js +0 -129
- package/legacy/internals/utils/fields.js +0 -28
- package/legacy/internals/utils/getDefaultReferenceDate.js +0 -65
- package/legacy/internals/utils/time-utils.js +0 -63
- package/legacy/internals/utils/utils.js +0 -40
- package/legacy/internals/utils/validation/extractValidationProps.js +0 -16
- package/legacy/internals/utils/validation/validateDate.js +0 -38
- package/legacy/internals/utils/validation/validateDateTime.js +0 -20
- package/legacy/internals/utils/validation/validateTime.js +0 -42
- package/legacy/internals/utils/valueManagers.js +0 -67
- package/legacy/internals/utils/views.js +0 -29
- package/legacy/internals/utils/warning.js +0 -39
- package/legacy/locales/beBY.js +0 -99
- package/legacy/locales/caES.js +0 -100
- package/legacy/locales/csCZ.js +0 -100
- package/legacy/locales/daDK.js +0 -102
- package/legacy/locales/deDE.js +0 -101
- package/legacy/locales/elGR.js +0 -100
- package/legacy/locales/enUS.js +0 -96
- package/legacy/locales/esES.js +0 -99
- package/legacy/locales/eu.js +0 -99
- package/legacy/locales/faIR.js +0 -100
- package/legacy/locales/fiFI.js +0 -100
- package/legacy/locales/frFR.js +0 -98
- package/legacy/locales/heIL.js +0 -100
- package/legacy/locales/huHU.js +0 -99
- package/legacy/locales/index.js +0 -35
- package/legacy/locales/isIS.js +0 -100
- package/legacy/locales/itIT.js +0 -98
- package/legacy/locales/jaJP.js +0 -102
- package/legacy/locales/koKR.js +0 -98
- package/legacy/locales/kzKZ.js +0 -99
- package/legacy/locales/mk.js +0 -96
- package/legacy/locales/nbNO.js +0 -100
- package/legacy/locales/nlNL.js +0 -100
- package/legacy/locales/plPL.js +0 -85
- package/legacy/locales/ptBR.js +0 -100
- package/legacy/locales/roRO.js +0 -99
- package/legacy/locales/ruRU.js +0 -98
- package/legacy/locales/skSK.js +0 -100
- package/legacy/locales/svSE.js +0 -85
- package/legacy/locales/trTR.js +0 -100
- package/legacy/locales/ukUA.js +0 -100
- package/legacy/locales/urPK.js +0 -85
- package/legacy/locales/utils/getPickersLocalization.js +0 -12
- package/legacy/locales/utils/pickersLocaleTextApi.js +0 -1
- package/legacy/locales/viVN.js +0 -100
- package/legacy/locales/zhCN.js +0 -100
- package/legacy/locales/zhHK.js +0 -100
- package/legacy/models/adapters.js +0 -1
- package/legacy/models/common.js +0 -1
- package/legacy/models/fields.js +0 -1
- package/legacy/models/index.js +0 -7
- package/legacy/models/pickers.js +0 -1
- package/legacy/models/timezone.js +0 -1
- package/legacy/models/validation.js +0 -1
- package/legacy/models/views.js +0 -1
- package/legacy/themeAugmentation/index.js +0 -3
- package/legacy/timeViewRenderers/index.js +0 -1
- package/legacy/timeViewRenderers/timeViewRenderers.js +0 -186
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapter, TimezoneProps, FieldSectionContentType, FieldValueType, PickersTimezone, PickerValidDate } from '../../../models';
|
|
2
|
+
import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapter, TimezoneProps, FieldSectionContentType, FieldValueType, PickersTimezone, PickerValidDate, FieldRef } from '../../../models';
|
|
3
3
|
import type { PickerValueManager } from '../usePicker';
|
|
4
4
|
import { InferError, Validator } from '../useValidation';
|
|
5
|
-
|
|
5
|
+
import type { UseFieldStateResponse } from './useFieldState';
|
|
6
|
+
import type { UseFieldCharacterEditingResponse } from './useFieldCharacterEditing';
|
|
7
|
+
import { PickersSectionElement, PickersSectionListRef } from '../../../PickersSectionList';
|
|
8
|
+
import { ExportedUseClearableFieldProps } from '../../../hooks/useClearableField';
|
|
9
|
+
export interface UseFieldParams<TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends UseFieldCommonForwardedProps & UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure>, TInternalProps extends UseFieldInternalProps<any, any, any, TEnableAccessibleFieldDOMStructure, any>> {
|
|
6
10
|
forwardedProps: TForwardedProps;
|
|
7
11
|
internalProps: TInternalProps;
|
|
8
12
|
valueManager: PickerValueManager<TValue, TDate, InferError<TInternalProps>>;
|
|
@@ -10,7 +14,7 @@ export interface UseFieldParams<TValue, TDate extends PickerValidDate, TSection
|
|
|
10
14
|
validator: Validator<TValue, TDate, InferError<TInternalProps>, UseFieldValidationProps<TValue, TInternalProps>>;
|
|
11
15
|
valueType: FieldValueType;
|
|
12
16
|
}
|
|
13
|
-
export interface UseFieldInternalProps<TValue, TDate extends PickerValidDate, TSection extends FieldSection, TError> extends TimezoneProps {
|
|
17
|
+
export interface UseFieldInternalProps<TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends TimezoneProps {
|
|
14
18
|
/**
|
|
15
19
|
* The selected value.
|
|
16
20
|
* Used when the component is controlled.
|
|
@@ -75,11 +79,11 @@ export interface UseFieldInternalProps<TValue, TDate extends PickerValidDate, TS
|
|
|
75
79
|
readOnly?: boolean;
|
|
76
80
|
/**
|
|
77
81
|
* The currently selected sections.
|
|
78
|
-
* This prop
|
|
82
|
+
* This prop accepts four formats:
|
|
79
83
|
* 1. If a number is provided, the section at this index will be selected.
|
|
80
|
-
* 2. If
|
|
81
|
-
* 3. If
|
|
82
|
-
* 4. If `null` is provided, no section will be selected
|
|
84
|
+
* 2. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
|
|
85
|
+
* 3. If `"all"` is provided, all the sections will be selected.
|
|
86
|
+
* 4. If `null` is provided, no section will be selected.
|
|
83
87
|
* If not provided, the selected sections will be handled internally.
|
|
84
88
|
*/
|
|
85
89
|
selectedSections?: FieldSelectedSections;
|
|
@@ -93,60 +97,59 @@ export interface UseFieldInternalProps<TValue, TDate extends PickerValidDate, TS
|
|
|
93
97
|
*/
|
|
94
98
|
unstableFieldRef?: React.Ref<FieldRef<TSection>>;
|
|
95
99
|
/**
|
|
96
|
-
*
|
|
100
|
+
* @default false
|
|
97
101
|
*/
|
|
98
|
-
|
|
102
|
+
enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
|
|
99
103
|
/**
|
|
100
|
-
* If `true`,
|
|
104
|
+
* If `true`, the `input` element is focused during the first mount.
|
|
101
105
|
* @default false
|
|
102
106
|
*/
|
|
103
|
-
|
|
107
|
+
autoFocus?: boolean;
|
|
104
108
|
/**
|
|
105
109
|
* If `true`, the component is disabled.
|
|
106
110
|
* @default false
|
|
107
111
|
*/
|
|
108
112
|
disabled?: boolean;
|
|
109
113
|
}
|
|
110
|
-
export interface
|
|
111
|
-
/**
|
|
112
|
-
* Returns the sections of the current value.
|
|
113
|
-
* @returns {TSection[]} The sections of the current value.
|
|
114
|
-
*/
|
|
115
|
-
getSections: () => TSection[];
|
|
116
|
-
/**
|
|
117
|
-
* Returns the index of the active section (the first focused section).
|
|
118
|
-
* If no section is active, returns `null`.
|
|
119
|
-
* @returns {number | null} The index of the active section.
|
|
120
|
-
*/
|
|
121
|
-
getActiveSectionIndex: () => number | null;
|
|
122
|
-
/**
|
|
123
|
-
* Updates the selected sections.
|
|
124
|
-
* @param {FieldSelectedSections} selectedSections The sections to select.
|
|
125
|
-
*/
|
|
126
|
-
setSelectedSections: (selectedSections: FieldSelectedSections) => void;
|
|
114
|
+
export interface UseFieldCommonAdditionalProps extends Required<Pick<UseFieldInternalProps<any, any, any, any, any>, 'disabled' | 'readOnly'>> {
|
|
127
115
|
}
|
|
128
|
-
export interface
|
|
129
|
-
inputRef?: React.Ref<HTMLInputElement>;
|
|
116
|
+
export interface UseFieldCommonForwardedProps extends ExportedUseClearableFieldProps {
|
|
130
117
|
onKeyDown?: React.KeyboardEventHandler;
|
|
131
|
-
|
|
132
|
-
|
|
118
|
+
error?: boolean;
|
|
119
|
+
}
|
|
120
|
+
export type UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure extends boolean> = UseFieldCommonForwardedProps & (TEnableAccessibleFieldDOMStructure extends false ? UseFieldV6ForwardedProps : UseFieldV7ForwardedProps);
|
|
121
|
+
export interface UseFieldV6ForwardedProps {
|
|
122
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
123
|
+
onBlur?: () => void;
|
|
133
124
|
onClick?: React.MouseEventHandler;
|
|
134
125
|
onFocus?: () => void;
|
|
126
|
+
onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
|
|
127
|
+
}
|
|
128
|
+
interface UseFieldV6AdditionalProps extends Required<Pick<React.InputHTMLAttributes<HTMLInputElement>, 'inputMode' | 'placeholder' | 'value' | 'onChange' | 'autoComplete'>> {
|
|
129
|
+
enableAccessibleFieldDOMStructure: false;
|
|
130
|
+
}
|
|
131
|
+
export interface UseFieldV7ForwardedProps {
|
|
132
|
+
focused?: boolean;
|
|
133
|
+
autoFocus?: boolean;
|
|
134
|
+
sectionListRef?: React.Ref<PickersSectionListRef>;
|
|
135
135
|
onBlur?: () => void;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
onClick?: React.MouseEventHandler;
|
|
137
|
+
onFocus?: () => void;
|
|
138
|
+
onInput?: React.FormEventHandler<HTMLDivElement>;
|
|
139
|
+
onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
interface UseFieldV7AdditionalProps {
|
|
142
|
+
enableAccessibleFieldDOMStructure: true;
|
|
143
|
+
elements: PickersSectionElement[];
|
|
144
|
+
tabIndex: number | undefined;
|
|
145
|
+
contentEditable: boolean;
|
|
143
146
|
value: string;
|
|
144
147
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
areAllSectionsEmpty: boolean;
|
|
149
|
+
}
|
|
150
|
+
export type UseFieldResponse<TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends UseFieldCommonForwardedProps & {
|
|
151
|
+
[key: string]: any;
|
|
152
|
+
}> = Omit<TForwardedProps, keyof UseFieldCommonForwardedProps> & Required<UseFieldCommonForwardedProps> & UseFieldCommonAdditionalProps & (TEnableAccessibleFieldDOMStructure extends false ? UseFieldV6AdditionalProps & Required<UseFieldV6ForwardedProps> : UseFieldV7AdditionalProps & Required<UseFieldV7ForwardedProps>);
|
|
150
153
|
export type FieldSectionValueBoundaries<TDate extends PickerValidDate, SectionType extends FieldSectionType> = {
|
|
151
154
|
minimum: number;
|
|
152
155
|
maximum: number;
|
|
@@ -160,6 +163,12 @@ export type FieldSectionsValueBoundaries<TDate extends PickerValidDate> = {
|
|
|
160
163
|
contentType: FieldSectionContentType;
|
|
161
164
|
}) => FieldSectionValueBoundaries<TDate, SectionType>;
|
|
162
165
|
};
|
|
166
|
+
export type FieldSectionsBoundaries = {
|
|
167
|
+
[SectionType in FieldSectionType]: {
|
|
168
|
+
minimum: number;
|
|
169
|
+
maximum: number;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
163
172
|
export type FieldChangeHandler<TValue, TError> = (value: TValue, context: FieldChangeHandlerContext<TError>) => void;
|
|
164
173
|
export interface FieldChangeHandlerContext<TError> {
|
|
165
174
|
validationError: TError;
|
|
@@ -192,14 +201,7 @@ interface FieldActiveDateManager<TValue, TDate extends PickerValidDate, TSection
|
|
|
192
201
|
*/
|
|
193
202
|
getNewValuesFromNewActiveDate: (newActiveDate: TDate | null) => Pick<UseFieldState<TValue, any>, 'value' | 'referenceValue'>;
|
|
194
203
|
}
|
|
195
|
-
export type
|
|
196
|
-
startIndex: number;
|
|
197
|
-
endIndex: number;
|
|
198
|
-
/**
|
|
199
|
-
* If `true`, the selectors at the very beginning and very end of the input will be selected.
|
|
200
|
-
*/
|
|
201
|
-
shouldSelectBoundarySelectors: boolean;
|
|
202
|
-
};
|
|
204
|
+
export type FieldParsedSelectedSections = number | 'all' | null;
|
|
203
205
|
export interface FieldValueManager<TValue, TDate extends PickerValidDate, TSection extends FieldSection> {
|
|
204
206
|
/**
|
|
205
207
|
* Creates the section list from the current value.
|
|
@@ -208,12 +210,10 @@ export interface FieldValueManager<TValue, TDate extends PickerValidDate, TSecti
|
|
|
208
210
|
* @param {MuiPickersAdapter<TDate>} utils The utils to manipulate the date.
|
|
209
211
|
* @param {TValue} value The current value to generate sections from.
|
|
210
212
|
* @param {TSection[] | null} fallbackSections The sections to use as a fallback if a date is null or invalid.
|
|
211
|
-
* @param {
|
|
212
|
-
* @param {boolean} isRTL `true` if the direction is "right to left".
|
|
213
|
-
* @param {(date: TDate) => FieldSectionWithoutPosition[]} getSectionsFromDate Returns the sections of the given date.
|
|
213
|
+
* @param {(date: TDate) => FieldSection[]} getSectionsFromDate Returns the sections of the given date.
|
|
214
214
|
* @returns {TSection[]} The new section list.
|
|
215
215
|
*/
|
|
216
|
-
getSectionsFromValue: (utils: MuiPickersAdapter<TDate>, value: TValue, fallbackSections: TSection[] | null,
|
|
216
|
+
getSectionsFromValue: (utils: MuiPickersAdapter<TDate>, value: TValue, fallbackSections: TSection[] | null, getSectionsFromDate: (date: TDate) => FieldSection[]) => TSection[];
|
|
217
217
|
/**
|
|
218
218
|
* Creates the string value to render in the input based on the current section list.
|
|
219
219
|
* @template TSection
|
|
@@ -222,7 +222,14 @@ export interface FieldValueManager<TValue, TDate extends PickerValidDate, TSecti
|
|
|
222
222
|
* @param {boolean} isRTL `true` if the current orientation is "right to left"
|
|
223
223
|
* @returns {string} The string value to render in the input.
|
|
224
224
|
*/
|
|
225
|
-
|
|
225
|
+
getV6InputValueFromSections: (sections: TSection[], localizedDigits: string[], isRTL: boolean) => string;
|
|
226
|
+
/**
|
|
227
|
+
* Creates the string value to render in the input based on the current section list.
|
|
228
|
+
* @template TSection
|
|
229
|
+
* @param {TSection[]} sections The current section list.
|
|
230
|
+
* @returns {string} The string value to render in the input.
|
|
231
|
+
*/
|
|
232
|
+
getV7HiddenInputValueFromSections: (sections: TSection[]) => string;
|
|
226
233
|
/**
|
|
227
234
|
* Returns the manager of the active date.
|
|
228
235
|
* @template TValue, TDate, TSection
|
|
@@ -316,4 +323,33 @@ export type SectionOrdering = {
|
|
|
316
323
|
*/
|
|
317
324
|
endIndex: number;
|
|
318
325
|
};
|
|
326
|
+
export interface UseFieldTextFieldInteractions {
|
|
327
|
+
/**
|
|
328
|
+
* Select the correct sections in the DOM according to the sections currently selected in state.
|
|
329
|
+
*/
|
|
330
|
+
syncSelectionToDOM: () => void;
|
|
331
|
+
/**
|
|
332
|
+
* Returns the index of the active section (the first focused section).
|
|
333
|
+
* If no section is active, returns `null`.
|
|
334
|
+
* @returns {number | null} The index of the active section.
|
|
335
|
+
*/
|
|
336
|
+
getActiveSectionIndexFromDOM: () => number | null;
|
|
337
|
+
/**
|
|
338
|
+
* Focuses the field.
|
|
339
|
+
* @param {number | FieldSectionType} newSelectedSection The section to select once focused.
|
|
340
|
+
*/
|
|
341
|
+
focusField: (newSelectedSection?: number | FieldSectionType) => void;
|
|
342
|
+
setSelectedSections: (newSelectedSections: FieldSelectedSections) => void;
|
|
343
|
+
isFieldFocused: () => boolean;
|
|
344
|
+
}
|
|
345
|
+
export type UseFieldTextField<TEnableAccessibleFieldDOMStructure extends boolean> = <TValue, TDate extends PickerValidDate, TSection extends FieldSection, TForwardedProps extends TEnableAccessibleFieldDOMStructure extends false ? UseFieldV6ForwardedProps : UseFieldV7ForwardedProps, TInternalProps extends UseFieldInternalProps<any, any, any, TEnableAccessibleFieldDOMStructure, any> & {
|
|
346
|
+
minutesStep?: number;
|
|
347
|
+
}>(params: UseFieldTextFieldParams<TValue, TDate, TSection, TEnableAccessibleFieldDOMStructure, TForwardedProps, TInternalProps>) => {
|
|
348
|
+
interactions: UseFieldTextFieldInteractions;
|
|
349
|
+
returnedValue: TEnableAccessibleFieldDOMStructure extends false ? UseFieldV6AdditionalProps & Required<UseFieldV6ForwardedProps> : UseFieldV7AdditionalProps & Required<UseFieldV7ForwardedProps>;
|
|
350
|
+
};
|
|
351
|
+
interface UseFieldTextFieldParams<TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends TEnableAccessibleFieldDOMStructure extends false ? UseFieldV6ForwardedProps : UseFieldV7ForwardedProps, TInternalProps extends UseFieldInternalProps<any, any, any, TEnableAccessibleFieldDOMStructure, any>> extends UseFieldParams<TValue, TDate, TSection, TEnableAccessibleFieldDOMStructure, TForwardedProps, TInternalProps>, UseFieldStateResponse<TValue, TDate, TSection>, UseFieldCharacterEditingResponse {
|
|
352
|
+
areAllSectionsEmpty: boolean;
|
|
353
|
+
sectionOrder: SectionOrdering;
|
|
354
|
+
}
|
|
319
355
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { AvailableAdjustKeyCode, FieldSectionsValueBoundaries, SectionOrdering,
|
|
2
|
-
import { FieldSectionType, FieldValueType, FieldSection, MuiPickersAdapter, FieldSectionContentType, PickersTimezone, PickerValidDate } from '../../../models';
|
|
3
|
-
import { PickersLocaleText } from '../../../locales/utils/pickersLocaleTextApi';
|
|
1
|
+
import { AvailableAdjustKeyCode, FieldSectionsValueBoundaries, SectionOrdering, FieldSectionValueBoundaries, FieldParsedSelectedSections } from './useField.types';
|
|
2
|
+
import { FieldSectionType, FieldValueType, FieldSection, MuiPickersAdapter, FieldSectionContentType, PickersTimezone, PickerValidDate, FieldSelectedSections } from '../../../models';
|
|
4
3
|
export declare const getDateSectionConfigFromFormatToken: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate, any>, formatToken: string) => Pick<FieldSection, 'type' | 'contentType'> & {
|
|
5
4
|
maxLength: number | undefined;
|
|
6
5
|
};
|
|
@@ -21,20 +20,21 @@ export declare const cleanDigitSectionValue: <TDate extends PickerValidDate>(uti
|
|
|
21
20
|
export declare const adjustSectionValue: <TDate extends PickerValidDate, TSection extends FieldSection>(utils: MuiPickersAdapter<TDate, any>, timezone: PickersTimezone, section: TSection, keyCode: AvailableAdjustKeyCode, sectionsValueBoundaries: FieldSectionsValueBoundaries<TDate>, localizedDigits: string[], activeDate: TDate | null, stepsAttributes?: {
|
|
22
21
|
minutesStep?: number;
|
|
23
22
|
}) => string;
|
|
24
|
-
export declare const getSectionVisibleValue: (section:
|
|
25
|
-
export declare const cleanString: (dirtyString: string) => string;
|
|
26
|
-
export declare const addPositionPropertiesToSections: <TSection extends FieldSection>(sections: FieldSectionWithoutPosition<TSection>[], localizedDigits: string[], isRTL: boolean) => TSection[];
|
|
23
|
+
export declare const getSectionVisibleValue: (section: FieldSection, target: 'input-rtl' | 'input-ltr' | 'non-input', localizedDigits: string[]) => string;
|
|
27
24
|
export declare const changeSectionValueFormat: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate, any>, valueStr: string, currentFormat: string, newFormat: string) => string;
|
|
28
25
|
export declare const doesSectionFormatHaveLeadingZeros: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate, any>, timezone: PickersTimezone, contentType: FieldSectionContentType, sectionType: FieldSectionType, format: string) => boolean;
|
|
29
|
-
export declare const splitFormatIntoSections: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate, any>, timezone: PickersTimezone, localeText: PickersLocaleText<TDate>, localizedDigits: string[], format: string, date: TDate | null, formatDensity: 'dense' | 'spacious', shouldRespectLeadingZeros: boolean, isRTL: boolean) => FieldSectionWithoutPosition[];
|
|
30
26
|
/**
|
|
31
27
|
* Some date libraries like `dayjs` don't support parsing from date with escaped characters.
|
|
32
28
|
* To make sure that the parsing works, we are building a format and a date without any separator.
|
|
33
29
|
*/
|
|
34
30
|
export declare const getDateFromDateSections: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate, any>, sections: FieldSection[], localizedDigits: string[]) => TDate;
|
|
35
|
-
export declare const
|
|
31
|
+
export declare const createDateStrForV7HiddenInputFromSections: (sections: FieldSection[]) => string;
|
|
32
|
+
export declare const createDateStrForV6InputFromSections: (sections: FieldSection[], localizedDigits: string[], isRTL: boolean) => string;
|
|
36
33
|
export declare const getSectionsBoundaries: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate, any>, localizedDigits: string[], timezone: PickersTimezone) => FieldSectionsValueBoundaries<TDate>;
|
|
37
34
|
export declare const validateSections: <TSection extends FieldSection>(sections: TSection[], valueType: FieldValueType) => void;
|
|
38
|
-
export declare const mergeDateIntoReferenceDate: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate, any>, timezone: PickersTimezone, dateToTransferFrom: TDate, sections:
|
|
35
|
+
export declare const mergeDateIntoReferenceDate: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate, any>, timezone: PickersTimezone, dateToTransferFrom: TDate, sections: FieldSection[], referenceDate: TDate, shouldLimitToEditedSections: boolean) => TDate;
|
|
39
36
|
export declare const isAndroid: () => boolean;
|
|
40
|
-
export declare const getSectionOrder: (sections:
|
|
37
|
+
export declare const getSectionOrder: (sections: FieldSection[], shouldApplyRTL: boolean) => SectionOrdering;
|
|
38
|
+
export declare const parseSelectedSections: (selectedSections: FieldSelectedSections, sections: FieldSection[]) => FieldParsedSelectedSections;
|
|
39
|
+
export declare const getSectionValueText: <TDate extends PickerValidDate>(section: FieldSection, utils: MuiPickersAdapter<TDate, any>) => string | undefined;
|
|
40
|
+
export declare const getSectionValueNow: <TDate extends PickerValidDate>(section: FieldSection, utils: MuiPickersAdapter<TDate, any>) => number | undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { getMonthsInYear } from '../../utils/date-utils';
|
|
3
2
|
export const getDateSectionConfigFromFormatToken = (utils, formatToken) => {
|
|
4
3
|
const config = utils.formatTokenMap[formatToken];
|
|
@@ -225,93 +224,6 @@ export const getSectionVisibleValue = (section, target, localizedDigits) => {
|
|
|
225
224
|
}
|
|
226
225
|
return value;
|
|
227
226
|
};
|
|
228
|
-
export const cleanString = dirtyString => dirtyString.replace(/[\u2066\u2067\u2068\u2069]/g, '');
|
|
229
|
-
export const addPositionPropertiesToSections = (sections, localizedDigits, isRTL) => {
|
|
230
|
-
let position = 0;
|
|
231
|
-
let positionInInput = isRTL ? 1 : 0;
|
|
232
|
-
const newSections = [];
|
|
233
|
-
for (let i = 0; i < sections.length; i += 1) {
|
|
234
|
-
const section = sections[i];
|
|
235
|
-
const renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
236
|
-
const sectionStr = `${section.startSeparator}${renderedValue}${section.endSeparator}`;
|
|
237
|
-
const sectionLength = cleanString(sectionStr).length;
|
|
238
|
-
const sectionLengthInInput = sectionStr.length;
|
|
239
|
-
|
|
240
|
-
// The ...InInput values consider the unicode characters but do include them in their indexes
|
|
241
|
-
const cleanedValue = cleanString(renderedValue);
|
|
242
|
-
const startInInput = positionInInput + (cleanedValue === '' ? 0 : renderedValue.indexOf(cleanedValue[0])) + section.startSeparator.length;
|
|
243
|
-
const endInInput = startInInput + cleanedValue.length;
|
|
244
|
-
newSections.push(_extends({}, section, {
|
|
245
|
-
start: position,
|
|
246
|
-
end: position + sectionLength,
|
|
247
|
-
startInInput,
|
|
248
|
-
endInInput
|
|
249
|
-
}));
|
|
250
|
-
position += sectionLength;
|
|
251
|
-
// Move position to the end of string associated to the current section
|
|
252
|
-
positionInInput += sectionLengthInInput;
|
|
253
|
-
}
|
|
254
|
-
return newSections;
|
|
255
|
-
};
|
|
256
|
-
const getSectionPlaceholder = (utils, timezone, localeText, sectionConfig, sectionFormat) => {
|
|
257
|
-
switch (sectionConfig.type) {
|
|
258
|
-
case 'year':
|
|
259
|
-
{
|
|
260
|
-
return localeText.fieldYearPlaceholder({
|
|
261
|
-
digitAmount: utils.formatByString(utils.date(undefined, timezone), sectionFormat).length,
|
|
262
|
-
format: sectionFormat
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
case 'month':
|
|
266
|
-
{
|
|
267
|
-
return localeText.fieldMonthPlaceholder({
|
|
268
|
-
contentType: sectionConfig.contentType,
|
|
269
|
-
format: sectionFormat
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
case 'day':
|
|
273
|
-
{
|
|
274
|
-
return localeText.fieldDayPlaceholder({
|
|
275
|
-
format: sectionFormat
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
case 'weekDay':
|
|
279
|
-
{
|
|
280
|
-
return localeText.fieldWeekDayPlaceholder({
|
|
281
|
-
contentType: sectionConfig.contentType,
|
|
282
|
-
format: sectionFormat
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
case 'hours':
|
|
286
|
-
{
|
|
287
|
-
return localeText.fieldHoursPlaceholder({
|
|
288
|
-
format: sectionFormat
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
case 'minutes':
|
|
292
|
-
{
|
|
293
|
-
return localeText.fieldMinutesPlaceholder({
|
|
294
|
-
format: sectionFormat
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
case 'seconds':
|
|
298
|
-
{
|
|
299
|
-
return localeText.fieldSecondsPlaceholder({
|
|
300
|
-
format: sectionFormat
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
case 'meridiem':
|
|
304
|
-
{
|
|
305
|
-
return localeText.fieldMeridiemPlaceholder({
|
|
306
|
-
format: sectionFormat
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
default:
|
|
310
|
-
{
|
|
311
|
-
return sectionFormat;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
227
|
export const changeSectionValueFormat = (utils, valueStr, currentFormat, newFormat) => {
|
|
316
228
|
if (process.env.NODE_ENV !== 'production') {
|
|
317
229
|
if (getDateSectionConfigFromFormatToken(utils, currentFormat).type === 'weekDay') {
|
|
@@ -367,142 +279,6 @@ export const doesSectionFormatHaveLeadingZeros = (utils, timezone, contentType,
|
|
|
367
279
|
}
|
|
368
280
|
}
|
|
369
281
|
};
|
|
370
|
-
const getEscapedPartsFromFormat = (utils, format) => {
|
|
371
|
-
const escapedParts = [];
|
|
372
|
-
const {
|
|
373
|
-
start: startChar,
|
|
374
|
-
end: endChar
|
|
375
|
-
} = utils.escapedCharacters;
|
|
376
|
-
const regExp = new RegExp(`(\\${startChar}[^\\${endChar}]*\\${endChar})+`, 'g');
|
|
377
|
-
let match = null;
|
|
378
|
-
// eslint-disable-next-line no-cond-assign
|
|
379
|
-
while (match = regExp.exec(format)) {
|
|
380
|
-
escapedParts.push({
|
|
381
|
-
start: match.index,
|
|
382
|
-
end: regExp.lastIndex - 1
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
return escapedParts;
|
|
386
|
-
};
|
|
387
|
-
export const splitFormatIntoSections = (utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL) => {
|
|
388
|
-
let startSeparator = '';
|
|
389
|
-
const sections = [];
|
|
390
|
-
const now = utils.date();
|
|
391
|
-
const commitToken = token => {
|
|
392
|
-
if (token === '') {
|
|
393
|
-
return null;
|
|
394
|
-
}
|
|
395
|
-
const sectionConfig = getDateSectionConfigFromFormatToken(utils, token);
|
|
396
|
-
const hasLeadingZerosInFormat = doesSectionFormatHaveLeadingZeros(utils, timezone, sectionConfig.contentType, sectionConfig.type, token);
|
|
397
|
-
const hasLeadingZerosInInput = shouldRespectLeadingZeros ? hasLeadingZerosInFormat : sectionConfig.contentType === 'digit';
|
|
398
|
-
const isValidDate = date != null && utils.isValid(date);
|
|
399
|
-
let sectionValue = isValidDate ? utils.formatByString(date, token) : '';
|
|
400
|
-
let maxLength = null;
|
|
401
|
-
if (hasLeadingZerosInInput) {
|
|
402
|
-
if (hasLeadingZerosInFormat) {
|
|
403
|
-
maxLength = sectionValue === '' ? utils.formatByString(now, token).length : sectionValue.length;
|
|
404
|
-
} else {
|
|
405
|
-
if (sectionConfig.maxLength == null) {
|
|
406
|
-
throw new Error(`MUI X: The token ${token} should have a 'maxDigitNumber' property on it's adapter`);
|
|
407
|
-
}
|
|
408
|
-
maxLength = sectionConfig.maxLength;
|
|
409
|
-
if (isValidDate) {
|
|
410
|
-
sectionValue = applyLocalizedDigits(cleanLeadingZeros(removeLocalizedDigits(sectionValue, localizedDigits), maxLength), localizedDigits);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
sections.push(_extends({}, sectionConfig, {
|
|
415
|
-
format: token,
|
|
416
|
-
maxLength,
|
|
417
|
-
value: sectionValue,
|
|
418
|
-
placeholder: getSectionPlaceholder(utils, timezone, localeText, sectionConfig, token),
|
|
419
|
-
hasLeadingZerosInFormat,
|
|
420
|
-
hasLeadingZerosInInput,
|
|
421
|
-
startSeparator: sections.length === 0 ? startSeparator : '',
|
|
422
|
-
endSeparator: '',
|
|
423
|
-
modified: false
|
|
424
|
-
}));
|
|
425
|
-
return null;
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
// Expand the provided format
|
|
429
|
-
let formatExpansionOverflow = 10;
|
|
430
|
-
let prevFormat = format;
|
|
431
|
-
let nextFormat = utils.expandFormat(format);
|
|
432
|
-
while (nextFormat !== prevFormat) {
|
|
433
|
-
prevFormat = nextFormat;
|
|
434
|
-
nextFormat = utils.expandFormat(prevFormat);
|
|
435
|
-
formatExpansionOverflow -= 1;
|
|
436
|
-
if (formatExpansionOverflow < 0) {
|
|
437
|
-
throw new Error('MUI X: The format expansion seems to be enter in an infinite loop. Please open an issue with the format passed to the picker component.');
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
const expandedFormat = nextFormat;
|
|
441
|
-
|
|
442
|
-
// Get start/end indexes of escaped sections
|
|
443
|
-
const escapedParts = getEscapedPartsFromFormat(utils, expandedFormat);
|
|
444
|
-
|
|
445
|
-
// This RegExp test if the beginning of a string correspond to a supported token
|
|
446
|
-
const isTokenStartRegExp = new RegExp(`^(${Object.keys(utils.formatTokenMap).sort((a, b) => b.length - a.length) // Sort to put longest word first
|
|
447
|
-
.join('|')})`, 'g') // used to get access to lastIndex state
|
|
448
|
-
;
|
|
449
|
-
let currentTokenValue = '';
|
|
450
|
-
for (let i = 0; i < expandedFormat.length; i += 1) {
|
|
451
|
-
const escapedPartOfCurrentChar = escapedParts.find(escapeIndex => escapeIndex.start <= i && escapeIndex.end >= i);
|
|
452
|
-
const char = expandedFormat[i];
|
|
453
|
-
const isEscapedChar = escapedPartOfCurrentChar != null;
|
|
454
|
-
const potentialToken = `${currentTokenValue}${expandedFormat.slice(i)}`;
|
|
455
|
-
const regExpMatch = isTokenStartRegExp.test(potentialToken);
|
|
456
|
-
if (!isEscapedChar && char.match(/([A-Za-z]+)/) && regExpMatch) {
|
|
457
|
-
currentTokenValue = potentialToken.slice(0, isTokenStartRegExp.lastIndex);
|
|
458
|
-
i += isTokenStartRegExp.lastIndex - 1;
|
|
459
|
-
} else {
|
|
460
|
-
// If we are on the opening or closing character of an escaped part of the format,
|
|
461
|
-
// Then we ignore this character.
|
|
462
|
-
const isEscapeBoundary = isEscapedChar && (escapedPartOfCurrentChar == null ? void 0 : escapedPartOfCurrentChar.start) === i || (escapedPartOfCurrentChar == null ? void 0 : escapedPartOfCurrentChar.end) === i;
|
|
463
|
-
if (!isEscapeBoundary) {
|
|
464
|
-
commitToken(currentTokenValue);
|
|
465
|
-
currentTokenValue = '';
|
|
466
|
-
if (sections.length === 0) {
|
|
467
|
-
startSeparator += char;
|
|
468
|
-
} else {
|
|
469
|
-
sections[sections.length - 1].endSeparator += char;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
commitToken(currentTokenValue);
|
|
475
|
-
if (sections.length === 0 && startSeparator.length > 0) {
|
|
476
|
-
sections.push({
|
|
477
|
-
type: 'empty',
|
|
478
|
-
contentType: 'letter',
|
|
479
|
-
maxLength: null,
|
|
480
|
-
format: '',
|
|
481
|
-
value: '',
|
|
482
|
-
placeholder: '',
|
|
483
|
-
hasLeadingZerosInFormat: false,
|
|
484
|
-
hasLeadingZerosInInput: false,
|
|
485
|
-
startSeparator,
|
|
486
|
-
endSeparator: '',
|
|
487
|
-
modified: false
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
return sections.map(section => {
|
|
491
|
-
const cleanSeparator = separator => {
|
|
492
|
-
let cleanedSeparator = separator;
|
|
493
|
-
if (isRTL && cleanedSeparator !== null && cleanedSeparator.includes(' ')) {
|
|
494
|
-
cleanedSeparator = `\u2069${cleanedSeparator}\u2066`;
|
|
495
|
-
}
|
|
496
|
-
if (formatDensity === 'spacious' && ['/', '.', '-'].includes(cleanedSeparator)) {
|
|
497
|
-
cleanedSeparator = ` ${cleanedSeparator} `;
|
|
498
|
-
}
|
|
499
|
-
return cleanedSeparator;
|
|
500
|
-
};
|
|
501
|
-
section.startSeparator = cleanSeparator(section.startSeparator);
|
|
502
|
-
section.endSeparator = cleanSeparator(section.endSeparator);
|
|
503
|
-
return section;
|
|
504
|
-
});
|
|
505
|
-
};
|
|
506
282
|
|
|
507
283
|
/**
|
|
508
284
|
* Some date libraries like `dayjs` don't support parsing from date with escaped characters.
|
|
@@ -527,7 +303,10 @@ export const getDateFromDateSections = (utils, sections, localizedDigits) => {
|
|
|
527
303
|
const dateWithoutSeparatorStr = sectionValues.join(' ');
|
|
528
304
|
return utils.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
|
|
529
305
|
};
|
|
530
|
-
export const
|
|
306
|
+
export const createDateStrForV7HiddenInputFromSections = sections => sections.map(section => {
|
|
307
|
+
return `${section.startSeparator}${section.value || section.placeholder}${section.endSeparator}`;
|
|
308
|
+
}).join('');
|
|
309
|
+
export const createDateStrForV6InputFromSections = (sections, localizedDigits, isRTL) => {
|
|
531
310
|
const formattedSections = sections.map(section => {
|
|
532
311
|
const dateValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
533
312
|
return `${section.startSeparator}${dateValue}${section.endSeparator}`;
|
|
@@ -627,7 +406,7 @@ export const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
|
|
|
627
406
|
}),
|
|
628
407
|
meridiem: () => ({
|
|
629
408
|
minimum: 0,
|
|
630
|
-
maximum:
|
|
409
|
+
maximum: 1
|
|
631
410
|
}),
|
|
632
411
|
empty: () => ({
|
|
633
412
|
minimum: 0,
|
|
@@ -727,9 +506,11 @@ export const mergeDateIntoReferenceDate = (utils, timezone, dateToTransferFrom,
|
|
|
727
506
|
return mergedDate;
|
|
728
507
|
}, referenceDate);
|
|
729
508
|
export const isAndroid = () => navigator.userAgent.toLowerCase().indexOf('android') > -1;
|
|
730
|
-
|
|
509
|
+
|
|
510
|
+
// TODO v8: Remove if we drop the v6 TextField approach.
|
|
511
|
+
export const getSectionOrder = (sections, shouldApplyRTL) => {
|
|
731
512
|
const neighbors = {};
|
|
732
|
-
if (!
|
|
513
|
+
if (!shouldApplyRTL) {
|
|
733
514
|
sections.forEach((_, index) => {
|
|
734
515
|
const leftIndex = index === 0 ? null : index - 1;
|
|
735
516
|
const rightIndex = index === sections.length - 1 ? null : index + 1;
|
|
@@ -782,4 +563,73 @@ export const getSectionOrder = (sections, isRTL) => {
|
|
|
782
563
|
startIndex: rtl2ltr[0],
|
|
783
564
|
endIndex: rtl2ltr[sections.length - 1]
|
|
784
565
|
};
|
|
566
|
+
};
|
|
567
|
+
export const parseSelectedSections = (selectedSections, sections) => {
|
|
568
|
+
if (selectedSections == null) {
|
|
569
|
+
return null;
|
|
570
|
+
}
|
|
571
|
+
if (selectedSections === 'all') {
|
|
572
|
+
return 'all';
|
|
573
|
+
}
|
|
574
|
+
if (typeof selectedSections === 'string') {
|
|
575
|
+
return sections.findIndex(section => section.type === selectedSections);
|
|
576
|
+
}
|
|
577
|
+
return selectedSections;
|
|
578
|
+
};
|
|
579
|
+
export const getSectionValueText = (section, utils) => {
|
|
580
|
+
if (!section.value) {
|
|
581
|
+
return undefined;
|
|
582
|
+
}
|
|
583
|
+
switch (section.type) {
|
|
584
|
+
case 'month':
|
|
585
|
+
{
|
|
586
|
+
if (section.contentType === 'digit') {
|
|
587
|
+
return utils.format(utils.setMonth(utils.date(), Number(section.value) - 1), 'month');
|
|
588
|
+
}
|
|
589
|
+
const parsedDate = utils.parse(section.value, section.format);
|
|
590
|
+
return parsedDate ? utils.format(parsedDate, 'month') : undefined;
|
|
591
|
+
}
|
|
592
|
+
case 'day':
|
|
593
|
+
return section.contentType === 'digit' ? utils.format(utils.setDate(utils.startOfYear(utils.date()), Number(section.value)), 'dayOfMonthFull') : section.value;
|
|
594
|
+
case 'weekDay':
|
|
595
|
+
// TODO: improve by providing the label of the week day
|
|
596
|
+
return undefined;
|
|
597
|
+
default:
|
|
598
|
+
return undefined;
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
export const getSectionValueNow = (section, utils) => {
|
|
602
|
+
if (!section.value) {
|
|
603
|
+
return undefined;
|
|
604
|
+
}
|
|
605
|
+
switch (section.type) {
|
|
606
|
+
case 'weekDay':
|
|
607
|
+
{
|
|
608
|
+
if (section.contentType === 'letter') {
|
|
609
|
+
// TODO: improve by resolving the week day number from a letter week day
|
|
610
|
+
return undefined;
|
|
611
|
+
}
|
|
612
|
+
return Number(section.value);
|
|
613
|
+
}
|
|
614
|
+
case 'meridiem':
|
|
615
|
+
{
|
|
616
|
+
const parsedDate = utils.parse(`01:00 ${section.value}`, `${utils.formats.hours12h}:${utils.formats.minutes} ${section.format}`);
|
|
617
|
+
if (parsedDate) {
|
|
618
|
+
return utils.getHours(parsedDate) >= 12 ? 1 : 0;
|
|
619
|
+
}
|
|
620
|
+
return undefined;
|
|
621
|
+
}
|
|
622
|
+
case 'day':
|
|
623
|
+
return section.contentType === 'digit-with-letter' ? parseInt(section.value, 10) : Number(section.value);
|
|
624
|
+
case 'month':
|
|
625
|
+
{
|
|
626
|
+
if (section.contentType === 'digit') {
|
|
627
|
+
return Number(section.value);
|
|
628
|
+
}
|
|
629
|
+
const parsedDate = utils.parse(section.value, section.format);
|
|
630
|
+
return parsedDate ? utils.getMonth(parsedDate) + 1 : undefined;
|
|
631
|
+
}
|
|
632
|
+
default:
|
|
633
|
+
return section.contentType !== 'letter' ? Number(section.value) : undefined;
|
|
634
|
+
}
|
|
785
635
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FieldSection, PickersTimezone, PickerValidDate } from '../../../models';
|
|
2
2
|
import { FieldSectionsValueBoundaries } from './useField.types';
|
|
3
3
|
import { UpdateSectionValueParams } from './useFieldState';
|
|
4
|
-
interface ApplyCharacterEditingParams {
|
|
4
|
+
export interface ApplyCharacterEditingParams {
|
|
5
5
|
keyPressed: string;
|
|
6
6
|
sectionIndex: number;
|
|
7
7
|
}
|
|
8
|
-
interface
|
|
8
|
+
interface UseFieldCharacterEditingParams<TDate extends PickerValidDate, TSection extends FieldSection> {
|
|
9
9
|
sections: TSection[];
|
|
10
10
|
updateSectionValue: (params: UpdateSectionValueParams<TSection>) => void;
|
|
11
11
|
sectionsValueBoundaries: FieldSectionsValueBoundaries<TDate>;
|
|
@@ -13,6 +13,10 @@ interface UseFieldEditingParams<TDate extends PickerValidDate, TSection extends
|
|
|
13
13
|
setTempAndroidValueStr: (newValue: string | null) => void;
|
|
14
14
|
timezone: PickersTimezone;
|
|
15
15
|
}
|
|
16
|
+
export interface UseFieldCharacterEditingResponse {
|
|
17
|
+
applyCharacterEditing: (params: ApplyCharacterEditingParams) => void;
|
|
18
|
+
resetCharacterQuery: () => void;
|
|
19
|
+
}
|
|
16
20
|
/**
|
|
17
21
|
* Update the active section value when the user pressed a key that is not a navigation key (arrow key for example).
|
|
18
22
|
* This hook has two main editing behaviors
|
|
@@ -20,8 +24,5 @@ interface UseFieldEditingParams<TDate extends PickerValidDate, TSection extends
|
|
|
20
24
|
* 1. The numeric editing when the user presses a digit
|
|
21
25
|
* 2. The letter editing when the user presses another key
|
|
22
26
|
*/
|
|
23
|
-
export declare const useFieldCharacterEditing: <TDate extends PickerValidDate, TSection extends FieldSection>({ sections, updateSectionValue, sectionsValueBoundaries, localizedDigits, setTempAndroidValueStr, timezone, }:
|
|
24
|
-
applyCharacterEditing: (params: ApplyCharacterEditingParams) => void;
|
|
25
|
-
resetCharacterQuery: () => void;
|
|
26
|
-
};
|
|
27
|
+
export declare const useFieldCharacterEditing: <TDate extends PickerValidDate, TSection extends FieldSection>({ sections, updateSectionValue, sectionsValueBoundaries, localizedDigits, setTempAndroidValueStr, timezone, }: UseFieldCharacterEditingParams<TDate, TSection>) => UseFieldCharacterEditingResponse;
|
|
27
28
|
export {};
|