@mui/x-date-pickers-pro 7.22.3 → 8.0.0-alpha.1
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 +348 -12
- package/DateRangeCalendar/DateRangeCalendar.d.ts +1 -2
- package/DateRangeCalendar/DateRangeCalendar.js +24 -22
- package/DateRangeCalendar/DateRangeCalendar.types.d.ts +24 -36
- package/DateRangeCalendar/useDragRange.d.ts +10 -9
- package/DateRangeCalendar/useDragRange.js +3 -3
- package/DateRangePicker/DateRangePicker.d.ts +1 -2
- package/DateRangePicker/DateRangePicker.js +12 -8
- package/DateRangePicker/DateRangePicker.types.d.ts +12 -6
- package/DateRangePicker/DateRangePickerToolbar.d.ts +3 -5
- package/DateRangePicker/DateRangePickerToolbar.js +2 -4
- package/DateRangePicker/index.d.ts +1 -1
- package/DateRangePicker/shared.d.ts +12 -12
- package/DateRangePickerDay/DateRangePickerDay.d.ts +2 -3
- package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -2
- package/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
- package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +12 -6
- package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +1 -2
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -2
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -9
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +4 -6
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -7
- package/DateTimeRangePicker/index.d.ts +1 -1
- package/DateTimeRangePicker/shared.d.ts +13 -13
- package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +1 -2
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
- package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +6 -7
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +1 -2
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +6 -7
- package/MobileDateRangePicker/MobileDateRangePicker.d.ts +1 -2
- package/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
- package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +6 -7
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +1 -2
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +6 -7
- package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +1 -2
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +9 -10
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +1 -2
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +9 -10
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +1 -2
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +9 -10
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.d.ts +1 -2
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.d.ts +3 -3
- package/README.md +4 -4
- package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +1 -2
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
- package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +8 -8
- package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +1 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +8 -8
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +1 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +8 -8
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -2
- package/StaticDateRangePicker/StaticDateRangePicker.d.ts +1 -2
- package/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
- package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +6 -7
- package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -3
- package/index.d.ts +0 -7
- package/index.js +1 -7
- package/internals/hooks/models/useRangePicker.d.ts +6 -7
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -2
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +22 -16
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +6 -7
- package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +16 -14
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +13 -13
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -2
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +23 -17
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +6 -7
- package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +1 -1
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +1 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +1 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -2
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +6 -6
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +8 -9
- package/internals/models/dateRange.d.ts +3 -4
- package/internals/models/dateTimeRange.d.ts +5 -10
- package/internals/models/fields.d.ts +26 -0
- package/internals/models/fields.js +1 -0
- package/internals/models/timeRange.d.ts +5 -9
- package/internals/utils/date-range-manager.d.ts +11 -10
- package/internals/utils/date-utils.d.ts +5 -5
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/valueManagers.d.ts +5 -6
- package/models/dateRange.d.ts +4 -5
- package/models/fields.d.ts +5 -32
- package/models/range.d.ts +1 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +24 -22
- package/modern/DateRangeCalendar/useDragRange.js +3 -3
- package/modern/DateRangePicker/DateRangePicker.js +12 -8
- package/modern/DateRangePicker/DateRangePickerToolbar.js +2 -4
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -2
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -7
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
- package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
- package/modern/index.js +1 -7
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +22 -16
- package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +13 -13
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +23 -17
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +6 -6
- package/modern/internals/models/fields.js +1 -0
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/validation/validateDateRange.js +5 -0
- package/modern/validation/validateDateTimeRange.js +5 -0
- package/modern/validation/validateTimeRange.js +5 -0
- package/node/DateRangeCalendar/DateRangeCalendar.js +23 -21
- package/node/DateRangeCalendar/useDragRange.js +3 -3
- package/node/DateRangePicker/DateRangePicker.js +12 -8
- package/node/DateRangePicker/DateRangePickerToolbar.js +1 -3
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +1 -1
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -6
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
- package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +1 -1
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
- package/node/index.js +2 -41
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +21 -15
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +12 -12
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -15
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +5 -5
- package/node/internals/models/fields.js +5 -0
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/validation/validateDateRange.js +4 -0
- package/node/validation/validateDateTimeRange.js +4 -0
- package/node/validation/validateTimeRange.js +4 -0
- package/package.json +7 -7
- package/themeAugmentation/props.d.ts +16 -17
- package/validation/validateDateRange.d.ts +9 -5
- package/validation/validateDateRange.js +5 -0
- package/validation/validateDateTimeRange.d.ts +11 -6
- package/validation/validateDateTimeRange.js +5 -0
- package/validation/validateTimeRange.d.ts +9 -4
- package/validation/validateTimeRange.js +5 -0
|
@@ -5,10 +5,10 @@ import * as React from 'react';
|
|
|
5
5
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
7
|
import useForkRef from '@mui/utils/useForkRef';
|
|
8
|
-
import {
|
|
8
|
+
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
9
9
|
import { onSpaceOrEnter } from '@mui/x-date-pickers/internals';
|
|
10
10
|
const useMultiInputFieldSlotProps = ({
|
|
11
|
-
|
|
11
|
+
variant,
|
|
12
12
|
open,
|
|
13
13
|
actions,
|
|
14
14
|
readOnly,
|
|
@@ -28,12 +28,12 @@ const useMultiInputFieldSlotProps = ({
|
|
|
28
28
|
startFieldRef,
|
|
29
29
|
endFieldRef
|
|
30
30
|
}) => {
|
|
31
|
-
const translations =
|
|
31
|
+
const translations = usePickerTranslations();
|
|
32
32
|
const handleStartFieldRef = useForkRef(fieldProps.unstableStartFieldRef, startFieldRef);
|
|
33
33
|
const handleEndFieldRef = useForkRef(fieldProps.unstableEndFieldRef, endFieldRef);
|
|
34
34
|
const previousRangePosition = React.useRef(rangePosition);
|
|
35
35
|
React.useEffect(() => {
|
|
36
|
-
if (!open) {
|
|
36
|
+
if (!open || variant === 'mobile') {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
const currentFieldRef = rangePosition === 'start' ? startFieldRef : endFieldRef;
|
|
@@ -49,7 +49,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
49
49
|
// use the current view or `0` when the range position has just been swapped
|
|
50
50
|
previousRangePosition.current === rangePosition ? currentView : 0);
|
|
51
51
|
previousRangePosition.current = rangePosition;
|
|
52
|
-
}, [rangePosition, open, currentView, startFieldRef, endFieldRef]);
|
|
52
|
+
}, [rangePosition, open, currentView, startFieldRef, endFieldRef, variant]);
|
|
53
53
|
const openRangeStartSelection = event => {
|
|
54
54
|
event.stopPropagation();
|
|
55
55
|
onRangePositionChange('start');
|
|
@@ -98,7 +98,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
98
98
|
focused: open ? rangePosition === 'start' : undefined
|
|
99
99
|
}, !readOnly && !fieldProps.disabled && {
|
|
100
100
|
onClick: openRangeStartSelection
|
|
101
|
-
},
|
|
101
|
+
}, variant === 'mobile' && {
|
|
102
102
|
readOnly: true
|
|
103
103
|
});
|
|
104
104
|
if (anchorRef) {
|
|
@@ -114,7 +114,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
114
114
|
focused: open ? rangePosition === 'end' : undefined
|
|
115
115
|
}, !readOnly && !fieldProps.disabled && {
|
|
116
116
|
onClick: openRangeEndSelection
|
|
117
|
-
},
|
|
117
|
+
}, variant === 'mobile' && {
|
|
118
118
|
readOnly: true
|
|
119
119
|
});
|
|
120
120
|
InputProps = resolvedComponentProps?.InputProps;
|
|
@@ -146,7 +146,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
146
146
|
return enrichedFieldProps;
|
|
147
147
|
};
|
|
148
148
|
const useSingleInputFieldSlotProps = ({
|
|
149
|
-
|
|
149
|
+
variant,
|
|
150
150
|
open,
|
|
151
151
|
actions,
|
|
152
152
|
readOnly,
|
|
@@ -166,7 +166,7 @@ const useSingleInputFieldSlotProps = ({
|
|
|
166
166
|
}) => {
|
|
167
167
|
const handleFieldRef = useForkRef(fieldProps.unstableFieldRef, startFieldRef, endFieldRef);
|
|
168
168
|
React.useEffect(() => {
|
|
169
|
-
if (!open || !startFieldRef.current) {
|
|
169
|
+
if (!open || !startFieldRef.current || variant === 'mobile') {
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
172
|
if (startFieldRef.current.isFieldFocused()) {
|
|
@@ -179,7 +179,7 @@ const useSingleInputFieldSlotProps = ({
|
|
|
179
179
|
const newSelectedSection = rangePosition === 'start' ? sections.indexOf(currentView) : sections.lastIndexOf(currentView);
|
|
180
180
|
startFieldRef.current?.focusField(newSelectedSection);
|
|
181
181
|
}
|
|
182
|
-
}, [rangePosition, open, currentView, startFieldRef]);
|
|
182
|
+
}, [rangePosition, open, currentView, startFieldRef, variant]);
|
|
183
183
|
const updateRangePosition = () => {
|
|
184
184
|
if (!startFieldRef.current?.isFieldFocused()) {
|
|
185
185
|
return;
|
|
@@ -208,8 +208,8 @@ const useSingleInputFieldSlotProps = ({
|
|
|
208
208
|
});
|
|
209
209
|
const slotProps = _extends({}, fieldProps.slotProps, {
|
|
210
210
|
textField: pickerSlotProps?.textField,
|
|
211
|
-
clearButton:
|
|
212
|
-
clearIcon:
|
|
211
|
+
clearButton: pickerSlotProps?.clearButton,
|
|
212
|
+
clearIcon: pickerSlotProps?.clearIcon
|
|
213
213
|
});
|
|
214
214
|
const enrichedFieldProps = _extends({}, fieldProps, {
|
|
215
215
|
slots,
|
|
@@ -225,7 +225,7 @@ const useSingleInputFieldSlotProps = ({
|
|
|
225
225
|
focused: open ? true : undefined
|
|
226
226
|
}, labelId != null && {
|
|
227
227
|
id: labelId
|
|
228
|
-
},
|
|
228
|
+
}, variant === 'mobile' && {
|
|
229
229
|
readOnly: true
|
|
230
230
|
}, !readOnly && !fieldProps.disabled && {
|
|
231
231
|
onClick: openPicker
|
|
@@ -5,8 +5,8 @@ import * as React from 'react';
|
|
|
5
5
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
6
6
|
import { useLicenseVerifier } from '@mui/x-license';
|
|
7
7
|
import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
8
|
-
import { usePicker, PickersModalDialog,
|
|
9
|
-
import {
|
|
8
|
+
import { usePicker, PickersModalDialog, PickerProvider } from '@mui/x-date-pickers/internals';
|
|
9
|
+
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
10
10
|
import useId from '@mui/utils/useId';
|
|
11
11
|
import { useEnrichedRangePickerFieldProps } from "../useEnrichedRangePickerFieldProps.js";
|
|
12
12
|
import { getReleaseInfo } from "../../utils/releaseInfo.js";
|
|
@@ -46,19 +46,21 @@ export const useMobileRangePicker = _ref => {
|
|
|
46
46
|
onRangePositionChange
|
|
47
47
|
} = useRangePosition(props, fieldType === 'single-input' ? startFieldRef : undefined);
|
|
48
48
|
const labelId = useId();
|
|
49
|
-
const contextTranslations =
|
|
49
|
+
const contextTranslations = usePickerTranslations();
|
|
50
50
|
const {
|
|
51
51
|
open,
|
|
52
52
|
actions,
|
|
53
53
|
layoutProps,
|
|
54
|
+
providerProps,
|
|
54
55
|
renderCurrentView,
|
|
55
56
|
fieldProps: pickerFieldProps,
|
|
56
|
-
|
|
57
|
+
ownerState
|
|
57
58
|
} = usePicker(_extends({}, pickerParams, {
|
|
58
59
|
props,
|
|
59
|
-
|
|
60
|
+
variant: 'mobile',
|
|
60
61
|
autoFocusView: true,
|
|
61
62
|
fieldRef: rangePosition === 'start' ? startFieldRef : endFieldRef,
|
|
63
|
+
localeText,
|
|
62
64
|
additionalViewProps: {
|
|
63
65
|
rangePosition,
|
|
64
66
|
onRangePositionChange
|
|
@@ -68,26 +70,32 @@ export const useMobileRangePicker = _ref => {
|
|
|
68
70
|
const fieldProps = useSlotProps({
|
|
69
71
|
elementType: Field,
|
|
70
72
|
externalSlotProps: innerSlotProps?.field,
|
|
71
|
-
additionalProps: _extends({
|
|
73
|
+
additionalProps: _extends({
|
|
74
|
+
// Internal props
|
|
72
75
|
readOnly: readOnly ?? true,
|
|
73
76
|
disabled,
|
|
74
|
-
className,
|
|
75
|
-
sx,
|
|
76
77
|
format,
|
|
77
78
|
formatDensity,
|
|
78
79
|
enableAccessibleFieldDOMStructure,
|
|
79
80
|
selectedSections,
|
|
80
81
|
onSelectedSectionsChange,
|
|
81
82
|
timezone
|
|
82
|
-
},
|
|
83
|
-
|
|
83
|
+
}, pickerFieldProps, {
|
|
84
|
+
// onChange and value
|
|
85
|
+
|
|
86
|
+
// Forwarded props
|
|
87
|
+
className,
|
|
88
|
+
sx
|
|
89
|
+
}, fieldType === 'single-input' && !!inputRef && {
|
|
90
|
+
inputRef
|
|
91
|
+
}, fieldType === 'single-input' && {
|
|
84
92
|
name
|
|
85
|
-
}
|
|
86
|
-
ownerState
|
|
93
|
+
}),
|
|
94
|
+
ownerState
|
|
87
95
|
});
|
|
88
96
|
const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
|
|
89
97
|
const enrichedFieldProps = useEnrichedRangePickerFieldProps({
|
|
90
|
-
|
|
98
|
+
variant: 'mobile',
|
|
91
99
|
fieldType,
|
|
92
100
|
open,
|
|
93
101
|
actions,
|
|
@@ -137,9 +145,7 @@ export const useMobileRangePicker = _ref => {
|
|
|
137
145
|
'aria-labelledby': labelledById
|
|
138
146
|
}, innerSlotProps?.mobilePaper)
|
|
139
147
|
});
|
|
140
|
-
const renderPicker = () => /*#__PURE__*/_jsxs(
|
|
141
|
-
contextValue: contextValue,
|
|
142
|
-
localeText: localeText,
|
|
148
|
+
const renderPicker = () => /*#__PURE__*/_jsxs(PickerProvider, _extends({}, providerProps, {
|
|
143
149
|
children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldProps)), /*#__PURE__*/_jsx(PickersModalDialog, _extends({}, actions, {
|
|
144
150
|
open: open,
|
|
145
151
|
slots: slots,
|
|
@@ -150,7 +156,7 @@ export const useMobileRangePicker = _ref => {
|
|
|
150
156
|
children: renderCurrentView()
|
|
151
157
|
}))
|
|
152
158
|
}))]
|
|
153
|
-
});
|
|
159
|
+
}));
|
|
154
160
|
return {
|
|
155
161
|
renderPicker
|
|
156
162
|
};
|
|
@@ -18,6 +18,7 @@ export const useMultiInputDateRangeField = ({
|
|
|
18
18
|
const {
|
|
19
19
|
value: valueProp,
|
|
20
20
|
defaultValue,
|
|
21
|
+
referenceDate,
|
|
21
22
|
format,
|
|
22
23
|
formatDensity,
|
|
23
24
|
shouldRespectLeadingZeros,
|
|
@@ -39,6 +40,7 @@ export const useMultiInputDateRangeField = ({
|
|
|
39
40
|
timezone: timezoneProp,
|
|
40
41
|
value: valueProp,
|
|
41
42
|
defaultValue,
|
|
43
|
+
referenceDate,
|
|
42
44
|
onChange,
|
|
43
45
|
valueManager: rangeValueManager
|
|
44
46
|
});
|
|
@@ -18,6 +18,7 @@ export const useMultiInputDateTimeRangeField = ({
|
|
|
18
18
|
const {
|
|
19
19
|
value: valueProp,
|
|
20
20
|
defaultValue,
|
|
21
|
+
referenceDate,
|
|
21
22
|
format,
|
|
22
23
|
formatDensity,
|
|
23
24
|
shouldRespectLeadingZeros,
|
|
@@ -39,6 +40,7 @@ export const useMultiInputDateTimeRangeField = ({
|
|
|
39
40
|
timezone: timezoneProp,
|
|
40
41
|
value: valueProp,
|
|
41
42
|
defaultValue,
|
|
43
|
+
referenceDate,
|
|
42
44
|
onChange,
|
|
43
45
|
valueManager: rangeValueManager
|
|
44
46
|
});
|
|
@@ -18,6 +18,7 @@ export const useMultiInputTimeRangeField = ({
|
|
|
18
18
|
const {
|
|
19
19
|
value: valueProp,
|
|
20
20
|
defaultValue,
|
|
21
|
+
referenceDate,
|
|
21
22
|
format,
|
|
22
23
|
formatDensity,
|
|
23
24
|
shouldRespectLeadingZeros,
|
|
@@ -40,7 +41,8 @@ export const useMultiInputTimeRangeField = ({
|
|
|
40
41
|
value: valueProp,
|
|
41
42
|
defaultValue,
|
|
42
43
|
onChange,
|
|
43
|
-
valueManager: rangeValueManager
|
|
44
|
+
valueManager: rangeValueManager,
|
|
45
|
+
referenceDate
|
|
44
46
|
});
|
|
45
47
|
const {
|
|
46
48
|
validationError,
|
|
@@ -4,9 +4,8 @@ const _excluded = ["props", "ref"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
7
|
-
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
8
7
|
import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
9
|
-
import { usePicker, DIALOG_WIDTH } from '@mui/x-date-pickers/internals';
|
|
8
|
+
import { usePicker, DIALOG_WIDTH, PickerProvider } from '@mui/x-date-pickers/internals';
|
|
10
9
|
import { useRangePosition } from "../useRangePosition.js";
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
const PickerStaticLayout = styled(PickersLayout)(({
|
|
@@ -42,16 +41,18 @@ export const useStaticRangePicker = _ref => {
|
|
|
42
41
|
} = useRangePosition(props);
|
|
43
42
|
const {
|
|
44
43
|
layoutProps,
|
|
44
|
+
providerProps,
|
|
45
45
|
renderCurrentView
|
|
46
46
|
} = usePicker(_extends({}, pickerParams, {
|
|
47
47
|
props,
|
|
48
48
|
autoFocusView: autoFocus ?? false,
|
|
49
49
|
fieldRef: undefined,
|
|
50
|
+
localeText,
|
|
50
51
|
additionalViewProps: {
|
|
51
52
|
rangePosition,
|
|
52
53
|
onRangePositionChange
|
|
53
54
|
},
|
|
54
|
-
|
|
55
|
+
variant: displayStaticWrapperAs
|
|
55
56
|
}));
|
|
56
57
|
const Layout = slots?.layout ?? PickerStaticLayout;
|
|
57
58
|
const slotPropsForLayout = _extends({}, slotProps, {
|
|
@@ -60,8 +61,7 @@ export const useStaticRangePicker = _ref => {
|
|
|
60
61
|
onRangePositionChange
|
|
61
62
|
})
|
|
62
63
|
});
|
|
63
|
-
const renderPicker = () => /*#__PURE__*/_jsx(
|
|
64
|
-
localeText: localeText,
|
|
64
|
+
const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
|
|
65
65
|
children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
|
|
66
66
|
slots: slots,
|
|
67
67
|
slotProps: slotPropsForLayout,
|
|
@@ -70,7 +70,7 @@ export const useStaticRangePicker = _ref => {
|
|
|
70
70
|
ref: ref,
|
|
71
71
|
children: renderCurrentView()
|
|
72
72
|
}))
|
|
73
|
-
});
|
|
73
|
+
}));
|
|
74
74
|
return {
|
|
75
75
|
renderPicker
|
|
76
76
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczMjIzMDAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -4,6 +4,11 @@ const _excluded = ["shouldDisableDate"];
|
|
|
4
4
|
import { validateDate } from '@mui/x-date-pickers/validation';
|
|
5
5
|
import { isRangeValid } from "../internals/utils/date-utils.js";
|
|
6
6
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Validation props used by the Date Range Picker, Date Range Field and Date Range Calendar components.
|
|
10
|
+
*/
|
|
11
|
+
|
|
7
12
|
export const validateDateRange = ({
|
|
8
13
|
adapter,
|
|
9
14
|
value,
|
|
@@ -4,6 +4,11 @@ const _excluded = ["shouldDisableDate"];
|
|
|
4
4
|
import { validateDateTime } from '@mui/x-date-pickers/validation';
|
|
5
5
|
import { isRangeValid } from "../internals/utils/date-utils.js";
|
|
6
6
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Validation props used by the Date Time Range Picker and Date Time Range Field.
|
|
10
|
+
*/
|
|
11
|
+
|
|
7
12
|
export const validateDateTimeRange = ({
|
|
8
13
|
adapter,
|
|
9
14
|
value,
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { validateTime } from '@mui/x-date-pickers/validation';
|
|
2
2
|
import { isRangeValid } from "../internals/utils/date-utils.js";
|
|
3
3
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Validation props used by the Time Range Picker and Time Range Field.
|
|
7
|
+
*/
|
|
8
|
+
|
|
4
9
|
export const validateTimeRange = ({
|
|
5
10
|
adapter,
|
|
6
11
|
value,
|
|
@@ -33,7 +33,7 @@ var _useRangePosition = require("../internals/hooks/useRangePosition");
|
|
|
33
33
|
var _dimensions = require("../internals/constants/dimensions");
|
|
34
34
|
var _PickersRangeCalendarHeader = require("../PickersRangeCalendarHeader");
|
|
35
35
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
36
|
-
const _excluded = ["value", "defaultValue", "referenceDate", "onChange", "className", "disableFuture", "disablePast", "minDate", "maxDate", "shouldDisableDate", "reduceAnimations", "onMonthChange", "rangePosition", "defaultRangePosition", "onRangePositionChange", "calendars", "currentMonthCalendarPosition", "slots", "slotProps", "loading", "renderLoading", "disableHighlightToday", "readOnly", "disabled", "showDaysOutsideCurrentMonth", "dayOfWeekFormatter", "disableAutoMonthSwitching", "autoFocus", "fixedWeekNumber", "disableDragEditing", "displayWeekNumber", "timezone", "availableRangePositions", "views", "view", "openTo", "onViewChange"],
|
|
36
|
+
const _excluded = ["value", "defaultValue", "referenceDate", "onChange", "className", "classes", "disableFuture", "disablePast", "minDate", "maxDate", "shouldDisableDate", "reduceAnimations", "onMonthChange", "rangePosition", "defaultRangePosition", "onRangePositionChange", "calendars", "currentMonthCalendarPosition", "slots", "slotProps", "loading", "renderLoading", "disableHighlightToday", "readOnly", "disabled", "showDaysOutsideCurrentMonth", "dayOfWeekFormatter", "disableAutoMonthSwitching", "autoFocus", "fixedWeekNumber", "disableDragEditing", "displayWeekNumber", "timezone", "availableRangePositions", "views", "view", "openTo", "onViewChange"],
|
|
37
37
|
_excluded2 = ["isDragging", "rangeDragDay", "draggingDatePosition"];
|
|
38
38
|
const releaseInfo = (0, _releaseInfo.getReleaseInfo)();
|
|
39
39
|
const DateRangeCalendarRoot = (0, _styles.styled)('div', {
|
|
@@ -104,15 +104,11 @@ function useDateRangeCalendarDefaultizedProps(props, name) {
|
|
|
104
104
|
availableRangePositions: themeProps.availableRangePositions ?? ['start', 'end']
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
const useUtilityClasses = ownerState => {
|
|
108
|
-
const {
|
|
109
|
-
classes,
|
|
110
|
-
isDragging
|
|
111
|
-
} = ownerState;
|
|
107
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
112
108
|
const slots = {
|
|
113
109
|
root: ['root'],
|
|
114
110
|
monthContainer: ['monthContainer'],
|
|
115
|
-
dayCalendar: [
|
|
111
|
+
dayCalendar: [ownerState.isDraggingDay && 'dayDragging']
|
|
116
112
|
};
|
|
117
113
|
return (0, _composeClasses.default)(slots, _dateRangeCalendarClasses.getDateRangeCalendarUtilityClass, classes);
|
|
118
114
|
};
|
|
@@ -137,6 +133,7 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
|
|
|
137
133
|
referenceDate,
|
|
138
134
|
onChange,
|
|
139
135
|
className,
|
|
136
|
+
classes: classesProp,
|
|
140
137
|
disableFuture,
|
|
141
138
|
disablePast,
|
|
142
139
|
minDate,
|
|
@@ -179,6 +176,7 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
|
|
|
179
176
|
name: 'DateRangeCalendar',
|
|
180
177
|
timezone: timezoneProp,
|
|
181
178
|
value: valueProp,
|
|
179
|
+
referenceDate,
|
|
182
180
|
defaultValue,
|
|
183
181
|
onChange,
|
|
184
182
|
valueManager: _valueManagers.rangeValueManager
|
|
@@ -252,10 +250,13 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
|
|
|
252
250
|
draggingDatePosition
|
|
253
251
|
} = _useDragRange,
|
|
254
252
|
dragEventHandlers = (0, _objectWithoutPropertiesLoose2.default)(_useDragRange, _excluded2);
|
|
255
|
-
const
|
|
256
|
-
|
|
253
|
+
const {
|
|
254
|
+
ownerState: pickersOwnerState
|
|
255
|
+
} = (0, _internals.usePickerPrivateContext)();
|
|
256
|
+
const ownerState = (0, _extends2.default)({}, pickersOwnerState, {
|
|
257
|
+
isDraggingDay: isDragging
|
|
257
258
|
});
|
|
258
|
-
const classes = useUtilityClasses(ownerState);
|
|
259
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
259
260
|
const draggingRange = React.useMemo(() => {
|
|
260
261
|
if (!valueDayRange[0] || !valueDayRange[1] || !rangeDragDay) {
|
|
261
262
|
return [null, null];
|
|
@@ -317,7 +318,7 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
|
|
|
317
318
|
slots,
|
|
318
319
|
slotProps
|
|
319
320
|
},
|
|
320
|
-
ownerState
|
|
321
|
+
ownerState
|
|
321
322
|
});
|
|
322
323
|
const prevValue = React.useRef(null);
|
|
323
324
|
React.useEffect(() => {
|
|
@@ -378,7 +379,8 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
|
|
|
378
379
|
const slotPropsForDayCalendar = (0, _extends2.default)({}, slotProps, {
|
|
379
380
|
day: dayOwnerState => {
|
|
380
381
|
const {
|
|
381
|
-
day
|
|
382
|
+
day,
|
|
383
|
+
isDaySelected
|
|
382
384
|
} = dayOwnerState;
|
|
383
385
|
const isSelectedStartDate = (0, _dateUtils.isStartOfRange)(utils, day, valueDayRange);
|
|
384
386
|
const isSelectedEndDate = (0, _dateUtils.isEndOfRange)(utils, day, valueDayRange);
|
|
@@ -401,7 +403,7 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
|
|
|
401
403
|
isEndOfHighlighting: isDragging ? (0, _dateUtils.isEndOfRange)(utils, day, draggingRange) : isSelectedEndDate,
|
|
402
404
|
onMouseEnter: shouldHavePreview ? handleDayMouseEnter : undefined,
|
|
403
405
|
// apply selected styling to the dragging start or end day
|
|
404
|
-
isVisuallySelected:
|
|
406
|
+
isVisuallySelected: isDaySelected || isDragging && (isStartOfHighlighting || isEndOfHighlighting),
|
|
405
407
|
'data-position': datePosition
|
|
406
408
|
}, dragEventHandlers, {
|
|
407
409
|
draggable: isElementDraggable ? true : undefined
|
|
@@ -522,9 +524,9 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
522
524
|
currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
|
|
523
525
|
/**
|
|
524
526
|
* Formats the day of week displayed in the calendar header.
|
|
525
|
-
* @param {
|
|
527
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
526
528
|
* @returns {string} The name to display.
|
|
527
|
-
* @default (date:
|
|
529
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
528
530
|
*/
|
|
529
531
|
dayOfWeekFormatter: _propTypes.default.func,
|
|
530
532
|
/**
|
|
@@ -544,7 +546,8 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
544
546
|
*/
|
|
545
547
|
disableAutoMonthSwitching: _propTypes.default.bool,
|
|
546
548
|
/**
|
|
547
|
-
* If `true`, the
|
|
549
|
+
* If `true`, the component is disabled.
|
|
550
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
548
551
|
* @default false
|
|
549
552
|
*/
|
|
550
553
|
disabled: _propTypes.default.bool,
|
|
@@ -615,8 +618,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
615
618
|
onFocusedViewChange: _propTypes.default.func,
|
|
616
619
|
/**
|
|
617
620
|
* Callback fired on month change.
|
|
618
|
-
* @
|
|
619
|
-
* @param {TDate} month The new month.
|
|
621
|
+
* @param {PickerValidDate} month The new month.
|
|
620
622
|
*/
|
|
621
623
|
onMonthChange: _propTypes.default.func,
|
|
622
624
|
/**
|
|
@@ -642,7 +644,8 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
642
644
|
*/
|
|
643
645
|
rangePosition: _propTypes.default.oneOf(['end', 'start']),
|
|
644
646
|
/**
|
|
645
|
-
*
|
|
647
|
+
* If `true`, the component is read-only.
|
|
648
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
646
649
|
* @default false
|
|
647
650
|
*/
|
|
648
651
|
readOnly: _propTypes.default.bool,
|
|
@@ -667,8 +670,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
667
670
|
*
|
|
668
671
|
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
669
672
|
*
|
|
670
|
-
* @
|
|
671
|
-
* @param {TDate} day The date to test.
|
|
673
|
+
* @param {PickerValidDate} day The date to test.
|
|
672
674
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
673
675
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
674
676
|
*/
|
|
@@ -221,9 +221,9 @@ const useDragRange = ({
|
|
|
221
221
|
}) => {
|
|
222
222
|
const [isDragging, setIsDragging] = React.useState(false);
|
|
223
223
|
const [rangeDragDay, setRangeDragDay] = React.useState(null);
|
|
224
|
-
const handleRangeDragDayChange = (0, _useEventCallback.default)(
|
|
225
|
-
if (!utils.isEqual(
|
|
226
|
-
setRangeDragDay(
|
|
224
|
+
const handleRangeDragDayChange = (0, _useEventCallback.default)(newValue => {
|
|
225
|
+
if (!utils.isEqual(newValue, rangeDragDay)) {
|
|
226
|
+
setRangeDragDay(newValue);
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
229
|
const draggingDatePosition = React.useMemo(() => {
|
|
@@ -81,9 +81,9 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
81
81
|
currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
|
|
82
82
|
/**
|
|
83
83
|
* Formats the day of week displayed in the calendar header.
|
|
84
|
-
* @param {
|
|
84
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
85
85
|
* @returns {string} The name to display.
|
|
86
|
-
* @default (date:
|
|
86
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
87
87
|
*/
|
|
88
88
|
dayOfWeekFormatter: _propTypes.default.func,
|
|
89
89
|
/**
|
|
@@ -109,7 +109,8 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
109
109
|
*/
|
|
110
110
|
disableAutoMonthSwitching: _propTypes.default.bool,
|
|
111
111
|
/**
|
|
112
|
-
* If `true`, the
|
|
112
|
+
* If `true`, the component is disabled.
|
|
113
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
113
114
|
* @default false
|
|
114
115
|
*/
|
|
115
116
|
disabled: _propTypes.default.bool,
|
|
@@ -143,7 +144,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
143
144
|
*/
|
|
144
145
|
displayWeekNumber: _propTypes.default.bool,
|
|
145
146
|
/**
|
|
146
|
-
* @default
|
|
147
|
+
* @default true
|
|
147
148
|
*/
|
|
148
149
|
enableAccessibleFieldDOMStructure: _propTypes.default.any,
|
|
149
150
|
/**
|
|
@@ -231,8 +232,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
231
232
|
onError: _propTypes.default.func,
|
|
232
233
|
/**
|
|
233
234
|
* Callback fired on month change.
|
|
234
|
-
* @
|
|
235
|
-
* @param {TDate} month The new month.
|
|
235
|
+
* @param {PickerValidDate} month The new month.
|
|
236
236
|
*/
|
|
237
237
|
onMonthChange: _propTypes.default.func,
|
|
238
238
|
/**
|
|
@@ -260,6 +260,11 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
260
260
|
* Used when the component position is controlled.
|
|
261
261
|
*/
|
|
262
262
|
rangePosition: _propTypes.default.oneOf(['end', 'start']),
|
|
263
|
+
/**
|
|
264
|
+
* If `true`, the component is read-only.
|
|
265
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
266
|
+
* @default false
|
|
267
|
+
*/
|
|
263
268
|
readOnly: _propTypes.default.bool,
|
|
264
269
|
/**
|
|
265
270
|
* If `true`, disable heavy animations.
|
|
@@ -292,8 +297,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
292
297
|
*
|
|
293
298
|
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
294
299
|
*
|
|
295
|
-
* @
|
|
296
|
-
* @param {TDate} day The date to test.
|
|
300
|
+
* @param {PickerValidDate} day The date to test.
|
|
297
301
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
298
302
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
299
303
|
*/
|
|
@@ -66,7 +66,7 @@ const DateRangePickerToolbar = exports.DateRangePickerToolbar = /*#__PURE__*/Rea
|
|
|
66
66
|
className
|
|
67
67
|
} = props,
|
|
68
68
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
69
|
-
const translations = (0, _hooks.
|
|
69
|
+
const translations = (0, _hooks.usePickerTranslations)();
|
|
70
70
|
const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) : translations.start;
|
|
71
71
|
const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) : translations.end;
|
|
72
72
|
const ownerState = props;
|
|
@@ -106,7 +106,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
106
106
|
*/
|
|
107
107
|
classes: _propTypes.default.object,
|
|
108
108
|
className: _propTypes.default.string,
|
|
109
|
-
disabled: _propTypes.default.bool,
|
|
110
109
|
/**
|
|
111
110
|
* If `true`, show the toolbar even in desktop mode.
|
|
112
111
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -120,7 +119,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
120
119
|
*/
|
|
121
120
|
onViewChange: _propTypes.default.func.isRequired,
|
|
122
121
|
rangePosition: _propTypes.default.oneOf(['end', 'start']).isRequired,
|
|
123
|
-
readOnly: _propTypes.default.bool,
|
|
124
122
|
/**
|
|
125
123
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
126
124
|
*/
|
|
@@ -86,9 +86,9 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
86
86
|
currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
|
|
87
87
|
/**
|
|
88
88
|
* Formats the day of week displayed in the calendar header.
|
|
89
|
-
* @param {
|
|
89
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
90
90
|
* @returns {string} The name to display.
|
|
91
|
-
* @default (date:
|
|
91
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
92
92
|
*/
|
|
93
93
|
dayOfWeekFormatter: _propTypes.default.func,
|
|
94
94
|
/**
|
|
@@ -114,7 +114,8 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
114
114
|
*/
|
|
115
115
|
disableAutoMonthSwitching: _propTypes.default.bool,
|
|
116
116
|
/**
|
|
117
|
-
* If `true`, the
|
|
117
|
+
* If `true`, the component is disabled.
|
|
118
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
118
119
|
* @default false
|
|
119
120
|
*/
|
|
120
121
|
disabled: _propTypes.default.bool,
|
|
@@ -153,7 +154,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
153
154
|
*/
|
|
154
155
|
displayWeekNumber: _propTypes.default.bool,
|
|
155
156
|
/**
|
|
156
|
-
* @default
|
|
157
|
+
* @default true
|
|
157
158
|
*/
|
|
158
159
|
enableAccessibleFieldDOMStructure: _propTypes.default.any,
|
|
159
160
|
/**
|
|
@@ -264,8 +265,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
264
265
|
onError: _propTypes.default.func,
|
|
265
266
|
/**
|
|
266
267
|
* Callback fired on month change.
|
|
267
|
-
* @
|
|
268
|
-
* @param {TDate} month The new month.
|
|
268
|
+
* @param {PickerValidDate} month The new month.
|
|
269
269
|
*/
|
|
270
270
|
onMonthChange: _propTypes.default.func,
|
|
271
271
|
/**
|
|
@@ -305,6 +305,11 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
305
305
|
* Used when the component position is controlled.
|
|
306
306
|
*/
|
|
307
307
|
rangePosition: _propTypes.default.oneOf(['end', 'start']),
|
|
308
|
+
/**
|
|
309
|
+
* If `true`, the component is read-only.
|
|
310
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
311
|
+
* @default false
|
|
312
|
+
*/
|
|
308
313
|
readOnly: _propTypes.default.bool,
|
|
309
314
|
/**
|
|
310
315
|
* If `true`, disable heavy animations.
|
|
@@ -337,16 +342,14 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
337
342
|
*
|
|
338
343
|
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
339
344
|
*
|
|
340
|
-
* @
|
|
341
|
-
* @param {TDate} day The date to test.
|
|
345
|
+
* @param {PickerValidDate} day The date to test.
|
|
342
346
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
343
347
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
344
348
|
*/
|
|
345
349
|
shouldDisableDate: _propTypes.default.func,
|
|
346
350
|
/**
|
|
347
351
|
* Disable specific time.
|
|
348
|
-
* @
|
|
349
|
-
* @param {TDate} value The value to check.
|
|
352
|
+
* @param {PickerValidDate} value The value to check.
|
|
350
353
|
* @param {TimeView} view The clock type of the timeValue.
|
|
351
354
|
* @returns {boolean} If `true` the time will be disabled.
|
|
352
355
|
*/
|