@mui/x-date-pickers-pro 6.2.1 → 6.3.1

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 (118) hide show
  1. package/CHANGELOG.md +118 -3
  2. package/DateRangePicker/shared.d.ts +1 -1
  3. package/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  4. package/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  5. package/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
  6. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
  7. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
  8. package/README.md +0 -9
  9. package/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -3
  10. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
  11. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +25 -3
  12. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
  13. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +25 -3
  14. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +4 -2
  15. package/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  16. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
  17. package/index.d.ts +1 -3
  18. package/index.js +3 -2
  19. package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +2 -2
  20. package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +5 -5
  21. package/internal/hooks/useEnrichedRangePickerFieldProps.d.ts +4 -3
  22. package/internal/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -2
  23. package/internal/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +5 -5
  24. package/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +4 -1
  25. package/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +4 -1
  26. package/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +4 -1
  27. package/internal/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -2
  28. package/internal/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +5 -5
  29. package/internal/models/dateRange.d.ts +1 -1
  30. package/internal/models/dateTimeRange.d.ts +3 -11
  31. package/internal/models/timeRange.d.ts +1 -1
  32. package/internal/utils/date-fields-utils.d.ts +4 -1
  33. package/internal/utils/releaseInfo.js +1 -1
  34. package/internal/{hooks/validation/useDateRangeValidation.d.ts → utils/validation/validateDateRange.d.ts} +1 -7
  35. package/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
  36. package/internal/utils/validation/validateDateTimeRange.d.ts +7 -0
  37. package/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +2 -6
  38. package/internal/utils/validation/validateTimeRange.d.ts +6 -0
  39. package/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +2 -6
  40. package/internal/utils/valueManagers.d.ts +1 -3
  41. package/internal/utils/valueManagers.js +1 -1
  42. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  43. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  44. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
  45. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
  46. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
  47. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -3
  48. package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
  49. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +25 -3
  50. package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
  51. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +25 -3
  52. package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +4 -2
  53. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  54. package/legacy/index.js +3 -2
  55. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +4 -1
  56. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +4 -1
  57. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +4 -1
  58. package/legacy/internal/utils/releaseInfo.js +1 -1
  59. package/legacy/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
  60. package/legacy/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +2 -6
  61. package/legacy/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +2 -6
  62. package/legacy/internal/utils/valueManagers.js +1 -1
  63. package/legacy/models/index.js +1 -0
  64. package/legacy/models/validation.js +1 -0
  65. package/models/index.d.ts +1 -0
  66. package/models/index.js +1 -0
  67. package/models/package.json +6 -0
  68. package/models/validation.d.ts +9 -0
  69. package/models/validation.js +1 -0
  70. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  71. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  72. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
  73. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
  74. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
  75. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -3
  76. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
  77. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +25 -3
  78. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
  79. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +25 -3
  80. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +4 -2
  81. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
  82. package/modern/index.js +3 -2
  83. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +4 -1
  84. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +4 -1
  85. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +4 -1
  86. package/modern/internal/utils/releaseInfo.js +1 -1
  87. package/modern/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
  88. package/modern/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +2 -6
  89. package/modern/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +2 -6
  90. package/modern/internal/utils/valueManagers.js +1 -1
  91. package/modern/models/index.js +1 -0
  92. package/modern/models/validation.js +1 -0
  93. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -2
  94. package/node/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  95. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
  96. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
  97. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
  98. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -3
  99. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +5 -3
  100. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +25 -3
  101. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +5 -3
  102. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +25 -3
  103. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +5 -3
  104. package/node/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
  105. package/node/index.js +13 -1
  106. package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +6 -3
  107. package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +6 -3
  108. package/node/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +6 -3
  109. package/node/internal/utils/releaseInfo.js +1 -1
  110. package/node/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
  111. package/node/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +3 -8
  112. package/node/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +3 -8
  113. package/node/internal/utils/valueManagers.js +1 -1
  114. package/node/models/index.js +16 -0
  115. package/node/models/validation.js +5 -0
  116. package/package.json +4 -7
  117. package/internal/hooks/validation/useDateTimeRangeValidation.d.ts +0 -14
  118. package/internal/hooks/validation/useTimeRangeValidation.d.ts +0 -13
