@mui/x-date-pickers-pro 6.0.0-alpha.12 → 6.0.0-alpha.13

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/CHANGELOG.md +132 -0
  2. package/DateRangeCalendar/DateRangeCalendar.js +7 -1
  3. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +37 -37
  4. package/DateRangePicker/DateRangePicker.js +0 -5
  5. package/DateRangePicker/DateRangePickerView.d.ts +3 -3
  6. package/DateRangePicker/DateRangePickerView.js +6 -3
  7. package/DateRangePicker/DateRangePickerViewMobile.js +1 -1
  8. package/DateRangePickerDay/DateRangePickerDay.js +72 -1
  9. package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +5 -0
  10. package/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -5
  11. package/DesktopNextDateRangePicker/DesktopNextDateRangePicker.js +22 -8
  12. package/MobileDateRangePicker/MobileDateRangePicker.d.ts +5 -0
  13. package/MobileDateRangePicker/MobileDateRangePicker.js +0 -5
  14. package/MobileNextDateRangePicker/MobileNextDateRangePicker.js +22 -8
  15. package/MultiInputDateRangeField/MultiInputDateRangeField.js +46 -13
  16. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +2 -2
  17. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +45 -10
  18. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +3 -3
  19. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +45 -10
  20. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +2 -2
  21. package/NextDateRangePicker/NextDateRangePicker.js +16 -2
  22. package/NextDateRangePicker/shared.d.ts +9 -2
  23. package/SingleInputDateRangeField/SingleInputDateRangeField.js +110 -5
  24. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +3 -2
  25. package/StaticDateRangePicker/StaticDateRangePicker.js +0 -5
  26. package/StaticNextDateRangePicker/StaticNextDateRangePicker.js +20 -6
  27. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +13 -0
  28. package/{internal/utils/viewRenderers.js → dateRangeViewRenderers/dateRangeViewRenderers.js} +3 -4
  29. package/dateRangeViewRenderers/index.d.ts +2 -0
  30. package/dateRangeViewRenderers/index.js +1 -0
  31. package/dateRangeViewRenderers/package.json +6 -0
  32. package/index.d.ts +1 -0
  33. package/index.js +5 -2
  34. package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -1
  35. package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +2 -4
  36. package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +4 -5
  37. package/internal/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -1
  38. package/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +2 -4
  39. package/internal/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +4 -5
  40. package/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +7 -1
  41. package/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +7 -1
  42. package/internal/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +2 -0
  43. package/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +7 -1
  44. package/internal/hooks/useRangePickerInputProps.d.ts +4 -6
  45. package/internal/hooks/useRangePickerInputProps.js +5 -6
  46. package/internal/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -1
  47. package/internal/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -2
  48. package/internal/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +2 -2
  49. package/internal/models/dateRange.d.ts +11 -1
  50. package/internal/models/dateTimeRange.d.ts +2 -2
  51. package/internal/models/timeRange.d.ts +2 -1
  52. package/internal/utils/date-fields-utils.d.ts +17 -1
  53. package/internal/utils/releaseInfo.js +1 -1
  54. package/internal/utils/valueManagers.js +15 -21
  55. package/legacy/DateRangeCalendar/DateRangeCalendar.js +7 -1
  56. package/legacy/DateRangePicker/DateRangePicker.js +0 -5
  57. package/legacy/DateRangePicker/DateRangePickerView.js +7 -2
  58. package/legacy/DateRangePicker/DateRangePickerViewMobile.js +1 -1
  59. package/legacy/DateRangePickerDay/DateRangePickerDay.js +72 -1
  60. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -5
  61. package/legacy/DesktopNextDateRangePicker/DesktopNextDateRangePicker.js +22 -8
  62. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +0 -5
  63. package/legacy/MobileNextDateRangePicker/MobileNextDateRangePicker.js +22 -8
  64. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +44 -11
  65. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +43 -8
  66. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +43 -8
  67. package/legacy/NextDateRangePicker/NextDateRangePicker.js +16 -2
  68. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +109 -4
  69. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +0 -5
  70. package/legacy/StaticNextDateRangePicker/StaticNextDateRangePicker.js +20 -6
  71. package/legacy/{internal/utils/viewRenderers.js → dateRangeViewRenderers/dateRangeViewRenderers.js} +3 -4
  72. package/legacy/dateRangeViewRenderers/index.js +1 -0
  73. package/legacy/index.js +5 -2
  74. package/legacy/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +2 -4
  75. package/legacy/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +2 -4
  76. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +7 -1
  77. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +7 -1
  78. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +7 -1
  79. package/legacy/internal/hooks/useRangePickerInputProps.js +5 -6
  80. package/legacy/internal/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -2
  81. package/legacy/internal/utils/releaseInfo.js +1 -1
  82. package/legacy/internal/utils/valueManagers.js +15 -23
  83. package/legacy/tests/describeRangeValidation/testTextFieldRangeValidation.js +1 -1
  84. package/modern/DateRangeCalendar/DateRangeCalendar.js +7 -1
  85. package/modern/DateRangePicker/DateRangePicker.js +0 -5
  86. package/modern/DateRangePicker/DateRangePickerView.js +6 -3
  87. package/modern/DateRangePicker/DateRangePickerViewMobile.js +1 -1
  88. package/modern/DateRangePickerDay/DateRangePickerDay.js +72 -1
  89. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -5
  90. package/modern/DesktopNextDateRangePicker/DesktopNextDateRangePicker.js +22 -8
  91. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +0 -5
  92. package/modern/MobileNextDateRangePicker/MobileNextDateRangePicker.js +22 -8
  93. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +46 -13
  94. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +45 -10
  95. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +45 -10
  96. package/modern/NextDateRangePicker/NextDateRangePicker.js +16 -2
  97. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +110 -5
  98. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +0 -5
  99. package/modern/StaticNextDateRangePicker/StaticNextDateRangePicker.js +20 -6
  100. package/modern/{internal/utils/viewRenderers.js → dateRangeViewRenderers/dateRangeViewRenderers.js} +3 -4
  101. package/modern/dateRangeViewRenderers/index.js +1 -0
  102. package/modern/index.js +5 -2
  103. package/modern/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +2 -4
  104. package/modern/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +2 -4
  105. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +7 -1
  106. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +7 -1
  107. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +7 -1
  108. package/modern/internal/hooks/useRangePickerInputProps.js +5 -6
  109. package/modern/internal/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -2
  110. package/modern/internal/utils/releaseInfo.js +1 -1
  111. package/modern/internal/utils/valueManagers.js +15 -21
  112. package/modern/tests/describeRangeValidation/testTextFieldRangeValidation.js +1 -1
  113. package/node/DateRangeCalendar/DateRangeCalendar.js +7 -1
  114. package/node/DateRangePicker/DateRangePicker.js +0 -5
  115. package/node/DateRangePicker/DateRangePickerView.js +6 -3
  116. package/node/DateRangePicker/DateRangePickerViewMobile.js +1 -1
  117. package/node/DateRangePickerDay/DateRangePickerDay.js +72 -1
  118. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -5
  119. package/node/DesktopNextDateRangePicker/DesktopNextDateRangePicker.js +22 -8
  120. package/node/MobileDateRangePicker/MobileDateRangePicker.js +0 -5
  121. package/node/MobileNextDateRangePicker/MobileNextDateRangePicker.js +22 -8
  122. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +46 -13
  123. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +45 -10
  124. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +45 -10
  125. package/node/NextDateRangePicker/NextDateRangePicker.js +16 -2
  126. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +110 -5
  127. package/node/StaticDateRangePicker/StaticDateRangePicker.js +0 -5
  128. package/node/StaticNextDateRangePicker/StaticNextDateRangePicker.js +20 -6
  129. package/node/{internal/utils/viewRenderers.js → dateRangeViewRenderers/dateRangeViewRenderers.js} +4 -4
  130. package/node/dateRangeViewRenderers/index.js +12 -0
  131. package/node/index.js +13 -1
  132. package/node/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +2 -4
  133. package/node/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +2 -4
  134. package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +7 -1
  135. package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +7 -1
  136. package/node/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +7 -1
  137. package/node/internal/hooks/useRangePickerInputProps.js +5 -6
  138. package/node/internal/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -2
  139. package/node/internal/utils/releaseInfo.js +1 -1
  140. package/node/internal/utils/valueManagers.js +14 -20
  141. package/node/tests/describeRangeValidation/testTextFieldRangeValidation.js +1 -1
  142. package/package.json +3 -3
  143. package/tests/describeRangeValidation/testTextFieldRangeValidation.js +1 -1
  144. package/internal/utils/viewRenderers.d.ts +0 -7
