react-tooltip 5.8.2-beta.2 → 5.8.2-beta.4
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 +77 -988
- package/dist/react-tooltip.cjs.min.js +2 -11
- package/dist/react-tooltip.esm.js +30 -937
- package/dist/react-tooltip.esm.min.js +2 -11
- package/dist/react-tooltip.umd.js +79 -991
- package/dist/react-tooltip.umd.min.js +2 -11
- package/package.json +2 -1
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
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);
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react = require('react');
|
|
10
7
|
|
|
11
8
|
function getAlignment(placement) {
|
|
12
9
|
return placement.split('-')[1];
|
|
@@ -1517,926 +1514,6 @@ const computePosition = (reference, floating, options) => {
|
|
|
1517
1514
|
});
|
|
1518
1515
|
};
|
|
1519
1516
|
|
|
1520
|
-
var jsxRuntime = {exports: {}};
|
|
1521
|
-
|
|
1522
|
-
var reactJsxRuntime_development = {};
|
|
1523
|
-
|
|
1524
|
-
/** @license React v16.14.0
|
|
1525
|
-
* react-jsx-runtime.development.js
|
|
1526
|
-
*
|
|
1527
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1528
|
-
*
|
|
1529
|
-
* This source code is licensed under the MIT license found in the
|
|
1530
|
-
* LICENSE file in the root directory of this source tree.
|
|
1531
|
-
*/
|
|
1532
|
-
|
|
1533
|
-
(function (exports) {
|
|
1534
|
-
|
|
1535
|
-
{
|
|
1536
|
-
(function() {
|
|
1537
|
-
|
|
1538
|
-
var React = require$$0__default["default"];
|
|
1539
|
-
|
|
1540
|
-
// ATTENTION
|
|
1541
|
-
// When adding new symbols to this file,
|
|
1542
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
1543
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
1544
|
-
// nor polyfill, then a plain number is used for performance.
|
|
1545
|
-
var REACT_ELEMENT_TYPE = 0xeac7;
|
|
1546
|
-
var REACT_PORTAL_TYPE = 0xeaca;
|
|
1547
|
-
exports.Fragment = 0xeacb;
|
|
1548
|
-
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
|
1549
|
-
var REACT_PROFILER_TYPE = 0xead2;
|
|
1550
|
-
var REACT_PROVIDER_TYPE = 0xeacd;
|
|
1551
|
-
var REACT_CONTEXT_TYPE = 0xeace;
|
|
1552
|
-
var REACT_FORWARD_REF_TYPE = 0xead0;
|
|
1553
|
-
var REACT_SUSPENSE_TYPE = 0xead1;
|
|
1554
|
-
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
|
1555
|
-
var REACT_MEMO_TYPE = 0xead3;
|
|
1556
|
-
var REACT_LAZY_TYPE = 0xead4;
|
|
1557
|
-
var REACT_BLOCK_TYPE = 0xead9;
|
|
1558
|
-
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
|
1559
|
-
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
|
1560
|
-
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
|
1561
|
-
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
|
1562
|
-
|
|
1563
|
-
if (typeof Symbol === 'function' && Symbol.for) {
|
|
1564
|
-
var symbolFor = Symbol.for;
|
|
1565
|
-
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
|
1566
|
-
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
|
1567
|
-
exports.Fragment = symbolFor('react.fragment');
|
|
1568
|
-
REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
|
|
1569
|
-
REACT_PROFILER_TYPE = symbolFor('react.profiler');
|
|
1570
|
-
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
|
1571
|
-
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
|
1572
|
-
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
|
1573
|
-
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
|
1574
|
-
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
|
1575
|
-
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
1576
|
-
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
1577
|
-
REACT_BLOCK_TYPE = symbolFor('react.block');
|
|
1578
|
-
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
|
1579
|
-
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
|
1580
|
-
symbolFor('react.scope');
|
|
1581
|
-
symbolFor('react.opaque.id');
|
|
1582
|
-
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
|
1583
|
-
symbolFor('react.offscreen');
|
|
1584
|
-
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
1588
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
1589
|
-
function getIteratorFn(maybeIterable) {
|
|
1590
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
1591
|
-
return null;
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
1595
|
-
|
|
1596
|
-
if (typeof maybeIterator === 'function') {
|
|
1597
|
-
return maybeIterator;
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
return null;
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1604
|
-
|
|
1605
|
-
function error(format) {
|
|
1606
|
-
{
|
|
1607
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1608
|
-
args[_key2 - 1] = arguments[_key2];
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
printWarning('error', format, args);
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
function printWarning(level, format, args) {
|
|
1616
|
-
// When changing this logic, you might want to also
|
|
1617
|
-
// update consoleWithStackDev.www.js as well.
|
|
1618
|
-
{
|
|
1619
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1620
|
-
var stack = '';
|
|
1621
|
-
|
|
1622
|
-
if (currentlyValidatingElement) {
|
|
1623
|
-
var name = getComponentName(currentlyValidatingElement.type);
|
|
1624
|
-
var owner = currentlyValidatingElement._owner;
|
|
1625
|
-
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
stack += ReactDebugCurrentFrame.getStackAddendum();
|
|
1629
|
-
|
|
1630
|
-
if (stack !== '') {
|
|
1631
|
-
format += '%s';
|
|
1632
|
-
args = args.concat([stack]);
|
|
1633
|
-
}
|
|
1634
|
-
|
|
1635
|
-
var argsWithFormat = args.map(function (item) {
|
|
1636
|
-
return '' + item;
|
|
1637
|
-
}); // Careful: RN currently depends on this prefix
|
|
1638
|
-
|
|
1639
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
1640
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
1641
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
1642
|
-
|
|
1643
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
1644
|
-
}
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
1648
|
-
|
|
1649
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
1650
|
-
|
|
1651
|
-
function isValidElementType(type) {
|
|
1652
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
1653
|
-
return true;
|
|
1654
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
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 ) {
|
|
1658
|
-
return true;
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
if (typeof type === 'object' && type !== null) {
|
|
1662
|
-
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) {
|
|
1663
|
-
return true;
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
return false;
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
1672
|
-
function describeComponentFrame (name, source, ownerName) {
|
|
1673
|
-
var sourceInfo = '';
|
|
1674
|
-
|
|
1675
|
-
if (source) {
|
|
1676
|
-
var path = source.fileName;
|
|
1677
|
-
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
1678
|
-
|
|
1679
|
-
{
|
|
1680
|
-
// In DEV, include code for a common special case:
|
|
1681
|
-
// prefer "folder/index.js" instead of just "index.js".
|
|
1682
|
-
if (/^index\./.test(fileName)) {
|
|
1683
|
-
var match = path.match(BEFORE_SLASH_RE);
|
|
1684
|
-
|
|
1685
|
-
if (match) {
|
|
1686
|
-
var pathBeforeSlash = match[1];
|
|
1687
|
-
|
|
1688
|
-
if (pathBeforeSlash) {
|
|
1689
|
-
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
1690
|
-
fileName = folderName + '/' + fileName;
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
1697
|
-
} else if (ownerName) {
|
|
1698
|
-
sourceInfo = ' (created by ' + ownerName + ')';
|
|
1699
|
-
}
|
|
1700
|
-
|
|
1701
|
-
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
1702
|
-
}
|
|
1703
|
-
|
|
1704
|
-
var Resolved = 1;
|
|
1705
|
-
function refineResolvedLazyComponent(lazyComponent) {
|
|
1706
|
-
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
1710
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
1711
|
-
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
1712
|
-
}
|
|
1713
|
-
|
|
1714
|
-
function getComponentName(type) {
|
|
1715
|
-
if (type == null) {
|
|
1716
|
-
// Host root, text node or just invalid type.
|
|
1717
|
-
return null;
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
{
|
|
1721
|
-
if (typeof type.tag === 'number') {
|
|
1722
|
-
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
if (typeof type === 'function') {
|
|
1727
|
-
return type.displayName || type.name || null;
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
if (typeof type === 'string') {
|
|
1731
|
-
return type;
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
switch (type) {
|
|
1735
|
-
case exports.Fragment:
|
|
1736
|
-
return 'Fragment';
|
|
1737
|
-
|
|
1738
|
-
case REACT_PORTAL_TYPE:
|
|
1739
|
-
return 'Portal';
|
|
1740
|
-
|
|
1741
|
-
case REACT_PROFILER_TYPE:
|
|
1742
|
-
return "Profiler";
|
|
1743
|
-
|
|
1744
|
-
case REACT_STRICT_MODE_TYPE:
|
|
1745
|
-
return 'StrictMode';
|
|
1746
|
-
|
|
1747
|
-
case REACT_SUSPENSE_TYPE:
|
|
1748
|
-
return 'Suspense';
|
|
1749
|
-
|
|
1750
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
1751
|
-
return 'SuspenseList';
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
if (typeof type === 'object') {
|
|
1755
|
-
switch (type.$$typeof) {
|
|
1756
|
-
case REACT_CONTEXT_TYPE:
|
|
1757
|
-
return 'Context.Consumer';
|
|
1758
|
-
|
|
1759
|
-
case REACT_PROVIDER_TYPE:
|
|
1760
|
-
return 'Context.Provider';
|
|
1761
|
-
|
|
1762
|
-
case REACT_FORWARD_REF_TYPE:
|
|
1763
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
1764
|
-
|
|
1765
|
-
case REACT_MEMO_TYPE:
|
|
1766
|
-
return getComponentName(type.type);
|
|
1767
|
-
|
|
1768
|
-
case REACT_BLOCK_TYPE:
|
|
1769
|
-
return getComponentName(type.render);
|
|
1770
|
-
|
|
1771
|
-
case REACT_LAZY_TYPE:
|
|
1772
|
-
{
|
|
1773
|
-
var thenable = type;
|
|
1774
|
-
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
1775
|
-
|
|
1776
|
-
if (resolvedThenable) {
|
|
1777
|
-
return getComponentName(resolvedThenable);
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
break;
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
return null;
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
var loggedTypeFailures = {};
|
|
1789
|
-
ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1790
|
-
var currentlyValidatingElement = null;
|
|
1791
|
-
|
|
1792
|
-
function setCurrentlyValidatingElement(element) {
|
|
1793
|
-
{
|
|
1794
|
-
currentlyValidatingElement = element;
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
1799
|
-
{
|
|
1800
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
1801
|
-
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
1802
|
-
|
|
1803
|
-
for (var typeSpecName in typeSpecs) {
|
|
1804
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
1805
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
1806
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
1807
|
-
// After these have been cleaned up, we'll let them throw.
|
|
1808
|
-
|
|
1809
|
-
try {
|
|
1810
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
1811
|
-
// behavior as without this statement except with a better message.
|
|
1812
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
1813
|
-
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`.');
|
|
1814
|
-
err.name = 'Invariant Violation';
|
|
1815
|
-
throw err;
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
1819
|
-
} catch (ex) {
|
|
1820
|
-
error$1 = ex;
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
1824
|
-
setCurrentlyValidatingElement(element);
|
|
1825
|
-
|
|
1826
|
-
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);
|
|
1827
|
-
|
|
1828
|
-
setCurrentlyValidatingElement(null);
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
1832
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
1833
|
-
// same error.
|
|
1834
|
-
loggedTypeFailures[error$1.message] = true;
|
|
1835
|
-
setCurrentlyValidatingElement(element);
|
|
1836
|
-
|
|
1837
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
1838
|
-
|
|
1839
|
-
setCurrentlyValidatingElement(null);
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1846
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
1847
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1848
|
-
var RESERVED_PROPS = {
|
|
1849
|
-
key: true,
|
|
1850
|
-
ref: true,
|
|
1851
|
-
__self: true,
|
|
1852
|
-
__source: true
|
|
1853
|
-
};
|
|
1854
|
-
var specialPropKeyWarningShown;
|
|
1855
|
-
var specialPropRefWarningShown;
|
|
1856
|
-
var didWarnAboutStringRefs;
|
|
1857
|
-
|
|
1858
|
-
{
|
|
1859
|
-
didWarnAboutStringRefs = {};
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
function hasValidRef(config) {
|
|
1863
|
-
{
|
|
1864
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
1865
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
1866
|
-
|
|
1867
|
-
if (getter && getter.isReactWarning) {
|
|
1868
|
-
return false;
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
return config.ref !== undefined;
|
|
1874
|
-
}
|
|
1875
|
-
|
|
1876
|
-
function hasValidKey(config) {
|
|
1877
|
-
{
|
|
1878
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
1879
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
1880
|
-
|
|
1881
|
-
if (getter && getter.isReactWarning) {
|
|
1882
|
-
return false;
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
return config.key !== undefined;
|
|
1888
|
-
}
|
|
1889
|
-
|
|
1890
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
1891
|
-
{
|
|
1892
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
1893
|
-
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
1894
|
-
|
|
1895
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
1896
|
-
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);
|
|
1897
|
-
|
|
1898
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
1899
|
-
}
|
|
1900
|
-
}
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
1905
|
-
{
|
|
1906
|
-
var warnAboutAccessingKey = function () {
|
|
1907
|
-
if (!specialPropKeyWarningShown) {
|
|
1908
|
-
specialPropKeyWarningShown = true;
|
|
1909
|
-
|
|
1910
|
-
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);
|
|
1911
|
-
}
|
|
1912
|
-
};
|
|
1913
|
-
|
|
1914
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
1915
|
-
Object.defineProperty(props, 'key', {
|
|
1916
|
-
get: warnAboutAccessingKey,
|
|
1917
|
-
configurable: true
|
|
1918
|
-
});
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
1923
|
-
{
|
|
1924
|
-
var warnAboutAccessingRef = function () {
|
|
1925
|
-
if (!specialPropRefWarningShown) {
|
|
1926
|
-
specialPropRefWarningShown = true;
|
|
1927
|
-
|
|
1928
|
-
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);
|
|
1929
|
-
}
|
|
1930
|
-
};
|
|
1931
|
-
|
|
1932
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
1933
|
-
Object.defineProperty(props, 'ref', {
|
|
1934
|
-
get: warnAboutAccessingRef,
|
|
1935
|
-
configurable: true
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
/**
|
|
1940
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
1941
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
1942
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
1943
|
-
* if something is a React Element.
|
|
1944
|
-
*
|
|
1945
|
-
* @param {*} type
|
|
1946
|
-
* @param {*} props
|
|
1947
|
-
* @param {*} key
|
|
1948
|
-
* @param {string|object} ref
|
|
1949
|
-
* @param {*} owner
|
|
1950
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
1951
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
1952
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
1953
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
1954
|
-
* change in behavior.
|
|
1955
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
1956
|
-
* indicating filename, line number, and/or other information.
|
|
1957
|
-
* @internal
|
|
1958
|
-
*/
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
1962
|
-
var element = {
|
|
1963
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
1964
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
1965
|
-
// Built-in properties that belong on the element
|
|
1966
|
-
type: type,
|
|
1967
|
-
key: key,
|
|
1968
|
-
ref: ref,
|
|
1969
|
-
props: props,
|
|
1970
|
-
// Record the component responsible for creating this element.
|
|
1971
|
-
_owner: owner
|
|
1972
|
-
};
|
|
1973
|
-
|
|
1974
|
-
{
|
|
1975
|
-
// The validation flag is currently mutative. We put it on
|
|
1976
|
-
// an external backing store so that we can freeze the whole object.
|
|
1977
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
1978
|
-
// commonly used development environments.
|
|
1979
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
1980
|
-
// the validation flag non-enumerable (where possible, which should
|
|
1981
|
-
// include every environment we run tests in), so the test framework
|
|
1982
|
-
// ignores it.
|
|
1983
|
-
|
|
1984
|
-
Object.defineProperty(element._store, 'validated', {
|
|
1985
|
-
configurable: false,
|
|
1986
|
-
enumerable: false,
|
|
1987
|
-
writable: true,
|
|
1988
|
-
value: false
|
|
1989
|
-
}); // self and source are DEV only properties.
|
|
1990
|
-
|
|
1991
|
-
Object.defineProperty(element, '_self', {
|
|
1992
|
-
configurable: false,
|
|
1993
|
-
enumerable: false,
|
|
1994
|
-
writable: false,
|
|
1995
|
-
value: self
|
|
1996
|
-
}); // Two elements created in two different places should be considered
|
|
1997
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
1998
|
-
|
|
1999
|
-
Object.defineProperty(element, '_source', {
|
|
2000
|
-
configurable: false,
|
|
2001
|
-
enumerable: false,
|
|
2002
|
-
writable: false,
|
|
2003
|
-
value: source
|
|
2004
|
-
});
|
|
2005
|
-
|
|
2006
|
-
if (Object.freeze) {
|
|
2007
|
-
Object.freeze(element.props);
|
|
2008
|
-
Object.freeze(element);
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
return element;
|
|
2013
|
-
};
|
|
2014
|
-
/**
|
|
2015
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
2016
|
-
* @param {*} type
|
|
2017
|
-
* @param {object} props
|
|
2018
|
-
* @param {string} key
|
|
2019
|
-
*/
|
|
2020
|
-
|
|
2021
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
2022
|
-
{
|
|
2023
|
-
var propName; // Reserved names are extracted
|
|
2024
|
-
|
|
2025
|
-
var props = {};
|
|
2026
|
-
var key = null;
|
|
2027
|
-
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
2028
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
2029
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
2030
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
2031
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
2032
|
-
// key is explicitly declared to be undefined or not.
|
|
2033
|
-
|
|
2034
|
-
if (maybeKey !== undefined) {
|
|
2035
|
-
key = '' + maybeKey;
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
|
-
if (hasValidKey(config)) {
|
|
2039
|
-
key = '' + config.key;
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
if (hasValidRef(config)) {
|
|
2043
|
-
ref = config.ref;
|
|
2044
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
2045
|
-
} // Remaining properties are added to a new props object
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
for (propName in config) {
|
|
2049
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
2050
|
-
props[propName] = config[propName];
|
|
2051
|
-
}
|
|
2052
|
-
} // Resolve default props
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
if (type && type.defaultProps) {
|
|
2056
|
-
var defaultProps = type.defaultProps;
|
|
2057
|
-
|
|
2058
|
-
for (propName in defaultProps) {
|
|
2059
|
-
if (props[propName] === undefined) {
|
|
2060
|
-
props[propName] = defaultProps[propName];
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
if (key || ref) {
|
|
2066
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
2067
|
-
|
|
2068
|
-
if (key) {
|
|
2069
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
2070
|
-
}
|
|
2071
|
-
|
|
2072
|
-
if (ref) {
|
|
2073
|
-
defineRefPropWarningGetter(props, displayName);
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
2078
|
-
}
|
|
2079
|
-
}
|
|
2080
|
-
|
|
2081
|
-
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
2082
|
-
ReactSharedInternals.ReactDebugCurrentFrame;
|
|
2083
|
-
|
|
2084
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
2085
|
-
currentlyValidatingElement = element;
|
|
2086
|
-
}
|
|
2087
|
-
|
|
2088
|
-
var propTypesMisspellWarningShown;
|
|
2089
|
-
|
|
2090
|
-
{
|
|
2091
|
-
propTypesMisspellWarningShown = false;
|
|
2092
|
-
}
|
|
2093
|
-
/**
|
|
2094
|
-
* Verifies the object is a ReactElement.
|
|
2095
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
2096
|
-
* @param {?object} object
|
|
2097
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
2098
|
-
* @final
|
|
2099
|
-
*/
|
|
2100
|
-
|
|
2101
|
-
function isValidElement(object) {
|
|
2102
|
-
{
|
|
2103
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
|
|
2107
|
-
function getDeclarationErrorAddendum() {
|
|
2108
|
-
{
|
|
2109
|
-
if (ReactCurrentOwner$1.current) {
|
|
2110
|
-
var name = getComponentName(ReactCurrentOwner$1.current.type);
|
|
2111
|
-
|
|
2112
|
-
if (name) {
|
|
2113
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
2114
|
-
}
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
return '';
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
|
-
function getSourceInfoErrorAddendum(source) {
|
|
2122
|
-
{
|
|
2123
|
-
if (source !== undefined) {
|
|
2124
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
2125
|
-
var lineNumber = source.lineNumber;
|
|
2126
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
return '';
|
|
2130
|
-
}
|
|
2131
|
-
}
|
|
2132
|
-
/**
|
|
2133
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
2134
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
2135
|
-
* updates.
|
|
2136
|
-
*/
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
var ownerHasKeyUseWarning = {};
|
|
2140
|
-
|
|
2141
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
2142
|
-
{
|
|
2143
|
-
var info = getDeclarationErrorAddendum();
|
|
2144
|
-
|
|
2145
|
-
if (!info) {
|
|
2146
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
2147
|
-
|
|
2148
|
-
if (parentName) {
|
|
2149
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
|
|
2153
|
-
return info;
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
/**
|
|
2157
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
2158
|
-
* This element is in an array. The array could grow and shrink or be
|
|
2159
|
-
* reordered. All children that haven't already been validated are required to
|
|
2160
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
2161
|
-
* will only be shown once.
|
|
2162
|
-
*
|
|
2163
|
-
* @internal
|
|
2164
|
-
* @param {ReactElement} element Element that requires a key.
|
|
2165
|
-
* @param {*} parentType element's parent's type.
|
|
2166
|
-
*/
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
function validateExplicitKey(element, parentType) {
|
|
2170
|
-
{
|
|
2171
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
2172
|
-
return;
|
|
2173
|
-
}
|
|
2174
|
-
|
|
2175
|
-
element._store.validated = true;
|
|
2176
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2177
|
-
|
|
2178
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2179
|
-
return;
|
|
2180
|
-
}
|
|
2181
|
-
|
|
2182
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
2183
|
-
// property, it may be the creator of the child that's responsible for
|
|
2184
|
-
// assigning it a key.
|
|
2185
|
-
|
|
2186
|
-
var childOwner = '';
|
|
2187
|
-
|
|
2188
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
2189
|
-
// Give the component that originally created this child.
|
|
2190
|
-
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
setCurrentlyValidatingElement$1(element);
|
|
2194
|
-
|
|
2195
|
-
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);
|
|
2196
|
-
|
|
2197
|
-
setCurrentlyValidatingElement$1(null);
|
|
2198
|
-
}
|
|
2199
|
-
}
|
|
2200
|
-
/**
|
|
2201
|
-
* Ensure that every element either is passed in a static location, in an
|
|
2202
|
-
* array with an explicit keys property defined, or in an object literal
|
|
2203
|
-
* with valid key property.
|
|
2204
|
-
*
|
|
2205
|
-
* @internal
|
|
2206
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
2207
|
-
* @param {*} parentType node's parent's type.
|
|
2208
|
-
*/
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
function validateChildKeys(node, parentType) {
|
|
2212
|
-
{
|
|
2213
|
-
if (typeof node !== 'object') {
|
|
2214
|
-
return;
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
if (Array.isArray(node)) {
|
|
2218
|
-
for (var i = 0; i < node.length; i++) {
|
|
2219
|
-
var child = node[i];
|
|
2220
|
-
|
|
2221
|
-
if (isValidElement(child)) {
|
|
2222
|
-
validateExplicitKey(child, parentType);
|
|
2223
|
-
}
|
|
2224
|
-
}
|
|
2225
|
-
} else if (isValidElement(node)) {
|
|
2226
|
-
// This element was passed in a valid location.
|
|
2227
|
-
if (node._store) {
|
|
2228
|
-
node._store.validated = true;
|
|
2229
|
-
}
|
|
2230
|
-
} else if (node) {
|
|
2231
|
-
var iteratorFn = getIteratorFn(node);
|
|
2232
|
-
|
|
2233
|
-
if (typeof iteratorFn === 'function') {
|
|
2234
|
-
// Entry iterators used to provide implicit keys,
|
|
2235
|
-
// but now we print a separate warning for them later.
|
|
2236
|
-
if (iteratorFn !== node.entries) {
|
|
2237
|
-
var iterator = iteratorFn.call(node);
|
|
2238
|
-
var step;
|
|
2239
|
-
|
|
2240
|
-
while (!(step = iterator.next()).done) {
|
|
2241
|
-
if (isValidElement(step.value)) {
|
|
2242
|
-
validateExplicitKey(step.value, parentType);
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
/**
|
|
2251
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
2252
|
-
* provided by the type.
|
|
2253
|
-
*
|
|
2254
|
-
* @param {ReactElement} element
|
|
2255
|
-
*/
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
function validatePropTypes(element) {
|
|
2259
|
-
{
|
|
2260
|
-
var type = element.type;
|
|
2261
|
-
|
|
2262
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
2263
|
-
return;
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2266
|
-
var propTypes;
|
|
2267
|
-
|
|
2268
|
-
if (typeof type === 'function') {
|
|
2269
|
-
propTypes = type.propTypes;
|
|
2270
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
2271
|
-
// Inner props are checked in the reconciler.
|
|
2272
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
2273
|
-
propTypes = type.propTypes;
|
|
2274
|
-
} else {
|
|
2275
|
-
return;
|
|
2276
|
-
}
|
|
2277
|
-
|
|
2278
|
-
if (propTypes) {
|
|
2279
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
2280
|
-
var name = getComponentName(type);
|
|
2281
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
2282
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2283
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
2284
|
-
|
|
2285
|
-
var _name = getComponentName(type);
|
|
2286
|
-
|
|
2287
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
2288
|
-
}
|
|
2289
|
-
|
|
2290
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2291
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2292
|
-
}
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
/**
|
|
2296
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
2297
|
-
* @param {ReactElement} fragment
|
|
2298
|
-
*/
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
function validateFragmentProps(fragment) {
|
|
2302
|
-
{
|
|
2303
|
-
var keys = Object.keys(fragment.props);
|
|
2304
|
-
|
|
2305
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2306
|
-
var key = keys[i];
|
|
2307
|
-
|
|
2308
|
-
if (key !== 'children' && key !== 'key') {
|
|
2309
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
2310
|
-
|
|
2311
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2312
|
-
|
|
2313
|
-
setCurrentlyValidatingElement$1(null);
|
|
2314
|
-
break;
|
|
2315
|
-
}
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
if (fragment.ref !== null) {
|
|
2319
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
2320
|
-
|
|
2321
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2322
|
-
|
|
2323
|
-
setCurrentlyValidatingElement$1(null);
|
|
2324
|
-
}
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
|
-
|
|
2328
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
2329
|
-
{
|
|
2330
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
2331
|
-
// succeed and there will likely be errors in render.
|
|
2332
|
-
|
|
2333
|
-
if (!validType) {
|
|
2334
|
-
var info = '';
|
|
2335
|
-
|
|
2336
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2337
|
-
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.";
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
|
-
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
2341
|
-
|
|
2342
|
-
if (sourceInfo) {
|
|
2343
|
-
info += sourceInfo;
|
|
2344
|
-
} else {
|
|
2345
|
-
info += getDeclarationErrorAddendum();
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
var typeString;
|
|
2349
|
-
|
|
2350
|
-
if (type === null) {
|
|
2351
|
-
typeString = 'null';
|
|
2352
|
-
} else if (Array.isArray(type)) {
|
|
2353
|
-
typeString = 'array';
|
|
2354
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2355
|
-
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
2356
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2357
|
-
} else {
|
|
2358
|
-
typeString = typeof type;
|
|
2359
|
-
}
|
|
2360
|
-
|
|
2361
|
-
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);
|
|
2362
|
-
}
|
|
2363
|
-
|
|
2364
|
-
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
2365
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2366
|
-
|
|
2367
|
-
if (element == null) {
|
|
2368
|
-
return element;
|
|
2369
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
2370
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2371
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
2372
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2373
|
-
// fixed, the key warnings will appear.)
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
if (validType) {
|
|
2377
|
-
var children = props.children;
|
|
2378
|
-
|
|
2379
|
-
if (children !== undefined) {
|
|
2380
|
-
if (isStaticChildren) {
|
|
2381
|
-
if (Array.isArray(children)) {
|
|
2382
|
-
for (var i = 0; i < children.length; i++) {
|
|
2383
|
-
validateChildKeys(children[i], type);
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
if (Object.freeze) {
|
|
2387
|
-
Object.freeze(children);
|
|
2388
|
-
}
|
|
2389
|
-
} else {
|
|
2390
|
-
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.');
|
|
2391
|
-
}
|
|
2392
|
-
} else {
|
|
2393
|
-
validateChildKeys(children, type);
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
|
|
2398
|
-
if (type === exports.Fragment) {
|
|
2399
|
-
validateFragmentProps(element);
|
|
2400
|
-
} else {
|
|
2401
|
-
validatePropTypes(element);
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
return element;
|
|
2405
|
-
}
|
|
2406
|
-
} // These two functions exist to still get child warnings in dev
|
|
2407
|
-
// even with the prod transform. This means that jsxDEV is purely
|
|
2408
|
-
// opt-in behavior for better messages but that we won't stop
|
|
2409
|
-
// giving you warnings if you use production apis.
|
|
2410
|
-
|
|
2411
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
2412
|
-
{
|
|
2413
|
-
return jsxWithValidation(type, props, key, true);
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
2417
|
-
{
|
|
2418
|
-
return jsxWithValidation(type, props, key, false);
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
2423
|
-
// for now we can ship identical prod functions
|
|
2424
|
-
|
|
2425
|
-
var jsxs = jsxWithValidationStatic ;
|
|
2426
|
-
|
|
2427
|
-
exports.jsx = jsx;
|
|
2428
|
-
exports.jsxs = jsxs;
|
|
2429
|
-
})();
|
|
2430
|
-
}
|
|
2431
|
-
} (reactJsxRuntime_development));
|
|
2432
|
-
|
|
2433
|
-
(function (module) {
|
|
2434
|
-
|
|
2435
|
-
{
|
|
2436
|
-
module.exports = reactJsxRuntime_development;
|
|
2437
|
-
}
|
|
2438
|
-
} (jsxRuntime));
|
|
2439
|
-
|
|
2440
1517
|
var classnames = {exports: {}};
|
|
2441
1518
|
|
|
2442
1519
|
/*!
|
|
@@ -2522,7 +1599,7 @@ const debounce = (func, wait, immediate) => {
|
|
|
2522
1599
|
};
|
|
2523
1600
|
|
|
2524
1601
|
const TooltipContent = ({ content }) => {
|
|
2525
|
-
return jsxRuntime.
|
|
1602
|
+
return jsxRuntime.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
2526
1603
|
};
|
|
2527
1604
|
|
|
2528
1605
|
const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
|
|
@@ -2542,16 +1619,16 @@ const DEFAULT_CONTEXT_DATA = {
|
|
|
2542
1619
|
const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
2543
1620
|
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
2544
1621
|
};
|
|
2545
|
-
const TooltipContext =
|
|
1622
|
+
const TooltipContext = react.createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
2546
1623
|
/**
|
|
2547
1624
|
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
2548
1625
|
* See https://react-tooltip.com/docs/getting-started
|
|
2549
1626
|
*/
|
|
2550
1627
|
const TooltipProvider = ({ children }) => {
|
|
2551
|
-
const [anchorRefMap, setAnchorRefMap] =
|
|
1628
|
+
const [anchorRefMap, setAnchorRefMap] = react.useState({
|
|
2552
1629
|
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
2553
1630
|
});
|
|
2554
|
-
const [activeAnchorMap, setActiveAnchorMap] =
|
|
1631
|
+
const [activeAnchorMap, setActiveAnchorMap] = react.useState({
|
|
2555
1632
|
[DEFAULT_TOOLTIP_ID]: { current: null },
|
|
2556
1633
|
});
|
|
2557
1634
|
const attach = (tooltipId, ...refs) => {
|
|
@@ -2586,7 +1663,7 @@ const TooltipProvider = ({ children }) => {
|
|
|
2586
1663
|
return { ...oldMap, [tooltipId]: ref };
|
|
2587
1664
|
});
|
|
2588
1665
|
};
|
|
2589
|
-
const getTooltipData =
|
|
1666
|
+
const getTooltipData = react.useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
|
|
2590
1667
|
var _a, _b;
|
|
2591
1668
|
return ({
|
|
2592
1669
|
anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
|
|
@@ -2596,15 +1673,15 @@ const TooltipProvider = ({ children }) => {
|
|
|
2596
1673
|
setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
|
|
2597
1674
|
});
|
|
2598
1675
|
}, [anchorRefMap, activeAnchorMap, attach, detach]);
|
|
2599
|
-
const context =
|
|
1676
|
+
const context = react.useMemo(() => {
|
|
2600
1677
|
return {
|
|
2601
1678
|
getTooltipData,
|
|
2602
1679
|
};
|
|
2603
1680
|
}, [getTooltipData]);
|
|
2604
|
-
return jsxRuntime.
|
|
1681
|
+
return jsxRuntime.jsx(TooltipContext.Provider, { value: context, children: children });
|
|
2605
1682
|
};
|
|
2606
1683
|
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
2607
|
-
return
|
|
1684
|
+
return react.useContext(TooltipContext).getTooltipData(tooltipId);
|
|
2608
1685
|
}
|
|
2609
1686
|
|
|
2610
1687
|
/**
|
|
@@ -2613,14 +1690,14 @@ function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
|
2613
1690
|
*/
|
|
2614
1691
|
const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
|
|
2615
1692
|
const { attach, detach } = useTooltip(tooltipId);
|
|
2616
|
-
const anchorRef =
|
|
2617
|
-
|
|
1693
|
+
const anchorRef = react.useRef(null);
|
|
1694
|
+
react.useEffect(() => {
|
|
2618
1695
|
attach(anchorRef);
|
|
2619
1696
|
return () => {
|
|
2620
1697
|
detach(anchorRef);
|
|
2621
1698
|
};
|
|
2622
1699
|
}, []);
|
|
2623
|
-
return (jsxRuntime.
|
|
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 }));
|
|
2624
1701
|
};
|
|
2625
1702
|
|
|
2626
1703
|
const computeTooltipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })], }) => {
|
|
@@ -2677,35 +1754,35 @@ const Tooltip = ({
|
|
|
2677
1754
|
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,
|
|
2678
1755
|
// props handled by controller
|
|
2679
1756
|
content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
2680
|
-
const tooltipRef =
|
|
2681
|
-
const tooltipArrowRef =
|
|
2682
|
-
const tooltipShowDelayTimerRef =
|
|
2683
|
-
const tooltipHideDelayTimerRef =
|
|
2684
|
-
const [inlineStyles, setInlineStyles] =
|
|
2685
|
-
const [inlineArrowStyles, setInlineArrowStyles] =
|
|
2686
|
-
const [show, setShow] =
|
|
2687
|
-
const [rendered, setRendered] =
|
|
2688
|
-
const wasShowing =
|
|
2689
|
-
const lastFloatPosition =
|
|
1757
|
+
const tooltipRef = react.useRef(null);
|
|
1758
|
+
const tooltipArrowRef = react.useRef(null);
|
|
1759
|
+
const tooltipShowDelayTimerRef = react.useRef(null);
|
|
1760
|
+
const tooltipHideDelayTimerRef = react.useRef(null);
|
|
1761
|
+
const [inlineStyles, setInlineStyles] = react.useState({});
|
|
1762
|
+
const [inlineArrowStyles, setInlineArrowStyles] = react.useState({});
|
|
1763
|
+
const [show, setShow] = react.useState(false);
|
|
1764
|
+
const [rendered, setRendered] = react.useState(false);
|
|
1765
|
+
const wasShowing = react.useRef(false);
|
|
1766
|
+
const lastFloatPosition = react.useRef(null);
|
|
2690
1767
|
/**
|
|
2691
1768
|
* @todo Remove this in a future version (provider/wrapper method is deprecated)
|
|
2692
1769
|
*/
|
|
2693
1770
|
const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id);
|
|
2694
|
-
const hoveringTooltip =
|
|
2695
|
-
const [anchorsBySelect, setAnchorsBySelect] =
|
|
2696
|
-
const mounted =
|
|
1771
|
+
const hoveringTooltip = react.useRef(false);
|
|
1772
|
+
const [anchorsBySelect, setAnchorsBySelect] = react.useState([]);
|
|
1773
|
+
const mounted = react.useRef(false);
|
|
2697
1774
|
/**
|
|
2698
1775
|
* useLayoutEffect runs before useEffect,
|
|
2699
1776
|
* but should be used carefully because of caveats
|
|
2700
1777
|
* https://beta.reactjs.org/reference/react/useLayoutEffect#caveats
|
|
2701
1778
|
*/
|
|
2702
|
-
|
|
1779
|
+
react.useLayoutEffect(() => {
|
|
2703
1780
|
mounted.current = true;
|
|
2704
1781
|
return () => {
|
|
2705
1782
|
mounted.current = false;
|
|
2706
1783
|
};
|
|
2707
1784
|
}, []);
|
|
2708
|
-
|
|
1785
|
+
react.useEffect(() => {
|
|
2709
1786
|
if (!show) {
|
|
2710
1787
|
/**
|
|
2711
1788
|
* this fixes weird behavior when switching between two anchor elements very quickly
|
|
@@ -2747,7 +1824,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2747
1824
|
* this replicates the effect from `handleShow()`
|
|
2748
1825
|
* when `isOpen` is changed from outside
|
|
2749
1826
|
*/
|
|
2750
|
-
|
|
1827
|
+
react.useEffect(() => {
|
|
2751
1828
|
if (isOpen === undefined) {
|
|
2752
1829
|
return () => null;
|
|
2753
1830
|
}
|
|
@@ -2761,7 +1838,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2761
1838
|
clearTimeout(timeout);
|
|
2762
1839
|
};
|
|
2763
1840
|
}, [isOpen]);
|
|
2764
|
-
|
|
1841
|
+
react.useEffect(() => {
|
|
2765
1842
|
if (show === wasShowing.current) {
|
|
2766
1843
|
return;
|
|
2767
1844
|
}
|
|
@@ -2895,7 +1972,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2895
1972
|
// mouse enter and focus events being triggered toggether
|
|
2896
1973
|
const debouncedHandleShowTooltip = debounce(handleShowTooltip, 50);
|
|
2897
1974
|
const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50);
|
|
2898
|
-
|
|
1975
|
+
react.useEffect(() => {
|
|
2899
1976
|
var _a, _b;
|
|
2900
1977
|
const elementRefs = new Set(anchorRefs);
|
|
2901
1978
|
anchorsBySelect.forEach((anchor) => {
|
|
@@ -2963,13 +2040,20 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2963
2040
|
* since `tooltipRef` becomes stale after removing/adding the tooltip to the DOM
|
|
2964
2041
|
*/
|
|
2965
2042
|
}, [rendered, anchorRefs, anchorsBySelect, closeOnEsc, events]);
|
|
2966
|
-
|
|
2043
|
+
react.useEffect(() => {
|
|
2967
2044
|
let selector = anchorSelect !== null && anchorSelect !== void 0 ? anchorSelect : '';
|
|
2968
2045
|
if (!selector && id) {
|
|
2969
2046
|
selector = `[data-tooltip-id='${id}']`;
|
|
2970
2047
|
}
|
|
2971
2048
|
const documentObserverCallback = (mutationList) => {
|
|
2049
|
+
const newAnchors = [];
|
|
2972
2050
|
mutationList.forEach((mutation) => {
|
|
2051
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'data-tooltip-id') {
|
|
2052
|
+
const newId = mutation.target.getAttribute('data-tooltip-id');
|
|
2053
|
+
if (newId === id) {
|
|
2054
|
+
newAnchors.push(mutation.target);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2973
2057
|
if (mutation.type !== 'childList') {
|
|
2974
2058
|
return;
|
|
2975
2059
|
}
|
|
@@ -2989,15 +2073,12 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
2989
2073
|
}
|
|
2990
2074
|
try {
|
|
2991
2075
|
const elements = [...mutation.addedNodes].filter((node) => node.nodeType === 1);
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
];
|
|
2998
|
-
if (newAnchors.length) {
|
|
2999
|
-
setAnchorsBySelect((anchors) => [...anchors, ...newAnchors]);
|
|
3000
|
-
}
|
|
2076
|
+
newAnchors.push(
|
|
2077
|
+
// the element itself is an anchor
|
|
2078
|
+
...elements.filter((element) => element.matches(selector)));
|
|
2079
|
+
newAnchors.push(
|
|
2080
|
+
// the element has children which are anchors
|
|
2081
|
+
...elements.flatMap((element) => [...element.querySelectorAll(selector)]));
|
|
3001
2082
|
}
|
|
3002
2083
|
catch (_a) {
|
|
3003
2084
|
/**
|
|
@@ -3006,15 +2087,23 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
3006
2087
|
*/
|
|
3007
2088
|
}
|
|
3008
2089
|
});
|
|
2090
|
+
if (newAnchors.length) {
|
|
2091
|
+
setAnchorsBySelect((anchors) => [...anchors, ...newAnchors]);
|
|
2092
|
+
}
|
|
3009
2093
|
};
|
|
3010
2094
|
const documentObserver = new MutationObserver(documentObserverCallback);
|
|
3011
2095
|
// watch for anchor being removed from the DOM
|
|
3012
|
-
documentObserver.observe(document.body, {
|
|
2096
|
+
documentObserver.observe(document.body, {
|
|
2097
|
+
childList: true,
|
|
2098
|
+
subtree: true,
|
|
2099
|
+
attributes: true,
|
|
2100
|
+
attributeFilter: ['data-tooltip-id'],
|
|
2101
|
+
});
|
|
3013
2102
|
return () => {
|
|
3014
2103
|
documentObserver.disconnect();
|
|
3015
2104
|
};
|
|
3016
2105
|
}, [id, anchorSelect, activeAnchor]);
|
|
3017
|
-
|
|
2106
|
+
react.useEffect(() => {
|
|
3018
2107
|
if (position) {
|
|
3019
2108
|
// if `position` is set, override regular and `float` positioning
|
|
3020
2109
|
handleTooltipPosition(position);
|
|
@@ -3055,7 +2144,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
3055
2144
|
}
|
|
3056
2145
|
});
|
|
3057
2146
|
}, [show, activeAnchor, content, html, place, offset, positionStrategy, position]);
|
|
3058
|
-
|
|
2147
|
+
react.useEffect(() => {
|
|
3059
2148
|
var _a;
|
|
3060
2149
|
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
3061
2150
|
const anchors = [...anchorsBySelect, anchorById];
|
|
@@ -3068,7 +2157,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
3068
2157
|
setActiveAnchor((_a = anchorsBySelect[0]) !== null && _a !== void 0 ? _a : anchorById);
|
|
3069
2158
|
}
|
|
3070
2159
|
}, [anchorId, anchorsBySelect, activeAnchor]);
|
|
3071
|
-
|
|
2160
|
+
react.useEffect(() => {
|
|
3072
2161
|
return () => {
|
|
3073
2162
|
if (tooltipShowDelayTimerRef.current) {
|
|
3074
2163
|
clearTimeout(tooltipShowDelayTimerRef.current);
|
|
@@ -3078,7 +2167,7 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
3078
2167
|
}
|
|
3079
2168
|
};
|
|
3080
2169
|
}, []);
|
|
3081
|
-
|
|
2170
|
+
react.useEffect(() => {
|
|
3082
2171
|
let selector = anchorSelect;
|
|
3083
2172
|
if (!selector && id) {
|
|
3084
2173
|
selector = `[data-tooltip-id='${id}']`;
|
|
@@ -3097,28 +2186,28 @@ content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
|
3097
2186
|
}, [id, anchorSelect]);
|
|
3098
2187
|
const hasContentOrChildren = Boolean(html || content || children);
|
|
3099
2188
|
const canShow = hasContentOrChildren && show && Object.keys(inlineStyles).length > 0;
|
|
3100
|
-
return rendered ? (jsxRuntime.
|
|
2189
|
+
return rendered ? (jsxRuntime.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, {
|
|
3101
2190
|
[styles['show']]: canShow,
|
|
3102
2191
|
[styles['fixed']]: positionStrategy === 'fixed',
|
|
3103
2192
|
[styles['clickable']]: clickable,
|
|
3104
|
-
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [(html && jsxRuntime.
|
|
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, {
|
|
3105
2194
|
[styles['no-arrow']]: noArrow,
|
|
3106
2195
|
}), style: inlineArrowStyles, ref: tooltipArrowRef })] })) : null;
|
|
3107
2196
|
};
|
|
3108
2197
|
|
|
3109
2198
|
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, }) => {
|
|
3110
|
-
const [tooltipContent, setTooltipContent] =
|
|
3111
|
-
const [tooltipHtml, setTooltipHtml] =
|
|
3112
|
-
const [tooltipPlace, setTooltipPlace] =
|
|
3113
|
-
const [tooltipVariant, setTooltipVariant] =
|
|
3114
|
-
const [tooltipOffset, setTooltipOffset] =
|
|
3115
|
-
const [tooltipDelayShow, setTooltipDelayShow] =
|
|
3116
|
-
const [tooltipDelayHide, setTooltipDelayHide] =
|
|
3117
|
-
const [tooltipFloat, setTooltipFloat] =
|
|
3118
|
-
const [tooltipWrapper, setTooltipWrapper] =
|
|
3119
|
-
const [tooltipEvents, setTooltipEvents] =
|
|
3120
|
-
const [tooltipPositionStrategy, setTooltipPositionStrategy] =
|
|
3121
|
-
const [activeAnchor, setActiveAnchor] =
|
|
2199
|
+
const [tooltipContent, setTooltipContent] = react.useState(content);
|
|
2200
|
+
const [tooltipHtml, setTooltipHtml] = react.useState(html);
|
|
2201
|
+
const [tooltipPlace, setTooltipPlace] = react.useState(place);
|
|
2202
|
+
const [tooltipVariant, setTooltipVariant] = react.useState(variant);
|
|
2203
|
+
const [tooltipOffset, setTooltipOffset] = react.useState(offset);
|
|
2204
|
+
const [tooltipDelayShow, setTooltipDelayShow] = react.useState(delayShow);
|
|
2205
|
+
const [tooltipDelayHide, setTooltipDelayHide] = react.useState(delayHide);
|
|
2206
|
+
const [tooltipFloat, setTooltipFloat] = react.useState(float);
|
|
2207
|
+
const [tooltipWrapper, setTooltipWrapper] = react.useState(wrapper);
|
|
2208
|
+
const [tooltipEvents, setTooltipEvents] = react.useState(events);
|
|
2209
|
+
const [tooltipPositionStrategy, setTooltipPositionStrategy] = react.useState(positionStrategy);
|
|
2210
|
+
const [activeAnchor, setActiveAnchor] = react.useState(null);
|
|
3122
2211
|
/**
|
|
3123
2212
|
* @todo Remove this in a future version (provider/wrapper method is deprecated)
|
|
3124
2213
|
*/
|
|
@@ -3183,16 +2272,16 @@ const TooltipController = ({ id, anchorId, anchorSelect, content, html, classNam
|
|
|
3183
2272
|
(_a = handleDataAttributes[key]) === null || _a === void 0 ? void 0 : _a.call(handleDataAttributes, value);
|
|
3184
2273
|
});
|
|
3185
2274
|
};
|
|
3186
|
-
|
|
2275
|
+
react.useEffect(() => {
|
|
3187
2276
|
setTooltipContent(content);
|
|
3188
2277
|
}, [content]);
|
|
3189
|
-
|
|
2278
|
+
react.useEffect(() => {
|
|
3190
2279
|
setTooltipHtml(html);
|
|
3191
2280
|
}, [html]);
|
|
3192
|
-
|
|
2281
|
+
react.useEffect(() => {
|
|
3193
2282
|
setTooltipPlace(place);
|
|
3194
2283
|
}, [place]);
|
|
3195
|
-
|
|
2284
|
+
react.useEffect(() => {
|
|
3196
2285
|
var _a;
|
|
3197
2286
|
const elementRefs = new Set(anchorRefs);
|
|
3198
2287
|
let selector = anchorSelect;
|
|
@@ -3280,7 +2369,7 @@ const TooltipController = ({ id, anchorId, anchorSelect, content, html, classNam
|
|
|
3280
2369
|
activeAnchor,
|
|
3281
2370
|
setActiveAnchor: (anchor) => setActiveAnchor(anchor),
|
|
3282
2371
|
};
|
|
3283
|
-
return children ? jsxRuntime.
|
|
2372
|
+
return children ? jsxRuntime.jsx(Tooltip, { ...props, children: children }) : jsxRuntime.jsx(Tooltip, { ...props });
|
|
3284
2373
|
};
|
|
3285
2374
|
|
|
3286
2375
|
exports.Tooltip = TooltipController;
|