@mui/x-date-pickers-pro 7.22.2 → 8.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -155
- package/DateRangeCalendar/DateRangeCalendar.d.ts +1 -2
- package/DateRangeCalendar/DateRangeCalendar.js +23 -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 +12 -2
- 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 +3 -5
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +12 -2
- 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 +2 -2
- 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 +20 -14
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +6 -7
- package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +15 -13
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +4 -4
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -2
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -15
- 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/useMultiInputDateTimeRangeField.d.ts +1 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +1 -2
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -2
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +5 -5
- 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 +10 -9
- 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 +23 -22
- package/modern/DateRangeCalendar/useDragRange.js +3 -3
- package/modern/DateRangePicker/DateRangePicker.js +12 -8
- package/modern/DateRangePicker/DateRangePickerToolbar.js +12 -2
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -2
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +12 -2
- 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 +20 -14
- package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +4 -4
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -15
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +5 -5
- 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 +22 -21
- package/node/DateRangeCalendar/useDragRange.js +3 -3
- package/node/DateRangePicker/DateRangePicker.js +12 -8
- package/node/DateRangePicker/DateRangePickerToolbar.js +11 -1
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +1 -1
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +11 -1
- 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 +19 -13
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +3 -3
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +19 -13
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +4 -4
- 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 +5 -5
- 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
|
@@ -2,52 +2,41 @@ import * as React from 'react';
|
|
|
2
2
|
import { SxProps } from '@mui/system';
|
|
3
3
|
import { SlotComponentProps } from '@mui/utils';
|
|
4
4
|
import { Theme } from '@mui/material/styles';
|
|
5
|
-
import {
|
|
5
|
+
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
6
|
+
import { PickerOwnerState, PickerValidDate, TimezoneProps } from '@mui/x-date-pickers/models';
|
|
6
7
|
import { PickersCalendarHeader, PickersCalendarHeaderSlots, PickersCalendarHeaderSlotProps } from '@mui/x-date-pickers/PickersCalendarHeader';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { PickerDayOwnerState } from '@mui/x-date-pickers/DateCalendar';
|
|
9
|
+
import { BaseDateValidationProps, ExportedDayCalendarProps, DayCalendarSlots, DayCalendarSlotProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, ExportedUseViewsOptions, PickerRangeValue, FormProps } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { RangePosition } from '../models';
|
|
10
11
|
import { DateRangeCalendarClasses } from './dateRangeCalendarClasses';
|
|
11
12
|
import { DateRangePickerDay, DateRangePickerDayProps } from '../DateRangePickerDay';
|
|
12
13
|
import { UseRangePositionProps } from '../internals/hooks/useRangePosition';
|
|
13
14
|
import { PickersRangeCalendarHeaderProps } from '../PickersRangeCalendarHeader';
|
|
14
|
-
|
|
15
|
+
import { ExportedValidateDateRangeProps } from '../validation/validateDateRange';
|
|
16
|
+
export interface DateRangeCalendarSlots extends PickersArrowSwitcherSlots, Omit<DayCalendarSlots, 'day'>, PickersCalendarHeaderSlots {
|
|
15
17
|
/**
|
|
16
18
|
* Custom component for calendar header.
|
|
17
19
|
* Check the [PickersCalendarHeader](https://mui.com/x/api/date-pickers/pickers-calendar-header/) component.
|
|
18
20
|
* @default PickersCalendarHeader
|
|
19
21
|
*/
|
|
20
|
-
calendarHeader?: React.ElementType<PickersRangeCalendarHeaderProps
|
|
22
|
+
calendarHeader?: React.ElementType<PickersRangeCalendarHeaderProps>;
|
|
21
23
|
/**
|
|
22
24
|
* Custom component for day in range pickers.
|
|
23
25
|
* Check the [DateRangePickersDay](https://mui.com/x/api/date-pickers/date-range-picker-day/) component.
|
|
24
26
|
* @default DateRangePickersDay
|
|
25
27
|
*/
|
|
26
|
-
day?: React.ElementType<DateRangePickerDayProps
|
|
28
|
+
day?: React.ElementType<DateRangePickerDayProps>;
|
|
27
29
|
}
|
|
28
|
-
export interface DateRangeCalendarSlotProps
|
|
29
|
-
calendarHeader?: SlotComponentProps<typeof PickersCalendarHeader, {},
|
|
30
|
-
day?: SlotComponentProps<typeof DateRangePickerDay, {},
|
|
31
|
-
day: TDate;
|
|
32
|
-
selected: boolean;
|
|
33
|
-
}>;
|
|
30
|
+
export interface DateRangeCalendarSlotProps extends PickersArrowSwitcherSlotProps, Omit<DayCalendarSlotProps, 'day'>, PickersCalendarHeaderSlotProps {
|
|
31
|
+
calendarHeader?: SlotComponentProps<typeof PickersCalendarHeader, {}, DateRangeCalendarOwnerState>;
|
|
32
|
+
day?: SlotComponentProps<typeof DateRangePickerDay, {}, PickerDayOwnerState>;
|
|
34
33
|
}
|
|
35
|
-
export interface ExportedDateRangeCalendarProps
|
|
34
|
+
export interface ExportedDateRangeCalendarProps extends ExportedDayCalendarProps, ExportedValidateDateRangeProps, TimezoneProps, FormProps {
|
|
36
35
|
/**
|
|
37
36
|
* If `true`, after selecting `start` date calendar will not automatically switch to the month of `end` date.
|
|
38
37
|
* @default false
|
|
39
38
|
*/
|
|
40
39
|
disableAutoMonthSwitching?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* If `true`, the picker and text field are disabled.
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
45
|
-
disabled?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Make picker read only.
|
|
48
|
-
* @default false
|
|
49
|
-
*/
|
|
50
|
-
readOnly?: boolean;
|
|
51
40
|
/**
|
|
52
41
|
* If `true`, disable heavy animations.
|
|
53
42
|
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
@@ -55,10 +44,9 @@ export interface ExportedDateRangeCalendarProps<TDate extends PickerValidDate> e
|
|
|
55
44
|
reduceAnimations?: boolean;
|
|
56
45
|
/**
|
|
57
46
|
* Callback fired on month change.
|
|
58
|
-
* @
|
|
59
|
-
* @param {TDate} month The new month.
|
|
47
|
+
* @param {PickerValidDate} month The new month.
|
|
60
48
|
*/
|
|
61
|
-
onMonthChange?: (month:
|
|
49
|
+
onMonthChange?: (month: PickerValidDate) => void;
|
|
62
50
|
/**
|
|
63
51
|
* Position the current month is rendered in.
|
|
64
52
|
* @default 1
|
|
@@ -70,22 +58,22 @@ export interface ExportedDateRangeCalendarProps<TDate extends PickerValidDate> e
|
|
|
70
58
|
*/
|
|
71
59
|
disableDragEditing?: boolean;
|
|
72
60
|
}
|
|
73
|
-
export interface DateRangeCalendarProps
|
|
61
|
+
export interface DateRangeCalendarProps extends ExportedDateRangeCalendarProps, UseRangePositionProps, ExportedUseViewsOptions<PickerRangeValue, 'day'> {
|
|
74
62
|
/**
|
|
75
63
|
* The selected value.
|
|
76
64
|
* Used when the component is controlled.
|
|
77
65
|
*/
|
|
78
|
-
value?:
|
|
66
|
+
value?: PickerRangeValue;
|
|
79
67
|
/**
|
|
80
68
|
* The default selected value.
|
|
81
69
|
* Used when the component is not controlled.
|
|
82
70
|
*/
|
|
83
|
-
defaultValue?:
|
|
71
|
+
defaultValue?: PickerRangeValue;
|
|
84
72
|
/**
|
|
85
73
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
86
74
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`.
|
|
87
75
|
*/
|
|
88
|
-
referenceDate?:
|
|
76
|
+
referenceDate?: PickerValidDate;
|
|
89
77
|
/**
|
|
90
78
|
* The number of calendars to render.
|
|
91
79
|
* @default 2
|
|
@@ -104,12 +92,12 @@ export interface DateRangeCalendarProps<TDate extends PickerValidDate> extends E
|
|
|
104
92
|
* Overridable component slots.
|
|
105
93
|
* @default {}
|
|
106
94
|
*/
|
|
107
|
-
slots?: DateRangeCalendarSlots
|
|
95
|
+
slots?: DateRangeCalendarSlots;
|
|
108
96
|
/**
|
|
109
97
|
* The props used for each component slot.
|
|
110
98
|
* @default {}
|
|
111
99
|
*/
|
|
112
|
-
slotProps?: DateRangeCalendarSlotProps
|
|
100
|
+
slotProps?: DateRangeCalendarSlotProps;
|
|
113
101
|
/**
|
|
114
102
|
* Range positions available for selection.
|
|
115
103
|
* This list is checked against when checking if a next range position can be selected.
|
|
@@ -119,7 +107,7 @@ export interface DateRangeCalendarProps<TDate extends PickerValidDate> extends E
|
|
|
119
107
|
*/
|
|
120
108
|
availableRangePositions?: RangePosition[];
|
|
121
109
|
}
|
|
122
|
-
export interface DateRangeCalendarOwnerState
|
|
123
|
-
|
|
110
|
+
export interface DateRangeCalendarOwnerState extends PickerOwnerState {
|
|
111
|
+
isDraggingDay: boolean;
|
|
124
112
|
}
|
|
125
|
-
export type DateRangeCalendarDefaultizedProps
|
|
113
|
+
export type DateRangeCalendarDefaultizedProps = DefaultizedProps<DateRangeCalendarProps, 'views' | 'openTo' | 'reduceAnimations' | 'calendars' | 'disableDragEditing' | 'availableRangePositions' | keyof BaseDateValidationProps>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MuiPickersAdapter, PickersTimezone, PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
4
|
+
import { RangePosition } from '../models';
|
|
5
|
+
interface UseDragRangeParams {
|
|
5
6
|
disableDragEditing?: boolean;
|
|
6
|
-
utils: MuiPickersAdapter
|
|
7
|
-
setRangeDragDay: (value:
|
|
7
|
+
utils: MuiPickersAdapter;
|
|
8
|
+
setRangeDragDay: (value: PickerValidDate | null) => void;
|
|
8
9
|
setIsDragging: (value: boolean) => void;
|
|
9
10
|
isDragging: boolean;
|
|
10
11
|
onDatePositionChange: (position: RangePosition) => void;
|
|
11
|
-
onDrop: (newDate:
|
|
12
|
-
dateRange:
|
|
12
|
+
onDrop: (newDate: PickerValidDate) => void;
|
|
13
|
+
dateRange: PickerRangeValue;
|
|
13
14
|
timezone: PickersTimezone;
|
|
14
15
|
}
|
|
15
16
|
interface UseDragRangeEvents {
|
|
@@ -23,10 +24,10 @@ interface UseDragRangeEvents {
|
|
|
23
24
|
onTouchMove?: React.TouchEventHandler<HTMLButtonElement>;
|
|
24
25
|
onTouchEnd?: React.TouchEventHandler<HTMLButtonElement>;
|
|
25
26
|
}
|
|
26
|
-
interface UseDragRangeResponse
|
|
27
|
+
interface UseDragRangeResponse extends UseDragRangeEvents {
|
|
27
28
|
isDragging: boolean;
|
|
28
|
-
rangeDragDay:
|
|
29
|
+
rangeDragDay: PickerValidDate | null;
|
|
29
30
|
draggingDatePosition: RangePosition | null;
|
|
30
31
|
}
|
|
31
|
-
export declare const useDragRange:
|
|
32
|
+
export declare const useDragRange: ({ disableDragEditing, utils, onDatePositionChange, onDrop, dateRange, timezone, }: Omit<UseDragRangeParams, "setRangeDragDay" | "setIsDragging" | "isDragging">) => UseDragRangeResponse;
|
|
32
33
|
export {};
|
|
@@ -214,9 +214,9 @@ export const useDragRange = ({
|
|
|
214
214
|
}) => {
|
|
215
215
|
const [isDragging, setIsDragging] = React.useState(false);
|
|
216
216
|
const [rangeDragDay, setRangeDragDay] = React.useState(null);
|
|
217
|
-
const handleRangeDragDayChange = useEventCallback(
|
|
218
|
-
if (!utils.isEqual(
|
|
219
|
-
setRangeDragDay(
|
|
217
|
+
const handleRangeDragDayChange = useEventCallback(newValue => {
|
|
218
|
+
if (!utils.isEqual(newValue, rangeDragDay)) {
|
|
219
|
+
setRangeDragDay(newValue);
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
const draggingDatePosition = React.useMemo(() => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { DateRangePickerProps } from './DateRangePicker.types';
|
|
4
|
-
type DatePickerComponent = (<
|
|
3
|
+
type DatePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DateRangePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -74,9 +74,9 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
74
74
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
75
75
|
/**
|
|
76
76
|
* Formats the day of week displayed in the calendar header.
|
|
77
|
-
* @param {
|
|
77
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
78
78
|
* @returns {string} The name to display.
|
|
79
|
-
* @default (date:
|
|
79
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
80
80
|
*/
|
|
81
81
|
dayOfWeekFormatter: PropTypes.func,
|
|
82
82
|
/**
|
|
@@ -102,7 +102,8 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
102
102
|
*/
|
|
103
103
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
104
104
|
/**
|
|
105
|
-
* If `true`, the
|
|
105
|
+
* If `true`, the component is disabled.
|
|
106
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
106
107
|
* @default false
|
|
107
108
|
*/
|
|
108
109
|
disabled: PropTypes.bool,
|
|
@@ -136,7 +137,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
136
137
|
*/
|
|
137
138
|
displayWeekNumber: PropTypes.bool,
|
|
138
139
|
/**
|
|
139
|
-
* @default
|
|
140
|
+
* @default true
|
|
140
141
|
*/
|
|
141
142
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
142
143
|
/**
|
|
@@ -224,8 +225,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
224
225
|
onError: PropTypes.func,
|
|
225
226
|
/**
|
|
226
227
|
* Callback fired on month change.
|
|
227
|
-
* @
|
|
228
|
-
* @param {TDate} month The new month.
|
|
228
|
+
* @param {PickerValidDate} month The new month.
|
|
229
229
|
*/
|
|
230
230
|
onMonthChange: PropTypes.func,
|
|
231
231
|
/**
|
|
@@ -253,6 +253,11 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
253
253
|
* Used when the component position is controlled.
|
|
254
254
|
*/
|
|
255
255
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
256
|
+
/**
|
|
257
|
+
* If `true`, the component is read-only.
|
|
258
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
259
|
+
* @default false
|
|
260
|
+
*/
|
|
256
261
|
readOnly: PropTypes.bool,
|
|
257
262
|
/**
|
|
258
263
|
* If `true`, disable heavy animations.
|
|
@@ -285,8 +290,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
285
290
|
*
|
|
286
291
|
* 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.
|
|
287
292
|
*
|
|
288
|
-
* @
|
|
289
|
-
* @param {TDate} day The date to test.
|
|
293
|
+
* @param {PickerValidDate} day The date to test.
|
|
290
294
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
291
295
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
292
296
|
*/
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseSingleInputFieldProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
2
2
|
import { DesktopDateRangePickerProps, DesktopDateRangePickerSlots, DesktopDateRangePickerSlotProps } from '../DesktopDateRangePicker';
|
|
3
3
|
import { MobileDateRangePickerProps, MobileDateRangePickerSlots, MobileDateRangePickerSlotProps } from '../MobileDateRangePicker';
|
|
4
|
-
|
|
4
|
+
import { DateRangeValidationError, RangeFieldSection } from '../models';
|
|
5
|
+
import { ValidateDateRangeProps } from '../validation';
|
|
6
|
+
export interface DateRangePickerSlots extends DesktopDateRangePickerSlots, MobileDateRangePickerSlots {
|
|
5
7
|
}
|
|
6
|
-
export interface DateRangePickerSlotProps<
|
|
8
|
+
export interface DateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, MobileDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure> {
|
|
7
9
|
}
|
|
8
|
-
export interface DateRangePickerProps<
|
|
10
|
+
export interface DateRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends DesktopDateRangePickerProps<TEnableAccessibleFieldDOMStructure>, MobileDateRangePickerProps<TEnableAccessibleFieldDOMStructure> {
|
|
9
11
|
/**
|
|
10
12
|
* CSS media query when `Mobile` mode will be changed to `Desktop`.
|
|
11
13
|
* @default '@media (pointer: fine)'
|
|
@@ -16,10 +18,14 @@ export interface DateRangePickerProps<TDate extends PickerValidDate, TEnableAcce
|
|
|
16
18
|
* Overridable component slots.
|
|
17
19
|
* @default {}
|
|
18
20
|
*/
|
|
19
|
-
slots?: DateRangePickerSlots
|
|
21
|
+
slots?: DateRangePickerSlots;
|
|
20
22
|
/**
|
|
21
23
|
* The props used for each component slot.
|
|
22
24
|
* @default {}
|
|
23
25
|
*/
|
|
24
|
-
slotProps?: DateRangePickerSlotProps<
|
|
26
|
+
slotProps?: DateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
25
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Props the field can receive when used inside a date range picker (<DateRangePicker />, <DesktopDateRangePicker /> or <MobileDateRangePicker /> component).
|
|
30
|
+
*/
|
|
31
|
+
export type DateRangePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateDateRangeProps & BaseSingleInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BaseToolbarProps, ExportedBaseToolbarProps } from '@mui/x-date-pickers/internals';
|
|
3
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
|
-
import { DateRange } from '../models';
|
|
2
|
+
import { BaseToolbarProps, ExportedBaseToolbarProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
5
3
|
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
6
4
|
import { DateRangePickerToolbarClasses } from './dateRangePickerToolbarClasses';
|
|
7
|
-
export interface DateRangePickerToolbarProps
|
|
5
|
+
export interface DateRangePickerToolbarProps extends ExportedDateRangePickerToolbarProps, Omit<BaseToolbarProps<PickerRangeValue, 'day'>, 'onChange' | 'isLandscape'>, Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
|
|
8
6
|
}
|
|
9
7
|
export interface ExportedDateRangePickerToolbarProps extends ExportedBaseToolbarProps {
|
|
10
8
|
/**
|
|
@@ -12,7 +10,7 @@ export interface ExportedDateRangePickerToolbarProps extends ExportedBaseToolbar
|
|
|
12
10
|
*/
|
|
13
11
|
classes?: Partial<DateRangePickerToolbarClasses>;
|
|
14
12
|
}
|
|
15
|
-
type DateRangePickerToolbarComponent = (
|
|
13
|
+
type DateRangePickerToolbarComponent = ((props: DateRangePickerToolbarProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
16
14
|
propTypes?: any;
|
|
17
15
|
};
|
|
18
16
|
/**
|
|
@@ -10,7 +10,7 @@ import Typography from '@mui/material/Typography';
|
|
|
10
10
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
11
11
|
import composeClasses from '@mui/utils/composeClasses';
|
|
12
12
|
import { PickersToolbar, PickersToolbarButton, useUtils } from '@mui/x-date-pickers/internals';
|
|
13
|
-
import {
|
|
13
|
+
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
14
14
|
import { getDateRangePickerToolbarUtilityClass } from "./dateRangePickerToolbarClasses.js";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const useUtilityClasses = ownerState => {
|
|
@@ -59,7 +59,7 @@ const DateRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateRangeP
|
|
|
59
59
|
className
|
|
60
60
|
} = props,
|
|
61
61
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
62
|
-
const translations =
|
|
62
|
+
const translations = usePickerTranslations();
|
|
63
63
|
const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) : translations.start;
|
|
64
64
|
const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) : translations.end;
|
|
65
65
|
const ownerState = props;
|
|
@@ -99,6 +99,11 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
99
99
|
*/
|
|
100
100
|
classes: PropTypes.object,
|
|
101
101
|
className: PropTypes.string,
|
|
102
|
+
/**
|
|
103
|
+
* If `true`, the component is disabled.
|
|
104
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
102
107
|
disabled: PropTypes.bool,
|
|
103
108
|
/**
|
|
104
109
|
* If `true`, show the toolbar even in desktop mode.
|
|
@@ -113,6 +118,11 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
113
118
|
*/
|
|
114
119
|
onViewChange: PropTypes.func.isRequired,
|
|
115
120
|
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
121
|
+
/**
|
|
122
|
+
* If `true`, the component is read-only.
|
|
123
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
116
126
|
readOnly: PropTypes.bool,
|
|
117
127
|
/**
|
|
118
128
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DateRangePicker } from './DateRangePicker';
|
|
2
|
-
export type { DateRangePickerProps, DateRangePickerSlots, DateRangePickerSlotProps, } from './DateRangePicker.types';
|
|
2
|
+
export type { DateRangePickerProps, DateRangePickerSlots, DateRangePickerSlotProps, DateRangePickerFieldProps, } from './DateRangePicker.types';
|
|
3
3
|
export { DateRangePickerToolbar } from './DateRangePickerToolbar';
|
|
4
4
|
export type { DateRangePickerToolbarProps } from './DateRangePickerToolbar';
|
|
5
5
|
export { getDateRangePickerToolbarUtilityClass, dateRangePickerToolbarClasses, } from './dateRangePickerToolbarClasses';
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
2
3
|
import { LocalizedComponent } from '@mui/x-date-pickers/locales';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { DateRangeValidationError, DateRange } from '../models';
|
|
4
|
+
import { BaseDateValidationProps, BasePickerInputProps, PickerViewRendererLookup, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { DateRangeValidationError } from '../models';
|
|
6
6
|
import { DateRangeCalendarSlots, DateRangeCalendarSlotProps, ExportedDateRangeCalendarProps } from '../DateRangeCalendar';
|
|
7
7
|
import { DateRangePickerToolbarProps, ExportedDateRangePickerToolbarProps } from './DateRangePickerToolbar';
|
|
8
8
|
import { DateRangeViewRendererProps } from '../dateRangeViewRenderers';
|
|
9
|
-
export interface BaseDateRangePickerSlots
|
|
9
|
+
export interface BaseDateRangePickerSlots extends DateRangeCalendarSlots {
|
|
10
10
|
/**
|
|
11
11
|
* Custom component for the toolbar rendered above the views.
|
|
12
12
|
* @default DateTimePickerToolbar
|
|
13
13
|
*/
|
|
14
|
-
toolbar?: React.JSXElementConstructor<DateRangePickerToolbarProps
|
|
14
|
+
toolbar?: React.JSXElementConstructor<DateRangePickerToolbarProps>;
|
|
15
15
|
}
|
|
16
|
-
export interface BaseDateRangePickerSlotProps
|
|
16
|
+
export interface BaseDateRangePickerSlotProps extends DateRangeCalendarSlotProps {
|
|
17
17
|
toolbar?: ExportedDateRangePickerToolbarProps;
|
|
18
18
|
}
|
|
19
|
-
export interface BaseDateRangePickerProps
|
|
19
|
+
export interface BaseDateRangePickerProps extends Omit<BasePickerInputProps<PickerRangeValue, 'day', DateRangeValidationError>, 'view' | 'views' | 'openTo' | 'onViewChange' | 'orientation'>, ExportedDateRangeCalendarProps {
|
|
20
20
|
/**
|
|
21
21
|
* Overridable component slots.
|
|
22
22
|
* @default {}
|
|
23
23
|
*/
|
|
24
|
-
slots?: BaseDateRangePickerSlots
|
|
24
|
+
slots?: BaseDateRangePickerSlots;
|
|
25
25
|
/**
|
|
26
26
|
* The props used for each component slot.
|
|
27
27
|
* @default {}
|
|
28
28
|
*/
|
|
29
|
-
slotProps?: BaseDateRangePickerSlotProps
|
|
29
|
+
slotProps?: BaseDateRangePickerSlotProps;
|
|
30
30
|
/**
|
|
31
31
|
* Define custom view renderers for each section.
|
|
32
32
|
* If `null`, the section will only have field editing.
|
|
33
33
|
* If `undefined`, internally defined view will be used.
|
|
34
34
|
*/
|
|
35
|
-
viewRenderers?: Partial<PickerViewRendererLookup<
|
|
35
|
+
viewRenderers?: Partial<PickerViewRendererLookup<PickerRangeValue, 'day', DateRangeViewRendererProps<'day'>, {}>>;
|
|
36
36
|
}
|
|
37
|
-
type UseDateRangePickerDefaultizedProps<
|
|
38
|
-
export declare function useDateRangePickerDefaultizedProps<
|
|
37
|
+
type UseDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps> = LocalizedComponent<DefaultizedProps<Props, keyof BaseDateValidationProps>>;
|
|
38
|
+
export declare function useDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps>(props: Props, name: string): UseDateRangePickerDefaultizedProps<Props>;
|
|
39
39
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { PickersDayProps } from '@mui/x-date-pickers/PickersDay';
|
|
4
3
|
import { DateRangePickerDayClasses } from './dateRangePickerDayClasses';
|
|
5
|
-
export interface DateRangePickerDayProps
|
|
4
|
+
export interface DateRangePickerDayProps extends Omit<PickersDayProps, 'classes' | 'onBlur' | 'onFocus' | 'onKeyDown'> {
|
|
6
5
|
/**
|
|
7
6
|
* Set to `true` if the `day` is in a highlighted date range.
|
|
8
7
|
*/
|
|
@@ -41,7 +40,7 @@ export interface DateRangePickerDayProps<TDate extends PickerValidDate> extends
|
|
|
41
40
|
*/
|
|
42
41
|
draggable?: boolean;
|
|
43
42
|
}
|
|
44
|
-
type DateRangePickerDayComponent =
|
|
43
|
+
type DateRangePickerDayComponent = (props: DateRangePickerDayProps & React.RefAttributes<HTMLButtonElement>) => React.JSX.Element;
|
|
45
44
|
/**
|
|
46
45
|
* Demos:
|
|
47
46
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { DateTimeRangePickerProps } from './DateTimeRangePicker.types';
|
|
4
|
-
type DateTimeRangePickerComponent = (<
|
|
3
|
+
type DateTimeRangePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -79,9 +79,9 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
79
79
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
80
80
|
/**
|
|
81
81
|
* Formats the day of week displayed in the calendar header.
|
|
82
|
-
* @param {
|
|
82
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
83
83
|
* @returns {string} The name to display.
|
|
84
|
-
* @default (date:
|
|
84
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
85
85
|
*/
|
|
86
86
|
dayOfWeekFormatter: PropTypes.func,
|
|
87
87
|
/**
|
|
@@ -107,7 +107,8 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
107
107
|
*/
|
|
108
108
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
109
109
|
/**
|
|
110
|
-
* If `true`, the
|
|
110
|
+
* If `true`, the component is disabled.
|
|
111
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
111
112
|
* @default false
|
|
112
113
|
*/
|
|
113
114
|
disabled: PropTypes.bool,
|
|
@@ -146,7 +147,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
146
147
|
*/
|
|
147
148
|
displayWeekNumber: PropTypes.bool,
|
|
148
149
|
/**
|
|
149
|
-
* @default
|
|
150
|
+
* @default true
|
|
150
151
|
*/
|
|
151
152
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
152
153
|
/**
|
|
@@ -257,8 +258,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
257
258
|
onError: PropTypes.func,
|
|
258
259
|
/**
|
|
259
260
|
* Callback fired on month change.
|
|
260
|
-
* @
|
|
261
|
-
* @param {TDate} month The new month.
|
|
261
|
+
* @param {PickerValidDate} month The new month.
|
|
262
262
|
*/
|
|
263
263
|
onMonthChange: PropTypes.func,
|
|
264
264
|
/**
|
|
@@ -298,6 +298,11 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
298
298
|
* Used when the component position is controlled.
|
|
299
299
|
*/
|
|
300
300
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
301
|
+
/**
|
|
302
|
+
* If `true`, the component is read-only.
|
|
303
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
304
|
+
* @default false
|
|
305
|
+
*/
|
|
301
306
|
readOnly: PropTypes.bool,
|
|
302
307
|
/**
|
|
303
308
|
* If `true`, disable heavy animations.
|
|
@@ -330,16 +335,14 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
330
335
|
*
|
|
331
336
|
* 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.
|
|
332
337
|
*
|
|
333
|
-
* @
|
|
334
|
-
* @param {TDate} day The date to test.
|
|
338
|
+
* @param {PickerValidDate} day The date to test.
|
|
335
339
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
336
340
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
337
341
|
*/
|
|
338
342
|
shouldDisableDate: PropTypes.func,
|
|
339
343
|
/**
|
|
340
344
|
* Disable specific time.
|
|
341
|
-
* @
|
|
342
|
-
* @param {TDate} value The value to check.
|
|
345
|
+
* @param {PickerValidDate} value The value to check.
|
|
343
346
|
* @param {TimeView} view The clock type of the timeValue.
|
|
344
347
|
* @returns {boolean} If `true` the time will be disabled.
|
|
345
348
|
*/
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseSingleInputFieldProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
2
2
|
import { DesktopDateTimeRangePickerProps, DesktopDateTimeRangePickerSlots, DesktopDateTimeRangePickerSlotProps } from '../DesktopDateTimeRangePicker';
|
|
3
3
|
import { MobileDateTimeRangePickerProps, MobileDateTimeRangePickerSlots, MobileDateTimeRangePickerSlotProps } from '../MobileDateTimeRangePicker';
|
|
4
|
-
|
|
4
|
+
import { DateTimeRangeValidationError, RangeFieldSection } from '../models';
|
|
5
|
+
import type { ValidateDateTimeRangeProps } from '../validation';
|
|
6
|
+
export interface DateTimeRangePickerSlots extends DesktopDateTimeRangePickerSlots, MobileDateTimeRangePickerSlots {
|
|
5
7
|
}
|
|
6
|
-
export interface DateTimeRangePickerSlotProps<
|
|
8
|
+
export interface DateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, MobileDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure> {
|
|
7
9
|
}
|
|
8
|
-
export interface DateTimeRangePickerProps<
|
|
10
|
+
export interface DateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends DesktopDateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure>, MobileDateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure> {
|
|
9
11
|
/**
|
|
10
12
|
* CSS media query when `Mobile` mode will be changed to `Desktop`.
|
|
11
13
|
* @default '@media (pointer: fine)'
|
|
@@ -16,10 +18,14 @@ export interface DateTimeRangePickerProps<TDate extends PickerValidDate, TEnable
|
|
|
16
18
|
* Overridable component slots.
|
|
17
19
|
* @default {}
|
|
18
20
|
*/
|
|
19
|
-
slots?: DateTimeRangePickerSlots
|
|
21
|
+
slots?: DateTimeRangePickerSlots;
|
|
20
22
|
/**
|
|
21
23
|
* The props used for each component slot.
|
|
22
24
|
* @default {}
|
|
23
25
|
*/
|
|
24
|
-
slotProps?: DateTimeRangePickerSlotProps<
|
|
26
|
+
slotProps?: DateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
25
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Props the field can receive when used inside a date time range picker (<DateTimeRangePicker />, <DesktopDateTimeRangePicker /> or <MobileDateTimeRangePicker /> component).
|
|
30
|
+
*/
|
|
31
|
+
export type DateTimeRangePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateDateTimeRangeProps & BaseSingleInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { DateOrTimeViewWithMeridiem, BaseTabsProps, ExportedBaseTabsProps } from '@mui/x-date-pickers/internals';
|
|
4
3
|
import { DateTimeRangePickerTabsClasses } from './dateTimeRangePickerTabsClasses';
|
|
5
4
|
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
@@ -27,7 +26,7 @@ export interface ExportedDateTimeRangePickerTabsProps extends ExportedBaseTabsPr
|
|
|
27
26
|
export interface DateTimeRangePickerTabsProps extends ExportedDateTimeRangePickerTabsProps, BaseTabsProps<DateOrTimeViewWithMeridiem>, Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
|
|
28
27
|
}
|
|
29
28
|
declare const DateTimeRangePickerTabs: {
|
|
30
|
-
|
|
29
|
+
(inProps: DateTimeRangePickerTabsProps): React.JSX.Element | null;
|
|
31
30
|
propTypes: any;
|
|
32
31
|
};
|
|
33
32
|
export { DateTimeRangePickerTabs };
|
|
@@ -8,7 +8,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
8
8
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
9
9
|
import { TimeIcon, DateRangeIcon, ArrowLeftIcon, ArrowRightIcon } from '@mui/x-date-pickers/icons';
|
|
10
10
|
import { isDatePickerView } from '@mui/x-date-pickers/internals';
|
|
11
|
-
import {
|
|
11
|
+
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
12
12
|
import IconButton from '@mui/material/IconButton';
|
|
13
13
|
import Button from '@mui/material/Button';
|
|
14
14
|
import { getDateTimeRangePickerTabsUtilityClass } from "./dateTimeRangePickerTabsClasses.js";
|
|
@@ -81,7 +81,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
81
81
|
className,
|
|
82
82
|
sx
|
|
83
83
|
} = props;
|
|
84
|
-
const translations =
|
|
84
|
+
const translations = usePickerTranslations();
|
|
85
85
|
const classes = useUtilityClasses(props);
|
|
86
86
|
const value = React.useMemo(() => viewToTab(view, rangePosition), [view, rangePosition]);
|
|
87
87
|
const isPreviousHidden = value === 'start-date';
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { DateRange } from '../models';
|
|
2
|
+
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
|
+
import { PickerSelectionState, PickerViewRenderer, TimeViewWithMeridiem, BaseClockProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
5
4
|
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
6
|
-
export type DateTimeRangePickerTimeWrapperProps<
|
|
5
|
+
export type DateTimeRangePickerTimeWrapperProps<TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>> = Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> & Omit<TComponentProps, 'views' | 'view' | 'onViewChange' | 'value' | 'defaultValue' | 'onChange'> & {
|
|
7
6
|
view: TView;
|
|
8
7
|
onViewChange?: (view: TView) => void;
|
|
9
8
|
views: readonly TView[];
|
|
10
|
-
value?:
|
|
11
|
-
defaultValue?:
|
|
12
|
-
onChange?: (value:
|
|
13
|
-
viewRenderer?: PickerViewRenderer<
|
|
9
|
+
value?: PickerRangeValue;
|
|
10
|
+
defaultValue?: PickerRangeValue;
|
|
11
|
+
onChange?: (value: PickerRangeValue, selectionState: PickerSelectionState, selectedView: TView) => void;
|
|
12
|
+
viewRenderer?: PickerViewRenderer<PickerRangeValue, TView, TComponentProps, any> | null;
|
|
14
13
|
openTo?: TView;
|
|
15
14
|
};
|
|
16
15
|
/**
|
|
17
16
|
* @ignore - internal component.
|
|
18
17
|
*/
|
|
19
|
-
declare function DateTimeRangePickerTimeWrapper<
|
|
18
|
+
declare function DateTimeRangePickerTimeWrapper<TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>>(props: DateTimeRangePickerTimeWrapperProps<TView, TComponentProps>, ref: React.Ref<HTMLDivElement>): React.ReactNode;
|
|
20
19
|
export { DateTimeRangePickerTimeWrapper };
|