@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
|
@@ -475,6 +475,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
475
475
|
view: PropTypes.oneOf(['hours', 'minutes', 'seconds']),
|
|
476
476
|
/**
|
|
477
477
|
* Available views.
|
|
478
|
+
* @default ['hours', 'minutes']
|
|
478
479
|
*/
|
|
479
480
|
views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'minutes', 'seconds']).isRequired)
|
|
480
481
|
} : void 0;
|
|
@@ -64,9 +64,6 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
64
64
|
* - the `input` element if there is a field rendered.
|
|
65
65
|
*/
|
|
66
66
|
autoFocus: PropTypes.bool,
|
|
67
|
-
/**
|
|
68
|
-
* Class name applied to the root element.
|
|
69
|
-
*/
|
|
70
67
|
className: PropTypes.string,
|
|
71
68
|
/**
|
|
72
69
|
* If `true`, the popover or modal will close after submitting the full date.
|
|
@@ -223,9 +223,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
|
|
223
223
|
ampm: PropTypes.bool,
|
|
224
224
|
ampmInClock: PropTypes.bool,
|
|
225
225
|
classes: PropTypes.object,
|
|
226
|
-
/**
|
|
227
|
-
* className applied to the root component.
|
|
228
|
-
*/
|
|
229
226
|
className: PropTypes.string,
|
|
230
227
|
disabled: PropTypes.bool,
|
|
231
228
|
/**
|
|
@@ -278,9 +278,6 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
|
|
|
278
278
|
* Override or extend the styles applied to the component.
|
|
279
279
|
*/
|
|
280
280
|
classes: PropTypes.object,
|
|
281
|
-
/**
|
|
282
|
-
* className applied to the root element.
|
|
283
|
-
*/
|
|
284
281
|
className: PropTypes.string,
|
|
285
282
|
/**
|
|
286
283
|
* The default selected value.
|
|
@@ -42,8 +42,8 @@ export var useClearableField = function useClearableField(props) {
|
|
|
42
42
|
});
|
|
43
43
|
return _extends({}, other, {
|
|
44
44
|
InputProps: _extends({}, InputProps, {
|
|
45
|
-
endAdornment:
|
|
46
|
-
children: [/*#__PURE__*/_jsx(InputAdornment, {
|
|
45
|
+
endAdornment: /*#__PURE__*/_jsxs(React.Fragment, {
|
|
46
|
+
children: [clearable && /*#__PURE__*/_jsx(InputAdornment, {
|
|
47
47
|
position: "end",
|
|
48
48
|
sx: {
|
|
49
49
|
marginRight: InputProps != null && InputProps.endAdornment ? -1 : -1.5
|
|
@@ -55,7 +55,7 @@ export var useClearableField = function useClearableField(props) {
|
|
|
55
55
|
}, endClearIconProps))
|
|
56
56
|
}))
|
|
57
57
|
}), InputProps == null ? void 0 : InputProps.endAdornment]
|
|
58
|
-
})
|
|
58
|
+
})
|
|
59
59
|
}),
|
|
60
60
|
sx: [{
|
|
61
61
|
'& .clearButton': {
|
package/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers v7.0.0-alpha.
|
|
2
|
+
* @mui/x-date-pickers v7.0.0-alpha.9
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -11,7 +11,7 @@ export * from './DigitalClock';
|
|
|
11
11
|
export * from './MultiSectionDigitalClock';
|
|
12
12
|
export * from './LocalizationProvider';
|
|
13
13
|
export * from './PickersDay';
|
|
14
|
-
export * from './locales';
|
|
14
|
+
export * from './locales/utils/pickersLocaleTextApi';
|
|
15
15
|
|
|
16
16
|
// Fields
|
|
17
17
|
export * from './DateField';
|
|
@@ -51,6 +51,7 @@ export * from './PickersShortcuts';
|
|
|
51
51
|
export * from './PickersCalendarHeader';
|
|
52
52
|
|
|
53
53
|
// Field utilities
|
|
54
|
+
export * from './PickersTextField';
|
|
54
55
|
export * from './PickersSectionList';
|
|
55
56
|
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
56
57
|
export * from './models';
|
|
@@ -25,6 +25,7 @@ export var useField = function useField(params) {
|
|
|
25
25
|
updateValueFromValueStr = _useFieldState.updateValueFromValueStr,
|
|
26
26
|
setTempAndroidValueStr = _useFieldState.setTempAndroidValueStr,
|
|
27
27
|
sectionsValueBoundaries = _useFieldState.sectionsValueBoundaries,
|
|
28
|
+
localizedDigits = _useFieldState.localizedDigits,
|
|
28
29
|
placeholder = _useFieldState.placeholder,
|
|
29
30
|
timezone = _useFieldState.timezone;
|
|
30
31
|
var internalProps = params.internalProps,
|
|
@@ -53,6 +54,7 @@ export var useField = function useField(params) {
|
|
|
53
54
|
sections: state.sections,
|
|
54
55
|
updateSectionValue: updateSectionValue,
|
|
55
56
|
sectionsValueBoundaries: sectionsValueBoundaries,
|
|
57
|
+
localizedDigits: localizedDigits,
|
|
56
58
|
setTempAndroidValueStr: setTempAndroidValueStr,
|
|
57
59
|
timezone: timezone
|
|
58
60
|
}),
|
|
@@ -200,7 +202,7 @@ export var useField = function useField(params) {
|
|
|
200
202
|
if (selectedSectionIndexes.startIndex === 0 && selectedSectionIndexes.endIndex === state.sections.length - 1 && cleanValueStr.length === 1) {
|
|
201
203
|
keyPressed = cleanValueStr;
|
|
202
204
|
} else {
|
|
203
|
-
var prevValueStr = cleanString(fieldValueManager.getValueStrFromSections(state.sections, isRTL));
|
|
205
|
+
var prevValueStr = cleanString(fieldValueManager.getValueStrFromSections(state.sections, localizedDigits, isRTL));
|
|
204
206
|
var startOfDiffIndex = -1;
|
|
205
207
|
var endOfDiffIndex = -1;
|
|
206
208
|
for (var i = 0; i < prevValueStr.length; i += 1) {
|
|
@@ -310,7 +312,7 @@ export var useField = function useField(params) {
|
|
|
310
312
|
}
|
|
311
313
|
var activeSection = state.sections[selectedSectionIndexes.startIndex];
|
|
312
314
|
var activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
|
|
313
|
-
var newSectionValue = adjustSectionValue(utils, timezone, activeSection, event.key, sectionsValueBoundaries, activeDateManager.date, {
|
|
315
|
+
var newSectionValue = adjustSectionValue(utils, timezone, activeSection, event.key, sectionsValueBoundaries, localizedDigits, activeDateManager.date, {
|
|
314
316
|
minutesStep: minutesStep
|
|
315
317
|
});
|
|
316
318
|
updateSectionValue({
|
|
@@ -397,8 +399,8 @@ export var useField = function useField(params) {
|
|
|
397
399
|
|
|
398
400
|
var valueStr = React.useMemo(function () {
|
|
399
401
|
var _state$tempValueStrAn;
|
|
400
|
-
return (_state$tempValueStrAn = state.tempValueStrAndroid) != null ? _state$tempValueStrAn : fieldValueManager.getValueStrFromSections(state.sections, isRTL);
|
|
401
|
-
}, [state.sections, fieldValueManager, state.tempValueStrAndroid, isRTL]);
|
|
402
|
+
return (_state$tempValueStrAn = state.tempValueStrAndroid) != null ? _state$tempValueStrAn : fieldValueManager.getValueStrFromSections(state.sections, localizedDigits, isRTL);
|
|
403
|
+
}, [state.sections, fieldValueManager, state.tempValueStrAndroid, localizedDigits, isRTL]);
|
|
402
404
|
var inputMode = React.useMemo(function () {
|
|
403
405
|
if (selectedSectionIndexes == null) {
|
|
404
406
|
return 'text';
|
|
@@ -4,7 +4,7 @@ import { getMonthsInYear } from '../../utils/date-utils';
|
|
|
4
4
|
export var getDateSectionConfigFromFormatToken = function getDateSectionConfigFromFormatToken(utils, formatToken) {
|
|
5
5
|
var config = utils.formatTokenMap[formatToken];
|
|
6
6
|
if (config == null) {
|
|
7
|
-
throw new Error(["MUI: 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'));
|
|
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
8
|
}
|
|
9
9
|
if (typeof config === 'string') {
|
|
10
10
|
return {
|
|
@@ -72,7 +72,58 @@ export var getLetterEditingOptions = function getLetterEditingOptions(utils, tim
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
|
|
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) {
|
|
76
127
|
var cleanValueStr = valueStr;
|
|
77
128
|
|
|
78
129
|
// Remove the leading zeros
|
|
@@ -84,10 +135,10 @@ export var cleanLeadingZeros = function cleanLeadingZeros(utils, valueStr, size)
|
|
|
84
135
|
}
|
|
85
136
|
return cleanValueStr;
|
|
86
137
|
};
|
|
87
|
-
export var cleanDigitSectionValue = function cleanDigitSectionValue(utils,
|
|
138
|
+
export var cleanDigitSectionValue = function cleanDigitSectionValue(utils, value, sectionBoundaries, localizedDigits, section) {
|
|
88
139
|
if (process.env.NODE_ENV !== 'production') {
|
|
89
140
|
if (section.type !== 'day' && section.contentType === 'digit-with-letter') {
|
|
90
|
-
throw new Error(["MUI: 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'));
|
|
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'));
|
|
91
142
|
}
|
|
92
143
|
}
|
|
93
144
|
if (section.type === 'day' && section.contentType === 'digit-with-letter') {
|
|
@@ -98,11 +149,11 @@ export var cleanDigitSectionValue = function cleanDigitSectionValue(utils, timez
|
|
|
98
149
|
// queryValue without leading `0` (`01` => `1`)
|
|
99
150
|
var valueStr = value.toString();
|
|
100
151
|
if (section.hasLeadingZerosInInput) {
|
|
101
|
-
|
|
152
|
+
valueStr = cleanLeadingZeros(valueStr, section.maxLength);
|
|
102
153
|
}
|
|
103
|
-
return valueStr;
|
|
154
|
+
return applyLocalizedDigits(valueStr, localizedDigits);
|
|
104
155
|
};
|
|
105
|
-
export var adjustSectionValue = function adjustSectionValue(utils, timezone, section, keyCode, sectionsValueBoundaries, activeDate, stepsAttributes) {
|
|
156
|
+
export var adjustSectionValue = function adjustSectionValue(utils, timezone, section, keyCode, sectionsValueBoundaries, localizedDigits, activeDate, stepsAttributes) {
|
|
106
157
|
var delta = getDeltaFromKeyCode(keyCode);
|
|
107
158
|
var isStart = keyCode === 'Home';
|
|
108
159
|
var isEnd = keyCode === 'End';
|
|
@@ -114,10 +165,10 @@ export var adjustSectionValue = function adjustSectionValue(utils, timezone, sec
|
|
|
114
165
|
contentType: section.contentType
|
|
115
166
|
});
|
|
116
167
|
var getCleanValue = function getCleanValue(value) {
|
|
117
|
-
return cleanDigitSectionValue(utils,
|
|
168
|
+
return cleanDigitSectionValue(utils, value, sectionBoundaries, localizedDigits, section);
|
|
118
169
|
};
|
|
119
170
|
var step = section.type === 'minutes' && stepsAttributes != null && stepsAttributes.minutesStep ? stepsAttributes.minutesStep : 1;
|
|
120
|
-
var currentSectionValue = parseInt(section.value, 10);
|
|
171
|
+
var currentSectionValue = parseInt(removeLocalizedDigits(section.value, localizedDigits), 10);
|
|
121
172
|
var newSectionValueNumber = currentSectionValue + delta * step;
|
|
122
173
|
if (shouldSetAbsolute) {
|
|
123
174
|
if (section.type === 'year' && !isEnd && !isStart) {
|
|
@@ -165,11 +216,11 @@ export var adjustSectionValue = function adjustSectionValue(utils, timezone, sec
|
|
|
165
216
|
}
|
|
166
217
|
return adjustLetterSection();
|
|
167
218
|
};
|
|
168
|
-
export var getSectionVisibleValue = function getSectionVisibleValue(section, target) {
|
|
219
|
+
export var getSectionVisibleValue = function getSectionVisibleValue(section, target, localizedDigits) {
|
|
169
220
|
var value = section.value || section.placeholder;
|
|
170
221
|
var hasLeadingZeros = target === 'non-input' ? section.hasLeadingZerosInFormat : section.hasLeadingZerosInInput;
|
|
171
222
|
if (target === 'non-input' && section.hasLeadingZerosInInput && !section.hasLeadingZerosInFormat) {
|
|
172
|
-
value = Number(value).toString();
|
|
223
|
+
value = Number(removeLocalizedDigits(value, localizedDigits)).toString();
|
|
173
224
|
}
|
|
174
225
|
|
|
175
226
|
// In the input, we add an empty character at the end of each section without leading zeros.
|
|
@@ -189,13 +240,13 @@ export var getSectionVisibleValue = function getSectionVisibleValue(section, tar
|
|
|
189
240
|
export var cleanString = function cleanString(dirtyString) {
|
|
190
241
|
return dirtyString.replace(/[\u2066\u2067\u2068\u2069]/g, '');
|
|
191
242
|
};
|
|
192
|
-
export var addPositionPropertiesToSections = function addPositionPropertiesToSections(sections, isRTL) {
|
|
243
|
+
export var addPositionPropertiesToSections = function addPositionPropertiesToSections(sections, localizedDigits, isRTL) {
|
|
193
244
|
var position = 0;
|
|
194
245
|
var positionInInput = isRTL ? 1 : 0;
|
|
195
246
|
var newSections = [];
|
|
196
247
|
for (var i = 0; i < sections.length; i += 1) {
|
|
197
248
|
var section = sections[i];
|
|
198
|
-
var renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr');
|
|
249
|
+
var renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
199
250
|
var sectionStr = "".concat(section.startSeparator).concat(renderedValue).concat(section.endSeparator);
|
|
200
251
|
var sectionLength = cleanString(sectionStr).length;
|
|
201
252
|
var sectionLengthInInput = sectionStr.length;
|
|
@@ -348,7 +399,7 @@ var getEscapedPartsFromFormat = function getEscapedPartsFromFormat(utils, format
|
|
|
348
399
|
}
|
|
349
400
|
return escapedParts;
|
|
350
401
|
};
|
|
351
|
-
export var splitFormatIntoSections = function splitFormatIntoSections(utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL) {
|
|
402
|
+
export var splitFormatIntoSections = function splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL) {
|
|
352
403
|
var startSeparator = '';
|
|
353
404
|
var sections = [];
|
|
354
405
|
var now = utils.date();
|
|
@@ -367,11 +418,11 @@ export var splitFormatIntoSections = function splitFormatIntoSections(utils, tim
|
|
|
367
418
|
maxLength = sectionValue === '' ? utils.formatByString(now, token).length : sectionValue.length;
|
|
368
419
|
} else {
|
|
369
420
|
if (sectionConfig.maxLength == null) {
|
|
370
|
-
throw new Error("MUI: The token ".concat(token, " should have a 'maxDigitNumber' property on it's adapter"));
|
|
421
|
+
throw new Error("MUI X: The token ".concat(token, " should have a 'maxDigitNumber' property on it's adapter"));
|
|
371
422
|
}
|
|
372
423
|
maxLength = sectionConfig.maxLength;
|
|
373
424
|
if (isValidDate) {
|
|
374
|
-
sectionValue = cleanLeadingZeros(
|
|
425
|
+
sectionValue = applyLocalizedDigits(cleanLeadingZeros(removeLocalizedDigits(sectionValue, localizedDigits), maxLength), localizedDigits);
|
|
375
426
|
}
|
|
376
427
|
}
|
|
377
428
|
}
|
|
@@ -398,7 +449,7 @@ export var splitFormatIntoSections = function splitFormatIntoSections(utils, tim
|
|
|
398
449
|
nextFormat = utils.expandFormat(prevFormat);
|
|
399
450
|
formatExpansionOverflow -= 1;
|
|
400
451
|
if (formatExpansionOverflow < 0) {
|
|
401
|
-
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');
|
|
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.');
|
|
402
453
|
}
|
|
403
454
|
}
|
|
404
455
|
var expandedFormat = nextFormat;
|
|
@@ -480,7 +531,7 @@ export var splitFormatIntoSections = function splitFormatIntoSections(utils, tim
|
|
|
480
531
|
* Some date libraries like `dayjs` don't support parsing from date with escaped characters.
|
|
481
532
|
* To make sure that the parsing works, we are building a format and a date without any separator.
|
|
482
533
|
*/
|
|
483
|
-
export var getDateFromDateSections = function getDateFromDateSections(utils, sections) {
|
|
534
|
+
export var getDateFromDateSections = function 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.
|
|
@@ -494,16 +545,16 @@ export var getDateFromDateSections = function getDateFromDateSections(utils, sec
|
|
|
494
545
|
var shouldSkip = shouldSkipWeekDays && section.type === 'weekDay';
|
|
495
546
|
if (!shouldSkip) {
|
|
496
547
|
sectionFormats.push(section.format);
|
|
497
|
-
sectionValues.push(getSectionVisibleValue(section, 'non-input'));
|
|
548
|
+
sectionValues.push(getSectionVisibleValue(section, 'non-input', localizedDigits));
|
|
498
549
|
}
|
|
499
550
|
}
|
|
500
551
|
var formatWithoutSeparator = sectionFormats.join(' ');
|
|
501
552
|
var dateWithoutSeparatorStr = sectionValues.join(' ');
|
|
502
553
|
return utils.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
|
|
503
554
|
};
|
|
504
|
-
export var createDateStrForInputFromSections = function createDateStrForInputFromSections(sections, isRTL) {
|
|
555
|
+
export var createDateStrForInputFromSections = function createDateStrForInputFromSections(sections, localizedDigits, isRTL) {
|
|
505
556
|
var formattedSections = sections.map(function (section) {
|
|
506
|
-
var dateValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr');
|
|
557
|
+
var dateValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
507
558
|
return "".concat(section.startSeparator).concat(dateValue).concat(section.endSeparator);
|
|
508
559
|
});
|
|
509
560
|
var dateStr = formattedSections.join('');
|
|
@@ -518,7 +569,7 @@ export var createDateStrForInputFromSections = function createDateStrForInputFro
|
|
|
518
569
|
// wrap into an isolated group such that separators can split the string in smaller ones by adding \u2069\u2068
|
|
519
570
|
return "\u2066".concat(dateStr, "\u2069");
|
|
520
571
|
};
|
|
521
|
-
export var getSectionsBoundaries = function getSectionsBoundaries(utils, timezone) {
|
|
572
|
+
export var getSectionsBoundaries = function getSectionsBoundaries(utils, localizedDigits, timezone) {
|
|
522
573
|
var today = utils.date(undefined, timezone);
|
|
523
574
|
var endOfYear = utils.endOfYear(today);
|
|
524
575
|
var endOfDay = utils.endOfDay(today);
|
|
@@ -578,11 +629,11 @@ export var getSectionsBoundaries = function getSectionsBoundaries(utils, timezon
|
|
|
578
629
|
hours: function hours(_ref4) {
|
|
579
630
|
var format = _ref4.format;
|
|
580
631
|
var lastHourInDay = utils.getHours(endOfDay);
|
|
581
|
-
var hasMeridiem = utils.formatByString(utils.endOfDay(today), format) !== lastHourInDay.toString();
|
|
632
|
+
var hasMeridiem = removeLocalizedDigits(utils.formatByString(utils.endOfDay(today), format), localizedDigits) !== lastHourInDay.toString();
|
|
582
633
|
if (hasMeridiem) {
|
|
583
634
|
return {
|
|
584
635
|
minimum: 1,
|
|
585
|
-
maximum: Number(utils.formatByString(utils.startOfDay(today), format))
|
|
636
|
+
maximum: Number(removeLocalizedDigits(utils.formatByString(utils.startOfDay(today), format), localizedDigits))
|
|
586
637
|
};
|
|
587
638
|
}
|
|
588
639
|
return {
|
|
@@ -633,7 +684,7 @@ export var validateSections = function validateSections(sections, valueType) {
|
|
|
633
684
|
return !supportedSections.includes(section.type);
|
|
634
685
|
});
|
|
635
686
|
if (invalidSection) {
|
|
636
|
-
console.warn("MUI: The field component you are using is not compatible with the \"".concat(invalidSection.type, "\" date section."), "The supported date sections are [\"".concat(supportedSections.join('", "'), "\"]`."));
|
|
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('", "'), "\"]`."));
|
|
637
688
|
warnedOnceInvalidSection = true;
|
|
638
689
|
}
|
|
639
690
|
}
|
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
5
5
|
import { useUtils } from '../useUtils';
|
|
6
|
-
import { changeSectionValueFormat, cleanDigitSectionValue, doesSectionFormatHaveLeadingZeros, getDateSectionConfigFromFormatToken, getDaysInWeekStr, getLetterEditingOptions } from './useField.utils';
|
|
6
|
+
import { changeSectionValueFormat, cleanDigitSectionValue, doesSectionFormatHaveLeadingZeros, getDateSectionConfigFromFormatToken, getDaysInWeekStr, getLetterEditingOptions, applyLocalizedDigits, removeLocalizedDigits, isStringNumber } from './useField.utils';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The letter editing and the numeric editing each define a `CharacterEditingApplier`.
|
|
@@ -43,6 +43,7 @@ export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
|
|
|
43
43
|
var sections = _ref.sections,
|
|
44
44
|
updateSectionValue = _ref.updateSectionValue,
|
|
45
45
|
sectionsValueBoundaries = _ref.sectionsValueBoundaries,
|
|
46
|
+
localizedDigits = _ref.localizedDigits,
|
|
46
47
|
setTempAndroidValueStr = _ref.setTempAndroidValueStr,
|
|
47
48
|
timezone = _ref.timezone;
|
|
48
49
|
var utils = useUtils();
|
|
@@ -77,7 +78,7 @@ export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
|
|
|
77
78
|
var activeSection = sections[sectionIndex];
|
|
78
79
|
|
|
79
80
|
// The current query targets the section being editing
|
|
80
|
-
// We can try to
|
|
81
|
+
// We can try to concatenate the value
|
|
81
82
|
if (query != null && (!isValidQueryValue || isValidQueryValue(query.value)) && query.sectionIndex === sectionIndex) {
|
|
82
83
|
var concatenatedQueryValue = "".concat(query.value).concat(cleanKeyPressed);
|
|
83
84
|
var _queryResponse = getFirstSectionValueMatchingWithQuery(concatenatedQueryValue, activeSection);
|
|
@@ -179,7 +180,8 @@ export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
|
|
|
179
180
|
};
|
|
180
181
|
var applyNumericEditing = function applyNumericEditing(params) {
|
|
181
182
|
var getNewSectionValue = function getNewSectionValue(queryValue, section) {
|
|
182
|
-
var
|
|
183
|
+
var cleanQueryValue = removeLocalizedDigits(queryValue, localizedDigits);
|
|
184
|
+
var queryValueNumber = Number(cleanQueryValue);
|
|
183
185
|
var sectionBoundaries = sectionsValueBoundaries[section.type]({
|
|
184
186
|
currentDate: null,
|
|
185
187
|
format: section.format,
|
|
@@ -199,8 +201,8 @@ export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
|
|
|
199
201
|
saveQuery: true
|
|
200
202
|
};
|
|
201
203
|
}
|
|
202
|
-
var shouldGoToNextSection =
|
|
203
|
-
var newSectionValue = cleanDigitSectionValue(utils,
|
|
204
|
+
var shouldGoToNextSection = queryValueNumber * 10 > sectionBoundaries.maximum || cleanQueryValue.length === sectionBoundaries.maximum.toString().length;
|
|
205
|
+
var newSectionValue = cleanDigitSectionValue(utils, queryValueNumber, sectionBoundaries, localizedDigits, section);
|
|
204
206
|
return {
|
|
205
207
|
sectionValue: newSectionValue,
|
|
206
208
|
shouldGoToNextSection: shouldGoToNextSection
|
|
@@ -249,13 +251,15 @@ export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
|
|
|
249
251
|
};
|
|
250
252
|
};
|
|
251
253
|
return applyQuery(params, getFirstSectionValueMatchingWithQuery, function (queryValue) {
|
|
252
|
-
return
|
|
254
|
+
return isStringNumber(queryValue, localizedDigits);
|
|
253
255
|
});
|
|
254
256
|
};
|
|
255
257
|
var applyCharacterEditing = useEventCallback(function (params) {
|
|
256
258
|
var activeSection = sections[params.sectionIndex];
|
|
257
|
-
var isNumericEditing =
|
|
258
|
-
var response = isNumericEditing ? applyNumericEditing(params
|
|
259
|
+
var isNumericEditing = isStringNumber(params.keyPressed, localizedDigits);
|
|
260
|
+
var response = isNumericEditing ? applyNumericEditing(_extends({}, params, {
|
|
261
|
+
keyPressed: applyLocalizedDigits(params.keyPressed, localizedDigits)
|
|
262
|
+
})) : applyLetterEditing(params);
|
|
259
263
|
if (response == null) {
|
|
260
264
|
setTempAndroidValueStr(null);
|
|
261
265
|
} else {
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import useControlled from '@mui/utils/useControlled';
|
|
6
6
|
import { useTheme } from '@mui/material/styles';
|
|
7
7
|
import { useUtils, useLocaleText, useLocalizationContext } from '../useUtils';
|
|
8
|
-
import { addPositionPropertiesToSections, splitFormatIntoSections, mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections } from './useField.utils';
|
|
8
|
+
import { addPositionPropertiesToSections, splitFormatIntoSections, mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections, getLocalizedDigits } from './useField.utils';
|
|
9
9
|
import { useValueWithTimezone } from '../useValueWithTimezone';
|
|
10
10
|
import { getSectionTypeGranularity } from '../../utils/getDefaultReferenceDate';
|
|
11
11
|
export var useFieldState = function useFieldState(params) {
|
|
@@ -42,18 +42,21 @@ export var useFieldState = function useFieldState(params) {
|
|
|
42
42
|
timezone = _useValueWithTimezone.timezone,
|
|
43
43
|
valueFromTheOutside = _useValueWithTimezone.value,
|
|
44
44
|
handleValueChange = _useValueWithTimezone.handleValueChange;
|
|
45
|
+
var localizedDigits = React.useMemo(function () {
|
|
46
|
+
return getLocalizedDigits(utils);
|
|
47
|
+
}, [utils]);
|
|
45
48
|
var sectionsValueBoundaries = React.useMemo(function () {
|
|
46
|
-
return getSectionsBoundaries(utils, timezone);
|
|
47
|
-
}, [utils, timezone]);
|
|
49
|
+
return getSectionsBoundaries(utils, localizedDigits, timezone);
|
|
50
|
+
}, [utils, localizedDigits, timezone]);
|
|
48
51
|
var getSectionsFromValue = React.useCallback(function (value) {
|
|
49
52
|
var fallbackSections = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
50
|
-
return fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, isRTL, function (date) {
|
|
51
|
-
return splitFormatIntoSections(utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
|
|
53
|
+
return fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, localizedDigits, isRTL, function (date) {
|
|
54
|
+
return splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
|
|
52
55
|
});
|
|
53
|
-
}, [fieldValueManager, format, localeText, isRTL, shouldRespectLeadingZeros, utils, formatDensity, timezone]);
|
|
56
|
+
}, [fieldValueManager, format, localeText, localizedDigits, isRTL, shouldRespectLeadingZeros, utils, formatDensity, timezone]);
|
|
54
57
|
var placeholder = React.useMemo(function () {
|
|
55
|
-
return fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), isRTL);
|
|
56
|
-
}, [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, isRTL]);
|
|
58
|
+
return fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), localizedDigits, isRTL);
|
|
59
|
+
}, [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, localizedDigits, isRTL]);
|
|
57
60
|
var _React$useState = React.useState(function () {
|
|
58
61
|
var sections = getSectionsFromValue(valueFromTheOutside);
|
|
59
62
|
validateSections(sections, valueType);
|
|
@@ -162,7 +165,7 @@ export var useFieldState = function useFieldState(params) {
|
|
|
162
165
|
value: newSectionValue,
|
|
163
166
|
modified: true
|
|
164
167
|
});
|
|
165
|
-
return addPositionPropertiesToSections(newSections, isRTL);
|
|
168
|
+
return addPositionPropertiesToSections(newSections, localizedDigits, isRTL);
|
|
166
169
|
};
|
|
167
170
|
var clearValue = function clearValue() {
|
|
168
171
|
publishValue({
|
|
@@ -203,7 +206,7 @@ export var useFieldState = function useFieldState(params) {
|
|
|
203
206
|
if (date == null || !utils.isValid(date)) {
|
|
204
207
|
return null;
|
|
205
208
|
}
|
|
206
|
-
var sections = splitFormatIntoSections(utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
|
|
209
|
+
var sections = splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
|
|
207
210
|
return mergeDateIntoReferenceDate(utils, timezone, date, sections, referenceDate, false);
|
|
208
211
|
};
|
|
209
212
|
var newValue = fieldValueManager.parseValueStr(valueStr, state.referenceValue, parseDateStr);
|
|
@@ -233,7 +236,7 @@ export var useFieldState = function useFieldState(params) {
|
|
|
233
236
|
var activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
|
|
234
237
|
var newSections = setSectionValue(selectedSectionIndexes.startIndex, newSectionValue);
|
|
235
238
|
var newActiveDateSections = activeDateManager.getSections(newSections);
|
|
236
|
-
var newActiveDate = getDateFromDateSections(utils, newActiveDateSections);
|
|
239
|
+
var newActiveDate = getDateFromDateSections(utils, newActiveDateSections, localizedDigits);
|
|
237
240
|
var values;
|
|
238
241
|
var shouldPublish;
|
|
239
242
|
|
|
@@ -311,6 +314,7 @@ export var useFieldState = function useFieldState(params) {
|
|
|
311
314
|
updateValueFromValueStr: updateValueFromValueStr,
|
|
312
315
|
setTempAndroidValueStr: setTempAndroidValueStr,
|
|
313
316
|
sectionsValueBoundaries: sectionsValueBoundaries,
|
|
317
|
+
localizedDigits: localizedDigits,
|
|
314
318
|
placeholder: placeholder,
|
|
315
319
|
timezone: timezone
|
|
316
320
|
};
|
|
@@ -129,12 +129,12 @@ export var usePickerValue = function usePickerValue(_ref) {
|
|
|
129
129
|
if (process.env.NODE_ENV !== 'production') {
|
|
130
130
|
React.useEffect(function () {
|
|
131
131
|
if (isControlled !== (inValue !== undefined)) {
|
|
132
|
-
console.error(["MUI: A component is changing the ".concat(isControlled ? '' : 'un', "controlled value of a picker to be ").concat(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'));
|
|
132
|
+
console.error(["MUI X: A component is changing the ".concat(isControlled ? '' : 'un', "controlled value of a picker to be ").concat(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'));
|
|
133
133
|
}
|
|
134
134
|
}, [inValue]);
|
|
135
135
|
React.useEffect(function () {
|
|
136
136
|
if (!isControlled && defaultValue !== inDefaultValue) {
|
|
137
|
-
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'));
|
|
137
|
+
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'));
|
|
138
138
|
}
|
|
139
139
|
}, [JSON.stringify(defaultValue)]);
|
|
140
140
|
}
|
|
@@ -5,10 +5,10 @@ import { DEFAULT_LOCALE } from '../../locales/enUS';
|
|
|
5
5
|
export var useLocalizationContext = function useLocalizationContext() {
|
|
6
6
|
var localization = React.useContext(MuiPickersAdapterContext);
|
|
7
7
|
if (localization === null) {
|
|
8
|
-
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'));
|
|
8
|
+
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'));
|
|
9
9
|
}
|
|
10
10
|
if (localization.utils === null) {
|
|
11
|
-
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'));
|
|
11
|
+
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'));
|
|
12
12
|
}
|
|
13
13
|
var localeText = React.useMemo(function () {
|
|
14
14
|
return _extends({}, DEFAULT_LOCALE, localization.localeText);
|
|
@@ -16,11 +16,11 @@ export function useViews(_ref) {
|
|
|
16
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
17
17
|
if (!warnedOnceNotValidView) {
|
|
18
18
|
if (inView != null && !views.includes(inView)) {
|
|
19
|
-
console.warn("MUI: `view=\"".concat(inView, "\"` is not a valid prop."), "It must be an element of `views=[\"".concat(views.join('", "'), "\"]`."));
|
|
19
|
+
console.warn("MUI X: `view=\"".concat(inView, "\"` is not a valid prop."), "It must be an element of `views=[\"".concat(views.join('", "'), "\"]`."));
|
|
20
20
|
warnedOnceNotValidView = true;
|
|
21
21
|
}
|
|
22
22
|
if (inView == null && openTo != null && !views.includes(openTo)) {
|
|
23
|
-
console.warn("MUI: `openTo=\"".concat(openTo, "\"` is not a valid prop."), "It must be an element of `views=[\"".concat(views.join('", "'), "\"]`."));
|
|
23
|
+
console.warn("MUI X: `openTo=\"".concat(openTo, "\"` is not a valid prop."), "It must be an element of `views=[\"".concat(views.join('", "'), "\"]`."));
|
|
24
24
|
warnedOnceNotValidView = true;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -14,10 +14,12 @@ export { useField, createDateStrForInputFromSections, addPositionPropertiesToSec
|
|
|
14
14
|
export { usePicker } from './hooks/usePicker';
|
|
15
15
|
export { useStaticPicker } from './hooks/useStaticPicker';
|
|
16
16
|
export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText, useNow } from './hooks/useUtils';
|
|
17
|
+
export { useViews } from './hooks/useViews';
|
|
17
18
|
export { useValidation } from './hooks/useValidation';
|
|
18
19
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
|
|
19
20
|
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
20
|
-
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate } from './utils/date-utils';
|
|
21
|
+
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem } from './utils/date-utils';
|
|
22
|
+
export { resolveTimeViewsResponse } from './utils/date-time-utils';
|
|
21
23
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
22
24
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
23
25
|
export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './utils/utils';
|
|
@@ -26,6 +28,8 @@ export { extractValidationProps } from './utils/validation/extractValidationProp
|
|
|
26
28
|
export { validateDate } from './utils/validation/validateDate';
|
|
27
29
|
export { validateDateTime } from './utils/validation/validateDateTime';
|
|
28
30
|
export { validateTime } from './utils/validation/validateTime';
|
|
31
|
+
export { applyDefaultViewProps } from './utils/views';
|
|
29
32
|
export { buildDeprecatedPropsWarning, buildWarning } from './utils/warning';
|
|
30
33
|
export { DayCalendar } from '../DateCalendar/DayCalendar';
|
|
31
|
-
export { useCalendarState } from '../DateCalendar/useCalendarState';
|
|
34
|
+
export { useCalendarState } from '../DateCalendar/useCalendarState';
|
|
35
|
+
export { isTimeView } from './utils/time-utils';
|
|
@@ -38,12 +38,12 @@ export var singleItemFieldValueManager = {
|
|
|
38
38
|
updateReferenceValue: function updateReferenceValue(utils, value, prevReferenceValue) {
|
|
39
39
|
return value == null || !utils.isValid(value) ? prevReferenceValue : value;
|
|
40
40
|
},
|
|
41
|
-
getSectionsFromValue: function getSectionsFromValue(utils, date, prevSections, isRTL, getSectionsFromDate) {
|
|
41
|
+
getSectionsFromValue: function getSectionsFromValue(utils, date, prevSections, localizedDigits, isRTL, getSectionsFromDate) {
|
|
42
42
|
var shouldReUsePrevDateSections = !utils.isValid(date) && !!prevSections;
|
|
43
43
|
if (shouldReUsePrevDateSections) {
|
|
44
44
|
return prevSections;
|
|
45
45
|
}
|
|
46
|
-
return addPositionPropertiesToSections(getSectionsFromDate(date), isRTL);
|
|
46
|
+
return addPositionPropertiesToSections(getSectionsFromDate(date), localizedDigits, isRTL);
|
|
47
47
|
},
|
|
48
48
|
getValueStrFromSections: createDateStrForInputFromSections,
|
|
49
49
|
getActiveDateManager: function getActiveDateManager(utils, state) {
|
|
@@ -20,7 +20,7 @@ export var applyDefaultViewProps = function applyDefaultViewProps(_ref) {
|
|
|
20
20
|
} else if (viewsWithDefault.length > 0) {
|
|
21
21
|
openToWithDefault = viewsWithDefault[0];
|
|
22
22
|
} else {
|
|
23
|
-
throw new Error('MUI: The `views` prop must contain at least one view');
|
|
23
|
+
throw new Error('MUI X: The `views` prop must contain at least one view.');
|
|
24
24
|
}
|
|
25
25
|
return {
|
|
26
26
|
views: viewsWithDefault,
|
package/legacy/locales/index.js
CHANGED
package/locales/enUS.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare const enUS: {
|
|
|
24
24
|
hoursClockNumberText?: ((hours: string) => string) | undefined;
|
|
25
25
|
minutesClockNumberText?: ((minutes: string) => string) | undefined;
|
|
26
26
|
secondsClockNumberText?: ((seconds: string) => string) | undefined;
|
|
27
|
-
selectViewText?: ((view: import("../internals
|
|
27
|
+
selectViewText?: ((view: import("../internals").TimeViewWithMeridiem) => string) | undefined;
|
|
28
28
|
openDatePickerDialogue?: ((date: any, utils: import("..").MuiPickersAdapter<any, any>) => string) | undefined;
|
|
29
29
|
openTimePickerDialogue?: ((date: any, utils: import("..").MuiPickersAdapter<any, any>) => string) | undefined;
|
|
30
30
|
fieldClearLabel?: string | undefined;
|