@mui/x-date-pickers-pro 7.0.0-alpha.9 → 7.0.0-beta.1

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 (165) hide show
  1. package/CHANGELOG.md +386 -38
  2. package/DateRangeCalendar/DateRangeCalendar.js +79 -13
  3. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +15 -14
  4. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +7 -0
  5. package/DateTimeRangePicker/DateTimeRangePicker.js +414 -0
  6. package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +24 -0
  7. package/DateTimeRangePicker/DateTimeRangePicker.types.js +1 -0
  8. package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +32 -0
  9. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +183 -0
  10. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +20 -0
  11. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +59 -0
  12. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +15 -0
  13. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +176 -0
  14. package/DateTimeRangePicker/dateTimeRangePickerTabsClasses.d.ts +13 -0
  15. package/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +6 -0
  16. package/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.d.ts +11 -0
  17. package/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +5 -0
  18. package/DateTimeRangePicker/index.d.ts +10 -0
  19. package/DateTimeRangePicker/index.js +5 -0
  20. package/DateTimeRangePicker/package.json +6 -0
  21. package/DateTimeRangePicker/shared.d.ts +60 -0
  22. package/DateTimeRangePicker/shared.js +56 -0
  23. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +1 -1
  24. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +7 -0
  25. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +491 -0
  26. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +25 -0
  27. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +1 -0
  28. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.d.ts +8 -0
  29. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +52 -0
  30. package/DesktopDateTimeRangePicker/index.d.ts +2 -0
  31. package/DesktopDateTimeRangePicker/index.js +1 -0
  32. package/DesktopDateTimeRangePicker/package.json +6 -0
  33. package/MobileDateRangePicker/MobileDateRangePicker.js +1 -5
  34. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +1 -6
  35. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +7 -0
  36. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +490 -0
  37. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +20 -0
  38. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +1 -0
  39. package/MobileDateTimeRangePicker/index.d.ts +2 -0
  40. package/MobileDateTimeRangePicker/index.js +1 -0
  41. package/MobileDateTimeRangePicker/package.json +6 -0
  42. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +2 -5
  43. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +2 -5
  44. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +2 -5
  45. package/README.md +2 -2
  46. package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +2 -1
  47. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +2 -1
  48. package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +2 -1
  49. package/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  50. package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +5 -0
  51. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -4
  52. package/dateRangeViewRenderers/dateRangeViewRenderers.js +10 -2
  53. package/index.d.ts +3 -0
  54. package/index.js +4 -1
  55. package/internals/constants/dimensions.d.ts +3 -0
  56. package/internals/constants/dimensions.js +5 -0
  57. package/internals/hooks/models/index.d.ts +1 -0
  58. package/internals/hooks/models/index.js +1 -0
  59. package/internals/hooks/models/useRangePicker.d.ts +21 -0
  60. package/internals/hooks/models/useRangePicker.js +1 -0
  61. package/internals/hooks/useDesktopRangePicker/index.d.ts +1 -1
  62. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +17 -3
  63. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +8 -14
  64. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +5 -2
  65. package/internals/hooks/useEnrichedRangePickerFieldProps.js +41 -11
  66. package/internals/hooks/useMobileRangePicker/index.d.ts +1 -1
  67. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +4 -0
  68. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +8 -14
  69. package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +2 -6
  70. package/internals/models/dateTimeRange.d.ts +3 -1
  71. package/internals/models/fields.d.ts +7 -2
  72. package/internals/utils/date-range-manager.d.ts +2 -1
  73. package/internals/utils/date-range-manager.js +12 -1
  74. package/internals/utils/releaseInfo.js +1 -1
  75. package/legacy/DateRangeCalendar/DateRangeCalendar.js +77 -12
  76. package/legacy/DateTimeRangePicker/DateTimeRangePicker.js +413 -0
  77. package/legacy/DateTimeRangePicker/DateTimeRangePicker.types.js +1 -0
  78. package/legacy/DateTimeRangePicker/DateTimeRangePickerTabs.js +191 -0
  79. package/legacy/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +57 -0
  80. package/legacy/DateTimeRangePicker/DateTimeRangePickerToolbar.js +184 -0
  81. package/legacy/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +6 -0
  82. package/legacy/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +5 -0
  83. package/legacy/DateTimeRangePicker/index.js +5 -0
  84. package/legacy/DateTimeRangePicker/shared.js +54 -0
  85. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +491 -0
  86. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +1 -0
  87. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +48 -0
  88. package/legacy/DesktopDateTimeRangePicker/index.js +1 -0
  89. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +1 -5
  90. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +484 -0
  91. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +1 -0
  92. package/legacy/MobileDateTimeRangePicker/index.js +1 -0
  93. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  94. package/legacy/dateRangeViewRenderers/dateRangeViewRenderers.js +10 -2
  95. package/legacy/index.js +4 -1
  96. package/legacy/internals/constants/dimensions.js +5 -0
  97. package/legacy/internals/hooks/models/index.js +1 -0
  98. package/legacy/internals/hooks/models/useRangePicker.js +1 -0
  99. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +17 -3
  100. package/legacy/internals/hooks/useEnrichedRangePickerFieldProps.js +43 -11
  101. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +4 -0
  102. package/legacy/internals/utils/date-range-manager.js +13 -1
  103. package/legacy/internals/utils/releaseInfo.js +1 -1
  104. package/modern/DateRangeCalendar/DateRangeCalendar.js +78 -12
  105. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +414 -0
  106. package/modern/DateTimeRangePicker/DateTimeRangePicker.types.js +1 -0
  107. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +183 -0
  108. package/modern/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +58 -0
  109. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +176 -0
  110. package/modern/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +6 -0
  111. package/modern/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +5 -0
  112. package/modern/DateTimeRangePicker/index.js +5 -0
  113. package/modern/DateTimeRangePicker/shared.js +55 -0
  114. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +483 -0
  115. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +1 -0
  116. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +51 -0
  117. package/modern/DesktopDateTimeRangePicker/index.js +1 -0
  118. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -5
  119. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +486 -0
  120. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +1 -0
  121. package/modern/MobileDateTimeRangePicker/index.js +1 -0
  122. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  123. package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +10 -2
  124. package/modern/index.js +4 -1
  125. package/modern/internals/constants/dimensions.js +5 -0
  126. package/modern/internals/hooks/models/index.js +1 -0
  127. package/modern/internals/hooks/models/useRangePicker.js +1 -0
  128. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -2
  129. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +40 -9
  130. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +4 -0
  131. package/modern/internals/utils/date-range-manager.js +12 -1
  132. package/modern/internals/utils/releaseInfo.js +1 -1
  133. package/node/DateRangeCalendar/DateRangeCalendar.js +78 -12
  134. package/node/DateTimeRangePicker/DateTimeRangePicker.js +422 -0
  135. package/node/DateTimeRangePicker/DateTimeRangePicker.types.js +5 -0
  136. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +190 -0
  137. package/node/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +64 -0
  138. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +183 -0
  139. package/node/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +14 -0
  140. package/node/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +12 -0
  141. package/node/DateTimeRangePicker/index.js +52 -0
  142. package/node/DateTimeRangePicker/shared.js +62 -0
  143. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +490 -0
  144. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +5 -0
  145. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +59 -0
  146. package/node/DesktopDateTimeRangePicker/index.js +12 -0
  147. package/node/MobileDateRangePicker/MobileDateRangePicker.js +1 -5
  148. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +494 -0
  149. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +5 -0
  150. package/node/MobileDateTimeRangePicker/index.js +12 -0
  151. package/node/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  152. package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +10 -2
  153. package/node/index.js +37 -1
  154. package/node/internals/constants/dimensions.js +16 -0
  155. package/node/internals/hooks/models/index.js +5 -0
  156. package/node/internals/hooks/models/useRangePicker.js +5 -0
  157. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -2
  158. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +40 -9
  159. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +4 -0
  160. package/node/internals/utils/date-range-manager.js +12 -1
  161. package/node/internals/utils/releaseInfo.js +1 -1
  162. package/package.json +7 -7
  163. package/themeAugmentation/components.d.ts +22 -3
  164. package/themeAugmentation/overrides.d.ts +7 -0
  165. package/themeAugmentation/props.d.ts +12 -0
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- 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"],
3
+ 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"],
4
4
  _excluded2 = ["isDragging", "rangeDragDay", "draggingDatePosition"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
@@ -12,7 +12,7 @@ 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-pro';
14
14
  import { PickersCalendarHeader } from '@mui/x-date-pickers/PickersCalendarHeader';
15
- import { applyDefaultDate, DAY_MARGIN, DayCalendar, useDefaultReduceAnimations, PickersArrowSwitcher, useCalendarState, useDefaultDates, useLocaleText, useNextMonthDisabled, usePreviousMonthDisabled, useUtils, useNow, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, buildWarning, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
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';
16
16
  import { getReleaseInfo } from '../internals/utils/releaseInfo';
17
17
  import { dateRangeCalendarClasses, getDateRangeCalendarUtilityClass } from './dateRangeCalendarClasses';
18
18
  import { isEndOfRange, isRangeValid, isStartOfRange, isWithinRange } from '../internals/utils/date-utils';
@@ -21,6 +21,7 @@ import { DateRangePickerDay, dateRangePickerDayClasses as dayClasses } from '../
21
21
  import { rangeValueManager } from '../internals/utils/valueManagers';
22
22
  import { useDragRange } from './useDragRange';
23
23
  import { useRangePosition } from '../internals/hooks/useRangePosition';
24
+ import { DAY_RANGE_SIZE, DAY_MARGIN } from '../internals/constants/dimensions';
24
25
  import { jsx as _jsx } from "react/jsx-runtime";
25
26
  import { jsxs as _jsxs } from "react/jsx-runtime";
26
27
  const releaseInfo = getReleaseInfo();
@@ -49,7 +50,6 @@ const DateRangeCalendarArrowSwitcher = styled(PickersArrowSwitcher)({
49
50
  alignItems: 'center',
50
51
  justifyContent: 'space-between'
51
52
  });
52
- const DAY_RANGE_SIZE = 40;
53
53
  const weeksContainerHeight = (DAY_RANGE_SIZE + DAY_MARGIN * 2) * 6;
54
54
  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
55
  const DayCalendarForRange = styled(DayCalendar)(({
@@ -75,7 +75,7 @@ const DayCalendarForRange = styled(DayCalendar)(({
75
75
  }
76
76
  }));
77
77
  function useDateRangeCalendarDefaultizedProps(props, name) {
78
- var _themeProps$renderLoa, _themeProps$reduceAni, _props$loading, _props$disablePast, _props$disableFuture, _themeProps$calendars, _themeProps$disableDr;
78
+ var _themeProps$renderLoa, _themeProps$reduceAni, _props$loading, _props$disablePast, _props$disableFuture, _themeProps$openTo, _themeProps$views, _themeProps$calendars, _themeProps$disableDr, _themeProps$available;
79
79
  const utils = useUtils();
80
80
  const defaultDates = useDefaultDates();
81
81
  const defaultReduceAnimations = useDefaultReduceAnimations();
@@ -91,10 +91,13 @@ function useDateRangeCalendarDefaultizedProps(props, name) {
91
91
  loading: (_props$loading = props.loading) != null ? _props$loading : false,
92
92
  disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
93
93
  disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
94
+ openTo: (_themeProps$openTo = themeProps.openTo) != null ? _themeProps$openTo : 'day',
95
+ views: (_themeProps$views = themeProps.views) != null ? _themeProps$views : ['day'],
94
96
  minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
95
97
  maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
96
98
  calendars: (_themeProps$calendars = themeProps.calendars) != null ? _themeProps$calendars : 2,
97
- disableDragEditing: (_themeProps$disableDr = themeProps.disableDragEditing) != null ? _themeProps$disableDr : false
99
+ disableDragEditing: (_themeProps$disableDr = themeProps.disableDragEditing) != null ? _themeProps$disableDr : false,
100
+ availableRangePositions: (_themeProps$available = themeProps.availableRangePositions) != null ? _themeProps$available : ['start', 'end']
98
101
  });
99
102
  }
100
103
  const useUtilityClasses = ownerState => {
@@ -157,7 +160,12 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
157
160
  fixedWeekNumber,
158
161
  disableDragEditing,
159
162
  displayWeekNumber,
160
- timezone: timezoneProp
163
+ timezone: timezoneProp,
164
+ availableRangePositions,
165
+ views,
166
+ view: inView,
167
+ openTo,
168
+ onViewChange
161
169
  } = props,
162
170
  other = _objectWithoutPropertiesLoose(props, _excluded);
163
171
  const {
@@ -172,6 +180,17 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
172
180
  onChange,
173
181
  valueManager: rangeValueManager
174
182
  });
183
+ const {
184
+ setValueAndGoToNextView,
185
+ view
186
+ } = useViews({
187
+ view: inView,
188
+ views,
189
+ openTo,
190
+ onChange: handleValueChange,
191
+ onViewChange,
192
+ autoFocus
193
+ });
175
194
  const utils = useUtils();
176
195
  const localeText = useLocaleText();
177
196
  const now = useNow(timezone);
@@ -197,11 +216,15 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
197
216
  utils,
198
217
  range: value,
199
218
  rangePosition,
200
- allowRangeFlip
219
+ allowRangeFlip,
220
+ shouldMergeDateAndTime: true
201
221
  });