@@ -63,11 +63,13 @@ const SingleInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Sin
63
63
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
64
64
  ref: ref
65
65
  }, fieldProps, {
66
+ InputProps: (0, _extends2.default)({}, fieldProps.InputProps, {
67
+ readOnly
68
+ }),
66
69
  inputProps: (0, _extends2.default)({}, fieldProps.inputProps, {
67
- ref: inputRef,
68
- onPaste,
69
70
  inputMode,
70
- readOnly
71
+ onPaste,
72
+ ref: inputRef
71
73
  })
72
74
  }));
73
75
  });
@@ -246,6 +248,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
246
248
  * @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
247
249
  */
248
250
  onChange: _propTypes.default.func,
251
+ /**
252
+ * @ignore
253
+ */
254
+ onClick: _propTypes.default.func,
249
255
  /**
250
256
  * Callback fired when the error associated to the current value changes.
251
257
  * @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
@@ -302,11 +308,27 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
302
308
  shouldDisableDate: _propTypes.default.func,
303
309
  /**
304
310
  * Disable specific time.
311
+ * @template TDate
305
312
  * @param {TDate} value The value to check.
306
313
  * @param {TimeView} view The clock type of the timeValue.
307
314
  * @returns {boolean} If `true` the time will be disabled.
308
315
  */
309
316
  shouldDisableTime: _propTypes.default.func,
317
+ /**
318
+ * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
319
+ * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
320
+ *
321
+ * Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (e.g: "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
322
+ *
323
+ * Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
324
+ * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
325
+ *
326
+ * Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
327
+ * This mean that when using `shouldRespectLeadingZeros={false}`, if you retrieve the value directly from the input (not listening to `onChange`) and your format contains tokens without leading zeros, the value will not be parsed by your library.
328
+ *
329
+ * @default `false`
330
+ */
331
+ shouldRespectLeadingZeros: _propTypes.default.bool,
310
332
  /**
311
333
  * The size of the component.
312
334
  */
@@ -9,8 +9,8 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _internals = require("@mui/x-date-pickers/internals");
11
11
  var _valueManagers = require("../internal/utils/valueManagers");
12
- var _useDateTimeRangeValidation = require("../internal/hooks/validation/useDateTimeRangeValidation");
13
- const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
12
+ var _validateDateTimeRange = require("../internal/utils/validation/validateDateTimeRange");
13
+ const _excluded = ["value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
14
14
  const useDefaultizedTimeRangeFieldProps = props => {
15
15
  const utils = (0, _internals.useUtils)();
16
16
  const defaultDates = (0, _internals.useDefaultDates)();
@@ -38,6 +38,7 @@ const useSingleInputDateTimeRangeField = ({
38
38
  defaultValue,
39
39
  format,
40
40
  formatDensity,
41
+ shouldRespectLeadingZeros,
41
42
  onChange,
42
43
  readOnly,
43
44
  onError,
@@ -64,6 +65,7 @@ const useSingleInputDateTimeRangeField = ({
64
65
  defaultValue,
65
66
  format,
66
67
  formatDensity,
68
+ shouldRespectLeadingZeros,
67
69
  onChange,
68
70
  readOnly,
69
71
  onError,
@@ -83,7 +85,7 @@ const useSingleInputDateTimeRangeField = ({
83
85
  },
84
86
  valueManager: _valueManagers.rangeValueManager,
85
87
  fieldValueManager: _valueManagers.rangeFieldValueManager,
86
- validator: _useDateTimeRangeValidation.validateDateTimeRange,
88
+ validator: _validateDateTimeRange.validateDateTimeRange,
87
89
  valueType: 'date-time'
88
90
  });
89
91
  };
@@ -63,11 +63,13 @@ const SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleI
63
63
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
64
64
  ref: ref
65
65
  }, fieldProps, {
66
+ InputProps: (0, _extends2.default)({}, fieldProps.InputProps, {
67
+ readOnly
68
+ }),
66
69
  inputProps: (0, _extends2.default)({}, fieldProps.inputProps, {
67
- ref: inputRef,
68
- onPaste,
69
70
  inputMode,
70
- readOnly
71
+ onPaste,
72
+ ref: inputRef
71
73
  })
72
74
  }));
73
75
  });
