@mui/x-date-pickers 7.0.0-beta.1 → 7.0.0-beta.4
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 +6 -0
- package/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +6 -0
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -1
- package/AdapterDayjs/AdapterDayjs.d.ts +6 -0
- package/AdapterDayjs/AdapterDayjs.js +6 -1
- package/AdapterLuxon/AdapterLuxon.d.ts +6 -0
- package/AdapterLuxon/AdapterLuxon.js +7 -2
- package/AdapterMoment/AdapterMoment.d.ts +6 -0
- package/AdapterMoment/AdapterMoment.js +4 -1
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +5 -0
- package/AdapterMomentHijri/AdapterMomentHijri.js +3 -1
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +5 -0
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -1
- package/CHANGELOG.md +437 -4
- package/DateCalendar/DateCalendar.d.ts +2 -1
- package/DateCalendar/DateCalendar.js +8 -6
- package/DateCalendar/DateCalendar.types.d.ts +9 -6
- package/DateCalendar/DayCalendar.d.ts +9 -7
- package/DateCalendar/DayCalendar.js +1 -1
- package/DateCalendar/PickersFadeTransitionGroup.d.ts +3 -0
- package/DateCalendar/PickersSlideTransition.d.ts +3 -0
- package/DateCalendar/useCalendarState.d.ts +7 -7
- package/DateCalendar/useIsDateDisabled.d.ts +2 -1
- package/DateField/DateField.d.ts +2 -1
- package/DateField/DateField.js +16 -14
- package/DateField/DateField.types.d.ts +12 -15
- package/DateField/index.d.ts +1 -1
- package/DateField/useDateField.d.ts +3 -2
- package/DateField/useDateField.js +1 -15
- package/DatePicker/DatePicker.d.ts +2 -1
- package/DatePicker/DatePicker.js +14 -14
- package/DatePicker/DatePicker.types.d.ts +5 -4
- package/DatePicker/DatePickerToolbar.d.ts +7 -6
- package/DatePicker/DatePickerToolbar.js +12 -4
- package/DatePicker/shared.d.ts +6 -6
- package/DateTimeField/DateTimeField.d.ts +2 -1
- package/DateTimeField/DateTimeField.js +20 -18
- package/DateTimeField/DateTimeField.types.d.ts +12 -15
- package/DateTimeField/index.d.ts +1 -1
- package/DateTimeField/useDateTimeField.d.ts +3 -2
- package/DateTimeField/useDateTimeField.js +1 -20
- package/DateTimePicker/DateTimePicker.d.ts +2 -1
- package/DateTimePicker/DateTimePicker.js +18 -18
- package/DateTimePicker/DateTimePicker.types.d.ts +5 -4
- package/DateTimePicker/DateTimePickerTabs.d.ts +2 -2
- package/DateTimePicker/DateTimePickerTabs.js +7 -1
- package/DateTimePicker/DateTimePickerToolbar.d.ts +4 -3
- package/DateTimePicker/DateTimePickerToolbar.js +4 -1
- package/DateTimePicker/shared.d.ts +6 -6
- package/DesktopDatePicker/DesktopDatePicker.d.ts +2 -1
- package/DesktopDatePicker/DesktopDatePicker.js +14 -14
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +5 -5
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +2 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +5 -5
- package/DesktopTimePicker/DesktopTimePicker.d.ts +2 -1
- package/DesktopTimePicker/DesktopTimePicker.js +14 -13
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +5 -5
- package/DigitalClock/DigitalClock.d.ts +2 -1
- package/DigitalClock/DigitalClock.js +5 -5
- package/DigitalClock/DigitalClock.types.d.ts +4 -4
- package/LocalizationProvider/LocalizationProvider.d.ts +5 -5
- package/LocalizationProvider/LocalizationProvider.js +1 -0
- package/MobileDatePicker/MobileDatePicker.d.ts +2 -1
- package/MobileDatePicker/MobileDatePicker.js +14 -14
- package/MobileDatePicker/MobileDatePicker.types.d.ts +5 -5
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +2 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +5 -5
- package/MobileTimePicker/MobileTimePicker.d.ts +2 -1
- package/MobileTimePicker/MobileTimePicker.js +14 -13
- package/MobileTimePicker/MobileTimePicker.types.d.ts +5 -5
- package/MonthCalendar/MonthCalendar.d.ts +3 -2
- package/MonthCalendar/MonthCalendar.js +5 -5
- package/MonthCalendar/MonthCalendar.types.d.ts +2 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.d.ts +2 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +5 -5
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +4 -3
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +5 -5
- package/PickersCalendarHeader/PickersCalendarHeader.d.ts +2 -1
- package/PickersCalendarHeader/PickersCalendarHeader.js +3 -3
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +6 -6
- package/PickersDay/PickersDay.d.ts +3 -2
- package/PickersDay/PickersDay.js +1 -1
- package/PickersLayout/PickersLayout.d.ts +2 -1
- package/PickersLayout/PickersLayout.js +6 -0
- package/PickersLayout/PickersLayout.types.d.ts +13 -6
- package/PickersLayout/usePickerLayout.d.ts +2 -1
- 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.d.ts +2 -1
- package/StaticDatePicker/StaticDatePicker.js +5 -6
- package/StaticDatePicker/StaticDatePicker.types.d.ts +4 -4
- package/StaticDateTimePicker/StaticDateTimePicker.d.ts +2 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +9 -10
- package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +4 -4
- package/StaticTimePicker/StaticTimePicker.d.ts +2 -1
- package/StaticTimePicker/StaticTimePicker.js +5 -5
- package/StaticTimePicker/StaticTimePicker.types.d.ts +4 -4
- package/TimeClock/Clock.d.ts +3 -3
- package/TimeClock/ClockNumbers.d.ts +4 -4
- package/TimeClock/TimeClock.d.ts +2 -1
- package/TimeClock/TimeClock.js +5 -5
- package/TimeClock/TimeClock.types.d.ts +3 -3
- package/TimeField/TimeField.d.ts +2 -1
- package/TimeField/TimeField.js +16 -14
- package/TimeField/TimeField.types.d.ts +12 -15
- package/TimeField/index.d.ts +1 -1
- package/TimeField/useTimeField.d.ts +3 -2
- package/TimeField/useTimeField.js +1 -13
- package/TimePicker/TimePicker.d.ts +2 -1
- package/TimePicker/TimePicker.js +14 -13
- package/TimePicker/TimePicker.types.d.ts +5 -4
- package/TimePicker/TimePickerToolbar.d.ts +7 -5
- package/TimePicker/TimePickerToolbar.js +12 -4
- package/TimePicker/shared.d.ts +5 -5
- package/YearCalendar/YearCalendar.d.ts +2 -1
- package/YearCalendar/YearCalendar.js +5 -5
- package/YearCalendar/YearCalendar.types.d.ts +2 -2
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +3 -2
- package/dateViewRenderers/dateViewRenderers.d.ts +3 -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/demo/DemoContainer.js +6 -5
- package/internals/hooks/date-helpers-hooks.d.ts +5 -5
- package/internals/hooks/defaultizedFieldProps.d.ts +19 -0
- package/internals/hooks/defaultizedFieldProps.js +43 -0
- package/internals/hooks/useClockReferenceDate.d.ts +3 -3
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +2 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -5
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +16 -15
- 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 +96 -60
- package/internals/hooks/useField/useField.utils.d.ts +20 -20
- package/internals/hooks/useField/useField.utils.js +78 -228
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +8 -7
- package/internals/hooks/useField/useFieldCharacterEditing.js +6 -6
- 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 +324 -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 +2 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.js +13 -5
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +14 -14
- package/internals/hooks/usePicker/usePicker.d.ts +2 -2
- package/internals/hooks/usePicker/usePicker.js +3 -3
- package/internals/hooks/usePicker/usePicker.types.d.ts +4 -4
- package/internals/hooks/usePicker/usePickerValue.d.ts +2 -2
- package/internals/hooks/usePicker/usePickerValue.js +2 -18
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +6 -7
- package/internals/hooks/usePicker/usePickerViews.d.ts +6 -6
- package/internals/hooks/usePicker/usePickerViews.js +5 -6
- package/internals/hooks/useStaticPicker/useStaticPicker.d.ts +2 -1
- package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -0
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +7 -6
- package/internals/hooks/useUtils.d.ts +6 -6
- package/internals/hooks/useValidation.d.ts +3 -2
- package/internals/hooks/useValueWithTimezone.d.ts +3 -3
- package/internals/hooks/useViews.d.ts +2 -1
- package/internals/index.d.ts +5 -4
- package/internals/index.js +2 -1
- package/internals/models/fields.d.ts +3 -5
- package/internals/models/helpers.d.ts +1 -0
- package/internals/models/props/basePickerProps.d.ts +5 -9
- package/internals/models/props/clock.d.ts +4 -4
- package/internals/models/props/tabs.d.ts +6 -0
- package/internals/models/props/toolbar.d.ts +3 -0
- package/internals/models/validation.d.ts +7 -7
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +1 -1
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +21 -3
- package/internals/utils/date-time-utils.d.ts +5 -5
- package/internals/utils/date-utils.d.ts +12 -12
- package/internals/utils/fields.js +1 -1
- package/internals/utils/getDefaultReferenceDate.d.ts +3 -3
- package/internals/utils/time-utils.d.ts +6 -6
- package/internals/utils/validation/validateDate.d.ts +2 -2
- package/internals/utils/validation/validateDateTime.d.ts +2 -2
- package/internals/utils/validation/validateTime.d.ts +2 -2
- package/internals/utils/valueManagers.d.ts +2 -2
- package/internals/utils/valueManagers.js +5 -4
- package/locales/beBY.d.ts +15 -6
- package/locales/beBY.js +13 -0
- package/locales/caES.d.ts +15 -6
- package/locales/caES.js +13 -0
- package/locales/csCZ.d.ts +15 -6
- package/locales/csCZ.js +13 -0
- package/locales/daDK.d.ts +15 -6
- package/locales/daDK.js +13 -0
- package/locales/deDE.d.ts +15 -6
- package/locales/deDE.js +13 -0
- package/locales/elGR.d.ts +15 -6
- package/locales/elGR.js +13 -0
- package/locales/enUS.d.ts +15 -6
- package/locales/enUS.js +12 -1
- package/locales/esES.d.ts +15 -6
- package/locales/esES.js +13 -0
- package/locales/eu.d.ts +15 -6
- package/locales/eu.js +13 -0
- package/locales/faIR.d.ts +15 -6
- package/locales/faIR.js +13 -0
- package/locales/fiFI.d.ts +15 -6
- package/locales/fiFI.js +13 -0
- package/locales/frFR.d.ts +15 -6
- package/locales/frFR.js +13 -0
- package/locales/heIL.d.ts +15 -6
- package/locales/heIL.js +13 -0
- package/locales/huHU.d.ts +15 -6
- package/locales/huHU.js +13 -0
- package/locales/isIS.d.ts +15 -6
- package/locales/isIS.js +13 -0
- package/locales/itIT.d.ts +15 -6
- package/locales/itIT.js +13 -0
- package/locales/jaJP.d.ts +15 -6
- package/locales/jaJP.js +13 -0
- package/locales/koKR.d.ts +15 -6
- package/locales/koKR.js +13 -0
- package/locales/kzKZ.d.ts +15 -6
- package/locales/kzKZ.js +13 -0
- package/locales/mk.d.ts +15 -6
- package/locales/mk.js +13 -0
- package/locales/nbNO.d.ts +15 -6
- package/locales/nbNO.js +13 -0
- package/locales/nlNL.d.ts +15 -6
- package/locales/nlNL.js +13 -0
- package/locales/plPL.d.ts +15 -6
- package/locales/plPL.js +13 -0
- package/locales/ptBR.d.ts +15 -6
- package/locales/ptBR.js +13 -0
- package/locales/roRO.d.ts +15 -6
- package/locales/roRO.js +13 -0
- package/locales/ruRU.d.ts +15 -6
- package/locales/ruRU.js +13 -0
- package/locales/skSK.d.ts +15 -6
- package/locales/skSK.js +13 -0
- package/locales/svSE.d.ts +15 -6
- package/locales/svSE.js +13 -0
- package/locales/trTR.d.ts +15 -6
- package/locales/trTR.js +13 -0
- package/locales/ukUA.d.ts +15 -6
- package/locales/ukUA.js +13 -0
- package/locales/urPK.d.ts +15 -6
- package/locales/urPK.js +13 -0
- package/locales/utils/getPickersLocalization.d.ts +15 -6
- package/locales/utils/pickersLocaleTextApi.d.ts +15 -6
- package/locales/viVN.d.ts +15 -6
- package/locales/viVN.js +13 -0
- package/locales/zhCN.d.ts +15 -6
- package/locales/zhCN.js +13 -0
- package/locales/zhHK.d.ts +15 -6
- package/locales/zhHK.js +13 -0
- package/models/adapters.d.ts +15 -1
- package/models/fields.d.ts +48 -32
- package/models/pickers.d.ts +3 -0
- package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -1
- package/modern/AdapterDayjs/AdapterDayjs.js +6 -1
- package/modern/AdapterLuxon/AdapterLuxon.js +7 -2
- package/modern/AdapterMoment/AdapterMoment.js +4 -1
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +3 -1
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -1
- package/modern/DateCalendar/DateCalendar.js +8 -6
- package/modern/DateCalendar/DayCalendar.js +1 -1
- package/modern/DateField/DateField.js +16 -14
- package/modern/DateField/useDateField.js +1 -14
- package/modern/DatePicker/DatePicker.js +14 -14
- package/modern/DatePicker/DatePickerToolbar.js +12 -4
- package/modern/DateTimeField/DateTimeField.js +20 -18
- package/modern/DateTimeField/useDateTimeField.js +1 -19
- package/modern/DateTimePicker/DateTimePicker.js +18 -18
- package/modern/DateTimePicker/DateTimePickerTabs.js +7 -1
- package/modern/DateTimePicker/DateTimePickerToolbar.js +4 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +14 -14
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/modern/DesktopTimePicker/DesktopTimePicker.js +14 -13
- package/modern/DigitalClock/DigitalClock.js +5 -5
- package/modern/LocalizationProvider/LocalizationProvider.js +1 -0
- package/modern/MobileDatePicker/MobileDatePicker.js +14 -14
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/modern/MobileTimePicker/MobileTimePicker.js +14 -13
- package/modern/MonthCalendar/MonthCalendar.js +5 -5
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +5 -5
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +3 -3
- package/modern/PickersDay/PickersDay.js +1 -1
- 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 +5 -6
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +9 -10
- package/modern/StaticTimePicker/StaticTimePicker.js +5 -5
- package/modern/TimeClock/TimeClock.js +5 -5
- package/modern/TimeField/TimeField.js +16 -14
- package/modern/TimeField/useTimeField.js +1 -12
- package/modern/TimePicker/TimePicker.js +14 -13
- package/modern/TimePicker/TimePickerToolbar.js +12 -4
- package/modern/YearCalendar/YearCalendar.js +5 -5
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersPopper.js +1 -2
- 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 +6 -6
- package/modern/internals/hooks/useField/useFieldState.js +45 -61
- package/modern/internals/hooks/useField/useFieldV6TextField.js +318 -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 +13 -0
- 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 +13 -0
- package/modern/locales/zhHK.js +13 -0
- package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -1
- package/node/AdapterDayjs/AdapterDayjs.js +6 -1
- package/node/AdapterLuxon/AdapterLuxon.js +7 -2
- package/node/AdapterMoment/AdapterMoment.js +4 -1
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +3 -1
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -1
- package/node/DateCalendar/DateCalendar.js +8 -6
- package/node/DateCalendar/DayCalendar.js +1 -1
- package/node/DateField/DateField.js +16 -14
- package/node/DateField/useDateField.js +2 -16
- package/node/DatePicker/DatePicker.js +14 -14
- package/node/DatePicker/DatePickerToolbar.js +12 -4
- package/node/DateTimeField/DateTimeField.js +20 -18
- package/node/DateTimeField/useDateTimeField.js +2 -21
- package/node/DateTimePicker/DateTimePicker.js +18 -18
- package/node/DateTimePicker/DateTimePickerTabs.js +7 -1
- package/node/DateTimePicker/DateTimePickerToolbar.js +4 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +14 -14
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
- package/node/DesktopTimePicker/DesktopTimePicker.js +14 -13
- package/node/DigitalClock/DigitalClock.js +5 -5
- package/node/LocalizationProvider/LocalizationProvider.js +1 -0
- package/node/MobileDatePicker/MobileDatePicker.js +14 -14
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
- package/node/MobileTimePicker/MobileTimePicker.js +14 -13
- package/node/MonthCalendar/MonthCalendar.js +5 -5
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +5 -5
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +3 -3
- package/node/PickersDay/PickersDay.js +1 -1
- 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 +5 -6
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +9 -10
- package/node/StaticTimePicker/StaticTimePicker.js +5 -5
- package/node/TimeClock/TimeClock.js +5 -5
- package/node/TimeField/TimeField.js +16 -14
- package/node/TimeField/useTimeField.js +2 -14
- package/node/TimePicker/TimePicker.js +14 -13
- package/node/TimePicker/TimePickerToolbar.js +12 -4
- package/node/YearCalendar/YearCalendar.js +5 -5
- package/node/index.js +1 -1
- package/node/internals/components/PickersPopper.js +1 -2
- 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 +6 -6
- package/node/internals/hooks/useField/useFieldState.js +44 -60
- package/node/internals/hooks/useField/useFieldV6TextField.js +329 -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 +13 -0
- 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 +13 -0
- package/node/locales/zhHK.js +13 -0
- package/package.json +4 -4
- package/themeAugmentation/props.d.ts +31 -31
- package/timeViewRenderers/timeViewRenderers.d.ts +4 -4
- 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 -548
- 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 -569
- package/legacy/AdapterDayjs/index.js +0 -1
- package/legacy/AdapterLuxon/AdapterLuxon.js +0 -509
- package/legacy/AdapterLuxon/index.js +0 -1
- package/legacy/AdapterMoment/AdapterMoment.js +0 -482
- package/legacy/AdapterMoment/index.js +0 -1
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +0 -239
- package/legacy/AdapterMomentHijri/index.js +0 -1
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -236
- 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,828 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import { getMonthsInYear } from '../../utils/date-utils';
|
|
4
|
-
export var getDateSectionConfigFromFormatToken = function getDateSectionConfigFromFormatToken(utils, formatToken) {
|
|
5
|
-
var config = utils.formatTokenMap[formatToken];
|
|
6
|
-
if (config == null) {
|
|
7
|
-
throw new Error(["MUI X: The token \"".concat(formatToken, "\" is not supported by the Date and Time Pickers."), 'Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported.'].join('\n'));
|
|
8
|
-
}
|
|
9
|
-
if (typeof config === 'string') {
|
|
10
|
-
return {
|
|
11
|
-
type: config,
|
|
12
|
-
contentType: config === 'meridiem' ? 'letter' : 'digit',
|
|
13
|
-
maxLength: undefined
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
type: config.sectionType,
|
|
18
|
-
contentType: config.contentType,
|
|
19
|
-
maxLength: config.maxLength
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
var getDeltaFromKeyCode = function getDeltaFromKeyCode(keyCode) {
|
|
23
|
-
switch (keyCode) {
|
|
24
|
-
case 'ArrowUp':
|
|
25
|
-
return 1;
|
|
26
|
-
case 'ArrowDown':
|
|
27
|
-
return -1;
|
|
28
|
-
case 'PageUp':
|
|
29
|
-
return 5;
|
|
30
|
-
case 'PageDown':
|
|
31
|
-
return -5;
|
|
32
|
-
default:
|
|
33
|
-
return 0;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export var getDaysInWeekStr = function getDaysInWeekStr(utils, timezone, format) {
|
|
37
|
-
var elements = [];
|
|
38
|
-
var now = utils.date(undefined, timezone);
|
|
39
|
-
var startDate = utils.startOfWeek(now);
|
|
40
|
-
var endDate = utils.endOfWeek(now);
|
|
41
|
-
var current = startDate;
|
|
42
|
-
while (utils.isBefore(current, endDate)) {
|
|
43
|
-
elements.push(current);
|
|
44
|
-
current = utils.addDays(current, 1);
|
|
45
|
-
}
|
|
46
|
-
return elements.map(function (weekDay) {
|
|
47
|
-
return utils.formatByString(weekDay, format);
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
export var getLetterEditingOptions = function getLetterEditingOptions(utils, timezone, sectionType, format) {
|
|
51
|
-
switch (sectionType) {
|
|
52
|
-
case 'month':
|
|
53
|
-
{
|
|
54
|
-
return getMonthsInYear(utils, utils.date(undefined, timezone)).map(function (month) {
|
|
55
|
-
return utils.formatByString(month, format);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
case 'weekDay':
|
|
59
|
-
{
|
|
60
|
-
return getDaysInWeekStr(utils, timezone, format);
|
|
61
|
-
}
|
|
62
|
-
case 'meridiem':
|
|
63
|
-
{
|
|
64
|
-
var now = utils.date(undefined, timezone);
|
|
65
|
-
return [utils.startOfDay(now), utils.endOfDay(now)].map(function (date) {
|
|
66
|
-
return utils.formatByString(date, format);
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
default:
|
|
70
|
-
{
|
|
71
|
-
return [];
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// This format should be the same on all the adapters
|
|
77
|
-
// If some adapter does not respect this convention, then we will need to hardcode the format on each adapter.
|
|
78
|
-
export var FORMAT_SECONDS_NO_LEADING_ZEROS = 's';
|
|
79
|
-
var NON_LOCALIZED_DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
80
|
-
export var getLocalizedDigits = function getLocalizedDigits(utils) {
|
|
81
|
-
var today = utils.date(undefined);
|
|
82
|
-
var formattedZero = utils.formatByString(utils.setSeconds(today, 0), FORMAT_SECONDS_NO_LEADING_ZEROS);
|
|
83
|
-
if (formattedZero === '0') {
|
|
84
|
-
return NON_LOCALIZED_DIGITS;
|
|
85
|
-
}
|
|
86
|
-
return Array.from({
|
|
87
|
-
length: 10
|
|
88
|
-
}).map(function (_, index) {
|
|
89
|
-
return utils.formatByString(utils.setSeconds(today, index), FORMAT_SECONDS_NO_LEADING_ZEROS);
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
export var removeLocalizedDigits = function removeLocalizedDigits(valueStr, localizedDigits) {
|
|
93
|
-
if (localizedDigits[0] === '0') {
|
|
94
|
-
return valueStr;
|
|
95
|
-
}
|
|
96
|
-
var digits = [];
|
|
97
|
-
var currentFormattedDigit = '';
|
|
98
|
-
for (var i = 0; i < valueStr.length; i += 1) {
|
|
99
|
-
currentFormattedDigit += valueStr[i];
|
|
100
|
-
var matchingDigitIndex = localizedDigits.indexOf(currentFormattedDigit);
|
|
101
|
-
if (matchingDigitIndex > -1) {
|
|
102
|
-
digits.push(matchingDigitIndex.toString());
|
|
103
|
-
currentFormattedDigit = '';
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return digits.join('');
|
|
107
|
-
};
|
|
108
|
-
export var applyLocalizedDigits = function applyLocalizedDigits(valueStr, localizedDigits) {
|
|
109
|
-
if (localizedDigits[0] === '0') {
|
|
110
|
-
return valueStr;
|
|
111
|
-
}
|
|
112
|
-
return valueStr.split('').map(function (char) {
|
|
113
|
-
return localizedDigits[Number(char)];
|
|
114
|
-
}).join('');
|
|
115
|
-
};
|
|
116
|
-
export var isStringNumber = function isStringNumber(valueStr, localizedDigits) {
|
|
117
|
-
var nonLocalizedValueStr = removeLocalizedDigits(valueStr, localizedDigits);
|
|
118
|
-
return !Number.isNaN(Number(nonLocalizedValueStr));
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Remove the leading zeroes to a digit section value.
|
|
123
|
-
* E.g.: `03` => `3`
|
|
124
|
-
* Warning: Should only be called with non-localized digits. Call `removeLocalizedDigits` with your value if needed.
|
|
125
|
-
*/
|
|
126
|
-
export var cleanLeadingZeros = function cleanLeadingZeros(valueStr, size) {
|
|
127
|
-
var cleanValueStr = valueStr;
|
|
128
|
-
|
|
129
|
-
// Remove the leading zeros
|
|
130
|
-
cleanValueStr = Number(cleanValueStr).toString();
|
|
131
|
-
|
|
132
|
-
// Add enough leading zeros to fill the section
|
|
133
|
-
while (cleanValueStr.length < size) {
|
|
134
|
-
cleanValueStr = "0".concat(cleanValueStr);
|
|
135
|
-
}
|
|
136
|
-
return cleanValueStr;
|
|
137
|
-
};
|
|
138
|
-
export var cleanDigitSectionValue = function cleanDigitSectionValue(utils, value, sectionBoundaries, localizedDigits, section) {
|
|
139
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
140
|
-
if (section.type !== 'day' && section.contentType === 'digit-with-letter') {
|
|
141
|
-
throw new Error(["MUI X: The token \"".concat(section.format, "\" is a digit format with letter in it.'\n This type of format is only supported for 'day' sections")].join('\n'));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (section.type === 'day' && section.contentType === 'digit-with-letter') {
|
|
145
|
-
var date = utils.setDate(sectionBoundaries.longestMonth, value);
|
|
146
|
-
return utils.formatByString(date, section.format);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// queryValue without leading `0` (`01` => `1`)
|
|
150
|
-
var valueStr = value.toString();
|
|
151
|
-
if (section.hasLeadingZerosInInput) {
|
|
152
|
-
valueStr = cleanLeadingZeros(valueStr, section.maxLength);
|
|
153
|
-
}
|
|
154
|
-
return applyLocalizedDigits(valueStr, localizedDigits);
|
|
155
|
-
};
|
|
156
|
-
export var adjustSectionValue = function adjustSectionValue(utils, timezone, section, keyCode, sectionsValueBoundaries, localizedDigits, activeDate, stepsAttributes) {
|
|
157
|
-
var delta = getDeltaFromKeyCode(keyCode);
|
|
158
|
-
var isStart = keyCode === 'Home';
|
|
159
|
-
var isEnd = keyCode === 'End';
|
|
160
|
-
var shouldSetAbsolute = section.value === '' || isStart || isEnd;
|
|
161
|
-
var adjustDigitSection = function adjustDigitSection() {
|
|
162
|
-
var sectionBoundaries = sectionsValueBoundaries[section.type]({
|
|
163
|
-
currentDate: activeDate,
|
|
164
|
-
format: section.format,
|
|
165
|
-
contentType: section.contentType
|
|
166
|
-
});
|
|
167
|
-
var getCleanValue = function getCleanValue(value) {
|
|
168
|
-
return cleanDigitSectionValue(utils, value, sectionBoundaries, localizedDigits, section);
|
|
169
|
-
};
|
|
170
|
-
var step = section.type === 'minutes' && stepsAttributes != null && stepsAttributes.minutesStep ? stepsAttributes.minutesStep : 1;
|
|
171
|
-
var currentSectionValue = parseInt(removeLocalizedDigits(section.value, localizedDigits), 10);
|
|
172
|
-
var newSectionValueNumber = currentSectionValue + delta * step;
|
|
173
|
-
if (shouldSetAbsolute) {
|
|
174
|
-
if (section.type === 'year' && !isEnd && !isStart) {
|
|
175
|
-
return utils.formatByString(utils.date(undefined, timezone), section.format);
|
|
176
|
-
}
|
|
177
|
-
if (delta > 0 || isStart) {
|
|
178
|
-
newSectionValueNumber = sectionBoundaries.minimum;
|
|
179
|
-
} else {
|
|
180
|
-
newSectionValueNumber = sectionBoundaries.maximum;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (newSectionValueNumber % step !== 0) {
|
|
184
|
-
if (delta < 0 || isStart) {
|
|
185
|
-
newSectionValueNumber += step - (step + newSectionValueNumber) % step; // for JS -3 % 5 = -3 (should be 2)
|
|
186
|
-
}
|
|
187
|
-
if (delta > 0 || isEnd) {
|
|
188
|
-
newSectionValueNumber -= newSectionValueNumber % step;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if (newSectionValueNumber > sectionBoundaries.maximum) {
|
|
192
|
-
return getCleanValue(sectionBoundaries.minimum + (newSectionValueNumber - sectionBoundaries.maximum - 1) % (sectionBoundaries.maximum - sectionBoundaries.minimum + 1));
|
|
193
|
-
}
|
|
194
|
-
if (newSectionValueNumber < sectionBoundaries.minimum) {
|
|
195
|
-
return getCleanValue(sectionBoundaries.maximum - (sectionBoundaries.minimum - newSectionValueNumber - 1) % (sectionBoundaries.maximum - sectionBoundaries.minimum + 1));
|
|
196
|
-
}
|
|
197
|
-
return getCleanValue(newSectionValueNumber);
|
|
198
|
-
};
|
|
199
|
-
var adjustLetterSection = function adjustLetterSection() {
|
|
200
|
-
var options = getLetterEditingOptions(utils, timezone, section.type, section.format);
|
|
201
|
-
if (options.length === 0) {
|
|
202
|
-
return section.value;
|
|
203
|
-
}
|
|
204
|
-
if (shouldSetAbsolute) {
|
|
205
|
-
if (delta > 0 || isStart) {
|
|
206
|
-
return options[0];
|
|
207
|
-
}
|
|
208
|
-
return options[options.length - 1];
|
|
209
|
-
}
|
|
210
|
-
var currentOptionIndex = options.indexOf(section.value);
|
|
211
|
-
var newOptionIndex = (currentOptionIndex + options.length + delta) % options.length;
|
|
212
|
-
return options[newOptionIndex];
|
|
213
|
-
};
|
|
214
|
-
if (section.contentType === 'digit' || section.contentType === 'digit-with-letter') {
|
|
215
|
-
return adjustDigitSection();
|
|
216
|
-
}
|
|
217
|
-
return adjustLetterSection();
|
|
218
|
-
};
|
|
219
|
-
export var getSectionVisibleValue = function getSectionVisibleValue(section, target, localizedDigits) {
|
|
220
|
-
var value = section.value || section.placeholder;
|
|
221
|
-
var hasLeadingZeros = target === 'non-input' ? section.hasLeadingZerosInFormat : section.hasLeadingZerosInInput;
|
|
222
|
-
if (target === 'non-input' && section.hasLeadingZerosInInput && !section.hasLeadingZerosInFormat) {
|
|
223
|
-
value = Number(removeLocalizedDigits(value, localizedDigits)).toString();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// In the input, we add an empty character at the end of each section without leading zeros.
|
|
227
|
-
// This makes sure that `onChange` will always be fired.
|
|
228
|
-
// Otherwise, when your input value equals `1/dd/yyyy` (format `M/DD/YYYY` on DayJs),
|
|
229
|
-
// If you press `1`, on the first section, the new value is also `1/dd/yyyy`,
|
|
230
|
-
// So the browser will not fire the input `onChange`.
|
|
231
|
-
var shouldAddInvisibleSpace = ['input-rtl', 'input-ltr'].includes(target) && section.contentType === 'digit' && !hasLeadingZeros && value.length === 1;
|
|
232
|
-
if (shouldAddInvisibleSpace) {
|
|
233
|
-
value = "".concat(value, "\u200E");
|
|
234
|
-
}
|
|
235
|
-
if (target === 'input-rtl') {
|
|
236
|
-
value = "\u2068".concat(value, "\u2069");
|
|
237
|
-
}
|
|
238
|
-
return value;
|
|
239
|
-
};
|
|
240
|
-
export var cleanString = function cleanString(dirtyString) {
|
|
241
|
-
return dirtyString.replace(/[\u2066\u2067\u2068\u2069]/g, '');
|
|
242
|
-
};
|
|
243
|
-
export var addPositionPropertiesToSections = function addPositionPropertiesToSections(sections, localizedDigits, isRTL) {
|
|
244
|
-
var position = 0;
|
|
245
|
-
var positionInInput = isRTL ? 1 : 0;
|
|
246
|
-
var newSections = [];
|
|
247
|
-
for (var i = 0; i < sections.length; i += 1) {
|
|
248
|
-
var section = sections[i];
|
|
249
|
-
var renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
250
|
-
var sectionStr = "".concat(section.startSeparator).concat(renderedValue).concat(section.endSeparator);
|
|
251
|
-
var sectionLength = cleanString(sectionStr).length;
|
|
252
|
-
var sectionLengthInInput = sectionStr.length;
|
|
253
|
-
|
|
254
|
-
// The ...InInput values consider the unicode characters but do include them in their indexes
|
|
255
|
-
var cleanedValue = cleanString(renderedValue);
|
|
256
|
-
var startInInput = positionInInput + (cleanedValue === '' ? 0 : renderedValue.indexOf(cleanedValue[0])) + section.startSeparator.length;
|
|
257
|
-
var endInInput = startInInput + cleanedValue.length;
|
|
258
|
-
newSections.push(_extends({}, section, {
|
|
259
|
-
start: position,
|
|
260
|
-
end: position + sectionLength,
|
|
261
|
-
startInInput: startInInput,
|
|
262
|
-
endInInput: endInInput
|
|
263
|
-
}));
|
|
264
|
-
position += sectionLength;
|
|
265
|
-
// Move position to the end of string associated to the current section
|
|
266
|
-
positionInInput += sectionLengthInInput;
|
|
267
|
-
}
|
|
268
|
-
return newSections;
|
|
269
|
-
};
|
|
270
|
-
var getSectionPlaceholder = function getSectionPlaceholder(utils, timezone, localeText, sectionConfig, sectionFormat) {
|
|
271
|
-
switch (sectionConfig.type) {
|
|
272
|
-
case 'year':
|
|
273
|
-
{
|
|
274
|
-
return localeText.fieldYearPlaceholder({
|
|
275
|
-
digitAmount: utils.formatByString(utils.date(undefined, timezone), sectionFormat).length,
|
|
276
|
-
format: sectionFormat
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
case 'month':
|
|
280
|
-
{
|
|
281
|
-
return localeText.fieldMonthPlaceholder({
|
|
282
|
-
contentType: sectionConfig.contentType,
|
|
283
|
-
format: sectionFormat
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
case 'day':
|
|
287
|
-
{
|
|
288
|
-
return localeText.fieldDayPlaceholder({
|
|
289
|
-
format: sectionFormat
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
case 'weekDay':
|
|
293
|
-
{
|
|
294
|
-
return localeText.fieldWeekDayPlaceholder({
|
|
295
|
-
contentType: sectionConfig.contentType,
|
|
296
|
-
format: sectionFormat
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
case 'hours':
|
|
300
|
-
{
|
|
301
|
-
return localeText.fieldHoursPlaceholder({
|
|
302
|
-
format: sectionFormat
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
case 'minutes':
|
|
306
|
-
{
|
|
307
|
-
return localeText.fieldMinutesPlaceholder({
|
|
308
|
-
format: sectionFormat
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
case 'seconds':
|
|
312
|
-
{
|
|
313
|
-
return localeText.fieldSecondsPlaceholder({
|
|
314
|
-
format: sectionFormat
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
case 'meridiem':
|
|
318
|
-
{
|
|
319
|
-
return localeText.fieldMeridiemPlaceholder({
|
|
320
|
-
format: sectionFormat
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
default:
|
|
324
|
-
{
|
|
325
|
-
return sectionFormat;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
export var changeSectionValueFormat = function changeSectionValueFormat(utils, valueStr, currentFormat, newFormat) {
|
|
330
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
331
|
-
if (getDateSectionConfigFromFormatToken(utils, currentFormat).type === 'weekDay') {
|
|
332
|
-
throw new Error("changeSectionValueFormat doesn't support week day formats");
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return utils.formatByString(utils.parse(valueStr, currentFormat), newFormat);
|
|
336
|
-
};
|
|
337
|
-
var isFourDigitYearFormat = function isFourDigitYearFormat(utils, timezone, format) {
|
|
338
|
-
return utils.formatByString(utils.date(undefined, timezone), format).length === 4;
|
|
339
|
-
};
|
|
340
|
-
export var doesSectionFormatHaveLeadingZeros = function doesSectionFormatHaveLeadingZeros(utils, timezone, contentType, sectionType, format) {
|
|
341
|
-
if (contentType !== 'digit') {
|
|
342
|
-
return false;
|
|
343
|
-
}
|
|
344
|
-
var now = utils.date(undefined, timezone);
|
|
345
|
-
switch (sectionType) {
|
|
346
|
-
// We can't use `changeSectionValueFormat`, because `utils.parse('1', 'YYYY')` returns `1971` instead of `1`.
|
|
347
|
-
case 'year':
|
|
348
|
-
{
|
|
349
|
-
if (isFourDigitYearFormat(utils, timezone, format)) {
|
|
350
|
-
var formatted0001 = utils.formatByString(utils.setYear(now, 1), format);
|
|
351
|
-
return formatted0001 === '0001';
|
|
352
|
-
}
|
|
353
|
-
var formatted2001 = utils.formatByString(utils.setYear(now, 2001), format);
|
|
354
|
-
return formatted2001 === '01';
|
|
355
|
-
}
|
|
356
|
-
case 'month':
|
|
357
|
-
{
|
|
358
|
-
return utils.formatByString(utils.startOfYear(now), format).length > 1;
|
|
359
|
-
}
|
|
360
|
-
case 'day':
|
|
361
|
-
{
|
|
362
|
-
return utils.formatByString(utils.startOfMonth(now), format).length > 1;
|
|
363
|
-
}
|
|
364
|
-
case 'weekDay':
|
|
365
|
-
{
|
|
366
|
-
return utils.formatByString(utils.startOfWeek(now), format).length > 1;
|
|
367
|
-
}
|
|
368
|
-
case 'hours':
|
|
369
|
-
{
|
|
370
|
-
return utils.formatByString(utils.setHours(now, 1), format).length > 1;
|
|
371
|
-
}
|
|
372
|
-
case 'minutes':
|
|
373
|
-
{
|
|
374
|
-
return utils.formatByString(utils.setMinutes(now, 1), format).length > 1;
|
|
375
|
-
}
|
|
376
|
-
case 'seconds':
|
|
377
|
-
{
|
|
378
|
-
return utils.formatByString(utils.setSeconds(now, 1), format).length > 1;
|
|
379
|
-
}
|
|
380
|
-
default:
|
|
381
|
-
{
|
|
382
|
-
throw new Error('Invalid section type');
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
var getEscapedPartsFromFormat = function getEscapedPartsFromFormat(utils, format) {
|
|
387
|
-
var escapedParts = [];
|
|
388
|
-
var _utils$escapedCharact = utils.escapedCharacters,
|
|
389
|
-
startChar = _utils$escapedCharact.start,
|
|
390
|
-
endChar = _utils$escapedCharact.end;
|
|
391
|
-
var regExp = new RegExp("(\\".concat(startChar, "[^\\").concat(endChar, "]*\\").concat(endChar, ")+"), 'g');
|
|
392
|
-
var match = null;
|
|
393
|
-
// eslint-disable-next-line no-cond-assign
|
|
394
|
-
while (match = regExp.exec(format)) {
|
|
395
|
-
escapedParts.push({
|
|
396
|
-
start: match.index,
|
|
397
|
-
end: regExp.lastIndex - 1
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
return escapedParts;
|
|
401
|
-
};
|
|
402
|
-
export var splitFormatIntoSections = function splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL) {
|
|
403
|
-
var startSeparator = '';
|
|
404
|
-
var sections = [];
|
|
405
|
-
var now = utils.date();
|
|
406
|
-
var commitToken = function commitToken(token) {
|
|
407
|
-
if (token === '') {
|
|
408
|
-
return null;
|
|
409
|
-
}
|
|
410
|
-
var sectionConfig = getDateSectionConfigFromFormatToken(utils, token);
|
|
411
|
-
var hasLeadingZerosInFormat = doesSectionFormatHaveLeadingZeros(utils, timezone, sectionConfig.contentType, sectionConfig.type, token);
|
|
412
|
-
var hasLeadingZerosInInput = shouldRespectLeadingZeros ? hasLeadingZerosInFormat : sectionConfig.contentType === 'digit';
|
|
413
|
-
var isValidDate = date != null && utils.isValid(date);
|
|
414
|
-
var sectionValue = isValidDate ? utils.formatByString(date, token) : '';
|
|
415
|
-
var maxLength = null;
|
|
416
|
-
if (hasLeadingZerosInInput) {
|
|
417
|
-
if (hasLeadingZerosInFormat) {
|
|
418
|
-
maxLength = sectionValue === '' ? utils.formatByString(now, token).length : sectionValue.length;
|
|
419
|
-
} else {
|
|
420
|
-
if (sectionConfig.maxLength == null) {
|
|
421
|
-
throw new Error("MUI X: The token ".concat(token, " should have a 'maxDigitNumber' property on it's adapter"));
|
|
422
|
-
}
|
|
423
|
-
maxLength = sectionConfig.maxLength;
|
|
424
|
-
if (isValidDate) {
|
|
425
|
-
sectionValue = applyLocalizedDigits(cleanLeadingZeros(removeLocalizedDigits(sectionValue, localizedDigits), maxLength), localizedDigits);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
sections.push(_extends({}, sectionConfig, {
|
|
430
|
-
format: token,
|
|
431
|
-
maxLength: maxLength,
|
|
432
|
-
value: sectionValue,
|
|
433
|
-
placeholder: getSectionPlaceholder(utils, timezone, localeText, sectionConfig, token),
|
|
434
|
-
hasLeadingZerosInFormat: hasLeadingZerosInFormat,
|
|
435
|
-
hasLeadingZerosInInput: hasLeadingZerosInInput,
|
|
436
|
-
startSeparator: sections.length === 0 ? startSeparator : '',
|
|
437
|
-
endSeparator: '',
|
|
438
|
-
modified: false
|
|
439
|
-
}));
|
|
440
|
-
return null;
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
// Expand the provided format
|
|
444
|
-
var formatExpansionOverflow = 10;
|
|
445
|
-
var prevFormat = format;
|
|
446
|
-
var nextFormat = utils.expandFormat(format);
|
|
447
|
-
while (nextFormat !== prevFormat) {
|
|
448
|
-
prevFormat = nextFormat;
|
|
449
|
-
nextFormat = utils.expandFormat(prevFormat);
|
|
450
|
-
formatExpansionOverflow -= 1;
|
|
451
|
-
if (formatExpansionOverflow < 0) {
|
|
452
|
-
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.');
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
var expandedFormat = nextFormat;
|
|
456
|
-
|
|
457
|
-
// Get start/end indexes of escaped sections
|
|
458
|
-
var escapedParts = getEscapedPartsFromFormat(utils, expandedFormat);
|
|
459
|
-
|
|
460
|
-
// This RegExp test if the beginning of a string correspond to a supported token
|
|
461
|
-
var isTokenStartRegExp = new RegExp("^(".concat(Object.keys(utils.formatTokenMap).sort(function (a, b) {
|
|
462
|
-
return b.length - a.length;
|
|
463
|
-
}) // Sort to put longest word first
|
|
464
|
-
.join('|'), ")"), 'g') // used to get access to lastIndex state
|
|
465
|
-
;
|
|
466
|
-
var currentTokenValue = '';
|
|
467
|
-
var _loop = function _loop(_i) {
|
|
468
|
-
var escapedPartOfCurrentChar = escapedParts.find(function (escapeIndex) {
|
|
469
|
-
return escapeIndex.start <= _i && escapeIndex.end >= _i;
|
|
470
|
-
});
|
|
471
|
-
var char = expandedFormat[_i];
|
|
472
|
-
var isEscapedChar = escapedPartOfCurrentChar != null;
|
|
473
|
-
var potentialToken = "".concat(currentTokenValue).concat(expandedFormat.slice(_i));
|
|
474
|
-
var regExpMatch = isTokenStartRegExp.test(potentialToken);
|
|
475
|
-
if (!isEscapedChar && char.match(/([A-Za-z]+)/) && regExpMatch) {
|
|
476
|
-
currentTokenValue = potentialToken.slice(0, isTokenStartRegExp.lastIndex);
|
|
477
|
-
_i += isTokenStartRegExp.lastIndex - 1;
|
|
478
|
-
} else {
|
|
479
|
-
// If we are on the opening or closing character of an escaped part of the format,
|
|
480
|
-
// Then we ignore this character.
|
|
481
|
-
var isEscapeBoundary = isEscapedChar && (escapedPartOfCurrentChar == null ? void 0 : escapedPartOfCurrentChar.start) === _i || (escapedPartOfCurrentChar == null ? void 0 : escapedPartOfCurrentChar.end) === _i;
|
|
482
|
-
if (!isEscapeBoundary) {
|
|
483
|
-
commitToken(currentTokenValue);
|
|
484
|
-
currentTokenValue = '';
|
|
485
|
-
if (sections.length === 0) {
|
|
486
|
-
startSeparator += char;
|
|
487
|
-
} else {
|
|
488
|
-
sections[sections.length - 1].endSeparator += char;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
i = _i;
|
|
493
|
-
};
|
|
494
|
-
for (var i = 0; i < expandedFormat.length; i += 1) {
|
|
495
|
-
_loop(i);
|
|
496
|
-
}
|
|
497
|
-
commitToken(currentTokenValue);
|
|
498
|
-
if (sections.length === 0 && startSeparator.length > 0) {
|
|
499
|
-
sections.push({
|
|
500
|
-
type: 'empty',
|
|
501
|
-
contentType: 'letter',
|
|
502
|
-
maxLength: null,
|
|
503
|
-
format: '',
|
|
504
|
-
value: '',
|
|
505
|
-
placeholder: '',
|
|
506
|
-
hasLeadingZerosInFormat: false,
|
|
507
|
-
hasLeadingZerosInInput: false,
|
|
508
|
-
startSeparator: startSeparator,
|
|
509
|
-
endSeparator: '',
|
|
510
|
-
modified: false
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
return sections.map(function (section) {
|
|
514
|
-
var cleanSeparator = function cleanSeparator(separator) {
|
|
515
|
-
var cleanedSeparator = separator;
|
|
516
|
-
if (isRTL && cleanedSeparator !== null && cleanedSeparator.includes(' ')) {
|
|
517
|
-
cleanedSeparator = "\u2069".concat(cleanedSeparator, "\u2066");
|
|
518
|
-
}
|
|
519
|
-
if (formatDensity === 'spacious' && ['/', '.', '-'].includes(cleanedSeparator)) {
|
|
520
|
-
cleanedSeparator = " ".concat(cleanedSeparator, " ");
|
|
521
|
-
}
|
|
522
|
-
return cleanedSeparator;
|
|
523
|
-
};
|
|
524
|
-
section.startSeparator = cleanSeparator(section.startSeparator);
|
|
525
|
-
section.endSeparator = cleanSeparator(section.endSeparator);
|
|
526
|
-
return section;
|
|
527
|
-
});
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* Some date libraries like `dayjs` don't support parsing from date with escaped characters.
|
|
532
|
-
* To make sure that the parsing works, we are building a format and a date without any separator.
|
|
533
|
-
*/
|
|
534
|
-
export var getDateFromDateSections = function getDateFromDateSections(utils, sections, localizedDigits) {
|
|
535
|
-
// If we have both a day and a weekDay section,
|
|
536
|
-
// Then we skip the weekDay in the parsing because libraries like dayjs can't parse complicated formats containing a weekDay.
|
|
537
|
-
// dayjs(dayjs().format('dddd MMMM D YYYY'), 'dddd MMMM D YYYY')) // returns `Invalid Date` even if the format is valid.
|
|
538
|
-
var shouldSkipWeekDays = sections.some(function (section) {
|
|
539
|
-
return section.type === 'day';
|
|
540
|
-
});
|
|
541
|
-
var sectionFormats = [];
|
|
542
|
-
var sectionValues = [];
|
|
543
|
-
for (var i = 0; i < sections.length; i += 1) {
|
|
544
|
-
var section = sections[i];
|
|
545
|
-
var shouldSkip = shouldSkipWeekDays && section.type === 'weekDay';
|
|
546
|
-
if (!shouldSkip) {
|
|
547
|
-
sectionFormats.push(section.format);
|
|
548
|
-
sectionValues.push(getSectionVisibleValue(section, 'non-input', localizedDigits));
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
var formatWithoutSeparator = sectionFormats.join(' ');
|
|
552
|
-
var dateWithoutSeparatorStr = sectionValues.join(' ');
|
|
553
|
-
return utils.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
|
|
554
|
-
};
|
|
555
|
-
export var createDateStrForInputFromSections = function createDateStrForInputFromSections(sections, localizedDigits, isRTL) {
|
|
556
|
-
var formattedSections = sections.map(function (section) {
|
|
557
|
-
var dateValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
558
|
-
return "".concat(section.startSeparator).concat(dateValue).concat(section.endSeparator);
|
|
559
|
-
});
|
|
560
|
-
var dateStr = formattedSections.join('');
|
|
561
|
-
if (!isRTL) {
|
|
562
|
-
return dateStr;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
// \u2066: start left-to-right isolation
|
|
566
|
-
// \u2067: start right-to-left isolation
|
|
567
|
-
// \u2068: start first strong character isolation
|
|
568
|
-
// \u2069: pop isolation
|
|
569
|
-
// wrap into an isolated group such that separators can split the string in smaller ones by adding \u2069\u2068
|
|
570
|
-
return "\u2066".concat(dateStr, "\u2069");
|
|
571
|
-
};
|
|
572
|
-
export var getSectionsBoundaries = function getSectionsBoundaries(utils, localizedDigits, timezone) {
|
|
573
|
-
var today = utils.date(undefined, timezone);
|
|
574
|
-
var endOfYear = utils.endOfYear(today);
|
|
575
|
-
var endOfDay = utils.endOfDay(today);
|
|
576
|
-
var _getMonthsInYear$redu = getMonthsInYear(utils, today).reduce(function (acc, month) {
|
|
577
|
-
var daysInMonth = utils.getDaysInMonth(month);
|
|
578
|
-
if (daysInMonth > acc.maxDaysInMonth) {
|
|
579
|
-
return {
|
|
580
|
-
maxDaysInMonth: daysInMonth,
|
|
581
|
-
longestMonth: month
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
return acc;
|
|
585
|
-
}, {
|
|
586
|
-
maxDaysInMonth: 0,
|
|
587
|
-
longestMonth: null
|
|
588
|
-
}),
|
|
589
|
-
maxDaysInMonth = _getMonthsInYear$redu.maxDaysInMonth,
|
|
590
|
-
longestMonth = _getMonthsInYear$redu.longestMonth;
|
|
591
|
-
return {
|
|
592
|
-
year: function year(_ref) {
|
|
593
|
-
var format = _ref.format;
|
|
594
|
-
return {
|
|
595
|
-
minimum: 0,
|
|
596
|
-
maximum: isFourDigitYearFormat(utils, timezone, format) ? 9999 : 99
|
|
597
|
-
};
|
|
598
|
-
},
|
|
599
|
-
month: function month() {
|
|
600
|
-
return {
|
|
601
|
-
minimum: 1,
|
|
602
|
-
// Assumption: All years have the same amount of months
|
|
603
|
-
maximum: utils.getMonth(endOfYear) + 1
|
|
604
|
-
};
|
|
605
|
-
},
|
|
606
|
-
day: function day(_ref2) {
|
|
607
|
-
var currentDate = _ref2.currentDate;
|
|
608
|
-
return {
|
|
609
|
-
minimum: 1,
|
|
610
|
-
maximum: currentDate != null && utils.isValid(currentDate) ? utils.getDaysInMonth(currentDate) : maxDaysInMonth,
|
|
611
|
-
longestMonth: longestMonth
|
|
612
|
-
};
|
|
613
|
-
},
|
|
614
|
-
weekDay: function weekDay(_ref3) {
|
|
615
|
-
var format = _ref3.format,
|
|
616
|
-
contentType = _ref3.contentType;
|
|
617
|
-
if (contentType === 'digit') {
|
|
618
|
-
var daysInWeek = getDaysInWeekStr(utils, timezone, format).map(Number);
|
|
619
|
-
return {
|
|
620
|
-
minimum: Math.min.apply(Math, _toConsumableArray(daysInWeek)),
|
|
621
|
-
maximum: Math.max.apply(Math, _toConsumableArray(daysInWeek))
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
return {
|
|
625
|
-
minimum: 1,
|
|
626
|
-
maximum: 7
|
|
627
|
-
};
|
|
628
|
-
},
|
|
629
|
-
hours: function hours(_ref4) {
|
|
630
|
-
var format = _ref4.format;
|
|
631
|
-
var lastHourInDay = utils.getHours(endOfDay);
|
|
632
|
-
var hasMeridiem = removeLocalizedDigits(utils.formatByString(utils.endOfDay(today), format), localizedDigits) !== lastHourInDay.toString();
|
|
633
|
-
if (hasMeridiem) {
|
|
634
|
-
return {
|
|
635
|
-
minimum: 1,
|
|
636
|
-
maximum: Number(removeLocalizedDigits(utils.formatByString(utils.startOfDay(today), format), localizedDigits))
|
|
637
|
-
};
|
|
638
|
-
}
|
|
639
|
-
return {
|
|
640
|
-
minimum: 0,
|
|
641
|
-
maximum: lastHourInDay
|
|
642
|
-
};
|
|
643
|
-
},
|
|
644
|
-
minutes: function minutes() {
|
|
645
|
-
return {
|
|
646
|
-
minimum: 0,
|
|
647
|
-
// Assumption: All years have the same amount of minutes
|
|
648
|
-
maximum: utils.getMinutes(endOfDay)
|
|
649
|
-
};
|
|
650
|
-
},
|
|
651
|
-
seconds: function seconds() {
|
|
652
|
-
return {
|
|
653
|
-
minimum: 0,
|
|
654
|
-
// Assumption: All years have the same amount of seconds
|
|
655
|
-
maximum: utils.getSeconds(endOfDay)
|
|
656
|
-
};
|
|
657
|
-
},
|
|
658
|
-
meridiem: function meridiem() {
|
|
659
|
-
return {
|
|
660
|
-
minimum: 0,
|
|
661
|
-
maximum: 0
|
|
662
|
-
};
|
|
663
|
-
},
|
|
664
|
-
empty: function empty() {
|
|
665
|
-
return {
|
|
666
|
-
minimum: 0,
|
|
667
|
-
maximum: 0
|
|
668
|
-
};
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
};
|
|
672
|
-
var warnedOnceInvalidSection = false;
|
|
673
|
-
export var validateSections = function validateSections(sections, valueType) {
|
|
674
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
675
|
-
if (!warnedOnceInvalidSection) {
|
|
676
|
-
var supportedSections = ['empty'];
|
|
677
|
-
if (['date', 'date-time'].includes(valueType)) {
|
|
678
|
-
supportedSections.push('weekDay', 'day', 'month', 'year');
|
|
679
|
-
}
|
|
680
|
-
if (['time', 'date-time'].includes(valueType)) {
|
|
681
|
-
supportedSections.push('hours', 'minutes', 'seconds', 'meridiem');
|
|
682
|
-
}
|
|
683
|
-
var invalidSection = sections.find(function (section) {
|
|
684
|
-
return !supportedSections.includes(section.type);
|
|
685
|
-
});
|
|
686
|
-
if (invalidSection) {
|
|
687
|
-
console.warn("MUI X: The field component you are using is not compatible with the \"".concat(invalidSection.type, "\" date section."), "The supported date sections are [\"".concat(supportedSections.join('", "'), "\"]`."));
|
|
688
|
-
warnedOnceInvalidSection = true;
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
};
|
|
693
|
-
var transferDateSectionValue = function transferDateSectionValue(utils, timezone, section, dateToTransferFrom, dateToTransferTo) {
|
|
694
|
-
switch (section.type) {
|
|
695
|
-
case 'year':
|
|
696
|
-
{
|
|
697
|
-
return utils.setYear(dateToTransferTo, utils.getYear(dateToTransferFrom));
|
|
698
|
-
}
|
|
699
|
-
case 'month':
|
|
700
|
-
{
|
|
701
|
-
return utils.setMonth(dateToTransferTo, utils.getMonth(dateToTransferFrom));
|
|
702
|
-
}
|
|
703
|
-
case 'weekDay':
|
|
704
|
-
{
|
|
705
|
-
var formattedDaysInWeek = getDaysInWeekStr(utils, timezone, section.format);
|
|
706
|
-
var dayInWeekStrOfActiveDate = utils.formatByString(dateToTransferFrom, section.format);
|
|
707
|
-
var dayInWeekOfActiveDate = formattedDaysInWeek.indexOf(dayInWeekStrOfActiveDate);
|
|
708
|
-
var dayInWeekOfNewSectionValue = formattedDaysInWeek.indexOf(section.value);
|
|
709
|
-
var diff = dayInWeekOfNewSectionValue - dayInWeekOfActiveDate;
|
|
710
|
-
return utils.addDays(dateToTransferFrom, diff);
|
|
711
|
-
}
|
|
712
|
-
case 'day':
|
|
713
|
-
{
|
|
714
|
-
return utils.setDate(dateToTransferTo, utils.getDate(dateToTransferFrom));
|
|
715
|
-
}
|
|
716
|
-
case 'meridiem':
|
|
717
|
-
{
|
|
718
|
-
var isAM = utils.getHours(dateToTransferFrom) < 12;
|
|
719
|
-
var mergedDateHours = utils.getHours(dateToTransferTo);
|
|
720
|
-
if (isAM && mergedDateHours >= 12) {
|
|
721
|
-
return utils.addHours(dateToTransferTo, -12);
|
|
722
|
-
}
|
|
723
|
-
if (!isAM && mergedDateHours < 12) {
|
|
724
|
-
return utils.addHours(dateToTransferTo, 12);
|
|
725
|
-
}
|
|
726
|
-
return dateToTransferTo;
|
|
727
|
-
}
|
|
728
|
-
case 'hours':
|
|
729
|
-
{
|
|
730
|
-
return utils.setHours(dateToTransferTo, utils.getHours(dateToTransferFrom));
|
|
731
|
-
}
|
|
732
|
-
case 'minutes':
|
|
733
|
-
{
|
|
734
|
-
return utils.setMinutes(dateToTransferTo, utils.getMinutes(dateToTransferFrom));
|
|
735
|
-
}
|
|
736
|
-
case 'seconds':
|
|
737
|
-
{
|
|
738
|
-
return utils.setSeconds(dateToTransferTo, utils.getSeconds(dateToTransferFrom));
|
|
739
|
-
}
|
|
740
|
-
default:
|
|
741
|
-
{
|
|
742
|
-
return dateToTransferTo;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
};
|
|
746
|
-
var reliableSectionModificationOrder = {
|
|
747
|
-
year: 1,
|
|
748
|
-
month: 2,
|
|
749
|
-
day: 3,
|
|
750
|
-
weekDay: 4,
|
|
751
|
-
hours: 5,
|
|
752
|
-
minutes: 6,
|
|
753
|
-
seconds: 7,
|
|
754
|
-
meridiem: 8,
|
|
755
|
-
empty: 9
|
|
756
|
-
};
|
|
757
|
-
export var mergeDateIntoReferenceDate = function mergeDateIntoReferenceDate(utils, timezone, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) {
|
|
758
|
-
return (
|
|
759
|
-
// cloning sections before sort to avoid mutating it
|
|
760
|
-
_toConsumableArray(sections).sort(function (a, b) {
|
|
761
|
-
return reliableSectionModificationOrder[a.type] - reliableSectionModificationOrder[b.type];
|
|
762
|
-
}).reduce(function (mergedDate, section) {
|
|
763
|
-
if (!shouldLimitToEditedSections || section.modified) {
|
|
764
|
-
return transferDateSectionValue(utils, timezone, section, dateToTransferFrom, mergedDate);
|
|
765
|
-
}
|
|
766
|
-
return mergedDate;
|
|
767
|
-
}, referenceDate)
|
|
768
|
-
);
|
|
769
|
-
};
|
|
770
|
-
export var isAndroid = function isAndroid() {
|
|
771
|
-
return navigator.userAgent.toLowerCase().indexOf('android') > -1;
|
|
772
|
-
};
|
|
773
|
-
export var getSectionOrder = function getSectionOrder(sections, isRTL) {
|
|
774
|
-
var neighbors = {};
|
|
775
|
-
if (!isRTL) {
|
|
776
|
-
sections.forEach(function (_, index) {
|
|
777
|
-
var leftIndex = index === 0 ? null : index - 1;
|
|
778
|
-
var rightIndex = index === sections.length - 1 ? null : index + 1;
|
|
779
|
-
neighbors[index] = {
|
|
780
|
-
leftIndex: leftIndex,
|
|
781
|
-
rightIndex: rightIndex
|
|
782
|
-
};
|
|
783
|
-
});
|
|
784
|
-
return {
|
|
785
|
-
neighbors: neighbors,
|
|
786
|
-
startIndex: 0,
|
|
787
|
-
endIndex: sections.length - 1
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
var rtl2ltr = {};
|
|
791
|
-
var ltr2rtl = {};
|
|
792
|
-
var groupedSectionsStart = 0;
|
|
793
|
-
var groupedSectionsEnd = 0;
|
|
794
|
-
var RTLIndex = sections.length - 1;
|
|
795
|
-
while (RTLIndex >= 0) {
|
|
796
|
-
groupedSectionsEnd = sections.findIndex(
|
|
797
|
-
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
|
798
|
-
function (section, index) {
|
|
799
|
-
var _section$endSeparator;
|
|
800
|
-
return index >= groupedSectionsStart && ((_section$endSeparator = section.endSeparator) == null ? void 0 : _section$endSeparator.includes(' ')) &&
|
|
801
|
-
// Special case where the spaces were not there in the initial input
|
|
802
|
-
section.endSeparator !== ' / ';
|
|
803
|
-
});
|
|
804
|
-
if (groupedSectionsEnd === -1) {
|
|
805
|
-
groupedSectionsEnd = sections.length - 1;
|
|
806
|
-
}
|
|
807
|
-
for (var i = groupedSectionsEnd; i >= groupedSectionsStart; i -= 1) {
|
|
808
|
-
ltr2rtl[i] = RTLIndex;
|
|
809
|
-
rtl2ltr[RTLIndex] = i;
|
|
810
|
-
RTLIndex -= 1;
|
|
811
|
-
}
|
|
812
|
-
groupedSectionsStart = groupedSectionsEnd + 1;
|
|
813
|
-
}
|
|
814
|
-
sections.forEach(function (_, index) {
|
|
815
|
-
var rtlIndex = ltr2rtl[index];
|
|
816
|
-
var leftIndex = rtlIndex === 0 ? null : rtl2ltr[rtlIndex - 1];
|
|
817
|
-
var rightIndex = rtlIndex === sections.length - 1 ? null : rtl2ltr[rtlIndex + 1];
|
|
818
|
-
neighbors[index] = {
|
|
819
|
-
leftIndex: leftIndex,
|
|
820
|
-
rightIndex: rightIndex
|
|
821
|
-
};
|
|
822
|
-
});
|
|
823
|
-
return {
|
|
824
|
-
neighbors: neighbors,
|
|
825
|
-
startIndex: rtl2ltr[0],
|
|
826
|
-
endIndex: rtl2ltr[sections.length - 1]
|
|
827
|
-
};
|
|
828
|
-
};
|