@mui/x-date-pickers-pro 6.2.0 → 6.3.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 (130) hide show
  1. package/CHANGELOG.md +118 -1
  2. package/DateRangePicker/shared.d.ts +1 -1
  3. package/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
  4. package/MobileDateRangePicker/MobileDateRangePicker.js +2 -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 +20 -3
  10. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
  11. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -3
  12. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
  13. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +21 -3
  14. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +4 -2
  15. package/StaticDateRangePicker/StaticDateRangePicker.js +2 -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.js +9 -9
  21. package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +5 -5
  22. package/internal/hooks/useEnrichedRangePickerFieldProps.d.ts +4 -3
  23. package/internal/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -2
  24. package/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -9
  25. package/internal/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +5 -5
  26. package/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +4 -1
  27. package/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +4 -1
  28. package/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +4 -1
  29. package/internal/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -2
  30. package/internal/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -10
  31. package/internal/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +5 -5
  32. package/internal/models/dateRange.d.ts +1 -1
  33. package/internal/models/dateTimeRange.d.ts +1 -1
  34. package/internal/models/timeRange.d.ts +1 -1
  35. package/internal/utils/date-fields-utils.d.ts +4 -1
  36. package/internal/utils/releaseInfo.js +1 -1
  37. package/internal/{hooks/validation/useDateRangeValidation.d.ts → utils/validation/validateDateRange.d.ts} +1 -7
  38. package/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
  39. package/internal/utils/validation/validateDateTimeRange.d.ts +7 -0
  40. package/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +2 -6
  41. package/internal/utils/validation/validateTimeRange.d.ts +6 -0
  42. package/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +2 -6
  43. package/internal/utils/valueManagers.d.ts +1 -3
  44. package/internal/utils/valueManagers.js +1 -1
  45. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
  46. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
  47. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
  48. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
  49. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
  50. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +20 -3
  51. package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
  52. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -3
  53. package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
  54. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +21 -3
  55. package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +4 -2
  56. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
  57. package/legacy/index.js +3 -2
  58. package/legacy/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +5 -6
  59. package/legacy/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +5 -6
  60. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +4 -1
  61. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +4 -1
  62. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +4 -1
  63. package/legacy/internal/hooks/useStaticRangePicker/useStaticRangePicker.js +6 -7
  64. package/legacy/internal/utils/releaseInfo.js +1 -1
  65. package/legacy/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
  66. package/legacy/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +2 -6
  67. package/legacy/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +2 -6
  68. package/legacy/internal/utils/valueManagers.js +2 -2
  69. package/legacy/models/index.js +1 -0
  70. package/legacy/models/validation.js +1 -0
  71. package/models/index.d.ts +1 -0
  72. package/models/index.js +1 -0
  73. package/models/package.json +6 -0
  74. package/models/validation.d.ts +9 -0
  75. package/models/validation.js +1 -0
  76. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
  77. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
  78. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
  79. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
  80. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
  81. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +20 -3
  82. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
  83. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -3
  84. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
  85. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +21 -3
  86. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +4 -2
  87. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
  88. package/modern/index.js +3 -2
  89. package/modern/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +9 -9
  90. package/modern/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -9
  91. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +4 -1
  92. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +4 -1
  93. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +4 -1
  94. package/modern/internal/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -10
  95. package/modern/internal/utils/releaseInfo.js +1 -1
  96. package/modern/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
  97. package/modern/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +2 -6
  98. package/modern/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +2 -6
  99. package/modern/internal/utils/valueManagers.js +1 -1
  100. package/modern/models/index.js +1 -0
  101. package/modern/models/validation.js +1 -0
  102. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +3 -2
  103. package/node/MobileDateRangePicker/MobileDateRangePicker.js +3 -2
  104. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
  105. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
  106. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
  107. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +20 -3
  108. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +5 -3
  109. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -3
  110. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +5 -3
  111. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +21 -3
  112. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +5 -3
  113. package/node/StaticDateRangePicker/StaticDateRangePicker.js +3 -2
  114. package/node/index.js +13 -1
  115. package/node/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +9 -9
  116. package/node/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -9
  117. package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +6 -3
  118. package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +6 -3
  119. package/node/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +6 -3
  120. package/node/internal/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -10
  121. package/node/internal/utils/releaseInfo.js +1 -1
  122. package/node/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
  123. package/node/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +3 -8
  124. package/node/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +3 -8
  125. package/node/internal/utils/valueManagers.js +1 -1
  126. package/node/models/index.js +16 -0
  127. package/node/models/validation.js +5 -0
  128. package/package.json +4 -7
  129. package/internal/hooks/validation/useDateTimeRangeValidation.d.ts +0 -14
  130. package/internal/hooks/validation/useTimeRangeValidation.d.ts +0 -13
