@mui/x-date-pickers-pro 7.0.0-beta.7 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/CHANGELOG.md +266 -12
  2. package/DateRangeCalendar/DateRangeCalendar.js +17 -22
  3. package/DateRangeCalendar/useDragRange.js +1 -2
  4. package/DateRangePicker/DateRangePicker.js +1 -1
  5. package/DateRangePicker/shared.js +3 -5
  6. package/DateRangePickerDay/DateRangePickerDay.d.ts +5 -0
  7. package/DateRangePickerDay/DateRangePickerDay.js +107 -43
  8. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +10 -0
  9. package/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
  10. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +4 -5
  11. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +2 -3
  12. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +31 -15
  13. package/DateTimeRangePicker/shared.d.ts +5 -4
  14. package/DateTimeRangePicker/shared.js +9 -10
  15. package/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -10
  16. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +10 -0
  17. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +31 -28
  18. package/MobileDateRangePicker/MobileDateRangePicker.js +5 -9
  19. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +10 -0
  20. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -14
  21. package/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -15
  22. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -15
  23. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -14
  24. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +1 -1
  25. package/README.md +1 -1
  26. package/SingleInputDateRangeField/SingleInputDateRangeField.js +8 -4
  27. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
  28. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +8 -4
  29. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
  30. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +7 -3
  31. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
  32. package/StaticDateRangePicker/StaticDateRangePicker.js +4 -5
  33. package/index.js +1 -1
  34. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +9 -11
  35. package/internals/hooks/useEnrichedRangePickerFieldProps.js +26 -32
  36. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -10
  37. package/internals/hooks/useMultiInputFieldSelectedSections.js +3 -6
  38. package/internals/hooks/useRangePosition.js +3 -5
  39. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -18
  40. package/internals/models/dateRange.d.ts +3 -3
  41. package/internals/models/dateTimeRange.d.ts +2 -2
  42. package/internals/models/timeRange.d.ts +2 -2
  43. package/internals/utils/releaseInfo.js +1 -1
  44. package/internals/utils/validation/validateDateRange.js +2 -2
  45. package/internals/utils/validation/validateDateTimeRange.js +2 -2
  46. package/internals/utils/valueManagers.d.ts +3 -1
  47. package/internals/utils/valueManagers.js +9 -7
  48. package/models/fields.d.ts +8 -1
  49. package/modern/DateRangeCalendar/DateRangeCalendar.js +1 -1
  50. package/modern/DateRangePicker/DateRangePicker.js +1 -1
  51. package/modern/DateRangePickerDay/DateRangePickerDay.js +107 -43
  52. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
  53. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +31 -15
  54. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  55. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
  56. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  57. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
  58. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -4
  59. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -4
  60. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +9 -3
  61. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
  62. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
  63. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
  64. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
  65. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
  66. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
  67. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  68. package/modern/index.js +1 -1
  69. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +1 -1
  70. package/modern/internals/utils/releaseInfo.js +1 -1
  71. package/modern/internals/utils/valueManagers.js +7 -5
  72. package/node/DateRangeCalendar/DateRangeCalendar.js +1 -1
  73. package/node/DateRangePicker/DateRangePicker.js +1 -1
  74. package/node/DateRangePickerDay/DateRangePickerDay.js +107 -43
  75. package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
  76. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +31 -15
  77. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  78. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
  79. package/node/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  80. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
  81. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -4
  82. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -4
  83. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +9 -3
  84. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
  85. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +7 -1
  86. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
  87. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +7 -1
  88. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
  89. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +7 -1
  90. package/node/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  91. package/node/index.js +1 -1
  92. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +1 -1
  93. package/node/internals/utils/releaseInfo.js +1 -1
  94. package/node/internals/utils/valueManagers.js +9 -6
  95. package/package.json +7 -7
  96. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.d.ts +0 -9
  97. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -52
  98. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -51
  99. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -59
@@ -46,9 +46,7 @@ const MultiInputDateTimeRangeFieldRoot = (0, _styles.styled)( /*#__PURE__*/React
46
46
  slot: 'Root',
47
47
  overridesResolver: (props, styles) => styles.root
48
48
  })({});
