@mui/x-date-pickers 8.0.0-alpha.5 → 8.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdapterDateFns/AdapterDateFns.d.ts +2 -4
- package/AdapterDateFns/AdapterDateFns.js +49 -47
- package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +1 -1
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +2 -4
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +48 -46
- package/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.d.ts → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts} +2 -2
- package/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +45 -52
- package/AdapterDateFnsJalaliV2/index.d.ts +1 -0
- package/AdapterDateFnsJalaliV2/index.js +1 -0
- package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/package.json +1 -1
- package/{AdapterDateFnsV3/AdapterDateFnsV3.d.ts → AdapterDateFnsV2/AdapterDateFnsV2.d.ts} +2 -2
- package/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js} +46 -54
- package/AdapterDateFnsV2/index.d.ts +1 -0
- package/AdapterDateFnsV2/index.js +1 -0
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/package.json +1 -1
- package/AdapterDayjs/AdapterDayjs.d.ts +1 -1
- package/AdapterLuxon/AdapterLuxon.d.ts +1 -1
- package/AdapterMoment/AdapterMoment.d.ts +1 -1
- package/CHANGELOG.md +206 -1
- package/DateCalendar/DateCalendar.js +1 -1
- package/DateCalendar/PickersFadeTransitionGroup.d.ts +1 -1
- package/DateCalendar/PickersSlideTransition.d.ts +1 -1
- package/DateField/useDateField.d.ts +1 -1
- package/DateField/useDateField.js +13 -11
- package/DatePicker/DatePicker.js +1 -1
- package/DatePicker/DatePicker.types.d.ts +5 -0
- package/DatePicker/DatePickerToolbar.d.ts +1 -3
- package/DatePicker/DatePickerToolbar.js +10 -25
- package/DatePicker/shared.d.ts +1 -1
- package/DateTimeField/useDateTimeField.d.ts +1 -1
- package/DateTimeField/useDateTimeField.js +13 -11
- package/DateTimePicker/DateTimePicker.js +2 -2
- package/DateTimePicker/DateTimePicker.types.d.ts +2 -2
- package/DateTimePicker/DateTimePickerTabs.d.ts +2 -5
- package/DateTimePicker/DateTimePickerTabs.js +7 -14
- package/DateTimePicker/DateTimePickerToolbar.d.ts +12 -4
- package/DateTimePicker/DateTimePickerToolbar.js +42 -48
- package/DateTimePicker/shared.d.ts +3 -3
- package/DesktopDatePicker/DesktopDatePicker.js +9 -3
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +7 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +2 -2
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +1 -2
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -15
- package/DesktopTimePicker/DesktopTimePicker.js +3 -7
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -2
- package/MobileDatePicker/MobileDatePicker.js +2 -2
- package/MobileDatePicker/MobileDatePicker.types.d.ts +2 -3
- package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +4 -4
- package/MobileTimePicker/MobileTimePicker.js +2 -2
- package/MobileTimePicker/MobileTimePicker.types.d.ts +4 -4
- package/PickersActionBar/PickersActionBar.d.ts +6 -7
- package/PickersActionBar/PickersActionBar.js +18 -16
- package/PickersLayout/PickersLayout.d.ts +2 -2
- package/PickersLayout/PickersLayout.js +1 -15
- package/PickersLayout/PickersLayout.types.d.ts +12 -15
- package/PickersLayout/usePickerLayout.d.ts +2 -2
- package/PickersLayout/usePickerLayout.js +13 -47
- package/PickersShortcuts/PickersShortcuts.d.ts +2 -5
- package/PickersShortcuts/PickersShortcuts.js +13 -10
- package/PickersShortcuts/index.d.ts +1 -1
- package/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
- package/PickersTextField/PickersTextField.js +1 -1
- package/StaticDatePicker/StaticDatePicker.types.d.ts +2 -3
- package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +2 -2
- package/StaticTimePicker/StaticTimePicker.types.d.ts +2 -2
- package/TimeField/useTimeField.d.ts +1 -1
- package/TimeField/useTimeField.js +13 -11
- package/TimePicker/TimePicker.js +2 -2
- package/TimePicker/TimePicker.types.d.ts +2 -2
- package/TimePicker/TimePickerToolbar.d.ts +1 -2
- package/TimePicker/TimePickerToolbar.js +23 -35
- package/TimePicker/shared.d.ts +1 -1
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +3 -1
- package/hooks/useIsValidValue.d.ts +7 -0
- package/hooks/useIsValidValue.js +11 -0
- package/hooks/usePickerActionsContext.d.ts +7 -0
- package/hooks/usePickerActionsContext.js +15 -0
- package/hooks/usePickerContext.d.ts +3 -1
- package/hooks/usePickerContext.js +1 -2
- package/index.d.ts +1 -0
- package/index.js +3 -2
- package/internals/components/PickerProvider.d.ts +14 -8
- package/internals/components/PickerProvider.js +17 -6
- package/internals/components/PickersModalDialog.d.ts +1 -3
- package/internals/components/PickersModalDialog.js +9 -3
- package/internals/components/PickersPopper.d.ts +1 -3
- package/internals/components/PickersPopper.js +11 -6
- package/internals/components/PickersToolbar.d.ts +2 -3
- package/internals/components/PickersToolbar.js +1 -1
- package/internals/hooks/date-helpers-hooks.js +4 -3
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -12
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +7 -7
- package/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/internals/hooks/useField/index.d.ts +1 -1
- package/internals/hooks/useField/index.js +1 -1
- package/internals/hooks/useField/useField.d.ts +10 -1
- package/internals/hooks/useField/useField.js +17 -1
- package/internals/hooks/useField/useField.utils.js +2 -2
- package/internals/hooks/useField/useFieldState.js +2 -2
- package/internals/hooks/useField/useFieldV6TextField.js +2 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.js +9 -10
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -7
- package/internals/hooks/useOpenState.js +3 -2
- package/internals/hooks/usePicker/usePicker.d.ts +1 -1
- package/internals/hooks/usePicker/usePicker.js +0 -8
- package/internals/hooks/usePicker/usePicker.types.d.ts +6 -7
- package/internals/hooks/usePicker/usePickerProvider.d.ts +5 -5
- package/internals/hooks/usePicker/usePickerProvider.js +8 -5
- package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +82 -217
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +82 -67
- package/internals/hooks/usePicker/usePickerViews.d.ts +35 -20
- package/internals/hooks/usePicker/usePickerViews.js +22 -14
- package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +6 -6
- package/internals/hooks/useUtils.js +1 -1
- package/internals/index.d.ts +9 -7
- package/internals/index.js +5 -3
- package/internals/models/index.d.ts +1 -0
- package/internals/models/index.js +2 -1
- package/internals/models/manager.d.ts +12 -0
- package/internals/models/manager.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +2 -2
- package/internals/models/props/tabs.d.ts +0 -13
- package/internals/models/props/toolbar.d.ts +1 -20
- package/internals/utils/date-utils.js +1 -1
- package/internals/utils/valueManagers.js +4 -4
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/nbNO.js +15 -19
- package/locales/utils/getPickersLocalization.js +1 -1
- package/locales/zhTW.d.ts +80 -0
- package/locales/zhTW.js +73 -0
- package/managers/index.d.ts +6 -0
- package/managers/index.js +3 -0
- package/managers/package.json +6 -0
- package/managers/useDateManager.d.ts +27 -0
- package/managers/useDateManager.js +47 -0
- package/managers/useDateTimeManager.d.ts +28 -0
- package/managers/useDateTimeManager.js +52 -0
- package/managers/useTimeManager.d.ts +28 -0
- package/managers/useTimeManager.js +43 -0
- package/models/adapters.d.ts +1 -1
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/models/manager.d.ts +78 -0
- package/models/manager.js +1 -0
- package/models/pickers.d.ts +7 -0
- package/modern/AdapterDateFns/AdapterDateFns.js +49 -47
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +48 -46
- package/modern/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +45 -52
- package/modern/AdapterDateFnsJalaliV2/index.js +1 -0
- package/modern/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js} +46 -54
- package/modern/AdapterDateFnsV2/index.js +1 -0
- package/modern/DateCalendar/DateCalendar.js +1 -1
- package/modern/DateField/useDateField.js +13 -11
- package/modern/DatePicker/DatePicker.js +1 -1
- package/modern/DatePicker/DatePickerToolbar.js +10 -25
- package/modern/DateTimeField/useDateTimeField.js +13 -11
- package/modern/DateTimePicker/DateTimePicker.js +2 -2
- package/modern/DateTimePicker/DateTimePickerTabs.js +7 -14
- package/modern/DateTimePicker/DateTimePickerToolbar.js +42 -48
- package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -3
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -15
- package/modern/DesktopTimePicker/DesktopTimePicker.js +3 -7
- package/modern/MobileDatePicker/MobileDatePicker.js +2 -2
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/modern/MobileTimePicker/MobileTimePicker.js +2 -2
- package/modern/PickersActionBar/PickersActionBar.js +18 -16
- package/modern/PickersLayout/PickersLayout.js +1 -15
- package/modern/PickersLayout/usePickerLayout.js +13 -47
- package/modern/PickersShortcuts/PickersShortcuts.js +13 -10
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
- package/modern/PickersTextField/PickersTextField.js +1 -1
- package/modern/TimeField/useTimeField.js +13 -11
- package/modern/TimePicker/TimePicker.js +2 -2
- package/modern/TimePicker/TimePickerToolbar.js +23 -35
- package/modern/hooks/index.js +3 -1
- package/modern/hooks/useIsValidValue.js +11 -0
- package/modern/hooks/usePickerActionsContext.js +15 -0
- package/modern/hooks/usePickerContext.js +1 -2
- package/modern/index.js +3 -2
- package/modern/internals/components/PickerProvider.js +17 -6
- package/modern/internals/components/PickersModalDialog.js +9 -3
- package/modern/internals/components/PickersPopper.js +11 -6
- package/modern/internals/components/PickersToolbar.js +1 -1
- package/modern/internals/hooks/date-helpers-hooks.js +4 -3
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -12
- package/modern/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/modern/internals/hooks/useField/index.js +1 -1
- package/modern/internals/hooks/useField/useField.js +17 -1
- package/modern/internals/hooks/useField/useField.utils.js +2 -2
- package/modern/internals/hooks/useField/useFieldState.js +2 -2
- package/modern/internals/hooks/useField/useFieldV6TextField.js +2 -2
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +9 -10
- package/modern/internals/hooks/useOpenState.js +3 -2
- package/modern/internals/hooks/usePicker/usePicker.js +0 -8
- package/modern/internals/hooks/usePicker/usePickerProvider.js +8 -5
- package/modern/internals/hooks/usePicker/usePickerValue.js +82 -217
- package/modern/internals/hooks/usePicker/usePickerViews.js +22 -14
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
- package/modern/internals/hooks/useUtils.js +1 -1
- package/modern/internals/index.js +5 -3
- package/modern/internals/models/index.js +2 -1
- package/modern/internals/models/manager.js +1 -0
- package/modern/internals/utils/date-utils.js +1 -1
- package/modern/internals/utils/valueManagers.js +4 -4
- package/modern/locales/index.js +1 -0
- package/modern/locales/nbNO.js +15 -19
- package/modern/locales/utils/getPickersLocalization.js +1 -1
- package/modern/locales/zhTW.js +73 -0
- package/modern/managers/index.js +3 -0
- package/modern/managers/useDateManager.js +47 -0
- package/modern/managers/useDateTimeManager.js +52 -0
- package/modern/managers/useTimeManager.js +43 -0
- package/modern/models/index.js +1 -0
- package/modern/models/manager.js +1 -0
- package/node/AdapterDateFns/AdapterDateFns.js +97 -97
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +97 -96
- package/node/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +94 -101
- package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/node/AdapterDateFnsV2/AdapterDateFnsV2.js +291 -0
- package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/node/DateCalendar/DateCalendar.js +1 -1
- package/node/DateField/useDateField.js +12 -10
- package/node/DatePicker/DatePicker.js +1 -1
- package/node/DatePicker/DatePickerToolbar.js +10 -25
- package/node/DateTimeField/useDateTimeField.js +12 -10
- package/node/DateTimePicker/DateTimePicker.js +2 -2
- package/node/DateTimePicker/DateTimePickerTabs.js +7 -14
- package/node/DateTimePicker/DateTimePickerToolbar.js +43 -49
- package/node/DesktopDatePicker/DesktopDatePicker.js +9 -3
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -15
- package/node/DesktopTimePicker/DesktopTimePicker.js +3 -7
- package/node/MobileDatePicker/MobileDatePicker.js +2 -2
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/node/MobileTimePicker/MobileTimePicker.js +2 -2
- package/node/PickersActionBar/PickersActionBar.js +20 -18
- package/node/PickersLayout/PickersLayout.js +1 -15
- package/node/PickersLayout/usePickerLayout.js +17 -51
- package/node/PickersShortcuts/PickersShortcuts.js +13 -10
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
- package/node/PickersTextField/PickersTextField.js +1 -1
- package/node/TimeField/useTimeField.js +12 -10
- package/node/TimePicker/TimePicker.js +2 -2
- package/node/TimePicker/TimePickerToolbar.js +23 -35
- package/node/hooks/index.js +15 -1
- package/node/hooks/useIsValidValue.js +18 -0
- package/node/hooks/usePickerActionsContext.js +22 -0
- package/node/hooks/usePickerContext.js +1 -1
- package/node/index.js +13 -1
- package/node/internals/components/PickerProvider.js +18 -7
- package/node/internals/components/PickersModalDialog.js +9 -3
- package/node/internals/components/PickersPopper.js +11 -6
- package/node/internals/components/PickersToolbar.js +1 -1
- package/node/internals/hooks/date-helpers-hooks.js +4 -3
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -12
- package/node/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
- package/node/internals/hooks/useField/index.js +6 -0
- package/node/internals/hooks/useField/useField.js +18 -1
- package/node/internals/hooks/useField/useField.utils.js +2 -2
- package/node/internals/hooks/useField/useFieldState.js +2 -2
- package/node/internals/hooks/useField/useFieldV6TextField.js +2 -2
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +9 -10
- package/node/internals/hooks/useOpenState.js +4 -2
- package/node/internals/hooks/usePicker/usePicker.js +0 -9
- package/node/internals/hooks/usePicker/usePickerProvider.js +8 -5
- package/node/internals/hooks/usePicker/usePickerValue.js +82 -217
- package/node/internals/hooks/usePicker/usePickerViews.js +22 -15
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
- package/node/internals/hooks/useUtils.js +1 -1
- package/node/internals/index.js +28 -20
- package/node/internals/models/index.js +11 -0
- package/node/internals/models/manager.js +5 -0
- package/node/internals/utils/date-utils.js +1 -1
- package/node/internals/utils/valueManagers.js +4 -4
- package/node/locales/index.js +11 -0
- package/node/locales/nbNO.js +15 -19
- package/node/locales/utils/getPickersLocalization.js +1 -1
- package/node/locales/zhTW.js +79 -0
- package/node/managers/index.js +26 -0
- package/node/managers/useDateManager.js +55 -0
- package/node/managers/useDateTimeManager.js +60 -0
- package/node/managers/useTimeManager.js +51 -0
- package/node/models/index.js +11 -0
- package/node/models/manager.js +5 -0
- package/package.json +3 -3
- package/themeAugmentation/props.d.ts +2 -3
- package/validation/extractValidationProps.d.ts +1 -1
- package/AdapterDateFnsJalaliV3/index.d.ts +0 -1
- package/AdapterDateFnsJalaliV3/index.js +0 -1
- package/AdapterDateFnsV3/index.d.ts +0 -1
- package/AdapterDateFnsV3/index.js +0 -1
- package/internals/hooks/defaultizedFieldProps.d.ts +0 -18
- package/internals/hooks/defaultizedFieldProps.js +0 -40
- package/modern/AdapterDateFnsJalaliV3/index.js +0 -1
- package/modern/AdapterDateFnsV3/index.js +0 -1
- package/modern/internals/hooks/defaultizedFieldProps.js +0 -40
- package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -299
- package/node/internals/hooks/defaultizedFieldProps.js +0 -50
|
@@ -1,53 +1,50 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
/* eslint-disable class-methods-use-this */
|
|
3
|
-
// TODO remove when date-fns-jalali-v3 is the default
|
|
4
3
|
// @ts-nocheck
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
|
|
49
|
-
// @ts-ignore TODO remove when date-fns-jalali-v3 is the default
|
|
50
|
-
|
|
4
|
+
import addSeconds from 'date-fns-jalali/addSeconds';
|
|
5
|
+
import addMinutes from 'date-fns-jalali/addMinutes';
|
|
6
|
+
import addHours from 'date-fns-jalali/addHours';
|
|
7
|
+
import addDays from 'date-fns-jalali/addDays';
|
|
8
|
+
import addWeeks from 'date-fns-jalali/addWeeks';
|
|
9
|
+
import addMonths from 'date-fns-jalali/addMonths';
|
|
10
|
+
import addYears from 'date-fns-jalali/addYears';
|
|
11
|
+
import endOfDay from 'date-fns-jalali/endOfDay';
|
|
12
|
+
import endOfWeek from 'date-fns-jalali/endOfWeek';
|
|
13
|
+
import endOfYear from 'date-fns-jalali/endOfYear';
|
|
14
|
+
import dateFnsFormat from 'date-fns-jalali/format';
|
|
15
|
+
import getHours from 'date-fns-jalali/getHours';
|
|
16
|
+
import getSeconds from 'date-fns-jalali/getSeconds';
|
|
17
|
+
import getMilliseconds from 'date-fns-jalali/getMilliseconds';
|
|
18
|
+
import getWeek from 'date-fns-jalali/getWeek';
|
|
19
|
+
import getYear from 'date-fns-jalali/getYear';
|
|
20
|
+
import getMonth from 'date-fns-jalali/getMonth';
|
|
21
|
+
import getDate from 'date-fns-jalali/getDate';
|
|
22
|
+
import getDaysInMonth from 'date-fns-jalali/getDaysInMonth';
|
|
23
|
+
import getMinutes from 'date-fns-jalali/getMinutes';
|
|
24
|
+
import isAfter from 'date-fns-jalali/isAfter';
|
|
25
|
+
import isBefore from 'date-fns-jalali/isBefore';
|
|
26
|
+
import isEqual from 'date-fns-jalali/isEqual';
|
|
27
|
+
import isSameDay from 'date-fns-jalali/isSameDay';
|
|
28
|
+
import isSameYear from 'date-fns-jalali/isSameYear';
|
|
29
|
+
import isSameMonth from 'date-fns-jalali/isSameMonth';
|
|
30
|
+
import isSameHour from 'date-fns-jalali/isSameHour';
|
|
31
|
+
import isValid from 'date-fns-jalali/isValid';
|
|
32
|
+
import dateFnsParse from 'date-fns-jalali/parse';
|
|
33
|
+
import setDate from 'date-fns-jalali/setDate';
|
|
34
|
+
import setHours from 'date-fns-jalali/setHours';
|
|
35
|
+
import setMinutes from 'date-fns-jalali/setMinutes';
|
|
36
|
+
import setMonth from 'date-fns-jalali/setMonth';
|
|
37
|
+
import setSeconds from 'date-fns-jalali/setSeconds';
|
|
38
|
+
import setMilliseconds from 'date-fns-jalali/setMilliseconds';
|
|
39
|
+
import setYear from 'date-fns-jalali/setYear';
|
|
40
|
+
import startOfDay from 'date-fns-jalali/startOfDay';
|
|
41
|
+
import startOfMonth from 'date-fns-jalali/startOfMonth';
|
|
42
|
+
import endOfMonth from 'date-fns-jalali/endOfMonth';
|
|
43
|
+
import startOfWeek from 'date-fns-jalali/startOfWeek';
|
|
44
|
+
import startOfYear from 'date-fns-jalali/startOfYear';
|
|
45
|
+
import isWithinInterval from 'date-fns-jalali/isWithinInterval';
|
|
46
|
+
import defaultLocale from 'date-fns-jalali/locale/fa-IR';
|
|
47
|
+
import longFormatters from 'date-fns-jalali/_lib/format/longFormatters';
|
|
51
48
|
import { AdapterDateFnsBase } from "../AdapterDateFnsBase/index.js";
|
|
52
49
|
const defaultFormats = {
|
|
53
50
|
year: 'yyyy',
|
|
@@ -119,10 +116,7 @@ export class AdapterDateFnsJalali extends AdapterDateFnsBase {
|
|
|
119
116
|
/* istanbul ignore next */
|
|
120
117
|
if (process.env.NODE_ENV !== 'production') {
|
|
121
118
|
if (typeof addDays !== 'function') {
|
|
122
|
-
throw new Error([
|
|
123
|
-
}
|
|
124
|
-
if (!longFormatters) {
|
|
125
|
-
throw new Error('MUI: The minimum supported `date-fns-jalali` package version compatible with this adapter is `3.2.x`.');
|
|
119
|
+
throw new Error(['MUI: This adapter is only compatible with `date-fns-jalali` v2.x package versions.', 'Please, install v2.x of the package or use the `AdapterDateFnsJalali` instead.'].join('\n'));
|
|
126
120
|
}
|
|
127
121
|
}
|
|
128
122
|
super({
|
|
@@ -133,7 +127,6 @@ export class AdapterDateFnsJalali extends AdapterDateFnsBase {
|
|
|
133
127
|
longFormatters,
|
|
134
128
|
lib: 'date-fns-jalali'
|
|
135
129
|
});
|
|
136
|
-
// TODO: explicit return types can be removed once there is only one date-fns version supported
|
|
137
130
|
this.parse = (value, format) => {
|
|
138
131
|
if (value === '') {
|
|
139
132
|
return null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AdapterDateFnsJalali } from "./AdapterDateFnsJalaliV2.js";
|
package/modern/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js}
RENAMED
|
@@ -1,53 +1,49 @@
|
|
|
1
1
|
/* eslint-disable class-methods-use-this */
|
|
2
|
-
// TODO remove when date-fns-v3 is the default
|
|
3
2
|
// @ts-nocheck
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
// date-fns v2 does not export types
|
|
49
|
-
// @ts-ignore TODO remove when date-fns-v3 is the default
|
|
50
|
-
|
|
3
|
+
import addDays from 'date-fns/addDays';
|
|
4
|
+
import addSeconds from 'date-fns/addSeconds';
|
|
5
|
+
import addMinutes from 'date-fns/addMinutes';
|
|
6
|
+
import addHours from 'date-fns/addHours';
|
|
7
|
+
import addWeeks from 'date-fns/addWeeks';
|
|
8
|
+
import addMonths from 'date-fns/addMonths';
|
|
9
|
+
import addYears from 'date-fns/addYears';
|
|
10
|
+
import endOfDay from 'date-fns/endOfDay';
|
|
11
|
+
import endOfWeek from 'date-fns/endOfWeek';
|
|
12
|
+
import endOfYear from 'date-fns/endOfYear';
|
|
13
|
+
import dateFnsFormat from 'date-fns/format';
|
|
14
|
+
import getDate from 'date-fns/getDate';
|
|
15
|
+
import getDaysInMonth from 'date-fns/getDaysInMonth';
|
|
16
|
+
import getHours from 'date-fns/getHours';
|
|
17
|
+
import getMinutes from 'date-fns/getMinutes';
|
|
18
|
+
import getMonth from 'date-fns/getMonth';
|
|
19
|
+
import getSeconds from 'date-fns/getSeconds';
|
|
20
|
+
import getMilliseconds from 'date-fns/getMilliseconds';
|
|
21
|
+
import getWeek from 'date-fns/getWeek';
|
|
22
|
+
import getYear from 'date-fns/getYear';
|
|
23
|
+
import isAfter from 'date-fns/isAfter';
|
|
24
|
+
import isBefore from 'date-fns/isBefore';
|
|
25
|
+
import isEqual from 'date-fns/isEqual';
|
|
26
|
+
import isSameDay from 'date-fns/isSameDay';
|
|
27
|
+
import isSameYear from 'date-fns/isSameYear';
|
|
28
|
+
import isSameMonth from 'date-fns/isSameMonth';
|
|
29
|
+
import isSameHour from 'date-fns/isSameHour';
|
|
30
|
+
import isValid from 'date-fns/isValid';
|
|
31
|
+
import dateFnsParse from 'date-fns/parse';
|
|
32
|
+
import setDate from 'date-fns/setDate';
|
|
33
|
+
import setHours from 'date-fns/setHours';
|
|
34
|
+
import setMinutes from 'date-fns/setMinutes';
|
|
35
|
+
import setMonth from 'date-fns/setMonth';
|
|
36
|
+
import setSeconds from 'date-fns/setSeconds';
|
|
37
|
+
import setMilliseconds from 'date-fns/setMilliseconds';
|
|
38
|
+
import setYear from 'date-fns/setYear';
|
|
39
|
+
import startOfDay from 'date-fns/startOfDay';
|
|
40
|
+
import startOfMonth from 'date-fns/startOfMonth';
|
|
41
|
+
import endOfMonth from 'date-fns/endOfMonth';
|
|
42
|
+
import startOfWeek from 'date-fns/startOfWeek';
|
|
43
|
+
import startOfYear from 'date-fns/startOfYear';
|
|
44
|
+
import isWithinInterval from 'date-fns/isWithinInterval';
|
|
45
|
+
import defaultLocale from 'date-fns/locale/en-US';
|
|
46
|
+
import longFormatters from 'date-fns/_lib/format/longFormatters';
|
|
51
47
|
import { AdapterDateFnsBase } from "../AdapterDateFnsBase/index.js";
|
|
52
48
|
/**
|
|
53
49
|
* Based on `@date-io/date-fns`
|
|
@@ -82,18 +78,14 @@ export class AdapterDateFns extends AdapterDateFnsBase {
|
|
|
82
78
|
/* istanbul ignore next */
|
|
83
79
|
if (process.env.NODE_ENV !== 'production') {
|
|
84
80
|
if (typeof addDays !== 'function') {
|
|
85
|
-
throw new Error([
|
|
86
|
-
}
|
|
87
|
-
if (!longFormatters) {
|
|
88
|
-
throw new Error('MUI: The minimum supported `date-fns` package version compatible with this adapter is `3.2.x`.');
|
|
81
|
+
throw new Error(['MUI: This adapter is only compatible with `date-fns` v2.x package versions.', 'Please, install v2.x of the package or use the `AdapterDateFns` instead.'].join('\n'));
|
|
89
82
|
}
|
|
90
83
|
}
|
|
91
84
|
super({
|
|
92
|
-
locale: locale ??
|
|
85
|
+
locale: locale ?? defaultLocale,
|
|
93
86
|
formats,
|
|
94
87
|
longFormatters
|
|
95
88
|
});
|
|
96
|
-
// TODO: explicit return types can be removed once there is only one date-fns version supported
|
|
97
89
|
this.parse = (value, format) => {
|
|
98
90
|
if (value === '') {
|
|
99
91
|
return null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AdapterDateFns } from "./AdapterDateFnsV2.js";
|
|
@@ -260,7 +260,7 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
|
|
|
260
260
|
return handleValueChange(day, 'finish', view);
|
|
261
261
|
});
|
|
262
262
|
React.useEffect(() => {
|
|
263
|
-
if (
|
|
263
|
+
if (utils.isValid(value)) {
|
|
264
264
|
changeMonth(value);
|
|
265
265
|
}
|
|
266
266
|
}, [value]); // eslint-disable-line
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { useField } from "../internals/hooks/useField/index.js";
|
|
5
|
-
import { validateDate } from "../validation/index.js";
|
|
3
|
+
import { useField, useFieldInternalPropsWithDefaults } from "../internals/hooks/useField/index.js";
|
|
6
4
|
import { useSplitFieldProps } from "../hooks/index.js";
|
|
7
|
-
import {
|
|
8
|
-
export const useDateField =
|
|
9
|
-
const
|
|
5
|
+
import { useDateManager } from "../managers/index.js";
|
|
6
|
+
export const useDateField = props => {
|
|
7
|
+
const manager = useDateManager(props);
|
|
10
8
|
const {
|
|
11
9
|
forwardedProps,
|
|
12
10
|
internalProps
|
|
13
11
|
} = useSplitFieldProps(props, 'date');
|
|
12
|
+
const internalPropsWithDefaults = useFieldInternalPropsWithDefaults({
|
|
13
|
+
manager,
|
|
14
|
+
internalProps
|
|
15
|
+
});
|
|
14
16
|
return useField({
|
|
15
17
|
forwardedProps,
|
|
16
|
-
internalProps,
|
|
17
|
-
valueManager:
|
|
18
|
-
fieldValueManager:
|
|
19
|
-
validator:
|
|
20
|
-
valueType:
|
|
18
|
+
internalProps: internalPropsWithDefaults,
|
|
19
|
+
valueManager: manager.internal_valueManager,
|
|
20
|
+
fieldValueManager: manager.internal_fieldValueManager,
|
|
21
|
+
validator: manager.validator,
|
|
22
|
+
valueType: manager.valueType
|
|
21
23
|
});
|
|
22
24
|
};
|
|
@@ -59,7 +59,7 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
59
59
|
autoFocus: PropTypes.bool,
|
|
60
60
|
className: PropTypes.string,
|
|
61
61
|
/**
|
|
62
|
-
* If `true`, the
|
|
62
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
63
63
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
64
64
|
*/
|
|
65
65
|
closeOnSelect: PropTypes.bool,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["toolbarFormat", "toolbarPlaceholder", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -15,6 +15,7 @@ import { useUtils } from "../internals/hooks/useUtils.js";
|
|
|
15
15
|
import { getDatePickerToolbarUtilityClass } from "./datePickerToolbarClasses.js";
|
|
16
16
|
import { resolveDateFormat } from "../internals/utils/date-utils.js";
|
|
17
17
|
import { useToolbarOwnerState } from "../internals/hooks/useToolbarOwnerState.js";
|
|
18
|
+
import { usePickerContext } from "../hooks/index.js";
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
const useUtilityClasses = classes => {
|
|
20
21
|
const slots = {
|
|
@@ -58,21 +59,23 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
|
|
|
58
59
|
name: 'MuiDatePickerToolbar'
|
|
59
60
|
});
|
|
60
61
|
const {
|
|
61
|
-
value,
|
|
62
|
-
isLandscape,
|
|
63
62
|
toolbarFormat,
|
|
64
63
|
toolbarPlaceholder = '––',
|
|
65
|
-
views,
|
|
66
64
|
className,
|
|
67
65
|
classes: classesProp
|
|
68
66
|
} = props,
|
|
69
67
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
70
68
|
const utils = useUtils();
|
|
69
|
+
const {
|
|
70
|
+
value,
|
|
71
|
+
views,
|
|
72
|
+
orientation
|
|
73
|
+
} = usePickerContext();
|
|
71
74
|
const translations = usePickerTranslations();
|
|
72
75
|
const ownerState = useToolbarOwnerState();
|
|
73
76
|
const classes = useUtilityClasses(classesProp);
|
|
74
77
|
const dateText = React.useMemo(() => {
|
|
75
|
-
if (!value) {
|
|
78
|
+
if (!utils.isValid(value)) {
|
|
76
79
|
return toolbarPlaceholder;
|
|
77
80
|
}
|
|
78
81
|
const formatFromViews = resolveDateFormat(utils, {
|
|
@@ -84,12 +87,11 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
|
|
|
84
87
|
return /*#__PURE__*/_jsx(DatePickerToolbarRoot, _extends({
|
|
85
88
|
ref: ref,
|
|
86
89
|
toolbarTitle: translations.datePickerToolbarTitle,
|
|
87
|
-
isLandscape: isLandscape,
|
|
88
90
|
className: clsx(classes.root, className)
|
|
89
91
|
}, other, {
|
|
90
92
|
children: /*#__PURE__*/_jsx(DatePickerToolbarTitle, {
|
|
91
93
|
variant: "h4",
|
|
92
|
-
align:
|
|
94
|
+
align: orientation === 'landscape' ? 'left' : 'center',
|
|
93
95
|
ownerState: ownerState,
|
|
94
96
|
className: classes.title,
|
|
95
97
|
children: dateText
|
|
@@ -111,14 +113,6 @@ process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
|
|
|
111
113
|
* @default `true` for Desktop, `false` for Mobile.
|
|
112
114
|
*/
|
|
113
115
|
hidden: PropTypes.bool,
|
|
114
|
-
isLandscape: PropTypes.bool.isRequired,
|
|
115
|
-
onChange: PropTypes.func.isRequired,
|
|
116
|
-
/**
|
|
117
|
-
* Callback called when a toolbar is clicked
|
|
118
|
-
* @template TView
|
|
119
|
-
* @param {TView} view The view to open
|
|
120
|
-
*/
|
|
121
|
-
onViewChange: PropTypes.func.isRequired,
|
|
122
116
|
/**
|
|
123
117
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
124
118
|
*/
|
|
@@ -132,14 +126,5 @@ process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
|
|
|
132
126
|
* Toolbar value placeholder—it is displayed when the value is empty.
|
|
133
127
|
* @default "––"
|
|
134
128
|
*/
|
|
135
|
-
toolbarPlaceholder: PropTypes.node
|
|
136
|
-
value: PropTypes.object,
|
|
137
|
-
/**
|
|
138
|
-
* Currently visible picker view.
|
|
139
|
-
*/
|
|
140
|
-
view: PropTypes.oneOf(['day', 'month', 'year']).isRequired,
|
|
141
|
-
/**
|
|
142
|
-
* Available views.
|
|
143
|
-
*/
|
|
144
|
-
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired).isRequired
|
|
129
|
+
toolbarPlaceholder: PropTypes.node
|
|
145
130
|
} : void 0;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { useField } from "../internals/hooks/useField/index.js";
|
|
5
|
-
import { validateDateTime } from "../validation/index.js";
|
|
3
|
+
import { useField, useFieldInternalPropsWithDefaults } from "../internals/hooks/useField/index.js";
|
|
6
4
|
import { useSplitFieldProps } from "../hooks/index.js";
|
|
7
|
-
import {
|
|
8
|
-
export const useDateTimeField =
|
|
9
|
-
const
|
|
5
|
+
import { useDateTimeManager } from "../managers/index.js";
|
|
6
|
+
export const useDateTimeField = props => {
|
|
7
|
+
const manager = useDateTimeManager(props);
|
|
10
8
|
const {
|
|
11
9
|
forwardedProps,
|
|
12
10
|
internalProps
|
|
13
11
|
} = useSplitFieldProps(props, 'date-time');
|
|
12
|
+
const internalPropsWithDefaults = useFieldInternalPropsWithDefaults({
|
|
13
|
+
manager,
|
|
14
|
+
internalProps
|
|
15
|
+
});
|
|
14
16
|
return useField({
|
|
15
17
|
forwardedProps,
|
|
16
|
-
internalProps,
|
|
17
|
-
valueManager:
|
|
18
|
-
fieldValueManager:
|
|
19
|
-
validator:
|
|
20
|
-
valueType:
|
|
18
|
+
internalProps: internalPropsWithDefaults,
|
|
19
|
+
valueManager: manager.internal_valueManager,
|
|
20
|
+
fieldValueManager: manager.internal_fieldValueManager,
|
|
21
|
+
validator: manager.validator,
|
|
22
|
+
valueType: manager.valueType
|
|
21
23
|
});
|
|
22
24
|
};
|
|
@@ -69,8 +69,8 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
69
69
|
autoFocus: PropTypes.bool,
|
|
70
70
|
className: PropTypes.string,
|
|
71
71
|
/**
|
|
72
|
-
* If `true`, the
|
|
73
|
-
* @default
|
|
72
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
73
|
+
* @default false
|
|
74
74
|
*/
|
|
75
75
|
closeOnSelect: PropTypes.bool,
|
|
76
76
|
/**
|
|
@@ -12,6 +12,7 @@ import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
|
12
12
|
import { getDateTimePickerTabsUtilityClass } from "./dateTimePickerTabsClasses.js";
|
|
13
13
|
import { isDatePickerView } from "../internals/utils/date-utils.js";
|
|
14
14
|
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
15
|
+
import { usePickerContext } from "../hooks/index.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const viewToTab = view => {
|
|
17
18
|
if (isDatePickerView(view)) {
|
|
@@ -65,9 +66,7 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
65
66
|
});
|
|
66
67
|
const {
|
|
67
68
|
dateIcon = /*#__PURE__*/_jsx(DateRangeIcon, {}),
|
|
68
|
-
onViewChange,
|
|
69
69
|
timeIcon = /*#__PURE__*/_jsx(TimeIcon, {}),
|
|
70
|
-
view,
|
|
71
70
|
hidden = typeof window === 'undefined' || window.innerHeight < 667,
|
|
72
71
|
className,
|
|
73
72
|
classes: classesProp,
|
|
@@ -77,9 +76,13 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
77
76
|
const {
|
|
78
77
|
ownerState
|
|
79
78
|
} = usePickerPrivateContext();
|
|
79
|
+
const {
|
|
80
|
+
view,
|
|
81
|
+
setView
|
|
82
|
+
} = usePickerContext();
|
|
80
83
|
const classes = useUtilityClasses(classesProp);
|
|
81
84
|
const handleChange = (event, value) => {
|
|
82
|
-
|
|
85
|
+
setView(tabToView(value));
|
|
83
86
|
};
|
|
84
87
|
if (hidden) {
|
|
85
88
|
return null;
|
|
@@ -126,12 +129,6 @@ process.env.NODE_ENV !== "production" ? DateTimePickerTabs.propTypes = {
|
|
|
126
129
|
* @default `window.innerHeight < 667` for `DesktopDateTimePicker` and `MobileDateTimePicker`, `displayStaticWrapperAs === 'desktop'` for `StaticDateTimePicker`
|
|
127
130
|
*/
|
|
128
131
|
hidden: PropTypes.bool,
|
|
129
|
-
/**
|
|
130
|
-
* Callback called when a tab is clicked.
|
|
131
|
-
* @template TView
|
|
132
|
-
* @param {TView} view The view to open
|
|
133
|
-
*/
|
|
134
|
-
onViewChange: PropTypes.func.isRequired,
|
|
135
132
|
/**
|
|
136
133
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
137
134
|
*/
|
|
@@ -140,10 +137,6 @@ process.env.NODE_ENV !== "production" ? DateTimePickerTabs.propTypes = {
|
|
|
140
137
|
* Time tab icon.
|
|
141
138
|
* @default Time
|
|
142
139
|
*/
|
|
143
|
-
timeIcon: PropTypes.node
|
|
144
|
-
/**
|
|
145
|
-
* Currently visible picker view.
|
|
146
|
-
*/
|
|
147
|
-
view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired
|
|
140
|
+
timeIcon: PropTypes.node
|
|
148
141
|
} : void 0;
|
|
149
142
|
export { DateTimePickerTabs };
|