@mui/x-date-pickers-pro 7.0.0-beta.6 → 7.0.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 (107) hide show
  1. package/CHANGELOG.md +311 -12
  2. package/DateRangeCalendar/DateRangeCalendar.js +34 -74
  3. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +3 -2
  4. package/DateRangeCalendar/useDragRange.js +1 -2
  5. package/DateRangePicker/DateRangePicker.js +1 -1
  6. package/DateRangePicker/shared.js +3 -5
  7. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +10 -0
  8. package/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
  9. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +4 -5
  10. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +2 -3
  11. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +2 -2
  12. package/DateTimeRangePicker/shared.d.ts +5 -4
  13. package/DateTimeRangePicker/shared.js +9 -10
  14. package/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -10
  15. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +10 -0
  16. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +31 -28
  17. package/MobileDateRangePicker/MobileDateRangePicker.js +5 -9
  18. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +10 -0
  19. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -14
  20. package/MultiInputDateRangeField/MultiInputDateRangeField.js +21 -17
  21. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +21 -17
  22. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +20 -16
  23. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.d.ts +8 -0
  24. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +124 -0
  25. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.d.ts +18 -0
  26. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.js +1 -0
  27. package/PickersRangeCalendarHeader/index.d.ts +2 -0
  28. package/PickersRangeCalendarHeader/index.js +1 -0
  29. package/PickersRangeCalendarHeader/package.json +6 -0
  30. package/README.md +1 -1
  31. package/SingleInputDateRangeField/SingleInputDateRangeField.js +8 -4
  32. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
  33. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +8 -4
  34. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
  35. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +7 -3
  36. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
  37. package/StaticDateRangePicker/StaticDateRangePicker.js +4 -5
  38. package/index.d.ts +1 -0
  39. package/index.js +2 -1
  40. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +9 -11
  41. package/internals/hooks/useEnrichedRangePickerFieldProps.js +25 -31
  42. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -10
  43. package/internals/hooks/useMultiInputFieldSelectedSections.js +3 -6
  44. package/internals/hooks/useRangePosition.js +3 -5
  45. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -18
  46. package/internals/models/dateRange.d.ts +3 -3
  47. package/internals/models/dateTimeRange.d.ts +2 -2
  48. package/internals/models/timeRange.d.ts +2 -2
  49. package/internals/utils/releaseInfo.js +1 -1
  50. package/internals/utils/validation/validateDateRange.js +2 -2
  51. package/internals/utils/validation/validateDateTimeRange.js +2 -2
  52. package/internals/utils/valueManagers.d.ts +3 -1
  53. package/internals/utils/valueManagers.js +9 -7
  54. package/models/fields.d.ts +8 -1
  55. package/modern/DateRangeCalendar/DateRangeCalendar.js +40 -72
  56. package/modern/DateRangePicker/DateRangePicker.js +1 -1
  57. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
  58. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  59. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
  60. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  61. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
  62. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +14 -6
  63. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +14 -6
  64. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +13 -5
  65. package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +124 -0
  66. package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.js +1 -0
  67. package/modern/PickersRangeCalendarHeader/index.js +1 -0
  68. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
  69. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
  70. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
  71. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
  72. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
  73. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
  74. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  75. package/modern/index.js +2 -1
  76. package/modern/internals/utils/releaseInfo.js +1 -1
  77. package/modern/internals/utils/valueManagers.js +7 -5
  78. package/node/DateRangeCalendar/DateRangeCalendar.js +39 -71
  79. package/node/DateRangePicker/DateRangePicker.js +1 -1
  80. package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
  81. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  82. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
  83. package/node/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  84. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
  85. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +14 -6
  86. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +14 -6
  87. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +13 -5
  88. package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +132 -0
  89. package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.js +5 -0
  90. package/node/PickersRangeCalendarHeader/index.js +12 -0
  91. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
  92. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +7 -1
  93. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
  94. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +7 -1
  95. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
  96. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +7 -1
  97. package/node/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  98. package/node/index.js +13 -1
  99. package/node/internals/utils/releaseInfo.js +1 -1
  100. package/node/internals/utils/valueManagers.js +9 -6
  101. package/package.json +7 -7
  102. package/themeAugmentation/components.d.ts +3 -0
  103. package/themeAugmentation/props.d.ts +2 -0
  104. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.d.ts +0 -9
  105. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -52
  106. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -51
  107. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -59