49
- const MultiInputDateTimeRangeFieldSeparator = (0, _styles.styled)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, (0, _extends2.default)({}, props, {
50
- children: props.children ?? ' – '
51
- })), {
49
+ const MultiInputDateTimeRangeFieldSeparator = (0, _styles.styled)(_Typography.default, {
52
50
  name: 'MuiMultiInputDateTimeRangeField',
53
51
  slot: 'Separator',
54
52
  overridesResolver: (props, styles) => styles.separator
@@ -114,6 +112,9 @@ const MultiInputDateTimeRangeField = exports.MultiInputDateTimeRangeField = /*#_
114
112
  const separatorProps = (0, _utils.useSlotProps)({
115
113
  elementType: Separator,
116
114
  externalSlotProps: slotProps?.separator,
115
+ additionalProps: {
116
+ children: ` ${internalProps.dateSeparator ?? '–'} `
117
+ },
117
118
  ownerState,
118
119
  className: classes.separator
119
120
  });
@@ -154,6 +155,11 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
154
155
  classes: _propTypes.default.object,
155
156
  className: _propTypes.default.string,
156
157
  component: _propTypes.default.elementType,
158
+ /**
159
+ * String displayed between the start and the end dates.
160
+ * @default "–"
161
+ */
162
+ dateSeparator: _propTypes.default.string,
157
163
  /**
158
164
  * The default value. Use when the component is not controlled.
159
165
  */
@@ -279,7 +285,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
279
285
  /**
280
286
  * Disable specific date.
281
287
  *
282
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
288
+ * Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
283
289
  *
284
290
  * @template TDate
285
291
  * @param {TDate} day The date to test.
@@ -46,9 +46,7 @@ const MultiInputTimeRangeFieldRoot = (0, _styles.styled)( /*#__PURE__*/React.for
46
46
  slot: 'Root',
47
47
  overridesResolver: (props, styles) => styles.root
48
48
  })({});
49
- const MultiInputTimeRangeFieldSeparator = (0, _styles.styled)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, (0, _extends2.default)({}, props, {
50
- children: props.children ?? ' – '
51
- })), {
49
+ const MultiInputTimeRangeFieldSeparator = (0, _styles.styled)(_Typography.default, {
52
50
  name: 'MuiMultiInputTimeRangeField',
53
51
  slot: 'Separator',
54
52
  overridesResolver: (props, styles) => styles.separator
@@ -114,6 +112,9 @@ const MultiInputTimeRangeField = exports.MultiInputTimeRangeField = /*#__PURE__*
114
112
  const separatorProps = (0, _utils.useSlotProps)({
115
113
  elementType: Separator,
116
114
  externalSlotProps: slotProps?.separator,
115
+ additionalProps: {
116
+ children: ` ${internalProps.dateSeparator ?? '–'} `
117
+ },
117
118
  ownerState,
118
119
  className: classes.separator
119
120
  });
@@ -154,6 +155,11 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
154
155
  classes: _propTypes.default.object,
155
156
  className: _propTypes.default.string,
156
157
  component: _propTypes.default.elementType,
158
+ /**
159
+ * String displayed between the start and the end dates.
160
+ * @default "–"
161
+ */
162
+ dateSeparator: _propTypes.default.string,
157
163
  /**
158
164
  * The default value. Use when the component is not controlled.
159
165
  */
@@ -91,6 +91,11 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
91
91
  */
92
92
  color: _propTypes.default.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
93
93
  component: _propTypes.default.elementType,
94
+ /**
95
+ * String displayed between the start and the end dates.
96
+ * @default "–"
97
+ */
98
+ dateSeparator: _propTypes.default.string,
94
99
  /**
95
100
  * The default value. Use when the component is not controlled.
96
101
  */
@@ -251,7 +256,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
251
256
  /**
252
257
  * Disable specific date.
253
258
  *
254
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
259
+ * Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
255
260
  *
256
261
  * @template TDate
257
262
  * @param {TDate} day The date to test.
@@ -4,20 +4,26 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useSingleInputDateRangeField = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
7
8
  var _internals = require("@mui/x-date-pickers/internals");
8
9
  var _valueManagers = require("../internals/utils/valueManagers");
9
10
  var _validateDateRange = require("../internals/utils/validation/validateDateRange");
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
13
  const useSingleInputDateRangeField = inProps => {
11
14
  const props = (0, _internals.useDefaultizedDateField)(inProps);
12
15
  const {
13
16
  forwardedProps,
14
17
  internalProps
15
18
  } = (0, _internals.splitFieldInternalAndForwardedProps)(props, 'date');
19
+ const fieldValueManager = React.useMemo(() => (0, _valueManagers.getRangeFieldValueManager)({
20
+ dateSeparator: internalProps.dateSeparator
21
+ }), [internalProps.dateSeparator]);
16
22
  return (0, _internals.useField)({
17
23
  forwardedProps,
18
24
  internalProps,
19
25
  valueManager: _valueManagers.rangeValueManager,
20
- fieldValueManager: _valueManagers.rangeFieldValueManager,
26
+ fieldValueManager,
21
27
  validator: _validateDateRange.validateDateRange,
22
28
  valueType: 'date'
23
29
  });
@@ -96,6 +96,11 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
96
96
  */
97
97
  color: _propTypes.default.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
98
98
  component: _propTypes.default.elementType,
99
+ /**
100
+ * String displayed between the start and the end dates.
101
+ * @default "–"
102
+ */
103
+ dateSeparator: _propTypes.default.string,
99
104
  /**
100
105
  * The default value. Use when the component is not controlled.
101
106
  */
@@ -284,7 +289,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
284
289
  /**
285
290
  * Disable specific date.
286
291
  *
287
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
292
+ * Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
288
293
  *
289
294
  * @template TDate
290
295
  * @param {TDate} day The date to test.
@@ -4,20 +4,26 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useSingleInputDateTimeRangeField = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
7
8
  var _internals = require("@mui/x-date-pickers/internals");
8
9
  var _valueManagers = require("../internals/utils/valueManagers");
9
10
  var _validateDateTimeRange = require("../internals/utils/validation/validateDateTimeRange");
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
13
  const useSingleInputDateTimeRangeField = inProps => {
11
14
  const props = (0, _internals.useDefaultizedDateTimeField)(inProps);
12
15
  const {
13
16
  forwardedProps,
14
17
  internalProps
15
18
  } = (0, _internals.splitFieldInternalAndForwardedProps)(props, 'date-time');
19
+ const fieldValueManager = React.useMemo(() => (0, _valueManagers.getRangeFieldValueManager)({
20
+ dateSeparator: internalProps.dateSeparator
21
+ }), [internalProps.dateSeparator]);
16
22
  return (0, _internals.useField)({
17
23
  forwardedProps,
18
24
  internalProps,
19
25
  valueManager: _valueManagers.rangeValueManager,
20
- fieldValueManager: _valueManagers.rangeFieldValueManager,
26
+ fieldValueManager,
21
27
  validator: _validateDateTimeRange.validateDateTimeRange,
22
28
  valueType: 'date-time'
23
29
  });
@@ -96,6 +96,11 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
96
96
  */
97
97
  color: _propTypes.default.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
98
98
  component: _propTypes.default.elementType,
99
+ /**
100
+ * String displayed between the start and the end dates.
101
+ * @default "–"
102
+ */
103
+ dateSeparator: _propTypes.default.string,
99
104
  /**
100
105
  * The default value. Use when the component is not controlled.
101
106
  */
@@ -4,20 +4,26 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useSingleInputTimeRangeField = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
7
8
  var _internals = require("@mui/x-date-pickers/internals");
8
9
  var _valueManagers = require("../internals/utils/valueManagers");
9
10
  var _validateTimeRange = require("../internals/utils/validation/validateTimeRange");
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
13
  const useSingleInputTimeRangeField = inProps => {
11
14
  const props = (0, _internals.useDefaultizedTimeField)(inProps);
12
15
  const {
13
16
  forwardedProps,
14
17
  internalProps
15
18
  } = (0, _internals.splitFieldInternalAndForwardedProps)(props, 'time');
19
+ const fieldValueManager = React.useMemo(() => (0, _valueManagers.getRangeFieldValueManager)({
20
+ dateSeparator: internalProps.dateSeparator
21
+ }), [internalProps.dateSeparator]);
16
22
  return (0, _internals.useField)({
17
23
  forwardedProps,
18
24
  internalProps,
19
25
  valueManager: _valueManagers.rangeValueManager,
20
- fieldValueManager: _valueManagers.rangeFieldValueManager,
26
+ fieldValueManager,
21
27
  validator: _validateTimeRange.validateTimeRange,
22
28
  valueType: 'time'
23
29
  });
@@ -226,7 +226,7 @@ StaticDateRangePicker.propTypes = {
226
226
  /**
227
227
  * Disable specific date.
228
228
  *
229
- * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
229
+ * Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
230
230
  *
231
231
  * @template TDate
232
232
  * @param {TDate} day The date to test.
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v7.0.0-beta.7
2
+ * @mui/x-date-pickers-pro v7.1.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -230,7 +230,7 @@ const useSingleInputFieldSlotProps = ({
230
230
  InputProps: (0, _extends2.default)({
231
231
  ref: anchorRef
232
232
  }, fieldProps?.InputProps),
233
- focused: open
233
+ focused: open ? true : undefined
234
234
  }, labelId != null && {
235
235
  id: labelId
236
236
  }, wrapperVariant === 'mobile' && {
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getReleaseInfo = void 0;
7
7
  var _utils = require("@mui/utils");
8
8
  const getReleaseInfo = () => {
9
- const releaseInfo = "MTcxMDM3MDgwMDAwMA==";
9
+ const releaseInfo = "MTcxMTU4MDQwMDAwMA==";
10
10
  if (process.env.NODE_ENV !== 'production') {
11
11
  // A simple hack to set the value in the test environment (has no build step).
12
12
  // eslint-disable-next-line no-useless-concat
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.rangeValueManager = exports.rangeFieldValueManager = void 0;
7
+ exports.rangeValueManager = exports.getRangeFieldValueManager = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
10
  var _internals = require("@mui/x-date-pickers/internals");
@@ -42,7 +42,9 @@ const rangeValueManager = exports.rangeValueManager = {
42
42
  },
43
43
  setTimezone: (utils, timezone, value) => [value[0] == null ? null : utils.setTimezone(value[0], timezone), value[1] == null ? null : utils.setTimezone(value[1], timezone)]
44
44
  };
45
- const rangeFieldValueManager = exports.rangeFieldValueManager = {
45
+ const getRangeFieldValueManager = ({
46
+ dateSeparator = '–'
47
+ }) => ({
46
48
  updateReferenceValue: (utils, value, prevReferenceValue) => {
47
49
  const shouldKeepStartDate = value[0] != null && utils.isValid(value[0]);
48
50
  const shouldKeepEndDate = value[1] != null && utils.isValid(value[1]);
@@ -73,7 +75,7 @@ const rangeFieldValueManager = exports.rangeFieldValueManager = {
73
75
  return (0, _extends2.default)({}, section, {
74
76
  dateName: position,
75
77
  // TODO: Check if RTL still works
76
- endSeparator: `${section.endSeparator} `
78
+ endSeparator: `${section.endSeparator} ${dateSeparator} `
77
79
  });
78
80
  }
79
81
  return (0, _extends2.default)({}, section, {
@@ -92,8 +94,8 @@ const rangeFieldValueManager = exports.rangeFieldValueManager = {
92
94
  return (0, _internals.createDateStrForV6InputFromSections)([...dateRangeSections.startDate, ...dateRangeSections.endDate], localizedDigits, isRTL);
93
95
  },
94
96
  parseValueStr: (valueStr, referenceValue, parseDate) => {
95
- // TODO: Improve because it would not work if the date format has `–` as a separator.
96
- const [startStr, endStr] = valueStr.split('–');
97
+ // TODO: Improve because it would not work if some section have the same separator as the dateSeparator.
98
+ const [startStr, endStr] = valueStr.split(dateSeparator);
97
99
  return [startStr, endStr].map((dateStr, index) => {
98
100
  if (dateStr == null) {
99
101
  return null;
@@ -120,4 +122,5 @@ const rangeFieldValueManager = exports.rangeFieldValueManager = {
120
122
  })
121
123
  };
122
124
  }
123
- };
125
+ });
126
+ exports.getRangeFieldValueManager = getRangeFieldValueManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-date-pickers-pro",
3
- "version": "7.0.0-beta.7",
3
+ "version": "7.1.0",
4
4
  "description": "The commercial edition of the date picker components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -32,11 +32,11 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.24.0",
35
- "@mui/base": "^5.0.0-beta.36",
36
- "@mui/system": "^5.15.9",
37
- "@mui/utils": "^5.15.9",
38
- "@mui/x-date-pickers": "7.0.0-beta.7",
39
- "@mui/x-license": "7.0.0-beta.6",
35
+ "@mui/base": "^5.0.0-beta.40",
36
+ "@mui/system": "^5.15.14",
37
+ "@mui/utils": "^5.15.14",
38
+ "@mui/x-date-pickers": "7.1.0",
39
+ "@mui/x-license": "7.0.0",
40
40
  "clsx": "^2.1.0",
41
41
  "prop-types": "^15.8.1",
42
42
  "react-transition-group": "^4.4.5"
@@ -44,7 +44,7 @@
44
44
  "peerDependencies": {
45
45
  "@emotion/react": "^11.9.0",
46
46
  "@emotion/styled": "^11.8.1",
47
- "@mui/material": "^5.15.0",
47
+ "@mui/material": "^5.15.14",
48
48
  "date-fns": "^2.25.0 || ^3.2.0",
49
49
  "date-fns-jalali": "^2.13.0-0",
50
50
  "dayjs": "^1.10.7",
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- import { PickersLayoutProps } from '@mui/x-date-pickers/PickersLayout';
3
- import { PickerValidDate } from '@mui/x-date-pickers/models';
4
- import { DateRange } from '../models';
5
- import { DateTimeRangePickerView } from '../internals/models/dateTimeRange';
6
- /**
7
- * @ignore - internal component.
8
- */
9
- export declare function DesktopDateTimeRangePickerLayout<TDate extends PickerValidDate>(props: PickersLayoutProps<DateRange<TDate>, TDate, DateTimeRangePickerView>): React.JSX.Element;
@@ -1,52 +0,0 @@
1
- import * as React from 'react';
2
- import clsx from 'clsx';
3
- import Divider from '@mui/material/Divider';
4
- import { PickersLayoutContentWrapper, PickersLayoutRoot, pickersLayoutClasses, usePickerLayout } from '@mui/x-date-pickers/PickersLayout';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- import { jsxs as _jsxs } from "react/jsx-runtime";
7
- /**
8
- * @ignore - internal component.
9
- */
10
- export function DesktopDateTimeRangePickerLayout(props) {
11
- var _actionBar$props$acti, _actionBar$props$acti2;
12
- const {
13
- toolbar,
14
- tabs,
15
- content,
16
- actionBar,
17
- shortcuts
18
- } = usePickerLayout(props);
19
- const {
20
- sx,
21
- className,
22
- isLandscape,
23
- ref
24
- } = props;
25
- const isActionBarVisible = actionBar && ((_actionBar$props$acti = (_actionBar$props$acti2 = actionBar.props.actions) == null ? void 0 : _actionBar$props$acti2.length) != null ? _actionBar$props$acti : 0) > 0;
26
- return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
27
- ref: ref,
28
- className: clsx(className, pickersLayoutClasses.root),
29
- sx: [{
30
- [`& .${pickersLayoutClasses.tabs}`]: {
31
- gridRow: 4,
32
- gridColumn: '1 / 4'
33
- },
34
- [`& .${pickersLayoutClasses.actionBar}`]: {
35
- gridRow: 5
36
- }
37
- }, ...(Array.isArray(sx) ? sx : [sx])],
38
- ownerState: props,
39
- children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/_jsx(PickersLayoutContentWrapper, {
40
- className: pickersLayoutClasses.contentWrapper,
41
- sx: {
42
- flexDirection: 'row'
43
- },
44
- children: content
45
- }), isActionBarVisible && /*#__PURE__*/_jsx(Divider, {
46
- sx: {
47
- gridRow: 3,
48
- gridColumn: '1/4'
49
- }
50
- }), tabs, actionBar]
51
- });
52
- }
@@ -1,51 +0,0 @@
1
- import * as React from 'react';
2
- import clsx from 'clsx';
3
- import Divider from '@mui/material/Divider';
4
- import { PickersLayoutContentWrapper, PickersLayoutRoot, pickersLayoutClasses, usePickerLayout } from '@mui/x-date-pickers/PickersLayout';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- import { jsxs as _jsxs } from "react/jsx-runtime";
7
- /**
8
- * @ignore - internal component.
9
- */
10
- export function DesktopDateTimeRangePickerLayout(props) {
11
- const {
12
- toolbar,
13
- tabs,
14
- content,
15
- actionBar,
16
- shortcuts
17
- } = usePickerLayout(props);
18
- const {
19
- sx,
20
- className,
21
- isLandscape,
22
- ref
23
- } = props;
24
- const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
25
- return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
26
- ref: ref,
27
- className: clsx(className, pickersLayoutClasses.root),
28
- sx: [{
29
- [`& .${pickersLayoutClasses.tabs}`]: {
30
- gridRow: 4,
31
- gridColumn: '1 / 4'
32
- },
33
- [`& .${pickersLayoutClasses.actionBar}`]: {
34
- gridRow: 5
35
- }
36
- }, ...(Array.isArray(sx) ? sx : [sx])],
37
- ownerState: props,
38
- children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/_jsx(PickersLayoutContentWrapper, {
39
- className: pickersLayoutClasses.contentWrapper,
40
- sx: {
41
- flexDirection: 'row'
42
- },
43
- children: content
44
- }), isActionBarVisible && /*#__PURE__*/_jsx(Divider, {
45
- sx: {
46
- gridRow: 3,
47
- gridColumn: '1/4'
48
- }
49
- }), tabs, actionBar]
50
- });
51
- }
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.DesktopDateTimeRangePickerLayout = DesktopDateTimeRangePickerLayout;
8
- var React = _interopRequireWildcard(require("react"));
9
- var _clsx = _interopRequireDefault(require("clsx"));
10
- var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
11
- var _PickersLayout = require("@mui/x-date-pickers/PickersLayout");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
- /**
16
- * @ignore - internal component.
17
- */
18
- function DesktopDateTimeRangePickerLayout(props) {
19
- const {
20
- toolbar,
21
- tabs,
22
- content,
23
- actionBar,
24
- shortcuts
25
- } = (0, _PickersLayout.usePickerLayout)(props);
26
- const {
27
- sx,
28
- className,
29
- isLandscape,
30
- ref
31
- } = props;
32
- const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
33
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PickersLayout.PickersLayoutRoot, {
34
- ref: ref,
35
- className: (0, _clsx.default)(className, _PickersLayout.pickersLayoutClasses.root),
36
- sx: [{
37
- [`& .${_PickersLayout.pickersLayoutClasses.tabs}`]: {
38
- gridRow: 4,
39
- gridColumn: '1 / 4'
40
- },
41
- [`& .${_PickersLayout.pickersLayoutClasses.actionBar}`]: {
42
- gridRow: 5
43
- }
44
- }, ...(Array.isArray(sx) ? sx : [sx])],
45
- ownerState: props,
46
- children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersLayout.PickersLayoutContentWrapper, {
47
- className: _PickersLayout.pickersLayoutClasses.contentWrapper,
48
- sx: {
49
- flexDirection: 'row'
50
- },
51
- children: content
52
- }), isActionBarVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
53
- sx: {
54
- gridRow: 3,
55
- gridColumn: '1/4'
56
- }
57
- }), tabs, actionBar]
58
- });
59
- }