react-tooltip 5.8.2-beta.3 → 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 +55 -978
- package/dist/react-tooltip.cjs.min.js +2 -11
- package/dist/react-tooltip.esm.js +8 -927
- package/dist/react-tooltip.esm.min.js +2 -11
- package/dist/react-tooltip.umd.js +57 -981
- package/dist/react-tooltip.umd.min.js +2 -11
- package/package.json +2 -1
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactTooltip = {}, global.React));
|
|
5
|
-
})(this, (function (exports,
|
|
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);
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactTooltip = {}, global.jsxRuntime, global.React));
|
|
5
|
+
})(this, (function (exports, jsxRuntime, react) { 'use strict';
|
|
10
6
|
|
|
11
7
|
function getAlignment(placement) {
|
|
12
8
|
return placement.split('-')[1];
|
|
@@ -1517,926 +1513,6 @@
|
|
|
1517
1513
|
});
|
|
1518
1514
|
};
|
|
1519
1515
|
|
|
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
1516
|
var classnames = {exports: {}};
|
|
2441
1517
|
|
|
2442
1518
|
/*!
|
|
@@ -2522,7 +1598,7 @@
|
|
|
2522
1598
|
};
|
|
2523
1599
|
|
|
2524
1600
|
const TooltipContent = ({ content }) => {
|
|
2525
|
-
return jsxRuntime.
|
|
1601
|
+
return jsxRuntime.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
2526
1602
|
};
|
|
2527
1603
|
|
|
2528
1604
|
const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
|
|
@@ -2542,16 +1618,16 @@
|
|
|
2542
1618
|
const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
2543
1619
|
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
2544
1620
|
};
|
|
2545
|
-
const TooltipContext =
|
|
1621
|
+
const TooltipContext = react.createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
2546
1622
|
/**
|
|
2547
1623
|
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
2548
1624
|
* See https://react-tooltip.com/docs/getting-started
|
|
2549
1625
|
*/
|
|
2550
1626
|
const TooltipProvider = ({ children }) => {
|
|
2551
|
-
const [anchorRefMap, setAnchorRefMap] =
|
|
1627
|
+
const [anchorRefMap, setAnchorRefMap] = react.useState({
|
|
2552
1628
|
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
2553
1629
|
});
|
|
2554
|
-
const [activeAnchorMap, setActiveAnchorMap] =
|
|
1630
|
+
const [activeAnchorMap, setActiveAnchorMap] = react.useState({
|
|
2555
1631
|
[DEFAULT_TOOLTIP_ID]: { current: null },
|
|
2556
1632
|
});
|
|
2557
1633
|
const attach = (tooltipId, ...refs) => {
|
|
@@ -2586,7 +1662,7 @@
|
|
|
2586
1662
|
return { ...oldMap, [tooltipId]: ref };
|
|
2587
1663
|
});
|
|
2588
1664
|
};
|
|
2589
|
-
const getTooltipData =
|
|
1665
|
+
const getTooltipData = react.useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
|
|
2590
1666
|
var _a, _b;
|
|
2591
1667
|
return ({
|
|
2592
1668
|
anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
|
|
@@ -2596,15 +1672,15 @@
|
|
|
2596
1672
|
setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
|
|
2597
1673
|
});
|
|
2598
1674
|
}, [anchorRefMap, activeAnchorMap, attach, detach]);
|
|
2599
|
-
const context =
|
|
1675
|
+
const context = react.useMemo(() => {
|
|
2600
1676
|
return {
|
|
2601
1677
|
getTooltipData,
|
|
2602
1678
|
};
|
|
2603
1679
|
}, [getTooltipData]);
|
|
2604
|
-
return jsxRuntime.
|
|
1680
|
+
return jsxRuntime.jsx(TooltipContext.Provider, { value: context, children: children });
|
|
2605
1681
|
};
|
|
2606
1682
|
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
2607
|
-
return
|
|
1683
|
+
return react.useContext(TooltipContext).getTooltipData(tooltipId);
|
|
2608
1684
|
}
|
|
2609
1685
|
|
|
2610
1686
|
/**
|
|
@@ -2613,14 +1689,14 @@
|
|
|
2613
1689
|
*/
|
|
2614
1690
|
const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
|
|
2615
1691
|
const { attach, detach } = useTooltip(tooltipId);
|
|
2616
|
-
const anchorRef =
|
|
2617
|
-
|
|
1692
|
+
const anchorRef = react.useRef(null);
|
|
1693
|
+
react.useEffect(() => {
|
|
2618
1694
|
attach(anchorRef);
|
|
2619
1695
|
return () => {
|
|
2620
1696
|
detach(anchorRef);
|
|
2621
1697
|
};
|
|
2622
1698
|
}, []);
|
|
2623
|
-
return (jsxRuntime.
|
|
1699
|
+
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
1700
|
};
|
|
2625
1701
|
|
|
2626
1702
|
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 +1753,35 @@
|
|
|
2677
1753
|
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
1754
|
// props handled by controller
|
|
2679
1755
|
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 =
|
|
1756
|
+
const tooltipRef = react.useRef(null);
|
|
1757
|
+
const tooltipArrowRef = react.useRef(null);
|
|
1758
|
+
const tooltipShowDelayTimerRef = react.useRef(null);
|
|
1759
|
+
const tooltipHideDelayTimerRef = react.useRef(null);
|
|
1760
|
+
const [inlineStyles, setInlineStyles] = react.useState({});
|
|
1761
|
+
const [inlineArrowStyles, setInlineArrowStyles] = react.useState({});
|
|
1762
|
+
const [show, setShow] = react.useState(false);
|
|
1763
|
+
const [rendered, setRendered] = react.useState(false);
|
|
1764
|
+
const wasShowing = react.useRef(false);
|
|
1765
|
+
const lastFloatPosition = react.useRef(null);
|
|
2690
1766
|
/**
|
|
2691
1767
|
* @todo Remove this in a future version (provider/wrapper method is deprecated)
|
|
2692
1768
|
*/
|
|
2693
1769
|
const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id);
|
|
2694
|
-
const hoveringTooltip =
|
|
2695
|
-
const [anchorsBySelect, setAnchorsBySelect] =
|
|
2696
|
-
const mounted =
|
|
1770
|
+
const hoveringTooltip = react.useRef(false);
|
|
1771
|
+
const [anchorsBySelect, setAnchorsBySelect] = react.useState([]);
|
|
1772
|
+
const mounted = react.useRef(false);
|
|
2697
1773
|
/**
|
|
2698
1774
|
* useLayoutEffect runs before useEffect,
|
|
2699
1775
|
* but should be used carefully because of caveats
|
|
2700
1776
|
* https://beta.reactjs.org/reference/react/useLayoutEffect#caveats
|
|
2701
1777
|
*/
|
|
2702
|
-
|
|
1778
|
+
react.useLayoutEffect(() => {
|
|
2703
1779
|
mounted.current = true;
|
|
2704
1780
|
return () => {
|
|
2705
1781
|
mounted.current = false;
|
|
2706
1782
|
};
|
|
2707
1783
|
}, []);
|
|
2708
|
-
|
|
1784
|
+
react.useEffect(() => {
|
|
2709
1785
|
if (!show) {
|
|
2710
1786
|
/**
|
|
2711
1787
|
* this fixes weird behavior when switching between two anchor elements very quickly
|
|
@@ -2747,7 +1823,7 @@
|
|
|
2747
1823
|
* this replicates the effect from `handleShow()`
|
|
2748
1824
|
* when `isOpen` is changed from outside
|
|
2749
1825
|
*/
|
|
2750
|
-
|
|
1826
|
+
react.useEffect(() => {
|
|
2751
1827
|
if (isOpen === undefined) {
|
|
2752
1828
|
return () => null;
|
|
2753
1829
|
}
|
|
@@ -2761,7 +1837,7 @@
|
|
|
2761
1837
|
clearTimeout(timeout);
|
|
2762
1838
|
};
|
|
2763
1839
|
}, [isOpen]);
|
|
2764
|
-
|
|
1840
|
+
react.useEffect(() => {
|
|
2765
1841
|
if (show === wasShowing.current) {
|
|
2766
1842
|
return;
|
|
2767
1843
|
}
|
|
@@ -2895,7 +1971,7 @@
|
|
|
2895
1971
|
// mouse enter and focus events being triggered toggether
|
|
2896
1972
|
const debouncedHandleShowTooltip = debounce(handleShowTooltip, 50);
|
|
2897
1973
|
const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50);
|
|
2898
|
-
|
|
1974
|
+
react.useEffect(() => {
|
|
2899
1975
|
var _a, _b;
|
|
2900
1976
|
const elementRefs = new Set(anchorRefs);
|
|
2901
1977
|
anchorsBySelect.forEach((anchor) => {
|
|
@@ -2963,7 +2039,7 @@
|
|
|
2963
2039
|
* since `tooltipRef` becomes stale after removing/adding the tooltip to the DOM
|
|
2964
2040
|
*/
|
|
2965
2041
|
}, [rendered, anchorRefs, anchorsBySelect, closeOnEsc, events]);
|
|
2966
|
-
|
|
2042
|
+
react.useEffect(() => {
|
|
2967
2043
|
let selector = anchorSelect !== null && anchorSelect !== void 0 ? anchorSelect : '';
|
|
2968
2044
|
if (!selector && id) {
|
|
2969
2045
|
selector = `[data-tooltip-id='${id}']`;
|
|
@@ -3026,7 +2102,7 @@
|
|
|
3026
2102
|
documentObserver.disconnect();
|
|
3027
2103
|
};
|
|
3028
2104
|
}, [id, anchorSelect, activeAnchor]);
|
|
3029
|
-
|
|
2105
|
+
react.useEffect(() => {
|
|
3030
2106
|
if (position) {
|
|
3031
2107
|
// if `position` is set, override regular and `float` positioning
|
|
3032
2108
|
handleTooltipPosition(position);
|
|
@@ -3067,7 +2143,7 @@
|
|
|
3067
2143
|
}
|
|
3068
2144
|
});
|
|
3069
2145
|
}, [show, activeAnchor, content, html, place, offset, positionStrategy, position]);
|
|
3070
|
-
|
|
2146
|
+
react.useEffect(() => {
|
|
3071
2147
|
var _a;
|
|
3072
2148
|
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
3073
2149
|
const anchors = [...anchorsBySelect, anchorById];
|
|
@@ -3080,7 +2156,7 @@
|
|
|
3080
2156
|
setActiveAnchor((_a = anchorsBySelect[0]) !== null && _a !== void 0 ? _a : anchorById);
|
|
3081
2157
|
}
|
|
3082
2158
|
}, [anchorId, anchorsBySelect, activeAnchor]);
|
|
3083
|
-
|
|
2159
|
+
react.useEffect(() => {
|
|
3084
2160
|
return () => {
|
|
3085
2161
|
if (tooltipShowDelayTimerRef.current) {
|
|
3086
2162
|
clearTimeout(tooltipShowDelayTimerRef.current);
|
|
@@ -3090,7 +2166,7 @@
|
|
|
3090
2166
|
}
|
|
3091
2167
|
};
|
|
3092
2168
|
}, []);
|
|
3093
|
-
|
|
2169
|
+
react.useEffect(() => {
|
|
3094
2170
|
let selector = anchorSelect;
|
|
3095
2171
|
if (!selector && id) {
|
|
3096
2172
|
selector = `[data-tooltip-id='${id}']`;
|
|
@@ -3109,28 +2185,28 @@
|
|
|
3109
2185
|
}, [id, anchorSelect]);
|
|
3110
2186
|
const hasContentOrChildren = Boolean(html || content || children);
|
|
3111
2187
|
const canShow = hasContentOrChildren && show && Object.keys(inlineStyles).length > 0;
|
|
3112
|
-
return rendered ? (jsxRuntime.
|
|
2188
|
+
return rendered ? (jsxRuntime.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, {
|
|
3113
2189
|
[styles['show']]: canShow,
|
|
3114
2190
|
[styles['fixed']]: positionStrategy === 'fixed',
|
|
3115
2191
|
[styles['clickable']]: clickable,
|
|
3116
|
-
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [(html && jsxRuntime.
|
|
2192
|
+
}), 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, {
|
|
3117
2193
|
[styles['no-arrow']]: noArrow,
|
|
3118
2194
|
}), style: inlineArrowStyles, ref: tooltipArrowRef })] })) : null;
|
|
3119
2195
|
};
|
|
3120
2196
|
|
|
3121
2197
|
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, }) => {
|
|
3122
|
-
const [tooltipContent, setTooltipContent] =
|
|
3123
|
-
const [tooltipHtml, setTooltipHtml] =
|
|
3124
|
-
const [tooltipPlace, setTooltipPlace] =
|
|
3125
|
-
const [tooltipVariant, setTooltipVariant] =
|
|
3126
|
-
const [tooltipOffset, setTooltipOffset] =
|
|
3127
|
-
const [tooltipDelayShow, setTooltipDelayShow] =
|
|
3128
|
-
const [tooltipDelayHide, setTooltipDelayHide] =
|
|
3129
|
-
const [tooltipFloat, setTooltipFloat] =
|
|
3130
|
-
const [tooltipWrapper, setTooltipWrapper] =
|
|
3131
|
-
const [tooltipEvents, setTooltipEvents] =
|
|
3132
|
-
const [tooltipPositionStrategy, setTooltipPositionStrategy] =
|
|
3133
|
-
const [activeAnchor, setActiveAnchor] =
|
|
2198
|
+
const [tooltipContent, setTooltipContent] = react.useState(content);
|
|
2199
|
+
const [tooltipHtml, setTooltipHtml] = react.useState(html);
|
|
2200
|
+
const [tooltipPlace, setTooltipPlace] = react.useState(place);
|
|
2201
|
+
const [tooltipVariant, setTooltipVariant] = react.useState(variant);
|
|
2202
|
+
const [tooltipOffset, setTooltipOffset] = react.useState(offset);
|
|
2203
|
+
const [tooltipDelayShow, setTooltipDelayShow] = react.useState(delayShow);
|
|
2204
|
+
const [tooltipDelayHide, setTooltipDelayHide] = react.useState(delayHide);
|
|
2205
|
+
const [tooltipFloat, setTooltipFloat] = react.useState(float);
|
|
2206
|
+
const [tooltipWrapper, setTooltipWrapper] = react.useState(wrapper);
|
|
2207
|
+
const [tooltipEvents, setTooltipEvents] = react.useState(events);
|
|
2208
|
+
const [tooltipPositionStrategy, setTooltipPositionStrategy] = react.useState(positionStrategy);
|
|
2209
|
+
const [activeAnchor, setActiveAnchor] = react.useState(null);
|
|
3134
2210
|
/**
|
|
3135
2211
|
* @todo Remove this in a future version (provider/wrapper method is deprecated)
|
|
3136
2212
|
*/
|
|
@@ -3195,16 +2271,16 @@
|
|
|
3195
2271
|
(_a = handleDataAttributes[key]) === null || _a === void 0 ? void 0 : _a.call(handleDataAttributes, value);
|
|
3196
2272
|
});
|
|
3197
2273
|
};
|
|
3198
|
-
|
|
2274
|
+
react.useEffect(() => {
|
|
3199
2275
|
setTooltipContent(content);
|
|
3200
2276
|
}, [content]);
|
|
3201
|
-
|
|
2277
|
+
react.useEffect(() => {
|
|
3202
2278
|
setTooltipHtml(html);
|
|
3203
2279
|
}, [html]);
|
|
3204
|
-
|
|
2280
|
+
react.useEffect(() => {
|
|
3205
2281
|
setTooltipPlace(place);
|
|
3206
2282
|
}, [place]);
|
|
3207
|
-
|
|
2283
|
+
react.useEffect(() => {
|
|
3208
2284
|
var _a;
|
|
3209
2285
|
const elementRefs = new Set(anchorRefs);
|
|
3210
2286
|
let selector = anchorSelect;
|
|
@@ -3292,7 +2368,7 @@
|
|
|
3292
2368
|
activeAnchor,
|
|
3293
2369
|
setActiveAnchor: (anchor) => setActiveAnchor(anchor),
|
|
3294
2370
|
};
|
|
3295
|
-
return children ? jsxRuntime.
|
|
2371
|
+
return children ? jsxRuntime.jsx(Tooltip, { ...props, children: children }) : jsxRuntime.jsx(Tooltip, { ...props });
|
|
3296
2372
|
};
|
|
3297
2373
|
|
|
3298
2374
|
exports.Tooltip = TooltipController;
|