@mui/x-date-pickers 7.15.0 → 7.17.0
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.js +1 -1
- package/AdapterDateFns/index.js +1 -1
- package/AdapterDateFnsBase/index.js +1 -1
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
- package/AdapterDateFnsJalali/index.js +1 -1
- package/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js +1 -1
- package/AdapterDateFnsJalaliV3/index.js +1 -1
- package/AdapterDateFnsV3/AdapterDateFnsV3.js +1 -1
- package/AdapterDateFnsV3/index.js +1 -1
- package/AdapterDayjs/AdapterDayjs.js +5 -6
- package/AdapterDayjs/index.js +1 -1
- package/AdapterLuxon/AdapterLuxon.js +4 -5
- package/AdapterLuxon/index.js +1 -1
- package/AdapterMoment/AdapterMoment.js +4 -5
- package/AdapterMoment/index.js +1 -1
- package/AdapterMomentHijri/AdapterMomentHijri.js +1 -1
- package/AdapterMomentHijri/index.js +1 -1
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -1
- package/AdapterMomentJalaali/index.js +1 -1
- package/CHANGELOG.md +185 -1
- package/DateCalendar/DateCalendar.js +18 -16
- package/DateCalendar/DayCalendar.js +9 -10
- package/DateCalendar/PickersFadeTransitionGroup.js +1 -1
- package/DateCalendar/PickersSlideTransition.js +1 -1
- package/DateCalendar/index.js +5 -5
- package/DateCalendar/useCalendarState.js +6 -4
- package/DateCalendar/useIsDateDisabled.d.ts +4 -3
- package/DateCalendar/useIsDateDisabled.js +6 -4
- package/DateField/DateField.js +15 -11
- package/DateField/DateField.types.d.ts +7 -2
- package/DateField/index.d.ts +1 -1
- package/DateField/index.js +2 -2
- package/DateField/useDateField.d.ts +1 -1
- package/DateField/useDateField.js +8 -6
- package/DatePicker/DatePicker.js +16 -14
- package/DatePicker/DatePickerToolbar.js +7 -5
- package/DatePicker/index.js +3 -3
- package/DatePicker/shared.js +4 -4
- package/DateTimeField/DateTimeField.js +15 -11
- package/DateTimeField/DateTimeField.types.d.ts +7 -2
- package/DateTimeField/index.d.ts +1 -1
- package/DateTimeField/index.js +2 -2
- package/DateTimeField/useDateTimeField.d.ts +1 -1
- package/DateTimeField/useDateTimeField.js +8 -6
- package/DateTimePicker/DateTimePicker.js +16 -14
- package/DateTimePicker/DateTimePickerTabs.js +6 -4
- package/DateTimePicker/DateTimePickerToolbar.js +13 -11
- package/DateTimePicker/index.js +5 -5
- package/DateTimePicker/shared.js +5 -5
- package/DayCalendarSkeleton/DayCalendarSkeleton.js +4 -2
- package/DayCalendarSkeleton/index.js +2 -2
- package/DesktopDatePicker/DesktopDatePicker.js +30 -23
- package/DesktopDatePicker/index.js +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +37 -30
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -1
- package/DesktopDateTimePicker/index.js +2 -2
- package/DesktopTimePicker/DesktopTimePicker.js +31 -24
- package/DesktopTimePicker/index.js +1 -1
- package/DigitalClock/DigitalClock.js +13 -11
- package/DigitalClock/index.js +2 -2
- package/LocalizationProvider/LocalizationProvider.js +2 -0
- package/LocalizationProvider/index.js +1 -1
- package/MobileDatePicker/MobileDatePicker.js +29 -22
- package/MobileDatePicker/index.js +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +30 -23
- package/MobileDateTimePicker/index.js +1 -1
- package/MobileTimePicker/MobileTimePicker.js +29 -22
- package/MobileTimePicker/index.js +1 -1
- package/MonthCalendar/MonthCalendar.js +10 -8
- package/MonthCalendar/PickersMonth.js +1 -1
- package/MonthCalendar/index.js +3 -3
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +19 -17
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +2 -2
- package/MultiSectionDigitalClock/index.js +3 -3
- package/PickersActionBar/PickersActionBar.js +3 -1
- package/PickersActionBar/index.js +1 -1
- package/PickersCalendarHeader/PickersCalendarHeader.js +9 -7
- package/PickersCalendarHeader/index.js +2 -2
- package/PickersDay/PickersDay.js +5 -3
- package/PickersDay/index.js +2 -2
- package/PickersLayout/PickersLayout.js +4 -2
- package/PickersLayout/index.js +3 -3
- package/PickersLayout/usePickerLayout.js +5 -3
- package/PickersSectionList/PickersSectionList.js +3 -1
- package/PickersSectionList/index.js +2 -2
- package/PickersShortcuts/PickersShortcuts.js +3 -1
- package/PickersShortcuts/index.js +1 -1
- package/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
- package/PickersTextField/PickersFilledInput/index.js +2 -2
- package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +1 -1
- package/PickersTextField/PickersInput/PickersInput.js +3 -3
- package/PickersTextField/PickersInput/index.js +2 -2
- package/PickersTextField/PickersInput/pickersInputClasses.js +1 -1
- package/PickersTextField/PickersInputBase/PickersInputBase.js +2 -2
- package/PickersTextField/PickersInputBase/index.js +2 -2
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +4 -4
- package/PickersTextField/PickersOutlinedInput/index.js +2 -2
- package/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +1 -1
- package/PickersTextField/PickersTextField.js +6 -4
- package/PickersTextField/index.js +6 -6
- package/StaticDatePicker/StaticDatePicker.js +18 -16
- package/StaticDatePicker/index.js +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +19 -17
- package/StaticDateTimePicker/index.js +1 -1
- package/StaticTimePicker/StaticTimePicker.js +18 -16
- package/StaticTimePicker/index.js +1 -1
- package/TimeClock/Clock.js +7 -7
- package/TimeClock/ClockNumber.js +2 -2
- package/TimeClock/ClockNumbers.js +2 -2
- package/TimeClock/ClockPointer.js +2 -2
- package/TimeClock/TimeClock.js +16 -14
- package/TimeClock/index.js +5 -5
- package/TimeField/TimeField.js +15 -11
- package/TimeField/TimeField.types.d.ts +7 -2
- package/TimeField/index.d.ts +1 -1
- package/TimeField/index.js +2 -2
- package/TimeField/useTimeField.d.ts +1 -1
- package/TimeField/useTimeField.js +8 -6
- package/TimePicker/TimePicker.js +16 -14
- package/TimePicker/TimePickerToolbar.js +11 -9
- package/TimePicker/index.js +3 -3
- package/TimePicker/shared.js +3 -3
- package/YearCalendar/PickersYear.js +1 -1
- package/YearCalendar/YearCalendar.js +10 -8
- package/YearCalendar/index.js +3 -3
- package/dateViewRenderers/dateViewRenderers.js +2 -2
- package/dateViewRenderers/index.js +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +3 -2
- package/hooks/useClearableField.js +4 -2
- package/hooks/usePickersTranslations.js +3 -1
- package/hooks/useSplitFieldProps.d.ts +19 -0
- package/hooks/useSplitFieldProps.js +43 -0
- package/icons/index.js +8 -8
- package/index.d.ts +1 -0
- package/index.js +39 -38
- package/internals/components/PickerViewRoot/PickerViewRoot.js +1 -1
- package/internals/components/PickerViewRoot/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +2 -2
- package/internals/components/PickersArrowSwitcher/index.js +2 -2
- package/internals/components/PickersModalDialog.js +1 -1
- package/internals/components/PickersPopper.js +3 -3
- package/internals/components/PickersToolbar.js +1 -1
- package/internals/components/PickersToolbarButton.js +2 -2
- package/internals/components/PickersToolbarText.js +1 -1
- package/internals/demo/DemoContainer.js +3 -3
- package/internals/demo/index.js +1 -1
- package/internals/hooks/date-helpers-hooks.js +2 -2
- package/internals/hooks/defaultizedFieldProps.js +2 -2
- package/internals/hooks/useClockReferenceDate.js +3 -3
- package/internals/hooks/useDesktopPicker/index.js +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +16 -8
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +6 -3
- package/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/internals/hooks/useField/index.js +2 -2
- package/internals/hooks/useField/useField.js +17 -12
- package/internals/hooks/useField/useField.types.d.ts +6 -22
- package/internals/hooks/useField/useField.utils.js +1 -1
- package/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
- package/internals/hooks/useField/useFieldState.js +8 -10
- package/internals/hooks/useField/useFieldV6TextField.js +2 -2
- package/internals/hooks/useField/useFieldV7TextField.js +4 -4
- package/internals/hooks/useIsLandscape.js +1 -1
- package/internals/hooks/useMobilePicker/index.js +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.js +6 -8
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +2 -2
- package/internals/hooks/usePicker/index.js +1 -1
- package/internals/hooks/usePicker/usePicker.d.ts +1 -2
- package/internals/hooks/usePicker/usePicker.js +4 -4
- package/internals/hooks/usePicker/usePickerLayoutProps.js +1 -1
- package/internals/hooks/usePicker/usePickerValue.d.ts +1 -2
- package/internals/hooks/usePicker/usePickerValue.js +15 -19
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +8 -19
- package/internals/hooks/usePicker/usePickerViews.js +2 -2
- package/internals/hooks/useStaticPicker/index.js +1 -1
- package/internals/hooks/useStaticPicker/useStaticPicker.js +4 -4
- package/internals/hooks/useUtils.js +2 -2
- package/internals/hooks/useValueWithTimezone.js +1 -1
- package/internals/hooks/useViews.d.ts +1 -1
- package/internals/index.d.ts +0 -8
- package/internals/index.js +29 -36
- package/internals/models/index.js +2 -2
- package/internals/utils/date-time-utils.js +2 -2
- package/internals/utils/date-utils.js +1 -1
- package/internals/utils/getDefaultReferenceDate.js +2 -2
- package/internals/utils/time-utils.js +1 -1
- package/internals/utils/valueManagers.js +3 -3
- package/locales/beBY.d.ts +3 -3
- package/locales/beBY.js +5 -5
- package/locales/caES.d.ts +3 -3
- package/locales/caES.js +4 -4
- package/locales/csCZ.d.ts +3 -3
- package/locales/csCZ.js +5 -5
- package/locales/daDK.d.ts +3 -3
- package/locales/daDK.js +4 -4
- package/locales/deDE.d.ts +3 -3
- package/locales/deDE.js +4 -4
- package/locales/elGR.d.ts +3 -3
- package/locales/elGR.js +5 -5
- package/locales/enUS.d.ts +3 -3
- package/locales/enUS.js +5 -5
- package/locales/esES.d.ts +3 -3
- package/locales/esES.js +4 -4
- package/locales/eu.d.ts +3 -3
- package/locales/eu.js +4 -4
- package/locales/faIR.d.ts +3 -3
- package/locales/faIR.js +4 -4
- package/locales/fiFI.d.ts +3 -3
- package/locales/fiFI.js +4 -4
- package/locales/frFR.d.ts +3 -3
- package/locales/frFR.js +4 -4
- package/locales/heIL.d.ts +3 -3
- package/locales/heIL.js +4 -4
- package/locales/huHU.d.ts +3 -3
- package/locales/huHU.js +4 -4
- package/locales/index.js +36 -36
- package/locales/isIS.d.ts +3 -3
- package/locales/isIS.js +5 -5
- package/locales/itIT.d.ts +3 -3
- package/locales/itIT.js +4 -4
- package/locales/jaJP.d.ts +3 -3
- package/locales/jaJP.js +4 -4
- package/locales/koKR.d.ts +3 -3
- package/locales/koKR.js +4 -4
- package/locales/kzKZ.d.ts +3 -3
- package/locales/kzKZ.js +5 -5
- package/locales/mk.d.ts +3 -3
- package/locales/mk.js +4 -4
- package/locales/nbNO.d.ts +3 -3
- package/locales/nbNO.js +5 -5
- package/locales/nlNL.d.ts +3 -3
- package/locales/nlNL.js +4 -4
- package/locales/nnNO.d.ts +3 -3
- package/locales/nnNO.js +4 -4
- package/locales/plPL.d.ts +3 -3
- package/locales/plPL.js +5 -5
- package/locales/ptBR.d.ts +3 -3
- package/locales/ptBR.js +5 -5
- package/locales/roRO.d.ts +3 -3
- package/locales/roRO.js +4 -4
- package/locales/ruRU.d.ts +3 -3
- package/locales/ruRU.js +4 -4
- package/locales/skSK.d.ts +3 -3
- package/locales/skSK.js +5 -5
- package/locales/svSE.d.ts +3 -3
- package/locales/svSE.js +4 -4
- package/locales/trTR.d.ts +3 -3
- package/locales/trTR.js +5 -5
- package/locales/ukUA.d.ts +3 -3
- package/locales/ukUA.js +4 -4
- package/locales/urPK.d.ts +3 -3
- package/locales/urPK.js +5 -5
- package/locales/utils/getPickersLocalization.d.ts +10 -3
- package/locales/utils/getPickersLocalization.js +13 -0
- package/locales/utils/pickersLocaleTextApi.d.ts +27 -3
- package/locales/viVN.d.ts +3 -3
- package/locales/viVN.js +4 -4
- package/locales/zhCN.d.ts +3 -3
- package/locales/zhCN.js +4 -4
- package/locales/zhHK.d.ts +3 -3
- package/locales/zhHK.js +4 -4
- package/models/index.d.ts +1 -0
- package/models/index.js +10 -7
- package/models/validation.d.ts +13 -0
- package/modern/AdapterDateFns/AdapterDateFns.js +1 -1
- package/modern/AdapterDateFns/index.js +1 -1
- package/modern/AdapterDateFnsBase/index.js +1 -1
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
- package/modern/AdapterDateFnsJalali/index.js +1 -1
- package/modern/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js +1 -1
- package/modern/AdapterDateFnsJalaliV3/index.js +1 -1
- package/modern/AdapterDateFnsV3/AdapterDateFnsV3.js +1 -1
- package/modern/AdapterDateFnsV3/index.js +1 -1
- package/modern/AdapterDayjs/AdapterDayjs.js +5 -6
- package/modern/AdapterDayjs/index.js +1 -1
- package/modern/AdapterLuxon/AdapterLuxon.js +4 -5
- package/modern/AdapterLuxon/index.js +1 -1
- package/modern/AdapterMoment/AdapterMoment.js +4 -5
- package/modern/AdapterMoment/index.js +1 -1
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -1
- package/modern/AdapterMomentHijri/index.js +1 -1
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -1
- package/modern/AdapterMomentJalaali/index.js +1 -1
- package/modern/DateCalendar/DateCalendar.js +18 -16
- package/modern/DateCalendar/DayCalendar.js +9 -10
- package/modern/DateCalendar/PickersFadeTransitionGroup.js +1 -1
- package/modern/DateCalendar/PickersSlideTransition.js +1 -1
- package/modern/DateCalendar/index.js +5 -5
- package/modern/DateCalendar/useCalendarState.js +6 -4
- package/modern/DateCalendar/useIsDateDisabled.js +6 -4
- package/modern/DateField/DateField.js +15 -11
- package/modern/DateField/index.js +2 -2
- package/modern/DateField/useDateField.js +8 -6
- package/modern/DatePicker/DatePicker.js +16 -14
- package/modern/DatePicker/DatePickerToolbar.js +7 -5
- package/modern/DatePicker/index.js +3 -3
- package/modern/DatePicker/shared.js +4 -4
- package/modern/DateTimeField/DateTimeField.js +15 -11
- package/modern/DateTimeField/index.js +2 -2
- package/modern/DateTimeField/useDateTimeField.js +8 -6
- package/modern/DateTimePicker/DateTimePicker.js +16 -14
- package/modern/DateTimePicker/DateTimePickerTabs.js +6 -4
- package/modern/DateTimePicker/DateTimePickerToolbar.js +13 -11
- package/modern/DateTimePicker/index.js +5 -5
- package/modern/DateTimePicker/shared.js +5 -5
- package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +4 -2
- package/modern/DayCalendarSkeleton/index.js +2 -2
- package/modern/DesktopDatePicker/DesktopDatePicker.js +30 -23
- package/modern/DesktopDatePicker/index.js +1 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +37 -30
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -1
- package/modern/DesktopDateTimePicker/index.js +2 -2
- package/modern/DesktopTimePicker/DesktopTimePicker.js +31 -24
- package/modern/DesktopTimePicker/index.js +1 -1
- package/modern/DigitalClock/DigitalClock.js +13 -11
- package/modern/DigitalClock/index.js +2 -2
- package/modern/LocalizationProvider/LocalizationProvider.js +2 -0
- package/modern/LocalizationProvider/index.js +1 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +29 -22
- package/modern/MobileDatePicker/index.js +1 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +30 -23
- package/modern/MobileDateTimePicker/index.js +1 -1
- package/modern/MobileTimePicker/MobileTimePicker.js +29 -22
- package/modern/MobileTimePicker/index.js +1 -1
- package/modern/MonthCalendar/MonthCalendar.js +10 -8
- package/modern/MonthCalendar/PickersMonth.js +1 -1
- package/modern/MonthCalendar/index.js +3 -3
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +19 -17
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +2 -2
- package/modern/MultiSectionDigitalClock/index.js +3 -3
- package/modern/PickersActionBar/PickersActionBar.js +3 -1
- package/modern/PickersActionBar/index.js +1 -1
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +9 -7
- package/modern/PickersCalendarHeader/index.js +2 -2
- package/modern/PickersDay/PickersDay.js +5 -3
- package/modern/PickersDay/index.js +2 -2
- package/modern/PickersLayout/PickersLayout.js +4 -2
- package/modern/PickersLayout/index.js +3 -3
- package/modern/PickersLayout/usePickerLayout.js +5 -3
- package/modern/PickersSectionList/PickersSectionList.js +3 -1
- package/modern/PickersSectionList/index.js +2 -2
- package/modern/PickersShortcuts/PickersShortcuts.js +3 -1
- package/modern/PickersShortcuts/index.js +1 -1
- package/modern/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
- package/modern/PickersTextField/PickersFilledInput/index.js +2 -2
- package/modern/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +1 -1
- package/modern/PickersTextField/PickersInput/PickersInput.js +3 -3
- package/modern/PickersTextField/PickersInput/index.js +2 -2
- package/modern/PickersTextField/PickersInput/pickersInputClasses.js +1 -1
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +2 -2
- package/modern/PickersTextField/PickersInputBase/index.js +2 -2
- package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +4 -4
- package/modern/PickersTextField/PickersOutlinedInput/index.js +2 -2
- package/modern/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +1 -1
- package/modern/PickersTextField/PickersTextField.js +6 -4
- package/modern/PickersTextField/index.js +6 -6
- package/modern/StaticDatePicker/StaticDatePicker.js +18 -16
- package/modern/StaticDatePicker/index.js +1 -1
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +19 -17
- package/modern/StaticDateTimePicker/index.js +1 -1
- package/modern/StaticTimePicker/StaticTimePicker.js +18 -16
- package/modern/StaticTimePicker/index.js +1 -1
- package/modern/TimeClock/Clock.js +7 -7
- package/modern/TimeClock/ClockNumber.js +2 -2
- package/modern/TimeClock/ClockNumbers.js +2 -2
- package/modern/TimeClock/ClockPointer.js +2 -2
- package/modern/TimeClock/TimeClock.js +16 -14
- package/modern/TimeClock/index.js +5 -5
- package/modern/TimeField/TimeField.js +15 -11
- package/modern/TimeField/index.js +2 -2
- package/modern/TimeField/useTimeField.js +8 -6
- package/modern/TimePicker/TimePicker.js +16 -14
- package/modern/TimePicker/TimePickerToolbar.js +11 -9
- package/modern/TimePicker/index.js +3 -3
- package/modern/TimePicker/shared.js +3 -3
- package/modern/YearCalendar/PickersYear.js +1 -1
- package/modern/YearCalendar/YearCalendar.js +10 -8
- package/modern/YearCalendar/index.js +3 -3
- package/modern/dateViewRenderers/dateViewRenderers.js +2 -2
- package/modern/dateViewRenderers/index.js +1 -1
- package/modern/hooks/index.js +3 -2
- package/modern/hooks/useClearableField.js +4 -2
- package/modern/hooks/usePickersTranslations.js +3 -1
- package/modern/hooks/useSplitFieldProps.js +43 -0
- package/modern/icons/index.js +8 -8
- package/modern/index.js +39 -38
- package/modern/internals/components/PickerViewRoot/PickerViewRoot.js +1 -1
- package/modern/internals/components/PickerViewRoot/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +2 -2
- package/modern/internals/components/PickersArrowSwitcher/index.js +2 -2
- package/modern/internals/components/PickersModalDialog.js +1 -1
- package/modern/internals/components/PickersPopper.js +3 -3
- package/modern/internals/components/PickersToolbar.js +1 -1
- package/modern/internals/components/PickersToolbarButton.js +2 -2
- package/modern/internals/components/PickersToolbarText.js +1 -1
- package/modern/internals/demo/DemoContainer.js +3 -3
- package/modern/internals/demo/index.js +1 -1
- package/modern/internals/hooks/date-helpers-hooks.js +2 -2
- package/modern/internals/hooks/defaultizedFieldProps.js +2 -2
- package/modern/internals/hooks/useClockReferenceDate.js +3 -3
- package/modern/internals/hooks/useDesktopPicker/index.js +1 -1
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +16 -8
- package/modern/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/modern/internals/hooks/useField/index.js +2 -2
- package/modern/internals/hooks/useField/useField.js +17 -12
- package/modern/internals/hooks/useField/useField.utils.js +1 -1
- package/modern/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
- package/modern/internals/hooks/useField/useFieldState.js +8 -10
- package/modern/internals/hooks/useField/useFieldV6TextField.js +2 -2
- package/modern/internals/hooks/useField/useFieldV7TextField.js +4 -4
- package/modern/internals/hooks/useIsLandscape.js +1 -1
- package/modern/internals/hooks/useMobilePicker/index.js +1 -1
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +6 -8
- package/modern/internals/hooks/usePicker/index.js +1 -1
- package/modern/internals/hooks/usePicker/usePicker.js +4 -4
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +1 -1
- package/modern/internals/hooks/usePicker/usePickerValue.js +15 -19
- package/modern/internals/hooks/usePicker/usePickerViews.js +2 -2
- package/modern/internals/hooks/useStaticPicker/index.js +1 -1
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +4 -4
- package/modern/internals/hooks/useUtils.js +2 -2
- package/modern/internals/hooks/useValueWithTimezone.js +1 -1
- package/modern/internals/index.js +29 -36
- package/modern/internals/models/index.js +2 -2
- package/modern/internals/utils/date-time-utils.js +2 -2
- package/modern/internals/utils/date-utils.js +1 -1
- package/modern/internals/utils/getDefaultReferenceDate.js +2 -2
- package/modern/internals/utils/time-utils.js +1 -1
- package/modern/internals/utils/valueManagers.js +3 -3
- package/modern/locales/beBY.js +5 -5
- package/modern/locales/caES.js +4 -4
- package/modern/locales/csCZ.js +5 -5
- package/modern/locales/daDK.js +4 -4
- package/modern/locales/deDE.js +4 -4
- package/modern/locales/elGR.js +5 -5
- package/modern/locales/enUS.js +5 -5
- package/modern/locales/esES.js +4 -4
- package/modern/locales/eu.js +4 -4
- package/modern/locales/faIR.js +4 -4
- package/modern/locales/fiFI.js +4 -4
- package/modern/locales/frFR.js +4 -4
- package/modern/locales/heIL.js +4 -4
- package/modern/locales/huHU.js +4 -4
- package/modern/locales/index.js +36 -36
- package/modern/locales/isIS.js +5 -5
- package/modern/locales/itIT.js +4 -4
- package/modern/locales/jaJP.js +4 -4
- package/modern/locales/koKR.js +4 -4
- package/modern/locales/kzKZ.js +5 -5
- package/modern/locales/mk.js +4 -4
- package/modern/locales/nbNO.js +5 -5
- package/modern/locales/nlNL.js +4 -4
- package/modern/locales/nnNO.js +4 -4
- package/modern/locales/plPL.js +5 -5
- package/modern/locales/ptBR.js +5 -5
- package/modern/locales/roRO.js +4 -4
- package/modern/locales/ruRU.js +4 -4
- package/modern/locales/skSK.js +5 -5
- package/modern/locales/svSE.js +4 -4
- package/modern/locales/trTR.js +5 -5
- package/modern/locales/ukUA.js +4 -4
- package/modern/locales/urPK.js +5 -5
- package/modern/locales/utils/getPickersLocalization.js +13 -0
- package/modern/locales/viVN.js +4 -4
- package/modern/locales/zhCN.js +4 -4
- package/modern/locales/zhHK.js +4 -4
- package/modern/models/index.js +10 -7
- package/modern/themeAugmentation/index.js +0 -3
- package/modern/timeViewRenderers/index.js +1 -1
- package/modern/timeViewRenderers/timeViewRenderers.js +4 -4
- package/modern/validation/index.js +5 -0
- package/modern/validation/useValidation.js +54 -0
- package/modern/{internals/utils/validation → validation}/validateDate.js +6 -4
- package/modern/validation/validateDateTime.js +26 -0
- package/{internals/utils → modern}/validation/validateTime.js +6 -4
- package/node/AdapterDateFns/AdapterDateFns.js +1 -1
- package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +1 -1
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
- package/node/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js +1 -1
- package/node/AdapterDayjs/AdapterDayjs.js +6 -7
- package/node/AdapterLuxon/AdapterLuxon.js +5 -6
- package/node/AdapterMoment/AdapterMoment.js +5 -6
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -1
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -1
- package/node/DateCalendar/DateCalendar.js +4 -4
- package/node/DateCalendar/DayCalendar.js +3 -5
- package/node/DateCalendar/PickersFadeTransitionGroup.js +2 -3
- package/node/DateCalendar/PickersSlideTransition.js +2 -3
- package/node/DateCalendar/useCalendarState.js +3 -3
- package/node/DateCalendar/useIsDateDisabled.js +6 -6
- package/node/DateField/DateField.js +12 -10
- package/node/DateField/useDateField.js +5 -4
- package/node/DatePicker/DatePicker.js +14 -14
- package/node/DatePicker/DatePickerToolbar.js +3 -3
- package/node/DatePicker/shared.js +2 -3
- package/node/DateTimeField/DateTimeField.js +12 -10
- package/node/DateTimeField/useDateTimeField.js +5 -4
- package/node/DateTimePicker/DateTimePicker.js +14 -14
- package/node/DateTimePicker/DateTimePickerTabs.js +3 -3
- package/node/DateTimePicker/DateTimePickerToolbar.js +3 -3
- package/node/DateTimePicker/shared.js +2 -3
- package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +3 -3
- package/node/DesktopDatePicker/DesktopDatePicker.js +24 -19
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +24 -19
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +2 -3
- package/node/DesktopTimePicker/DesktopTimePicker.js +24 -19
- package/node/DigitalClock/DigitalClock.js +4 -4
- package/node/DigitalClock/digitalClockClasses.js +1 -1
- package/node/LocalizationProvider/LocalizationProvider.js +3 -3
- package/node/MobileDatePicker/MobileDatePicker.js +24 -19
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +24 -19
- package/node/MobileTimePicker/MobileTimePicker.js +24 -19
- package/node/MonthCalendar/MonthCalendar.js +3 -3
- package/node/MonthCalendar/PickersMonth.js +2 -3
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -7
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +2 -3
- package/node/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +1 -1
- package/node/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +1 -1
- package/node/PickersActionBar/PickersActionBar.js +3 -3
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +3 -3
- package/node/PickersDay/PickersDay.js +3 -3
- package/node/PickersLayout/PickersLayout.js +3 -3
- package/node/PickersLayout/index.js +1 -1
- package/node/PickersLayout/pickersLayoutClasses.js +1 -1
- package/node/PickersLayout/usePickerLayout.js +3 -3
- package/node/PickersSectionList/PickersSectionList.js +3 -3
- package/node/PickersSectionList/pickersSectionListClasses.js +1 -1
- package/node/PickersShortcuts/PickersShortcuts.js +3 -3
- package/node/PickersTextField/PickersFilledInput/PickersFilledInput.js +2 -3
- package/node/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +1 -1
- package/node/PickersTextField/PickersInput/PickersInput.js +2 -3
- package/node/PickersTextField/PickersInput/pickersInputClasses.js +1 -1
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +2 -3
- package/node/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +1 -1
- package/node/PickersTextField/PickersOutlinedInput/Outline.js +2 -3
- package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +2 -3
- package/node/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +1 -1
- package/node/PickersTextField/PickersTextField.js +3 -3
- package/node/PickersTextField/pickersTextFieldClasses.js +1 -1
- package/node/StaticDatePicker/StaticDatePicker.js +16 -16
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +16 -16
- package/node/StaticTimePicker/StaticTimePicker.js +16 -16
- package/node/TimeClock/Clock.js +3 -4
- package/node/TimeClock/ClockNumber.js +2 -3
- package/node/TimeClock/ClockNumbers.js +2 -3
- package/node/TimeClock/ClockPointer.js +2 -3
- package/node/TimeClock/TimeClock.js +4 -4
- package/node/TimeField/TimeField.js +12 -10
- package/node/TimeField/useTimeField.js +5 -4
- package/node/TimePicker/TimePicker.js +14 -14
- package/node/TimePicker/TimePickerToolbar.js +3 -3
- package/node/TimePicker/shared.js +2 -3
- package/node/YearCalendar/PickersYear.js +2 -3
- package/node/YearCalendar/YearCalendar.js +3 -3
- package/node/dateViewRenderers/dateViewRenderers.js +1 -2
- package/node/hooks/index.js +8 -1
- package/node/hooks/useClearableField.js +3 -3
- package/node/hooks/usePickersTranslations.js +1 -0
- package/node/hooks/useSplitFieldProps.js +51 -0
- package/node/icons/index.js +9 -10
- package/node/index.js +13 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +2 -3
- package/node/internals/components/PickersModalDialog.js +2 -3
- package/node/internals/components/PickersPopper.js +2 -3
- package/node/internals/components/PickersToolbar.js +2 -3
- package/node/internals/components/PickersToolbarButton.js +2 -3
- package/node/internals/components/PickersToolbarText.js +2 -3
- package/node/internals/demo/DemoContainer.js +4 -5
- package/node/internals/hooks/date-helpers-hooks.js +1 -2
- package/node/internals/hooks/defaultizedFieldProps.js +1 -1
- package/node/internals/hooks/useClockReferenceDate.js +1 -2
- package/node/internals/hooks/useDefaultReduceAnimations.js +1 -1
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +14 -7
- package/node/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/node/internals/hooks/useField/useField.js +13 -9
- package/node/internals/hooks/useField/useFieldCharacterEditing.js +2 -3
- package/node/internals/hooks/useField/useFieldState.js +4 -7
- package/node/internals/hooks/useField/useFieldV6TextField.js +2 -3
- package/node/internals/hooks/useField/useFieldV7TextField.js +2 -3
- package/node/internals/hooks/useIsLandscape.js +1 -2
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +3 -6
- package/node/internals/hooks/useOpenState.js +1 -2
- package/node/internals/hooks/usePicker/usePicker.js +1 -1
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +1 -1
- package/node/internals/hooks/usePicker/usePickerValue.js +14 -19
- package/node/internals/hooks/usePicker/usePickerViews.js +2 -3
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +2 -3
- package/node/internals/hooks/useUtils.js +2 -3
- package/node/internals/hooks/useValueWithTimezone.js +2 -3
- package/node/internals/hooks/useViews.js +2 -3
- package/node/internals/index.js +0 -49
- package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +1 -1
- package/node/internals/utils/date-time-utils.js +1 -1
- package/node/internals/utils/valueManagers.js +1 -1
- package/node/locales/beBY.js +4 -4
- package/node/locales/caES.js +3 -3
- package/node/locales/csCZ.js +4 -4
- package/node/locales/daDK.js +3 -3
- package/node/locales/deDE.js +3 -3
- package/node/locales/elGR.js +4 -4
- package/node/locales/enUS.js +4 -4
- package/node/locales/esES.js +3 -3
- package/node/locales/eu.js +3 -3
- package/node/locales/faIR.js +3 -3
- package/node/locales/fiFI.js +3 -3
- package/node/locales/frFR.js +3 -3
- package/node/locales/heIL.js +3 -3
- package/node/locales/huHU.js +3 -3
- package/node/locales/isIS.js +4 -4
- package/node/locales/itIT.js +3 -3
- package/node/locales/jaJP.js +3 -3
- package/node/locales/koKR.js +3 -3
- package/node/locales/kzKZ.js +4 -4
- package/node/locales/mk.js +3 -3
- package/node/locales/nbNO.js +4 -4
- package/node/locales/nlNL.js +3 -3
- package/node/locales/nnNO.js +3 -3
- package/node/locales/plPL.js +4 -4
- package/node/locales/ptBR.js +4 -4
- package/node/locales/roRO.js +3 -3
- package/node/locales/ruRU.js +3 -3
- package/node/locales/skSK.js +4 -4
- package/node/locales/svSE.js +3 -3
- package/node/locales/trTR.js +4 -4
- package/node/locales/ukUA.js +3 -3
- package/node/locales/urPK.js +4 -4
- package/node/locales/utils/getPickersLocalization.js +17 -3
- package/node/locales/viVN.js +3 -3
- package/node/locales/zhCN.js +3 -3
- package/node/locales/zhHK.js +3 -3
- package/node/themeAugmentation/index.js +1 -38
- package/node/timeViewRenderers/timeViewRenderers.js +1 -2
- package/node/validation/index.js +40 -0
- package/node/validation/useValidation.js +61 -0
- package/node/{internals/utils/validation → validation}/validateDate.js +6 -4
- package/node/{internals/utils/validation → validation}/validateDateTime.js +8 -3
- package/node/{internals/utils/validation → validation}/validateTime.js +6 -4
- package/package.json +4 -3
- package/themeAugmentation/index.d.ts +3 -3
- package/themeAugmentation/index.js +0 -3
- package/timeViewRenderers/index.js +1 -1
- package/timeViewRenderers/timeViewRenderers.js +4 -4
- package/{internals/utils/validation → validation}/extractValidationProps.d.ts +1 -1
- package/validation/index.d.ts +9 -0
- package/validation/index.js +5 -0
- package/validation/package.json +6 -0
- package/validation/useValidation.d.ts +68 -0
- package/validation/useValidation.js +54 -0
- package/validation/validateDate.d.ts +6 -0
- package/{internals/utils/validation → validation}/validateDate.js +6 -4
- package/validation/validateDateTime.d.ts +7 -0
- package/validation/validateDateTime.js +26 -0
- package/validation/validateTime.d.ts +6 -0
- package/{modern/internals/utils/validation → validation}/validateTime.js +6 -4
- package/internals/hooks/useValidation.d.ts +0 -24
- package/internals/hooks/useValidation.js +0 -22
- package/internals/utils/fields.d.ts +0 -5
- package/internals/utils/fields.js +0 -28
- package/internals/utils/validation/validateDate.d.ts +0 -7
- package/internals/utils/validation/validateDateTime.d.ts +0 -7
- package/internals/utils/validation/validateDateTime.js +0 -21
- package/internals/utils/validation/validateTime.d.ts +0 -7
- package/internals/utils/warning.d.ts +0 -2
- package/internals/utils/warning.js +0 -21
- package/modern/internals/hooks/useValidation.js +0 -22
- package/modern/internals/utils/fields.js +0 -28
- package/modern/internals/utils/validation/validateDateTime.js +0 -21
- package/modern/internals/utils/warning.js +0 -21
- package/node/internals/hooks/useValidation.js +0 -30
- package/node/internals/utils/fields.js +0 -36
- package/node/internals/utils/warning.js +0 -28
- /package/{internals/utils → modern}/validation/extractValidationProps.js +0 -0
- /package/node/{internals/utils/validation → validation}/extractValidationProps.js +0 -0
- /package/{modern/internals/utils/validation → validation}/extractValidationProps.js +0 -0
package/node/locales/skSK.js
CHANGED
|
@@ -39,7 +39,7 @@ const skSKPickers = {
|
|
|
39
39
|
timePickerToolbarTitle: 'Vyberte čas',
|
|
40
40
|
dateRangePickerToolbarTitle: 'Vyberete rozmedzie dátumov',
|
|
41
41
|
// Clock labels
|
|
42
|
-
clockLabelText: (view, time,
|
|
42
|
+
clockLabelText: (view, time, utils, formattedTime) => `${timeViews[view] ?? view} vybraný. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Nie je vybraný čas' : `Vybraný čas je ${formattedTime ?? utils.format(time, 'fullTime')}`}`,
|
|
43
43
|
hoursClockNumberText: hours => `${hours} hodín`,
|
|
44
44
|
minutesClockNumberText: minutes => `${minutes} minút`,
|
|
45
45
|
secondsClockNumberText: seconds => `${seconds} sekúnd`,
|
|
@@ -51,9 +51,9 @@ const skSKPickers = {
|
|
|
51
51
|
calendarWeekNumberAriaLabelText: weekNumber => `${weekNumber} týždeň v roku`,
|
|
52
52
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
53
53
|
// Open picker labels
|
|
54
|
-
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Vyberte dátum, vybraný dátum je ${utils.format(value, 'fullDate')}` : 'Vyberte dátum',
|
|
55
|
-
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Vyberte čas, vybraný čas je ${utils.format(value, 'fullTime')}` : 'Vyberte čas',
|
|
56
|
-
// fieldClearLabel: 'Clear
|
|
54
|
+
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `Vyberte dátum, vybraný dátum je ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Vyberte dátum',
|
|
55
|
+
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Vyberte čas, vybraný čas je ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Vyberte čas',
|
|
56
|
+
// fieldClearLabel: 'Clear',
|
|
57
57
|
|
|
58
58
|
// Table labels
|
|
59
59
|
timeTableLabel: 'vyberte čas',
|
package/node/locales/svSE.js
CHANGED
|
@@ -37,7 +37,7 @@ const svSEPickers = {
|
|
|
37
37
|
timePickerToolbarTitle: 'Välj tid',
|
|
38
38
|
dateRangePickerToolbarTitle: 'Välj datumintervall',
|
|
39
39
|
// Clock labels
|
|
40
|
-
clockLabelText: (view, time,
|
|
40
|
+
clockLabelText: (view, time, utils, formattedTime) => `Välj ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Ingen tid vald' : `Vald tid är ${formattedTime ?? utils.format(time, 'fullTime')}`}`,
|
|
41
41
|
hoursClockNumberText: hours => `${hours} timmar`,
|
|
42
42
|
minutesClockNumberText: minutes => `${minutes} minuter`,
|
|
43
43
|
secondsClockNumberText: seconds => `${seconds} sekunder`,
|
|
@@ -49,8 +49,8 @@ const svSEPickers = {
|
|
|
49
49
|
calendarWeekNumberAriaLabelText: weekNumber => `Vecka ${weekNumber}`,
|
|
50
50
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
51
51
|
// Open picker labels
|
|
52
|
-
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Välj datum, valt datum är ${utils.format(value, 'fullDate')}` : 'Välj datum',
|
|
53
|
-
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Välj tid, vald tid är ${utils.format(value, 'fullTime')}` : 'Välj tid',
|
|
52
|
+
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `Välj datum, valt datum är ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Välj datum',
|
|
53
|
+
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Välj tid, vald tid är ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Välj tid',
|
|
54
54
|
fieldClearLabel: 'Rensa värde',
|
|
55
55
|
// Table labels
|
|
56
56
|
timeTableLabel: 'välj tid',
|
package/node/locales/trTR.js
CHANGED
|
@@ -38,7 +38,7 @@ const trTRPickers = {
|
|
|
38
38
|
timePickerToolbarTitle: 'Saat seç',
|
|
39
39
|
dateRangePickerToolbarTitle: 'Tarih aralığı seçin',
|
|
40
40
|
// Clock labels
|
|
41
|
-
clockLabelText: (view, time,
|
|
41
|
+
clockLabelText: (view, time, utils, formattedTime) => `${timeViews[view]} seç. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Zaman seçilmedi' : `Seçilen zaman: ${formattedTime ?? utils.format(time, 'fullTime')}`}`,
|
|
42
42
|
hoursClockNumberText: hours => `${hours} saat`,
|
|
43
43
|
minutesClockNumberText: minutes => `${minutes} dakika`,
|
|
44
44
|
secondsClockNumberText: seconds => `${seconds} saniye`,
|
|
@@ -50,9 +50,9 @@ const trTRPickers = {
|
|
|
50
50
|
calendarWeekNumberAriaLabelText: weekNumber => `Hafta ${weekNumber}`,
|
|
51
51
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
52
52
|
// Open picker labels
|
|
53
|
-
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Tarih seçin, seçilen tarih: ${utils.format(value, 'fullDate')}` : 'Tarih seç',
|
|
54
|
-
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Saat seçin, seçilen saat: ${utils.format(value, 'fullTime')}` : 'Saat seç',
|
|
55
|
-
// fieldClearLabel: 'Clear
|
|
53
|
+
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `Tarih seçin, seçilen tarih: ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Tarih seç',
|
|
54
|
+
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Saat seçin, seçilen saat: ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Saat seç',
|
|
55
|
+
// fieldClearLabel: 'Clear',
|
|
56
56
|
|
|
57
57
|
// Table labels
|
|
58
58
|
timeTableLabel: 'saat seç',
|
package/node/locales/ukUA.js
CHANGED
|
@@ -37,7 +37,7 @@ const ukUAPickers = {
|
|
|
37
37
|
timePickerToolbarTitle: 'Вибрати час',
|
|
38
38
|
dateRangePickerToolbarTitle: 'Вибрати календарний період',
|
|
39
39
|
// Clock labels
|
|
40
|
-
clockLabelText: (view, time,
|
|
40
|
+
clockLabelText: (view, time, utils, formattedTime) => `Вибрати ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Час не вибраний' : `Вибрано час ${formattedTime ?? utils.format(time, 'fullTime')}`}`,
|
|
41
41
|
hoursClockNumberText: hours => `${hours} годин`,
|
|
42
42
|
minutesClockNumberText: minutes => `${minutes} хвилин`,
|
|
43
43
|
secondsClockNumberText: seconds => `${seconds} секунд`,
|
|
@@ -49,8 +49,8 @@ const ukUAPickers = {
|
|
|
49
49
|
calendarWeekNumberAriaLabelText: weekNumber => `Тиждень ${weekNumber}`,
|
|
50
50
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
51
51
|
// Open picker labels
|
|
52
|
-
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Оберіть дату, обрана дата ${utils.format(value, 'fullDate')}` : 'Оберіть дату',
|
|
53
|
-
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Оберіть час, обраний час ${utils.format(value, 'fullTime')}` : 'Оберіть час',
|
|
52
|
+
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `Оберіть дату, обрана дата ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Оберіть дату',
|
|
53
|
+
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Оберіть час, обраний час ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Оберіть час',
|
|
54
54
|
fieldClearLabel: 'Очистити дані',
|
|
55
55
|
// Table labels
|
|
56
56
|
timeTableLabel: 'оберіть час',
|
package/node/locales/urPK.js
CHANGED
|
@@ -38,7 +38,7 @@ const urPKPickers = {
|
|
|
38
38
|
timePickerToolbarTitle: 'وقت منتخب کریں',
|
|
39
39
|
dateRangePickerToolbarTitle: 'تاریخوں کی رینج منتخب کریں',
|
|
40
40
|
// Clock labels
|
|
41
|
-
clockLabelText: (view, time,
|
|
41
|
+
clockLabelText: (view, time, utils, formattedTime) => `${timeViews[view]} منتخب کریں ${!formattedTime && (time === null || !utils.isValid(time)) ? 'کوئی وقت منتخب نہیں' : `منتخب وقت ہے ${formattedTime ?? utils.format(time, 'fullTime')}`}`,
|
|
42
42
|
hoursClockNumberText: hours => `${hours} گھنٹے`,
|
|
43
43
|
minutesClockNumberText: minutes => `${minutes} منٹ`,
|
|
44
44
|
secondsClockNumberText: seconds => `${seconds} سیکنڈ`,
|
|
@@ -50,9 +50,9 @@ const urPKPickers = {
|
|
|
50
50
|
calendarWeekNumberAriaLabelText: weekNumber => `ہفتہ ${weekNumber}`,
|
|
51
51
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
52
52
|
// Open picker labels
|
|
53
|
-
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `تاریخ منتخب کریں، منتخب شدہ تاریخ ہے ${utils.format(value, 'fullDate')}` : 'تاریخ منتخب کریں',
|
|
54
|
-
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `وقت منتخب کریں، منتخب شدہ وقت ہے ${utils.format(value, 'fullTime')}` : 'وقت منتخب کریں',
|
|
55
|
-
// fieldClearLabel: 'Clear
|
|
53
|
+
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `تاریخ منتخب کریں، منتخب شدہ تاریخ ہے ${formattedDate ?? utils.format(value, 'fullDate')}` : 'تاریخ منتخب کریں',
|
|
54
|
+
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `وقت منتخب کریں، منتخب شدہ وقت ہے ${formattedTime ?? utils.format(value, 'fullTime')}` : 'وقت منتخب کریں',
|
|
55
|
+
// fieldClearLabel: 'Clear',
|
|
56
56
|
|
|
57
57
|
// Table labels
|
|
58
58
|
timeTableLabel: 'وقت منتخب کریں',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getPickersLocalization = void 0;
|
|
7
|
+
exports.getPickersLocalization = exports.buildGetOpenDialogAriaText = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
const getPickersLocalization = pickersTranslations => {
|
|
10
10
|
return {
|
|
@@ -17,4 +17,18 @@ const getPickersLocalization = pickersTranslations => {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
exports.getPickersLocalization = getPickersLocalization;
|
|
20
|
+
exports.getPickersLocalization = getPickersLocalization;
|
|
21
|
+
const buildGetOpenDialogAriaText = params => {
|
|
22
|
+
const {
|
|
23
|
+
utils,
|
|
24
|
+
formatKey,
|
|
25
|
+
contextTranslation,
|
|
26
|
+
propsTranslation
|
|
27
|
+
} = params;
|
|
28
|
+
return value => {
|
|
29
|
+
const formattedValue = value !== null && utils.isValid(value) ? utils.format(value, formatKey) : null;
|
|
30
|
+
const translation = propsTranslation ?? contextTranslation;
|
|
31
|
+
return translation(value, utils, formattedValue);
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
exports.buildGetOpenDialogAriaText = buildGetOpenDialogAriaText;
|
package/node/locales/viVN.js
CHANGED
|
@@ -37,7 +37,7 @@ const viVNPickers = {
|
|
|
37
37
|
timePickerToolbarTitle: 'Chọn giờ',
|
|
38
38
|
dateRangePickerToolbarTitle: 'Chọn khoảng ngày',
|
|
39
39
|
// Clock labels
|
|
40
|
-
clockLabelText: (view, time,
|
|
40
|
+
clockLabelText: (view, time, utils, formattedTime) => `Chọn ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Không có giờ được chọn' : `Giờ được chọn là ${formattedTime ?? utils.format(time, 'fullTime')}`}`,
|
|
41
41
|
hoursClockNumberText: hours => `${hours} giờ`,
|
|
42
42
|
minutesClockNumberText: minutes => `${minutes} phút`,
|
|
43
43
|
secondsClockNumberText: seconds => `${seconds} giây`,
|
|
@@ -49,8 +49,8 @@ const viVNPickers = {
|
|
|
49
49
|
calendarWeekNumberAriaLabelText: weekNumber => `Tuần ${weekNumber}`,
|
|
50
50
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
51
51
|
// Open picker labels
|
|
52
|
-
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Chọn ngày, ngày đã chọn là ${utils.format(value, 'fullDate')}` : 'Chọn ngày',
|
|
53
|
-
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Chọn giờ, giờ đã chọn là ${utils.format(value, 'fullTime')}` : 'Chọn giờ',
|
|
52
|
+
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `Chọn ngày, ngày đã chọn là ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Chọn ngày',
|
|
53
|
+
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Chọn giờ, giờ đã chọn là ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Chọn giờ',
|
|
54
54
|
fieldClearLabel: 'Xóa giá trị',
|
|
55
55
|
// Table labels
|
|
56
56
|
timeTableLabel: 'chọn giờ',
|
package/node/locales/zhCN.js
CHANGED
|
@@ -37,7 +37,7 @@ const zhCNPickers = {
|
|
|
37
37
|
timePickerToolbarTitle: '选择时间',
|
|
38
38
|
dateRangePickerToolbarTitle: '选择时间范围',
|
|
39
39
|
// Clock labels
|
|
40
|
-
clockLabelText: (view, time,
|
|
40
|
+
clockLabelText: (view, time, utils, formattedTime) => `选择 ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? '未选择时间' : `已选择${formattedTime ?? utils.format(time, 'fullTime')}`}`,
|
|
41
41
|
hoursClockNumberText: hours => `${hours}小时`,
|
|
42
42
|
minutesClockNumberText: minutes => `${minutes}分钟`,
|
|
43
43
|
secondsClockNumberText: seconds => `${seconds}秒`,
|
|
@@ -49,8 +49,8 @@ const zhCNPickers = {
|
|
|
49
49
|
calendarWeekNumberAriaLabelText: weekNumber => `第${weekNumber}周`,
|
|
50
50
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
51
51
|
// Open picker labels
|
|
52
|
-
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `选择日期,已选择${utils.format(value, 'fullDate')}` : '选择日期',
|
|
53
|
-
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `选择时间,已选择${utils.format(value, 'fullTime')}` : '选择时间',
|
|
52
|
+
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `选择日期,已选择${formattedDate ?? utils.format(value, 'fullDate')}` : '选择日期',
|
|
53
|
+
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `选择时间,已选择${formattedTime ?? utils.format(value, 'fullTime')}` : '选择时间',
|
|
54
54
|
fieldClearLabel: '清除',
|
|
55
55
|
// Table labels
|
|
56
56
|
timeTableLabel: '选择时间',
|
package/node/locales/zhHK.js
CHANGED
|
@@ -37,7 +37,7 @@ const zhHKPickers = {
|
|
|
37
37
|
timePickerToolbarTitle: '選擇時間',
|
|
38
38
|
dateRangePickerToolbarTitle: '選擇時間範圍',
|
|
39
39
|
// Clock labels
|
|
40
|
-
clockLabelText: (view, time,
|
|
40
|
+
clockLabelText: (view, time, utils, formattedTime) => `選擇 ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? '未選擇時間' : `已選擇${formattedTime ?? utils.format(time, 'fullTime')}`}`,
|
|
41
41
|
hoursClockNumberText: hours => `${hours}小時`,
|
|
42
42
|
minutesClockNumberText: minutes => `${minutes}分鐘`,
|
|
43
43
|
secondsClockNumberText: seconds => `${seconds}秒`,
|
|
@@ -49,8 +49,8 @@ const zhHKPickers = {
|
|
|
49
49
|
calendarWeekNumberAriaLabelText: weekNumber => `第${weekNumber}週`,
|
|
50
50
|
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
51
51
|
// Open picker labels
|
|
52
|
-
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `選擇日期,已選擇${utils.format(value, 'fullDate')}` : '選擇日期',
|
|
53
|
-
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `選擇時間,已選擇${utils.format(value, 'fullTime')}` : '選擇時間',
|
|
52
|
+
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `選擇日期,已選擇${formattedDate ?? utils.format(value, 'fullDate')}` : '選擇日期',
|
|
53
|
+
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `選擇時間,已選擇${formattedTime ?? utils.format(value, 'fullTime')}` : '選擇時間',
|
|
54
54
|
fieldClearLabel: '清除',
|
|
55
55
|
// Table labels
|
|
56
56
|
timeTableLabel: '選擇時間',
|
|
@@ -1,38 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _overrides = require("./overrides");
|
|
7
|
-
Object.keys(_overrides).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _overrides[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _overrides[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _props = require("./props");
|
|
18
|
-
Object.keys(_props).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _props[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _props[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _components = require("./components");
|
|
29
|
-
Object.keys(_components).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _components[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _components[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
1
|
+
"use strict";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -10,8 +11,6 @@ var _DigitalClock = require("../DigitalClock");
|
|
|
10
11
|
var _MultiSectionDigitalClock = require("../MultiSectionDigitalClock");
|
|
11
12
|
var _timeUtils = require("../internals/utils/time-utils");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
14
|
const renderTimeViewClock = ({
|
|
16
15
|
view,
|
|
17
16
|
onViewChange,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "extractValidationProps", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _extractValidationProps.extractValidationProps;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "useValidation", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _useValidation.useValidation;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "validateDate", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _validateDate.validateDate;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "validateDateTime", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _validateDateTime.validateDateTime;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "validateTime", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _validateTime.validateTime;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var _validateDate = require("./validateDate");
|
|
37
|
+
var _validateTime = require("./validateTime");
|
|
38
|
+
var _validateDateTime = require("./validateDateTime");
|
|
39
|
+
var _extractValidationProps = require("./extractValidationProps");
|
|
40
|
+
var _useValidation = require("./useValidation");
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.useValidation = useValidation;
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
12
|
+
var _useUtils = require("../internals/hooks/useUtils");
|
|
13
|
+
/**
|
|
14
|
+
* Utility hook to check if a given value is valid based on the provided validation props.
|
|
15
|
+
* @template TDate
|
|
16
|
+
* @template TValue The value type. It will be either the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
17
|
+
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
18
|
+
* @param {UseValidationOptions<TValue, TDate, TError, TValidationProps>} options The options to configure the hook.
|
|
19
|
+
* @param {TValue} options.value The value to validate.
|
|
20
|
+
* @param {PickersTimezone} options.timezone The timezone to use for the validation.
|
|
21
|
+
* @param {Validator<TValue, TDate, TError, TValidationProps>} options.validator The validator function to use.
|
|
22
|
+
* @param {TValidationProps} options.props The validation props, they differ depending on the component.
|
|
23
|
+
* @param {(error: TError, value: TValue) => void} options.onError Callback fired when the error associated with the current value changes.
|
|
24
|
+
*/
|
|
25
|
+
function useValidation(options) {
|
|
26
|
+
const {
|
|
27
|
+
props,
|
|
28
|
+
validator,
|
|
29
|
+
value,
|
|
30
|
+
timezone,
|
|
31
|
+
onError
|
|
32
|
+
} = options;
|
|
33
|
+
const adapter = (0, _useUtils.useLocalizationContext)();
|
|
34
|
+
const previousValidationErrorRef = React.useRef(validator.valueManager.defaultErrorState);
|
|
35
|
+
const validationError = validator({
|
|
36
|
+
adapter,
|
|
37
|
+
value,
|
|
38
|
+
timezone,
|
|
39
|
+
props
|
|
40
|
+
});
|
|
41
|
+
const hasValidationError = validator.valueManager.hasError(validationError);
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
if (onError && !validator.valueManager.isSameError(validationError, previousValidationErrorRef.current)) {
|
|
44
|
+
onError(validationError, value);
|
|
45
|
+
}
|
|
46
|
+
previousValidationErrorRef.current = validationError;
|
|
47
|
+
}, [validator, onError, validationError, value]);
|
|
48
|
+
const getValidationErrorForNewValue = (0, _useEventCallback.default)(newValue => {
|
|
49
|
+
return validator({
|
|
50
|
+
adapter,
|
|
51
|
+
value: newValue,
|
|
52
|
+
timezone,
|
|
53
|
+
props
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
validationError,
|
|
58
|
+
hasValidationError,
|
|
59
|
+
getValidationErrorForNewValue
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.validateDate = void 0;
|
|
7
|
-
var _dateUtils = require("../date-utils");
|
|
7
|
+
var _dateUtils = require("../internals/utils/date-utils");
|
|
8
|
+
var _valueManagers = require("../internals/utils/valueManagers");
|
|
8
9
|
const validateDate = ({
|
|
9
10
|
props,
|
|
10
11
|
value,
|
|
12
|
+
timezone,
|
|
11
13
|
adapter
|
|
12
14
|
}) => {
|
|
13
15
|
if (value === null) {
|
|
@@ -18,8 +20,7 @@ const validateDate = ({
|
|
|
18
20
|
shouldDisableMonth,
|
|
19
21
|
shouldDisableYear,
|
|
20
22
|
disablePast,
|
|
21
|
-
disableFuture
|
|
22
|
-
timezone
|
|
23
|
+
disableFuture
|
|
23
24
|
} = props;
|
|
24
25
|
const now = adapter.utils.date(undefined, timezone);
|
|
25
26
|
const minDate = (0, _dateUtils.applyDefaultDate)(adapter.utils, props.minDate, adapter.defaultDates.minDate);
|
|
@@ -45,4 +46,5 @@ const validateDate = ({
|
|
|
45
46
|
return null;
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
|
-
exports.validateDate = validateDate;
|
|
49
|
+
exports.validateDate = validateDate;
|
|
50
|
+
validateDate.valueManager = _valueManagers.singleItemValueManager;
|
|
@@ -6,14 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.validateDateTime = void 0;
|
|
7
7
|
var _validateDate = require("./validateDate");
|
|
8
8
|
var _validateTime = require("./validateTime");
|
|
9
|
+
var _valueManagers = require("../internals/utils/valueManagers");
|
|
9
10
|
const validateDateTime = ({
|
|
10
|
-
|
|
11
|
+
adapter,
|
|
11
12
|
value,
|
|
12
|
-
|
|
13
|
+
timezone,
|
|
14
|
+
props
|
|
13
15
|
}) => {
|
|
14
16
|
const dateValidationResult = (0, _validateDate.validateDate)({
|
|
15
17
|
adapter,
|
|
16
18
|
value,
|
|
19
|
+
timezone,
|
|
17
20
|
props
|
|
18
21
|
});
|
|
19
22
|
if (dateValidationResult !== null) {
|
|
@@ -22,7 +25,9 @@ const validateDateTime = ({
|
|
|
22
25
|
return (0, _validateTime.validateTime)({
|
|
23
26
|
adapter,
|
|
24
27
|
value,
|
|
28
|
+
timezone,
|
|
25
29
|
props
|
|
26
30
|
});
|
|
27
31
|
};
|
|
28
|
-
exports.validateDateTime = validateDateTime;
|
|
32
|
+
exports.validateDateTime = validateDateTime;
|
|
33
|
+
validateDateTime.valueManager = _valueManagers.singleItemValueManager;
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.validateTime = void 0;
|
|
7
|
-
var _timeUtils = require("../time-utils");
|
|
7
|
+
var _timeUtils = require("../internals/utils/time-utils");
|
|
8
|
+
var _valueManagers = require("../internals/utils/valueManagers");
|
|
8
9
|
const validateTime = ({
|
|
9
10
|
adapter,
|
|
10
11
|
value,
|
|
12
|
+
timezone,
|
|
11
13
|
props
|
|
12
14
|
}) => {
|
|
13
15
|
if (value === null) {
|
|
@@ -20,8 +22,7 @@ const validateTime = ({
|
|
|
20
22
|
shouldDisableTime,
|
|
21
23
|
disableIgnoringDatePartForTimeValidation = false,
|
|
22
24
|
disablePast,
|
|
23
|
-
disableFuture
|
|
24
|
-
timezone
|
|
25
|
+
disableFuture
|
|
25
26
|
} = props;
|
|
26
27
|
const now = adapter.utils.date(undefined, timezone);
|
|
27
28
|
const isAfter = (0, _timeUtils.createIsAfterIgnoreDatePart)(disableIgnoringDatePartForTimeValidation, adapter.utils);
|
|
@@ -48,4 +49,5 @@ const validateTime = ({
|
|
|
48
49
|
return null;
|
|
49
50
|
}
|
|
50
51
|
};
|
|
51
|
-
exports.validateTime = validateTime;
|
|
52
|
+
exports.validateTime = validateTime;
|
|
53
|
+
validateTime.valueManager = _valueManagers.singleItemValueManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.17.0",
|
|
4
4
|
"description": "The community edition of the Date and Time Picker components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -35,12 +35,13 @@
|
|
|
35
35
|
"directory": "packages/x-date-pickers"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@babel/runtime": "^7.25.
|
|
38
|
+
"@babel/runtime": "^7.25.6",
|
|
39
39
|
"@mui/utils": "^5.16.6",
|
|
40
40
|
"@types/react-transition-group": "^4.4.11",
|
|
41
41
|
"clsx": "^2.1.1",
|
|
42
42
|
"prop-types": "^15.8.1",
|
|
43
|
-
"react-transition-group": "^4.4.5"
|
|
43
|
+
"react-transition-group": "^4.4.5",
|
|
44
|
+
"@mui/x-internals": "7.17.0"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"@emotion/react": "^11.9.0",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './overrides';
|
|
2
|
-
export * from './props';
|
|
3
|
-
export * from './components';
|
|
1
|
+
export type * from './overrides';
|
|
2
|
+
export type * from './props';
|
|
3
|
+
export type * from './components';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { renderTimeViewClock, renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from
|
|
1
|
+
export { renderTimeViewClock, renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from "./timeViewRenderers.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { TimeClock } from
|
|
3
|
-
import { DigitalClock } from
|
|
4
|
-
import { MultiSectionDigitalClock } from
|
|
5
|
-
import { isTimeView } from
|
|
2
|
+
import { TimeClock } from "../TimeClock/index.js";
|
|
3
|
+
import { DigitalClock } from "../DigitalClock/index.js";
|
|
4
|
+
import { MultiSectionDigitalClock } from "../MultiSectionDigitalClock/index.js";
|
|
5
|
+
import { isTimeView } from "../internals/utils/time-utils.js";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
export const renderTimeViewClock = ({
|
|
8
8
|
view,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseDateValidationProps, BaseTimeValidationProps, DateTimeValidationProps, DayValidationProps, MonthValidationProps, TimeValidationProps, YearValidationProps } from '
|
|
1
|
+
import { BaseDateValidationProps, BaseTimeValidationProps, DateTimeValidationProps, DayValidationProps, MonthValidationProps, TimeValidationProps, YearValidationProps } from '../internals/models/validation';
|
|
2
2
|
export declare const DATE_VALIDATION_PROP_NAMES: (keyof BaseDateValidationProps<any> | keyof YearValidationProps<any> | keyof MonthValidationProps<any> | keyof DayValidationProps<any>)[];
|
|
3
3
|
export declare const TIME_VALIDATION_PROP_NAMES: (keyof BaseTimeValidationProps | keyof TimeValidationProps<any> | 'ampm')[];
|
|
4
4
|
export declare const DATE_TIME_VALIDATION_PROP_NAMES: (keyof DateTimeValidationProps<any>)[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { validateDate } from './validateDate';
|
|
2
|
+
export type { ValidateDateProps } from './validateDate';
|
|
3
|
+
export { validateTime } from './validateTime';
|
|
4
|
+
export type { ValidateTimeProps } from './validateTime';
|
|
5
|
+
export { validateDateTime } from './validateDateTime';
|
|
6
|
+
export type { ValidateDateTimeProps } from './validateDateTime';
|
|
7
|
+
export { extractValidationProps } from './extractValidationProps';
|
|
8
|
+
export { useValidation } from './useValidation';
|
|
9
|
+
export type { Validator } from './useValidation';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { validateDate } from "./validateDate.js";
|
|
2
|
+
export { validateTime } from "./validateTime.js";
|
|
3
|
+
export { validateDateTime } from "./validateDateTime.js";
|
|
4
|
+
export { extractValidationProps } from "./extractValidationProps.js";
|
|
5
|
+
export { useValidation } from "./useValidation.js";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { MuiPickersAdapterContextValue } from '../LocalizationProvider/LocalizationProvider';
|
|
2
|
+
import { OnErrorProps, PickersTimezone, PickerValidDate } from '../models';
|
|
3
|
+
import type { PickerValueManager } from '../internals/hooks/usePicker';
|
|
4
|
+
export type Validator<TValue, TDate extends PickerValidDate, TError, TValidationProps> = {
|
|
5
|
+
(params: {
|
|
6
|
+
adapter: MuiPickersAdapterContextValue<TDate>;
|
|
7
|
+
value: TValue;
|
|
8
|
+
timezone: PickersTimezone;
|
|
9
|
+
props: TValidationProps;
|
|
10
|
+
}): TError;
|
|
11
|
+
valueManager: PickerValueManager<TValue, TDate, any>;
|
|
12
|
+
};
|
|
13
|
+
interface UseValidationOptions<TValue, TDate extends PickerValidDate, TError, TValidationProps extends {}> extends OnErrorProps<TValue, TError> {
|
|
14
|
+
/**
|
|
15
|
+
* The value to validate.
|
|
16
|
+
*/
|
|
17
|
+
value: TValue;
|
|
18
|
+
/**
|
|
19
|
+
* The timezone to use for the validation.
|
|
20
|
+
*/
|
|
21
|
+
timezone: PickersTimezone;
|
|
22
|
+
/**
|
|
23
|
+
* The validator function to use.
|
|
24
|
+
* They can be imported from `@mui/x-date-pickers/validation` and `@mui/x-date-pickers-pro/validation`.
|
|
25
|
+
* It is recommended to only use the validator exported by the MUI X packages,
|
|
26
|
+
* otherwise you may have inconsistent behaviors between the field and the views.
|
|
27
|
+
*/
|
|
28
|
+
validator: Validator<TValue, TDate, TError, TValidationProps>;
|
|
29
|
+
/**
|
|
30
|
+
* The validation props, they differ depending on the component.
|
|
31
|
+
* For example, the `validateTime` function supports `minTime`, `maxTime`, etc.
|
|
32
|
+
*/
|
|
33
|
+
props: TValidationProps;
|
|
34
|
+
}
|
|
35
|
+
interface UseValidationReturnValue<TValue, TError> {
|
|
36
|
+
/**
|
|
37
|
+
* The validation error associated to the value passed to the `useValidation` hook.
|
|
38
|
+
*/
|
|
39
|
+
validationError: TError;
|
|
40
|
+
/**
|
|
41
|
+
* `true` if the current error is not null.
|
|
42
|
+
* For single value components, it means that the value is invalid.
|
|
43
|
+
* For range components, it means that either start or end value is invalid.
|
|
44
|
+
*/
|
|
45
|
+
hasValidationError: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Get the validation error for a new value.
|
|
48
|
+
* This can be used to validate the value in a change handler before updating the state.
|
|
49
|
+
* @template TValue The value type.
|
|
50
|
+
* @param {TValue} newValue The value to validate.
|
|
51
|
+
* @returns {TError} The validation error associated to the new value.
|
|
52
|
+
*/
|
|
53
|
+
getValidationErrorForNewValue: (newValue: TValue) => TError;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Utility hook to check if a given value is valid based on the provided validation props.
|
|
57
|
+
* @template TDate
|
|
58
|
+
* @template TValue The value type. It will be either the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
59
|
+
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
60
|
+
* @param {UseValidationOptions<TValue, TDate, TError, TValidationProps>} options The options to configure the hook.
|
|
61
|
+
* @param {TValue} options.value The value to validate.
|
|
62
|
+
* @param {PickersTimezone} options.timezone The timezone to use for the validation.
|
|
63
|
+
* @param {Validator<TValue, TDate, TError, TValidationProps>} options.validator The validator function to use.
|
|
64
|
+
* @param {TValidationProps} options.props The validation props, they differ depending on the component.
|
|
65
|
+
* @param {(error: TError, value: TValue) => void} options.onError Callback fired when the error associated with the current value changes.
|
|
66
|
+
*/
|
|
67
|
+
export declare function useValidation<TValue, TDate extends PickerValidDate, TError, TValidationProps extends {}>(options: UseValidationOptions<TValue, TDate, TError, TValidationProps>): UseValidationReturnValue<TValue, TError>;
|
|
68
|
+
export {};
|