@mui/x-date-pickers-pro 7.0.0-alpha.9 → 7.0.0-beta.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 (165) hide show
  1. package/CHANGELOG.md +139 -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 +6 -6
  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,13 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
3
3
  import { DateRangeCalendarProps } from '../DateRangeCalendar';
4
- export interface DateRangeViewRendererProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends DateRangeCalendarProps<TDate> {
5
- view: TView;
6
- onViewChange?: (view: TView) => void;
4
+ export interface DateRangeViewRendererProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends Omit<DateRangeCalendarProps<TDate>, 'views'> {
7
5
  views: readonly TView[];
8
6
  }
9
7
  /**
10
8
  * We don't pass all the props down to `DateRangeCalendar`,
11
9
  * because otherwise some unwanted props would be passed to the HTML element.
12
10
  */
13
- export declare const renderDateRangeViewCalendar: <TDate extends unknown>({ 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, sx, autoFocus, fixedWeekNumber, disableDragEditing, displayWeekNumber, timezone, }: DateRangeViewRendererProps<TDate, any>) => React.JSX.Element;
11
+ export declare const renderDateRangeViewCalendar: <TDate extends unknown>({ 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, sx, autoFocus, fixedWeekNumber, disableDragEditing, displayWeekNumber, timezone, availableRangePositions, views, view, onViewChange, }: DateRangeViewRendererProps<TDate, "day">) => React.JSX.Element;
@@ -39,7 +39,11 @@ export const renderDateRangeViewCalendar = ({
39
39
  fixedWeekNumber,
40
40
  disableDragEditing,
41
41
  displayWeekNumber,
42
- timezone
42
+ timezone,
43
+ availableRangePositions,
44
+ views,
45
+ view,
46
+ onViewChange
43
47
  }) => /*#__PURE__*/_jsx(DateRangeCalendar, {
44
48
  value: value,
45
49
  defaultValue: defaultValue,
@@ -74,5 +78,9 @@ export const renderDateRangeViewCalendar = ({
74
78
  fixedWeekNumber: fixedWeekNumber,
75
79
  disableDragEditing: disableDragEditing,
76
80
  displayWeekNumber: displayWeekNumber,
77
- timezone: timezone
81
+ timezone: timezone,
82
+ availableRangePositions: availableRangePositions,
83
+ view: view,
84
+ views: views,
85
+ onViewChange: onViewChange
78
86
  });
package/index.d.ts CHANGED
@@ -13,6 +13,9 @@ export * from './DateRangePicker';
13
13
  export * from './DesktopDateRangePicker';
14
14
  export * from './MobileDateRangePicker';
15
15
  export * from './StaticDateRangePicker';
16
+ export * from './DateTimeRangePicker';
17
+ export * from './DesktopDateTimeRangePicker';
18
+ export * from './MobileDateTimeRangePicker';
16
19
  export * from './dateRangeViewRenderers';
17
20
  export type { UseDateRangeFieldProps } from './internals/models/dateRange';
18
21
  export * from './models';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v7.0.0-alpha.9
2
+ * @mui/x-date-pickers-pro v7.0.0-beta.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -24,6 +24,9 @@ export * from './DateRangePicker';
24
24
  export * from './DesktopDateRangePicker';
25
25
  export * from './MobileDateRangePicker';
26
26
  export * from './StaticDateRangePicker';
27
+ export * from './DateTimeRangePicker';
28
+ export * from './DesktopDateTimeRangePicker';
29
+ export * from './MobileDateTimeRangePicker';
27
30
 
28
31
  // View renderers
29
32
  export * from './dateRangeViewRenderers';
@@ -0,0 +1,3 @@
1
+ export { DAY_MARGIN } from '@mui/x-date-pickers/internals';
2
+ export declare const DAY_RANGE_SIZE = 40;
3
+ export declare const RANGE_VIEW_HEIGHT: number;
@@ -0,0 +1,5 @@
1
+ import { DAY_MARGIN, VIEW_HEIGHT } from '@mui/x-date-pickers/internals';
2
+ export { DAY_MARGIN } from '@mui/x-date-pickers/internals';
3
+ export const DAY_RANGE_SIZE = 40;
4
+ // adding the extra height of the range day element height difference (40px vs 36px)
5
+ export const RANGE_VIEW_HEIGHT = VIEW_HEIGHT + 6 * 2 * DAY_MARGIN;
@@ -0,0 +1 @@
1
+ export type { UseRangePickerSlots, UseRangePickerSlotProps, RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerProps, UseRangePickerParams, } from './useRangePicker';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import { UsePickerParams, BasePickerProps, ExportedBaseToolbarProps, UsePickerViewsProps, BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, DateOrTimeViewWithMeridiem, ExportedBaseTabsProps } from '@mui/x-date-pickers/internals';
2
+ import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
3
+ import { RangeFieldSection, BaseRangeNonStaticPickerProps } from '../../models';
4
+ import { UseRangePositionProps, UseRangePositionResponse } from '../useRangePosition';
5
+ import { RangePickerFieldSlots, RangePickerFieldSlotProps } from '../useEnrichedRangePickerFieldProps';
6
+ import { DateRange } from '../../../models';
7
+ export interface UseRangePickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<DateRange<TDate>, TDate, TView>, RangePickerFieldSlots {
8
+ }
9
+ export interface UseRangePickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<DateRange<TDate>, TDate, TView>, RangePickerFieldSlotProps<TDate> {
10
+ tabs?: ExportedBaseTabsProps;
11
+ toolbar?: ExportedBaseToolbarProps;
12
+ }
13
+ export interface RangeOnlyPickerProps<TDate> extends BaseNonStaticPickerProps, UsePickerValueNonStaticProps<TDate | null, RangeFieldSection>, UsePickerViewsNonStaticProps, BaseRangeNonStaticPickerProps, UseRangePositionProps {
14
+ }
15
+ export interface UseRangePickerProps<TDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>, TAdditionalViewProps extends {}> extends RangeOnlyPickerProps<TDate>, BasePickerProps<DateRange<TDate>, TDate, TView, TError, TExternalProps, TAdditionalViewProps> {
16
+ }
17
+ export interface RangePickerAdditionalViewProps extends Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
18
+ }
19
+ export interface UseRangePickerParams<TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseRangePickerProps<TDate, TView, any, TExternalProps, TAdditionalViewProps>, TAdditionalViewProps extends {}> extends Pick<UsePickerParams<DateRange<TDate>, TDate, TView, RangeFieldSection, TExternalProps, TAdditionalViewProps>, 'valueManager' | 'valueType' | 'validator' | 'rendererInterceptor'> {
20
+ props: TExternalProps;
21
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
1
  export { useDesktopRangePicker } from './useDesktopRangePicker';
2
- export type { UseDesktopRangePickerSlots, UseDesktopRangePickerSlotProps, DesktopRangeOnlyPickerProps, } from './useDesktopRangePicker.types';
2
+ export type { UseDesktopRangePickerSlots, UseDesktopRangePickerSlotProps, DesktopRangeOnlyPickerProps, UseDesktopRangePickerProps, } from './useDesktopRangePicker.types';
@@ -14,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  const releaseInfo = getReleaseInfo();
16
16
  export const useDesktopRangePicker = _ref => {
17
- var _fieldType, _slots$layout;
17
+ var _props$openTo, _fieldType, _initialView$current, _slots$layout;
18
18
  let {
19
19
  props
20
20
  } = _ref,
@@ -41,6 +41,7 @@ export const useDesktopRangePicker = _ref => {
41
41
  const fieldContainerRef = React.useRef(null);
42
42
  const anchorRef = React.useRef(null);
43
43
  const popperRef = React.useRef(null);
44
+ const initialView = React.useRef((_props$openTo = props.openTo) != null ? _props$openTo : null);
44
45
  const {
45
46
  rangePosition,
46
47
  onRangePositionChange,
@@ -56,12 +57,18 @@ export const useDesktopRangePicker = _ref => {
56
57
  } = usePicker(_extends({}, pickerParams, {
57
58
  props,
58
59
  wrapperVariant: 'desktop',
59
- autoFocusView: true,
60
+ autoFocusView: false,
60
61
  additionalViewProps: {
61
62
  rangePosition,
62
63
  onRangePositionChange
63
64
  }
64
65
  }));
66
+ React.useEffect(() => {
67
+ if (layoutProps.view) {
68
+ initialView.current = layoutProps.view;
69
+ }
70
+ // eslint-disable-next-line react-hooks/exhaustive-deps
71
+ }, []);
65
72
  const handleBlur = () => {
66
73
  executeInTheNextEventLoopTick(() => {
67
74
  var _fieldContainerRef$cu, _popperRef$current;
@@ -108,9 +115,16 @@ export const useDesktopRangePicker = _ref => {
108
115
  pickerSlotProps: slotProps,
109
116
  pickerSlots: slots,
110
117
  fieldProps,
111
- anchorRef
118
+ anchorRef,
119
+ currentView: layoutProps.view !== props.openTo ? layoutProps.view : undefined,
120
+ initialView: (_initialView$current = initialView.current) != null ? _initialView$current : undefined,
121
+ onViewChange: layoutProps.onViewChange
112
122
  });
113
123
  const slotPropsForLayout = _extends({}, slotProps, {
124
+ tabs: _extends({}, slotProps == null ? void 0 : slotProps.tabs, {
125
+ rangePosition,
126
+ onRangePositionChange
127
+ }),
114
128
  toolbar: _extends({}, slotProps == null ? void 0 : slotProps.toolbar, {
115
129
  rangePosition,
116
130
  onRangePositionChange
@@ -1,21 +1,16 @@
1
- import { UsePickerParams, BasePickerProps, PickersPopperSlots, PickersPopperSlotProps, ExportedBaseToolbarProps, UsePickerViewsProps, BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
- import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
3
- import { RangeFieldSection, BaseRangeNonStaticPickerProps } from '../../models';
4
- import { DateRange } from '../../../models';
5
- import { UseRangePositionProps, UseRangePositionResponse } from '../useRangePosition';
6
- import { RangePickerFieldSlots, RangePickerFieldSlotProps } from '../useEnrichedRangePickerFieldProps';
7
- export interface UseDesktopRangePickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends PickersPopperSlots, ExportedPickersLayoutSlots<DateRange<TDate>, TDate, TView>, RangePickerFieldSlots {
1
+ import { PickersPopperSlots, PickersPopperSlotProps, UsePickerViewsProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
+ import { RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
3
+ export interface UseDesktopRangePickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TDate, TView>, PickersPopperSlots {
8
4
  }
9
- export interface UseDesktopRangePickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends PickersPopperSlotProps, ExportedPickersLayoutSlotProps<DateRange<TDate>, TDate, TView>, RangePickerFieldSlotProps<TDate> {
10
- toolbar?: ExportedBaseToolbarProps;
5
+ export interface UseDesktopRangePickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlotProps<TDate, TView>, PickersPopperSlotProps {
11
6
  }
12
- export interface DesktopRangeOnlyPickerProps<TDate> extends BaseNonStaticPickerProps, UsePickerValueNonStaticProps<TDate | null, RangeFieldSection>, UsePickerViewsNonStaticProps, BaseRangeNonStaticPickerProps, UseRangePositionProps {
7
+ export interface DesktopRangeOnlyPickerProps<TDate> extends RangeOnlyPickerProps<TDate> {
13
8
  /**
14
9
  * If `true`, the start `input` element is focused during the first mount.
15
10
  */
16
11
  autoFocus?: boolean;
17
12
  }
18
- export interface UseDesktopRangePickerProps<TDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends DesktopRangeOnlyPickerProps<TDate>, BasePickerProps<DateRange<TDate>, TDate, TView, TError, TExternalProps, DesktopRangePickerAdditionalViewProps> {
13
+ export interface UseDesktopRangePickerProps<TDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, DesktopRangePickerAdditionalViewProps> {
19
14
  /**
20
15
  * Overridable component slots.
21
16
  * @default {}
@@ -27,8 +22,7 @@ export interface UseDesktopRangePickerProps<TDate, TView extends DateOrTimeViewW
27
22
  */
28
23
  slotProps?: UseDesktopRangePickerSlotProps<TDate, TView>;
29
24
  }
30
- export interface DesktopRangePickerAdditionalViewProps extends Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
25
+ export interface DesktopRangePickerAdditionalViewProps extends RangePickerAdditionalViewProps {
31
26
  }
32
- export interface UseDesktopRangePickerParams<TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, any, TExternalProps>> extends Pick<UsePickerParams<DateRange<TDate>, TDate, TView, RangeFieldSection, TExternalProps, DesktopRangePickerAdditionalViewProps>, 'valueManager' | 'valueType' | 'validator'> {
33
- props: TExternalProps;
27
+ export interface UseDesktopRangePickerParams<TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, DesktopRangePickerAdditionalViewProps> {
34
28
  }
@@ -7,7 +7,7 @@ import { BaseSingleInputFieldProps } from '@mui/x-date-pickers/models';
7
7
  import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks';
8
8
  import { PickersInputLocaleText } from '@mui/x-date-pickers/locales';
9
9
  import { BaseFieldProps, UsePickerResponse, WrapperVariant, UsePickerProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
10
- import { BaseMultiInputFieldProps, RangeFieldSection, UseDateRangeFieldProps } from '../models';
10
+ import { BaseMultiInputFieldProps, RangeFieldSection, UseDateRangeFieldProps, FieldType } from '../models';
11
11
  import { DateRange, RangePosition } from '../../models';
12
12
  import { UseRangePositionResponse } from './useRangePosition';
13
13
  export interface RangePickerFieldSlots extends UseClearableFieldSlots {
@@ -40,7 +40,7 @@ export interface RangePickerFieldSlotProps<TDate> extends UseClearableFieldSlotP
40
40
  }
41
41
  export interface UseEnrichedRangePickerFieldPropsParams<TDate, TView extends DateOrTimeViewWithMeridiem, TError, FieldProps extends BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError> = BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>> extends Pick<UsePickerResponse<DateRange<TDate>, TView, RangeFieldSection, any>, 'open' | 'actions'>, UseRangePositionResponse {
42
42
  wrapperVariant: WrapperVariant;
43
- fieldType: 'single-input' | 'multi-input';
43
+ fieldType: FieldType;
44
44
  readOnly?: boolean;
45
45
  labelId?: string;
46
46
  disableOpenPicker?: boolean;
@@ -52,5 +52,8 @@ export interface UseEnrichedRangePickerFieldPropsParams<TDate, TView extends Dat
52
52
  pickerSlots: RangePickerFieldSlots | undefined;
53
53
  fieldProps: FieldProps;
54
54
  anchorRef?: React.Ref<HTMLDivElement>;
55
+ currentView?: TView | null;
56
+ initialView?: TView;
57
+ onViewChange?: (view: TView) => void;
55
58
  }
56
59
  export declare const useEnrichedRangePickerFieldProps: <TDate, TView extends DateOrTimeViewWithMeridiem, TError>(params: UseEnrichedRangePickerFieldPropsParams<TDate, TView, TError, BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>>) => BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError> | BaseSingleInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>;
@@ -20,23 +20,38 @@ const useMultiInputFieldSlotProps = ({
20
20
  pickerSlotProps,
21
21
  pickerSlots,
22
22
  fieldProps,
23
- anchorRef
23
+ anchorRef,
24
+ currentView,
25
+ initialView,
26
+ onViewChange
24
27
  }) => {
25
28
  const localeText = useLocaleText();
26
29
  const startRef = React.useRef(null);
27
30
  const endRef = React.useRef(null);
31
+ const startFieldRef = React.useRef(null);
32
+ const endFieldRef = React.useRef(null);
33
+ const handleStartFieldRef = useForkRef(fieldProps.unstableStartFieldRef, startFieldRef);
34
+ const handleEndFieldRef = useForkRef(fieldProps.unstableFieldRef, endFieldRef);
35
+ const previousRangePosition = React.useRef(rangePosition);
28
36
  React.useEffect(() => {
37
+ var _currentRef$current;
29
38
  if (!open) {
30
39
  return;
31
40
  }
32
- if (rangePosition === 'start') {
33
- var _startRef$current;
34
- (_startRef$current = startRef.current) == null || _startRef$current.focus();
35
- } else if (rangePosition === 'end') {
36
- var _endRef$current;
37
- (_endRef$current = endRef.current) == null || _endRef$current.focus();
41
+ const currentRef = rangePosition === 'start' ? startRef : endRef;
42
+ (_currentRef$current = currentRef.current) == null || _currentRef$current.focus();
43
+ const currentFieldRef = rangePosition === 'start' ? startFieldRef : endFieldRef;
44
+ if (!currentFieldRef.current || !currentView) {
45
+ // could happen when the user is switching between the inputs
46
+ previousRangePosition.current = rangePosition;
47
+ return;
38
48
  }
39
- }, [rangePosition, open]);
49
+ // bring back focus to the field
50
+ currentFieldRef.current.setSelectedSections(
51
+ // use the current view or `0` when the range position has just been swapped
52
+ previousRangePosition.current === rangePosition ? currentView : 0);
53
+ previousRangePosition.current = rangePosition;
54
+ }, [rangePosition, open, currentView]);
40
55
  const openRangeStartSelection = event => {
41
56
  event.stopPropagation();
42
57
  onRangePositionChange('start');
@@ -54,11 +69,17 @@ const useMultiInputFieldSlotProps = ({
54
69
  const handleFocusStart = () => {
55
70
  if (open) {
56
71
  onRangePositionChange('start');
72
+ if (previousRangePosition.current !== 'start' && initialView) {
73
+ onViewChange == null || onViewChange(initialView);
74
+ }
57
75
  }
58
76
  };
59
77
  const handleFocusEnd = () => {
60
78
  if (open) {
61
79
  onRangePositionChange('end');
80
+ if (previousRangePosition.current !== 'end' && initialView) {
81
+ onViewChange == null || onViewChange(initialView);
82
+ }
62
83
  }
63
84
  };
64
85
  const slots = _extends({
@@ -123,7 +144,9 @@ const useMultiInputFieldSlotProps = ({
123
144
  const restFieldProps = _objectWithoutPropertiesLoose(fieldProps, _excluded);
124
145
  const enrichedFieldProps = _extends({}, restFieldProps, {
125
146
  slots,
126
- slotProps
147
+ slotProps,
148
+ unstableStartFieldRef: handleStartFieldRef,
149
+ unstableEndFieldRef: handleEndFieldRef
127
150
  });
128
151
  return enrichedFieldProps;
129
152
  };
@@ -143,7 +166,8 @@ const useSingleInputFieldSlotProps = ({
143
166
  pickerSlots,
144
167
  pickerSlotProps,
145
168
  fieldProps,
146
- anchorRef
169
+ anchorRef,
170
+ currentView
147
171
  }) => {
148
172
  const inputRef = React.useRef(null);
149
173
  const handleInputRef = useForkRef(inInputRef, inputRef);
@@ -154,7 +178,13 @@ const useSingleInputFieldSlotProps = ({
154
178
  return;
155
179
  }
156
180
  (_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
157
- }, [rangePosition, open]);
181
+ if (!singleInputFieldRef.current || !currentView) {
182
+ return;
183
+ }
184
+ const sections = singleInputFieldRef.current.getSections().map(section => section.type);
185
+ // bring back focus to the field with the current view section selected
186
+ singleInputFieldRef.current.setSelectedSections(rangePosition === 'start' ? sections.indexOf(currentView) : sections.lastIndexOf(currentView));
187
+ }, [rangePosition, open, currentView, singleInputFieldRef]);
158
188
  const updateRangePosition = () => {
159
189
  var _singleInputFieldRef$;
160
190
  if (!singleInputFieldRef.current || inputRef.current !== getActiveElement(document)) {
@@ -1,2 +1,2 @@
1
1
  export { useMobileRangePicker } from './useMobileRangePicker';
2
- export type { UseMobileRangePickerSlots, UseMobileRangePickerSlotProps, MobileRangeOnlyPickerProps, } from './useMobileRangePicker.types';
2
+ export type { UseMobileRangePickerSlots, UseMobileRangePickerSlotProps, MobileRangeOnlyPickerProps, UseMobileRangePickerProps, } from './useMobileRangePicker.types';
@@ -97,6 +97,10 @@ export const useMobileRangePicker = _ref => {
97
97
  fieldProps
98
98
  });
99
99
  const slotPropsForLayout = _extends({}, innerSlotProps, {
100
+ tabs: _extends({}, innerSlotProps == null ? void 0 : innerSlotProps.tabs, {
101
+ rangePosition,
102
+ onRangePositionChange
103
+ }),
100
104
  toolbar: _extends({}, innerSlotProps == null ? void 0 : innerSlotProps.toolbar, {
101
105
  titleId: labelId,
102
106
  rangePosition,
@@ -1,17 +1,12 @@
1
- import { UsePickerParams, BasePickerProps, PickersModalDialogSlots, PickersModalDialogSlotProps, ExportedBaseToolbarProps, UsePickerViewsProps, BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
- import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
3
- import { RangeFieldSection, BaseRangeNonStaticPickerProps } from '../../models';
4
- import { DateRange } from '../../../models';
5
- import { UseRangePositionProps, UseRangePositionResponse } from '../useRangePosition';
6
- import { RangePickerFieldSlots, RangePickerFieldSlotProps } from '../useEnrichedRangePickerFieldProps';
7
- export interface UseMobileRangePickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends PickersModalDialogSlots, ExportedPickersLayoutSlots<DateRange<TDate>, TDate, TView>, RangePickerFieldSlots {
1
+ import { PickersModalDialogSlots, PickersModalDialogSlotProps, UsePickerViewsProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
+ import { RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
3
+ export interface UseMobileRangePickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TDate, TView>, PickersModalDialogSlots {
8
4
  }
9
- export interface UseMobileRangePickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends PickersModalDialogSlotProps, ExportedPickersLayoutSlotProps<DateRange<TDate>, TDate, TView>, RangePickerFieldSlotProps<TDate> {
10
- toolbar?: ExportedBaseToolbarProps;
5
+ export interface UseMobileRangePickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlotProps<TDate, TView>, PickersModalDialogSlotProps {
11
6
  }
12
- export interface MobileRangeOnlyPickerProps<TDate> extends BaseNonStaticPickerProps, UsePickerValueNonStaticProps<TDate | null, RangeFieldSection>, UsePickerViewsNonStaticProps, BaseRangeNonStaticPickerProps, UseRangePositionProps {
7
+ export interface MobileRangeOnlyPickerProps<TDate> extends RangeOnlyPickerProps<TDate> {
13
8
  }
14
- export interface UseMobileRangePickerProps<TDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends MobileRangeOnlyPickerProps<TDate>, BasePickerProps<DateRange<TDate>, TDate, TView, TError, TExternalProps, MobileRangePickerAdditionalViewProps> {
9
+ export interface UseMobileRangePickerProps<TDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, MobileRangePickerAdditionalViewProps> {
15
10
  /**
16
11
  * Overridable component slots.
17
12
  * @default {}
@@ -23,8 +18,7 @@ export interface UseMobileRangePickerProps<TDate, TView extends DateOrTimeViewWi
23
18
  */
24
19
  slotProps?: UseMobileRangePickerSlotProps<TDate, TView>;
25
20
  }
26
- export interface MobileRangePickerAdditionalViewProps extends Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
21
+ export interface MobileRangePickerAdditionalViewProps extends RangePickerAdditionalViewProps {
27
22
  }
28
- export interface UseMobileRangePickerParams<TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseMobileRangePickerProps<TDate, TView, any, TExternalProps>> extends Pick<UsePickerParams<DateRange<TDate>, TDate, TView, RangeFieldSection, TExternalProps, MobileRangePickerAdditionalViewProps>, 'valueManager' | 'valueType' | 'validator'> {
29
- props: TExternalProps;
23
+ export interface UseMobileRangePickerParams<TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseMobileRangePickerProps<TDate, TView, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, MobileRangePickerAdditionalViewProps> {
30
24
  }
@@ -1,13 +1,9 @@
1
- import * as React from 'react';
2
- import { FieldRef } from '@mui/x-date-pickers/models';
3
1
  import { UseFieldResponse } from '@mui/x-date-pickers/internals';
4
- import { RangeFieldSection } from '../../models/fields';
5
- export interface UseMultiInputRangeFieldParams<TSharedProps extends {}, TTextFieldSlotProps extends {}> {
2
+ import { MultiInputFieldRefs } from '../../models/fields';
3
+ export interface UseMultiInputRangeFieldParams<TSharedProps extends {}, TTextFieldSlotProps extends {}> extends MultiInputFieldRefs {
6
4
  sharedProps: TSharedProps;
7
5
  startTextFieldProps: TTextFieldSlotProps;
8
- unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
9
6
  endTextFieldProps: TTextFieldSlotProps;
10
- unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
11
7
  }
12
8
  export interface UseMultiInputRangeFieldResponse<TForwardedProps extends {}> {
13
9
  startDate: UseFieldResponse<TForwardedProps>;
@@ -1,4 +1,4 @@
1
- import { BaseDateValidationProps, TimeValidationProps, DefaultizedProps, MakeOptional, UseFieldInternalProps, DateTimeValidationProps } from '@mui/x-date-pickers/internals';
1
+ import { BaseDateValidationProps, TimeValidationProps, DefaultizedProps, MakeOptional, UseFieldInternalProps, DateTimeValidationProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
2
  import { BaseRangeProps, DayRangeValidationProps } from './dateRange';
3
3
  import { DateTimeRangeValidationError, DateRange } from '../../models';
4
4
  import { RangeFieldSection } from './fields';
@@ -10,3 +10,5 @@ export interface UseDateTimeRangeFieldProps<TDate> extends MakeOptional<UseField
10
10
  ampm?: boolean;
11
11
  }
12
12
  export type UseDateTimeRangeFieldDefaultizedProps<TDate> = DefaultizedProps<UseDateTimeRangeFieldProps<TDate>, keyof BaseDateValidationProps<TDate> | 'format' | 'disableIgnoringDatePartForTimeValidation'>;
13
+ export type DateTimeRangePickerView = Exclude<DateOrTimeViewWithMeridiem, 'month' | 'year'>;
14
+ export type DateTimeRangePickerViewExternal = Exclude<DateTimeRangePickerView, 'meridiem'>;
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { SlotComponentProps } from '@mui/base/utils';
3
3
  import { BaseFieldProps, FieldsTextFieldProps } from '@mui/x-date-pickers/internals';
4
- import { FieldSection } from '@mui/x-date-pickers/models';
4
+ import { FieldSection, FieldRef } from '@mui/x-date-pickers/models';
5
5
  export interface RangeFieldSection extends FieldSection {
6
6
  dateName: 'start' | 'end';
7
7
  }
8
+ export type FieldType = 'single-input' | 'multi-input';
8
9
  /**
9
10
  * Props the `textField` slot of the multi input field can receive when used inside a picker.
10
11
  */
@@ -25,11 +26,15 @@ export interface MultiInputFieldSlotTextFieldProps {
25
26
  export interface MultiInputFieldSlotRootProps {
26
27
  onBlur?: React.FocusEventHandler;
27
28
  }
29
+ export interface MultiInputFieldRefs {
30
+ unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
31
+ unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
32
+ }
28
33
  /**
29
34
  * Props the multi input field can receive when used inside a picker.
30
35
  * Only contains what the MUI component are passing to the field, not what users can pass using the `props.slotProps.field`.
31
36
  */
32
- export interface BaseMultiInputFieldProps<TValue, TDate, TSection extends FieldSection, TError> extends BaseFieldProps<TValue, TDate, TSection, TError> {
37
+ export interface BaseMultiInputFieldProps<TValue, TDate, TSection extends FieldSection, TError> extends BaseFieldProps<TValue, TDate, TSection, TError>, MultiInputFieldRefs {
33
38
  slots?: {
34
39
  root?: React.ElementType;
35
40
  separator?: React.ElementType;
@@ -11,11 +11,12 @@ interface CalculateRangeChangeOptions<TDate> {
11
11
  * It is used to allow dragging range `start` date past `end` date essentially becoming the new `end` date and vice versa.
12
12
  */
13
13
  allowRangeFlip?: boolean;
14
+ shouldMergeDateAndTime?: boolean;
14
15
  }
15
16
  interface CalculateRangeChangeResponse<TDate> {
16
17
  nextSelection: RangePosition;
17
18
  newRange: DateRange<TDate>;
18
19
  }
19
- export declare function calculateRangeChange<TDate>({ utils, range, newDate: selectedDate, rangePosition, allowRangeFlip, }: CalculateRangeChangeOptions<TDate>): CalculateRangeChangeResponse<TDate>;
20
+ export declare function calculateRangeChange<TDate>({ utils, range, newDate: selectedDate, rangePosition, allowRangeFlip, shouldMergeDateAndTime, }: CalculateRangeChangeOptions<TDate>): CalculateRangeChangeResponse<TDate>;
20
21
  export declare function calculateRangePreview<TDate>(options: CalculateRangeChangeOptions<TDate>): DateRange<TDate>;
21
22
  export {};
@@ -1,11 +1,22 @@
1
+ import { mergeDateAndTime } from '@mui/x-date-pickers/internals';
1
2
  export function calculateRangeChange({
2
3
  utils,
3
4
  range,
4
5
  newDate: selectedDate,
5
6
  rangePosition,
6
- allowRangeFlip = false
7
+ allowRangeFlip = false,
8
+ shouldMergeDateAndTime = false
7
9
  }) {
8
10
  const [start, end] = range;
11
+ if (shouldMergeDateAndTime && selectedDate) {
12
+ // If there is a date already selected, then we want to keep its time
13
+ if (start && rangePosition === 'start') {
14
+ selectedDate = mergeDateAndTime(utils, selectedDate, start);
15
+ }
16
+ if (end && rangePosition === 'end') {
17
+ selectedDate = mergeDateAndTime(utils, selectedDate, end);
18
+ }
19
+ }
9
20
  if (rangePosition === 'start') {
10
21
  const truthyResult = allowRangeFlip ? {
11
22
  nextSelection: 'start',
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTcwNTYxODgwMDAwMA==";
3
+ const releaseInfo = "MTcwNjIyMDAwMDAwMA==";
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