@mui/x-date-pickers 7.0.0-alpha.7 → 7.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdapterDateFns/AdapterDateFns.d.ts +4 -21
- package/AdapterDateFns/AdapterDateFns.js +11 -255
- package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +62 -0
- package/AdapterDateFnsBase/AdapterDateFnsBase.js +291 -0
- package/AdapterDateFnsBase/index.d.ts +1 -0
- package/AdapterDateFnsBase/index.js +1 -0
- package/AdapterDateFnsBase/package.json +6 -0
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -0
- package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +80 -0
- package/AdapterDateFnsV3/AdapterDateFnsV3.js +287 -0
- package/AdapterDateFnsV3/index.d.ts +1 -0
- package/AdapterDateFnsV3/index.js +1 -0
- package/AdapterDateFnsV3/package.json +6 -0
- package/AdapterLuxon/AdapterLuxon.d.ts +1 -1
- package/AdapterLuxon/AdapterLuxon.js +4 -12
- package/CHANGELOG.md +554 -51
- package/DatePicker/DatePicker.js +0 -3
- package/DatePicker/DatePickerToolbar.d.ts +2 -2
- package/DatePicker/DatePickerToolbar.js +2 -10
- package/DateTimePicker/DateTimePicker.js +0 -3
- package/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/DigitalClock/DigitalClock.js +1 -0
- package/DigitalClock/DigitalClock.types.d.ts +5 -0
- package/LocalizationProvider/LocalizationProvider.js +1 -1
- package/MobileDatePicker/MobileDatePicker.js +0 -3
- package/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/MobileTimePicker/MobileTimePicker.js +0 -3
- package/MonthCalendar/MonthCalendar.js +0 -3
- package/MonthCalendar/MonthCalendar.types.d.ts +0 -3
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +5 -0
- package/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +0 -3
- package/PickersSectionList/PickersSectionList.js +7 -2
- package/PickersTextField/PickersFilledInput/PickersFilledInput.d.ts +11 -0
- package/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +98 -25
- package/PickersTextField/PickersFilledInput/index.d.ts +4 -0
- package/PickersTextField/PickersFilledInput/index.js +2 -0
- package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.d.ts +23 -0
- package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
- package/PickersTextField/PickersInput/PickersInput.d.ts +10 -0
- package/PickersTextField/PickersInput/PickersInput.js +196 -0
- package/{internals/components → PickersTextField}/PickersInput/index.d.ts +2 -2
- package/PickersTextField/PickersInput/index.js +2 -0
- package/PickersTextField/PickersInput/pickersInputClasses.d.ts +22 -0
- package/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
- package/PickersTextField/PickersInputBase/PickersInputBase.d.ts +16 -0
- package/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -28
- package/{internals/components/PickersInput/PickersInput.types.d.ts → PickersTextField/PickersInputBase/PickersInputBase.types.d.ts} +3 -13
- package/PickersTextField/PickersInputBase/index.d.ts +4 -0
- package/PickersTextField/PickersInputBase/index.js +2 -0
- package/PickersTextField/PickersInputBase/pickersInputBaseClasses.d.ts +31 -0
- package/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
- package/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.d.ts +3 -0
- package/{modern/internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.d.ts +10 -0
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +190 -0
- package/PickersTextField/PickersOutlinedInput/index.d.ts +4 -0
- package/PickersTextField/PickersOutlinedInput/index.js +2 -0
- package/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.d.ts +22 -0
- package/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
- package/PickersTextField/PickersTextField.d.ts +3 -0
- package/PickersTextField/PickersTextField.js +258 -0
- package/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.d.ts +5 -2
- package/PickersTextField/index.d.ts +8 -0
- package/PickersTextField/index.js +6 -0
- package/PickersTextField/package.json +6 -0
- package/README.md +1 -1
- package/StaticDatePicker/StaticDatePicker.js +0 -3
- package/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/StaticTimePicker/StaticTimePicker.js +0 -3
- package/TimeClock/TimeClock.js +1 -0
- package/TimeClock/TimeClock.types.d.ts +5 -0
- package/TimePicker/TimePicker.js +0 -3
- package/TimePicker/TimePickerToolbar.js +0 -3
- package/YearCalendar/YearCalendar.js +0 -3
- package/YearCalendar/YearCalendar.types.d.ts +0 -3
- package/hooks/useClearableField.js +3 -3
- package/index.d.ts +2 -1
- package/index.js +3 -2
- package/internals/hooks/useField/useField.js +6 -4
- package/internals/hooks/useField/useField.types.d.ts +4 -2
- package/internals/hooks/useField/useField.utils.d.ts +19 -9
- package/internals/hooks/useField/useField.utils.js +73 -26
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +2 -1
- package/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
- package/internals/hooks/useField/useFieldState.d.ts +1 -0
- package/internals/hooks/useField/useFieldState.js +9 -7
- package/internals/hooks/usePicker/index.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/internals/hooks/useUtils.js +2 -2
- package/internals/hooks/useViews.js +2 -2
- package/internals/index.d.ts +9 -3
- package/internals/index.js +6 -2
- package/internals/models/common.d.ts +1 -1
- package/internals/models/helpers.d.ts +1 -0
- package/internals/models/props/basePickerProps.d.ts +0 -3
- package/internals/models/props/toolbar.d.ts +0 -3
- package/internals/utils/valueManagers.js +2 -2
- package/internals/utils/views.js +1 -1
- package/legacy/AdapterDateFns/AdapterDateFns.js +222 -458
- package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +293 -0
- package/legacy/AdapterDateFnsBase/index.js +1 -0
- package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +306 -0
- package/legacy/AdapterDateFnsV3/index.js +1 -0
- package/legacy/AdapterLuxon/AdapterLuxon.js +4 -12
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -6
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -6
- package/legacy/DatePicker/DatePicker.js +0 -3
- package/legacy/DatePicker/DatePickerToolbar.js +2 -10
- package/legacy/DateTimePicker/DateTimePicker.js +0 -3
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/legacy/DigitalClock/DigitalClock.js +1 -0
- package/legacy/LocalizationProvider/LocalizationProvider.js +1 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +0 -3
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/legacy/MobileTimePicker/MobileTimePicker.js +0 -3
- package/legacy/MonthCalendar/MonthCalendar.js +0 -3
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/legacy/PickersSectionList/PickersSectionList.js +7 -2
- package/legacy/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +99 -26
- package/legacy/PickersTextField/PickersFilledInput/index.js +2 -0
- package/legacy/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
- package/legacy/PickersTextField/PickersInput/PickersInput.js +190 -0
- package/legacy/PickersTextField/PickersInput/index.js +2 -0
- package/legacy/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
- package/legacy/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -28
- package/legacy/PickersTextField/PickersInputBase/index.js +2 -0
- package/legacy/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
- package/legacy/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +7 -1
- package/legacy/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +183 -0
- package/legacy/PickersTextField/PickersOutlinedInput/index.js +2 -0
- package/legacy/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
- package/legacy/{internals/components/PickersTextField → PickersTextField}/PickersTextField.js +128 -8
- package/legacy/PickersTextField/index.js +6 -0
- package/legacy/StaticDatePicker/StaticDatePicker.js +0 -3
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/legacy/StaticTimePicker/StaticTimePicker.js +0 -3
- package/legacy/TimeClock/TimeClock.js +1 -0
- package/legacy/TimePicker/TimePicker.js +0 -3
- package/legacy/TimePicker/TimePickerToolbar.js +0 -3
- package/legacy/YearCalendar/YearCalendar.js +0 -3
- package/legacy/hooks/useClearableField.js +3 -3
- package/legacy/index.js +3 -2
- package/legacy/internals/hooks/useField/useField.js +6 -4
- package/legacy/internals/hooks/useField/useField.utils.js +76 -25
- package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
- package/legacy/internals/hooks/useField/useFieldState.js +15 -11
- package/legacy/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/legacy/internals/hooks/useUtils.js +2 -2
- package/legacy/internals/hooks/useViews.js +2 -2
- package/legacy/internals/index.js +6 -2
- package/legacy/internals/utils/valueManagers.js +2 -2
- package/legacy/internals/utils/views.js +1 -1
- package/legacy/locales/index.js +1 -0
- package/locales/enUS.d.ts +1 -1
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/mk.d.ts +1 -1
- package/locales/utils/getPickersLocalization.d.ts +1 -1
- package/modern/AdapterDateFns/AdapterDateFns.js +11 -254
- package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +290 -0
- package/modern/AdapterDateFnsBase/index.js +1 -0
- package/modern/AdapterDateFnsV3/AdapterDateFnsV3.js +287 -0
- package/modern/AdapterDateFnsV3/index.js +1 -0
- package/modern/AdapterLuxon/AdapterLuxon.js +3 -11
- package/modern/DatePicker/DatePicker.js +0 -3
- package/modern/DatePicker/DatePickerToolbar.js +2 -10
- package/modern/DateTimePicker/DateTimePicker.js +0 -3
- package/modern/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/modern/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/modern/DigitalClock/DigitalClock.js +1 -0
- package/modern/LocalizationProvider/LocalizationProvider.js +1 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +0 -3
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/modern/MobileTimePicker/MobileTimePicker.js +0 -3
- package/modern/MonthCalendar/MonthCalendar.js +0 -3
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/modern/PickersSectionList/PickersSectionList.js +7 -2
- package/modern/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +98 -25
- package/modern/PickersTextField/PickersFilledInput/index.js +2 -0
- package/modern/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
- package/modern/PickersTextField/PickersInput/PickersInput.js +196 -0
- package/modern/PickersTextField/PickersInput/index.js +2 -0
- package/modern/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
- package/modern/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -28
- package/modern/PickersTextField/PickersInputBase/index.js +2 -0
- package/modern/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
- package/{internals/components/PickersInput → modern/PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
- package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +190 -0
- package/modern/PickersTextField/PickersOutlinedInput/index.js +2 -0
- package/modern/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
- package/modern/PickersTextField/PickersTextField.js +258 -0
- package/modern/PickersTextField/index.js +6 -0
- package/modern/StaticDatePicker/StaticDatePicker.js +0 -3
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/modern/StaticTimePicker/StaticTimePicker.js +0 -3
- package/modern/TimeClock/TimeClock.js +1 -0
- package/modern/TimePicker/TimePicker.js +0 -3
- package/modern/TimePicker/TimePickerToolbar.js +0 -3
- package/modern/YearCalendar/YearCalendar.js +0 -3
- package/modern/hooks/useClearableField.js +3 -3
- package/modern/index.js +3 -2
- package/modern/internals/hooks/useField/useField.js +5 -3
- package/modern/internals/hooks/useField/useField.utils.js +73 -26
- package/modern/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
- package/modern/internals/hooks/useField/useFieldState.js +9 -7
- package/modern/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/modern/internals/hooks/useUtils.js +2 -2
- package/modern/internals/hooks/useViews.js +2 -2
- package/modern/internals/index.js +6 -2
- package/modern/internals/utils/valueManagers.js +2 -2
- package/modern/internals/utils/views.js +1 -1
- package/modern/locales/index.js +1 -0
- package/node/AdapterDateFns/AdapterDateFns.js +11 -254
- package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +298 -0
- package/node/AdapterDateFnsBase/index.js +12 -0
- package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +295 -0
- package/node/AdapterDateFnsV3/index.js +12 -0
- package/node/AdapterLuxon/AdapterLuxon.js +3 -11
- package/node/DatePicker/DatePicker.js +0 -3
- package/node/DatePicker/DatePickerToolbar.js +0 -7
- package/node/DateTimePicker/DateTimePicker.js +0 -3
- package/node/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/node/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/node/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/node/DigitalClock/DigitalClock.js +1 -0
- package/node/LocalizationProvider/LocalizationProvider.js +1 -1
- package/node/MobileDatePicker/MobileDatePicker.js +0 -3
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/node/MobileTimePicker/MobileTimePicker.js +0 -3
- package/node/MonthCalendar/MonthCalendar.js +0 -3
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/node/PickersSectionList/PickersSectionList.js +7 -2
- package/node/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +102 -30
- package/node/PickersTextField/PickersFilledInput/index.js +25 -0
- package/node/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +16 -0
- package/node/PickersTextField/PickersInput/PickersInput.js +204 -0
- package/node/{internals/components → PickersTextField}/PickersInput/index.js +0 -7
- package/node/PickersTextField/PickersInput/pickersInputClasses.js +16 -0
- package/node/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +105 -28
- package/node/PickersTextField/PickersInputBase/index.js +25 -0
- package/node/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +14 -0
- package/node/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
- package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +197 -0
- package/node/PickersTextField/PickersOutlinedInput/index.js +25 -0
- package/node/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +16 -0
- package/node/{internals/components/PickersTextField → PickersTextField}/PickersTextField.js +128 -9
- package/node/PickersTextField/index.js +78 -0
- package/node/StaticDatePicker/StaticDatePicker.js +0 -3
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/node/StaticTimePicker/StaticTimePicker.js +0 -3
- package/node/TimeClock/TimeClock.js +1 -0
- package/node/TimePicker/TimePicker.js +0 -3
- package/node/TimePicker/TimePickerToolbar.js +0 -3
- package/node/YearCalendar/YearCalendar.js +0 -3
- package/node/hooks/useClearableField.js +3 -3
- package/node/index.js +17 -5
- package/node/internals/hooks/useField/useField.js +5 -3
- package/node/internals/hooks/useField/useField.utils.js +78 -27
- package/node/internals/hooks/useField/useFieldCharacterEditing.js +11 -7
- package/node/internals/hooks/useField/useFieldState.js +8 -6
- package/node/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/node/internals/hooks/useUtils.js +2 -2
- package/node/internals/hooks/useViews.js +2 -2
- package/node/internals/index.js +47 -1
- package/node/internals/utils/valueManagers.js +2 -2
- package/node/internals/utils/views.js +1 -1
- package/node/locales/index.js +11 -0
- package/package.json +8 -8
- package/themeAugmentation/components.d.ts +26 -0
- package/themeAugmentation/overrides.d.ts +16 -0
- package/themeAugmentation/props.d.ts +16 -0
- package/internals/components/PickersInput/PickersFilledInput.d.ts +0 -3
- package/internals/components/PickersInput/PickersInput.d.ts +0 -15
- package/internals/components/PickersInput/PickersOutlinedInput.d.ts +0 -3
- package/internals/components/PickersInput/PickersOutlinedInput.js +0 -117
- package/internals/components/PickersInput/PickersStandardInput.d.ts +0 -3
- package/internals/components/PickersInput/PickersStandardInput.js +0 -123
- package/internals/components/PickersInput/index.js +0 -3
- package/internals/components/PickersInput/pickersInputClasses.d.ts +0 -84
- package/internals/components/PickersInput/pickersInputClasses.js +0 -18
- package/internals/components/PickersTextField/PickersTextField.d.ts +0 -2
- package/internals/components/PickersTextField/PickersTextField.js +0 -138
- package/internals/components/PickersTextField/index.d.ts +0 -1
- package/internals/components/PickersTextField/index.js +0 -1
- package/legacy/internals/components/PickersInput/PickersOutlinedInput.js +0 -110
- package/legacy/internals/components/PickersInput/PickersStandardInput.js +0 -117
- package/legacy/internals/components/PickersInput/index.js +0 -3
- package/legacy/internals/components/PickersInput/pickersInputClasses.js +0 -18
- package/legacy/internals/components/PickersTextField/index.js +0 -1
- package/modern/internals/components/PickersInput/PickersOutlinedInput.js +0 -117
- package/modern/internals/components/PickersInput/PickersStandardInput.js +0 -123
- package/modern/internals/components/PickersInput/index.js +0 -3
- package/modern/internals/components/PickersInput/pickersInputClasses.js +0 -18
- package/modern/internals/components/PickersTextField/PickersTextField.js +0 -138
- package/modern/internals/components/PickersTextField/index.js +0 -1
- package/node/internals/components/PickersInput/PickersOutlinedInput.js +0 -125
- package/node/internals/components/PickersInput/PickersStandardInput.js +0 -132
- package/node/internals/components/PickersInput/pickersInputClasses.js +0 -29
- package/node/internals/components/PickersTextField/index.js +0 -12
- /package/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.d.ts +0 -0
- /package/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
- /package/legacy/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/legacy/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/legacy/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
- /package/modern/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/modern/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/modern/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
- /package/node/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/node/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/node/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
|
@@ -4,13 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.validateSections = exports.splitFormatIntoSections = exports.mergeDateIntoReferenceDate = exports.isAndroid = exports.getSectionsBoundaries = exports.getSectionVisibleValue = exports.getSectionOrder = exports.getLetterEditingOptions = exports.getDaysInWeekStr = exports.getDateSectionConfigFromFormatToken = exports.getDateFromDateSections = exports.doesSectionFormatHaveLeadingZeros = exports.createDateStrForInputFromSections = exports.cleanString = exports.cleanLeadingZeros = exports.cleanDigitSectionValue = exports.changeSectionValueFormat = exports.adjustSectionValue = exports.addPositionPropertiesToSections = void 0;
|
|
7
|
+
exports.validateSections = exports.splitFormatIntoSections = exports.removeLocalizedDigits = exports.mergeDateIntoReferenceDate = exports.isStringNumber = exports.isAndroid = exports.getSectionsBoundaries = exports.getSectionVisibleValue = exports.getSectionOrder = exports.getLocalizedDigits = exports.getLetterEditingOptions = exports.getDaysInWeekStr = exports.getDateSectionConfigFromFormatToken = exports.getDateFromDateSections = exports.doesSectionFormatHaveLeadingZeros = exports.createDateStrForInputFromSections = exports.cleanString = exports.cleanLeadingZeros = exports.cleanDigitSectionValue = exports.changeSectionValueFormat = exports.applyLocalizedDigits = exports.adjustSectionValue = exports.addPositionPropertiesToSections = exports.FORMAT_SECONDS_NO_LEADING_ZEROS = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _dateUtils = require("../../utils/date-utils");
|
|
10
10
|
const getDateSectionConfigFromFormatToken = (utils, formatToken) => {
|
|
11
11
|
const config = utils.formatTokenMap[formatToken];
|
|
12
12
|
if (config == null) {
|
|
13
|
-
throw new Error([`MUI: The token "${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'));
|
|
13
|
+
throw new Error([`MUI X: The token "${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'));
|
|
14
14
|
}
|
|
15
15
|
if (typeof config === 'string') {
|
|
16
16
|
return {
|
|
@@ -74,8 +74,59 @@ const getLetterEditingOptions = (utils, timezone, sectionType, format) => {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
+
|
|
78
|
+
// This format should be the same on all the adapters
|
|
79
|
+
// If some adapter does not respect this convention, then we will need to hardcode the format on each adapter.
|
|
77
80
|
exports.getLetterEditingOptions = getLetterEditingOptions;
|
|
78
|
-
const
|
|
81
|
+
const FORMAT_SECONDS_NO_LEADING_ZEROS = exports.FORMAT_SECONDS_NO_LEADING_ZEROS = 's';
|
|
82
|
+
const NON_LOCALIZED_DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
83
|
+
const getLocalizedDigits = utils => {
|
|
84
|
+
const today = utils.date(undefined);
|
|
85
|
+
const formattedZero = utils.formatByString(utils.setSeconds(today, 0), FORMAT_SECONDS_NO_LEADING_ZEROS);
|
|
86
|
+
if (formattedZero === '0') {
|
|
87
|
+
return NON_LOCALIZED_DIGITS;
|
|
88
|
+
}
|
|
89
|
+
return Array.from({
|
|
90
|
+
length: 10
|
|
91
|
+
}).map((_, index) => utils.formatByString(utils.setSeconds(today, index), FORMAT_SECONDS_NO_LEADING_ZEROS));
|
|
92
|
+
};
|
|
93
|
+
exports.getLocalizedDigits = getLocalizedDigits;
|
|
94
|
+
const removeLocalizedDigits = (valueStr, localizedDigits) => {
|
|
95
|
+
if (localizedDigits[0] === '0') {
|
|
96
|
+
return valueStr;
|
|
97
|
+
}
|
|
98
|
+
const digits = [];
|
|
99
|
+
let currentFormattedDigit = '';
|
|
100
|
+
for (let i = 0; i < valueStr.length; i += 1) {
|
|
101
|
+
currentFormattedDigit += valueStr[i];
|
|
102
|
+
const matchingDigitIndex = localizedDigits.indexOf(currentFormattedDigit);
|
|
103
|
+
if (matchingDigitIndex > -1) {
|
|
104
|
+
digits.push(matchingDigitIndex.toString());
|
|
105
|
+
currentFormattedDigit = '';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return digits.join('');
|
|
109
|
+
};
|
|
110
|
+
exports.removeLocalizedDigits = removeLocalizedDigits;
|
|
111
|
+
const applyLocalizedDigits = (valueStr, localizedDigits) => {
|
|
112
|
+
if (localizedDigits[0] === '0') {
|
|
113
|
+
return valueStr;
|
|
114
|
+
}
|
|
115
|
+
return valueStr.split('').map(char => localizedDigits[Number(char)]).join('');
|
|
116
|
+
};
|
|
117
|
+
exports.applyLocalizedDigits = applyLocalizedDigits;
|
|
118
|
+
const isStringNumber = (valueStr, localizedDigits) => {
|
|
119
|
+
const nonLocalizedValueStr = removeLocalizedDigits(valueStr, localizedDigits);
|
|
120
|
+
return !Number.isNaN(Number(nonLocalizedValueStr));
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Remove the leading zeroes to a digit section value.
|
|
125
|
+
* E.g.: `03` => `3`
|
|
126
|
+
* Warning: Should only be called with non-localized digits. Call `removeLocalizedDigits` with your value if needed.
|
|
127
|
+
*/
|
|
128
|
+
exports.isStringNumber = isStringNumber;
|
|
129
|
+
const cleanLeadingZeros = (valueStr, size) => {
|
|
79
130
|
let cleanValueStr = valueStr;
|
|
80
131
|
|
|
81
132
|
// Remove the leading zeros
|
|
@@ -88,10 +139,10 @@ const cleanLeadingZeros = (utils, valueStr, size) => {
|
|
|
88
139
|
return cleanValueStr;
|
|
89
140
|
};
|
|
90
141
|
exports.cleanLeadingZeros = cleanLeadingZeros;
|
|
91
|
-
const cleanDigitSectionValue = (utils,
|
|
142
|
+
const cleanDigitSectionValue = (utils, value, sectionBoundaries, localizedDigits, section) => {
|
|
92
143
|
if (process.env.NODE_ENV !== 'production') {
|
|
93
144
|
if (section.type !== 'day' && section.contentType === 'digit-with-letter') {
|
|
94
|
-
throw new Error([`MUI: The token "${section.format}" is a digit format with letter in it.'
|
|
145
|
+
throw new Error([`MUI X: The token "${section.format}" is a digit format with letter in it.'
|
|
95
146
|
This type of format is only supported for 'day' sections`].join('\n'));
|
|
96
147
|
}
|
|
97
148
|
}
|
|
@@ -101,14 +152,14 @@ const cleanDigitSectionValue = (utils, timezone, value, sectionBoundaries, secti
|
|
|
101
152
|
}
|
|
102
153
|
|
|
103
154
|
// queryValue without leading `0` (`01` => `1`)
|
|
104
|
-
|
|
155
|
+
let valueStr = value.toString();
|
|
105
156
|
if (section.hasLeadingZerosInInput) {
|
|
106
|
-
|
|
157
|
+
valueStr = cleanLeadingZeros(valueStr, section.maxLength);
|
|
107
158
|
}
|
|
108
|
-
return valueStr;
|
|
159
|
+
return applyLocalizedDigits(valueStr, localizedDigits);
|
|
109
160
|
};
|
|
110
161
|
exports.cleanDigitSectionValue = cleanDigitSectionValue;
|
|
111
|
-
const adjustSectionValue = (utils, timezone, section, keyCode, sectionsValueBoundaries, activeDate, stepsAttributes) => {
|
|
162
|
+
const adjustSectionValue = (utils, timezone, section, keyCode, sectionsValueBoundaries, localizedDigits, activeDate, stepsAttributes) => {
|
|
112
163
|
const delta = getDeltaFromKeyCode(keyCode);
|
|
113
164
|
const isStart = keyCode === 'Home';
|
|
114
165
|
const isEnd = keyCode === 'End';
|
|
@@ -119,9 +170,9 @@ const adjustSectionValue = (utils, timezone, section, keyCode, sectionsValueBoun
|
|
|
119
170
|
format: section.format,
|
|
120
171
|
contentType: section.contentType
|
|
121
172
|
});
|
|
122
|
-
const getCleanValue = value => cleanDigitSectionValue(utils,
|
|
173
|
+
const getCleanValue = value => cleanDigitSectionValue(utils, value, sectionBoundaries, localizedDigits, section);
|
|
123
174
|
const step = section.type === 'minutes' && stepsAttributes?.minutesStep ? stepsAttributes.minutesStep : 1;
|
|
124
|
-
const currentSectionValue = parseInt(section.value, 10);
|
|
175
|
+
const currentSectionValue = parseInt(removeLocalizedDigits(section.value, localizedDigits), 10);
|
|
125
176
|
let newSectionValueNumber = currentSectionValue + delta * step;
|
|
126
177
|
if (shouldSetAbsolute) {
|
|
127
178
|
if (section.type === 'year' && !isEnd && !isStart) {
|
|
@@ -170,11 +221,11 @@ const adjustSectionValue = (utils, timezone, section, keyCode, sectionsValueBoun
|
|
|
170
221
|
return adjustLetterSection();
|
|
171
222
|
};
|
|
172
223
|
exports.adjustSectionValue = adjustSectionValue;
|
|
173
|
-
const getSectionVisibleValue = (section, target) => {
|
|
224
|
+
const getSectionVisibleValue = (section, target, localizedDigits) => {
|
|
174
225
|
let value = section.value || section.placeholder;
|
|
175
226
|
const hasLeadingZeros = target === 'non-input' ? section.hasLeadingZerosInFormat : section.hasLeadingZerosInInput;
|
|
176
227
|
if (target === 'non-input' && section.hasLeadingZerosInInput && !section.hasLeadingZerosInFormat) {
|
|
177
|
-
value = Number(value).toString();
|
|
228
|
+
value = Number(removeLocalizedDigits(value, localizedDigits)).toString();
|
|
178
229
|
}
|
|
179
230
|
|
|
180
231
|
// In the input, we add an empty character at the end of each section without leading zeros.
|
|
@@ -194,13 +245,13 @@ const getSectionVisibleValue = (section, target) => {
|
|
|
194
245
|
exports.getSectionVisibleValue = getSectionVisibleValue;
|
|
195
246
|
const cleanString = dirtyString => dirtyString.replace(/[\u2066\u2067\u2068\u2069]/g, '');
|
|
196
247
|
exports.cleanString = cleanString;
|
|
197
|
-
const addPositionPropertiesToSections = (sections, isRTL) => {
|
|
248
|
+
const addPositionPropertiesToSections = (sections, localizedDigits, isRTL) => {
|
|
198
249
|
let position = 0;
|
|
199
250
|
let positionInInput = isRTL ? 1 : 0;
|
|
200
251
|
const newSections = [];
|
|
201
252
|
for (let i = 0; i < sections.length; i += 1) {
|
|
202
253
|
const section = sections[i];
|
|
203
|
-
const renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr');
|
|
254
|
+
const renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
204
255
|
const sectionStr = `${section.startSeparator}${renderedValue}${section.endSeparator}`;
|
|
205
256
|
const sectionLength = cleanString(sectionStr).length;
|
|
206
257
|
const sectionLengthInInput = sectionStr.length;
|
|
@@ -355,7 +406,7 @@ const getEscapedPartsFromFormat = (utils, format) => {
|
|
|
355
406
|
}
|
|
356
407
|
return escapedParts;
|
|
357
408
|
};
|
|
358
|
-
const splitFormatIntoSections = (utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL) => {
|
|
409
|
+
const splitFormatIntoSections = (utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL) => {
|
|
359
410
|
let startSeparator = '';
|
|
360
411
|
const sections = [];
|
|
361
412
|
const now = utils.date();
|
|
@@ -374,11 +425,11 @@ const splitFormatIntoSections = (utils, timezone, localeText, format, date, form
|
|
|
374
425
|
maxLength = sectionValue === '' ? utils.formatByString(now, token).length : sectionValue.length;
|
|
375
426
|
} else {
|
|
376
427
|
if (sectionConfig.maxLength == null) {
|
|
377
|
-
throw new Error(`MUI: The token ${token} should have a 'maxDigitNumber' property on it's adapter`);
|
|
428
|
+
throw new Error(`MUI X: The token ${token} should have a 'maxDigitNumber' property on it's adapter`);
|
|
378
429
|
}
|
|
379
430
|
maxLength = sectionConfig.maxLength;
|
|
380
431
|
if (isValidDate) {
|
|
381
|
-
sectionValue = cleanLeadingZeros(
|
|
432
|
+
sectionValue = applyLocalizedDigits(cleanLeadingZeros(removeLocalizedDigits(sectionValue, localizedDigits), maxLength), localizedDigits);
|
|
382
433
|
}
|
|
383
434
|
}
|
|
384
435
|
}
|
|
@@ -405,7 +456,7 @@ const splitFormatIntoSections = (utils, timezone, localeText, format, date, form
|
|
|
405
456
|
nextFormat = utils.expandFormat(prevFormat);
|
|
406
457
|
formatExpansionOverflow -= 1;
|
|
407
458
|
if (formatExpansionOverflow < 0) {
|
|
408
|
-
throw new Error('MUI: The format expansion seems to be enter in an infinite loop. Please open an issue with the format passed to the picker component');
|
|
459
|
+
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.');
|
|
409
460
|
}
|
|
410
461
|
}
|
|
411
462
|
const expandedFormat = nextFormat;
|
|
@@ -480,7 +531,7 @@ const splitFormatIntoSections = (utils, timezone, localeText, format, date, form
|
|
|
480
531
|
* To make sure that the parsing works, we are building a format and a date without any separator.
|
|
481
532
|
*/
|
|
482
533
|
exports.splitFormatIntoSections = splitFormatIntoSections;
|
|
483
|
-
const getDateFromDateSections = (utils, sections) => {
|
|
534
|
+
const getDateFromDateSections = (utils, sections, localizedDigits) => {
|
|
484
535
|
// If we have both a day and a weekDay section,
|
|
485
536
|
// Then we skip the weekDay in the parsing because libraries like dayjs can't parse complicated formats containing a weekDay.
|
|
486
537
|
// dayjs(dayjs().format('dddd MMMM D YYYY'), 'dddd MMMM D YYYY')) // returns `Invalid Date` even if the format is valid.
|
|
@@ -492,7 +543,7 @@ const getDateFromDateSections = (utils, sections) => {
|
|
|
492
543
|
const shouldSkip = shouldSkipWeekDays && section.type === 'weekDay';
|
|
493
544
|
if (!shouldSkip) {
|
|
494
545
|
sectionFormats.push(section.format);
|
|
495
|
-
sectionValues.push(getSectionVisibleValue(section, 'non-input'));
|
|
546
|
+
sectionValues.push(getSectionVisibleValue(section, 'non-input', localizedDigits));
|
|
496
547
|
}
|
|
497
548
|
}
|
|
498
549
|
const formatWithoutSeparator = sectionFormats.join(' ');
|
|
@@ -500,9 +551,9 @@ const getDateFromDateSections = (utils, sections) => {
|
|
|
500
551
|
return utils.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
|
|
501
552
|
};
|
|
502
553
|
exports.getDateFromDateSections = getDateFromDateSections;
|
|
503
|
-
const createDateStrForInputFromSections = (sections, isRTL) => {
|
|
554
|
+
const createDateStrForInputFromSections = (sections, localizedDigits, isRTL) => {
|
|
504
555
|
const formattedSections = sections.map(section => {
|
|
505
|
-
const dateValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr');
|
|
556
|
+
const dateValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
506
557
|
return `${section.startSeparator}${dateValue}${section.endSeparator}`;
|
|
507
558
|
});
|
|
508
559
|
const dateStr = formattedSections.join('');
|
|
@@ -518,7 +569,7 @@ const createDateStrForInputFromSections = (sections, isRTL) => {
|
|
|
518
569
|
return `\u2066${dateStr}\u2069`;
|
|
519
570
|
};
|
|
520
571
|
exports.createDateStrForInputFromSections = createDateStrForInputFromSections;
|
|
521
|
-
const getSectionsBoundaries = (utils, timezone) => {
|
|
572
|
+
const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
|
|
522
573
|
const today = utils.date(undefined, timezone);
|
|
523
574
|
const endOfYear = utils.endOfYear(today);
|
|
524
575
|
const endOfDay = utils.endOfDay(today);
|
|
@@ -577,11 +628,11 @@ const getSectionsBoundaries = (utils, timezone) => {
|
|
|
577
628
|
format
|
|
578
629
|
}) => {
|
|
579
630
|
const lastHourInDay = utils.getHours(endOfDay);
|
|
580
|
-
const hasMeridiem = utils.formatByString(utils.endOfDay(today), format) !== lastHourInDay.toString();
|
|
631
|
+
const hasMeridiem = removeLocalizedDigits(utils.formatByString(utils.endOfDay(today), format), localizedDigits) !== lastHourInDay.toString();
|
|
581
632
|
if (hasMeridiem) {
|
|
582
633
|
return {
|
|
583
634
|
minimum: 1,
|
|
584
|
-
maximum: Number(utils.formatByString(utils.startOfDay(today), format))
|
|
635
|
+
maximum: Number(removeLocalizedDigits(utils.formatByString(utils.startOfDay(today), format), localizedDigits))
|
|
585
636
|
};
|
|
586
637
|
}
|
|
587
638
|
return {
|
|
@@ -623,7 +674,7 @@ const validateSections = (sections, valueType) => {
|
|
|
623
674
|
}
|
|
624
675
|
const invalidSection = sections.find(section => !supportedSections.includes(section.type));
|
|
625
676
|
if (invalidSection) {
|
|
626
|
-
console.warn(`MUI: The field component you are using is not compatible with the "${invalidSection.type}" date section.`, `The supported date sections are ["${supportedSections.join('", "')}"]\`.`);
|
|
677
|
+
console.warn(`MUI X: The field component you are using is not compatible with the "${invalidSection.type}" date section.`, `The supported date sections are ["${supportedSections.join('", "')}"]\`.`);
|
|
627
678
|
warnedOnceInvalidSection = true;
|
|
628
679
|
}
|
|
629
680
|
}
|
|
@@ -48,6 +48,7 @@ const useFieldCharacterEditing = ({
|
|
|
48
48
|
sections,
|
|
49
49
|
updateSectionValue,
|
|
50
50
|
sectionsValueBoundaries,
|
|
51
|
+
localizedDigits,
|
|
51
52
|
setTempAndroidValueStr,
|
|
52
53
|
timezone
|
|
53
54
|
}) => {
|
|
@@ -76,7 +77,7 @@ const useFieldCharacterEditing = ({
|
|
|
76
77
|
const activeSection = sections[sectionIndex];
|
|
77
78
|
|
|
78
79
|
// The current query targets the section being editing
|
|
79
|
-
// We can try to
|
|
80
|
+
// We can try to concatenate the value
|
|
80
81
|
if (query != null && (!isValidQueryValue || isValidQueryValue(query.value)) && query.sectionIndex === sectionIndex) {
|
|
81
82
|
const concatenatedQueryValue = `${query.value}${cleanKeyPressed}`;
|
|
82
83
|
const queryResponse = getFirstSectionValueMatchingWithQuery(concatenatedQueryValue, activeSection);
|
|
@@ -170,7 +171,8 @@ const useFieldCharacterEditing = ({
|
|
|
170
171
|
};
|
|
171
172
|
const applyNumericEditing = params => {
|
|
172
173
|
const getNewSectionValue = (queryValue, section) => {
|
|
173
|
-
const
|
|
174
|
+
const cleanQueryValue = (0, _useField.removeLocalizedDigits)(queryValue, localizedDigits);
|
|
175
|
+
const queryValueNumber = Number(cleanQueryValue);
|
|
174
176
|
const sectionBoundaries = sectionsValueBoundaries[section.type]({
|
|
175
177
|
currentDate: null,
|
|
176
178
|
format: section.format,
|
|
@@ -190,8 +192,8 @@ const useFieldCharacterEditing = ({
|
|
|
190
192
|
saveQuery: true
|
|
191
193
|
};
|
|
192
194
|
}
|
|
193
|
-
const shouldGoToNextSection =
|
|
194
|
-
const newSectionValue = (0, _useField.cleanDigitSectionValue)(utils,
|
|
195
|
+
const shouldGoToNextSection = queryValueNumber * 10 > sectionBoundaries.maximum || cleanQueryValue.length === sectionBoundaries.maximum.toString().length;
|
|
196
|
+
const newSectionValue = (0, _useField.cleanDigitSectionValue)(utils, queryValueNumber, sectionBoundaries, localizedDigits, section);
|
|
195
197
|
return {
|
|
196
198
|
sectionValue: newSectionValue,
|
|
197
199
|
shouldGoToNextSection
|
|
@@ -239,12 +241,14 @@ const useFieldCharacterEditing = ({
|
|
|
239
241
|
saveQuery: false
|
|
240
242
|
};
|
|
241
243
|
};
|
|
242
|
-
return applyQuery(params, getFirstSectionValueMatchingWithQuery, queryValue =>
|
|
244
|
+
return applyQuery(params, getFirstSectionValueMatchingWithQuery, queryValue => (0, _useField.isStringNumber)(queryValue, localizedDigits));
|
|
243
245
|
};
|
|
244
246
|
const applyCharacterEditing = (0, _useEventCallback.default)(params => {
|
|
245
247
|
const activeSection = sections[params.sectionIndex];
|
|
246
|
-
const isNumericEditing =
|
|
247
|
-
const response = isNumericEditing ? applyNumericEditing(
|
|
248
|
+
const isNumericEditing = (0, _useField.isStringNumber)(params.keyPressed, localizedDigits);
|
|
249
|
+
const response = isNumericEditing ? applyNumericEditing((0, _extends2.default)({}, params, {
|
|
250
|
+
keyPressed: (0, _useField.applyLocalizedDigits)(params.keyPressed, localizedDigits)
|
|
251
|
+
})) : applyLetterEditing(params);
|
|
248
252
|
if (response == null) {
|
|
249
253
|
setTempAndroidValueStr(null);
|
|
250
254
|
} else {
|
|
@@ -51,9 +51,10 @@ const useFieldState = params => {
|
|
|
51
51
|
onChange,
|
|
52
52
|
valueManager
|
|
53
53
|
});
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
54
|
+
const localizedDigits = React.useMemo(() => (0, _useField.getLocalizedDigits)(utils), [utils]);
|
|
55
|
+
const sectionsValueBoundaries = React.useMemo(() => (0, _useField.getSectionsBoundaries)(utils, localizedDigits, timezone), [utils, localizedDigits, timezone]);
|
|
56
|
+
const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, localizedDigits, isRTL, date => (0, _useField.splitFormatIntoSections)(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL)), [fieldValueManager, format, localeText, localizedDigits, isRTL, shouldRespectLeadingZeros, utils, formatDensity, timezone]);
|
|
57
|
+
const placeholder = React.useMemo(() => fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), localizedDigits, isRTL), [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, localizedDigits, isRTL]);
|
|
57
58
|
const [state, setState] = React.useState(() => {
|
|
58
59
|
const sections = getSectionsFromValue(valueFromTheOutside);
|
|
59
60
|
(0, _useField.validateSections)(sections, valueType);
|
|
@@ -151,7 +152,7 @@ const useFieldState = params => {
|
|
|
151
152
|
value: newSectionValue,
|
|
152
153
|
modified: true
|
|
153
154
|
});
|
|
154
|
-
return (0, _useField.addPositionPropertiesToSections)(newSections, isRTL);
|
|
155
|
+
return (0, _useField.addPositionPropertiesToSections)(newSections, localizedDigits, isRTL);
|
|
155
156
|
};
|
|
156
157
|
const clearValue = () => {
|
|
157
158
|
publishValue({
|
|
@@ -188,7 +189,7 @@ const useFieldState = params => {
|
|
|
188
189
|
if (date == null || !utils.isValid(date)) {
|
|
189
190
|
return null;
|
|
190
191
|
}
|
|
191
|
-
const sections = (0, _useField.splitFormatIntoSections)(utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
|
|
192
|
+
const sections = (0, _useField.splitFormatIntoSections)(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
|
|
192
193
|
return (0, _useField.mergeDateIntoReferenceDate)(utils, timezone, date, sections, referenceDate, false);
|
|
193
194
|
};
|
|
194
195
|
const newValue = fieldValueManager.parseValueStr(valueStr, state.referenceValue, parseDateStr);
|
|
@@ -219,7 +220,7 @@ const useFieldState = params => {
|
|
|
219
220
|
const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
|
|
220
221
|
const newSections = setSectionValue(selectedSectionIndexes.startIndex, newSectionValue);
|
|
221
222
|
const newActiveDateSections = activeDateManager.getSections(newSections);
|
|
222
|
-
const newActiveDate = (0, _useField.getDateFromDateSections)(utils, newActiveDateSections);
|
|
223
|
+
const newActiveDate = (0, _useField.getDateFromDateSections)(utils, newActiveDateSections, localizedDigits);
|
|
223
224
|
let values;
|
|
224
225
|
let shouldPublish;
|
|
225
226
|
|
|
@@ -287,6 +288,7 @@ const useFieldState = params => {
|
|
|
287
288
|
updateValueFromValueStr,
|
|
288
289
|
setTempAndroidValueStr,
|
|
289
290
|
sectionsValueBoundaries,
|
|
291
|
+
localizedDigits,
|
|
290
292
|
placeholder,
|
|
291
293
|
timezone
|
|
292
294
|
};
|
|
@@ -146,12 +146,12 @@ const usePickerValue = ({
|
|
|
146
146
|
if (process.env.NODE_ENV !== 'production') {
|
|
147
147
|
React.useEffect(() => {
|
|
148
148
|
if (isControlled !== (inValue !== undefined)) {
|
|
149
|
-
console.error([`MUI: A component is changing the ${isControlled ? '' : 'un'}controlled value of a picker to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled value` + 'for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
149
|
+
console.error([`MUI X: A component is changing the ${isControlled ? '' : 'un'}controlled value of a picker to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled value` + 'for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
150
150
|
}
|
|
151
151
|
}, [inValue]);
|
|
152
152
|
React.useEffect(() => {
|
|
153
153
|
if (!isControlled && defaultValue !== inDefaultValue) {
|
|
154
|
-
console.error([`MUI: A component is changing the defaultValue of an uncontrolled picker after being initialized. ` + `To suppress this warning opt to use a controlled value.`].join('\n'));
|
|
154
|
+
console.error([`MUI X: A component is changing the defaultValue of an uncontrolled picker after being initialized. ` + `To suppress this warning opt to use a controlled value.`].join('\n'));
|
|
155
155
|
}
|
|
156
156
|
}, [JSON.stringify(defaultValue)]);
|
|
157
157
|
}
|
|
@@ -14,10 +14,10 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
14
14
|
const useLocalizationContext = () => {
|
|
15
15
|
const localization = React.useContext(_LocalizationProvider.MuiPickersAdapterContext);
|
|
16
16
|
if (localization === null) {
|
|
17
|
-
throw new Error(['MUI: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
|
|
17
|
+
throw new Error(['MUI X: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
|
|
18
18
|
}
|
|
19
19
|
if (localization.utils === null) {
|
|
20
|
-
throw new Error(['MUI: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
|
|
20
|
+
throw new Error(['MUI X: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
|
|
21
21
|
}
|
|
22
22
|
const localeText = React.useMemo(() => (0, _extends2.default)({}, _enUS.DEFAULT_LOCALE, localization.localeText), [localization.localeText]);
|
|
23
23
|
return React.useMemo(() => (0, _extends2.default)({}, localization, {
|
|
@@ -24,11 +24,11 @@ function useViews({
|
|
|
24
24
|
if (process.env.NODE_ENV !== 'production') {
|
|
25
25
|
if (!warnedOnceNotValidView) {
|
|
26
26
|
if (inView != null && !views.includes(inView)) {
|
|
27
|
-
console.warn(`MUI: \`view="${inView}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
27
|
+
console.warn(`MUI X: \`view="${inView}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
28
28
|
warnedOnceNotValidView = true;
|
|
29
29
|
}
|
|
30
30
|
if (inView == null && openTo != null && !views.includes(openTo)) {
|
|
31
|
-
console.warn(`MUI: \`openTo="${openTo}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
31
|
+
console.warn(`MUI X: \`openTo="${openTo}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
32
32
|
warnedOnceNotValidView = true;
|
|
33
33
|
}
|
|
34
34
|
}
|
package/node/internals/index.js
CHANGED
|
@@ -69,6 +69,12 @@ Object.defineProperty(exports, "applyDefaultDate", {
|
|
|
69
69
|
return _dateUtils.applyDefaultDate;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
+
Object.defineProperty(exports, "applyDefaultViewProps", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _views.applyDefaultViewProps;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
72
78
|
Object.defineProperty(exports, "areDatesEqual", {
|
|
73
79
|
enumerable: true,
|
|
74
80
|
get: function () {
|
|
@@ -111,6 +117,12 @@ Object.defineProperty(exports, "extractValidationProps", {
|
|
|
111
117
|
return _extractValidationProps.extractValidationProps;
|
|
112
118
|
}
|
|
113
119
|
});
|
|
120
|
+
Object.defineProperty(exports, "formatMeridiem", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _dateUtils.formatMeridiem;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
114
126
|
Object.defineProperty(exports, "getActiveElement", {
|
|
115
127
|
enumerable: true,
|
|
116
128
|
get: function () {
|
|
@@ -129,6 +141,24 @@ Object.defineProperty(exports, "getTodayDate", {
|
|
|
129
141
|
return _dateUtils.getTodayDate;
|
|
130
142
|
}
|
|
131
143
|
});
|
|
144
|
+
Object.defineProperty(exports, "isDatePickerView", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () {
|
|
147
|
+
return _dateUtils.isDatePickerView;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "isTimeView", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () {
|
|
153
|
+
return _timeUtils.isTimeView;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "mergeDateAndTime", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _dateUtils.mergeDateAndTime;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
132
162
|
Object.defineProperty(exports, "onSpaceOrEnter", {
|
|
133
163
|
enumerable: true,
|
|
134
164
|
get: function () {
|
|
@@ -171,6 +201,12 @@ Object.defineProperty(exports, "replaceInvalidDateByNull", {
|
|
|
171
201
|
return _dateUtils.replaceInvalidDateByNull;
|
|
172
202
|
}
|
|
173
203
|
});
|
|
204
|
+
Object.defineProperty(exports, "resolveTimeViewsResponse", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function () {
|
|
207
|
+
return _dateTimeUtils.resolveTimeViewsResponse;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
174
210
|
Object.defineProperty(exports, "splitFieldInternalAndForwardedProps", {
|
|
175
211
|
enumerable: true,
|
|
176
212
|
get: function () {
|
|
@@ -261,6 +297,12 @@ Object.defineProperty(exports, "useValidation", {
|
|
|
261
297
|
return _useValidation.useValidation;
|
|
262
298
|
}
|
|
263
299
|
});
|
|
300
|
+
Object.defineProperty(exports, "useViews", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () {
|
|
303
|
+
return _useViews.useViews;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
264
306
|
Object.defineProperty(exports, "validateDate", {
|
|
265
307
|
enumerable: true,
|
|
266
308
|
get: function () {
|
|
@@ -295,10 +337,12 @@ var _useField = require("./hooks/useField");
|
|
|
295
337
|
var _usePicker = require("./hooks/usePicker");
|
|
296
338
|
var _useStaticPicker = require("./hooks/useStaticPicker");
|
|
297
339
|
var _useUtils = require("./hooks/useUtils");
|
|
340
|
+
var _useViews = require("./hooks/useViews");
|
|
298
341
|
var _useValidation = require("./hooks/useValidation");
|
|
299
342
|
var _dateHelpersHooks = require("./hooks/date-helpers-hooks");
|
|
300
343
|
var _convertFieldResponseIntoMuiTextFieldProps = require("./utils/convertFieldResponseIntoMuiTextFieldProps");
|
|
301
344
|
var _dateUtils = require("./utils/date-utils");
|
|
345
|
+
var _dateTimeUtils = require("./utils/date-time-utils");
|
|
302
346
|
var _fields = require("./utils/fields");
|
|
303
347
|
var _getDefaultReferenceDate = require("./utils/getDefaultReferenceDate");
|
|
304
348
|
var _utils = require("./utils/utils");
|
|
@@ -307,6 +351,8 @@ var _extractValidationProps = require("./utils/validation/extractValidationProps
|
|
|
307
351
|
var _validateDate = require("./utils/validation/validateDate");
|
|
308
352
|
var _validateDateTime = require("./utils/validation/validateDateTime");
|
|
309
353
|
var _validateTime = require("./utils/validation/validateTime");
|
|
354
|
+
var _views = require("./utils/views");
|
|
310
355
|
var _warning = require("./utils/warning");
|
|
311
356
|
var _DayCalendar = require("../DateCalendar/DayCalendar");
|
|
312
|
-
var _useCalendarState = require("../DateCalendar/useCalendarState");
|
|
357
|
+
var _useCalendarState = require("../DateCalendar/useCalendarState");
|
|
358
|
+
var _timeUtils = require("./utils/time-utils");
|
|
@@ -37,12 +37,12 @@ const singleItemValueManager = exports.singleItemValueManager = {
|
|
|
37
37
|
};
|
|
38
38
|
const singleItemFieldValueManager = exports.singleItemFieldValueManager = {
|
|
39
39
|
updateReferenceValue: (utils, value, prevReferenceValue) => value == null || !utils.isValid(value) ? prevReferenceValue : value,
|
|
40
|
-
getSectionsFromValue: (utils, date, prevSections, isRTL, getSectionsFromDate) => {
|
|
40
|
+
getSectionsFromValue: (utils, date, prevSections, localizedDigits, isRTL, getSectionsFromDate) => {
|
|
41
41
|
const shouldReUsePrevDateSections = !utils.isValid(date) && !!prevSections;
|
|
42
42
|
if (shouldReUsePrevDateSections) {
|
|
43
43
|
return prevSections;
|
|
44
44
|
}
|
|
45
|
-
return (0, _useField.addPositionPropertiesToSections)(getSectionsFromDate(date), isRTL);
|
|
45
|
+
return (0, _useField.addPositionPropertiesToSections)(getSectionsFromDate(date), localizedDigits, isRTL);
|
|
46
46
|
},
|
|
47
47
|
getValueStrFromSections: _useField.createDateStrForInputFromSections,
|
|
48
48
|
getActiveDateManager: (utils, state) => ({
|
|
@@ -26,7 +26,7 @@ const applyDefaultViewProps = ({
|
|
|
26
26
|
} else if (viewsWithDefault.length > 0) {
|
|
27
27
|
openToWithDefault = viewsWithDefault[0];
|
|
28
28
|
} else {
|
|
29
|
-
throw new Error('MUI: The `views` prop must contain at least one view');
|
|
29
|
+
throw new Error('MUI X: The `views` prop must contain at least one view.');
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
32
|
views: viewsWithDefault,
|
package/node/locales/index.js
CHANGED
|
@@ -36,6 +36,17 @@ Object.keys(_csCZ).forEach(function (key) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
+
var _daDK = require("./daDK");
|
|
40
|
+
Object.keys(_daDK).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _daDK[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _daDK[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
39
50
|
var _deDE = require("./deDE");
|
|
40
51
|
Object.keys(_deDE).forEach(function (key) {
|
|
41
52
|
if (key === "default" || key === "__esModule") return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.9",
|
|
4
4
|
"description": "The community edition of the date picker components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"directory": "packages/x-date-pickers"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@babel/runtime": "^7.23.
|
|
38
|
-
"@mui/base": "^5.0.0-beta.
|
|
39
|
-
"@mui/system": "^5.15.
|
|
40
|
-
"@mui/utils": "^5.15.
|
|
37
|
+
"@babel/runtime": "^7.23.8",
|
|
38
|
+
"@mui/base": "^5.0.0-beta.32",
|
|
39
|
+
"@mui/system": "^5.15.5",
|
|
40
|
+
"@mui/utils": "^5.15.5",
|
|
41
41
|
"@types/react-transition-group": "^4.4.10",
|
|
42
|
-
"clsx": "^2.
|
|
42
|
+
"clsx": "^2.1.0",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"react-transition-group": "^4.4.5"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@emotion/react": "^11.9.0",
|
|
48
48
|
"@emotion/styled": "^11.8.1",
|
|
49
|
-
"@mui/material": "^5.
|
|
50
|
-
"date-fns": "^2.25.0",
|
|
49
|
+
"@mui/material": "^5.15.0",
|
|
50
|
+
"date-fns": "^2.25.0 || ^3.2.0",
|
|
51
51
|
"date-fns-jalali": "^2.13.0-0",
|
|
52
52
|
"dayjs": "^1.10.7",
|
|
53
53
|
"luxon": "^3.0.2",
|
|
@@ -167,6 +167,32 @@ export interface PickerComponents<Theme = unknown> {
|
|
|
167
167
|
MuiStaticDateTimePicker?: {
|
|
168
168
|
defaultProps?: ComponentsProps['MuiStaticDateTimePicker'];
|
|
169
169
|
};
|
|
170
|
+
|
|
171
|
+
// PickersTextField
|
|
172
|
+
MuiPickersTextField?: {
|
|
173
|
+
defaultProps?: ComponentsProps['MuiPickersTextField'];
|
|
174
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersTextField'];
|
|
175
|
+
};
|
|
176
|
+
MuiPickersInputBase?: {
|
|
177
|
+
defaultProps?: ComponentsProps['MuiPickersInputBase'];
|
|
178
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersInputBase'];
|
|
179
|
+
};
|
|
180
|
+
MuiPickersInput?: {
|
|
181
|
+
defaultProps?: ComponentsProps['MuiPickersInput'];
|
|
182
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersInput'];
|
|
183
|
+
};
|
|
184
|
+
MuiPickersFilledInput?: {
|
|
185
|
+
defaultProps?: ComponentsProps['MuiPickersFilledInput'];
|
|
186
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersFilledInput'];
|
|
187
|
+
};
|
|
188
|
+
MuiPickersOutlinedInput?: {
|
|
189
|
+
defaultProps?: ComponentsProps['MuiPickersOutlinedInput'];
|
|
190
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersOutlinedInput'];
|
|
191
|
+
};
|
|
192
|
+
MuiPickersSectionList?: {
|
|
193
|
+
defaultProps?: ComponentsProps['MuiPickersSectionList'];
|
|
194
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersSectionList'];
|
|
195
|
+
};
|
|
170
196
|
}
|
|
171
197
|
|
|
172
198
|
declare module '@mui/material/styles' {
|
|
@@ -29,6 +29,14 @@ import {
|
|
|
29
29
|
MultiSectionDigitalClockClassKey,
|
|
30
30
|
MultiSectionDigitalClockSectionClassKey,
|
|
31
31
|
} from '../MultiSectionDigitalClock';
|
|
32
|
+
import {
|
|
33
|
+
PickersTextFieldClassKey,
|
|
34
|
+
PickersInputClassKey,
|
|
35
|
+
PickersOutlinedInputClassKey,
|
|
36
|
+
PickersFilledInputClassKey,
|
|
37
|
+
PickersInputBaseClassKey,
|
|
38
|
+
} from '../PickersTextField';
|
|
39
|
+
import { PickersSectionListClassKey } from '../PickersSectionList';
|
|
32
40
|
|
|
33
41
|
// prettier-ignore
|
|
34
42
|
export interface PickersComponentNameToClassKey {
|
|
@@ -60,6 +68,14 @@ export interface PickersComponentNameToClassKey {
|
|
|
60
68
|
MuiTimeClock: TimeClockClassKey;
|
|
61
69
|
MuiTimePickerToolbar: TimePickerToolbarClassKey;
|
|
62
70
|
MuiYearCalendar: YearCalendarClassKey;
|
|
71
|
+
|
|
72
|
+
// V7 Picker's TextField
|
|
73
|
+
MuiPickersTextField: PickersTextFieldClassKey;
|
|
74
|
+
MuiPickersInputBase: PickersInputBaseClassKey
|
|
75
|
+
MuiPickersInput: PickersInputClassKey
|
|
76
|
+
MuiPickersFilledInput: PickersFilledInputClassKey
|
|
77
|
+
MuiPickersOutlinedInput: PickersOutlinedInputClassKey
|
|
78
|
+
MuiPickersSectionList: PickersSectionListClassKey
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
declare module '@mui/material/styles' {
|