@mui/x-date-pickers 8.0.0-alpha.6 → 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 +127 -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 -2
- package/DatePicker/DatePickerToolbar.js +7 -11
- 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/DateTimePickerTabs.js +2 -2
- package/DateTimePicker/DateTimePickerToolbar.d.ts +6 -2
- package/DateTimePicker/DateTimePickerToolbar.js +36 -31
- package/DateTimePicker/shared.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +9 -3
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +5 -0
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
- package/DesktopTimePicker/DesktopTimePicker.js +3 -7
- package/MobileDatePicker/MobileDatePicker.js +2 -2
- package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/MobileTimePicker/MobileTimePicker.js +2 -2
- package/PickersActionBar/PickersActionBar.d.ts +6 -3
- package/PickersActionBar/PickersActionBar.js +6 -3
- package/PickersLayout/PickersLayout.js +1 -5
- package/PickersLayout/PickersLayout.types.d.ts +2 -3
- package/PickersLayout/usePickerLayout.js +12 -31
- 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/TimeField/useTimeField.d.ts +1 -1
- package/TimeField/useTimeField.js +13 -11
- package/TimePicker/TimePicker.js +2 -2
- package/TimePicker/TimePickerToolbar.d.ts +1 -2
- package/TimePicker/TimePickerToolbar.js +20 -18
- package/TimePicker/shared.d.ts +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- package/hooks/useIsValidValue.d.ts +7 -0
- package/hooks/useIsValidValue.js +11 -0
- package/hooks/usePickerActionsContext.d.ts +3 -1
- package/hooks/usePickerActionsContext.js +0 -1
- package/hooks/usePickerContext.d.ts +2 -2
- package/hooks/usePickerContext.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +3 -2
- package/internals/components/PickerProvider.d.ts +11 -10
- package/internals/components/PickerProvider.js +8 -3
- 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 +1 -3
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +2 -2
- 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 +1 -3
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +2 -2
- package/internals/hooks/useOpenState.js +3 -2
- package/internals/hooks/usePicker/usePicker.d.ts +1 -1
- package/internals/hooks/usePicker/usePicker.js +0 -6
- package/internals/hooks/usePicker/usePicker.types.d.ts +5 -6
- package/internals/hooks/usePicker/usePickerProvider.d.ts +5 -5
- package/internals/hooks/usePicker/usePickerProvider.js +4 -2
- package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +67 -184
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +48 -54
- package/internals/hooks/usePicker/usePickerViews.d.ts +27 -23
- package/internals/hooks/usePicker/usePickerViews.js +17 -11
- package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +2 -2
- package/internals/hooks/useUtils.js +1 -1
- package/internals/index.d.ts +5 -3
- 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/toolbar.d.ts +1 -5
- 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 +7 -11
- package/modern/DateTimeField/useDateTimeField.js +13 -11
- package/modern/DateTimePicker/DateTimePicker.js +2 -2
- package/modern/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/modern/DateTimePicker/DateTimePickerToolbar.js +36 -31
- package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -3
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
- 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 +6 -3
- package/modern/PickersLayout/PickersLayout.js +1 -5
- package/modern/PickersLayout/usePickerLayout.js +12 -31
- 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 +20 -18
- package/modern/hooks/index.js +2 -1
- package/modern/hooks/useIsValidValue.js +11 -0
- package/modern/hooks/usePickerActionsContext.js +0 -1
- package/modern/hooks/usePickerContext.js +1 -1
- package/modern/index.js +3 -2
- package/modern/internals/components/PickerProvider.js +8 -3
- 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 +1 -3
- 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 +1 -3
- package/modern/internals/hooks/useOpenState.js +3 -2
- package/modern/internals/hooks/usePicker/usePicker.js +0 -6
- package/modern/internals/hooks/usePicker/usePickerProvider.js +4 -2
- package/modern/internals/hooks/usePicker/usePickerValue.js +67 -184
- package/modern/internals/hooks/usePicker/usePickerViews.js +17 -11
- 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 +7 -11
- package/node/DateTimeField/useDateTimeField.js +12 -10
- package/node/DateTimePicker/DateTimePicker.js +2 -2
- package/node/DateTimePicker/DateTimePickerTabs.js +2 -2
- package/node/DateTimePicker/DateTimePickerToolbar.js +36 -31
- package/node/DesktopDatePicker/DesktopDatePicker.js +9 -3
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
- 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 +8 -5
- package/node/PickersLayout/PickersLayout.js +1 -5
- package/node/PickersLayout/usePickerLayout.js +16 -35
- 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 +20 -18
- package/node/hooks/index.js +8 -1
- package/node/hooks/useIsValidValue.js +18 -0
- package/node/hooks/usePickerContext.js +1 -1
- package/node/index.js +13 -1
- package/node/internals/components/PickerProvider.js +8 -3
- 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 +1 -3
- 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 +1 -3
- package/node/internals/hooks/useOpenState.js +4 -2
- package/node/internals/hooks/usePicker/usePicker.js +0 -7
- package/node/internals/hooks/usePicker/usePickerProvider.js +4 -2
- package/node/internals/hooks/usePicker/usePickerValue.js +67 -184
- package/node/internals/hooks/usePicker/usePickerViews.js +17 -12
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
- package/node/internals/hooks/useUtils.js +1 -1
- package/node/internals/index.js +26 -18
- 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 +1 -1
- 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';
|
|
@@ -59,8 +59,6 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
|
|
|
59
59
|
name: 'MuiDatePickerToolbar'
|
|
60
60
|
});
|
|
61
61
|
const {
|
|
62
|
-
value,
|
|
63
|
-
isLandscape,
|
|
64
62
|
toolbarFormat,
|
|
65
63
|
toolbarPlaceholder = '––',
|
|
66
64
|
className,
|
|
@@ -69,13 +67,15 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
|
|
|
69
67
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
70
68
|
const utils = useUtils();
|
|
71
69
|
const {
|
|
72
|
-
|
|
70
|
+
value,
|
|
71
|
+
views,
|
|
72
|
+
orientation
|
|
73
73
|
} = usePickerContext();
|
|
74
74
|
const translations = usePickerTranslations();
|
|
75
75
|
const ownerState = useToolbarOwnerState();
|
|
76
76
|
const classes = useUtilityClasses(classesProp);
|
|
77
77
|
const dateText = React.useMemo(() => {
|
|
78
|
-
if (!value) {
|
|
78
|
+
if (!utils.isValid(value)) {
|
|
79
79
|
return toolbarPlaceholder;
|
|
80
80
|
}
|
|
81
81
|
const formatFromViews = resolveDateFormat(utils, {
|
|
@@ -87,12 +87,11 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
|
|
|
87
87
|
return /*#__PURE__*/_jsx(DatePickerToolbarRoot, _extends({
|
|
88
88
|
ref: ref,
|
|
89
89
|
toolbarTitle: translations.datePickerToolbarTitle,
|
|
90
|
-
isLandscape: isLandscape,
|
|
91
90
|
className: clsx(classes.root, className)
|
|
92
91
|
}, other, {
|
|
93
92
|
children: /*#__PURE__*/_jsx(DatePickerToolbarTitle, {
|
|
94
93
|
variant: "h4",
|
|
95
|
-
align:
|
|
94
|
+
align: orientation === 'landscape' ? 'left' : 'center',
|
|
96
95
|
ownerState: ownerState,
|
|
97
96
|
className: classes.title,
|
|
98
97
|
children: dateText
|
|
@@ -114,8 +113,6 @@ process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
|
|
|
114
113
|
* @default `true` for Desktop, `false` for Mobile.
|
|
115
114
|
*/
|
|
116
115
|
hidden: PropTypes.bool,
|
|
117
|
-
isLandscape: PropTypes.bool.isRequired,
|
|
118
|
-
onChange: PropTypes.func.isRequired,
|
|
119
116
|
/**
|
|
120
117
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
121
118
|
*/
|
|
@@ -129,6 +126,5 @@ process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
|
|
|
129
126
|
* Toolbar value placeholder—it is displayed when the value is empty.
|
|
130
127
|
* @default "––"
|
|
131
128
|
*/
|
|
132
|
-
toolbarPlaceholder: PropTypes.node
|
|
133
|
-
value: PropTypes.object
|
|
129
|
+
toolbarPlaceholder: PropTypes.node
|
|
134
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
|
/**
|
|
@@ -78,11 +78,11 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
78
78
|
} = usePickerPrivateContext();
|
|
79
79
|
const {
|
|
80
80
|
view,
|
|
81
|
-
|
|
81
|
+
setView
|
|
82
82
|
} = usePickerContext();
|
|
83
83
|
const classes = useUtilityClasses(classesProp);
|
|
84
84
|
const handleChange = (event, value) => {
|
|
85
|
-
|
|
85
|
+
setView(tabToView(value));
|
|
86
86
|
};
|
|
87
87
|
if (hidden) {
|
|
88
88
|
return null;
|
|
@@ -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 = ["ampm", "ampmInClock", "
|
|
5
|
+
const _excluded = ["ampm", "ampmInClock", "toolbarFormat", "toolbarPlaceholder", "toolbarTitle", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -230,9 +230,6 @@ function DateTimePickerToolbar(inProps) {
|
|
|
230
230
|
const {
|
|
231
231
|
ampm,
|
|
232
232
|
ampmInClock,
|
|
233
|
-
value,
|
|
234
|
-
onChange,
|
|
235
|
-
isLandscape,
|
|
236
233
|
toolbarFormat,
|
|
237
234
|
toolbarPlaceholder = '––',
|
|
238
235
|
toolbarTitle: inToolbarTitle,
|
|
@@ -241,31 +238,37 @@ function DateTimePickerToolbar(inProps) {
|
|
|
241
238
|
} = props,
|
|
242
239
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
243
240
|
const {
|
|
241
|
+
value: valueContext,
|
|
242
|
+
setValue: setValueContext,
|
|
244
243
|
disabled,
|
|
245
244
|
readOnly,
|
|
246
245
|
variant,
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
orientation,
|
|
247
|
+
view: viewContext,
|
|
248
|
+
setView: setViewContext,
|
|
249
249
|
views
|
|
250
250
|
} = usePickerContext();
|
|
251
|
+
const translations = usePickerTranslations();
|
|
251
252
|
const ownerState = useToolbarOwnerState();
|
|
252
253
|
const classes = useUtilityClasses(classesProp, ownerState);
|
|
253
254
|
const utils = useUtils();
|
|
255
|
+
const overrides = React.useContext(DateTimePickerToolbarOverrideContext);
|
|
256
|
+
const value = overrides ? overrides.value : valueContext;
|
|
257
|
+
const setValue = overrides ? overrides.setValue : setValueContext;
|
|
258
|
+
const view = overrides ? overrides.view : viewContext;
|
|
259
|
+
const setView = overrides ? overrides.setView : setViewContext;
|
|
254
260
|
const {
|
|
255
261
|
meridiemMode,
|
|
256
262
|
handleMeridiemChange
|
|
257
|
-
} = useMeridiemMode(value, ampm,
|
|
258
|
-
|
|
259
|
-
|
|
263
|
+
} = useMeridiemMode(value, ampm, newValue => setValue(newValue, {
|
|
264
|
+
changeImportance: 'set'
|
|
265
|
+
}));
|
|
260
266
|
const toolbarVariant = overrides?.forceDesktopVariant ? 'desktop' : variant;
|
|
261
267
|
const isDesktop = toolbarVariant === 'desktop';
|
|
262
268
|
const showAmPmControl = Boolean(ampm && !ampmInClock);
|
|
263
269
|
const toolbarTitle = inToolbarTitle ?? translations.dateTimePickerToolbarTitle;
|
|
264
|
-
const view = overrides ? overrides.view : viewCtx;
|
|
265
|
-
const onViewChange = overrides ? overrides.onViewChange : onViewChangeCtx;
|
|
266
|
-
const formatHours = time => ampm ? utils.format(time, 'hours12h') : utils.format(time, 'hours24h');
|
|
267
270
|
const dateText = React.useMemo(() => {
|
|
268
|
-
if (!value) {
|
|
271
|
+
if (!utils.isValid(value)) {
|
|
269
272
|
return toolbarPlaceholder;
|
|
270
273
|
}
|
|
271
274
|
if (toolbarFormat) {
|
|
@@ -273,8 +276,13 @@ function DateTimePickerToolbar(inProps) {
|
|
|
273
276
|
}
|
|
274
277
|
return utils.format(value, 'shortDate');
|
|
275
278
|
}, [value, toolbarFormat, toolbarPlaceholder, utils]);
|
|
279
|
+
const formatSection = (format, fallback) => {
|
|
280
|
+
if (!utils.isValid(value)) {
|
|
281
|
+
return fallback;
|
|
282
|
+
}
|
|
283
|
+
return utils.format(value, format);
|
|
284
|
+
};
|
|
276
285
|
return /*#__PURE__*/_jsxs(DateTimePickerToolbarRoot, _extends({
|
|
277
|
-
isLandscape: isLandscape,
|
|
278
286
|
className: clsx(classes.root, className),
|
|
279
287
|
toolbarTitle: toolbarTitle,
|
|
280
288
|
toolbarVariant: toolbarVariant
|
|
@@ -286,13 +294,13 @@ function DateTimePickerToolbar(inProps) {
|
|
|
286
294
|
children: [views.includes('year') && /*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
287
295
|
tabIndex: -1,
|
|
288
296
|
variant: "subtitle1",
|
|
289
|
-
onClick: () =>
|
|
297
|
+
onClick: () => setView('year'),
|
|
290
298
|
selected: view === 'year',
|
|
291
|
-
value:
|
|
299
|
+
value: formatSection('year', '–')
|
|
292
300
|
}), views.includes('day') && /*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
293
301
|
tabIndex: -1,
|
|
294
302
|
variant: isDesktop ? 'h5' : 'h4',
|
|
295
|
-
onClick: () =>
|
|
303
|
+
onClick: () => setView('day'),
|
|
296
304
|
selected: view === 'day',
|
|
297
305
|
value: dateText
|
|
298
306
|
})]
|
|
@@ -307,10 +315,10 @@ function DateTimePickerToolbar(inProps) {
|
|
|
307
315
|
children: [views.includes('hours') && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
308
316
|
children: [/*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
309
317
|
variant: isDesktop ? 'h5' : 'h3',
|
|
310
|
-
width: isDesktop &&
|
|
311
|
-
onClick: () =>
|
|
318
|
+
width: isDesktop && orientation === 'portrait' ? MULTI_SECTION_CLOCK_SECTION_WIDTH : undefined,
|
|
319
|
+
onClick: () => setView('hours'),
|
|
312
320
|
selected: view === 'hours',
|
|
313
|
-
value:
|
|
321
|
+
value: formatSection(ampm ? 'hours12h' : 'hours24h', '--')
|
|
314
322
|
}), /*#__PURE__*/_jsx(DateTimePickerToolbarSeparator, {
|
|
315
323
|
variant: isDesktop ? 'h5' : 'h3',
|
|
316
324
|
value: ":",
|
|
@@ -319,10 +327,10 @@ function DateTimePickerToolbar(inProps) {
|
|
|
319
327
|
toolbarVariant: toolbarVariant
|
|
320
328
|
}), /*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
321
329
|
variant: isDesktop ? 'h5' : 'h3',
|
|
322
|
-
width: isDesktop &&
|
|
323
|
-
onClick: () =>
|
|
330
|
+
width: isDesktop && orientation === 'portrait' ? MULTI_SECTION_CLOCK_SECTION_WIDTH : undefined,
|
|
331
|
+
onClick: () => setView('minutes'),
|
|
324
332
|
selected: view === 'minutes' || !views.includes('minutes') && view === 'hours',
|
|
325
|
-
value:
|
|
333
|
+
value: formatSection('minutes', '--'),
|
|
326
334
|
disabled: !views.includes('minutes')
|
|
327
335
|
})]
|
|
328
336
|
}), views.includes('seconds') && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
@@ -334,10 +342,10 @@ function DateTimePickerToolbar(inProps) {
|
|
|
334
342
|
toolbarVariant: toolbarVariant
|
|
335
343
|
}), /*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
336
344
|
variant: isDesktop ? 'h5' : 'h3',
|
|
337
|
-
width: isDesktop &&
|
|
338
|
-
onClick: () =>
|
|
345
|
+
width: isDesktop && orientation === 'portrait' ? MULTI_SECTION_CLOCK_SECTION_WIDTH : undefined,
|
|
346
|
+
onClick: () => setView('seconds'),
|
|
339
347
|
selected: view === 'seconds',
|
|
340
|
-
value:
|
|
348
|
+
value: formatSection('seconds', '--')
|
|
341
349
|
})]
|
|
342
350
|
})]
|
|
343
351
|
}), showAmPmControl && !isDesktop && /*#__PURE__*/_jsxs(DateTimePickerToolbarAmPmSelection, {
|
|
@@ -360,7 +368,7 @@ function DateTimePickerToolbar(inProps) {
|
|
|
360
368
|
})]
|
|
361
369
|
}), ampm && isDesktop && /*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
362
370
|
variant: "h5",
|
|
363
|
-
onClick: () =>
|
|
371
|
+
onClick: () => setView('meridiem'),
|
|
364
372
|
selected: view === 'meridiem',
|
|
365
373
|
value: value && meridiemMode ? formatMeridiem(utils, meridiemMode) : '--',
|
|
366
374
|
width: MULTI_SECTION_CLOCK_SECTION_WIDTH
|
|
@@ -385,8 +393,6 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
|
|
|
385
393
|
* @default `true` for Desktop, `false` for Mobile.
|
|
386
394
|
*/
|
|
387
395
|
hidden: PropTypes.bool,
|
|
388
|
-
isLandscape: PropTypes.bool.isRequired,
|
|
389
|
-
onChange: PropTypes.func.isRequired,
|
|
390
396
|
/**
|
|
391
397
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
392
398
|
*/
|
|
@@ -404,7 +410,6 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
|
|
|
404
410
|
/**
|
|
405
411
|
* If provided, it will be used instead of `dateTimePickerToolbarTitle` from localization.
|
|
406
412
|
*/
|
|
407
|
-
toolbarTitle: PropTypes.node
|
|
408
|
-
value: PropTypes.object
|
|
413
|
+
toolbarTitle: PropTypes.node
|
|
409
414
|
} : void 0;
|
|
410
415
|
export { DateTimePickerToolbar };
|
|
@@ -16,6 +16,8 @@ import { DateField } from "../DateField/index.js";
|
|
|
16
16
|
import { renderDateViewCalendar } from "../dateViewRenderers/index.js";
|
|
17
17
|
import { resolveDateFormat } from "../internals/utils/date-utils.js";
|
|
18
18
|
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
19
|
+
const emptyActions = [];
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
22
|
* Demos:
|
|
21
23
|
*
|
|
@@ -40,6 +42,7 @@ const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePick
|
|
|
40
42
|
|
|
41
43
|
// Props with the default values specific to the desktop variant
|
|
42
44
|
const props = _extends({}, defaultizedProps, {
|
|
45
|
+
closeOnSelect: defaultizedProps.closeOnSelect ?? true,
|
|
43
46
|
viewRenderers,
|
|
44
47
|
format: resolveDateFormat(utils, defaultizedProps, false),
|
|
45
48
|
yearsPerRow: defaultizedProps.yearsPerRow ?? 4,
|
|
@@ -53,7 +56,10 @@ const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePick
|
|
|
53
56
|
}),
|
|
54
57
|
toolbar: _extends({
|
|
55
58
|
hidden: true
|
|
56
|
-
}, defaultizedProps.slotProps?.toolbar)
|
|
59
|
+
}, defaultizedProps.slotProps?.toolbar),
|
|
60
|
+
actionBar: ownerState => _extends({
|
|
61
|
+
actions: emptyActions
|
|
62
|
+
}, resolveComponentProps(defaultizedProps.slotProps?.actionBar, ownerState))
|
|
57
63
|
})
|
|
58
64
|
});
|
|
59
65
|
const {
|
|
@@ -86,8 +92,8 @@ DesktopDatePicker.propTypes = {
|
|
|
86
92
|
autoFocus: PropTypes.bool,
|
|
87
93
|
className: PropTypes.string,
|
|
88
94
|
/**
|
|
89
|
-
* If `true`, the
|
|
90
|
-
* @default
|
|
95
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
96
|
+
* @default true
|
|
91
97
|
*/
|
|
92
98
|
closeOnSelect: PropTypes.bool,
|
|
93
99
|
/**
|