@@ -17,7 +17,7 @@ export const rangeValueManager = {
17
17
  if (shouldKeepStartDate && shouldKeepEndDate) {
18
18
  return value;
19
19
  }
20
- const referenceDate = referenceDateProp != null ? referenceDateProp : getDefaultReferenceDate(params);
20
+ const referenceDate = referenceDateProp ?? getDefaultReferenceDate(params);
21
21
  return [shouldKeepStartDate ? value[0] : referenceDate, shouldKeepEndDate ? value[1] : referenceDate];
22
22
  },
23
23
  cleanValue: (utils, value) => value.map(date => replaceInvalidDateByNull(utils, date)),
@@ -31,11 +31,13 @@ export const rangeValueManager = {
31
31
  if (timezoneStart != null && timezoneEnd != null && timezoneStart !== timezoneEnd) {
32
32
  throw new Error('MUI X: The timezone of the start and the end date should be the same.');
33
33
  }
34
- return timezoneStart != null ? timezoneStart : timezoneEnd;
34
+ return timezoneStart ?? timezoneEnd;
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
+ });
@@ -36,12 +36,19 @@ export interface MultiInputFieldRefs {
36
36
  unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
37
37
  unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
38
38
  }
39
+ export interface RangeFieldSeparatorProps {
40
+ /**
41
+ * String displayed between the start and the end dates.
42
+ * @default "–"
43
+ */
44
+ dateSeparator?: string;
45
+ }
39
46
  /**
40
47
  * Props the multi input field can receive when used inside a picker.
41
48
  * Only contains what the MUI components are passing to the field,
42
49
  * not what users can pass using the `props.slotProps.field`.
43
50
  */
44
- export interface BaseMultiInputFieldProps<TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends Omit<BaseFieldProps<TValue, TDate, TSection, TEnableAccessibleFieldDOMStructure, TError>, 'unstableFieldRef'> {
51
+ export interface BaseMultiInputFieldProps<TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends Omit<BaseFieldProps<TValue, TDate, TSection, TEnableAccessibleFieldDOMStructure, TError>, 'unstableFieldRef'>, RangeFieldSeparatorProps {
45
52
  sx?: SxProps<any>;
46
53
  unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
47
54
  unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
@@ -11,8 +11,7 @@ import { resolveComponentProps, useSlotProps } from '@mui/base/utils';
11
11
  import { styled, useThemeProps } from '@mui/material/styles';
12
12
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
13
13
  import { Watermark } from '@mui/x-license';
14
- import { PickersCalendarHeader } from '@mui/x-date-pickers/PickersCalendarHeader';
15
- import { applyDefaultDate, DayCalendar, useDefaultReduceAnimations, PickersArrowSwitcher, useCalendarState, useDefaultDates, useLocaleText, useNextMonthDisabled, usePreviousMonthDisabled, useUtils, useNow, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, buildWarning, useControlledValueWithTimezone, useViews } from '@mui/x-date-pickers/internals';
14
+ import { applyDefaultDate, DayCalendar, useDefaultReduceAnimations, useCalendarState, useDefaultDates, useUtils, useNow, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, buildWarning, useControlledValueWithTimezone, useViews } from '@mui/x-date-pickers/internals';
16
15
  import { getReleaseInfo } from '../internals/utils/releaseInfo';
17
16
  import { dateRangeCalendarClasses, getDateRangeCalendarUtilityClass } from './dateRangeCalendarClasses';
18
17
  import { isEndOfRange, isRangeValid, isStartOfRange, isWithinRange } from '../internals/utils/date-utils';
@@ -22,6 +21,7 @@ import { rangeValueManager } from '../internals/utils/valueManagers';
22
21
  import { useDragRange } from './useDragRange';
23
22
  import { useRangePosition } from '../internals/hooks/useRangePosition';
24
23
  import { DAY_RANGE_SIZE, DAY_MARGIN } from '../internals/constants/dimensions';
24
+ import { PickersRangeCalendarHeader } from '../PickersRangeCalendarHeader';
25
25
  import { jsx as _jsx } from "react/jsx-runtime";
26
26
  import { jsxs as _jsxs } from "react/jsx-runtime";
27
27
  const releaseInfo = getReleaseInfo();
@@ -44,12 +44,6 @@ const DateRangeCalendarMonthContainer = styled('div', {
44
44
  borderRight: `1px solid ${(theme.vars || theme).palette.divider}`
45
45
  }
46
46
  }));
