@mui/x-date-pickers-pro 8.0.0-alpha.0 → 8.0.0-alpha.2
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 +651 -6
- package/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/DateRangePicker/DateRangePicker.types.d.ts +2 -2
- package/DateRangePicker/DateRangePickerToolbar.js +0 -12
- package/DateRangePicker/shared.d.ts +3 -2
- package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +2 -2
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +8 -7
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +2 -2
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -16
- package/DateTimeRangePicker/shared.d.ts +4 -3
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -12
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +12 -10
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -12
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +11 -9
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -12
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +11 -9
- package/README.md +9 -6
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +5 -5
- package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +11 -10
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +5 -5
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +11 -10
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -5
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +10 -9
- package/index.js +1 -1
- package/internals/hooks/models/useRangePicker.d.ts +1 -2
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +14 -4
- package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +14 -13
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +17 -18
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +15 -5
- package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +6 -7
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/internals/hooks/useRangePosition.d.ts +3 -2
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -1
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +1 -2
- package/internals/models/dateTimeRange.d.ts +2 -2
- package/internals/models/fields.d.ts +6 -6
- package/internals/models/timeRange.d.ts +2 -2
- package/internals/utils/date-fields-utils.d.ts +6 -6
- package/internals/utils/date-range-manager.d.ts +2 -1
- package/internals/utils/date-range-manager.js +11 -9
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/valueManagers.d.ts +4 -3
- package/models/dateRange.d.ts +3 -3
- package/models/fields.d.ts +6 -9
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/models/range.d.ts +0 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/modern/DateRangePicker/DateRangePickerToolbar.js +0 -12
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +8 -7
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -16
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -12
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -12
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -12
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +5 -5
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +5 -5
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -5
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +14 -4
- package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +17 -18
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +15 -5
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -1
- package/modern/internals/utils/date-range-manager.js +11 -9
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/models/index.js +2 -1
- package/modern/validation/validateDateRange.js +8 -0
- package/modern/validation/validateDateTimeRange.js +4 -0
- package/modern/validation/validateTimeRange.js +8 -0
- package/node/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/node/DateRangePicker/DateRangePickerToolbar.js +0 -12
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -6
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +5 -15
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +9 -11
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +9 -11
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +9 -11
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
- package/node/index.js +1 -1
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +14 -4
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +17 -18
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +15 -5
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -1
- package/node/internals/utils/date-range-manager.js +11 -9
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/validation/validateDateRange.js +8 -0
- package/node/validation/validateDateTimeRange.js +4 -0
- package/node/validation/validateTimeRange.js +8 -0
- package/package.json +6 -6
- package/validation/validateDateRange.d.ts +9 -1
- package/validation/validateDateRange.js +8 -0
- package/validation/validateDateTimeRange.d.ts +6 -2
- package/validation/validateDateTimeRange.js +4 -0
- package/validation/validateTimeRange.d.ts +9 -1
- package/validation/validateTimeRange.js +8 -0
|
@@ -169,6 +169,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
169
169
|
name: 'DateRangeCalendar',
|
|
170
170
|
timezone: timezoneProp,
|
|
171
171
|
value: valueProp,
|
|
172
|
+
referenceDate,
|
|
172
173
|
defaultValue,
|
|
173
174
|
onChange,
|
|
174
175
|
valueManager: rangeValueManager
|
|
@@ -210,7 +211,8 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
210
211
|
range: value,
|
|
211
212
|
rangePosition,
|
|
212
213
|
allowRangeFlip,
|
|
213
|
-
shouldMergeDateAndTime: true
|
|
214
|
+
shouldMergeDateAndTime: true,
|
|
215
|
+
referenceDate
|
|
214
216
|
});
|
|
215
217
|
const isNextSectionAvailable = availableRangePositions.includes(nextSelection);
|
|
216
218
|
if (isNextSectionAvailable) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
import { DateRangeValidationError
|
|
4
|
+
import { DateRangeValidationError } from '../models';
|
|
5
5
|
import { ValidateDateRangeProps } from '../validation';
|
|
6
6
|
export interface DateRangePickerSlots extends DesktopDateRangePickerSlots, MobileDateRangePickerSlots {
|
|
7
7
|
}
|
|
@@ -28,4 +28,4 @@ export interface DateRangePickerProps<TEnableAccessibleFieldDOMStructure extends
|
|
|
28
28
|
/**
|
|
29
29
|
* Props the field can receive when used inside a date range picker (<DateRangePicker />, <DesktopDateRangePicker /> or <MobileDateRangePicker /> component).
|
|
30
30
|
*/
|
|
31
|
-
export type DateRangePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateDateRangeProps & BaseSingleInputFieldProps<PickerRangeValue,
|
|
31
|
+
export type DateRangePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateDateRangeProps & BaseSingleInputFieldProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>;
|
|
@@ -99,12 +99,6 @@ 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
|
-
*/
|
|
107
|
-
disabled: PropTypes.bool,
|
|
108
102
|
/**
|
|
109
103
|
* If `true`, show the toolbar even in desktop mode.
|
|
110
104
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -118,12 +112,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
118
112
|
*/
|
|
119
113
|
onViewChange: PropTypes.func.isRequired,
|
|
120
114
|
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
|
-
*/
|
|
126
|
-
readOnly: PropTypes.bool,
|
|
127
115
|
/**
|
|
128
116
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
129
117
|
*/
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
import { LocalizedComponent } from '@mui/x-date-pickers/locales';
|
|
4
|
-
import {
|
|
4
|
+
import { BasePickerInputProps, PickerViewRendererLookup, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
5
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
|
+
import { ValidateDateRangePropsToDefault } from '../validation/validateDateRange';
|
|
9
10
|
export interface BaseDateRangePickerSlots extends DateRangeCalendarSlots {
|
|
10
11
|
/**
|
|
11
12
|
* Custom component for the toolbar rendered above the views.
|
|
@@ -34,6 +35,6 @@ export interface BaseDateRangePickerProps extends Omit<BasePickerInputProps<Pick
|
|
|
34
35
|
*/
|
|
35
36
|
viewRenderers?: Partial<PickerViewRendererLookup<PickerRangeValue, 'day', DateRangeViewRendererProps<'day'>, {}>>;
|
|
36
37
|
}
|
|
37
|
-
type UseDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps> = LocalizedComponent<DefaultizedProps<Props,
|
|
38
|
+
type UseDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps> = LocalizedComponent<DefaultizedProps<Props, ValidateDateRangePropsToDefault>>;
|
|
38
39
|
export declare function useDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps>(props: Props, name: string): UseDateRangePickerDefaultizedProps<Props>;
|
|
39
40
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
import { DateTimeRangeValidationError
|
|
4
|
+
import { DateTimeRangeValidationError } from '../models';
|
|
5
5
|
import type { ValidateDateTimeRangeProps } from '../validation';
|
|
6
6
|
export interface DateTimeRangePickerSlots extends DesktopDateTimeRangePickerSlots, MobileDateTimeRangePickerSlots {
|
|
7
7
|
}
|
|
@@ -28,4 +28,4 @@ export interface DateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure ext
|
|
|
28
28
|
/**
|
|
29
29
|
* Props the field can receive when used inside a date time range picker (<DateTimeRangePicker />, <DesktopDateTimeRangePicker /> or <MobileDateTimeRangePicker /> component).
|
|
30
30
|
*/
|
|
31
|
-
export type DateTimeRangePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateDateTimeRangeProps & BaseSingleInputFieldProps<PickerRangeValue,
|
|
31
|
+
export type DateTimeRangePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateDateTimeRangeProps & BaseSingleInputFieldProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>;
|
|
@@ -7,7 +7,7 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
7
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
|
-
import { isDatePickerView } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { isDatePickerView, usePickerPrivateContext } from '@mui/x-date-pickers/internals';
|
|
11
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';
|
|
@@ -25,10 +25,7 @@ const tabToView = tab => {
|
|
|
25
25
|
}
|
|
26
26
|
return 'hours';
|
|
27
27
|
};
|
|
28
|
-
const useUtilityClasses =
|
|
29
|
-
const {
|
|
30
|
-
classes
|
|
31
|
-
} = ownerState;
|
|
28
|
+
const useUtilityClasses = classes => {
|
|
32
29
|
const slots = {
|
|
33
30
|
root: ['root'],
|
|
34
31
|
tabButton: ['tabButton'],
|
|
@@ -79,10 +76,14 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
79
76
|
rangePosition,
|
|
80
77
|
onRangePositionChange,
|
|
81
78
|
className,
|
|
79
|
+
classes: classesProp,
|
|
82
80
|
sx
|
|
83
81
|
} = props;
|
|
84
82
|
const translations = usePickerTranslations();
|
|
85
|
-
const
|
|
83
|
+
const {
|
|
84
|
+
ownerState
|
|
85
|
+
} = usePickerPrivateContext();
|
|
86
|
+
const classes = useUtilityClasses(classesProp);
|
|
86
87
|
const value = React.useMemo(() => viewToTab(view, rangePosition), [view, rangePosition]);
|
|
87
88
|
const isPreviousHidden = value === 'start-date';
|
|
88
89
|
const isNextHidden = value === 'end-time';
|
|
@@ -121,7 +122,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
121
122
|
return null;
|
|
122
123
|
}
|
|
123
124
|
return /*#__PURE__*/_jsxs(DateTimeRangePickerTabsRoot, {
|
|
124
|
-
ownerState:
|
|
125
|
+
ownerState: ownerState,
|
|
125
126
|
className: clsx(classes.root, className),
|
|
126
127
|
sx: sx,
|
|
127
128
|
children: [!isPreviousHidden ? /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BaseToolbarProps, ExportedBaseToolbarProps, DateOrTimeViewWithMeridiem,
|
|
2
|
+
import { BaseToolbarProps, ExportedBaseToolbarProps, DateOrTimeViewWithMeridiem, PickerVariant, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
3
3
|
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
4
4
|
import { DateTimeRangePickerToolbarClasses } from './dateTimeRangePickerToolbarClasses';
|
|
5
5
|
type DateTimeRangeViews = Exclude<DateOrTimeViewWithMeridiem, 'year' | 'month'>;
|
|
6
6
|
export interface DateTimeRangePickerToolbarProps extends BaseToolbarProps<PickerRangeValue, DateTimeRangeViews>, Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'>, ExportedDateTimeRangePickerToolbarProps {
|
|
7
7
|
ampm?: boolean;
|
|
8
|
-
toolbarVariant?:
|
|
8
|
+
toolbarVariant?: PickerVariant;
|
|
9
9
|
}
|
|
10
10
|
export interface ExportedDateTimeRangePickerToolbarProps extends ExportedBaseToolbarProps {
|
|
11
11
|
/**
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "
|
|
5
|
+
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "hidden", "toolbarFormat", "toolbarPlaceholder", "titleId", "sx"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
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 { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
12
|
+
import { usePickerContext, 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";
|
|
@@ -86,8 +86,6 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
86
86
|
isLandscape,
|
|
87
87
|
views,
|
|
88
88
|
ampm,
|
|
89
|
-
disabled,
|
|
90
|
-
readOnly,
|
|
91
89
|
hidden,
|
|
92
90
|
toolbarFormat,
|
|
93
91
|
toolbarPlaceholder,
|
|
@@ -95,6 +93,10 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
95
93
|
sx
|
|
96
94
|
} = props,
|
|
97
95
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
96
|
+
const {
|
|
97
|
+
disabled,
|
|
98
|
+
readOnly
|
|
99
|
+
} = usePickerContext();
|
|
98
100
|
const commonToolbarProps = {
|
|
99
101
|
isLandscape,
|
|
100
102
|
views,
|
|
@@ -183,12 +185,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
183
185
|
*/
|
|
184
186
|
classes: PropTypes.object,
|
|
185
187
|
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
|
-
*/
|
|
191
|
-
disabled: PropTypes.bool,
|
|
192
188
|
/**
|
|
193
189
|
* If `true`, show the toolbar even in desktop mode.
|
|
194
190
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -204,12 +200,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
204
200
|
*/
|
|
205
201
|
onViewChange: PropTypes.func.isRequired,
|
|
206
202
|
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
|
-
*/
|
|
212
|
-
readOnly: PropTypes.bool,
|
|
213
203
|
/**
|
|
214
204
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
215
205
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
import { LocalizedComponent } from '@mui/x-date-pickers/locales';
|
|
4
|
-
import {
|
|
4
|
+
import { BasePickerInputProps, PickerViewRendererLookup, BaseClockProps, DesktopOnlyTimePickerProps, TimeViewWithMeridiem, UseViewsOptions, 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';
|
|
@@ -11,6 +11,7 @@ import { DateRangeCalendarSlots, DateRangeCalendarSlotProps, ExportedDateRangeCa
|
|
|
11
11
|
import { DateTimeRangePickerToolbarProps, ExportedDateTimeRangePickerToolbarProps } from './DateTimeRangePickerToolbar';
|
|
12
12
|
import { DateRangeViewRendererProps } from '../dateRangeViewRenderers';
|
|
13
13
|
import { DateTimeRangePickerTabsProps, ExportedDateTimeRangePickerTabsProps } from './DateTimeRangePickerTabs';
|
|
14
|
+
import { ExportedValidateDateTimeRangeProps, ValidateDateTimeRangePropsToDefault } from '../validation/validateDateTimeRange';
|
|
14
15
|
export interface BaseDateTimeRangePickerSlots extends DateRangeCalendarSlots, DigitalClockSlots, MultiSectionDigitalClockSlots {
|
|
15
16
|
/**
|
|
16
17
|
* Tabs enabling toggling between date and time pickers.
|
|
@@ -36,7 +37,7 @@ export interface BaseDateTimeRangePickerSlotProps extends DateRangeCalendarSlotP
|
|
|
36
37
|
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
38
|
view: TView;
|
|
38
39
|
}, TAdditionalProps>;
|
|
39
|
-
export interface BaseDateTimeRangePickerProps extends Omit<BasePickerInputProps<PickerRangeValue, DateTimeRangePickerView, DateTimeRangeValidationError>, 'orientation' | 'views' | 'openTo'>, ExportedDateRangeCalendarProps,
|
|
40
|
+
export interface BaseDateTimeRangePickerProps extends Omit<BasePickerInputProps<PickerRangeValue, DateTimeRangePickerView, DateTimeRangeValidationError>, 'orientation' | 'views' | 'openTo'>, ExportedDateRangeCalendarProps, ExportedValidateDateTimeRangeProps, DesktopOnlyTimePickerProps, Partial<Pick<UseViewsOptions<PickerRangeValue, DateTimeRangePickerViewExternal>, 'openTo' | 'views'>> {
|
|
40
41
|
/**
|
|
41
42
|
* Overridable component slots.
|
|
42
43
|
* @default {}
|
|
@@ -54,7 +55,7 @@ export interface BaseDateTimeRangePickerProps extends Omit<BasePickerInputProps<
|
|
|
54
55
|
*/
|
|
55
56
|
viewRenderers?: Partial<DateTimeRangePickerRenderers<DateTimeRangePickerView>>;
|
|
56
57
|
}
|
|
57
|
-
type UseDateTimeRangePickerDefaultizedProps<Props extends BaseDateTimeRangePickerProps> = LocalizedComponent<Omit<DefaultizedProps<Props, 'openTo' | 'ampm' |
|
|
58
|
+
type UseDateTimeRangePickerDefaultizedProps<Props extends BaseDateTimeRangePickerProps> = LocalizedComponent<Omit<DefaultizedProps<Props, 'openTo' | 'ampm' | ValidateDateTimeRangePropsToDefault>, 'views'>> & {
|
|
58
59
|
shouldRenderTimeInASingleColumn: boolean;
|
|
59
60
|
views: readonly DateTimeRangePickerView[];
|
|
60
61
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className"];
|
|
5
|
+
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -12,17 +12,14 @@ import Typography from '@mui/material/Typography';
|
|
|
12
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
13
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
14
14
|
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
15
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
15
|
+
import { convertFieldResponseIntoMuiTextFieldProps, useFieldOwnerState } from '@mui/x-date-pickers/internals';
|
|
16
16
|
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
17
17
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
18
18
|
import { useMultiInputDateRangeField } from "../internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js";
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export const multiInputDateRangeFieldClasses = generateUtilityClasses('MuiMultiInputDateRangeField', ['root', 'separator']);
|
|
21
21
|
export const getMultiInputDateRangeFieldUtilityClass = slot => generateUtilityClass('MuiMultiInputDateRangeField', slot);
|
|
22
|
-
const useUtilityClasses =
|
|
23
|
-
const {
|
|
24
|
-
classes
|
|
25
|
-
} = ownerState;
|
|
22
|
+
const useUtilityClasses = classes => {
|
|
26
23
|
const slots = {
|
|
27
24
|
root: ['root'],
|
|
28
25
|
separator: ['separator']
|
|
@@ -70,11 +67,12 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
70
67
|
slotProps,
|
|
71
68
|
unstableStartFieldRef,
|
|
72
69
|
unstableEndFieldRef,
|
|
73
|
-
className
|
|
70
|
+
className,
|
|
71
|
+
classes: classesProp
|
|
74
72
|
} = forwardedProps,
|
|
75
73
|
otherForwardedProps = _objectWithoutPropertiesLoose(forwardedProps, _excluded);
|
|
76
|
-
const ownerState =
|
|
77
|
-
const classes = useUtilityClasses(
|
|
74
|
+
const ownerState = useFieldOwnerState(internalProps);
|
|
75
|
+
const classes = useUtilityClasses(classesProp);
|
|
78
76
|
const Root = slots?.root ?? MultiInputDateRangeFieldRoot;
|
|
79
77
|
const rootProps = useSlotProps({
|
|
80
78
|
elementType: Root,
|
|
@@ -258,10 +256,10 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
258
256
|
*/
|
|
259
257
|
shouldDisableDate: PropTypes.func,
|
|
260
258
|
/**
|
|
261
|
-
* If `true`, the format will respect the leading zeroes (
|
|
262
|
-
* If `false`, the format will always add leading zeroes (
|
|
259
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
260
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
263
261
|
*
|
|
264
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
262
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
265
263
|
*
|
|
266
264
|
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
267
265
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import type { TypographyProps } from '@mui/material/Typography';
|
|
3
|
+
import type { StackProps } from '@mui/material/Stack';
|
|
4
|
+
import type { TextFieldProps } from '@mui/material/TextField';
|
|
5
|
+
import { FieldOwnerState } from '@mui/x-date-pickers/models';
|
|
6
|
+
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
7
|
+
import { PickersTextFieldProps } from '@mui/x-date-pickers/PickersTextField';
|
|
6
8
|
import { UseMultiInputRangeFieldParams } from '../internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types';
|
|
7
9
|
import { MultiInputFieldRefs, MultiInputRangeFieldClasses, RangePosition, UseDateRangeFieldProps } from '../models';
|
|
8
10
|
export type UseMultiInputDateRangeFieldParams<TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}> = UseMultiInputRangeFieldParams<UseMultiInputDateRangeFieldProps<TEnableAccessibleFieldDOMStructure>, TTextFieldSlotProps>;
|
|
@@ -24,7 +26,7 @@ export interface MultiInputDateRangeFieldProps<TEnableAccessibleFieldDOMStructur
|
|
|
24
26
|
* The props used for each component slot.
|
|
25
27
|
* @default {}
|
|
26
28
|
*/
|
|
27
|
-
slotProps?: MultiInputDateRangeFieldSlotProps
|
|
29
|
+
slotProps?: MultiInputDateRangeFieldSlotProps;
|
|
28
30
|
}
|
|
29
31
|
export interface MultiInputDateRangeFieldSlots {
|
|
30
32
|
/**
|
|
@@ -35,7 +37,7 @@ export interface MultiInputDateRangeFieldSlots {
|
|
|
35
37
|
/**
|
|
36
38
|
* Form control with an input to render a date.
|
|
37
39
|
* It is rendered twice: once for the start date and once for the end date.
|
|
38
|
-
* @default TextField from '@mui/material'
|
|
40
|
+
* @default <PickersTextField />, or <TextField /> from '@mui/material' if `enableAccessibleFieldDOMStructure` is `false`.
|
|
39
41
|
*/
|
|
40
42
|
textField?: React.ElementType;
|
|
41
43
|
/**
|
|
@@ -44,10 +46,10 @@ export interface MultiInputDateRangeFieldSlots {
|
|
|
44
46
|
*/
|
|
45
47
|
separator?: React.ElementType;
|
|
46
48
|
}
|
|
47
|
-
export interface MultiInputDateRangeFieldSlotProps
|
|
48
|
-
root?:
|
|
49
|
-
textField?:
|
|
49
|
+
export interface MultiInputDateRangeFieldSlotProps {
|
|
50
|
+
root?: SlotComponentPropsFromProps<StackProps, {}, FieldOwnerState>;
|
|
51
|
+
textField?: SlotComponentPropsFromProps<PickersTextFieldProps | TextFieldProps, {}, FieldOwnerState & {
|
|
50
52
|
position: RangePosition;
|
|
51
53
|
}>;
|
|
52
|
-
separator?:
|
|
54
|
+
separator?: SlotComponentPropsFromProps<TypographyProps, {}, FieldOwnerState>;
|
|
53
55
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className"];
|
|
5
|
+
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -12,17 +12,14 @@ import Typography from '@mui/material/Typography';
|
|
|
12
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
13
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
14
14
|
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
15
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
15
|
+
import { convertFieldResponseIntoMuiTextFieldProps, useFieldOwnerState } from '@mui/x-date-pickers/internals';
|
|
16
16
|
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
17
17
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
18
18
|
import { useMultiInputDateTimeRangeField } from "../internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js";
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export const multiInputDateTimeRangeFieldClasses = generateUtilityClasses('MuiMultiInputDateTimeRangeField', ['root', 'separator']);
|
|
21
21
|
export const getMultiInputDateTimeRangeFieldUtilityClass = slot => generateUtilityClass('MuiMultiInputDateTimeRangeField', slot);
|
|
22
|
-
const useUtilityClasses =
|
|
23
|
-
const {
|
|
24
|
-
classes
|
|
25
|
-
} = ownerState;
|
|
22
|
+
const useUtilityClasses = classes => {
|
|
26
23
|
const slots = {
|
|
27
24
|
root: ['root'],
|
|
28
25
|
separator: ['separator']
|
|
@@ -70,11 +67,12 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
|
|
|
70
67
|
slotProps,
|
|
71
68
|
unstableStartFieldRef,
|
|
72
69
|
unstableEndFieldRef,
|
|
73
|
-
className
|
|
70
|
+
className,
|
|
71
|
+
classes: classesProp
|
|
74
72
|
} = forwardedProps,
|
|
75
73
|
otherForwardedProps = _objectWithoutPropertiesLoose(forwardedProps, _excluded);
|
|
76
|
-
const ownerState = themeProps;
|
|
77
|
-
const classes = useUtilityClasses(
|
|
74
|
+
const ownerState = useFieldOwnerState(themeProps);
|
|
75
|
+
const classes = useUtilityClasses(classesProp);
|
|
78
76
|
const Root = slots?.root ?? MultiInputDateTimeRangeFieldRoot;
|
|
79
77
|
const rootProps = useSlotProps({
|
|
80
78
|
elementType: Root,
|
|
@@ -298,10 +296,10 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
298
296
|
*/
|
|
299
297
|
shouldDisableTime: PropTypes.func,
|
|
300
298
|
/**
|
|
301
|
-
* If `true`, the format will respect the leading zeroes (
|
|
302
|
-
* If `false`, the format will always add leading zeroes (
|
|
299
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
300
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
303
301
|
*
|
|
304
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
302
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
305
303
|
*
|
|
306
304
|
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
307
305
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import type { TypographyProps } from '@mui/material/Typography';
|
|
3
|
+
import type { StackProps } from '@mui/material/Stack';
|
|
4
|
+
import type { TextFieldProps } from '@mui/material/TextField';
|
|
5
|
+
import { FieldOwnerState } from '@mui/x-date-pickers/models';
|
|
6
|
+
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
7
|
+
import { PickersTextFieldProps } from '@mui/x-date-pickers/PickersTextField';
|
|
6
8
|
import { UseDateTimeRangeFieldProps } from '../internals/models/dateTimeRange';
|
|
7
9
|
import { UseMultiInputRangeFieldParams } from '../internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types';
|
|
8
10
|
import { MultiInputFieldRefs, MultiInputRangeFieldClasses, RangePosition } from '../models';
|
|
@@ -25,7 +27,7 @@ export interface MultiInputDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStru
|
|
|
25
27
|
* The props used for each component slot.
|
|
26
28
|
* @default {}
|
|
27
29
|
*/
|
|
28
|
-
slotProps?: MultiInputDateTimeRangeFieldSlotProps
|
|
30
|
+
slotProps?: MultiInputDateTimeRangeFieldSlotProps;
|
|
29
31
|
}
|
|
30
32
|
export interface MultiInputDateTimeRangeFieldSlots {
|
|
31
33
|
/**
|
|
@@ -45,10 +47,10 @@ export interface MultiInputDateTimeRangeFieldSlots {
|
|
|
45
47
|
*/
|
|
46
48
|
separator?: React.ElementType;
|
|
47
49
|
}
|
|
48
|
-
export interface MultiInputDateTimeRangeFieldSlotProps
|
|
49
|
-
root?:
|
|
50
|
-
textField?:
|
|
50
|
+
export interface MultiInputDateTimeRangeFieldSlotProps {
|
|
51
|
+
root?: SlotComponentPropsFromProps<StackProps, {}, FieldOwnerState>;
|
|
52
|
+
textField?: SlotComponentPropsFromProps<PickersTextFieldProps | TextFieldProps, {}, FieldOwnerState & {
|
|
51
53
|
position: RangePosition;
|
|
52
54
|
}>;
|
|
53
|
-
separator?:
|
|
55
|
+
separator?: SlotComponentPropsFromProps<TypographyProps, {}, FieldOwnerState>;
|
|
54
56
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className"];
|
|
5
|
+
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
@@ -12,17 +12,14 @@ import Typography from '@mui/material/Typography';
|
|
|
12
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
13
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
14
14
|
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
15
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
15
|
+
import { convertFieldResponseIntoMuiTextFieldProps, useFieldOwnerState } from '@mui/x-date-pickers/internals';
|
|
16
16
|
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
17
17
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
18
18
|
import { useMultiInputTimeRangeField } from "../internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js";
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export const multiInputTimeRangeFieldClasses = generateUtilityClasses('MuiMultiInputTimeRangeField', ['root', 'separator']);
|
|
21
21
|
export const getMultiInputTimeRangeFieldUtilityClass = slot => generateUtilityClass('MuiMultiInputTimeRangeField', slot);
|
|
22
|
-
const useUtilityClasses =
|
|
23
|
-
const {
|
|
24
|
-
classes
|
|
25
|
-
} = ownerState;
|
|
22
|
+
const useUtilityClasses = classes => {
|
|
26
23
|
const slots = {
|
|
27
24
|
root: ['root'],
|
|
28
25
|
separator: ['separator']
|
|
@@ -70,11 +67,12 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
70
67
|
slotProps,
|
|
71
68
|
unstableStartFieldRef,
|
|
72
69
|
unstableEndFieldRef,
|
|
73
|
-
className
|
|
70
|
+
className,
|
|
71
|
+
classes: classesProp
|
|
74
72
|
} = forwardedProps,
|
|
75
73
|
otherForwardedProps = _objectWithoutPropertiesLoose(forwardedProps, _excluded);
|
|
76
|
-
const ownerState = themeProps;
|
|
77
|
-
const classes = useUtilityClasses(
|
|
74
|
+
const ownerState = useFieldOwnerState(themeProps);
|
|
75
|
+
const classes = useUtilityClasses(classesProp);
|
|
78
76
|
const Root = slots?.root ?? MultiInputTimeRangeFieldRoot;
|
|
79
77
|
const rootProps = useSlotProps({
|
|
80
78
|
elementType: Root,
|
|
@@ -270,10 +268,10 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
270
268
|
*/
|
|
271
269
|
shouldDisableTime: PropTypes.func,
|
|
272
270
|
/**
|
|
273
|
-
* If `true`, the format will respect the leading zeroes (
|
|
274
|
-
* If `false`, the format will always add leading zeroes (
|
|
271
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
272
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
275
273
|
*
|
|
276
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
274
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
277
275
|
*
|
|
278
276
|
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
279
277
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import type { TypographyProps } from '@mui/material/Typography';
|
|
3
|
+
import type { StackProps } from '@mui/material/Stack';
|
|
4
|
+
import type { TextFieldProps } from '@mui/material/TextField';
|
|
5
|
+
import { FieldOwnerState } from '@mui/x-date-pickers/models';
|
|
6
|
+
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
7
|
+
import { PickersTextFieldProps } from '@mui/x-date-pickers/PickersTextField';
|
|
6
8
|
import { UseTimeRangeFieldProps } from '../internals/models/timeRange';
|
|
7
9
|
import { UseMultiInputRangeFieldParams } from '../internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types';
|
|
8
10
|
import { MultiInputFieldRefs, MultiInputRangeFieldClasses, RangePosition } from '../models';
|
|
@@ -25,7 +27,7 @@ export interface MultiInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructur
|
|
|
25
27
|
* The props used for each component slot.
|
|
26
28
|
* @default {}
|
|
27
29
|
*/
|
|
28
|
-
slotProps?: MultiInputTimeRangeFieldSlotProps
|
|
30
|
+
slotProps?: MultiInputTimeRangeFieldSlotProps;
|
|
29
31
|
}
|
|
30
32
|
export interface MultiInputTimeRangeFieldSlots {
|
|
31
33
|
/**
|
|
@@ -45,10 +47,10 @@ export interface MultiInputTimeRangeFieldSlots {
|
|
|
45
47
|
*/
|
|
46
48
|
separator?: React.ElementType;
|
|
47
49
|
}
|
|
48
|
-
export interface MultiInputTimeRangeFieldSlotProps
|
|
49
|
-
root?:
|
|
50
|
-
textField?:
|
|
50
|
+
export interface MultiInputTimeRangeFieldSlotProps {
|
|
51
|
+
root?: SlotComponentPropsFromProps<StackProps, {}, FieldOwnerState>;
|
|
52
|
+
textField?: SlotComponentPropsFromProps<PickersTextFieldProps | TextFieldProps, {}, FieldOwnerState & {
|
|
51
53
|
position: RangePosition;
|
|
52
54
|
}>;
|
|
53
|
-
separator?:
|
|
55
|
+
separator?: SlotComponentPropsFromProps<TypographyProps, {}, FieldOwnerState>;
|
|
54
56
|
}
|
package/README.md
CHANGED
|
@@ -20,13 +20,16 @@ The pickers currently support the following date libraries:
|
|
|
20
20
|
- [Moment.js](https://momentjs.com/)
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
|
|
23
|
+
# date-fns
|
|
24
24
|
npm install date-fns
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
# or dayjs
|
|
26
27
|
npm install dayjs
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
# or luxon
|
|
28
30
|
npm install luxon
|
|
29
|
-
|
|
31
|
+
|
|
32
|
+
# or moment
|
|
30
33
|
npm install moment
|
|
31
34
|
```
|
|
32
35
|
|
|
@@ -35,8 +38,8 @@ This component has the following peer dependencies that you need to install as w
|
|
|
35
38
|
```json
|
|
36
39
|
"peerDependencies": {
|
|
37
40
|
"@mui/material": "^5.15.14 || ^6.0.0",
|
|
38
|
-
"react": "^17.0.0 || ^18.0.0",
|
|
39
|
-
"react-dom": "^17.0.0 || ^18.0.0"
|
|
41
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
42
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
40
43
|
},
|
|
41
44
|
```
|
|
42
45
|
|