react-tooltip 5.10.1-beta-9 → 5.10.1-beta-10

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.
@@ -1,985 +1,7 @@
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;
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect, useLayoutEffect } from 'react';
3
+ import classNames from 'classnames';
4
+ import { arrow, computePosition, offset, flip, shift } from '@floating-ui/dom';
983
5
 
984
6
  /* eslint-disable @typescript-eslint/no-explicit-any */
985
7
  /**
@@ -1080,7 +102,7 @@ const TooltipProvider = ({ children }) => {
1080
102
  getTooltipData,
1081
103
  };
1082
104
  }, [getTooltipData]);
1083
- return jsxRuntime.exports.jsx(TooltipContext.Provider, { value: context, children: children });
105
+ return jsx(TooltipContext.Provider, { value: context, children: children });
1084
106
  };
1085
107
  function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
1086
108
  return useContext(TooltipContext).getTooltipData(tooltipId);
@@ -1099,1288 +121,11 @@ const TooltipWrapper = ({ tooltipId, children, className, place, content, html,
1099
121
  detach(anchorRef);
1100
122
  };
1101
123
  }, []);
1102
- 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 }));
124
+ 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 }));
1103
125
  };
1104
126
 
1105
127
  const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
1106
128
 
1107
- function getAlignment(placement) {
1108
- return placement.split('-')[1];
1109
- }
1110
-
1111
- function getLengthFromAxis(axis) {
1112
- return axis === 'y' ? 'height' : 'width';
1113
- }
1114
-
1115
- function getSide(placement) {
1116
- return placement.split('-')[0];
1117
- }
1118
-
1119
- function getMainAxisFromPlacement(placement) {
1120
- return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
1121
- }
1122
-
1123
- function computeCoordsFromPlacement(_ref, placement, rtl) {
1124
- let {
1125
- reference,
1126
- floating
1127
- } = _ref;
1128
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
1129
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
1130
- const mainAxis = getMainAxisFromPlacement(placement);
1131
- const length = getLengthFromAxis(mainAxis);
1132
- const commonAlign = reference[length] / 2 - floating[length] / 2;
1133
- const side = getSide(placement);
1134
- const isVertical = mainAxis === 'x';
1135
- let coords;
1136
- switch (side) {
1137
- case 'top':
1138
- coords = {
1139
- x: commonX,
1140
- y: reference.y - floating.height
1141
- };
1142
- break;
1143
- case 'bottom':
1144
- coords = {
1145
- x: commonX,
1146
- y: reference.y + reference.height
1147
- };
1148
- break;
1149
- case 'right':
1150
- coords = {
1151
- x: reference.x + reference.width,
1152
- y: commonY
1153
- };
1154
- break;
1155
- case 'left':
1156
- coords = {
1157
- x: reference.x - floating.width,
1158
- y: commonY
1159
- };
1160
- break;
1161
- default:
1162
- coords = {
1163
- x: reference.x,
1164
- y: reference.y
1165
- };
1166
- }
1167
- switch (getAlignment(placement)) {
1168
- case 'start':
1169
- coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1170
- break;
1171
- case 'end':
1172
- coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1173
- break;
1174
- }
1175
- return coords;
1176
- }
1177
-
1178
- /**
1179
- * Computes the `x` and `y` coordinates that will place the floating element
1180
- * next to a reference element when it is given a certain positioning strategy.
1181
- *
1182
- * This export does not have any `platform` interface logic. You will need to
1183
- * write one for the platform you are using Floating UI with.
1184
- */
1185
- const computePosition$1 = async (reference, floating, config) => {
1186
- const {
1187
- placement = 'bottom',
1188
- strategy = 'absolute',
1189
- middleware = [],
1190
- platform
1191
- } = config;
1192
- const validMiddleware = middleware.filter(Boolean);
1193
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
1194
- {
1195
- if (platform == null) {
1196
- console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
1197
- }
1198
- if (validMiddleware.filter(_ref => {
1199
- let {
1200
- name
1201
- } = _ref;
1202
- return name === 'autoPlacement' || name === 'flip';
1203
- }).length > 1) {
1204
- throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement` middleware', 'detected. This will lead to an infinite loop. Ensure only one of', 'either has been passed to the `middleware` array.'].join(' '));
1205
- }
1206
- if (!reference || !floating) {
1207
- console.error(['Floating UI: The reference and/or floating element was not defined', 'when `computePosition()` was called. Ensure that both elements have', 'been created and can be measured.'].join(' '));
1208
- }
1209
- }
1210
- let rects = await platform.getElementRects({
1211
- reference,
1212
- floating,
1213
- strategy
1214
- });
1215
- let {
1216
- x,
1217
- y
1218
- } = computeCoordsFromPlacement(rects, placement, rtl);
1219
- let statefulPlacement = placement;
1220
- let middlewareData = {};
1221
- let resetCount = 0;
1222
- for (let i = 0; i < validMiddleware.length; i++) {
1223
- const {
1224
- name,
1225
- fn
1226
- } = validMiddleware[i];
1227
- const {
1228
- x: nextX,
1229
- y: nextY,
1230
- data,
1231
- reset
1232
- } = await fn({
1233
- x,
1234
- y,
1235
- initialPlacement: placement,
1236
- placement: statefulPlacement,
1237
- strategy,
1238
- middlewareData,
1239
- rects,
1240
- platform,
1241
- elements: {
1242
- reference,
1243
- floating
1244
- }
1245
- });
1246
- x = nextX != null ? nextX : x;
1247
- y = nextY != null ? nextY : y;
1248
- middlewareData = {
1249
- ...middlewareData,
1250
- [name]: {
1251
- ...middlewareData[name],
1252
- ...data
1253
- }
1254
- };
1255
- {
1256
- if (resetCount > 50) {
1257
- console.warn(['Floating UI: The middleware lifecycle appears to be running in an', 'infinite loop. This is usually caused by a `reset` continually', 'being returned without a break condition.'].join(' '));
1258
- }
1259
- }
1260
- if (reset && resetCount <= 50) {
1261
- resetCount++;
1262
- if (typeof reset === 'object') {
1263
- if (reset.placement) {
1264
- statefulPlacement = reset.placement;
1265
- }
1266
- if (reset.rects) {
1267
- rects = reset.rects === true ? await platform.getElementRects({
1268
- reference,
1269
- floating,
1270
- strategy
1271
- }) : reset.rects;
1272
- }
1273
- ({
1274
- x,
1275
- y
1276
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1277
- }
1278
- i = -1;
1279
- continue;
1280
- }
1281
- }
1282
- return {
1283
- x,
1284
- y,
1285
- placement: statefulPlacement,
1286
- strategy,
1287
- middlewareData
1288
- };
1289
- };
1290
-
1291
- function expandPaddingObject(padding) {
1292
- return {
1293
- top: 0,
1294
- right: 0,
1295
- bottom: 0,
1296
- left: 0,
1297
- ...padding
1298
- };
1299
- }
1300
-
1301
- function getSideObjectFromPadding(padding) {
1302
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
1303
- top: padding,
1304
- right: padding,
1305
- bottom: padding,
1306
- left: padding
1307
- };
1308
- }
1309
-
1310
- function rectToClientRect(rect) {
1311
- return {
1312
- ...rect,
1313
- top: rect.y,
1314
- left: rect.x,
1315
- right: rect.x + rect.width,
1316
- bottom: rect.y + rect.height
1317
- };
1318
- }
1319
-
1320
- /**
1321
- * Resolves with an object of overflow side offsets that determine how much the
1322
- * element is overflowing a given clipping boundary on each side.
1323
- * - positive = overflowing the boundary by that number of pixels
1324
- * - negative = how many pixels left before it will overflow
1325
- * - 0 = lies flush with the boundary
1326
- * @see https://floating-ui.com/docs/detectOverflow
1327
- */
1328
- async function detectOverflow(state, options) {
1329
- var _await$platform$isEle;
1330
- if (options === void 0) {
1331
- options = {};
1332
- }
1333
- const {
1334
- x,
1335
- y,
1336
- platform,
1337
- rects,
1338
- elements,
1339
- strategy
1340
- } = state;
1341
- const {
1342
- boundary = 'clippingAncestors',
1343
- rootBoundary = 'viewport',
1344
- elementContext = 'floating',
1345
- altBoundary = false,
1346
- padding = 0
1347
- } = options;
1348
- const paddingObject = getSideObjectFromPadding(padding);
1349
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
1350
- const element = elements[altBoundary ? altContext : elementContext];
1351
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
1352
- element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
1353
- boundary,
1354
- rootBoundary,
1355
- strategy
1356
- }));
1357
- const rect = elementContext === 'floating' ? {
1358
- ...rects.floating,
1359
- x,
1360
- y
1361
- } : rects.reference;
1362
- const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
1363
- const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
1364
- x: 1,
1365
- y: 1
1366
- } : {
1367
- x: 1,
1368
- y: 1
1369
- };
1370
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
1371
- rect,
1372
- offsetParent,
1373
- strategy
1374
- }) : rect);
1375
- return {
1376
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1377
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1378
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1379
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1380
- };
1381
- }
1382
-
1383
- const min$1 = Math.min;
1384
- const max$1 = Math.max;
1385
-
1386
- function within(min$1$1, value, max$1$1) {
1387
- return max$1(min$1$1, min$1(value, max$1$1));
1388
- }
1389
-
1390
- /**
1391
- * Provides data to position an inner element of the floating element so that it
1392
- * appears centered to the reference element.
1393
- * @see https://floating-ui.com/docs/arrow
1394
- */
1395
- const arrow = options => ({
1396
- name: 'arrow',
1397
- options,
1398
- async fn(state) {
1399
- // Since `element` is required, we don't Partial<> the type.
1400
- const {
1401
- element,
1402
- padding = 0
1403
- } = options || {};
1404
- const {
1405
- x,
1406
- y,
1407
- placement,
1408
- rects,
1409
- platform,
1410
- elements
1411
- } = state;
1412
- if (element == null) {
1413
- {
1414
- console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
1415
- }
1416
- return {};
1417
- }
1418
- const paddingObject = getSideObjectFromPadding(padding);
1419
- const coords = {
1420
- x,
1421
- y
1422
- };
1423
- const axis = getMainAxisFromPlacement(placement);
1424
- const length = getLengthFromAxis(axis);
1425
- const arrowDimensions = await platform.getDimensions(element);
1426
- const isYAxis = axis === 'y';
1427
- const minProp = isYAxis ? 'top' : 'left';
1428
- const maxProp = isYAxis ? 'bottom' : 'right';
1429
- const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
1430
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1431
- const startDiff = coords[axis] - rects.reference[axis];
1432
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
1433
- let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1434
-
1435
- // DOM platform can return `window` as the `offsetParent`.
1436
- if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
1437
- clientSize = elements.floating[clientProp] || rects.floating[length];
1438
- }
1439
- const centerToReference = endDiff / 2 - startDiff / 2;
1440
-
1441
- // Make sure the arrow doesn't overflow the floating element if the center
1442
- // point is outside the floating element's bounds.
1443
- const min = paddingObject[minProp];
1444
- const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
1445
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1446
- const offset = within(min, center, max);
1447
-
1448
- // If the reference is small enough that the arrow's padding causes it to
1449
- // to point to nothing for an aligned placement, adjust the offset of the
1450
- // floating element itself. This stops `shift()` from taking action, but can
1451
- // be worked around by calling it again after the `arrow()` if desired.
1452
- const shouldAddOffset = getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min ? paddingObject[minProp] : paddingObject[maxProp]) - arrowDimensions[length] / 2 < 0;
1453
- const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
1454
- return {
1455
- [axis]: coords[axis] - alignmentOffset,
1456
- data: {
1457
- [axis]: offset,
1458
- centerOffset: center - offset
1459
- }
1460
- };
1461
- }
1462
- });
1463
-
1464
- const oppositeSideMap = {
1465
- left: 'right',
1466
- right: 'left',
1467
- bottom: 'top',
1468
- top: 'bottom'
1469
- };
1470
- function getOppositePlacement(placement) {
1471
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
1472
- }
1473
-
1474
- function getAlignmentSides(placement, rects, rtl) {
1475
- if (rtl === void 0) {
1476
- rtl = false;
1477
- }
1478
- const alignment = getAlignment(placement);
1479
- const mainAxis = getMainAxisFromPlacement(placement);
1480
- const length = getLengthFromAxis(mainAxis);
1481
- let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
1482
- if (rects.reference[length] > rects.floating[length]) {
1483
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
1484
- }
1485
- return {
1486
- main: mainAlignmentSide,
1487
- cross: getOppositePlacement(mainAlignmentSide)
1488
- };
1489
- }
1490
-
1491
- const oppositeAlignmentMap = {
1492
- start: 'end',
1493
- end: 'start'
1494
- };
1495
- function getOppositeAlignmentPlacement(placement) {
1496
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
1497
- }
1498
-
1499
- function getExpandedPlacements(placement) {
1500
- const oppositePlacement = getOppositePlacement(placement);
1501
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
1502
- }
1503
-
1504
- function getSideList(side, isStart, rtl) {
1505
- const lr = ['left', 'right'];
1506
- const rl = ['right', 'left'];
1507
- const tb = ['top', 'bottom'];
1508
- const bt = ['bottom', 'top'];
1509
- switch (side) {
1510
- case 'top':
1511
- case 'bottom':
1512
- if (rtl) return isStart ? rl : lr;
1513
- return isStart ? lr : rl;
1514
- case 'left':
1515
- case 'right':
1516
- return isStart ? tb : bt;
1517
- default:
1518
- return [];
1519
- }
1520
- }
1521
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
1522
- const alignment = getAlignment(placement);
1523
- let list = getSideList(getSide(placement), direction === 'start', rtl);
1524
- if (alignment) {
1525
- list = list.map(side => side + "-" + alignment);
1526
- if (flipAlignment) {
1527
- list = list.concat(list.map(getOppositeAlignmentPlacement));
1528
- }
1529
- }
1530
- return list;
1531
- }
1532
-
1533
- /**
1534
- * Optimizes the visibility of the floating element by flipping the `placement`
1535
- * in order to keep it in view when the preferred placement(s) will overflow the
1536
- * clipping boundary. Alternative to `autoPlacement`.
1537
- * @see https://floating-ui.com/docs/flip
1538
- */
1539
- const flip = function (options) {
1540
- if (options === void 0) {
1541
- options = {};
1542
- }
1543
- return {
1544
- name: 'flip',
1545
- options,
1546
- async fn(state) {
1547
- var _middlewareData$flip;
1548
- const {
1549
- placement,
1550
- middlewareData,
1551
- rects,
1552
- initialPlacement,
1553
- platform,
1554
- elements
1555
- } = state;
1556
- const {
1557
- mainAxis: checkMainAxis = true,
1558
- crossAxis: checkCrossAxis = true,
1559
- fallbackPlacements: specifiedFallbackPlacements,
1560
- fallbackStrategy = 'bestFit',
1561
- fallbackAxisSideDirection = 'none',
1562
- flipAlignment = true,
1563
- ...detectOverflowOptions
1564
- } = options;
1565
- const side = getSide(placement);
1566
- const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1567
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1568
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1569
- if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
1570
- fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1571
- }
1572
- const placements = [initialPlacement, ...fallbackPlacements];
1573
- const overflow = await detectOverflow(state, detectOverflowOptions);
1574
- const overflows = [];
1575
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1576
- if (checkMainAxis) {
1577
- overflows.push(overflow[side]);
1578
- }
1579
- if (checkCrossAxis) {
1580
- const {
1581
- main,
1582
- cross
1583
- } = getAlignmentSides(placement, rects, rtl);
1584
- overflows.push(overflow[main], overflow[cross]);
1585
- }
1586
- overflowsData = [...overflowsData, {
1587
- placement,
1588
- overflows
1589
- }];
1590
-
1591
- // One or more sides is overflowing.
1592
- if (!overflows.every(side => side <= 0)) {
1593
- var _middlewareData$flip2, _overflowsData$filter;
1594
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1595
- const nextPlacement = placements[nextIndex];
1596
- if (nextPlacement) {
1597
- // Try next placement and re-run the lifecycle.
1598
- return {
1599
- data: {
1600
- index: nextIndex,
1601
- overflows: overflowsData
1602
- },
1603
- reset: {
1604
- placement: nextPlacement
1605
- }
1606
- };
1607
- }
1608
-
1609
- // First, find the candidates that fit on the mainAxis side of overflow,
1610
- // then find the placement that fits the best on the main crossAxis side.
1611
- let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
1612
-
1613
- // Otherwise fallback.
1614
- if (!resetPlacement) {
1615
- switch (fallbackStrategy) {
1616
- case 'bestFit':
1617
- {
1618
- var _overflowsData$map$so;
1619
- const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
1620
- if (placement) {
1621
- resetPlacement = placement;
1622
- }
1623
- break;
1624
- }
1625
- case 'initialPlacement':
1626
- resetPlacement = initialPlacement;
1627
- break;
1628
- }
1629
- }
1630
- if (placement !== resetPlacement) {
1631
- return {
1632
- reset: {
1633
- placement: resetPlacement
1634
- }
1635
- };
1636
- }
1637
- }
1638
- return {};
1639
- }
1640
- };
1641
- };
1642
-
1643
- async function convertValueToCoords(state, value) {
1644
- const {
1645
- placement,
1646
- platform,
1647
- elements
1648
- } = state;
1649
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1650
- const side = getSide(placement);
1651
- const alignment = getAlignment(placement);
1652
- const isVertical = getMainAxisFromPlacement(placement) === 'x';
1653
- const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1654
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
1655
- const rawValue = typeof value === 'function' ? value(state) : value;
1656
-
1657
- // eslint-disable-next-line prefer-const
1658
- let {
1659
- mainAxis,
1660
- crossAxis,
1661
- alignmentAxis
1662
- } = typeof rawValue === 'number' ? {
1663
- mainAxis: rawValue,
1664
- crossAxis: 0,
1665
- alignmentAxis: null
1666
- } : {
1667
- mainAxis: 0,
1668
- crossAxis: 0,
1669
- alignmentAxis: null,
1670
- ...rawValue
1671
- };
1672
- if (alignment && typeof alignmentAxis === 'number') {
1673
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1674
- }
1675
- return isVertical ? {
1676
- x: crossAxis * crossAxisMulti,
1677
- y: mainAxis * mainAxisMulti
1678
- } : {
1679
- x: mainAxis * mainAxisMulti,
1680
- y: crossAxis * crossAxisMulti
1681
- };
1682
- }
1683
-
1684
- /**
1685
- * Modifies the placement by translating the floating element along the
1686
- * specified axes.
1687
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
1688
- * object may be passed.
1689
- * @see https://floating-ui.com/docs/offset
1690
- */
1691
- const offset = function (value) {
1692
- if (value === void 0) {
1693
- value = 0;
1694
- }
1695
- return {
1696
- name: 'offset',
1697
- options: value,
1698
- async fn(state) {
1699
- const {
1700
- x,
1701
- y
1702
- } = state;
1703
- const diffCoords = await convertValueToCoords(state, value);
1704
- return {
1705
- x: x + diffCoords.x,
1706
- y: y + diffCoords.y,
1707
- data: diffCoords
1708
- };
1709
- }
1710
- };
1711
- };
1712
-
1713
- function getCrossAxis(axis) {
1714
- return axis === 'x' ? 'y' : 'x';
1715
- }
1716
-
1717
- /**
1718
- * Optimizes the visibility of the floating element by shifting it in order to
1719
- * keep it in view when it will overflow the clipping boundary.
1720
- * @see https://floating-ui.com/docs/shift
1721
- */
1722
- const shift = function (options) {
1723
- if (options === void 0) {
1724
- options = {};
1725
- }
1726
- return {
1727
- name: 'shift',
1728
- options,
1729
- async fn(state) {
1730
- const {
1731
- x,
1732
- y,
1733
- placement
1734
- } = state;
1735
- const {
1736
- mainAxis: checkMainAxis = true,
1737
- crossAxis: checkCrossAxis = false,
1738
- limiter = {
1739
- fn: _ref => {
1740
- let {
1741
- x,
1742
- y
1743
- } = _ref;
1744
- return {
1745
- x,
1746
- y
1747
- };
1748
- }
1749
- },
1750
- ...detectOverflowOptions
1751
- } = options;
1752
- const coords = {
1753
- x,
1754
- y
1755
- };
1756
- const overflow = await detectOverflow(state, detectOverflowOptions);
1757
- const mainAxis = getMainAxisFromPlacement(getSide(placement));
1758
- const crossAxis = getCrossAxis(mainAxis);
1759
- let mainAxisCoord = coords[mainAxis];
1760
- let crossAxisCoord = coords[crossAxis];
1761
- if (checkMainAxis) {
1762
- const minSide = mainAxis === 'y' ? 'top' : 'left';
1763
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
1764
- const min = mainAxisCoord + overflow[minSide];
1765
- const max = mainAxisCoord - overflow[maxSide];
1766
- mainAxisCoord = within(min, mainAxisCoord, max);
1767
- }
1768
- if (checkCrossAxis) {
1769
- const minSide = crossAxis === 'y' ? 'top' : 'left';
1770
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
1771
- const min = crossAxisCoord + overflow[minSide];
1772
- const max = crossAxisCoord - overflow[maxSide];
1773
- crossAxisCoord = within(min, crossAxisCoord, max);
1774
- }
1775
- const limitedCoords = limiter.fn({
1776
- ...state,
1777
- [mainAxis]: mainAxisCoord,
1778
- [crossAxis]: crossAxisCoord
1779
- });
1780
- return {
1781
- ...limitedCoords,
1782
- data: {
1783
- x: limitedCoords.x - x,
1784
- y: limitedCoords.y - y
1785
- }
1786
- };
1787
- }
1788
- };
1789
- };
1790
-
1791
- function getWindow(node) {
1792
- var _node$ownerDocument;
1793
- return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1794
- }
1795
-
1796
- function getComputedStyle$1(element) {
1797
- return getWindow(element).getComputedStyle(element);
1798
- }
1799
-
1800
- const min = Math.min;
1801
- const max = Math.max;
1802
- const round = Math.round;
1803
-
1804
- function getCssDimensions(element) {
1805
- const css = getComputedStyle$1(element);
1806
- let width = parseFloat(css.width);
1807
- let height = parseFloat(css.height);
1808
- const offsetWidth = element.offsetWidth;
1809
- const offsetHeight = element.offsetHeight;
1810
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1811
- if (shouldFallback) {
1812
- width = offsetWidth;
1813
- height = offsetHeight;
1814
- }
1815
- return {
1816
- width,
1817
- height,
1818
- fallback: shouldFallback
1819
- };
1820
- }
1821
-
1822
- function getNodeName(node) {
1823
- return isNode(node) ? (node.nodeName || '').toLowerCase() : '';
1824
- }
1825
-
1826
- let uaString;
1827
- function getUAString() {
1828
- if (uaString) {
1829
- return uaString;
1830
- }
1831
- const uaData = navigator.userAgentData;
1832
- if (uaData && Array.isArray(uaData.brands)) {
1833
- uaString = uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
1834
- return uaString;
1835
- }
1836
- return navigator.userAgent;
1837
- }
1838
-
1839
- function isHTMLElement(value) {
1840
- return value instanceof getWindow(value).HTMLElement;
1841
- }
1842
- function isElement(value) {
1843
- return value instanceof getWindow(value).Element;
1844
- }
1845
- function isNode(value) {
1846
- return value instanceof getWindow(value).Node;
1847
- }
1848
- function isShadowRoot(node) {
1849
- // Browsers without `ShadowRoot` support.
1850
- if (typeof ShadowRoot === 'undefined') {
1851
- return false;
1852
- }
1853
- const OwnElement = getWindow(node).ShadowRoot;
1854
- return node instanceof OwnElement || node instanceof ShadowRoot;
1855
- }
1856
- function isOverflowElement(element) {
1857
- const {
1858
- overflow,
1859
- overflowX,
1860
- overflowY,
1861
- display
1862
- } = getComputedStyle$1(element);
1863
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1864
- }
1865
- function isTableElement(element) {
1866
- return ['table', 'td', 'th'].includes(getNodeName(element));
1867
- }
1868
- function isContainingBlock(element) {
1869
- // TODO: Try to use feature detection here instead.
1870
- const isFirefox = /firefox/i.test(getUAString());
1871
- const css = getComputedStyle$1(element);
1872
- const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter;
1873
-
1874
- // This is non-exhaustive but covers the most common CSS properties that
1875
- // create a containing block.
1876
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1877
- return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => {
1878
- // Add type check for old browsers.
1879
- const contain = css.contain;
1880
- return contain != null ? contain.includes(value) : false;
1881
- });
1882
- }
1883
-
1884
- /**
1885
- * Determines whether or not `.getBoundingClientRect()` is affected by visual
1886
- * viewport offsets. In Safari, the `x`/`y` offsets are values relative to the
1887
- * visual viewport, while in other engines, they are values relative to the
1888
- * layout viewport.
1889
- */
1890
- function isClientRectVisualViewportBased() {
1891
- // TODO: Try to use feature detection here instead. Feature detection for
1892
- // this can fail in various ways, making the userAgent check the most
1893
- // reliable:
1894
- // • Always-visible scrollbar or not
1895
- // • Width of <html>
1896
-
1897
- // Is Safari.
1898
- return /^((?!chrome|android).)*safari/i.test(getUAString());
1899
- }
1900
- function isLastTraversableNode(node) {
1901
- return ['html', 'body', '#document'].includes(getNodeName(node));
1902
- }
1903
-
1904
- function unwrapElement(element) {
1905
- return !isElement(element) ? element.contextElement : element;
1906
- }
1907
-
1908
- const FALLBACK_SCALE = {
1909
- x: 1,
1910
- y: 1
1911
- };
1912
- function getScale(element) {
1913
- const domElement = unwrapElement(element);
1914
- if (!isHTMLElement(domElement)) {
1915
- return FALLBACK_SCALE;
1916
- }
1917
- const rect = domElement.getBoundingClientRect();
1918
- const {
1919
- width,
1920
- height,
1921
- fallback
1922
- } = getCssDimensions(domElement);
1923
- let x = (fallback ? round(rect.width) : rect.width) / width;
1924
- let y = (fallback ? round(rect.height) : rect.height) / height;
1925
-
1926
- // 0, NaN, or Infinity should always fallback to 1.
1927
-
1928
- if (!x || !Number.isFinite(x)) {
1929
- x = 1;
1930
- }
1931
- if (!y || !Number.isFinite(y)) {
1932
- y = 1;
1933
- }
1934
- return {
1935
- x,
1936
- y
1937
- };
1938
- }
1939
-
1940
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1941
- var _win$visualViewport, _win$visualViewport2;
1942
- if (includeScale === void 0) {
1943
- includeScale = false;
1944
- }
1945
- if (isFixedStrategy === void 0) {
1946
- isFixedStrategy = false;
1947
- }
1948
- const clientRect = element.getBoundingClientRect();
1949
- const domElement = unwrapElement(element);
1950
- let scale = FALLBACK_SCALE;
1951
- if (includeScale) {
1952
- if (offsetParent) {
1953
- if (isElement(offsetParent)) {
1954
- scale = getScale(offsetParent);
1955
- }
1956
- } else {
1957
- scale = getScale(element);
1958
- }
1959
- }
1960
- const win = domElement ? getWindow(domElement) : window;
1961
- const addVisualOffsets = isClientRectVisualViewportBased() && isFixedStrategy;
1962
- let x = (clientRect.left + (addVisualOffsets ? ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0 : 0)) / scale.x;
1963
- let y = (clientRect.top + (addVisualOffsets ? ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0 : 0)) / scale.y;
1964
- let width = clientRect.width / scale.x;
1965
- let height = clientRect.height / scale.y;
1966
- if (domElement) {
1967
- const win = getWindow(domElement);
1968
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1969
- let currentIFrame = win.frameElement;
1970
- while (currentIFrame && offsetParent && offsetWin !== win) {
1971
- const iframeScale = getScale(currentIFrame);
1972
- const iframeRect = currentIFrame.getBoundingClientRect();
1973
- const css = getComputedStyle(currentIFrame);
1974
- iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1975
- iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1976
- x *= iframeScale.x;
1977
- y *= iframeScale.y;
1978
- width *= iframeScale.x;
1979
- height *= iframeScale.y;
1980
- x += iframeRect.x;
1981
- y += iframeRect.y;
1982
- currentIFrame = getWindow(currentIFrame).frameElement;
1983
- }
1984
- }
1985
- return rectToClientRect({
1986
- width,
1987
- height,
1988
- x,
1989
- y
1990
- });
1991
- }
1992
-
1993
- function getDocumentElement(node) {
1994
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
1995
- }
1996
-
1997
- function getNodeScroll(element) {
1998
- if (isElement(element)) {
1999
- return {
2000
- scrollLeft: element.scrollLeft,
2001
- scrollTop: element.scrollTop
2002
- };
2003
- }
2004
- return {
2005
- scrollLeft: element.pageXOffset,
2006
- scrollTop: element.pageYOffset
2007
- };
2008
- }
2009
-
2010
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2011
- let {
2012
- rect,
2013
- offsetParent,
2014
- strategy
2015
- } = _ref;
2016
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
2017
- const documentElement = getDocumentElement(offsetParent);
2018
- if (offsetParent === documentElement) {
2019
- return rect;
2020
- }
2021
- let scroll = {
2022
- scrollLeft: 0,
2023
- scrollTop: 0
2024
- };
2025
- let scale = {
2026
- x: 1,
2027
- y: 1
2028
- };
2029
- const offsets = {
2030
- x: 0,
2031
- y: 0
2032
- };
2033
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
2034
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2035
- scroll = getNodeScroll(offsetParent);
2036
- }
2037
- if (isHTMLElement(offsetParent)) {
2038
- const offsetRect = getBoundingClientRect(offsetParent);
2039
- scale = getScale(offsetParent);
2040
- offsets.x = offsetRect.x + offsetParent.clientLeft;
2041
- offsets.y = offsetRect.y + offsetParent.clientTop;
2042
- }
2043
- }
2044
- return {
2045
- width: rect.width * scale.x,
2046
- height: rect.height * scale.y,
2047
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
2048
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
2049
- };
2050
- }
2051
-
2052
- function getWindowScrollBarX(element) {
2053
- // If <html> has a CSS width greater than the viewport, then this will be
2054
- // incorrect for RTL.
2055
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2056
- }
2057
-
2058
- // Gets the entire size of the scrollable document area, even extending outside
2059
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
2060
- function getDocumentRect(element) {
2061
- const html = getDocumentElement(element);
2062
- const scroll = getNodeScroll(element);
2063
- const body = element.ownerDocument.body;
2064
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
2065
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
2066
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2067
- const y = -scroll.scrollTop;
2068
- if (getComputedStyle$1(body).direction === 'rtl') {
2069
- x += max(html.clientWidth, body.clientWidth) - width;
2070
- }
2071
- return {
2072
- width,
2073
- height,
2074
- x,
2075
- y
2076
- };
2077
- }
2078
-
2079
- function getParentNode(node) {
2080
- if (getNodeName(node) === 'html') {
2081
- return node;
2082
- }
2083
- const result =
2084
- // Step into the shadow DOM of the parent of a slotted node.
2085
- node.assignedSlot ||
2086
- // DOM Element detected.
2087
- node.parentNode ||
2088
- // ShadowRoot detected.
2089
- isShadowRoot(node) && node.host ||
2090
- // Fallback.
2091
- getDocumentElement(node);
2092
- return isShadowRoot(result) ? result.host : result;
2093
- }
2094
-
2095
- function getNearestOverflowAncestor(node) {
2096
- const parentNode = getParentNode(node);
2097
- if (isLastTraversableNode(parentNode)) {
2098
- // `getParentNode` will never return a `Document` due to the fallback
2099
- // check, so it's either the <html> or <body> element.
2100
- return parentNode.ownerDocument.body;
2101
- }
2102
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2103
- return parentNode;
2104
- }
2105
- return getNearestOverflowAncestor(parentNode);
2106
- }
2107
-
2108
- function getOverflowAncestors(node, list) {
2109
- var _node$ownerDocument;
2110
- if (list === void 0) {
2111
- list = [];
2112
- }
2113
- const scrollableAncestor = getNearestOverflowAncestor(node);
2114
- const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
2115
- const win = getWindow(scrollableAncestor);
2116
- if (isBody) {
2117
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
2118
- }
2119
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));
2120
- }
2121
-
2122
- function getViewportRect(element, strategy) {
2123
- const win = getWindow(element);
2124
- const html = getDocumentElement(element);
2125
- const visualViewport = win.visualViewport;
2126
- let width = html.clientWidth;
2127
- let height = html.clientHeight;
2128
- let x = 0;
2129
- let y = 0;
2130
- if (visualViewport) {
2131
- width = visualViewport.width;
2132
- height = visualViewport.height;
2133
- const visualViewportBased = isClientRectVisualViewportBased();
2134
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
2135
- x = visualViewport.offsetLeft;
2136
- y = visualViewport.offsetTop;
2137
- }
2138
- }
2139
- return {
2140
- width,
2141
- height,
2142
- x,
2143
- y
2144
- };
2145
- }
2146
-
2147
- // Returns the inner client rect, subtracting scrollbars if present.
2148
- function getInnerBoundingClientRect(element, strategy) {
2149
- const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
2150
- const top = clientRect.top + element.clientTop;
2151
- const left = clientRect.left + element.clientLeft;
2152
- const scale = isHTMLElement(element) ? getScale(element) : {
2153
- x: 1,
2154
- y: 1
2155
- };
2156
- const width = element.clientWidth * scale.x;
2157
- const height = element.clientHeight * scale.y;
2158
- const x = left * scale.x;
2159
- const y = top * scale.y;
2160
- return {
2161
- width,
2162
- height,
2163
- x,
2164
- y
2165
- };
2166
- }
2167
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2168
- let rect;
2169
- if (clippingAncestor === 'viewport') {
2170
- rect = getViewportRect(element, strategy);
2171
- } else if (clippingAncestor === 'document') {
2172
- rect = getDocumentRect(getDocumentElement(element));
2173
- } else if (isElement(clippingAncestor)) {
2174
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
2175
- } else {
2176
- const mutableRect = {
2177
- ...clippingAncestor
2178
- };
2179
- if (isClientRectVisualViewportBased()) {
2180
- var _win$visualViewport, _win$visualViewport2;
2181
- const win = getWindow(element);
2182
- mutableRect.x -= ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0;
2183
- mutableRect.y -= ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0;
2184
- }
2185
- rect = mutableRect;
2186
- }
2187
- return rectToClientRect(rect);
2188
- }
2189
-
2190
- // A "clipping ancestor" is an `overflow` element with the characteristic of
2191
- // clipping (or hiding) child elements. This returns all clipping ancestors
2192
- // of the given element up the tree.
2193
- function getClippingElementAncestors(element, cache) {
2194
- const cachedResult = cache.get(element);
2195
- if (cachedResult) {
2196
- return cachedResult;
2197
- }
2198
- let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
2199
- let currentContainingBlockComputedStyle = null;
2200
- const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
2201
- let currentNode = elementIsFixed ? getParentNode(element) : element;
2202
-
2203
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2204
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2205
- const computedStyle = getComputedStyle$1(currentNode);
2206
- const containingBlock = isContainingBlock(currentNode);
2207
- const shouldIgnoreCurrentNode = computedStyle.position === 'fixed';
2208
- if (shouldIgnoreCurrentNode) {
2209
- currentContainingBlockComputedStyle = null;
2210
- } else {
2211
- const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position);
2212
- if (shouldDropCurrentNode) {
2213
- // Drop non-containing blocks.
2214
- result = result.filter(ancestor => ancestor !== currentNode);
2215
- } else {
2216
- // Record last containing block for next iteration.
2217
- currentContainingBlockComputedStyle = computedStyle;
2218
- }
2219
- }
2220
- currentNode = getParentNode(currentNode);
2221
- }
2222
- cache.set(element, result);
2223
- return result;
2224
- }
2225
-
2226
- // Gets the maximum area that the element is visible in due to any number of
2227
- // clipping ancestors.
2228
- function getClippingRect(_ref) {
2229
- let {
2230
- element,
2231
- boundary,
2232
- rootBoundary,
2233
- strategy
2234
- } = _ref;
2235
- const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
2236
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2237
- const firstClippingAncestor = clippingAncestors[0];
2238
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2239
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2240
- accRect.top = max(rect.top, accRect.top);
2241
- accRect.right = min(rect.right, accRect.right);
2242
- accRect.bottom = min(rect.bottom, accRect.bottom);
2243
- accRect.left = max(rect.left, accRect.left);
2244
- return accRect;
2245
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2246
- return {
2247
- width: clippingRect.right - clippingRect.left,
2248
- height: clippingRect.bottom - clippingRect.top,
2249
- x: clippingRect.left,
2250
- y: clippingRect.top
2251
- };
2252
- }
2253
-
2254
- function getDimensions(element) {
2255
- if (isHTMLElement(element)) {
2256
- return getCssDimensions(element);
2257
- }
2258
- return element.getBoundingClientRect();
2259
- }
2260
-
2261
- function getTrueOffsetParent(element, polyfill) {
2262
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
2263
- return null;
2264
- }
2265
- if (polyfill) {
2266
- return polyfill(element);
2267
- }
2268
- return element.offsetParent;
2269
- }
2270
- function getContainingBlock(element) {
2271
- let currentNode = getParentNode(element);
2272
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2273
- if (isContainingBlock(currentNode)) {
2274
- return currentNode;
2275
- } else {
2276
- currentNode = getParentNode(currentNode);
2277
- }
2278
- }
2279
- return null;
2280
- }
2281
-
2282
- // Gets the closest ancestor positioned element. Handles some edge cases,
2283
- // such as table ancestors and cross browser bugs.
2284
- function getOffsetParent(element, polyfill) {
2285
- const window = getWindow(element);
2286
- if (!isHTMLElement(element)) {
2287
- return window;
2288
- }
2289
- let offsetParent = getTrueOffsetParent(element, polyfill);
2290
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
2291
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2292
- }
2293
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
2294
- return window;
2295
- }
2296
- return offsetParent || getContainingBlock(element) || window;
2297
- }
2298
-
2299
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2300
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
2301
- const documentElement = getDocumentElement(offsetParent);
2302
- const rect = getBoundingClientRect(element, true, strategy === 'fixed', offsetParent);
2303
- let scroll = {
2304
- scrollLeft: 0,
2305
- scrollTop: 0
2306
- };
2307
- const offsets = {
2308
- x: 0,
2309
- y: 0
2310
- };
2311
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
2312
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2313
- scroll = getNodeScroll(offsetParent);
2314
- }
2315
- if (isHTMLElement(offsetParent)) {
2316
- const offsetRect = getBoundingClientRect(offsetParent, true);
2317
- offsets.x = offsetRect.x + offsetParent.clientLeft;
2318
- offsets.y = offsetRect.y + offsetParent.clientTop;
2319
- } else if (documentElement) {
2320
- offsets.x = getWindowScrollBarX(documentElement);
2321
- }
2322
- }
2323
- return {
2324
- x: rect.left + scroll.scrollLeft - offsets.x,
2325
- y: rect.top + scroll.scrollTop - offsets.y,
2326
- width: rect.width,
2327
- height: rect.height
2328
- };
2329
- }
2330
-
2331
- const platform = {
2332
- getClippingRect,
2333
- convertOffsetParentRelativeRectToViewportRelativeRect,
2334
- isElement,
2335
- getDimensions,
2336
- getOffsetParent,
2337
- getDocumentElement,
2338
- getScale,
2339
- async getElementRects(_ref) {
2340
- let {
2341
- reference,
2342
- floating,
2343
- strategy
2344
- } = _ref;
2345
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2346
- const getDimensionsFn = this.getDimensions;
2347
- return {
2348
- reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
2349
- floating: {
2350
- x: 0,
2351
- y: 0,
2352
- ...(await getDimensionsFn(floating))
2353
- }
2354
- };
2355
- },
2356
- getClientRects: element => Array.from(element.getClientRects()),
2357
- isRTL: element => getComputedStyle$1(element).direction === 'rtl'
2358
- };
2359
-
2360
- /**
2361
- * Computes the `x` and `y` coordinates that will place the floating element
2362
- * next to a reference element when it is given a certain CSS positioning
2363
- * strategy.
2364
- */
2365
- const computePosition = (reference, floating, options) => {
2366
- // This caches the expensive `getClippingElementAncestors` function so that
2367
- // multiple lifecycle resets re-use the same result. It only lives for a
2368
- // single call. If other functions become expensive, we can add them as well.
2369
- const cache = new Map();
2370
- const mergedOptions = {
2371
- platform,
2372
- ...options
2373
- };
2374
- const platformWithCache = {
2375
- ...mergedOptions.platform,
2376
- _c: cache
2377
- };
2378
- return computePosition$1(reference, floating, {
2379
- ...mergedOptions,
2380
- platform: platformWithCache
2381
- });
2382
- };
2383
-
2384
129
  const computeTooltipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })], }) => {
2385
130
  if (!elementReference) {
2386
131
  // elementReference can be null or undefined and we will not compute the position
@@ -2872,11 +617,11 @@ content, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
2872
617
  }
2873
618
  }, [id, anchorSelect]);
2874
619
  const canShow = content && show && Object.keys(inlineStyles).length > 0;
2875
- return rendered ? (jsxRuntime.exports.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, `react-tooltip__place-${actualPlacement}`, {
620
+ return rendered ? (jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, `react-tooltip__place-${actualPlacement}`, {
2876
621
  [styles['show']]: canShow,
2877
622
  [styles['fixed']]: positionStrategy === 'fixed',
2878
623
  [styles['clickable']]: clickable,
2879
- }), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [content, jsxRuntime.exports.jsx(WrapperElement, { className: classNames('react-tooltip-arrow', styles['arrow'], classNameArrow, {
624
+ }), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [content, jsx(WrapperElement, { className: classNames('react-tooltip-arrow', styles['arrow'], classNameArrow, {
2880
625
  /**
2881
626
  * changed from dash `no-arrow` to camelcase because of:
2882
627
  * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42
@@ -2886,7 +631,7 @@ content, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
2886
631
  };
2887
632
 
2888
633
  const TooltipContent = ({ content }) => {
2889
- return jsxRuntime.exports.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
634
+ return jsx("span", { dangerouslySetInnerHTML: { __html: content } });
2890
635
  };
2891
636
 
2892
637
  const TooltipController = ({ id, anchorId, anchorSelect, content, html, render, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
@@ -3045,7 +790,7 @@ const TooltipController = ({ id, anchorId, anchorSelect, content, html, render,
3045
790
  renderedContent = tooltipContent;
3046
791
  }
3047
792
  if (tooltipHtml) {
3048
- renderedContent = jsxRuntime.exports.jsx(TooltipContent, { content: tooltipHtml });
793
+ renderedContent = jsx(TooltipContent, { content: tooltipHtml });
3049
794
  }
3050
795
  const props = {
3051
796
  id,
@@ -3077,7 +822,7 @@ const TooltipController = ({ id, anchorId, anchorSelect, content, html, render,
3077
822
  activeAnchor,
3078
823
  setActiveAnchor: (anchor) => setActiveAnchor(anchor),
3079
824
  };
3080
- return jsxRuntime.exports.jsx(Tooltip, { ...props });
825
+ return jsx(Tooltip, { ...props });
3081
826
  };
3082
827
 
3083
828
  export { TooltipController as Tooltip, TooltipProvider, TooltipWrapper };