202
- onRangePositionChange(nextSelection);
222
+ const isNextSectionAvailable = availableRangePositions.includes(nextSelection);
223
+ if (isNextSectionAvailable) {
224
+ onRangePositionChange(nextSelection);
225
+ }
203
226
  const isFullRangeSelected = rangePosition === 'end' && isRangeValid(utils, newRange);
204
- handleValueChange(newRange, isFullRangeSelected ? 'finish' : 'partial');
227
+ setValueAndGoToNextView(newRange, isFullRangeSelected || !isNextSectionAvailable ? 'finish' : 'partial', view);
205
228
  });
206
229
  const handleDrop = useEventCallback(newDate => {
207
230
  handleSelectedDayChange(newDate, undefined, true);
@@ -498,6 +521,14 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
498
521
  * - the `input` element if there is a field rendered.
499
522
  */
500
523
  autoFocus: PropTypes.bool,
524
+ /**
525
+ * Range positions available for selection.
526
+ * This list is checked against when checking if a next range position can be selected.
527
+ *
528
+ * Used on Date Time Range pickers with current `rangePosition` to force a `finish` selection after just one range position selection.
529
+ * @default ['start', 'end']
530
+ */
531
+ availableRangePositions: PropTypes.arrayOf(PropTypes.oneOf(['end', 'start']).isRequired),
501
532
  /**
502
533
  * The number of calendars to render.
503
534
  * @default 2
@@ -568,6 +599,10 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
568
599
  * @default undefined
569
600
  */
570
601
  fixedWeekNumber: PropTypes.number,
602
+ /**
603
+ * Controlled focused view.
604
+ */
605
+ focusedView: PropTypes.oneOf(['day']),
571
606
  /**
572
607
  * If `true`, calls `renderLoading` instead of rendering the day calendar.
573
608
  * Can be used to preload information and show it in calendar.
@@ -584,11 +619,20 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
584
619
  minDate: PropTypes.any,
585
620
  /**
586
621
  * Callback fired when the value changes.
587
- * @template TDate
588
- * @param {DateRange<TDate>} value The new value.
589
- * @param {PickerSelectionState | undefined} selectionState Indicates if the date range selection is complete.
622
+ * @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
623
+ * @template TView The view type. Will be one of date or time views.
624
+ * @param {TValue} value The new value.
625
+ * @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
626
+ * @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
590
627
  */
591
628
  onChange: PropTypes.func,
629
+ /**
630
+ * Callback fired on focused view change.
631
+ * @template TView
632
+ * @param {TView} view The new view to focus or not.
633
+ * @param {boolean} hasFocus `true` if the view should be focused.
634
+ */
635
+ onFocusedViewChange: PropTypes.func,
592
636
  /**
593
637
  * Callback fired on month change.
594
638
  * @template TDate
@@ -600,6 +644,18 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
600
644
  * @param {RangePosition} rangePosition The new range position.
601
645
  */
602
646
  onRangePositionChange: PropTypes.func,
647
+ /**
648
+ * Callback fired on view change.
649
+ * @template TView
650
+ * @param {TView} view The new view.
651
+ */
652
+ onViewChange: PropTypes.func,
653
+ /**
654
+ * The default visible view.
655
+ * Used when the component view is not controlled.
656
+ * Must be a valid option from `views` list.
657
+ */
658
+ openTo: PropTypes.oneOf(['day']),
603
659
  /**
604
660
  * The position in the currently edited date range.
605
661
  * Used when the component position is controlled.
@@ -674,6 +730,16 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
674
730
  * The selected value.
675
731
  * Used when the component is controlled.
676
732
  */
677
- value: PropTypes.arrayOf(PropTypes.any)
733
+ value: PropTypes.arrayOf(PropTypes.any),
734
+ /**
735
+ * The visible view.
736
+ * Used when the component view is controlled.
737
+ * Must be a valid option from `views` list.
738
+ */
739
+ view: PropTypes.oneOf(['day']),
740
+ /**
741
+ * Available views.
742
+ */
743
+ views: PropTypes.arrayOf(PropTypes.oneOf(['day']))
678
744
  } : void 0;
679
745
  export { DateRangeCalendar };
@@ -4,7 +4,7 @@ import { SlotComponentProps } from '@mui/base/utils';
4
4
  import { Theme } from '@mui/material/styles';
5
5
  import { TimezoneProps } from '@mui/x-date-pickers/models';
6
6
  import { PickersCalendarHeader, PickersCalendarHeaderProps, PickersCalendarHeaderSlots, PickersCalendarHeaderSlotProps } from '@mui/x-date-pickers/PickersCalendarHeader';
7
- import { BaseDateValidationProps, DefaultizedProps, ExportedDayCalendarProps, DayCalendarSlots, DayCalendarSlotProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, PickerSelectionState, DayCalendarProps, ExportedUseViewsOptions } from '@mui/x-date-pickers/internals';
7
+ import { BaseDateValidationProps, DefaultizedProps, ExportedDayCalendarProps, DayCalendarSlots, DayCalendarSlotProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, DayCalendarProps, ExportedUseViewsOptions } from '@mui/x-date-pickers/internals';
8
8
  import { DayRangeValidationProps } from '../internals/models';
9
9
  import { DateRange } from '../models';
10
10
  import { DateRangeCalendarClasses } from './dateRangeCalendarClasses';
@@ -32,7 +32,7 @@ export interface DateRangeCalendarSlotProps<TDate> extends PickersArrowSwitcherS
32
32
  selected: boolean;
33
33
  }>;