47
- const DateRangeCalendarArrowSwitcher = styled(PickersArrowSwitcher)({
48
- padding: '12px 16px 4px 16px',
49
- display: 'flex',
50
- alignItems: 'center',
51
- justifyContent: 'space-between'
52
- });
53
47
  const weeksContainerHeight = (DAY_RANGE_SIZE + DAY_MARGIN * 2) * 6;
54
48
  const warnInvalidCurrentMonthCalendarPosition = buildWarning(['The `currentMonthCalendarPosition` prop must be an integer between `1` and the amount of calendars rendered.', 'For example if you have 2 calendars rendered, it should be equal to either 1 or 2.']);
55
49
  const DayCalendarForRange = styled(DayCalendar)(({
@@ -190,7 +184,6 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
190
184
  autoFocus
191
185
  });
192
186
  const utils = useUtils();
193
- const localeText = useLocaleText();
194
187
  const now = useNow(timezone);
195
188
  const {
196
189
  rangePosition,
@@ -288,15 +281,12 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
288
281
  shouldDisableDate: wrappedShouldDisableDate,
289
282
  timezone
290
283
  });
291
-
292
- // When disabled, limit the view to the selected date
293
- const minDateWithDisabled = disabled && value[0] || minDate;
294
- const maxDateWithDisabled = disabled && value[1] || maxDate;
295
- const CalendarHeader = slots?.calendarHeader ?? PickersCalendarHeader;
284
+ const CalendarHeader = slots?.calendarHeader ?? PickersRangeCalendarHeader;
296
285
  const calendarHeaderProps = useSlotProps({
297
286
  elementType: CalendarHeader,
298
287
  externalSlotProps: slotProps?.calendarHeader,
299
288
  additionalProps: {
289
+ calendars,
300
290
  views: ['day'],
301
291
  view: 'day',
302
292
  currentMonth: calendarState.currentMonth,
@@ -304,15 +294,15 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
304
294
  newMonth,
305
295
  direction
306
296
  }),
307
- minDate: minDateWithDisabled,
308
- maxDate: maxDateWithDisabled,
297
+ minDate,
298
+ maxDate,
309
299
  disabled,
310
300
  disablePast,
311
301
  disableFuture,
312
302
  reduceAnimations,
303
+ timezone,
313
304
  slots,
314
- slotProps,
315
- timezone
305
+ slotProps
316
306
  },
317
307
  ownerState: props
318
308
  });
@@ -341,22 +331,6 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
341
331
  }
342
332
  }, [rangePosition, value]); // eslint-disable-line
343
333
 
