@mui/x-date-pickers 6.14.0 → 6.16.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/CHANGELOG.md +167 -0
- package/DateCalendar/DateCalendar.js +6 -2
- package/DateCalendar/DateCalendar.types.d.ts +1 -1
- package/DateCalendar/DayCalendar.d.ts +6 -5
- package/DateCalendar/DayCalendar.js +18 -6
- package/DateCalendar/dayCalendarClasses.d.ts +2 -0
- package/DateCalendar/dayCalendarClasses.js +1 -1
- package/DateField/DateField.js +32 -4
- package/DateField/DateField.types.d.ts +3 -2
- package/DatePicker/DatePicker.js +6 -2
- package/DateTimeField/DateTimeField.js +32 -4
- package/DateTimeField/DateTimeField.types.d.ts +3 -2
- package/DateTimePicker/DateTimePicker.js +6 -2
- package/DateTimePicker/DateTimePickerToolbar.js +1 -0
- package/DesktopDatePicker/DesktopDatePicker.js +6 -2
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -2
- package/MobileDatePicker/MobileDatePicker.js +6 -2
- package/MobileDateTimePicker/MobileDateTimePicker.js +6 -2
- package/StaticDatePicker/StaticDatePicker.js +6 -2
- package/StaticDateTimePicker/StaticDateTimePicker.js +6 -2
- package/TimeField/TimeField.js +29 -4
- package/TimeField/TimeField.types.d.ts +3 -2
- package/TimePicker/TimePickerToolbar.js +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/package.json +6 -0
- package/hooks/useClearableField.d.ts +25 -0
- package/hooks/useClearableField.js +79 -0
- package/icons/index.d.ts +6 -0
- package/icons/index.js +8 -1
- package/index.d.ts +1 -0
- package/index.js +3 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +3 -2
- package/internals/hooks/useField/index.d.ts +1 -1
- package/internals/hooks/useField/useField.js +24 -6
- package/internals/hooks/useField/useField.types.d.ts +31 -1
- package/internals/hooks/useField/useField.utils.js +8 -3
- package/internals/index.d.ts +1 -1
- package/internals/models/props/toolbar.d.ts +3 -0
- package/internals/models/validation.d.ts +3 -0
- package/internals/utils/date-utils.d.ts +1 -0
- package/internals/utils/date-utils.js +4 -0
- package/legacy/DateCalendar/DateCalendar.js +6 -2
- package/legacy/DateCalendar/DayCalendar.js +22 -9
- package/legacy/DateCalendar/dayCalendarClasses.js +1 -1
- package/legacy/DateField/DateField.js +30 -3
- package/legacy/DatePicker/DatePicker.js +6 -2
- package/legacy/DateTimeField/DateTimeField.js +30 -3
- package/legacy/DateTimePicker/DateTimePicker.js +6 -2
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +1 -0
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +6 -2
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -2
- package/legacy/MobileDatePicker/MobileDatePicker.js +6 -2
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +6 -2
- package/legacy/StaticDatePicker/StaticDatePicker.js +6 -2
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +6 -2
- package/legacy/TimeField/TimeField.js +27 -3
- package/legacy/TimePicker/TimePickerToolbar.js +1 -0
- package/legacy/hooks/index.js +1 -0
- package/legacy/hooks/useClearableField.js +80 -0
- package/legacy/icons/index.js +8 -1
- package/legacy/index.js +3 -2
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
- package/legacy/internals/hooks/useField/useField.js +28 -7
- package/legacy/internals/hooks/useField/useField.utils.js +16 -8
- package/legacy/internals/utils/date-utils.js +6 -0
- package/legacy/locales/beBY.js +2 -0
- package/legacy/locales/caES.js +2 -0
- package/legacy/locales/csCZ.js +2 -0
- package/legacy/locales/daDK.js +2 -0
- package/legacy/locales/deDE.js +2 -0
- package/legacy/locales/elGR.js +2 -0
- package/legacy/locales/enUS.js +1 -0
- package/legacy/locales/esES.js +2 -0
- package/legacy/locales/faIR.js +2 -0
- package/legacy/locales/fiFI.js +27 -11
- package/legacy/locales/frFR.js +2 -0
- package/legacy/locales/heIL.js +2 -0
- package/legacy/locales/huHU.js +1 -0
- package/legacy/locales/isIS.js +2 -0
- package/legacy/locales/itIT.js +2 -0
- package/legacy/locales/jaJP.js +2 -0
- package/legacy/locales/koKR.js +2 -0
- package/legacy/locales/kzKZ.js +2 -0
- package/legacy/locales/nbNO.js +2 -0
- package/legacy/locales/nlNL.js +2 -0
- package/legacy/locales/plPL.js +2 -0
- package/legacy/locales/ptBR.js +2 -0
- package/legacy/locales/roRO.js +1 -0
- package/legacy/locales/ruRU.js +2 -0
- package/legacy/locales/skSK.js +2 -0
- package/legacy/locales/svSE.js +2 -0
- package/legacy/locales/trTR.js +2 -0
- package/legacy/locales/ukUA.js +2 -0
- package/legacy/locales/urPK.js +2 -0
- package/legacy/locales/viVN.js +2 -0
- package/legacy/locales/zhCN.js +2 -0
- package/legacy/locales/zhHK.js +2 -0
- package/locales/beBY.d.ts +1 -0
- package/locales/beBY.js +2 -0
- package/locales/caES.d.ts +1 -0
- package/locales/caES.js +2 -0
- package/locales/csCZ.d.ts +1 -0
- package/locales/csCZ.js +2 -0
- package/locales/daDK.d.ts +1 -0
- package/locales/daDK.js +2 -0
- package/locales/deDE.d.ts +1 -0
- package/locales/deDE.js +2 -0
- package/locales/elGR.d.ts +1 -0
- package/locales/elGR.js +2 -0
- package/locales/enUS.d.ts +1 -0
- package/locales/enUS.js +1 -0
- package/locales/esES.d.ts +1 -0
- package/locales/esES.js +2 -0
- package/locales/faIR.d.ts +1 -0
- package/locales/faIR.js +2 -0
- package/locales/fiFI.d.ts +1 -0
- package/locales/fiFI.js +11 -11
- package/locales/frFR.d.ts +1 -0
- package/locales/frFR.js +2 -0
- package/locales/heIL.d.ts +1 -0
- package/locales/heIL.js +2 -0
- package/locales/huHU.d.ts +1 -0
- package/locales/huHU.js +1 -0
- package/locales/isIS.d.ts +1 -0
- package/locales/isIS.js +2 -0
- package/locales/itIT.d.ts +1 -0
- package/locales/itIT.js +2 -0
- package/locales/jaJP.d.ts +1 -0
- package/locales/jaJP.js +2 -0
- package/locales/koKR.d.ts +1 -0
- package/locales/koKR.js +2 -0
- package/locales/kzKZ.d.ts +1 -0
- package/locales/kzKZ.js +2 -0
- package/locales/nbNO.d.ts +1 -0
- package/locales/nbNO.js +2 -0
- package/locales/nlNL.d.ts +1 -0
- package/locales/nlNL.js +2 -0
- package/locales/plPL.d.ts +1 -0
- package/locales/plPL.js +2 -0
- package/locales/ptBR.d.ts +1 -0
- package/locales/ptBR.js +2 -0
- package/locales/roRO.d.ts +1 -0
- package/locales/roRO.js +1 -0
- package/locales/ruRU.d.ts +1 -0
- package/locales/ruRU.js +2 -0
- package/locales/skSK.d.ts +1 -0
- package/locales/skSK.js +2 -0
- package/locales/svSE.d.ts +1 -0
- package/locales/svSE.js +2 -0
- package/locales/trTR.d.ts +1 -0
- package/locales/trTR.js +2 -0
- package/locales/ukUA.d.ts +1 -0
- package/locales/ukUA.js +2 -0
- package/locales/urPK.d.ts +1 -0
- package/locales/urPK.js +2 -0
- package/locales/utils/getPickersLocalization.d.ts +1 -0
- package/locales/utils/pickersLocaleTextApi.d.ts +1 -0
- package/locales/viVN.d.ts +1 -0
- package/locales/viVN.js +2 -0
- package/locales/zhCN.d.ts +1 -0
- package/locales/zhCN.js +2 -0
- package/locales/zhHK.d.ts +1 -0
- package/locales/zhHK.js +2 -0
- package/models/adapters.d.ts +1 -0
- package/models/fields.d.ts +2 -0
- package/modern/DateCalendar/DateCalendar.js +6 -2
- package/modern/DateCalendar/DayCalendar.js +25 -11
- package/modern/DateCalendar/dayCalendarClasses.js +1 -1
- package/modern/DateField/DateField.js +32 -4
- package/modern/DatePicker/DatePicker.js +6 -2
- package/modern/DateTimeField/DateTimeField.js +32 -4
- package/modern/DateTimePicker/DateTimePicker.js +6 -2
- package/modern/DateTimePicker/DateTimePickerToolbar.js +1 -0
- package/modern/DesktopDatePicker/DesktopDatePicker.js +6 -2
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -2
- package/modern/MobileDatePicker/MobileDatePicker.js +6 -2
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +6 -2
- package/modern/StaticDatePicker/StaticDatePicker.js +6 -2
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +6 -2
- package/modern/TimeField/TimeField.js +29 -4
- package/modern/TimePicker/TimePickerToolbar.js +1 -0
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/useClearableField.js +78 -0
- package/modern/icons/index.js +8 -1
- package/modern/index.js +3 -2
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
- package/modern/internals/hooks/useField/useField.js +23 -6
- package/modern/internals/hooks/useField/useField.utils.js +8 -3
- package/modern/internals/utils/date-utils.js +4 -0
- package/modern/locales/beBY.js +2 -0
- package/modern/locales/caES.js +2 -0
- package/modern/locales/csCZ.js +2 -0
- package/modern/locales/daDK.js +2 -0
- package/modern/locales/deDE.js +2 -0
- package/modern/locales/elGR.js +2 -0
- package/modern/locales/enUS.js +1 -0
- package/modern/locales/esES.js +2 -0
- package/modern/locales/faIR.js +2 -0
- package/modern/locales/fiFI.js +11 -11
- package/modern/locales/frFR.js +2 -0
- package/modern/locales/heIL.js +2 -0
- package/modern/locales/huHU.js +1 -0
- package/modern/locales/isIS.js +2 -0
- package/modern/locales/itIT.js +2 -0
- package/modern/locales/jaJP.js +2 -0
- package/modern/locales/koKR.js +2 -0
- package/modern/locales/kzKZ.js +2 -0
- package/modern/locales/nbNO.js +2 -0
- package/modern/locales/nlNL.js +2 -0
- package/modern/locales/plPL.js +2 -0
- package/modern/locales/ptBR.js +2 -0
- package/modern/locales/roRO.js +1 -0
- package/modern/locales/ruRU.js +2 -0
- package/modern/locales/skSK.js +2 -0
- package/modern/locales/svSE.js +2 -0
- package/modern/locales/trTR.js +2 -0
- package/modern/locales/ukUA.js +2 -0
- package/modern/locales/urPK.js +2 -0
- package/modern/locales/viVN.js +2 -0
- package/modern/locales/zhCN.js +2 -0
- package/modern/locales/zhHK.js +2 -0
- package/node/DateCalendar/DateCalendar.js +6 -2
- package/node/DateCalendar/DayCalendar.js +24 -10
- package/node/DateCalendar/dayCalendarClasses.js +1 -1
- package/node/DateField/DateField.js +32 -4
- package/node/DatePicker/DatePicker.js +6 -2
- package/node/DateTimeField/DateTimeField.js +32 -4
- package/node/DateTimePicker/DateTimePicker.js +6 -2
- package/node/DateTimePicker/DateTimePickerToolbar.js +1 -0
- package/node/DesktopDatePicker/DesktopDatePicker.js +6 -2
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -2
- package/node/MobileDatePicker/MobileDatePicker.js +6 -2
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +6 -2
- package/node/StaticDatePicker/StaticDatePicker.js +6 -2
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +6 -2
- package/node/TimeField/TimeField.js +29 -4
- package/node/TimePicker/TimePickerToolbar.js +1 -0
- package/node/hooks/index.js +12 -0
- package/node/hooks/useClearableField.js +87 -0
- package/node/icons/index.js +10 -2
- package/node/index.js +13 -1
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
- package/node/internals/hooks/useField/useField.js +23 -6
- package/node/internals/hooks/useField/useField.utils.js +8 -3
- package/node/internals/utils/date-utils.js +7 -2
- package/node/locales/beBY.js +2 -0
- package/node/locales/caES.js +2 -0
- package/node/locales/csCZ.js +2 -0
- package/node/locales/daDK.js +2 -0
- package/node/locales/deDE.js +2 -0
- package/node/locales/elGR.js +2 -0
- package/node/locales/enUS.js +1 -0
- package/node/locales/esES.js +2 -0
- package/node/locales/faIR.js +2 -0
- package/node/locales/fiFI.js +11 -11
- package/node/locales/frFR.js +2 -0
- package/node/locales/heIL.js +2 -0
- package/node/locales/huHU.js +1 -0
- package/node/locales/isIS.js +2 -0
- package/node/locales/itIT.js +2 -0
- package/node/locales/jaJP.js +2 -0
- package/node/locales/koKR.js +2 -0
- package/node/locales/kzKZ.js +2 -0
- package/node/locales/nbNO.js +2 -0
- package/node/locales/nlNL.js +2 -0
- package/node/locales/plPL.js +2 -0
- package/node/locales/ptBR.js +2 -0
- package/node/locales/roRO.js +1 -0
- package/node/locales/ruRU.js +2 -0
- package/node/locales/skSK.js +2 -0
- package/node/locales/svSE.js +2 -0
- package/node/locales/trTR.js +2 -0
- package/node/locales/ukUA.js +2 -0
- package/node/locales/urPK.js +2 -0
- package/node/locales/viVN.js +2 -0
- package/node/locales/zhCN.js +2 -0
- package/node/locales/zhHK.js +2 -0
- package/package.json +1 -1
- package/legacy/tests/describe.types.js +0 -1
- package/legacy/tests/describeAdapters/describeAdapters.js +0 -29
- package/legacy/tests/describeAdapters/index.js +0 -1
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +0 -32
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +0 -1
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +0 -2
- package/legacy/tests/describeGregorianAdapter/index.js +0 -2
- package/legacy/tests/describeGregorianAdapter/testCalculations.js +0 -707
- package/legacy/tests/describeGregorianAdapter/testFormat.js +0 -26
- package/legacy/tests/describeGregorianAdapter/testLocalization.js +0 -49
- package/legacy/tests/describeHijriAdapter/describeHijriAdapter.js +0 -21
- package/legacy/tests/describeHijriAdapter/describeHijriAdapter.types.js +0 -1
- package/legacy/tests/describeHijriAdapter/index.js +0 -1
- package/legacy/tests/describeHijriAdapter/testCalculations.js +0 -167
- package/legacy/tests/describeHijriAdapter/testLocalization.js +0 -20
- package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.js +0 -21
- package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +0 -1
- package/legacy/tests/describeJalaliAdapter/index.js +0 -1
- package/legacy/tests/describeJalaliAdapter/testCalculations.js +0 -236
- package/legacy/tests/describeJalaliAdapter/testLocalization.js +0 -20
- package/legacy/tests/describePicker/describePicker.js +0 -159
- package/legacy/tests/describePicker/describePicker.types.js +0 -1
- package/legacy/tests/describePicker/index.js +0 -1
- package/legacy/tests/describeValidation/describeValidation.js +0 -31
- package/legacy/tests/describeValidation/describeValidation.types.js +0 -1
- package/legacy/tests/describeValidation/index.js +0 -1
- package/legacy/tests/describeValidation/testDayViewValidation.js +0 -281
- package/legacy/tests/describeValidation/testMinutesViewValidation.js +0 -194
- package/legacy/tests/describeValidation/testMonthViewValidation.js +0 -136
- package/legacy/tests/describeValidation/testTextFieldValidation.js +0 -463
- package/legacy/tests/describeValidation/testYearViewValidation.js +0 -95
- package/legacy/tests/describeValue/describeValue.js +0 -57
- package/legacy/tests/describeValue/describeValue.types.js +0 -1
- package/legacy/tests/describeValue/index.js +0 -1
- package/legacy/tests/describeValue/testControlledUnControlled.js +0 -237
- package/legacy/tests/describeValue/testPickerActionBar.js +0 -250
- package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -362
- package/legacy/tests/describeValue/testShortcuts.js +0 -119
- package/modern/tests/describe.types.js +0 -1
- package/modern/tests/describeAdapters/describeAdapters.js +0 -29
- package/modern/tests/describeAdapters/index.js +0 -1
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +0 -29
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +0 -1
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +0 -2
- package/modern/tests/describeGregorianAdapter/index.js +0 -2
- package/modern/tests/describeGregorianAdapter/testCalculations.js +0 -706
- package/modern/tests/describeGregorianAdapter/testFormat.js +0 -27
- package/modern/tests/describeGregorianAdapter/testLocalization.js +0 -50
- package/modern/tests/describeHijriAdapter/describeHijriAdapter.js +0 -21
- package/modern/tests/describeHijriAdapter/describeHijriAdapter.types.js +0 -1
- package/modern/tests/describeHijriAdapter/index.js +0 -1
- package/modern/tests/describeHijriAdapter/testCalculations.js +0 -164
- package/modern/tests/describeHijriAdapter/testLocalization.js +0 -21
- package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.js +0 -21
- package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +0 -1
- package/modern/tests/describeJalaliAdapter/index.js +0 -1
- package/modern/tests/describeJalaliAdapter/testCalculations.js +0 -237
- package/modern/tests/describeJalaliAdapter/testLocalization.js +0 -21
- package/modern/tests/describePicker/describePicker.js +0 -162
- package/modern/tests/describePicker/describePicker.types.js +0 -1
- package/modern/tests/describePicker/index.js +0 -1
- package/modern/tests/describeValidation/describeValidation.js +0 -31
- package/modern/tests/describeValidation/describeValidation.types.js +0 -1
- package/modern/tests/describeValidation/index.js +0 -1
- package/modern/tests/describeValidation/testDayViewValidation.js +0 -280
- package/modern/tests/describeValidation/testMinutesViewValidation.js +0 -193
- package/modern/tests/describeValidation/testMonthViewValidation.js +0 -137
- package/modern/tests/describeValidation/testTextFieldValidation.js +0 -470
- package/modern/tests/describeValidation/testYearViewValidation.js +0 -94
- package/modern/tests/describeValue/describeValue.js +0 -59
- package/modern/tests/describeValue/describeValue.types.js +0 -1
- package/modern/tests/describeValue/index.js +0 -1
- package/modern/tests/describeValue/testControlledUnControlled.js +0 -239
- package/modern/tests/describeValue/testPickerActionBar.js +0 -254
- package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -371
- package/modern/tests/describeValue/testShortcuts.js +0 -112
- package/node/tests/describe.types.js +0 -5
- package/node/tests/describeAdapters/describeAdapters.js +0 -37
- package/node/tests/describeAdapters/index.js +0 -12
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +0 -37
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +0 -5
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +0 -10
- package/node/tests/describeGregorianAdapter/index.js +0 -19
- package/node/tests/describeGregorianAdapter/testCalculations.js +0 -711
- package/node/tests/describeGregorianAdapter/testFormat.js +0 -34
- package/node/tests/describeGregorianAdapter/testLocalization.js +0 -57
- package/node/tests/describeHijriAdapter/describeHijriAdapter.js +0 -29
- package/node/tests/describeHijriAdapter/describeHijriAdapter.types.js +0 -5
- package/node/tests/describeHijriAdapter/index.js +0 -12
- package/node/tests/describeHijriAdapter/testCalculations.js +0 -171
- package/node/tests/describeHijriAdapter/testLocalization.js +0 -28
- package/node/tests/describeJalaliAdapter/describeJalaliAdapter.js +0 -29
- package/node/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +0 -5
- package/node/tests/describeJalaliAdapter/index.js +0 -12
- package/node/tests/describeJalaliAdapter/testCalculations.js +0 -244
- package/node/tests/describeJalaliAdapter/testLocalization.js +0 -28
- package/node/tests/describePicker/describePicker.js +0 -173
- package/node/tests/describePicker/describePicker.types.js +0 -5
- package/node/tests/describePicker/index.js +0 -12
- package/node/tests/describeValidation/describeValidation.js +0 -39
- package/node/tests/describeValidation/describeValidation.types.js +0 -5
- package/node/tests/describeValidation/index.js +0 -12
- package/node/tests/describeValidation/testDayViewValidation.js +0 -290
- package/node/tests/describeValidation/testMinutesViewValidation.js +0 -203
- package/node/tests/describeValidation/testMonthViewValidation.js +0 -147
- package/node/tests/describeValidation/testTextFieldValidation.js +0 -480
- package/node/tests/describeValidation/testYearViewValidation.js +0 -104
- package/node/tests/describeValue/describeValue.js +0 -69
- package/node/tests/describeValue/describeValue.types.js +0 -5
- package/node/tests/describeValue/index.js +0 -12
- package/node/tests/describeValue/testControlledUnControlled.js +0 -248
- package/node/tests/describeValue/testPickerActionBar.js +0 -264
- package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -381
- package/node/tests/describeValue/testShortcuts.js +0 -122
- package/tests/describe.types.js +0 -1
- package/tests/describeAdapters/describeAdapters.js +0 -29
- package/tests/describeAdapters/index.js +0 -1
- package/tests/describeGregorianAdapter/describeGregorianAdapter.js +0 -30
- package/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +0 -1
- package/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +0 -2
- package/tests/describeGregorianAdapter/index.js +0 -2
- package/tests/describeGregorianAdapter/testCalculations.js +0 -706
- package/tests/describeGregorianAdapter/testFormat.js +0 -27
- package/tests/describeGregorianAdapter/testLocalization.js +0 -50
- package/tests/describeHijriAdapter/describeHijriAdapter.js +0 -21
- package/tests/describeHijriAdapter/describeHijriAdapter.types.js +0 -1
- package/tests/describeHijriAdapter/index.js +0 -1
- package/tests/describeHijriAdapter/testCalculations.js +0 -164
- package/tests/describeHijriAdapter/testLocalization.js +0 -21
- package/tests/describeJalaliAdapter/describeJalaliAdapter.js +0 -21
- package/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +0 -1
- package/tests/describeJalaliAdapter/index.js +0 -1
- package/tests/describeJalaliAdapter/testCalculations.js +0 -237
- package/tests/describeJalaliAdapter/testLocalization.js +0 -21
- package/tests/describePicker/describePicker.js +0 -162
- package/tests/describePicker/describePicker.types.js +0 -1
- package/tests/describePicker/index.js +0 -1
- package/tests/describeValidation/describeValidation.js +0 -31
- package/tests/describeValidation/describeValidation.types.js +0 -1
- package/tests/describeValidation/index.js +0 -1
- package/tests/describeValidation/testDayViewValidation.js +0 -280
- package/tests/describeValidation/testMinutesViewValidation.js +0 -193
- package/tests/describeValidation/testMonthViewValidation.js +0 -137
- package/tests/describeValidation/testTextFieldValidation.js +0 -470
- package/tests/describeValidation/testYearViewValidation.js +0 -94
- package/tests/describeValue/describeValue.js +0 -59
- package/tests/describeValue/describeValue.types.js +0 -1
- package/tests/describeValue/index.js +0 -1
- package/tests/describeValue/testControlledUnControlled.js +0 -239
- package/tests/describeValue/testPickerActionBar.js +0 -254
- package/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -371
- package/tests/describeValue/testShortcuts.js +0 -112
|
@@ -14,7 +14,7 @@ import { useUtils, useNow, useLocaleText } from '../internals/hooks/useUtils';
|
|
|
14
14
|
import { DAY_SIZE, DAY_MARGIN } from '../internals/constants/dimensions';
|
|
15
15
|
import { PickersSlideTransition } from './PickersSlideTransition';
|
|
16
16
|
import { useIsDateDisabled } from './useIsDateDisabled';
|
|
17
|
-
import { findClosestEnabledDate } from '../internals/utils/date-utils';
|
|
17
|
+
import { findClosestEnabledDate, getWeekdays } from '../internals/utils/date-utils';
|
|
18
18
|
import { getDayCalendarUtilityClass } from './dayCalendarClasses';
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -23,6 +23,7 @@ const useUtilityClasses = ownerState => {
|
|
|
23
23
|
classes
|
|
24
24
|
} = ownerState;
|
|
25
25
|
const slots = {
|
|
26
|
+
root: ['root'],
|
|
26
27
|
header: ['header'],
|
|
27
28
|
weekDayLabel: ['weekDayLabel'],
|
|
28
29
|
loadingContainer: ['loadingContainer'],
|
|
@@ -34,8 +35,12 @@ const useUtilityClasses = ownerState => {
|
|
|
34
35
|
};
|
|
35
36
|
return composeClasses(slots, getDayCalendarUtilityClass, classes);
|
|
36
37
|
};
|
|
37
|
-
const defaultDayOfWeekFormatter = day => day.charAt(0).toUpperCase();
|
|
38
38
|
const weeksContainerHeight = (DAY_SIZE + DAY_MARGIN * 2) * 6;
|
|
39
|
+
const PickersCalendarDayRoot = styled('div', {
|
|
40
|
+
name: 'MuiDayCalendar',
|
|
41
|
+
slot: 'Root',
|
|
42
|
+
overridesResolver: (_, styles) => styles.root
|
|
43
|
+
})({});
|
|
39
44
|
const PickersCalendarDayHeader = styled('div', {
|
|
40
45
|
name: 'MuiDayCalendar',
|
|
41
46
|
slot: 'Header',
|
|
@@ -235,7 +240,7 @@ export function DayCalendar(inProps) {
|
|
|
235
240
|
shouldDisableDate,
|
|
236
241
|
shouldDisableMonth,
|
|
237
242
|
shouldDisableYear,
|
|
238
|
-
dayOfWeekFormatter
|
|
243
|
+
dayOfWeekFormatter: dayOfWeekFormatterFromProps,
|
|
239
244
|
hasFocus,
|
|
240
245
|
onFocusedViewChange,
|
|
241
246
|
gridLabelId,
|
|
@@ -249,6 +254,9 @@ export function DayCalendar(inProps) {
|
|
|
249
254
|
const classes = useUtilityClasses(props);
|
|
250
255
|
const theme = useTheme();
|
|
251
256
|
const isRTL = theme.direction === 'rtl';
|
|
257
|
+
|
|
258
|
+
// before we could define this outside of the component scope, but now we need utils, which is only defined here
|
|
259
|
+
const dayOfWeekFormatter = dayOfWeekFormatterFromProps || ((_day, date) => utils.format(date, 'weekdayShort').charAt(0).toUpperCase());
|
|
252
260
|
const isDateDisabled = useIsDateDisabled({
|
|
253
261
|
shouldDisableDate,
|
|
254
262
|
shouldDisableMonth,
|
|
@@ -390,9 +398,10 @@ export function DayCalendar(inProps) {
|
|
|
390
398
|
}
|
|
391
399
|
return toDisplay;
|
|
392
400
|
}, [currentMonth, fixedWeekNumber, utils, timezone]);
|
|
393
|
-
return /*#__PURE__*/_jsxs(
|
|
401
|
+
return /*#__PURE__*/_jsxs(PickersCalendarDayRoot, {
|
|
394
402
|
role: "grid",
|
|
395
403
|
"aria-labelledby": gridLabelId,
|
|
404
|
+
className: classes.root,
|
|
396
405
|
children: [/*#__PURE__*/_jsxs(PickersCalendarDayHeader, {
|
|
397
406
|
role: "row",
|
|
398
407
|
className: classes.header,
|
|
@@ -402,13 +411,18 @@ export function DayCalendar(inProps) {
|
|
|
402
411
|
"aria-label": localeText.calendarWeekNumberHeaderLabel,
|
|
403
412
|
className: classes.weekNumberLabel,
|
|
404
413
|
children: localeText.calendarWeekNumberHeaderText
|
|
405
|
-
}),
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
414
|
+
}), getWeekdays(utils, now).map((weekday, i) => {
|
|
415
|
+
// regression-prevention:
|
|
416
|
+
// since 'weekdayShort' now always returns an abbreviated form we slice the first 2 letters from it.
|
|
417
|
+
const day = utils.format(weekday, 'weekdayShort').slice(0, 2);
|
|
418
|
+
return /*#__PURE__*/_jsx(PickersCalendarWeekDayLabel, {
|
|
419
|
+
variant: "caption",
|
|
420
|
+
role: "columnheader",
|
|
421
|
+
"aria-label": utils.format(utils.addDays(startOfCurrentWeek, i), 'weekday'),
|
|
422
|
+
className: classes.weekDayLabel,
|
|
423
|
+
children: dayOfWeekFormatter?.(day, weekday) ?? day
|
|
424
|
+
}, day + i.toString());
|
|
425
|
+
})]
|
|
412
426
|
}), loading ? /*#__PURE__*/_jsx(PickersCalendarLoadingContainer, {
|
|
413
427
|
className: classes.loadingContainer,
|
|
414
428
|
children: renderLoading()
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
2
|
export const getDayCalendarUtilityClass = slot => generateUtilityClass('MuiDayCalendar', slot);
|
|
3
|
-
export const dayPickerClasses = generateUtilityClasses('MuiDayCalendar', ['header', 'weekDayLabel', 'loadingContainer', 'slideTransition', 'monthContainer', 'weekContainer', 'weekNumberLabel', 'weekNumber']);
|
|
3
|
+
export const dayPickerClasses = generateUtilityClasses('MuiDayCalendar', ['root', 'header', 'weekDayLabel', 'loadingContainer', 'slideTransition', 'monthContainer', 'weekContainer', 'weekNumberLabel', 'weekNumber']);
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["components", "componentsProps", "slots", "slotProps", "InputProps", "inputProps"],
|
|
4
4
|
_excluded2 = ["inputRef"],
|
|
5
|
-
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
|
|
5
|
+
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import MuiTextField from '@mui/material/TextField';
|
|
@@ -10,6 +10,7 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
10
10
|
import { useSlotProps } from '@mui/base/utils';
|
|
11
11
|
import { refType } from '@mui/utils';
|
|
12
12
|
import { useDateField } from './useDateField';
|
|
13
|
+
import { useClearableField } from '../hooks';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, ref) {
|
|
15
16
|
const themeProps = useThemeProps({
|
|
@@ -50,13 +51,28 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, ref)
|
|
|
50
51
|
onPaste,
|
|
51
52
|
onKeyDown,
|
|
52
53
|
inputMode,
|
|
53
|
-
readOnly
|
|
54
|
+
readOnly,
|
|
55
|
+
clearable,
|
|
56
|
+
onClear
|
|
54
57
|
} = _useDateField,
|
|
55
58
|
fieldProps = _objectWithoutPropertiesLoose(_useDateField, _excluded3);
|
|
59
|
+
const {
|
|
60
|
+
InputProps: ProcessedInputProps,
|
|
61
|
+
fieldProps: processedFieldProps
|
|
62
|
+
} = useClearableField({
|
|
63
|
+
onClear,
|
|
64
|
+
clearable,
|
|
65
|
+
fieldProps,
|
|
66
|
+
InputProps: fieldProps.InputProps,
|
|
67
|
+
slots,
|
|
68
|
+
slotProps,
|
|
69
|
+
components,
|
|
70
|
+
componentsProps
|
|
71
|
+
});
|
|
56
72
|
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
57
73
|
ref: ref
|
|
58
|
-
},
|
|
59
|
-
InputProps: _extends({},
|
|
74
|
+
}, processedFieldProps, {
|
|
75
|
+
InputProps: _extends({}, ProcessedInputProps, {
|
|
60
76
|
readOnly
|
|
61
77
|
}),
|
|
62
78
|
inputProps: _extends({}, fieldProps.inputProps, {
|
|
@@ -78,6 +94,11 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
78
94
|
*/
|
|
79
95
|
autoFocus: PropTypes.bool,
|
|
80
96
|
className: PropTypes.string,
|
|
97
|
+
/**
|
|
98
|
+
* If `true`, a clear button will be shown in the field allowing value clearing.
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
clearable: PropTypes.bool,
|
|
81
102
|
/**
|
|
82
103
|
* The color of the component.
|
|
83
104
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -206,6 +227,10 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
206
227
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
207
228
|
*/
|
|
208
229
|
onChange: PropTypes.func,
|
|
230
|
+
/**
|
|
231
|
+
* Callback fired when the clear button is clicked.
|
|
232
|
+
*/
|
|
233
|
+
onClear: PropTypes.func,
|
|
209
234
|
/**
|
|
210
235
|
* Callback fired when the error associated to the current value changes.
|
|
211
236
|
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
@@ -252,6 +277,9 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
252
277
|
})]),
|
|
253
278
|
/**
|
|
254
279
|
* Disable specific date.
|
|
280
|
+
*
|
|
281
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
282
|
+
*
|
|
255
283
|
* @template TDate
|
|
256
284
|
* @param {TDate} day The date to test.
|
|
257
285
|
* @returns {boolean} If `true` the date will be disabled.
|
|
@@ -68,9 +68,10 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
68
68
|
componentsProps: PropTypes.object,
|
|
69
69
|
/**
|
|
70
70
|
* Formats the day of week displayed in the calendar header.
|
|
71
|
-
* @param {string} day The day of week provided by the adapter
|
|
71
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
72
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
72
73
|
* @returns {string} The name to display.
|
|
73
|
-
* @default (
|
|
74
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
74
75
|
*/
|
|
75
76
|
dayOfWeekFormatter: PropTypes.func,
|
|
76
77
|
/**
|
|
@@ -270,6 +271,9 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
270
271
|
})]),
|
|
271
272
|
/**
|
|
272
273
|
* Disable specific date.
|
|
274
|
+
*
|
|
275
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
276
|
+
*
|
|
273
277
|
* @template TDate
|
|
274
278
|
* @param {TDate} day The date to test.
|
|
275
279
|
* @returns {boolean} If `true` the date will be disabled.
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["components", "componentsProps", "slots", "slotProps", "InputProps", "inputProps"],
|
|
4
4
|
_excluded2 = ["inputRef"],
|
|
5
|
-
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
|
|
5
|
+
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import MuiTextField from '@mui/material/TextField';
|
|
@@ -10,6 +10,7 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
10
10
|
import { useSlotProps } from '@mui/base/utils';
|
|
11
11
|
import { refType } from '@mui/utils';
|
|
12
12
|
import { useDateTimeField } from './useDateTimeField';
|
|
13
|
+
import { useClearableField } from '../hooks';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inProps, ref) {
|
|
15
16
|
const themeProps = useThemeProps({
|
|
@@ -50,13 +51,28 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
|
|
|
50
51
|
onPaste,
|
|
51
52
|
onKeyDown,
|
|
52
53
|
inputMode,
|
|
53
|
-
readOnly
|
|
54
|
+
readOnly,
|
|
55
|
+
clearable,
|
|
56
|
+
onClear
|
|
54
57
|
} = _useDateTimeField,
|
|
55
58
|
fieldProps = _objectWithoutPropertiesLoose(_useDateTimeField, _excluded3);
|
|
59
|
+
const {
|
|
60
|
+
InputProps: ProcessedInputProps,
|
|
61
|
+
fieldProps: processedFieldProps
|
|
62
|
+
} = useClearableField({
|
|
63
|
+
onClear,
|
|
64
|
+
clearable,
|
|
65
|
+
fieldProps,
|
|
66
|
+
InputProps: fieldProps.InputProps,
|
|
67
|
+
slots,
|
|
68
|
+
slotProps,
|
|
69
|
+
components,
|
|
70
|
+
componentsProps
|
|
71
|
+
});
|
|
56
72
|
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
57
73
|
ref: ref
|
|
58
|
-
},
|
|
59
|
-
InputProps: _extends({},
|
|
74
|
+
}, processedFieldProps, {
|
|
75
|
+
InputProps: _extends({}, ProcessedInputProps, {
|
|
60
76
|
readOnly
|
|
61
77
|
}),
|
|
62
78
|
inputProps: _extends({}, fieldProps.inputProps, {
|
|
@@ -83,6 +99,11 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
83
99
|
*/
|
|
84
100
|
autoFocus: PropTypes.bool,
|
|
85
101
|
className: PropTypes.string,
|
|
102
|
+
/**
|
|
103
|
+
* If `true`, a clear button will be shown in the field allowing value clearing.
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
clearable: PropTypes.bool,
|
|
86
107
|
/**
|
|
87
108
|
* The color of the component.
|
|
88
109
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -239,6 +260,10 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
239
260
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
240
261
|
*/
|
|
241
262
|
onChange: PropTypes.func,
|
|
263
|
+
/**
|
|
264
|
+
* Callback fired when the clear button is clicked.
|
|
265
|
+
*/
|
|
266
|
+
onClear: PropTypes.func,
|
|
242
267
|
/**
|
|
243
268
|
* Callback fired when the error associated to the current value changes.
|
|
244
269
|
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
@@ -293,6 +318,9 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
293
318
|
shouldDisableClock: PropTypes.func,
|
|
294
319
|
/**
|
|
295
320
|
* Disable specific date.
|
|
321
|
+
*
|
|
322
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
323
|
+
*
|
|
296
324
|
* @template TDate
|
|
297
325
|
* @param {TDate} day The date to test.
|
|
298
326
|
* @returns {boolean} If `true` the date will be disabled.
|
|
@@ -78,9 +78,10 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
78
78
|
componentsProps: PropTypes.object,
|
|
79
79
|
/**
|
|
80
80
|
* Formats the day of week displayed in the calendar header.
|
|
81
|
-
* @param {string} day The day of week provided by the adapter
|
|
81
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
82
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
82
83
|
* @returns {string} The name to display.
|
|
83
|
-
* @default (
|
|
84
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
84
85
|
*/
|
|
85
86
|
dayOfWeekFormatter: PropTypes.func,
|
|
86
87
|
/**
|
|
@@ -316,6 +317,9 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
316
317
|
shouldDisableClock: PropTypes.func,
|
|
317
318
|
/**
|
|
318
319
|
* Disable specific date.
|
|
320
|
+
*
|
|
321
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
322
|
+
*
|
|
319
323
|
* @template TDate
|
|
320
324
|
* @param {TDate} day The date to test.
|
|
321
325
|
* @returns {boolean} If `true` the date will be disabled.
|
|
@@ -316,6 +316,7 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
|
|
|
316
316
|
*/
|
|
317
317
|
onViewChange: PropTypes.func.isRequired,
|
|
318
318
|
readOnly: PropTypes.bool,
|
|
319
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
319
320
|
titleId: PropTypes.string,
|
|
320
321
|
/**
|
|
321
322
|
* Toolbar date format.
|
|
@@ -88,9 +88,10 @@ DesktopDatePicker.propTypes = {
|
|
|
88
88
|
componentsProps: PropTypes.object,
|
|
89
89
|
/**
|
|
90
90
|
* Formats the day of week displayed in the calendar header.
|
|
91
|
-
* @param {string} day The day of week provided by the adapter
|
|
91
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
92
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
92
93
|
* @returns {string} The name to display.
|
|
93
|
-
* @default (
|
|
94
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
94
95
|
*/
|
|
95
96
|
dayOfWeekFormatter: PropTypes.func,
|
|
96
97
|
/**
|
|
@@ -284,6 +285,9 @@ DesktopDatePicker.propTypes = {
|
|
|
284
285
|
})]),
|
|
285
286
|
/**
|
|
286
287
|
* Disable specific date.
|
|
288
|
+
*
|
|
289
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
290
|
+
*
|
|
287
291
|
* @template TDate
|
|
288
292
|
* @param {TDate} day The date to test.
|
|
289
293
|
* @returns {boolean} If `true` the date will be disabled.
|
|
@@ -134,9 +134,10 @@ DesktopDateTimePicker.propTypes = {
|
|
|
134
134
|
componentsProps: PropTypes.object,
|
|
135
135
|
/**
|
|
136
136
|
* Formats the day of week displayed in the calendar header.
|
|
137
|
-
* @param {string} day The day of week provided by the adapter
|
|
137
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
138
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
138
139
|
* @returns {string} The name to display.
|
|
139
|
-
* @default (
|
|
140
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
140
141
|
*/
|
|
141
142
|
dayOfWeekFormatter: PropTypes.func,
|
|
142
143
|
/**
|
|
@@ -366,6 +367,9 @@ DesktopDateTimePicker.propTypes = {
|
|
|
366
367
|
shouldDisableClock: PropTypes.func,
|
|
367
368
|
/**
|
|
368
369
|
* Disable specific date.
|
|
370
|
+
*
|
|
371
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
372
|
+
*
|
|
369
373
|
* @template TDate
|
|
370
374
|
* @param {TDate} day The date to test.
|
|
371
375
|
* @returns {boolean} If `true` the date will be disabled.
|
|
@@ -85,9 +85,10 @@ MobileDatePicker.propTypes = {
|
|
|
85
85
|
componentsProps: PropTypes.object,
|
|
86
86
|
/**
|
|
87
87
|
* Formats the day of week displayed in the calendar header.
|
|
88
|
-
* @param {string} day The day of week provided by the adapter
|
|
88
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
89
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
89
90
|
* @returns {string} The name to display.
|
|
90
|
-
* @default (
|
|
91
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
91
92
|
*/
|
|
92
93
|
dayOfWeekFormatter: PropTypes.func,
|
|
93
94
|
/**
|
|
@@ -281,6 +282,9 @@ MobileDatePicker.propTypes = {
|
|
|
281
282
|
})]),
|
|
282
283
|
/**
|
|
283
284
|
* Disable specific date.
|
|
285
|
+
*
|
|
286
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
287
|
+
*
|
|
284
288
|
* @template TDate
|
|
285
289
|
* @param {TDate} day The date to test.
|
|
286
290
|
* @returns {boolean} If `true` the date will be disabled.
|
|
@@ -106,9 +106,10 @@ MobileDateTimePicker.propTypes = {
|
|
|
106
106
|
componentsProps: PropTypes.object,
|
|
107
107
|
/**
|
|
108
108
|
* Formats the day of week displayed in the calendar header.
|
|
109
|
-
* @param {string} day The day of week provided by the adapter
|
|
109
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
110
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
110
111
|
* @returns {string} The name to display.
|
|
111
|
-
* @default (
|
|
112
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
112
113
|
*/
|
|
113
114
|
dayOfWeekFormatter: PropTypes.func,
|
|
114
115
|
/**
|
|
@@ -338,6 +339,9 @@ MobileDateTimePicker.propTypes = {
|
|
|
338
339
|
shouldDisableClock: PropTypes.func,
|
|
339
340
|
/**
|
|
340
341
|
* Disable specific date.
|
|
342
|
+
*
|
|
343
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
344
|
+
*
|
|
341
345
|
* @template TDate
|
|
342
346
|
* @param {TDate} day The date to test.
|
|
343
347
|
* @returns {boolean} If `true` the date will be disabled.
|
|
@@ -67,9 +67,10 @@ StaticDatePicker.propTypes = {
|
|
|
67
67
|
componentsProps: PropTypes.object,
|
|
68
68
|
/**
|
|
69
69
|
* Formats the day of week displayed in the calendar header.
|
|
70
|
-
* @param {string} day The day of week provided by the adapter
|
|
70
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
71
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
71
72
|
* @returns {string} The name to display.
|
|
72
|
-
* @default (
|
|
73
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
73
74
|
*/
|
|
74
75
|
dayOfWeekFormatter: PropTypes.func,
|
|
75
76
|
/**
|
|
@@ -217,6 +218,9 @@ StaticDatePicker.propTypes = {
|
|
|
217
218
|
renderLoading: PropTypes.func,
|
|
218
219
|
/**
|
|
219
220
|
* Disable specific date.
|
|
221
|
+
*
|
|
222
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
223
|
+
*
|
|
220
224
|
* @template TDate
|
|
221
225
|
* @param {TDate} day The date to test.
|
|
222
226
|
* @returns {boolean} If `true` the date will be disabled.
|
|
@@ -87,9 +87,10 @@ StaticDateTimePicker.propTypes = {
|
|
|
87
87
|
componentsProps: PropTypes.object,
|
|
88
88
|
/**
|
|
89
89
|
* Formats the day of week displayed in the calendar header.
|
|
90
|
-
* @param {string} day The day of week provided by the adapter
|
|
90
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
91
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
91
92
|
* @returns {string} The name to display.
|
|
92
|
-
* @default (
|
|
93
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
93
94
|
*/
|
|
94
95
|
dayOfWeekFormatter: PropTypes.func,
|
|
95
96
|
/**
|
|
@@ -273,6 +274,9 @@ StaticDateTimePicker.propTypes = {
|
|
|
273
274
|
shouldDisableClock: PropTypes.func,
|
|
274
275
|
/**
|
|
275
276
|
* Disable specific date.
|
|
277
|
+
*
|
|
278
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
279
|
+
*
|
|
276
280
|
* @template TDate
|
|
277
281
|
* @param {TDate} day The date to test.
|
|
278
282
|
* @returns {boolean} If `true` the date will be disabled.
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
|
|
4
4
|
_excluded2 = ["inputRef"],
|
|
5
|
-
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
|
|
5
|
+
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import MuiTextField from '@mui/material/TextField';
|
|
@@ -10,6 +10,7 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
10
10
|
import { useSlotProps } from '@mui/base/utils';
|
|
11
11
|
import { refType } from '@mui/utils';
|
|
12
12
|
import { useTimeField } from './useTimeField';
|
|
13
|
+
import { useClearableField } from '../hooks';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, ref) {
|
|
15
16
|
const themeProps = useThemeProps({
|
|
@@ -50,13 +51,28 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, ref)
|
|
|
50
51
|
onPaste,
|
|
51
52
|
onKeyDown,
|
|
52
53
|
inputMode,
|
|
53
|
-
readOnly
|
|
54
|
+
readOnly,
|
|
55
|
+
clearable,
|
|
56
|
+
onClear
|
|
54
57
|
} = _useTimeField,
|
|
55
58
|
fieldProps = _objectWithoutPropertiesLoose(_useTimeField, _excluded3);
|
|
59
|
+
const {
|
|
60
|
+
InputProps: ProcessedInputProps,
|
|
61
|
+
fieldProps: processedFieldProps
|
|
62
|
+
} = useClearableField({
|
|
63
|
+
onClear,
|
|
64
|
+
clearable,
|
|
65
|
+
fieldProps,
|
|
66
|
+
InputProps: fieldProps.InputProps,
|
|
67
|
+
slots,
|
|
68
|
+
slotProps,
|
|
69
|
+
components,
|
|
70
|
+
componentsProps
|
|
71
|
+
});
|
|
56
72
|
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
57
73
|
ref: ref
|
|
58
|
-
},
|
|
59
|
-
InputProps: _extends({},
|
|
74
|
+
}, processedFieldProps, {
|
|
75
|
+
InputProps: _extends({}, ProcessedInputProps, {
|
|
60
76
|
readOnly
|
|
61
77
|
}),
|
|
62
78
|
inputProps: _extends({}, fieldProps.inputProps, {
|
|
@@ -83,6 +99,11 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
83
99
|
*/
|
|
84
100
|
autoFocus: PropTypes.bool,
|
|
85
101
|
className: PropTypes.string,
|
|
102
|
+
/**
|
|
103
|
+
* If `true`, a clear button will be shown in the field allowing value clearing.
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
clearable: PropTypes.bool,
|
|
86
107
|
/**
|
|
87
108
|
* The color of the component.
|
|
88
109
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -223,6 +244,10 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
223
244
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
224
245
|
*/
|
|
225
246
|
onChange: PropTypes.func,
|
|
247
|
+
/**
|
|
248
|
+
* Callback fired when the clear button is clicked.
|
|
249
|
+
*/
|
|
250
|
+
onClear: PropTypes.func,
|
|
226
251
|
/**
|
|
227
252
|
* Callback fired when the error associated to the current value changes.
|
|
228
253
|
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
@@ -222,6 +222,7 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
|
|
222
222
|
*/
|
|
223
223
|
onViewChange: PropTypes.func.isRequired,
|
|
224
224
|
readOnly: PropTypes.bool,
|
|
225
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
225
226
|
titleId: PropTypes.string,
|
|
226
227
|
/**
|
|
227
228
|
* Toolbar date format.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useClearableField } from './useClearableField';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["ownerState"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
6
|
+
import MuiIconButton from '@mui/material/IconButton';
|
|
7
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
8
|
+
import { ClearIcon } from '../icons';
|
|
9
|
+
import { useLocaleText } from '../internals';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
export const useClearableField = ({
|
|
13
|
+
clearable,
|
|
14
|
+
fieldProps: forwardedFieldProps,
|
|
15
|
+
InputProps: ForwardedInputProps,
|
|
16
|
+
onClear,
|
|
17
|
+
slots,
|
|
18
|
+
slotProps,
|
|
19
|
+
components,
|
|
20
|
+
componentsProps
|
|
21
|
+
}) => {
|
|
22
|
+
const localeText = useLocaleText();
|
|
23
|
+
const IconButton = slots?.clearButton ?? components?.ClearButton ?? MuiIconButton;
|
|
24
|
+
// The spread is here to avoid this bug mui/material-ui#34056
|
|
25
|
+
const _useSlotProps = useSlotProps({
|
|
26
|
+
elementType: IconButton,
|
|
27
|
+
externalSlotProps: slotProps?.clearButton ?? componentsProps?.clearButton,
|
|
28
|
+
ownerState: {},
|
|
29
|
+
className: 'clearButton',
|
|
30
|
+
additionalProps: {
|
|
31
|
+
title: localeText.fieldClearLabel
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
iconButtonProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded);
|
|
35
|
+
const EndClearIcon = slots?.clearIcon ?? components?.ClearIcon ?? ClearIcon;
|
|
36
|
+
const endClearIconProps = useSlotProps({
|
|
37
|
+
elementType: EndClearIcon,
|
|
38
|
+
externalSlotProps: slotProps?.clearIcon ?? componentsProps?.clearIcon,
|
|
39
|
+
ownerState: {}
|
|
40
|
+
});
|
|
41
|
+
const InputProps = _extends({}, ForwardedInputProps, {
|
|
42
|
+
endAdornment: clearable ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
43
|
+
children: [/*#__PURE__*/_jsx(InputAdornment, {
|
|
44
|
+
position: "end",
|
|
45
|
+
sx: {
|
|
46
|
+
marginRight: ForwardedInputProps?.endAdornment ? -1 : -1.5
|
|
47
|
+
},
|
|
48
|
+
children: /*#__PURE__*/_jsx(IconButton, _extends({}, iconButtonProps, {
|
|
49
|
+
onClick: onClear,
|
|
50
|
+
children: /*#__PURE__*/_jsx(EndClearIcon, _extends({
|
|
51
|
+
fontSize: "small"
|
|
52
|
+
}, endClearIconProps))
|
|
53
|
+
}))
|
|
54
|
+
}), ForwardedInputProps?.endAdornment]
|
|
55
|
+
}) : ForwardedInputProps?.endAdornment
|
|
56
|
+
});
|
|
57
|
+
const fieldProps = _extends({}, forwardedFieldProps, {
|
|
58
|
+
sx: [{
|
|
59
|
+
'& .clearButton': {
|
|
60
|
+
opacity: 1
|
|
61
|
+
},
|
|
62
|
+
'@media (pointer: fine)': {
|
|
63
|
+
'& .clearButton': {
|
|
64
|
+
opacity: 0
|
|
65
|
+
},
|
|
66
|
+
'&:hover, &:focus-within': {
|
|
67
|
+
'.clearButton': {
|
|
68
|
+
opacity: 1
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, ...(Array.isArray(forwardedFieldProps.sx) ? forwardedFieldProps.sx : [forwardedFieldProps.sx])]
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
InputProps,
|
|
76
|
+
fieldProps
|
|
77
|
+
};
|
|
78
|
+
};
|
package/modern/icons/index.js
CHANGED
|
@@ -58,4 +58,11 @@ export const TimeIcon = createSvgIcon( /*#__PURE__*/_jsxs(React.Fragment, {
|
|
|
58
58
|
}), /*#__PURE__*/_jsx("path", {
|
|
59
59
|
d: "M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"
|
|
60
60
|
})]
|
|
61
|
-
}), 'Time');
|
|
61
|
+
}), 'Time');
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @ignore - internal component.
|
|
65
|
+
*/
|
|
66
|
+
export const ClearIcon = createSvgIcon( /*#__PURE__*/_jsx("path", {
|
|
67
|
+
d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
68
|
+
}), 'Clear');
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers v6.
|
|
2
|
+
* @mui/x-date-pickers v6.16.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -48,4 +48,5 @@ export * from './PickersActionBar';
|
|
|
48
48
|
export * from './PickersShortcuts';
|
|
49
49
|
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
50
50
|
export * from './models';
|
|
51
|
-
export * from './icons';
|
|
51
|
+
export * from './icons';
|
|
52
|
+
export * from './hooks';
|
|
@@ -121,7 +121,9 @@ export const useDesktopPicker = _ref => {
|
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
const slotsForField = _extends({
|
|
124
|
-
textField: slots.textField
|
|
124
|
+
textField: slots.textField,
|
|
125
|
+
clearIcon: slots.clearIcon,
|
|
126
|
+
clearButton: slots.clearButton
|
|
125
127
|
}, fieldProps.slots);
|
|
126
128
|
const Layout = slots.layout ?? PickersLayout;
|
|
127
129
|
const handleInputRef = useForkRef(internalInputRef, fieldProps.inputRef, inputRef);
|