34
34
  }
35
- export interface ExportedDateRangeCalendarProps<TDate> extends ExportedDayCalendarProps<TDate>, BaseDateValidationProps<TDate>, DayRangeValidationProps<TDate>, TimezoneProps, Pick<ExportedUseViewsOptions<'day'>, 'autoFocus'> {
35
+ export interface ExportedDateRangeCalendarProps<TDate> extends ExportedDayCalendarProps<TDate>, BaseDateValidationProps<TDate>, DayRangeValidationProps<TDate>, TimezoneProps {
36
36
  /**
37
37
  * If `true`, after selecting `start` date calendar will not automatically switch to the month of `end` date.
38
38
  * @default false
@@ -59,11 +59,6 @@ export interface ExportedDateRangeCalendarProps<TDate> extends ExportedDayCalend
59
59
  * @param {TDate} month The new month.
60
60
  */
61
61
  onMonthChange?: (month: TDate) => void;
62
- /**
63
- * The number of calendars to render.
64
- * @default 2
65
- */
66
- calendars?: 1 | 2 | 3;
67
62
  /**
68
63
  * Position the current month is rendered in.
69
64
  * @default 1
@@ -75,7 +70,7 @@ export interface ExportedDateRangeCalendarProps<TDate> extends ExportedDayCalend
75
70
  */
76
71
  disableDragEditing?: boolean;
77
72
  }
78
- export interface DateRangeCalendarProps<TDate> extends ExportedDateRangeCalendarProps<TDate>, UseRangePositionProps {
73
+ export interface DateRangeCalendarProps<TDate> extends ExportedDateRangeCalendarProps<TDate>, UseRangePositionProps, ExportedUseViewsOptions<'day'> {
79
74
  /**
80
75
  * The selected value.
81
76
  * Used when the component is controlled.
@@ -92,12 +87,10 @@ export interface DateRangeCalendarProps<TDate> extends ExportedDateRangeCalendar
92
87
  */
93
88
  referenceDate?: TDate;
94
89
  /**
95
- * Callback fired when the value changes.
96
- * @template TDate
97
- * @param {DateRange<TDate>} value The new value.
98
- * @param {PickerSelectionState | undefined} selectionState Indicates if the date range selection is complete.
90
+ * The number of calendars to render.
91
+ * @default 2
99
92
  */
100
- onChange?: (value: DateRange<TDate>, selectionState?: PickerSelectionState) => void;
93
+ calendars?: 1 | 2 | 3;
101
94
  className?: string;
102
95
  classes?: Partial<DateRangeCalendarClasses>;
103
96
  /**
@@ -114,8 +107,16 @@ export interface DateRangeCalendarProps<TDate> extends ExportedDateRangeCalendar
114
107
  * @default {}
115
108
  */
116
109
  slotProps?: DateRangeCalendarSlotProps<TDate>;
110
+ /**
111
+ * Range positions available for selection.
112
+ * This list is checked against when checking if a next range position can be selected.
113
+ *
114
+ * Used on Date Time Range pickers with current `rangePosition` to force a `finish` selection after just one range position selection.
115
+ * @default ['start', 'end']
116
+ */
117
+ availableRangePositions?: DateRangePosition[];
117
118
  }
118
119
  export interface DateRangeCalendarOwnerState<TDate> extends DateRangeCalendarProps<TDate> {
119
120
  isDragging: boolean;
120
121
  }
121
- export type DateRangeCalendarDefaultizedProps<TDate> = DefaultizedProps<DateRangeCalendarProps<TDate>, 'reduceAnimations' | 'calendars' | 'disableDragEditing' | keyof BaseDateValidationProps<TDate>>;
122
+ export type DateRangeCalendarDefaultizedProps<TDate> = DefaultizedProps<DateRangeCalendarProps<TDate>, 'views' | 'openTo' | 'reduceAnimations' | 'calendars' | 'disableDragEditing' | 'availableRangePositions' | keyof BaseDateValidationProps<TDate>>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { DateTimeRangePickerProps } from './DateTimeRangePicker.types';
3
+ type DateTimeRangePickerComponent = (<TDate>(props: DateTimeRangePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
4
+ propTypes?: any;
5
+ };
6
+ declare const DateTimeRangePicker: DateTimeRangePickerComponent;
7
+ export { DateTimeRangePicker };