@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
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BaseToolbarProps, ExportedBaseToolbarProps, DateOrTimeViewWithMeridiem, WrapperVariant } from '@mui/x-date-pickers/internals';
|
|
3
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
|
-
import { DateRange } from '../models';
|
|
2
|
+
import { BaseToolbarProps, ExportedBaseToolbarProps, DateOrTimeViewWithMeridiem, WrapperVariant, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
5
3
|
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
6
4
|
import { DateTimeRangePickerToolbarClasses } from './dateTimeRangePickerToolbarClasses';
|
|
7
5
|
type DateTimeRangeViews = Exclude<DateOrTimeViewWithMeridiem, 'year' | 'month'>;
|
|
8
|
-
export interface DateTimeRangePickerToolbarProps
|
|
6
|
+
export interface DateTimeRangePickerToolbarProps extends BaseToolbarProps<PickerRangeValue, DateTimeRangeViews>, Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'>, ExportedDateTimeRangePickerToolbarProps {
|
|
9
7
|
ampm?: boolean;
|
|
10
8
|
toolbarVariant?: WrapperVariant;
|
|
11
9
|
}
|
|
@@ -15,7 +13,7 @@ export interface ExportedDateTimeRangePickerToolbarProps extends ExportedBaseToo
|
|
|
15
13
|
*/
|
|
16
14
|
classes?: Partial<DateTimeRangePickerToolbarClasses>;
|
|
17
15
|
}
|
|
18
|
-
type DateTimeRangePickerToolbarComponent = (
|
|
16
|
+
type DateTimeRangePickerToolbarComponent = ((props: DateTimeRangePickerToolbarProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
19
17
|
propTypes?: any;
|
|
20
18
|
};
|
|
21
19
|
declare const DateTimeRangePickerToolbar: DateTimeRangePickerToolbarComponent;
|
|
@@ -9,7 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
10
10
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
11
|
import { useUtils } from '@mui/x-date-pickers/internals';
|
|
12
|
-
import {
|
|
12
|
+
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
13
13
|
import { DateTimePickerToolbar } from '@mui/x-date-pickers/DateTimePicker';
|
|
14
14
|
import { getDateTimeRangePickerToolbarUtilityClass } from "./dateTimeRangePickerToolbarClasses.js";
|
|
15
15
|
import { calculateRangeChange } from "../internals/utils/date-range-manager.js";
|
|
@@ -105,7 +105,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
105
105
|
toolbarFormat,
|
|
106
106
|
toolbarPlaceholder
|
|
107
107
|
};
|
|
108
|
-
const translations =
|
|
108
|
+
const translations = usePickerTranslations();
|
|
109
109
|
const ownerState = props;
|
|
110
110
|
const classes = useUtilityClasses(ownerState);
|
|
111
111
|
const handleStartRangeViewChange = React.useCallback(newView => {
|
|
@@ -183,6 +183,11 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
183
183
|
*/
|
|
184
184
|
classes: PropTypes.object,
|
|
185
185
|
className: PropTypes.string,
|
|
186
|
+
/**
|
|
187
|
+
* If `true`, the component is disabled.
|
|
188
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
189
|
+
* @default false
|
|
190
|
+
*/
|
|
186
191
|
disabled: PropTypes.bool,
|
|
187
192
|
/**
|
|
188
193
|
* If `true`, show the toolbar even in desktop mode.
|
|
@@ -199,6 +204,11 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
199
204
|
*/
|
|
200
205
|
onViewChange: PropTypes.func.isRequired,
|
|
201
206
|
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
207
|
+
/**
|
|
208
|
+
* If `true`, the component is read-only.
|
|
209
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
210
|
+
* @default false
|
|
211
|
+
*/
|
|
202
212
|
readOnly: PropTypes.bool,
|
|
203
213
|
/**
|
|
204
214
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DateTimeRangePicker } from './DateTimeRangePicker';
|
|
2
|
-
export type { DateTimeRangePickerProps, DateTimeRangePickerSlots, DateTimeRangePickerSlotProps, } from './DateTimeRangePicker.types';
|
|
2
|
+
export type { DateTimeRangePickerProps, DateTimeRangePickerSlots, DateTimeRangePickerSlotProps, DateTimeRangePickerFieldProps, } from './DateTimeRangePicker.types';
|
|
3
3
|
export { DateTimeRangePickerTabs } from './DateTimeRangePickerTabs';
|
|
4
4
|
export type { ExportedDateTimeRangePickerTabsProps } from './DateTimeRangePickerTabs';
|
|
5
5
|
export { getDateTimeRangePickerTabsUtilityClass, dateTimeRangePickerTabsClasses, } from './dateTimeRangePickerTabsClasses';
|
|
@@ -1,17 +1,17 @@
|
|
|
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 { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
|
+
import { BaseDateValidationProps, BasePickerInputProps, PickerViewRendererLookup, BaseClockProps, DesktopOnlyTimePickerProps, TimeViewWithMeridiem, UseViewsOptions, DateTimeValidationProps, DateOrTimeViewWithMeridiem, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { TimeViewRendererProps } from '@mui/x-date-pickers/timeViewRenderers';
|
|
6
6
|
import { DigitalClockSlots, DigitalClockSlotProps } from '@mui/x-date-pickers/DigitalClock';
|
|
7
7
|
import { MultiSectionDigitalClockSlots, MultiSectionDigitalClockSlotProps } from '@mui/x-date-pickers/MultiSectionDigitalClock';
|
|
8
|
-
import {
|
|
8
|
+
import { DateTimeRangeValidationError } from '../models';
|
|
9
9
|
import { DateTimeRangePickerView, DateTimeRangePickerViewExternal } from '../internals/models';
|
|
10
10
|
import { DateRangeCalendarSlots, DateRangeCalendarSlotProps, ExportedDateRangeCalendarProps } from '../DateRangeCalendar';
|
|
11
11
|
import { DateTimeRangePickerToolbarProps, ExportedDateTimeRangePickerToolbarProps } from './DateTimeRangePickerToolbar';
|
|
12
12
|
import { DateRangeViewRendererProps } from '../dateRangeViewRenderers';
|
|
13
13
|
import { DateTimeRangePickerTabsProps, ExportedDateTimeRangePickerTabsProps } from './DateTimeRangePickerTabs';
|
|
14
|
-
export interface BaseDateTimeRangePickerSlots
|
|
14
|
+
export interface BaseDateTimeRangePickerSlots extends DateRangeCalendarSlots, DigitalClockSlots, MultiSectionDigitalClockSlots {
|
|
15
15
|
/**
|
|
16
16
|
* Tabs enabling toggling between date and time pickers.
|
|
17
17
|
* @default DateTimeRangePickerTabs
|
|
@@ -21,9 +21,9 @@ export interface BaseDateTimeRangePickerSlots<TDate extends PickerValidDate> ext
|
|
|
21
21
|
* Custom component for the toolbar rendered above the views.
|
|
22
22
|
* @default DateTimeRangePickerToolbar
|
|
23
23
|
*/
|
|
24
|
-
toolbar?: React.JSXElementConstructor<DateTimeRangePickerToolbarProps
|
|
24
|
+
toolbar?: React.JSXElementConstructor<DateTimeRangePickerToolbarProps>;
|
|
25
25
|
}
|
|
26
|
-
export interface BaseDateTimeRangePickerSlotProps
|
|
26
|
+
export interface BaseDateTimeRangePickerSlotProps extends DateRangeCalendarSlotProps, DigitalClockSlotProps, MultiSectionDigitalClockSlotProps {
|
|
27
27
|
/**
|
|
28
28
|
* Props passed down to the tabs component.
|
|
29
29
|
*/
|
|
@@ -33,30 +33,30 @@ export interface BaseDateTimeRangePickerSlotProps<TDate extends PickerValidDate>
|
|
|
33
33
|
*/
|
|
34
34
|
toolbar?: ExportedDateTimeRangePickerToolbarProps;
|
|
35
35
|
}
|
|
36
|
-
export type DateTimeRangePickerRenderers<
|
|
36
|
+
export type DateTimeRangePickerRenderers<TView extends DateOrTimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<PickerRangeValue, TView, Omit<DateRangeViewRendererProps<'day'>, 'view' | 'slots' | 'slotProps'> & Omit<TimeViewRendererProps<TimeViewWithMeridiem, BaseClockProps<TimeViewWithMeridiem>>, 'view' | 'slots' | 'slotProps'> & {
|
|
37
37
|
view: TView;
|
|
38
38
|
}, TAdditionalProps>;
|
|
39
|
-
export interface BaseDateTimeRangePickerProps
|
|
39
|
+
export interface BaseDateTimeRangePickerProps extends Omit<BasePickerInputProps<PickerRangeValue, DateTimeRangePickerView, DateTimeRangeValidationError>, 'orientation' | 'views' | 'openTo'>, ExportedDateRangeCalendarProps, BaseDateValidationProps, DesktopOnlyTimePickerProps, Partial<Pick<UseViewsOptions<PickerRangeValue, DateTimeRangePickerViewExternal>, 'openTo' | 'views'>>, DateTimeValidationProps {
|
|
40
40
|
/**
|
|
41
41
|
* Overridable component slots.
|
|
42
42
|
* @default {}
|
|
43
43
|
*/
|
|
44
|
-
slots?: BaseDateTimeRangePickerSlots
|
|
44
|
+
slots?: BaseDateTimeRangePickerSlots;
|
|
45
45
|
/**
|
|
46
46
|
* The props used for each component slot.
|
|
47
47
|
* @default {}
|
|
48
48
|
*/
|
|
49
|
-
slotProps?: BaseDateTimeRangePickerSlotProps
|
|
49
|
+
slotProps?: BaseDateTimeRangePickerSlotProps;
|
|
50
50
|
/**
|
|
51
51
|
* Define custom view renderers for each section.
|
|
52
52
|
* If `null`, the section will only have field editing.
|
|
53
53
|
* If `undefined`, internally defined view will be used.
|
|
54
54
|
*/
|
|
55
|
-
viewRenderers?: Partial<DateTimeRangePickerRenderers<
|
|
55
|
+
viewRenderers?: Partial<DateTimeRangePickerRenderers<DateTimeRangePickerView>>;
|
|
56
56
|
}
|
|
57
|
-
type UseDateTimeRangePickerDefaultizedProps<
|
|
57
|
+
type UseDateTimeRangePickerDefaultizedProps<Props extends BaseDateTimeRangePickerProps> = LocalizedComponent<Omit<DefaultizedProps<Props, 'openTo' | 'ampm' | keyof BaseDateValidationProps>, 'views'>> & {
|
|
58
58
|
shouldRenderTimeInASingleColumn: boolean;
|
|
59
59
|
views: readonly DateTimeRangePickerView[];
|
|
60
60
|
};
|
|
61
|
-
export declare function useDateTimeRangePickerDefaultizedProps<
|
|
61
|
+
export declare function useDateTimeRangePickerDefaultizedProps<Props extends BaseDateTimeRangePickerProps>(props: Props, name: string): UseDateTimeRangePickerDefaultizedProps<Props>;
|
|
62
62
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { DesktopDateRangePickerProps } from './DesktopDateRangePicker.types';
|
|
4
|
-
type DesktopDateRangePickerComponent = (<
|
|
3
|
+
type DesktopDateRangePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DesktopDateRangePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import { useUtils } from '@mui/x-date-pickers/internals';
|
|
6
7
|
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
7
8
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
8
9
|
import { refType } from '@mui/utils';
|
|
@@ -23,6 +24,8 @@ import { validateDateRange } from "../validation/index.js";
|
|
|
23
24
|
* - [DesktopDateRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-range-picker/)
|
|
24
25
|
*/
|
|
25
26
|
const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateRangePicker(inProps, ref) {
|
|
27
|
+
const utils = useUtils();
|
|
28
|
+
|
|
26
29
|
// Props with the default values common to all date time pickers
|
|
27
30
|
const defaultizedProps = useDateRangePickerDefaultizedProps(inProps, 'MuiDesktopDateRangePicker');
|
|
28
31
|
const viewRenderers = _extends({
|
|
@@ -30,6 +33,7 @@ const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDat
|
|
|
30
33
|
}, defaultizedProps.viewRenderers);
|
|
31
34
|
const props = _extends({}, defaultizedProps, {
|
|
32
35
|
viewRenderers,
|
|
36
|
+
format: utils.formats.keyboardDate,
|
|
33
37
|
calendars: defaultizedProps.calendars ?? 2,
|
|
34
38
|
views: ['day'],
|
|
35
39
|
openTo: 'day',
|
|
@@ -85,9 +89,9 @@ DesktopDateRangePicker.propTypes = {
|
|
|
85
89
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
86
90
|
/**
|
|
87
91
|
* Formats the day of week displayed in the calendar header.
|
|
88
|
-
* @param {
|
|
92
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
89
93
|
* @returns {string} The name to display.
|
|
90
|
-
* @default (date:
|
|
94
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
91
95
|
*/
|
|
92
96
|
dayOfWeekFormatter: PropTypes.func,
|
|
93
97
|
/**
|
|
@@ -107,7 +111,8 @@ DesktopDateRangePicker.propTypes = {
|
|
|
107
111
|
*/
|
|
108
112
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
109
113
|
/**
|
|
110
|
-
* If `true`, the
|
|
114
|
+
* If `true`, the component is disabled.
|
|
115
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
111
116
|
* @default false
|
|
112
117
|
*/
|
|
113
118
|
disabled: PropTypes.bool,
|
|
@@ -141,7 +146,7 @@ DesktopDateRangePicker.propTypes = {
|
|
|
141
146
|
*/
|
|
142
147
|
displayWeekNumber: PropTypes.bool,
|
|
143
148
|
/**
|
|
144
|
-
* @default
|
|
149
|
+
* @default true
|
|
145
150
|
*/
|
|
146
151
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
147
152
|
/**
|
|
@@ -229,8 +234,7 @@ DesktopDateRangePicker.propTypes = {
|
|
|
229
234
|
onError: PropTypes.func,
|
|
230
235
|
/**
|
|
231
236
|
* Callback fired on month change.
|
|
232
|
-
* @
|
|
233
|
-
* @param {TDate} month The new month.
|
|
237
|
+
* @param {PickerValidDate} month The new month.
|
|
234
238
|
*/
|
|
235
239
|
onMonthChange: PropTypes.func,
|
|
236
240
|
/**
|
|
@@ -258,6 +262,11 @@ DesktopDateRangePicker.propTypes = {
|
|
|
258
262
|
* Used when the component position is controlled.
|
|
259
263
|
*/
|
|
260
264
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
265
|
+
/**
|
|
266
|
+
* If `true`, the component is read-only.
|
|
267
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
268
|
+
* @default false
|
|
269
|
+
*/
|
|
261
270
|
readOnly: PropTypes.bool,
|
|
262
271
|
/**
|
|
263
272
|
* If `true`, disable heavy animations.
|
|
@@ -290,8 +299,7 @@ DesktopDateRangePicker.propTypes = {
|
|
|
290
299
|
*
|
|
291
300
|
* 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.
|
|
292
301
|
*
|
|
293
|
-
* @
|
|
294
|
-
* @param {TDate} day The date to test.
|
|
302
|
+
* @param {PickerValidDate} day The date to test.
|
|
295
303
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
296
304
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
297
305
|
*/
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { MakeOptional } from '@mui/x-
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
2
|
import { UseDesktopRangePickerSlots, UseDesktopRangePickerSlotProps, DesktopRangeOnlyPickerProps } from '../internals/hooks/useDesktopRangePicker';
|
|
4
3
|
import { BaseDateRangePickerProps, BaseDateRangePickerSlots, BaseDateRangePickerSlotProps } from '../DateRangePicker/shared';
|
|
5
|
-
export interface DesktopDateRangePickerSlots
|
|
4
|
+
export interface DesktopDateRangePickerSlots extends BaseDateRangePickerSlots, MakeOptional<UseDesktopRangePickerSlots<'day'>, 'field'> {
|
|
6
5
|
}
|
|
7
|
-
export interface DesktopDateRangePickerSlotProps<
|
|
6
|
+
export interface DesktopDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateRangePickerSlotProps, Omit<UseDesktopRangePickerSlotProps<'day', TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
|
|
8
7
|
}
|
|
9
|
-
export interface DesktopDateRangePickerProps<
|
|
8
|
+
export interface DesktopDateRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseDateRangePickerProps, DesktopRangeOnlyPickerProps {
|
|
10
9
|
/**
|
|
11
10
|
* The number of calendars to render on **desktop**.
|
|
12
11
|
* @default 2
|
|
@@ -16,10 +15,10 @@ export interface DesktopDateRangePickerProps<TDate extends PickerValidDate, TEna
|
|
|
16
15
|
* Overridable component slots.
|
|
17
16
|
* @default {}
|
|
18
17
|
*/
|
|
19
|
-
slots?: DesktopDateRangePickerSlots
|
|
18
|
+
slots?: DesktopDateRangePickerSlots;
|
|
20
19
|
/**
|
|
21
20
|
* The props used for each component slot.
|
|
22
21
|
* @default {}
|
|
23
22
|
*/
|
|
24
|
-
slotProps?: DesktopDateRangePickerSlotProps<
|
|
23
|
+
slotProps?: DesktopDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
25
24
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { DesktopDateTimeRangePickerProps } from './DesktopDateTimeRangePicker.types';
|
|
4
|
-
type DesktopDateRangePickerComponent = (<
|
|
3
|
+
type DesktopDateRangePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DesktopDateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -166,9 +166,9 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
166
166
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
167
167
|
/**
|
|
168
168
|
* Formats the day of week displayed in the calendar header.
|
|
169
|
-
* @param {
|
|
169
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
170
170
|
* @returns {string} The name to display.
|
|
171
|
-
* @default (date:
|
|
171
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
172
172
|
*/
|
|
173
173
|
dayOfWeekFormatter: PropTypes.func,
|
|
174
174
|
/**
|
|
@@ -188,7 +188,8 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
188
188
|
*/
|
|
189
189
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
190
190
|
/**
|
|
191
|
-
* If `true`, the
|
|
191
|
+
* If `true`, the component is disabled.
|
|
192
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
192
193
|
* @default false
|
|
193
194
|
*/
|
|
194
195
|
disabled: PropTypes.bool,
|
|
@@ -227,7 +228,7 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
227
228
|
*/
|
|
228
229
|
displayWeekNumber: PropTypes.bool,
|
|
229
230
|
/**
|
|
230
|
-
* @default
|
|
231
|
+
* @default true
|
|
231
232
|
*/
|
|
232
233
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
233
234
|
/**
|
|
@@ -338,8 +339,7 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
338
339
|
onError: PropTypes.func,
|
|
339
340
|
/**
|
|
340
341
|
* Callback fired on month change.
|
|
341
|
-
* @
|
|
342
|
-
* @param {TDate} month The new month.
|
|
342
|
+
* @param {PickerValidDate} month The new month.
|
|
343
343
|
*/
|
|
344
344
|
onMonthChange: PropTypes.func,
|
|
345
345
|
/**
|
|
@@ -379,6 +379,11 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
379
379
|
* Used when the component position is controlled.
|
|
380
380
|
*/
|
|
381
381
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
382
|
+
/**
|
|
383
|
+
* If `true`, the component is read-only.
|
|
384
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
385
|
+
* @default false
|
|
386
|
+
*/
|
|
382
387
|
readOnly: PropTypes.bool,
|
|
383
388
|
/**
|
|
384
389
|
* If `true`, disable heavy animations.
|
|
@@ -411,16 +416,14 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
411
416
|
*
|
|
412
417
|
* 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.
|
|
413
418
|
*
|
|
414
|
-
* @
|
|
415
|
-
* @param {TDate} day The date to test.
|
|
419
|
+
* @param {PickerValidDate} day The date to test.
|
|
416
420
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
417
421
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
418
422
|
*/
|
|
419
423
|
shouldDisableDate: PropTypes.func,
|
|
420
424
|
/**
|
|
421
425
|
* Disable specific time.
|
|
422
|
-
* @
|
|
423
|
-
* @param {TDate} value The value to check.
|
|
426
|
+
* @param {PickerValidDate} value The value to check.
|
|
424
427
|
* @param {TimeView} view The clock type of the timeValue.
|
|
425
428
|
* @returns {boolean} If `true` the time will be disabled.
|
|
426
429
|
*/
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { MakeOptional } from '@mui/x-
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
2
|
import { UseDesktopRangePickerSlots, UseDesktopRangePickerSlotProps, DesktopRangeOnlyPickerProps } from '../internals/hooks/useDesktopRangePicker';
|
|
4
3
|
import { BaseDateTimeRangePickerProps, BaseDateTimeRangePickerSlots, BaseDateTimeRangePickerSlotProps } from '../DateTimeRangePicker/shared';
|
|
5
4
|
import { DateTimeRangePickerView } from '../internals/models';
|
|
6
|
-
export interface DesktopDateTimeRangePickerSlots
|
|
5
|
+
export interface DesktopDateTimeRangePickerSlots extends BaseDateTimeRangePickerSlots, MakeOptional<UseDesktopRangePickerSlots<DateTimeRangePickerView>, 'field'> {
|
|
7
6
|
}
|
|
8
|
-
export interface DesktopDateTimeRangePickerSlotProps<
|
|
7
|
+
export interface DesktopDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateTimeRangePickerSlotProps, Omit<UseDesktopRangePickerSlotProps<DateTimeRangePickerView, TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
|
|
9
8
|
}
|
|
10
|
-
export interface DesktopDateTimeRangePickerProps<
|
|
9
|
+
export interface DesktopDateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseDateTimeRangePickerProps, DesktopRangeOnlyPickerProps {
|
|
11
10
|
/**
|
|
12
11
|
* The number of calendars to render on **desktop**.
|
|
13
12
|
* @default 1
|
|
@@ -17,10 +16,10 @@ export interface DesktopDateTimeRangePickerProps<TDate extends PickerValidDate,
|
|
|
17
16
|
* Overridable component slots.
|
|
18
17
|
* @default {}
|
|
19
18
|
*/
|
|
20
|
-
slots?: DesktopDateTimeRangePickerSlots
|
|
19
|
+
slots?: DesktopDateTimeRangePickerSlots;
|
|
21
20
|
/**
|
|
22
21
|
* The props used for each component slot.
|
|
23
22
|
* @default {}
|
|
24
23
|
*/
|
|
25
|
-
slotProps?: DesktopDateTimeRangePickerSlotProps<
|
|
24
|
+
slotProps?: DesktopDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
26
25
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { MobileDateRangePickerProps } from './MobileDateRangePicker.types';
|
|
4
|
-
type MobileDateRangePickerComponent = (<
|
|
3
|
+
type MobileDateRangePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: MobileDateRangePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import { useUtils } from '@mui/x-date-pickers/internals';
|
|
6
7
|
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
7
8
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
8
9
|
import { refType } from '@mui/utils';
|
|
@@ -23,6 +24,8 @@ import { validateDateRange } from "../validation/index.js";
|
|
|
23
24
|
* - [MobileDateRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-range-picker/)
|
|
24
25
|
*/
|
|
25
26
|
const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateRangePicker(inProps, ref) {
|
|
27
|
+
const utils = useUtils();
|
|
28
|
+
|
|
26
29
|
// Props with the default values common to all date time pickers
|
|
27
30
|
const defaultizedProps = useDateRangePickerDefaultizedProps(inProps, 'MuiMobileDateRangePicker');
|
|
28
31
|
const viewRenderers = _extends({
|
|
@@ -30,6 +33,7 @@ const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateR
|
|
|
30
33
|
}, defaultizedProps.viewRenderers);
|
|
31
34
|
const props = _extends({}, defaultizedProps, {
|
|
32
35
|
viewRenderers,
|
|
36
|
+
format: utils.formats.keyboardDate,
|
|
33
37
|
// Force one calendar on mobile to avoid layout issues
|
|
34
38
|
calendars: 1,
|
|
35
39
|
views: ['day'],
|
|
@@ -81,9 +85,9 @@ MobileDateRangePicker.propTypes = {
|
|
|
81
85
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
82
86
|
/**
|
|
83
87
|
* Formats the day of week displayed in the calendar header.
|
|
84
|
-
* @param {
|
|
88
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
85
89
|
* @returns {string} The name to display.
|
|
86
|
-
* @default (date:
|
|
90
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
87
91
|
*/
|
|
88
92
|
dayOfWeekFormatter: PropTypes.func,
|
|
89
93
|
/**
|
|
@@ -103,7 +107,8 @@ MobileDateRangePicker.propTypes = {
|
|
|
103
107
|
*/
|
|
104
108
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
105
109
|
/**
|
|
106
|
-
* If `true`, the
|
|
110
|
+
* If `true`, the component is disabled.
|
|
111
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
107
112
|
* @default false
|
|
108
113
|
*/
|
|
109
114
|
disabled: PropTypes.bool,
|
|
@@ -137,7 +142,7 @@ MobileDateRangePicker.propTypes = {
|
|
|
137
142
|
*/
|
|
138
143
|
displayWeekNumber: PropTypes.bool,
|
|
139
144
|
/**
|
|
140
|
-
* @default
|
|
145
|
+
* @default true
|
|
141
146
|
*/
|
|
142
147
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
143
148
|
/**
|
|
@@ -225,8 +230,7 @@ MobileDateRangePicker.propTypes = {
|
|
|
225
230
|
onError: PropTypes.func,
|
|
226
231
|
/**
|
|
227
232
|
* Callback fired on month change.
|
|
228
|
-
* @
|
|
229
|
-
* @param {TDate} month The new month.
|
|
233
|
+
* @param {PickerValidDate} month The new month.
|
|
230
234
|
*/
|
|
231
235
|
onMonthChange: PropTypes.func,
|
|
232
236
|
/**
|
|
@@ -254,6 +258,11 @@ MobileDateRangePicker.propTypes = {
|
|
|
254
258
|
* Used when the component position is controlled.
|
|
255
259
|
*/
|
|
256
260
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
261
|
+
/**
|
|
262
|
+
* If `true`, the component is read-only.
|
|
263
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
264
|
+
* @default false
|
|
265
|
+
*/
|
|
257
266
|
readOnly: PropTypes.bool,
|
|
258
267
|
/**
|
|
259
268
|
* If `true`, disable heavy animations.
|
|
@@ -286,8 +295,7 @@ MobileDateRangePicker.propTypes = {
|
|
|
286
295
|
*
|
|
287
296
|
* 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.
|
|
288
297
|
*
|
|
289
|
-
* @
|
|
290
|
-
* @param {TDate} day The date to test.
|
|
298
|
+
* @param {PickerValidDate} day The date to test.
|
|
291
299
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
292
300
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
293
301
|
*/
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { MakeOptional } from '@mui/x-
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
2
|
import { UseMobileRangePickerSlots, UseMobileRangePickerSlotProps, MobileRangeOnlyPickerProps } from '../internals/hooks/useMobileRangePicker';
|
|
4
3
|
import { BaseDateRangePickerProps, BaseDateRangePickerSlots, BaseDateRangePickerSlotProps } from '../DateRangePicker/shared';
|
|
5
|
-
export interface MobileDateRangePickerSlots
|
|
4
|
+
export interface MobileDateRangePickerSlots extends BaseDateRangePickerSlots, MakeOptional<UseMobileRangePickerSlots<'day'>, 'field'> {
|
|
6
5
|
}
|
|
7
|
-
export interface MobileDateRangePickerSlotProps<
|
|
6
|
+
export interface MobileDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateRangePickerSlotProps, Omit<UseMobileRangePickerSlotProps<'day', TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
|
|
8
7
|
}
|
|
9
|
-
export interface MobileDateRangePickerProps<
|
|
8
|
+
export interface MobileDateRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseDateRangePickerProps, MobileRangeOnlyPickerProps {
|
|
10
9
|
/**
|
|
11
10
|
* Overridable component slots.
|
|
12
11
|
* @default {}
|
|
13
12
|
*/
|
|
14
|
-
slots?: MobileDateRangePickerSlots
|
|
13
|
+
slots?: MobileDateRangePickerSlots;
|
|
15
14
|
/**
|
|
16
15
|
* The props used for each component slot.
|
|
17
16
|
* @default {}
|
|
18
17
|
*/
|
|
19
|
-
slotProps?: MobileDateRangePickerSlotProps<
|
|
18
|
+
slotProps?: MobileDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
20
19
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { MobileDateTimeRangePickerProps } from './MobileDateTimeRangePicker.types';
|
|
4
|
-
type MobileDateRangePickerComponent = (<
|
|
3
|
+
type MobileDateRangePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: MobileDateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -160,9 +160,9 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
160
160
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
161
161
|
/**
|
|
162
162
|
* Formats the day of week displayed in the calendar header.
|
|
163
|
-
* @param {
|
|
163
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
164
164
|
* @returns {string} The name to display.
|
|
165
|
-
* @default (date:
|
|
165
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
166
166
|
*/
|
|
167
167
|
dayOfWeekFormatter: PropTypes.func,
|
|
168
168
|
/**
|
|
@@ -182,7 +182,8 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
182
182
|
*/
|
|
183
183
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
184
184
|
/**
|
|
185
|
-
* If `true`, the
|
|
185
|
+
* If `true`, the component is disabled.
|
|
186
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
186
187
|
* @default false
|
|
187
188
|
*/
|
|
188
189
|
disabled: PropTypes.bool,
|
|
@@ -221,7 +222,7 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
221
222
|
*/
|
|
222
223
|
displayWeekNumber: PropTypes.bool,
|
|
223
224
|
/**
|
|
224
|
-
* @default
|
|
225
|
+
* @default true
|
|
225
226
|
*/
|
|
226
227
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
227
228
|
/**
|
|
@@ -332,8 +333,7 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
332
333
|
onError: PropTypes.func,
|
|
333
334
|
/**
|
|
334
335
|
* Callback fired on month change.
|
|
335
|
-
* @
|
|
336
|
-
* @param {TDate} month The new month.
|
|
336
|
+
* @param {PickerValidDate} month The new month.
|
|
337
337
|
*/
|
|
338
338
|
onMonthChange: PropTypes.func,
|
|
339
339
|
/**
|
|
@@ -373,6 +373,11 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
373
373
|
* Used when the component position is controlled.
|
|
374
374
|
*/
|
|
375
375
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
376
|
+
/**
|
|
377
|
+
* If `true`, the component is read-only.
|
|
378
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
379
|
+
* @default false
|
|
380
|
+
*/
|
|
376
381
|
readOnly: PropTypes.bool,
|
|
377
382
|
/**
|
|
378
383
|
* If `true`, disable heavy animations.
|
|
@@ -405,16 +410,14 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
405
410
|
*
|
|
406
411
|
* 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.
|
|
407
412
|
*
|
|
408
|
-
* @
|
|
409
|
-
* @param {TDate} day The date to test.
|
|
413
|
+
* @param {PickerValidDate} day The date to test.
|
|
410
414
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
411
415
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
412
416
|
*/
|
|
413
417
|
shouldDisableDate: PropTypes.func,
|
|
414
418
|
/**
|
|
415
419
|
* Disable specific time.
|
|
416
|
-
* @
|
|
417
|
-
* @param {TDate} value The value to check.
|
|
420
|
+
* @param {PickerValidDate} value The value to check.
|
|
418
421
|
* @param {TimeView} view The clock type of the timeValue.
|
|
419
422
|
* @returns {boolean} If `true` the time will be disabled.
|
|
420
423
|
*/
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { MakeOptional } from '@mui/x-
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
2
|
import { UseMobileRangePickerSlots, UseMobileRangePickerSlotProps, MobileRangeOnlyPickerProps } from '../internals/hooks/useMobileRangePicker';
|
|
4
3
|
import { BaseDateTimeRangePickerProps, BaseDateTimeRangePickerSlots, BaseDateTimeRangePickerSlotProps } from '../DateTimeRangePicker/shared';
|
|
5
4
|
import { DateTimeRangePickerView } from '../internals/models';
|
|
6
|
-
export interface MobileDateTimeRangePickerSlots
|
|
5
|
+
export interface MobileDateTimeRangePickerSlots extends BaseDateTimeRangePickerSlots, MakeOptional<UseMobileRangePickerSlots<DateTimeRangePickerView>, 'field'> {
|
|
7
6
|
}
|
|
8
|
-
export interface MobileDateTimeRangePickerSlotProps<
|
|
7
|
+
export interface MobileDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateTimeRangePickerSlotProps, Omit<UseMobileRangePickerSlotProps<DateTimeRangePickerView, TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
|
|
9
8
|
}
|
|
10
|
-
export interface MobileDateTimeRangePickerProps<
|
|
9
|
+
export interface MobileDateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseDateTimeRangePickerProps, MobileRangeOnlyPickerProps {
|
|
11
10
|
/**
|
|
12
11
|
* Overridable component slots.
|
|
13
12
|
* @default {}
|
|
14
13
|
*/
|
|
15
|
-
slots?: MobileDateTimeRangePickerSlots
|
|
14
|
+
slots?: MobileDateTimeRangePickerSlots;
|
|
16
15
|
/**
|
|
17
16
|
* The props used for each component slot.
|
|
18
17
|
* @default {}
|
|
19
18
|
*/
|
|
20
|
-
slotProps?: MobileDateTimeRangePickerSlotProps<
|
|
19
|
+
slotProps?: MobileDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
21
20
|
}
|