@@ -3,19 +3,20 @@ import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { useStaticRangePicker } from '../internal/hooks/useStaticRangePicker';
5
5
  import { useNextDateRangePickerDefaultizedProps } from '../NextDateRangePicker/shared';
6
+ import { renderDateRangeViewCalendar } from '../dateRangeViewRenderers';
6
7
  import { rangeValueManager } from '../internal/utils/valueManagers';
7
- import { renderDateRangeView } from '../internal/utils/viewRenderers';
8
8
  import { validateDateRange } from '../internal/hooks/validation/useDateRangeValidation';
9
- var VIEW_LOOKUP = {
10
- day: renderDateRangeView
11
- };
12
9
  var StaticNextDateRangePicker = /*#__PURE__*/React.forwardRef(function StaticNextDateRangePicker(inProps, ref) {
13
10
  var _defaultizedProps$dis, _defaultizedProps$cal, _defaultizedProps$sho;
14
11
  var defaultizedProps = useNextDateRangePickerDefaultizedProps(inProps, 'MuiStaticNextDateRangePicker');
15
12
  var displayStaticWrapperAs = (_defaultizedProps$dis = defaultizedProps.displayStaticWrapperAs) != null ? _defaultizedProps$dis : 'mobile';
13
+ var viewRenderers = _extends({
14
+ day: renderDateRangeViewCalendar
15
+ }, defaultizedProps.viewRenderers);
16
16
 
17
17
  // Props with the default values specific to the static variant
18
18
  var props = _extends({}, defaultizedProps, {
19
+ viewRenderers: viewRenderers,
19
20
  displayStaticWrapperAs: displayStaticWrapperAs,
20
21
  views: ['day'],
21
22
  openTo: 'day',
@@ -25,7 +26,6 @@ var StaticNextDateRangePicker = /*#__PURE__*/React.forwardRef(function StaticNex
25
26
  var _useStaticRangePicker = useStaticRangePicker({
26
27
  props: props,
27
28
  valueManager: rangeValueManager,
28
- viewLookup: VIEW_LOOKUP,
29
29
  validator: validateDateRange,
30
30
  ref: ref
31
31
  }),
@@ -37,6 +37,12 @@ StaticNextDateRangePicker.propTypes = {
37
37
  // | These PropTypes are generated from the TypeScript type definitions |
38
38
  // | To update them edit the TypeScript types and run "yarn proptypes" |
39
39
  // ----------------------------------------------------------------------
40
+ /**
41
+ * If `true`, the main element is focused during the first mount.
42
+ * This main element is:
43
+ * - the element chosen by the visible view if any (i.e: the selected day on the `day` view).
44
+ * - the `input` element if there is a field rendered.
45
+ */
40
46
  autoFocus: PropTypes.bool,
41
47
  /**
42
48
  * The number of calendars to render.
@@ -204,6 +210,14 @@ StaticNextDateRangePicker.propTypes = {
204
210
  * The selected value.
205
211
  * Used when the component is controlled.
206
212
  */
207
- value: PropTypes.arrayOf(PropTypes.any)
213
+ value: PropTypes.arrayOf(PropTypes.any),
214
+ /**
215
+ * Define custom view renderers for each section.
216
+ * If `null`, the section will only have field editing.
217
+ * If `undefined`, internally defined view will be the used.
218
+ */
219
+ viewRenderers: PropTypes.shape({
220
+ day: PropTypes.func
221
+ })
208
222
  };
209
223
  export { StaticNextDateRangePicker };
@@ -1,12 +1,11 @@
1
1
  import * as React from 'react';
2
- import { DateRangeCalendar } from '../../DateRangeCalendar';
3
-
2
+ import { DateRangeCalendar } from '../DateRangeCalendar';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  /**
5
5
  * We don't pass all the props down to `DateRangeCalendar`,
6
6
  * because otherwise some unwanted props would be passed to the HTML element.
7
7
  */
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- export var renderDateRangeView = function renderDateRangeView(_ref) {
8
+ export var renderDateRangeViewCalendar = function renderDateRangeViewCalendar(_ref) {
10
9
  var value = _ref.value,
11
10
  defaultValue = _ref.defaultValue,
12
11
  onChange = _ref.onChange,
@@ -0,0 +1 @@
1
+ export { renderDateRangeViewCalendar } from './dateRangeViewRenderers';
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v6.0.0-alpha.12
1
+ /** @license MUI v6.0.0-alpha.13
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -23,4 +23,7 @@ export * from './DateRangeCalendar';
23
23
  export * from './NextDateRangePicker';
24
24
  export * from './DesktopNextDateRangePicker';
25
25
  export * from './MobileNextDateRangePicker';
26
- export * from './StaticNextDateRangePicker';
26
+ export * from './StaticNextDateRangePicker';
27
+
28
+ // View renderers
29
+ export * from './dateRangeViewRenderers';
@@ -13,7 +13,6 @@ var releaseInfo = getReleaseInfo();
13
13
  export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
14
14
  var props = _ref.props,
15
15
  valueManager = _ref.valueManager,
16
- viewLookup = _ref.viewLookup,
17
16
  validator = _ref.validator;
18
17
  useLicenseVerifier('x-date-pickers-pro', releaseInfo);
19
18
  var components = props.components,
@@ -36,7 +35,6 @@ export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
36
35
  props: props,
37
36
  valueManager: valueManager,
38
37
  wrapperVariant: 'desktop',
39
- viewLookup: viewLookup,
40
38
  validator: validator,
41
39
  autoFocusView: true,
42
40
  additionalViewProps: {
@@ -60,7 +58,7 @@ export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
60
58
  });
61
59
  };
62
60
  var fieldSlotsProps = useRangePickerInputProps({
63
- wrapperVariant: 'mobile',
61
+ wrapperVariant: 'desktop',
64
62
  open: open,
65
63
  actions: actions,
66
64
  readOnly: readOnly,
@@ -97,7 +95,7 @@ export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
97
95
  var inputPropsPassedByField = resolveComponentProps((_fieldProps$component = fieldProps.componentsProps) == null ? void 0 : _fieldProps$component.input, ownerState);
98
96
  var inputPropsPassedByPicker = ownerState.position === 'start' ? fieldSlotsProps.startInput : fieldSlotsProps.endInput;
99
97
  return _extends({}, externalInputProps, inputPropsPassedByField, inputPropsPassedByPicker, {
100
- inputProps: _extends({}, externalInputProps == null ? void 0 : externalInputProps.inputProps, inputPropsPassedByField == null ? void 0 : inputPropsPassedByField.inputProps, inputPropsPassedByPicker == null ? void 0 : inputPropsPassedByPicker.inputProps)
98
+ inputProps: _extends({}, externalInputProps == null ? void 0 : externalInputProps.inputProps, inputPropsPassedByField == null ? void 0 : inputPropsPassedByField.inputProps)
101
99
  });
102
100
  },
103
101
  root: function root(ownerState) {
@@ -13,7 +13,6 @@ var releaseInfo = getReleaseInfo();
13
13
  export var useMobileRangePicker = function useMobileRangePicker(_ref) {
14
14
  var props = _ref.props,
15
15
  valueManager = _ref.valueManager,
16
- viewLookup = _ref.viewLookup,
17
16
  validator = _ref.validator;
18
17
  useLicenseVerifier('x-date-pickers-pro', releaseInfo);
19
18
  var components = props.components,
@@ -34,7 +33,6 @@ export var useMobileRangePicker = function useMobileRangePicker(_ref) {
34
33
  props: props,
35
34
  valueManager: valueManager,
36
35
  wrapperVariant: 'mobile',
37
- viewLookup: viewLookup,
38
36
  validator: validator,
39
37
  autoFocusView: true,
40
38
  additionalViewProps: {
@@ -63,7 +61,7 @@ export var useMobileRangePicker = function useMobileRangePicker(_ref) {
63
61
  elementType: Field,
64
62
  externalSlotProps: componentsProps.field,
65
63
  additionalProps: _extends({}, pickerFieldProps, {
66
- readOnly: readOnly,
64
+ readOnly: readOnly != null ? readOnly : true,
67
65
  disabled: disabled,
68
66
  className: className,
69
67
  format: format,
@@ -81,7 +79,7 @@ export var useMobileRangePicker = function useMobileRangePicker(_ref) {
81
79
  var inputPropsPassedByField = resolveComponentProps((_fieldProps$component = fieldProps.componentsProps) == null ? void 0 : _fieldProps$component.input, ownerState);
82
80
  var inputPropsPassedByPicker = ownerState.position === 'start' ? fieldSlotsProps.startInput : fieldSlotsProps.endInput;
83
81
  return _extends({}, externalInputProps, inputPropsPassedByField, inputPropsPassedByPicker, {
84
- inputProps: _extends({}, externalInputProps == null ? void 0 : externalInputProps.inputProps, inputPropsPassedByField == null ? void 0 : inputPropsPassedByField.inputProps, inputPropsPassedByPicker == null ? void 0 : inputPropsPassedByPicker.inputProps)
82
+ inputProps: _extends({}, externalInputProps == null ? void 0 : externalInputProps.inputProps, inputPropsPassedByField == null ? void 0 : inputPropsPassedByField.inputProps)
85
83
  });
86
84
  },
87
85
  root: function root(ownerState) {
@@ -18,7 +18,9 @@ export var useMultiInputDateRangeField = function useMultiInputDateRangeField(_r
18
18
  var valueProp = sharedProps.value,
19
19
  defaultValue = sharedProps.defaultValue,
20
20
  format = sharedProps.format,
21
- onChange = sharedProps.onChange;
21
+ onChange = sharedProps.onChange,
22
+ disabled = sharedProps.disabled,
23
+ readOnly = sharedProps.readOnly;
22
24
  var firstDefaultValue = React.useRef(defaultValue);
23
25
 
24
26
  // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
@@ -45,6 +47,8 @@ export var useMultiInputDateRangeField = function useMultiInputDateRangeField(_r
45
47
  var handleStartDateChange = useEventCallback(buildChangeHandler(0));
46
48
  var handleEndDateChange = useEventCallback(buildChangeHandler(1));
47
49
  var startInputProps = _extends({}, inStartInputProps, {
50
+ disabled: disabled,
51
+ readOnly: readOnly,
48
52
  format: format,
49
53
  value: valueProp === undefined ? undefined : valueProp[0],
50
54
  defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
@@ -52,6 +56,8 @@ export var useMultiInputDateRangeField = function useMultiInputDateRangeField(_r
52
56
  });
53
57
  var endInputProps = _extends({}, inEndInputProps, {
54
58
  format: format,
59
+ disabled: disabled,
60
+ readOnly: readOnly,
55
61
  value: valueProp === undefined ? undefined : valueProp[1],
56
62
  defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
57
63
  onChange: handleEndDateChange
@@ -34,7 +34,9 @@ export var useMultiInputDateTimeRangeField = function useMultiInputDateTimeRange
34
34
  var valueProp = sharedProps.value,
35
35
  defaultValue = sharedProps.defaultValue,
36
36
  format = sharedProps.format,
37
- onChange = sharedProps.onChange;
37
+ onChange = sharedProps.onChange,
38
+ disabled = sharedProps.disabled,
39
+ readOnly = sharedProps.readOnly;
38
40
  var firstDefaultValue = React.useRef(defaultValue);
39
41
 
40
42
  // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
@@ -62,12 +64,16 @@ export var useMultiInputDateTimeRangeField = function useMultiInputDateTimeRange
62
64
  var handleEndDateChange = useEventCallback(buildChangeHandler(1));
63
65
  var startInputProps = _extends({}, inStartInputProps, {
64
66
  format: format,
67
+ disabled: disabled,
68
+ readOnly: readOnly,
65
69
  value: valueProp === undefined ? undefined : valueProp[0],
66
70
  defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
67
71
  onChange: handleStartDateChange
68
72
  });
69
73
  var endInputProps = _extends({}, inEndInputProps, {
70
74
  format: format,
75
+ disabled: disabled,
76
+ readOnly: readOnly,
71
77
  value: valueProp === undefined ? undefined : valueProp[1],
72
78
  defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
73
79
  onChange: handleEndDateChange
@@ -30,7 +30,9 @@ export var useMultiInputTimeRangeField = function useMultiInputTimeRangeField(_r
30
30
  var valueProp = sharedProps.value,
31
31
  defaultValue = sharedProps.defaultValue,
32
32
  format = sharedProps.format,
33
- onChange = sharedProps.onChange;
33
+ onChange = sharedProps.onChange,
34
+ disabled = sharedProps.disabled,
35
+ readOnly = sharedProps.readOnly;
34
36
  var firstDefaultValue = React.useRef(defaultValue);
35
37
 
36
38
  // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
@@ -58,12 +60,16 @@ export var useMultiInputTimeRangeField = function useMultiInputTimeRangeField(_r
58
60
  var handleEndDateChange = useEventCallback(buildChangeHandler(1));
59
61
  var startInputProps = _extends({}, inStartInputProps, {
60
62
  format: format,
63
+ disabled: disabled,
64
+ readOnly: readOnly,
61
65
  value: valueProp === undefined ? undefined : valueProp[0],
62
66
  defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
63
67
  onChange: handleStartDateChange
64
68
  });
65
69
  var endInputProps = _extends({}, inEndInputProps, {
66
70
  format: format,
71
+ disabled: disabled,
72
+ readOnly: readOnly,
67
73
  value: valueProp === undefined ? undefined : valueProp[1],
68
74
  defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
69
75
  onChange: handleEndDateChange
@@ -52,6 +52,7 @@ export var useRangePickerInputProps = function useRangePickerInputProps(_ref) {
52
52
  onRangePositionChange('end');
53
53
  }
54
54
  };
55
+ var readOnlyInput = readOnly != null ? readOnly : wrapperVariant === 'mobile';
55
56
  var startInputProps = _extends({
56
57
  inputRef: startRef,
57
58
  label: (_inLocaleText$start = inLocaleText == null ? void 0 : inLocaleText.start) != null ? _inLocaleText$start : localeText.start,
@@ -61,9 +62,8 @@ export var useRangePickerInputProps = function useRangePickerInputProps(_ref) {
61
62
  }, !readOnly && !disabled && {
62
63
  onClick: openRangeStartSelection
63
64
  }, {
64
- inputProps: {
65
- readOnly: wrapperVariant === 'mobile'
66
- }
65
+ readOnly: readOnlyInput,
66
+ disabled: disabled
67
67
  });
68
68
  var endInputProps = _extends({
69
69
  inputRef: endRef,
@@ -74,9 +74,8 @@ export var useRangePickerInputProps = function useRangePickerInputProps(_ref) {
74
74
  }, !readOnly && !disabled && {
75
75
  onClick: openRangeEndSelection
76
76
  }, {
77
- inputProps: {
78
- readOnly: wrapperVariant === 'mobile'
79
- }
77
+ readOnly: readOnlyInput,
78
+ disabled: disabled
80
79
  });
81
80
  var rootProps = {
82
81
  onBlur: onBlur
@@ -21,7 +21,6 @@ var PickerStaticViewLayout = styled(PickersViewLayout)(function (_ref) {
21
21
  export var useStaticRangePicker = function useStaticRangePicker(_ref2) {
22
22
  var props = _ref2.props,
23
23
  valueManager = _ref2.valueManager,
24
- viewLookup = _ref2.viewLookup,
25
24
  validator = _ref2.validator,
26
25
  ref = _ref2.ref;
27
26
  var localeText = props.localeText,
@@ -35,7 +34,6 @@ export var useStaticRangePicker = function useStaticRangePicker(_ref2) {
35
34
  setRangePosition = _React$useState2[1];
36
35
  var _usePicker = usePicker({
37
36
  props: props,
38
- viewLookup: viewLookup,
39
37
  valueManager: valueManager,
40
38
  validator: validator,
41
39
  autoFocusView: autoFocus != null ? autoFocus : false,
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export var getReleaseInfo = function getReleaseInfo() {
3
- var releaseInfo = "MTY3MTE0NTIwMDAwMA==";
3
+ var releaseInfo = "MTY3MTgzMjgwMDAwMA==";
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
@@ -1,7 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
- import { replaceInvalidDateByNull, splitFormatIntoSections, addPositionPropertiesToSections, createDateStrFromSections, getSectionOrder as _getSectionOrder } from '@mui/x-date-pickers/internals';
4
+ import { replaceInvalidDateByNull, splitFormatIntoSections, addPositionPropertiesToSections, createDateStrForInputFromSections, getSectionOrder as _getSectionOrder } from '@mui/x-date-pickers/internals';
5
5
  import { splitDateRangeSections, removeLastSeparator } from './date-fields-utils';
6
6
  export var rangeValueManager = {
7
7
  emptyValue: [null, null],
@@ -44,37 +44,29 @@ export var rangeFieldValueManager = {
44
44
  startDate: null,
45
45
  endDate: null
46
46
  } : splitDateRangeSections(prevSections);
47
- var getSections = function getSections(newDate, prevDateSections) {
47
+ var getSections = function getSections(newDate, prevDateSections, position) {
48
48
  var shouldReUsePrevDateSections = !utils.isValid(newDate) && !!prevDateSections;
49
49
  if (shouldReUsePrevDateSections) {
50
50
  return prevDateSections;
51
51
  }
52
- return splitFormatIntoSections(utils, localeText, format, newDate);
53
- };
54
- var rawSectionsOfStartDate = getSections(start, prevDateRangeSections.startDate);
55
- var rawSectionsOfEndDate = getSections(end, prevDateRangeSections.endDate);
56
- var sectionsOfStartDate = rawSectionsOfStartDate.map(function (section, sectionIndex) {
57
- if (sectionIndex === rawSectionsOfStartDate.length - 1) {
52
+ var sections = splitFormatIntoSections(utils, localeText, format, newDate);
53
+ return sections.map(function (section, sectionIndex) {
54
+ if (sectionIndex === sections.length - 1 && position === 'start') {
55
+ return _extends({}, section, {
56
+ dateName: position,
57
+ endSeparator: "".concat(section.endSeparator, "\u2069 \u2013 \u2066")
58
+ });
59
+ }
58
60
  return _extends({}, section, {
59
- dateName: 'start',
60
- separator: "\u2069 \u2013 \u2066",
61
- parsingSeparator: ' – '
61
+ dateName: position
62
62
  });
63
- }
64
- return _extends({}, section, {
65
- dateName: 'start'
66
- });
67
- });
68
- var sectionsOfEndDate = rawSectionsOfEndDate.map(function (section) {
69
- return _extends({}, section, {
70
- dateName: 'end'
71
63
  });
72
- });
73
- return addPositionPropertiesToSections([].concat(_toConsumableArray(sectionsOfStartDate), _toConsumableArray(sectionsOfEndDate)));
64
+ };
65
+ return addPositionPropertiesToSections([].concat(_toConsumableArray(getSections(start, prevDateRangeSections.startDate, 'start')), _toConsumableArray(getSections(end, prevDateRangeSections.endDate, 'end'))));
74
66
  },
75
67
  getValueStrFromSections: function getValueStrFromSections(sections) {
76
68
  var dateRangeSections = splitDateRangeSections(sections);
77
- return createDateStrFromSections([].concat(_toConsumableArray(dateRangeSections.startDate), _toConsumableArray(dateRangeSections.endDate)), true);
69
+ return createDateStrForInputFromSections([].concat(_toConsumableArray(dateRangeSections.startDate), _toConsumableArray(dateRangeSections.endDate)));
78
70
  },
79
71
  getActiveDateSections: function getActiveDateSections(sections, activeSection) {
80
72
  var index = activeSection.dateName === 'start' ? 0 : 1;
@@ -116,7 +108,7 @@ export var rangeFieldValueManager = {
116
108
  getSectionOrder: function getSectionOrder(utils, localeText, format, isRTL) {
117
109
  var splitedFormat = splitFormatIntoSections(utils, localeText, format, null);
118
110
  return _getSectionOrder([].concat(_toConsumableArray(splitedFormat.slice(0, splitedFormat.length - 1)), [_extends({}, splitedFormat[splitedFormat.length - 1], {
119
- separator: ' – '
111
+ endSeparator: ' – '
120
112
  })], _toConsumableArray(splitedFormat)), isRTL);
121
113
  }
122
114
  };
@@ -29,7 +29,7 @@ export var testTextFieldRangeValidation = function testTextFieldRangeValidation(
29
29
  isSingleInput = _getOptions.isSingleInput,
30
30
  withDate = _getOptions.withDate,
31
31
  withTime = _getOptions.withTime;
32
- if (!['legacy-picker', 'picker'].includes(componentFamily)) {
32
+ if (!['legacy-picker', 'new-picker'].includes(componentFamily)) {
33
33
  return;
34
34
  }
35
35
  describe('text field:', function () {
@@ -379,7 +379,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
379
379
  className: classes.monthContainer,
380
380
  children: [calendars === 1 ? /*#__PURE__*/_jsx(PickersCalendarHeader, {
381
381
  views: ['day'],
382
- openView: 'day',
382
+ view: 'day',
383
383
  currentMonth: calendarState.currentMonth,
384
384
  onMonthChange: (newMonth, direction) => handleChangeMonth({
385
385
  newMonth,
@@ -434,6 +434,12 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
434
434
  // | These PropTypes are generated from the TypeScript type definitions |
435
435
  // | To update them edit the TypeScript types and run "yarn proptypes" |
436
436
  // ----------------------------------------------------------------------
437
+ /**
438
+ * If `true`, the main element is focused during the first mount.
439
+ * This main element is:
440
+ * - the element chosen by the visible view if any (i.e: the selected day on the `day` view).
441
+ * - the `input` element if there is a field rendered.
442
+ */
437
443
  autoFocus: PropTypes.bool,
438
444
  /**
439
445
  * The number of calendars to render.
@@ -234,11 +234,6 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
234
234
  * Use in controlled mode (see open).
235
235
  */
236
236
  onOpen: PropTypes.func,
237
- /**
238
- * Callback fired on view change.
239
- * @param {DateView} view The new view.
240
- */
241
- onViewChange: PropTypes.func,
242
237
  /**
243
238
  * Control the popup or dialog open state.
244
239
  */
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["calendars", "className", "value", "DateInputProps", "defaultCalendarMonth", "disableAutoMonthSwitching", "disableFuture", "disableHighlightToday", "disablePast", "isMobileKeyboardViewOpen", "maxDate", "minDate", "onDateChange", "onMonthChange", "open", "reduceAnimations", "rangePosition", "onRangePositionChange", "shouldDisableDate", "showToolbar", "toggleMobileKeyboardView", "components", "componentsProps"];
3
+ const _excluded = ["calendars", "className", "value", "DateInputProps", "defaultCalendarMonth", "disableAutoMonthSwitching", "disableFuture", "disableHighlightToday", "disablePast", "isMobileKeyboardViewOpen", "maxDate", "minDate", "onDateChange", "onMonthChange", "open", "reduceAnimations", "rangePosition", "onRangePositionChange", "shouldDisableDate", "showToolbar", "toggleMobileKeyboardView", "components", "componentsProps", "onFocusedViewChange"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { Watermark } from '@mui/x-license-pro';
@@ -40,7 +40,8 @@ function DateRangePickerViewRaw(props) {
40
40
  showToolbar,
41
41
  toggleMobileKeyboardView,
42
42
  components,
43
- componentsProps
43
+ componentsProps,
44
+ onFocusedViewChange
44
45
  } = props,
45
46
  other = _objectWithoutPropertiesLoose(props, _excluded);
46
47
  const utils = useUtils();
@@ -122,7 +123,9 @@ function DateRangePickerViewRaw(props) {
122
123
  components,
123
124
  componentsProps,
124
125
  shouldDisableDate: wrappedShouldDisableDate
125
- }, calendarState, other);
126
+ }, calendarState, {
127
+ onFocusedViewChange: onFocusedViewChange ? newHasFocus => onFocusedViewChange('day', newHasFocus) : undefined
128
+ }, other);
126
129
  switch (wrapperVariant) {
127
130
  case 'desktop':
128
131
  {
@@ -65,7 +65,7 @@ export function DateRangePickerViewMobile(props) {
65
65
  maxDate: maxDateWithDisabled,
66
66
  minDate: minDateWithDisabled,
67
67
  onMonthChange: changeMonth,
68
- openView: "day",
68
+ view: "day",
69
69
  views: onlyDayView,
70
70
  disabled: disabled
71
71
  }, other)), /*#__PURE__*/_jsx(DayCalendar, _extends({}, other, {
@@ -196,10 +196,26 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
196
196
  // | These PropTypes are generated from the TypeScript type definitions |
197
197
  // | To update them edit the TypeScript types and run "yarn proptypes" |
198
198
  // ----------------------------------------------------------------------
199
+ /**
200
+ * A ref for imperative actions.
201
+ * It currently only supports `focusVisible()` action.
202
+ */
203
+ action: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
204
+ current: PropTypes.shape({
205
+ focusVisible: PropTypes.func.isRequired
206
+ })
207
+ })]),
208
+ /**
209
+ * If `true`, the ripples are centered.
210
+ * They won't start at the cursor interaction position.
211
+ * @default false
212
+ */
213
+ centerRipple: PropTypes.bool,
199
214
  /**
200
215
  * Override or extend the styles applied to the component.
201
216
  */
202
217
  classes: PropTypes.object,
218
+ className: PropTypes.string,
203
219
  /**
204
220
  * The date to show.
205
221
  */
@@ -219,6 +235,33 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
219
235
  * @default false
220
236
  */
221
237
  disableMargin: PropTypes.bool,
238
+ /**
239
+ * If `true`, the ripple effect is disabled.
240
+ *
241
+ * ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
242
+ * to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
243
+ * @default false
244
+ */
245
+ disableRipple: PropTypes.bool,
246
+ /**
247
+ * If `true`, the touch ripple effect is disabled.
248
+ * @default false
249
+ */
250
+ disableTouchRipple: PropTypes.bool,
251
+ /**
252
+ * If `true`, the base button will have a keyboard focus ripple.
253
+ * @default false
254
+ */
255
+ focusRipple: PropTypes.bool,
256
+ /**
257
+ * This prop can help identify which element has keyboard focus.
258
+ * The class name will be applied when the element gains the focus through keyboard interaction.
259
+ * It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
260
+ * The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
261
+ * A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
262
+ * if needed.
263
+ */
264
+ focusVisibleClassName: PropTypes.string,
222
265
  isAnimating: PropTypes.bool,
223
266
  /**
224
267
  * Set to `true` if the `day` is the end of a highlighted date range.
@@ -249,6 +292,11 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
249
292
  */
250
293
  isVisuallySelected: PropTypes.bool,
251
294
  onDaySelect: PropTypes.func.isRequired,
295
+ /**
296
+ * Callback fired when the component is focused with a keyboard.
297
+ * We trigger a `onFocus` callback too.
298
+ */
299
+ onFocusVisible: PropTypes.func,
252
300
  onMouseEnter: PropTypes.func,
253
301
  /**
254
302
  * If `true`, day is outside of month and will be hidden.
@@ -264,11 +312,34 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
264
312
  * @default false
265
313
  */
266
314
  showDaysOutsideCurrentMonth: PropTypes.bool,
315
+ style: PropTypes.object,
316
+ /**
317
+ * The system prop that allows defining system overrides as well as additional CSS styles.
318
+ */
319
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
320
+ /**
321
+ * @default 0
322
+ */
323
+ tabIndex: PropTypes.number,
267
324
  /**
268
325
  * If `true`, renders as today date.
269
326
  * @default false
270
327
  */
271
- today: PropTypes.bool
328
+ today: PropTypes.bool,
329
+ /**
330
+ * Props applied to the `TouchRipple` element.
331
+ */
332
+ TouchRippleProps: PropTypes.object,
333
+ /**
334
+ * A ref that points to the `TouchRipple` element.
335
+ */
336
+ touchRippleRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
337
+ current: PropTypes.shape({
338
+ pulsate: PropTypes.func.isRequired,
339
+ start: PropTypes.func.isRequired,
340
+ stop: PropTypes.func.isRequired
341
+ })
342
+ })])
272
343
  } : void 0;
273
344
 
274
345
  /**
@@ -248,11 +248,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateRangePicker.propTypes = {
248
248
  * Use in controlled mode (see open).
249
249
  */
250
250
  onOpen: PropTypes.func,
251
- /**
252
- * Callback fired on view change.
253
- * @param {DateView} view The new view.
254
- */
255
- onViewChange: PropTypes.func,
256
251
  /**
257
252
  * Control the popup or dialog open state.
258
253
  */