@@ -230,6 +232,10 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
230
232
  * @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
231
233
  */
232
234
  onChange: _propTypes.default.func,
235
+ /**
236
+ * @ignore
237
+ */
238
+ onClick: _propTypes.default.func,
233
239
  /**
234
240
  * Callback fired when the error associated to the current value changes.
235
241
  * @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
@@ -278,11 +284,27 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
278
284
  shouldDisableClock: _propTypes.default.func,
279
285
  /**
280
286
  * Disable specific time.
287
+ * @template TDate
281
288
  * @param {TDate} value The value to check.
282
289
  * @param {TimeView} view The clock type of the timeValue.
283
290
  * @returns {boolean} If `true` the time will be disabled.
284
291
  */
285
292
  shouldDisableTime: _propTypes.default.func,
293
+ /**
294
+ * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
295
+ * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
296
+ *
297
+ * Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (e.g: "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
298
+ *
299
+ * Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
300
+ * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
301
+ *
302
+ * Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
303
+ * This mean that when using `shouldRespectLeadingZeros={false}`, if you retrieve the value directly from the input (not listening to `onChange`) and your format contains tokens without leading zeros, the value will not be parsed by your library.
304
+ *
305
+ * @default `false`
306
+ */
307
+ shouldRespectLeadingZeros: _propTypes.default.bool,
286
308
  /**
287
309
  * The size of the component.
288
310
  */
@@ -9,8 +9,8 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _internals = require("@mui/x-date-pickers/internals");
11
11
  var _valueManagers = require("../internal/utils/valueManagers");
