@mui/x-date-pickers 7.0.0-alpha.7 → 7.0.0-alpha.8

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 (109) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +4 -21
  2. package/AdapterDateFns/AdapterDateFns.js +11 -255
  3. package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +62 -0
  4. package/AdapterDateFnsBase/AdapterDateFnsBase.js +291 -0
  5. package/AdapterDateFnsBase/index.d.ts +1 -0
  6. package/AdapterDateFnsBase/index.js +1 -0
  7. package/AdapterDateFnsBase/package.json +6 -0
  8. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -0
  9. package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +80 -0
  10. package/AdapterDateFnsV3/AdapterDateFnsV3.js +287 -0
  11. package/AdapterDateFnsV3/index.d.ts +1 -0
  12. package/AdapterDateFnsV3/index.js +1 -0
  13. package/AdapterDateFnsV3/package.json +6 -0
  14. package/CHANGELOG.md +175 -49
  15. package/DatePicker/DatePickerToolbar.d.ts +2 -2
  16. package/DatePicker/DatePickerToolbar.js +2 -7
  17. package/DigitalClock/DigitalClock.js +1 -0
  18. package/DigitalClock/DigitalClock.types.d.ts +5 -0
  19. package/LocalizationProvider/LocalizationProvider.js +1 -1
  20. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  21. package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +5 -0
  22. package/PickersSectionList/PickersSectionList.js +1 -1
  23. package/TimeClock/TimeClock.js +1 -0
  24. package/TimeClock/TimeClock.types.d.ts +5 -0
  25. package/hooks/useClearableField.js +3 -3
  26. package/index.js +1 -1
  27. package/internals/components/PickersInput/PickersInput.d.ts +2 -4
  28. package/internals/components/PickersInput/PickersInput.js +2 -3
  29. package/internals/hooks/useField/useField.utils.js +5 -5
  30. package/internals/hooks/usePicker/index.d.ts +1 -1
  31. package/internals/hooks/usePicker/usePickerValue.js +2 -2
  32. package/internals/hooks/useUtils.js +2 -2
  33. package/internals/hooks/useViews.js +2 -2
  34. package/internals/index.d.ts +9 -3
  35. package/internals/index.js +6 -2
  36. package/internals/models/common.d.ts +1 -1
  37. package/internals/models/helpers.d.ts +1 -0
  38. package/internals/utils/views.js +1 -1
  39. package/legacy/AdapterDateFns/AdapterDateFns.js +222 -458
  40. package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +293 -0
  41. package/legacy/AdapterDateFnsBase/index.js +1 -0
  42. package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +306 -0
  43. package/legacy/AdapterDateFnsV3/index.js +1 -0
  44. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -6
  45. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -6
  46. package/legacy/DatePicker/DatePickerToolbar.js +2 -7
  47. package/legacy/DigitalClock/DigitalClock.js +1 -0
  48. package/legacy/LocalizationProvider/LocalizationProvider.js +1 -1
  49. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  50. package/legacy/PickersSectionList/PickersSectionList.js +1 -1
  51. package/legacy/TimeClock/TimeClock.js +1 -0
  52. package/legacy/hooks/useClearableField.js +3 -3
  53. package/legacy/index.js +1 -1
  54. package/legacy/internals/components/PickersInput/PickersInput.js +2 -3
  55. package/legacy/internals/hooks/useField/useField.utils.js +5 -5
  56. package/legacy/internals/hooks/usePicker/usePickerValue.js +2 -2
  57. package/legacy/internals/hooks/useUtils.js +2 -2
  58. package/legacy/internals/hooks/useViews.js +2 -2
  59. package/legacy/internals/index.js +6 -2
  60. package/legacy/internals/utils/views.js +1 -1
  61. package/legacy/locales/index.js +1 -0
  62. package/locales/enUS.d.ts +1 -1
  63. package/locales/index.d.ts +1 -0
  64. package/locales/index.js +1 -0
  65. package/locales/mk.d.ts +1 -1
  66. package/locales/utils/getPickersLocalization.d.ts +1 -1
  67. package/modern/AdapterDateFns/AdapterDateFns.js +11 -254
  68. package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +290 -0
  69. package/modern/AdapterDateFnsBase/index.js +1 -0
  70. package/modern/AdapterDateFnsV3/AdapterDateFnsV3.js +287 -0
  71. package/modern/AdapterDateFnsV3/index.js +1 -0
  72. package/modern/DatePicker/DatePickerToolbar.js +2 -7
  73. package/modern/DigitalClock/DigitalClock.js +1 -0
  74. package/modern/LocalizationProvider/LocalizationProvider.js +1 -1
  75. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  76. package/modern/PickersSectionList/PickersSectionList.js +1 -1
  77. package/modern/TimeClock/TimeClock.js +1 -0
  78. package/modern/hooks/useClearableField.js +3 -3
  79. package/modern/index.js +1 -1
  80. package/modern/internals/components/PickersInput/PickersInput.js +2 -3
  81. package/modern/internals/hooks/useField/useField.utils.js +5 -5
  82. package/modern/internals/hooks/usePicker/usePickerValue.js +2 -2
  83. package/modern/internals/hooks/useUtils.js +2 -2
  84. package/modern/internals/hooks/useViews.js +2 -2
  85. package/modern/internals/index.js +6 -2
  86. package/modern/internals/utils/views.js +1 -1
  87. package/modern/locales/index.js +1 -0
  88. package/node/AdapterDateFns/AdapterDateFns.js +11 -254
  89. package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +298 -0
  90. package/node/AdapterDateFnsBase/index.js +12 -0
  91. package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +295 -0
  92. package/node/AdapterDateFnsV3/index.js +12 -0
  93. package/node/DatePicker/DatePickerToolbar.js +0 -4
  94. package/node/DigitalClock/DigitalClock.js +1 -0
  95. package/node/LocalizationProvider/LocalizationProvider.js +1 -1
  96. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  97. package/node/PickersSectionList/PickersSectionList.js +1 -1
  98. package/node/TimeClock/TimeClock.js +1 -0
  99. package/node/hooks/useClearableField.js +3 -3
  100. package/node/index.js +1 -1
  101. package/node/internals/components/PickersInput/PickersInput.js +2 -3
  102. package/node/internals/hooks/useField/useField.utils.js +5 -5
  103. package/node/internals/hooks/usePicker/usePickerValue.js +2 -2
  104. package/node/internals/hooks/useUtils.js +2 -2
  105. package/node/internals/hooks/useViews.js +2 -2
  106. package/node/internals/index.js +47 -1
  107. package/node/internals/utils/views.js +1 -1
  108. package/node/locales/index.js +11 -0
  109. package/package.json +2 -2
