@mui/x-date-pickers-pro 8.0.0-beta.1 → 8.0.0-beta.3
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 +235 -0
- package/DateRangeCalendar/DateRangeCalendar.js +2 -7
- package/DateRangePicker/shared.js +2 -7
- package/DateRangePickerDay/DateRangePickerDay.js +1 -1
- package/DateTimeRangePicker/shared.js +2 -11
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +9 -1
- package/DesktopTimeRangePicker/DesktopTimeRangePicker.js +9 -1
- package/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -1
- package/MobileTimeRangePicker/MobileTimeRangePicker.js +9 -1
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
- package/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
- package/TimeRangePicker/shared.js +2 -3
- package/esm/DateRangeCalendar/DateRangeCalendar.js +3 -8
- package/esm/DateRangePicker/shared.js +3 -8
- package/esm/DateRangePickerDay/DateRangePickerDay.js +1 -1
- package/esm/DateTimeRangePicker/shared.js +3 -12
- package/esm/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
- package/esm/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +9 -1
- package/esm/DesktopTimeRangePicker/DesktopTimeRangePicker.js +9 -1
- package/esm/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
- package/esm/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +16 -2
- package/esm/MobileTimeRangePicker/MobileTimeRangePicker.js +9 -1
- package/esm/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
- package/esm/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
- package/esm/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
- package/esm/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
- package/esm/TimeRangePicker/shared.js +3 -4
- package/esm/index.js +1 -1
- package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -0
- package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +10 -3
- package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -3
- package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -0
- package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +10 -3
- package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -3
- package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -0
- package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -3
- package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +7 -0
- package/esm/internals/models/rangePickerProps.d.ts +14 -0
- package/esm/internals/utils/createRangePickerStepNavigation.d.ts +16 -0
- package/esm/internals/utils/createRangePickerStepNavigation.js +31 -0
- package/esm/internals/utils/releaseInfo.js +1 -1
- package/esm/managers/useDateRangeManager.js +9 -10
- package/esm/managers/useDateTimeRangeManager.js +10 -10
- package/esm/managers/useTimeRangeManager.js +10 -8
- package/index.js +1 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -0
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +10 -3
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -3
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -0
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +10 -3
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -3
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -0
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -3
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +7 -0
- package/internals/models/rangePickerProps.d.ts +14 -0
- package/internals/utils/createRangePickerStepNavigation.d.ts +16 -0
- package/internals/utils/createRangePickerStepNavigation.js +37 -0
- package/internals/utils/releaseInfo.js +1 -1
- package/managers/useDateRangeManager.js +8 -9
- package/managers/useDateTimeRangeManager.js +9 -9
- package/managers/useTimeRangeManager.js +9 -7
- package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -8
- package/modern/DateRangePicker/shared.js +3 -8
- package/modern/DateRangePickerDay/DateRangePickerDay.js +1 -1
- package/modern/DateTimeRangePicker/shared.js +3 -12
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +9 -1
- package/modern/DesktopTimeRangePicker/DesktopTimeRangePicker.js +9 -1
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +16 -2
- package/modern/MobileTimeRangePicker/MobileTimeRangePicker.js +9 -1
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
- package/modern/TimeRangePicker/shared.js +3 -4
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -0
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +10 -3
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -3
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -0
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +10 -3
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -3
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -0
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -3
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +7 -0
- package/modern/internals/models/rangePickerProps.d.ts +14 -0
- package/modern/internals/utils/createRangePickerStepNavigation.d.ts +16 -0
- package/modern/internals/utils/createRangePickerStepNavigation.js +31 -0
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/managers/useDateRangeManager.js +9 -10
- package/modern/managers/useDateTimeRangeManager.js +10 -10
- package/modern/managers/useTimeRangeManager.js +10 -8
- package/package.json +8 -8
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/internals/hooks/models/index.d.ts +0 -1
- package/esm/internals/hooks/models/index.js +0 -1
- package/esm/internals/hooks/models/useRangePicker.d.ts +0 -8
- package/esm/internals/hooks/models/useRangePicker.js +0 -1
- package/internals/hooks/models/index.d.ts +0 -1
- package/internals/hooks/models/index.js +0 -5
- package/internals/hooks/models/useRangePicker.d.ts +0 -8
- package/internals/hooks/models/useRangePicker.js +0 -5
- package/modern/internals/hooks/models/index.d.ts +0 -1
- package/modern/internals/hooks/models/index.js +0 -1
- package/modern/internals/hooks/models/useRangePicker.d.ts +0 -8
- package/modern/internals/hooks/models/useRangePicker.js +0 -1
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useThemeProps } from '@mui/material/styles';
|
|
4
|
-
import {
|
|
4
|
+
import { useApplyDefaultValuesToDateValidationProps } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { DateRangePickerToolbar } from "./DateRangePickerToolbar.js";
|
|
6
6
|
export function useDateRangePickerDefaultizedProps(props, name) {
|
|
7
|
-
const utils = useUtils();
|
|
8
|
-
const defaultDates = useDefaultDates();
|
|
9
7
|
const themeProps = useThemeProps({
|
|
10
8
|
props,
|
|
11
9
|
name
|
|
12
10
|
});
|
|
11
|
+
const validationProps = useApplyDefaultValuesToDateValidationProps(themeProps);
|
|
13
12
|
const localeText = React.useMemo(() => {
|
|
14
13
|
if (themeProps.localeText?.toolbarTitle == null) {
|
|
15
14
|
return themeProps.localeText;
|
|
@@ -18,12 +17,8 @@ export function useDateRangePickerDefaultizedProps(props, name) {
|
|
|
18
17
|
dateRangePickerToolbarTitle: themeProps.localeText.toolbarTitle
|
|
19
18
|
});
|
|
20
19
|
}, [themeProps.localeText]);
|
|
21
|
-
return _extends({}, themeProps, {
|
|
20
|
+
return _extends({}, themeProps, validationProps, {
|
|
22
21
|
localeText,
|
|
23
|
-
disableFuture: themeProps.disableFuture ?? false,
|
|
24
|
-
disablePast: themeProps.disablePast ?? false,
|
|
25
|
-
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
|
|
26
|
-
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
|
|
27
22
|
slots: _extends({
|
|
28
23
|
toolbar: DateRangePickerToolbar
|
|
29
24
|
}, themeProps.slots)
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { useThemeProps } from '@mui/material/styles';
|
|
3
|
-
import {
|
|
3
|
+
import { useUtils, applyDefaultViewProps, resolveTimeViewsResponse, useApplyDefaultValuesToDateTimeValidationProps } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import { DateTimeRangePickerToolbar } from "./DateTimeRangePickerToolbar.js";
|
|
5
5
|
import { DateTimeRangePickerTabs } from "./DateTimeRangePickerTabs.js";
|
|
6
6
|
export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
7
7
|
const utils = useUtils();
|
|
8
|
-
const defaultDates = useDefaultDates();
|
|
9
8
|
const themeProps = useThemeProps({
|
|
10
9
|
props,
|
|
11
10
|
name
|
|
12
11
|
});
|
|
12
|
+
const validationProps = useApplyDefaultValuesToDateTimeValidationProps(themeProps);
|
|
13
13
|
const ampm = themeProps.ampm ?? utils.is12HourCycleInCurrentLocale();
|
|
14
14
|
const {
|
|
15
15
|
openTo,
|
|
@@ -31,22 +31,13 @@ export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
|
31
31
|
timeSteps: themeProps.timeSteps,
|
|
32
32
|
views: defaultViews
|
|
33
33
|
});
|
|
34
|
-
return _extends({}, themeProps, {
|
|
34
|
+
return _extends({}, themeProps, validationProps, {
|
|
35
35
|
timeSteps,
|
|
36
36
|
openTo,
|
|
37
37
|
shouldRenderTimeInASingleColumn,
|
|
38
38
|
thresholdToRenderTimeInASingleColumn,
|
|
39
39
|
views,
|
|
40
40
|
ampm,
|
|
41
|
-
disableFuture: themeProps.disableFuture ?? false,
|
|
42
|
-
disablePast: themeProps.disablePast ?? false,
|
|
43
|
-
minDate: applyDefaultDate(utils, themeProps.minDateTime ?? themeProps.minDate, defaultDates.minDate),
|
|
44
|
-
maxDate: applyDefaultDate(utils, themeProps.maxDateTime ?? themeProps.maxDate, defaultDates.maxDate),
|
|
45
|
-
minTime: themeProps.minDateTime ?? themeProps.minTime,
|
|
46
|
-
maxTime: themeProps.maxDateTime ?? themeProps.maxTime,
|
|
47
|
-
disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
|
|
48
|
-
// allow digital clocks to correctly check time validity: https://github.com/mui/mui-x/issues/12048
|
|
49
|
-
themeProps.disablePast || themeProps.disableFuture),
|
|
50
41
|
slots: _extends({
|
|
51
42
|
tabs: DateTimeRangePickerTabs,
|
|
52
43
|
toolbar: DateTimeRangePickerToolbar
|
|
@@ -60,7 +60,8 @@ const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDat
|
|
|
60
60
|
props,
|
|
61
61
|
valueManager: rangeValueManager,
|
|
62
62
|
valueType: 'date',
|
|
63
|
-
validator: validateDateRange
|
|
63
|
+
validator: validateDateRange,
|
|
64
|
+
steps: null
|
|
64
65
|
});
|
|
65
66
|
return renderPicker();
|
|
66
67
|
});
|
|
@@ -24,6 +24,13 @@ import { DateTimeRangePickerTimeWrapper } from "../DateTimeRangePicker/DateTimeR
|
|
|
24
24
|
import { RANGE_VIEW_HEIGHT } from "../internals/constants/dimensions.js";
|
|
25
25
|
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
26
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
+
const STEPS = [{
|
|
28
|
+
views: null,
|
|
29
|
+
rangePosition: 'start'
|
|
30
|
+
}, {
|
|
31
|
+
views: null,
|
|
32
|
+
rangePosition: 'end'
|
|
33
|
+
}];
|
|
27
34
|
const rendererInterceptor = function RendererInterceptor(props) {
|
|
28
35
|
const {
|
|
29
36
|
viewRenderers,
|
|
@@ -128,7 +135,8 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
|
|
|
128
135
|
valueManager: rangeValueManager,
|
|
129
136
|
valueType: 'date-time',
|
|
130
137
|
validator: validateDateTimeRange,
|
|
131
|
-
rendererInterceptor
|
|
138
|
+
rendererInterceptor,
|
|
139
|
+
steps: STEPS
|
|
132
140
|
});
|
|
133
141
|
return renderPicker();
|
|
134
142
|
});
|
|
@@ -20,6 +20,13 @@ import { validateTimeRange } from "../validation/validateTimeRange.js";
|
|
|
20
20
|
import { RANGE_VIEW_HEIGHT } from "../internals/constants/dimensions.js";
|
|
21
21
|
import { TimeRangePickerTimeWrapper } from "../TimeRangePicker/TimeRangePickerTimeWrapper.js";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
const STEPS = [{
|
|
24
|
+
views: null,
|
|
25
|
+
rangePosition: 'start'
|
|
26
|
+
}, {
|
|
27
|
+
views: null,
|
|
28
|
+
rangePosition: 'end'
|
|
29
|
+
}];
|
|
23
30
|
const rendererInterceptor = function RendererInterceptor(props) {
|
|
24
31
|
const {
|
|
25
32
|
viewRenderers,
|
|
@@ -101,7 +108,8 @@ const DesktopTimeRangePicker = /*#__PURE__*/React.forwardRef(function DesktopTim
|
|
|
101
108
|
valueManager: rangeValueManager,
|
|
102
109
|
valueType: 'time',
|
|
103
110
|
validator: validateTimeRange,
|
|
104
|
-
rendererInterceptor
|
|
111
|
+
rendererInterceptor,
|
|
112
|
+
steps: STEPS
|
|
105
113
|
});
|
|
106
114
|
return renderPicker();
|
|
107
115
|
});
|
|
@@ -57,7 +57,8 @@ const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateR
|
|
|
57
57
|
props,
|
|
58
58
|
valueManager: rangeValueManager,
|
|
59
59
|
valueType: 'date',
|
|
60
|
-
validator: validateDateRange
|
|
60
|
+
validator: validateDateRange,
|
|
61
|
+
steps: null
|
|
61
62
|
});
|
|
62
63
|
return renderPicker();
|
|
63
64
|
});
|
|
@@ -6,7 +6,7 @@ const _excluded = ["view", "openTo"];
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { refType } from '@mui/utils';
|
|
9
|
-
import { DIALOG_WIDTH, VIEW_HEIGHT, isInternalTimeView, isDatePickerView, resolveDateTimeFormat, useUtils } from '@mui/x-date-pickers/internals';
|
|
9
|
+
import { DIALOG_WIDTH, VIEW_HEIGHT, isInternalTimeView, isDatePickerView, resolveDateTimeFormat, useUtils, TIME_VIEWS } from '@mui/x-date-pickers/internals';
|
|
10
10
|
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
11
11
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
12
12
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
@@ -22,6 +22,19 @@ import { DateTimeRangePickerTimeWrapper } from "../DateTimeRangePicker/DateTimeR
|
|
|
22
22
|
import { RANGE_VIEW_HEIGHT } from "../internals/constants/dimensions.js";
|
|
23
23
|
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
24
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
+
const STEPS = [{
|
|
26
|
+
views: ['day'],
|
|
27
|
+
rangePosition: 'start'
|
|
28
|
+
}, {
|
|
29
|
+
views: TIME_VIEWS,
|
|
30
|
+
rangePosition: 'start'
|
|
31
|
+
}, {
|
|
32
|
+
views: ['day'],
|
|
33
|
+
rangePosition: 'end'
|
|
34
|
+
}, {
|
|
35
|
+
views: TIME_VIEWS,
|
|
36
|
+
rangePosition: 'end'
|
|
37
|
+
}];
|
|
25
38
|
const rendererInterceptor = function RendererInterceptor(props) {
|
|
26
39
|
const {
|
|
27
40
|
viewRenderers,
|
|
@@ -133,7 +146,8 @@ const MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileD
|
|
|
133
146
|
valueManager: rangeValueManager,
|
|
134
147
|
valueType: 'date-time',
|
|
135
148
|
validator: validateDateTimeRange,
|
|
136
|
-
rendererInterceptor
|
|
149
|
+
rendererInterceptor,
|
|
150
|
+
steps: STEPS
|
|
137
151
|
});
|
|
138
152
|
return renderPicker();
|
|
139
153
|
});
|
|
@@ -18,6 +18,13 @@ import { validateTimeRange } from "../validation/validateTimeRange.js";
|
|
|
18
18
|
import { RANGE_VIEW_HEIGHT } from "../internals/constants/dimensions.js";
|
|
19
19
|
import { TimeRangePickerTimeWrapper } from "../TimeRangePicker/TimeRangePickerTimeWrapper.js";
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const STEPS = [{
|
|
22
|
+
views: null,
|
|
23
|
+
rangePosition: 'start'
|
|
24
|
+
}, {
|
|
25
|
+
views: null,
|
|
26
|
+
rangePosition: 'end'
|
|
27
|
+
}];
|
|
21
28
|
const rendererInterceptor = function rendererInterceptor(props) {
|
|
22
29
|
const {
|
|
23
30
|
viewRenderers,
|
|
@@ -91,7 +98,8 @@ const MobileTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileTimeR
|
|
|
91
98
|
valueManager: rangeValueManager,
|
|
92
99
|
valueType: 'time',
|
|
93
100
|
validator: validateTimeRange,
|
|
94
|
-
rendererInterceptor
|
|
101
|
+
rendererInterceptor,
|
|
102
|
+
steps: STEPS
|
|
95
103
|
});
|
|
96
104
|
return renderPicker();
|
|
97
105
|
});
|
|
@@ -119,7 +119,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
119
119
|
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
120
120
|
/**
|
|
121
121
|
* Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
|
|
122
|
-
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in
|
|
122
|
+
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
123
123
|
*/
|
|
124
124
|
FormHelperTextProps: PropTypes.object,
|
|
125
125
|
/**
|
|
@@ -146,12 +146,12 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
146
146
|
/**
|
|
147
147
|
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
|
|
148
148
|
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
149
|
-
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in
|
|
149
|
+
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
150
150
|
*/
|
|
151
151
|
InputLabelProps: PropTypes.object,
|
|
152
152
|
/**
|
|
153
153
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
154
|
-
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in
|
|
154
|
+
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
155
155
|
*/
|
|
156
156
|
inputProps: PropTypes.object,
|
|
157
157
|
/**
|
|
@@ -159,7 +159,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
159
159
|
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
|
|
160
160
|
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
|
|
161
161
|
* component depending on the `variant` prop value.
|
|
162
|
-
* @deprecated Use `slotProps.input` instead. This prop will be removed in
|
|
162
|
+
* @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
163
163
|
*/
|
|
164
164
|
InputProps: PropTypes.object,
|
|
165
165
|
/**
|
|
@@ -129,7 +129,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
129
129
|
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
130
130
|
/**
|
|
131
131
|
* Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
|
|
132
|
-
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in
|
|
132
|
+
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
133
133
|
*/
|
|
134
134
|
FormHelperTextProps: PropTypes.object,
|
|
135
135
|
/**
|
|
@@ -156,12 +156,12 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
156
156
|
/**
|
|
157
157
|
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
|
|
158
158
|
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
159
|
-
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in
|
|
159
|
+
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
160
160
|
*/
|
|
161
161
|
InputLabelProps: PropTypes.object,
|
|
162
162
|
/**
|
|
163
163
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
164
|
-
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in
|
|
164
|
+
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
165
165
|
*/
|
|
166
166
|
inputProps: PropTypes.object,
|
|
167
167
|
/**
|
|
@@ -169,7 +169,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
169
169
|
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
|
|
170
170
|
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
|
|
171
171
|
* component depending on the `variant` prop value.
|
|
172
|
-
* @deprecated Use `slotProps.input` instead. This prop will be removed in
|
|
172
|
+
* @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
173
173
|
*/
|
|
174
174
|
InputProps: PropTypes.object,
|
|
175
175
|
/**
|
|
@@ -129,7 +129,7 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
129
129
|
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
130
130
|
/**
|
|
131
131
|
* Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
|
|
132
|
-
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in
|
|
132
|
+
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
133
133
|
*/
|
|
134
134
|
FormHelperTextProps: PropTypes.object,
|
|
135
135
|
/**
|
|
@@ -156,12 +156,12 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
156
156
|
/**
|
|
157
157
|
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
|
|
158
158
|
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
|
159
|
-
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in
|
|
159
|
+
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
160
160
|
*/
|
|
161
161
|
InputLabelProps: PropTypes.object,
|
|
162
162
|
/**
|
|
163
163
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
164
|
-
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in
|
|
164
|
+
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
165
165
|
*/
|
|
166
166
|
inputProps: PropTypes.object,
|
|
167
167
|
/**
|
|
@@ -169,7 +169,7 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
169
169
|
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
|
|
170
170
|
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
|
|
171
171
|
* component depending on the `variant` prop value.
|
|
172
|
-
* @deprecated Use `slotProps.input` instead. This prop will be removed in
|
|
172
|
+
* @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
173
173
|
*/
|
|
174
174
|
InputProps: PropTypes.object,
|
|
175
175
|
/**
|
|
@@ -45,7 +45,8 @@ const StaticDateRangePicker = /*#__PURE__*/React.forwardRef(function StaticDateR
|
|
|
45
45
|
props,
|
|
46
46
|
valueManager: rangeValueManager,
|
|
47
47
|
valueType: 'date',
|
|
48
|
-
validator: validateDateRange
|
|
48
|
+
validator: validateDateRange,
|
|
49
|
+
steps: null
|
|
49
50
|
});
|
|
50
51
|
return renderPicker();
|
|
51
52
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useThemeProps } from '@mui/material/styles';
|
|
4
|
-
import { useUtils, applyDefaultViewProps, resolveTimeViewsResponse } from '@mui/x-date-pickers/internals';
|
|
4
|
+
import { useUtils, applyDefaultViewProps, resolveTimeViewsResponse, useApplyDefaultValuesToTimeValidationProps } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { TimeRangePickerToolbar } from "./TimeRangePickerToolbar.js";
|
|
6
6
|
import { TimeRangePickerTabs } from "./TimeRangePickerTabs.js";
|
|
7
7
|
export function useTimeRangePickerDefaultizedProps(props, name) {
|
|
@@ -10,6 +10,7 @@ export function useTimeRangePickerDefaultizedProps(props, name) {
|
|
|
10
10
|
props,
|
|
11
11
|
name
|
|
12
12
|
});
|
|
13
|
+
const validationProps = useApplyDefaultValuesToTimeValidationProps(themeProps);
|
|
13
14
|
const ampm = themeProps.ampm ?? utils.is12HourCycleInCurrentLocale();
|
|
14
15
|
const {
|
|
15
16
|
openTo,
|
|
@@ -39,7 +40,7 @@ export function useTimeRangePickerDefaultizedProps(props, name) {
|
|
|
39
40
|
timeSteps: themeProps.timeSteps,
|
|
40
41
|
views: defaultViews
|
|
41
42
|
});
|
|
42
|
-
return _extends({}, themeProps, {
|
|
43
|
+
return _extends({}, themeProps, validationProps, {
|
|
43
44
|
localeText,
|
|
44
45
|
timeSteps,
|
|
45
46
|
openTo,
|
|
@@ -47,8 +48,6 @@ export function useTimeRangePickerDefaultizedProps(props, name) {
|
|
|
47
48
|
thresholdToRenderTimeInASingleColumn,
|
|
48
49
|
views,
|
|
49
50
|
ampm,
|
|
50
|
-
disableFuture: themeProps.disableFuture ?? false,
|
|
51
|
-
disablePast: themeProps.disablePast ?? false,
|
|
52
51
|
slots: _extends({
|
|
53
52
|
tabs: TimeRangePickerTabs,
|
|
54
53
|
toolbar: TimeRangePickerToolbar
|
package/esm/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
|
3
3
|
import { UseDesktopRangePickerParams, UseDesktopRangePickerProps } from "./useDesktopRangePicker.types.js";
|
|
4
4
|
export declare const useDesktopRangePicker: <TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>>({
|
|
5
5
|
props,
|
|
6
|
+
steps,
|
|
6
7
|
...pickerParams
|
|
7
8
|
}: UseDesktopRangePickerParams<TView, TEnableAccessibleFieldDOMStructure, TExternalProps>) => {
|
|
8
9
|
renderPicker: () => React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["props"],
|
|
3
|
+
const _excluded = ["props", "steps"],
|
|
4
4
|
_excluded2 = ["ownerState"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
@@ -11,11 +11,13 @@ import { getReleaseInfo } from "../../utils/releaseInfo.js";
|
|
|
11
11
|
import { useRangePosition } from "../useRangePosition.js";
|
|
12
12
|
import { PickerRangePositionContext } from "../../../hooks/usePickerRangePositionContext.js";
|
|
13
13
|
import { getRangeFieldType } from "../../utils/date-fields-utils.js";
|
|
14
|
+
import { createRangePickerStepNavigation } from "../../utils/createRangePickerStepNavigation.js";
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
const releaseInfo = getReleaseInfo();
|
|
16
17
|
export const useDesktopRangePicker = _ref => {
|
|
17
18
|
let {
|
|
18
|
-
props
|
|
19
|
+
props,
|
|
20
|
+
steps
|
|
19
21
|
} = _ref,
|
|
20
22
|
pickerParams = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
23
|
useLicenseVerifier('x-date-pickers-pro', releaseInfo);
|
|
@@ -28,6 +30,10 @@ export const useDesktopRangePicker = _ref => {
|
|
|
28
30
|
const fieldType = getRangeFieldType(slots.field);
|
|
29
31
|
const viewContainerRole = fieldType === 'single-input' ? 'dialog' : 'tooltip';
|
|
30
32
|
const rangePositionResponse = useRangePosition(props);
|
|
33
|
+
const getStepNavigation = createRangePickerStepNavigation({
|
|
34
|
+
steps,
|
|
35
|
+
rangePositionResponse
|
|
36
|
+
});
|
|
31
37
|
const {
|
|
32
38
|
providerProps,
|
|
33
39
|
renderCurrentView,
|
|
@@ -37,7 +43,8 @@ export const useDesktopRangePicker = _ref => {
|
|
|
37
43
|
variant: 'desktop',
|
|
38
44
|
autoFocusView: viewContainerRole === 'dialog',
|
|
39
45
|
viewContainerRole,
|
|
40
|
-
localeText
|
|
46
|
+
localeText,
|
|
47
|
+
getStepNavigation
|
|
41
48
|
}));
|
|
42
49
|
const Field = slots.field;
|
|
43
50
|
const _useSlotProps = useSlotProps({
|
|
@@ -2,7 +2,7 @@ import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
|
2
2
|
import { PickerFieldSlotProps, PickerOwnerState } from '@mui/x-date-pickers/models';
|
|
3
3
|
import { PickerPopperSlots, PickerPopperSlotProps, UsePickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue, PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import { ExportedPickersLayoutSlotProps, ExportedPickersLayoutSlots } from '@mui/x-date-pickers/PickersLayout';
|
|
5
|
-
import {
|
|
5
|
+
import { NonStaticRangePickerProps, NonStaticRangePickerHookParameters, UseRangePickerProps } from "../../models/index.js";
|
|
6
6
|
export interface UseDesktopRangePickerSlots extends PickerPopperSlots, ExportedPickersLayoutSlots<PickerRangeValue>, PickerFieldUISlotsFromContext {
|
|
7
7
|
/**
|
|
8
8
|
* Component used to enter the date with the keyboard.
|
|
@@ -14,7 +14,7 @@ export interface UseDesktopRangePickerSlotProps<TEnableAccessibleFieldDOMStructu
|
|
|
14
14
|
dateSeparator?: string;
|
|
15
15
|
}, {}, PickerOwnerState>;
|
|
16
16
|
}
|
|
17
|
-
export interface DesktopRangeOnlyPickerProps extends
|
|
17
|
+
export interface DesktopRangeOnlyPickerProps extends NonStaticRangePickerProps {
|
|
18
18
|
/**
|
|
19
19
|
* If `true`, the start `input` element is focused during the first mount.
|
|
20
20
|
*/
|
|
@@ -32,4 +32,4 @@ export interface UseDesktopRangePickerProps<TView extends DateOrTimeViewWithMeri
|
|
|
32
32
|
*/
|
|
33
33
|
slotProps?: UseDesktopRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
34
34
|
}
|
|
35
|
-
export interface UseDesktopRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends
|
|
35
|
+
export interface UseDesktopRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends NonStaticRangePickerHookParameters<TView, TExternalProps> {}
|
|
@@ -3,6 +3,7 @@ import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
|
3
3
|
import { UseMobileRangePickerParams, UseMobileRangePickerProps } from "./useMobileRangePicker.types.js";
|
|
4
4
|
export declare const useMobileRangePicker: <TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>>({
|
|
5
5
|
props,
|
|
6
|
+
steps,
|
|
6
7
|
...pickerParams
|
|
7
8
|
}: UseMobileRangePickerParams<TView, TEnableAccessibleFieldDOMStructure, TExternalProps>) => {
|
|
8
9
|
renderPicker: () => React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["props"],
|
|
3
|
+
const _excluded = ["props", "steps"],
|
|
4
4
|
_excluded2 = ["ownerState"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
@@ -13,11 +13,13 @@ import { getReleaseInfo } from "../../utils/releaseInfo.js";
|
|
|
13
13
|
import { useRangePosition } from "../useRangePosition.js";
|
|
14
14
|
import { PickerRangePositionContext } from "../../../hooks/usePickerRangePositionContext.js";
|
|
15
15
|
import { getRangeFieldType } from "../../utils/date-fields-utils.js";
|
|
16
|
+
import { createRangePickerStepNavigation } from "../../utils/createRangePickerStepNavigation.js";
|
|
16
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
const releaseInfo = getReleaseInfo();
|
|
18
19
|
export const useMobileRangePicker = _ref => {
|
|
19
20
|
let {
|
|
20
|
-
props
|
|
21
|
+
props,
|
|
22
|
+
steps
|
|
21
23
|
} = _ref,
|
|
22
24
|
pickerParams = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
23
25
|
useLicenseVerifier('x-date-pickers-pro', releaseInfo);
|
|
@@ -31,6 +33,10 @@ export const useMobileRangePicker = _ref => {
|
|
|
31
33
|
const fieldType = getRangeFieldType(slots.field);
|
|
32
34
|
const rangePositionResponse = useRangePosition(props);
|
|
33
35
|
const contextTranslations = usePickerTranslations();
|
|
36
|
+
const getStepNavigation = createRangePickerStepNavigation({
|
|
37
|
+
steps,
|
|
38
|
+
rangePositionResponse
|
|
39
|
+
});
|
|
34
40
|
const {
|
|
35
41
|
providerProps,
|
|
36
42
|
renderCurrentView,
|
|
@@ -40,7 +46,8 @@ export const useMobileRangePicker = _ref => {
|
|
|
40
46
|
variant: 'mobile',
|
|
41
47
|
autoFocusView: true,
|
|
42
48
|
viewContainerRole: 'dialog',
|
|
43
|
-
localeText
|
|
49
|
+
localeText,
|
|
50
|
+
getStepNavigation
|
|
44
51
|
}));
|
|
45
52
|
const labelId = providerProps.privateContextValue.labelId;
|
|
46
53
|
const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
|
|
@@ -2,7 +2,7 @@ import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
|
2
2
|
import { PickerFieldSlotProps, PickerOwnerState } from '@mui/x-date-pickers/models';
|
|
3
3
|
import { PickersModalDialogSlots, PickersModalDialogSlotProps, UsePickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue, PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import { ExportedPickersLayoutSlotProps, ExportedPickersLayoutSlots, PickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
|
|
5
|
-
import {
|
|
5
|
+
import { NonStaticRangePickerProps, NonStaticRangePickerHookParameters, UseRangePickerProps } from "../../models/index.js";
|
|
6
6
|
export interface UseMobileRangePickerSlots extends PickersModalDialogSlots, ExportedPickersLayoutSlots<PickerRangeValue>, PickerFieldUISlotsFromContext {
|
|
7
7
|
/**
|
|
8
8
|
* Component used to enter the date with the keyboard.
|
|
@@ -15,7 +15,7 @@ export interface ExportedUseMobileRangePickerSlotProps<TEnableAccessibleFieldDOM
|
|
|
15
15
|
}, {}, PickerOwnerState>;
|
|
16
16
|
}
|
|
17
17
|
export interface UseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends ExportedUseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, Pick<PickersLayoutSlotProps<PickerRangeValue>, 'toolbar'> {}
|
|
18
|
-
export interface MobileRangeOnlyPickerProps extends
|
|
18
|
+
export interface MobileRangeOnlyPickerProps extends NonStaticRangePickerProps {}
|
|
19
19
|
export interface UseMobileRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerProps<PickerRangeValue, TView, TError, any>> extends UseRangePickerProps<TView, TError, TExternalProps> {
|
|
20
20
|
/**
|
|
21
21
|
* Overridable component slots.
|
|
@@ -28,4 +28,4 @@ export interface UseMobileRangePickerProps<TView extends DateOrTimeViewWithMerid
|
|
|
28
28
|
*/
|
|
29
29
|
slotProps?: UseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
30
30
|
}
|
|
31
|
-
export interface UseMobileRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends
|
|
31
|
+
export interface UseMobileRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends NonStaticRangePickerHookParameters<TView, TExternalProps> {}
|
|
@@ -7,6 +7,7 @@ import { UseStaticRangePickerParams, UseStaticRangePickerProps } from "./useStat
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const useStaticRangePicker: <TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>>({
|
|
9
9
|
props,
|
|
10
|
+
steps,
|
|
10
11
|
...pickerParams
|
|
11
12
|
}: UseStaticRangePickerParams<TView, TExternalProps>) => {
|
|
12
13
|
renderPicker: () => React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["props"];
|
|
3
|
+
const _excluded = ["props", "steps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
@@ -8,6 +8,7 @@ import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
|
8
8
|
import { usePicker, DIALOG_WIDTH, PickerProvider, mergeSx } from '@mui/x-date-pickers/internals';
|
|
9
9
|
import { useRangePosition } from "../useRangePosition.js";
|
|
10
10
|
import { PickerRangePositionContext } from "../../../hooks/usePickerRangePositionContext.js";
|
|
11
|
+
import { createRangePickerStepNavigation } from "../../utils/createRangePickerStepNavigation.js";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
const PickerStaticLayout = styled(PickersLayout)(({
|
|
13
14
|
theme
|
|
@@ -23,7 +24,8 @@ const PickerStaticLayout = styled(PickersLayout)(({
|
|
|
23
24
|
*/
|
|
24
25
|
export const useStaticRangePicker = _ref => {
|
|
25
26
|
let {
|
|
26
|
-
props
|
|
27
|
+
props,
|
|
28
|
+
steps
|
|
27
29
|
} = _ref,
|
|
28
30
|
pickerParams = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
29
31
|
const {
|
|
@@ -34,6 +36,10 @@ export const useStaticRangePicker = _ref => {
|
|
|
34
36
|
autoFocus
|
|
35
37
|
} = props;
|
|
36
38
|
const rangePositionResponse = useRangePosition(props);
|
|
39
|
+
const getStepNavigation = createRangePickerStepNavigation({
|
|
40
|
+
steps,
|
|
41
|
+
rangePositionResponse
|
|
42
|
+
});
|
|
37
43
|
const {
|
|
38
44
|
providerProps,
|
|
39
45
|
renderCurrentView
|
|
@@ -42,7 +48,8 @@ export const useStaticRangePicker = _ref => {
|
|
|
42
48
|
variant: displayStaticWrapperAs,
|
|
43
49
|
autoFocusView: autoFocus ?? false,
|
|
44
50
|
viewContainerRole: null,
|
|
45
|
-
localeText
|
|
51
|
+
localeText,
|
|
52
|
+
getStepNavigation
|
|
46
53
|
}));
|
|
47
54
|
const Layout = slots?.layout ?? PickerStaticLayout;
|
|
48
55
|
const renderPicker = () => /*#__PURE__*/_jsx(PickerRangePositionContext.Provider, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BasePickerProps, UsePickerParameters, ExportedBaseToolbarProps, StaticOnlyPickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
2
2
|
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
|
|
3
3
|
import { UseRangePositionProps } from "../useRangePosition.js";
|
|
4
|
+
import { PickerRangeStep } from "../../utils/createRangePickerStepNavigation.js";
|
|
4
5
|
export interface UseStaticRangePickerSlots extends ExportedPickersLayoutSlots<PickerRangeValue> {}
|
|
5
6
|
export interface UseStaticRangePickerSlotProps extends ExportedPickersLayoutSlotProps<PickerRangeValue> {
|
|
6
7
|
toolbar?: ExportedBaseToolbarProps;
|
|
@@ -20,4 +21,10 @@ export interface UseStaticRangePickerProps<TView extends DateOrTimeViewWithMerid
|
|
|
20
21
|
}
|
|
21
22
|
export interface UseStaticRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParameters<PickerRangeValue, TView, TExternalProps>, 'valueManager' | 'valueType' | 'validator' | 'ref'> {
|
|
22
23
|
props: TExternalProps;
|
|
24
|
+
/**
|
|
25
|
+
* Steps available for the picker.
|
|
26
|
+
* This will be used to define the behavior of navigation actions.
|
|
27
|
+
* If null, the picker will not have any step navigation.
|
|
28
|
+
*/
|
|
29
|
+
steps: PickerRangeStep[] | null;
|
|
23
30
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { BasePickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue, UsePickerNonStaticProps, UsePickerParameters, UsePickerProps } from '@mui/x-date-pickers/internals';
|
|
1
2
|
import * as React from 'react';
|
|
3
|
+
import { UseRangePositionProps } from "../hooks/useRangePosition.js";
|
|
4
|
+
import { PickerRangeStep } from "../utils/createRangePickerStepNavigation.js";
|
|
2
5
|
/**
|
|
3
6
|
* Props common to all range non-static pickers.
|
|
4
7
|
* These props are handled by the headless wrappers.
|
|
@@ -19,4 +22,15 @@ export interface BaseRangeNonStaticPickerProps {
|
|
|
19
22
|
* Ignored if the field has several inputs.
|
|
20
23
|
*/
|
|
21
24
|
name?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface NonStaticRangePickerProps extends UsePickerNonStaticProps, BaseRangeNonStaticPickerProps, UseRangePositionProps {}
|
|
27
|
+
export interface UseRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerProps<PickerRangeValue, TView, TError, any>> extends NonStaticRangePickerProps, BasePickerProps<PickerRangeValue, TView, TError, TExternalProps> {}
|
|
28
|
+
export interface NonStaticRangePickerHookParameters<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParameters<PickerRangeValue, TView, TExternalProps>, 'valueManager' | 'valueType' | 'validator' | 'rendererInterceptor' | 'ref'> {
|
|
29
|
+
props: TExternalProps;
|
|
30
|
+
/**
|
|
31
|
+
* Steps available for the picker.
|
|
32
|
+
* This will be used to define the behavior of navigation actions.
|
|
33
|
+
* If null, the picker will not have any step navigation.
|
|
34
|
+
*/
|
|
35
|
+
steps: PickerRangeStep[] | null;
|
|
22
36
|
}
|