@mui/x-date-pickers-pro 8.0.0-alpha.6 → 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 (144) 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 +127 -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 -17
  13. package/DateRangePicker/shared.d.ts +1 -1
  14. package/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
  15. package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +3 -4
  16. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +8 -7
  17. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -10
  18. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +7 -5
  19. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +2 -3
  20. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +26 -28
  21. package/DateTimeRangePicker/shared.d.ts +2 -2
  22. package/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
  23. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +5 -0
  24. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
  25. package/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  26. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
  27. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
  28. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
  29. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
  30. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
  31. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
  32. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
  33. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
  34. package/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  35. package/hooks/index.d.ts +1 -0
  36. package/hooks/index.js +1 -0
  37. package/hooks/package.json +6 -0
  38. package/hooks/usePickerRangePositionContext.d.ts +7 -0
  39. package/hooks/usePickerRangePositionContext.js +15 -0
  40. package/index.d.ts +2 -0
  41. package/index.js +4 -2
  42. package/internals/hooks/models/useRangePicker.d.ts +2 -2
  43. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +26 -43
  44. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -5
  45. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +5 -5
  46. package/internals/hooks/useEnrichedRangePickerFieldProps.js +3 -3
  47. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -35
  48. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -5
  49. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +10 -12
  50. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -1
  51. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +11 -6
  52. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +2 -2
  53. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +12 -7
  54. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +2 -2
  55. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +13 -8
  56. package/internals/hooks/useNullablePickerRangePositionContext.d.ts +5 -0
  57. package/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
  58. package/internals/hooks/useRangePosition.d.ts +1 -1
  59. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
  60. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +2 -2
  61. package/internals/utils/date-range-manager.js +2 -1
  62. package/internals/utils/releaseInfo.js +1 -1
  63. package/internals/utils/valueManagers.js +7 -7
  64. package/managers/index.d.ts +6 -0
  65. package/managers/index.js +3 -0
  66. package/managers/package.json +6 -0
  67. package/managers/useDateRangeManager.d.ts +15 -0
  68. package/managers/useDateRangeManager.js +31 -0
  69. package/managers/useDateTimeRangeManager.d.ts +15 -0
  70. package/managers/useDateTimeRangeManager.js +31 -0
  71. package/managers/useTimeRangeManager.d.ts +15 -0
  72. package/managers/useTimeRangeManager.js +29 -0
  73. package/models/range.d.ts +0 -1
  74. package/modern/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  75. package/modern/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  76. package/modern/DateRangeCalendar/DateRangeCalendar.js +9 -7
  77. package/modern/DateRangePicker/DateRangePicker.js +1 -1
  78. package/modern/DateRangePicker/DateRangePickerToolbar.js +25 -17
  79. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
  80. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +8 -7
  81. package/modern/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +7 -5
  82. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +26 -28
  83. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
  84. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
  85. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  86. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
  87. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
  88. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
  89. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
  90. package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  91. package/modern/hooks/index.js +1 -0
  92. package/modern/hooks/usePickerRangePositionContext.js +15 -0
  93. package/modern/index.js +4 -2
  94. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +26 -43
  95. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +3 -3
  96. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -35
  97. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +11 -6
  98. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +12 -7
  99. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +13 -8
  100. package/modern/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
  101. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
  102. package/modern/internals/utils/date-range-manager.js +2 -1
  103. package/modern/internals/utils/releaseInfo.js +1 -1
  104. package/modern/internals/utils/valueManagers.js +7 -7
  105. package/modern/managers/index.js +3 -0
  106. package/modern/managers/useDateRangeManager.js +31 -0
  107. package/modern/managers/useDateTimeRangeManager.js +31 -0
  108. package/modern/managers/useTimeRangeManager.js +29 -0
  109. package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  110. package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  111. package/node/DateRangeCalendar/DateRangeCalendar.js +9 -7
  112. package/node/DateRangePicker/DateRangePicker.js +1 -1
  113. package/node/DateRangePicker/DateRangePickerToolbar.js +24 -16
  114. package/node/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
  115. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +8 -7
  116. package/node/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +7 -5
  117. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +26 -28
  118. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
  119. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
  120. package/node/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  121. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
  122. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +12 -14
  123. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +12 -14
  124. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +12 -14
  125. package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  126. package/node/hooks/index.js +12 -0
  127. package/node/hooks/usePickerRangePositionContext.js +22 -0
  128. package/node/index.js +23 -1
  129. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +26 -43
  130. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +3 -3
  131. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -35
  132. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +10 -5
  133. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +11 -6
  134. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +12 -7
  135. package/node/internals/hooks/useNullablePickerRangePositionContext.js +16 -0
  136. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
  137. package/node/internals/utils/date-range-manager.js +2 -1
  138. package/node/internals/utils/releaseInfo.js +1 -1
  139. package/node/internals/utils/valueManagers.js +7 -7
  140. package/node/managers/index.js +26 -0
  141. package/node/managers/useDateRangeManager.js +38 -0
  142. package/node/managers/useDateTimeRangeManager.js +38 -0
  143. package/node/managers/useTimeRangeManager.js +36 -0
  144. package/package.json +5 -5
