@mui/x-date-pickers-pro 7.22.2 → 8.0.0-alpha.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 (161) hide show
  1. package/CHANGELOG.md +142 -155
  2. package/DateRangeCalendar/DateRangeCalendar.d.ts +1 -2
  3. package/DateRangeCalendar/DateRangeCalendar.js +23 -22
  4. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +24 -36
  5. package/DateRangeCalendar/useDragRange.d.ts +10 -9
  6. package/DateRangeCalendar/useDragRange.js +3 -3
  7. package/DateRangePicker/DateRangePicker.d.ts +1 -2
  8. package/DateRangePicker/DateRangePicker.js +12 -8
  9. package/DateRangePicker/DateRangePicker.types.d.ts +12 -6
  10. package/DateRangePicker/DateRangePickerToolbar.d.ts +3 -5
  11. package/DateRangePicker/DateRangePickerToolbar.js +12 -2
  12. package/DateRangePicker/index.d.ts +1 -1
  13. package/DateRangePicker/shared.d.ts +12 -12
  14. package/DateRangePickerDay/DateRangePickerDay.d.ts +2 -3
  15. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -2
  16. package/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
  17. package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +12 -6
  18. package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +1 -2
  19. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -2
  20. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -9
  21. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +3 -5
  22. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +12 -2
  23. package/DateTimeRangePicker/index.d.ts +1 -1
  24. package/DateTimeRangePicker/shared.d.ts +13 -13
  25. package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +1 -2
  26. package/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
  27. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +6 -7
  28. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +1 -2
  29. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
  30. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +6 -7
  31. package/MobileDateRangePicker/MobileDateRangePicker.d.ts +1 -2
  32. package/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
  33. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +6 -7
  34. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +1 -2
  35. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
  36. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +6 -7
  37. package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +1 -2
  38. package/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
  39. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +9 -10
  40. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +1 -2
  41. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
  42. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +9 -10
  43. package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +1 -2
  44. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
  45. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +9 -10
  46. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.d.ts +1 -2
  47. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
  48. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.d.ts +3 -3
  49. package/README.md +2 -2
  50. package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +1 -2
  51. package/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
  52. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +8 -8
  53. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -2
  54. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +1 -2
  55. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
  56. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +8 -8
  57. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -2
  58. package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +1 -2
  59. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
  60. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +8 -8
  61. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -2
  62. package/StaticDateRangePicker/StaticDateRangePicker.d.ts +1 -2
  63. package/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
  64. package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +6 -7
  65. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -3
  66. package/index.d.ts +0 -7
  67. package/index.js +1 -7
  68. package/internals/hooks/models/useRangePicker.d.ts +6 -7
  69. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -2
  70. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +20 -14
  71. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +6 -7
  72. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +15 -13
  73. package/internals/hooks/useEnrichedRangePickerFieldProps.js +4 -4
  74. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -2
  75. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -15
  76. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +6 -7
  77. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +1 -1
  78. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -2
  79. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +1 -2
  80. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +1 -2
  81. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -2
  82. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +5 -5
  83. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +8 -9
  84. package/internals/models/dateRange.d.ts +3 -4
  85. package/internals/models/dateTimeRange.d.ts +5 -10
  86. package/internals/models/fields.d.ts +26 -0
  87. package/internals/models/fields.js +1 -0
  88. package/internals/models/timeRange.d.ts +5 -9
  89. package/internals/utils/date-range-manager.d.ts +10 -9
  90. package/internals/utils/date-utils.d.ts +5 -5
  91. package/internals/utils/releaseInfo.js +1 -1
  92. package/internals/utils/valueManagers.d.ts +5 -6
  93. package/models/dateRange.d.ts +4 -5
  94. package/models/fields.d.ts +5 -32
  95. package/models/range.d.ts +1 -1
  96. package/modern/DateRangeCalendar/DateRangeCalendar.js +23 -22
  97. package/modern/DateRangeCalendar/useDragRange.js +3 -3
  98. package/modern/DateRangePicker/DateRangePicker.js +12 -8
  99. package/modern/DateRangePicker/DateRangePickerToolbar.js +12 -2
  100. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
  101. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -2
  102. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +12 -2
  103. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
  104. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
  105. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
  106. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
  107. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
  108. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
  109. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
  110. package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
  111. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
  112. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
  113. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
  114. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
  115. package/modern/index.js +1 -7
  116. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +20 -14
  117. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +4 -4
  118. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -15
  119. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +5 -5
  120. package/modern/internals/models/fields.js +1 -0
  121. package/modern/internals/utils/releaseInfo.js +1 -1
  122. package/modern/validation/validateDateRange.js +5 -0
  123. package/modern/validation/validateDateTimeRange.js +5 -0
  124. package/modern/validation/validateTimeRange.js +5 -0
  125. package/node/DateRangeCalendar/DateRangeCalendar.js +22 -21
  126. package/node/DateRangeCalendar/useDragRange.js +3 -3
  127. package/node/DateRangePicker/DateRangePicker.js +12 -8
  128. package/node/DateRangePicker/DateRangePickerToolbar.js +11 -1
  129. package/node/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
  130. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +1 -1
  131. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +11 -1
  132. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
  133. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
  134. package/node/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
  135. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
  136. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
  137. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
  138. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
  139. package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +1 -1
  140. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
  141. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
  142. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
  143. package/node/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
  144. package/node/index.js +2 -41
  145. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +19 -13
  146. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +3 -3
  147. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +19 -13
  148. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +4 -4
  149. package/node/internals/models/fields.js +5 -0
  150. package/node/internals/utils/releaseInfo.js +1 -1
  151. package/node/validation/validateDateRange.js +4 -0
  152. package/node/validation/validateDateTimeRange.js +4 -0
  153. package/node/validation/validateTimeRange.js +4 -0
  154. package/package.json +5 -5
  155. package/themeAugmentation/props.d.ts +16 -17
  156. package/validation/validateDateRange.d.ts +9 -5
  157. package/validation/validateDateRange.js +5 -0
  158. package/validation/validateDateTimeRange.d.ts +11 -6
  159. package/validation/validateDateTimeRange.js +5 -0
  160. package/validation/validateTimeRange.d.ts +9 -4
  161. package/validation/validateTimeRange.js +5 -0