12
- var _useTimeRangeValidation = require("../internal/hooks/validation/useTimeRangeValidation");
13
- const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "minTime", "maxTime", "minutesStep", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
12
+ var _validateTimeRange = require("../internal/utils/validation/validateTimeRange");
13
+ const _excluded = ["value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "onError", "minTime", "maxTime", "minutesStep", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
14
14
  const useDefaultizedTimeRangeFieldProps = props => {
15
15
  const utils = (0, _internals.useUtils)();
16
16
  const ampm = props.ampm ?? utils.is12HourCycleInCurrentLocale();
@@ -32,6 +32,7 @@ const useSingleInputTimeRangeField = ({
32
32
  defaultValue,
33
33
  format,
34
34
  formatDensity,
35
+ shouldRespectLeadingZeros,
35
36
  onChange,
36
37
  readOnly,
37
38
  onError,
@@ -54,6 +55,7 @@ const useSingleInputTimeRangeField = ({
54
55
  defaultValue,
55
56
  format,
56
57
  formatDensity,
58
+ shouldRespectLeadingZeros,
57
59
  onChange,
58
60
  readOnly,
59
61
  onError,
@@ -69,7 +71,7 @@ const useSingleInputTimeRangeField = ({
69
71
  },
70
72
  valueManager: _valueManagers.rangeValueManager,
71
73
  fieldValueManager: _valueManagers.rangeFieldValueManager,
72
- validator: _useTimeRangeValidation.validateTimeRange,
74
+ validator: _validateTimeRange.validateTimeRange,
73
75
  valueType: 'time'
74
76
  });
75
77
  };
@@ -12,7 +12,7 @@ var _useStaticRangePicker = require("../internal/hooks/useStaticRangePicker");
12
12
  var _shared = require("../DateRangePicker/shared");
13
13
  var _dateRangeViewRenderers = require("../dateRangeViewRenderers");
14
14
  var _valueManagers = require("../internal/utils/valueManagers");
15
- var _useDateRangeValidation = require("../internal/hooks/validation/useDateRangeValidation");
15
+ var _validateDateRange = require("../internal/utils/validation/validateDateRange");
16
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
17
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
18
  const StaticDateRangePicker = /*#__PURE__*/React.forwardRef(function StaticDateRangePicker(inProps, ref) {
@@ -41,7 +41,7 @@ const StaticDateRangePicker = /*#__PURE__*/React.forwardRef(function StaticDateR
41
41
  props,
42
42
  valueManager: _valueManagers.rangeValueManager,
43
43
  valueType: 'date',
44
- validator: _useDateRangeValidation.validateDateRange,
44
+ validator: _validateDateRange.validateDateRange,
45
45
  ref
46
46
  });
47
47
  return renderPicker();
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v6.2.1
2
+ * @mui/x-date-pickers-pro v6.3.1
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -187,4 +187,16 @@ Object.keys(_dateRangeViewRenderers).forEach(function (key) {
187
187
  return _dateRangeViewRenderers[key];
188
188
  }
189
189
  });
190
+ });
191
+ var _models = require("./models");
192
+ Object.keys(_models).forEach(function (key) {
193
+ if (key === "default" || key === "__esModule") return;
194
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
195
+ if (key in exports && exports[key] === _models[key]) return;
196
+ Object.defineProperty(exports, key, {
197
+ enumerable: true,
198
+ get: function () {
199
+ return _models[key];
200
+ }
201
+ });
190
202
  });
@@ -12,7 +12,7 @@ var _DateField = require("@mui/x-date-pickers/DateField");
12
12
  var _internals = require("@mui/x-date-pickers/internals");
13
13
  var _useControlled = _interopRequireDefault(require("@mui/utils/useControlled"));
14
14
  var _useSingleInputDateRangeField = require("../../../SingleInputDateRangeField/useSingleInputDateRangeField");
15
- var _useDateRangeValidation = require("../validation/useDateRangeValidation");
15
+ var _validateDateRange = require("../../utils/validation/validateDateRange");
16
16
  var _valueManagers = require("../../utils/valueManagers");
17
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -32,6 +32,7 @@ const useMultiInputDateRangeField = ({
32
32
  defaultValue,
33
33
  format,
34
34
  formatDensity,
35
+ shouldRespectLeadingZeros,
35
36
  onChange,
36
37
  disabled,
37
38
  readOnly,
@@ -52,7 +53,7 @@ const useMultiInputDateRangeField = ({
52
53
  const newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
53
54
  setValue(newDateRange);
54
55
  const context = (0, _extends2.default)({}, rawContext, {
55
- validationError: (0, _useDateRangeValidation.validateDateRange)({
56
+ validationError: (0, _validateDateRange.validateDateRange)({
56
57
  adapter,
57
58
  value: newDateRange,
58
59
  props: sharedProps
@@ -65,7 +66,7 @@ const useMultiInputDateRangeField = ({
65
66
  const handleEndDateChange = (0, _useEventCallback.default)(buildChangeHandler(1));
66
67
  const validationError = (0, _internals.useValidation)((0, _extends2.default)({}, sharedProps, {
67
68
  value
68
- }), _useDateRangeValidation.validateDateRange, _valueManagers.rangeValueManager.isSameError, _valueManagers.rangeValueManager.defaultErrorState);
69
+ }), _validateDateRange.validateDateRange, _valueManagers.rangeValueManager.isSameError, _valueManagers.rangeValueManager.defaultErrorState);
69
70
  const startFieldProps = (0, _extends2.default)({
70
71
  error: !!validationError[0]
71
72
  }, startTextFieldProps, {
@@ -73,6 +74,7 @@ const useMultiInputDateRangeField = ({
73
74
  readOnly,
74
75
  format,
75
76
  formatDensity,
77
+ shouldRespectLeadingZeros,
76
78
  unstableFieldRef: unstableStartFieldRef,
77
79
  value: valueProp === undefined ? undefined : valueProp[0],
78
80
  defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
@@ -85,6 +87,7 @@ const useMultiInputDateRangeField = ({
85
87
  }, endTextFieldProps, {
86
88
  format,
87
89
  formatDensity,
90
+ shouldRespectLeadingZeros,
88
91
  disabled,
89
92
  readOnly,
90
93
  unstableFieldRef: unstableEndFieldRef,
@@ -11,7 +11,7 @@ var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallb
11
11
  var _DateTimeField = require("@mui/x-date-pickers/DateTimeField");
12
12
  var _internals = require("@mui/x-date-pickers/internals");
13
13
  var _useControlled = _interopRequireDefault(require("@mui/utils/useControlled"));
14
- var _useDateTimeRangeValidation = require("../validation/useDateTimeRangeValidation");
14
+ var _validateDateTimeRange = require("../../utils/validation/validateDateTimeRange");
15
15
  var _valueManagers = require("../../utils/valueManagers");
16
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
17
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -47,6 +47,7 @@ const useMultiInputDateTimeRangeField = ({
47
47
  value: valueProp,
48
48
  defaultValue,
49
49
  format,
50
+ shouldRespectLeadingZeros,
50
51
  onChange,
51
52
  disabled,
52
53
  readOnly
@@ -65,7 +66,7 @@ const useMultiInputDateTimeRangeField = ({
65
66
  const newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
66
67
  setValue(newDateRange);
67
68
  const context = (0, _extends2.default)({}, rawContext, {
68
- validationError: (0, _useDateTimeRangeValidation.validateDateTimeRange)({
69
+ validationError: (0, _validateDateTimeRange.validateDateTimeRange)({
69
70
  adapter,
70
71
  value: newDateRange,
71
72
  props: sharedProps
@@ -78,11 +79,12 @@ const useMultiInputDateTimeRangeField = ({
78
79
  const handleEndDateChange = (0, _useEventCallback.default)(buildChangeHandler(1));
79
80
  const validationError = (0, _internals.useValidation)((0, _extends2.default)({}, sharedProps, {
80
81
  value
81
- }), _useDateTimeRangeValidation.validateDateTimeRange, _valueManagers.rangeValueManager.isSameError, _valueManagers.rangeValueManager.defaultErrorState);
82
+ }), _validateDateTimeRange.validateDateTimeRange, _valueManagers.rangeValueManager.isSameError, _valueManagers.rangeValueManager.defaultErrorState);
82
83
  const startFieldProps = (0, _extends2.default)({
83
84
  error: !!validationError[0]
84
85
  }, startTextFieldProps, {
85
86
  format,
87
+ shouldRespectLeadingZeros,
86
88
  disabled,
87
89
  readOnly,
88
90
  unstableFieldRef: unstableStartFieldRef,
@@ -94,6 +96,7 @@ const useMultiInputDateTimeRangeField = ({
94
96
  error: !!validationError[1]
95
97
  }, endTextFieldProps, {
96
98
  format,
99
+ shouldRespectLeadingZeros,
97
100
  disabled,
98
101
  readOnly,
99
102
  unstableFieldRef: unstableEndFieldRef,
@@ -11,7 +11,7 @@ var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallb
11
11
  var _TimeField = require("@mui/x-date-pickers/TimeField");
12
12
  var _internals = require("@mui/x-date-pickers/internals");
13
13
  var _useControlled = _interopRequireDefault(require("@mui/utils/useControlled"));
14
- var _useTimeRangeValidation = require("../validation/useTimeRangeValidation");
14
+ var _validateTimeRange = require("../../utils/validation/validateTimeRange");
15
15
  var _valueManagers = require("../../utils/valueManagers");
16
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
17
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -41,6 +41,7 @@ const useMultiInputTimeRangeField = ({
41
41
  value: valueProp,
42
42
  defaultValue,
43
43
  format,
44
+ shouldRespectLeadingZeros,
44
45
  onChange,
45
46
  disabled,
46
47
  readOnly
@@ -59,7 +60,7 @@ const useMultiInputTimeRangeField = ({
59
60
  const newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
60
61
  setValue(newDateRange);
61
62
  const context = (0, _extends2.default)({}, rawContext, {
62
- validationError: (0, _useTimeRangeValidation.validateTimeRange)({
63
+ validationError: (0, _validateTimeRange.validateTimeRange)({
63
64
  adapter,
64
65
  value: newDateRange,
65
66
  props: sharedProps
@@ -72,11 +73,12 @@ const useMultiInputTimeRangeField = ({
72
73
  const handleEndDateChange = (0, _useEventCallback.default)(buildChangeHandler(1));
73
74
  const validationError = (0, _internals.useValidation)((0, _extends2.default)({}, sharedProps, {
74
75
  value
75
- }), _useTimeRangeValidation.validateTimeRange, _valueManagers.rangeValueManager.isSameError, _valueManagers.rangeValueManager.defaultErrorState);
76
+ }), _validateTimeRange.validateTimeRange, _valueManagers.rangeValueManager.isSameError, _valueManagers.rangeValueManager.defaultErrorState);
76
77
  const startFieldProps = (0, _extends2.default)({
77
78
  error: !!validationError[0]
78
79
  }, startTextFieldProps, {
79
80
  format,
81
+ shouldRespectLeadingZeros,
80
82
  disabled,
81
83
  readOnly,
82
84
  unstableFieldRef: unstableStartFieldRef,
@@ -88,6 +90,7 @@ const useMultiInputTimeRangeField = ({
88
90
  error: !!validationError[1]
89
91
  }, endTextFieldProps, {
90
92
  format,
93
+ shouldRespectLeadingZeros,
91
94
  disabled,
92
95
  readOnly,
93
96
  unstableFieldRef: unstableEndFieldRef,
@@ -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 = "MTY4MTkzMDgwMDAwMA==";
9
+ const releaseInfo = "MTY4MzIzNzYwMDAwMA==";
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
@@ -8,7 +8,7 @@ exports.validateDateRange = 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");
11
- var _dateUtils = require("../../utils/date-utils");
11
+ var _dateUtils = require("../date-utils");
12
12
  const _excluded = ["shouldDisableDate"];
13
13
  const validateDateRange = ({
14
14
  props,
@@ -4,12 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.validateDateTimeRange = exports.useDateRangeValidation = void 0;
7
+ exports.validateDateTimeRange = 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");
11
- var _dateUtils = require("../../utils/date-utils");
12
- var _valueManagers = require("../../utils/valueManagers");
11
+ var _dateUtils = require("../date-utils");
13
12
  const _excluded = ["shouldDisableDate"];
14
13
  const validateDateTimeRange = ({
15
14
  props,
@@ -47,8 +46,4 @@ const validateDateTimeRange = ({
47
46
  }
48
47
  return [null, null];
49
48
  };
50
- exports.validateDateTimeRange = validateDateTimeRange;
51
- const useDateRangeValidation = props => {
52
- return (0, _internals.useValidation)(props, validateDateTimeRange, _valueManagers.rangeValueManager.isSameError, _valueManagers.rangeValueManager.defaultErrorState);
53
- };
54
- exports.useDateRangeValidation = useDateRangeValidation;
49
+ exports.validateDateTimeRange = validateDateTimeRange;
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.validateTimeRange = exports.useDateRangeValidation = void 0;
6
+ exports.validateTimeRange = void 0;
7
7
  var _internals = require("@mui/x-date-pickers/internals");
8
- var _dateUtils = require("../../utils/date-utils");
9
- var _valueManagers = require("../../utils/valueManagers");
8
+ var _dateUtils = require("../date-utils");
10
9
  const validateTimeRange = ({
11
10
  props,
12
11
  value,
@@ -35,8 +34,4 @@ const validateTimeRange = ({
35
34
  }
36
35
  return [null, null];
37
36
  };
38
- exports.validateTimeRange = validateTimeRange;
39
- const useDateRangeValidation = props => {
40
- return (0, _internals.useValidation)(props, validateTimeRange, _valueManagers.rangeValueManager.isSameError, _valueManagers.rangeValueManager.defaultErrorState);
41
- };
42
- exports.useDateRangeValidation = useDateRangeValidation;
37
+ exports.validateTimeRange = validateTimeRange;
@@ -48,7 +48,7 @@ const rangeFieldValueManager = {
48
48
  if (sectionIndex === sections.length - 1 && position === 'start') {
49
49
  return (0, _extends2.default)({}, section, {
50
50
  dateName: position,
51
- endSeparator: `${section.endSeparator}\u2069 – \u2066`
51
+ endSeparator: `${section.endSeparator}${isRTL ? '\u2069 – \u2066' : ' – '}`
52
52
  });
53
53
  }
54
54
  return (0, _extends2.default)({}, section, {
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _validation = require("./validation");
7
+ Object.keys(_validation).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _validation[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _validation[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-date-pickers-pro",
3
- "version": "6.2.1",
3
+ "version": "6.3.1",
4
4
  "description": "The commercial edition of the date picker components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -31,11 +31,8 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.21.0",
34
- "@date-io/date-fns": "^2.16.0",
35
- "@date-io/luxon": "^2.16.1",
36
- "@date-io/moment": "^2.16.1",
37
- "@mui/utils": "^5.11.13",
38
- "@mui/x-date-pickers": "6.2.1",
34
+ "@mui/utils": "^5.12.3",
35
+ "@mui/x-date-pickers": "6.3.1",
39
36
  "@mui/x-license-pro": "6.0.4",
40
37
  "clsx": "^1.2.1",
41
38
  "prop-types": "^15.8.1",
@@ -53,7 +50,7 @@
53
50
  "luxon": "^3.0.2",
54
51
  "moment": "^2.29.4",
55
52
  "moment-hijri": "^2.1.2",
56
- "moment-jalaali": "^0.7.4 || ^0.8.0 || ^0.9.0",
53
+ "moment-jalaali": "^0.7.4 || ^0.8.0 || ^0.9.0 || ^0.10.0",
57
54
  "react": "^17.0.2 || ^18.0.0",
58
55
  "react-dom": "^17.0.2 || ^18.0.0"
59
56
  },
@@ -1,14 +0,0 @@
1
- import { Validator, BaseDateValidationProps, TimeValidationProps, ValidationProps } from '@mui/x-date-pickers/internals';
2
- import { DateTimeValidationError } from '@mui/x-date-pickers/models';
3
- import { DayRangeValidationProps } from '../../models/dateRange';
4
- import { DateRange } from '../../models/range';
5
- export interface DateTimeRangeComponentValidationProps<TDate> extends DayRangeValidationProps<TDate>, TimeValidationProps<TDate>, Required<BaseDateValidationProps<TDate>> {
6
- }
7
- export declare const validateDateTimeRange: Validator<DateRange<any>, any, DateTimeRangeValidationError, DateTimeRangeComponentValidationProps<any>>;
8
- type DateTimeRangeValidationErrorValue = DateTimeValidationError | 'invalidRange' | null;
9
- export type DateTimeRangeValidationError = [
10
- DateTimeRangeValidationErrorValue,
11
- DateTimeRangeValidationErrorValue
12
- ];
13
- export declare const useDateRangeValidation: <TDate>(props: ValidationProps<DateTimeRangeValidationError, DateRange<TDate>, DateTimeRangeComponentValidationProps<TDate>>) => DateTimeRangeValidationError;
14
- export {};
@@ -1,13 +0,0 @@
1
- import { Validator, BaseTimeValidationProps, ValidationProps } from '@mui/x-date-pickers/internals';
2
- import { TimeValidationError } from '@mui/x-date-pickers/models';
3
- import { DateRange } from '../../models/range';
4
- export interface TimeRangeComponentValidationProps extends Required<BaseTimeValidationProps> {
5
- }
6
- export declare const validateTimeRange: Validator<DateRange<any>, any, TimeRangeValidationError, TimeRangeComponentValidationProps>;
7
- type TimeRangeValidationErrorValue = TimeValidationError | 'invalidRange' | null;
8
- export type TimeRangeValidationError = [
9
- TimeRangeValidationErrorValue,
10
- TimeRangeValidationErrorValue
11
- ];
12
- export declare const useDateRangeValidation: <TDate>(props: ValidationProps<TimeRangeValidationError, DateRange<TDate>, TimeRangeComponentValidationProps>) => TimeRangeValidationError;
13
- export {};