344
- const selectNextMonth = React.useCallback(() => {
345
- changeMonth(utils.addMonths(calendarState.currentMonth, 1));
346
- }, [changeMonth, calendarState.currentMonth, utils]);
347
- const selectPreviousMonth = React.useCallback(() => {
348
- changeMonth(utils.addMonths(calendarState.currentMonth, -1));
349
- }, [changeMonth, calendarState.currentMonth, utils]);
350
- const isNextMonthDisabled = useNextMonthDisabled(calendarState.currentMonth, {
351
- disableFuture,
352
- maxDate,
353
- timezone
354
- });
355
- const isPreviousMonthDisabled = usePreviousMonthDisabled(calendarState.currentMonth, {
356
- disablePast,
357
- minDate,
358
- timezone
359
- });
360
334
  const baseDateValidationProps = {
361
335
  disablePast,
362
336
  disableFuture,
@@ -462,43 +436,37 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
462
436
  children: [/*#__PURE__*/_jsx(Watermark, {
463
437
  packageName: "x-date-pickers-pro",
464
438
  releaseInfo: releaseInfo
465
- }), calendarMonths.map((month, index) => /*#__PURE__*/_jsxs(DateRangeCalendarMonthContainer, {
466
- className: classes.monthContainer,
467
- children: [calendars === 1 ? /*#__PURE__*/_jsx(CalendarHeader, _extends({}, calendarHeaderProps)) : /*#__PURE__*/_jsx(DateRangeCalendarArrowSwitcher, {
468
- onGoToPrevious: selectPreviousMonth,
469
- onGoToNext: selectNextMonth,
470
- isPreviousHidden: index !== 0,
471
- isPreviousDisabled: isPreviousMonthDisabled,
472
- previousLabel: localeText.previousMonth,
473
- isNextHidden: index !== calendars - 1,
474
- isNextDisabled: isNextMonthDisabled,
475
- nextLabel: localeText.nextMonth,
476
- slots: slots,
477
- slotProps: slotProps,
478
- children: utils.formatByString(visibleMonths[month], calendarHeaderProps.format ?? `${utils.formats.month} ${utils.formats.year}`)
479
- }), /*#__PURE__*/_jsx(DayCalendarForRange, _extends({
480
- className: classes.dayCalendar
481
- }, calendarState, baseDateValidationProps, commonViewProps, {
482
- onMonthSwitchingAnimationEnd: onMonthSwitchingAnimationEnd,
483
- onFocusedDayChange: changeFocusedDay,
484
- reduceAnimations: reduceAnimations,
485
- selectedDays: value,
486
- onSelectedDaysChange: handleSelectedDayChange,
487
- currentMonth: visibleMonths[month],
488
- TransitionProps: CalendarTransitionProps,
489
- shouldDisableDate: wrappedShouldDisableDate,
490
- showDaysOutsideCurrentMonth: calendars === 1 && showDaysOutsideCurrentMonth,
491
- dayOfWeekFormatter: dayOfWeekFormatter,
492
- loading: loading,
493
- renderLoading: renderLoading,
494
- slots: slotsForDayCalendar,
495
- slotProps: slotPropsForDayCalendar,
496
- autoFocus: visibleMonths[month] === focusedMonth,
497
- fixedWeekNumber: fixedWeekNumber,
498
- displayWeekNumber: displayWeekNumber,
499
- timezone: timezone
500
- }), index)]
501
- }, month))]
439
+ }), calendarMonths.map(monthIndex => {
440
+ const month = visibleMonths[monthIndex];
441
+ return /*#__PURE__*/_jsxs(DateRangeCalendarMonthContainer, {
442
+ className: classes.monthContainer,
443
+ children: [/*#__PURE__*/_jsx(CalendarHeader, _extends({}, calendarHeaderProps, {
444
+ month: month,
445
+ monthIndex: monthIndex
446
+ })), /*#__PURE__*/_jsx(DayCalendarForRange, _extends({
447
+ className: classes.dayCalendar
448
+ }, calendarState, baseDateValidationProps, commonViewProps, {
449
+ onMonthSwitchingAnimationEnd: onMonthSwitchingAnimationEnd,
450
+ onFocusedDayChange: changeFocusedDay,
451
+ reduceAnimations: reduceAnimations,
452
+ selectedDays: value,
453
+ onSelectedDaysChange: handleSelectedDayChange,
454
+ currentMonth: month,
455
+ TransitionProps: CalendarTransitionProps,
456
+ shouldDisableDate: wrappedShouldDisableDate,
457
+ showDaysOutsideCurrentMonth: calendars === 1 && showDaysOutsideCurrentMonth,
458
+ dayOfWeekFormatter: dayOfWeekFormatter,
459
+ loading: loading,
460
+ renderLoading: renderLoading,
461
+ slots: slotsForDayCalendar,
462
+ slotProps: slotPropsForDayCalendar,
463
+ autoFocus: month === focusedMonth,
464
+ fixedWeekNumber: fixedWeekNumber,
465
+ displayWeekNumber: displayWeekNumber,
466
+ timezone: timezone
467
+ }))]
468
+ }, monthIndex);
469
+ })]
502
470
  }));
503
471
  });
504
472
  process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
