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