@@ -7,6 +7,7 @@ import { styled } from '@mui/material/styles';
7
7
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
8
8
  import { usePicker, DIALOG_WIDTH, PickerProvider } from '@mui/x-date-pickers/internals';
9
9
  import { useRangePosition } from "../useRangePosition.js";
10
+ import { PickerRangePositionContext } from "../../../hooks/usePickerRangePositionContext.js";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
12
  const PickerStaticLayout = styled(PickersLayout)(({
12
13
  theme
@@ -35,12 +36,8 @@ export const useStaticRangePicker = _ref => {
35
36
  displayStaticWrapperAs,
36
37
  autoFocus
37
38
  } = props;
39
+ const rangePositionResponse = useRangePosition(props);
38
40
  const {
39
- rangePosition,
40
- onRangePositionChange
41
- } = useRangePosition(props);
42
- const {
43
- layoutProps,
44
41
  providerProps,
45
42
  renderCurrentView
46
43
  } = usePicker(_extends({}, pickerParams, {
@@ -48,29 +45,22 @@ export const useStaticRangePicker = _ref => {
48
45
  autoFocusView: autoFocus ?? false,
49
46
  fieldRef: undefined,
50
47
  localeText,
51
- additionalViewProps: {
52
- rangePosition,
53
- onRangePositionChange
54
- },
55
48
  variant: displayStaticWrapperAs
56
49
  }));
57
50
  const Layout = slots?.layout ?? PickerStaticLayout;
58
- const slotPropsForLayout = _extends({}, slotProps, {
59
- toolbar: _extends({}, slotProps?.toolbar, {
60
- rangePosition,
61
- onRangePositionChange
62
- })
63
- });
64
- const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
65
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
66
- slots: slots,
67
- slotProps: slotPropsForLayout,
68
- sx: [...(Array.isArray(sx) ? sx : [sx]), ...(Array.isArray(slotProps?.layout?.sx) ? slotProps.layout.sx : [slotProps?.layout?.sx])],
69
- className: clsx(className, slotProps?.layout?.className),
70
- ref: ref,
71
- children: renderCurrentView()
51
+ const renderPicker = () => /*#__PURE__*/_jsx(PickerRangePositionContext.Provider, {
52
+ value: rangePositionResponse,
53
+ children: /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
54
+ children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
55
+ slots: slots,
56
+ slotProps: slotProps,
57
+ sx: [...(Array.isArray(sx) ? sx : [sx]), ...(Array.isArray(slotProps?.layout?.sx) ? slotProps.layout.sx : [slotProps?.layout?.sx])],
58
+ className: clsx(className, slotProps?.layout?.className),
59
+ ref: ref,
60
+ children: renderCurrentView()
61
+ }))
72
62
  }))
73
- }));
63
+ });
74
64
  return {
75
65
  renderPicker
76
66
  };
@@ -9,7 +9,7 @@ export interface UseStaticRangePickerSlotProps extends ExportedPickersLayoutSlot
9
9
  }
10
10
  export interface StaticRangeOnlyPickerProps extends StaticOnlyPickerProps, UseRangePositionProps {
11
11
  }