@@ -0,0 +1,298 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.AdapterDateFnsBase = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ /* eslint-disable class-methods-use-this */
10
+
11
+ const formatTokenMap = {
12
+ // Year
13
+ y: {
14
+ sectionType: 'year',
15
+ contentType: 'digit',
16
+ maxLength: 4
17
+ },
18
+ yy: 'year',
19
+ yyy: {
20
+ sectionType: 'year',
21
+ contentType: 'digit',
22
+ maxLength: 4
23
+ },
24
+ yyyy: 'year',
25
+ // Month
26
+ M: {
27
+ sectionType: 'month',
28
+ contentType: 'digit',
29
+ maxLength: 2
30
+ },
31
+ MM: 'month',
32
+ MMMM: {
33
+ sectionType: 'month',
34
+ contentType: 'letter'
35
+ },
36
+ MMM: {
37
+ sectionType: 'month',
38
+ contentType: 'letter'
39
+ },
40
+ L: {
41
+ sectionType: 'month',
42
+ contentType: 'digit',
43
+ maxLength: 2
44
+ },
45
+ LL: 'month',
46
+ LLL: {
47
+ sectionType: 'month',
48
+ contentType: 'letter'
49
+ },
50
+ LLLL: {
51
+ sectionType: 'month',
52
+ contentType: 'letter'
53
+ },
54
+ // Day of the month
55
+ d: {
56
+ sectionType: 'day',
57
+ contentType: 'digit',
58
+ maxLength: 2
59
+ },
60
+ dd: 'day',
61
+ do: {
62
+ sectionType: 'day',
63
+ contentType: 'digit-with-letter'
64
+ },
65
+ // Day of the week
66
+ E: {
67
+ sectionType: 'weekDay',
68
+ contentType: 'letter'
69
+ },
70
+ EE: {
71
+ sectionType: 'weekDay',
72
+ contentType: 'letter'
73
+ },
74
+ EEE: {
75
+ sectionType: 'weekDay',
76
+ contentType: 'letter'
77
+ },
78
+ EEEE: {
79
+ sectionType: 'weekDay',
80
+ contentType: 'letter'
81
+ },
82
+ EEEEE: {
83
+ sectionType: 'weekDay',
84
+ contentType: 'letter'
85
+ },
86
+ i: {
87
+ sectionType: 'weekDay',
88
+ contentType: 'digit',
89
+ maxLength: 1
90
+ },
91
+ ii: 'weekDay',
92
+ iii: {
93
+ sectionType: 'weekDay',
94
+ contentType: 'letter'
95
+ },
96
+ iiii: {
97
+ sectionType: 'weekDay',
98
+ contentType: 'letter'
99
+ },
100
+ e: {
101
+ sectionType: 'weekDay',
102
+ contentType: 'digit',
103
+ maxLength: 1
104
+ },
105
+ ee: 'weekDay',
106
+ eee: {
107
+ sectionType: 'weekDay',
108
+ contentType: 'letter'
109
+ },
110
+ eeee: {
111
+ sectionType: 'weekDay',
112
+ contentType: 'letter'
113
+ },
114
+ eeeee: {
115
+ sectionType: 'weekDay',
116
+ contentType: 'letter'
117
+ },
118
+ eeeeee: {
119
+ sectionType: 'weekDay',
120
+ contentType: 'letter'
121
+ },
122
+ c: {
123
+ sectionType: 'weekDay',
124
+ contentType: 'digit',
125
+ maxLength: 1
126
+ },
127
+ cc: 'weekDay',
128
+ ccc: {
129
+ sectionType: 'weekDay',
130
+ contentType: 'letter'
131
+ },
132
+ cccc: {
133
+ sectionType: 'weekDay',
134
+ contentType: 'letter'
135
+ },
136
+ ccccc: {
137
+ sectionType: 'weekDay',
138
+ contentType: 'letter'
139
+ },
140
+ cccccc: {
141
+ sectionType: 'weekDay',
142
+ contentType: 'letter'
143
+ },
144
+ // Meridiem
145
+ a: 'meridiem',
146
+ aa: 'meridiem',
147
+ aaa: 'meridiem',
148
+ // Hours
149
+ H: {
150
+ sectionType: 'hours',
151
+ contentType: 'digit',
152
+ maxLength: 2
153
+ },
154
+ HH: 'hours',
155
+ h: {
156
+ sectionType: 'hours',
157
+ contentType: 'digit',
158
+ maxLength: 2
159
+ },
160
+ hh: 'hours',
161
+ // Minutes
162
+ m: {
163
+ sectionType: 'minutes',
164
+ contentType: 'digit',
165
+ maxLength: 2
166
+ },
167
+ mm: 'minutes',
168
+ // Seconds
169
+ s: {
170
+ sectionType: 'seconds',
171
+ contentType: 'digit',
172
+ maxLength: 2
173
+ },
174
+ ss: 'seconds'
175
+ };
176
+ const defaultFormats = {
177
+ year: 'yyyy',
178
+ month: 'LLLL',
179
+ monthShort: 'MMM',
180
+ dayOfMonth: 'd',
181
+ weekday: 'EEEE',
182
+ weekdayShort: 'EEEEEE',
183
+ hours24h: 'HH',
184
+ hours12h: 'hh',
185
+ meridiem: 'aa',
186
+ minutes: 'mm',
187
+ seconds: 'ss',
188
+ fullDate: 'PP',
189
+ keyboardDate: 'P',
190
+ shortDate: 'MMM d',
191
+ normalDate: 'd MMMM',
192
+ normalDateWithWeekday: 'EEE, MMM d',
193
+ fullTime: 'p',
194
+ fullTime12h: 'hh:mm aa',
195
+ fullTime24h: 'HH:mm',
196
+ keyboardDateTime: 'P p',
197
+ keyboardDateTime12h: 'P hh:mm aa',
198
+ keyboardDateTime24h: 'P HH:mm'
199
+ };
200
+ /**
201
+ * Based on `@date-io/date-fns`
202
+ *
203
+ * MIT License
204
+ *
205
+ * Copyright (c) 2017 Dmitriy Kovalenko
206
+ *
207
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
208
+ * of this software and associated documentation files (the "Software"), to deal
209
+ * in the Software without restriction, including without limitation the rights
210
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
211
+ * copies of the Software, and to permit persons to whom the Software is
212
+ * furnished to do so, subject to the following conditions:
213
+ *
214
+ * The above copyright notice and this permission notice shall be included in all
215
+ * copies or substantial portions of the Software.
216
+ *
217
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
218
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
219
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
220
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
221
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
222
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
223
+ * SOFTWARE.
224
+ */
225
+ class AdapterDateFnsBase {
226
+ constructor(props) {
227
+ this.isMUIAdapter = true;
228
+ this.isTimezoneCompatible = false;
229
+ this.lib = 'date-fns';
230
+ this.locale = void 0;
231
+ this.formats = void 0;
232
+ this.formatTokenMap = formatTokenMap;
233
+ this.escapedCharacters = {
234
+ start: "'",
235
+ end: "'"
236
+ };
237
+ this.longFormatters = void 0;
238
+ this.date = value => {
239
+ if (typeof value === 'undefined') {
240
+ return new Date();
241
+ }
242
+ if (value === null) {
243
+ return null;
244
+ }
245
+ return new Date(value);
246
+ };
247
+ this.getInvalidDate = () => new Date('Invalid Date');
248
+ this.getTimezone = () => {
249
+ return 'default';
250
+ };
251
+ this.setTimezone = value => {
252
+ return value;
253
+ };
254
+ this.toJsDate = value => {
255
+ return value;
256
+ };
257
+ this.getCurrentLocaleCode = () => {
258
+ return this.locale?.code || 'en-US';
259
+ };
260
+ // Note: date-fns input types are more lenient than this adapter, so we need to expose our more
261
+ // strict signature and delegate to the more lenient signature. Otherwise, we have downstream type errors upon usage.
262
+ this.is12HourCycleInCurrentLocale = () => {
263
+ if (this.locale) {
264
+ return /a/.test(this.locale.formatLong.time({
265
+ width: 'short'
266
+ }));
267
+ }
268
+
269
+ // By default, date-fns is using en-US locale with am/pm enabled
270
+ return true;
271
+ };
272
+ this.expandFormat = format => {
273
+ const longFormatRegexp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
274
+
275
+ // @see https://github.com/date-fns/date-fns/blob/master/src/format/index.js#L31
276
+ return format.match(longFormatRegexp).map(token => {
277
+ const firstCharacter = token[0];
278
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
279
+ const longFormatter = this.longFormatters[firstCharacter];
280
+ return longFormatter(token, this.locale.formatLong);
281
+ }
282
+ return token;
283
+ }).join('');
284
+ };
285
+ this.formatNumber = numberToFormat => {
286
+ return numberToFormat;
287
+ };
288
+ const {
289
+ locale,
290
+ formats,
291
+ longFormatters
292
+ } = props;
293
+ this.locale = locale;
294
+ this.formats = (0, _extends2.default)({}, defaultFormats, formats);
295
+ this.longFormatters = longFormatters;
296
+ }
297
+ }
298
+ exports.AdapterDateFnsBase = AdapterDateFnsBase;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "AdapterDateFnsBase", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _AdapterDateFnsBase.AdapterDateFnsBase;
10
+ }
11
+ });
12
+ var _AdapterDateFnsBase = require("./AdapterDateFnsBase");
@@ -0,0 +1,295 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AdapterDateFns = void 0;
7
+ var _addDays = require("date-fns/addDays");
8
+ var _addSeconds = require("date-fns/addSeconds");
9
+ var _addMinutes = require("date-fns/addMinutes");
10
+ var _addHours = require("date-fns/addHours");
11
+ var _addWeeks = require("date-fns/addWeeks");
12
+ var _addMonths = require("date-fns/addMonths");
13
+ var _addYears = require("date-fns/addYears");
14
+ var _endOfDay = require("date-fns/endOfDay");
15
+ var _endOfWeek = require("date-fns/endOfWeek");
16
+ var _endOfYear = require("date-fns/endOfYear");
17
+ var _format = require("date-fns/format");
18
+ var _getDate = require("date-fns/getDate");
19
+ var _getDaysInMonth = require("date-fns/getDaysInMonth");
20
+ var _getHours = require("date-fns/getHours");
21
+ var _getMinutes = require("date-fns/getMinutes");
22
+ var _getMonth = require("date-fns/getMonth");
23
+ var _getSeconds = require("date-fns/getSeconds");
24
+ var _getMilliseconds = require("date-fns/getMilliseconds");
25
+ var _getWeek = require("date-fns/getWeek");
26
+ var _getYear = require("date-fns/getYear");
27
+ var _isAfter = require("date-fns/isAfter");
28
+ var _isBefore = require("date-fns/isBefore");
29
+ var _isEqual = require("date-fns/isEqual");
30
+ var _isSameDay = require("date-fns/isSameDay");
31
+ var _isSameYear = require("date-fns/isSameYear");
32
+ var _isSameMonth = require("date-fns/isSameMonth");
33
+ var _isSameHour = require("date-fns/isSameHour");
34
+ var _isValid = require("date-fns/isValid");
35
+ var _parse = require("date-fns/parse");
36
+ var _setDate = require("date-fns/setDate");
37
+ var _setHours = require("date-fns/setHours");
38
+ var _setMinutes = require("date-fns/setMinutes");
39
+ var _setMonth = require("date-fns/setMonth");
40
+ var _setSeconds = require("date-fns/setSeconds");
41
+ var _setMilliseconds = require("date-fns/setMilliseconds");
42
+ var _setYear = require("date-fns/setYear");
43
+ var _startOfDay = require("date-fns/startOfDay");
44
+ var _startOfMonth = require("date-fns/startOfMonth");
45
+ var _endOfMonth = require("date-fns/endOfMonth");
46
+ var _startOfWeek = require("date-fns/startOfWeek");
47
+ var _startOfYear = require("date-fns/startOfYear");
48
+ var _isWithinInterval = require("date-fns/isWithinInterval");
49
+ var _enUS = require("date-fns/locale/en-US");
50
+ var _AdapterDateFnsBase = require("../AdapterDateFnsBase");
51
+ /* eslint-disable class-methods-use-this */
52
+ // TODO remove when date-fns-v3 is the default
53
+ // @ts-nocheck
54
+
55
+ // @ts-ignore TODO remove when date-fns-v3 is the default
56
+
57
+ // date-fns v2 does not export types
58
+ // @ts-ignore TODO remove when date-fns-v3 is the default
59
+
60
+ /**
61
+ * Based on `@date-io/date-fns`
62
+ *
63
+ * MIT License
64
+ *
65
+ * Copyright (c) 2017 Dmitriy Kovalenko
66
+ *
67
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
68
+ * of this software and associated documentation files (the "Software"), to deal
69
+ * in the Software without restriction, including without limitation the rights
70
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
71
+ * copies of the Software, and to permit persons to whom the Software is
72
+ * furnished to do so, subject to the following conditions:
73
+ *
74
+ * The above copyright notice and this permission notice shall be included in all
75
+ * copies or substantial portions of the Software.
76
+ *
77
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
78
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
79
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
80
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
81
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
82
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
83
+ * SOFTWARE.
84
+ */
85
+ class AdapterDateFns extends _AdapterDateFnsBase.AdapterDateFnsBase {
86
+ constructor({
87
+ locale,
88
+ formats
89
+ } = {}) {
90
+ if (typeof _addDays.addDays !== 'function') {
91
+ throw new Error([`MUI: The \`date-fns\` package v2.x is not compatible with this adapter.`, 'Please, install v3.x of the package or use the `AdapterDateFns` instead.'].join('\n'));
92
+ }
93
+ if (!_format.longFormatters) {
94
+ throw new Error('MUI: The minimum supported `date-fns` package version compatible with this adapter is `3.2.x`.');
95
+ }
96
+ super({
97
+ locale: locale ?? _enUS.enUS,
98
+ formats,
99
+ longFormatters: _format.longFormatters
100
+ });
101
+ this.parse = (value, format) => {
102
+ if (value === '') {
103
+ return null;
104
+ }
105
+ return (0, _parse.parse)(value, format, new Date(), {
106
+ locale: this.locale
107
+ });
108
+ };
109
+ this.isValid = value => {
110
+ if (value == null) {
111
+ return false;
112
+ }
113
+ return (0, _isValid.isValid)(value);
114
+ };
115
+ this.format = (value, formatKey) => {
116
+ return this.formatByString(value, this.formats[formatKey]);
117
+ };
118
+ this.formatByString = (value, formatString) => {
119
+ return (0, _format.format)(value, formatString, {
120
+ locale: this.locale
121
+ });
122
+ };
123
+ this.isEqual = (value, comparing) => {
124
+ if (value === null && comparing === null) {
125
+ return true;
126
+ }
127
+ if (value === null || comparing === null) {
128
+ return false;
129
+ }
130
+ return (0, _isEqual.isEqual)(value, comparing);
131
+ };
132
+ this.isSameYear = (value, comparing) => {
133
+ return (0, _isSameYear.isSameYear)(value, comparing);
134
+ };
135
+ this.isSameMonth = (value, comparing) => {
136
+ return (0, _isSameMonth.isSameMonth)(value, comparing);
137
+ };
138
+ this.isSameDay = (value, comparing) => {
139
+ return (0, _isSameDay.isSameDay)(value, comparing);
140
+ };
141
+ this.isSameHour = (value, comparing) => {
142
+ return (0, _isSameHour.isSameHour)(value, comparing);
143
+ };
144
+ this.isAfter = (value, comparing) => {
145
+ return (0, _isAfter.isAfter)(value, comparing);
146
+ };
147
+ this.isAfterYear = (value, comparing) => {
148
+ return (0, _isAfter.isAfter)(value, (0, _endOfYear.endOfYear)(comparing));
149
+ };
150
+ this.isAfterDay = (value, comparing) => {
151
+ return (0, _isAfter.isAfter)(value, (0, _endOfDay.endOfDay)(comparing));
152
+ };
153
+ this.isBefore = (value, comparing) => {
154
+ return (0, _isBefore.isBefore)(value, comparing);
155
+ };
156
+ this.isBeforeYear = (value, comparing) => {
157
+ return (0, _isBefore.isBefore)(value, this.startOfYear(comparing));
158
+ };
159
+ this.isBeforeDay = (value, comparing) => {
160
+ return (0, _isBefore.isBefore)(value, this.startOfDay(comparing));
161
+ };
162
+ this.isWithinRange = (value, [start, end]) => {
163
+ return (0, _isWithinInterval.isWithinInterval)(value, {
164
+ start,
165
+ end
166
+ });
167
+ };
168
+ this.startOfYear = value => {
169
+ return (0, _startOfYear.startOfYear)(value);
170
+ };
171
+ this.startOfMonth = value => {
172
+ return (0, _startOfMonth.startOfMonth)(value);
173
+ };
174
+ this.startOfWeek = value => {
175
+ return (0, _startOfWeek.startOfWeek)(value, {
176
+ locale: this.locale
177
+ });
178
+ };
179
+ this.startOfDay = value => {
180
+ return (0, _startOfDay.startOfDay)(value);
181
+ };
182
+ this.endOfYear = value => {
183
+ return (0, _endOfYear.endOfYear)(value);
184
+ };
185
+ this.endOfMonth = value => {
186
+ return (0, _endOfMonth.endOfMonth)(value);
187
+ };
188
+ this.endOfWeek = value => {
189
+ return (0, _endOfWeek.endOfWeek)(value, {
190
+ locale: this.locale
191
+ });
192
+ };
193
+ this.endOfDay = value => {
194
+ return (0, _endOfDay.endOfDay)(value);
195
+ };
196
+ this.addYears = (value, amount) => {
197
+ return (0, _addYears.addYears)(value, amount);
198
+ };
199
+ this.addMonths = (value, amount) => {
200
+ return (0, _addMonths.addMonths)(value, amount);
201
+ };
202
+ this.addWeeks = (value, amount) => {
203
+ return (0, _addWeeks.addWeeks)(value, amount);
204
+ };
205
+ this.addDays = (value, amount) => {
206
+ return (0, _addDays.addDays)(value, amount);
207
+ };
208
+ this.addHours = (value, amount) => {
209
+ return (0, _addHours.addHours)(value, amount);
210
+ };
211
+ this.addMinutes = (value, amount) => {
212
+ return (0, _addMinutes.addMinutes)(value, amount);
213
+ };
214
+ this.addSeconds = (value, amount) => {
215
+ return (0, _addSeconds.addSeconds)(value, amount);
216
+ };
217
+ this.getYear = value => {
218
+ return (0, _getYear.getYear)(value);
219
+ };
220
+ this.getMonth = value => {
221
+ return (0, _getMonth.getMonth)(value);
222
+ };
223
+ this.getDate = value => {
224
+ return (0, _getDate.getDate)(value);
225
+ };
226
+ this.getHours = value => {
227
+ return (0, _getHours.getHours)(value);
228
+ };
229
+ this.getMinutes = value => {
230
+ return (0, _getMinutes.getMinutes)(value);
231
+ };
232
+ this.getSeconds = value => {
233
+ return (0, _getSeconds.getSeconds)(value);
234
+ };
235
+ this.getMilliseconds = value => {
236
+ return (0, _getMilliseconds.getMilliseconds)(value);
237
+ };
238
+ this.setYear = (value, year) => {
239
+ return (0, _setYear.setYear)(value, year);
240
+ };
241
+ this.setMonth = (value, month) => {
242
+ return (0, _setMonth.setMonth)(value, month);
243
+ };
244
+ this.setDate = (value, date) => {
245
+ return (0, _setDate.setDate)(value, date);
246
+ };
247
+ this.setHours = (value, hours) => {
248
+ return (0, _setHours.setHours)(value, hours);
249
+ };
250
+ this.setMinutes = (value, minutes) => {
251
+ return (0, _setMinutes.setMinutes)(value, minutes);
252
+ };
253
+ this.setSeconds = (value, seconds) => {
254
+ return (0, _setSeconds.setSeconds)(value, seconds);
255
+ };
256
+ this.setMilliseconds = (value, milliseconds) => {
257
+ return (0, _setMilliseconds.setMilliseconds)(value, milliseconds);
258
+ };
259
+ this.getDaysInMonth = value => {
260
+ return (0, _getDaysInMonth.getDaysInMonth)(value);
261
+ };
262
+ this.getWeekArray = value => {
263
+ const start = this.startOfWeek(this.startOfMonth(value));
264
+ const end = this.endOfWeek(this.endOfMonth(value));
265
+ let count = 0;
266
+ let current = start;
267
+ const nestedWeeks = [];
268
+ while (this.isBefore(current, end)) {
269
+ const weekNumber = Math.floor(count / 7);
270
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
271
+ nestedWeeks[weekNumber].push(current);
272
+ current = this.addDays(current, 1);
273
+ count += 1;
274
+ }
275
+ return nestedWeeks;
276
+ };
277
+ this.getWeekNumber = value => {
278
+ return (0, _getWeek.getWeek)(value, {
279
+ locale: this.locale
280
+ });
281
+ };
282
+ this.getYearRange = ([start, end]) => {
283
+ const startDate = this.startOfYear(start);
284
+ const endDate = this.endOfYear(end);
285
+ const years = [];
286
+ let current = startDate;
287
+ while (this.isBefore(current, endDate)) {
288
+ years.push(current);
289
+ current = this.addYears(current, 1);
290
+ }
291
+ return years;
292
+ };
293
+ }
294
+ }
295
+ exports.AdapterDateFns = AdapterDateFns;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "AdapterDateFns", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _AdapterDateFnsV.AdapterDateFns;
10
+ }
11
+ });
12
+ var _AdapterDateFnsV = require("./AdapterDateFnsV3");
@@ -35,10 +35,6 @@ const DatePickerToolbarRoot = (0, _styles.styled)(_PickersToolbar.PickersToolbar
35
35
  slot: 'Root',
36
36
  overridesResolver: (_, styles) => styles.root
37
37
  })({});