@@ -4,9 +4,8 @@ const _excluded = ["props", "ref"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { styled } from '@mui/material/styles';
7
- import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
8
7
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
9
- import { usePicker, DIALOG_WIDTH } from '@mui/x-date-pickers/internals';
8
+ import { usePicker, DIALOG_WIDTH, PickerProvider } from '@mui/x-date-pickers/internals';
10
9
  import { useRangePosition } from "../useRangePosition.js";
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
11
  const PickerStaticLayout = styled(PickersLayout)(({
@@ -42,11 +41,13 @@ export const useStaticRangePicker = _ref => {
42
41
  } = useRangePosition(props);
43
42
  const {
44
43
  layoutProps,
44
+ providerProps,
45
45
  renderCurrentView
46
46
  } = usePicker(_extends({}, pickerParams, {
47
47
  props,
48
48
  autoFocusView: autoFocus ?? false,
49
49
  fieldRef: undefined,
50
+ localeText,
50
51
  additionalViewProps: {
51
52
  rangePosition,
52
53
  onRangePositionChange
@@ -60,8 +61,7 @@ export const useStaticRangePicker = _ref => {
60
61
  onRangePositionChange
61
62
  })
62
63
  });
63
- const renderPicker = () => /*#__PURE__*/_jsx(LocalizationProvider, {
64
- localeText: localeText,
64
+ const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
65
65
  children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
66
66
  slots: slots,
67
67
  slotProps: slotPropsForLayout,
@@ -70,7 +70,7 @@ export const useStaticRangePicker = _ref => {
70
70
  ref: ref,
71
71
  children: renderCurrentView()
72
72
  }))
73
- });
73
+ }));
74
74
  return {
75
75
  renderPicker
76
76
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczMTAyMDQwMDAwMA==";
3
+ const releaseInfo = "MTczMTUzODgwMDAwMA==";
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
@@ -4,6 +4,11 @@ const _excluded = ["shouldDisableDate"];
4
4
  import { validateDate } from '@mui/x-date-pickers/validation';
5
5
  import { isRangeValid } from "../internals/utils/date-utils.js";
6
6
  import { rangeValueManager } from "../internals/utils/valueManagers.js";
7
+
8
+ /**
9
+ * Validation props used by the Date Range Picker, Date Range Field and Date Range Calendar components.
10
+ */
11
+
7
12
  export const validateDateRange = ({
8
13
  adapter,
9
14
  value,
@@ -4,6 +4,11 @@ const _excluded = ["shouldDisableDate"];
4
4
  import { validateDateTime } from '@mui/x-date-pickers/validation';
5
5
  import { isRangeValid } from "../internals/utils/date-utils.js";
6
6
  import { rangeValueManager } from "../internals/utils/valueManagers.js";
7
+
8
+ /**
9
+ * Validation props used by the Date Time Range Picker and Date Time Range Field.
10
+ */
11
+
7
12
  export const validateDateTimeRange = ({
8
13
  adapter,
9
14
  value,
@@ -1,6 +1,11 @@
1
1
  import { validateTime } from '@mui/x-date-pickers/validation';
2
2
  import { isRangeValid } from "../internals/utils/date-utils.js";
3
3
  import { rangeValueManager } from "../internals/utils/valueManagers.js";
4
+
5
+ /**
6
+ * Validation props used by the Time Range Picker and Time Range Field.
7
+ */
8
+
4
9
  export const validateTimeRange = ({
5
10
  adapter,
6
11
  value,
@@ -33,7 +33,7 @@ var _useRangePosition = require("../internals/hooks/useRangePosition");
33
33
  var _dimensions = require("../internals/constants/dimensions");
34
34
  var _PickersRangeCalendarHeader = require("../PickersRangeCalendarHeader");
35
35
  var _jsxRuntime = require("react/jsx-runtime");
36
- const _excluded = ["value", "defaultValue", "referenceDate", "onChange", "className", "disableFuture", "disablePast", "minDate", "maxDate", "shouldDisableDate", "reduceAnimations", "onMonthChange", "rangePosition", "defaultRangePosition", "onRangePositionChange", "calendars", "currentMonthCalendarPosition", "slots", "slotProps", "loading", "renderLoading", "disableHighlightToday", "readOnly", "disabled", "showDaysOutsideCurrentMonth", "dayOfWeekFormatter", "disableAutoMonthSwitching", "autoFocus", "fixedWeekNumber", "disableDragEditing", "displayWeekNumber", "timezone", "availableRangePositions", "views", "view", "openTo", "onViewChange"],
36
+ const _excluded = ["value", "defaultValue", "referenceDate", "onChange", "className", "classes", "disableFuture", "disablePast", "minDate", "maxDate", "shouldDisableDate", "reduceAnimations", "onMonthChange", "rangePosition", "defaultRangePosition", "onRangePositionChange", "calendars", "currentMonthCalendarPosition", "slots", "slotProps", "loading", "renderLoading", "disableHighlightToday", "readOnly", "disabled", "showDaysOutsideCurrentMonth", "dayOfWeekFormatter", "disableAutoMonthSwitching", "autoFocus", "fixedWeekNumber", "disableDragEditing", "displayWeekNumber", "timezone", "availableRangePositions", "views", "view", "openTo", "onViewChange"],
37
37
  _excluded2 = ["isDragging", "rangeDragDay", "draggingDatePosition"];
38
38
  const releaseInfo = (0, _releaseInfo.getReleaseInfo)();
39
39
  const DateRangeCalendarRoot = (0, _styles.styled)('div', {
@@ -104,15 +104,11 @@ function useDateRangeCalendarDefaultizedProps(props, name) {
104
104
  availableRangePositions: themeProps.availableRangePositions ?? ['start', 'end']
105
105
  });
106
106
  }
107
- const useUtilityClasses = ownerState => {
108
- const {
109
- classes,
110
- isDragging
111
- } = ownerState;
107
+ const useUtilityClasses = (classes, ownerState) => {
112
108
  const slots = {
113
109
  root: ['root'],
114
110
  monthContainer: ['monthContainer'],
115
- dayCalendar: [isDragging && 'dayDragging']
111
+ dayCalendar: [ownerState.isDraggingDay && 'dayDragging']
116
112
  };
117
113
  return (0, _composeClasses.default)(slots, _dateRangeCalendarClasses.getDateRangeCalendarUtilityClass, classes);
118
114
  };
@@ -137,6 +133,7 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
137
133
  referenceDate,
138
134
  onChange,
139
135
  className,
136
+ classes: classesProp,
140
137
  disableFuture,
141
138
  disablePast,
142
139
  minDate,
@@ -251,10 +248,13 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
251
248
  draggingDatePosition
252
249
  } = _useDragRange,
253
250
  dragEventHandlers = (0, _objectWithoutPropertiesLoose2.default)(_useDragRange, _excluded2);
254
- const ownerState = (0, _extends2.default)({}, props, {
255
- isDragging
251
+ const {
252
+ ownerState: pickersOwnerState
253
+ } = (0, _internals.usePickerPrivateContext)();
254
+ const ownerState = (0, _extends2.default)({}, pickersOwnerState, {
255
+ isDraggingDay: isDragging
256
256
  });
257
- const classes = useUtilityClasses(ownerState);
257
+ const classes = useUtilityClasses(classesProp, ownerState);
258
258
  const draggingRange = React.useMemo(() => {
259
259
  if (!valueDayRange[0] || !valueDayRange[1] || !rangeDragDay) {
260
260
  return [null, null];
@@ -316,7 +316,7 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
316
316
  slots,
317
317
  slotProps
318
318
  },
319
- ownerState: props
319
+ ownerState
320
320
  });
321
321
  const prevValue = React.useRef(null);
322
322
  React.useEffect(() => {
@@ -377,7 +377,8 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
377
377
  const slotPropsForDayCalendar = (0, _extends2.default)({}, slotProps, {
378
378
  day: dayOwnerState => {
379
379
  const {
380
- day
380
+ day,
381
+ isDaySelected
381
382
  } = dayOwnerState;
382
383
  const isSelectedStartDate = (0, _dateUtils.isStartOfRange)(utils, day, valueDayRange);
383
384
  const isSelectedEndDate = (0, _dateUtils.isEndOfRange)(utils, day, valueDayRange);
@@ -400,7 +401,7 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
400
401
  isEndOfHighlighting: isDragging ? (0, _dateUtils.isEndOfRange)(utils, day, draggingRange) : isSelectedEndDate,
401
402
  onMouseEnter: shouldHavePreview ? handleDayMouseEnter : undefined,
402
403
  // apply selected styling to the dragging start or end day
403
- isVisuallySelected: dayOwnerState.selected || isDragging && (isStartOfHighlighting || isEndOfHighlighting),
404
+ isVisuallySelected: isDaySelected || isDragging && (isStartOfHighlighting || isEndOfHighlighting),
404
405
  'data-position': datePosition
405
406
  }, dragEventHandlers, {
406
407
  draggable: isElementDraggable ? true : undefined
@@ -521,9 +522,9 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
521
522
  currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
522
523
  /**
523
524
  * Formats the day of week displayed in the calendar header.
524
- * @param {TDate} date The date of the day of week provided by the adapter.
525
+ * @param {PickerValidDate} date The date of the day of week provided by the adapter.
525
526
  * @returns {string} The name to display.
526
- * @default (date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
527
+ * @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
527
528
  */
528
529
  dayOfWeekFormatter: _propTypes.default.func,
529
530
  /**
@@ -543,7 +544,8 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
543
544
  */
544
545
  disableAutoMonthSwitching: _propTypes.default.bool,
545
546
  /**
546
- * If `true`, the picker and text field are disabled.
547
+ * If `true`, the component is disabled.
548
+ * When disabled, the value cannot be changed and no interaction is possible.
547
549
  * @default false
548
550
  */
549
551
  disabled: _propTypes.default.bool,
@@ -614,8 +616,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
614
616
  onFocusedViewChange: _propTypes.default.func,
615
617
  /**
616
618
  * Callback fired on month change.
617
- * @template TDate
618
- * @param {TDate} month The new month.
619
+ * @param {PickerValidDate} month The new month.
619
620
  */
620
621
  onMonthChange: _propTypes.default.func,
621
622
  /**
@@ -641,7 +642,8 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
641
642
  */
642
643
  rangePosition: _propTypes.default.oneOf(['end', 'start']),
643
644
  /**
644
- * Make picker read only.
645
+ * If `true`, the component is read-only.
646
+ * When read-only, the value cannot be changed but the user can interact with the interface.
645
647
  * @default false
646
648
  */
647
649
  readOnly: _propTypes.default.bool,
@@ -666,8 +668,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
666
668
  *
667
669
  * 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.
668
670
  *
669
- * @template TDate
670
- * @param {TDate} day The date to test.
671
+ * @param {PickerValidDate} day The date to test.
671
672
  * @param {string} position The date to test, 'start' or 'end'.
672
673
  * @returns {boolean} Returns `true` if the date should be disabled.
673
674
  */
@@ -221,9 +221,9 @@ const useDragRange = ({
221
221
  }) => {
222
222
  const [isDragging, setIsDragging] = React.useState(false);
223
223
  const [rangeDragDay, setRangeDragDay] = React.useState(null);
224
- const handleRangeDragDayChange = (0, _useEventCallback.default)(val => {
225
- if (!utils.isEqual(val, rangeDragDay)) {
226
- setRangeDragDay(val);
224
+ const handleRangeDragDayChange = (0, _useEventCallback.default)(newValue => {
225
+ if (!utils.isEqual(newValue, rangeDragDay)) {
226
+ setRangeDragDay(newValue);
227
227
  }
228
228
  });
229
229
  const draggingDatePosition = React.useMemo(() => {
@@ -81,9 +81,9 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
81
81
  currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
82
82
  /**
83
83
  * Formats the day of week displayed in the calendar header.
84
- * @param {TDate} date The date of the day of week provided by the adapter.
84
+ * @param {PickerValidDate} date The date of the day of week provided by the adapter.
85
85
  * @returns {string} The name to display.
86
- * @default (date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
86
+ * @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
87
87
  */
88
88
  dayOfWeekFormatter: _propTypes.default.func,
89
89
  /**
@@ -109,7 +109,8 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
109
109
  */
110
110
  disableAutoMonthSwitching: _propTypes.default.bool,
111
111
  /**
112
- * If `true`, the picker and text field are disabled.
112
+ * If `true`, the component is disabled.
113
+ * When disabled, the value cannot be changed and no interaction is possible.
113
114
  * @default false
114
115
  */
115
116
  disabled: _propTypes.default.bool,
@@ -143,7 +144,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
143
144
  */
144
145
  displayWeekNumber: _propTypes.default.bool,
145
146
  /**
146
- * @default false
147
+ * @default true
147
148
  */
148
149
  enableAccessibleFieldDOMStructure: _propTypes.default.any,
149
150
  /**
@@ -231,8 +232,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
231
232
  onError: _propTypes.default.func,
232
233
  /**
233
234
  * Callback fired on month change.
234
- * @template TDate
235
- * @param {TDate} month The new month.
235
+ * @param {PickerValidDate} month The new month.
236
236
  */
237
237
  onMonthChange: _propTypes.default.func,
238
238
  /**
@@ -260,6 +260,11 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
260
260
  * Used when the component position is controlled.
261
261
  */
262
262
  rangePosition: _propTypes.default.oneOf(['end', 'start']),
263
+ /**
264
+ * If `true`, the component is read-only.
265
+ * When read-only, the value cannot be changed but the user can interact with the interface.
266
+ * @default false
267
+ */
263
268
  readOnly: _propTypes.default.bool,
264
269
  /**
265
270
  * If `true`, disable heavy animations.
@@ -292,8 +297,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
292
297
  *
293
298
  * 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.
294
299
  *
295
- * @template TDate
296
- * @param {TDate} day The date to test.
300
+ * @param {PickerValidDate} day The date to test.
297
301
  * @param {string} position The date to test, 'start' or 'end'.
298
302
  * @returns {boolean} Returns `true` if the date should be disabled.
299
303
  */
@@ -66,7 +66,7 @@ const DateRangePickerToolbar = exports.DateRangePickerToolbar = /*#__PURE__*/Rea
66
66
  className
67
67
  } = props,
68
68
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
69
- const translations = (0, _hooks.usePickersTranslations)();
69
+ const translations = (0, _hooks.usePickerTranslations)();
70
70
  const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) : translations.start;
71
71
  const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) : translations.end;
72
72
  const ownerState = props;
@@ -106,6 +106,11 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
106
106
  */
107
107
  classes: _propTypes.default.object,
108
108
  className: _propTypes.default.string,
109
+ /**
110
+ * If `true`, the component is disabled.
111
+ * When disabled, the value cannot be changed and no interaction is possible.
112
+ * @default false
113
+ */
109
114
  disabled: _propTypes.default.bool,
110
115
  /**
111
116
  * If `true`, show the toolbar even in desktop mode.
@@ -120,6 +125,11 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
120
125
  */
121
126
  onViewChange: _propTypes.default.func.isRequired,
122
127
  rangePosition: _propTypes.default.oneOf(['end', 'start']).isRequired,
128
+ /**
129
+ * If `true`, the component is read-only.
130
+ * When read-only, the value cannot be changed but the user can interact with the interface.
131
+ * @default false
132
+ */
123
133
  readOnly: _propTypes.default.bool,
124
134
  /**
125
135
  * The system prop that allows defining system overrides as well as additional CSS styles.
@@ -86,9 +86,9 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
86
86
  currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
87
87
  /**
88
88
  * Formats the day of week displayed in the calendar header.
89
- * @param {TDate} date The date of the day of week provided by the adapter.
89
+ * @param {PickerValidDate} date The date of the day of week provided by the adapter.
90
90
  * @returns {string} The name to display.
91
- * @default (date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
91
+ * @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
92
92
  */
93
93
  dayOfWeekFormatter: _propTypes.default.func,
94
94
  /**
@@ -114,7 +114,8 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
114
114
  */
115
115
  disableAutoMonthSwitching: _propTypes.default.bool,
116
116
  /**
117
- * If `true`, the picker and text field are disabled.
117
+ * If `true`, the component is disabled.
118
+ * When disabled, the value cannot be changed and no interaction is possible.
118
119
  * @default false
119
120
  */
120
121
  disabled: _propTypes.default.bool,
@@ -153,7 +154,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
153
154
  */
154
155
  displayWeekNumber: _propTypes.default.bool,
155
156
  /**
156
- * @default false
157
+ * @default true
157
158
  */
158
159
  enableAccessibleFieldDOMStructure: _propTypes.default.any,
159
160
  /**
@@ -264,8 +265,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
264
265
  onError: _propTypes.default.func,
265
266
  /**
266
267
  * Callback fired on month change.
267
- * @template TDate
268
- * @param {TDate} month The new month.
268
+ * @param {PickerValidDate} month The new month.
269
269
  */
270
270
  onMonthChange: _propTypes.default.func,
271
271
  /**
@@ -305,6 +305,11 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
305
305
  * Used when the component position is controlled.
306
306
  */
307
307
  rangePosition: _propTypes.default.oneOf(['end', 'start']),
308
+ /**
309
+ * If `true`, the component is read-only.
310
+ * When read-only, the value cannot be changed but the user can interact with the interface.
311
+ * @default false
312
+ */
308
313
  readOnly: _propTypes.default.bool,
309
314
  /**
310
315
  * If `true`, disable heavy animations.
@@ -337,16 +342,14 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
337
342
  *
338
343
  * 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.
339
344
  *
340
- * @template TDate
341
- * @param {TDate} day The date to test.
345
+ * @param {PickerValidDate} day The date to test.
342
346
  * @param {string} position The date to test, 'start' or 'end'.
343
347
  * @returns {boolean} Returns `true` if the date should be disabled.
344
348
  */
345
349
  shouldDisableDate: _propTypes.default.func,
346
350
  /**
347
351
  * Disable specific time.
348
- * @template TDate
349
- * @param {TDate} value The value to check.
352
+ * @param {PickerValidDate} value The value to check.
350
353
  * @param {TimeView} view The clock type of the timeValue.
351
354
  * @returns {boolean} If `true` the time will be disabled.
352
355
  */
@@ -88,7 +88,7 @@ const DateTimeRangePickerTabs = exports.DateTimeRangePickerTabs = function DateT
88
88
  className,
89
89
  sx
90
90
  } = props;
91
- const translations = (0, _hooks.usePickersTranslations)();
91
+ const translations = (0, _hooks.usePickerTranslations)();
92
92
  const classes = useUtilityClasses(props);
93
93
  const value = React.useMemo(() => viewToTab(view, rangePosition), [view, rangePosition]);
94
94
  const isPreviousHidden = value === 'start-date';
@@ -112,7 +112,7 @@ const DateTimeRangePickerToolbar = exports.DateTimeRangePickerToolbar = /*#__PUR
112
112
  toolbarFormat,
113
113
  toolbarPlaceholder
114
114
  };
115
- const translations = (0, _hooks.usePickersTranslations)();
115
+ const translations = (0, _hooks.usePickerTranslations)();
116
116
  const ownerState = props;
117
117
  const classes = useUtilityClasses(ownerState);
118
118
  const handleStartRangeViewChange = React.useCallback(newView => {
@@ -190,6 +190,11 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
190
190
  */
191
191
  classes: _propTypes.default.object,
192
192
  className: _propTypes.default.string,
193
+ /**
194
+ * If `true`, the component is disabled.
195
+ * When disabled, the value cannot be changed and no interaction is possible.
196
+ * @default false
197
+ */
193
198
  disabled: _propTypes.default.bool,
194
199
  /**
195
200
  * If `true`, show the toolbar even in desktop mode.
@@ -206,6 +211,11 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
206
211
  */
207
212
  onViewChange: _propTypes.default.func.isRequired,
208
213
  rangePosition: _propTypes.default.oneOf(['end', 'start']).isRequired,
214
+ /**
215
+ * If `true`, the component is read-only.
216
+ * When read-only, the value cannot be changed but the user can interact with the interface.
217
+ * @default false
218
+ */
209
219
  readOnly: _propTypes.default.bool,
210
220
  /**
211
221
  * The system prop that allows defining system overrides as well as additional CSS styles.
@@ -10,6 +10,7 @@ exports.DesktopDateRangePicker = void 0;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
+ var _internals = require("@mui/x-date-pickers/internals");
13
14
  var _validation = require("@mui/x-date-pickers/validation");
14
15
  var _resolveComponentProps = _interopRequireDefault(require("@mui/utils/resolveComponentProps"));
15
16
  var _utils = require("@mui/utils");
@@ -30,6 +31,8 @@ var _validation2 = require("../validation");
30
31
  * - [DesktopDateRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-range-picker/)
31
32
  */
32
33
  const DesktopDateRangePicker = exports.DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateRangePicker(inProps, ref) {
34
+ const utils = (0, _internals.useUtils)();
35
+
33
36
  // Props with the default values common to all date time pickers
34
37
  const defaultizedProps = (0, _shared.useDateRangePickerDefaultizedProps)(inProps, 'MuiDesktopDateRangePicker');
35
38
  const viewRenderers = (0, _extends2.default)({
@@ -37,6 +40,7 @@ const DesktopDateRangePicker = exports.DesktopDateRangePicker = /*#__PURE__*/Rea
37
40
  }, defaultizedProps.viewRenderers);
38
41
  const props = (0, _extends2.default)({}, defaultizedProps, {
39
42
  viewRenderers,
43
+ format: utils.formats.keyboardDate,
40
44
  calendars: defaultizedProps.calendars ?? 2,
41
45
  views: ['day'],
42
46
  openTo: 'day',
@@ -92,9 +96,9 @@ DesktopDateRangePicker.propTypes = {
92
96
  currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
93
97
  /**
94
98
  * Formats the day of week displayed in the calendar header.
95
- * @param {TDate} date The date of the day of week provided by the adapter.
99
+ * @param {PickerValidDate} date The date of the day of week provided by the adapter.
96
100
  * @returns {string} The name to display.
97
- * @default (date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
101
+ * @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
98
102
  */
99
103
  dayOfWeekFormatter: _propTypes.default.func,
100
104
  /**
@@ -114,7 +118,8 @@ DesktopDateRangePicker.propTypes = {
114
118
  */
115
119
  disableAutoMonthSwitching: _propTypes.default.bool,
116
120
  /**
117
- * If `true`, the picker and text field are disabled.
121
+ * If `true`, the component is disabled.
122
+ * When disabled, the value cannot be changed and no interaction is possible.
118
123
  * @default false
119
124
  */
120
125
  disabled: _propTypes.default.bool,
@@ -148,7 +153,7 @@ DesktopDateRangePicker.propTypes = {
148
153
  */
149
154
  displayWeekNumber: _propTypes.default.bool,
150
155
  /**
151
- * @default false
156
+ * @default true
152
157
  */
153
158
  enableAccessibleFieldDOMStructure: _propTypes.default.any,
154
159
  /**
@@ -236,8 +241,7 @@ DesktopDateRangePicker.propTypes = {
236
241
  onError: _propTypes.default.func,
237
242
  /**
238
243
  * Callback fired on month change.
239
- * @template TDate
240
- * @param {TDate} month The new month.
244
+ * @param {PickerValidDate} month The new month.
241
245
  */
242
246
  onMonthChange: _propTypes.default.func,
243
247
  /**
@@ -265,6 +269,11 @@ DesktopDateRangePicker.propTypes = {
265
269
  * Used when the component position is controlled.
266
270
  */
267
271
  rangePosition: _propTypes.default.oneOf(['end', 'start']),
272
+ /**
273
+ * If `true`, the component is read-only.
274
+ * When read-only, the value cannot be changed but the user can interact with the interface.
275
+ * @default false
276
+ */
268
277
  readOnly: _propTypes.default.bool,
269
278
  /**
270
279
  * If `true`, disable heavy animations.
@@ -297,8 +306,7 @@ DesktopDateRangePicker.propTypes = {
297
306
  *
298
307
  * 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.
299
308
  *
300
- * @template TDate
301
- * @param {TDate} day The date to test.
309
+ * @param {PickerValidDate} day The date to test.
302
310
  * @param {string} position The date to test, 'start' or 'end'.
303
311
  * @returns {boolean} Returns `true` if the date should be disabled.
304
312
  */
@@ -173,9 +173,9 @@ DesktopDateTimeRangePicker.propTypes = {
173
173
  currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
174
174
  /**
175
175
  * Formats the day of week displayed in the calendar header.
176
- * @param {TDate} date The date of the day of week provided by the adapter.
176
+ * @param {PickerValidDate} date The date of the day of week provided by the adapter.
177
177
  * @returns {string} The name to display.
178
- * @default (date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
178
+ * @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
179
179
  */
180
180
  dayOfWeekFormatter: _propTypes.default.func,
181
181
  /**
@@ -195,7 +195,8 @@ DesktopDateTimeRangePicker.propTypes = {
195
195
  */
196
196
  disableAutoMonthSwitching: _propTypes.default.bool,
197
197
  /**
198
- * If `true`, the picker and text field are disabled.
198
+ * If `true`, the component is disabled.
199
+ * When disabled, the value cannot be changed and no interaction is possible.
199
200
  * @default false
200
201
  */
201
202
  disabled: _propTypes.default.bool,
@@ -234,7 +235,7 @@ DesktopDateTimeRangePicker.propTypes = {
234
235
  */
235
236
  displayWeekNumber: _propTypes.default.bool,
236
237
  /**
237
- * @default false
238
+ * @default true
238
239
  */
239
240
  enableAccessibleFieldDOMStructure: _propTypes.default.any,
240
241
  /**
@@ -345,8 +346,7 @@ DesktopDateTimeRangePicker.propTypes = {
345
346
  onError: _propTypes.default.func,
346
347
  /**
347
348
  * Callback fired on month change.
348
- * @template TDate
349
- * @param {TDate} month The new month.
349
+ * @param {PickerValidDate} month The new month.
350
350
  */
351
351
  onMonthChange: _propTypes.default.func,
352
352
  /**
@@ -386,6 +386,11 @@ DesktopDateTimeRangePicker.propTypes = {
386
386
  * Used when the component position is controlled.
387
387
  */
388
388
  rangePosition: _propTypes.default.oneOf(['end', 'start']),
389
+ /**
390
+ * If `true`, the component is read-only.
391
+ * When read-only, the value cannot be changed but the user can interact with the interface.
392
+ * @default false
393
+ */
389
394
  readOnly: _propTypes.default.bool,
390
395
  /**
391
396
  * If `true`, disable heavy animations.
@@ -418,16 +423,14 @@ DesktopDateTimeRangePicker.propTypes = {
418
423
  *
419
424
  * 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.
420
425
  *
421
- * @template TDate
422
- * @param {TDate} day The date to test.
426
+ * @param {PickerValidDate} day The date to test.
423
427
  * @param {string} position The date to test, 'start' or 'end'.
424
428
  * @returns {boolean} Returns `true` if the date should be disabled.
425
429
  */
426
430
  shouldDisableDate: _propTypes.default.func,
427
431
  /**
428
432
  * Disable specific time.
429
- * @template TDate
430
- * @param {TDate} value The value to check.
433
+ * @param {PickerValidDate} value The value to check.
431
434
  * @param {TimeView} view The clock type of the timeValue.
432
435
  * @returns {boolean} If `true` the time will be disabled.
433
436
  */