@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
@@ -87,6 +87,11 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.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
  */
@@ -1,5 +1,6 @@
1
+ import * as React from 'react';
1
2
  import { useField, splitFieldInternalAndForwardedProps, useDefaultizedTimeField } 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 { validateTimeRange } from '../internals/utils/validation/validateTimeRange';
4
5
  export const useSingleInputTimeRangeField = inProps => {
5
6
  const props = useDefaultizedTimeField(inProps);
@@ -7,11 +8,14 @@ export const useSingleInputTimeRangeField = inProps => {
7
8
  forwardedProps,
8
9
  internalProps
9
10
  } = splitFieldInternalAndForwardedProps(props, '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: validateTimeRange,
16
20
  valueType: 'time'
17
21
  });
@@ -217,7 +217,7 @@ StaticDateRangePicker.propTypes = {
217
217
  /**
218
218
  * Disable specific date.
219
219
  *
220
- * 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.
220
+ * 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.
221
221
  *
222
222
  * @template TDate
223
223
  * @param {TDate} day The date to test.
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v7.0.0-beta.7
2
+ * @mui/x-date-pickers-pro v7.1.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -221,7 +221,7 @@ const useSingleInputFieldSlotProps = ({
221
221
  InputProps: _extends({
222
222
  ref: anchorRef
223
223
  }, fieldProps?.InputProps),
224
- focused: open
224
+ focused: open ? true : undefined
225
225
  }, labelId != null && {
226
226
  id: labelId
227
227
  }, wrapperVariant === 'mobile' && {
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTcxMDM3MDgwMDAwMA==";
3
+ const releaseInfo = "MTcxMTU4MDQwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -35,7 +35,9 @@ export const rangeValueManager = {
35
35
  },
36
36
  setTimezone: (utils, timezone, value) => [value[0] == null ? null : utils.setTimezone(value[0], timezone), value[1] == null ? null : utils.setTimezone(value[1], timezone)]
37
37
  };
38
- export const rangeFieldValueManager = {
38
+ export const getRangeFieldValueManager = ({
39
+ dateSeparator = '–'
40
+ }) => ({
39
41
  updateReferenceValue: (utils, value, prevReferenceValue) => {
40
42
  const shouldKeepStartDate = value[0] != null && utils.isValid(value[0]);
41
43
  const shouldKeepEndDate = value[1] != null && utils.isValid(value[1]);
@@ -66,7 +68,7 @@ export const rangeFieldValueManager = {
66
68
  return _extends({}, section, {
67
69
  dateName: position,
68
70
  // TODO: Check if RTL still works
69
- endSeparator: `${section.endSeparator} `
71
+ endSeparator: `${section.endSeparator} ${dateSeparator} `
70
72
  });
71
73
  }
72
74
  return _extends({}, section, {
@@ -85,8 +87,8 @@ export const rangeFieldValueManager = {
85
87
  return createDateStrForV6InputFromSections([...dateRangeSections.startDate, ...dateRangeSections.endDate], localizedDigits, isRTL);
86
88
  },
87
89
  parseValueStr: (valueStr, referenceValue, parseDate) => {
88
- // TODO: Improve because it would not work if the date format has `–` as a separator.
89
- const [startStr, endStr] = valueStr.split('–');
90
+ // TODO: Improve because it would not work if some section have the same separator as the dateSeparator.
91
+ const [startStr, endStr] = valueStr.split(dateSeparator);
90
92
  return [startStr, endStr].map((dateStr, index) => {
91
93
  if (dateStr == null) {
92
94
  return null;
@@ -113,4 +115,4 @@ export const rangeFieldValueManager = {
113
115
  })
114
116
  };
115
117
  }
116
- };
118
+ });
@@ -655,7 +655,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
655
655
  /**
656
656
  * Disable specific date.
657
657
  *
658
- * 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.
658
+ * 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.
659
659
  *
660
660
  * @template TDate
661
661
  * @param {TDate} day The date to test.
@@ -286,7 +286,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
286
286
  /**
287
287
  * Disable specific date.
288
288
  *
289
- * 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.
289
+ * 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.
290
290
  *
291
291
  * @template TDate
292
292
  * @param {TDate} day The date to test.
@@ -77,26 +77,56 @@ const DateRangePickerDayRoot = (0, _styles.styled)('div', {
77
77
  [`&.${_dateRangePickerDayClasses.dateRangePickerDayClasses.hiddenDayFiller}`]: styles.hiddenDayFiller
78
78
  }, styles.root]
79
79
  })(({
80
- theme,
81
- ownerState
82
- }) => ownerState.isHiddenDayFiller ? {} : (0, _extends2.default)({
83
- [`&:first-of-type .${_dateRangePickerDayClasses.dateRangePickerDayClasses.rangeIntervalDayPreview}`]: (0, _extends2.default)({}, startBorderStyle, {
84
- borderLeftColor: (theme.vars || theme).palette.divider
85
- }),
86
- [`&:last-of-type .${_dateRangePickerDayClasses.dateRangePickerDayClasses.rangeIntervalDayPreview}`]: (0, _extends2.default)({}, endBorderStyle, {
87
- borderRightColor: (theme.vars || theme).palette.divider
88
- })
89
- }, ownerState.isHighlighting && {
90
- borderRadius: 0,
91
- color: (theme.vars || theme).palette.primary.contrastText,
92
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.focusOpacity})` : (0, _styles.alpha)(theme.palette.primary.main, theme.palette.action.focusOpacity),
93
- '&:first-of-type': startBorderStyle,
94
- '&:last-of-type': endBorderStyle
95
- }, (ownerState.isStartOfHighlighting || ownerState.isFirstVisibleCell) && (0, _extends2.default)({}, startBorderStyle, {
96
- paddingLeft: 0
97
- }), (ownerState.isEndOfHighlighting || ownerState.isLastVisibleCell) && (0, _extends2.default)({}, endBorderStyle, {
98
- paddingRight: 0
99
- })));
80
+ theme
81
+ }) => ({
82
+ variants: [{
83
+ props: {
84
+ isHiddenDayFiller: false
85
+ },
86
+ style: {
87
+ [`&:first-of-type .${_dateRangePickerDayClasses.dateRangePickerDayClasses.rangeIntervalDayPreview}`]: (0, _extends2.default)({}, startBorderStyle, {
88
+ borderLeftColor: (theme.vars || theme).palette.divider
89
+ }),
90
+ [`&:last-of-type .${_dateRangePickerDayClasses.dateRangePickerDayClasses.rangeIntervalDayPreview}`]: (0, _extends2.default)({}, endBorderStyle, {
91
+ borderRightColor: (theme.vars || theme).palette.divider
92
+ })
93
+ }
94
+ }, {
95
+ props: {
96
+ isHiddenDayFiller: false,
97
+ isHighlighting: true
98
+ },
99
+ style: {
100
+ borderRadius: 0,
101
+ color: (theme.vars || theme).palette.primary.contrastText,
102
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.focusOpacity})` : (0, _styles.alpha)(theme.palette.primary.main, theme.palette.action.focusOpacity),
103
+ '&:first-of-type': startBorderStyle,
104
+ '&:last-of-type': endBorderStyle
105
+ }
106
+ }, {
107
+ props: ({
108
+ ownerState: {
109
+ isHiddenDayFiller,
110
+ isStartOfHighlighting,
111
+ isFirstVisibleCell
112
+ }
113
+ }) => !isHiddenDayFiller && (isStartOfHighlighting || isFirstVisibleCell),
114
+ style: (0, _extends2.default)({}, startBorderStyle, {
115
+ paddingLeft: 0
116
+ })
117
+ }, {
118
+ props: ({
119
+ ownerState: {
120
+ isHiddenDayFiller,
121
+ isEndOfHighlighting,
122
+ isLastVisibleCell
123
+ }
124
+ }) => !isHiddenDayFiller && (isEndOfHighlighting || isLastVisibleCell),
125
+ style: (0, _extends2.default)({}, endBorderStyle, {
126
+ paddingRight: 0
127
+ })
128
+ }]
129
+ }));
100
130
  DateRangePickerDayRoot.propTypes = {
101
131
  // ----------------------------- Warning --------------------------------
102
132
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -115,21 +145,47 @@ const DateRangePickerDayRangeIntervalPreview = (0, _styles.styled)('div', {
115
145
  [`&.${_dateRangePickerDayClasses.dateRangePickerDayClasses.rangeIntervalDayPreviewEnd}`]: styles.rangeIntervalDayPreviewEnd
116
146
  }, styles.rangeIntervalPreview]
117
147
  })(({
118
- theme,
119
- ownerState
120
- }) => (0, _extends2.default)({
148
+ theme
149
+ }) => ({
121
150
  // replace default day component margin with transparent border to avoid jumping on preview
122
- border: '2px solid transparent'
123
- }, ownerState.isPreviewing && !ownerState.isHiddenDayFiller && (0, _extends2.default)({
124
- borderRadius: 0,
125
- border: `2px dashed ${(theme.vars || theme).palette.divider}`,
126
- borderLeftColor: 'transparent',
127
- borderRightColor: 'transparent'
128
- }, (ownerState.isStartOfPreviewing || ownerState.isFirstVisibleCell) && (0, _extends2.default)({
129
- borderLeftColor: (theme.vars || theme).palette.divider
130
- }, startBorderStyle), (ownerState.isEndOfPreviewing || ownerState.isLastVisibleCell) && (0, _extends2.default)({
131
- borderRightColor: (theme.vars || theme).palette.divider
132
- }, endBorderStyle))));
151
+ border: '2px solid transparent',
152
+ variants: [{
153
+ props: {
154
+ isPreviewing: true,
155
+ isHiddenDayFiller: false
156
+ },
157
+ style: {
158
+ borderRadius: 0,
159
+ border: `2px dashed ${(theme.vars || theme).palette.divider}`,
160
+ borderLeftColor: 'transparent',
161
+ borderRightColor: 'transparent'
162
+ }
163
+ }, {
164
+ props: ({
165
+ ownerState: {
166
+ isPreviewing,
167
+ isHiddenDayFiller,
168
+ isStartOfPreviewing,
169
+ isFirstVisibleCell
170
+ }
171
+ }) => isPreviewing && !isHiddenDayFiller && (isStartOfPreviewing || isFirstVisibleCell),
172
+ style: (0, _extends2.default)({
173
+ borderLeftColor: (theme.vars || theme).palette.divider
174
+ }, startBorderStyle)
175
+ }, {
176
+ props: ({
177
+ ownerState: {
178
+ isPreviewing,
179
+ isHiddenDayFiller,
180
+ isEndOfPreviewing,
181
+ isLastVisibleCell
182
+ }
183
+ }) => isPreviewing && !isHiddenDayFiller && (isEndOfPreviewing || isLastVisibleCell),
184
+ style: (0, _extends2.default)({
185
+ borderRightColor: (theme.vars || theme).palette.divider
186
+ }, endBorderStyle)
187
+ }]
188
+ }));
133
189
  DateRangePickerDayRangeIntervalPreview.propTypes = {
134
190
  // ----------------------------- Warning --------------------------------
135
191
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -147,19 +203,22 @@ const DateRangePickerDayDay = (0, _styles.styled)(_PickersDay.PickersDay, {
147
203
  }, {
148
204
  [`&.${_dateRangePickerDayClasses.dateRangePickerDayClasses.notSelectedDate}`]: styles.notSelectedDate
149
205
  }, styles.day]
150
- })(({
151
- ownerState
152
- }) => (0, _extends2.default)({
206
+ })({
153
207
  // Required to overlap preview border
154
208
  transform: 'scale(1.1)',
155
209
  '& > *': {
156
210
  transform: 'scale(0.9)'
157
- }
158
- }, ownerState.draggable && {
159
- cursor: 'grab'
160
- }, ownerState.draggable && {
161
- touchAction: 'none'
162
- }));
211
+ },
212
+ variants: [{
213
+ props: {
214
+ draggable: true
215
+ },
216
+ style: {
217
+ cursor: 'grab',
218
+ touchAction: 'none'
219
+ }
220
+ }]
221
+ });
163
222
  const DateRangePickerDayRaw = /*#__PURE__*/React.forwardRef(function DateRangePickerDay(inProps, ref) {
164
223
  const props = (0, _styles.useThemeProps)({
165
224
  props: inProps,
@@ -275,6 +334,11 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
275
334
  * @default false
276
335
  */
277
336
  disableTouchRipple: _propTypes.default.bool,
337
+ /**
338
+ * If `true`, the day can be dragged to change the current date range.
339
+ * @default false
340
+ */
341
+ draggable: _propTypes.default.bool,
278
342
  /**
279
343
  * If `true`, the base button will have a keyboard focus ripple.
280
344
  * @default false
@@ -18,6 +18,16 @@ var _jsxRuntime = require("react/jsx-runtime");
18
18
  const _excluded = ["desktopModeMediaQuery"];
19
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
+ /**
22
+ * Demos:
23
+ *
24
+ * - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
25
+ * - [Validation](https://mui.com/x/react-date-pickers/validation/)
26
+ *
27
+ * API:
28
+ *
29
+ * - [DateTimeRangePicker API](https://mui.com/x/api/date-pickers/date-time-range-picker/)
30
+ */
21
31
  const DateTimeRangePicker = exports.DateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DateTimeRangePicker(inProps, ref) {
22
32
  const props = (0, _styles.useThemeProps)({
23
33
  props: inProps,
@@ -321,7 +331,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
321
331
  /**
322
332
  * Disable specific date.
323
333
  *
324
- * 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.
334
+ * 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.
325
335
  *
326
336
  * @template TDate
327
337
  * @param {TDate} day The date to test.
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.DateTimeRangePickerToolbar = void 0;
8
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
@@ -43,24 +43,40 @@ const DateTimeRangePickerToolbarStart = (0, _styles.styled)(_DateTimePicker.Date
43
43
  name: 'MuiDateTimeRangePickerToolbar',
44
44
  slot: 'StartToolbar',
45
45
  overridesResolver: (_, styles) => styles.startToolbar
46
- })(({
47
- ownerState
48
- }) => (0, _extends2.default)({
49
- borderBottom: 'none'
50
- }, ownerState?.toolbarVariant !== 'desktop' ? {
51
- padding: '12px 8px 0 12px'
52
- } : {
53
- paddingBottom: 0
54
- }));
46
+ })({
47
+ borderBottom: 'none',
48
+ variants: [{
49
+ props: ({
50
+ toolbarVariant
51
+ }) => toolbarVariant !== 'desktop',
52
+ style: {
53
+ padding: '12px 8px 0 12px'
54
+ }
55
+ }, {
56
+ props: {
57
+ toolbarVariant: 'desktop'
58
+ },
59
+ style: {
60
+ paddingBottom: 0
61
+ }
62
+ }]
63
+ });
55
64
  const DateTimeRangePickerToolbarEnd = (0, _styles.styled)(_DateTimePicker.DateTimePickerToolbar, {
56
65
  name: 'MuiDateTimeRangePickerToolbar',
57
66
  slot: 'EndToolbar',
58
67
  overridesResolver: (_, styles) => styles.endToolbar
59
- })(({
60
- ownerState
61
- }) => ({
62
- padding: ownerState?.toolbarVariant !== 'desktop' ? '12px 8px 12px 12px' : undefined
63
- }));
68
+ })({
69
+ variants: [{
70
+ props: ({
71
+ ownerState: {
72
+ toolbarVariant
73
+ }
74
+ }) => toolbarVariant !== 'desktop',
75
+ style: {
76
+ padding: '12px 8px 12px 12px'
77
+ }
78
+ }]
79
+ });
64
80
  const DateTimeRangePickerToolbar = exports.DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTimeRangePickerToolbar(inProps, ref) {
65
81
  const props = (0, _styles.useThemeProps)({
66
82
  props: inProps,
@@ -291,7 +291,7 @@ DesktopDateRangePicker.propTypes = {
291
291
  /**
292
292
  * Disable specific date.
293
293
  *
294
- * 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.
294
+ * 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.
295
295
  *
296
296
  * @template TDate
297
297
  * @param {TDate} day The date to test.
@@ -16,6 +16,7 @@ var _timeViewRenderers = require("@mui/x-date-pickers/timeViewRenderers");
16
16
  var _MultiSectionDigitalClock = require("@mui/x-date-pickers/MultiSectionDigitalClock");
17
17
  var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
18
18
  var _DigitalClock = require("@mui/x-date-pickers/DigitalClock");
19
+ var _DesktopDateTimePicker = require("@mui/x-date-pickers/DesktopDateTimePicker");
19
20
  var _valueManagers = require("../internals/utils/valueManagers");
20
21
  var _dateRangeViewRenderers = require("../dateRangeViewRenderers");
21
22
  var _useDesktopRangePicker = require("../internals/hooks/useDesktopRangePicker");
@@ -24,28 +25,27 @@ var _shared = require("../DateTimeRangePicker/shared");
24
25
  var _MultiInputDateTimeRangeField = require("../MultiInputDateTimeRangeField");
25
26
  var _DateTimeRangePickerTimeWrapper = require("../DateTimeRangePicker/DateTimeRangePickerTimeWrapper");
26
27
  var _dimensions = require("../internals/constants/dimensions");
27
- var _DesktopDateTimeRangePickerLayout = require("./DesktopDateTimeRangePickerLayout");
28
28
  var _jsxRuntime = require("react/jsx-runtime");
29
- const _excluded = ["openTo", "rangePosition", "sx"];
29
+ const _excluded = ["openTo", "rangePosition"];
30
30
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
31
31
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
32
32
  const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
33
33
  const {
34
34
  openTo,
35
- rangePosition,
36
- sx
35
+ rangePosition
37
36
  } = rendererProps,
38
37
  otherProps = (0, _objectWithoutPropertiesLoose2.default)(rendererProps, _excluded);
39
38
  const finalProps = (0, _extends2.default)({}, otherProps, {
40
39
  rangePosition,
41
40
  focusedView: null,
42
41
  sx: [{
43
- borderBottom: 0,
44
- width: 'auto',
42
+ [`&.${_MultiSectionDigitalClock.multiSectionDigitalClockClasses.root}`]: {
43
+ borderBottom: 0
44
+ },
45
45
  [`&.${_MultiSectionDigitalClock.multiSectionDigitalClockClasses.root}, .${_MultiSectionDigitalClock.multiSectionDigitalClockSectionClasses.root}, &.${_DigitalClock.digitalClockClasses.root}`]: {
46
46
  maxHeight: _dimensions.RANGE_VIEW_HEIGHT
47
47
  }
48
- }, ...(Array.isArray(sx) ? sx : [sx])]
48
+ }]
49
49
  });
50
50
  const isTimeViewActive = (0, _internals.isInternalTimeView)(popperView);
51
51
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
@@ -57,11 +57,22 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
57
57
  orientation: "vertical"
58
58
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DateTimeRangePickerTimeWrapper.DateTimeRangePickerTimeWrapper, (0, _extends2.default)({}, finalProps, {
59
59
  view: isTimeViewActive ? popperView : 'hours',
60
+ views: finalProps.views.filter(_internals.isInternalTimeView),
60
61
  openTo: (0, _internals.isInternalTimeView)(openTo) ? openTo : 'hours',
61
62
  viewRenderer: inViewRenderers[isTimeViewActive ? popperView : 'hours']
62
63
  }))]
63
64
  });
64
65
  };
66
+ /**
67
+ * Demos:
68
+ *
69
+ * - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
70
+ * - [Validation](https://mui.com/x/react-date-pickers/validation/)
71
+ *
72
+ * API:
73
+ *
74
+ * - [DesktopDateTimeRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-range-picker/)
75
+ */
65
76
  const DesktopDateTimeRangePicker = exports.DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimeRangePicker(inProps, ref) {
66
77
  // Props with the default values common to all date time range pickers
67
78
  const defaultizedProps = (0, _shared.useDateTimeRangePickerDefaultizedProps)(inProps, 'MuiDesktopDateTimeRangePicker');
@@ -86,7 +97,7 @@ const DesktopDateTimeRangePicker = exports.DesktopDateTimeRangePicker = /*#__PUR
86
97
  calendars: defaultizedProps.calendars ?? 1,
87
98
  slots: (0, _extends2.default)({
88
99
  field: _MultiInputDateTimeRangeField.MultiInputDateTimeRangeField,
89
- layout: _DesktopDateTimeRangePickerLayout.DesktopDateTimeRangePickerLayout
100
+ layout: _DesktopDateTimePicker.DesktopDateTimePickerLayout
90
101
  }, defaultizedProps.slots),
91
102
  slotProps: (0, _extends2.default)({}, defaultizedProps.slotProps, {
92
103
  field: ownerState => (0, _extends2.default)({}, (0, _utils.resolveComponentProps)(defaultizedProps.slotProps?.field, ownerState), (0, _internals.extractValidationProps)(defaultizedProps), {
@@ -389,7 +400,7 @@ DesktopDateTimeRangePicker.propTypes = {
389
400
  /**
390
401
  * Disable specific date.
391
402
  *
392
- * 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.
403
+ * 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.
393
404
  *
394
405
  * @template TDate
395
406
  * @param {TDate} day The date to test.
@@ -287,7 +287,7 @@ MobileDateRangePicker.propTypes = {
287
287
  /**
288
288
  * Disable specific date.
289
289
  *
290
- * 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.
290
+ * 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.
291
291
  *
292
292
  * @template TDate
293
293
  * @param {TDate} day The date to test.
@@ -24,15 +24,14 @@ var _MultiInputDateTimeRangeField = require("../MultiInputDateTimeRangeField");
24
24
  var _DateTimeRangePickerTimeWrapper = require("../DateTimeRangePicker/DateTimeRangePickerTimeWrapper");
25
25
  var _dimensions = require("../internals/constants/dimensions");
26
26
  var _jsxRuntime = require("react/jsx-runtime");
27
- const _excluded = ["view", "openTo", "rangePosition", "sx"];
27
+ const _excluded = ["view", "openTo", "rangePosition"];
28
28
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
29
29
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
30
30
  const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
31
31
  const {
32
32
  view,
33
33
  openTo,
34
- rangePosition,
35
- sx
34
+ rangePosition
36
35
  } = rendererProps,
37
36
  otherRendererProps = (0, _objectWithoutPropertiesLoose2.default)(rendererProps, _excluded);
38
37
  const finalProps = (0, _extends2.default)({}, otherRendererProps, {
@@ -57,7 +56,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
57
56
  [`&.${_MultiSectionDigitalClock.multiSectionDigitalClockClasses.root}, .${_MultiSectionDigitalClock.multiSectionDigitalClockSectionClasses.root}`]: {
58
57
  maxHeight: _dimensions.RANGE_VIEW_HEIGHT - 1
59
58
  }
60
- }, ...(Array.isArray(sx) ? sx : [sx])]
59
+ }]
61
60
  });
62
61
  const isTimeView = (0, _internals.isInternalTimeView)(popperView);
63
62
  const viewRenderer = inViewRenderers[popperView];
@@ -68,6 +67,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
68
67
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DateTimeRangePickerTimeWrapper.DateTimeRangePickerTimeWrapper, (0, _extends2.default)({}, finalProps, {
69
68
  viewRenderer: viewRenderer,
70
69
  view: view && (0, _internals.isInternalTimeView)(view) ? view : 'hours',
70
+ views: finalProps.views,
71
71
  openTo: (0, _internals.isInternalTimeView)(openTo) ? openTo : 'hours'
72
72
  }));
73
73
  }
@@ -80,6 +80,16 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
80
80
  openTo: (0, _internals.isDatePickerView)(openTo) ? openTo : 'day'
81
81
  }));
82
82
  };
83
+ /**
84
+ * Demos:
85
+ *
86
+ * - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
87
+ * - [Validation](https://mui.com/x/react-date-pickers/validation/)
88
+ *
89
+ * API:
90
+ *
91
+ * - [MobileDateTimeRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-range-picker/)
92
+ */
83
93
  const MobileDateTimeRangePicker = exports.MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimeRangePicker(inProps, ref) {
84
94
  // Props with the default values common to all date time range pickers
85
95
  const defaultizedProps = (0, _shared.useDateTimeRangePickerDefaultizedProps)(inProps, 'MuiMobileDateTimeRangePicker');
@@ -393,7 +403,7 @@ MobileDateTimeRangePicker.propTypes = {
393
403
  /**
394
404
  * Disable specific date.
395
405
  *
396
- * 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.
406
+ * 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.
397
407
  *
398
408
  * @template TDate
399
409
  * @param {TDate} day The date to test.
@@ -46,9 +46,7 @@ const MultiInputDateRangeFieldRoot = (0, _styles.styled)( /*#__PURE__*/React.for
46
46
  slot: 'Root',
47
47
  overridesResolver: (props, styles) => styles.root
48
48
  })({});
49
- const MultiInputDateRangeFieldSeparator = (0, _styles.styled)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, (0, _extends2.default)({}, props, {
50
- children: props.children ?? ' – '
51
- })), {
49
+ const MultiInputDateRangeFieldSeparator = (0, _styles.styled)(_Typography.default, {
52
50
  name: 'MuiMultiInputDateRangeField',
53
51
  slot: 'Separator',
54
52
  overridesResolver: (props, styles) => styles.separator
@@ -114,6 +112,9 @@ const MultiInputDateRangeField = exports.MultiInputDateRangeField = /*#__PURE__*
114
112
  const separatorProps = (0, _utils.useSlotProps)({
115
113
  elementType: Separator,
116
114
  externalSlotProps: slotProps?.separator,
115
+ additionalProps: {
116
+ children: ` ${internalProps.dateSeparator ?? '–'} `
117
+ },
117
118
  ownerState,
118
119
  className: classes.separator
119
120
  });
@@ -149,6 +150,11 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
149
150
  classes: _propTypes.default.object,
150
151
  className: _propTypes.default.string,
151
152
  component: _propTypes.default.elementType,
153
+ /**
154
+ * String displayed between the start and the end dates.
155
+ * @default "–"
156
+ */
157
+ dateSeparator: _propTypes.default.string,
152
158
  /**
153
159
  * The default value. Use when the component is not controlled.
154
160
  */
@@ -246,7 +252,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
246
252
  /**
247
253
  * Disable specific date.
248
254
  *
249
- * 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.
255
+ * 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.
250
256
  *
251
257
  * @template TDate
252
258
  * @param {TDate} day The date to test.