38
-
39
- /**
40
- * @ignore - do not document.
41
- */
42
38
  const DatePickerToolbarTitle = (0, _styles.styled)(_Typography.default, {
43
39
  name: 'MuiDatePickerToolbar',
44
40
  slot: 'Title',
@@ -426,6 +426,7 @@ process.env.NODE_ENV !== "production" ? DigitalClock.propTypes = {
426
426
  view: _propTypes.default.oneOf(['hours']),
427
427
  /**
428
428
  * Available views.
429
+ * @default ['hours']
429
430
  */
430
431
  views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['hours']))
431
432
  } : void 0;
@@ -70,7 +70,7 @@ const LocalizationProvider = exports.LocalizationProvider = function Localizatio
70
70
  instance: dateLibInstance
71
71
  });
72
72
  if (!adapter.isMUIAdapter) {
73
- throw new Error(['MUI: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`', "For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`", 'More information on the installation documentation: https://mui.com/x/react-date-pickers/getting-started/#installation'].join(`\n`));
73
+ throw new Error(['MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`', "For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`", 'More information on the installation documentation: https://mui.com/x/react-date-pickers/getting-started/#installation'].join(`\n`));
74
74
  }
75
75
  return adapter;
76
76
  }, [DateAdapter, adapterLocale, dateFormats, dateLibInstance, parentUtils]);
