@mui/x-date-pickers-pro 8.0.0-alpha.5 → 8.0.0-alpha.7

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 (148) hide show
  1. package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.d.ts +1 -1
  2. package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  3. package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/package.json +1 -1
  4. package/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.d.ts +1 -1
  5. package/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  6. package/{AdapterDateFnsV3 → AdapterDateFnsV2}/package.json +1 -1
  7. package/CHANGELOG.md +206 -1
  8. package/DateRangeCalendar/DateRangeCalendar.js +9 -7
  9. package/DateRangePicker/DateRangePicker.js +1 -1
  10. package/DateRangePicker/DateRangePicker.types.d.ts +5 -0
  11. package/DateRangePicker/DateRangePickerToolbar.d.ts +2 -3
  12. package/DateRangePicker/DateRangePickerToolbar.js +25 -31
  13. package/DateRangePicker/shared.d.ts +1 -1
  14. package/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
  15. package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +4 -5
  16. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +25 -24
  17. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -10
  18. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +7 -5
  19. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +2 -4
  20. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +66 -69
  21. package/DateTimeRangePicker/shared.d.ts +2 -2
  22. package/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
  23. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +7 -2
  24. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
  25. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +2 -3
  26. package/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  27. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +2 -2
  28. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
  29. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +2 -3
  30. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
  31. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
  32. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
  33. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
  34. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
  35. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
  36. package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +2 -2
  37. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
  38. package/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  39. package/hooks/index.d.ts +1 -0
  40. package/hooks/index.js +1 -0
  41. package/hooks/package.json +6 -0
  42. package/hooks/usePickerRangePositionContext.d.ts +7 -0
  43. package/hooks/usePickerRangePositionContext.js +15 -0
  44. package/index.d.ts +2 -0
  45. package/index.js +4 -2
  46. package/internals/hooks/models/useRangePicker.d.ts +4 -4
  47. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +35 -53
  48. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +7 -9
  49. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +6 -6
  50. package/internals/hooks/useEnrichedRangePickerFieldProps.js +11 -8
  51. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +24 -40
  52. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +7 -9
  53. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +10 -12
  54. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -1
  55. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +11 -6
  56. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +2 -2
  57. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +12 -7
  58. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +2 -2
  59. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +13 -8
  60. package/internals/hooks/useNullablePickerRangePositionContext.d.ts +5 -0
  61. package/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
  62. package/internals/hooks/useRangePosition.d.ts +1 -1
  63. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
  64. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +6 -6
  65. package/internals/utils/date-range-manager.js +2 -1
  66. package/internals/utils/releaseInfo.js +1 -1
  67. package/internals/utils/valueManagers.js +7 -7
  68. package/managers/index.d.ts +6 -0
  69. package/managers/index.js +3 -0
  70. package/managers/package.json +6 -0
  71. package/managers/useDateRangeManager.d.ts +15 -0
  72. package/managers/useDateRangeManager.js +31 -0
  73. package/managers/useDateTimeRangeManager.d.ts +15 -0
  74. package/managers/useDateTimeRangeManager.js +31 -0
  75. package/managers/useTimeRangeManager.d.ts +15 -0
  76. package/managers/useTimeRangeManager.js +29 -0
  77. package/models/range.d.ts +0 -1
  78. package/modern/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  79. package/modern/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  80. package/modern/DateRangeCalendar/DateRangeCalendar.js +9 -7
  81. package/modern/DateRangePicker/DateRangePicker.js +1 -1
  82. package/modern/DateRangePicker/DateRangePickerToolbar.js +25 -31
  83. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
  84. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +25 -24
  85. package/modern/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +7 -5
  86. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +66 -69
  87. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
  88. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
  89. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  90. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
  91. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
  92. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
  93. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
  94. package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  95. package/modern/hooks/index.js +1 -0
  96. package/modern/hooks/usePickerRangePositionContext.js +15 -0
  97. package/modern/index.js +4 -2
  98. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +35 -53
  99. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +11 -8
  100. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +24 -40
  101. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +11 -6
  102. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +12 -7
  103. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +13 -8
  104. package/modern/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
  105. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
  106. package/modern/internals/utils/date-range-manager.js +2 -1
  107. package/modern/internals/utils/releaseInfo.js +1 -1
  108. package/modern/internals/utils/valueManagers.js +7 -7
  109. package/modern/managers/index.js +3 -0
  110. package/modern/managers/useDateRangeManager.js +31 -0
  111. package/modern/managers/useDateTimeRangeManager.js +31 -0
  112. package/modern/managers/useTimeRangeManager.js +29 -0
  113. package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  114. package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  115. package/node/DateRangeCalendar/DateRangeCalendar.js +9 -7
  116. package/node/DateRangePicker/DateRangePicker.js +1 -1
  117. package/node/DateRangePicker/DateRangePickerToolbar.js +24 -30
  118. package/node/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
  119. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +24 -23
  120. package/node/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +7 -5
  121. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +65 -68
  122. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
  123. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
  124. package/node/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  125. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
  126. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +12 -14
  127. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +12 -14
  128. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +12 -14
  129. package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  130. package/node/hooks/index.js +12 -0
  131. package/node/hooks/usePickerRangePositionContext.js +22 -0
  132. package/node/index.js +23 -1
  133. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +35 -53
  134. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +11 -8
  135. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +24 -40
  136. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +10 -5
  137. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +11 -6
  138. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +12 -7
  139. package/node/internals/hooks/useNullablePickerRangePositionContext.js +16 -0
  140. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
  141. package/node/internals/utils/date-range-manager.js +2 -1
  142. package/node/internals/utils/releaseInfo.js +1 -1
  143. package/node/internals/utils/valueManagers.js +7 -7
  144. package/node/managers/index.js +26 -0
  145. package/node/managers/useDateRangeManager.js +38 -0
  146. package/node/managers/useDateTimeRangeManager.js +38 -0
  147. package/node/managers/useTimeRangeManager.js +36 -0
  148. package/package.json +5 -5