package/CHANGELOG.md CHANGED
@@ -3,9 +3,126 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.3.0
7
+
8
+ _Apr 28, 2023_
9
+
10
+ We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🚀 New [time-picking UI](https://mui.com/x/react-date-pickers/digital-clock/) designed for desktops (#7958) @LukasTy
13
+
14
+ <img src="https://user-images.githubusercontent.com/4941090/235072007-de39a397-e4a4-4c98-8e10-5ee4ad440108.gif" width="494" />
15
+
16
+ - ✨ Picker fields [now always include a leading zero](https://mui.com/x/react-date-pickers/adapters-locale/#respect-leading-zeros-in-fields) on digit sections (#8527) @flaviendelangle
17
+ - 🌍 Improve Chinese (zh-CN), French (fr-FR), and Turkish (tr-TR) locales
18
+ - 🐞 Bugfixes
19
+ - 📚 Documentation improvements
20
+
21
+ ### `@mui/x-data-grid@v6.3.0` / `@mui/x-data-grid-pro@v6.3.0` / `@mui/x-data-grid-premium@v6.3.0`
22
+
23
+ #### Changes
24
+
25
+ - [DataGrid] Add overlay classes to `gridClasses` (#8686) @lindapaiste
26
+ - [DataGrid] Avoid passing `api` prop to div (#8679) @someden
27
+ - [DataGrid] Fix 'ResizeObserver loop limit exceeded' error (#8744) @m4theushw
28
+ - [DataGrid] Add Joy UI slots (button and switch) (#8699) @siriwatknp
29
+ - [DataGrid] Fix aggregation label alignment (#8694) @joserodolfofreitas
30
+ - [DataGridPremium] Fix infinite loop when updating grouped rows (#8693) @cherniavskii
31
+ - [DataGridPro] Fix error after updating `columns` and `columnGroupingModel` at once (#8730) @cherniavskii
32
+ - [l10n] Improve Chinese (zh-CN) locale (#8753) @SakumyZ
33
+ - [l10n] Improve French (fr-FR) locale (#8704) @Jul13nT
34
+ - [l10n] Improve Turkish (tr-TR) locale (#8783) @cccaaannn
35
+
36
+ ### `@mui/x-date-pickers@v6.3.0` / `@mui/x-date-pickers-pro@v6.3.0`
37
+
38
+ #### Changes
39
+
40
+ - [fields] Always add leading zeroes on digit sections (#8527) @flaviendelangle
41
+ - [fields] Pass the `readOnly` prop to `InputProps` instead of `inputProps` (#8659) @flaviendelangle
42
+ - [pickers] Add missing export for `caES` locale (#8782) @flaviendelangle
43
+ - [pickers] Add new `DigitalClock` desktop time picking experience (#7958) @LukasTy
44
+ - [pickers] Do not use `instanceOf DateTime` in `AdapterLuxon` (#8734) @flaviendelangle
45
+ - [pickers] Fix date calendar `selected` & `disabled` day style (#8773) @LukasTy
46
+ - [pickers] Migrate `AdapterDateFns` to our repository (#8736) @flaviendelangle
47
+ - [pickers] Migrate `AdapterLuxon` to our repository (#8600) @flaviendelangle
48
+ - [pickers] Migrate `AdapterMomentHijri` to our repository (#8776) @flaviendelangle
49
+ - [pickers] Migrate `AdapterMomentJalaali` and `AdapterDateFnsJalali` to our repository (#8741) @flaviendelangle
50
+ - [pickers] Migrate `AdapterMoment` to our repository (#8700) @flaviendelangle
51
+ - [pickers] Refactor the validation files (#8622) @flaviendelangle
52
+ - [pickers] Use `en dash` instead of `em dash` in multi input range fields (#8738) @flaviendelangle
53
+ - [l10n] Improve Chinese (zh-CN) locale (#8753) @SakumyZ
54
+ - [l10n] Improve Turkish (tr-TR) locale (#8783) @cccaaannn
55
+
56
+ ### Docs
57
+
58
+ - [docs] Add icons for charts menu (#8752) @alexfauquette
59
+ - [docs] Document the supported formats (#8746) @flaviendelangle
60
+ - [docs] Fix Hijri demo (#8698) @alexfauquette
61
+ - [docs] Fix `x-codemod` package version in changelog (#8690) @MBilalShafi
62
+ - [docs] Fix columns special properties code example (#8414) @mikkelhl
63
+ - [docs] Fix error in `minDateTime` `validation` page section (#8777) @LukasTy
64
+ - [docs] Update custom field pickers using theme scoping (#8609) @siriwatknp
65
+ - [docs] Use community version of data grid for column grouping demo (#7346) @ASchwad
66
+ - [docs] Use new `slots` / `slotProps` props in the pickers migration guide (#8341) @flaviendelangle
67
+
68
+ ### Core
69
+
70
+ - [core] Cleanup picker tests (#8652) @flaviendelangle
71
+ - [core] Use `adapter.lib` instead of `adapterName` in `describeAdapters` (#8779) @flaviendelangle
72
+ - [charts] Adapt line and scatter plot to the "band" scale type (#8701) @alexfauquette
73
+ - [charts] Link the Gantt Charts issue in the docs (#8739) @flaviendelangle
74
+
75
+ ## 6.2.1
76
+
77
+ _Apr 20, 2023_
78
+
79
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
80
+
81
+ - 🚀 Add virtualization to row detail panels (#7969) @yaredtsy
82
+ - 🐞 Bugfixes
83
+ - 📚 Documentation improvements
84
+
85
+ ### `@mui/x-data-grid@v6.2.1` / `@mui/x-data-grid-pro@v6.2.1` / `@mui/x-data-grid-premium@v6.2.1`
86
+
87
+ #### Changes
88
+
89
+ - [DataGrid] Add `getTogglableColumns` to `Hide all` and `Show all` actions (#8496) @MBilalShafi
90
+ - [DataGrid] Add Grid + Joy UI experiment page (#8067) @cherniavskii
91
+ - [DataGrid] Fix print style when rendering inside Shadow DOM (#8656) @Bwatermelon
92
+ - [DataGrid] Replace `GridAutoSizer` with `ResizeObserver` (#8091) @m4theushw
93
+ - [DataGrid] Use stable ID for the placeholder filter item (#8603) @m4theushw
94
+ - [DataGridPro] Virtualize row detail panels (#7969) @yaredtsy
95
+
96
+ ### `@mui/x-date-pickers@v6.2.1` / `@mui/x-date-pickers-pro@v6.2.1`
97
+
98
+ #### Changes
99
+
100
+ - [pickers] Do not include the time in date components when going to today (#8657) @flaviendelangle
101
+ - [pickers] Sync internal state with controlled value (#8674) @alexfauquette
102
+
103
+ ### `@mui/x-codemod@v6.2.1`
104
+
105
+ #### Changes
106
+
107
+ - [codemod] Avoid filter failures on object prototype properties (#8647) @LukasTy
108
+
109
+ ### Docs
110
+
111
+ - [docs] Add no-op service worker to fix stale cache issue (#8598) @cherniavskii
112
+ - [docs] Clarify what `AdapterDayjs` is in the Getting Started page (#8219) @flaviendelangle
113
+ - [docs] Fix typo on picker page description (#8611) @maxolasersquad
114
+ - [docs] Improve section title in Getting Started page (#8648) @flaviendelangle
115
+ - [docs] Inform about input format modification (#8458) @alexfauquette
116
+
117
+ ### Core
118
+
119
+ - [core] Fix release date (#8618) @flaviendelangle
120
+ - [core] Upgrade monorepo (#8668) @MBilalShafi
121
+ - [charts] Support Tooltip (#8356) @alexfauquette
122
+
6
123
  ## 6.2.0
7
124
 
8
- _Apr 13, 2023_
125
+ _Apr 14, 2023_
9
126
 
10
127
  We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
11
128
 
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { LocalizedComponent } from '@mui/x-date-pickers/locales';
3
3
  import { DefaultizedProps, BaseDateValidationProps, BasePickerInputProps, PickerViewRendererLookup, UncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
4
- import { DateRangeValidationError } from '../internal/hooks/validation/useDateRangeValidation';
4
+ import { DateRangeValidationError } from '../models';
5
5
  import { DateRange } from '../internal/models';
6
6
  import { DateRangeCalendarSlotsComponent, DateRangeCalendarSlotsComponentsProps, ExportedDateRangeCalendarProps } from '../DateRangeCalendar';
7
7
  import { DateRangePickerToolbarProps, ExportedDateRangePickerToolbarProps } from './DateRangePickerToolbar';
@@ -8,7 +8,7 @@ import { useDateRangePickerDefaultizedProps } from '../DateRangePicker/shared';
8
8
  import { renderDateRangeViewCalendar } from '../dateRangeViewRenderers';
9
9
  import { MultiInputDateRangeField } from '../MultiInputDateRangeField';
10
10
  import { useDesktopRangePicker } from '../internal/hooks/useDesktopRangePicker';
11
- import { validateDateRange } from '../internal/hooks/validation/useDateRangeValidation';
11
+ import { validateDateRange } from '../internal/utils/validation/validateDateRange';
12
12
  const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateRangePicker(inProps, ref) {
13
13
  var _defaultizedProps$cal, _defaultizedProps$slo2;
14
14
  // Props with the default values common to all date time pickers
@@ -41,6 +41,7 @@ const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDat
41
41
  } = useDesktopRangePicker({
42
42
  props,
43
43
  valueManager: rangeValueManager,
44
+ valueType: 'date',
44
45
  validator: validateDateRange
45
46
  });
46
47
  return renderPicker();
@@ -10,7 +10,7 @@ import { useDateRangePickerDefaultizedProps } from '../DateRangePicker/shared';
10
10
  import { renderDateRangeViewCalendar } from '../dateRangeViewRenderers';
11
11
  import { MultiInputDateRangeField } from '../MultiInputDateRangeField';
12
12
  import { useMobileRangePicker } from '../internal/hooks/useMobileRangePicker';
13
- import { validateDateRange } from '../internal/hooks/validation/useDateRangeValidation';
13
+ import { validateDateRange } from '../internal/utils/validation/validateDateRange';
14
14
  const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateRangePicker(inProps, ref) {
15
15
  var _defaultizedProps$slo2;
16
16
  // Props with the default values common to all date time pickers
@@ -44,6 +44,7 @@ const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateR
44
44
  } = useMobileRangePicker({
45
45
  props,
46
46
  valueManager: rangeValueManager,
47
+ valueType: 'date',
47
48
  validator: validateDateRange
48
49
  });
49
50
  return renderPicker();
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "autoFocus"],
3
+ const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "autoFocus"],
4
4
  _excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
5
5
  _excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
6
6
  import * as React from 'react';
@@ -27,7 +27,7 @@ const MultiInputDateRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((prop
27
27
  const MultiInputDateRangeFieldSeparator = styled(props => {
28
28
  var _props$children;
29
29
  return /*#__PURE__*/_jsx(Typography, _extends({}, props, {
30
- children: (_props$children = props.children) != null ? _props$children : ' '
30
+ children: (_props$children = props.children) != null ? _props$children : ' '
31
31
  }));
32
32
  }, {
33
33
  name: 'MuiMultiInputDateRangeField',
@@ -49,6 +49,7 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
49
49
  defaultValue,
50
50
  format,
51
51
  formatDensity,
52
+ shouldRespectLeadingZeros,
52
53
  onChange,
53
54
  readOnly,
54
55
  disabled,
@@ -106,6 +107,7 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
106
107
  defaultValue,
107
108
  format,
108
109
  formatDensity,
110
+ shouldRespectLeadingZeros,
109
111
  onChange,
110
112
  readOnly,
111
113
  disabled,
@@ -143,15 +145,20 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
143
145
  children: [/*#__PURE__*/_jsx(TextField, _extends({
144
146
  fullWidth: true
145
147
  }, startDateProps, {
148
+ InputProps: _extends({}, startDateProps.InputProps, {
149
+ readOnly: startReadOnly
150
+ }),
146
151
  inputProps: _extends({}, startDateProps.inputProps, {
147
152
  ref: startInputRef,
148
- readOnly: startReadOnly,
149
153
  inputMode: startInputMode,
150
154
  onKeyDown: onStartInputKeyDown
151
155
  })
152
156
  })), /*#__PURE__*/_jsx(Separator, _extends({}, separatorProps)), /*#__PURE__*/_jsx(TextField, _extends({
153
157
  fullWidth: true
154
158
  }, endDateProps, {
159
+ InputProps: _extends({}, endDateProps.InputProps, {
160
+ readOnly: endReadOnly
161
+ }),
155
162
  inputProps: _extends({}, endDateProps.inputProps, {
156
163
  ref: endInputRef,
157
164
  readOnly: endReadOnly,
@@ -275,6 +282,21 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
275
282
  * @returns {boolean} Returns `true` if the date should be disabled.
276
283
  */
277
284
  shouldDisableDate: PropTypes.func,
285
+ /**
286
+ * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
287
+ * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
288
+ *
289
+ * 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`.
290
+ *
291
+ * 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.
292
+ * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
293
+ *
294
+ * Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
295
+ * 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.
296
+ *
297
+ * @default `false`
298
+ */
299
+ shouldRespectLeadingZeros: PropTypes.bool,
278
300
  /**
279
301
  * The props used for each component slot.
280
302
  * @default {}
@@ -300,7 +322,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
300
322
  /**
301
323
  * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
302
324
  *
303
- * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
325
+ * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
304
326
  * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
305
327
  *
306
328
  * To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableStartFieldRef", "unstableEndFieldRef", "autoFocus"],
3
+ const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableStartFieldRef", "unstableEndFieldRef", "autoFocus"],
4
4
  _excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
5
5
  _excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
6
6
  import * as React from 'react';
@@ -27,7 +27,7 @@ const MultiInputDateTimeRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((
27
27
  const MultiInputDateTimeRangeFieldSeparator = styled(props => {
28
28
  var _props$children;
29
29
  return /*#__PURE__*/_jsx(Typography, _extends({}, props, {
30
- children: (_props$children = props.children) != null ? _props$children : ' '
30
+ children: (_props$children = props.children) != null ? _props$children : ' '
31
31
  }));
32
32
  }, {
33
33
  name: 'MuiMultiInputDateTimeRangeField',
@@ -49,6 +49,7 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
49
49
  defaultValue,
50
50
  format,
51
51
  formatDensity,
52
+ shouldRespectLeadingZeros,
52
53
  onChange,
53
54
  readOnly,
54
55
  disabled,
@@ -115,6 +116,7 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
115
116
  defaultValue,
116
117
  format,
117
118
  formatDensity,
119
+ shouldRespectLeadingZeros,
118
120
  onChange,
119
121
  readOnly,
120
122
  disabled,
@@ -161,15 +163,20 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
161
163
  children: [/*#__PURE__*/_jsx(TextField, _extends({
162
164
  fullWidth: true
163
165
  }, startDateProps, {
166
+ InputProps: _extends({}, startDateProps.InputProps, {
167
+ readOnly: startReadOnly
168
+ }),
164
169
  inputProps: _extends({}, startDateProps.inputProps, {
165
170
  ref: startInputRef,
166
- readOnly: startReadOnly,
167
171
  inputMode: startInputMode,
168
172
  onKeyDown: onStartInputKeyDown
169
173
  })
170
174
  })), /*#__PURE__*/_jsx(Separator, _extends({}, separatorProps)), /*#__PURE__*/_jsx(TextField, _extends({
171
175
  fullWidth: true
172
176
  }, endDateProps, {
177
+ InputProps: _extends({}, endDateProps.InputProps, {
178
+ readOnly: endReadOnly
179
+ }),
173
180
  inputProps: _extends({}, endDateProps.inputProps, {
174
181
  ref: endInputRef,
175
182
  readOnly: endReadOnly,
@@ -336,11 +343,27 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
336
343
  shouldDisableDate: PropTypes.func,
337
344
  /**
338
345
  * Disable specific time.
346
+ * @template TDate
339
347
  * @param {TDate} value The value to check.
340
348
  * @param {TimeView} view The clock type of the timeValue.
341
349
  * @returns {boolean} If `true` the time will be disabled.
342
350
  */
343
351
  shouldDisableTime: PropTypes.func,
352
+ /**
353
+ * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
354
+ * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
355
+ *
356
+ * 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`.
357
+ *
358
+ * 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.
359
+ * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
360
+ *
361
+ * Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
362
+ * 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.
363
+ *
364
+ * @default `false`
365
+ */
366
+ shouldRespectLeadingZeros: PropTypes.bool,
344
367
  /**
345
368
  * The props used for each component slot.
346
369
  * @default {}
@@ -366,7 +389,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
366
389
  /**
367
390
  * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
368
391
  *
369
- * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
392
+ * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
370
393
  * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
371
394
  *
372
395
  * To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "disabled", "onError", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableStartFieldRef", "unstableEndFieldRef", "autoFocus"],
3
+ const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "disabled", "onError", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableStartFieldRef", "unstableEndFieldRef", "autoFocus"],
4
4
  _excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
5
5
  _excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
6
6
  import * as React from 'react';
@@ -27,7 +27,7 @@ const MultiInputTimeRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((prop
27
27
  const MultiInputTimeRangeFieldSeparator = styled(props => {
28
28
  var _props$children;
29
29
  return /*#__PURE__*/_jsx(Typography, _extends({}, props, {
30
- children: (_props$children = props.children) != null ? _props$children : ' '
30
+ children: (_props$children = props.children) != null ? _props$children : ' '
31
31
  }));
32
32
  }, {
33
33
  name: 'MuiMultiInputTimeRangeField',
@@ -49,6 +49,7 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
49
49
  defaultValue,
50
50
  format,
51
51
  formatDensity,
52
+ shouldRespectLeadingZeros,
52
53
  onChange,
53
54
  readOnly,
54
55
  disabled,
@@ -110,6 +111,7 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
110
111
  defaultValue,
111
112
  format,
112
113
  formatDensity,
114
+ shouldRespectLeadingZeros,
113
115
  onChange,
114
116
  readOnly,
115
117
  disabled,
@@ -151,15 +153,20 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
151
153
  children: [/*#__PURE__*/_jsx(TextField, _extends({
152
154
  fullWidth: true
153
155
  }, startDateProps, {
156
+ InputProps: _extends({}, startDateProps.InputProps, {
157
+ readOnly: startReadOnly
158
+ }),
154
159
  inputProps: _extends({}, startDateProps.inputProps, {
155
160
  ref: startInputRef,
156
- readOnly: startReadOnly,
157
161
  inputMode: startInputMode,
158
162
  onKeyDown: onStartInputKeyDown
159
163
  })
160
164
  })), /*#__PURE__*/_jsx(Separator, _extends({}, separatorProps)), /*#__PURE__*/_jsx(TextField, _extends({
161
165
  fullWidth: true
162
166
  }, endDateProps, {
167
+ InputProps: _extends({}, endDateProps.InputProps, {
168
+ readOnly: endReadOnly
169
+ }),
163
170
  inputProps: _extends({}, endDateProps.inputProps, {
164
171
  ref: endInputRef,
165
172
  readOnly: endReadOnly,
@@ -302,11 +309,27 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
302
309
  shouldDisableClock: PropTypes.func,
303
310
  /**
304
311
  * Disable specific time.
312
+ * @template TDate
305
313
  * @param {TDate} value The value to check.
306
314
  * @param {TimeView} view The clock type of the timeValue.
307
315
  * @returns {boolean} If `true` the time will be disabled.
308
316
  */
309
317
  shouldDisableTime: PropTypes.func,
318
+ /**
319
+ * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
320
+ * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
321
+ *
322
+ * 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`.
323
+ *
324
+ * 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.
325
+ * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
326
+ *
327
+ * Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
328
+ * 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.
329
+ *
330
+ * @default `false`
331
+ */
332
+ shouldRespectLeadingZeros: PropTypes.bool,
310
333
  /**
311
334
  * The props used for each component slot.
312
335
  * @default {}
@@ -332,7 +355,7 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
332
355
  /**
333
356
  * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
334
357
  *
335
- * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack#limitations),
358
+ * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
336
359
  * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
337
360
  *
338
361
  * To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
package/README.md CHANGED
@@ -42,15 +42,6 @@ This component has the following peer dependencies that you will need to install
42
42
  },
43
43
  ```
44
44
 
45
- If you need to use `js-joda`, `date-fns-jalali`, `jalaali`, or `hijri` library, you should be able to find the corresponding date-library from [`@date-io`](https://github.com/dmtrKovalenko/date-io#projects).
46
- In such a case, you will have to install both the date-library and the corresponding @date-io adapter.
47
-
48
- ```jsx
49
- // To use moment-jalaali
50
- npm install moment-jalaali
51
- npm install @date-io/jalaali
52
- ```
53
-
54
45
  After installation completed, you have to set the `dateAdapter` prop of the `LocalizationProvider` accordingly.
55
46
  The supported adapters are exported from `@mui/x-date-pickers-pro`.
56
47
 
@@ -55,11 +55,13 @@ const SingleInputDateRangeField = /*#__PURE__*/React.forwardRef(function SingleI
55
55
  return /*#__PURE__*/_jsx(TextField, _extends({
56
56
  ref: ref
57
57
  }, fieldProps, {
58
+ InputProps: _extends({}, fieldProps.InputProps, {
59
+ readOnly
60
+ }),
58
61
  inputProps: _extends({}, fieldProps.inputProps, {
59
- ref: inputRef,
60
- onPaste,
61
62
  inputMode,
62
- readOnly
63
+ onPaste,
64
+ ref: inputRef
63
65
  })
64
66
  }));
65
67
  });
@@ -250,6 +252,21 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
250
252
  * @returns {boolean} Returns `true` if the date should be disabled.
251
253
  */
252
254
  shouldDisableDate: PropTypes.func,
255
+ /**
256
+ * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
257
+ * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
258
+ *
259
+ * 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`.
260
+ *
261
+ * 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.
262
+ * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
263
+ *
264
+ * Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
265
+ * 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.
266
+ *
267
+ * @default `false`
268
+ */
269
+ shouldRespectLeadingZeros: PropTypes.bool,
253
270
  /**
254
271
  * The size of the component.
255
272
  */
@@ -1,9 +1,9 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
3
+ const _excluded = ["value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
4
4
  import { useUtils, useDefaultDates, applyDefaultDate, useField } from '@mui/x-date-pickers/internals';
5
5
  import { rangeValueManager, rangeFieldValueManager } from '../internal/utils/valueManagers';
6
- import { validateDateRange } from '../internal/hooks/validation/useDateRangeValidation';
6
+ import { validateDateRange } from '../internal/utils/validation/validateDateRange';
7
7
  export const useDefaultizedDateRangeFieldProps = props => {
8
8
  var _props$disablePast, _props$disableFuture, _props$format;
9
9
  const utils = useUtils();
@@ -26,6 +26,7 @@ export const useSingleInputDateRangeField = ({
26
26
  defaultValue,
27
27
  format,
28
28
  formatDensity,
29
+ shouldRespectLeadingZeros,
29
30
  onChange,
30
31
  readOnly,
31
32
  onError,
@@ -47,6 +48,7 @@ export const useSingleInputDateRangeField = ({
47
48
  defaultValue,
48
49
  format,
49
50
  formatDensity,
51
+ shouldRespectLeadingZeros,
50
52
  onChange,
51
53
  readOnly,
52
54
  onError,
@@ -55,11 +55,13 @@ const SingleInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Sin
55
55
  return /*#__PURE__*/_jsx(TextField, _extends({
56
56
  ref: ref
57
57
  }, fieldProps, {
58
+ InputProps: _extends({}, fieldProps.InputProps, {
59
+ readOnly
60
+ }),
58
61
  inputProps: _extends({}, fieldProps.inputProps, {
59
- ref: inputRef,
60
- onPaste,
61
62
  inputMode,
62
- readOnly
63
+ onPaste,
64
+ ref: inputRef
63
65
  })
64
66
  }));
65
67
  });
@@ -293,11 +295,27 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
293
295
  shouldDisableDate: PropTypes.func,
294
296
  /**
295
297
  * Disable specific time.
298
+ * @template TDate
296
299
  * @param {TDate} value The value to check.
297
300
  * @param {TimeView} view The clock type of the timeValue.
298
301
  * @returns {boolean} If `true` the time will be disabled.
299
302
  */
300
303
  shouldDisableTime: PropTypes.func,
304
+ /**
305
+ * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
306
+ * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
307
+ *
308
+ * 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`.
309
+ *
310
+ * 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.
311
+ * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
312
+ *
313
+ * Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
314
+ * 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.
315
+ *
316
+ * @default `false`
317
+ */
318
+ shouldRespectLeadingZeros: PropTypes.bool,
301
319
  /**
302
320
  * The size of the component.
303
321
  */
@@ -1,9 +1,9 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
3
+ 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"];
4
4
  import { useUtils, useField, applyDefaultDate, useDefaultDates } from '@mui/x-date-pickers/internals';
5
5
  import { rangeValueManager, rangeFieldValueManager } from '../internal/utils/valueManagers';
6
- import { validateDateTimeRange } from '../internal/hooks/validation/useDateTimeRangeValidation';
6
+ import { validateDateTimeRange } from '../internal/utils/validation/validateDateTimeRange';
7
7
  export const useDefaultizedTimeRangeFieldProps = props => {
8
8
  var _props$ampm, _props$disablePast, _props$disableFuture, _props$format, _props$minDateTime, _props$maxDateTime, _props$minDateTime2, _props$maxDateTime2;
9
9
  const utils = useUtils();
@@ -31,6 +31,7 @@ export const useSingleInputDateTimeRangeField = ({
31
31
  defaultValue,
32
32
  format,
33
33
  formatDensity,
34
+ shouldRespectLeadingZeros,
34
35
  onChange,
35
36
  readOnly,
36
37
  onError,
@@ -57,6 +58,7 @@ export const useSingleInputDateTimeRangeField = ({
57
58
  defaultValue,
58
59
  format,
59
60
  formatDensity,
61
+ shouldRespectLeadingZeros,
60
62
  onChange,
61
63
  readOnly,
62
64
  onError,
@@ -55,11 +55,13 @@ const SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleI
55
55
  return /*#__PURE__*/_jsx(TextField, _extends({
56
56
  ref: ref
57
57
  }, fieldProps, {
58
+ InputProps: _extends({}, fieldProps.InputProps, {
59
+ readOnly
60
+ }),
58
61
  inputProps: _extends({}, fieldProps.inputProps, {
59
- ref: inputRef,
60
- onPaste,
61
62
  inputMode,
62
- readOnly
63
+ onPaste,
64
+ ref: inputRef
63
65
  })
64
66
  }));
65
67
  });
@@ -269,11 +271,27 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
269
271
  shouldDisableClock: PropTypes.func,
270
272
  /**
271
273
  * Disable specific time.
274
+ * @template TDate
272
275
  * @param {TDate} value The value to check.
273
276
  * @param {TimeView} view The clock type of the timeValue.
274
277
  * @returns {boolean} If `true` the time will be disabled.
275
278
  */
276
279
  shouldDisableTime: PropTypes.func,
280
+ /**
281
+ * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
282
+ * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
283
+ *
284
+ * 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`.
285
+ *
286
+ * 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.
287
+ * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
288
+ *
289
+ * Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
290
+ * 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.
291
+ *
292
+ * @default `false`
293
+ */
294
+ shouldRespectLeadingZeros: PropTypes.bool,
277
295
  /**
278
296
  * The size of the component.
279
297
  */