@mui/x-date-pickers-pro 7.0.0-beta.7 → 7.1.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +266 -12
  2. package/DateRangeCalendar/DateRangeCalendar.js +17 -22
  3. package/DateRangeCalendar/useDragRange.js +1 -2
  4. package/DateRangePicker/DateRangePicker.js +1 -1
  5. package/DateRangePicker/shared.js +3 -5
  6. package/DateRangePickerDay/DateRangePickerDay.d.ts +5 -0
  7. package/DateRangePickerDay/DateRangePickerDay.js +107 -43
  8. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +10 -0
  9. package/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
  10. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +4 -5
  11. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +2 -3
  12. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +31 -15
  13. package/DateTimeRangePicker/shared.d.ts +5 -4
  14. package/DateTimeRangePicker/shared.js +9 -10
  15. package/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -10
  16. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +10 -0
  17. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +31 -28
  18. package/MobileDateRangePicker/MobileDateRangePicker.js +5 -9
  19. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +10 -0
  20. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -14
  21. package/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -15
  22. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -15
  23. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -14
  24. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +1 -1
  25. package/README.md +1 -1
  26. package/SingleInputDateRangeField/SingleInputDateRangeField.js +8 -4
  27. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
  28. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +8 -4
  29. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
  30. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +7 -3
  31. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
  32. package/StaticDateRangePicker/StaticDateRangePicker.js +4 -5
  33. package/index.js +1 -1
  34. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +9 -11
  35. package/internals/hooks/useEnrichedRangePickerFieldProps.js +26 -32
  36. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -10
  37. package/internals/hooks/useMultiInputFieldSelectedSections.js +3 -6
  38. package/internals/hooks/useRangePosition.js +3 -5
  39. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -18
  40. package/internals/models/dateRange.d.ts +3 -3
  41. package/internals/models/dateTimeRange.d.ts +2 -2
  42. package/internals/models/timeRange.d.ts +2 -2
  43. package/internals/utils/releaseInfo.js +1 -1
  44. package/internals/utils/validation/validateDateRange.js +2 -2
  45. package/internals/utils/validation/validateDateTimeRange.js +2 -2
  46. package/internals/utils/valueManagers.d.ts +3 -1
  47. package/internals/utils/valueManagers.js +9 -7
  48. package/models/fields.d.ts +8 -1
  49. package/modern/DateRangeCalendar/DateRangeCalendar.js +1 -1
  50. package/modern/DateRangePicker/DateRangePicker.js +1 -1
  51. package/modern/DateRangePickerDay/DateRangePickerDay.js +107 -43
  52. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
  53. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +31 -15
  54. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  55. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
  56. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  57. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
  58. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -4
  59. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -4
  60. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +9 -3
  61. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
  62. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
  63. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
  64. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
  65. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
  66. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
  67. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  68. package/modern/index.js +1 -1
  69. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +1 -1
  70. package/modern/internals/utils/releaseInfo.js +1 -1
  71. package/modern/internals/utils/valueManagers.js +7 -5
  72. package/node/DateRangeCalendar/DateRangeCalendar.js +1 -1
  73. package/node/DateRangePicker/DateRangePicker.js +1 -1
  74. package/node/DateRangePickerDay/DateRangePickerDay.js +107 -43
  75. package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
  76. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +31 -15
  77. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  78. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
  79. package/node/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  80. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
  81. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -4
  82. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -4
  83. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +9 -3
  84. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
  85. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +7 -1
  86. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
  87. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +7 -1
  88. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
  89. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +7 -1
  90. package/node/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  91. package/node/index.js +1 -1
  92. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +1 -1
  93. package/node/internals/utils/releaseInfo.js +1 -1
  94. package/node/internals/utils/valueManagers.js +9 -6
  95. package/package.json +7 -7
  96. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.d.ts +0 -9
  97. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -52
  98. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -51
  99. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -59