@@ -1,19 +1,17 @@
1
- import * as React from 'react';
2
1
  import { DefaultizedProps } from '@mui/x-internals/types';
3
2
  import { PickerSelectionState, PickerViewRenderer, TimeViewWithMeridiem, BaseClockProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
4
- import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
5
- export type DateTimeRangePickerTimeWrapperProps<TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>> = Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> & Omit<TComponentProps, 'views' | 'view' | 'onViewChange' | 'value' | 'defaultValue' | 'onChange'> & {
6
- view: TView;
7
- onViewChange?: (view: TView) => void;
8
- views: readonly TView[];
3
+ export type DateTimeRangePickerTimeWrapperProps<TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TimeViewWithMeridiem>, 'value' | 'defaultValue' | 'onChange'>, 'views'>> = Omit<TComponentProps, 'views' | 'view' | 'onViewChange' | 'value' | 'defaultValue' | 'onChange'> & {
4
+ view: TimeViewWithMeridiem;
5
+ onViewChange?: (view: TimeViewWithMeridiem) => void;
6
+ views: readonly TimeViewWithMeridiem[];
9
7
  value?: PickerRangeValue;
10
8
  defaultValue?: PickerRangeValue;
11
- onChange?: (value: PickerRangeValue, selectionState: PickerSelectionState, selectedView: TView) => void;
12
- viewRenderer?: PickerViewRenderer<PickerRangeValue, TView, TComponentProps, any> | null;
13
- openTo?: TView;
9
+ onChange?: (value: PickerRangeValue, selectionState: PickerSelectionState, selectedView: TimeViewWithMeridiem) => void;
10
+ viewRenderer?: PickerViewRenderer<PickerRangeValue, TComponentProps> | null;
11
+ openTo?: TimeViewWithMeridiem;
14
12
  };
15
13
  /**
16
14
  * @ignore - internal component.
17
15
  */
18
- declare function DateTimeRangePickerTimeWrapper<TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>>(props: DateTimeRangePickerTimeWrapperProps<TView, TComponentProps>, ref: React.Ref<HTMLDivElement>): React.ReactNode;
16
+ declare function DateTimeRangePickerTimeWrapper<TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TimeViewWithMeridiem>, 'value' | 'defaultValue' | 'onChange'>, 'views'>>(props: DateTimeRangePickerTimeWrapperProps<TComponentProps>): import("react").ReactNode;
19
17
  export { DateTimeRangePickerTimeWrapper };
@@ -1,17 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["rangePosition", "onRangePositionChange", "viewRenderer", "value", "onChange", "defaultValue", "onViewChange", "views", "className"];
3
+ const _excluded = ["viewRenderer", "value", "onChange", "defaultValue", "onViewChange", "views", "className"];
4
4
  import { isInternalTimeView, useUtils } from '@mui/x-date-pickers/internals';
5
5
  import { isRangeValid } from "../internals/utils/date-utils.js";
6
6
  import { calculateRangeChange } from "../internals/utils/date-range-manager.js";
7
+ import { usePickerRangePositionContext } from "../hooks/index.js";
7
8
  /**
8
9
  * @ignore - internal component.
9
10
  */
10
- function DateTimeRangePickerTimeWrapper(props, ref) {
11
+ function DateTimeRangePickerTimeWrapper(props) {
11
12
  const utils = useUtils();
12
13
  const {
13
- rangePosition,
14
- onRangePositionChange,
15
14
  viewRenderer,
16
15
  value,
17
16
  onChange,
@@ -20,6 +19,10 @@ function DateTimeRangePickerTimeWrapper(props, ref) {
20
19
  views
21
20
  } = props,
22
21
  other = _objectWithoutPropertiesLoose(props, _excluded);
22
+ const {
23
+ rangePosition,
24
+ onRangePositionChange
25
+ } = usePickerRangePositionContext();
23
26
  if (!viewRenderer) {
24
27
  return null;
25
28
  }
@@ -47,7 +50,6 @@ function DateTimeRangePickerTimeWrapper(props, ref) {
47
50
  onChange(newRange, isFullRangeSelected ? 'finish' : 'partial', selectedView);
48
51
  };
49
52
  return viewRenderer(_extends({}, other, {
50
- ref,
51
53
  views,
52
54
  onViewChange,
53
55
  value: currentValue,
@@ -1,9 +1,7 @@
1
1
  import * as React from 'react';
2
- import { BaseToolbarProps, ExportedBaseToolbarProps, DateOrTimeViewWithMeridiem, PickerRangeValue } from '@mui/x-date-pickers/internals';
3
- import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
2
+ import { BaseToolbarProps, ExportedBaseToolbarProps } from '@mui/x-date-pickers/internals';
4
3
  import { DateTimeRangePickerToolbarClasses } from './dateTimeRangePickerToolbarClasses';
5
- type DateTimeRangeViews = Exclude<DateOrTimeViewWithMeridiem, 'year' | 'month'>;
6
- export interface DateTimeRangePickerToolbarProps extends BaseToolbarProps<PickerRangeValue, DateTimeRangeViews>, Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'>, ExportedDateTimeRangePickerToolbarProps {
4
+ export interface DateTimeRangePickerToolbarProps extends BaseToolbarProps, ExportedDateTimeRangePickerToolbarProps {
7
5
  ampm?: boolean;
8
6
  }
9
7
  export interface ExportedDateTimeRangePickerToolbarProps extends ExportedBaseToolbarProps {
@@ -2,17 +2,18 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "classes", "onViewChange", "onChange", "classes", "view", "isLandscape", "views", "ampm", "hidden", "toolbarFormat", "toolbarPlaceholder", "titleId", "sx"];
5
+ const _excluded = ["className", "classes", "classes", "ampm", "hidden", "toolbarFormat", "toolbarPlaceholder", "titleId", "sx"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
9
9
  import { styled, useThemeProps } from '@mui/material/styles';
10
10
  import composeClasses from '@mui/utils/composeClasses';
11
- import { useUtils, useToolbarOwnerState, DateTimePickerToolbarForceDesktopVariant } from '@mui/x-date-pickers/internals';
11
+ import { useUtils, useToolbarOwnerState, DateTimePickerToolbarOverrideContext } from '@mui/x-date-pickers/internals';
12
12
  import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hooks';
13
13
  import { DateTimePickerToolbar } from '@mui/x-date-pickers/DateTimePicker';
14
14
  import { getDateTimeRangePickerToolbarUtilityClass } from "./dateTimeRangePickerToolbarClasses.js";
15
15
  import { calculateRangeChange } from "../internals/utils/date-range-manager.js";
16
+ import { usePickerRangePositionContext } from "../hooks/index.js";
16
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
18
  const useUtilityClasses = classes => {
18
19
  const slots = {
@@ -50,16 +51,8 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
50
51
  });
51
52
  const utils = useUtils();
52
53
  const {
53
- value: [start, end],
54
- rangePosition,
55
- onRangePositionChange,
56
54
  className,
57
55
  classes: classesProp,
58
- onViewChange,
59
- onChange,
60
- view,
61
- isLandscape,
62
- views,
63
56
  ampm,
64
57
  hidden,
65
58
  toolbarFormat,
@@ -69,14 +62,22 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
69
62
  } = props,
70
63
  other = _objectWithoutPropertiesLoose(props, _excluded);
71
64
  const {
65
+ value,
66
+ setValue,
72
67
  disabled,
73
- readOnly
68
+ readOnly,
69
+ view,
70
+ setView,
71
+ views
74
72
  } = usePickerContext();
75
73
  const translations = usePickerTranslations();
76
74
  const ownerState = useToolbarOwnerState();
75
+ const {
76
+ rangePosition,
77
+ onRangePositionChange
78
+ } = usePickerRangePositionContext();
77
79
  const classes = useUtilityClasses(classesProp);
78
80
  const commonToolbarProps = {
79
- isLandscape,
80
81
  views,
81
82
  ampm,
82
83
  disabled,
@@ -85,69 +86,84 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
85
86
  toolbarFormat,
86
87
  toolbarPlaceholder
87
88
  };
88
- const handleStartRangeViewChange = React.useCallback(newView => {
89
- if (newView === 'year' || newView === 'month') {
90
- return;
91
- }
92
- if (rangePosition !== 'start') {
93
- onRangePositionChange('start');
94
- }
95
- onViewChange(newView);
96
- }, [onRangePositionChange, onViewChange, rangePosition]);
97
- const handleEndRangeViewChange = React.useCallback(newView => {
98
- if (newView === 'year' || newView === 'month') {
99
- return;
100
- }
101
- if (rangePosition !== 'end') {
102
- onRangePositionChange('end');
103
- }
104
- onViewChange(newView);
105
- }, [onRangePositionChange, onViewChange, rangePosition]);
106
- const handleOnChange = React.useCallback(newDate => {
89
+ const wrappedSetValue = React.useCallback(newDate => {
107
90
  const {
108
91
  nextSelection,
109
92
  newRange
110
93
  } = calculateRangeChange({
111
94
  newDate,
112
95
  utils,
113
- range: props.value,
96
+ range: value,
114
97
  rangePosition,
115
98
  allowRangeFlip: true
116
99
  });
117
100
  onRangePositionChange(nextSelection);
118
- onChange(newRange);
119
- }, [onChange, onRangePositionChange, props.value, rangePosition, utils]);
101
+ setValue(newRange, {
102
+ changeImportance: 'set'
103
+ });
104
+ }, [setValue, onRangePositionChange, value, rangePosition, utils]);
105
+ const startOverrides = React.useMemo(() => {
106
+ const handleStartRangeViewChange = newView => {
107
+ if (newView === 'year' || newView === 'month') {
108
+ return;
109
+ }
110
+ if (rangePosition !== 'start') {
111
+ onRangePositionChange('start');
112
+ }
113
+ setView(newView);
114
+ };
115
+ return {
116
+ value: value[0],
117
+ setValue: wrappedSetValue,
118
+ forceDesktopVariant: true,
119
+ setView: handleStartRangeViewChange,
120
+ view: rangePosition === 'start' ? view : null
121
+ };
122
+ }, [value, wrappedSetValue, rangePosition, view, onRangePositionChange, setView]);
123
+ const endOverrides = React.useMemo(() => {
124
+ const handleEndRangeViewChange = newView => {
125
+ if (newView === 'year' || newView === 'month') {
126
+ return;
127
+ }
128
+ if (rangePosition !== 'end') {
129
+ onRangePositionChange('end');
130
+ }
131
+ setView(newView);
132
+ };
133
+ return {
134
+ value: value[1],
135
+ setValue: wrappedSetValue,
136
+ forceDesktopVariant: true,
137
+ setView: handleEndRangeViewChange,
138
+ view: rangePosition === 'end' ? view : null
139
+ };
140
+ }, [value, wrappedSetValue, rangePosition, view, onRangePositionChange, setView]);
120
141
  if (hidden) {
121
142
  return null;
122
143
  }
123
- return /*#__PURE__*/_jsx(DateTimeRangePickerToolbarRoot, _extends({
144
+ return /*#__PURE__*/_jsxs(DateTimeRangePickerToolbarRoot, _extends({
124
145
  className: clsx(classes.root, className),
125
146
  ownerState: ownerState,
126
147
  ref: ref,
127
148
  sx: sx
128
149
  }, other, {
129
- children: /*#__PURE__*/_jsxs(DateTimePickerToolbarForceDesktopVariant.Provider, {
130
- value: true,
131
- children: [/*#__PURE__*/_jsx(DateTimeRangePickerToolbarStart, _extends({
132
- value: start,
133
- onViewChange: handleStartRangeViewChange,
150
+ children: [/*#__PURE__*/_jsx(DateTimePickerToolbarOverrideContext.Provider, {
151
+ value: startOverrides,
152
+ children: /*#__PURE__*/_jsx(DateTimeRangePickerToolbarStart, _extends({
134
153
  toolbarTitle: translations.start,
135
154
  ownerState: ownerState,
136
- view: rangePosition === 'start' ? view : undefined,
137
155
  className: classes.startToolbar,
138
- onChange: handleOnChange,
139
156
  titleId: titleId ? `${titleId}-start-toolbar` : undefined
140
- }, commonToolbarProps)), /*#__PURE__*/_jsx(DateTimeRangePickerToolbarEnd, _extends({
141
- value: end,
142
- onViewChange: handleEndRangeViewChange,
157
+ }, commonToolbarProps))
158
+ }), /*#__PURE__*/_jsx(DateTimePickerToolbarOverrideContext.Provider, {
159
+ value: endOverrides,
160
+ children: /*#__PURE__*/_jsx(DateTimeRangePickerToolbarEnd, _extends({
143
161
  toolbarTitle: translations.end,
144
162
  ownerState: ownerState,
145
- view: rangePosition === 'end' ? view : undefined,
146
163
  className: classes.endToolbar,
147
- onChange: handleOnChange,
148
164
  titleId: titleId ? `${titleId}-end-toolbar` : undefined
149
- }, commonToolbarProps))]
150
- })
165
+ }, commonToolbarProps))
166
+ })]
151
167
  }));
152
168
  });
153
169
  process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
@@ -166,16 +182,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
166
182
  * @default `true` for Desktop, `false` for Mobile.
167
183
  */
168
184
  hidden: PropTypes.bool,
169
- isLandscape: PropTypes.bool.isRequired,
170
- onChange: PropTypes.func.isRequired,
171
- onRangePositionChange: PropTypes.func.isRequired,
172
- /**
173
- * Callback called when a toolbar is clicked
174
- * @template TView
175
- * @param {TView} view The view to open
176
- */
177
- onViewChange: PropTypes.func.isRequired,
178
- rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
179
185
  /**
180
186
  * The system prop that allows defining system overrides as well as additional CSS styles.
181
187
  */
@@ -189,15 +195,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
189
195
  * Toolbar value placeholder—it is displayed when the value is empty.
190
196
  * @default "––"
191
197
  */
192
- toolbarPlaceholder: PropTypes.node,
193
- value: PropTypes.arrayOf(PropTypes.object).isRequired,
194
- /**
195
- * Currently visible picker view.
196
- */
197
- view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'seconds']).isRequired,
198
- /**
199
- * Available views.
200
- */
201
- views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'seconds']).isRequired).isRequired
198
+ toolbarPlaceholder: PropTypes.node
202
199
  } : void 0;
203
200
  export { DateTimeRangePickerToolbar };
@@ -34,9 +34,9 @@ export interface BaseDateTimeRangePickerSlotProps extends DateRangeCalendarSlotP
34
34
  */
35
35
  toolbar?: ExportedDateTimeRangePickerToolbarProps;
36
36
  }
37
- export type DateTimeRangePickerRenderers<TView extends DateOrTimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<PickerRangeValue, TView, Omit<DateRangeViewRendererProps<'day'>, 'view' | 'slots' | 'slotProps'> & Omit<TimeViewRendererProps<TimeViewWithMeridiem, BaseClockProps<TimeViewWithMeridiem>>, 'view' | 'slots' | 'slotProps'> & {
37
+ export type DateTimeRangePickerRenderers<TView extends DateOrTimeViewWithMeridiem> = PickerViewRendererLookup<PickerRangeValue, TView, Omit<DateRangeViewRendererProps<'day'>, 'view' | 'slots' | 'slotProps'> & Omit<TimeViewRendererProps<TimeViewWithMeridiem, BaseClockProps<TimeViewWithMeridiem>>, 'view' | 'slots' | 'slotProps'> & {
38
38
  view: TView;
39
- }, TAdditionalProps>;
39
+ }>;
40
40
  export interface BaseDateTimeRangePickerProps extends Omit<BasePickerInputProps<PickerRangeValue, DateTimeRangePickerView, DateTimeRangeValidationError>, 'orientation' | 'views' | 'openTo'>, ExportedDateRangeCalendarProps, ExportedValidateDateTimeRangeProps, DesktopOnlyTimePickerProps, Partial<Pick<UseViewsOptions<PickerRangeValue, DateTimeRangePickerViewExternal>, 'openTo' | 'views'>> {
41
41
  /**
42
42
  * Overridable component slots.
@@ -13,6 +13,8 @@ import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js"
13
13
  import { MultiInputDateRangeField } from "../MultiInputDateRangeField/index.js";
14
14
  import { useDesktopRangePicker } from "../internals/hooks/useDesktopRangePicker/index.js";
15
15
  import { validateDateRange } from "../validation/index.js";
16
+ const emptyActions = [];
17
+
16
18
  /**
17
19
  * Demos:
18
20
  *
@@ -32,6 +34,7 @@ const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDat
32
34
  day: renderDateRangeViewCalendar
33
35
  }, defaultizedProps.viewRenderers);
34
36
  const props = _extends({}, defaultizedProps, {
37
+ closeOnSelect: defaultizedProps.closeOnSelect ?? true,
35
38
  viewRenderers,
36
39
  format: utils.formats.keyboardDate,
37
40
  calendars: defaultizedProps.calendars ?? 2,
@@ -46,7 +49,10 @@ const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDat
46
49
  }),
47
50
  toolbar: _extends({
48
51
  hidden: true
49
- }, defaultizedProps.slotProps?.toolbar)
52
+ }, defaultizedProps.slotProps?.toolbar),
53
+ actionBar: ownerState => _extends({
54
+ actions: emptyActions
55
+ }, resolveComponentProps(defaultizedProps.slotProps?.actionBar, ownerState))
50
56
  })
51
57
  });
52
58
  const {
@@ -78,8 +84,8 @@ DesktopDateRangePicker.propTypes = {
78
84
  calendars: PropTypes.oneOf([1, 2, 3]),
79
85
  className: PropTypes.string,
80
86
  /**
81
- * If `true`, the popover or modal will close after submitting the full date.
82
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
87
+ * If `true`, the Picker will close after submitting the full date.
88
+ * @default true
83
89
  */
84
90
  closeOnSelect: PropTypes.bool,
85
91
  /**
@@ -1,9 +1,9 @@
1
1
  import { MakeOptional } from '@mui/x-internals/types';
2
2
  import { UseDesktopRangePickerSlots, UseDesktopRangePickerSlotProps, DesktopRangeOnlyPickerProps } from '../internals/hooks/useDesktopRangePicker';
3
3
  import { BaseDateRangePickerProps, BaseDateRangePickerSlots, BaseDateRangePickerSlotProps } from '../DateRangePicker/shared';
4
- export interface DesktopDateRangePickerSlots extends BaseDateRangePickerSlots, MakeOptional<UseDesktopRangePickerSlots<'day'>, 'field'> {
4
+ export interface DesktopDateRangePickerSlots extends BaseDateRangePickerSlots, MakeOptional<UseDesktopRangePickerSlots, 'field'> {
5
5
  }
6
- export interface DesktopDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateRangePickerSlotProps, Omit<UseDesktopRangePickerSlotProps<'day', TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
6
+ export interface DesktopDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateRangePickerSlotProps, Omit<UseDesktopRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
7
7
  }
8
8
  export interface DesktopDateRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseDateRangePickerProps, DesktopRangeOnlyPickerProps {
9
9
  /**
@@ -21,4 +21,9 @@ export interface DesktopDateRangePickerProps<TEnableAccessibleFieldDOMStructure
21
21
  * @default {}
22
22
  */
23
23
  slotProps?: DesktopDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
24
+ /**
25
+ * If `true`, the Picker will close after submitting the full date.
26
+ * @default true
27
+ */
28
+ closeOnSelect?: boolean;
24
29
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["openTo", "rangePosition"];
5
+ const _excluded = ["openTo"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { isDatePickerView, isInternalTimeView, resolveDateTimeFormat, useUtils } from '@mui/x-date-pickers/internals';
@@ -22,15 +22,22 @@ import { useDateTimeRangePickerDefaultizedProps } from "../DateTimeRangePicker/s
22
22
  import { MultiInputDateTimeRangeField } from "../MultiInputDateTimeRangeField/index.js";
23
23
  import { DateTimeRangePickerTimeWrapper } from "../DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js";
24
24
  import { RANGE_VIEW_HEIGHT } from "../internals/constants/dimensions.js";
25
+ import { usePickerRangePositionContext } from "../hooks/index.js";
25
26
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
- const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
27
+ const rendererInterceptor = function RendererInterceptor(props) {
27
28
  const {
28
- openTo,
29
- rangePosition
29
+ viewRenderers,
30
+ popperView,
31
+ rendererProps
32
+ } = props;
33
+ const {
34
+ openTo
30
35
  } = rendererProps,
31
36
  otherProps = _objectWithoutPropertiesLoose(rendererProps, _excluded);
37
+ const {
38
+ rangePosition
39
+ } = usePickerRangePositionContext();
32
40
  const finalProps = _extends({}, otherProps, {
33
- rangePosition,
34
41
  focusedView: null,
35
42
  sx: [{
36
43
  [`&.${multiSectionDigitalClockClasses.root}`]: {
@@ -43,7 +50,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
43
50
  });
44
51
  const isTimeViewActive = isInternalTimeView(popperView);
45
52
  return /*#__PURE__*/_jsxs(React.Fragment, {
46
- children: [inViewRenderers.day?.(_extends({}, rendererProps, {
53
+ children: [viewRenderers.day?.(_extends({}, rendererProps, {
47
54
  availableRangePositions: [rangePosition],
48
55
  view: !isTimeViewActive ? popperView : 'day',
49
56
  views: rendererProps.views.filter(isDatePickerView),
@@ -59,7 +66,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
59
66
  view: isTimeViewActive ? popperView : 'hours',
60
67
  views: finalProps.views.filter(isInternalTimeView),
61
68
  openTo: isInternalTimeView(openTo) ? openTo : 'hours',
62
- viewRenderer: inViewRenderers[isTimeViewActive ? popperView : 'hours'],
69
+ viewRenderer: viewRenderers[isTimeViewActive ? popperView : 'hours'],
63
70
  sx: [{
64
71
  gridColumn: 3
65
72
  }, ...finalProps.sx]
@@ -92,7 +99,6 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
92
99
  // Need to avoid adding the `meridiem` view when unexpected renderer is specified
93
100
  const shouldHoursRendererContainMeridiemView = viewRenderers.hours?.name === renderMultiSectionDigitalClockTimeView.name;
94
101
  const views = !shouldHoursRendererContainMeridiemView ? defaultizedProps.views.filter(view => view !== 'meridiem') : defaultizedProps.views;
95
- const actionBarActions = defaultizedProps.shouldRenderTimeInASingleColumn ? [] : ['accept'];
96
102
  const props = _extends({}, defaultizedProps, {
97
103
  views,
98
104
  viewRenderers,
@@ -113,10 +119,7 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
113
119
  }, defaultizedProps.slotProps?.tabs),
114
120
  toolbar: _extends({
115
121
  hidden: true
116
- }, defaultizedProps.slotProps?.toolbar),
117
- actionBar: ownerState => _extends({
118
- actions: actionBarActions
119
- }, resolveComponentProps(defaultizedProps.slotProps?.actionBar, ownerState))
122
+ }, defaultizedProps.slotProps?.toolbar)
120
123
  })
121
124
  });
122
125
  const {
@@ -154,8 +157,8 @@ DesktopDateTimeRangePicker.propTypes = {
154
157
  calendars: PropTypes.oneOf([1, 2, 3]),
155
158
  className: PropTypes.string,
156
159
  /**
157
- * If `true`, the popover or modal will close after submitting the full date.
158
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
160
+ * If `true`, the Picker will close after submitting the full date.
161
+ * @default false
159
162
  */
160
163
  closeOnSelect: PropTypes.bool,
161
164
  /**
@@ -1,10 +1,9 @@
1
1
  import { MakeOptional } from '@mui/x-internals/types';
2
2
  import { UseDesktopRangePickerSlots, UseDesktopRangePickerSlotProps, DesktopRangeOnlyPickerProps } from '../internals/hooks/useDesktopRangePicker';
3
3
  import { BaseDateTimeRangePickerProps, BaseDateTimeRangePickerSlots, BaseDateTimeRangePickerSlotProps } from '../DateTimeRangePicker/shared';
4
- import { DateTimeRangePickerView } from '../internals/models';
5
- export interface DesktopDateTimeRangePickerSlots extends BaseDateTimeRangePickerSlots, MakeOptional<UseDesktopRangePickerSlots<DateTimeRangePickerView>, 'field'> {
4
+ export interface DesktopDateTimeRangePickerSlots extends BaseDateTimeRangePickerSlots, MakeOptional<UseDesktopRangePickerSlots, 'field'> {
6
5
  }
7
- export interface DesktopDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateTimeRangePickerSlotProps, Omit<UseDesktopRangePickerSlotProps<DateTimeRangePickerView, TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
6
+ export interface DesktopDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateTimeRangePickerSlotProps, Omit<UseDesktopRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
8
7
  }
9
8
  export interface DesktopDateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseDateTimeRangePickerProps, DesktopRangeOnlyPickerProps {
10
9
  /**
@@ -74,8 +74,8 @@ MobileDateRangePicker.propTypes = {
74
74
  autoFocus: PropTypes.bool,
75
75
  className: PropTypes.string,
76
76
  /**
77
- * If `true`, the popover or modal will close after submitting the full date.
78
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
77
+ * If `true`, the Picker will close after submitting the full date.
78
+ * @default false
79
79
  */
80
80
  closeOnSelect: PropTypes.bool,
81
81
  /**
@@ -1,9 +1,9 @@
1
1
  import { MakeOptional } from '@mui/x-internals/types';
2
2
  import { UseMobileRangePickerSlots, UseMobileRangePickerSlotProps, MobileRangeOnlyPickerProps } from '../internals/hooks/useMobileRangePicker';
3
3
  import { BaseDateRangePickerProps, BaseDateRangePickerSlots, BaseDateRangePickerSlotProps } from '../DateRangePicker/shared';
4
- export interface MobileDateRangePickerSlots extends BaseDateRangePickerSlots, MakeOptional<UseMobileRangePickerSlots<'day'>, 'field'> {
4
+ export interface MobileDateRangePickerSlots extends BaseDateRangePickerSlots, MakeOptional<UseMobileRangePickerSlots, 'field'> {
5
5
  }
6
- export interface MobileDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateRangePickerSlotProps, Omit<UseMobileRangePickerSlotProps<'day', TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
6
+ export interface MobileDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateRangePickerSlotProps, Omit<UseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
7
7
  }
8
8
  export interface MobileDateRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseDateRangePickerProps, MobileRangeOnlyPickerProps {
9
9
  /**
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["view", "openTo", "rangePosition"];
5
+ const _excluded = ["view", "openTo"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { refType } from '@mui/utils';
@@ -20,16 +20,23 @@ import { useDateTimeRangePickerDefaultizedProps } from "../DateTimeRangePicker/s
20
20
  import { MultiInputDateTimeRangeField } from "../MultiInputDateTimeRangeField/index.js";
21
21
  import { DateTimeRangePickerTimeWrapper } from "../DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js";
22
22
  import { RANGE_VIEW_HEIGHT } from "../internals/constants/dimensions.js";
23
+ import { usePickerRangePositionContext } from "../hooks/index.js";
23
24
  import { jsx as _jsx } from "react/jsx-runtime";
24
- const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
25
+ const rendererInterceptor = function RendererInterceptor(props) {
26
+ const {
27
+ viewRenderers,
28
+ popperView,
29
+ rendererProps
30
+ } = props;
31
+ const {
32
+ rangePosition
33
+ } = usePickerRangePositionContext();
25
34
  const {
26
35
  view,
27
- openTo,
28
- rangePosition
36
+ openTo
29
37
  } = rendererProps,
30
38
  otherRendererProps = _objectWithoutPropertiesLoose(rendererProps, _excluded);
31
39
  const finalProps = _extends({}, otherRendererProps, {
32
- rangePosition,
33
40
  focusedView: null,
34
41
  sx: [{
35
42
  width: DIALOG_WIDTH,
@@ -53,7 +60,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
53
60
  }]
54
61
  });
55
62
  const isTimeView = isInternalTimeView(popperView);
56
- const viewRenderer = inViewRenderers[popperView];
63
+ const viewRenderer = viewRenderers[popperView];
57
64
  if (!viewRenderer) {
58
65
  return null;
59
66
  }
@@ -148,8 +155,8 @@ MobileDateTimeRangePicker.propTypes = {
148
155
  autoFocus: PropTypes.bool,
149
156
  className: PropTypes.string,
150
157
  /**
151
- * If `true`, the popover or modal will close after submitting the full date.
152
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
158
+ * If `true`, the Picker will close after submitting the full date.
159
+ * @default false
153
160
  */
154
161
  closeOnSelect: PropTypes.bool,
155
162
  /**
@@ -1,10 +1,9 @@
1
1
  import { MakeOptional } from '@mui/x-internals/types';
2
2
  import { UseMobileRangePickerSlots, UseMobileRangePickerSlotProps, MobileRangeOnlyPickerProps } from '../internals/hooks/useMobileRangePicker';
3
3
  import { BaseDateTimeRangePickerProps, BaseDateTimeRangePickerSlots, BaseDateTimeRangePickerSlotProps } from '../DateTimeRangePicker/shared';
4
- import { DateTimeRangePickerView } from '../internals/models';
5
- export interface MobileDateTimeRangePickerSlots extends BaseDateTimeRangePickerSlots, MakeOptional<UseMobileRangePickerSlots<DateTimeRangePickerView>, 'field'> {
4
+ export interface MobileDateTimeRangePickerSlots extends BaseDateTimeRangePickerSlots, MakeOptional<UseMobileRangePickerSlots, 'field'> {
6
5
  }
7
- export interface MobileDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateTimeRangePickerSlotProps, Omit<UseMobileRangePickerSlotProps<DateTimeRangePickerView, TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
6
+ export interface MobileDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateTimeRangePickerSlotProps, Omit<UseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
8
7
  }
9
8
  export interface MobileDateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends BaseDateTimeRangePickerProps, MobileRangeOnlyPickerProps {
10
9
  /**
@@ -1,2 +1,2 @@
1
1
  import { UseSingleInputDateRangeFieldProps } from './SingleInputDateRangeField.types';
2
- export declare const useSingleInputDateRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputDateRangeFieldProps<TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputDateRangeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateFieldBaseProps> & Required<Pick<UseSingleInputDateRangeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateFieldBaseProps>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "referenceDate" | "timezone" | "formatDensity" | "enableAccessibleFieldDOMStructure" | "selectedSections" | "onSelectedSectionsChange" | "shouldRespectLeadingZeros" | "unstableFieldRef" | keyof import("@mui/x-date-pickers/internals").BaseDateValidationProps | "shouldDisableDate" | "shouldDisableMonth" | "shouldDisableYear" | "dateSeparator">>;
2
+ export declare const useSingleInputDateRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputDateRangeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "onChange" | "onError" | "format" | "referenceDate" | "timezone" | "formatDensity" | "enableAccessibleFieldDOMStructure" | "selectedSections" | "onSelectedSectionsChange" | "shouldRespectLeadingZeros" | "unstableFieldRef" | keyof import("@mui/x-date-pickers/internals").BaseDateValidationProps | "shouldDisableDate" | "shouldDisableMonth" | "shouldDisableYear" | "dateSeparator">>;
@@ -1,25 +1,24 @@
1
1
  'use client';
2
2
 
3
- import * as React from 'react';
4
- import { useField, useDefaultizedDateField } from '@mui/x-date-pickers/internals';
3
+ import { useField, useFieldInternalPropsWithDefaults } from '@mui/x-date-pickers/internals';
5
4
  import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
6
- import { rangeValueManager, getRangeFieldValueManager } from "../internals/utils/valueManagers.js";
7
- import { validateDateRange } from "../validation/index.js";
8
- export const useSingleInputDateRangeField = inProps => {
9
- const props = useDefaultizedDateField(inProps);
5
+ import { useDateRangeManager } from "../managers/index.js";
6
+ export const useSingleInputDateRangeField = props => {
7
+ const manager = useDateRangeManager(props);
10
8
  const {
11
9
  forwardedProps,
12
10
  internalProps
13
11
  } = useSplitFieldProps(props, 'date');
14
- const fieldValueManager = React.useMemo(() => getRangeFieldValueManager({
15
- dateSeparator: internalProps.dateSeparator
16
- }), [internalProps.dateSeparator]);
12
+ const internalPropsWithDefaults = useFieldInternalPropsWithDefaults({
13
+ manager,
14
+ internalProps
15
+ });
17
16
  return useField({
18
17
  forwardedProps,
19
- internalProps,
20
- valueManager: rangeValueManager,
21
- fieldValueManager,
22
- validator: validateDateRange,
23
- valueType: 'date'
18
+ internalProps: internalPropsWithDefaults,
19
+ valueManager: manager.internal_valueManager,
20
+ fieldValueManager: manager.internal_fieldValueManager,
21
+ validator: manager.validator,
22
+ valueType: manager.valueType
24
23
  });
25
24
  };
@@ -1,2 +1,2 @@
1
1
  import { UseSingleInputDateTimeRangeFieldProps } from './SingleInputDateTimeRangeField.types';
2
- export declare const useSingleInputDateTimeRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps> & Required<Pick<UseSingleInputDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "referenceDate" | "timezone" | "formatDensity" | "enableAccessibleFieldDOMStructure" | "selectedSections" | "onSelectedSectionsChange" | "shouldRespectLeadingZeros" | "unstableFieldRef" | "ampm" | "disableFuture" | "maxDate" | "disablePast" | "minDate" | "minTime" | "maxTime" | "minutesStep" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "minDateTime" | "maxDateTime" | "shouldDisableDate" | "shouldDisableMonth" | "shouldDisableYear" | "dateSeparator">>;
2
+ export declare const useSingleInputDateTimeRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "onChange" | "onError" | "format" | "referenceDate" | "timezone" | "formatDensity" | "enableAccessibleFieldDOMStructure" | "selectedSections" | "onSelectedSectionsChange" | "shouldRespectLeadingZeros" | "unstableFieldRef" | "ampm" | "disableFuture" | "maxDate" | "disablePast" | "minDate" | "minTime" | "maxTime" | "minutesStep" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "shouldDisableDate" | "shouldDisableMonth" | "shouldDisableYear" | "minDateTime" | "maxDateTime" | "dateSeparator">>;