react-tooltip 5.5.0 → 5.5.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/dist/react-tooltip.cjs.js +847 -1249
- package/dist/react-tooltip.cjs.min.js +11 -2
- package/dist/react-tooltip.esm.js +848 -1250
- package/dist/react-tooltip.esm.min.js +11 -2
- package/dist/react-tooltip.umd.js +847 -1249
- package/dist/react-tooltip.umd.min.js +11 -2
- package/package.json +6 -6
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
var reactJsxRuntime_development = {};
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* @license React
|
|
15
|
+
/** @license React v16.14.0
|
|
17
16
|
* react-jsx-runtime.development.js
|
|
18
17
|
*
|
|
19
18
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -22,1307 +21,905 @@
|
|
|
22
21
|
* LICENSE file in the root directory of this source tree.
|
|
23
22
|
*/
|
|
24
23
|
|
|
25
|
-
{
|
|
26
|
-
(function() {
|
|
27
|
-
|
|
28
|
-
var React = require$$0__default["default"];
|
|
29
|
-
|
|
30
|
-
// ATTENTION
|
|
31
|
-
// When adding new symbols to this file,
|
|
32
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
33
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
34
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
35
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
36
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
37
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
38
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
39
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
40
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
41
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
42
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
43
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
44
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
45
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
46
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
47
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
48
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
49
|
-
function getIteratorFn(maybeIterable) {
|
|
50
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
55
|
-
|
|
56
|
-
if (typeof maybeIterator === 'function') {
|
|
57
|
-
return maybeIterator;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
64
|
-
|
|
65
|
-
function error(format) {
|
|
66
|
-
{
|
|
67
|
-
{
|
|
68
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
69
|
-
args[_key2 - 1] = arguments[_key2];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
printWarning('error', format, args);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function printWarning(level, format, args) {
|
|
78
|
-
// When changing this logic, you might want to also
|
|
79
|
-
// update consoleWithStackDev.www.js as well.
|
|
80
|
-
{
|
|
81
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
82
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
83
|
-
|
|
84
|
-
if (stack !== '') {
|
|
85
|
-
format += '%s';
|
|
86
|
-
args = args.concat([stack]);
|
|
87
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var argsWithFormat = args.map(function (item) {
|
|
91
|
-
return String(item);
|
|
92
|
-
}); // Careful: RN currently depends on this prefix
|
|
93
|
-
|
|
94
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
95
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
96
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
97
|
-
|
|
98
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// -----------------------------------------------------------------------------
|
|
103
|
-
|
|
104
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
105
|
-
var enableCacheElement = false;
|
|
106
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
107
|
-
|
|
108
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
109
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
110
|
-
// issues in DEV builds.
|
|
111
|
-
|
|
112
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
113
|
-
|
|
114
|
-
var REACT_MODULE_REFERENCE;
|
|
115
|
-
|
|
116
|
-
{
|
|
117
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function isValidElementType(type) {
|
|
121
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
122
|
-
return true;
|
|
123
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
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 ) {
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (typeof type === 'object' && type !== null) {
|
|
131
|
-
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
|
|
132
|
-
// types supported by any Flight configuration anywhere since
|
|
133
|
-
// we don't know which Flight build this will end up being used
|
|
134
|
-
// with.
|
|
135
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
144
|
-
var displayName = outerType.displayName;
|
|
145
|
-
|
|
146
|
-
if (displayName) {
|
|
147
|
-
return displayName;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
151
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
152
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
function getContextName(type) {
|
|
156
|
-
return type.displayName || 'Context';
|
|
157
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
function getComponentNameFromType(type) {
|
|
161
|
-
if (type == null) {
|
|
162
|
-
// Host root, text node or just invalid type.
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
{
|
|
167
|
-
if (typeof type.tag === 'number') {
|
|
168
|
-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (typeof type === 'function') {
|
|
173
|
-
return type.displayName || type.name || null;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (typeof type === 'string') {
|
|
177
|
-
return type;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
switch (type) {
|
|
181
|
-
case REACT_FRAGMENT_TYPE:
|
|
182
|
-
return 'Fragment';
|
|
183
|
-
|
|
184
|
-
case REACT_PORTAL_TYPE:
|
|
185
|
-
return 'Portal';
|
|
186
|
-
|
|
187
|
-
case REACT_PROFILER_TYPE:
|
|
188
|
-
return 'Profiler';
|
|
189
|
-
|
|
190
|
-
case REACT_STRICT_MODE_TYPE:
|
|
191
|
-
return 'StrictMode';
|
|
192
|
-
|
|
193
|
-
case REACT_SUSPENSE_TYPE:
|
|
194
|
-
return 'Suspense';
|
|
195
|
-
|
|
196
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
197
|
-
return 'SuspenseList';
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (typeof type === 'object') {
|
|
202
|
-
switch (type.$$typeof) {
|
|
203
|
-
case REACT_CONTEXT_TYPE:
|
|
204
|
-
var context = type;
|
|
205
|
-
return getContextName(context) + '.Consumer';
|
|
206
|
-
|
|
207
|
-
case REACT_PROVIDER_TYPE:
|
|
208
|
-
var provider = type;
|
|
209
|
-
return getContextName(provider._context) + '.Provider';
|
|
210
|
-
|
|
211
|
-
case REACT_FORWARD_REF_TYPE:
|
|
212
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
213
|
-
|
|
214
|
-
case REACT_MEMO_TYPE:
|
|
215
|
-
var outerName = type.displayName || null;
|
|
216
|
-
|
|
217
|
-
if (outerName !== null) {
|
|
218
|
-
return outerName;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
222
|
-
|
|
223
|
-
case REACT_LAZY_TYPE:
|
|
224
|
-
{
|
|
225
|
-
var lazyComponent = type;
|
|
226
|
-
var payload = lazyComponent._payload;
|
|
227
|
-
var init = lazyComponent._init;
|
|
228
|
-
|
|
229
|
-
try {
|
|
230
|
-
return getComponentNameFromType(init(payload));
|
|
231
|
-
} catch (x) {
|
|
232
|
-
return null;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// eslint-disable-next-line no-fallthrough
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
var assign = Object.assign;
|
|
244
|
-
|
|
245
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
246
|
-
// replaying on render function. This currently only patches the object
|
|
247
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
248
|
-
// We could also eagerly patch the method.
|
|
249
|
-
var disabledDepth = 0;
|
|
250
|
-
var prevLog;
|
|
251
|
-
var prevInfo;
|
|
252
|
-
var prevWarn;
|
|
253
|
-
var prevError;
|
|
254
|
-
var prevGroup;
|
|
255
|
-
var prevGroupCollapsed;
|
|
256
|
-
var prevGroupEnd;
|
|
257
|
-
|
|
258
|
-
function disabledLog() {}
|
|
259
|
-
|
|
260
|
-
disabledLog.__reactDisabledLog = true;
|
|
261
|
-
function disableLogs() {
|
|
262
|
-
{
|
|
263
|
-
if (disabledDepth === 0) {
|
|
264
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
265
|
-
prevLog = console.log;
|
|
266
|
-
prevInfo = console.info;
|
|
267
|
-
prevWarn = console.warn;
|
|
268
|
-
prevError = console.error;
|
|
269
|
-
prevGroup = console.group;
|
|
270
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
271
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
272
|
-
|
|
273
|
-
var props = {
|
|
274
|
-
configurable: true,
|
|
275
|
-
enumerable: true,
|
|
276
|
-
value: disabledLog,
|
|
277
|
-
writable: true
|
|
278
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
279
|
-
|
|
280
|
-
Object.defineProperties(console, {
|
|
281
|
-
info: props,
|
|
282
|
-
log: props,
|
|
283
|
-
warn: props,
|
|
284
|
-
error: props,
|
|
285
|
-
group: props,
|
|
286
|
-
groupCollapsed: props,
|
|
287
|
-
groupEnd: props
|
|
288
|
-
});
|
|
289
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
disabledDepth++;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
function reenableLogs() {
|
|
296
|
-
{
|
|
297
|
-
disabledDepth--;
|
|
298
|
-
|
|
299
|
-
if (disabledDepth === 0) {
|
|
300
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
301
|
-
var props = {
|
|
302
|
-
configurable: true,
|
|
303
|
-
enumerable: true,
|
|
304
|
-
writable: true
|
|
305
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
306
|
-
|
|
307
|
-
Object.defineProperties(console, {
|
|
308
|
-
log: assign({}, props, {
|
|
309
|
-
value: prevLog
|
|
310
|
-
}),
|
|
311
|
-
info: assign({}, props, {
|
|
312
|
-
value: prevInfo
|
|
313
|
-
}),
|
|
314
|
-
warn: assign({}, props, {
|
|
315
|
-
value: prevWarn
|
|
316
|
-
}),
|
|
317
|
-
error: assign({}, props, {
|
|
318
|
-
value: prevError
|
|
319
|
-
}),
|
|
320
|
-
group: assign({}, props, {
|
|
321
|
-
value: prevGroup
|
|
322
|
-
}),
|
|
323
|
-
groupCollapsed: assign({}, props, {
|
|
324
|
-
value: prevGroupCollapsed
|
|
325
|
-
}),
|
|
326
|
-
groupEnd: assign({}, props, {
|
|
327
|
-
value: prevGroupEnd
|
|
328
|
-
})
|
|
329
|
-
});
|
|
330
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
if (disabledDepth < 0) {
|
|
334
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
340
|
-
var prefix;
|
|
341
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
342
|
-
{
|
|
343
|
-
if (prefix === undefined) {
|
|
344
|
-
// Extract the VM specific prefix used by each line.
|
|
345
|
-
try {
|
|
346
|
-
throw Error();
|
|
347
|
-
} catch (x) {
|
|
348
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
349
|
-
prefix = match && match[1] || '';
|
|
350
|
-
}
|
|
351
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
return '\n' + prefix + name;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
var reentry = false;
|
|
358
|
-
var componentFrameCache;
|
|
359
|
-
|
|
360
|
-
{
|
|
361
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
362
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
366
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
367
|
-
if ( !fn || reentry) {
|
|
368
|
-
return '';
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
{
|
|
372
|
-
var frame = componentFrameCache.get(fn);
|
|
373
|
-
|
|
374
|
-
if (frame !== undefined) {
|
|
375
|
-
return frame;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
var control;
|
|
380
|
-
reentry = true;
|
|
381
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
382
|
-
|
|
383
|
-
Error.prepareStackTrace = undefined;
|
|
384
|
-
var previousDispatcher;
|
|
385
|
-
|
|
386
|
-
{
|
|
387
|
-
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
388
|
-
// for warnings.
|
|
389
|
-
|
|
390
|
-
ReactCurrentDispatcher.current = null;
|
|
391
|
-
disableLogs();
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
try {
|
|
395
|
-
// This should throw.
|
|
396
|
-
if (construct) {
|
|
397
|
-
// Something should be setting the props in the constructor.
|
|
398
|
-
var Fake = function () {
|
|
399
|
-
throw Error();
|
|
400
|
-
}; // $FlowFixMe
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
404
|
-
set: function () {
|
|
405
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
406
|
-
// because that won't throw in a non-strict mode function.
|
|
407
|
-
throw Error();
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
412
|
-
// We construct a different control for this case to include any extra
|
|
413
|
-
// frames added by the construct call.
|
|
414
|
-
try {
|
|
415
|
-
Reflect.construct(Fake, []);
|
|
416
|
-
} catch (x) {
|
|
417
|
-
control = x;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
Reflect.construct(fn, [], Fake);
|
|
421
|
-
} else {
|
|
422
|
-
try {
|
|
423
|
-
Fake.call();
|
|
424
|
-
} catch (x) {
|
|
425
|
-
control = x;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
fn.call(Fake.prototype);
|
|
429
|
-
}
|
|
430
|
-
} else {
|
|
431
|
-
try {
|
|
432
|
-
throw Error();
|
|
433
|
-
} catch (x) {
|
|
434
|
-
control = x;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
fn();
|
|
438
|
-
}
|
|
439
|
-
} catch (sample) {
|
|
440
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
441
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
442
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
443
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
444
|
-
var sampleLines = sample.stack.split('\n');
|
|
445
|
-
var controlLines = control.stack.split('\n');
|
|
446
|
-
var s = sampleLines.length - 1;
|
|
447
|
-
var c = controlLines.length - 1;
|
|
448
|
-
|
|
449
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
450
|
-
// We expect at least one stack frame to be shared.
|
|
451
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
452
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
453
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
454
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
455
|
-
// the sample somewhere in the control.
|
|
456
|
-
c--;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
460
|
-
// Next we find the first one that isn't the same which should be the
|
|
461
|
-
// frame that called our sample function and the control.
|
|
462
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
463
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
464
|
-
// If we're about to return the first line, and the control is also on the same
|
|
465
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
466
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
467
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
468
|
-
if (s !== 1 || c !== 1) {
|
|
469
|
-
do {
|
|
470
|
-
s--;
|
|
471
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
472
|
-
// The next one that isn't the same should be our match though.
|
|
473
|
-
|
|
474
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
475
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
476
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
477
|
-
// but we have a user-provided "displayName"
|
|
478
|
-
// splice it in to make the stack more readable.
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
482
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
{
|
|
486
|
-
if (typeof fn === 'function') {
|
|
487
|
-
componentFrameCache.set(fn, _frame);
|
|
488
|
-
}
|
|
489
|
-
} // Return the line we found.
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
return _frame;
|
|
493
|
-
}
|
|
494
|
-
} while (s >= 1 && c >= 0);
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
break;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
} finally {
|
|
502
|
-
reentry = false;
|
|
503
|
-
|
|
504
|
-
{
|
|
505
|
-
ReactCurrentDispatcher.current = previousDispatcher;
|
|
506
|
-
reenableLogs();
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
510
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
514
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
515
|
-
|
|
516
|
-
{
|
|
517
|
-
if (typeof fn === 'function') {
|
|
518
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
return syntheticFrame;
|
|
523
|
-
}
|
|
524
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
525
|
-
{
|
|
526
|
-
return describeNativeComponentFrame(fn, false);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
function shouldConstruct(Component) {
|
|
531
|
-
var prototype = Component.prototype;
|
|
532
|
-
return !!(prototype && prototype.isReactComponent);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
536
|
-
|
|
537
|
-
if (type == null) {
|
|
538
|
-
return '';
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
if (typeof type === 'function') {
|
|
542
|
-
{
|
|
543
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
if (typeof type === 'string') {
|
|
548
|
-
return describeBuiltInComponentFrame(type);
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
switch (type) {
|
|
552
|
-
case REACT_SUSPENSE_TYPE:
|
|
553
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
554
|
-
|
|
555
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
556
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
if (typeof type === 'object') {
|
|
560
|
-
switch (type.$$typeof) {
|
|
561
|
-
case REACT_FORWARD_REF_TYPE:
|
|
562
|
-
return describeFunctionComponentFrame(type.render);
|
|
563
|
-
|
|
564
|
-
case REACT_MEMO_TYPE:
|
|
565
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
566
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
567
|
-
|
|
568
|
-
case REACT_LAZY_TYPE:
|
|
569
|
-
{
|
|
570
|
-
var lazyComponent = type;
|
|
571
|
-
var payload = lazyComponent._payload;
|
|
572
|
-
var init = lazyComponent._init;
|
|
573
|
-
|
|
574
|
-
try {
|
|
575
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
576
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
577
|
-
} catch (x) {}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
return '';
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
586
|
-
|
|
587
|
-
var loggedTypeFailures = {};
|
|
588
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
589
|
-
|
|
590
|
-
function setCurrentlyValidatingElement(element) {
|
|
591
|
-
{
|
|
592
|
-
if (element) {
|
|
593
|
-
var owner = element._owner;
|
|
594
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
595
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
596
|
-
} else {
|
|
597
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
603
|
-
{
|
|
604
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
605
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
606
|
-
|
|
607
|
-
for (var typeSpecName in typeSpecs) {
|
|
608
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
609
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
610
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
611
|
-
// After these have been cleaned up, we'll let them throw.
|
|
612
|
-
|
|
613
|
-
try {
|
|
614
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
615
|
-
// behavior as without this statement except with a better message.
|
|
616
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
617
|
-
// eslint-disable-next-line react-internal/prod-error-codes
|
|
618
|
-
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`.');
|
|
619
|
-
err.name = 'Invariant Violation';
|
|
620
|
-
throw err;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
624
|
-
} catch (ex) {
|
|
625
|
-
error$1 = ex;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
629
|
-
setCurrentlyValidatingElement(element);
|
|
630
|
-
|
|
631
|
-
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);
|
|
632
|
-
|
|
633
|
-
setCurrentlyValidatingElement(null);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
637
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
638
|
-
// same error.
|
|
639
|
-
loggedTypeFailures[error$1.message] = true;
|
|
640
|
-
setCurrentlyValidatingElement(element);
|
|
641
|
-
|
|
642
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
643
|
-
|
|
644
|
-
setCurrentlyValidatingElement(null);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
24
|
+
(function (exports) {
|
|
652
25
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
26
|
+
{
|
|
27
|
+
(function() {
|
|
28
|
+
|
|
29
|
+
var React = require$$0__default["default"];
|
|
30
|
+
|
|
31
|
+
// ATTENTION
|
|
32
|
+
// When adding new symbols to this file,
|
|
33
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
34
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
35
|
+
// nor polyfill, then a plain number is used for performance.
|
|
36
|
+
var REACT_ELEMENT_TYPE = 0xeac7;
|
|
37
|
+
var REACT_PORTAL_TYPE = 0xeaca;
|
|
38
|
+
exports.Fragment = 0xeacb;
|
|
39
|
+
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
|
40
|
+
var REACT_PROFILER_TYPE = 0xead2;
|
|
41
|
+
var REACT_PROVIDER_TYPE = 0xeacd;
|
|
42
|
+
var REACT_CONTEXT_TYPE = 0xeace;
|
|
43
|
+
var REACT_FORWARD_REF_TYPE = 0xead0;
|
|
44
|
+
var REACT_SUSPENSE_TYPE = 0xead1;
|
|
45
|
+
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
|
46
|
+
var REACT_MEMO_TYPE = 0xead3;
|
|
47
|
+
var REACT_LAZY_TYPE = 0xead4;
|
|
48
|
+
var REACT_BLOCK_TYPE = 0xead9;
|
|
49
|
+
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
|
50
|
+
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
|
51
|
+
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
|
52
|
+
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
|
53
|
+
|
|
54
|
+
if (typeof Symbol === 'function' && Symbol.for) {
|
|
55
|
+
var symbolFor = Symbol.for;
|
|
56
|
+
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
|
57
|
+
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
|
58
|
+
exports.Fragment = symbolFor('react.fragment');
|
|
59
|
+
REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
|
|
60
|
+
REACT_PROFILER_TYPE = symbolFor('react.profiler');
|
|
61
|
+
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
|
62
|
+
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
|
63
|
+
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
|
64
|
+
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
|
65
|
+
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
|
66
|
+
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
67
|
+
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
68
|
+
REACT_BLOCK_TYPE = symbolFor('react.block');
|
|
69
|
+
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
|
70
|
+
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
|
71
|
+
symbolFor('react.scope');
|
|
72
|
+
symbolFor('react.opaque.id');
|
|
73
|
+
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
|
74
|
+
symbolFor('react.offscreen');
|
|
75
|
+
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
|
76
|
+
}
|
|
656
77
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
664
|
-
* of the `value` object).
|
|
665
|
-
*/
|
|
666
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
667
|
-
function typeName(value) {
|
|
668
|
-
{
|
|
669
|
-
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
670
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
671
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
672
|
-
return type;
|
|
673
|
-
}
|
|
674
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
78
|
+
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
79
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
80
|
+
function getIteratorFn(maybeIterable) {
|
|
81
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
675
84
|
|
|
85
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
676
86
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
testStringCoercion(value);
|
|
681
|
-
return false;
|
|
682
|
-
} catch (e) {
|
|
683
|
-
return true;
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
87
|
+
if (typeof maybeIterator === 'function') {
|
|
88
|
+
return maybeIterator;
|
|
89
|
+
}
|
|
687
90
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
691
|
-
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
692
|
-
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
693
|
-
//
|
|
694
|
-
// The most common types that will cause this exception are `Symbol` instances
|
|
695
|
-
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
696
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
697
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
698
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
699
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
700
|
-
//
|
|
701
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
702
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
703
|
-
//
|
|
704
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
705
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
706
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
707
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
708
|
-
// In most cases, this console output also shows the component and its
|
|
709
|
-
// ancestor components where the exception happened.
|
|
710
|
-
//
|
|
711
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
712
|
-
return '' + value;
|
|
713
|
-
}
|
|
714
|
-
function checkKeyStringCoercion(value) {
|
|
715
|
-
{
|
|
716
|
-
if (willCoercionThrow(value)) {
|
|
717
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
718
93
|
|
|
719
|
-
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
}
|
|
94
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
723
95
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
__source: true
|
|
730
|
-
};
|
|
731
|
-
var specialPropKeyWarningShown;
|
|
732
|
-
var specialPropRefWarningShown;
|
|
733
|
-
var didWarnAboutStringRefs;
|
|
96
|
+
function error(format) {
|
|
97
|
+
{
|
|
98
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
99
|
+
args[_key2 - 1] = arguments[_key2];
|
|
100
|
+
}
|
|
734
101
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
102
|
+
printWarning('error', format, args);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
738
105
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
106
|
+
function printWarning(level, format, args) {
|
|
107
|
+
// When changing this logic, you might want to also
|
|
108
|
+
// update consoleWithStackDev.www.js as well.
|
|
109
|
+
{
|
|
110
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
111
|
+
var stack = '';
|
|
743
112
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
113
|
+
if (currentlyValidatingElement) {
|
|
114
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
115
|
+
var owner = currentlyValidatingElement._owner;
|
|
116
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
117
|
+
}
|
|
749
118
|
|
|
750
|
-
|
|
751
|
-
}
|
|
119
|
+
stack += ReactDebugCurrentFrame.getStackAddendum();
|
|
752
120
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
121
|
+
if (stack !== '') {
|
|
122
|
+
format += '%s';
|
|
123
|
+
args = args.concat([stack]);
|
|
124
|
+
}
|
|
757
125
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
762
|
-
}
|
|
126
|
+
var argsWithFormat = args.map(function (item) {
|
|
127
|
+
return '' + item;
|
|
128
|
+
}); // Careful: RN currently depends on this prefix
|
|
763
129
|
|
|
764
|
-
|
|
765
|
-
|
|
130
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
131
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
132
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
766
133
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
134
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
771
137
|
|
|
772
|
-
|
|
773
|
-
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);
|
|
138
|
+
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
774
139
|
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
}
|
|
140
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
780
141
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
specialPropKeyWarningShown = true;
|
|
786
|
-
|
|
787
|
-
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);
|
|
788
|
-
}
|
|
789
|
-
};
|
|
142
|
+
function isValidElementType(type) {
|
|
143
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
144
|
+
return true;
|
|
145
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
790
146
|
|
|
791
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
792
|
-
Object.defineProperty(props, 'key', {
|
|
793
|
-
get: warnAboutAccessingKey,
|
|
794
|
-
configurable: true
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
147
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
if (!specialPropRefWarningShown) {
|
|
803
|
-
specialPropRefWarningShown = true;
|
|
148
|
+
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
804
151
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
152
|
+
if (typeof type === 'object' && type !== null) {
|
|
153
|
+
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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
808
157
|
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
get: warnAboutAccessingRef,
|
|
812
|
-
configurable: true
|
|
813
|
-
});
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
/**
|
|
817
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
818
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
819
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
820
|
-
* if something is a React Element.
|
|
821
|
-
*
|
|
822
|
-
* @param {*} type
|
|
823
|
-
* @param {*} props
|
|
824
|
-
* @param {*} key
|
|
825
|
-
* @param {string|object} ref
|
|
826
|
-
* @param {*} owner
|
|
827
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
828
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
829
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
830
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
831
|
-
* change in behavior.
|
|
832
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
833
|
-
* indicating filename, line number, and/or other information.
|
|
834
|
-
* @internal
|
|
835
|
-
*/
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
836
160
|
|
|
837
161
|
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
842
|
-
// Built-in properties that belong on the element
|
|
843
|
-
type: type,
|
|
844
|
-
key: key,
|
|
845
|
-
ref: ref,
|
|
846
|
-
props: props,
|
|
847
|
-
// Record the component responsible for creating this element.
|
|
848
|
-
_owner: owner
|
|
849
|
-
};
|
|
162
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
163
|
+
function describeComponentFrame (name, source, ownerName) {
|
|
164
|
+
var sourceInfo = '';
|
|
850
165
|
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
855
|
-
// commonly used development environments.
|
|
856
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
857
|
-
// the validation flag non-enumerable (where possible, which should
|
|
858
|
-
// include every environment we run tests in), so the test framework
|
|
859
|
-
// ignores it.
|
|
860
|
-
|
|
861
|
-
Object.defineProperty(element._store, 'validated', {
|
|
862
|
-
configurable: false,
|
|
863
|
-
enumerable: false,
|
|
864
|
-
writable: true,
|
|
865
|
-
value: false
|
|
866
|
-
}); // self and source are DEV only properties.
|
|
867
|
-
|
|
868
|
-
Object.defineProperty(element, '_self', {
|
|
869
|
-
configurable: false,
|
|
870
|
-
enumerable: false,
|
|
871
|
-
writable: false,
|
|
872
|
-
value: self
|
|
873
|
-
}); // Two elements created in two different places should be considered
|
|
874
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
875
|
-
|
|
876
|
-
Object.defineProperty(element, '_source', {
|
|
877
|
-
configurable: false,
|
|
878
|
-
enumerable: false,
|
|
879
|
-
writable: false,
|
|
880
|
-
value: source
|
|
881
|
-
});
|
|
166
|
+
if (source) {
|
|
167
|
+
var path = source.fileName;
|
|
168
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
882
169
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
170
|
+
{
|
|
171
|
+
// In DEV, include code for a common special case:
|
|
172
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
173
|
+
if (/^index\./.test(fileName)) {
|
|
174
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
888
175
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
893
|
-
* @param {*} type
|
|
894
|
-
* @param {object} props
|
|
895
|
-
* @param {string} key
|
|
896
|
-
*/
|
|
897
|
-
|
|
898
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
899
|
-
{
|
|
900
|
-
var propName; // Reserved names are extracted
|
|
901
|
-
|
|
902
|
-
var props = {};
|
|
903
|
-
var key = null;
|
|
904
|
-
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
905
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
906
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
907
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
908
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
909
|
-
// key is explicitly declared to be undefined or not.
|
|
910
|
-
|
|
911
|
-
if (maybeKey !== undefined) {
|
|
912
|
-
{
|
|
913
|
-
checkKeyStringCoercion(maybeKey);
|
|
914
|
-
}
|
|
176
|
+
if (match) {
|
|
177
|
+
var pathBeforeSlash = match[1];
|
|
915
178
|
|
|
916
|
-
|
|
917
|
-
|
|
179
|
+
if (pathBeforeSlash) {
|
|
180
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
181
|
+
fileName = folderName + '/' + fileName;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
918
186
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
187
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
188
|
+
} else if (ownerName) {
|
|
189
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
190
|
+
}
|
|
923
191
|
|
|
924
|
-
|
|
925
|
-
|
|
192
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
193
|
+
}
|
|
926
194
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
195
|
+
var Resolved = 1;
|
|
196
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
197
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
198
|
+
}
|
|
931
199
|
|
|
200
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
201
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
202
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
203
|
+
}
|
|
932
204
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
205
|
+
function getComponentName(type) {
|
|
206
|
+
if (type == null) {
|
|
207
|
+
// Host root, text node or just invalid type.
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
938
210
|
|
|
211
|
+
{
|
|
212
|
+
if (typeof type.tag === 'number') {
|
|
213
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
939
216
|
|
|
940
|
-
|
|
941
|
-
|
|
217
|
+
if (typeof type === 'function') {
|
|
218
|
+
return type.displayName || type.name || null;
|
|
219
|
+
}
|
|
942
220
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
}
|
|
221
|
+
if (typeof type === 'string') {
|
|
222
|
+
return type;
|
|
223
|
+
}
|
|
949
224
|
|
|
950
|
-
|
|
951
|
-
|
|
225
|
+
switch (type) {
|
|
226
|
+
case exports.Fragment:
|
|
227
|
+
return 'Fragment';
|
|
952
228
|
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
}
|
|
229
|
+
case REACT_PORTAL_TYPE:
|
|
230
|
+
return 'Portal';
|
|
956
231
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
}
|
|
960
|
-
}
|
|
232
|
+
case REACT_PROFILER_TYPE:
|
|
233
|
+
return "Profiler";
|
|
961
234
|
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
}
|
|
235
|
+
case REACT_STRICT_MODE_TYPE:
|
|
236
|
+
return 'StrictMode';
|
|
965
237
|
|
|
966
|
-
|
|
967
|
-
|
|
238
|
+
case REACT_SUSPENSE_TYPE:
|
|
239
|
+
return 'Suspense';
|
|
968
240
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
var owner = element._owner;
|
|
973
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
974
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
975
|
-
} else {
|
|
976
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
}
|
|
241
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
242
|
+
return 'SuspenseList';
|
|
243
|
+
}
|
|
980
244
|
|
|
981
|
-
|
|
245
|
+
if (typeof type === 'object') {
|
|
246
|
+
switch (type.$$typeof) {
|
|
247
|
+
case REACT_CONTEXT_TYPE:
|
|
248
|
+
return 'Context.Consumer';
|
|
982
249
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
}
|
|
986
|
-
/**
|
|
987
|
-
* Verifies the object is a ReactElement.
|
|
988
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
989
|
-
* @param {?object} object
|
|
990
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
991
|
-
* @final
|
|
992
|
-
*/
|
|
250
|
+
case REACT_PROVIDER_TYPE:
|
|
251
|
+
return 'Context.Provider';
|
|
993
252
|
|
|
253
|
+
case REACT_FORWARD_REF_TYPE:
|
|
254
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
994
255
|
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
998
|
-
}
|
|
999
|
-
}
|
|
256
|
+
case REACT_MEMO_TYPE:
|
|
257
|
+
return getComponentName(type.type);
|
|
1000
258
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
if (ReactCurrentOwner$1.current) {
|
|
1004
|
-
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
259
|
+
case REACT_BLOCK_TYPE:
|
|
260
|
+
return getComponentName(type.render);
|
|
1005
261
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
262
|
+
case REACT_LAZY_TYPE:
|
|
263
|
+
{
|
|
264
|
+
var thenable = type;
|
|
265
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
1010
266
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
267
|
+
if (resolvedThenable) {
|
|
268
|
+
return getComponentName(resolvedThenable);
|
|
269
|
+
}
|
|
1014
270
|
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
var lineNumber = source.lineNumber;
|
|
1020
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
1021
|
-
}
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
1022
275
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
}
|
|
1026
|
-
/**
|
|
1027
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1028
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
1029
|
-
* updates.
|
|
1030
|
-
*/
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
1031
278
|
|
|
279
|
+
var loggedTypeFailures = {};
|
|
280
|
+
ReactSharedInternals.ReactDebugCurrentFrame;
|
|
281
|
+
var currentlyValidatingElement = null;
|
|
1032
282
|
|
|
1033
|
-
|
|
283
|
+
function setCurrentlyValidatingElement(element) {
|
|
284
|
+
{
|
|
285
|
+
currentlyValidatingElement = element;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
1034
288
|
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
289
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
290
|
+
{
|
|
291
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
292
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
293
|
+
|
|
294
|
+
for (var typeSpecName in typeSpecs) {
|
|
295
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
296
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
297
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
298
|
+
// After these have been cleaned up, we'll let them throw.
|
|
299
|
+
|
|
300
|
+
try {
|
|
301
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
302
|
+
// behavior as without this statement except with a better message.
|
|
303
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
304
|
+
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`.');
|
|
305
|
+
err.name = 'Invariant Violation';
|
|
306
|
+
throw err;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
310
|
+
} catch (ex) {
|
|
311
|
+
error$1 = ex;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
315
|
+
setCurrentlyValidatingElement(element);
|
|
316
|
+
|
|
317
|
+
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);
|
|
318
|
+
|
|
319
|
+
setCurrentlyValidatingElement(null);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
323
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
324
|
+
// same error.
|
|
325
|
+
loggedTypeFailures[error$1.message] = true;
|
|
326
|
+
setCurrentlyValidatingElement(element);
|
|
327
|
+
|
|
328
|
+
error('Failed %s type: %s', location, error$1.message);
|
|
329
|
+
|
|
330
|
+
setCurrentlyValidatingElement(null);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
1038
336
|
|
|
1039
|
-
|
|
1040
|
-
|
|
337
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
338
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
339
|
+
var RESERVED_PROPS = {
|
|
340
|
+
key: true,
|
|
341
|
+
ref: true,
|
|
342
|
+
__self: true,
|
|
343
|
+
__source: true
|
|
344
|
+
};
|
|
345
|
+
var specialPropKeyWarningShown;
|
|
346
|
+
var specialPropRefWarningShown;
|
|
347
|
+
var didWarnAboutStringRefs;
|
|
1041
348
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
}
|
|
349
|
+
{
|
|
350
|
+
didWarnAboutStringRefs = {};
|
|
351
|
+
}
|
|
1046
352
|
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1052
|
-
* This element is in an array. The array could grow and shrink or be
|
|
1053
|
-
* reordered. All children that haven't already been validated are required to
|
|
1054
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1055
|
-
* will only be shown once.
|
|
1056
|
-
*
|
|
1057
|
-
* @internal
|
|
1058
|
-
* @param {ReactElement} element Element that requires a key.
|
|
1059
|
-
* @param {*} parentType element's parent's type.
|
|
1060
|
-
*/
|
|
353
|
+
function hasValidRef(config) {
|
|
354
|
+
{
|
|
355
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
356
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
1061
357
|
|
|
358
|
+
if (getter && getter.isReactWarning) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
1062
363
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
1066
|
-
return;
|
|
1067
|
-
}
|
|
364
|
+
return config.ref !== undefined;
|
|
365
|
+
}
|
|
1068
366
|
|
|
1069
|
-
|
|
1070
|
-
|
|
367
|
+
function hasValidKey(config) {
|
|
368
|
+
{
|
|
369
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
370
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
1071
371
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
372
|
+
if (getter && getter.isReactWarning) {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
1075
377
|
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
// assigning it a key.
|
|
378
|
+
return config.key !== undefined;
|
|
379
|
+
}
|
|
1079
380
|
|
|
1080
|
-
|
|
381
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
382
|
+
{
|
|
383
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
384
|
+
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
1081
385
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1085
|
-
}
|
|
386
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
387
|
+
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', getComponentName(ReactCurrentOwner.current.type), config.ref);
|
|
1086
388
|
|
|
1087
|
-
|
|
389
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
1088
394
|
|
|
1089
|
-
|
|
395
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
396
|
+
{
|
|
397
|
+
var warnAboutAccessingKey = function () {
|
|
398
|
+
if (!specialPropKeyWarningShown) {
|
|
399
|
+
specialPropKeyWarningShown = true;
|
|
400
|
+
|
|
401
|
+
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);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
406
|
+
Object.defineProperty(props, 'key', {
|
|
407
|
+
get: warnAboutAccessingKey,
|
|
408
|
+
configurable: true
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
1090
412
|
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
413
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
414
|
+
{
|
|
415
|
+
var warnAboutAccessingRef = function () {
|
|
416
|
+
if (!specialPropRefWarningShown) {
|
|
417
|
+
specialPropRefWarningShown = true;
|
|
418
|
+
|
|
419
|
+
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);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
424
|
+
Object.defineProperty(props, 'ref', {
|
|
425
|
+
get: warnAboutAccessingRef,
|
|
426
|
+
configurable: true
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
432
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
433
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
434
|
+
* if something is a React Element.
|
|
435
|
+
*
|
|
436
|
+
* @param {*} type
|
|
437
|
+
* @param {*} props
|
|
438
|
+
* @param {*} key
|
|
439
|
+
* @param {string|object} ref
|
|
440
|
+
* @param {*} owner
|
|
441
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
442
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
443
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
444
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
445
|
+
* change in behavior.
|
|
446
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
447
|
+
* indicating filename, line number, and/or other information.
|
|
448
|
+
* @internal
|
|
449
|
+
*/
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
453
|
+
var element = {
|
|
454
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
455
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
456
|
+
// Built-in properties that belong on the element
|
|
457
|
+
type: type,
|
|
458
|
+
key: key,
|
|
459
|
+
ref: ref,
|
|
460
|
+
props: props,
|
|
461
|
+
// Record the component responsible for creating this element.
|
|
462
|
+
_owner: owner
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
{
|
|
466
|
+
// The validation flag is currently mutative. We put it on
|
|
467
|
+
// an external backing store so that we can freeze the whole object.
|
|
468
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
469
|
+
// commonly used development environments.
|
|
470
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
471
|
+
// the validation flag non-enumerable (where possible, which should
|
|
472
|
+
// include every environment we run tests in), so the test framework
|
|
473
|
+
// ignores it.
|
|
474
|
+
|
|
475
|
+
Object.defineProperty(element._store, 'validated', {
|
|
476
|
+
configurable: false,
|
|
477
|
+
enumerable: false,
|
|
478
|
+
writable: true,
|
|
479
|
+
value: false
|
|
480
|
+
}); // self and source are DEV only properties.
|
|
481
|
+
|
|
482
|
+
Object.defineProperty(element, '_self', {
|
|
483
|
+
configurable: false,
|
|
484
|
+
enumerable: false,
|
|
485
|
+
writable: false,
|
|
486
|
+
value: self
|
|
487
|
+
}); // Two elements created in two different places should be considered
|
|
488
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
489
|
+
|
|
490
|
+
Object.defineProperty(element, '_source', {
|
|
491
|
+
configurable: false,
|
|
492
|
+
enumerable: false,
|
|
493
|
+
writable: false,
|
|
494
|
+
value: source
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
if (Object.freeze) {
|
|
498
|
+
Object.freeze(element.props);
|
|
499
|
+
Object.freeze(element);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
return element;
|
|
504
|
+
};
|
|
505
|
+
/**
|
|
506
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
507
|
+
* @param {*} type
|
|
508
|
+
* @param {object} props
|
|
509
|
+
* @param {string} key
|
|
510
|
+
*/
|
|
511
|
+
|
|
512
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
513
|
+
{
|
|
514
|
+
var propName; // Reserved names are extracted
|
|
515
|
+
|
|
516
|
+
var props = {};
|
|
517
|
+
var key = null;
|
|
518
|
+
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
519
|
+
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
520
|
+
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
521
|
+
// but as an intermediary step, we will use jsxDEV for everything except
|
|
522
|
+
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
523
|
+
// key is explicitly declared to be undefined or not.
|
|
524
|
+
|
|
525
|
+
if (maybeKey !== undefined) {
|
|
526
|
+
key = '' + maybeKey;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (hasValidKey(config)) {
|
|
530
|
+
key = '' + config.key;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (hasValidRef(config)) {
|
|
534
|
+
ref = config.ref;
|
|
535
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
536
|
+
} // Remaining properties are added to a new props object
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
for (propName in config) {
|
|
540
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
541
|
+
props[propName] = config[propName];
|
|
542
|
+
}
|
|
543
|
+
} // Resolve default props
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
if (type && type.defaultProps) {
|
|
547
|
+
var defaultProps = type.defaultProps;
|
|
548
|
+
|
|
549
|
+
for (propName in defaultProps) {
|
|
550
|
+
if (props[propName] === undefined) {
|
|
551
|
+
props[propName] = defaultProps[propName];
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (key || ref) {
|
|
557
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
558
|
+
|
|
559
|
+
if (key) {
|
|
560
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (ref) {
|
|
564
|
+
defineRefPropWarningGetter(props, displayName);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
1103
571
|
|
|
572
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
573
|
+
ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1104
574
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
return;
|
|
1109
|
-
}
|
|
575
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
576
|
+
currentlyValidatingElement = element;
|
|
577
|
+
}
|
|
1110
578
|
|
|
1111
|
-
|
|
1112
|
-
for (var i = 0; i < node.length; i++) {
|
|
1113
|
-
var child = node[i];
|
|
579
|
+
var propTypesMisspellWarningShown;
|
|
1114
580
|
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
var iterator = iteratorFn.call(node);
|
|
1132
|
-
var step;
|
|
1133
|
-
|
|
1134
|
-
while (!(step = iterator.next()).done) {
|
|
1135
|
-
if (isValidElement(step.value)) {
|
|
1136
|
-
validateExplicitKey(step.value, parentType);
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
1146
|
-
* provided by the type.
|
|
1147
|
-
*
|
|
1148
|
-
* @param {ReactElement} element
|
|
1149
|
-
*/
|
|
581
|
+
{
|
|
582
|
+
propTypesMisspellWarningShown = false;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Verifies the object is a ReactElement.
|
|
586
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
587
|
+
* @param {?object} object
|
|
588
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
589
|
+
* @final
|
|
590
|
+
*/
|
|
591
|
+
|
|
592
|
+
function isValidElement(object) {
|
|
593
|
+
{
|
|
594
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
1150
597
|
|
|
598
|
+
function getDeclarationErrorAddendum() {
|
|
599
|
+
{
|
|
600
|
+
if (ReactCurrentOwner$1.current) {
|
|
601
|
+
var name = getComponentName(ReactCurrentOwner$1.current.type);
|
|
1151
602
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
603
|
+
if (name) {
|
|
604
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
605
|
+
}
|
|
606
|
+
}
|
|
1155
607
|
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
608
|
+
return '';
|
|
609
|
+
}
|
|
610
|
+
}
|
|
1159
611
|
|
|
1160
|
-
|
|
612
|
+
function getSourceInfoErrorAddendum(source) {
|
|
613
|
+
{
|
|
614
|
+
if (source !== undefined) {
|
|
615
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
616
|
+
var lineNumber = source.lineNumber;
|
|
617
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
618
|
+
}
|
|
1161
619
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
}
|
|
620
|
+
return '';
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
625
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
626
|
+
* updates.
|
|
627
|
+
*/
|
|
1171
628
|
|
|
1172
|
-
if (propTypes) {
|
|
1173
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
1174
|
-
var name = getComponentNameFromType(type);
|
|
1175
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1176
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1177
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1178
629
|
|
|
1179
|
-
|
|
630
|
+
var ownerHasKeyUseWarning = {};
|
|
1180
631
|
|
|
1181
|
-
|
|
1182
|
-
|
|
632
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
633
|
+
{
|
|
634
|
+
var info = getDeclarationErrorAddendum();
|
|
1183
635
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
/**
|
|
1190
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
1191
|
-
* @param {ReactElement} fragment
|
|
1192
|
-
*/
|
|
636
|
+
if (!info) {
|
|
637
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1193
638
|
|
|
639
|
+
if (parentName) {
|
|
640
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
641
|
+
}
|
|
642
|
+
}
|
|
1194
643
|
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
644
|
+
return info;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
649
|
+
* This element is in an array. The array could grow and shrink or be
|
|
650
|
+
* reordered. All children that haven't already been validated are required to
|
|
651
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
652
|
+
* will only be shown once.
|
|
653
|
+
*
|
|
654
|
+
* @internal
|
|
655
|
+
* @param {ReactElement} element Element that requires a key.
|
|
656
|
+
* @param {*} parentType element's parent's type.
|
|
657
|
+
*/
|
|
1198
658
|
|
|
1199
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1200
|
-
var key = keys[i];
|
|
1201
659
|
|
|
1202
|
-
|
|
1203
|
-
|
|
660
|
+
function validateExplicitKey(element, parentType) {
|
|
661
|
+
{
|
|
662
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
1204
665
|
|
|
1205
|
-
|
|
666
|
+
element._store.validated = true;
|
|
667
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1206
668
|
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
}
|
|
669
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
1211
672
|
|
|
1212
|
-
|
|
1213
|
-
|
|
673
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
674
|
+
// property, it may be the creator of the child that's responsible for
|
|
675
|
+
// assigning it a key.
|
|
1214
676
|
|
|
1215
|
-
|
|
677
|
+
var childOwner = '';
|
|
1216
678
|
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
679
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
680
|
+
// Give the component that originally created this child.
|
|
681
|
+
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
|
|
682
|
+
}
|
|
1221
683
|
|
|
1222
|
-
|
|
1223
|
-
{
|
|
1224
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1225
|
-
// succeed and there will likely be errors in render.
|
|
684
|
+
setCurrentlyValidatingElement$1(element);
|
|
1226
685
|
|
|
1227
|
-
|
|
1228
|
-
var info = '';
|
|
686
|
+
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);
|
|
1229
687
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
688
|
+
setCurrentlyValidatingElement$1(null);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Ensure that every element either is passed in a static location, in an
|
|
693
|
+
* array with an explicit keys property defined, or in an object literal
|
|
694
|
+
* with valid key property.
|
|
695
|
+
*
|
|
696
|
+
* @internal
|
|
697
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
698
|
+
* @param {*} parentType node's parent's type.
|
|
699
|
+
*/
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
function validateChildKeys(node, parentType) {
|
|
703
|
+
{
|
|
704
|
+
if (typeof node !== 'object') {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
if (Array.isArray(node)) {
|
|
709
|
+
for (var i = 0; i < node.length; i++) {
|
|
710
|
+
var child = node[i];
|
|
711
|
+
|
|
712
|
+
if (isValidElement(child)) {
|
|
713
|
+
validateExplicitKey(child, parentType);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
} else if (isValidElement(node)) {
|
|
717
|
+
// This element was passed in a valid location.
|
|
718
|
+
if (node._store) {
|
|
719
|
+
node._store.validated = true;
|
|
720
|
+
}
|
|
721
|
+
} else if (node) {
|
|
722
|
+
var iteratorFn = getIteratorFn(node);
|
|
723
|
+
|
|
724
|
+
if (typeof iteratorFn === 'function') {
|
|
725
|
+
// Entry iterators used to provide implicit keys,
|
|
726
|
+
// but now we print a separate warning for them later.
|
|
727
|
+
if (iteratorFn !== node.entries) {
|
|
728
|
+
var iterator = iteratorFn.call(node);
|
|
729
|
+
var step;
|
|
730
|
+
|
|
731
|
+
while (!(step = iterator.next()).done) {
|
|
732
|
+
if (isValidElement(step.value)) {
|
|
733
|
+
validateExplicitKey(step.value, parentType);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
743
|
+
* provided by the type.
|
|
744
|
+
*
|
|
745
|
+
* @param {ReactElement} element
|
|
746
|
+
*/
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
function validatePropTypes(element) {
|
|
750
|
+
{
|
|
751
|
+
var type = element.type;
|
|
752
|
+
|
|
753
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
var propTypes;
|
|
758
|
+
|
|
759
|
+
if (typeof type === 'function') {
|
|
760
|
+
propTypes = type.propTypes;
|
|
761
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
762
|
+
// Inner props are checked in the reconciler.
|
|
763
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
764
|
+
propTypes = type.propTypes;
|
|
765
|
+
} else {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
if (propTypes) {
|
|
770
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
|
771
|
+
var name = getComponentName(type);
|
|
772
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
773
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
774
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
775
|
+
|
|
776
|
+
var _name = getComponentName(type);
|
|
777
|
+
|
|
778
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
782
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
788
|
+
* @param {ReactElement} fragment
|
|
789
|
+
*/
|
|
1233
790
|
|
|
1234
|
-
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
1235
791
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
info += getDeclarationErrorAddendum();
|
|
1240
|
-
}
|
|
792
|
+
function validateFragmentProps(fragment) {
|
|
793
|
+
{
|
|
794
|
+
var keys = Object.keys(fragment.props);
|
|
1241
795
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
if (type === null) {
|
|
1245
|
-
typeString = 'null';
|
|
1246
|
-
} else if (isArray(type)) {
|
|
1247
|
-
typeString = 'array';
|
|
1248
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1249
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
1250
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1251
|
-
} else {
|
|
1252
|
-
typeString = typeof type;
|
|
1253
|
-
}
|
|
796
|
+
for (var i = 0; i < keys.length; i++) {
|
|
797
|
+
var key = keys[i];
|
|
1254
798
|
|
|
1255
|
-
|
|
1256
|
-
|
|
799
|
+
if (key !== 'children' && key !== 'key') {
|
|
800
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
1257
801
|
|
|
1258
|
-
|
|
1259
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
802
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1260
803
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
1266
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1267
|
-
// fixed, the key warnings will appear.)
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
if (validType) {
|
|
1271
|
-
var children = props.children;
|
|
1272
|
-
|
|
1273
|
-
if (children !== undefined) {
|
|
1274
|
-
if (isStaticChildren) {
|
|
1275
|
-
if (isArray(children)) {
|
|
1276
|
-
for (var i = 0; i < children.length; i++) {
|
|
1277
|
-
validateChildKeys(children[i], type);
|
|
1278
|
-
}
|
|
804
|
+
setCurrentlyValidatingElement$1(null);
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
1279
808
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
}
|
|
1283
|
-
} else {
|
|
1284
|
-
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.');
|
|
1285
|
-
}
|
|
1286
|
-
} else {
|
|
1287
|
-
validateChildKeys(children, type);
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
809
|
+
if (fragment.ref !== null) {
|
|
810
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
1291
811
|
|
|
1292
|
-
|
|
1293
|
-
validateFragmentProps(element);
|
|
1294
|
-
} else {
|
|
1295
|
-
validatePropTypes(element);
|
|
1296
|
-
}
|
|
812
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1297
813
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
// opt-in behavior for better messages but that we won't stop
|
|
1303
|
-
// giving you warnings if you use production apis.
|
|
814
|
+
setCurrentlyValidatingElement$1(null);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
1304
818
|
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
819
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
820
|
+
{
|
|
821
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
822
|
+
// succeed and there will likely be errors in render.
|
|
823
|
+
|
|
824
|
+
if (!validType) {
|
|
825
|
+
var info = '';
|
|
826
|
+
|
|
827
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
828
|
+
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.";
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
832
|
+
|
|
833
|
+
if (sourceInfo) {
|
|
834
|
+
info += sourceInfo;
|
|
835
|
+
} else {
|
|
836
|
+
info += getDeclarationErrorAddendum();
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
var typeString;
|
|
840
|
+
|
|
841
|
+
if (type === null) {
|
|
842
|
+
typeString = 'null';
|
|
843
|
+
} else if (Array.isArray(type)) {
|
|
844
|
+
typeString = 'array';
|
|
845
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
846
|
+
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
847
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
848
|
+
} else {
|
|
849
|
+
typeString = typeof type;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
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);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
856
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
857
|
+
|
|
858
|
+
if (element == null) {
|
|
859
|
+
return element;
|
|
860
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
861
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
862
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
863
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
864
|
+
// fixed, the key warnings will appear.)
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
if (validType) {
|
|
868
|
+
var children = props.children;
|
|
869
|
+
|
|
870
|
+
if (children !== undefined) {
|
|
871
|
+
if (isStaticChildren) {
|
|
872
|
+
if (Array.isArray(children)) {
|
|
873
|
+
for (var i = 0; i < children.length; i++) {
|
|
874
|
+
validateChildKeys(children[i], type);
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
if (Object.freeze) {
|
|
878
|
+
Object.freeze(children);
|
|
879
|
+
}
|
|
880
|
+
} else {
|
|
881
|
+
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.');
|
|
882
|
+
}
|
|
883
|
+
} else {
|
|
884
|
+
validateChildKeys(children, type);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
if (type === exports.Fragment) {
|
|
890
|
+
validateFragmentProps(element);
|
|
891
|
+
} else {
|
|
892
|
+
validatePropTypes(element);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
return element;
|
|
896
|
+
}
|
|
897
|
+
} // These two functions exist to still get child warnings in dev
|
|
898
|
+
// even with the prod transform. This means that jsxDEV is purely
|
|
899
|
+
// opt-in behavior for better messages but that we won't stop
|
|
900
|
+
// giving you warnings if you use production apis.
|
|
901
|
+
|
|
902
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
903
|
+
{
|
|
904
|
+
return jsxWithValidation(type, props, key, true);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
908
|
+
{
|
|
909
|
+
return jsxWithValidation(type, props, key, false);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
1315
912
|
|
|
1316
|
-
|
|
1317
|
-
|
|
913
|
+
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
914
|
+
// for now we can ship identical prod functions
|
|
1318
915
|
|
|
1319
|
-
|
|
916
|
+
var jsxs = jsxWithValidationStatic ;
|
|
1320
917
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
}
|
|
918
|
+
exports.jsx = jsx;
|
|
919
|
+
exports.jsxs = jsxs;
|
|
920
|
+
})();
|
|
921
|
+
}
|
|
922
|
+
} (reactJsxRuntime_development));
|
|
1326
923
|
|
|
1327
924
|
(function (module) {
|
|
1328
925
|
|
|
@@ -1419,7 +1016,8 @@
|
|
|
1419
1016
|
return jsxRuntime.exports.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
1420
1017
|
};
|
|
1421
1018
|
|
|
1422
|
-
const
|
|
1019
|
+
const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
|
|
1020
|
+
const DEFAULT_CONTEXT_DATA = {
|
|
1423
1021
|
anchorRefs: new Set(),
|
|
1424
1022
|
activeAnchor: { current: null },
|
|
1425
1023
|
attach: () => {
|
|
@@ -1432,15 +1030,16 @@
|
|
|
1432
1030
|
/* set active anchor */
|
|
1433
1031
|
},
|
|
1434
1032
|
};
|
|
1435
|
-
const
|
|
1436
|
-
|
|
1033
|
+
const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
1034
|
+
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
1035
|
+
};
|
|
1036
|
+
const TooltipContext = require$$0.createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
1437
1037
|
const TooltipProvider = ({ children }) => {
|
|
1438
|
-
const defaultTooltipId = require$$0.useId();
|
|
1439
1038
|
const [anchorRefMap, setAnchorRefMap] = require$$0.useState({
|
|
1440
|
-
[
|
|
1039
|
+
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
1441
1040
|
});
|
|
1442
1041
|
const [activeAnchorMap, setActiveAnchorMap] = require$$0.useState({
|
|
1443
|
-
[
|
|
1042
|
+
[DEFAULT_TOOLTIP_ID]: { current: null },
|
|
1444
1043
|
});
|
|
1445
1044
|
const attach = (tooltipId, ...refs) => {
|
|
1446
1045
|
setAnchorRefMap((oldMap) => {
|
|
@@ -1474,36 +1073,29 @@
|
|
|
1474
1073
|
return { ...oldMap, [tooltipId]: ref };
|
|
1475
1074
|
});
|
|
1476
1075
|
};
|
|
1477
|
-
const getTooltipData = require$$0.useCallback((tooltipId) => {
|
|
1076
|
+
const getTooltipData = require$$0.useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
|
|
1478
1077
|
var _a, _b;
|
|
1479
1078
|
return ({
|
|
1480
|
-
anchorRefs: (_a = anchorRefMap[tooltipId
|
|
1481
|
-
activeAnchor: (_b = activeAnchorMap[tooltipId
|
|
1482
|
-
attach: (...refs) => attach(tooltipId
|
|
1483
|
-
detach: (...refs) => detach(tooltipId
|
|
1484
|
-
setActiveAnchor: (ref) => setActiveAnchor(tooltipId
|
|
1079
|
+
anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
|
|
1080
|
+
activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
|
|
1081
|
+
attach: (...refs) => attach(tooltipId, ...refs),
|
|
1082
|
+
detach: (...refs) => detach(tooltipId, ...refs),
|
|
1083
|
+
setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
|
|
1485
1084
|
});
|
|
1486
|
-
}, [
|
|
1085
|
+
}, [anchorRefMap, activeAnchorMap, attach, detach]);
|
|
1487
1086
|
const context = require$$0.useMemo(() => {
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1087
|
+
return {
|
|
1088
|
+
getTooltipData,
|
|
1089
|
+
};
|
|
1491
1090
|
}, [getTooltipData]);
|
|
1492
1091
|
return jsxRuntime.exports.jsx(TooltipContext.Provider, { value: context, children: children });
|
|
1493
1092
|
};
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
const { anchorRefs, attach, detach } = useTooltip()
|
|
1497
|
-
|
|
1498
|
-
// this will use the tooltip with id `tooltip-id`
|
|
1499
|
-
const { anchorRefs, attach, detach } = useTooltip()('tooltip-id')
|
|
1500
|
-
*/
|
|
1501
|
-
function useTooltip() {
|
|
1502
|
-
return require$$0.useContext(TooltipContext);
|
|
1093
|
+
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
1094
|
+
return require$$0.useContext(TooltipContext).getTooltipData(tooltipId);
|
|
1503
1095
|
}
|
|
1504
1096
|
|
|
1505
1097
|
const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
|
|
1506
|
-
const { attach, detach } = useTooltip(
|
|
1098
|
+
const { attach, detach } = useTooltip(tooltipId);
|
|
1507
1099
|
const anchorRef = require$$0.useRef(null);
|
|
1508
1100
|
require$$0.useEffect(() => {
|
|
1509
1101
|
attach(anchorRef);
|
|
@@ -2752,7 +2344,7 @@
|
|
|
2752
2344
|
// props
|
|
2753
2345
|
id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style: externalStyles, position, afterShow, afterHide,
|
|
2754
2346
|
// props handled by controller
|
|
2755
|
-
|
|
2347
|
+
content, html, isOpen, setIsOpen, }) => {
|
|
2756
2348
|
const tooltipRef = require$$0.useRef(null);
|
|
2757
2349
|
const tooltipArrowRef = require$$0.useRef(null);
|
|
2758
2350
|
const tooltipShowDelayTimerRef = require$$0.useRef(null);
|
|
@@ -2763,7 +2355,7 @@
|
|
|
2763
2355
|
const wasShowing = require$$0.useRef(false);
|
|
2764
2356
|
const [calculatingPosition, setCalculatingPosition] = require$$0.useState(false);
|
|
2765
2357
|
const lastFloatPosition = require$$0.useRef(null);
|
|
2766
|
-
const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(
|
|
2358
|
+
const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id);
|
|
2767
2359
|
const [activeAnchor, setActiveAnchor] = require$$0.useState({ current: null });
|
|
2768
2360
|
const hoveringTooltip = require$$0.useRef(false);
|
|
2769
2361
|
const handleShow = (value) => {
|
|
@@ -3007,7 +2599,18 @@
|
|
|
3007
2599
|
return () => {
|
|
3008
2600
|
mounted = false;
|
|
3009
2601
|
};
|
|
3010
|
-
}, [
|
|
2602
|
+
}, [
|
|
2603
|
+
show,
|
|
2604
|
+
isOpen,
|
|
2605
|
+
anchorId,
|
|
2606
|
+
activeAnchor,
|
|
2607
|
+
content,
|
|
2608
|
+
html,
|
|
2609
|
+
place,
|
|
2610
|
+
offset,
|
|
2611
|
+
positionStrategy,
|
|
2612
|
+
position,
|
|
2613
|
+
]);
|
|
3011
2614
|
require$$0.useEffect(() => {
|
|
3012
2615
|
return () => {
|
|
3013
2616
|
if (tooltipShowDelayTimerRef.current) {
|
|
@@ -3018,18 +2621,19 @@
|
|
|
3018
2621
|
}
|
|
3019
2622
|
};
|
|
3020
2623
|
}, []);
|
|
3021
|
-
const hasContentOrChildren = Boolean(content || children);
|
|
2624
|
+
const hasContentOrChildren = Boolean(html || content || children);
|
|
3022
2625
|
return (jsxRuntime.exports.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, {
|
|
3023
2626
|
[styles['show']]: hasContentOrChildren && !calculatingPosition && (isOpen || show),
|
|
3024
2627
|
[styles['fixed']]: positionStrategy === 'fixed',
|
|
3025
2628
|
[styles['clickable']]: clickable,
|
|
3026
|
-
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [children || (
|
|
2629
|
+
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [children || (html && jsxRuntime.exports.jsx(TooltipContent, { content: html })) || content, jsxRuntime.exports.jsx("div", { className: classNames('react-tooltip-arrow', styles['arrow'], classNameArrow, {
|
|
3027
2630
|
[styles['no-arrow']]: noArrow,
|
|
3028
2631
|
}), style: inlineArrowStyles, ref: tooltipArrowRef })] }));
|
|
3029
2632
|
};
|
|
3030
2633
|
|
|
3031
2634
|
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
|
|
3032
|
-
const [tooltipContent, setTooltipContent] = require$$0.useState(content
|
|
2635
|
+
const [tooltipContent, setTooltipContent] = require$$0.useState(content);
|
|
2636
|
+
const [tooltipHtml, setTooltipHtml] = require$$0.useState(html);
|
|
3033
2637
|
const [tooltipPlace, setTooltipPlace] = require$$0.useState(place);
|
|
3034
2638
|
const [tooltipVariant, setTooltipVariant] = require$$0.useState(variant);
|
|
3035
2639
|
const [tooltipOffset, setTooltipOffset] = require$$0.useState(offset);
|
|
@@ -3039,8 +2643,7 @@
|
|
|
3039
2643
|
const [tooltipWrapper, setTooltipWrapper] = require$$0.useState(wrapper);
|
|
3040
2644
|
const [tooltipEvents, setTooltipEvents] = require$$0.useState(events);
|
|
3041
2645
|
const [tooltipPositionStrategy, setTooltipPositionStrategy] = require$$0.useState(positionStrategy);
|
|
3042
|
-
const
|
|
3043
|
-
const { anchorRefs, activeAnchor } = useTooltip()(id);
|
|
2646
|
+
const { anchorRefs, activeAnchor } = useTooltip(id);
|
|
3044
2647
|
const getDataAttributesFromAnchorElement = (elementReference) => {
|
|
3045
2648
|
const dataAttributes = elementReference === null || elementReference === void 0 ? void 0 : elementReference.getAttributeNames().reduce((acc, name) => {
|
|
3046
2649
|
var _a;
|
|
@@ -3062,9 +2665,7 @@
|
|
|
3062
2665
|
setTooltipContent(value !== null && value !== void 0 ? value : content);
|
|
3063
2666
|
},
|
|
3064
2667
|
html: (value) => {
|
|
3065
|
-
|
|
3066
|
-
setIsHtmlContent(Boolean(value !== null && value !== void 0 ? value : html));
|
|
3067
|
-
setTooltipContent((_a = value !== null && value !== void 0 ? value : html) !== null && _a !== void 0 ? _a : content);
|
|
2668
|
+
setTooltipHtml(value !== null && value !== void 0 ? value : html);
|
|
3068
2669
|
},
|
|
3069
2670
|
variant: (value) => {
|
|
3070
2671
|
var _a;
|
|
@@ -3104,14 +2705,11 @@
|
|
|
3104
2705
|
});
|
|
3105
2706
|
};
|
|
3106
2707
|
require$$0.useEffect(() => {
|
|
3107
|
-
setIsHtmlContent(false);
|
|
3108
2708
|
setTooltipContent(content);
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
}
|
|
3114
|
-
}, [content, html]);
|
|
2709
|
+
}, [content]);
|
|
2710
|
+
require$$0.useEffect(() => {
|
|
2711
|
+
setTooltipHtml(html);
|
|
2712
|
+
}, [html]);
|
|
3115
2713
|
require$$0.useEffect(() => {
|
|
3116
2714
|
var _a;
|
|
3117
2715
|
const elementRefs = new Set(anchorRefs);
|
|
@@ -3122,16 +2720,17 @@
|
|
|
3122
2720
|
if (!elementRefs.size) {
|
|
3123
2721
|
return () => null;
|
|
3124
2722
|
}
|
|
2723
|
+
const anchorElement = (_a = activeAnchor.current) !== null && _a !== void 0 ? _a : anchorById;
|
|
3125
2724
|
const observerCallback = (mutationList) => {
|
|
3126
2725
|
mutationList.forEach((mutation) => {
|
|
3127
2726
|
var _a;
|
|
3128
|
-
if (!
|
|
2727
|
+
if (!anchorElement ||
|
|
3129
2728
|
mutation.type !== 'attributes' ||
|
|
3130
2729
|
!((_a = mutation.attributeName) === null || _a === void 0 ? void 0 : _a.startsWith('data-tooltip-'))) {
|
|
3131
2730
|
return;
|
|
3132
2731
|
}
|
|
3133
2732
|
// make sure to get all set attributes, since all unset attributes are reset
|
|
3134
|
-
const dataAttributes = getDataAttributesFromAnchorElement(
|
|
2733
|
+
const dataAttributes = getDataAttributesFromAnchorElement(anchorElement);
|
|
3135
2734
|
applyAllDataAttributesFromAnchorElement(dataAttributes);
|
|
3136
2735
|
});
|
|
3137
2736
|
};
|
|
@@ -3140,12 +2739,11 @@
|
|
|
3140
2739
|
// do not check for subtree and childrens, we only want to know attribute changes
|
|
3141
2740
|
// to stay watching `data-attributes-*` from anchor element
|
|
3142
2741
|
const observerConfig = { attributes: true, childList: false, subtree: false };
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
const dataAttributes = getDataAttributesFromAnchorElement(element);
|
|
2742
|
+
if (anchorElement) {
|
|
2743
|
+
const dataAttributes = getDataAttributesFromAnchorElement(anchorElement);
|
|
3146
2744
|
applyAllDataAttributesFromAnchorElement(dataAttributes);
|
|
3147
2745
|
// Start observing the target node for configured mutations
|
|
3148
|
-
observer.observe(
|
|
2746
|
+
observer.observe(anchorElement, observerConfig);
|
|
3149
2747
|
}
|
|
3150
2748
|
return () => {
|
|
3151
2749
|
// Remove the observer when the tooltip is destroyed
|
|
@@ -3158,7 +2756,7 @@
|
|
|
3158
2756
|
className,
|
|
3159
2757
|
classNameArrow,
|
|
3160
2758
|
content: tooltipContent,
|
|
3161
|
-
|
|
2759
|
+
html: tooltipHtml,
|
|
3162
2760
|
place: tooltipPlace,
|
|
3163
2761
|
variant: tooltipVariant,
|
|
3164
2762
|
offset: tooltipOffset,
|