@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,3 +1,2 @@
|
|
|
1
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
1
|
import { UseSingleInputDateTimeRangeFieldProps } from './SingleInputDateTimeRangeField.types';
|
|
3
|
-
export declare const useSingleInputDateTimeRangeField: <
|
|
2
|
+
export declare const useSingleInputDateTimeRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps> & Required<Pick<UseSingleInputDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "formatDensity" | "enableAccessibleFieldDOMStructure" | "selectedSections" | "onSelectedSectionsChange" | "timezone" | "unstableFieldRef" | "referenceDate" | "shouldRespectLeadingZeros" | "ampm" | "disableFuture" | "maxDate" | "disablePast" | "minDate" | "minTime" | "maxTime" | "minutesStep" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "minDateTime" | "maxDateTime" | "shouldDisableDate" | "shouldDisableMonth" | "shouldDisableYear" | "dateSeparator">>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { SingleInputTimeRangeFieldProps } from './SingleInputTimeRangeField.types';
|
|
4
3
|
import { FieldType } from '../models';
|
|
5
|
-
type DateRangeFieldComponent = (<
|
|
4
|
+
type DateRangeFieldComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: SingleInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
6
5
|
propTypes?: any;
|
|
7
6
|
fieldType?: FieldType;
|
|
8
7
|
};
|
|
@@ -37,7 +37,7 @@ const SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleI
|
|
|
37
37
|
} = themeProps,
|
|
38
38
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
39
39
|
const ownerState = themeProps;
|
|
40
|
-
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure ?
|
|
40
|
+
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
|
|
41
41
|
const textFieldProps = useSlotProps({
|
|
42
42
|
elementType: TextField,
|
|
43
43
|
externalSlotProps: slotProps?.textField,
|
|
@@ -100,6 +100,7 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
100
100
|
defaultValue: PropTypes.arrayOf(PropTypes.object),
|
|
101
101
|
/**
|
|
102
102
|
* If `true`, the component is disabled.
|
|
103
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
103
104
|
* @default false
|
|
104
105
|
*/
|
|
105
106
|
disabled: PropTypes.bool,
|
|
@@ -119,7 +120,7 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
119
120
|
*/
|
|
120
121
|
disablePast: PropTypes.bool,
|
|
121
122
|
/**
|
|
122
|
-
* @default
|
|
123
|
+
* @default true
|
|
123
124
|
*/
|
|
124
125
|
enableAccessibleFieldDOMStructure: PropTypes.bool,
|
|
125
126
|
/**
|
|
@@ -239,8 +240,8 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
239
240
|
*/
|
|
240
241
|
onSelectedSectionsChange: PropTypes.func,
|
|
241
242
|
/**
|
|
242
|
-
*
|
|
243
|
-
*
|
|
243
|
+
* If `true`, the component is read-only.
|
|
244
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
244
245
|
* @default false
|
|
245
246
|
*/
|
|
246
247
|
readOnly: PropTypes.bool,
|
|
@@ -267,8 +268,7 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
267
268
|
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number]),
|
|
268
269
|
/**
|
|
269
270
|
* Disable specific time.
|
|
270
|
-
* @
|
|
271
|
-
* @param {TDate} value The value to check.
|
|
271
|
+
* @param {PickerValidDate} value The value to check.
|
|
272
272
|
* @param {TimeView} view The clock type of the timeValue.
|
|
273
273
|
* @returns {boolean} If `true` the time will be disabled.
|
|
274
274
|
*/
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SlotComponentProps } from '@mui/utils';
|
|
3
3
|
import TextField from '@mui/material/TextField';
|
|
4
|
-
import { UseFieldInternalProps } from '@mui/x-date-pickers/internals';
|
|
5
|
-
import {
|
|
4
|
+
import { PickerRangeValue, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { BuiltInFieldTextFieldProps } from '@mui/x-date-pickers/models';
|
|
6
6
|
import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks';
|
|
7
7
|
import { UseTimeRangeFieldProps } from '../internals/models';
|
|
8
|
-
import {
|
|
9
|
-
export interface UseSingleInputTimeRangeFieldProps<
|
|
8
|
+
import { RangeFieldSection, TimeRangeValidationError } from '../models';
|
|
9
|
+
export interface UseSingleInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends UseTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>, ExportedUseClearableFieldProps, Pick<UseFieldInternalProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, 'unstableFieldRef'> {
|
|
10
10
|
}
|
|
11
|
-
export type SingleInputTimeRangeFieldProps<
|
|
11
|
+
export type SingleInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseSingleInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>> & UseSingleInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure> & {
|
|
12
12
|
/**
|
|
13
13
|
* Overridable component slots.
|
|
14
14
|
* @default {}
|
|
@@ -18,7 +18,7 @@ export type SingleInputTimeRangeFieldProps<TDate extends PickerValidDate, TEnabl
|
|
|
18
18
|
* The props used for each component slot.
|
|
19
19
|
* @default {}
|
|
20
20
|
*/
|
|
21
|
-
slotProps?: SingleInputTimeRangeFieldSlotProps<
|
|
21
|
+
slotProps?: SingleInputTimeRangeFieldSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
22
22
|
};
|
|
23
23
|
export interface SingleInputTimeRangeFieldSlots extends UseClearableFieldSlots {
|
|
24
24
|
/**
|
|
@@ -27,6 +27,6 @@ export interface SingleInputTimeRangeFieldSlots extends UseClearableFieldSlots {
|
|
|
27
27
|
*/
|
|
28
28
|
textField?: React.ElementType;
|
|
29
29
|
}
|
|
30
|
-
export interface SingleInputTimeRangeFieldSlotProps<
|
|
31
|
-
textField?: SlotComponentProps<typeof TextField, {}, SingleInputTimeRangeFieldProps<
|
|
30
|
+
export interface SingleInputTimeRangeFieldSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends UseClearableFieldSlotProps {
|
|
31
|
+
textField?: SlotComponentProps<typeof TextField, {}, SingleInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>>;
|
|
32
32
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
1
|
import { UseSingleInputTimeRangeFieldProps } from './SingleInputTimeRangeField.types';
|
|
3
|
-
export declare const useSingleInputTimeRangeField: <
|
|
2
|
+
export declare const useSingleInputTimeRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps> & Required<Pick<UseSingleInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "formatDensity" | "enableAccessibleFieldDOMStructure" | "selectedSections" | "onSelectedSectionsChange" | "timezone" | "unstableFieldRef" | "referenceDate" | "shouldRespectLeadingZeros" | "ampm" | keyof import("@mui/x-date-pickers/internals").BaseTimeValidationProps | keyof import("@mui/x-date-pickers/internals").TimeValidationProps | "dateSeparator">>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { StaticDateRangePickerProps } from './StaticDateRangePicker.types';
|
|
4
|
-
type StaticDateRangePickerComponent = (
|
|
3
|
+
type StaticDateRangePickerComponent = ((props: StaticDateRangePickerProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
4
|
propTypes?: any;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
@@ -74,9 +74,9 @@ StaticDateRangePicker.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
|
/**
|
|
@@ -96,7 +96,8 @@ StaticDateRangePicker.propTypes = {
|
|
|
96
96
|
*/
|
|
97
97
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
98
98
|
/**
|
|
99
|
-
* If `true`, the
|
|
99
|
+
* If `true`, the component is disabled.
|
|
100
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
100
101
|
* @default false
|
|
101
102
|
*/
|
|
102
103
|
disabled: PropTypes.bool,
|
|
@@ -189,8 +190,7 @@ StaticDateRangePicker.propTypes = {
|
|
|
189
190
|
onError: PropTypes.func,
|
|
190
191
|
/**
|
|
191
192
|
* Callback fired on month change.
|
|
192
|
-
* @
|
|
193
|
-
* @param {TDate} month The new month.
|
|
193
|
+
* @param {PickerValidDate} month The new month.
|
|
194
194
|
*/
|
|
195
195
|
onMonthChange: PropTypes.func,
|
|
196
196
|
/**
|
|
@@ -203,6 +203,11 @@ StaticDateRangePicker.propTypes = {
|
|
|
203
203
|
* Used when the component position is controlled.
|
|
204
204
|
*/
|
|
205
205
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
206
|
+
/**
|
|
207
|
+
* If `true`, the component is read-only.
|
|
208
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
209
|
+
* @default false
|
|
210
|
+
*/
|
|
206
211
|
readOnly: PropTypes.bool,
|
|
207
212
|
/**
|
|
208
213
|
* If `true`, disable heavy animations.
|
|
@@ -225,8 +230,7 @@ StaticDateRangePicker.propTypes = {
|
|
|
225
230
|
*
|
|
226
231
|
* 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.
|
|
227
232
|
*
|
|
228
|
-
* @
|
|
229
|
-
* @param {TDate} day The date to test.
|
|
233
|
+
* @param {PickerValidDate} day The date to test.
|
|
230
234
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
231
235
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
232
236
|
*/
|
|
@@ -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 { StaticRangeOnlyPickerProps, UseStaticRangePickerSlots, UseStaticRangePickerSlotProps } from '../internals/hooks/useStaticRangePicker';
|
|
4
3
|
import { BaseDateRangePickerProps, BaseDateRangePickerSlots, BaseDateRangePickerSlotProps } from '../DateRangePicker/shared';
|
|
5
|
-
export interface StaticDateRangePickerSlots
|
|
4
|
+
export interface StaticDateRangePickerSlots extends BaseDateRangePickerSlots, UseStaticRangePickerSlots<'day'> {
|
|
6
5
|
}
|
|
7
|
-
export interface StaticDateRangePickerSlotProps
|
|
6
|
+
export interface StaticDateRangePickerSlotProps extends BaseDateRangePickerSlotProps, Omit<UseStaticRangePickerSlotProps<'day'>, 'toolbar'> {
|
|
8
7
|
}
|
|
9
|
-
export interface StaticDateRangePickerProps
|
|
8
|
+
export interface StaticDateRangePickerProps extends BaseDateRangePickerProps, MakeOptional<StaticRangeOnlyPickerProps, 'displayStaticWrapperAs'> {
|
|
10
9
|
/**
|
|
11
10
|
* The number of calendars to render.
|
|
12
11
|
* @default 1 if `displayStaticWrapperAs === 'mobile'`, 2 otherwise.
|
|
@@ -16,10 +15,10 @@ export interface StaticDateRangePickerProps<TDate extends PickerValidDate> exten
|
|
|
16
15
|
* Overridable component slots.
|
|
17
16
|
* @default {}
|
|
18
17
|
*/
|
|
19
|
-
slots?: StaticDateRangePickerSlots
|
|
18
|
+
slots?: StaticDateRangePickerSlots;
|
|
20
19
|
/**
|
|
21
20
|
* The props used for each component slot.
|
|
22
21
|
* @default {}
|
|
23
22
|
*/
|
|
24
|
-
slotProps?: StaticDateRangePickerSlotProps
|
|
23
|
+
slotProps?: StaticDateRangePickerSlotProps;
|
|
25
24
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
3
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
3
|
import { DateRangeCalendarProps } from '../DateRangeCalendar';
|
|
5
|
-
export interface DateRangeViewRendererProps<
|
|
4
|
+
export interface DateRangeViewRendererProps<TView extends DateOrTimeViewWithMeridiem> extends Omit<DateRangeCalendarProps, 'views'> {
|
|
6
5
|
views: readonly TView[];
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
9
8
|
* We don't pass all the props down to `DateRangeCalendar`,
|
|
10
9
|
* because otherwise some unwanted props would be passed to the HTML element.
|
|
11
10
|
*/
|
|
12
|
-
export declare const renderDateRangeViewCalendar:
|
|
11
|
+
export declare const renderDateRangeViewCalendar: ({ 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, sx, autoFocus, fixedWeekNumber, disableDragEditing, displayWeekNumber, timezone, availableRangePositions, views, view, onViewChange, }: DateRangeViewRendererProps<"day">) => React.JSX.Element;
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import { LicenseInfo as LicenseInfoExport } from '@mui/x-license';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Use `@mui/x-license` package instead:
|
|
4
|
-
* @example import { LicenseInfo } from '@mui/x-license';
|
|
5
|
-
*/
|
|
6
|
-
export declare class LicenseInfo extends LicenseInfoExport {
|
|
7
|
-
}
|
|
8
1
|
export * from '@mui/x-date-pickers';
|
|
9
2
|
export * from './DateRangePickerDay';
|
|
10
3
|
export * from './MultiInputDateRangeField';
|
package/index.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers-pro
|
|
2
|
+
* @mui/x-date-pickers-pro v8.0.0-alpha.0
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
import { LicenseInfo as LicenseInfoExport } from '@mui/x-license';
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Use `@mui/x-license` package instead:
|
|
11
|
-
* @example import { LicenseInfo } from '@mui/x-license';
|
|
12
|
-
*/
|
|
13
|
-
export class LicenseInfo extends LicenseInfoExport {}
|
|
14
8
|
export * from '@mui/x-date-pickers';
|
|
15
9
|
export * from "./DateRangePickerDay/index.js";
|
|
16
10
|
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { UsePickerParams, BasePickerProps, ExportedBaseToolbarProps, UsePickerViewsProps, BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, DateOrTimeViewWithMeridiem, ExportedBaseTabsProps } from '@mui/x-date-pickers/internals';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
1
|
+
import { UsePickerParams, BasePickerProps, ExportedBaseToolbarProps, UsePickerViewsProps, BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, DateOrTimeViewWithMeridiem, ExportedBaseTabsProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
3
2
|
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
|
|
4
3
|
import { BaseRangeNonStaticPickerProps } from '../../models';
|
|
5
4
|
import { UseRangePositionProps, UseRangePositionResponse } from '../useRangePosition';
|
|
6
5
|
import { RangePickerFieldSlots, RangePickerFieldSlotProps } from '../useEnrichedRangePickerFieldProps';
|
|
7
|
-
import {
|
|
8
|
-
export interface UseRangePickerSlots<
|
|
6
|
+
import { RangeFieldSection } from '../../../models';
|
|
7
|
+
export interface UseRangePickerSlots<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<PickerRangeValue, TView>, RangePickerFieldSlots {
|
|
9
8
|
}
|
|
10
|
-
export interface UseRangePickerSlotProps<
|
|
9
|
+
export interface UseRangePickerSlotProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends ExportedPickersLayoutSlotProps<PickerRangeValue, TView>, RangePickerFieldSlotProps<TEnableAccessibleFieldDOMStructure> {
|
|
11
10
|
tabs?: ExportedBaseTabsProps;
|
|
12
11
|
toolbar?: ExportedBaseToolbarProps;
|
|
13
12
|
}
|
|
14
13
|
export interface RangeOnlyPickerProps extends BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, BaseRangeNonStaticPickerProps, UseRangePositionProps {
|
|
15
14
|
}
|
|
16
|
-
export interface UseRangePickerProps<
|
|
15
|
+
export interface UseRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, TView, any, any>, TAdditionalViewProps extends {}> extends RangeOnlyPickerProps, BasePickerProps<PickerRangeValue, TView, TError, TExternalProps, TAdditionalViewProps> {
|
|
17
16
|
}
|
|
18
17
|
export interface RangePickerAdditionalViewProps extends Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
|
|
19
18
|
}
|
|
20
|
-
export interface UseRangePickerParams<
|
|
19
|
+
export interface UseRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseRangePickerProps<TView, any, TExternalProps, TAdditionalViewProps>, TAdditionalViewProps extends {}> extends Pick<UsePickerParams<PickerRangeValue, TView, RangeFieldSection, TExternalProps, TAdditionalViewProps>, 'valueManager' | 'valueType' | 'validator' | 'rendererInterceptor'> {
|
|
21
20
|
props: TExternalProps;
|
|
22
21
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
3
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
3
|
import { UseDesktopRangePickerParams, UseDesktopRangePickerProps } from './useDesktopRangePicker.types';
|
|
5
|
-
export declare const useDesktopRangePicker: <
|
|
4
|
+
export declare const useDesktopRangePicker: <TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>>({ props, ...pickerParams }: UseDesktopRangePickerParams<TView, TEnableAccessibleFieldDOMStructure, TExternalProps>) => {
|
|
6
5
|
renderPicker: () => React.JSX.Element;
|
|
7
6
|
};
|
|
@@ -5,7 +5,7 @@ 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 { executeInTheNextEventLoopTick, getActiveElement, usePicker, PickersPopper,
|
|
8
|
+
import { executeInTheNextEventLoopTick, getActiveElement, usePicker, PickersPopper, PickerProvider } from '@mui/x-date-pickers/internals';
|
|
9
9
|
import { useEnrichedRangePickerFieldProps } from "../useEnrichedRangePickerFieldProps.js";
|
|
10
10
|
import { getReleaseInfo } from "../../utils/releaseInfo.js";
|
|
11
11
|
import { useRangePosition } from "../useRangePosition.js";
|
|
@@ -53,15 +53,17 @@ export const useDesktopRangePicker = _ref => {
|
|
|
53
53
|
open,
|
|
54
54
|
actions,
|
|
55
55
|
layoutProps,
|
|
56
|
+
providerProps,
|
|
56
57
|
renderCurrentView,
|
|
57
58
|
shouldRestoreFocus,
|
|
58
59
|
fieldProps: pickerFieldProps,
|
|
59
|
-
|
|
60
|
+
ownerState
|
|
60
61
|
} = usePicker(_extends({}, pickerParams, {
|
|
61
62
|
props,
|
|
62
63
|
wrapperVariant: 'desktop',
|
|
63
64
|
autoFocusView: false,
|
|
64
65
|
fieldRef: rangePosition === 'start' ? startFieldRef : endFieldRef,
|
|
66
|
+
localeText,
|
|
65
67
|
additionalViewProps: {
|
|
66
68
|
rangePosition,
|
|
67
69
|
onRangePositionChange
|
|
@@ -85,24 +87,30 @@ export const useDesktopRangePicker = _ref => {
|
|
|
85
87
|
const fieldProps = useSlotProps({
|
|
86
88
|
elementType: Field,
|
|
87
89
|
externalSlotProps: slotProps?.field,
|
|
88
|
-
additionalProps: _extends({
|
|
90
|
+
additionalProps: _extends({
|
|
91
|
+
// Internal props
|
|
89
92
|
readOnly,
|
|
90
93
|
disabled,
|
|
91
|
-
className,
|
|
92
|
-
sx,
|
|
93
94
|
format,
|
|
94
95
|
formatDensity,
|
|
95
96
|
enableAccessibleFieldDOMStructure,
|
|
96
97
|
selectedSections,
|
|
97
98
|
onSelectedSectionsChange,
|
|
98
99
|
timezone,
|
|
99
|
-
autoFocus: autoFocus && !props.open
|
|
100
|
+
autoFocus: autoFocus && !props.open
|
|
101
|
+
}, pickerFieldProps, {
|
|
102
|
+
// onChange and value
|
|
103
|
+
|
|
104
|
+
// Forwarded props
|
|
105
|
+
className,
|
|
106
|
+
sx,
|
|
100
107
|
ref: fieldContainerRef
|
|
101
|
-
}, fieldType === 'single-input'
|
|
102
|
-
inputRef
|
|
108
|
+
}, fieldType === 'single-input' && !!inputRef && {
|
|
109
|
+
inputRef
|
|
110
|
+
}, fieldType === 'single-input' && {
|
|
103
111
|
name
|
|
104
|
-
}
|
|
105
|
-
ownerState
|
|
112
|
+
}),
|
|
113
|
+
ownerState
|
|
106
114
|
});
|
|
107
115
|
const enrichedFieldProps = useEnrichedRangePickerFieldProps({
|
|
108
116
|
wrapperVariant: 'desktop',
|
|
@@ -137,9 +145,7 @@ export const useDesktopRangePicker = _ref => {
|
|
|
137
145
|
})
|
|
138
146
|
});
|
|
139
147
|
const Layout = slots?.layout ?? PickersLayout;
|
|
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(PickersPopper, _extends({
|
|
144
150
|
role: "tooltip",
|
|
145
151
|
placement: "bottom-start",
|
|
@@ -158,7 +164,7 @@ export const useDesktopRangePicker = _ref => {
|
|
|
158
164
|
children: renderCurrentView()
|
|
159
165
|
}))
|
|
160
166
|
}))]
|
|
161
|
-
});
|
|
167
|
+
}));
|
|
162
168
|
return {
|
|
163
169
|
renderPicker
|
|
164
170
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { PickersPopperSlots, PickersPopperSlotProps, UsePickerViewsProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
2
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
2
|
import { RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
|
|
4
|
-
export interface UseDesktopRangePickerSlots<
|
|
3
|
+
export interface UseDesktopRangePickerSlots<TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TView>, PickersPopperSlots {
|
|
5
4
|
}
|
|
6
|
-
export interface UseDesktopRangePickerSlotProps<
|
|
5
|
+
export interface UseDesktopRangePickerSlotProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends UseRangePickerSlotProps<TView, TEnableAccessibleFieldDOMStructure>, PickersPopperSlotProps {
|
|
7
6
|
}
|
|
8
7
|
export interface DesktopRangeOnlyPickerProps extends RangeOnlyPickerProps {
|
|
9
8
|
/**
|
|
@@ -11,19 +10,19 @@ export interface DesktopRangeOnlyPickerProps extends RangeOnlyPickerProps {
|
|
|
11
10
|
*/
|
|
12
11
|
autoFocus?: boolean;
|
|
13
12
|
}
|
|
14
|
-
export interface UseDesktopRangePickerProps<
|
|
13
|
+
export interface UseDesktopRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<any, TView, any, any>> extends UseRangePickerProps<TView, TError, TExternalProps, DesktopRangePickerAdditionalViewProps> {
|
|
15
14
|
/**
|
|
16
15
|
* Overridable component slots.
|
|
17
16
|
* @default {}
|
|
18
17
|
*/
|
|
19
|
-
slots: UseDesktopRangePickerSlots<
|
|
18
|
+
slots: UseDesktopRangePickerSlots<TView>;
|
|
20
19
|
/**
|
|
21
20
|
* The props used for each component slot.
|
|
22
21
|
* @default {}
|
|
23
22
|
*/
|
|
24
|
-
slotProps?: UseDesktopRangePickerSlotProps<
|
|
23
|
+
slotProps?: UseDesktopRangePickerSlotProps<TView, TEnableAccessibleFieldDOMStructure>;
|
|
25
24
|
}
|
|
26
25
|
export interface DesktopRangePickerAdditionalViewProps extends RangePickerAdditionalViewProps {
|
|
27
26
|
}
|
|
28
|
-
export interface UseDesktopRangePickerParams<
|
|
27
|
+
export interface UseDesktopRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends UseRangePickerParams<TView, TExternalProps, DesktopRangePickerAdditionalViewProps> {
|
|
29
28
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Stack, { StackProps } from '@mui/material/Stack';
|
|
3
3
|
import Typography, { TypographyProps } from '@mui/material/Typography';
|
|
4
|
-
import TextField from '@mui/material/TextField';
|
|
5
4
|
import { SlotComponentProps } from '@mui/utils';
|
|
6
|
-
import {
|
|
5
|
+
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
6
|
+
import { FieldRef, PickerOwnerState } from '@mui/x-date-pickers/models';
|
|
7
7
|
import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks';
|
|
8
8
|
import { PickersInputLocaleText } from '@mui/x-date-pickers/locales';
|
|
9
|
-
import { UsePickerResponse, WrapperVariant,
|
|
10
|
-
import {
|
|
9
|
+
import { UsePickerResponse, WrapperVariant, DateOrTimeViewWithMeridiem, BaseSingleInputFieldProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
11
|
+
import { RangeFieldSection, RangePosition, FieldType, UseDateRangeFieldProps, PickerRangeFieldSlotProps } from '../../models';
|
|
11
12
|
import { UseRangePositionResponse } from './useRangePosition';
|
|
13
|
+
import { BaseMultiInputFieldProps } from '../models/fields';
|
|
12
14
|
export interface RangePickerFieldSlots extends UseClearableFieldSlots {
|
|
13
15
|
field: React.ElementType;
|
|
14
16
|
/**
|
|
@@ -28,16 +30,16 @@ export interface RangePickerFieldSlots extends UseClearableFieldSlots {
|
|
|
28
30
|
*/
|
|
29
31
|
textField?: React.ElementType;
|
|
30
32
|
}
|
|
31
|
-
export interface RangePickerFieldSlotProps<
|
|
32
|
-
field?: SlotComponentPropsFromProps<
|
|
33
|
+
export interface RangePickerFieldSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends UseClearableFieldSlotProps {
|
|
34
|
+
field?: SlotComponentPropsFromProps<PickerRangeFieldSlotProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure>, {}, PickerOwnerState>;
|
|
33
35
|
fieldRoot?: SlotComponentProps<typeof Stack, {}, Record<string, any>>;
|
|
34
36
|
fieldSeparator?: SlotComponentProps<typeof Typography, {}, Record<string, any>>;
|
|
35
|
-
textField?: SlotComponentProps<typeof
|
|
37
|
+
textField?: SlotComponentProps<typeof PickersTextField, {}, UseDateRangeFieldProps<TEnableAccessibleFieldDOMStructure> & {
|
|
36
38
|
position?: RangePosition;
|
|
37
39
|
}>;
|
|
38
40
|
}
|
|
39
|
-
export type RangePickerPropsForFieldSlot<TIsSingleInput extends boolean,
|
|
40
|
-
export interface UseEnrichedRangePickerFieldPropsParams<TIsSingleInput extends boolean,
|
|
41
|
+
export type RangePickerPropsForFieldSlot<TIsSingleInput extends boolean, TEnableAccessibleFieldDOMStructure extends boolean, TError> = (TIsSingleInput extends true ? BaseSingleInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError> : never) | (TIsSingleInput extends false ? BaseMultiInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError> : never);
|
|
42
|
+
export interface UseEnrichedRangePickerFieldPropsParams<TIsSingleInput extends boolean, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends Pick<UsePickerResponse<PickerRangeValue, TView, RangeFieldSection, any>, 'open' | 'actions'>, UseRangePositionResponse {
|
|
41
43
|
wrapperVariant: WrapperVariant;
|
|
42
44
|
fieldType: FieldType;
|
|
43
45
|
readOnly?: boolean;
|
|
@@ -45,10 +47,10 @@ export interface UseEnrichedRangePickerFieldPropsParams<TIsSingleInput extends b
|
|
|
45
47
|
disableOpenPicker?: boolean;
|
|
46
48
|
onBlur?: () => void;
|
|
47
49
|
label?: React.ReactNode;
|
|
48
|
-
localeText: PickersInputLocaleText
|
|
49
|
-
pickerSlotProps: RangePickerFieldSlotProps<
|
|
50
|
+
localeText: PickersInputLocaleText | undefined;
|
|
51
|
+
pickerSlotProps: RangePickerFieldSlotProps<TEnableAccessibleFieldDOMStructure> | undefined;
|
|
50
52
|
pickerSlots: RangePickerFieldSlots | undefined;
|
|
51
|
-
fieldProps: RangePickerPropsForFieldSlot<TIsSingleInput,
|
|
53
|
+
fieldProps: RangePickerPropsForFieldSlot<TIsSingleInput, TEnableAccessibleFieldDOMStructure, TError>;
|
|
52
54
|
anchorRef?: React.Ref<HTMLDivElement>;
|
|
53
55
|
currentView?: TView | null;
|
|
54
56
|
initialView?: TView;
|
|
@@ -56,4 +58,4 @@ export interface UseEnrichedRangePickerFieldPropsParams<TIsSingleInput extends b
|
|
|
56
58
|
startFieldRef: React.RefObject<FieldRef<RangeFieldSection>>;
|
|
57
59
|
endFieldRef: React.RefObject<FieldRef<RangeFieldSection>>;
|
|
58
60
|
}
|
|
59
|
-
export declare const useEnrichedRangePickerFieldProps: <
|
|
61
|
+
export declare const useEnrichedRangePickerFieldProps: <TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError>(params: UseEnrichedRangePickerFieldPropsParams<boolean, TView, TEnableAccessibleFieldDOMStructure, TError>) => BaseMultiInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError> | BaseSingleInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError>;
|
|
@@ -5,7 +5,7 @@ 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
|
wrapperVariant,
|
|
@@ -28,7 +28,7 @@ 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);
|
|
@@ -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,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
3
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
3
|
import { UseMobileRangePickerParams, UseMobileRangePickerProps } from './useMobileRangePicker.types';
|
|
5
|
-
export declare const useMobileRangePicker: <
|
|
4
|
+
export declare const useMobileRangePicker: <TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>>({ props, ...pickerParams }: UseMobileRangePickerParams<TView, TEnableAccessibleFieldDOMStructure, TExternalProps>) => {
|
|
6
5
|
renderPicker: () => React.JSX.Element;
|
|
7
6
|
};
|