@@ -495,6 +495,7 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
495
495
  view: _propTypes.default.oneOf(['hours', 'meridiem', 'minutes', 'seconds']),
496
496
  /**
497
497
  * Available views.
498
+ * @default ['hours', 'minutes']
498
499
  */
499
500
  views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['hours', 'meridiem', 'minutes', 'seconds']).isRequired)
500
501
  } : void 0;
@@ -125,7 +125,7 @@ const PickersSectionList = exports.PickersSectionList = /*#__PURE__*/React.forwa
125
125
  const handleRootRef = (0, _useForkRef.default)(ref, rootRef);
126
126
  const getRoot = methodName => {
127
127
  if (!rootRef.current) {
128
- throw new Error(`MUI: Cannot call sectionListRef.${methodName} before the mount of the component`);
128
+ throw new Error(`MUI X: Cannot call sectionListRef.${methodName} before the mount of the component.`);
129
129
  }
130
130
  return rootRef.current;
131
131
  };
@@ -471,6 +471,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
471
471
  view: _propTypes.default.oneOf(['hours', 'minutes', 'seconds']),
472
472
  /**
473
473
  * Available views.
474
+ * @default ['hours', 'minutes']
474
475
  */
475
476
  views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['hours', 'minutes', 'seconds']).isRequired)
476
477
  } : void 0;
@@ -49,8 +49,8 @@ const useClearableField = props => {
49
49
  });
50
50
  return (0, _extends2.default)({}, other, {
51
51
  InputProps: (0, _extends2.default)({}, InputProps, {
52
- endAdornment: clearable ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
53
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InputAdornment.default, {
52
+ endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
53
+ children: [clearable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputAdornment.default, {
54
54
  position: "end",
55
55
  sx: {
56
56
  marginRight: InputProps?.endAdornment ? -1 : -1.5
@@ -62,7 +62,7 @@ const useClearableField = props => {
62
62
  }, endClearIconProps))
63
63
  }))
64
64
  }), InputProps?.endAdornment]
65
- }) : InputProps?.endAdornment
65
+ })
66
66
  }),
67
67
  sx: [{
68
68
  '& .clearButton': {