@@ -679,7 +647,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
679
647
  /**
680
648
  * Disable specific date.
681
649
  *
682
- * 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.
650
+ * 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.
683
651
  *
684
652
  * @template TDate
685
653
  * @param {TDate} day The date to test.
@@ -277,7 +277,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
277
277
  /**
278
278
  * Disable specific date.
279
279
  *
280
- * 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.
280
+ * 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.
281
281
  *
282
282
  * @template TDate
283
283
  * @param {TDate} day The date to test.
@@ -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.
@@ -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.
@@ -31,19 +31,19 @@ const MultiInputDateRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((prop
31
31
  ref: ref,
32
32
  spacing: 2,
33
33
  direction: "row",
34
- alignItems: "baseline"
34
+ alignItems: "center"
35
35
  }, props))), {
36
36
  name: 'MuiMultiInputDateRangeField',
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
46
- })({});
44
+ })({
45
+ lineHeight: '1.4375em' // 23px
46
+ });
47
47
  /**
48
48
  * Demos:
49
49
  *
@@ -103,6 +103,9 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
103
103
  const separatorProps = useSlotProps({
104
104
  elementType: Separator,
105
105
  externalSlotProps: slotProps?.separator,
106
+ additionalProps: {
107
+ children: ` ${internalProps.dateSeparator ?? '–'} `
108
+ },
106
109
  ownerState,
107
110
  className: classes.separator
108
111
  });
@@ -138,6 +141,11 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
138
141
  classes: PropTypes.object,
139
142
  className: PropTypes.string,
140
143
  component: PropTypes.elementType,
144
+ /**
145
+ * String displayed between the start and the end dates.
146
+ * @default "–"
147
+ */
148
+ dateSeparator: PropTypes.string,
141
149
  /**
142
150
  * The default value. Use when the component is not controlled.
143
151
  */
@@ -235,7 +243,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
235
243
  /**
236
244
  * Disable specific date.
237
245
  *
238
- * 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.
239
247
  *
240
248
  * @template TDate
241
249
  * @param {TDate} day The date to test.
@@ -31,19 +31,19 @@ const MultiInputDateTimeRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((
31
31
  ref: ref,
32
32
  spacing: 2,
33
33
  direction: "row",
34
- alignItems: "baseline"
34
+ alignItems: "center"
35
35
  }, props))), {
36
36
  name: 'MuiMultiInputDateTimeRangeField',
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
46
- })({});
44
+ })({
45
+ lineHeight: '1.4375em' // 23px
46
+ });
47
47
  /**
48
48
  * Demos:
49
49
  *
@@ -103,6 +103,9 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
103
103
  const separatorProps = useSlotProps({
104
104
  elementType: Separator,
105
105
  externalSlotProps: slotProps?.separator,
106
+ additionalProps: {
107
+ children: ` ${internalProps.dateSeparator ?? '–'} `
108
+ },
106
109
  ownerState,
107
110
  className: classes.separator
108
111
  });
@@ -143,6 +146,11 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
143
146
  classes: PropTypes.object,
144
147
  className: PropTypes.string,
145
148
  component: PropTypes.elementType,
149
+ /**
150
+ * String displayed between the start and the end dates.
151
+ * @default "–"
152
+ */
153
+ dateSeparator: PropTypes.string,
146
154
  /**
147
155
  * The default value. Use when the component is not controlled.
148
156
  */
@@ -268,7 +276,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
268
276
  /**
269
277
  * Disable specific date.
270
278
  *
271
- * 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.
272
280
  *
273
281
  * @template TDate
274
282
  * @param {TDate} day The date to test.
@@ -31,19 +31,19 @@ const MultiInputTimeRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((prop
31
31
  ref: ref,
32
32
  spacing: 2,
33
33
  direction: "row",
34
- alignItems: "baseline"
34
+ alignItems: "center"
35
35
  }, props))), {
36
36
  name: 'MuiMultiInputTimeRangeField',
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
46
- })({});
44
+ })({
45
+ lineHeight: '1.4375em' // 23px
46
+ });
47
47
  /**
48
48
  * Demos:
49
49
  *
@@ -103,6 +103,9 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
103
103
  const separatorProps = useSlotProps({
104
104
  elementType: Separator,
105
105
  externalSlotProps: slotProps?.separator,
106
+ additionalProps: {
107
+ children: ` ${internalProps.dateSeparator ?? '–'} `
108
+ },
106
109
  ownerState,
107
110
  className: classes.separator
108
111
  });
@@ -143,6 +146,11 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
143
146
  classes: PropTypes.object,
144
147
  className: PropTypes.string,
145
148
  component: PropTypes.elementType,
149
+ /**
150
+ * String displayed between the start and the end dates.
151
+ * @default "–"
152
+ */
153
+ dateSeparator: PropTypes.string,
146
154
  /**
147
155
  * The default value. Use when the component is not controlled.
148
156
  */