react-tooltip 5.8.2-beta.4 → 5.8.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 +1155 -505
- package/dist/react-tooltip.cjs.min.js +11 -2
- package/dist/react-tooltip.d.ts +7 -3
- package/dist/react-tooltip.esm.js +1114 -462
- package/dist/react-tooltip.esm.min.js +11 -2
- package/dist/react-tooltip.umd.js +1158 -507
- package/dist/react-tooltip.umd.min.js +11 -2
- package/package.json +1 -2
|
@@ -1,5 +1,1112 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import require$$0, { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect, useLayoutEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = {exports: {}};
|
|
4
|
+
|
|
5
|
+
var reactJsxRuntime_development = {};
|
|
6
|
+
|
|
7
|
+
/** @license React v16.14.0
|
|
8
|
+
* react-jsx-runtime.development.js
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
(function (exports) {
|
|
17
|
+
|
|
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
|
+
}
|
|
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
|
+
}
|
|
76
|
+
|
|
77
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
78
|
+
|
|
79
|
+
if (typeof maybeIterator === 'function') {
|
|
80
|
+
return maybeIterator;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
87
|
+
|
|
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
|
+
}
|
|
93
|
+
|
|
94
|
+
printWarning('error', format, args);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
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 = '';
|
|
104
|
+
|
|
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
|
+
}
|
|
110
|
+
|
|
111
|
+
stack += ReactDebugCurrentFrame.getStackAddendum();
|
|
112
|
+
|
|
113
|
+
if (stack !== '') {
|
|
114
|
+
format += '%s';
|
|
115
|
+
args = args.concat([stack]);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var argsWithFormat = args.map(function (item) {
|
|
119
|
+
return '' + item;
|
|
120
|
+
}); // Careful: RN currently depends on this prefix
|
|
121
|
+
|
|
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
|
|
125
|
+
|
|
126
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
131
|
+
|
|
132
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
133
|
+
|
|
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).
|
|
138
|
+
|
|
139
|
+
|
|
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
|
+
}
|
|
143
|
+
|
|
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
|
+
}
|
|
149
|
+
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
155
|
+
function describeComponentFrame (name, source, ownerName) {
|
|
156
|
+
var sourceInfo = '';
|
|
157
|
+
|
|
158
|
+
if (source) {
|
|
159
|
+
var path = source.fileName;
|
|
160
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
161
|
+
|
|
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);
|
|
167
|
+
|
|
168
|
+
if (match) {
|
|
169
|
+
var pathBeforeSlash = match[1];
|
|
170
|
+
|
|
171
|
+
if (pathBeforeSlash) {
|
|
172
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
173
|
+
fileName = folderName + '/' + fileName;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
180
|
+
} else if (ownerName) {
|
|
181
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
var Resolved = 1;
|
|
188
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
189
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
193
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
194
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function getComponentName(type) {
|
|
198
|
+
if (type == null) {
|
|
199
|
+
// Host root, text node or just invalid type.
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
|
|
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
|
+
}
|
|
208
|
+
|
|
209
|
+
if (typeof type === 'function') {
|
|
210
|
+
return type.displayName || type.name || null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (typeof type === 'string') {
|
|
214
|
+
return type;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
switch (type) {
|
|
218
|
+
case exports.Fragment:
|
|
219
|
+
return 'Fragment';
|
|
220
|
+
|
|
221
|
+
case REACT_PORTAL_TYPE:
|
|
222
|
+
return 'Portal';
|
|
223
|
+
|
|
224
|
+
case REACT_PROFILER_TYPE:
|
|
225
|
+
return "Profiler";
|
|
226
|
+
|
|
227
|
+
case REACT_STRICT_MODE_TYPE:
|
|
228
|
+
return 'StrictMode';
|
|
229
|
+
|
|
230
|
+
case REACT_SUSPENSE_TYPE:
|
|
231
|
+
return 'Suspense';
|
|
232
|
+
|
|
233
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
234
|
+
return 'SuspenseList';
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (typeof type === 'object') {
|
|
238
|
+
switch (type.$$typeof) {
|
|
239
|
+
case REACT_CONTEXT_TYPE:
|
|
240
|
+
return 'Context.Consumer';
|
|
241
|
+
|
|
242
|
+
case REACT_PROVIDER_TYPE:
|
|
243
|
+
return 'Context.Provider';
|
|
244
|
+
|
|
245
|
+
case REACT_FORWARD_REF_TYPE:
|
|
246
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
247
|
+
|
|
248
|
+
case REACT_MEMO_TYPE:
|
|
249
|
+
return getComponentName(type.type);
|
|
250
|
+
|
|
251
|
+
case REACT_BLOCK_TYPE:
|
|
252
|
+
return getComponentName(type.render);
|
|
253
|
+
|
|
254
|
+
case REACT_LAZY_TYPE:
|
|
255
|
+
{
|
|
256
|
+
var thenable = type;
|
|
257
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
258
|
+
|
|
259
|
+
if (resolvedThenable) {
|
|
260
|
+
return getComponentName(resolvedThenable);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
var loggedTypeFailures = {};
|
|
272
|
+
ReactSharedInternals.ReactDebugCurrentFrame;
|
|
273
|
+
var currentlyValidatingElement = null;
|
|
274
|
+
|
|
275
|
+
function setCurrentlyValidatingElement(element) {
|
|
276
|
+
{
|
|
277
|
+
currentlyValidatingElement = element;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
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
|
+
}
|
|
328
|
+
|
|
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;
|
|
340
|
+
|
|
341
|
+
{
|
|
342
|
+
didWarnAboutStringRefs = {};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function hasValidRef(config) {
|
|
346
|
+
{
|
|
347
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
348
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
349
|
+
|
|
350
|
+
if (getter && getter.isReactWarning) {
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return config.ref !== undefined;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function hasValidKey(config) {
|
|
360
|
+
{
|
|
361
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
362
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
363
|
+
|
|
364
|
+
if (getter && getter.isReactWarning) {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return config.key !== undefined;
|
|
371
|
+
}
|
|
372
|
+
|
|
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);
|
|
377
|
+
|
|
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);
|
|
380
|
+
|
|
381
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
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
|
+
}
|
|
404
|
+
|
|
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
|
+
}
|
|
563
|
+
|
|
564
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
565
|
+
ReactSharedInternals.ReactDebugCurrentFrame;
|
|
566
|
+
|
|
567
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
568
|
+
currentlyValidatingElement = element;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
var propTypesMisspellWarningShown;
|
|
572
|
+
|
|
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
|
+
}
|
|
589
|
+
|
|
590
|
+
function getDeclarationErrorAddendum() {
|
|
591
|
+
{
|
|
592
|
+
if (ReactCurrentOwner$1.current) {
|
|
593
|
+
var name = getComponentName(ReactCurrentOwner$1.current.type);
|
|
594
|
+
|
|
595
|
+
if (name) {
|
|
596
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
return '';
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
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
|
+
}
|
|
611
|
+
|
|
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
|
+
*/
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
var ownerHasKeyUseWarning = {};
|
|
623
|
+
|
|
624
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
625
|
+
{
|
|
626
|
+
var info = getDeclarationErrorAddendum();
|
|
627
|
+
|
|
628
|
+
if (!info) {
|
|
629
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
630
|
+
|
|
631
|
+
if (parentName) {
|
|
632
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
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
|
+
*/
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
function validateExplicitKey(element, parentType) {
|
|
653
|
+
{
|
|
654
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
element._store.validated = true;
|
|
659
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
660
|
+
|
|
661
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
|
|
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.
|
|
668
|
+
|
|
669
|
+
var childOwner = '';
|
|
670
|
+
|
|
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
|
+
}
|
|
675
|
+
|
|
676
|
+
setCurrentlyValidatingElement$1(element);
|
|
677
|
+
|
|
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);
|
|
679
|
+
|
|
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
|
+
*/
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
function validateFragmentProps(fragment) {
|
|
785
|
+
{
|
|
786
|
+
var keys = Object.keys(fragment.props);
|
|
787
|
+
|
|
788
|
+
for (var i = 0; i < keys.length; i++) {
|
|
789
|
+
var key = keys[i];
|
|
790
|
+
|
|
791
|
+
if (key !== 'children' && key !== 'key') {
|
|
792
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
793
|
+
|
|
794
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
795
|
+
|
|
796
|
+
setCurrentlyValidatingElement$1(null);
|
|
797
|
+
break;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
if (fragment.ref !== null) {
|
|
802
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
803
|
+
|
|
804
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
805
|
+
|
|
806
|
+
setCurrentlyValidatingElement$1(null);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
|
|
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
|
+
}
|
|
904
|
+
|
|
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
|
|
907
|
+
|
|
908
|
+
var jsxs = jsxWithValidationStatic ;
|
|
909
|
+
|
|
910
|
+
exports.jsx = jsx;
|
|
911
|
+
exports.jsxs = jsxs;
|
|
912
|
+
})();
|
|
913
|
+
}
|
|
914
|
+
} (reactJsxRuntime_development));
|
|
915
|
+
|
|
916
|
+
(function (module) {
|
|
917
|
+
|
|
918
|
+
{
|
|
919
|
+
module.exports = reactJsxRuntime_development;
|
|
920
|
+
}
|
|
921
|
+
} (jsxRuntime));
|
|
922
|
+
|
|
923
|
+
var classnames = {exports: {}};
|
|
924
|
+
|
|
925
|
+
/*!
|
|
926
|
+
Copyright (c) 2018 Jed Watson.
|
|
927
|
+
Licensed under the MIT License (MIT), see
|
|
928
|
+
http://jedwatson.github.io/classnames
|
|
929
|
+
*/
|
|
930
|
+
|
|
931
|
+
(function (module) {
|
|
932
|
+
/* global define */
|
|
933
|
+
|
|
934
|
+
(function () {
|
|
935
|
+
|
|
936
|
+
var hasOwn = {}.hasOwnProperty;
|
|
937
|
+
|
|
938
|
+
function classNames() {
|
|
939
|
+
var classes = [];
|
|
940
|
+
|
|
941
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
942
|
+
var arg = arguments[i];
|
|
943
|
+
if (!arg) continue;
|
|
944
|
+
|
|
945
|
+
var argType = typeof arg;
|
|
946
|
+
|
|
947
|
+
if (argType === 'string' || argType === 'number') {
|
|
948
|
+
classes.push(arg);
|
|
949
|
+
} else if (Array.isArray(arg)) {
|
|
950
|
+
if (arg.length) {
|
|
951
|
+
var inner = classNames.apply(null, arg);
|
|
952
|
+
if (inner) {
|
|
953
|
+
classes.push(inner);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
} else if (argType === 'object') {
|
|
957
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
958
|
+
classes.push(arg.toString());
|
|
959
|
+
continue;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
for (var key in arg) {
|
|
963
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
964
|
+
classes.push(key);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
return classes.join(' ');
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
if (module.exports) {
|
|
974
|
+
classNames.default = classNames;
|
|
975
|
+
module.exports = classNames;
|
|
976
|
+
} else {
|
|
977
|
+
window.classNames = classNames;
|
|
978
|
+
}
|
|
979
|
+
}());
|
|
980
|
+
} (classnames));
|
|
981
|
+
|
|
982
|
+
var classNames = classnames.exports;
|
|
983
|
+
|
|
984
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
985
|
+
/**
|
|
986
|
+
* This function debounce the received function
|
|
987
|
+
* @param { function } func Function to be debounced
|
|
988
|
+
* @param { number } wait Time to wait before execut the function
|
|
989
|
+
* @param { boolean } immediate Param to define if the function will be executed immediately
|
|
990
|
+
*/
|
|
991
|
+
const debounce = (func, wait, immediate) => {
|
|
992
|
+
let timeout = null;
|
|
993
|
+
return function debounced(...args) {
|
|
994
|
+
const later = () => {
|
|
995
|
+
timeout = null;
|
|
996
|
+
if (!immediate) {
|
|
997
|
+
func.apply(this, args);
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
if (timeout) {
|
|
1001
|
+
clearTimeout(timeout);
|
|
1002
|
+
}
|
|
1003
|
+
timeout = setTimeout(later, wait);
|
|
1004
|
+
};
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
const TooltipContent = ({ content }) => {
|
|
1008
|
+
return jsxRuntime.exports.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1011
|
+
const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
|
|
1012
|
+
const DEFAULT_CONTEXT_DATA = {
|
|
1013
|
+
anchorRefs: new Set(),
|
|
1014
|
+
activeAnchor: { current: null },
|
|
1015
|
+
attach: () => {
|
|
1016
|
+
/* attach anchor element */
|
|
1017
|
+
},
|
|
1018
|
+
detach: () => {
|
|
1019
|
+
/* detach anchor element */
|
|
1020
|
+
},
|
|
1021
|
+
setActiveAnchor: () => {
|
|
1022
|
+
/* set active anchor */
|
|
1023
|
+
},
|
|
1024
|
+
};
|
|
1025
|
+
const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
1026
|
+
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
1027
|
+
};
|
|
1028
|
+
const TooltipContext = createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
1029
|
+
/**
|
|
1030
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
1031
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
1032
|
+
*/
|
|
1033
|
+
const TooltipProvider = ({ children }) => {
|
|
1034
|
+
const [anchorRefMap, setAnchorRefMap] = useState({
|
|
1035
|
+
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
1036
|
+
});
|
|
1037
|
+
const [activeAnchorMap, setActiveAnchorMap] = useState({
|
|
1038
|
+
[DEFAULT_TOOLTIP_ID]: { current: null },
|
|
1039
|
+
});
|
|
1040
|
+
const attach = (tooltipId, ...refs) => {
|
|
1041
|
+
setAnchorRefMap((oldMap) => {
|
|
1042
|
+
var _a;
|
|
1043
|
+
const tooltipRefs = (_a = oldMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set();
|
|
1044
|
+
refs.forEach((ref) => tooltipRefs.add(ref));
|
|
1045
|
+
// create new object to trigger re-render
|
|
1046
|
+
return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
|
|
1047
|
+
});
|
|
1048
|
+
};
|
|
1049
|
+
const detach = (tooltipId, ...refs) => {
|
|
1050
|
+
setAnchorRefMap((oldMap) => {
|
|
1051
|
+
const tooltipRefs = oldMap[tooltipId];
|
|
1052
|
+
if (!tooltipRefs) {
|
|
1053
|
+
// tooltip not found
|
|
1054
|
+
// maybe thow error?
|
|
1055
|
+
return oldMap;
|
|
1056
|
+
}
|
|
1057
|
+
refs.forEach((ref) => tooltipRefs.delete(ref));
|
|
1058
|
+
// create new object to trigger re-render
|
|
1059
|
+
return { ...oldMap };
|
|
1060
|
+
});
|
|
1061
|
+
};
|
|
1062
|
+
const setActiveAnchor = (tooltipId, ref) => {
|
|
1063
|
+
setActiveAnchorMap((oldMap) => {
|
|
1064
|
+
var _a;
|
|
1065
|
+
if (((_a = oldMap[tooltipId]) === null || _a === void 0 ? void 0 : _a.current) === ref.current) {
|
|
1066
|
+
return oldMap;
|
|
1067
|
+
}
|
|
1068
|
+
// create new object to trigger re-render
|
|
1069
|
+
return { ...oldMap, [tooltipId]: ref };
|
|
1070
|
+
});
|
|
1071
|
+
};
|
|
1072
|
+
const getTooltipData = useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
|
|
1073
|
+
var _a, _b;
|
|
1074
|
+
return ({
|
|
1075
|
+
anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
|
|
1076
|
+
activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
|
|
1077
|
+
attach: (...refs) => attach(tooltipId, ...refs),
|
|
1078
|
+
detach: (...refs) => detach(tooltipId, ...refs),
|
|
1079
|
+
setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
|
|
1080
|
+
});
|
|
1081
|
+
}, [anchorRefMap, activeAnchorMap, attach, detach]);
|
|
1082
|
+
const context = useMemo(() => {
|
|
1083
|
+
return {
|
|
1084
|
+
getTooltipData,
|
|
1085
|
+
};
|
|
1086
|
+
}, [getTooltipData]);
|
|
1087
|
+
return jsxRuntime.exports.jsx(TooltipContext.Provider, { value: context, children: children });
|
|
1088
|
+
};
|
|
1089
|
+
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
1090
|
+
return useContext(TooltipContext).getTooltipData(tooltipId);
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
1095
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
1096
|
+
*/
|
|
1097
|
+
const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
|
|
1098
|
+
const { attach, detach } = useTooltip(tooltipId);
|
|
1099
|
+
const anchorRef = useRef(null);
|
|
1100
|
+
useEffect(() => {
|
|
1101
|
+
attach(anchorRef);
|
|
1102
|
+
return () => {
|
|
1103
|
+
detach(anchorRef);
|
|
1104
|
+
};
|
|
1105
|
+
}, []);
|
|
1106
|
+
return (jsxRuntime.exports.jsx("span", { ref: anchorRef, className: classNames('react-tooltip-wrapper', className), "data-tooltip-place": place, "data-tooltip-content": content, "data-tooltip-html": html, "data-tooltip-variant": variant, "data-tooltip-offset": offset, "data-tooltip-wrapper": wrapper, "data-tooltip-events": events, "data-tooltip-position-strategy": positionStrategy, "data-tooltip-delay-show": delayShow, "data-tooltip-delay-hide": delayHide, children: children }));
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
3
1110
|
|
|
4
1111
|
function getAlignment(placement) {
|
|
5
1112
|
return placement.split('-')[1];
|
|
@@ -353,9 +1460,6 @@ const arrow = options => ({
|
|
|
353
1460
|
}
|
|
354
1461
|
});
|
|
355
1462
|
|
|
356
|
-
const sides = ['top', 'right', 'bottom', 'left'];
|
|
357
|
-
const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
|
|
358
|
-
|
|
359
1463
|
const oppositeSideMap = {
|
|
360
1464
|
left: 'right',
|
|
361
1465
|
right: 'left',
|
|
@@ -391,104 +1495,6 @@ function getOppositeAlignmentPlacement(placement) {
|
|
|
391
1495
|
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
392
1496
|
}
|
|
393
1497
|
|
|
394
|
-
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
395
|
-
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
|
|
396
|
-
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
397
|
-
if (alignment) {
|
|
398
|
-
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
399
|
-
}
|
|
400
|
-
return true;
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Automatically chooses the `placement` which has the most space available.
|
|
405
|
-
* @see https://floating-ui.com/docs/autoPlacement
|
|
406
|
-
*/
|
|
407
|
-
const autoPlacement = function (options) {
|
|
408
|
-
if (options === void 0) {
|
|
409
|
-
options = {};
|
|
410
|
-
}
|
|
411
|
-
return {
|
|
412
|
-
name: 'autoPlacement',
|
|
413
|
-
options,
|
|
414
|
-
async fn(middlewareArguments) {
|
|
415
|
-
var _middlewareData$autoP, _middlewareData$autoP2, _placementsSortedByLe;
|
|
416
|
-
const {
|
|
417
|
-
rects,
|
|
418
|
-
middlewareData,
|
|
419
|
-
placement,
|
|
420
|
-
platform,
|
|
421
|
-
elements
|
|
422
|
-
} = middlewareArguments;
|
|
423
|
-
const {
|
|
424
|
-
alignment,
|
|
425
|
-
allowedPlacements = allPlacements,
|
|
426
|
-
autoAlignment = true,
|
|
427
|
-
...detectOverflowOptions
|
|
428
|
-
} = options;
|
|
429
|
-
const placements = alignment !== undefined || allowedPlacements === allPlacements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
430
|
-
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
431
|
-
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
432
|
-
const currentPlacement = placements[currentIndex];
|
|
433
|
-
if (currentPlacement == null) {
|
|
434
|
-
return {};
|
|
435
|
-
}
|
|
436
|
-
const {
|
|
437
|
-
main,
|
|
438
|
-
cross
|
|
439
|
-
} = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
440
|
-
|
|
441
|
-
// Make `computeCoords` start from the right place.
|
|
442
|
-
if (placement !== currentPlacement) {
|
|
443
|
-
return {
|
|
444
|
-
reset: {
|
|
445
|
-
placement: placements[0]
|
|
446
|
-
}
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
|
-
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main], overflow[cross]];
|
|
450
|
-
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
|
|
451
|
-
placement: currentPlacement,
|
|
452
|
-
overflows: currentOverflows
|
|
453
|
-
}];
|
|
454
|
-
const nextPlacement = placements[currentIndex + 1];
|
|
455
|
-
|
|
456
|
-
// There are more placements to check.
|
|
457
|
-
if (nextPlacement) {
|
|
458
|
-
return {
|
|
459
|
-
data: {
|
|
460
|
-
index: currentIndex + 1,
|
|
461
|
-
overflows: allOverflows
|
|
462
|
-
},
|
|
463
|
-
reset: {
|
|
464
|
-
placement: nextPlacement
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
|
|
469
|
-
const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {
|
|
470
|
-
let {
|
|
471
|
-
overflows
|
|
472
|
-
} = _ref;
|
|
473
|
-
return overflows.every(overflow => overflow <= 0);
|
|
474
|
-
})) == null ? void 0 : _placementsSortedByLe.placement;
|
|
475
|
-
const resetPlacement = placementThatFitsOnAllSides || placementsSortedByLeastOverflow[0].placement;
|
|
476
|
-
if (resetPlacement !== placement) {
|
|
477
|
-
return {
|
|
478
|
-
data: {
|
|
479
|
-
index: currentIndex + 1,
|
|
480
|
-
overflows: allOverflows
|
|
481
|
-
},
|
|
482
|
-
reset: {
|
|
483
|
-
placement: resetPlacement
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
return {};
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
};
|
|
491
|
-
|
|
492
1498
|
function getExpandedPlacements(placement) {
|
|
493
1499
|
const oppositePlacement = getOppositePlacement(placement);
|
|
494
1500
|
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
@@ -631,113 +1637,6 @@ const flip = function (options) {
|
|
|
631
1637
|
};
|
|
632
1638
|
};
|
|
633
1639
|
|
|
634
|
-
/**
|
|
635
|
-
* Provides improved positioning for inline reference elements that can span
|
|
636
|
-
* over multiple lines, such as hyperlinks or range selections.
|
|
637
|
-
* @see https://floating-ui.com/docs/inline
|
|
638
|
-
*/
|
|
639
|
-
const inline = function (options) {
|
|
640
|
-
if (options === void 0) {
|
|
641
|
-
options = {};
|
|
642
|
-
}
|
|
643
|
-
return {
|
|
644
|
-
name: 'inline',
|
|
645
|
-
options,
|
|
646
|
-
async fn(middlewareArguments) {
|
|
647
|
-
const {
|
|
648
|
-
placement,
|
|
649
|
-
elements,
|
|
650
|
-
rects,
|
|
651
|
-
platform,
|
|
652
|
-
strategy
|
|
653
|
-
} = middlewareArguments;
|
|
654
|
-
// A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
|
|
655
|
-
// ClientRect's bounds, despite the event listener being triggered. A
|
|
656
|
-
// padding of 2 seems to handle this issue.
|
|
657
|
-
const {
|
|
658
|
-
padding = 2,
|
|
659
|
-
x,
|
|
660
|
-
y
|
|
661
|
-
} = options;
|
|
662
|
-
const fallback = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
663
|
-
rect: rects.reference,
|
|
664
|
-
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
665
|
-
strategy
|
|
666
|
-
}) : rects.reference);
|
|
667
|
-
const clientRects = (await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || [];
|
|
668
|
-
const paddingObject = getSideObjectFromPadding(padding);
|
|
669
|
-
function getBoundingClientRect() {
|
|
670
|
-
// There are two rects and they are disjoined.
|
|
671
|
-
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
|
|
672
|
-
// Find the first rect in which the point is fully inside.
|
|
673
|
-
return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
// There are 2 or more connected rects.
|
|
677
|
-
if (clientRects.length >= 2) {
|
|
678
|
-
if (getMainAxisFromPlacement(placement) === 'x') {
|
|
679
|
-
const firstRect = clientRects[0];
|
|
680
|
-
const lastRect = clientRects[clientRects.length - 1];
|
|
681
|
-
const isTop = getSide(placement) === 'top';
|
|
682
|
-
const top = firstRect.top;
|
|
683
|
-
const bottom = lastRect.bottom;
|
|
684
|
-
const left = isTop ? firstRect.left : lastRect.left;
|
|
685
|
-
const right = isTop ? firstRect.right : lastRect.right;
|
|
686
|
-
const width = right - left;
|
|
687
|
-
const height = bottom - top;
|
|
688
|
-
return {
|
|
689
|
-
top,
|
|
690
|
-
bottom,
|
|
691
|
-
left,
|
|
692
|
-
right,
|
|
693
|
-
width,
|
|
694
|
-
height,
|
|
695
|
-
x: left,
|
|
696
|
-
y: top
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
const isLeftSide = getSide(placement) === 'left';
|
|
700
|
-
const maxRight = max$1(...clientRects.map(rect => rect.right));
|
|
701
|
-
const minLeft = min$1(...clientRects.map(rect => rect.left));
|
|
702
|
-
const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
|
|
703
|
-
const top = measureRects[0].top;
|
|
704
|
-
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
705
|
-
const left = minLeft;
|
|
706
|
-
const right = maxRight;
|
|
707
|
-
const width = right - left;
|
|
708
|
-
const height = bottom - top;
|
|
709
|
-
return {
|
|
710
|
-
top,
|
|
711
|
-
bottom,
|
|
712
|
-
left,
|
|
713
|
-
right,
|
|
714
|
-
width,
|
|
715
|
-
height,
|
|
716
|
-
x: left,
|
|
717
|
-
y: top
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
return fallback;
|
|
721
|
-
}
|
|
722
|
-
const resetRects = await platform.getElementRects({
|
|
723
|
-
reference: {
|
|
724
|
-
getBoundingClientRect
|
|
725
|
-
},
|
|
726
|
-
floating: elements.floating,
|
|
727
|
-
strategy
|
|
728
|
-
});
|
|
729
|
-
if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
|
|
730
|
-
return {
|
|
731
|
-
reset: {
|
|
732
|
-
rects: resetRects
|
|
733
|
-
}
|
|
734
|
-
};
|
|
735
|
-
}
|
|
736
|
-
return {};
|
|
737
|
-
}
|
|
738
|
-
};
|
|
739
|
-
};
|
|
740
|
-
|
|
741
1640
|
async function convertValueToCoords(middlewareArguments, value) {
|
|
742
1641
|
const {
|
|
743
1642
|
placement,
|
|
@@ -883,67 +1782,6 @@ const shift = function (options) {
|
|
|
883
1782
|
};
|
|
884
1783
|
};
|
|
885
1784
|
|
|
886
|
-
/**
|
|
887
|
-
* Provides data to change the size of the floating element. For instance,
|
|
888
|
-
* prevent it from overflowing its clipping boundary or match the width of the
|
|
889
|
-
* reference element.
|
|
890
|
-
* @see https://floating-ui.com/docs/size
|
|
891
|
-
*/
|
|
892
|
-
const size = function (options) {
|
|
893
|
-
if (options === void 0) {
|
|
894
|
-
options = {};
|
|
895
|
-
}
|
|
896
|
-
return {
|
|
897
|
-
name: 'size',
|
|
898
|
-
options,
|
|
899
|
-
async fn(middlewareArguments) {
|
|
900
|
-
const {
|
|
901
|
-
placement,
|
|
902
|
-
rects,
|
|
903
|
-
platform,
|
|
904
|
-
elements
|
|
905
|
-
} = middlewareArguments;
|
|
906
|
-
const {
|
|
907
|
-
apply = () => {},
|
|
908
|
-
...detectOverflowOptions
|
|
909
|
-
} = options;
|
|
910
|
-
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
911
|
-
const side = getSide(placement);
|
|
912
|
-
const alignment = getAlignment(placement);
|
|
913
|
-
let heightSide;
|
|
914
|
-
let widthSide;
|
|
915
|
-
if (side === 'top' || side === 'bottom') {
|
|
916
|
-
heightSide = side;
|
|
917
|
-
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
918
|
-
} else {
|
|
919
|
-
widthSide = side;
|
|
920
|
-
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
921
|
-
}
|
|
922
|
-
const xMin = max$1(overflow.left, 0);
|
|
923
|
-
const xMax = max$1(overflow.right, 0);
|
|
924
|
-
const yMin = max$1(overflow.top, 0);
|
|
925
|
-
const yMax = max$1(overflow.bottom, 0);
|
|
926
|
-
const dimensions = {
|
|
927
|
-
availableHeight: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom)) : overflow[heightSide]),
|
|
928
|
-
availableWidth: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)) : overflow[widthSide])
|
|
929
|
-
};
|
|
930
|
-
await apply({
|
|
931
|
-
...middlewareArguments,
|
|
932
|
-
...dimensions
|
|
933
|
-
});
|
|
934
|
-
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
935
|
-
if (rects.floating.width !== nextDimensions.width || rects.floating.height !== nextDimensions.height) {
|
|
936
|
-
return {
|
|
937
|
-
reset: {
|
|
938
|
-
rects: true
|
|
939
|
-
}
|
|
940
|
-
};
|
|
941
|
-
}
|
|
942
|
-
return {};
|
|
943
|
-
}
|
|
944
|
-
};
|
|
945
|
-
};
|
|
946
|
-
|
|
947
1785
|
function getWindow(node) {
|
|
948
1786
|
var _node$ownerDocument;
|
|
949
1787
|
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
@@ -1510,192 +2348,6 @@ const computePosition = (reference, floating, options) => {
|
|
|
1510
2348
|
});
|
|
1511
2349
|
};
|
|
1512
2350
|
|
|
1513
|
-
var classnames = {exports: {}};
|
|
1514
|
-
|
|
1515
|
-
/*!
|
|
1516
|
-
Copyright (c) 2018 Jed Watson.
|
|
1517
|
-
Licensed under the MIT License (MIT), see
|
|
1518
|
-
http://jedwatson.github.io/classnames
|
|
1519
|
-
*/
|
|
1520
|
-
|
|
1521
|
-
(function (module) {
|
|
1522
|
-
/* global define */
|
|
1523
|
-
|
|
1524
|
-
(function () {
|
|
1525
|
-
|
|
1526
|
-
var hasOwn = {}.hasOwnProperty;
|
|
1527
|
-
|
|
1528
|
-
function classNames() {
|
|
1529
|
-
var classes = [];
|
|
1530
|
-
|
|
1531
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
1532
|
-
var arg = arguments[i];
|
|
1533
|
-
if (!arg) continue;
|
|
1534
|
-
|
|
1535
|
-
var argType = typeof arg;
|
|
1536
|
-
|
|
1537
|
-
if (argType === 'string' || argType === 'number') {
|
|
1538
|
-
classes.push(arg);
|
|
1539
|
-
} else if (Array.isArray(arg)) {
|
|
1540
|
-
if (arg.length) {
|
|
1541
|
-
var inner = classNames.apply(null, arg);
|
|
1542
|
-
if (inner) {
|
|
1543
|
-
classes.push(inner);
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
} else if (argType === 'object') {
|
|
1547
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
1548
|
-
classes.push(arg.toString());
|
|
1549
|
-
continue;
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
for (var key in arg) {
|
|
1553
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
1554
|
-
classes.push(key);
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
return classes.join(' ');
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
if (module.exports) {
|
|
1564
|
-
classNames.default = classNames;
|
|
1565
|
-
module.exports = classNames;
|
|
1566
|
-
} else {
|
|
1567
|
-
window.classNames = classNames;
|
|
1568
|
-
}
|
|
1569
|
-
}());
|
|
1570
|
-
} (classnames));
|
|
1571
|
-
|
|
1572
|
-
var classNames = classnames.exports;
|
|
1573
|
-
|
|
1574
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1575
|
-
/**
|
|
1576
|
-
* This function debounce the received function
|
|
1577
|
-
* @param { function } func Function to be debounced
|
|
1578
|
-
* @param { number } wait Time to wait before execut the function
|
|
1579
|
-
* @param { boolean } immediate Param to define if the function will be executed immediately
|
|
1580
|
-
*/
|
|
1581
|
-
const debounce = (func, wait, immediate) => {
|
|
1582
|
-
let timeout = null;
|
|
1583
|
-
return function debounced(...args) {
|
|
1584
|
-
const later = () => {
|
|
1585
|
-
timeout = null;
|
|
1586
|
-
if (!immediate) {
|
|
1587
|
-
func.apply(this, args);
|
|
1588
|
-
}
|
|
1589
|
-
};
|
|
1590
|
-
if (timeout) {
|
|
1591
|
-
clearTimeout(timeout);
|
|
1592
|
-
}
|
|
1593
|
-
timeout = setTimeout(later, wait);
|
|
1594
|
-
};
|
|
1595
|
-
};
|
|
1596
|
-
|
|
1597
|
-
const TooltipContent = ({ content }) => {
|
|
1598
|
-
return jsx("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
1599
|
-
};
|
|
1600
|
-
|
|
1601
|
-
const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
|
|
1602
|
-
const DEFAULT_CONTEXT_DATA = {
|
|
1603
|
-
anchorRefs: new Set(),
|
|
1604
|
-
activeAnchor: { current: null },
|
|
1605
|
-
attach: () => {
|
|
1606
|
-
/* attach anchor element */
|
|
1607
|
-
},
|
|
1608
|
-
detach: () => {
|
|
1609
|
-
/* detach anchor element */
|
|
1610
|
-
},
|
|
1611
|
-
setActiveAnchor: () => {
|
|
1612
|
-
/* set active anchor */
|
|
1613
|
-
},
|
|
1614
|
-
};
|
|
1615
|
-
const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
1616
|
-
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
1617
|
-
};
|
|
1618
|
-
const TooltipContext = createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
1619
|
-
/**
|
|
1620
|
-
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
1621
|
-
* See https://react-tooltip.com/docs/getting-started
|
|
1622
|
-
*/
|
|
1623
|
-
const TooltipProvider = ({ children }) => {
|
|
1624
|
-
const [anchorRefMap, setAnchorRefMap] = useState({
|
|
1625
|
-
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
1626
|
-
});
|
|
1627
|
-
const [activeAnchorMap, setActiveAnchorMap] = useState({
|
|
1628
|
-
[DEFAULT_TOOLTIP_ID]: { current: null },
|
|
1629
|
-
});
|
|
1630
|
-
const attach = (tooltipId, ...refs) => {
|
|
1631
|
-
setAnchorRefMap((oldMap) => {
|
|
1632
|
-
var _a;
|
|
1633
|
-
const tooltipRefs = (_a = oldMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set();
|
|
1634
|
-
refs.forEach((ref) => tooltipRefs.add(ref));
|
|
1635
|
-
// create new object to trigger re-render
|
|
1636
|
-
return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
|
|
1637
|
-
});
|
|
1638
|
-
};
|
|
1639
|
-
const detach = (tooltipId, ...refs) => {
|
|
1640
|
-
setAnchorRefMap((oldMap) => {
|
|
1641
|
-
const tooltipRefs = oldMap[tooltipId];
|
|
1642
|
-
if (!tooltipRefs) {
|
|
1643
|
-
// tooltip not found
|
|
1644
|
-
// maybe thow error?
|
|
1645
|
-
return oldMap;
|
|
1646
|
-
}
|
|
1647
|
-
refs.forEach((ref) => tooltipRefs.delete(ref));
|
|
1648
|
-
// create new object to trigger re-render
|
|
1649
|
-
return { ...oldMap };
|
|
1650
|
-
});
|
|
1651
|
-
};
|
|
1652
|
-
const setActiveAnchor = (tooltipId, ref) => {
|
|
1653
|
-
setActiveAnchorMap((oldMap) => {
|
|
1654
|
-
var _a;
|
|
1655
|
-
if (((_a = oldMap[tooltipId]) === null || _a === void 0 ? void 0 : _a.current) === ref.current) {
|
|
1656
|
-
return oldMap;
|
|
1657
|
-
}
|
|
1658
|
-
// create new object to trigger re-render
|
|
1659
|
-
return { ...oldMap, [tooltipId]: ref };
|
|
1660
|
-
});
|
|
1661
|
-
};
|
|
1662
|
-
const getTooltipData = useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
|
|
1663
|
-
var _a, _b;
|
|
1664
|
-
return ({
|
|
1665
|
-
anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
|
|
1666
|
-
activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
|
|
1667
|
-
attach: (...refs) => attach(tooltipId, ...refs),
|
|
1668
|
-
detach: (...refs) => detach(tooltipId, ...refs),
|
|
1669
|
-
setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
|
|
1670
|
-
});
|
|
1671
|
-
}, [anchorRefMap, activeAnchorMap, attach, detach]);
|
|
1672
|
-
const context = useMemo(() => {
|
|
1673
|
-
return {
|
|
1674
|
-
getTooltipData,
|
|
1675
|
-
};
|
|
1676
|
-
}, [getTooltipData]);
|
|
1677
|
-
return jsx(TooltipContext.Provider, { value: context, children: children });
|
|
1678
|
-
};
|
|
1679
|
-
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
1680
|
-
return useContext(TooltipContext).getTooltipData(tooltipId);
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
/**
|
|
1684
|
-
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
1685
|
-
* See https://react-tooltip.com/docs/getting-started
|
|
1686
|
-
*/
|
|
1687
|
-
const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
|
|
1688
|
-
const { attach, detach } = useTooltip(tooltipId);
|
|
1689
|
-
const anchorRef = useRef(null);
|
|
1690
|
-
useEffect(() => {
|
|
1691
|
-
attach(anchorRef);
|
|
1692
|
-
return () => {
|
|
1693
|
-
detach(anchorRef);
|
|
1694
|
-
};
|
|
1695
|
-
}, []);
|
|
1696
|
-
return (jsx("span", { ref: anchorRef, className: classNames('react-tooltip-wrapper', className), "data-tooltip-place": place, "data-tooltip-content": content, "data-tooltip-html": html, "data-tooltip-variant": variant, "data-tooltip-offset": offset, "data-tooltip-wrapper": wrapper, "data-tooltip-events": events, "data-tooltip-position-strategy": positionStrategy, "data-tooltip-delay-show": delayShow, "data-tooltip-delay-hide": delayHide, children: children }));
|
|
1697
|
-
};
|
|
1698
|
-
|
|
1699
2351
|
const computeTooltipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })], }) => {
|
|
1700
2352
|
if (!elementReference) {
|
|
1701
2353
|
// elementReference can be null or undefined and we will not compute the position
|
|
@@ -1772,7 +2424,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
1772
2424
|
* but should be used carefully because of caveats
|
|
1773
2425
|
* https://beta.reactjs.org/reference/react/useLayoutEffect#caveats
|
|
1774
2426
|
*/
|
|
1775
|
-
|
|
2427
|
+
useIsomorphicLayoutEffect(() => {
|
|
1776
2428
|
mounted.current = true;
|
|
1777
2429
|
return () => {
|
|
1778
2430
|
mounted.current = false;
|
|
@@ -2182,11 +2834,11 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2182
2834
|
}, [id, anchorSelect]);
|
|
2183
2835
|
const hasContentOrChildren = Boolean(html || content || children);
|
|
2184
2836
|
const canShow = hasContentOrChildren && show && Object.keys(inlineStyles).length > 0;
|
|
2185
|
-
return rendered ? (jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, {
|
|
2837
|
+
return rendered ? (jsxRuntime.exports.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, {
|
|
2186
2838
|
[styles['show']]: canShow,
|
|
2187
2839
|
[styles['fixed']]: positionStrategy === 'fixed',
|
|
2188
2840
|
[styles['clickable']]: clickable,
|
|
2189
|
-
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [(html && jsx(TooltipContent, { content: html })) || content || children, jsx(WrapperElement, { className: classNames('react-tooltip-arrow', styles['arrow'], classNameArrow, {
|
|
2841
|
+
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [(html && jsxRuntime.exports.jsx(TooltipContent, { content: html })) || content || children, jsxRuntime.exports.jsx(WrapperElement, { className: classNames('react-tooltip-arrow', styles['arrow'], classNameArrow, {
|
|
2190
2842
|
[styles['no-arrow']]: noArrow,
|
|
2191
2843
|
}), style: inlineArrowStyles, ref: tooltipArrowRef })] })) : null;
|
|
2192
2844
|
};
|
|
@@ -2365,7 +3017,7 @@ const TooltipController = ({ id, anchorId, anchorSelect, content, html, classNam
|
|
|
2365
3017
|
activeAnchor,
|
|
2366
3018
|
setActiveAnchor: (anchor) => setActiveAnchor(anchor),
|
|
2367
3019
|
};
|
|
2368
|
-
return children ? jsx(Tooltip, { ...props, children: children }) : jsx(Tooltip, { ...props });
|
|
3020
|
+
return children ? jsxRuntime.exports.jsx(Tooltip, { ...props, children: children }) : jsxRuntime.exports.jsx(Tooltip, { ...props });
|
|
2369
3021
|
};
|
|
2370
3022
|
|
|
2371
|
-
export { TooltipController as Tooltip, TooltipProvider, TooltipWrapper
|
|
3023
|
+
export { TooltipController as Tooltip, TooltipProvider, TooltipWrapper };
|