12
- export interface UseStaticRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends BasePickerProps<PickerRangeValue, TView, TError, TExternalProps, {}>, StaticRangeOnlyPickerProps {
12
+ export interface UseStaticRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends BasePickerProps<PickerRangeValue, TView, TError, TExternalProps>, StaticRangeOnlyPickerProps {
13
13
  /**
14
14
  * Overridable components.
15
15
  * @default {}
@@ -21,7 +21,7 @@ export interface UseStaticRangePickerProps<TView extends DateOrTimeViewWithMerid
21
21
  */
22
22
  slotProps?: UseStaticRangePickerSlotProps;
23
23
  }
24
- export interface UseStaticRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerRangeValue, TView, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
24
+ export interface UseStaticRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerRangeValue, TView, TExternalProps>, 'valueManager' | 'valueType' | 'validator'> {
25
25
  props: TExternalProps;
26
26
  /**
27
27
  * Ref to pass to the root element
@@ -8,7 +8,8 @@ export function calculateRangeChange({
8
8
  shouldMergeDateAndTime = false,
9
9
  referenceDate
10
10
  }) {
11
- const [start, end] = range;
11
+ const start = !utils.isValid(range[0]) ? null : range[0];
12
+ const end = !utils.isValid(range[1]) ? null : range[1];
12
13
  if (shouldMergeDateAndTime && selectedDate) {
13
14
  // If there is a date already selected, then we want to keep its time
14
15
  if (start && rangePosition === 'start') {
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczNTE2NDAwMDAwMA==";
3
+ const releaseInfo = "MTczNjM3NzIwMDAwMA==";
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
@@ -12,8 +12,8 @@ export const rangeValueManager = {
12
12
  referenceDate: referenceDateProp
13
13
  } = _ref,
14
14
  params = _objectWithoutPropertiesLoose(_ref, _excluded);
15
- const shouldKeepStartDate = value[0] != null && params.utils.isValid(value[0]);
16
- const shouldKeepEndDate = value[1] != null && params.utils.isValid(value[1]);
15
+ const shouldKeepStartDate = params.utils.isValid(value[0]);
16
+ const shouldKeepEndDate = params.utils.isValid(value[1]);
17
17
  if (shouldKeepStartDate && shouldKeepEndDate) {
18
18
  return value;
19
19
  }
@@ -26,8 +26,8 @@ export const rangeValueManager = {
26
26
  hasError: error => error[0] != null || error[1] != null,
27
27
  defaultErrorState: [null, null],
28
28
  getTimezone: (utils, value) => {
29
- const timezoneStart = value[0] == null || !utils.isValid(value[0]) ? null : utils.getTimezone(value[0]);
30
- const timezoneEnd = value[1] == null || !utils.isValid(value[1]) ? null : utils.getTimezone(value[1]);
29
+ const timezoneStart = utils.isValid(value[0]) ? utils.getTimezone(value[0]) : null;
30
+ const timezoneEnd = utils.isValid(value[1]) ? utils.getTimezone(value[1]) : null;
31
31
  if (timezoneStart != null && timezoneEnd != null && timezoneStart !== timezoneEnd) {
32
32
  throw new Error('MUI X: The timezone of the start and the end date should be the same.');
33
33
  }
@@ -39,8 +39,8 @@ export const getRangeFieldValueManager = ({
39
39
  dateSeparator = '–'
40
40
  }) => ({
41
41
  updateReferenceValue: (utils, value, prevReferenceValue) => {
42
- const shouldKeepStartDate = value[0] != null && utils.isValid(value[0]);
43
- const shouldKeepEndDate = value[1] != null && utils.isValid(value[1]);
42
+ const shouldKeepStartDate = utils.isValid(value[0]);
43
+ const shouldKeepEndDate = utils.isValid(value[1]);
44
44
  if (!shouldKeepStartDate && !shouldKeepEndDate) {
45
45
  return prevReferenceValue;
46
46
  }
@@ -111,7 +111,7 @@ export const getRangeFieldValueManager = ({
111
111
  },
112
112
  getNewValuesFromNewActiveDate: newActiveDate => ({
113
113
  value: updateDateInRange(newActiveDate, state.value),
114
- referenceValue: newActiveDate == null || !utils.isValid(newActiveDate) ? state.referenceValue : updateDateInRange(newActiveDate, state.referenceValue)
114
+ referenceValue: !utils.isValid(newActiveDate) ? state.referenceValue : updateDateInRange(newActiveDate, state.referenceValue)
115
115
  })
116
116
  };
117
117
  }
@@ -0,0 +1,6 @@
1
+ export { useDateRangeManager } from './useDateRangeManager';
2
+ export type { UseDateRangeManagerReturnValue, UseDateRangeManagerParameters, } from './useDateRangeManager';
3
+ export { useTimeRangeManager } from './useTimeRangeManager';
4
+ export type { UseTimeRangeManagerReturnValue, UseTimeRangeManagerParameters, } from './useTimeRangeManager';
5
+ export { useDateTimeRangeManager } from './useDateTimeRangeManager';
6
+ export type { UseDateTimeRangeManagerReturnValue, UseDateTimeRangeManagerParameters, } from './useDateTimeRangeManager';
@@ -0,0 +1,3 @@
1
+ export { useDateRangeManager } from "./useDateRangeManager.js";
2
+ export { useTimeRangeManager } from "./useTimeRangeManager.js";
3
+ export { useDateTimeRangeManager } from "./useDateTimeRangeManager.js";
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/managers/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,15 @@
1
+ import type { MakeOptional } from '@mui/x-internals/types';
2
+ import { PickerManager } from '@mui/x-date-pickers/models';
3
+ import { PickerRangeValue, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
4
+ import { DateRangeValidationError, RangeFieldSeparatorProps } from '../models';
5
+ import { ExportedValidateDateRangeProps, ValidateDateRangeProps } from '../validation/validateDateRange';
6
+ export declare function useDateRangeManager<TEnableAccessibleFieldDOMStructure extends boolean = true>(parameters?: UseDateRangeManagerParameters<TEnableAccessibleFieldDOMStructure>): UseDateRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure>;
7
+ export interface UseDateRangeManagerParameters<TEnableAccessibleFieldDOMStructure extends boolean> extends RangeFieldSeparatorProps {
8
+ enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
9
+ }
10
+ export type UseDateRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateRangeValidationError, DateRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>, DateRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure>>;
11
+ interface DateRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>, 'format'>, RangeFieldSeparatorProps, ExportedValidateDateRangeProps {
12
+ }
13
+ interface DateRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure extends boolean> extends UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>, ValidateDateRangeProps, RangeFieldSeparatorProps {
14
+ }
15
+ export {};
@@ -0,0 +1,31 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import { getDateFieldInternalPropsDefaults } from '@mui/x-date-pickers/internals';
6
+ import { getRangeFieldValueManager, rangeValueManager } from "../internals/utils/valueManagers.js";
7
+ import { validateDateRange } from "../validation/index.js";
8
+ export function useDateRangeManager(parameters = {}) {
9
+ const {
10
+ enableAccessibleFieldDOMStructure = true,
11
+ dateSeparator
12
+ } = parameters;
13
+ return React.useMemo(() => ({
14
+ valueType: 'date',
15
+ validator: validateDateRange,
16
+ internal_valueManager: rangeValueManager,
17
+ internal_fieldValueManager: getRangeFieldValueManager({
18
+ dateSeparator
19
+ }),
20
+ internal_enableAccessibleFieldDOMStructure: enableAccessibleFieldDOMStructure,
21
+ internal_applyDefaultsToFieldInternalProps: ({
22
+ internalProps,
23
+ utils,
24
+ defaultDates
25
+ }) => _extends({}, internalProps, getDateFieldInternalPropsDefaults({
26
+ defaultDates,
27
+ utils,
28
+ internalProps
29
+ }))
30
+ }), [enableAccessibleFieldDOMStructure, dateSeparator]);
31
+ }
@@ -0,0 +1,15 @@
1
+ import type { MakeOptional } from '@mui/x-internals/types';
2
+ import { PickerManager } from '@mui/x-date-pickers/models';
3
+ import { AmPmProps, PickerRangeValue, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
4
+ import { DateTimeRangeValidationError, RangeFieldSeparatorProps } from '../models';
5
+ import { ExportedValidateDateTimeRangeProps, ValidateDateTimeRangeProps } from '../validation/validateDateTimeRange';
6
+ export declare function useDateTimeRangeManager<TEnableAccessibleFieldDOMStructure extends boolean = true>(parameters?: UseDateTimeRangeManagerParameters<TEnableAccessibleFieldDOMStructure>): UseDateTimeRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure>;
7
+ export interface UseDateTimeRangeManagerParameters<TEnableAccessibleFieldDOMStructure extends boolean> extends RangeFieldSeparatorProps {
8
+ enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
9
+ }
10
+ export type UseDateTimeRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError, DateTimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>, DateTimeRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure>>;
11
+ interface DateTimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, 'format'>, ExportedValidateDateTimeRangeProps, AmPmProps, RangeFieldSeparatorProps {
12
+ }
13
+ interface DateTimeRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure extends boolean> extends UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, ValidateDateTimeRangeProps, RangeFieldSeparatorProps {
14
+ }
15
+ export {};
@@ -0,0 +1,31 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import { getDateTimeFieldInternalPropsDefaults } from '@mui/x-date-pickers/internals';
6
+ import { getRangeFieldValueManager, rangeValueManager } from "../internals/utils/valueManagers.js";
7
+ import { validateDateTimeRange } from "../validation/index.js";
8
+ export function useDateTimeRangeManager(parameters = {}) {
9
+ const {
10
+ enableAccessibleFieldDOMStructure = true,
11
+ dateSeparator
12
+ } = parameters;
13
+ return React.useMemo(() => ({
14
+ valueType: 'date-time',
15
+ validator: validateDateTimeRange,
16
+ internal_valueManager: rangeValueManager,
17
+ internal_fieldValueManager: getRangeFieldValueManager({
18
+ dateSeparator
19
+ }),
20
+ internal_enableAccessibleFieldDOMStructure: enableAccessibleFieldDOMStructure,
21
+ internal_applyDefaultsToFieldInternalProps: ({
22
+ internalProps,
23
+ utils,
24
+ defaultDates
25
+ }) => _extends({}, internalProps, getDateTimeFieldInternalPropsDefaults({
26
+ internalProps,
27
+ utils,
28
+ defaultDates
29
+ }))
30
+ }), [enableAccessibleFieldDOMStructure, dateSeparator]);
31
+ }
@@ -0,0 +1,15 @@
1
+ import type { MakeOptional } from '@mui/x-internals/types';
2
+ import { PickerManager } from '@mui/x-date-pickers/models';
3
+ import { AmPmProps, PickerRangeValue, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
4
+ import { TimeRangeValidationError, RangeFieldSeparatorProps } from '../models';
5
+ import { ExportedValidateTimeRangeProps, ValidateTimeRangeProps } from '../validation/validateTimeRange';
6
+ export declare function useTimeRangeManager<TEnableAccessibleFieldDOMStructure extends boolean = true>(parameters?: UseTimeRangeManagerParameters<TEnableAccessibleFieldDOMStructure>): UseTimeRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure>;
7
+ export interface UseTimeRangeManagerParameters<TEnableAccessibleFieldDOMStructure extends boolean> extends RangeFieldSeparatorProps {
8
+ enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
9
+ }
10
+ export type UseTimeRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerRangeValue, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError, TimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>, TimeRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure>>;
11
+ interface TimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, 'format'>, ExportedValidateTimeRangeProps, AmPmProps, RangeFieldSeparatorProps {
12
+ }
13
+ interface TimeRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure extends boolean> extends UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, ValidateTimeRangeProps {
14
+ }
15
+ export {};
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import { getTimeFieldInternalPropsDefaults } from '@mui/x-date-pickers/internals';
6
+ import { getRangeFieldValueManager, rangeValueManager } from "../internals/utils/valueManagers.js";
7
+ import { validateTimeRange } from "../validation/index.js";
8
+ export function useTimeRangeManager(parameters = {}) {
9
+ const {
10
+ enableAccessibleFieldDOMStructure = true,
11
+ dateSeparator
12
+ } = parameters;
13
+ return React.useMemo(() => ({
14
+ valueType: 'time',
15
+ validator: validateTimeRange,
16
+ internal_valueManager: rangeValueManager,
17
+ internal_fieldValueManager: getRangeFieldValueManager({
18
+ dateSeparator
19
+ }),
20
+ internal_enableAccessibleFieldDOMStructure: enableAccessibleFieldDOMStructure,
21
+ internal_applyDefaultsToFieldInternalProps: ({
22
+ internalProps,
23
+ utils
24
+ }) => _extends({}, internalProps, getTimeFieldInternalPropsDefaults({
25
+ utils,
26
+ internalProps
27
+ }))
28
+ }), [enableAccessibleFieldDOMStructure, dateSeparator]);
29
+ }
package/models/range.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  import { PickerValidDate } from '@mui/x-date-pickers/models';
2
2
  export type DateRange<TDate extends PickerValidDate> = [TDate | null, TDate | null];
3
- export type NonEmptyDateRange = [PickerValidDate, PickerValidDate];
@@ -1 +1 @@
1
- export { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalaliV3';
1
+ export { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalaliV2';
@@ -1 +1 @@
1
- export { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
1
+ export { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV2';
@@ -27,6 +27,7 @@ import { useDragRange } from "./useDragRange.js";
27
27
  import { useRangePosition } from "../internals/hooks/useRangePosition.js";
28
28
  import { DAY_RANGE_SIZE, DAY_MARGIN } from "../internals/constants/dimensions.js";
29
29
  import { PickersRangeCalendarHeader } from "../PickersRangeCalendarHeader/index.js";
30
+ import { useNullablePickerRangePositionContext } from "../internals/hooks/useNullablePickerRangePositionContext.js";
30
31
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
31
32
  const releaseInfo = getReleaseInfo();
32
33
  const DateRangeCalendarRoot = styled('div', {
@@ -135,8 +136,8 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
135
136
  reduceAnimations,
136
137
  onMonthChange,
137
138
  rangePosition: rangePositionProp,
138
- defaultRangePosition: inDefaultRangePosition,
139
- onRangePositionChange: inOnRangePositionChange,
139
+ defaultRangePosition: defaultRangePositionProp,
140
+ onRangePositionChange: onRangePositionChangeProp,
140
141
  calendars,
141
142
  currentMonthCalendarPosition = 1,
142
143
  slots,
@@ -161,6 +162,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
161
162
  onViewChange
162
163
  } = props,
163
164
  other = _objectWithoutPropertiesLoose(props, _excluded);
165
+ const rangePositionContext = useNullablePickerRangePositionContext();
164
166
  const {
165
167
  value,
166
168
  handleValueChange,
@@ -192,9 +194,9 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
192
194
  rangePosition,
193
195
  onRangePositionChange
194
196
  } = useRangePosition({
195
- rangePosition: rangePositionProp,
196
- defaultRangePosition: inDefaultRangePosition,
197
- onRangePositionChange: inOnRangePositionChange
197
+ rangePosition: rangePositionProp ?? rangePositionContext?.rangePosition,
198
+ defaultRangePosition: defaultRangePositionProp,
199
+ onRangePositionChange: onRangePositionChangeProp ?? rangePositionContext?.onRangePositionChange
198
200
  });
199
201
  const handleDatePositionChange = useEventCallback(position => {
200
202
  if (rangePosition !== position) {
@@ -228,7 +230,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
228
230
 
229
231
  // Range going for the start of the start day to the end of the end day.
230
232
  // This makes sure that `isWithinRange` works with any time in the start and end day.
231
- const valueDayRange = React.useMemo(() => [value[0] == null || !utils.isValid(value[0]) ? value[0] : utils.startOfDay(value[0]), value[1] == null || !utils.isValid(value[1]) ? value[1] : utils.endOfDay(value[1])], [value, utils]);
233
+ const valueDayRange = React.useMemo(() => [!utils.isValid(value[0]) ? value[0] : utils.startOfDay(value[0]), !utils.isValid(value[1]) ? value[1] : utils.endOfDay(value[1])], [value, utils]);
232
234
  const _useDragRange = useDragRange({
233
235
  disableDragEditing: shouldDisableDragEditing,
234
236
  onDrop: handleDrop,
@@ -316,7 +318,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
316
318
  const prevValue = React.useRef(null);
317
319
  React.useEffect(() => {
318
320
  const date = rangePosition === 'start' ? value[0] : value[1];
319
- if (!date || !utils.isValid(date)) {
321
+ if (!utils.isValid(date)) {
320
322
  return;
321
323
  }
322
324
  const prevDate = rangePosition === 'start' ? prevValue.current?.[0] : prevValue.current?.[1];
@@ -63,7 +63,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
63
63
  calendars: PropTypes.oneOf([1, 2, 3]),
64
64
  className: PropTypes.string,
65
65
  /**
66
- * If `true`, the popover or modal will close after submitting the full date.
66
+ * If `true`, the Picker will close after submitting the full date.
67
67
  * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
68
68
  */
69
69
  closeOnSelect: PropTypes.bool,
@@ -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 = ["value", "rangePosition", "onRangePositionChange", "toolbarFormat", "className", "classes"];
5
+ const _excluded = ["toolbarFormat", "className", "classes"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
@@ -10,8 +10,9 @@ import Typography from '@mui/material/Typography';
10
10
  import { styled, useThemeProps } from '@mui/material/styles';
11
11
  import composeClasses from '@mui/utils/composeClasses';
12
12
  import { PickersToolbar, PickersToolbarButton, useUtils, useToolbarOwnerState } from '@mui/x-date-pickers/internals';
13
- import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
13
+ import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hooks';
14
14
  import { getDateRangePickerToolbarUtilityClass } from "./dateRangePickerToolbarClasses.js";
15
+ import { usePickerRangePositionContext } from "../hooks/index.js";
15
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
17
  const useUtilityClasses = classes => {
17
18
  const slots = {
@@ -49,38 +50,48 @@ const DateRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateRangeP
49
50
  name: 'MuiDateRangePickerToolbar'
50
51
  });
51
52
  const {
52
- value: [start, end],
53
- rangePosition,
54
- onRangePositionChange,
55
- toolbarFormat,
53
+ toolbarFormat: toolbarFormatProp,
56
54
  className,
57
55
  classes: classesProp
58
56
  } = props,
59
57
  other = _objectWithoutPropertiesLoose(props, _excluded);
58
+ const {
59
+ value
60
+ } = usePickerContext();
60
61
  const translations = usePickerTranslations();
61
62
  const ownerState = useToolbarOwnerState();
63
+ const {
64
+ rangePosition,
65
+ onRangePositionChange
66
+ } = usePickerRangePositionContext();
62
67
  const classes = useUtilityClasses(classesProp);
63
- const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) : translations.start;
64
- const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) : translations.end;
68
+
69
+ // This can't be a default value when spreading because it breaks the API generation.
70
+ const toolbarFormat = toolbarFormatProp ?? utils.formats.shortDate;
71
+ const formatDate = (date, fallback) => {
72
+ if (!utils.isValid(date)) {
73
+ return fallback;
74
+ }
75
+ return utils.formatByString(date, toolbarFormat);
76
+ };
65
77
  return /*#__PURE__*/_jsx(DateRangePickerToolbarRoot, _extends({}, other, {
66
78
  toolbarTitle: translations.dateRangePickerToolbarTitle,
67
- isLandscape: false,
68
79
  className: clsx(classes.root, className),
69
80
  ownerState: ownerState,
70
81
  ref: ref,
71
82
  children: /*#__PURE__*/_jsxs(DateRangePickerToolbarContainer, {
72
83
  className: classes.container,
73
84
  children: [/*#__PURE__*/_jsx(PickersToolbarButton, {
74
- variant: start !== null ? 'h5' : 'h6',
75
- value: startDateValue,
85
+ variant: value[0] == null ? 'h6' : 'h5',
86
+ value: formatDate(value[0], translations.start),
76
87
  selected: rangePosition === 'start',
77
88
  onClick: () => onRangePositionChange('start')
78
89
  }), /*#__PURE__*/_jsxs(Typography, {
79
90
  variant: "h5",
80
91
  children: ["\xA0", '–', "\xA0"]
81
92
  }), /*#__PURE__*/_jsx(PickersToolbarButton, {
82
- variant: end !== null ? 'h5' : 'h6',
83
- value: endDateValue,
93
+ variant: value[1] == null ? 'h6' : 'h5',
94
+ value: formatDate(value[1], translations.end),
84
95
  selected: rangePosition === 'end',
85
96
  onClick: () => onRangePositionChange('end')
86
97
  })]
@@ -102,8 +113,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
102
113
  * @default `true` for Desktop, `false` for Mobile.
103
114
  */
104
115
  hidden: PropTypes.bool,
105
- onRangePositionChange: PropTypes.func.isRequired,
106
- rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
107
116
  /**
108
117
  * The system prop that allows defining system overrides as well as additional CSS styles.
109
118
  */
@@ -117,7 +126,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
117
126
  * Toolbar value placeholder—it is displayed when the value is empty.
118
127
  * @default "––"
119
128
  */
120
- toolbarPlaceholder: PropTypes.node,
121
- value: PropTypes.arrayOf(PropTypes.object).isRequired
129
+ toolbarPlaceholder: PropTypes.node
122
130
  } : void 0;
123
131
  export { DateRangePickerToolbar };
@@ -68,8 +68,8 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
68
68
  calendars: PropTypes.oneOf([1, 2, 3]),
69
69
  className: PropTypes.string,
70
70
  /**
71
- * If `true`, the popover or modal will close after submitting the full date.
72
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
71
+ * If `true`, the Picker will close after submitting the full date.
72
+ * @default false
73
73
  */
74
74
  closeOnSelect: PropTypes.bool,
75
75
  /**
@@ -12,6 +12,7 @@ import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hoo
12
12
  import IconButton from '@mui/material/IconButton';
13
13
  import Button from '@mui/material/Button';
14
14
  import { getDateTimeRangePickerTabsUtilityClass } from "./dateTimeRangePickerTabsClasses.js";
15
+ import { usePickerRangePositionContext } from "../hooks/index.js";
15
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
17
  const viewToTab = (view, rangePosition) => {
17
18
  if (isDatePickerView(view)) {
@@ -71,8 +72,6 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
71
72
  dateIcon = /*#__PURE__*/_jsx(DateRangeIcon, {}),
72
73
  timeIcon = /*#__PURE__*/_jsx(TimeIcon, {}),
73
74
  hidden = typeof window === 'undefined' || window.innerHeight < 667,
74
- rangePosition,
75
- onRangePositionChange,
76
75
  className,
77
76
  classes: classesProp,
78
77
  sx
@@ -83,9 +82,13 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
83
82
  } = usePickerPrivateContext();
84
83
  const {
85
84
  view,
86
- onViewChange
85
+ setView
87
86
  } = usePickerContext();
88
87
  const classes = useUtilityClasses(classesProp);
88
+ const {
89
+ rangePosition,
90
+ onRangePositionChange
91
+ } = usePickerRangePositionContext();
89
92
  const value = React.useMemo(() => view == null ? null : viewToTab(view, rangePosition), [view, rangePosition]);
90
93
  const isPreviousHidden = value === 'start-date';
91
94
  const isNextHidden = value === 'end-time';
@@ -112,12 +115,12 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
112
115
  });
113
116
  const changeToPreviousTab = useEventCallback(() => {
114
117
  const previousTab = value == null ? tabOptions[0] : tabOptions[tabOptions.indexOf(value) - 1];
115
- onViewChange(tabToView(previousTab));
118
+ setView(tabToView(previousTab));
116
119
  handleRangePositionChange(previousTab);
117
120
  });
118
121
  const changeToNextTab = useEventCallback(() => {
119
122
  const nextTab = value == null ? tabOptions[0] : tabOptions[tabOptions.indexOf(value) + 1];
120
- onViewChange(tabToView(nextTab));
123
+ setView(tabToView(nextTab));
121
124
  handleRangePositionChange(nextTab);
122
125
  });
123
126
  if (hidden) {
@@ -177,8 +180,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerTabs.propTypes = {
177
180
  * @default `window.innerHeight < 667` for `DesktopDateTimeRangePicker` and `MobileDateTimeRangePicker`
178
181
  */
179
182
  hidden: PropTypes.bool,
180
- onRangePositionChange: PropTypes.func.isRequired,
181
- rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
182
183
  /**
183
184
  * The system prop that allows defining system overrides as well as additional CSS styles.
184
185
  */
@@ -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,