react-day-picker 8.10.0 → 8.10.2
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.
- package/README.md +3 -9
- package/dist/index.d.ts +49 -46
- package/dist/index.esm.js +56 -1409
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +84 -1437
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -10
- package/dist/index.min.js.map +1 -1
- package/package.json +4 -4
- package/src/DayPicker.tsx +3 -1
- package/src/components/Button/Button.tsx +2 -1
- package/src/components/Caption/Caption.tsx +4 -2
- package/src/components/CaptionDropdowns/CaptionDropdowns.tsx +3 -1
- package/src/components/CaptionLabel/CaptionLabel.tsx +3 -1
- package/src/components/CaptionNavigation/CaptionNavigation.tsx +2 -2
- package/src/components/Day/Day.tsx +2 -1
- package/src/components/DayContent/DayContent.tsx +3 -1
- package/src/components/Dropdown/Dropdown.tsx +3 -2
- package/src/components/Footer/Footer.tsx +3 -1
- package/src/components/Head/Head.tsx +3 -1
- package/src/components/HeadRow/HeadRow.tsx +3 -1
- package/src/components/IconDropdown/IconDropdown.tsx +3 -1
- package/src/components/IconLeft/IconLeft.tsx +3 -1
- package/src/components/IconRight/IconRight.tsx +3 -1
- package/src/components/Months/Months.tsx +2 -2
- package/src/components/MonthsDropdown/MonthsDropdown.tsx +2 -2
- package/src/components/Navigation/Navigation.tsx +2 -2
- package/src/components/Root/Root.tsx +2 -1
- package/src/components/Row/Row.tsx +3 -1
- package/src/components/Table/Table.tsx +3 -1
- package/src/components/WeekNumber/WeekNumber.tsx +2 -2
- package/src/components/YearsDropdown/YearsDropdown.tsx +2 -2
- package/src/contexts/DayPicker/DayPickerContext.tsx +3 -2
- package/src/contexts/Focus/FocusContext.tsx +3 -2
- package/src/contexts/Modifiers/ModifiersContext.tsx +3 -2
- package/src/contexts/Navigation/NavigationContext.tsx +3 -2
- package/src/contexts/RootProvider.tsx +14 -4
- package/src/contexts/SelectMultiple/SelectMultipleContext.test.ts +1 -1
- package/src/contexts/SelectMultiple/SelectMultipleContext.tsx +4 -3
- package/src/contexts/SelectRange/SelectRangeContext.test.ts +1 -1
- package/src/contexts/SelectRange/SelectRangeContext.tsx +4 -3
- package/src/contexts/SelectSingle/SelectSingleContext.test.ts +1 -1
- package/src/contexts/SelectSingle/SelectSingleContext.tsx +4 -3
- package/src/hooks/useControlledValue/useControlledValue.test.ts +1 -1
- package/src/hooks/useDayEventHandlers/useDayEventHandlers.tsx +1 -1
- package/src/hooks/useDayRender/useDayRender.tsx +2 -1
- package/src/hooks/useDayRender/utils/getDayStyle.ts +1 -1
- package/src/hooks/useInput/useInput.ts +3 -3
- package/src/types/DayPickerBase.ts +15 -15
- package/src/types/EventHandlers.ts +1 -1
- package/src/types/Formatters.ts +1 -1
- package/src/types/Modifiers.ts +1 -1
- package/src/types/Styles.ts +1 -1
- package/src/hooks/useId/useIsomorphicLayoutEffect.ts +0 -31
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, useContext, useState, forwardRef, useEffect, useRef, useLayoutEffect } from 'react';
|
|
2
3
|
import { format, startOfMonth, endOfMonth, startOfDay, isSameYear, setMonth, setYear, startOfYear, differenceInCalendarMonths, addMonths, isSameMonth, isBefore, startOfISOWeek, startOfWeek, addDays, isSameDay, isAfter, subDays, differenceInCalendarDays, isDate, max, min, addWeeks, addYears, endOfISOWeek, endOfWeek, getUnixTime, getISOWeek, getWeek, getWeeksInMonth, parse } from 'date-fns';
|
|
3
4
|
import { enUS } from 'date-fns/locale';
|
|
4
5
|
|
|
@@ -57,1360 +58,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
57
58
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
58
59
|
};
|
|
59
60
|
|
|
60
|
-
var jsxRuntime = {exports: {}};
|
|
61
|
-
|
|
62
|
-
var reactJsxRuntime_development = {};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @license React
|
|
66
|
-
* react-jsx-runtime.development.js
|
|
67
|
-
*
|
|
68
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
69
|
-
*
|
|
70
|
-
* This source code is licensed under the MIT license found in the
|
|
71
|
-
* LICENSE file in the root directory of this source tree.
|
|
72
|
-
*/
|
|
73
|
-
|
|
74
|
-
var hasRequiredReactJsxRuntime_development;
|
|
75
|
-
|
|
76
|
-
function requireReactJsxRuntime_development () {
|
|
77
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
78
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
79
|
-
|
|
80
|
-
if (process.env.NODE_ENV !== "production") {
|
|
81
|
-
(function() {
|
|
82
|
-
|
|
83
|
-
var React = require$$0;
|
|
84
|
-
|
|
85
|
-
// ATTENTION
|
|
86
|
-
// When adding new symbols to this file,
|
|
87
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
88
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
89
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
90
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
91
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
92
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
93
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
94
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
95
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
96
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
97
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
98
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
99
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
100
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
101
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
102
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
103
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
104
|
-
function getIteratorFn(maybeIterable) {
|
|
105
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
110
|
-
|
|
111
|
-
if (typeof maybeIterator === 'function') {
|
|
112
|
-
return maybeIterator;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
119
|
-
|
|
120
|
-
function error(format) {
|
|
121
|
-
{
|
|
122
|
-
{
|
|
123
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
124
|
-
args[_key2 - 1] = arguments[_key2];
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
printWarning('error', format, args);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function printWarning(level, format, args) {
|
|
133
|
-
// When changing this logic, you might want to also
|
|
134
|
-
// update consoleWithStackDev.www.js as well.
|
|
135
|
-
{
|
|
136
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
137
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
138
|
-
|
|
139
|
-
if (stack !== '') {
|
|
140
|
-
format += '%s';
|
|
141
|
-
args = args.concat([stack]);
|
|
142
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var argsWithFormat = args.map(function (item) {
|
|
146
|
-
return String(item);
|
|
147
|
-
}); // Careful: RN currently depends on this prefix
|
|
148
|
-
|
|
149
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
150
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
151
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
152
|
-
|
|
153
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// -----------------------------------------------------------------------------
|
|
158
|
-
|
|
159
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
160
|
-
var enableCacheElement = false;
|
|
161
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
162
|
-
|
|
163
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
164
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
165
|
-
// issues in DEV builds.
|
|
166
|
-
|
|
167
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
168
|
-
|
|
169
|
-
var REACT_MODULE_REFERENCE;
|
|
170
|
-
|
|
171
|
-
{
|
|
172
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function isValidElementType(type) {
|
|
176
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
177
|
-
return true;
|
|
178
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (typeof type === 'object' && type !== null) {
|
|
186
|
-
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
187
|
-
// types supported by any Flight configuration anywhere since
|
|
188
|
-
// we don't know which Flight build this will end up being used
|
|
189
|
-
// with.
|
|
190
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
199
|
-
var displayName = outerType.displayName;
|
|
200
|
-
|
|
201
|
-
if (displayName) {
|
|
202
|
-
return displayName;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
206
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
207
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
function getContextName(type) {
|
|
211
|
-
return type.displayName || 'Context';
|
|
212
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
function getComponentNameFromType(type) {
|
|
216
|
-
if (type == null) {
|
|
217
|
-
// Host root, text node or just invalid type.
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
{
|
|
222
|
-
if (typeof type.tag === 'number') {
|
|
223
|
-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (typeof type === 'function') {
|
|
228
|
-
return type.displayName || type.name || null;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (typeof type === 'string') {
|
|
232
|
-
return type;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
switch (type) {
|
|
236
|
-
case REACT_FRAGMENT_TYPE:
|
|
237
|
-
return 'Fragment';
|
|
238
|
-
|
|
239
|
-
case REACT_PORTAL_TYPE:
|
|
240
|
-
return 'Portal';
|
|
241
|
-
|
|
242
|
-
case REACT_PROFILER_TYPE:
|
|
243
|
-
return 'Profiler';
|
|
244
|
-
|
|
245
|
-
case REACT_STRICT_MODE_TYPE:
|
|
246
|
-
return 'StrictMode';
|
|
247
|
-
|
|
248
|
-
case REACT_SUSPENSE_TYPE:
|
|
249
|
-
return 'Suspense';
|
|
250
|
-
|
|
251
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
252
|
-
return 'SuspenseList';
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if (typeof type === 'object') {
|
|
257
|
-
switch (type.$$typeof) {
|
|
258
|
-
case REACT_CONTEXT_TYPE:
|
|
259
|
-
var context = type;
|
|
260
|
-
return getContextName(context) + '.Consumer';
|
|
261
|
-
|
|
262
|
-
case REACT_PROVIDER_TYPE:
|
|
263
|
-
var provider = type;
|
|
264
|
-
return getContextName(provider._context) + '.Provider';
|
|
265
|
-
|
|
266
|
-
case REACT_FORWARD_REF_TYPE:
|
|
267
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
268
|
-
|
|
269
|
-
case REACT_MEMO_TYPE:
|
|
270
|
-
var outerName = type.displayName || null;
|
|
271
|
-
|
|
272
|
-
if (outerName !== null) {
|
|
273
|
-
return outerName;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
277
|
-
|
|
278
|
-
case REACT_LAZY_TYPE:
|
|
279
|
-
{
|
|
280
|
-
var lazyComponent = type;
|
|
281
|
-
var payload = lazyComponent._payload;
|
|
282
|
-
var init = lazyComponent._init;
|
|
283
|
-
|
|
284
|
-
try {
|
|
285
|
-
return getComponentNameFromType(init(payload));
|
|
286
|
-
} catch (x) {
|
|
287
|
-
return null;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// eslint-disable-next-line no-fallthrough
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return null;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
var assign = Object.assign;
|
|
299
|
-
|
|
300
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
301
|
-
// replaying on render function. This currently only patches the object
|
|
302
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
303
|
-
// We could also eagerly patch the method.
|
|
304
|
-
var disabledDepth = 0;
|
|
305
|
-
var prevLog;
|
|
306
|
-
var prevInfo;
|
|
307
|
-
var prevWarn;
|
|
308
|
-
var prevError;
|
|
309
|
-
var prevGroup;
|
|
310
|
-
var prevGroupCollapsed;
|
|
311
|
-
var prevGroupEnd;
|
|
312
|
-
|
|
313
|
-
function disabledLog() {}
|
|
314
|
-
|
|
315
|
-
disabledLog.__reactDisabledLog = true;
|
|
316
|
-
function disableLogs() {
|
|
317
|
-
{
|
|
318
|
-
if (disabledDepth === 0) {
|
|
319
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
320
|
-
prevLog = console.log;
|
|
321
|
-
prevInfo = console.info;
|
|
322
|
-
prevWarn = console.warn;
|
|
323
|
-
prevError = console.error;
|
|
324
|
-
prevGroup = console.group;
|
|
325
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
326
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
327
|
-
|
|
328
|
-
var props = {
|
|
329
|
-
configurable: true,
|
|
330
|
-
enumerable: true,
|
|
331
|
-
value: disabledLog,
|
|
332
|
-
writable: true
|
|
333
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
334
|
-
|
|
335
|
-
Object.defineProperties(console, {
|
|
336
|
-
info: props,
|
|
337
|
-
log: props,
|
|
338
|
-
warn: props,
|
|
339
|
-
error: props,
|
|
340
|
-
group: props,
|
|
341
|
-
groupCollapsed: props,
|
|
342
|
-
groupEnd: props
|
|
343
|
-
});
|
|
344
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
disabledDepth++;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
function reenableLogs() {
|
|
351
|
-
{
|
|
352
|
-
disabledDepth--;
|
|
353
|
-
|
|
354
|
-
if (disabledDepth === 0) {
|
|
355
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
356
|
-
var props = {
|
|
357
|
-
configurable: true,
|
|
358
|
-
enumerable: true,
|
|
359
|
-
writable: true
|
|
360
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
361
|
-
|
|
362
|
-
Object.defineProperties(console, {
|
|
363
|
-
log: assign({}, props, {
|
|
364
|
-
value: prevLog
|
|
365
|
-
}),
|
|
366
|
-
info: assign({}, props, {
|
|
367
|
-
value: prevInfo
|
|
368
|
-
}),
|
|
369
|
-
warn: assign({}, props, {
|
|
370
|
-
value: prevWarn
|
|
371
|
-
}),
|
|
372
|
-
error: assign({}, props, {
|
|
373
|
-
value: prevError
|
|
374
|
-
}),
|
|
375
|
-
group: assign({}, props, {
|
|
376
|
-
value: prevGroup
|
|
377
|
-
}),
|
|
378
|
-
groupCollapsed: assign({}, props, {
|
|
379
|
-
value: prevGroupCollapsed
|
|
380
|
-
}),
|
|
381
|
-
groupEnd: assign({}, props, {
|
|
382
|
-
value: prevGroupEnd
|
|
383
|
-
})
|
|
384
|
-
});
|
|
385
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (disabledDepth < 0) {
|
|
389
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
395
|
-
var prefix;
|
|
396
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
397
|
-
{
|
|
398
|
-
if (prefix === undefined) {
|
|
399
|
-
// Extract the VM specific prefix used by each line.
|
|
400
|
-
try {
|
|
401
|
-
throw Error();
|
|
402
|
-
} catch (x) {
|
|
403
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
404
|
-
prefix = match && match[1] || '';
|
|
405
|
-
}
|
|
406
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
return '\n' + prefix + name;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
var reentry = false;
|
|
413
|
-
var componentFrameCache;
|
|
414
|
-
|
|
415
|
-
{
|
|
416
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
417
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
421
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
422
|
-
if ( !fn || reentry) {
|
|
423
|
-
return '';
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
{
|
|
427
|
-
var frame = componentFrameCache.get(fn);
|
|
428
|
-
|
|
429
|
-
if (frame !== undefined) {
|
|
430
|
-
return frame;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
var control;
|
|
435
|
-
reentry = true;
|
|
436
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
437
|
-
|
|
438
|
-
Error.prepareStackTrace = undefined;
|
|
439
|
-
var previousDispatcher;
|
|
440
|
-
|
|
441
|
-
{
|
|
442
|
-
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
443
|
-
// for warnings.
|
|
444
|
-
|
|
445
|
-
ReactCurrentDispatcher.current = null;
|
|
446
|
-
disableLogs();
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
try {
|
|
450
|
-
// This should throw.
|
|
451
|
-
if (construct) {
|
|
452
|
-
// Something should be setting the props in the constructor.
|
|
453
|
-
var Fake = function () {
|
|
454
|
-
throw Error();
|
|
455
|
-
}; // $FlowFixMe
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
459
|
-
set: function () {
|
|
460
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
461
|
-
// because that won't throw in a non-strict mode function.
|
|
462
|
-
throw Error();
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
467
|
-
// We construct a different control for this case to include any extra
|
|
468
|
-
// frames added by the construct call.
|
|
469
|
-
try {
|
|
470
|
-
Reflect.construct(Fake, []);
|
|
471
|
-
} catch (x) {
|
|
472
|
-
control = x;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
Reflect.construct(fn, [], Fake);
|
|
476
|
-
} else {
|
|
477
|
-
try {
|
|
478
|
-
Fake.call();
|
|
479
|
-
} catch (x) {
|
|
480
|
-
control = x;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
fn.call(Fake.prototype);
|
|
484
|
-
}
|
|
485
|
-
} else {
|
|
486
|
-
try {
|
|
487
|
-
throw Error();
|
|
488
|
-
} catch (x) {
|
|
489
|
-
control = x;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
fn();
|
|
493
|
-
}
|
|
494
|
-
} catch (sample) {
|
|
495
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
496
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
497
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
498
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
499
|
-
var sampleLines = sample.stack.split('\n');
|
|
500
|
-
var controlLines = control.stack.split('\n');
|
|
501
|
-
var s = sampleLines.length - 1;
|
|
502
|
-
var c = controlLines.length - 1;
|
|
503
|
-
|
|
504
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
505
|
-
// We expect at least one stack frame to be shared.
|
|
506
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
507
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
508
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
509
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
510
|
-
// the sample somewhere in the control.
|
|
511
|
-
c--;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
515
|
-
// Next we find the first one that isn't the same which should be the
|
|
516
|
-
// frame that called our sample function and the control.
|
|
517
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
518
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
519
|
-
// If we're about to return the first line, and the control is also on the same
|
|
520
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
521
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
522
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
523
|
-
if (s !== 1 || c !== 1) {
|
|
524
|
-
do {
|
|
525
|
-
s--;
|
|
526
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
527
|
-
// The next one that isn't the same should be our match though.
|
|
528
|
-
|
|
529
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
530
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
531
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
532
|
-
// but we have a user-provided "displayName"
|
|
533
|
-
// splice it in to make the stack more readable.
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
537
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
{
|
|
541
|
-
if (typeof fn === 'function') {
|
|
542
|
-
componentFrameCache.set(fn, _frame);
|
|
543
|
-
}
|
|
544
|
-
} // Return the line we found.
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
return _frame;
|
|
548
|
-
}
|
|
549
|
-
} while (s >= 1 && c >= 0);
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
break;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
} finally {
|
|
557
|
-
reentry = false;
|
|
558
|
-
|
|
559
|
-
{
|
|
560
|
-
ReactCurrentDispatcher.current = previousDispatcher;
|
|
561
|
-
reenableLogs();
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
565
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
569
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
570
|
-
|
|
571
|
-
{
|
|
572
|
-
if (typeof fn === 'function') {
|
|
573
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
return syntheticFrame;
|
|
578
|
-
}
|
|
579
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
580
|
-
{
|
|
581
|
-
return describeNativeComponentFrame(fn, false);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
function shouldConstruct(Component) {
|
|
586
|
-
var prototype = Component.prototype;
|
|
587
|
-
return !!(prototype && prototype.isReactComponent);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
591
|
-
|
|
592
|
-
if (type == null) {
|
|
593
|
-
return '';
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
if (typeof type === 'function') {
|
|
597
|
-
{
|
|
598
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
if (typeof type === 'string') {
|
|
603
|
-
return describeBuiltInComponentFrame(type);
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
switch (type) {
|
|
607
|
-
case REACT_SUSPENSE_TYPE:
|
|
608
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
609
|
-
|
|
610
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
611
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
if (typeof type === 'object') {
|
|
615
|
-
switch (type.$$typeof) {
|
|
616
|
-
case REACT_FORWARD_REF_TYPE:
|
|
617
|
-
return describeFunctionComponentFrame(type.render);
|
|
618
|
-
|
|
619
|
-
case REACT_MEMO_TYPE:
|
|
620
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
621
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
622
|
-
|
|
623
|
-
case REACT_LAZY_TYPE:
|
|
624
|
-
{
|
|
625
|
-
var lazyComponent = type;
|
|
626
|
-
var payload = lazyComponent._payload;
|
|
627
|
-
var init = lazyComponent._init;
|
|
628
|
-
|
|
629
|
-
try {
|
|
630
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
631
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
632
|
-
} catch (x) {}
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
return '';
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
641
|
-
|
|
642
|
-
var loggedTypeFailures = {};
|
|
643
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
644
|
-
|
|
645
|
-
function setCurrentlyValidatingElement(element) {
|
|
646
|
-
{
|
|
647
|
-
if (element) {
|
|
648
|
-
var owner = element._owner;
|
|
649
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
650
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
651
|
-
} else {
|
|
652
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
658
|
-
{
|
|
659
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
660
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
661
|
-
|
|
662
|
-
for (var typeSpecName in typeSpecs) {
|
|
663
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
664
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
665
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
666
|
-
// After these have been cleaned up, we'll let them throw.
|
|
667
|
-
|
|
668
|
-
try {
|
|
669
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
670
|
-
// behavior as without this statement except with a better message.
|
|
671
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
672
|
-
// eslint-disable-next-line react-internal/prod-error-codes
|
|
673
|
-
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
674
|
-
err.name = 'Invariant Violation';
|
|
675
|
-
throw err;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
679
|
-
} catch (ex) {
|
|
680
|
-
error$1 = ex;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
684
|
-
setCurrentlyValidatingElement(element);
|
|
685
|
-
|
|
686
|
-
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
687
|
-
|
|
688
|
-
setCurrentlyValidatingElement(null);
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
692
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
693
|
-
// same error.
|
|
694
|
-
loggedTypeFailures[error$1.message] = true;
|
|
695
|
-
setCurrentlyValidatingElement(element);
|
|
696
|
-
|
|
697
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
698
|
-
|
|
699
|
-
setCurrentlyValidatingElement(null);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
707
|
-
|
|
708
|
-
function isArray(a) {
|
|
709
|
-
return isArrayImpl(a);
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
/*
|
|
713
|
-
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
714
|
-
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
715
|
-
*
|
|
716
|
-
* The functions in this module will throw an easier-to-understand,
|
|
717
|
-
* easier-to-debug exception with a clear errors message message explaining the
|
|
718
|
-
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
719
|
-
* of the `value` object).
|
|
720
|
-
*/
|
|
721
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
722
|
-
function typeName(value) {
|
|
723
|
-
{
|
|
724
|
-
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
725
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
726
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
727
|
-
return type;
|
|
728
|
-
}
|
|
729
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
function willCoercionThrow(value) {
|
|
733
|
-
{
|
|
734
|
-
try {
|
|
735
|
-
testStringCoercion(value);
|
|
736
|
-
return false;
|
|
737
|
-
} catch (e) {
|
|
738
|
-
return true;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
function testStringCoercion(value) {
|
|
744
|
-
// If you ended up here by following an exception call stack, here's what's
|
|
745
|
-
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
746
|
-
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
747
|
-
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
748
|
-
//
|
|
749
|
-
// The most common types that will cause this exception are `Symbol` instances
|
|
750
|
-
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
751
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
752
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
753
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
754
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
755
|
-
//
|
|
756
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
757
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
758
|
-
//
|
|
759
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
760
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
761
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
762
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
763
|
-
// In most cases, this console output also shows the component and its
|
|
764
|
-
// ancestor components where the exception happened.
|
|
765
|
-
//
|
|
766
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
767
|
-
return '' + value;
|
|
768
|
-
}
|
|
769
|
-
function checkKeyStringCoercion(value) {
|
|
770
|
-
{
|
|
771
|
-
if (willCoercionThrow(value)) {
|
|
772
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
773
|
-
|
|
774
|
-
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
780
|
-
var RESERVED_PROPS = {
|
|
781
|
-
key: true,
|
|
782
|
-
ref: true,
|
|
783
|
-
__self: true,
|
|
784
|
-
__source: true
|
|
785
|
-
};
|
|
786
|
-
var specialPropKeyWarningShown;
|
|
787
|
-
var specialPropRefWarningShown;
|
|
788
|
-
var didWarnAboutStringRefs;
|
|
789
|
-
|
|
790
|
-
{
|
|
791
|
-
didWarnAboutStringRefs = {};
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
function hasValidRef(config) {
|
|
795
|
-
{
|
|
796
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
797
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
798
|
-
|
|
799
|
-
if (getter && getter.isReactWarning) {
|
|
800
|
-
return false;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
return config.ref !== undefined;
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
function hasValidKey(config) {
|
|
809
|
-
{
|
|
810
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
811
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
812
|
-
|
|
813
|
-
if (getter && getter.isReactWarning) {
|
|
814
|
-
return false;
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
return config.key !== undefined;
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
823
|
-
{
|
|
824
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
825
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
826
|
-
|
|
827
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
828
|
-
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
|
829
|
-
|
|
830
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
837
|
-
{
|
|
838
|
-
var warnAboutAccessingKey = function () {
|
|
839
|
-
if (!specialPropKeyWarningShown) {
|
|
840
|
-
specialPropKeyWarningShown = true;
|
|
841
|
-
|
|
842
|
-
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
843
|
-
}
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
847
|
-
Object.defineProperty(props, 'key', {
|
|
848
|
-
get: warnAboutAccessingKey,
|
|
849
|
-
configurable: true
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
855
|
-
{
|
|
856
|
-
var warnAboutAccessingRef = function () {
|
|
857
|
-
if (!specialPropRefWarningShown) {
|
|
858
|
-
specialPropRefWarningShown = true;
|
|
859
|
-
|
|
860
|
-
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
861
|
-
}
|
|
862
|
-
};
|
|
863
|
-
|
|
864
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
865
|
-
Object.defineProperty(props, 'ref', {
|
|
866
|
-
get: warnAboutAccessingRef,
|
|
867
|
-
configurable: true
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
873
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
874
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
875
|
-
* if something is a React Element.
|
|
876
|
-
*
|
|
877
|
-
* @param {*} type
|
|
878
|
-
* @param {*} props
|
|
879
|
-
* @param {*} key
|
|
880
|
-
* @param {string|object} ref
|
|
881
|
-
* @param {*} owner
|
|
882
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
883
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
884
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
885
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
886
|
-
* change in behavior.
|
|
887
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
888
|
-
* indicating filename, line number, and/or other information.
|
|
889
|
-
* @internal
|
|
890
|
-
*/
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
894
|
-
var element = {
|
|
895
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
896
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
897
|
-
// Built-in properties that belong on the element
|
|
898
|
-
type: type,
|
|
899
|
-
key: key,
|
|
900
|
-
ref: ref,
|
|
901
|
-
props: props,
|
|
902
|
-
// Record the component responsible for creating this element.
|
|
903
|
-
_owner: owner
|
|
904
|
-
};
|
|
905
|
-
|
|
906
|
-
{
|
|
907
|
-
// The validation flag is currently mutative. We put it on
|
|
908
|
-
// an external backing store so that we can freeze the whole object.
|
|
909
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
910
|
-
// commonly used development environments.
|
|
911
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
912
|
-
// the validation flag non-enumerable (where possible, which should
|
|
913
|
-
// include every environment we run tests in), so the test framework
|
|
914
|
-
// ignores it.
|
|
915
|
-
|
|
916
|
-
Object.defineProperty(element._store, 'validated', {
|
|
917
|
-
configurable: false,
|
|
918
|
-
enumerable: false,
|
|
919
|
-
writable: true,
|
|
920
|
-
value: false
|
|
921
|
-
}); // self and source are DEV only properties.
|
|
922
|
-
|
|
923
|
-
Object.defineProperty(element, '_self', {
|
|
924
|
-
configurable: false,
|
|
925
|
-
enumerable: false,
|
|
926
|
-
writable: false,
|
|
927
|
-
value: self
|
|
928
|
-
}); // Two elements created in two different places should be considered
|
|
929
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
930
|
-
|
|
931
|
-
Object.defineProperty(element, '_source', {
|
|
932
|
-
configurable: false,
|
|
933
|
-
enumerable: false,
|
|
934
|
-
writable: false,
|
|
935
|
-
value: source
|
|
936
|
-
});
|
|
937
|
-
|
|
938
|
-
if (Object.freeze) {
|
|
939
|
-
Object.freeze(element.props);
|
|
940
|
-
Object.freeze(element);
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
return element;
|
|
945
|
-
};
|
|
946
|
-
/**
|
|
947
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
948
|
-
* @param {*} type
|
|
949
|
-
* @param {object} props
|
|
950
|
-
* @param {string} key
|
|
951
|
-
*/
|
|
952
|
-
|
|
953
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
954
|
-
{
|
|
955
|
-
var propName; // Reserved names are extracted
|
|
956
|
-
|
|
957
|
-
var props = {};
|
|
958
|
-
var key = null;
|
|
959
|
-
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
960
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
961
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
962
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
963
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
964
|
-
// key is explicitly declared to be undefined or not.
|
|
965
|
-
|
|
966
|
-
if (maybeKey !== undefined) {
|
|
967
|
-
{
|
|
968
|
-
checkKeyStringCoercion(maybeKey);
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
key = '' + maybeKey;
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
if (hasValidKey(config)) {
|
|
975
|
-
{
|
|
976
|
-
checkKeyStringCoercion(config.key);
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
key = '' + config.key;
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
if (hasValidRef(config)) {
|
|
983
|
-
ref = config.ref;
|
|
984
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
985
|
-
} // Remaining properties are added to a new props object
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
for (propName in config) {
|
|
989
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
990
|
-
props[propName] = config[propName];
|
|
991
|
-
}
|
|
992
|
-
} // Resolve default props
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
if (type && type.defaultProps) {
|
|
996
|
-
var defaultProps = type.defaultProps;
|
|
997
|
-
|
|
998
|
-
for (propName in defaultProps) {
|
|
999
|
-
if (props[propName] === undefined) {
|
|
1000
|
-
props[propName] = defaultProps[propName];
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
if (key || ref) {
|
|
1006
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
1007
|
-
|
|
1008
|
-
if (key) {
|
|
1009
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
if (ref) {
|
|
1013
|
-
defineRefPropWarningGetter(props, displayName);
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
1022
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1023
|
-
|
|
1024
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
1025
|
-
{
|
|
1026
|
-
if (element) {
|
|
1027
|
-
var owner = element._owner;
|
|
1028
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1029
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1030
|
-
} else {
|
|
1031
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
var propTypesMisspellWarningShown;
|
|
1037
|
-
|
|
1038
|
-
{
|
|
1039
|
-
propTypesMisspellWarningShown = false;
|
|
1040
|
-
}
|
|
1041
|
-
/**
|
|
1042
|
-
* Verifies the object is a ReactElement.
|
|
1043
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1044
|
-
* @param {?object} object
|
|
1045
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
1046
|
-
* @final
|
|
1047
|
-
*/
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
function isValidElement(object) {
|
|
1051
|
-
{
|
|
1052
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
function getDeclarationErrorAddendum() {
|
|
1057
|
-
{
|
|
1058
|
-
if (ReactCurrentOwner$1.current) {
|
|
1059
|
-
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
1060
|
-
|
|
1061
|
-
if (name) {
|
|
1062
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
return '';
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
function getSourceInfoErrorAddendum(source) {
|
|
1071
|
-
{
|
|
1072
|
-
if (source !== undefined) {
|
|
1073
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
1074
|
-
var lineNumber = source.lineNumber;
|
|
1075
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
return '';
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
/**
|
|
1082
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1083
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
1084
|
-
* updates.
|
|
1085
|
-
*/
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
var ownerHasKeyUseWarning = {};
|
|
1089
|
-
|
|
1090
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
1091
|
-
{
|
|
1092
|
-
var info = getDeclarationErrorAddendum();
|
|
1093
|
-
|
|
1094
|
-
if (!info) {
|
|
1095
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1096
|
-
|
|
1097
|
-
if (parentName) {
|
|
1098
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
return info;
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
/**
|
|
1106
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1107
|
-
* This element is in an array. The array could grow and shrink or be
|
|
1108
|
-
* reordered. All children that haven't already been validated are required to
|
|
1109
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1110
|
-
* will only be shown once.
|
|
1111
|
-
*
|
|
1112
|
-
* @internal
|
|
1113
|
-
* @param {ReactElement} element Element that requires a key.
|
|
1114
|
-
* @param {*} parentType element's parent's type.
|
|
1115
|
-
*/
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
function validateExplicitKey(element, parentType) {
|
|
1119
|
-
{
|
|
1120
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
1121
|
-
return;
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
element._store.validated = true;
|
|
1125
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1126
|
-
|
|
1127
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1128
|
-
return;
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
1132
|
-
// property, it may be the creator of the child that's responsible for
|
|
1133
|
-
// assigning it a key.
|
|
1134
|
-
|
|
1135
|
-
var childOwner = '';
|
|
1136
|
-
|
|
1137
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
1138
|
-
// Give the component that originally created this child.
|
|
1139
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
setCurrentlyValidatingElement$1(element);
|
|
1143
|
-
|
|
1144
|
-
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1145
|
-
|
|
1146
|
-
setCurrentlyValidatingElement$1(null);
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Ensure that every element either is passed in a static location, in an
|
|
1151
|
-
* array with an explicit keys property defined, or in an object literal
|
|
1152
|
-
* with valid key property.
|
|
1153
|
-
*
|
|
1154
|
-
* @internal
|
|
1155
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
1156
|
-
* @param {*} parentType node's parent's type.
|
|
1157
|
-
*/
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
function validateChildKeys(node, parentType) {
|
|
1161
|
-
{
|
|
1162
|
-
if (typeof node !== 'object') {
|
|
1163
|
-
return;
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
if (isArray(node)) {
|
|
1167
|
-
for (var i = 0; i < node.length; i++) {
|
|
1168
|
-
var child = node[i];
|
|
1169
|
-
|
|
1170
|
-
if (isValidElement(child)) {
|
|
1171
|
-
validateExplicitKey(child, parentType);
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
} else if (isValidElement(node)) {
|
|
1175
|
-
// This element was passed in a valid location.
|
|
1176
|
-
if (node._store) {
|
|
1177
|
-
node._store.validated = true;
|
|
1178
|
-
}
|
|
1179
|
-
} else if (node) {
|
|
1180
|
-
var iteratorFn = getIteratorFn(node);
|
|
1181
|
-
|
|
1182
|
-
if (typeof iteratorFn === 'function') {
|
|
1183
|
-
// Entry iterators used to provide implicit keys,
|
|
1184
|
-
// but now we print a separate warning for them later.
|
|
1185
|
-
if (iteratorFn !== node.entries) {
|
|
1186
|
-
var iterator = iteratorFn.call(node);
|
|
1187
|
-
var step;
|
|
1188
|
-
|
|
1189
|
-
while (!(step = iterator.next()).done) {
|
|
1190
|
-
if (isValidElement(step.value)) {
|
|
1191
|
-
validateExplicitKey(step.value, parentType);
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
/**
|
|
1200
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
1201
|
-
* provided by the type.
|
|
1202
|
-
*
|
|
1203
|
-
* @param {ReactElement} element
|
|
1204
|
-
*/
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
function validatePropTypes(element) {
|
|
1208
|
-
{
|
|
1209
|
-
var type = element.type;
|
|
1210
|
-
|
|
1211
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
1212
|
-
return;
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
var propTypes;
|
|
1216
|
-
|
|
1217
|
-
if (typeof type === 'function') {
|
|
1218
|
-
propTypes = type.propTypes;
|
|
1219
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1220
|
-
// Inner props are checked in the reconciler.
|
|
1221
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1222
|
-
propTypes = type.propTypes;
|
|
1223
|
-
} else {
|
|
1224
|
-
return;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
if (propTypes) {
|
|
1228
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
1229
|
-
var name = getComponentNameFromType(type);
|
|
1230
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1231
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1232
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1233
|
-
|
|
1234
|
-
var _name = getComponentNameFromType(type);
|
|
1235
|
-
|
|
1236
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1240
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
/**
|
|
1245
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
1246
|
-
* @param {ReactElement} fragment
|
|
1247
|
-
*/
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
function validateFragmentProps(fragment) {
|
|
1251
|
-
{
|
|
1252
|
-
var keys = Object.keys(fragment.props);
|
|
1253
|
-
|
|
1254
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1255
|
-
var key = keys[i];
|
|
1256
|
-
|
|
1257
|
-
if (key !== 'children' && key !== 'key') {
|
|
1258
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1259
|
-
|
|
1260
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1261
|
-
|
|
1262
|
-
setCurrentlyValidatingElement$1(null);
|
|
1263
|
-
break;
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
if (fragment.ref !== null) {
|
|
1268
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1269
|
-
|
|
1270
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1271
|
-
|
|
1272
|
-
setCurrentlyValidatingElement$1(null);
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1278
|
-
{
|
|
1279
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1280
|
-
// succeed and there will likely be errors in render.
|
|
1281
|
-
|
|
1282
|
-
if (!validType) {
|
|
1283
|
-
var info = '';
|
|
1284
|
-
|
|
1285
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1286
|
-
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
1290
|
-
|
|
1291
|
-
if (sourceInfo) {
|
|
1292
|
-
info += sourceInfo;
|
|
1293
|
-
} else {
|
|
1294
|
-
info += getDeclarationErrorAddendum();
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
var typeString;
|
|
1298
|
-
|
|
1299
|
-
if (type === null) {
|
|
1300
|
-
typeString = 'null';
|
|
1301
|
-
} else if (isArray(type)) {
|
|
1302
|
-
typeString = 'array';
|
|
1303
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1304
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
1305
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1306
|
-
} else {
|
|
1307
|
-
typeString = typeof type;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1314
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1315
|
-
|
|
1316
|
-
if (element == null) {
|
|
1317
|
-
return element;
|
|
1318
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1319
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1320
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
1321
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1322
|
-
// fixed, the key warnings will appear.)
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
if (validType) {
|
|
1326
|
-
var children = props.children;
|
|
1327
|
-
|
|
1328
|
-
if (children !== undefined) {
|
|
1329
|
-
if (isStaticChildren) {
|
|
1330
|
-
if (isArray(children)) {
|
|
1331
|
-
for (var i = 0; i < children.length; i++) {
|
|
1332
|
-
validateChildKeys(children[i], type);
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
if (Object.freeze) {
|
|
1336
|
-
Object.freeze(children);
|
|
1337
|
-
}
|
|
1338
|
-
} else {
|
|
1339
|
-
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
1340
|
-
}
|
|
1341
|
-
} else {
|
|
1342
|
-
validateChildKeys(children, type);
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
1348
|
-
validateFragmentProps(element);
|
|
1349
|
-
} else {
|
|
1350
|
-
validatePropTypes(element);
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
return element;
|
|
1354
|
-
}
|
|
1355
|
-
} // These two functions exist to still get child warnings in dev
|
|
1356
|
-
// even with the prod transform. This means that jsxDEV is purely
|
|
1357
|
-
// opt-in behavior for better messages but that we won't stop
|
|
1358
|
-
// giving you warnings if you use production apis.
|
|
1359
|
-
|
|
1360
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
1361
|
-
{
|
|
1362
|
-
return jsxWithValidation(type, props, key, true);
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
1366
|
-
{
|
|
1367
|
-
return jsxWithValidation(type, props, key, false);
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
1372
|
-
// for now we can ship identical prod functions
|
|
1373
|
-
|
|
1374
|
-
var jsxs = jsxWithValidationStatic ;
|
|
1375
|
-
|
|
1376
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
1377
|
-
reactJsxRuntime_development.jsx = jsx;
|
|
1378
|
-
reactJsxRuntime_development.jsxs = jsxs;
|
|
1379
|
-
})();
|
|
1380
|
-
}
|
|
1381
|
-
return reactJsxRuntime_development;
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
var reactJsxRuntime_production_min = {};
|
|
1385
|
-
|
|
1386
|
-
/**
|
|
1387
|
-
* @license React
|
|
1388
|
-
* react-jsx-runtime.production.min.js
|
|
1389
|
-
*
|
|
1390
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1391
|
-
*
|
|
1392
|
-
* This source code is licensed under the MIT license found in the
|
|
1393
|
-
* LICENSE file in the root directory of this source tree.
|
|
1394
|
-
*/
|
|
1395
|
-
|
|
1396
|
-
var hasRequiredReactJsxRuntime_production_min;
|
|
1397
|
-
|
|
1398
|
-
function requireReactJsxRuntime_production_min () {
|
|
1399
|
-
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
1400
|
-
hasRequiredReactJsxRuntime_production_min = 1;
|
|
1401
|
-
var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
|
|
1402
|
-
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
|
|
1403
|
-
return reactJsxRuntime_production_min;
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1407
|
-
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
1408
|
-
} else {
|
|
1409
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
var jsxRuntimeExports = jsxRuntime.exports;
|
|
1413
|
-
|
|
1414
61
|
/** Returns true when the props are of type {@link DayPickerMultipleProps}. */
|
|
1415
62
|
function isDayPickerMultiple(props) {
|
|
1416
63
|
return props.mode === 'multiple';
|
|
@@ -1664,7 +311,7 @@ function DayPickerProvider(props) {
|
|
|
1664
311
|
onSelect = initialProps.onSelect;
|
|
1665
312
|
}
|
|
1666
313
|
var value = __assign(__assign(__assign({}, defaultContextValues), initialProps), { captionLayout: captionLayout, classNames: __assign(__assign({}, defaultContextValues.classNames), initialProps.classNames), components: __assign({}, initialProps.components), formatters: __assign(__assign({}, defaultContextValues.formatters), initialProps.formatters), fromDate: fromDate, labels: __assign(__assign({}, defaultContextValues.labels), initialProps.labels), mode: initialProps.mode || defaultContextValues.mode, modifiers: __assign(__assign({}, defaultContextValues.modifiers), initialProps.modifiers), modifiersClassNames: __assign(__assign({}, defaultContextValues.modifiersClassNames), initialProps.modifiersClassNames), onSelect: onSelect, styles: __assign(__assign({}, defaultContextValues.styles), initialProps.styles), toDate: toDate });
|
|
1667
|
-
return (
|
|
314
|
+
return (jsx(DayPickerContext.Provider, { value: value, children: props.children }));
|
|
1668
315
|
}
|
|
1669
316
|
/**
|
|
1670
317
|
* Hook to access the {@link DayPickerContextValue}.
|
|
@@ -1683,14 +330,14 @@ function useDayPicker() {
|
|
|
1683
330
|
/** Render the caption for the displayed month. This component is used when `captionLayout="buttons"`. */
|
|
1684
331
|
function CaptionLabel(props) {
|
|
1685
332
|
var _a = useDayPicker(), locale = _a.locale, classNames = _a.classNames, styles = _a.styles, formatCaption = _a.formatters.formatCaption;
|
|
1686
|
-
return (
|
|
333
|
+
return (jsx("div", { className: classNames.caption_label, style: styles.caption_label, "aria-live": "polite", role: "presentation", id: props.id, children: formatCaption(props.displayMonth, { locale: locale }) }));
|
|
1687
334
|
}
|
|
1688
335
|
|
|
1689
336
|
/**
|
|
1690
337
|
* Render the icon in the styled drop-down.
|
|
1691
338
|
*/
|
|
1692
339
|
function IconDropdown(props) {
|
|
1693
|
-
return (
|
|
340
|
+
return (jsx("svg", __assign({ width: "8px", height: "8px", viewBox: "0 0 120 120", "data-testid": "iconDropdown" }, props, { children: jsx("path", { d: "M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z", fill: "currentColor", fillRule: "nonzero" }) })));
|
|
1694
341
|
}
|
|
1695
342
|
|
|
1696
343
|
/**
|
|
@@ -1702,7 +349,7 @@ function Dropdown(props) {
|
|
|
1702
349
|
var onChange = props.onChange, value = props.value, children = props.children, caption = props.caption, className = props.className, style = props.style;
|
|
1703
350
|
var dayPicker = useDayPicker();
|
|
1704
351
|
var IconDropdownComponent = (_b = (_a = dayPicker.components) === null || _a === void 0 ? void 0 : _a.IconDropdown) !== null && _b !== void 0 ? _b : IconDropdown;
|
|
1705
|
-
return (
|
|
352
|
+
return (jsxs("div", { className: className, style: style, children: [jsx("span", { className: dayPicker.classNames.vhidden, children: props['aria-label'] }), jsx("select", { name: props.name, "aria-label": props['aria-label'], className: dayPicker.classNames.dropdown, style: dayPicker.styles.dropdown, value: value, onChange: onChange, children: children }), jsxs("div", { className: dayPicker.classNames.caption_label, style: dayPicker.styles.caption_label, "aria-hidden": "true", children: [caption, jsx(IconDropdownComponent, { className: dayPicker.classNames.dropdown_icon, style: dayPicker.styles.dropdown_icon })] })] }));
|
|
1706
353
|
}
|
|
1707
354
|
|
|
1708
355
|
/** Render the dropdown to navigate between months. */
|
|
@@ -1711,9 +358,9 @@ function MonthsDropdown(props) {
|
|
|
1711
358
|
var _b = useDayPicker(), fromDate = _b.fromDate, toDate = _b.toDate, styles = _b.styles, locale = _b.locale, formatMonthCaption = _b.formatters.formatMonthCaption, classNames = _b.classNames, components = _b.components, labelMonthDropdown = _b.labels.labelMonthDropdown;
|
|
1712
359
|
// Dropdown should appear only when both from/toDate is set
|
|
1713
360
|
if (!fromDate)
|
|
1714
|
-
return
|
|
361
|
+
return jsx(Fragment, {});
|
|
1715
362
|
if (!toDate)
|
|
1716
|
-
return
|
|
363
|
+
return jsx(Fragment, {});
|
|
1717
364
|
var dropdownMonths = [];
|
|
1718
365
|
if (isSameYear(fromDate, toDate)) {
|
|
1719
366
|
// only display the months included in the range
|
|
@@ -1735,7 +382,7 @@ function MonthsDropdown(props) {
|
|
|
1735
382
|
props.onChange(newMonth);
|
|
1736
383
|
};
|
|
1737
384
|
var DropdownComponent = (_a = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a !== void 0 ? _a : Dropdown;
|
|
1738
|
-
return (
|
|
385
|
+
return (jsx(DropdownComponent, { name: "months", "aria-label": labelMonthDropdown(), className: classNames.dropdown_month, style: styles.dropdown_month, onChange: handleChange, value: props.displayMonth.getMonth(), caption: formatMonthCaption(props.displayMonth, { locale: locale }), children: dropdownMonths.map(function (m) { return (jsx("option", { value: m.getMonth(), children: formatMonthCaption(m, { locale: locale }) }, m.getMonth())); }) }));
|
|
1739
386
|
}
|
|
1740
387
|
|
|
1741
388
|
/**
|
|
@@ -1749,9 +396,9 @@ function YearsDropdown(props) {
|
|
|
1749
396
|
var years = [];
|
|
1750
397
|
// Dropdown should appear only when both from/toDate is set
|
|
1751
398
|
if (!fromDate)
|
|
1752
|
-
return
|
|
399
|
+
return jsx(Fragment, {});
|
|
1753
400
|
if (!toDate)
|
|
1754
|
-
return
|
|
401
|
+
return jsx(Fragment, {});
|
|
1755
402
|
var fromYear = fromDate.getFullYear();
|
|
1756
403
|
var toYear = toDate.getFullYear();
|
|
1757
404
|
for (var year = fromYear; year <= toYear; year++) {
|
|
@@ -1762,7 +409,7 @@ function YearsDropdown(props) {
|
|
|
1762
409
|
props.onChange(newMonth);
|
|
1763
410
|
};
|
|
1764
411
|
var DropdownComponent = (_a = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a !== void 0 ? _a : Dropdown;
|
|
1765
|
-
return (
|
|
412
|
+
return (jsx(DropdownComponent, { name: "years", "aria-label": labelYearDropdown(), className: classNames.dropdown_year, style: styles.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption(displayMonth, { locale: locale }), children: years.map(function (year) { return (jsx("option", { value: year.getFullYear(), children: formatYearCaption(year, { locale: locale }) }, year.getFullYear())); }) }));
|
|
1766
413
|
}
|
|
1767
414
|
|
|
1768
415
|
/**
|
|
@@ -1926,7 +573,7 @@ function NavigationProvider(props) {
|
|
|
1926
573
|
nextMonth: nextMonth,
|
|
1927
574
|
isDateDisplayed: isDateDisplayed
|
|
1928
575
|
};
|
|
1929
|
-
return (
|
|
576
|
+
return (jsx(NavigationContext.Provider, { value: value, children: props.children }));
|
|
1930
577
|
}
|
|
1931
578
|
/**
|
|
1932
579
|
* Hook to access the {@link NavigationContextValue}. Use this hook to navigate
|
|
@@ -1953,22 +600,22 @@ function CaptionDropdowns(props) {
|
|
|
1953
600
|
goToMonth(addMonths(newMonth, props.displayIndex ? -props.displayIndex : 0));
|
|
1954
601
|
};
|
|
1955
602
|
var CaptionLabelComponent = (_a = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a !== void 0 ? _a : CaptionLabel;
|
|
1956
|
-
var captionLabel = (
|
|
1957
|
-
return (
|
|
603
|
+
var captionLabel = (jsx(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth }));
|
|
604
|
+
return (jsxs("div", { className: classNames.caption_dropdowns, style: styles.caption_dropdowns, children: [jsx("div", { className: classNames.vhidden, children: captionLabel }), jsx(MonthsDropdown, { onChange: handleMonthChange, displayMonth: props.displayMonth }), jsx(YearsDropdown, { onChange: handleMonthChange, displayMonth: props.displayMonth })] }));
|
|
1958
605
|
}
|
|
1959
606
|
|
|
1960
607
|
/**
|
|
1961
608
|
* Render the "previous month" button in the navigation.
|
|
1962
609
|
*/
|
|
1963
610
|
function IconLeft(props) {
|
|
1964
|
-
return (
|
|
611
|
+
return (jsx("svg", __assign({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props, { children: jsx("path", { d: "M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z", fill: "currentColor", fillRule: "nonzero" }) })));
|
|
1965
612
|
}
|
|
1966
613
|
|
|
1967
614
|
/**
|
|
1968
615
|
* Render the "next month" button in the navigation.
|
|
1969
616
|
*/
|
|
1970
617
|
function IconRight(props) {
|
|
1971
|
-
return (
|
|
618
|
+
return (jsx("svg", __assign({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props, { children: jsx("path", { d: "M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z", fill: "currentColor" }) })));
|
|
1972
619
|
}
|
|
1973
620
|
|
|
1974
621
|
/** Render a button HTML element applying the reset class name. */
|
|
@@ -1983,7 +630,7 @@ var Button = forwardRef(function (props, ref) {
|
|
|
1983
630
|
if (props.style) {
|
|
1984
631
|
Object.assign(style, props.style);
|
|
1985
632
|
}
|
|
1986
|
-
return (
|
|
633
|
+
return (jsx("button", __assign({}, props, { ref: ref, type: "button", className: className, style: style })));
|
|
1987
634
|
});
|
|
1988
635
|
|
|
1989
636
|
/** A component rendering the navigation buttons or the drop-downs. */
|
|
@@ -1991,7 +638,7 @@ function Navigation(props) {
|
|
|
1991
638
|
var _a, _b;
|
|
1992
639
|
var _c = useDayPicker(), dir = _c.dir, locale = _c.locale, classNames = _c.classNames, styles = _c.styles, _d = _c.labels, labelPrevious = _d.labelPrevious, labelNext = _d.labelNext, components = _c.components;
|
|
1993
640
|
if (!props.nextMonth && !props.previousMonth) {
|
|
1994
|
-
return
|
|
641
|
+
return jsx(Fragment, {});
|
|
1995
642
|
}
|
|
1996
643
|
var previousLabel = labelPrevious(props.previousMonth, { locale: locale });
|
|
1997
644
|
var previousClassName = [
|
|
@@ -2005,7 +652,7 @@ function Navigation(props) {
|
|
|
2005
652
|
].join(' ');
|
|
2006
653
|
var IconRightComponent = (_a = components === null || components === void 0 ? void 0 : components.IconRight) !== null && _a !== void 0 ? _a : IconRight;
|
|
2007
654
|
var IconLeftComponent = (_b = components === null || components === void 0 ? void 0 : components.IconLeft) !== null && _b !== void 0 ? _b : IconLeft;
|
|
2008
|
-
return (
|
|
655
|
+
return (jsxs("div", { className: classNames.nav, style: styles.nav, children: [!props.hidePrevious && (jsx(Button, { name: "previous-month", "aria-label": previousLabel, className: previousClassName, style: styles.nav_button_previous, disabled: !props.previousMonth, onClick: props.onPreviousClick, children: dir === 'rtl' ? (jsx(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (jsx(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })) })), !props.hideNext && (jsx(Button, { name: "next-month", "aria-label": nextLabel, className: nextClassName, style: styles.nav_button_next, disabled: !props.nextMonth, onClick: props.onNextClick, children: dir === 'rtl' ? (jsx(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (jsx(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon })) }))] }));
|
|
2009
656
|
}
|
|
2010
657
|
|
|
2011
658
|
/**
|
|
@@ -2031,7 +678,7 @@ function CaptionNavigation(props) {
|
|
|
2031
678
|
return;
|
|
2032
679
|
goToMonth(nextMonth);
|
|
2033
680
|
};
|
|
2034
|
-
return (
|
|
681
|
+
return (jsx(Navigation, { displayMonth: props.displayMonth, hideNext: hideNext, hidePrevious: hidePrevious, nextMonth: nextMonth, previousMonth: previousMonth, onPreviousClick: handlePreviousClick, onNextClick: handleNextClick }));
|
|
2035
682
|
}
|
|
2036
683
|
|
|
2037
684
|
/**
|
|
@@ -2044,18 +691,18 @@ function Caption(props) {
|
|
|
2044
691
|
var CaptionLabelComponent = (_a = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a !== void 0 ? _a : CaptionLabel;
|
|
2045
692
|
var caption;
|
|
2046
693
|
if (disableNavigation) {
|
|
2047
|
-
caption = (
|
|
694
|
+
caption = (jsx(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth }));
|
|
2048
695
|
}
|
|
2049
696
|
else if (captionLayout === 'dropdown') {
|
|
2050
|
-
caption = (
|
|
697
|
+
caption = (jsx(CaptionDropdowns, { displayMonth: props.displayMonth, id: props.id }));
|
|
2051
698
|
}
|
|
2052
699
|
else if (captionLayout === 'dropdown-buttons') {
|
|
2053
|
-
caption = (
|
|
700
|
+
caption = (jsxs(Fragment, { children: [jsx(CaptionDropdowns, { displayMonth: props.displayMonth, displayIndex: props.displayIndex, id: props.id }), jsx(CaptionNavigation, { displayMonth: props.displayMonth, displayIndex: props.displayIndex, id: props.id })] }));
|
|
2054
701
|
}
|
|
2055
702
|
else {
|
|
2056
|
-
caption = (
|
|
703
|
+
caption = (jsxs(Fragment, { children: [jsx(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth, displayIndex: props.displayIndex }), jsx(CaptionNavigation, { displayMonth: props.displayMonth, id: props.id })] }));
|
|
2057
704
|
}
|
|
2058
|
-
return (
|
|
705
|
+
return (jsx("div", { className: classNames.caption, style: styles.caption, children: caption }));
|
|
2059
706
|
}
|
|
2060
707
|
|
|
2061
708
|
/** Render the Footer component (empty as default).*/
|
|
@@ -2063,8 +710,8 @@ function Caption(props) {
|
|
|
2063
710
|
function Footer(props) {
|
|
2064
711
|
var _a = useDayPicker(), footer = _a.footer, styles = _a.styles, tfoot = _a.classNames.tfoot;
|
|
2065
712
|
if (!footer)
|
|
2066
|
-
return
|
|
2067
|
-
return (
|
|
713
|
+
return jsx(Fragment, {});
|
|
714
|
+
return (jsx("tfoot", { className: tfoot, style: styles.tfoot, children: jsx("tr", { children: jsx("td", { colSpan: 8, children: footer }) }) }));
|
|
2068
715
|
}
|
|
2069
716
|
|
|
2070
717
|
/**
|
|
@@ -2093,7 +740,7 @@ ISOWeek) {
|
|
|
2093
740
|
function HeadRow() {
|
|
2094
741
|
var _a = useDayPicker(), classNames = _a.classNames, styles = _a.styles, showWeekNumber = _a.showWeekNumber, locale = _a.locale, weekStartsOn = _a.weekStartsOn, ISOWeek = _a.ISOWeek, formatWeekdayName = _a.formatters.formatWeekdayName, labelWeekday = _a.labels.labelWeekday;
|
|
2095
742
|
var weekdays = getWeekdays(locale, weekStartsOn, ISOWeek);
|
|
2096
|
-
return (
|
|
743
|
+
return (jsxs("tr", { style: styles.head_row, className: classNames.head_row, children: [showWeekNumber && (jsx("td", { style: styles.head_cell, className: classNames.head_cell })), weekdays.map(function (weekday, i) { return (jsx("th", { scope: "col", className: classNames.head_cell, style: styles.head_cell, "aria-label": labelWeekday(weekday, { locale: locale }), children: formatWeekdayName(weekday, { locale: locale }) }, i)); })] }));
|
|
2097
744
|
}
|
|
2098
745
|
|
|
2099
746
|
/** Render the table head. */
|
|
@@ -2101,13 +748,13 @@ function Head() {
|
|
|
2101
748
|
var _a;
|
|
2102
749
|
var _b = useDayPicker(), classNames = _b.classNames, styles = _b.styles, components = _b.components;
|
|
2103
750
|
var HeadRowComponent = (_a = components === null || components === void 0 ? void 0 : components.HeadRow) !== null && _a !== void 0 ? _a : HeadRow;
|
|
2104
|
-
return (
|
|
751
|
+
return (jsx("thead", { style: styles.head, className: classNames.head, children: jsx(HeadRowComponent, {}) }));
|
|
2105
752
|
}
|
|
2106
753
|
|
|
2107
754
|
/** Render the content of the day cell. */
|
|
2108
755
|
function DayContent(props) {
|
|
2109
756
|
var _a = useDayPicker(), locale = _a.locale, formatDay = _a.formatters.formatDay;
|
|
2110
|
-
return
|
|
757
|
+
return jsx(Fragment, { children: formatDay(props.date, { locale: locale }) });
|
|
2111
758
|
}
|
|
2112
759
|
|
|
2113
760
|
/**
|
|
@@ -2126,9 +773,9 @@ function SelectMultipleProvider(props) {
|
|
|
2126
773
|
disabled: []
|
|
2127
774
|
}
|
|
2128
775
|
};
|
|
2129
|
-
return (
|
|
776
|
+
return (jsx(SelectMultipleContext.Provider, { value: emptyContextValue, children: props.children }));
|
|
2130
777
|
}
|
|
2131
|
-
return (
|
|
778
|
+
return (jsx(SelectMultipleProviderInternal, { initialProps: props.initialProps, children: props.children }));
|
|
2132
779
|
}
|
|
2133
780
|
function SelectMultipleProviderInternal(_a) {
|
|
2134
781
|
var initialProps = _a.initialProps, children = _a.children;
|
|
@@ -2173,7 +820,7 @@ function SelectMultipleProviderInternal(_a) {
|
|
|
2173
820
|
onDayClick: onDayClick,
|
|
2174
821
|
modifiers: modifiers
|
|
2175
822
|
};
|
|
2176
|
-
return (
|
|
823
|
+
return (jsx(SelectMultipleContext.Provider, { value: contextValue, children: children }));
|
|
2177
824
|
}
|
|
2178
825
|
/**
|
|
2179
826
|
* Hook to access the {@link SelectMultipleContextValue}.
|
|
@@ -2245,9 +892,9 @@ function SelectRangeProvider(props) {
|
|
|
2245
892
|
disabled: []
|
|
2246
893
|
}
|
|
2247
894
|
};
|
|
2248
|
-
return (
|
|
895
|
+
return (jsx(SelectRangeContext.Provider, { value: emptyContextValue, children: props.children }));
|
|
2249
896
|
}
|
|
2250
|
-
return (
|
|
897
|
+
return (jsx(SelectRangeProviderInternal, { initialProps: props.initialProps, children: props.children }));
|
|
2251
898
|
}
|
|
2252
899
|
function SelectRangeProviderInternal(_a) {
|
|
2253
900
|
var initialProps = _a.initialProps, children = _a.children;
|
|
@@ -2336,7 +983,7 @@ function SelectRangeProviderInternal(_a) {
|
|
|
2336
983
|
});
|
|
2337
984
|
}
|
|
2338
985
|
}
|
|
2339
|
-
return (
|
|
986
|
+
return (jsx(SelectRangeContext.Provider, { value: { selected: selected, onDayClick: onDayClick, modifiers: modifiers }, children: children }));
|
|
2340
987
|
}
|
|
2341
988
|
/**
|
|
2342
989
|
* Hook to access the {@link SelectRangeContextValue}.
|
|
@@ -2436,7 +1083,7 @@ function ModifiersProvider(props) {
|
|
|
2436
1083
|
var internalModifiers = getInternalModifiers(dayPicker, selectMultiple, selectRange);
|
|
2437
1084
|
var customModifiers = getCustomModifiers(dayPicker.modifiers);
|
|
2438
1085
|
var modifiers = __assign(__assign({}, internalModifiers), customModifiers);
|
|
2439
|
-
return (
|
|
1086
|
+
return (jsx(ModifiersContext.Provider, { value: modifiers, children: props.children }));
|
|
2440
1087
|
}
|
|
2441
1088
|
/**
|
|
2442
1089
|
* Return the modifiers used by DayPicker.
|
|
@@ -2734,7 +1381,7 @@ function FocusProvider(props) {
|
|
|
2734
1381
|
focusStartOfWeek: function () { return moveFocus('startOfWeek', 'before'); },
|
|
2735
1382
|
focusEndOfWeek: function () { return moveFocus('endOfWeek', 'after'); }
|
|
2736
1383
|
};
|
|
2737
|
-
return (
|
|
1384
|
+
return (jsx(FocusContext.Provider, { value: value, children: props.children }));
|
|
2738
1385
|
}
|
|
2739
1386
|
/**
|
|
2740
1387
|
* Hook to access the {@link FocusContextValue}. Use this hook to handle the
|
|
@@ -2782,9 +1429,9 @@ function SelectSingleProvider(props) {
|
|
|
2782
1429
|
var emptyContextValue = {
|
|
2783
1430
|
selected: undefined
|
|
2784
1431
|
};
|
|
2785
|
-
return (
|
|
1432
|
+
return (jsx(SelectSingleContext.Provider, { value: emptyContextValue, children: props.children }));
|
|
2786
1433
|
}
|
|
2787
|
-
return (
|
|
1434
|
+
return (jsx(SelectSingleProviderInternal, { initialProps: props.initialProps, children: props.children }));
|
|
2788
1435
|
}
|
|
2789
1436
|
function SelectSingleProviderInternal(_a) {
|
|
2790
1437
|
var initialProps = _a.initialProps, children = _a.children;
|
|
@@ -2801,7 +1448,7 @@ function SelectSingleProviderInternal(_a) {
|
|
|
2801
1448
|
selected: initialProps.selected,
|
|
2802
1449
|
onDayClick: onDayClick
|
|
2803
1450
|
};
|
|
2804
|
-
return (
|
|
1451
|
+
return (jsx(SelectSingleContext.Provider, { value: contextValue, children: children }));
|
|
2805
1452
|
}
|
|
2806
1453
|
/**
|
|
2807
1454
|
* Hook to access the {@link SelectSingleContextValue}.
|
|
@@ -3071,7 +1718,7 @@ buttonRef) {
|
|
|
3071
1718
|
var isHidden = Boolean((activeModifiers.outside && !dayPicker.showOutsideDays) ||
|
|
3072
1719
|
activeModifiers.hidden);
|
|
3073
1720
|
var DayContentComponent = (_c = (_b = dayPicker.components) === null || _b === void 0 ? void 0 : _b.DayContent) !== null && _c !== void 0 ? _c : DayContent;
|
|
3074
|
-
var children = (
|
|
1721
|
+
var children = (jsx(DayContentComponent, { date: day, displayMonth: displayMonth, activeModifiers: activeModifiers }));
|
|
3075
1722
|
var divProps = {
|
|
3076
1723
|
style: style,
|
|
3077
1724
|
className: className,
|
|
@@ -3102,12 +1749,12 @@ function Day(props) {
|
|
|
3102
1749
|
var buttonRef = useRef(null);
|
|
3103
1750
|
var dayRender = useDayRender(props.date, props.displayMonth, buttonRef);
|
|
3104
1751
|
if (dayRender.isHidden) {
|
|
3105
|
-
return
|
|
1752
|
+
return jsx("div", { role: "gridcell" });
|
|
3106
1753
|
}
|
|
3107
1754
|
if (!dayRender.isButton) {
|
|
3108
|
-
return
|
|
1755
|
+
return jsx("div", __assign({}, dayRender.divProps));
|
|
3109
1756
|
}
|
|
3110
|
-
return
|
|
1757
|
+
return jsx(Button, __assign({ name: "day", ref: buttonRef }, dayRender.buttonProps));
|
|
3111
1758
|
}
|
|
3112
1759
|
|
|
3113
1760
|
/**
|
|
@@ -3119,13 +1766,13 @@ function WeekNumber(props) {
|
|
|
3119
1766
|
var _a = useDayPicker(), onWeekNumberClick = _a.onWeekNumberClick, styles = _a.styles, classNames = _a.classNames, locale = _a.locale, labelWeekNumber = _a.labels.labelWeekNumber, formatWeekNumber = _a.formatters.formatWeekNumber;
|
|
3120
1767
|
var content = formatWeekNumber(Number(weekNumber), { locale: locale });
|
|
3121
1768
|
if (!onWeekNumberClick) {
|
|
3122
|
-
return (
|
|
1769
|
+
return (jsx("span", { className: classNames.weeknumber, style: styles.weeknumber, children: content }));
|
|
3123
1770
|
}
|
|
3124
1771
|
var label = labelWeekNumber(Number(weekNumber), { locale: locale });
|
|
3125
1772
|
var handleClick = function (e) {
|
|
3126
1773
|
onWeekNumberClick(weekNumber, dates, e);
|
|
3127
1774
|
};
|
|
3128
|
-
return (
|
|
1775
|
+
return (jsx(Button, { name: "week-number", "aria-label": label, className: classNames.weeknumber, style: styles.weeknumber, onClick: handleClick, children: content }));
|
|
3129
1776
|
}
|
|
3130
1777
|
|
|
3131
1778
|
/** Render a row in the calendar, with the days and the week number. */
|
|
@@ -3136,9 +1783,9 @@ function Row(props) {
|
|
|
3136
1783
|
var WeeknumberComponent = (_b = components === null || components === void 0 ? void 0 : components.WeekNumber) !== null && _b !== void 0 ? _b : WeekNumber;
|
|
3137
1784
|
var weekNumberCell;
|
|
3138
1785
|
if (showWeekNumber) {
|
|
3139
|
-
weekNumberCell = (
|
|
1786
|
+
weekNumberCell = (jsx("td", { className: classNames.cell, style: styles.cell, children: jsx(WeeknumberComponent, { number: props.weekNumber, dates: props.dates }) }));
|
|
3140
1787
|
}
|
|
3141
|
-
return (
|
|
1788
|
+
return (jsxs("tr", { className: classNames.row, style: styles.row, children: [weekNumberCell, props.dates.map(function (date) { return (jsx("td", { className: classNames.cell, style: styles.cell, role: "presentation", children: jsx(DayComponent, { displayMonth: props.displayMonth, date: date }) }, getUnixTime(date))); })] }));
|
|
3142
1789
|
}
|
|
3143
1790
|
|
|
3144
1791
|
/** Return the weeks between two dates. */
|
|
@@ -3206,7 +1853,7 @@ function Table(props) {
|
|
|
3206
1853
|
var HeadComponent = (_a = components === null || components === void 0 ? void 0 : components.Head) !== null && _a !== void 0 ? _a : Head;
|
|
3207
1854
|
var RowComponent = (_b = components === null || components === void 0 ? void 0 : components.Row) !== null && _b !== void 0 ? _b : Row;
|
|
3208
1855
|
var FooterComponent = (_c = components === null || components === void 0 ? void 0 : components.Footer) !== null && _c !== void 0 ? _c : Footer;
|
|
3209
|
-
return (
|
|
1856
|
+
return (jsxs("table", { id: props.id, className: classNames.table, style: styles.table, role: "grid", "aria-labelledby": props['aria-labelledby'], children: [!hideHead && jsx(HeadComponent, {}), jsx("tbody", { className: classNames.tbody, style: styles.tbody, children: weeks.map(function (week) { return (jsx(RowComponent, { displayMonth: props.displayMonth, dates: week.dates, weekNumber: week.weekNumber }, week.weekNumber)); }) }), jsx(FooterComponent, { displayMonth: props.displayMonth })] }));
|
|
3210
1857
|
}
|
|
3211
1858
|
|
|
3212
1859
|
/*
|
|
@@ -3372,7 +2019,7 @@ function Month(props) {
|
|
|
3372
2019
|
style = __assign(__assign({}, style), styles.caption_between);
|
|
3373
2020
|
}
|
|
3374
2021
|
var CaptionComponent = (_b = components === null || components === void 0 ? void 0 : components.Caption) !== null && _b !== void 0 ? _b : Caption;
|
|
3375
|
-
return (
|
|
2022
|
+
return (jsxs("div", { className: className.join(' '), style: style, children: [jsx(CaptionComponent, { id: captionId, displayMonth: props.displayMonth, displayIndex: props.displayIndex }), jsx(Table, { id: tableId, "aria-labelledby": captionId, displayMonth: props.displayMonth })] }, props.displayIndex));
|
|
3376
2023
|
}
|
|
3377
2024
|
|
|
3378
2025
|
/**
|
|
@@ -3380,7 +2027,7 @@ function Month(props) {
|
|
|
3380
2027
|
*/
|
|
3381
2028
|
function Months(props) {
|
|
3382
2029
|
var _a = useDayPicker(), classNames = _a.classNames, styles = _a.styles;
|
|
3383
|
-
return (
|
|
2030
|
+
return (jsx("div", { className: classNames.months, style: styles.months, children: props.children }));
|
|
3384
2031
|
}
|
|
3385
2032
|
|
|
3386
2033
|
/** Render the container with the months according to the number of months to display. */
|
|
@@ -3424,13 +2071,13 @@ function Root(_a) {
|
|
|
3424
2071
|
return __assign(__assign({}, attrs), (_a = {}, _a[key] = initialProps[key], _a));
|
|
3425
2072
|
}, {});
|
|
3426
2073
|
var MonthsComponent = (_c = (_b = initialProps.components) === null || _b === void 0 ? void 0 : _b.Months) !== null && _c !== void 0 ? _c : Months;
|
|
3427
|
-
return (
|
|
2074
|
+
return (jsx("div", __assign({ className: classNames.join(' '), style: style, dir: dayPicker.dir, id: dayPicker.id, nonce: initialProps.nonce, title: initialProps.title, lang: initialProps.lang }, dataAttributes, { children: jsx(MonthsComponent, { children: navigation.displayMonths.map(function (month, i) { return (jsx(Month, { displayIndex: i, displayMonth: month }, i)); }) }) })));
|
|
3428
2075
|
}
|
|
3429
2076
|
|
|
3430
2077
|
/** Provide the value for all the context providers. */
|
|
3431
2078
|
function RootProvider(props) {
|
|
3432
2079
|
var children = props.children, initialProps = __rest(props, ["children"]);
|
|
3433
|
-
return (
|
|
2080
|
+
return (jsx(DayPickerProvider, { initialProps: initialProps, children: jsx(NavigationProvider, { children: jsx(SelectSingleProvider, { initialProps: initialProps, children: jsx(SelectMultipleProvider, { initialProps: initialProps, children: jsx(SelectRangeProvider, { initialProps: initialProps, children: jsx(ModifiersProvider, { children: jsx(FocusProvider, { children: children }) }) }) }) }) }) }));
|
|
3434
2081
|
}
|
|
3435
2082
|
|
|
3436
2083
|
/**
|
|
@@ -3521,7 +2168,7 @@ function RootProvider(props) {
|
|
|
3521
2168
|
* ```
|
|
3522
2169
|
*/
|
|
3523
2170
|
function DayPicker(props) {
|
|
3524
|
-
return (
|
|
2171
|
+
return (jsx(RootProvider, __assign({}, props, { children: jsx(Root, { initialProps: props }) })));
|
|
3525
2172
|
}
|
|
3526
2173
|
|
|
3527
2174
|
/** @private */
|