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
|
@@ -2,8 +2,1119 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
|
|
5
|
+
var require$$0 = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
10
|
+
|
|
11
|
+
var jsxRuntime = {exports: {}};
|
|
12
|
+
|
|
13
|
+
var reactJsxRuntime_development = {};
|
|
14
|
+
|
|
15
|
+
/** @license React v16.14.0
|
|
16
|
+
* react-jsx-runtime.development.js
|
|
17
|
+
*
|
|
18
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the MIT license found in the
|
|
21
|
+
* LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
(function (exports) {
|
|
25
|
+
|
|
26
|
+
{
|
|
27
|
+
(function() {
|
|
28
|
+
|
|
29
|
+
var React = require$$0__default["default"];
|
|
30
|
+
|
|
31
|
+
// ATTENTION
|
|
32
|
+
// When adding new symbols to this file,
|
|
33
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
34
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
35
|
+
// nor polyfill, then a plain number is used for performance.
|
|
36
|
+
var REACT_ELEMENT_TYPE = 0xeac7;
|
|
37
|
+
var REACT_PORTAL_TYPE = 0xeaca;
|
|
38
|
+
exports.Fragment = 0xeacb;
|
|
39
|
+
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
|
40
|
+
var REACT_PROFILER_TYPE = 0xead2;
|
|
41
|
+
var REACT_PROVIDER_TYPE = 0xeacd;
|
|
42
|
+
var REACT_CONTEXT_TYPE = 0xeace;
|
|
43
|
+
var REACT_FORWARD_REF_TYPE = 0xead0;
|
|
44
|
+
var REACT_SUSPENSE_TYPE = 0xead1;
|
|
45
|
+
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
|
46
|
+
var REACT_MEMO_TYPE = 0xead3;
|
|
47
|
+
var REACT_LAZY_TYPE = 0xead4;
|
|
48
|
+
var REACT_BLOCK_TYPE = 0xead9;
|
|
49
|
+
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
|
50
|
+
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
|
51
|
+
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
|
52
|
+
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
|
53
|
+
|
|
54
|
+
if (typeof Symbol === 'function' && Symbol.for) {
|
|
55
|
+
var symbolFor = Symbol.for;
|
|
56
|
+
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
|
57
|
+
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
|
58
|
+
exports.Fragment = symbolFor('react.fragment');
|
|
59
|
+
REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
|
|
60
|
+
REACT_PROFILER_TYPE = symbolFor('react.profiler');
|
|
61
|
+
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
|
62
|
+
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
|
63
|
+
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
|
64
|
+
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
|
65
|
+
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
|
66
|
+
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
67
|
+
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
68
|
+
REACT_BLOCK_TYPE = symbolFor('react.block');
|
|
69
|
+
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
|
70
|
+
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
|
71
|
+
symbolFor('react.scope');
|
|
72
|
+
symbolFor('react.opaque.id');
|
|
73
|
+
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
|
74
|
+
symbolFor('react.offscreen');
|
|
75
|
+
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
79
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
80
|
+
function getIteratorFn(maybeIterable) {
|
|
81
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
86
|
+
|
|
87
|
+
if (typeof maybeIterator === 'function') {
|
|
88
|
+
return maybeIterator;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
95
|
+
|
|
96
|
+
function error(format) {
|
|
97
|
+
{
|
|
98
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
99
|
+
args[_key2 - 1] = arguments[_key2];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
printWarning('error', format, args);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function printWarning(level, format, args) {
|
|
107
|
+
// When changing this logic, you might want to also
|
|
108
|
+
// update consoleWithStackDev.www.js as well.
|
|
109
|
+
{
|
|
110
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
111
|
+
var stack = '';
|
|
112
|
+
|
|
113
|
+
if (currentlyValidatingElement) {
|
|
114
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
115
|
+
var owner = currentlyValidatingElement._owner;
|
|
116
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
stack += ReactDebugCurrentFrame.getStackAddendum();
|
|
120
|
+
|
|
121
|
+
if (stack !== '') {
|
|
122
|
+
format += '%s';
|
|
123
|
+
args = args.concat([stack]);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var argsWithFormat = args.map(function (item) {
|
|
127
|
+
return '' + item;
|
|
128
|
+
}); // Careful: RN currently depends on this prefix
|
|
129
|
+
|
|
130
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
131
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
132
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
133
|
+
|
|
134
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
139
|
+
|
|
140
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
141
|
+
|
|
142
|
+
function isValidElementType(type) {
|
|
143
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
144
|
+
return true;
|
|
145
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (typeof type === 'object' && type !== null) {
|
|
153
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
163
|
+
function describeComponentFrame (name, source, ownerName) {
|
|
164
|
+
var sourceInfo = '';
|
|
165
|
+
|
|
166
|
+
if (source) {
|
|
167
|
+
var path = source.fileName;
|
|
168
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
169
|
+
|
|
170
|
+
{
|
|
171
|
+
// In DEV, include code for a common special case:
|
|
172
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
173
|
+
if (/^index\./.test(fileName)) {
|
|
174
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
175
|
+
|
|
176
|
+
if (match) {
|
|
177
|
+
var pathBeforeSlash = match[1];
|
|
178
|
+
|
|
179
|
+
if (pathBeforeSlash) {
|
|
180
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
181
|
+
fileName = folderName + '/' + fileName;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
188
|
+
} else if (ownerName) {
|
|
189
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
var Resolved = 1;
|
|
196
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
197
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
201
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
202
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function getComponentName(type) {
|
|
206
|
+
if (type == null) {
|
|
207
|
+
// Host root, text node or just invalid type.
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
{
|
|
212
|
+
if (typeof type.tag === 'number') {
|
|
213
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (typeof type === 'function') {
|
|
218
|
+
return type.displayName || type.name || null;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (typeof type === 'string') {
|
|
222
|
+
return type;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
switch (type) {
|
|
226
|
+
case exports.Fragment:
|
|
227
|
+
return 'Fragment';
|
|
228
|
+
|
|
229
|
+
case REACT_PORTAL_TYPE:
|
|
230
|
+
return 'Portal';
|
|
231
|
+
|
|
232
|
+
case REACT_PROFILER_TYPE:
|
|
233
|
+
return "Profiler";
|
|
234
|
+
|
|
235
|
+
case REACT_STRICT_MODE_TYPE:
|
|
236
|
+
return 'StrictMode';
|
|
237
|
+
|
|
238
|
+
case REACT_SUSPENSE_TYPE:
|
|
239
|
+
return 'Suspense';
|
|
240
|
+
|
|
241
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
242
|
+
return 'SuspenseList';
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (typeof type === 'object') {
|
|
246
|
+
switch (type.$$typeof) {
|
|
247
|
+
case REACT_CONTEXT_TYPE:
|
|
248
|
+
return 'Context.Consumer';
|
|
249
|
+
|
|
250
|
+
case REACT_PROVIDER_TYPE:
|
|
251
|
+
return 'Context.Provider';
|
|
252
|
+
|
|
253
|
+
case REACT_FORWARD_REF_TYPE:
|
|
254
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
255
|
+
|
|
256
|
+
case REACT_MEMO_TYPE:
|
|
257
|
+
return getComponentName(type.type);
|
|
258
|
+
|
|
259
|
+
case REACT_BLOCK_TYPE:
|
|
260
|
+
return getComponentName(type.render);
|
|
261
|
+
|
|
262
|
+
case REACT_LAZY_TYPE:
|
|
263
|
+
{
|
|
264
|
+
var thenable = type;
|
|
265
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
266
|
+
|
|
267
|
+
if (resolvedThenable) {
|
|
268
|
+
return getComponentName(resolvedThenable);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
var loggedTypeFailures = {};
|
|
280
|
+
ReactSharedInternals.ReactDebugCurrentFrame;
|
|
281
|
+
var currentlyValidatingElement = null;
|
|
282
|
+
|
|
283
|
+
function setCurrentlyValidatingElement(element) {
|
|
284
|
+
{
|
|
285
|
+
currentlyValidatingElement = element;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
290
|
+
{
|
|
291
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
292
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
293
|
+
|
|
294
|
+
for (var typeSpecName in typeSpecs) {
|
|
295
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
296
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
297
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
298
|
+
// After these have been cleaned up, we'll let them throw.
|
|
299
|
+
|
|
300
|
+
try {
|
|
301
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
302
|
+
// behavior as without this statement except with a better message.
|
|
303
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
304
|
+
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
305
|
+
err.name = 'Invariant Violation';
|
|
306
|
+
throw err;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
310
|
+
} catch (ex) {
|
|
311
|
+
error$1 = ex;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
315
|
+
setCurrentlyValidatingElement(element);
|
|
316
|
+
|
|
317
|
+
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
318
|
+
|
|
319
|
+
setCurrentlyValidatingElement(null);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
323
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
324
|
+
// same error.
|
|
325
|
+
loggedTypeFailures[error$1.message] = true;
|
|
326
|
+
setCurrentlyValidatingElement(element);
|
|
327
|
+
|
|
328
|
+
error('Failed %s type: %s', location, error$1.message);
|
|
329
|
+
|
|
330
|
+
setCurrentlyValidatingElement(null);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
338
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
339
|
+
var RESERVED_PROPS = {
|
|
340
|
+
key: true,
|
|
341
|
+
ref: true,
|
|
342
|
+
__self: true,
|
|
343
|
+
__source: true
|
|
344
|
+
};
|
|
345
|
+
var specialPropKeyWarningShown;
|
|
346
|
+
var specialPropRefWarningShown;
|
|
347
|
+
var didWarnAboutStringRefs;
|
|
348
|
+
|
|
349
|
+
{
|
|
350
|
+
didWarnAboutStringRefs = {};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function hasValidRef(config) {
|
|
354
|
+
{
|
|
355
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
356
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
357
|
+
|
|
358
|
+
if (getter && getter.isReactWarning) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return config.ref !== undefined;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function hasValidKey(config) {
|
|
368
|
+
{
|
|
369
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
370
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
371
|
+
|
|
372
|
+
if (getter && getter.isReactWarning) {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return config.key !== undefined;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
382
|
+
{
|
|
383
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
384
|
+
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
385
|
+
|
|
386
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
387
|
+
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
|
|
388
|
+
|
|
389
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
396
|
+
{
|
|
397
|
+
var warnAboutAccessingKey = function () {
|
|
398
|
+
if (!specialPropKeyWarningShown) {
|
|
399
|
+
specialPropKeyWarningShown = true;
|
|
400
|
+
|
|
401
|
+
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
406
|
+
Object.defineProperty(props, 'key', {
|
|
407
|
+
get: warnAboutAccessingKey,
|
|
408
|
+
configurable: true
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
414
|
+
{
|
|
415
|
+
var warnAboutAccessingRef = function () {
|
|
416
|
+
if (!specialPropRefWarningShown) {
|
|
417
|
+
specialPropRefWarningShown = true;
|
|
418
|
+
|
|
419
|
+
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
424
|
+
Object.defineProperty(props, 'ref', {
|
|
425
|
+
get: warnAboutAccessingRef,
|
|
426
|
+
configurable: true
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
432
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
433
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
434
|
+
* if something is a React Element.
|
|
435
|
+
*
|
|
436
|
+
* @param {*} type
|
|
437
|
+
* @param {*} props
|
|
438
|
+
* @param {*} key
|
|
439
|
+
* @param {string|object} ref
|
|
440
|
+
* @param {*} owner
|
|
441
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
442
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
443
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
444
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
445
|
+
* change in behavior.
|
|
446
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
447
|
+
* indicating filename, line number, and/or other information.
|
|
448
|
+
* @internal
|
|
449
|
+
*/
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
453
|
+
var element = {
|
|
454
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
455
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
456
|
+
// Built-in properties that belong on the element
|
|
457
|
+
type: type,
|
|
458
|
+
key: key,
|
|
459
|
+
ref: ref,
|
|
460
|
+
props: props,
|
|
461
|
+
// Record the component responsible for creating this element.
|
|
462
|
+
_owner: owner
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
{
|
|
466
|
+
// The validation flag is currently mutative. We put it on
|
|
467
|
+
// an external backing store so that we can freeze the whole object.
|
|
468
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
469
|
+
// commonly used development environments.
|
|
470
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
471
|
+
// the validation flag non-enumerable (where possible, which should
|
|
472
|
+
// include every environment we run tests in), so the test framework
|
|
473
|
+
// ignores it.
|
|
474
|
+
|
|
475
|
+
Object.defineProperty(element._store, 'validated', {
|
|
476
|
+
configurable: false,
|
|
477
|
+
enumerable: false,
|
|
478
|
+
writable: true,
|
|
479
|
+
value: false
|
|
480
|
+
}); // self and source are DEV only properties.
|
|
481
|
+
|
|
482
|
+
Object.defineProperty(element, '_self', {
|
|
483
|
+
configurable: false,
|
|
484
|
+
enumerable: false,
|
|
485
|
+
writable: false,
|
|
486
|
+
value: self
|
|
487
|
+
}); // Two elements created in two different places should be considered
|
|
488
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
489
|
+
|
|
490
|
+
Object.defineProperty(element, '_source', {
|
|
491
|
+
configurable: false,
|
|
492
|
+
enumerable: false,
|
|
493
|
+
writable: false,
|
|
494
|
+
value: source
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
if (Object.freeze) {
|
|
498
|
+
Object.freeze(element.props);
|
|
499
|
+
Object.freeze(element);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
return element;
|
|
504
|
+
};
|
|
505
|
+
/**
|
|
506
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
507
|
+
* @param {*} type
|
|
508
|
+
* @param {object} props
|
|
509
|
+
* @param {string} key
|
|
510
|
+
*/
|
|
511
|
+
|
|
512
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
513
|
+
{
|
|
514
|
+
var propName; // Reserved names are extracted
|
|
515
|
+
|
|
516
|
+
var props = {};
|
|
517
|
+
var key = null;
|
|
518
|
+
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
519
|
+
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
520
|
+
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
521
|
+
// but as an intermediary step, we will use jsxDEV for everything except
|
|
522
|
+
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
523
|
+
// key is explicitly declared to be undefined or not.
|
|
524
|
+
|
|
525
|
+
if (maybeKey !== undefined) {
|
|
526
|
+
key = '' + maybeKey;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (hasValidKey(config)) {
|
|
530
|
+
key = '' + config.key;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (hasValidRef(config)) {
|
|
534
|
+
ref = config.ref;
|
|
535
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
536
|
+
} // Remaining properties are added to a new props object
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
for (propName in config) {
|
|
540
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
541
|
+
props[propName] = config[propName];
|
|
542
|
+
}
|
|
543
|
+
} // Resolve default props
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
if (type && type.defaultProps) {
|
|
547
|
+
var defaultProps = type.defaultProps;
|
|
548
|
+
|
|
549
|
+
for (propName in defaultProps) {
|
|
550
|
+
if (props[propName] === undefined) {
|
|
551
|
+
props[propName] = defaultProps[propName];
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (key || ref) {
|
|
557
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
558
|
+
|
|
559
|
+
if (key) {
|
|
560
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (ref) {
|
|
564
|
+
defineRefPropWarningGetter(props, displayName);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
573
|
+
ReactSharedInternals.ReactDebugCurrentFrame;
|
|
574
|
+
|
|
575
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
576
|
+
currentlyValidatingElement = element;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
var propTypesMisspellWarningShown;
|
|
580
|
+
|
|
581
|
+
{
|
|
582
|
+
propTypesMisspellWarningShown = false;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Verifies the object is a ReactElement.
|
|
586
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
587
|
+
* @param {?object} object
|
|
588
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
589
|
+
* @final
|
|
590
|
+
*/
|
|
591
|
+
|
|
592
|
+
function isValidElement(object) {
|
|
593
|
+
{
|
|
594
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
function getDeclarationErrorAddendum() {
|
|
599
|
+
{
|
|
600
|
+
if (ReactCurrentOwner$1.current) {
|
|
601
|
+
var name = getComponentName(ReactCurrentOwner$1.current.type);
|
|
602
|
+
|
|
603
|
+
if (name) {
|
|
604
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
return '';
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
function getSourceInfoErrorAddendum(source) {
|
|
613
|
+
{
|
|
614
|
+
if (source !== undefined) {
|
|
615
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
616
|
+
var lineNumber = source.lineNumber;
|
|
617
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
return '';
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
625
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
626
|
+
* updates.
|
|
627
|
+
*/
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
var ownerHasKeyUseWarning = {};
|
|
631
|
+
|
|
632
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
633
|
+
{
|
|
634
|
+
var info = getDeclarationErrorAddendum();
|
|
635
|
+
|
|
636
|
+
if (!info) {
|
|
637
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
638
|
+
|
|
639
|
+
if (parentName) {
|
|
640
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
return info;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
649
|
+
* This element is in an array. The array could grow and shrink or be
|
|
650
|
+
* reordered. All children that haven't already been validated are required to
|
|
651
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
652
|
+
* will only be shown once.
|
|
653
|
+
*
|
|
654
|
+
* @internal
|
|
655
|
+
* @param {ReactElement} element Element that requires a key.
|
|
656
|
+
* @param {*} parentType element's parent's type.
|
|
657
|
+
*/
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
function validateExplicitKey(element, parentType) {
|
|
661
|
+
{
|
|
662
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
element._store.validated = true;
|
|
667
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
668
|
+
|
|
669
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
674
|
+
// property, it may be the creator of the child that's responsible for
|
|
675
|
+
// assigning it a key.
|
|
676
|
+
|
|
677
|
+
var childOwner = '';
|
|
678
|
+
|
|
679
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
680
|
+
// Give the component that originally created this child.
|
|
681
|
+
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
setCurrentlyValidatingElement$1(element);
|
|
685
|
+
|
|
686
|
+
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
687
|
+
|
|
688
|
+
setCurrentlyValidatingElement$1(null);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Ensure that every element either is passed in a static location, in an
|
|
693
|
+
* array with an explicit keys property defined, or in an object literal
|
|
694
|
+
* with valid key property.
|
|
695
|
+
*
|
|
696
|
+
* @internal
|
|
697
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
698
|
+
* @param {*} parentType node's parent's type.
|
|
699
|
+
*/
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
function validateChildKeys(node, parentType) {
|
|
703
|
+
{
|
|
704
|
+
if (typeof node !== 'object') {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
if (Array.isArray(node)) {
|
|
709
|
+
for (var i = 0; i < node.length; i++) {
|
|
710
|
+
var child = node[i];
|
|
711
|
+
|
|
712
|
+
if (isValidElement(child)) {
|
|
713
|
+
validateExplicitKey(child, parentType);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
} else if (isValidElement(node)) {
|
|
717
|
+
// This element was passed in a valid location.
|
|
718
|
+
if (node._store) {
|
|
719
|
+
node._store.validated = true;
|
|
720
|
+
}
|
|
721
|
+
} else if (node) {
|
|
722
|
+
var iteratorFn = getIteratorFn(node);
|
|
723
|
+
|
|
724
|
+
if (typeof iteratorFn === 'function') {
|
|
725
|
+
// Entry iterators used to provide implicit keys,
|
|
726
|
+
// but now we print a separate warning for them later.
|
|
727
|
+
if (iteratorFn !== node.entries) {
|
|
728
|
+
var iterator = iteratorFn.call(node);
|
|
729
|
+
var step;
|
|
730
|
+
|
|
731
|
+
while (!(step = iterator.next()).done) {
|
|
732
|
+
if (isValidElement(step.value)) {
|
|
733
|
+
validateExplicitKey(step.value, parentType);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
743
|
+
* provided by the type.
|
|
744
|
+
*
|
|
745
|
+
* @param {ReactElement} element
|
|
746
|
+
*/
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
function validatePropTypes(element) {
|
|
750
|
+
{
|
|
751
|
+
var type = element.type;
|
|
752
|
+
|
|
753
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
var propTypes;
|
|
758
|
+
|
|
759
|
+
if (typeof type === 'function') {
|
|
760
|
+
propTypes = type.propTypes;
|
|
761
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
762
|
+
// Inner props are checked in the reconciler.
|
|
763
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
764
|
+
propTypes = type.propTypes;
|
|
765
|
+
} else {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
if (propTypes) {
|
|
770
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
|
771
|
+
var name = getComponentName(type);
|
|
772
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
773
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
774
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
775
|
+
|
|
776
|
+
var _name = getComponentName(type);
|
|
777
|
+
|
|
778
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
782
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
788
|
+
* @param {ReactElement} fragment
|
|
789
|
+
*/
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
function validateFragmentProps(fragment) {
|
|
793
|
+
{
|
|
794
|
+
var keys = Object.keys(fragment.props);
|
|
795
|
+
|
|
796
|
+
for (var i = 0; i < keys.length; i++) {
|
|
797
|
+
var key = keys[i];
|
|
798
|
+
|
|
799
|
+
if (key !== 'children' && key !== 'key') {
|
|
800
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
801
|
+
|
|
802
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
803
|
+
|
|
804
|
+
setCurrentlyValidatingElement$1(null);
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
if (fragment.ref !== null) {
|
|
810
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
811
|
+
|
|
812
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
813
|
+
|
|
814
|
+
setCurrentlyValidatingElement$1(null);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
820
|
+
{
|
|
821
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
822
|
+
// succeed and there will likely be errors in render.
|
|
823
|
+
|
|
824
|
+
if (!validType) {
|
|
825
|
+
var info = '';
|
|
826
|
+
|
|
827
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
828
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
832
|
+
|
|
833
|
+
if (sourceInfo) {
|
|
834
|
+
info += sourceInfo;
|
|
835
|
+
} else {
|
|
836
|
+
info += getDeclarationErrorAddendum();
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
var typeString;
|
|
840
|
+
|
|
841
|
+
if (type === null) {
|
|
842
|
+
typeString = 'null';
|
|
843
|
+
} else if (Array.isArray(type)) {
|
|
844
|
+
typeString = 'array';
|
|
845
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
846
|
+
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
847
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
848
|
+
} else {
|
|
849
|
+
typeString = typeof type;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
856
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
857
|
+
|
|
858
|
+
if (element == null) {
|
|
859
|
+
return element;
|
|
860
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
861
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
862
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
863
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
864
|
+
// fixed, the key warnings will appear.)
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
if (validType) {
|
|
868
|
+
var children = props.children;
|
|
869
|
+
|
|
870
|
+
if (children !== undefined) {
|
|
871
|
+
if (isStaticChildren) {
|
|
872
|
+
if (Array.isArray(children)) {
|
|
873
|
+
for (var i = 0; i < children.length; i++) {
|
|
874
|
+
validateChildKeys(children[i], type);
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
if (Object.freeze) {
|
|
878
|
+
Object.freeze(children);
|
|
879
|
+
}
|
|
880
|
+
} else {
|
|
881
|
+
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
882
|
+
}
|
|
883
|
+
} else {
|
|
884
|
+
validateChildKeys(children, type);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
if (type === exports.Fragment) {
|
|
890
|
+
validateFragmentProps(element);
|
|
891
|
+
} else {
|
|
892
|
+
validatePropTypes(element);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
return element;
|
|
896
|
+
}
|
|
897
|
+
} // These two functions exist to still get child warnings in dev
|
|
898
|
+
// even with the prod transform. This means that jsxDEV is purely
|
|
899
|
+
// opt-in behavior for better messages but that we won't stop
|
|
900
|
+
// giving you warnings if you use production apis.
|
|
901
|
+
|
|
902
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
903
|
+
{
|
|
904
|
+
return jsxWithValidation(type, props, key, true);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
908
|
+
{
|
|
909
|
+
return jsxWithValidation(type, props, key, false);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
914
|
+
// for now we can ship identical prod functions
|
|
915
|
+
|
|
916
|
+
var jsxs = jsxWithValidationStatic ;
|
|
917
|
+
|
|
918
|
+
exports.jsx = jsx;
|
|
919
|
+
exports.jsxs = jsxs;
|
|
920
|
+
})();
|
|
921
|
+
}
|
|
922
|
+
} (reactJsxRuntime_development));
|
|
923
|
+
|
|
924
|
+
(function (module) {
|
|
925
|
+
|
|
926
|
+
{
|
|
927
|
+
module.exports = reactJsxRuntime_development;
|
|
928
|
+
}
|
|
929
|
+
} (jsxRuntime));
|
|
930
|
+
|
|
931
|
+
var classnames = {exports: {}};
|
|
932
|
+
|
|
933
|
+
/*!
|
|
934
|
+
Copyright (c) 2018 Jed Watson.
|
|
935
|
+
Licensed under the MIT License (MIT), see
|
|
936
|
+
http://jedwatson.github.io/classnames
|
|
937
|
+
*/
|
|
938
|
+
|
|
939
|
+
(function (module) {
|
|
940
|
+
/* global define */
|
|
941
|
+
|
|
942
|
+
(function () {
|
|
943
|
+
|
|
944
|
+
var hasOwn = {}.hasOwnProperty;
|
|
945
|
+
|
|
946
|
+
function classNames() {
|
|
947
|
+
var classes = [];
|
|
948
|
+
|
|
949
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
950
|
+
var arg = arguments[i];
|
|
951
|
+
if (!arg) continue;
|
|
952
|
+
|
|
953
|
+
var argType = typeof arg;
|
|
954
|
+
|
|
955
|
+
if (argType === 'string' || argType === 'number') {
|
|
956
|
+
classes.push(arg);
|
|
957
|
+
} else if (Array.isArray(arg)) {
|
|
958
|
+
if (arg.length) {
|
|
959
|
+
var inner = classNames.apply(null, arg);
|
|
960
|
+
if (inner) {
|
|
961
|
+
classes.push(inner);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
} else if (argType === 'object') {
|
|
965
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
966
|
+
classes.push(arg.toString());
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
for (var key in arg) {
|
|
971
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
972
|
+
classes.push(key);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
return classes.join(' ');
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
if (module.exports) {
|
|
982
|
+
classNames.default = classNames;
|
|
983
|
+
module.exports = classNames;
|
|
984
|
+
} else {
|
|
985
|
+
window.classNames = classNames;
|
|
986
|
+
}
|
|
987
|
+
}());
|
|
988
|
+
} (classnames));
|
|
989
|
+
|
|
990
|
+
var classNames = classnames.exports;
|
|
991
|
+
|
|
992
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
993
|
+
/**
|
|
994
|
+
* This function debounce the received function
|
|
995
|
+
* @param { function } func Function to be debounced
|
|
996
|
+
* @param { number } wait Time to wait before execut the function
|
|
997
|
+
* @param { boolean } immediate Param to define if the function will be executed immediately
|
|
998
|
+
*/
|
|
999
|
+
const debounce = (func, wait, immediate) => {
|
|
1000
|
+
let timeout = null;
|
|
1001
|
+
return function debounced(...args) {
|
|
1002
|
+
const later = () => {
|
|
1003
|
+
timeout = null;
|
|
1004
|
+
if (!immediate) {
|
|
1005
|
+
func.apply(this, args);
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
if (timeout) {
|
|
1009
|
+
clearTimeout(timeout);
|
|
1010
|
+
}
|
|
1011
|
+
timeout = setTimeout(later, wait);
|
|
1012
|
+
};
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
const TooltipContent = ({ content }) => {
|
|
1016
|
+
return jsxRuntime.exports.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
|
|
1020
|
+
const DEFAULT_CONTEXT_DATA = {
|
|
1021
|
+
anchorRefs: new Set(),
|
|
1022
|
+
activeAnchor: { current: null },
|
|
1023
|
+
attach: () => {
|
|
1024
|
+
/* attach anchor element */
|
|
1025
|
+
},
|
|
1026
|
+
detach: () => {
|
|
1027
|
+
/* detach anchor element */
|
|
1028
|
+
},
|
|
1029
|
+
setActiveAnchor: () => {
|
|
1030
|
+
/* set active anchor */
|
|
1031
|
+
},
|
|
1032
|
+
};
|
|
1033
|
+
const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
1034
|
+
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
1035
|
+
};
|
|
1036
|
+
const TooltipContext = require$$0.createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
1037
|
+
/**
|
|
1038
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
1039
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
1040
|
+
*/
|
|
1041
|
+
const TooltipProvider = ({ children }) => {
|
|
1042
|
+
const [anchorRefMap, setAnchorRefMap] = require$$0.useState({
|
|
1043
|
+
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
1044
|
+
});
|
|
1045
|
+
const [activeAnchorMap, setActiveAnchorMap] = require$$0.useState({
|
|
1046
|
+
[DEFAULT_TOOLTIP_ID]: { current: null },
|
|
1047
|
+
});
|
|
1048
|
+
const attach = (tooltipId, ...refs) => {
|
|
1049
|
+
setAnchorRefMap((oldMap) => {
|
|
1050
|
+
var _a;
|
|
1051
|
+
const tooltipRefs = (_a = oldMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set();
|
|
1052
|
+
refs.forEach((ref) => tooltipRefs.add(ref));
|
|
1053
|
+
// create new object to trigger re-render
|
|
1054
|
+
return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
|
|
1055
|
+
});
|
|
1056
|
+
};
|
|
1057
|
+
const detach = (tooltipId, ...refs) => {
|
|
1058
|
+
setAnchorRefMap((oldMap) => {
|
|
1059
|
+
const tooltipRefs = oldMap[tooltipId];
|
|
1060
|
+
if (!tooltipRefs) {
|
|
1061
|
+
// tooltip not found
|
|
1062
|
+
// maybe thow error?
|
|
1063
|
+
return oldMap;
|
|
1064
|
+
}
|
|
1065
|
+
refs.forEach((ref) => tooltipRefs.delete(ref));
|
|
1066
|
+
// create new object to trigger re-render
|
|
1067
|
+
return { ...oldMap };
|
|
1068
|
+
});
|
|
1069
|
+
};
|
|
1070
|
+
const setActiveAnchor = (tooltipId, ref) => {
|
|
1071
|
+
setActiveAnchorMap((oldMap) => {
|
|
1072
|
+
var _a;
|
|
1073
|
+
if (((_a = oldMap[tooltipId]) === null || _a === void 0 ? void 0 : _a.current) === ref.current) {
|
|
1074
|
+
return oldMap;
|
|
1075
|
+
}
|
|
1076
|
+
// create new object to trigger re-render
|
|
1077
|
+
return { ...oldMap, [tooltipId]: ref };
|
|
1078
|
+
});
|
|
1079
|
+
};
|
|
1080
|
+
const getTooltipData = require$$0.useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
|
|
1081
|
+
var _a, _b;
|
|
1082
|
+
return ({
|
|
1083
|
+
anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
|
|
1084
|
+
activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
|
|
1085
|
+
attach: (...refs) => attach(tooltipId, ...refs),
|
|
1086
|
+
detach: (...refs) => detach(tooltipId, ...refs),
|
|
1087
|
+
setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
|
|
1088
|
+
});
|
|
1089
|
+
}, [anchorRefMap, activeAnchorMap, attach, detach]);
|
|
1090
|
+
const context = require$$0.useMemo(() => {
|
|
1091
|
+
return {
|
|
1092
|
+
getTooltipData,
|
|
1093
|
+
};
|
|
1094
|
+
}, [getTooltipData]);
|
|
1095
|
+
return jsxRuntime.exports.jsx(TooltipContext.Provider, { value: context, children: children });
|
|
1096
|
+
};
|
|
1097
|
+
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
1098
|
+
return require$$0.useContext(TooltipContext).getTooltipData(tooltipId);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
1103
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
1104
|
+
*/
|
|
1105
|
+
const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
|
|
1106
|
+
const { attach, detach } = useTooltip(tooltipId);
|
|
1107
|
+
const anchorRef = require$$0.useRef(null);
|
|
1108
|
+
require$$0.useEffect(() => {
|
|
1109
|
+
attach(anchorRef);
|
|
1110
|
+
return () => {
|
|
1111
|
+
detach(anchorRef);
|
|
1112
|
+
};
|
|
1113
|
+
}, []);
|
|
1114
|
+
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 }));
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? require$$0.useLayoutEffect : require$$0.useEffect;
|
|
7
1118
|
|
|
8
1119
|
function getAlignment(placement) {
|
|
9
1120
|
return placement.split('-')[1];
|
|
@@ -357,9 +1468,6 @@ const arrow = options => ({
|
|
|
357
1468
|
}
|
|
358
1469
|
});
|
|
359
1470
|
|
|
360
|
-
const sides = ['top', 'right', 'bottom', 'left'];
|
|
361
|
-
const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
|
|
362
|
-
|
|
363
1471
|
const oppositeSideMap = {
|
|
364
1472
|
left: 'right',
|
|
365
1473
|
right: 'left',
|
|
@@ -395,104 +1503,6 @@ function getOppositeAlignmentPlacement(placement) {
|
|
|
395
1503
|
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
396
1504
|
}
|
|
397
1505
|
|
|
398
|
-
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
399
|
-
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
|
|
400
|
-
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
401
|
-
if (alignment) {
|
|
402
|
-
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
403
|
-
}
|
|
404
|
-
return true;
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Automatically chooses the `placement` which has the most space available.
|
|
409
|
-
* @see https://floating-ui.com/docs/autoPlacement
|
|
410
|
-
*/
|
|
411
|
-
const autoPlacement = function (options) {
|
|
412
|
-
if (options === void 0) {
|
|
413
|
-
options = {};
|
|
414
|
-
}
|
|
415
|
-
return {
|
|
416
|
-
name: 'autoPlacement',
|
|
417
|
-
options,
|
|
418
|
-
async fn(middlewareArguments) {
|
|
419
|
-
var _middlewareData$autoP, _middlewareData$autoP2, _placementsSortedByLe;
|
|
420
|
-
const {
|
|
421
|
-
rects,
|
|
422
|
-
middlewareData,
|
|
423
|
-
placement,
|
|
424
|
-
platform,
|
|
425
|
-
elements
|
|
426
|
-
} = middlewareArguments;
|
|
427
|
-
const {
|
|
428
|
-
alignment,
|
|
429
|
-
allowedPlacements = allPlacements,
|
|
430
|
-
autoAlignment = true,
|
|
431
|
-
...detectOverflowOptions
|
|
432
|
-
} = options;
|
|
433
|
-
const placements = alignment !== undefined || allowedPlacements === allPlacements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
434
|
-
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
435
|
-
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
436
|
-
const currentPlacement = placements[currentIndex];
|
|
437
|
-
if (currentPlacement == null) {
|
|
438
|
-
return {};
|
|
439
|
-
}
|
|
440
|
-
const {
|
|
441
|
-
main,
|
|
442
|
-
cross
|
|
443
|
-
} = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
444
|
-
|
|
445
|
-
// Make `computeCoords` start from the right place.
|
|
446
|
-
if (placement !== currentPlacement) {
|
|
447
|
-
return {
|
|
448
|
-
reset: {
|
|
449
|
-
placement: placements[0]
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main], overflow[cross]];
|
|
454
|
-
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
|
|
455
|
-
placement: currentPlacement,
|
|
456
|
-
overflows: currentOverflows
|
|
457
|
-
}];
|
|
458
|
-
const nextPlacement = placements[currentIndex + 1];
|
|
459
|
-
|
|
460
|
-
// There are more placements to check.
|
|
461
|
-
if (nextPlacement) {
|
|
462
|
-
return {
|
|
463
|
-
data: {
|
|
464
|
-
index: currentIndex + 1,
|
|
465
|
-
overflows: allOverflows
|
|
466
|
-
},
|
|
467
|
-
reset: {
|
|
468
|
-
placement: nextPlacement
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
|
|
473
|
-
const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {
|
|
474
|
-
let {
|
|
475
|
-
overflows
|
|
476
|
-
} = _ref;
|
|
477
|
-
return overflows.every(overflow => overflow <= 0);
|
|
478
|
-
})) == null ? void 0 : _placementsSortedByLe.placement;
|
|
479
|
-
const resetPlacement = placementThatFitsOnAllSides || placementsSortedByLeastOverflow[0].placement;
|
|
480
|
-
if (resetPlacement !== placement) {
|
|
481
|
-
return {
|
|
482
|
-
data: {
|
|
483
|
-
index: currentIndex + 1,
|
|
484
|
-
overflows: allOverflows
|
|
485
|
-
},
|
|
486
|
-
reset: {
|
|
487
|
-
placement: resetPlacement
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
return {};
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
};
|
|
495
|
-
|
|
496
1506
|
function getExpandedPlacements(placement) {
|
|
497
1507
|
const oppositePlacement = getOppositePlacement(placement);
|
|
498
1508
|
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
@@ -635,113 +1645,6 @@ const flip = function (options) {
|
|
|
635
1645
|
};
|
|
636
1646
|
};
|
|
637
1647
|
|
|
638
|
-
/**
|
|
639
|
-
* Provides improved positioning for inline reference elements that can span
|
|
640
|
-
* over multiple lines, such as hyperlinks or range selections.
|
|
641
|
-
* @see https://floating-ui.com/docs/inline
|
|
642
|
-
*/
|
|
643
|
-
const inline = function (options) {
|
|
644
|
-
if (options === void 0) {
|
|
645
|
-
options = {};
|
|
646
|
-
}
|
|
647
|
-
return {
|
|
648
|
-
name: 'inline',
|
|
649
|
-
options,
|
|
650
|
-
async fn(middlewareArguments) {
|
|
651
|
-
const {
|
|
652
|
-
placement,
|
|
653
|
-
elements,
|
|
654
|
-
rects,
|
|
655
|
-
platform,
|
|
656
|
-
strategy
|
|
657
|
-
} = middlewareArguments;
|
|
658
|
-
// A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
|
|
659
|
-
// ClientRect's bounds, despite the event listener being triggered. A
|
|
660
|
-
// padding of 2 seems to handle this issue.
|
|
661
|
-
const {
|
|
662
|
-
padding = 2,
|
|
663
|
-
x,
|
|
664
|
-
y
|
|
665
|
-
} = options;
|
|
666
|
-
const fallback = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
667
|
-
rect: rects.reference,
|
|
668
|
-
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
669
|
-
strategy
|
|
670
|
-
}) : rects.reference);
|
|
671
|
-
const clientRects = (await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || [];
|
|
672
|
-
const paddingObject = getSideObjectFromPadding(padding);
|
|
673
|
-
function getBoundingClientRect() {
|
|
674
|
-
// There are two rects and they are disjoined.
|
|
675
|
-
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
|
|
676
|
-
// Find the first rect in which the point is fully inside.
|
|
677
|
-
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;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
// There are 2 or more connected rects.
|
|
681
|
-
if (clientRects.length >= 2) {
|
|
682
|
-
if (getMainAxisFromPlacement(placement) === 'x') {
|
|
683
|
-
const firstRect = clientRects[0];
|
|
684
|
-
const lastRect = clientRects[clientRects.length - 1];
|
|
685
|
-
const isTop = getSide(placement) === 'top';
|
|
686
|
-
const top = firstRect.top;
|
|
687
|
-
const bottom = lastRect.bottom;
|
|
688
|
-
const left = isTop ? firstRect.left : lastRect.left;
|
|
689
|
-
const right = isTop ? firstRect.right : lastRect.right;
|
|
690
|
-
const width = right - left;
|
|
691
|
-
const height = bottom - top;
|
|
692
|
-
return {
|
|
693
|
-
top,
|
|
694
|
-
bottom,
|
|
695
|
-
left,
|
|
696
|
-
right,
|
|
697
|
-
width,
|
|
698
|
-
height,
|
|
699
|
-
x: left,
|
|
700
|
-
y: top
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
const isLeftSide = getSide(placement) === 'left';
|
|
704
|
-
const maxRight = max$1(...clientRects.map(rect => rect.right));
|
|
705
|
-
const minLeft = min$1(...clientRects.map(rect => rect.left));
|
|
706
|
-
const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
|
|
707
|
-
const top = measureRects[0].top;
|
|
708
|
-
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
709
|
-
const left = minLeft;
|
|
710
|
-
const right = maxRight;
|
|
711
|
-
const width = right - left;
|
|
712
|
-
const height = bottom - top;
|
|
713
|
-
return {
|
|
714
|
-
top,
|
|
715
|
-
bottom,
|
|
716
|
-
left,
|
|
717
|
-
right,
|
|
718
|
-
width,
|
|
719
|
-
height,
|
|
720
|
-
x: left,
|
|
721
|
-
y: top
|
|
722
|
-
};
|
|
723
|
-
}
|
|
724
|
-
return fallback;
|
|
725
|
-
}
|
|
726
|
-
const resetRects = await platform.getElementRects({
|
|
727
|
-
reference: {
|
|
728
|
-
getBoundingClientRect
|
|
729
|
-
},
|
|
730
|
-
floating: elements.floating,
|
|
731
|
-
strategy
|
|
732
|
-
});
|
|
733
|
-
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) {
|
|
734
|
-
return {
|
|
735
|
-
reset: {
|
|
736
|
-
rects: resetRects
|
|
737
|
-
}
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
return {};
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
};
|
|
744
|
-
|
|
745
1648
|
async function convertValueToCoords(middlewareArguments, value) {
|
|
746
1649
|
const {
|
|
747
1650
|
placement,
|
|
@@ -887,67 +1790,6 @@ const shift = function (options) {
|
|
|
887
1790
|
};
|
|
888
1791
|
};
|
|
889
1792
|
|
|
890
|
-
/**
|
|
891
|
-
* Provides data to change the size of the floating element. For instance,
|
|
892
|
-
* prevent it from overflowing its clipping boundary or match the width of the
|
|
893
|
-
* reference element.
|
|
894
|
-
* @see https://floating-ui.com/docs/size
|
|
895
|
-
*/
|
|
896
|
-
const size = function (options) {
|
|
897
|
-
if (options === void 0) {
|
|
898
|
-
options = {};
|
|
899
|
-
}
|
|
900
|
-
return {
|
|
901
|
-
name: 'size',
|
|
902
|
-
options,
|
|
903
|
-
async fn(middlewareArguments) {
|
|
904
|
-
const {
|
|
905
|
-
placement,
|
|
906
|
-
rects,
|
|
907
|
-
platform,
|
|
908
|
-
elements
|
|
909
|
-
} = middlewareArguments;
|
|
910
|
-
const {
|
|
911
|
-
apply = () => {},
|
|
912
|
-
...detectOverflowOptions
|
|
913
|
-
} = options;
|
|
914
|
-
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
915
|
-
const side = getSide(placement);
|
|
916
|
-
const alignment = getAlignment(placement);
|
|
917
|
-
let heightSide;
|
|
918
|
-
let widthSide;
|
|
919
|
-
if (side === 'top' || side === 'bottom') {
|
|
920
|
-
heightSide = side;
|
|
921
|
-
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
922
|
-
} else {
|
|
923
|
-
widthSide = side;
|
|
924
|
-
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
925
|
-
}
|
|
926
|
-
const xMin = max$1(overflow.left, 0);
|
|
927
|
-
const xMax = max$1(overflow.right, 0);
|
|
928
|
-
const yMin = max$1(overflow.top, 0);
|
|
929
|
-
const yMax = max$1(overflow.bottom, 0);
|
|
930
|
-
const dimensions = {
|
|
931
|
-
availableHeight: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom)) : overflow[heightSide]),
|
|
932
|
-
availableWidth: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)) : overflow[widthSide])
|
|
933
|
-
};
|
|
934
|
-
await apply({
|
|
935
|
-
...middlewareArguments,
|
|
936
|
-
...dimensions
|
|
937
|
-
});
|
|
938
|
-
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
939
|
-
if (rects.floating.width !== nextDimensions.width || rects.floating.height !== nextDimensions.height) {
|
|
940
|
-
return {
|
|
941
|
-
reset: {
|
|
942
|
-
rects: true
|
|
943
|
-
}
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
return {};
|
|
947
|
-
}
|
|
948
|
-
};
|
|
949
|
-
};
|
|
950
|
-
|
|
951
1793
|
function getWindow(node) {
|
|
952
1794
|
var _node$ownerDocument;
|
|
953
1795
|
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
@@ -1514,192 +2356,6 @@ const computePosition = (reference, floating, options) => {
|
|
|
1514
2356
|
});
|
|
1515
2357
|
};
|
|
1516
2358
|
|
|
1517
|
-
var classnames = {exports: {}};
|
|
1518
|
-
|
|
1519
|
-
/*!
|
|
1520
|
-
Copyright (c) 2018 Jed Watson.
|
|
1521
|
-
Licensed under the MIT License (MIT), see
|
|
1522
|
-
http://jedwatson.github.io/classnames
|
|
1523
|
-
*/
|
|
1524
|
-
|
|
1525
|
-
(function (module) {
|
|
1526
|
-
/* global define */
|
|
1527
|
-
|
|
1528
|
-
(function () {
|
|
1529
|
-
|
|
1530
|
-
var hasOwn = {}.hasOwnProperty;
|
|
1531
|
-
|
|
1532
|
-
function classNames() {
|
|
1533
|
-
var classes = [];
|
|
1534
|
-
|
|
1535
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
1536
|
-
var arg = arguments[i];
|
|
1537
|
-
if (!arg) continue;
|
|
1538
|
-
|
|
1539
|
-
var argType = typeof arg;
|
|
1540
|
-
|
|
1541
|
-
if (argType === 'string' || argType === 'number') {
|
|
1542
|
-
classes.push(arg);
|
|
1543
|
-
} else if (Array.isArray(arg)) {
|
|
1544
|
-
if (arg.length) {
|
|
1545
|
-
var inner = classNames.apply(null, arg);
|
|
1546
|
-
if (inner) {
|
|
1547
|
-
classes.push(inner);
|
|
1548
|
-
}
|
|
1549
|
-
}
|
|
1550
|
-
} else if (argType === 'object') {
|
|
1551
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
1552
|
-
classes.push(arg.toString());
|
|
1553
|
-
continue;
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
for (var key in arg) {
|
|
1557
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
1558
|
-
classes.push(key);
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
return classes.join(' ');
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
if (module.exports) {
|
|
1568
|
-
classNames.default = classNames;
|
|
1569
|
-
module.exports = classNames;
|
|
1570
|
-
} else {
|
|
1571
|
-
window.classNames = classNames;
|
|
1572
|
-
}
|
|
1573
|
-
}());
|
|
1574
|
-
} (classnames));
|
|
1575
|
-
|
|
1576
|
-
var classNames = classnames.exports;
|
|
1577
|
-
|
|
1578
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1579
|
-
/**
|
|
1580
|
-
* This function debounce the received function
|
|
1581
|
-
* @param { function } func Function to be debounced
|
|
1582
|
-
* @param { number } wait Time to wait before execut the function
|
|
1583
|
-
* @param { boolean } immediate Param to define if the function will be executed immediately
|
|
1584
|
-
*/
|
|
1585
|
-
const debounce = (func, wait, immediate) => {
|
|
1586
|
-
let timeout = null;
|
|
1587
|
-
return function debounced(...args) {
|
|
1588
|
-
const later = () => {
|
|
1589
|
-
timeout = null;
|
|
1590
|
-
if (!immediate) {
|
|
1591
|
-
func.apply(this, args);
|
|
1592
|
-
}
|
|
1593
|
-
};
|
|
1594
|
-
if (timeout) {
|
|
1595
|
-
clearTimeout(timeout);
|
|
1596
|
-
}
|
|
1597
|
-
timeout = setTimeout(later, wait);
|
|
1598
|
-
};
|
|
1599
|
-
};
|
|
1600
|
-
|
|
1601
|
-
const TooltipContent = ({ content }) => {
|
|
1602
|
-
return jsxRuntime.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
1603
|
-
};
|
|
1604
|
-
|
|
1605
|
-
const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
|
|
1606
|
-
const DEFAULT_CONTEXT_DATA = {
|
|
1607
|
-
anchorRefs: new Set(),
|
|
1608
|
-
activeAnchor: { current: null },
|
|
1609
|
-
attach: () => {
|
|
1610
|
-
/* attach anchor element */
|
|
1611
|
-
},
|
|
1612
|
-
detach: () => {
|
|
1613
|
-
/* detach anchor element */
|
|
1614
|
-
},
|
|
1615
|
-
setActiveAnchor: () => {
|
|
1616
|
-
/* set active anchor */
|
|
1617
|
-
},
|
|
1618
|
-
};
|
|
1619
|
-
const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
1620
|
-
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
1621
|
-
};
|
|
1622
|
-
const TooltipContext = react.createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
1623
|
-
/**
|
|
1624
|
-
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
1625
|
-
* See https://react-tooltip.com/docs/getting-started
|
|
1626
|
-
*/
|
|
1627
|
-
const TooltipProvider = ({ children }) => {
|
|
1628
|
-
const [anchorRefMap, setAnchorRefMap] = react.useState({
|
|
1629
|
-
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
1630
|
-
});
|
|
1631
|
-
const [activeAnchorMap, setActiveAnchorMap] = react.useState({
|
|
1632
|
-
[DEFAULT_TOOLTIP_ID]: { current: null },
|
|
1633
|
-
});
|
|
1634
|
-
const attach = (tooltipId, ...refs) => {
|
|
1635
|
-
setAnchorRefMap((oldMap) => {
|
|
1636
|
-
var _a;
|
|
1637
|
-
const tooltipRefs = (_a = oldMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set();
|
|
1638
|
-
refs.forEach((ref) => tooltipRefs.add(ref));
|
|
1639
|
-
// create new object to trigger re-render
|
|
1640
|
-
return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
|
|
1641
|
-
});
|
|
1642
|
-
};
|
|
1643
|
-
const detach = (tooltipId, ...refs) => {
|
|
1644
|
-
setAnchorRefMap((oldMap) => {
|
|
1645
|
-
const tooltipRefs = oldMap[tooltipId];
|
|
1646
|
-
if (!tooltipRefs) {
|
|
1647
|
-
// tooltip not found
|
|
1648
|
-
// maybe thow error?
|
|
1649
|
-
return oldMap;
|
|
1650
|
-
}
|
|
1651
|
-
refs.forEach((ref) => tooltipRefs.delete(ref));
|
|
1652
|
-
// create new object to trigger re-render
|
|
1653
|
-
return { ...oldMap };
|
|
1654
|
-
});
|
|
1655
|
-
};
|
|
1656
|
-
const setActiveAnchor = (tooltipId, ref) => {
|
|
1657
|
-
setActiveAnchorMap((oldMap) => {
|
|
1658
|
-
var _a;
|
|
1659
|
-
if (((_a = oldMap[tooltipId]) === null || _a === void 0 ? void 0 : _a.current) === ref.current) {
|
|
1660
|
-
return oldMap;
|
|
1661
|
-
}
|
|
1662
|
-
// create new object to trigger re-render
|
|
1663
|
-
return { ...oldMap, [tooltipId]: ref };
|
|
1664
|
-
});
|
|
1665
|
-
};
|
|
1666
|
-
const getTooltipData = react.useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
|
|
1667
|
-
var _a, _b;
|
|
1668
|
-
return ({
|
|
1669
|
-
anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
|
|
1670
|
-
activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
|
|
1671
|
-
attach: (...refs) => attach(tooltipId, ...refs),
|
|
1672
|
-
detach: (...refs) => detach(tooltipId, ...refs),
|
|
1673
|
-
setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
|
|
1674
|
-
});
|
|
1675
|
-
}, [anchorRefMap, activeAnchorMap, attach, detach]);
|
|
1676
|
-
const context = react.useMemo(() => {
|
|
1677
|
-
return {
|
|
1678
|
-
getTooltipData,
|
|
1679
|
-
};
|
|
1680
|
-
}, [getTooltipData]);
|
|
1681
|
-
return jsxRuntime.jsx(TooltipContext.Provider, { value: context, children: children });
|
|
1682
|
-
};
|
|
1683
|
-
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
1684
|
-
return react.useContext(TooltipContext).getTooltipData(tooltipId);
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
/**
|
|
1688
|
-
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
1689
|
-
* See https://react-tooltip.com/docs/getting-started
|
|
1690
|
-
*/
|
|
1691
|
-
const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
|
|
1692
|
-
const { attach, detach } = useTooltip(tooltipId);
|
|
1693
|
-
const anchorRef = react.useRef(null);
|
|
1694
|
-
react.useEffect(() => {
|
|
1695
|
-
attach(anchorRef);
|
|
1696
|
-
return () => {
|
|
1697
|
-
detach(anchorRef);
|
|
1698
|
-
};
|
|
1699
|
-
}, []);
|
|
1700
|
-
return (jsxRuntime.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 }));
|
|
1701
|
-
};
|
|
1702
|
-
|
|
1703
2359
|
const computeTooltipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })], }) => {
|
|
1704
2360
|
if (!elementReference) {
|
|
1705
2361
|
// elementReference can be null or undefined and we will not compute the position
|
|
@@ -1754,35 +2410,35 @@ const Tooltip = ({
|
|
|
1754
2410
|
id, className, classNameArrow, variant = 'dark', anchorId, anchorSelect, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', middlewares, wrapper: WrapperElement, children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style: externalStyles, position, afterShow, afterHide,
|
|
1755
2411
|
// props handled by controller
|
|
1756
2412
|
content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
1757
|
-
const tooltipRef =
|
|
1758
|
-
const tooltipArrowRef =
|
|
1759
|
-
const tooltipShowDelayTimerRef =
|
|
1760
|
-
const tooltipHideDelayTimerRef =
|
|
1761
|
-
const [inlineStyles, setInlineStyles] =
|
|
1762
|
-
const [inlineArrowStyles, setInlineArrowStyles] =
|
|
1763
|
-
const [show, setShow] =
|
|
1764
|
-
const [rendered, setRendered] =
|
|
1765
|
-
const wasShowing =
|
|
1766
|
-
const lastFloatPosition =
|
|
2413
|
+
const tooltipRef = require$$0.useRef(null);
|
|
2414
|
+
const tooltipArrowRef = require$$0.useRef(null);
|
|
2415
|
+
const tooltipShowDelayTimerRef = require$$0.useRef(null);
|
|
2416
|
+
const tooltipHideDelayTimerRef = require$$0.useRef(null);
|
|
2417
|
+
const [inlineStyles, setInlineStyles] = require$$0.useState({});
|
|
2418
|
+
const [inlineArrowStyles, setInlineArrowStyles] = require$$0.useState({});
|
|
2419
|
+
const [show, setShow] = require$$0.useState(false);
|
|
2420
|
+
const [rendered, setRendered] = require$$0.useState(false);
|
|
2421
|
+
const wasShowing = require$$0.useRef(false);
|
|
2422
|
+
const lastFloatPosition = require$$0.useRef(null);
|
|
1767
2423
|
/**
|
|
1768
2424
|
* @todo Remove this in a future version (provider/wrapper method is deprecated)
|
|
1769
2425
|
*/
|
|
1770
2426
|
const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id);
|
|
1771
|
-
const hoveringTooltip =
|
|
1772
|
-
const [anchorsBySelect, setAnchorsBySelect] =
|
|
1773
|
-
const mounted =
|
|
2427
|
+
const hoveringTooltip = require$$0.useRef(false);
|
|
2428
|
+
const [anchorsBySelect, setAnchorsBySelect] = require$$0.useState([]);
|
|
2429
|
+
const mounted = require$$0.useRef(false);
|
|
1774
2430
|
/**
|
|
1775
2431
|
* useLayoutEffect runs before useEffect,
|
|
1776
2432
|
* but should be used carefully because of caveats
|
|
1777
2433
|
* https://beta.reactjs.org/reference/react/useLayoutEffect#caveats
|
|
1778
2434
|
*/
|
|
1779
|
-
|
|
2435
|
+
useIsomorphicLayoutEffect(() => {
|
|
1780
2436
|
mounted.current = true;
|
|
1781
2437
|
return () => {
|
|
1782
2438
|
mounted.current = false;
|
|
1783
2439
|
};
|
|
1784
2440
|
}, []);
|
|
1785
|
-
|
|
2441
|
+
require$$0.useEffect(() => {
|
|
1786
2442
|
if (!show) {
|
|
1787
2443
|
/**
|
|
1788
2444
|
* this fixes weird behavior when switching between two anchor elements very quickly
|
|
@@ -1824,7 +2480,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
1824
2480
|
* this replicates the effect from `handleShow()`
|
|
1825
2481
|
* when `isOpen` is changed from outside
|
|
1826
2482
|
*/
|
|
1827
|
-
|
|
2483
|
+
require$$0.useEffect(() => {
|
|
1828
2484
|
if (isOpen === undefined) {
|
|
1829
2485
|
return () => null;
|
|
1830
2486
|
}
|
|
@@ -1838,7 +2494,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
1838
2494
|
clearTimeout(timeout);
|
|
1839
2495
|
};
|
|
1840
2496
|
}, [isOpen]);
|
|
1841
|
-
|
|
2497
|
+
require$$0.useEffect(() => {
|
|
1842
2498
|
if (show === wasShowing.current) {
|
|
1843
2499
|
return;
|
|
1844
2500
|
}
|
|
@@ -1972,7 +2628,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
1972
2628
|
// mouse enter and focus events being triggered toggether
|
|
1973
2629
|
const debouncedHandleShowTooltip = debounce(handleShowTooltip, 50);
|
|
1974
2630
|
const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50);
|
|
1975
|
-
|
|
2631
|
+
require$$0.useEffect(() => {
|
|
1976
2632
|
var _a, _b;
|
|
1977
2633
|
const elementRefs = new Set(anchorRefs);
|
|
1978
2634
|
anchorsBySelect.forEach((anchor) => {
|
|
@@ -2040,7 +2696,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2040
2696
|
* since `tooltipRef` becomes stale after removing/adding the tooltip to the DOM
|
|
2041
2697
|
*/
|
|
2042
2698
|
}, [rendered, anchorRefs, anchorsBySelect, closeOnEsc, events]);
|
|
2043
|
-
|
|
2699
|
+
require$$0.useEffect(() => {
|
|
2044
2700
|
let selector = anchorSelect !== null && anchorSelect !== void 0 ? anchorSelect : '';
|
|
2045
2701
|
if (!selector && id) {
|
|
2046
2702
|
selector = `[data-tooltip-id='${id}']`;
|
|
@@ -2103,7 +2759,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2103
2759
|
documentObserver.disconnect();
|
|
2104
2760
|
};
|
|
2105
2761
|
}, [id, anchorSelect, activeAnchor]);
|
|
2106
|
-
|
|
2762
|
+
require$$0.useEffect(() => {
|
|
2107
2763
|
if (position) {
|
|
2108
2764
|
// if `position` is set, override regular and `float` positioning
|
|
2109
2765
|
handleTooltipPosition(position);
|
|
@@ -2144,7 +2800,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2144
2800
|
}
|
|
2145
2801
|
});
|
|
2146
2802
|
}, [show, activeAnchor, content, html, place, offset, positionStrategy, position]);
|
|
2147
|
-
|
|
2803
|
+
require$$0.useEffect(() => {
|
|
2148
2804
|
var _a;
|
|
2149
2805
|
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
2150
2806
|
const anchors = [...anchorsBySelect, anchorById];
|
|
@@ -2157,7 +2813,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2157
2813
|
setActiveAnchor((_a = anchorsBySelect[0]) !== null && _a !== void 0 ? _a : anchorById);
|
|
2158
2814
|
}
|
|
2159
2815
|
}, [anchorId, anchorsBySelect, activeAnchor]);
|
|
2160
|
-
|
|
2816
|
+
require$$0.useEffect(() => {
|
|
2161
2817
|
return () => {
|
|
2162
2818
|
if (tooltipShowDelayTimerRef.current) {
|
|
2163
2819
|
clearTimeout(tooltipShowDelayTimerRef.current);
|
|
@@ -2167,7 +2823,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2167
2823
|
}
|
|
2168
2824
|
};
|
|
2169
2825
|
}, []);
|
|
2170
|
-
|
|
2826
|
+
require$$0.useEffect(() => {
|
|
2171
2827
|
let selector = anchorSelect;
|
|
2172
2828
|
if (!selector && id) {
|
|
2173
2829
|
selector = `[data-tooltip-id='${id}']`;
|
|
@@ -2186,28 +2842,28 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2186
2842
|
}, [id, anchorSelect]);
|
|
2187
2843
|
const hasContentOrChildren = Boolean(html || content || children);
|
|
2188
2844
|
const canShow = hasContentOrChildren && show && Object.keys(inlineStyles).length > 0;
|
|
2189
|
-
return rendered ? (jsxRuntime.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, {
|
|
2845
|
+
return rendered ? (jsxRuntime.exports.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, {
|
|
2190
2846
|
[styles['show']]: canShow,
|
|
2191
2847
|
[styles['fixed']]: positionStrategy === 'fixed',
|
|
2192
2848
|
[styles['clickable']]: clickable,
|
|
2193
|
-
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [(html && jsxRuntime.jsx(TooltipContent, { content: html })) || content || children, jsxRuntime.jsx(WrapperElement, { className: classNames('react-tooltip-arrow', styles['arrow'], classNameArrow, {
|
|
2849
|
+
}), 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, {
|
|
2194
2850
|
[styles['no-arrow']]: noArrow,
|
|
2195
2851
|
}), style: inlineArrowStyles, ref: tooltipArrowRef })] })) : null;
|
|
2196
2852
|
};
|
|
2197
2853
|
|
|
2198
2854
|
const TooltipController = ({ id, anchorId, anchorSelect, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
|
|
2199
|
-
const [tooltipContent, setTooltipContent] =
|
|
2200
|
-
const [tooltipHtml, setTooltipHtml] =
|
|
2201
|
-
const [tooltipPlace, setTooltipPlace] =
|
|
2202
|
-
const [tooltipVariant, setTooltipVariant] =
|
|
2203
|
-
const [tooltipOffset, setTooltipOffset] =
|
|
2204
|
-
const [tooltipDelayShow, setTooltipDelayShow] =
|
|
2205
|
-
const [tooltipDelayHide, setTooltipDelayHide] =
|
|
2206
|
-
const [tooltipFloat, setTooltipFloat] =
|
|
2207
|
-
const [tooltipWrapper, setTooltipWrapper] =
|
|
2208
|
-
const [tooltipEvents, setTooltipEvents] =
|
|
2209
|
-
const [tooltipPositionStrategy, setTooltipPositionStrategy] =
|
|
2210
|
-
const [activeAnchor, setActiveAnchor] =
|
|
2855
|
+
const [tooltipContent, setTooltipContent] = require$$0.useState(content);
|
|
2856
|
+
const [tooltipHtml, setTooltipHtml] = require$$0.useState(html);
|
|
2857
|
+
const [tooltipPlace, setTooltipPlace] = require$$0.useState(place);
|
|
2858
|
+
const [tooltipVariant, setTooltipVariant] = require$$0.useState(variant);
|
|
2859
|
+
const [tooltipOffset, setTooltipOffset] = require$$0.useState(offset);
|
|
2860
|
+
const [tooltipDelayShow, setTooltipDelayShow] = require$$0.useState(delayShow);
|
|
2861
|
+
const [tooltipDelayHide, setTooltipDelayHide] = require$$0.useState(delayHide);
|
|
2862
|
+
const [tooltipFloat, setTooltipFloat] = require$$0.useState(float);
|
|
2863
|
+
const [tooltipWrapper, setTooltipWrapper] = require$$0.useState(wrapper);
|
|
2864
|
+
const [tooltipEvents, setTooltipEvents] = require$$0.useState(events);
|
|
2865
|
+
const [tooltipPositionStrategy, setTooltipPositionStrategy] = require$$0.useState(positionStrategy);
|
|
2866
|
+
const [activeAnchor, setActiveAnchor] = require$$0.useState(null);
|
|
2211
2867
|
/**
|
|
2212
2868
|
* @todo Remove this in a future version (provider/wrapper method is deprecated)
|
|
2213
2869
|
*/
|
|
@@ -2272,16 +2928,16 @@ const TooltipController = ({ id, anchorId, anchorSelect, content, html, classNam
|
|
|
2272
2928
|
(_a = handleDataAttributes[key]) === null || _a === void 0 ? void 0 : _a.call(handleDataAttributes, value);
|
|
2273
2929
|
});
|
|
2274
2930
|
};
|
|
2275
|
-
|
|
2931
|
+
require$$0.useEffect(() => {
|
|
2276
2932
|
setTooltipContent(content);
|
|
2277
2933
|
}, [content]);
|
|
2278
|
-
|
|
2934
|
+
require$$0.useEffect(() => {
|
|
2279
2935
|
setTooltipHtml(html);
|
|
2280
2936
|
}, [html]);
|
|
2281
|
-
|
|
2937
|
+
require$$0.useEffect(() => {
|
|
2282
2938
|
setTooltipPlace(place);
|
|
2283
2939
|
}, [place]);
|
|
2284
|
-
|
|
2940
|
+
require$$0.useEffect(() => {
|
|
2285
2941
|
var _a;
|
|
2286
2942
|
const elementRefs = new Set(anchorRefs);
|
|
2287
2943
|
let selector = anchorSelect;
|
|
@@ -2369,15 +3025,9 @@ const TooltipController = ({ id, anchorId, anchorSelect, content, html, classNam
|
|
|
2369
3025
|
activeAnchor,
|
|
2370
3026
|
setActiveAnchor: (anchor) => setActiveAnchor(anchor),
|
|
2371
3027
|
};
|
|
2372
|
-
return children ? jsxRuntime.jsx(Tooltip, { ...props, children: children }) : jsxRuntime.jsx(Tooltip, { ...props });
|
|
3028
|
+
return children ? jsxRuntime.exports.jsx(Tooltip, { ...props, children: children }) : jsxRuntime.exports.jsx(Tooltip, { ...props });
|
|
2373
3029
|
};
|
|
2374
3030
|
|
|
2375
3031
|
exports.Tooltip = TooltipController;
|
|
2376
3032
|
exports.TooltipProvider = TooltipProvider;
|
|
2377
3033
|
exports.TooltipWrapper = TooltipWrapper;
|
|
2378
|
-
exports.autoPlacement = autoPlacement;
|
|
2379
|
-
exports.flip = flip;
|
|
2380
|
-
exports.inline = inline;
|
|
2381
|
-
exports.offset = offset;
|
|
2382
|
-
exports.shift = shift;
|
|
2383
|
-
exports.size = size;
|