@@ -68,26 +68,56 @@ const DateRangePickerDayRoot = styled('div', {
68
68
  [`&.${dateRangePickerDayClasses.hiddenDayFiller}`]: styles.hiddenDayFiller
69
69
  }, styles.root]
70
70
  })(({
71
- theme,
72
- ownerState
73
- }) => ownerState.isHiddenDayFiller ? {} : _extends({
74
- [`&:first-of-type .${dateRangePickerDayClasses.rangeIntervalDayPreview}`]: _extends({}, startBorderStyle, {
75
- borderLeftColor: (theme.vars || theme).palette.divider
76
- }),
77
- [`&:last-of-type .${dateRangePickerDayClasses.rangeIntervalDayPreview}`]: _extends({}, endBorderStyle, {
78
- borderRightColor: (theme.vars || theme).palette.divider
79
- })
80
- }, ownerState.isHighlighting && {
81
- borderRadius: 0,
82
- color: (theme.vars || theme).palette.primary.contrastText,
83
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.focusOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.focusOpacity),
84
- '&:first-of-type': startBorderStyle,
85
- '&:last-of-type': endBorderStyle
86
- }, (ownerState.isStartOfHighlighting || ownerState.isFirstVisibleCell) && _extends({}, startBorderStyle, {
87
- paddingLeft: 0
88
- }), (ownerState.isEndOfHighlighting || ownerState.isLastVisibleCell) && _extends({}, endBorderStyle, {
89
- paddingRight: 0
90
- })));
71
+ theme
72
+ }) => ({
73
+ variants: [{
74
+ props: {
75
+ isHiddenDayFiller: false
76
+ },
77
+ style: {
78
+ [`&:first-of-type .${dateRangePickerDayClasses.rangeIntervalDayPreview}`]: _extends({}, startBorderStyle, {
79
+ borderLeftColor: (theme.vars || theme).palette.divider
80
+ }),
81
+ [`&:last-of-type .${dateRangePickerDayClasses.rangeIntervalDayPreview}`]: _extends({}, endBorderStyle, {
82
+ borderRightColor: (theme.vars || theme).palette.divider
83
+ })
84
+ }
85
+ }, {
86
+ props: {
87
+ isHiddenDayFiller: false,
88
+ isHighlighting: true
89
+ },
90
+ style: {
91
+ borderRadius: 0,
92
+ color: (theme.vars || theme).palette.primary.contrastText,
93
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.focusOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.focusOpacity),
94
+ '&:first-of-type': startBorderStyle,
95
+ '&:last-of-type': endBorderStyle
96
+ }
97
+ }, {
98
+ props: ({
99
+ ownerState: {
100
+ isHiddenDayFiller,
101
+ isStartOfHighlighting,
102
+ isFirstVisibleCell
103
+ }
104
+ }) => !isHiddenDayFiller && (isStartOfHighlighting || isFirstVisibleCell),
105
+ style: _extends({}, startBorderStyle, {
106
+ paddingLeft: 0
107
+ })
108
+ }, {
109
+ props: ({
110
+ ownerState: {
111
+ isHiddenDayFiller,
112
+ isEndOfHighlighting,
113
+ isLastVisibleCell
114
+ }
115
+ }) => !isHiddenDayFiller && (isEndOfHighlighting || isLastVisibleCell),
116
+ style: _extends({}, endBorderStyle, {
117
+ paddingRight: 0
118
+ })
119
+ }]
120
+ }));
91
121
  DateRangePickerDayRoot.propTypes = {
92
122
  // ----------------------------- Warning --------------------------------
93
123
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -106,21 +136,47 @@ const DateRangePickerDayRangeIntervalPreview = styled('div', {
106
136
  [`&.${dateRangePickerDayClasses.rangeIntervalDayPreviewEnd}`]: styles.rangeIntervalDayPreviewEnd
107
137
  }, styles.rangeIntervalPreview]
108
138
  })(({
109
- theme,
110
- ownerState
111
- }) => _extends({
139
+ theme
140
+ }) => ({
112
141
  // replace default day component margin with transparent border to avoid jumping on preview
113
- border: '2px solid transparent'
114
- }, ownerState.isPreviewing && !ownerState.isHiddenDayFiller && _extends({
115
- borderRadius: 0,
116
- border: `2px dashed ${(theme.vars || theme).palette.divider}`,
117
- borderLeftColor: 'transparent',
118
- borderRightColor: 'transparent'
119
- }, (ownerState.isStartOfPreviewing || ownerState.isFirstVisibleCell) && _extends({
120
- borderLeftColor: (theme.vars || theme).palette.divider
121
- }, startBorderStyle), (ownerState.isEndOfPreviewing || ownerState.isLastVisibleCell) && _extends({
122
- borderRightColor: (theme.vars || theme).palette.divider
123
- }, endBorderStyle))));
142
+ border: '2px solid transparent',
143
+ variants: [{
144
+ props: {
145
+ isPreviewing: true,
146
+ isHiddenDayFiller: false
147
+ },
148
+ style: {
149
+ borderRadius: 0,
150
+ border: `2px dashed ${(theme.vars || theme).palette.divider}`,
151
+ borderLeftColor: 'transparent',
152
+ borderRightColor: 'transparent'
153
+ }
154
+ }, {
155
+ props: ({
156
+ ownerState: {
157
+ isPreviewing,
158
+ isHiddenDayFiller,
159
+ isStartOfPreviewing,
160
+ isFirstVisibleCell
161
+ }
162
+ }) => isPreviewing && !isHiddenDayFiller && (isStartOfPreviewing || isFirstVisibleCell),
163
+ style: _extends({
164
+ borderLeftColor: (theme.vars || theme).palette.divider
165
+ }, startBorderStyle)
166
+ }, {
167
+ props: ({
168
+ ownerState: {
169
+ isPreviewing,
170
+ isHiddenDayFiller,
171
+ isEndOfPreviewing,
172
+ isLastVisibleCell
173
+ }
174
+ }) => isPreviewing && !isHiddenDayFiller && (isEndOfPreviewing || isLastVisibleCell),
175
+ style: _extends({
176
+ borderRightColor: (theme.vars || theme).palette.divider
177
+ }, endBorderStyle)
178
+ }]
179
+ }));
124
180
  DateRangePickerDayRangeIntervalPreview.propTypes = {
125
181
  // ----------------------------- Warning --------------------------------
126
182
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -138,19 +194,22 @@ const DateRangePickerDayDay = styled(PickersDay, {
138
194
  }, {
139
195
  [`&.${dateRangePickerDayClasses.notSelectedDate}`]: styles.notSelectedDate
140
196
  }, styles.day]
141
- })(({
142
- ownerState
143
- }) => _extends({
197
+ })({
144
198
  // Required to overlap preview border
145
199
  transform: 'scale(1.1)',
146
200
  '& > *': {
147
201
  transform: 'scale(0.9)'
148
- }
149
- }, ownerState.draggable && {
150
- cursor: 'grab'
151
- }, ownerState.draggable && {
152
- touchAction: 'none'
153
- }));
202
+ },
203
+ variants: [{
204
+ props: {
205
+ draggable: true
206
+ },
207
+ style: {
208
+ cursor: 'grab',
209
+ touchAction: 'none'
210
+ }
211
+ }]
212
+ });
154
213
  const DateRangePickerDayRaw = /*#__PURE__*/React.forwardRef(function DateRangePickerDay(inProps, ref) {
155
214
  const props = useThemeProps({
156
215
  props: inProps,
@@ -266,6 +325,11 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
266
325
  * @default false
267
326
  */
268
327
  disableTouchRipple: PropTypes.bool,
328
+ /**
329
+ * If `true`, the day can be dragged to change the current date range.
330
+ * @default false
331
+ */
332
+ draggable: PropTypes.bool,
269
333
  /**
270
334
  * If `true`, the base button will have a keyboard focus ripple.
271
335
  * @default false
@@ -9,6 +9,16 @@ import { useThemeProps } from '@mui/material/styles';
9
9
  import { DesktopDateTimeRangePicker } from '../DesktopDateTimeRangePicker';
10
10
  import { MobileDateTimeRangePicker } from '../MobileDateTimeRangePicker';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+ /**
13
+ * Demos:
14
+ *
15
+ * - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
16
+ * - [Validation](https://mui.com/x/react-date-pickers/validation/)
17
+ *
18
+ * API:
19
+ *
20
+ * - [DateTimeRangePicker API](https://mui.com/x/api/date-pickers/date-time-range-picker/)
21
+ */
12
22
  const DateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DateTimeRangePicker(inProps, ref) {
13
23
  const props = useThemeProps({
14
24
  props: inProps,
@@ -312,7 +322,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
312
322
  /**
313
323
  * Disable specific date.
314
324
  *
315
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
325
+ * 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.
316
326
  *
317
327
  * @template TDate
318
328
  * @param {TDate} day The date to test.
@@ -1,5 +1,5 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "disabled", "readOnly", "hidden", "toolbarFormat", "toolbarPlaceholder", "titleId", "sx"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
@@ -35,24 +35,40 @@ const DateTimeRangePickerToolbarStart = styled(DateTimePickerToolbar, {
35
35
  name: 'MuiDateTimeRangePickerToolbar',
36
36
  slot: 'StartToolbar',
37
37
  overridesResolver: (_, styles) => styles.startToolbar
38
- })(({
39
- ownerState
40
- }) => _extends({
41
- borderBottom: 'none'
42
- }, ownerState?.toolbarVariant !== 'desktop' ? {
43
- padding: '12px 8px 0 12px'
44
- } : {
45
- paddingBottom: 0
46
- }));
38
+ })({
39
+ borderBottom: 'none',
40
+ variants: [{
41
+ props: ({
42
+ toolbarVariant
43
+ }) => toolbarVariant !== 'desktop',
44
+ style: {
45
+ padding: '12px 8px 0 12px'
46
+ }
47
+ }, {
48
+ props: {
49
+ toolbarVariant: 'desktop'
50
+ },
51
+ style: {
52
+ paddingBottom: 0
53
+ }
54
+ }]
55
+ });
47
56
  const DateTimeRangePickerToolbarEnd = styled(DateTimePickerToolbar, {
48
57
  name: 'MuiDateTimeRangePickerToolbar',
49
58
  slot: 'EndToolbar',
50
59
  overridesResolver: (_, styles) => styles.endToolbar
51
- })(({
52
- ownerState
53
- }) => ({
54
- padding: ownerState?.toolbarVariant !== 'desktop' ? '12px 8px 12px 12px' : undefined
55
- }));
60
+ })({
61
+ variants: [{
62
+ props: ({
63
+ ownerState: {
64
+ toolbarVariant
65
+ }
66
+ }) => toolbarVariant !== 'desktop',
67
+ style: {
68
+ padding: '12px 8px 12px 12px'
69
+ }
70
+ }]
71
+ });
56
72
  const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTimeRangePickerToolbar(inProps, ref) {
57
73
  const props = useThemeProps({
58
74
  props: inProps,
@@ -282,7 +282,7 @@ DesktopDateRangePicker.propTypes = {
282
282
  /**
283
283
  * Disable specific date.
284
284
  *
285
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
285
+ * 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.
286
286
  *
287
287
  * @template TDate
288
288
  * @param {TDate} day The date to test.
@@ -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 = ["openTo", "rangePosition", "sx"];
3
+ const _excluded = ["openTo", "rangePosition"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { extractValidationProps, isDatePickerView, isInternalTimeView } from '@mui/x-date-pickers/internals';
@@ -10,6 +10,7 @@ import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } fr
10
10
  import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '@mui/x-date-pickers/MultiSectionDigitalClock';
11
11
  import Divider from '@mui/material/Divider';
12
12
  import { digitalClockClasses } from '@mui/x-date-pickers/DigitalClock';
13
+ import { DesktopDateTimePickerLayout } from '@mui/x-date-pickers/DesktopDateTimePicker';
13
14
  import { rangeValueManager } from '../internals/utils/valueManagers';
14
15
  import { renderDateRangeViewCalendar } from '../dateRangeViewRenderers';
15
16
  import { useDesktopRangePicker } from '../internals/hooks/useDesktopRangePicker';
@@ -18,26 +19,25 @@ import { useDateTimeRangePickerDefaultizedProps } from '../DateTimeRangePicker/s
18
19
  import { MultiInputDateTimeRangeField } from '../MultiInputDateTimeRangeField';
19
20
  import { DateTimeRangePickerTimeWrapper } from '../DateTimeRangePicker/DateTimeRangePickerTimeWrapper';
20
21
  import { RANGE_VIEW_HEIGHT } from '../internals/constants/dimensions';
21
- import { DesktopDateTimeRangePickerLayout } from './DesktopDateTimeRangePickerLayout';
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
23
23
  import { jsxs as _jsxs } from "react/jsx-runtime";
24
24
  const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
25
25
  const {
26
26
  openTo,
27
- rangePosition,
28
- sx
27
+ rangePosition
29
28
  } = rendererProps,
30
29
  otherProps = _objectWithoutPropertiesLoose(rendererProps, _excluded);
31
30
  const finalProps = _extends({}, otherProps, {
32
31
  rangePosition,
33
32
  focusedView: null,
34
33
  sx: [{
35
- borderBottom: 0,
36
- width: 'auto',
34
+ [`&.${multiSectionDigitalClockClasses.root}`]: {
35
+ borderBottom: 0
36
+ },
37
37
  [`&.${multiSectionDigitalClockClasses.root}, .${multiSectionDigitalClockSectionClasses.root}, &.${digitalClockClasses.root}`]: {
38
38
  maxHeight: RANGE_VIEW_HEIGHT
39
39
  }
40
- }, ...(Array.isArray(sx) ? sx : [sx])]
40
+ }]
41
41
  });
42
42
  const isTimeViewActive = isInternalTimeView(popperView);
43
43
  return /*#__PURE__*/_jsxs(React.Fragment, {
@@ -49,11 +49,22 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
49
49
  orientation: "vertical"
50
50
  }), /*#__PURE__*/_jsx(DateTimeRangePickerTimeWrapper, _extends({}, finalProps, {
51
51
  view: isTimeViewActive ? popperView : 'hours',
52
+ views: finalProps.views.filter(isInternalTimeView),
52
53
  openTo: isInternalTimeView(openTo) ? openTo : 'hours',
53
54
  viewRenderer: inViewRenderers[isTimeViewActive ? popperView : 'hours']
54
55
  }))]
55
56
  });
56
57
  };
58
+ /**
59
+ * Demos:
60
+ *
61
+ * - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
62
+ * - [Validation](https://mui.com/x/react-date-pickers/validation/)
63
+ *
64
+ * API:
65
+ *
66
+ * - [DesktopDateTimeRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-range-picker/)
67
+ */
57
68
  const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimeRangePicker(inProps, ref) {
58
69
  // Props with the default values common to all date time range pickers
59
70
  const defaultizedProps = useDateTimeRangePickerDefaultizedProps(inProps, 'MuiDesktopDateTimeRangePicker');
@@ -78,7 +89,7 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
78
89
  calendars: defaultizedProps.calendars ?? 1,
79
90
  slots: _extends({
80
91
  field: MultiInputDateTimeRangeField,
81
- layout: DesktopDateTimeRangePickerLayout
92
+ layout: DesktopDateTimePickerLayout
82
93
  }, defaultizedProps.slots),
83
94
  slotProps: _extends({}, defaultizedProps.slotProps, {
84
95
  field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
@@ -381,7 +392,7 @@ DesktopDateTimeRangePicker.propTypes = {
381
392
  /**
382
393
  * Disable specific date.
383
394
  *
384
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
395
+ * 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.
385
396
  *
386
397
  * @template TDate
387
398
  * @param {TDate} day The date to test.
@@ -278,7 +278,7 @@ MobileDateRangePicker.propTypes = {
278
278
  /**
279
279
  * Disable specific date.
280
280
  *
281
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
281
+ * 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.
282
282
  *
283
283
  * @template TDate
284
284
  * @param {TDate} day The date to test.
@@ -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 = ["view", "openTo", "rangePosition", "sx"];
3
+ const _excluded = ["view", "openTo", "rangePosition"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { refType } from '@mui/utils';
@@ -22,8 +22,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
22
22
  const {
23
23
  view,
24
24
  openTo,
25
- rangePosition,
26
- sx
25
+ rangePosition
27
26
  } = rendererProps,
28
27
  otherRendererProps = _objectWithoutPropertiesLoose(rendererProps, _excluded);
29
28
  const finalProps = _extends({}, otherRendererProps, {
@@ -48,7 +47,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
48
47
  [`&.${multiSectionDigitalClockClasses.root}, .${multiSectionDigitalClockSectionClasses.root}`]: {
49
48
  maxHeight: RANGE_VIEW_HEIGHT - 1
50
49
  }
51
- }, ...(Array.isArray(sx) ? sx : [sx])]
50
+ }]
52
51
  });
53
52
  const isTimeView = isInternalTimeView(popperView);
54
53
  const viewRenderer = inViewRenderers[popperView];
@@ -59,6 +58,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
59
58
  return /*#__PURE__*/_jsx(DateTimeRangePickerTimeWrapper, _extends({}, finalProps, {
60
59
  viewRenderer: viewRenderer,
61
60
  view: view && isInternalTimeView(view) ? view : 'hours',
61
+ views: finalProps.views,
62
62
  openTo: isInternalTimeView(openTo) ? openTo : 'hours'
63
63
  }));
64
64
  }
@@ -71,6 +71,16 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
71
71
  openTo: isDatePickerView(openTo) ? openTo : 'day'
72
72
  }));
73
73
  };
74
+ /**
75
+ * Demos:
76
+ *
77
+ * - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
78
+ * - [Validation](https://mui.com/x/react-date-pickers/validation/)
79
+ *
80
+ * API:
81
+ *
82
+ * - [MobileDateTimeRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-range-picker/)
83
+ */
74
84
  const MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimeRangePicker(inProps, ref) {
75
85
  // Props with the default values common to all date time range pickers
76
86
  const defaultizedProps = useDateTimeRangePickerDefaultizedProps(inProps, 'MuiMobileDateTimeRangePicker');
@@ -384,7 +394,7 @@ MobileDateTimeRangePicker.propTypes = {
384
394
  /**
385
395
  * Disable specific date.
386
396
  *
387
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
397
+ * 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.
388
398
  *
389
399
  * @template TDate
390
400
  * @param {TDate} day The date to test.
@@ -37,9 +37,7 @@ const MultiInputDateRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((prop
37
37
  slot: 'Root',
38
38
  overridesResolver: (props, styles) => styles.root
39
39
  })({});
40
- const MultiInputDateRangeFieldSeparator = styled(props => /*#__PURE__*/_jsx(Typography, _extends({}, props, {
41
- children: props.children ?? ' – '
42
- })), {
40
+ const MultiInputDateRangeFieldSeparator = styled(Typography, {
43
41
  name: 'MuiMultiInputDateRangeField',
44
42
  slot: 'Separator',
45
43
  overridesResolver: (props, styles) => styles.separator
@@ -105,6 +103,9 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
105
103
  const separatorProps = useSlotProps({
106
104
  elementType: Separator,
107
105
  externalSlotProps: slotProps?.separator,
106
+ additionalProps: {
107
+ children: ` ${internalProps.dateSeparator ?? '–'} `
108
+ },
108
109
  ownerState,
109
110
  className: classes.separator
110
111
  });
@@ -140,6 +141,11 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
140
141
  classes: PropTypes.object,
141
142
  className: PropTypes.string,
142
143
  component: PropTypes.elementType,
144
+ /**
145
+ * String displayed between the start and the end dates.
146
+ * @default "–"
147
+ */
148
+ dateSeparator: PropTypes.string,
143
149
  /**
144
150
  * The default value. Use when the component is not controlled.
145
151
  */
@@ -237,7 +243,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
237
243
  /**
238
244
  * Disable specific date.
239
245
  *
240
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
246
+ * 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.
241
247
  *
242
248
  * @template TDate
243
249
  * @param {TDate} day The date to test.
@@ -37,9 +37,7 @@ const MultiInputDateTimeRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((
37
37
  slot: 'Root',
38
38
  overridesResolver: (props, styles) => styles.root
39
39
  })({});
40
- const MultiInputDateTimeRangeFieldSeparator = styled(props => /*#__PURE__*/_jsx(Typography, _extends({}, props, {
41
- children: props.children ?? ' – '
42
- })), {
40
+ const MultiInputDateTimeRangeFieldSeparator = styled(Typography, {
43
41
  name: 'MuiMultiInputDateTimeRangeField',
44
42
  slot: 'Separator',
45
43
  overridesResolver: (props, styles) => styles.separator
@@ -105,6 +103,9 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
105
103
  const separatorProps = useSlotProps({
106
104
  elementType: Separator,
107
105
  externalSlotProps: slotProps?.separator,
106
+ additionalProps: {
107
+ children: ` ${internalProps.dateSeparator ?? '–'} `
108
+ },
108
109
  ownerState,
109
110
  className: classes.separator
110
111
  });
@@ -145,6 +146,11 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
145
146
  classes: PropTypes.object,
146
147
  className: PropTypes.string,
147
148
  component: PropTypes.elementType,
149
+ /**
150
+ * String displayed between the start and the end dates.
151
+ * @default "–"
152
+ */
153
+ dateSeparator: PropTypes.string,
148
154
  /**
149
155
  * The default value. Use when the component is not controlled.
150
156
  */
@@ -270,7 +276,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
270
276
  /**
271
277
  * Disable specific date.
272
278
  *
273
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
279
+ * 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.
274
280
  *
275
281
  * @template TDate
276
282
  * @param {TDate} day The date to test.
@@ -37,9 +37,7 @@ const MultiInputTimeRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((prop
37
37
  slot: 'Root',
38
38
  overridesResolver: (props, styles) => styles.root
39
39
  })({});
40
- const MultiInputTimeRangeFieldSeparator = styled(props => /*#__PURE__*/_jsx(Typography, _extends({}, props, {
41
- children: props.children ?? ' – '
42
- })), {
40
+ const MultiInputTimeRangeFieldSeparator = styled(Typography, {
43
41
  name: 'MuiMultiInputTimeRangeField',
44
42
  slot: 'Separator',
45
43
  overridesResolver: (props, styles) => styles.separator
@@ -105,6 +103,9 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
105
103
  const separatorProps = useSlotProps({
106
104
  elementType: Separator,
107
105
  externalSlotProps: slotProps?.separator,
106
+ additionalProps: {
107
+ children: ` ${internalProps.dateSeparator ?? '–'} `
108
+ },
108
109
  ownerState,
109
110
  className: classes.separator
110
111
  });
@@ -145,6 +146,11 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
145
146
  classes: PropTypes.object,
146
147
  className: PropTypes.string,
147
148
  component: PropTypes.elementType,
149
+ /**
150
+ * String displayed between the start and the end dates.
151
+ * @default "–"
152
+ */
153
+ dateSeparator: PropTypes.string,
148
154
  /**
149
155
  * The default value. Use when the component is not controlled.
150
156
  */
@@ -82,6 +82,11 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
82
82
  */
83
83
  color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
84
84
  component: PropTypes.elementType,
85
+ /**
86
+ * String displayed between the start and the end dates.
87
+ * @default "–"
88
+ */
89
+ dateSeparator: PropTypes.string,
85
90
  /**
86
91
  * The default value. Use when the component is not controlled.
87
92
  */
@@ -242,7 +247,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
242
247
  /**
243
248
  * Disable specific date.
244
249
  *
245
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
250
+ * 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.
246
251
  *
247
252
  * @template TDate
248
253
  * @param {TDate} day The date to test.
@@ -1,5 +1,6 @@
1
+ import * as React from 'react';
1
2
  import { useField, splitFieldInternalAndForwardedProps, useDefaultizedDateField } from '@mui/x-date-pickers/internals';
2
- import { rangeValueManager, rangeFieldValueManager } from '../internals/utils/valueManagers';
3
+ import { rangeValueManager, getRangeFieldValueManager } from '../internals/utils/valueManagers';
3
4
  import { validateDateRange } from '../internals/utils/validation/validateDateRange';
4
5
  export const useSingleInputDateRangeField = inProps => {
5
6
  const props = useDefaultizedDateField(inProps);
@@ -7,11 +8,14 @@ export const useSingleInputDateRangeField = inProps => {
7
8
  forwardedProps,
8
9
  internalProps
9
10
  } = splitFieldInternalAndForwardedProps(props, 'date');
11
+ const fieldValueManager = React.useMemo(() => getRangeFieldValueManager({
12
+ dateSeparator: internalProps.dateSeparator
13
+ }), [internalProps.dateSeparator]);
10
14
  return useField({
11
15
  forwardedProps,
12
16
  internalProps,
13
17
  valueManager: rangeValueManager,
14
- fieldValueManager: rangeFieldValueManager,
18
+ fieldValueManager,
15
19
  validator: validateDateRange,
16
20
  valueType: 'date'
17
21
  });
@@ -87,6 +87,11 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
87
87
  */
88
88
  color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
89
89
  component: PropTypes.elementType,
90
+ /**
91
+ * String displayed between the start and the end dates.
92
+ * @default "–"
93
+ */
94
+ dateSeparator: PropTypes.string,
90
95
  /**
91
96
  * The default value. Use when the component is not controlled.
92
97
  */
@@ -275,7 +280,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
275
280
  /**
276
281
  * Disable specific date.
277
282
  *
278
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
283
+ * 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.
279
284
  *
280
285
  * @template TDate
281
286
  * @param {TDate} day The date to test.
@@ -1,5 +1,6 @@
1
+ import * as React from 'react';
1
2
  import { useField, splitFieldInternalAndForwardedProps, useDefaultizedDateTimeField } from '@mui/x-date-pickers/internals';
2
- import { rangeValueManager, rangeFieldValueManager } from '../internals/utils/valueManagers';
3
+ import { rangeValueManager, getRangeFieldValueManager } from '../internals/utils/valueManagers';
3
4
  import { validateDateTimeRange } from '../internals/utils/validation/validateDateTimeRange';
4
5
  export const useSingleInputDateTimeRangeField = inProps => {
5
6
  const props = useDefaultizedDateTimeField(inProps);
@@ -7,11 +8,14 @@ export const useSingleInputDateTimeRangeField = inProps => {
7
8
  forwardedProps,
8
9
  internalProps
9
10
  } = splitFieldInternalAndForwardedProps(props, 'date-time');
11
+ const fieldValueManager = React.useMemo(() => getRangeFieldValueManager({
12
+ dateSeparator: internalProps.dateSeparator
13
+ }), [internalProps.dateSeparator]);
10
14
  return useField({
11
15
  forwardedProps,
12
16
  internalProps,
13
17
  valueManager: rangeValueManager,
14
- fieldValueManager: rangeFieldValueManager,
18
+ fieldValueManager,
15
19
  validator: validateDateTimeRange,
16
20
  valueType: 'date-time'
17
21
  });