@0xsquid/ui 0.3.0 → 1.0.0
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/README.md +1 -76
- package/dist/cjs/index.js +4326 -466
- package/dist/cjs/types/components/buttons/Dropdown.d.ts +1 -4
- package/dist/cjs/types/components/index.d.ts +0 -5
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +0 -3
- package/dist/cjs/types/index.d.ts +0 -1
- package/dist/cjs/types/providers/SquidConfigProvider.d.ts +1 -0
- package/dist/cjs/types/types/config.d.ts +0 -1
- package/dist/esm/index.js +4327 -445
- package/dist/esm/types/components/buttons/Dropdown.d.ts +1 -4
- package/dist/esm/types/components/index.d.ts +0 -5
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +0 -3
- package/dist/esm/types/index.d.ts +0 -1
- package/dist/esm/types/providers/SquidConfigProvider.d.ts +1 -0
- package/dist/esm/types/types/config.d.ts +0 -1
- package/dist/index.css +6 -6
- package/dist/index.d.ts +2 -224
- package/package.json +5 -8
- package/dist/cjs/types/components/badges/index.d.ts +0 -2
- package/dist/cjs/types/components/controls/index.d.ts +0 -3
- package/dist/cjs/types/components/layout/index.d.ts +0 -8
- package/dist/cjs/types/components/lists/index.d.ts +0 -5
- package/dist/cjs/types/components/typography/index.d.ts +0 -3
- package/dist/cjs/types/providers/index.d.ts +0 -1
- package/dist/esm/types/components/badges/index.d.ts +0 -2
- package/dist/esm/types/components/controls/index.d.ts +0 -3
- package/dist/esm/types/components/layout/index.d.ts +0 -8
- package/dist/esm/types/components/lists/index.d.ts +0 -5
- package/dist/esm/types/components/typography/index.d.ts +0 -3
- package/dist/esm/types/providers/index.d.ts +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,4191 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function __rest(s, e) {
|
|
19
|
+
var t = {};
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
21
|
+
t[p] = s[p];
|
|
22
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
23
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
24
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
25
|
+
t[p[i]] = s[p[i]];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
31
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
32
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
33
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
34
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
35
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
36
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
41
|
+
var e = new Error(message);
|
|
42
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var jsxRuntime = {exports: {}};
|
|
46
|
+
|
|
47
|
+
var reactJsxRuntime_production_min = {};
|
|
48
|
+
|
|
49
|
+
var react = {exports: {}};
|
|
50
|
+
|
|
51
|
+
var react_production_min = {};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @license React
|
|
55
|
+
* react.production.min.js
|
|
56
|
+
*
|
|
57
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the MIT license found in the
|
|
60
|
+
* LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
var hasRequiredReact_production_min;
|
|
64
|
+
|
|
65
|
+
function requireReact_production_min () {
|
|
66
|
+
if (hasRequiredReact_production_min) return react_production_min;
|
|
67
|
+
hasRequiredReact_production_min = 1;
|
|
68
|
+
var l=Symbol.for("react.element"),n=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),z=Symbol.iterator;function A(a){if(null===a||"object"!==typeof a)return null;a=z&&a[z]||a["@@iterator"];return "function"===typeof a?a:null}
|
|
69
|
+
var B={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}E.prototype.isReactComponent={};
|
|
70
|
+
E.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,b,"setState");};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}var H=G.prototype=new F;
|
|
71
|
+
H.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};
|
|
72
|
+
function M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];c.children=f;}if(a&&a.defaultProps)for(d in g=a.defaultProps,g)void 0===c[d]&&(c[d]=g[d]);return {$$typeof:l,type:a,key:k,ref:h,props:c,_owner:K.current}}
|
|
73
|
+
function N(a,b){return {$$typeof:l,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return "object"===typeof a&&null!==a&&a.$$typeof===l}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var P=/\/+/g;function Q(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
|
|
74
|
+
function R(a,b,e,d,c){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case l:case n:h=!0;}}if(h)return h=a,c=c(h),a=""===d?"."+Q(h,0):d,I(c)?(e="",null!=a&&(e=a.replace(P,"$&/")+"/"),R(c,b,e,"",function(a){return a})):null!=c&&(O(c)&&(c=N(c,e+(!c.key||h&&h.key===c.key?"":(""+c.key).replace(P,"$&/")+"/")+a)),b.push(c)),1;h=0;d=""===d?".":d+":";if(I(a))for(var g=0;g<a.length;g++){k=
|
|
75
|
+
a[g];var f=d+Q(k,g);h+=R(k,b,e,f,c);}else if(f=A(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=d+Q(k,g++),h+=R(k,b,e,f,c);else if("object"===k)throw b=String(a),Error("Objects are not valid as a React child (found: "+("[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b)+"). If you meant to render a collection of children, use an array instead.");return h}
|
|
76
|
+
function S(a,b,e){if(null==a)return a;var d=[],c=0;R(a,d,"","",function(a){return b.call(e,a,c++)});return d}function T(a){if(-1===a._status){var b=a._result;b=b();b.then(function(b){if(0===a._status||-1===a._status)a._status=1,a._result=b;},function(b){if(0===a._status||-1===a._status)a._status=2,a._result=b;});-1===a._status&&(a._status=0,a._result=b);}if(1===a._status)return a._result.default;throw a._result;}
|
|
77
|
+
var U={current:null},V={transition:null},W={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:V,ReactCurrentOwner:K};react_production_min.Children={map:S,forEach:function(a,b,e){S(a,function(){b.apply(this,arguments);},e);},count:function(a){var b=0;S(a,function(){b++;});return b},toArray:function(a){return S(a,function(a){return a})||[]},only:function(a){if(!O(a))throw Error("React.Children.only expected to receive a single React element child.");return a}};react_production_min.Component=E;react_production_min.Fragment=p;
|
|
78
|
+
react_production_min.Profiler=r;react_production_min.PureComponent=G;react_production_min.StrictMode=q;react_production_min.Suspense=w;react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W;
|
|
79
|
+
react_production_min.cloneElement=function(a,b,e){if(null===a||void 0===a)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+a+".");var d=C({},a.props),c=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=K.current);void 0!==b.key&&(c=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)J.call(b,f)&&!L.hasOwnProperty(f)&&(d[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){g=Array(f);
|
|
80
|
+
for(var m=0;m<f;m++)g[m]=arguments[m+2];d.children=g;}return {$$typeof:l,type:a.type,key:c,ref:k,props:d,_owner:h}};react_production_min.createContext=function(a){a={$$typeof:u,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};a.Provider={$$typeof:t,_context:a};return a.Consumer=a};react_production_min.createElement=M;react_production_min.createFactory=function(a){var b=M.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}};
|
|
81
|
+
react_production_min.forwardRef=function(a){return {$$typeof:v,render:a}};react_production_min.isValidElement=O;react_production_min.lazy=function(a){return {$$typeof:y,_payload:{_status:-1,_result:a},_init:T}};react_production_min.memo=function(a,b){return {$$typeof:x,type:a,compare:void 0===b?null:b}};react_production_min.startTransition=function(a){var b=V.transition;V.transition={};try{a();}finally{V.transition=b;}};react_production_min.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.");};
|
|
82
|
+
react_production_min.useCallback=function(a,b){return U.current.useCallback(a,b)};react_production_min.useContext=function(a){return U.current.useContext(a)};react_production_min.useDebugValue=function(){};react_production_min.useDeferredValue=function(a){return U.current.useDeferredValue(a)};react_production_min.useEffect=function(a,b){return U.current.useEffect(a,b)};react_production_min.useId=function(){return U.current.useId()};react_production_min.useImperativeHandle=function(a,b,e){return U.current.useImperativeHandle(a,b,e)};
|
|
83
|
+
react_production_min.useInsertionEffect=function(a,b){return U.current.useInsertionEffect(a,b)};react_production_min.useLayoutEffect=function(a,b){return U.current.useLayoutEffect(a,b)};react_production_min.useMemo=function(a,b){return U.current.useMemo(a,b)};react_production_min.useReducer=function(a,b,e){return U.current.useReducer(a,b,e)};react_production_min.useRef=function(a){return U.current.useRef(a)};react_production_min.useState=function(a){return U.current.useState(a)};react_production_min.useSyncExternalStore=function(a,b,e){return U.current.useSyncExternalStore(a,b,e)};
|
|
84
|
+
react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.2.0";
|
|
85
|
+
return react_production_min;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var react_development = {exports: {}};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @license React
|
|
92
|
+
* react.development.js
|
|
93
|
+
*
|
|
94
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the MIT license found in the
|
|
97
|
+
* LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/
|
|
99
|
+
react_development.exports;
|
|
100
|
+
|
|
101
|
+
var hasRequiredReact_development;
|
|
102
|
+
|
|
103
|
+
function requireReact_development () {
|
|
104
|
+
if (hasRequiredReact_development) return react_development.exports;
|
|
105
|
+
hasRequiredReact_development = 1;
|
|
106
|
+
(function (module, exports) {
|
|
107
|
+
|
|
108
|
+
if (process.env.NODE_ENV !== "production") {
|
|
109
|
+
(function() {
|
|
110
|
+
|
|
111
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
112
|
+
if (
|
|
113
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
114
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
115
|
+
'function'
|
|
116
|
+
) {
|
|
117
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
118
|
+
}
|
|
119
|
+
var ReactVersion = '18.2.0';
|
|
120
|
+
|
|
121
|
+
// ATTENTION
|
|
122
|
+
// When adding new symbols to this file,
|
|
123
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
124
|
+
// The Symbol used to tag the ReactElement-like types.
|
|
125
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
126
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
127
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
128
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
129
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
130
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
131
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
132
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
133
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
134
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
135
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
136
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
137
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
138
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
139
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
140
|
+
function getIteratorFn(maybeIterable) {
|
|
141
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
146
|
+
|
|
147
|
+
if (typeof maybeIterator === 'function') {
|
|
148
|
+
return maybeIterator;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Keeps track of the current dispatcher.
|
|
156
|
+
*/
|
|
157
|
+
var ReactCurrentDispatcher = {
|
|
158
|
+
/**
|
|
159
|
+
* @internal
|
|
160
|
+
* @type {ReactComponent}
|
|
161
|
+
*/
|
|
162
|
+
current: null
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Keeps track of the current batch's configuration such as how long an update
|
|
167
|
+
* should suspend for if it needs to.
|
|
168
|
+
*/
|
|
169
|
+
var ReactCurrentBatchConfig = {
|
|
170
|
+
transition: null
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
var ReactCurrentActQueue = {
|
|
174
|
+
current: null,
|
|
175
|
+
// Used to reproduce behavior of `batchedUpdates` in legacy mode.
|
|
176
|
+
isBatchingLegacy: false,
|
|
177
|
+
didScheduleLegacyUpdate: false
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Keeps track of the current owner.
|
|
182
|
+
*
|
|
183
|
+
* The current owner is the component who should own any components that are
|
|
184
|
+
* currently being constructed.
|
|
185
|
+
*/
|
|
186
|
+
var ReactCurrentOwner = {
|
|
187
|
+
/**
|
|
188
|
+
* @internal
|
|
189
|
+
* @type {ReactComponent}
|
|
190
|
+
*/
|
|
191
|
+
current: null
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
var ReactDebugCurrentFrame = {};
|
|
195
|
+
var currentExtraStackFrame = null;
|
|
196
|
+
function setExtraStackFrame(stack) {
|
|
197
|
+
{
|
|
198
|
+
currentExtraStackFrame = stack;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
{
|
|
203
|
+
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
|
204
|
+
{
|
|
205
|
+
currentExtraStackFrame = stack;
|
|
206
|
+
}
|
|
207
|
+
}; // Stack implementation injected by the current renderer.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
211
|
+
|
|
212
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
213
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
|
214
|
+
|
|
215
|
+
if (currentExtraStackFrame) {
|
|
216
|
+
stack += currentExtraStackFrame;
|
|
217
|
+
} // Delegate to the injected renderer-specific implementation
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
221
|
+
|
|
222
|
+
if (impl) {
|
|
223
|
+
stack += impl() || '';
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return stack;
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// -----------------------------------------------------------------------------
|
|
231
|
+
|
|
232
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
233
|
+
var enableCacheElement = false;
|
|
234
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
235
|
+
|
|
236
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
237
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
238
|
+
// issues in DEV builds.
|
|
239
|
+
|
|
240
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
241
|
+
|
|
242
|
+
var ReactSharedInternals = {
|
|
243
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
244
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
245
|
+
ReactCurrentOwner: ReactCurrentOwner
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
{
|
|
249
|
+
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
|
250
|
+
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// by calls to these methods by a Babel plugin.
|
|
254
|
+
//
|
|
255
|
+
// In PROD (or in packages without access to React internals),
|
|
256
|
+
// they are left as they are instead.
|
|
257
|
+
|
|
258
|
+
function warn(format) {
|
|
259
|
+
{
|
|
260
|
+
{
|
|
261
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
262
|
+
args[_key - 1] = arguments[_key];
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
printWarning('warn', format, args);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function error(format) {
|
|
270
|
+
{
|
|
271
|
+
{
|
|
272
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
273
|
+
args[_key2 - 1] = arguments[_key2];
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
printWarning('error', format, args);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function printWarning(level, format, args) {
|
|
282
|
+
// When changing this logic, you might want to also
|
|
283
|
+
// update consoleWithStackDev.www.js as well.
|
|
284
|
+
{
|
|
285
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
286
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
287
|
+
|
|
288
|
+
if (stack !== '') {
|
|
289
|
+
format += '%s';
|
|
290
|
+
args = args.concat([stack]);
|
|
291
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
var argsWithFormat = args.map(function (item) {
|
|
295
|
+
return String(item);
|
|
296
|
+
}); // Careful: RN currently depends on this prefix
|
|
297
|
+
|
|
298
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
299
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
300
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
301
|
+
|
|
302
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
|
307
|
+
|
|
308
|
+
function warnNoop(publicInstance, callerName) {
|
|
309
|
+
{
|
|
310
|
+
var _constructor = publicInstance.constructor;
|
|
311
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
312
|
+
var warningKey = componentName + "." + callerName;
|
|
313
|
+
|
|
314
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
|
319
|
+
|
|
320
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* This is the abstract API for an update queue.
|
|
325
|
+
*/
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
var ReactNoopUpdateQueue = {
|
|
329
|
+
/**
|
|
330
|
+
* Checks whether or not this composite component is mounted.
|
|
331
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
|
332
|
+
* @return {boolean} True if mounted, false otherwise.
|
|
333
|
+
* @protected
|
|
334
|
+
* @final
|
|
335
|
+
*/
|
|
336
|
+
isMounted: function (publicInstance) {
|
|
337
|
+
return false;
|
|
338
|
+
},
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Forces an update. This should only be invoked when it is known with
|
|
342
|
+
* certainty that we are **not** in a DOM transaction.
|
|
343
|
+
*
|
|
344
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
345
|
+
* component's state has changed but `setState` was not called.
|
|
346
|
+
*
|
|
347
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
348
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
349
|
+
*
|
|
350
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
351
|
+
* @param {?function} callback Called after component is updated.
|
|
352
|
+
* @param {?string} callerName name of the calling function in the public API.
|
|
353
|
+
* @internal
|
|
354
|
+
*/
|
|
355
|
+
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
356
|
+
warnNoop(publicInstance, 'forceUpdate');
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
361
|
+
* You should treat `this.state` as immutable.
|
|
362
|
+
*
|
|
363
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
364
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
365
|
+
*
|
|
366
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
367
|
+
* @param {object} completeState Next state.
|
|
368
|
+
* @param {?function} callback Called after component is updated.
|
|
369
|
+
* @param {?string} callerName name of the calling function in the public API.
|
|
370
|
+
* @internal
|
|
371
|
+
*/
|
|
372
|
+
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
373
|
+
warnNoop(publicInstance, 'replaceState');
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
|
378
|
+
* internal. This provides a merging strategy that is not available to deep
|
|
379
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
380
|
+
* during the merge.
|
|
381
|
+
*
|
|
382
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
383
|
+
* @param {object} partialState Next partial state to be merged with state.
|
|
384
|
+
* @param {?function} callback Called after component is updated.
|
|
385
|
+
* @param {?string} Name of the calling function in the public API.
|
|
386
|
+
* @internal
|
|
387
|
+
*/
|
|
388
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
389
|
+
warnNoop(publicInstance, 'setState');
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
var assign = Object.assign;
|
|
394
|
+
|
|
395
|
+
var emptyObject = {};
|
|
396
|
+
|
|
397
|
+
{
|
|
398
|
+
Object.freeze(emptyObject);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Base class helpers for the updating state of a component.
|
|
402
|
+
*/
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
function Component(props, context, updater) {
|
|
406
|
+
this.props = props;
|
|
407
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
408
|
+
|
|
409
|
+
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
410
|
+
// renderer.
|
|
411
|
+
|
|
412
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
Component.prototype.isReactComponent = {};
|
|
416
|
+
/**
|
|
417
|
+
* Sets a subset of the state. Always use this to mutate
|
|
418
|
+
* state. You should treat `this.state` as immutable.
|
|
419
|
+
*
|
|
420
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
421
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
422
|
+
*
|
|
423
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
|
424
|
+
* as they may eventually be batched together. You can provide an optional
|
|
425
|
+
* callback that will be executed when the call to setState is actually
|
|
426
|
+
* completed.
|
|
427
|
+
*
|
|
428
|
+
* When a function is provided to setState, it will be called at some point in
|
|
429
|
+
* the future (not synchronously). It will be called with the up to date
|
|
430
|
+
* component arguments (state, props, context). These values can be different
|
|
431
|
+
* from this.* because your function may be called after receiveProps but before
|
|
432
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
433
|
+
* assigned to this.
|
|
434
|
+
*
|
|
435
|
+
* @param {object|function} partialState Next partial state or function to
|
|
436
|
+
* produce next partial state to be merged with current state.
|
|
437
|
+
* @param {?function} callback Called after state is updated.
|
|
438
|
+
* @final
|
|
439
|
+
* @protected
|
|
440
|
+
*/
|
|
441
|
+
|
|
442
|
+
Component.prototype.setState = function (partialState, callback) {
|
|
443
|
+
if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {
|
|
444
|
+
throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
448
|
+
};
|
|
449
|
+
/**
|
|
450
|
+
* Forces an update. This should only be invoked when it is known with
|
|
451
|
+
* certainty that we are **not** in a DOM transaction.
|
|
452
|
+
*
|
|
453
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
454
|
+
* component's state has changed but `setState` was not called.
|
|
455
|
+
*
|
|
456
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
457
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
458
|
+
*
|
|
459
|
+
* @param {?function} callback Called after update is complete.
|
|
460
|
+
* @final
|
|
461
|
+
* @protected
|
|
462
|
+
*/
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
Component.prototype.forceUpdate = function (callback) {
|
|
466
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
470
|
+
* we would like to deprecate them, we're not going to move them over to this
|
|
471
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
472
|
+
*/
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
{
|
|
476
|
+
var deprecatedAPIs = {
|
|
477
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
478
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
var defineDeprecationWarning = function (methodName, info) {
|
|
482
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
483
|
+
get: function () {
|
|
484
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
485
|
+
|
|
486
|
+
return undefined;
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
for (var fnName in deprecatedAPIs) {
|
|
492
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
493
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function ComponentDummy() {}
|
|
499
|
+
|
|
500
|
+
ComponentDummy.prototype = Component.prototype;
|
|
501
|
+
/**
|
|
502
|
+
* Convenience component with default shallow equality check for sCU.
|
|
503
|
+
*/
|
|
504
|
+
|
|
505
|
+
function PureComponent(props, context, updater) {
|
|
506
|
+
this.props = props;
|
|
507
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
508
|
+
|
|
509
|
+
this.refs = emptyObject;
|
|
510
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
514
|
+
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
515
|
+
|
|
516
|
+
assign(pureComponentPrototype, Component.prototype);
|
|
517
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
518
|
+
|
|
519
|
+
// an immutable object with a single mutable value
|
|
520
|
+
function createRef() {
|
|
521
|
+
var refObject = {
|
|
522
|
+
current: null
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
{
|
|
526
|
+
Object.seal(refObject);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
return refObject;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
533
|
+
|
|
534
|
+
function isArray(a) {
|
|
535
|
+
return isArrayImpl(a);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/*
|
|
539
|
+
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
540
|
+
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
541
|
+
*
|
|
542
|
+
* The functions in this module will throw an easier-to-understand,
|
|
543
|
+
* easier-to-debug exception with a clear errors message message explaining the
|
|
544
|
+
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
545
|
+
* of the `value` object).
|
|
546
|
+
*/
|
|
547
|
+
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
548
|
+
function typeName(value) {
|
|
549
|
+
{
|
|
550
|
+
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
551
|
+
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
552
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
553
|
+
return type;
|
|
554
|
+
}
|
|
555
|
+
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
function willCoercionThrow(value) {
|
|
559
|
+
{
|
|
560
|
+
try {
|
|
561
|
+
testStringCoercion(value);
|
|
562
|
+
return false;
|
|
563
|
+
} catch (e) {
|
|
564
|
+
return true;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function testStringCoercion(value) {
|
|
570
|
+
// If you ended up here by following an exception call stack, here's what's
|
|
571
|
+
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
572
|
+
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
573
|
+
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
574
|
+
//
|
|
575
|
+
// The most common types that will cause this exception are `Symbol` instances
|
|
576
|
+
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
577
|
+
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
578
|
+
// exception. (Library authors do this to prevent users from using built-in
|
|
579
|
+
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
580
|
+
// methods are needed to perform accurate arithmetic or comparison.)
|
|
581
|
+
//
|
|
582
|
+
// To fix the problem, coerce this object or symbol value to a string before
|
|
583
|
+
// passing it to React. The most reliable way is usually `String(value)`.
|
|
584
|
+
//
|
|
585
|
+
// To find which value is throwing, check the browser or debugger console.
|
|
586
|
+
// Before this exception was thrown, there should be `console.error` output
|
|
587
|
+
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
588
|
+
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
589
|
+
// In most cases, this console output also shows the component and its
|
|
590
|
+
// ancestor components where the exception happened.
|
|
591
|
+
//
|
|
592
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
593
|
+
return '' + value;
|
|
594
|
+
}
|
|
595
|
+
function checkKeyStringCoercion(value) {
|
|
596
|
+
{
|
|
597
|
+
if (willCoercionThrow(value)) {
|
|
598
|
+
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
599
|
+
|
|
600
|
+
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
606
|
+
var displayName = outerType.displayName;
|
|
607
|
+
|
|
608
|
+
if (displayName) {
|
|
609
|
+
return displayName;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
613
|
+
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
614
|
+
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
function getContextName(type) {
|
|
618
|
+
return type.displayName || 'Context';
|
|
619
|
+
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
function getComponentNameFromType(type) {
|
|
623
|
+
if (type == null) {
|
|
624
|
+
// Host root, text node or just invalid type.
|
|
625
|
+
return null;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
{
|
|
629
|
+
if (typeof type.tag === 'number') {
|
|
630
|
+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
if (typeof type === 'function') {
|
|
635
|
+
return type.displayName || type.name || null;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
if (typeof type === 'string') {
|
|
639
|
+
return type;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
switch (type) {
|
|
643
|
+
case REACT_FRAGMENT_TYPE:
|
|
644
|
+
return 'Fragment';
|
|
645
|
+
|
|
646
|
+
case REACT_PORTAL_TYPE:
|
|
647
|
+
return 'Portal';
|
|
648
|
+
|
|
649
|
+
case REACT_PROFILER_TYPE:
|
|
650
|
+
return 'Profiler';
|
|
651
|
+
|
|
652
|
+
case REACT_STRICT_MODE_TYPE:
|
|
653
|
+
return 'StrictMode';
|
|
654
|
+
|
|
655
|
+
case REACT_SUSPENSE_TYPE:
|
|
656
|
+
return 'Suspense';
|
|
657
|
+
|
|
658
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
659
|
+
return 'SuspenseList';
|
|
660
|
+
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
if (typeof type === 'object') {
|
|
664
|
+
switch (type.$$typeof) {
|
|
665
|
+
case REACT_CONTEXT_TYPE:
|
|
666
|
+
var context = type;
|
|
667
|
+
return getContextName(context) + '.Consumer';
|
|
668
|
+
|
|
669
|
+
case REACT_PROVIDER_TYPE:
|
|
670
|
+
var provider = type;
|
|
671
|
+
return getContextName(provider._context) + '.Provider';
|
|
672
|
+
|
|
673
|
+
case REACT_FORWARD_REF_TYPE:
|
|
674
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
675
|
+
|
|
676
|
+
case REACT_MEMO_TYPE:
|
|
677
|
+
var outerName = type.displayName || null;
|
|
678
|
+
|
|
679
|
+
if (outerName !== null) {
|
|
680
|
+
return outerName;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
return getComponentNameFromType(type.type) || 'Memo';
|
|
684
|
+
|
|
685
|
+
case REACT_LAZY_TYPE:
|
|
686
|
+
{
|
|
687
|
+
var lazyComponent = type;
|
|
688
|
+
var payload = lazyComponent._payload;
|
|
689
|
+
var init = lazyComponent._init;
|
|
690
|
+
|
|
691
|
+
try {
|
|
692
|
+
return getComponentNameFromType(init(payload));
|
|
693
|
+
} catch (x) {
|
|
694
|
+
return null;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// eslint-disable-next-line no-fallthrough
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
return null;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
706
|
+
|
|
707
|
+
var RESERVED_PROPS = {
|
|
708
|
+
key: true,
|
|
709
|
+
ref: true,
|
|
710
|
+
__self: true,
|
|
711
|
+
__source: true
|
|
712
|
+
};
|
|
713
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
714
|
+
|
|
715
|
+
{
|
|
716
|
+
didWarnAboutStringRefs = {};
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
function hasValidRef(config) {
|
|
720
|
+
{
|
|
721
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
722
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
723
|
+
|
|
724
|
+
if (getter && getter.isReactWarning) {
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
return config.ref !== undefined;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
function hasValidKey(config) {
|
|
734
|
+
{
|
|
735
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
736
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
737
|
+
|
|
738
|
+
if (getter && getter.isReactWarning) {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
return config.key !== undefined;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
748
|
+
var warnAboutAccessingKey = function () {
|
|
749
|
+
{
|
|
750
|
+
if (!specialPropKeyWarningShown) {
|
|
751
|
+
specialPropKeyWarningShown = true;
|
|
752
|
+
|
|
753
|
+
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);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
759
|
+
Object.defineProperty(props, 'key', {
|
|
760
|
+
get: warnAboutAccessingKey,
|
|
761
|
+
configurable: true
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
766
|
+
var warnAboutAccessingRef = function () {
|
|
767
|
+
{
|
|
768
|
+
if (!specialPropRefWarningShown) {
|
|
769
|
+
specialPropRefWarningShown = true;
|
|
770
|
+
|
|
771
|
+
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);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
|
|
776
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
777
|
+
Object.defineProperty(props, 'ref', {
|
|
778
|
+
get: warnAboutAccessingRef,
|
|
779
|
+
configurable: true
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
784
|
+
{
|
|
785
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
786
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
787
|
+
|
|
788
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
789
|
+
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', componentName, config.ref);
|
|
790
|
+
|
|
791
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
798
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
799
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
800
|
+
* if something is a React Element.
|
|
801
|
+
*
|
|
802
|
+
* @param {*} type
|
|
803
|
+
* @param {*} props
|
|
804
|
+
* @param {*} key
|
|
805
|
+
* @param {string|object} ref
|
|
806
|
+
* @param {*} owner
|
|
807
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
808
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
809
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
810
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
811
|
+
* change in behavior.
|
|
812
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
813
|
+
* indicating filename, line number, and/or other information.
|
|
814
|
+
* @internal
|
|
815
|
+
*/
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
819
|
+
var element = {
|
|
820
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
821
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
822
|
+
// Built-in properties that belong on the element
|
|
823
|
+
type: type,
|
|
824
|
+
key: key,
|
|
825
|
+
ref: ref,
|
|
826
|
+
props: props,
|
|
827
|
+
// Record the component responsible for creating this element.
|
|
828
|
+
_owner: owner
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
{
|
|
832
|
+
// The validation flag is currently mutative. We put it on
|
|
833
|
+
// an external backing store so that we can freeze the whole object.
|
|
834
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
835
|
+
// commonly used development environments.
|
|
836
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
837
|
+
// the validation flag non-enumerable (where possible, which should
|
|
838
|
+
// include every environment we run tests in), so the test framework
|
|
839
|
+
// ignores it.
|
|
840
|
+
|
|
841
|
+
Object.defineProperty(element._store, 'validated', {
|
|
842
|
+
configurable: false,
|
|
843
|
+
enumerable: false,
|
|
844
|
+
writable: true,
|
|
845
|
+
value: false
|
|
846
|
+
}); // self and source are DEV only properties.
|
|
847
|
+
|
|
848
|
+
Object.defineProperty(element, '_self', {
|
|
849
|
+
configurable: false,
|
|
850
|
+
enumerable: false,
|
|
851
|
+
writable: false,
|
|
852
|
+
value: self
|
|
853
|
+
}); // Two elements created in two different places should be considered
|
|
854
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
855
|
+
|
|
856
|
+
Object.defineProperty(element, '_source', {
|
|
857
|
+
configurable: false,
|
|
858
|
+
enumerable: false,
|
|
859
|
+
writable: false,
|
|
860
|
+
value: source
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
if (Object.freeze) {
|
|
864
|
+
Object.freeze(element.props);
|
|
865
|
+
Object.freeze(element);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
return element;
|
|
870
|
+
};
|
|
871
|
+
/**
|
|
872
|
+
* Create and return a new ReactElement of the given type.
|
|
873
|
+
* See https://reactjs.org/docs/react-api.html#createelement
|
|
874
|
+
*/
|
|
875
|
+
|
|
876
|
+
function createElement(type, config, children) {
|
|
877
|
+
var propName; // Reserved names are extracted
|
|
878
|
+
|
|
879
|
+
var props = {};
|
|
880
|
+
var key = null;
|
|
881
|
+
var ref = null;
|
|
882
|
+
var self = null;
|
|
883
|
+
var source = null;
|
|
884
|
+
|
|
885
|
+
if (config != null) {
|
|
886
|
+
if (hasValidRef(config)) {
|
|
887
|
+
ref = config.ref;
|
|
888
|
+
|
|
889
|
+
{
|
|
890
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
if (hasValidKey(config)) {
|
|
895
|
+
{
|
|
896
|
+
checkKeyStringCoercion(config.key);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
key = '' + config.key;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
self = config.__self === undefined ? null : config.__self;
|
|
903
|
+
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
|
904
|
+
|
|
905
|
+
for (propName in config) {
|
|
906
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
907
|
+
props[propName] = config[propName];
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
} // Children can be more than one argument, and those are transferred onto
|
|
911
|
+
// the newly allocated props object.
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
var childrenLength = arguments.length - 2;
|
|
915
|
+
|
|
916
|
+
if (childrenLength === 1) {
|
|
917
|
+
props.children = children;
|
|
918
|
+
} else if (childrenLength > 1) {
|
|
919
|
+
var childArray = Array(childrenLength);
|
|
920
|
+
|
|
921
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
922
|
+
childArray[i] = arguments[i + 2];
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
{
|
|
926
|
+
if (Object.freeze) {
|
|
927
|
+
Object.freeze(childArray);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
props.children = childArray;
|
|
932
|
+
} // Resolve default props
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
if (type && type.defaultProps) {
|
|
936
|
+
var defaultProps = type.defaultProps;
|
|
937
|
+
|
|
938
|
+
for (propName in defaultProps) {
|
|
939
|
+
if (props[propName] === undefined) {
|
|
940
|
+
props[propName] = defaultProps[propName];
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
{
|
|
946
|
+
if (key || ref) {
|
|
947
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
948
|
+
|
|
949
|
+
if (key) {
|
|
950
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
if (ref) {
|
|
954
|
+
defineRefPropWarningGetter(props, displayName);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
960
|
+
}
|
|
961
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
|
962
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
963
|
+
return newElement;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Clone and return a new ReactElement using element as the starting point.
|
|
967
|
+
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
968
|
+
*/
|
|
969
|
+
|
|
970
|
+
function cloneElement(element, config, children) {
|
|
971
|
+
if (element === null || element === undefined) {
|
|
972
|
+
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
var propName; // Original props are copied
|
|
976
|
+
|
|
977
|
+
var props = assign({}, element.props); // Reserved names are extracted
|
|
978
|
+
|
|
979
|
+
var key = element.key;
|
|
980
|
+
var ref = element.ref; // Self is preserved since the owner is preserved.
|
|
981
|
+
|
|
982
|
+
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
|
983
|
+
// transpiler, and the original source is probably a better indicator of the
|
|
984
|
+
// true owner.
|
|
985
|
+
|
|
986
|
+
var source = element._source; // Owner will be preserved, unless ref is overridden
|
|
987
|
+
|
|
988
|
+
var owner = element._owner;
|
|
989
|
+
|
|
990
|
+
if (config != null) {
|
|
991
|
+
if (hasValidRef(config)) {
|
|
992
|
+
// Silently steal the ref from the parent.
|
|
993
|
+
ref = config.ref;
|
|
994
|
+
owner = ReactCurrentOwner.current;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
if (hasValidKey(config)) {
|
|
998
|
+
{
|
|
999
|
+
checkKeyStringCoercion(config.key);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
key = '' + config.key;
|
|
1003
|
+
} // Remaining properties override existing props
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
var defaultProps;
|
|
1007
|
+
|
|
1008
|
+
if (element.type && element.type.defaultProps) {
|
|
1009
|
+
defaultProps = element.type.defaultProps;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
for (propName in config) {
|
|
1013
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
1014
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
1015
|
+
// Resolve default props
|
|
1016
|
+
props[propName] = defaultProps[propName];
|
|
1017
|
+
} else {
|
|
1018
|
+
props[propName] = config[propName];
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
} // Children can be more than one argument, and those are transferred onto
|
|
1023
|
+
// the newly allocated props object.
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
var childrenLength = arguments.length - 2;
|
|
1027
|
+
|
|
1028
|
+
if (childrenLength === 1) {
|
|
1029
|
+
props.children = children;
|
|
1030
|
+
} else if (childrenLength > 1) {
|
|
1031
|
+
var childArray = Array(childrenLength);
|
|
1032
|
+
|
|
1033
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
1034
|
+
childArray[i] = arguments[i + 2];
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
props.children = childArray;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Verifies the object is a ReactElement.
|
|
1044
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1045
|
+
* @param {?object} object
|
|
1046
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
1047
|
+
* @final
|
|
1048
|
+
*/
|
|
1049
|
+
|
|
1050
|
+
function isValidElement(object) {
|
|
1051
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
var SEPARATOR = '.';
|
|
1055
|
+
var SUBSEPARATOR = ':';
|
|
1056
|
+
/**
|
|
1057
|
+
* Escape and wrap key so it is safe to use as a reactid
|
|
1058
|
+
*
|
|
1059
|
+
* @param {string} key to be escaped.
|
|
1060
|
+
* @return {string} the escaped key.
|
|
1061
|
+
*/
|
|
1062
|
+
|
|
1063
|
+
function escape(key) {
|
|
1064
|
+
var escapeRegex = /[=:]/g;
|
|
1065
|
+
var escaperLookup = {
|
|
1066
|
+
'=': '=0',
|
|
1067
|
+
':': '=2'
|
|
1068
|
+
};
|
|
1069
|
+
var escapedString = key.replace(escapeRegex, function (match) {
|
|
1070
|
+
return escaperLookup[match];
|
|
1071
|
+
});
|
|
1072
|
+
return '$' + escapedString;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* TODO: Test that a single child and an array with one item have the same key
|
|
1076
|
+
* pattern.
|
|
1077
|
+
*/
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
var didWarnAboutMaps = false;
|
|
1081
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1082
|
+
|
|
1083
|
+
function escapeUserProvidedKey(text) {
|
|
1084
|
+
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Generate a key string that identifies a element within a set.
|
|
1088
|
+
*
|
|
1089
|
+
* @param {*} element A element that could contain a manual key.
|
|
1090
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
1091
|
+
* @return {string}
|
|
1092
|
+
*/
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
function getElementKey(element, index) {
|
|
1096
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1097
|
+
// that we don't block potential future ES APIs.
|
|
1098
|
+
if (typeof element === 'object' && element !== null && element.key != null) {
|
|
1099
|
+
// Explicit key
|
|
1100
|
+
{
|
|
1101
|
+
checkKeyStringCoercion(element.key);
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
return escape('' + element.key);
|
|
1105
|
+
} // Implicit key determined by the index in the set
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
return index.toString(36);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
1112
|
+
var type = typeof children;
|
|
1113
|
+
|
|
1114
|
+
if (type === 'undefined' || type === 'boolean') {
|
|
1115
|
+
// All of the above are perceived as null.
|
|
1116
|
+
children = null;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
var invokeCallback = false;
|
|
1120
|
+
|
|
1121
|
+
if (children === null) {
|
|
1122
|
+
invokeCallback = true;
|
|
1123
|
+
} else {
|
|
1124
|
+
switch (type) {
|
|
1125
|
+
case 'string':
|
|
1126
|
+
case 'number':
|
|
1127
|
+
invokeCallback = true;
|
|
1128
|
+
break;
|
|
1129
|
+
|
|
1130
|
+
case 'object':
|
|
1131
|
+
switch (children.$$typeof) {
|
|
1132
|
+
case REACT_ELEMENT_TYPE:
|
|
1133
|
+
case REACT_PORTAL_TYPE:
|
|
1134
|
+
invokeCallback = true;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
if (invokeCallback) {
|
|
1141
|
+
var _child = children;
|
|
1142
|
+
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
|
1143
|
+
// so that it's consistent if the number of children grows:
|
|
1144
|
+
|
|
1145
|
+
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
1146
|
+
|
|
1147
|
+
if (isArray(mappedChild)) {
|
|
1148
|
+
var escapedChildKey = '';
|
|
1149
|
+
|
|
1150
|
+
if (childKey != null) {
|
|
1151
|
+
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
|
1155
|
+
return c;
|
|
1156
|
+
});
|
|
1157
|
+
} else if (mappedChild != null) {
|
|
1158
|
+
if (isValidElement(mappedChild)) {
|
|
1159
|
+
{
|
|
1160
|
+
// The `if` statement here prevents auto-disabling of the safe
|
|
1161
|
+
// coercion ESLint rule, so we must manually disable it below.
|
|
1162
|
+
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1163
|
+
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
|
1164
|
+
checkKeyStringCoercion(mappedChild.key);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
1169
|
+
// traverseAllChildren used to do for objects as children
|
|
1170
|
+
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1171
|
+
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
|
1172
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1173
|
+
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
array.push(mappedChild);
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
return 1;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
var child;
|
|
1183
|
+
var nextName;
|
|
1184
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1185
|
+
|
|
1186
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1187
|
+
|
|
1188
|
+
if (isArray(children)) {
|
|
1189
|
+
for (var i = 0; i < children.length; i++) {
|
|
1190
|
+
child = children[i];
|
|
1191
|
+
nextName = nextNamePrefix + getElementKey(child, i);
|
|
1192
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1193
|
+
}
|
|
1194
|
+
} else {
|
|
1195
|
+
var iteratorFn = getIteratorFn(children);
|
|
1196
|
+
|
|
1197
|
+
if (typeof iteratorFn === 'function') {
|
|
1198
|
+
var iterableChildren = children;
|
|
1199
|
+
|
|
1200
|
+
{
|
|
1201
|
+
// Warn about using Maps as children
|
|
1202
|
+
if (iteratorFn === iterableChildren.entries) {
|
|
1203
|
+
if (!didWarnAboutMaps) {
|
|
1204
|
+
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
didWarnAboutMaps = true;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
var iterator = iteratorFn.call(iterableChildren);
|
|
1212
|
+
var step;
|
|
1213
|
+
var ii = 0;
|
|
1214
|
+
|
|
1215
|
+
while (!(step = iterator.next()).done) {
|
|
1216
|
+
child = step.value;
|
|
1217
|
+
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
1218
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1219
|
+
}
|
|
1220
|
+
} else if (type === 'object') {
|
|
1221
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1222
|
+
var childrenString = String(children);
|
|
1223
|
+
throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.');
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
return subtreeCount;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Maps children that are typically specified as `props.children`.
|
|
1232
|
+
*
|
|
1233
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1234
|
+
*
|
|
1235
|
+
* The provided mapFunction(child, index) will be called for each
|
|
1236
|
+
* leaf child.
|
|
1237
|
+
*
|
|
1238
|
+
* @param {?*} children Children tree container.
|
|
1239
|
+
* @param {function(*, int)} func The map function.
|
|
1240
|
+
* @param {*} context Context for mapFunction.
|
|
1241
|
+
* @return {object} Object containing the ordered map of results.
|
|
1242
|
+
*/
|
|
1243
|
+
function mapChildren(children, func, context) {
|
|
1244
|
+
if (children == null) {
|
|
1245
|
+
return children;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
var result = [];
|
|
1249
|
+
var count = 0;
|
|
1250
|
+
mapIntoArray(children, result, '', '', function (child) {
|
|
1251
|
+
return func.call(context, child, count++);
|
|
1252
|
+
});
|
|
1253
|
+
return result;
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Count the number of children that are typically specified as
|
|
1257
|
+
* `props.children`.
|
|
1258
|
+
*
|
|
1259
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1260
|
+
*
|
|
1261
|
+
* @param {?*} children Children tree container.
|
|
1262
|
+
* @return {number} The number of children.
|
|
1263
|
+
*/
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
function countChildren(children) {
|
|
1267
|
+
var n = 0;
|
|
1268
|
+
mapChildren(children, function () {
|
|
1269
|
+
n++; // Don't return anything
|
|
1270
|
+
});
|
|
1271
|
+
return n;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* Iterates through children that are typically specified as `props.children`.
|
|
1276
|
+
*
|
|
1277
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1278
|
+
*
|
|
1279
|
+
* The provided forEachFunc(child, index) will be called for each
|
|
1280
|
+
* leaf child.
|
|
1281
|
+
*
|
|
1282
|
+
* @param {?*} children Children tree container.
|
|
1283
|
+
* @param {function(*, int)} forEachFunc
|
|
1284
|
+
* @param {*} forEachContext Context for forEachContext.
|
|
1285
|
+
*/
|
|
1286
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1287
|
+
mapChildren(children, function () {
|
|
1288
|
+
forEachFunc.apply(this, arguments); // Don't return anything.
|
|
1289
|
+
}, forEachContext);
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Flatten a children object (typically specified as `props.children`) and
|
|
1293
|
+
* return an array with appropriately re-keyed children.
|
|
1294
|
+
*
|
|
1295
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1296
|
+
*/
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
function toArray(children) {
|
|
1300
|
+
return mapChildren(children, function (child) {
|
|
1301
|
+
return child;
|
|
1302
|
+
}) || [];
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Returns the first child in a collection of children and verifies that there
|
|
1306
|
+
* is only one child in the collection.
|
|
1307
|
+
*
|
|
1308
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
1309
|
+
*
|
|
1310
|
+
* The current implementation of this function assumes that a single child gets
|
|
1311
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
|
1312
|
+
* abstract away the particular structure of children.
|
|
1313
|
+
*
|
|
1314
|
+
* @param {?object} children Child collection structure.
|
|
1315
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1316
|
+
* structure.
|
|
1317
|
+
*/
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
function onlyChild(children) {
|
|
1321
|
+
if (!isValidElement(children)) {
|
|
1322
|
+
throw new Error('React.Children.only expected to receive a single React element child.');
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
return children;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
function createContext(defaultValue) {
|
|
1329
|
+
// TODO: Second argument used to be an optional `calculateChangedBits`
|
|
1330
|
+
// function. Warn to reserve for future use?
|
|
1331
|
+
var context = {
|
|
1332
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
1333
|
+
// As a workaround to support multiple concurrent renderers, we categorize
|
|
1334
|
+
// some renderers as primary and others as secondary. We only expect
|
|
1335
|
+
// there to be two concurrent renderers at most: React Native (primary) and
|
|
1336
|
+
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
1337
|
+
// Secondary renderers store their context values on separate fields.
|
|
1338
|
+
_currentValue: defaultValue,
|
|
1339
|
+
_currentValue2: defaultValue,
|
|
1340
|
+
// Used to track how many concurrent renderers this context currently
|
|
1341
|
+
// supports within in a single renderer. Such as parallel server rendering.
|
|
1342
|
+
_threadCount: 0,
|
|
1343
|
+
// These are circular
|
|
1344
|
+
Provider: null,
|
|
1345
|
+
Consumer: null,
|
|
1346
|
+
// Add these to use same hidden class in VM as ServerContext
|
|
1347
|
+
_defaultValue: null,
|
|
1348
|
+
_globalName: null
|
|
1349
|
+
};
|
|
1350
|
+
context.Provider = {
|
|
1351
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
|
1352
|
+
_context: context
|
|
1353
|
+
};
|
|
1354
|
+
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
1355
|
+
var hasWarnedAboutUsingConsumerProvider = false;
|
|
1356
|
+
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
1357
|
+
|
|
1358
|
+
{
|
|
1359
|
+
// A separate object, but proxies back to the original context object for
|
|
1360
|
+
// backwards compatibility. It has a different $$typeof, so we can properly
|
|
1361
|
+
// warn for the incorrect usage of Context as a Consumer.
|
|
1362
|
+
var Consumer = {
|
|
1363
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
1364
|
+
_context: context
|
|
1365
|
+
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
1366
|
+
|
|
1367
|
+
Object.defineProperties(Consumer, {
|
|
1368
|
+
Provider: {
|
|
1369
|
+
get: function () {
|
|
1370
|
+
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1371
|
+
hasWarnedAboutUsingConsumerProvider = true;
|
|
1372
|
+
|
|
1373
|
+
error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
return context.Provider;
|
|
1377
|
+
},
|
|
1378
|
+
set: function (_Provider) {
|
|
1379
|
+
context.Provider = _Provider;
|
|
1380
|
+
}
|
|
1381
|
+
},
|
|
1382
|
+
_currentValue: {
|
|
1383
|
+
get: function () {
|
|
1384
|
+
return context._currentValue;
|
|
1385
|
+
},
|
|
1386
|
+
set: function (_currentValue) {
|
|
1387
|
+
context._currentValue = _currentValue;
|
|
1388
|
+
}
|
|
1389
|
+
},
|
|
1390
|
+
_currentValue2: {
|
|
1391
|
+
get: function () {
|
|
1392
|
+
return context._currentValue2;
|
|
1393
|
+
},
|
|
1394
|
+
set: function (_currentValue2) {
|
|
1395
|
+
context._currentValue2 = _currentValue2;
|
|
1396
|
+
}
|
|
1397
|
+
},
|
|
1398
|
+
_threadCount: {
|
|
1399
|
+
get: function () {
|
|
1400
|
+
return context._threadCount;
|
|
1401
|
+
},
|
|
1402
|
+
set: function (_threadCount) {
|
|
1403
|
+
context._threadCount = _threadCount;
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
Consumer: {
|
|
1407
|
+
get: function () {
|
|
1408
|
+
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1409
|
+
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1410
|
+
|
|
1411
|
+
error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
return context.Consumer;
|
|
1415
|
+
}
|
|
1416
|
+
},
|
|
1417
|
+
displayName: {
|
|
1418
|
+
get: function () {
|
|
1419
|
+
return context.displayName;
|
|
1420
|
+
},
|
|
1421
|
+
set: function (displayName) {
|
|
1422
|
+
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
1423
|
+
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
1424
|
+
|
|
1425
|
+
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1430
|
+
|
|
1431
|
+
context.Consumer = Consumer;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
{
|
|
1435
|
+
context._currentRenderer = null;
|
|
1436
|
+
context._currentRenderer2 = null;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
return context;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
var Uninitialized = -1;
|
|
1443
|
+
var Pending = 0;
|
|
1444
|
+
var Resolved = 1;
|
|
1445
|
+
var Rejected = 2;
|
|
1446
|
+
|
|
1447
|
+
function lazyInitializer(payload) {
|
|
1448
|
+
if (payload._status === Uninitialized) {
|
|
1449
|
+
var ctor = payload._result;
|
|
1450
|
+
var thenable = ctor(); // Transition to the next state.
|
|
1451
|
+
// This might throw either because it's missing or throws. If so, we treat it
|
|
1452
|
+
// as still uninitialized and try again next time. Which is the same as what
|
|
1453
|
+
// happens if the ctor or any wrappers processing the ctor throws. This might
|
|
1454
|
+
// end up fixing it if the resolution was a concurrency bug.
|
|
1455
|
+
|
|
1456
|
+
thenable.then(function (moduleObject) {
|
|
1457
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1458
|
+
// Transition to the next state.
|
|
1459
|
+
var resolved = payload;
|
|
1460
|
+
resolved._status = Resolved;
|
|
1461
|
+
resolved._result = moduleObject;
|
|
1462
|
+
}
|
|
1463
|
+
}, function (error) {
|
|
1464
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1465
|
+
// Transition to the next state.
|
|
1466
|
+
var rejected = payload;
|
|
1467
|
+
rejected._status = Rejected;
|
|
1468
|
+
rejected._result = error;
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
|
|
1472
|
+
if (payload._status === Uninitialized) {
|
|
1473
|
+
// In case, we're still uninitialized, then we're waiting for the thenable
|
|
1474
|
+
// to resolve. Set it as pending in the meantime.
|
|
1475
|
+
var pending = payload;
|
|
1476
|
+
pending._status = Pending;
|
|
1477
|
+
pending._result = thenable;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
if (payload._status === Resolved) {
|
|
1482
|
+
var moduleObject = payload._result;
|
|
1483
|
+
|
|
1484
|
+
{
|
|
1485
|
+
if (moduleObject === undefined) {
|
|
1486
|
+
error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
|
1487
|
+
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
{
|
|
1492
|
+
if (!('default' in moduleObject)) {
|
|
1493
|
+
error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
|
1494
|
+
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
return moduleObject.default;
|
|
1499
|
+
} else {
|
|
1500
|
+
throw payload._result;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
function lazy(ctor) {
|
|
1505
|
+
var payload = {
|
|
1506
|
+
// We use these fields to store the result.
|
|
1507
|
+
_status: Uninitialized,
|
|
1508
|
+
_result: ctor
|
|
1509
|
+
};
|
|
1510
|
+
var lazyType = {
|
|
1511
|
+
$$typeof: REACT_LAZY_TYPE,
|
|
1512
|
+
_payload: payload,
|
|
1513
|
+
_init: lazyInitializer
|
|
1514
|
+
};
|
|
1515
|
+
|
|
1516
|
+
{
|
|
1517
|
+
// In production, this would just set it on the object.
|
|
1518
|
+
var defaultProps;
|
|
1519
|
+
var propTypes; // $FlowFixMe
|
|
1520
|
+
|
|
1521
|
+
Object.defineProperties(lazyType, {
|
|
1522
|
+
defaultProps: {
|
|
1523
|
+
configurable: true,
|
|
1524
|
+
get: function () {
|
|
1525
|
+
return defaultProps;
|
|
1526
|
+
},
|
|
1527
|
+
set: function (newDefaultProps) {
|
|
1528
|
+
error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1529
|
+
|
|
1530
|
+
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1531
|
+
// $FlowFixMe
|
|
1532
|
+
|
|
1533
|
+
Object.defineProperty(lazyType, 'defaultProps', {
|
|
1534
|
+
enumerable: true
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
},
|
|
1538
|
+
propTypes: {
|
|
1539
|
+
configurable: true,
|
|
1540
|
+
get: function () {
|
|
1541
|
+
return propTypes;
|
|
1542
|
+
},
|
|
1543
|
+
set: function (newPropTypes) {
|
|
1544
|
+
error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1545
|
+
|
|
1546
|
+
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1547
|
+
// $FlowFixMe
|
|
1548
|
+
|
|
1549
|
+
Object.defineProperty(lazyType, 'propTypes', {
|
|
1550
|
+
enumerable: true
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
return lazyType;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
function forwardRef(render) {
|
|
1561
|
+
{
|
|
1562
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1563
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1564
|
+
} else if (typeof render !== 'function') {
|
|
1565
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1566
|
+
} else {
|
|
1567
|
+
if (render.length !== 0 && render.length !== 2) {
|
|
1568
|
+
error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
if (render != null) {
|
|
1573
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
|
1574
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
var elementType = {
|
|
1580
|
+
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1581
|
+
render: render
|
|
1582
|
+
};
|
|
1583
|
+
|
|
1584
|
+
{
|
|
1585
|
+
var ownName;
|
|
1586
|
+
Object.defineProperty(elementType, 'displayName', {
|
|
1587
|
+
enumerable: false,
|
|
1588
|
+
configurable: true,
|
|
1589
|
+
get: function () {
|
|
1590
|
+
return ownName;
|
|
1591
|
+
},
|
|
1592
|
+
set: function (name) {
|
|
1593
|
+
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
1594
|
+
// because the component may be used elsewhere.
|
|
1595
|
+
// But it's nice for anonymous functions to inherit the name,
|
|
1596
|
+
// so that our component-stack generation logic will display their frames.
|
|
1597
|
+
// An anonymous function generally suggests a pattern like:
|
|
1598
|
+
// React.forwardRef((props, ref) => {...});
|
|
1599
|
+
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1600
|
+
|
|
1601
|
+
if (!render.name && !render.displayName) {
|
|
1602
|
+
render.displayName = name;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
return elementType;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
var REACT_MODULE_REFERENCE;
|
|
1612
|
+
|
|
1613
|
+
{
|
|
1614
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
function isValidElementType(type) {
|
|
1618
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
1619
|
+
return true;
|
|
1620
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
1624
|
+
return true;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
if (typeof type === 'object' && type !== null) {
|
|
1628
|
+
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 || // This needs to include all possible module reference object
|
|
1629
|
+
// types supported by any Flight configuration anywhere since
|
|
1630
|
+
// we don't know which Flight build this will end up being used
|
|
1631
|
+
// with.
|
|
1632
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
1633
|
+
return true;
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
return false;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
function memo(type, compare) {
|
|
1641
|
+
{
|
|
1642
|
+
if (!isValidElementType(type)) {
|
|
1643
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
var elementType = {
|
|
1648
|
+
$$typeof: REACT_MEMO_TYPE,
|
|
1649
|
+
type: type,
|
|
1650
|
+
compare: compare === undefined ? null : compare
|
|
1651
|
+
};
|
|
1652
|
+
|
|
1653
|
+
{
|
|
1654
|
+
var ownName;
|
|
1655
|
+
Object.defineProperty(elementType, 'displayName', {
|
|
1656
|
+
enumerable: false,
|
|
1657
|
+
configurable: true,
|
|
1658
|
+
get: function () {
|
|
1659
|
+
return ownName;
|
|
1660
|
+
},
|
|
1661
|
+
set: function (name) {
|
|
1662
|
+
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
1663
|
+
// because the component may be used elsewhere.
|
|
1664
|
+
// But it's nice for anonymous functions to inherit the name,
|
|
1665
|
+
// so that our component-stack generation logic will display their frames.
|
|
1666
|
+
// An anonymous function generally suggests a pattern like:
|
|
1667
|
+
// React.memo((props) => {...});
|
|
1668
|
+
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1669
|
+
|
|
1670
|
+
if (!type.name && !type.displayName) {
|
|
1671
|
+
type.displayName = name;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
return elementType;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
function resolveDispatcher() {
|
|
1681
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
|
1682
|
+
|
|
1683
|
+
{
|
|
1684
|
+
if (dispatcher === null) {
|
|
1685
|
+
error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');
|
|
1686
|
+
}
|
|
1687
|
+
} // Will result in a null access error if accessed outside render phase. We
|
|
1688
|
+
// intentionally don't throw our own error because this is in a hot path.
|
|
1689
|
+
// Also helps ensure this is inlined.
|
|
1690
|
+
|
|
1691
|
+
|
|
1692
|
+
return dispatcher;
|
|
1693
|
+
}
|
|
1694
|
+
function useContext(Context) {
|
|
1695
|
+
var dispatcher = resolveDispatcher();
|
|
1696
|
+
|
|
1697
|
+
{
|
|
1698
|
+
// TODO: add a more generic warning for invalid values.
|
|
1699
|
+
if (Context._context !== undefined) {
|
|
1700
|
+
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1701
|
+
// and nobody should be using this in existing code.
|
|
1702
|
+
|
|
1703
|
+
if (realContext.Consumer === Context) {
|
|
1704
|
+
error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
|
1705
|
+
} else if (realContext.Provider === Context) {
|
|
1706
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
return dispatcher.useContext(Context);
|
|
1712
|
+
}
|
|
1713
|
+
function useState(initialState) {
|
|
1714
|
+
var dispatcher = resolveDispatcher();
|
|
1715
|
+
return dispatcher.useState(initialState);
|
|
1716
|
+
}
|
|
1717
|
+
function useReducer(reducer, initialArg, init) {
|
|
1718
|
+
var dispatcher = resolveDispatcher();
|
|
1719
|
+
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1720
|
+
}
|
|
1721
|
+
function useRef(initialValue) {
|
|
1722
|
+
var dispatcher = resolveDispatcher();
|
|
1723
|
+
return dispatcher.useRef(initialValue);
|
|
1724
|
+
}
|
|
1725
|
+
function useEffect(create, deps) {
|
|
1726
|
+
var dispatcher = resolveDispatcher();
|
|
1727
|
+
return dispatcher.useEffect(create, deps);
|
|
1728
|
+
}
|
|
1729
|
+
function useInsertionEffect(create, deps) {
|
|
1730
|
+
var dispatcher = resolveDispatcher();
|
|
1731
|
+
return dispatcher.useInsertionEffect(create, deps);
|
|
1732
|
+
}
|
|
1733
|
+
function useLayoutEffect(create, deps) {
|
|
1734
|
+
var dispatcher = resolveDispatcher();
|
|
1735
|
+
return dispatcher.useLayoutEffect(create, deps);
|
|
1736
|
+
}
|
|
1737
|
+
function useCallback(callback, deps) {
|
|
1738
|
+
var dispatcher = resolveDispatcher();
|
|
1739
|
+
return dispatcher.useCallback(callback, deps);
|
|
1740
|
+
}
|
|
1741
|
+
function useMemo(create, deps) {
|
|
1742
|
+
var dispatcher = resolveDispatcher();
|
|
1743
|
+
return dispatcher.useMemo(create, deps);
|
|
1744
|
+
}
|
|
1745
|
+
function useImperativeHandle(ref, create, deps) {
|
|
1746
|
+
var dispatcher = resolveDispatcher();
|
|
1747
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1748
|
+
}
|
|
1749
|
+
function useDebugValue(value, formatterFn) {
|
|
1750
|
+
{
|
|
1751
|
+
var dispatcher = resolveDispatcher();
|
|
1752
|
+
return dispatcher.useDebugValue(value, formatterFn);
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
function useTransition() {
|
|
1756
|
+
var dispatcher = resolveDispatcher();
|
|
1757
|
+
return dispatcher.useTransition();
|
|
1758
|
+
}
|
|
1759
|
+
function useDeferredValue(value) {
|
|
1760
|
+
var dispatcher = resolveDispatcher();
|
|
1761
|
+
return dispatcher.useDeferredValue(value);
|
|
1762
|
+
}
|
|
1763
|
+
function useId() {
|
|
1764
|
+
var dispatcher = resolveDispatcher();
|
|
1765
|
+
return dispatcher.useId();
|
|
1766
|
+
}
|
|
1767
|
+
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
1768
|
+
var dispatcher = resolveDispatcher();
|
|
1769
|
+
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
1773
|
+
// replaying on render function. This currently only patches the object
|
|
1774
|
+
// lazily which won't cover if the log function was extracted eagerly.
|
|
1775
|
+
// We could also eagerly patch the method.
|
|
1776
|
+
var disabledDepth = 0;
|
|
1777
|
+
var prevLog;
|
|
1778
|
+
var prevInfo;
|
|
1779
|
+
var prevWarn;
|
|
1780
|
+
var prevError;
|
|
1781
|
+
var prevGroup;
|
|
1782
|
+
var prevGroupCollapsed;
|
|
1783
|
+
var prevGroupEnd;
|
|
1784
|
+
|
|
1785
|
+
function disabledLog() {}
|
|
1786
|
+
|
|
1787
|
+
disabledLog.__reactDisabledLog = true;
|
|
1788
|
+
function disableLogs() {
|
|
1789
|
+
{
|
|
1790
|
+
if (disabledDepth === 0) {
|
|
1791
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
1792
|
+
prevLog = console.log;
|
|
1793
|
+
prevInfo = console.info;
|
|
1794
|
+
prevWarn = console.warn;
|
|
1795
|
+
prevError = console.error;
|
|
1796
|
+
prevGroup = console.group;
|
|
1797
|
+
prevGroupCollapsed = console.groupCollapsed;
|
|
1798
|
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
1799
|
+
|
|
1800
|
+
var props = {
|
|
1801
|
+
configurable: true,
|
|
1802
|
+
enumerable: true,
|
|
1803
|
+
value: disabledLog,
|
|
1804
|
+
writable: true
|
|
1805
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1806
|
+
|
|
1807
|
+
Object.defineProperties(console, {
|
|
1808
|
+
info: props,
|
|
1809
|
+
log: props,
|
|
1810
|
+
warn: props,
|
|
1811
|
+
error: props,
|
|
1812
|
+
group: props,
|
|
1813
|
+
groupCollapsed: props,
|
|
1814
|
+
groupEnd: props
|
|
1815
|
+
});
|
|
1816
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
disabledDepth++;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
function reenableLogs() {
|
|
1823
|
+
{
|
|
1824
|
+
disabledDepth--;
|
|
1825
|
+
|
|
1826
|
+
if (disabledDepth === 0) {
|
|
1827
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
1828
|
+
var props = {
|
|
1829
|
+
configurable: true,
|
|
1830
|
+
enumerable: true,
|
|
1831
|
+
writable: true
|
|
1832
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1833
|
+
|
|
1834
|
+
Object.defineProperties(console, {
|
|
1835
|
+
log: assign({}, props, {
|
|
1836
|
+
value: prevLog
|
|
1837
|
+
}),
|
|
1838
|
+
info: assign({}, props, {
|
|
1839
|
+
value: prevInfo
|
|
1840
|
+
}),
|
|
1841
|
+
warn: assign({}, props, {
|
|
1842
|
+
value: prevWarn
|
|
1843
|
+
}),
|
|
1844
|
+
error: assign({}, props, {
|
|
1845
|
+
value: prevError
|
|
1846
|
+
}),
|
|
1847
|
+
group: assign({}, props, {
|
|
1848
|
+
value: prevGroup
|
|
1849
|
+
}),
|
|
1850
|
+
groupCollapsed: assign({}, props, {
|
|
1851
|
+
value: prevGroupCollapsed
|
|
1852
|
+
}),
|
|
1853
|
+
groupEnd: assign({}, props, {
|
|
1854
|
+
value: prevGroupEnd
|
|
1855
|
+
})
|
|
1856
|
+
});
|
|
1857
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
if (disabledDepth < 0) {
|
|
1861
|
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1867
|
+
var prefix;
|
|
1868
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1869
|
+
{
|
|
1870
|
+
if (prefix === undefined) {
|
|
1871
|
+
// Extract the VM specific prefix used by each line.
|
|
1872
|
+
try {
|
|
1873
|
+
throw Error();
|
|
1874
|
+
} catch (x) {
|
|
1875
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
1876
|
+
prefix = match && match[1] || '';
|
|
1877
|
+
}
|
|
1878
|
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
1879
|
+
|
|
1880
|
+
|
|
1881
|
+
return '\n' + prefix + name;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
var reentry = false;
|
|
1885
|
+
var componentFrameCache;
|
|
1886
|
+
|
|
1887
|
+
{
|
|
1888
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
1889
|
+
componentFrameCache = new PossiblyWeakMap();
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
function describeNativeComponentFrame(fn, construct) {
|
|
1893
|
+
// If something asked for a stack inside a fake render, it should get ignored.
|
|
1894
|
+
if ( !fn || reentry) {
|
|
1895
|
+
return '';
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
{
|
|
1899
|
+
var frame = componentFrameCache.get(fn);
|
|
1900
|
+
|
|
1901
|
+
if (frame !== undefined) {
|
|
1902
|
+
return frame;
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
var control;
|
|
1907
|
+
reentry = true;
|
|
1908
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
1909
|
+
|
|
1910
|
+
Error.prepareStackTrace = undefined;
|
|
1911
|
+
var previousDispatcher;
|
|
1912
|
+
|
|
1913
|
+
{
|
|
1914
|
+
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
1915
|
+
// for warnings.
|
|
1916
|
+
|
|
1917
|
+
ReactCurrentDispatcher$1.current = null;
|
|
1918
|
+
disableLogs();
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
try {
|
|
1922
|
+
// This should throw.
|
|
1923
|
+
if (construct) {
|
|
1924
|
+
// Something should be setting the props in the constructor.
|
|
1925
|
+
var Fake = function () {
|
|
1926
|
+
throw Error();
|
|
1927
|
+
}; // $FlowFixMe
|
|
1928
|
+
|
|
1929
|
+
|
|
1930
|
+
Object.defineProperty(Fake.prototype, 'props', {
|
|
1931
|
+
set: function () {
|
|
1932
|
+
// We use a throwing setter instead of frozen or non-writable props
|
|
1933
|
+
// because that won't throw in a non-strict mode function.
|
|
1934
|
+
throw Error();
|
|
1935
|
+
}
|
|
1936
|
+
});
|
|
1937
|
+
|
|
1938
|
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
1939
|
+
// We construct a different control for this case to include any extra
|
|
1940
|
+
// frames added by the construct call.
|
|
1941
|
+
try {
|
|
1942
|
+
Reflect.construct(Fake, []);
|
|
1943
|
+
} catch (x) {
|
|
1944
|
+
control = x;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
Reflect.construct(fn, [], Fake);
|
|
1948
|
+
} else {
|
|
1949
|
+
try {
|
|
1950
|
+
Fake.call();
|
|
1951
|
+
} catch (x) {
|
|
1952
|
+
control = x;
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
fn.call(Fake.prototype);
|
|
1956
|
+
}
|
|
1957
|
+
} else {
|
|
1958
|
+
try {
|
|
1959
|
+
throw Error();
|
|
1960
|
+
} catch (x) {
|
|
1961
|
+
control = x;
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
fn();
|
|
1965
|
+
}
|
|
1966
|
+
} catch (sample) {
|
|
1967
|
+
// This is inlined manually because closure doesn't do it for us.
|
|
1968
|
+
if (sample && control && typeof sample.stack === 'string') {
|
|
1969
|
+
// This extracts the first frame from the sample that isn't also in the control.
|
|
1970
|
+
// Skipping one frame that we assume is the frame that calls the two.
|
|
1971
|
+
var sampleLines = sample.stack.split('\n');
|
|
1972
|
+
var controlLines = control.stack.split('\n');
|
|
1973
|
+
var s = sampleLines.length - 1;
|
|
1974
|
+
var c = controlLines.length - 1;
|
|
1975
|
+
|
|
1976
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
1977
|
+
// We expect at least one stack frame to be shared.
|
|
1978
|
+
// Typically this will be the root most one. However, stack frames may be
|
|
1979
|
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
1980
|
+
// earlier than the other. We assume that the sample is longer or the same
|
|
1981
|
+
// and there for cut off earlier. So we should find the root most frame in
|
|
1982
|
+
// the sample somewhere in the control.
|
|
1983
|
+
c--;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
|
1987
|
+
// Next we find the first one that isn't the same which should be the
|
|
1988
|
+
// frame that called our sample function and the control.
|
|
1989
|
+
if (sampleLines[s] !== controlLines[c]) {
|
|
1990
|
+
// In V8, the first line is describing the message but other VMs don't.
|
|
1991
|
+
// If we're about to return the first line, and the control is also on the same
|
|
1992
|
+
// line, that's a pretty good indicator that our sample threw at same line as
|
|
1993
|
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
1994
|
+
// This can happen if you passed a class to function component, or non-function.
|
|
1995
|
+
if (s !== 1 || c !== 1) {
|
|
1996
|
+
do {
|
|
1997
|
+
s--;
|
|
1998
|
+
c--; // We may still have similar intermediate frames from the construct call.
|
|
1999
|
+
// The next one that isn't the same should be our match though.
|
|
2000
|
+
|
|
2001
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
2002
|
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
2003
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
2004
|
+
// but we have a user-provided "displayName"
|
|
2005
|
+
// splice it in to make the stack more readable.
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
2009
|
+
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
{
|
|
2013
|
+
if (typeof fn === 'function') {
|
|
2014
|
+
componentFrameCache.set(fn, _frame);
|
|
2015
|
+
}
|
|
2016
|
+
} // Return the line we found.
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
return _frame;
|
|
2020
|
+
}
|
|
2021
|
+
} while (s >= 1 && c >= 0);
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
break;
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
} finally {
|
|
2029
|
+
reentry = false;
|
|
2030
|
+
|
|
2031
|
+
{
|
|
2032
|
+
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
2033
|
+
reenableLogs();
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
2037
|
+
} // Fallback to just using the name if we couldn't make it throw.
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
var name = fn ? fn.displayName || fn.name : '';
|
|
2041
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
2042
|
+
|
|
2043
|
+
{
|
|
2044
|
+
if (typeof fn === 'function') {
|
|
2045
|
+
componentFrameCache.set(fn, syntheticFrame);
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
return syntheticFrame;
|
|
2050
|
+
}
|
|
2051
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
2052
|
+
{
|
|
2053
|
+
return describeNativeComponentFrame(fn, false);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
function shouldConstruct(Component) {
|
|
2058
|
+
var prototype = Component.prototype;
|
|
2059
|
+
return !!(prototype && prototype.isReactComponent);
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
2063
|
+
|
|
2064
|
+
if (type == null) {
|
|
2065
|
+
return '';
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
if (typeof type === 'function') {
|
|
2069
|
+
{
|
|
2070
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
if (typeof type === 'string') {
|
|
2075
|
+
return describeBuiltInComponentFrame(type);
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
switch (type) {
|
|
2079
|
+
case REACT_SUSPENSE_TYPE:
|
|
2080
|
+
return describeBuiltInComponentFrame('Suspense');
|
|
2081
|
+
|
|
2082
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
2083
|
+
return describeBuiltInComponentFrame('SuspenseList');
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
if (typeof type === 'object') {
|
|
2087
|
+
switch (type.$$typeof) {
|
|
2088
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2089
|
+
return describeFunctionComponentFrame(type.render);
|
|
2090
|
+
|
|
2091
|
+
case REACT_MEMO_TYPE:
|
|
2092
|
+
// Memo may contain any component type so we recursively resolve it.
|
|
2093
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
2094
|
+
|
|
2095
|
+
case REACT_LAZY_TYPE:
|
|
2096
|
+
{
|
|
2097
|
+
var lazyComponent = type;
|
|
2098
|
+
var payload = lazyComponent._payload;
|
|
2099
|
+
var init = lazyComponent._init;
|
|
2100
|
+
|
|
2101
|
+
try {
|
|
2102
|
+
// Lazy may contain any component type so we recursively resolve it.
|
|
2103
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
2104
|
+
} catch (x) {}
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
return '';
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
var loggedTypeFailures = {};
|
|
2113
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
2114
|
+
|
|
2115
|
+
function setCurrentlyValidatingElement(element) {
|
|
2116
|
+
{
|
|
2117
|
+
if (element) {
|
|
2118
|
+
var owner = element._owner;
|
|
2119
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2120
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
2121
|
+
} else {
|
|
2122
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
2128
|
+
{
|
|
2129
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
2130
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
2131
|
+
|
|
2132
|
+
for (var typeSpecName in typeSpecs) {
|
|
2133
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
2134
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
2135
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
2136
|
+
// After these have been cleaned up, we'll let them throw.
|
|
2137
|
+
|
|
2138
|
+
try {
|
|
2139
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
2140
|
+
// behavior as without this statement except with a better message.
|
|
2141
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
2142
|
+
// eslint-disable-next-line react-internal/prod-error-codes
|
|
2143
|
+
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`.');
|
|
2144
|
+
err.name = 'Invariant Violation';
|
|
2145
|
+
throw err;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
2149
|
+
} catch (ex) {
|
|
2150
|
+
error$1 = ex;
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
2154
|
+
setCurrentlyValidatingElement(element);
|
|
2155
|
+
|
|
2156
|
+
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);
|
|
2157
|
+
|
|
2158
|
+
setCurrentlyValidatingElement(null);
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
2162
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
2163
|
+
// same error.
|
|
2164
|
+
loggedTypeFailures[error$1.message] = true;
|
|
2165
|
+
setCurrentlyValidatingElement(element);
|
|
2166
|
+
|
|
2167
|
+
error('Failed %s type: %s', location, error$1.message);
|
|
2168
|
+
|
|
2169
|
+
setCurrentlyValidatingElement(null);
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
2177
|
+
{
|
|
2178
|
+
if (element) {
|
|
2179
|
+
var owner = element._owner;
|
|
2180
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2181
|
+
setExtraStackFrame(stack);
|
|
2182
|
+
} else {
|
|
2183
|
+
setExtraStackFrame(null);
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
var propTypesMisspellWarningShown;
|
|
2189
|
+
|
|
2190
|
+
{
|
|
2191
|
+
propTypesMisspellWarningShown = false;
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
function getDeclarationErrorAddendum() {
|
|
2195
|
+
if (ReactCurrentOwner.current) {
|
|
2196
|
+
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
2197
|
+
|
|
2198
|
+
if (name) {
|
|
2199
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
return '';
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
function getSourceInfoErrorAddendum(source) {
|
|
2207
|
+
if (source !== undefined) {
|
|
2208
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
2209
|
+
var lineNumber = source.lineNumber;
|
|
2210
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
return '';
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
2217
|
+
if (elementProps !== null && elementProps !== undefined) {
|
|
2218
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
return '';
|
|
2222
|
+
}
|
|
2223
|
+
/**
|
|
2224
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
2225
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
2226
|
+
* updates.
|
|
2227
|
+
*/
|
|
2228
|
+
|
|
2229
|
+
|
|
2230
|
+
var ownerHasKeyUseWarning = {};
|
|
2231
|
+
|
|
2232
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
2233
|
+
var info = getDeclarationErrorAddendum();
|
|
2234
|
+
|
|
2235
|
+
if (!info) {
|
|
2236
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
2237
|
+
|
|
2238
|
+
if (parentName) {
|
|
2239
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
return info;
|
|
2244
|
+
}
|
|
2245
|
+
/**
|
|
2246
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
2247
|
+
* This element is in an array. The array could grow and shrink or be
|
|
2248
|
+
* reordered. All children that haven't already been validated are required to
|
|
2249
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
2250
|
+
* will only be shown once.
|
|
2251
|
+
*
|
|
2252
|
+
* @internal
|
|
2253
|
+
* @param {ReactElement} element Element that requires a key.
|
|
2254
|
+
* @param {*} parentType element's parent's type.
|
|
2255
|
+
*/
|
|
2256
|
+
|
|
2257
|
+
|
|
2258
|
+
function validateExplicitKey(element, parentType) {
|
|
2259
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
element._store.validated = true;
|
|
2264
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2265
|
+
|
|
2266
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2267
|
+
return;
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
2271
|
+
// property, it may be the creator of the child that's responsible for
|
|
2272
|
+
// assigning it a key.
|
|
2273
|
+
|
|
2274
|
+
var childOwner = '';
|
|
2275
|
+
|
|
2276
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
2277
|
+
// Give the component that originally created this child.
|
|
2278
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
{
|
|
2282
|
+
setCurrentlyValidatingElement$1(element);
|
|
2283
|
+
|
|
2284
|
+
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);
|
|
2285
|
+
|
|
2286
|
+
setCurrentlyValidatingElement$1(null);
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* Ensure that every element either is passed in a static location, in an
|
|
2291
|
+
* array with an explicit keys property defined, or in an object literal
|
|
2292
|
+
* with valid key property.
|
|
2293
|
+
*
|
|
2294
|
+
* @internal
|
|
2295
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
2296
|
+
* @param {*} parentType node's parent's type.
|
|
2297
|
+
*/
|
|
2298
|
+
|
|
2299
|
+
|
|
2300
|
+
function validateChildKeys(node, parentType) {
|
|
2301
|
+
if (typeof node !== 'object') {
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
if (isArray(node)) {
|
|
2306
|
+
for (var i = 0; i < node.length; i++) {
|
|
2307
|
+
var child = node[i];
|
|
2308
|
+
|
|
2309
|
+
if (isValidElement(child)) {
|
|
2310
|
+
validateExplicitKey(child, parentType);
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
} else if (isValidElement(node)) {
|
|
2314
|
+
// This element was passed in a valid location.
|
|
2315
|
+
if (node._store) {
|
|
2316
|
+
node._store.validated = true;
|
|
2317
|
+
}
|
|
2318
|
+
} else if (node) {
|
|
2319
|
+
var iteratorFn = getIteratorFn(node);
|
|
2320
|
+
|
|
2321
|
+
if (typeof iteratorFn === 'function') {
|
|
2322
|
+
// Entry iterators used to provide implicit keys,
|
|
2323
|
+
// but now we print a separate warning for them later.
|
|
2324
|
+
if (iteratorFn !== node.entries) {
|
|
2325
|
+
var iterator = iteratorFn.call(node);
|
|
2326
|
+
var step;
|
|
2327
|
+
|
|
2328
|
+
while (!(step = iterator.next()).done) {
|
|
2329
|
+
if (isValidElement(step.value)) {
|
|
2330
|
+
validateExplicitKey(step.value, parentType);
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
/**
|
|
2338
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
2339
|
+
* provided by the type.
|
|
2340
|
+
*
|
|
2341
|
+
* @param {ReactElement} element
|
|
2342
|
+
*/
|
|
2343
|
+
|
|
2344
|
+
|
|
2345
|
+
function validatePropTypes(element) {
|
|
2346
|
+
{
|
|
2347
|
+
var type = element.type;
|
|
2348
|
+
|
|
2349
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
2350
|
+
return;
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
var propTypes;
|
|
2354
|
+
|
|
2355
|
+
if (typeof type === 'function') {
|
|
2356
|
+
propTypes = type.propTypes;
|
|
2357
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
2358
|
+
// Inner props are checked in the reconciler.
|
|
2359
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
2360
|
+
propTypes = type.propTypes;
|
|
2361
|
+
} else {
|
|
2362
|
+
return;
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
if (propTypes) {
|
|
2366
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
|
2367
|
+
var name = getComponentNameFromType(type);
|
|
2368
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
2369
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2370
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
2371
|
+
|
|
2372
|
+
var _name = getComponentNameFromType(type);
|
|
2373
|
+
|
|
2374
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2378
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
/**
|
|
2383
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
2384
|
+
* @param {ReactElement} fragment
|
|
2385
|
+
*/
|
|
2386
|
+
|
|
2387
|
+
|
|
2388
|
+
function validateFragmentProps(fragment) {
|
|
2389
|
+
{
|
|
2390
|
+
var keys = Object.keys(fragment.props);
|
|
2391
|
+
|
|
2392
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2393
|
+
var key = keys[i];
|
|
2394
|
+
|
|
2395
|
+
if (key !== 'children' && key !== 'key') {
|
|
2396
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
2397
|
+
|
|
2398
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2399
|
+
|
|
2400
|
+
setCurrentlyValidatingElement$1(null);
|
|
2401
|
+
break;
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
if (fragment.ref !== null) {
|
|
2406
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
2407
|
+
|
|
2408
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2409
|
+
|
|
2410
|
+
setCurrentlyValidatingElement$1(null);
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
function createElementWithValidation(type, props, children) {
|
|
2415
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
2416
|
+
// succeed and there will likely be errors in render.
|
|
2417
|
+
|
|
2418
|
+
if (!validType) {
|
|
2419
|
+
var info = '';
|
|
2420
|
+
|
|
2421
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2422
|
+
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.";
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
2426
|
+
|
|
2427
|
+
if (sourceInfo) {
|
|
2428
|
+
info += sourceInfo;
|
|
2429
|
+
} else {
|
|
2430
|
+
info += getDeclarationErrorAddendum();
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
var typeString;
|
|
2434
|
+
|
|
2435
|
+
if (type === null) {
|
|
2436
|
+
typeString = 'null';
|
|
2437
|
+
} else if (isArray(type)) {
|
|
2438
|
+
typeString = 'array';
|
|
2439
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2440
|
+
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
2441
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2442
|
+
} else {
|
|
2443
|
+
typeString = typeof type;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
{
|
|
2447
|
+
error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
2452
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2453
|
+
|
|
2454
|
+
if (element == null) {
|
|
2455
|
+
return element;
|
|
2456
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
2457
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2458
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
2459
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2460
|
+
// fixed, the key warnings will appear.)
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
if (validType) {
|
|
2464
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
2465
|
+
validateChildKeys(arguments[i], type);
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
2470
|
+
validateFragmentProps(element);
|
|
2471
|
+
} else {
|
|
2472
|
+
validatePropTypes(element);
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
return element;
|
|
2476
|
+
}
|
|
2477
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
|
2478
|
+
function createFactoryWithValidation(type) {
|
|
2479
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2480
|
+
validatedFactory.type = type;
|
|
2481
|
+
|
|
2482
|
+
{
|
|
2483
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
2484
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
|
2485
|
+
|
|
2486
|
+
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
2487
|
+
} // Legacy hook: remove it
|
|
2488
|
+
|
|
2489
|
+
|
|
2490
|
+
Object.defineProperty(validatedFactory, 'type', {
|
|
2491
|
+
enumerable: false,
|
|
2492
|
+
get: function () {
|
|
2493
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2494
|
+
|
|
2495
|
+
Object.defineProperty(this, 'type', {
|
|
2496
|
+
value: type
|
|
2497
|
+
});
|
|
2498
|
+
return type;
|
|
2499
|
+
}
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
return validatedFactory;
|
|
2504
|
+
}
|
|
2505
|
+
function cloneElementWithValidation(element, props, children) {
|
|
2506
|
+
var newElement = cloneElement.apply(this, arguments);
|
|
2507
|
+
|
|
2508
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
2509
|
+
validateChildKeys(arguments[i], newElement.type);
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
validatePropTypes(newElement);
|
|
2513
|
+
return newElement;
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
function startTransition(scope, options) {
|
|
2517
|
+
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
2518
|
+
ReactCurrentBatchConfig.transition = {};
|
|
2519
|
+
var currentTransition = ReactCurrentBatchConfig.transition;
|
|
2520
|
+
|
|
2521
|
+
{
|
|
2522
|
+
ReactCurrentBatchConfig.transition._updatedFibers = new Set();
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
try {
|
|
2526
|
+
scope();
|
|
2527
|
+
} finally {
|
|
2528
|
+
ReactCurrentBatchConfig.transition = prevTransition;
|
|
2529
|
+
|
|
2530
|
+
{
|
|
2531
|
+
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
2532
|
+
var updatedFibersCount = currentTransition._updatedFibers.size;
|
|
2533
|
+
|
|
2534
|
+
if (updatedFibersCount > 10) {
|
|
2535
|
+
warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.');
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
currentTransition._updatedFibers.clear();
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
var didWarnAboutMessageChannel = false;
|
|
2545
|
+
var enqueueTaskImpl = null;
|
|
2546
|
+
function enqueueTask(task) {
|
|
2547
|
+
if (enqueueTaskImpl === null) {
|
|
2548
|
+
try {
|
|
2549
|
+
// read require off the module object to get around the bundlers.
|
|
2550
|
+
// we don't want them to detect a require and bundle a Node polyfill.
|
|
2551
|
+
var requireString = ('require' + Math.random()).slice(0, 7);
|
|
2552
|
+
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
|
|
2553
|
+
// version of setImmediate, bypassing fake timers if any.
|
|
2554
|
+
|
|
2555
|
+
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
|
2556
|
+
} catch (_err) {
|
|
2557
|
+
// we're in a browser
|
|
2558
|
+
// we can't use regular timers because they may still be faked
|
|
2559
|
+
// so we try MessageChannel+postMessage instead
|
|
2560
|
+
enqueueTaskImpl = function (callback) {
|
|
2561
|
+
{
|
|
2562
|
+
if (didWarnAboutMessageChannel === false) {
|
|
2563
|
+
didWarnAboutMessageChannel = true;
|
|
2564
|
+
|
|
2565
|
+
if (typeof MessageChannel === 'undefined') {
|
|
2566
|
+
error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
var channel = new MessageChannel();
|
|
2572
|
+
channel.port1.onmessage = callback;
|
|
2573
|
+
channel.port2.postMessage(undefined);
|
|
2574
|
+
};
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
return enqueueTaskImpl(task);
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
var actScopeDepth = 0;
|
|
2582
|
+
var didWarnNoAwaitAct = false;
|
|
2583
|
+
function act(callback) {
|
|
2584
|
+
{
|
|
2585
|
+
// `act` calls can be nested, so we track the depth. This represents the
|
|
2586
|
+
// number of `act` scopes on the stack.
|
|
2587
|
+
var prevActScopeDepth = actScopeDepth;
|
|
2588
|
+
actScopeDepth++;
|
|
2589
|
+
|
|
2590
|
+
if (ReactCurrentActQueue.current === null) {
|
|
2591
|
+
// This is the outermost `act` scope. Initialize the queue. The reconciler
|
|
2592
|
+
// will detect the queue and use it instead of Scheduler.
|
|
2593
|
+
ReactCurrentActQueue.current = [];
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
|
2597
|
+
var result;
|
|
2598
|
+
|
|
2599
|
+
try {
|
|
2600
|
+
// Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
|
2601
|
+
// set to `true` while the given callback is executed, not for updates
|
|
2602
|
+
// triggered during an async event, because this is how the legacy
|
|
2603
|
+
// implementation of `act` behaved.
|
|
2604
|
+
ReactCurrentActQueue.isBatchingLegacy = true;
|
|
2605
|
+
result = callback(); // Replicate behavior of original `act` implementation in legacy mode,
|
|
2606
|
+
// which flushed updates immediately after the scope function exits, even
|
|
2607
|
+
// if it's an async function.
|
|
2608
|
+
|
|
2609
|
+
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
2610
|
+
var queue = ReactCurrentActQueue.current;
|
|
2611
|
+
|
|
2612
|
+
if (queue !== null) {
|
|
2613
|
+
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
|
2614
|
+
flushActQueue(queue);
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
} catch (error) {
|
|
2618
|
+
popActScope(prevActScopeDepth);
|
|
2619
|
+
throw error;
|
|
2620
|
+
} finally {
|
|
2621
|
+
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
|
2625
|
+
var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
|
|
2626
|
+
// for it to resolve before exiting the current scope.
|
|
2627
|
+
|
|
2628
|
+
var wasAwaited = false;
|
|
2629
|
+
var thenable = {
|
|
2630
|
+
then: function (resolve, reject) {
|
|
2631
|
+
wasAwaited = true;
|
|
2632
|
+
thenableResult.then(function (returnValue) {
|
|
2633
|
+
popActScope(prevActScopeDepth);
|
|
2634
|
+
|
|
2635
|
+
if (actScopeDepth === 0) {
|
|
2636
|
+
// We've exited the outermost act scope. Recursively flush the
|
|
2637
|
+
// queue until there's no remaining work.
|
|
2638
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2639
|
+
} else {
|
|
2640
|
+
resolve(returnValue);
|
|
2641
|
+
}
|
|
2642
|
+
}, function (error) {
|
|
2643
|
+
// The callback threw an error.
|
|
2644
|
+
popActScope(prevActScopeDepth);
|
|
2645
|
+
reject(error);
|
|
2646
|
+
});
|
|
2647
|
+
}
|
|
2648
|
+
};
|
|
2649
|
+
|
|
2650
|
+
{
|
|
2651
|
+
if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
|
2652
|
+
// eslint-disable-next-line no-undef
|
|
2653
|
+
Promise.resolve().then(function () {}).then(function () {
|
|
2654
|
+
if (!wasAwaited) {
|
|
2655
|
+
didWarnNoAwaitAct = true;
|
|
2656
|
+
|
|
2657
|
+
error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);');
|
|
2658
|
+
}
|
|
2659
|
+
});
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
return thenable;
|
|
2664
|
+
} else {
|
|
2665
|
+
var returnValue = result; // The callback is not an async function. Exit the current scope
|
|
2666
|
+
// immediately, without awaiting.
|
|
2667
|
+
|
|
2668
|
+
popActScope(prevActScopeDepth);
|
|
2669
|
+
|
|
2670
|
+
if (actScopeDepth === 0) {
|
|
2671
|
+
// Exiting the outermost act scope. Flush the queue.
|
|
2672
|
+
var _queue = ReactCurrentActQueue.current;
|
|
2673
|
+
|
|
2674
|
+
if (_queue !== null) {
|
|
2675
|
+
flushActQueue(_queue);
|
|
2676
|
+
ReactCurrentActQueue.current = null;
|
|
2677
|
+
} // Return a thenable. If the user awaits it, we'll flush again in
|
|
2678
|
+
// case additional work was scheduled by a microtask.
|
|
2679
|
+
|
|
2680
|
+
|
|
2681
|
+
var _thenable = {
|
|
2682
|
+
then: function (resolve, reject) {
|
|
2683
|
+
// Confirm we haven't re-entered another `act` scope, in case
|
|
2684
|
+
// the user does something weird like await the thenable
|
|
2685
|
+
// multiple times.
|
|
2686
|
+
if (ReactCurrentActQueue.current === null) {
|
|
2687
|
+
// Recursively flush the queue until there's no remaining work.
|
|
2688
|
+
ReactCurrentActQueue.current = [];
|
|
2689
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2690
|
+
} else {
|
|
2691
|
+
resolve(returnValue);
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
};
|
|
2695
|
+
return _thenable;
|
|
2696
|
+
} else {
|
|
2697
|
+
// Since we're inside a nested `act` scope, the returned thenable
|
|
2698
|
+
// immediately resolves. The outer scope will flush the queue.
|
|
2699
|
+
var _thenable2 = {
|
|
2700
|
+
then: function (resolve, reject) {
|
|
2701
|
+
resolve(returnValue);
|
|
2702
|
+
}
|
|
2703
|
+
};
|
|
2704
|
+
return _thenable2;
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
function popActScope(prevActScopeDepth) {
|
|
2711
|
+
{
|
|
2712
|
+
if (prevActScopeDepth !== actScopeDepth - 1) {
|
|
2713
|
+
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
actScopeDepth = prevActScopeDepth;
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
2721
|
+
{
|
|
2722
|
+
var queue = ReactCurrentActQueue.current;
|
|
2723
|
+
|
|
2724
|
+
if (queue !== null) {
|
|
2725
|
+
try {
|
|
2726
|
+
flushActQueue(queue);
|
|
2727
|
+
enqueueTask(function () {
|
|
2728
|
+
if (queue.length === 0) {
|
|
2729
|
+
// No additional work was scheduled. Finish.
|
|
2730
|
+
ReactCurrentActQueue.current = null;
|
|
2731
|
+
resolve(returnValue);
|
|
2732
|
+
} else {
|
|
2733
|
+
// Keep flushing work until there's none left.
|
|
2734
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2735
|
+
}
|
|
2736
|
+
});
|
|
2737
|
+
} catch (error) {
|
|
2738
|
+
reject(error);
|
|
2739
|
+
}
|
|
2740
|
+
} else {
|
|
2741
|
+
resolve(returnValue);
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
var isFlushing = false;
|
|
2747
|
+
|
|
2748
|
+
function flushActQueue(queue) {
|
|
2749
|
+
{
|
|
2750
|
+
if (!isFlushing) {
|
|
2751
|
+
// Prevent re-entrance.
|
|
2752
|
+
isFlushing = true;
|
|
2753
|
+
var i = 0;
|
|
2754
|
+
|
|
2755
|
+
try {
|
|
2756
|
+
for (; i < queue.length; i++) {
|
|
2757
|
+
var callback = queue[i];
|
|
2758
|
+
|
|
2759
|
+
do {
|
|
2760
|
+
callback = callback(true);
|
|
2761
|
+
} while (callback !== null);
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
queue.length = 0;
|
|
2765
|
+
} catch (error) {
|
|
2766
|
+
// If something throws, leave the remaining callbacks on the queue.
|
|
2767
|
+
queue = queue.slice(i + 1);
|
|
2768
|
+
throw error;
|
|
2769
|
+
} finally {
|
|
2770
|
+
isFlushing = false;
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
var createElement$1 = createElementWithValidation ;
|
|
2777
|
+
var cloneElement$1 = cloneElementWithValidation ;
|
|
2778
|
+
var createFactory = createFactoryWithValidation ;
|
|
2779
|
+
var Children = {
|
|
2780
|
+
map: mapChildren,
|
|
2781
|
+
forEach: forEachChildren,
|
|
2782
|
+
count: countChildren,
|
|
2783
|
+
toArray: toArray,
|
|
2784
|
+
only: onlyChild
|
|
2785
|
+
};
|
|
2786
|
+
|
|
2787
|
+
exports.Children = Children;
|
|
2788
|
+
exports.Component = Component;
|
|
2789
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
2790
|
+
exports.Profiler = REACT_PROFILER_TYPE;
|
|
2791
|
+
exports.PureComponent = PureComponent;
|
|
2792
|
+
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2793
|
+
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
2794
|
+
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
2795
|
+
exports.cloneElement = cloneElement$1;
|
|
2796
|
+
exports.createContext = createContext;
|
|
2797
|
+
exports.createElement = createElement$1;
|
|
2798
|
+
exports.createFactory = createFactory;
|
|
2799
|
+
exports.createRef = createRef;
|
|
2800
|
+
exports.forwardRef = forwardRef;
|
|
2801
|
+
exports.isValidElement = isValidElement;
|
|
2802
|
+
exports.lazy = lazy;
|
|
2803
|
+
exports.memo = memo;
|
|
2804
|
+
exports.startTransition = startTransition;
|
|
2805
|
+
exports.unstable_act = act;
|
|
2806
|
+
exports.useCallback = useCallback;
|
|
2807
|
+
exports.useContext = useContext;
|
|
2808
|
+
exports.useDebugValue = useDebugValue;
|
|
2809
|
+
exports.useDeferredValue = useDeferredValue;
|
|
2810
|
+
exports.useEffect = useEffect;
|
|
2811
|
+
exports.useId = useId;
|
|
2812
|
+
exports.useImperativeHandle = useImperativeHandle;
|
|
2813
|
+
exports.useInsertionEffect = useInsertionEffect;
|
|
2814
|
+
exports.useLayoutEffect = useLayoutEffect;
|
|
2815
|
+
exports.useMemo = useMemo;
|
|
2816
|
+
exports.useReducer = useReducer;
|
|
2817
|
+
exports.useRef = useRef;
|
|
2818
|
+
exports.useState = useState;
|
|
2819
|
+
exports.useSyncExternalStore = useSyncExternalStore;
|
|
2820
|
+
exports.useTransition = useTransition;
|
|
2821
|
+
exports.version = ReactVersion;
|
|
2822
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
2823
|
+
if (
|
|
2824
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
2825
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
2826
|
+
'function'
|
|
2827
|
+
) {
|
|
2828
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
})();
|
|
2832
|
+
}
|
|
2833
|
+
} (react_development, react_development.exports));
|
|
2834
|
+
return react_development.exports;
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2838
|
+
react.exports = requireReact_production_min();
|
|
2839
|
+
} else {
|
|
2840
|
+
react.exports = requireReact_development();
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
var reactExports = react.exports;
|
|
2844
|
+
|
|
2845
|
+
/**
|
|
2846
|
+
* @license React
|
|
2847
|
+
* react-jsx-runtime.production.min.js
|
|
2848
|
+
*
|
|
2849
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2850
|
+
*
|
|
2851
|
+
* This source code is licensed under the MIT license found in the
|
|
2852
|
+
* LICENSE file in the root directory of this source tree.
|
|
2853
|
+
*/
|
|
2854
|
+
|
|
2855
|
+
var hasRequiredReactJsxRuntime_production_min;
|
|
2856
|
+
|
|
2857
|
+
function requireReactJsxRuntime_production_min () {
|
|
2858
|
+
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
2859
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
|
2860
|
+
var f=reactExports,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
|
|
2861
|
+
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
|
|
2862
|
+
return reactJsxRuntime_production_min;
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
var reactJsxRuntime_development = {};
|
|
2866
|
+
|
|
2867
|
+
/**
|
|
2868
|
+
* @license React
|
|
2869
|
+
* react-jsx-runtime.development.js
|
|
2870
|
+
*
|
|
2871
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2872
|
+
*
|
|
2873
|
+
* This source code is licensed under the MIT license found in the
|
|
2874
|
+
* LICENSE file in the root directory of this source tree.
|
|
2875
|
+
*/
|
|
2876
|
+
|
|
2877
|
+
var hasRequiredReactJsxRuntime_development;
|
|
2878
|
+
|
|
2879
|
+
function requireReactJsxRuntime_development () {
|
|
2880
|
+
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
2881
|
+
hasRequiredReactJsxRuntime_development = 1;
|
|
2882
|
+
|
|
2883
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2884
|
+
(function() {
|
|
2885
|
+
|
|
2886
|
+
var React = reactExports;
|
|
2887
|
+
|
|
2888
|
+
// ATTENTION
|
|
2889
|
+
// When adding new symbols to this file,
|
|
2890
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
2891
|
+
// The Symbol used to tag the ReactElement-like types.
|
|
2892
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
2893
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
2894
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
2895
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
2896
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
2897
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
2898
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
2899
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
2900
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
2901
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
2902
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
2903
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
2904
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
2905
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
2906
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
2907
|
+
function getIteratorFn(maybeIterable) {
|
|
2908
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
2909
|
+
return null;
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
2913
|
+
|
|
2914
|
+
if (typeof maybeIterator === 'function') {
|
|
2915
|
+
return maybeIterator;
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
return null;
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
2922
|
+
|
|
2923
|
+
function error(format) {
|
|
2924
|
+
{
|
|
2925
|
+
{
|
|
2926
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
2927
|
+
args[_key2 - 1] = arguments[_key2];
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
printWarning('error', format, args);
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
function printWarning(level, format, args) {
|
|
2936
|
+
// When changing this logic, you might want to also
|
|
2937
|
+
// update consoleWithStackDev.www.js as well.
|
|
2938
|
+
{
|
|
2939
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
2940
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
2941
|
+
|
|
2942
|
+
if (stack !== '') {
|
|
2943
|
+
format += '%s';
|
|
2944
|
+
args = args.concat([stack]);
|
|
2945
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
2946
|
+
|
|
2947
|
+
|
|
2948
|
+
var argsWithFormat = args.map(function (item) {
|
|
2949
|
+
return String(item);
|
|
2950
|
+
}); // Careful: RN currently depends on this prefix
|
|
2951
|
+
|
|
2952
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
2953
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
2954
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
2955
|
+
|
|
2956
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
// -----------------------------------------------------------------------------
|
|
2961
|
+
|
|
2962
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
2963
|
+
var enableCacheElement = false;
|
|
2964
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
2965
|
+
|
|
2966
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
2967
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
2968
|
+
// issues in DEV builds.
|
|
2969
|
+
|
|
2970
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
2971
|
+
|
|
2972
|
+
var REACT_MODULE_REFERENCE;
|
|
2973
|
+
|
|
2974
|
+
{
|
|
2975
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
function isValidElementType(type) {
|
|
2979
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
2980
|
+
return true;
|
|
2981
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
2982
|
+
|
|
2983
|
+
|
|
2984
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
2985
|
+
return true;
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
if (typeof type === 'object' && type !== null) {
|
|
2989
|
+
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 || // This needs to include all possible module reference object
|
|
2990
|
+
// types supported by any Flight configuration anywhere since
|
|
2991
|
+
// we don't know which Flight build this will end up being used
|
|
2992
|
+
// with.
|
|
2993
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
2994
|
+
return true;
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2998
|
+
return false;
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
3002
|
+
var displayName = outerType.displayName;
|
|
3003
|
+
|
|
3004
|
+
if (displayName) {
|
|
3005
|
+
return displayName;
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
3009
|
+
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
3010
|
+
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
3011
|
+
|
|
3012
|
+
|
|
3013
|
+
function getContextName(type) {
|
|
3014
|
+
return type.displayName || 'Context';
|
|
3015
|
+
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
3016
|
+
|
|
3017
|
+
|
|
3018
|
+
function getComponentNameFromType(type) {
|
|
3019
|
+
if (type == null) {
|
|
3020
|
+
// Host root, text node or just invalid type.
|
|
3021
|
+
return null;
|
|
3022
|
+
}
|
|
3023
|
+
|
|
3024
|
+
{
|
|
3025
|
+
if (typeof type.tag === 'number') {
|
|
3026
|
+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3030
|
+
if (typeof type === 'function') {
|
|
3031
|
+
return type.displayName || type.name || null;
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
if (typeof type === 'string') {
|
|
3035
|
+
return type;
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
switch (type) {
|
|
3039
|
+
case REACT_FRAGMENT_TYPE:
|
|
3040
|
+
return 'Fragment';
|
|
3041
|
+
|
|
3042
|
+
case REACT_PORTAL_TYPE:
|
|
3043
|
+
return 'Portal';
|
|
3044
|
+
|
|
3045
|
+
case REACT_PROFILER_TYPE:
|
|
3046
|
+
return 'Profiler';
|
|
3047
|
+
|
|
3048
|
+
case REACT_STRICT_MODE_TYPE:
|
|
3049
|
+
return 'StrictMode';
|
|
3050
|
+
|
|
3051
|
+
case REACT_SUSPENSE_TYPE:
|
|
3052
|
+
return 'Suspense';
|
|
3053
|
+
|
|
3054
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
3055
|
+
return 'SuspenseList';
|
|
3056
|
+
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3059
|
+
if (typeof type === 'object') {
|
|
3060
|
+
switch (type.$$typeof) {
|
|
3061
|
+
case REACT_CONTEXT_TYPE:
|
|
3062
|
+
var context = type;
|
|
3063
|
+
return getContextName(context) + '.Consumer';
|
|
3064
|
+
|
|
3065
|
+
case REACT_PROVIDER_TYPE:
|
|
3066
|
+
var provider = type;
|
|
3067
|
+
return getContextName(provider._context) + '.Provider';
|
|
3068
|
+
|
|
3069
|
+
case REACT_FORWARD_REF_TYPE:
|
|
3070
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
3071
|
+
|
|
3072
|
+
case REACT_MEMO_TYPE:
|
|
3073
|
+
var outerName = type.displayName || null;
|
|
3074
|
+
|
|
3075
|
+
if (outerName !== null) {
|
|
3076
|
+
return outerName;
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
return getComponentNameFromType(type.type) || 'Memo';
|
|
3080
|
+
|
|
3081
|
+
case REACT_LAZY_TYPE:
|
|
3082
|
+
{
|
|
3083
|
+
var lazyComponent = type;
|
|
3084
|
+
var payload = lazyComponent._payload;
|
|
3085
|
+
var init = lazyComponent._init;
|
|
3086
|
+
|
|
3087
|
+
try {
|
|
3088
|
+
return getComponentNameFromType(init(payload));
|
|
3089
|
+
} catch (x) {
|
|
3090
|
+
return null;
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3094
|
+
// eslint-disable-next-line no-fallthrough
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
return null;
|
|
3099
|
+
}
|
|
3100
|
+
|
|
3101
|
+
var assign = Object.assign;
|
|
3102
|
+
|
|
3103
|
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
3104
|
+
// replaying on render function. This currently only patches the object
|
|
3105
|
+
// lazily which won't cover if the log function was extracted eagerly.
|
|
3106
|
+
// We could also eagerly patch the method.
|
|
3107
|
+
var disabledDepth = 0;
|
|
3108
|
+
var prevLog;
|
|
3109
|
+
var prevInfo;
|
|
3110
|
+
var prevWarn;
|
|
3111
|
+
var prevError;
|
|
3112
|
+
var prevGroup;
|
|
3113
|
+
var prevGroupCollapsed;
|
|
3114
|
+
var prevGroupEnd;
|
|
3115
|
+
|
|
3116
|
+
function disabledLog() {}
|
|
3117
|
+
|
|
3118
|
+
disabledLog.__reactDisabledLog = true;
|
|
3119
|
+
function disableLogs() {
|
|
3120
|
+
{
|
|
3121
|
+
if (disabledDepth === 0) {
|
|
3122
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
3123
|
+
prevLog = console.log;
|
|
3124
|
+
prevInfo = console.info;
|
|
3125
|
+
prevWarn = console.warn;
|
|
3126
|
+
prevError = console.error;
|
|
3127
|
+
prevGroup = console.group;
|
|
3128
|
+
prevGroupCollapsed = console.groupCollapsed;
|
|
3129
|
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
3130
|
+
|
|
3131
|
+
var props = {
|
|
3132
|
+
configurable: true,
|
|
3133
|
+
enumerable: true,
|
|
3134
|
+
value: disabledLog,
|
|
3135
|
+
writable: true
|
|
3136
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
3137
|
+
|
|
3138
|
+
Object.defineProperties(console, {
|
|
3139
|
+
info: props,
|
|
3140
|
+
log: props,
|
|
3141
|
+
warn: props,
|
|
3142
|
+
error: props,
|
|
3143
|
+
group: props,
|
|
3144
|
+
groupCollapsed: props,
|
|
3145
|
+
groupEnd: props
|
|
3146
|
+
});
|
|
3147
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3150
|
+
disabledDepth++;
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
function reenableLogs() {
|
|
3154
|
+
{
|
|
3155
|
+
disabledDepth--;
|
|
3156
|
+
|
|
3157
|
+
if (disabledDepth === 0) {
|
|
3158
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
3159
|
+
var props = {
|
|
3160
|
+
configurable: true,
|
|
3161
|
+
enumerable: true,
|
|
3162
|
+
writable: true
|
|
3163
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
3164
|
+
|
|
3165
|
+
Object.defineProperties(console, {
|
|
3166
|
+
log: assign({}, props, {
|
|
3167
|
+
value: prevLog
|
|
3168
|
+
}),
|
|
3169
|
+
info: assign({}, props, {
|
|
3170
|
+
value: prevInfo
|
|
3171
|
+
}),
|
|
3172
|
+
warn: assign({}, props, {
|
|
3173
|
+
value: prevWarn
|
|
3174
|
+
}),
|
|
3175
|
+
error: assign({}, props, {
|
|
3176
|
+
value: prevError
|
|
3177
|
+
}),
|
|
3178
|
+
group: assign({}, props, {
|
|
3179
|
+
value: prevGroup
|
|
3180
|
+
}),
|
|
3181
|
+
groupCollapsed: assign({}, props, {
|
|
3182
|
+
value: prevGroupCollapsed
|
|
3183
|
+
}),
|
|
3184
|
+
groupEnd: assign({}, props, {
|
|
3185
|
+
value: prevGroupEnd
|
|
3186
|
+
})
|
|
3187
|
+
});
|
|
3188
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3191
|
+
if (disabledDepth < 0) {
|
|
3192
|
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
3198
|
+
var prefix;
|
|
3199
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
3200
|
+
{
|
|
3201
|
+
if (prefix === undefined) {
|
|
3202
|
+
// Extract the VM specific prefix used by each line.
|
|
3203
|
+
try {
|
|
3204
|
+
throw Error();
|
|
3205
|
+
} catch (x) {
|
|
3206
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
3207
|
+
prefix = match && match[1] || '';
|
|
3208
|
+
}
|
|
3209
|
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
3210
|
+
|
|
3211
|
+
|
|
3212
|
+
return '\n' + prefix + name;
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
var reentry = false;
|
|
3216
|
+
var componentFrameCache;
|
|
3217
|
+
|
|
3218
|
+
{
|
|
3219
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
3220
|
+
componentFrameCache = new PossiblyWeakMap();
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
function describeNativeComponentFrame(fn, construct) {
|
|
3224
|
+
// If something asked for a stack inside a fake render, it should get ignored.
|
|
3225
|
+
if ( !fn || reentry) {
|
|
3226
|
+
return '';
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
{
|
|
3230
|
+
var frame = componentFrameCache.get(fn);
|
|
3231
|
+
|
|
3232
|
+
if (frame !== undefined) {
|
|
3233
|
+
return frame;
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
var control;
|
|
3238
|
+
reentry = true;
|
|
3239
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
3240
|
+
|
|
3241
|
+
Error.prepareStackTrace = undefined;
|
|
3242
|
+
var previousDispatcher;
|
|
3243
|
+
|
|
3244
|
+
{
|
|
3245
|
+
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
3246
|
+
// for warnings.
|
|
3247
|
+
|
|
3248
|
+
ReactCurrentDispatcher.current = null;
|
|
3249
|
+
disableLogs();
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3252
|
+
try {
|
|
3253
|
+
// This should throw.
|
|
3254
|
+
if (construct) {
|
|
3255
|
+
// Something should be setting the props in the constructor.
|
|
3256
|
+
var Fake = function () {
|
|
3257
|
+
throw Error();
|
|
3258
|
+
}; // $FlowFixMe
|
|
3259
|
+
|
|
3260
|
+
|
|
3261
|
+
Object.defineProperty(Fake.prototype, 'props', {
|
|
3262
|
+
set: function () {
|
|
3263
|
+
// We use a throwing setter instead of frozen or non-writable props
|
|
3264
|
+
// because that won't throw in a non-strict mode function.
|
|
3265
|
+
throw Error();
|
|
3266
|
+
}
|
|
3267
|
+
});
|
|
3268
|
+
|
|
3269
|
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
3270
|
+
// We construct a different control for this case to include any extra
|
|
3271
|
+
// frames added by the construct call.
|
|
3272
|
+
try {
|
|
3273
|
+
Reflect.construct(Fake, []);
|
|
3274
|
+
} catch (x) {
|
|
3275
|
+
control = x;
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
Reflect.construct(fn, [], Fake);
|
|
3279
|
+
} else {
|
|
3280
|
+
try {
|
|
3281
|
+
Fake.call();
|
|
3282
|
+
} catch (x) {
|
|
3283
|
+
control = x;
|
|
3284
|
+
}
|
|
3285
|
+
|
|
3286
|
+
fn.call(Fake.prototype);
|
|
3287
|
+
}
|
|
3288
|
+
} else {
|
|
3289
|
+
try {
|
|
3290
|
+
throw Error();
|
|
3291
|
+
} catch (x) {
|
|
3292
|
+
control = x;
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3295
|
+
fn();
|
|
3296
|
+
}
|
|
3297
|
+
} catch (sample) {
|
|
3298
|
+
// This is inlined manually because closure doesn't do it for us.
|
|
3299
|
+
if (sample && control && typeof sample.stack === 'string') {
|
|
3300
|
+
// This extracts the first frame from the sample that isn't also in the control.
|
|
3301
|
+
// Skipping one frame that we assume is the frame that calls the two.
|
|
3302
|
+
var sampleLines = sample.stack.split('\n');
|
|
3303
|
+
var controlLines = control.stack.split('\n');
|
|
3304
|
+
var s = sampleLines.length - 1;
|
|
3305
|
+
var c = controlLines.length - 1;
|
|
3306
|
+
|
|
3307
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
3308
|
+
// We expect at least one stack frame to be shared.
|
|
3309
|
+
// Typically this will be the root most one. However, stack frames may be
|
|
3310
|
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
3311
|
+
// earlier than the other. We assume that the sample is longer or the same
|
|
3312
|
+
// and there for cut off earlier. So we should find the root most frame in
|
|
3313
|
+
// the sample somewhere in the control.
|
|
3314
|
+
c--;
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
|
3318
|
+
// Next we find the first one that isn't the same which should be the
|
|
3319
|
+
// frame that called our sample function and the control.
|
|
3320
|
+
if (sampleLines[s] !== controlLines[c]) {
|
|
3321
|
+
// In V8, the first line is describing the message but other VMs don't.
|
|
3322
|
+
// If we're about to return the first line, and the control is also on the same
|
|
3323
|
+
// line, that's a pretty good indicator that our sample threw at same line as
|
|
3324
|
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
3325
|
+
// This can happen if you passed a class to function component, or non-function.
|
|
3326
|
+
if (s !== 1 || c !== 1) {
|
|
3327
|
+
do {
|
|
3328
|
+
s--;
|
|
3329
|
+
c--; // We may still have similar intermediate frames from the construct call.
|
|
3330
|
+
// The next one that isn't the same should be our match though.
|
|
3331
|
+
|
|
3332
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
3333
|
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
3334
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
3335
|
+
// but we have a user-provided "displayName"
|
|
3336
|
+
// splice it in to make the stack more readable.
|
|
3337
|
+
|
|
3338
|
+
|
|
3339
|
+
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
3340
|
+
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
{
|
|
3344
|
+
if (typeof fn === 'function') {
|
|
3345
|
+
componentFrameCache.set(fn, _frame);
|
|
3346
|
+
}
|
|
3347
|
+
} // Return the line we found.
|
|
3348
|
+
|
|
3349
|
+
|
|
3350
|
+
return _frame;
|
|
3351
|
+
}
|
|
3352
|
+
} while (s >= 1 && c >= 0);
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
break;
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
} finally {
|
|
3360
|
+
reentry = false;
|
|
3361
|
+
|
|
3362
|
+
{
|
|
3363
|
+
ReactCurrentDispatcher.current = previousDispatcher;
|
|
3364
|
+
reenableLogs();
|
|
3365
|
+
}
|
|
3366
|
+
|
|
3367
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
3368
|
+
} // Fallback to just using the name if we couldn't make it throw.
|
|
3369
|
+
|
|
3370
|
+
|
|
3371
|
+
var name = fn ? fn.displayName || fn.name : '';
|
|
3372
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
3373
|
+
|
|
3374
|
+
{
|
|
3375
|
+
if (typeof fn === 'function') {
|
|
3376
|
+
componentFrameCache.set(fn, syntheticFrame);
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3380
|
+
return syntheticFrame;
|
|
3381
|
+
}
|
|
3382
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
3383
|
+
{
|
|
3384
|
+
return describeNativeComponentFrame(fn, false);
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
function shouldConstruct(Component) {
|
|
3389
|
+
var prototype = Component.prototype;
|
|
3390
|
+
return !!(prototype && prototype.isReactComponent);
|
|
3391
|
+
}
|
|
3392
|
+
|
|
3393
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
3394
|
+
|
|
3395
|
+
if (type == null) {
|
|
3396
|
+
return '';
|
|
3397
|
+
}
|
|
3398
|
+
|
|
3399
|
+
if (typeof type === 'function') {
|
|
3400
|
+
{
|
|
3401
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
if (typeof type === 'string') {
|
|
3406
|
+
return describeBuiltInComponentFrame(type);
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3409
|
+
switch (type) {
|
|
3410
|
+
case REACT_SUSPENSE_TYPE:
|
|
3411
|
+
return describeBuiltInComponentFrame('Suspense');
|
|
3412
|
+
|
|
3413
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
3414
|
+
return describeBuiltInComponentFrame('SuspenseList');
|
|
3415
|
+
}
|
|
3416
|
+
|
|
3417
|
+
if (typeof type === 'object') {
|
|
3418
|
+
switch (type.$$typeof) {
|
|
3419
|
+
case REACT_FORWARD_REF_TYPE:
|
|
3420
|
+
return describeFunctionComponentFrame(type.render);
|
|
3421
|
+
|
|
3422
|
+
case REACT_MEMO_TYPE:
|
|
3423
|
+
// Memo may contain any component type so we recursively resolve it.
|
|
3424
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
3425
|
+
|
|
3426
|
+
case REACT_LAZY_TYPE:
|
|
3427
|
+
{
|
|
3428
|
+
var lazyComponent = type;
|
|
3429
|
+
var payload = lazyComponent._payload;
|
|
3430
|
+
var init = lazyComponent._init;
|
|
3431
|
+
|
|
3432
|
+
try {
|
|
3433
|
+
// Lazy may contain any component type so we recursively resolve it.
|
|
3434
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
3435
|
+
} catch (x) {}
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3439
|
+
|
|
3440
|
+
return '';
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
3444
|
+
|
|
3445
|
+
var loggedTypeFailures = {};
|
|
3446
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
3447
|
+
|
|
3448
|
+
function setCurrentlyValidatingElement(element) {
|
|
3449
|
+
{
|
|
3450
|
+
if (element) {
|
|
3451
|
+
var owner = element._owner;
|
|
3452
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
3453
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
3454
|
+
} else {
|
|
3455
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3460
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
3461
|
+
{
|
|
3462
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
3463
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
3464
|
+
|
|
3465
|
+
for (var typeSpecName in typeSpecs) {
|
|
3466
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
3467
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
3468
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
3469
|
+
// After these have been cleaned up, we'll let them throw.
|
|
3470
|
+
|
|
3471
|
+
try {
|
|
3472
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
3473
|
+
// behavior as without this statement except with a better message.
|
|
3474
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
3475
|
+
// eslint-disable-next-line react-internal/prod-error-codes
|
|
3476
|
+
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`.');
|
|
3477
|
+
err.name = 'Invariant Violation';
|
|
3478
|
+
throw err;
|
|
3479
|
+
}
|
|
3480
|
+
|
|
3481
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
3482
|
+
} catch (ex) {
|
|
3483
|
+
error$1 = ex;
|
|
3484
|
+
}
|
|
3485
|
+
|
|
3486
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
3487
|
+
setCurrentlyValidatingElement(element);
|
|
3488
|
+
|
|
3489
|
+
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);
|
|
3490
|
+
|
|
3491
|
+
setCurrentlyValidatingElement(null);
|
|
3492
|
+
}
|
|
3493
|
+
|
|
3494
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
3495
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
3496
|
+
// same error.
|
|
3497
|
+
loggedTypeFailures[error$1.message] = true;
|
|
3498
|
+
setCurrentlyValidatingElement(element);
|
|
3499
|
+
|
|
3500
|
+
error('Failed %s type: %s', location, error$1.message);
|
|
3501
|
+
|
|
3502
|
+
setCurrentlyValidatingElement(null);
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3509
|
+
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
3510
|
+
|
|
3511
|
+
function isArray(a) {
|
|
3512
|
+
return isArrayImpl(a);
|
|
3513
|
+
}
|
|
3514
|
+
|
|
3515
|
+
/*
|
|
3516
|
+
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
3517
|
+
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
3518
|
+
*
|
|
3519
|
+
* The functions in this module will throw an easier-to-understand,
|
|
3520
|
+
* easier-to-debug exception with a clear errors message message explaining the
|
|
3521
|
+
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
3522
|
+
* of the `value` object).
|
|
3523
|
+
*/
|
|
3524
|
+
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
3525
|
+
function typeName(value) {
|
|
3526
|
+
{
|
|
3527
|
+
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
3528
|
+
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
3529
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
3530
|
+
return type;
|
|
3531
|
+
}
|
|
3532
|
+
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
3533
|
+
|
|
3534
|
+
|
|
3535
|
+
function willCoercionThrow(value) {
|
|
3536
|
+
{
|
|
3537
|
+
try {
|
|
3538
|
+
testStringCoercion(value);
|
|
3539
|
+
return false;
|
|
3540
|
+
} catch (e) {
|
|
3541
|
+
return true;
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
function testStringCoercion(value) {
|
|
3547
|
+
// If you ended up here by following an exception call stack, here's what's
|
|
3548
|
+
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
3549
|
+
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
3550
|
+
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
3551
|
+
//
|
|
3552
|
+
// The most common types that will cause this exception are `Symbol` instances
|
|
3553
|
+
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
3554
|
+
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
3555
|
+
// exception. (Library authors do this to prevent users from using built-in
|
|
3556
|
+
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
3557
|
+
// methods are needed to perform accurate arithmetic or comparison.)
|
|
3558
|
+
//
|
|
3559
|
+
// To fix the problem, coerce this object or symbol value to a string before
|
|
3560
|
+
// passing it to React. The most reliable way is usually `String(value)`.
|
|
3561
|
+
//
|
|
3562
|
+
// To find which value is throwing, check the browser or debugger console.
|
|
3563
|
+
// Before this exception was thrown, there should be `console.error` output
|
|
3564
|
+
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
3565
|
+
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
3566
|
+
// In most cases, this console output also shows the component and its
|
|
3567
|
+
// ancestor components where the exception happened.
|
|
3568
|
+
//
|
|
3569
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
3570
|
+
return '' + value;
|
|
3571
|
+
}
|
|
3572
|
+
function checkKeyStringCoercion(value) {
|
|
3573
|
+
{
|
|
3574
|
+
if (willCoercionThrow(value)) {
|
|
3575
|
+
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
3576
|
+
|
|
3577
|
+
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
3583
|
+
var RESERVED_PROPS = {
|
|
3584
|
+
key: true,
|
|
3585
|
+
ref: true,
|
|
3586
|
+
__self: true,
|
|
3587
|
+
__source: true
|
|
3588
|
+
};
|
|
3589
|
+
var specialPropKeyWarningShown;
|
|
3590
|
+
var specialPropRefWarningShown;
|
|
3591
|
+
var didWarnAboutStringRefs;
|
|
3592
|
+
|
|
3593
|
+
{
|
|
3594
|
+
didWarnAboutStringRefs = {};
|
|
3595
|
+
}
|
|
3596
|
+
|
|
3597
|
+
function hasValidRef(config) {
|
|
3598
|
+
{
|
|
3599
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
3600
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
3601
|
+
|
|
3602
|
+
if (getter && getter.isReactWarning) {
|
|
3603
|
+
return false;
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
3606
|
+
}
|
|
3607
|
+
|
|
3608
|
+
return config.ref !== undefined;
|
|
3609
|
+
}
|
|
3610
|
+
|
|
3611
|
+
function hasValidKey(config) {
|
|
3612
|
+
{
|
|
3613
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
3614
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
3615
|
+
|
|
3616
|
+
if (getter && getter.isReactWarning) {
|
|
3617
|
+
return false;
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3621
|
+
|
|
3622
|
+
return config.key !== undefined;
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
3626
|
+
{
|
|
3627
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
3628
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
3629
|
+
|
|
3630
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
3631
|
+
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', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
|
3632
|
+
|
|
3633
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
3640
|
+
{
|
|
3641
|
+
var warnAboutAccessingKey = function () {
|
|
3642
|
+
if (!specialPropKeyWarningShown) {
|
|
3643
|
+
specialPropKeyWarningShown = true;
|
|
3644
|
+
|
|
3645
|
+
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);
|
|
3646
|
+
}
|
|
3647
|
+
};
|
|
3648
|
+
|
|
3649
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
3650
|
+
Object.defineProperty(props, 'key', {
|
|
3651
|
+
get: warnAboutAccessingKey,
|
|
3652
|
+
configurable: true
|
|
3653
|
+
});
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
|
|
3657
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
3658
|
+
{
|
|
3659
|
+
var warnAboutAccessingRef = function () {
|
|
3660
|
+
if (!specialPropRefWarningShown) {
|
|
3661
|
+
specialPropRefWarningShown = true;
|
|
3662
|
+
|
|
3663
|
+
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);
|
|
3664
|
+
}
|
|
3665
|
+
};
|
|
3666
|
+
|
|
3667
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
3668
|
+
Object.defineProperty(props, 'ref', {
|
|
3669
|
+
get: warnAboutAccessingRef,
|
|
3670
|
+
configurable: true
|
|
3671
|
+
});
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
/**
|
|
3675
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
3676
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
3677
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
3678
|
+
* if something is a React Element.
|
|
3679
|
+
*
|
|
3680
|
+
* @param {*} type
|
|
3681
|
+
* @param {*} props
|
|
3682
|
+
* @param {*} key
|
|
3683
|
+
* @param {string|object} ref
|
|
3684
|
+
* @param {*} owner
|
|
3685
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
3686
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
3687
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
3688
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
3689
|
+
* change in behavior.
|
|
3690
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
3691
|
+
* indicating filename, line number, and/or other information.
|
|
3692
|
+
* @internal
|
|
3693
|
+
*/
|
|
3694
|
+
|
|
3695
|
+
|
|
3696
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
3697
|
+
var element = {
|
|
3698
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
3699
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
3700
|
+
// Built-in properties that belong on the element
|
|
3701
|
+
type: type,
|
|
3702
|
+
key: key,
|
|
3703
|
+
ref: ref,
|
|
3704
|
+
props: props,
|
|
3705
|
+
// Record the component responsible for creating this element.
|
|
3706
|
+
_owner: owner
|
|
3707
|
+
};
|
|
3708
|
+
|
|
3709
|
+
{
|
|
3710
|
+
// The validation flag is currently mutative. We put it on
|
|
3711
|
+
// an external backing store so that we can freeze the whole object.
|
|
3712
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
3713
|
+
// commonly used development environments.
|
|
3714
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
3715
|
+
// the validation flag non-enumerable (where possible, which should
|
|
3716
|
+
// include every environment we run tests in), so the test framework
|
|
3717
|
+
// ignores it.
|
|
3718
|
+
|
|
3719
|
+
Object.defineProperty(element._store, 'validated', {
|
|
3720
|
+
configurable: false,
|
|
3721
|
+
enumerable: false,
|
|
3722
|
+
writable: true,
|
|
3723
|
+
value: false
|
|
3724
|
+
}); // self and source are DEV only properties.
|
|
3725
|
+
|
|
3726
|
+
Object.defineProperty(element, '_self', {
|
|
3727
|
+
configurable: false,
|
|
3728
|
+
enumerable: false,
|
|
3729
|
+
writable: false,
|
|
3730
|
+
value: self
|
|
3731
|
+
}); // Two elements created in two different places should be considered
|
|
3732
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
3733
|
+
|
|
3734
|
+
Object.defineProperty(element, '_source', {
|
|
3735
|
+
configurable: false,
|
|
3736
|
+
enumerable: false,
|
|
3737
|
+
writable: false,
|
|
3738
|
+
value: source
|
|
3739
|
+
});
|
|
3740
|
+
|
|
3741
|
+
if (Object.freeze) {
|
|
3742
|
+
Object.freeze(element.props);
|
|
3743
|
+
Object.freeze(element);
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3747
|
+
return element;
|
|
3748
|
+
};
|
|
3749
|
+
/**
|
|
3750
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
3751
|
+
* @param {*} type
|
|
3752
|
+
* @param {object} props
|
|
3753
|
+
* @param {string} key
|
|
3754
|
+
*/
|
|
3755
|
+
|
|
3756
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
3757
|
+
{
|
|
3758
|
+
var propName; // Reserved names are extracted
|
|
3759
|
+
|
|
3760
|
+
var props = {};
|
|
3761
|
+
var key = null;
|
|
3762
|
+
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
3763
|
+
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
3764
|
+
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
3765
|
+
// but as an intermediary step, we will use jsxDEV for everything except
|
|
3766
|
+
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
3767
|
+
// key is explicitly declared to be undefined or not.
|
|
3768
|
+
|
|
3769
|
+
if (maybeKey !== undefined) {
|
|
3770
|
+
{
|
|
3771
|
+
checkKeyStringCoercion(maybeKey);
|
|
3772
|
+
}
|
|
3773
|
+
|
|
3774
|
+
key = '' + maybeKey;
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3777
|
+
if (hasValidKey(config)) {
|
|
3778
|
+
{
|
|
3779
|
+
checkKeyStringCoercion(config.key);
|
|
3780
|
+
}
|
|
3781
|
+
|
|
3782
|
+
key = '' + config.key;
|
|
3783
|
+
}
|
|
3784
|
+
|
|
3785
|
+
if (hasValidRef(config)) {
|
|
3786
|
+
ref = config.ref;
|
|
3787
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
3788
|
+
} // Remaining properties are added to a new props object
|
|
3789
|
+
|
|
3790
|
+
|
|
3791
|
+
for (propName in config) {
|
|
3792
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
3793
|
+
props[propName] = config[propName];
|
|
3794
|
+
}
|
|
3795
|
+
} // Resolve default props
|
|
3796
|
+
|
|
3797
|
+
|
|
3798
|
+
if (type && type.defaultProps) {
|
|
3799
|
+
var defaultProps = type.defaultProps;
|
|
3800
|
+
|
|
3801
|
+
for (propName in defaultProps) {
|
|
3802
|
+
if (props[propName] === undefined) {
|
|
3803
|
+
props[propName] = defaultProps[propName];
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
|
|
3808
|
+
if (key || ref) {
|
|
3809
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
3810
|
+
|
|
3811
|
+
if (key) {
|
|
3812
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3815
|
+
if (ref) {
|
|
3816
|
+
defineRefPropWarningGetter(props, displayName);
|
|
3817
|
+
}
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3820
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
3825
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
3826
|
+
|
|
3827
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
3828
|
+
{
|
|
3829
|
+
if (element) {
|
|
3830
|
+
var owner = element._owner;
|
|
3831
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
3832
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
3833
|
+
} else {
|
|
3834
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
3835
|
+
}
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
var propTypesMisspellWarningShown;
|
|
3840
|
+
|
|
3841
|
+
{
|
|
3842
|
+
propTypesMisspellWarningShown = false;
|
|
3843
|
+
}
|
|
3844
|
+
/**
|
|
3845
|
+
* Verifies the object is a ReactElement.
|
|
3846
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
3847
|
+
* @param {?object} object
|
|
3848
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
3849
|
+
* @final
|
|
3850
|
+
*/
|
|
3851
|
+
|
|
3852
|
+
|
|
3853
|
+
function isValidElement(object) {
|
|
3854
|
+
{
|
|
3855
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
|
|
3859
|
+
function getDeclarationErrorAddendum() {
|
|
3860
|
+
{
|
|
3861
|
+
if (ReactCurrentOwner$1.current) {
|
|
3862
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
3863
|
+
|
|
3864
|
+
if (name) {
|
|
3865
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3869
|
+
return '';
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
|
|
3873
|
+
function getSourceInfoErrorAddendum(source) {
|
|
3874
|
+
{
|
|
3875
|
+
|
|
3876
|
+
return '';
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
/**
|
|
3880
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
3881
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
3882
|
+
* updates.
|
|
3883
|
+
*/
|
|
3884
|
+
|
|
3885
|
+
|
|
3886
|
+
var ownerHasKeyUseWarning = {};
|
|
3887
|
+
|
|
3888
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
3889
|
+
{
|
|
3890
|
+
var info = getDeclarationErrorAddendum();
|
|
3891
|
+
|
|
3892
|
+
if (!info) {
|
|
3893
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
3894
|
+
|
|
3895
|
+
if (parentName) {
|
|
3896
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
3897
|
+
}
|
|
3898
|
+
}
|
|
3899
|
+
|
|
3900
|
+
return info;
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
/**
|
|
3904
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
3905
|
+
* This element is in an array. The array could grow and shrink or be
|
|
3906
|
+
* reordered. All children that haven't already been validated are required to
|
|
3907
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
3908
|
+
* will only be shown once.
|
|
3909
|
+
*
|
|
3910
|
+
* @internal
|
|
3911
|
+
* @param {ReactElement} element Element that requires a key.
|
|
3912
|
+
* @param {*} parentType element's parent's type.
|
|
3913
|
+
*/
|
|
3914
|
+
|
|
3915
|
+
|
|
3916
|
+
function validateExplicitKey(element, parentType) {
|
|
3917
|
+
{
|
|
3918
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
3919
|
+
return;
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3922
|
+
element._store.validated = true;
|
|
3923
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
3924
|
+
|
|
3925
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
3926
|
+
return;
|
|
3927
|
+
}
|
|
3928
|
+
|
|
3929
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
3930
|
+
// property, it may be the creator of the child that's responsible for
|
|
3931
|
+
// assigning it a key.
|
|
3932
|
+
|
|
3933
|
+
var childOwner = '';
|
|
3934
|
+
|
|
3935
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
3936
|
+
// Give the component that originally created this child.
|
|
3937
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
3938
|
+
}
|
|
3939
|
+
|
|
3940
|
+
setCurrentlyValidatingElement$1(element);
|
|
3941
|
+
|
|
3942
|
+
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);
|
|
3943
|
+
|
|
3944
|
+
setCurrentlyValidatingElement$1(null);
|
|
3945
|
+
}
|
|
3946
|
+
}
|
|
3947
|
+
/**
|
|
3948
|
+
* Ensure that every element either is passed in a static location, in an
|
|
3949
|
+
* array with an explicit keys property defined, or in an object literal
|
|
3950
|
+
* with valid key property.
|
|
3951
|
+
*
|
|
3952
|
+
* @internal
|
|
3953
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
3954
|
+
* @param {*} parentType node's parent's type.
|
|
3955
|
+
*/
|
|
3956
|
+
|
|
3957
|
+
|
|
3958
|
+
function validateChildKeys(node, parentType) {
|
|
3959
|
+
{
|
|
3960
|
+
if (typeof node !== 'object') {
|
|
3961
|
+
return;
|
|
3962
|
+
}
|
|
3963
|
+
|
|
3964
|
+
if (isArray(node)) {
|
|
3965
|
+
for (var i = 0; i < node.length; i++) {
|
|
3966
|
+
var child = node[i];
|
|
3967
|
+
|
|
3968
|
+
if (isValidElement(child)) {
|
|
3969
|
+
validateExplicitKey(child, parentType);
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
} else if (isValidElement(node)) {
|
|
3973
|
+
// This element was passed in a valid location.
|
|
3974
|
+
if (node._store) {
|
|
3975
|
+
node._store.validated = true;
|
|
3976
|
+
}
|
|
3977
|
+
} else if (node) {
|
|
3978
|
+
var iteratorFn = getIteratorFn(node);
|
|
3979
|
+
|
|
3980
|
+
if (typeof iteratorFn === 'function') {
|
|
3981
|
+
// Entry iterators used to provide implicit keys,
|
|
3982
|
+
// but now we print a separate warning for them later.
|
|
3983
|
+
if (iteratorFn !== node.entries) {
|
|
3984
|
+
var iterator = iteratorFn.call(node);
|
|
3985
|
+
var step;
|
|
3986
|
+
|
|
3987
|
+
while (!(step = iterator.next()).done) {
|
|
3988
|
+
if (isValidElement(step.value)) {
|
|
3989
|
+
validateExplicitKey(step.value, parentType);
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
/**
|
|
3998
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
3999
|
+
* provided by the type.
|
|
4000
|
+
*
|
|
4001
|
+
* @param {ReactElement} element
|
|
4002
|
+
*/
|
|
4003
|
+
|
|
4004
|
+
|
|
4005
|
+
function validatePropTypes(element) {
|
|
4006
|
+
{
|
|
4007
|
+
var type = element.type;
|
|
4008
|
+
|
|
4009
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
4010
|
+
return;
|
|
4011
|
+
}
|
|
4012
|
+
|
|
4013
|
+
var propTypes;
|
|
4014
|
+
|
|
4015
|
+
if (typeof type === 'function') {
|
|
4016
|
+
propTypes = type.propTypes;
|
|
4017
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
4018
|
+
// Inner props are checked in the reconciler.
|
|
4019
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
4020
|
+
propTypes = type.propTypes;
|
|
4021
|
+
} else {
|
|
4022
|
+
return;
|
|
4023
|
+
}
|
|
4024
|
+
|
|
4025
|
+
if (propTypes) {
|
|
4026
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
|
4027
|
+
var name = getComponentNameFromType(type);
|
|
4028
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
4029
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
4030
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
4031
|
+
|
|
4032
|
+
var _name = getComponentNameFromType(type);
|
|
4033
|
+
|
|
4034
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
4035
|
+
}
|
|
4036
|
+
|
|
4037
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
4038
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
}
|
|
4042
|
+
/**
|
|
4043
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
4044
|
+
* @param {ReactElement} fragment
|
|
4045
|
+
*/
|
|
4046
|
+
|
|
4047
|
+
|
|
4048
|
+
function validateFragmentProps(fragment) {
|
|
4049
|
+
{
|
|
4050
|
+
var keys = Object.keys(fragment.props);
|
|
4051
|
+
|
|
4052
|
+
for (var i = 0; i < keys.length; i++) {
|
|
4053
|
+
var key = keys[i];
|
|
4054
|
+
|
|
4055
|
+
if (key !== 'children' && key !== 'key') {
|
|
4056
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
4057
|
+
|
|
4058
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
4059
|
+
|
|
4060
|
+
setCurrentlyValidatingElement$1(null);
|
|
4061
|
+
break;
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
|
|
4065
|
+
if (fragment.ref !== null) {
|
|
4066
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
4067
|
+
|
|
4068
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
4069
|
+
|
|
4070
|
+
setCurrentlyValidatingElement$1(null);
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
|
|
4075
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
4076
|
+
{
|
|
4077
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
4078
|
+
// succeed and there will likely be errors in render.
|
|
4079
|
+
|
|
4080
|
+
if (!validType) {
|
|
4081
|
+
var info = '';
|
|
4082
|
+
|
|
4083
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
4084
|
+
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.";
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
var sourceInfo = getSourceInfoErrorAddendum();
|
|
4088
|
+
|
|
4089
|
+
if (sourceInfo) {
|
|
4090
|
+
info += sourceInfo;
|
|
4091
|
+
} else {
|
|
4092
|
+
info += getDeclarationErrorAddendum();
|
|
4093
|
+
}
|
|
4094
|
+
|
|
4095
|
+
var typeString;
|
|
4096
|
+
|
|
4097
|
+
if (type === null) {
|
|
4098
|
+
typeString = 'null';
|
|
4099
|
+
} else if (isArray(type)) {
|
|
4100
|
+
typeString = 'array';
|
|
4101
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
4102
|
+
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
4103
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
4104
|
+
} else {
|
|
4105
|
+
typeString = typeof type;
|
|
4106
|
+
}
|
|
4107
|
+
|
|
4108
|
+
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);
|
|
4109
|
+
}
|
|
4110
|
+
|
|
4111
|
+
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
4112
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
4113
|
+
|
|
4114
|
+
if (element == null) {
|
|
4115
|
+
return element;
|
|
4116
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
4117
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
4118
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
4119
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
4120
|
+
// fixed, the key warnings will appear.)
|
|
4121
|
+
|
|
4122
|
+
|
|
4123
|
+
if (validType) {
|
|
4124
|
+
var children = props.children;
|
|
4125
|
+
|
|
4126
|
+
if (children !== undefined) {
|
|
4127
|
+
if (isStaticChildren) {
|
|
4128
|
+
if (isArray(children)) {
|
|
4129
|
+
for (var i = 0; i < children.length; i++) {
|
|
4130
|
+
validateChildKeys(children[i], type);
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
if (Object.freeze) {
|
|
4134
|
+
Object.freeze(children);
|
|
4135
|
+
}
|
|
4136
|
+
} else {
|
|
4137
|
+
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.');
|
|
4138
|
+
}
|
|
4139
|
+
} else {
|
|
4140
|
+
validateChildKeys(children, type);
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4144
|
+
|
|
4145
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
4146
|
+
validateFragmentProps(element);
|
|
4147
|
+
} else {
|
|
4148
|
+
validatePropTypes(element);
|
|
4149
|
+
}
|
|
4150
|
+
|
|
4151
|
+
return element;
|
|
4152
|
+
}
|
|
4153
|
+
} // These two functions exist to still get child warnings in dev
|
|
4154
|
+
// even with the prod transform. This means that jsxDEV is purely
|
|
4155
|
+
// opt-in behavior for better messages but that we won't stop
|
|
4156
|
+
// giving you warnings if you use production apis.
|
|
4157
|
+
|
|
4158
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
4159
|
+
{
|
|
4160
|
+
return jsxWithValidation(type, props, key, true);
|
|
4161
|
+
}
|
|
4162
|
+
}
|
|
4163
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
4164
|
+
{
|
|
4165
|
+
return jsxWithValidation(type, props, key, false);
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
|
|
4169
|
+
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
4170
|
+
// for now we can ship identical prod functions
|
|
4171
|
+
|
|
4172
|
+
var jsxs = jsxWithValidationStatic ;
|
|
4173
|
+
|
|
4174
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
4175
|
+
reactJsxRuntime_development.jsx = jsx;
|
|
4176
|
+
reactJsxRuntime_development.jsxs = jsxs;
|
|
4177
|
+
})();
|
|
4178
|
+
}
|
|
4179
|
+
return reactJsxRuntime_development;
|
|
4180
|
+
}
|
|
4181
|
+
|
|
4182
|
+
if (process.env.NODE_ENV === 'production') {
|
|
4183
|
+
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
4184
|
+
} else {
|
|
4185
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
4186
|
+
}
|
|
4187
|
+
|
|
4188
|
+
var jsxRuntimeExports = jsxRuntime.exports;
|
|
3
4189
|
|
|
4
4190
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
5
4191
|
|
|
@@ -2531,66 +6717,8 @@ const cn = (...inputs) => {
|
|
|
2531
6717
|
return twMerge(clsx(inputs));
|
|
2532
6718
|
};
|
|
2533
6719
|
|
|
2534
|
-
const badgeSizeClassMap = {
|
|
2535
|
-
sm: 'tw-w-4 tw-h-4',
|
|
2536
|
-
md: 'tw-w-5 tw-h-5',
|
|
2537
|
-
};
|
|
2538
|
-
const mainImageSizeClassMap = {
|
|
2539
|
-
sm: 'tw-w-8 tw-h-8',
|
|
2540
|
-
md: 'tw-w-10 tw-h-10',
|
|
2541
|
-
};
|
|
2542
|
-
function BadgeImage({ imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, rounded = false, }) {
|
|
2543
|
-
return imageUrl ? (jsxs("div", { className: cn('tw-relative', extraMarginForBadge && badgeUrl ? 'tw-mr-1.5' : null, mainImageSizeClassMap[size]), children: [jsx("img", { src: imageUrl, alt: "", className: cn('tw-h-full tw-w-full', rounded ? ' tw-rounded-full' : 'tw-rounded-squid-xs') }), badgeUrl ? (jsx("img", { src: badgeUrl, alt: "", className: cn('tw-absolute -tw-right-1/3 tw-bottom-0 tw-z-10 tw-m-0 -tw-translate-x-1/3 tw-rounded-md tw-border-[1px] tw-border-grey-800', badgeSizeClassMap[size]) })) : null] })) : null;
|
|
2544
|
-
}
|
|
2545
|
-
|
|
2546
|
-
/******************************************************************************
|
|
2547
|
-
Copyright (c) Microsoft Corporation.
|
|
2548
|
-
|
|
2549
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2550
|
-
purpose with or without fee is hereby granted.
|
|
2551
|
-
|
|
2552
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2553
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2554
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2555
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2556
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2557
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2558
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2559
|
-
***************************************************************************** */
|
|
2560
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
function __rest(s, e) {
|
|
2564
|
-
var t = {};
|
|
2565
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2566
|
-
t[p] = s[p];
|
|
2567
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2568
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2569
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2570
|
-
t[p[i]] = s[p[i]];
|
|
2571
|
-
}
|
|
2572
|
-
return t;
|
|
2573
|
-
}
|
|
2574
|
-
|
|
2575
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2576
|
-
var e = new Error(message);
|
|
2577
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2578
|
-
};
|
|
2579
|
-
|
|
2580
|
-
function CaptionText(_a) {
|
|
2581
|
-
var { children, bold } = _a, props = __rest(_a, ["children", "bold"]);
|
|
2582
|
-
const boldClass = bold
|
|
2583
|
-
? 'tw-font-typography-bold'
|
|
2584
|
-
: 'tw-font-typography-regular';
|
|
2585
|
-
return (jsx("span", Object.assign({}, props, { className: cn(boldClass, 'tw-text-caption tw-leading-caption', props.className), children: children })));
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
function UsdAmount({ usdAmount }) {
|
|
2589
|
-
return (jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsx(CaptionText, { className: "tw-text-grey-500/65", children: "$" }), jsx(CaptionText, { children: usdAmount.toString() })] }));
|
|
2590
|
-
}
|
|
2591
|
-
|
|
2592
6720
|
// font size, line height, and letter spacing classes
|
|
2593
|
-
const textClassMap
|
|
6721
|
+
const textClassMap = {
|
|
2594
6722
|
small: 'tw-text-body-small tw-tracking-body-small tw-leading-body-small',
|
|
2595
6723
|
medium: 'tw-text-body-medium tw-tracking-body-medium tw-leading-body-medium',
|
|
2596
6724
|
large: 'tw-text-body-large tw-tracking-body-large tw-leading-body-large',
|
|
@@ -2600,54 +6728,51 @@ function BodyText(_a) {
|
|
|
2600
6728
|
const fontWeightClass = bold
|
|
2601
6729
|
? 'tw-font-typography-bold'
|
|
2602
6730
|
: 'tw-font-typography-regular';
|
|
2603
|
-
return (jsx("span", Object.assign({}, props, { className: cn(textClassMap
|
|
6731
|
+
return (jsxRuntimeExports.jsx("span", Object.assign({}, props, { className: cn(textClassMap[size], fontWeightClass, props.className), children: children })));
|
|
2604
6732
|
}
|
|
2605
6733
|
|
|
2606
6734
|
function Loader({ size = '24' }) {
|
|
2607
6735
|
return (
|
|
2608
6736
|
// <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
|
|
2609
|
-
jsxs("svg", { width: size, height: size, viewBox: "0 0 38 38", xmlns: "http://www.w3.org/2000/svg", children: [jsx("defs", { children: jsxs("linearGradient", { x1: "8.042%", y1: "0%", x2: "65.682%", y2: "23.865%", id: "a", children: [jsx("stop", { stopColor: "currentColor", stopOpacity: "0", offset: "0%" }), jsx("stop", { stopColor: "currentColor", stopOpacity: ".631", offset: "63.146%" }), jsx("stop", { stopColor: "currentColor", offset: "100%" })] }) }), jsx("g", { fill: "none", fillRule: "evenodd", children: jsxs("g", { transform: "translate(1 1)", children: [jsx("path", { d: "M36 18c0-9.94-8.06-18-18-18", id: "Oval-2", stroke: "url(#a)", strokeWidth: "2", children: jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 18 18", to: "360 18 18", dur: "0.9s", repeatCount: "indefinite" }) }), jsx("circle", { fill: "currentColor", cx: "36", cy: "18", r: "1", children: jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 18 18", to: "360 18 18", dur: "0.9s", repeatCount: "indefinite" }) })] }) })] }));
|
|
6737
|
+
jsxRuntimeExports.jsxs("svg", { width: size, height: size, viewBox: "0 0 38 38", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntimeExports.jsx("defs", { children: jsxRuntimeExports.jsxs("linearGradient", { x1: "8.042%", y1: "0%", x2: "65.682%", y2: "23.865%", id: "a", children: [jsxRuntimeExports.jsx("stop", { stopColor: "currentColor", stopOpacity: "0", offset: "0%" }), jsxRuntimeExports.jsx("stop", { stopColor: "currentColor", stopOpacity: ".631", offset: "63.146%" }), jsxRuntimeExports.jsx("stop", { stopColor: "currentColor", offset: "100%" })] }) }), jsxRuntimeExports.jsx("g", { fill: "none", fillRule: "evenodd", children: jsxRuntimeExports.jsxs("g", { transform: "translate(1 1)", children: [jsxRuntimeExports.jsx("path", { d: "M36 18c0-9.94-8.06-18-18-18", id: "Oval-2", stroke: "url(#a)", strokeWidth: "2", children: jsxRuntimeExports.jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 18 18", to: "360 18 18", dur: "0.9s", repeatCount: "indefinite" }) }), jsxRuntimeExports.jsx("circle", { fill: "currentColor", cx: "36", cy: "18", r: "1", children: jsxRuntimeExports.jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 18 18", to: "360 18 18", dur: "0.9s", repeatCount: "indefinite" }) })] }) })] }));
|
|
6738
|
+
}
|
|
6739
|
+
|
|
6740
|
+
const badgeSizeClassMap = {
|
|
6741
|
+
sm: 'tw-w-4 tw-h-4',
|
|
6742
|
+
md: 'tw-w-5 tw-h-5',
|
|
6743
|
+
};
|
|
6744
|
+
const mainImageSizeClassMap = {
|
|
6745
|
+
sm: 'tw-w-8 tw-h-8',
|
|
6746
|
+
md: 'tw-w-10 tw-h-10',
|
|
6747
|
+
};
|
|
6748
|
+
function BadgeImage({ imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, rounded = false, }) {
|
|
6749
|
+
return imageUrl ? (jsxRuntimeExports.jsxs("div", { className: cn('tw-relative', extraMarginForBadge && badgeUrl ? 'tw-mr-1.5' : null, mainImageSizeClassMap[size]), children: [jsxRuntimeExports.jsx("img", { src: imageUrl, alt: "", className: cn('tw-h-full tw-w-full', rounded ? ' tw-rounded-full' : 'tw-rounded-squid-xs') }), badgeUrl ? (jsxRuntimeExports.jsx("img", { src: badgeUrl, alt: "", className: cn('tw-absolute -tw-right-1/3 tw-bottom-0 tw-z-10 tw-m-0 -tw-translate-x-1/3 tw-rounded-md tw-border-[1px] tw-border-grey-800', badgeSizeClassMap[size]) })) : null] })) : null;
|
|
2610
6750
|
}
|
|
2611
6751
|
|
|
2612
6752
|
function AddressButton(_a) {
|
|
2613
6753
|
var { label, imageUrl, badgeUrl, isLoading } = _a, props = __rest(_a, ["label", "imageUrl", "badgeUrl", "isLoading"]);
|
|
2614
|
-
return (jsx("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xxl tw-items-center tw-gap-1.5 tw-rounded-squid-m tw-border tw-border-material-light-thin tw-bg-grey-800 tw-text-grey-300', !isLoading && imageUrl ? 'tw-pl-1 tw-pr-4' : 'tw-px-4', props.className), children: isLoading ? (jsx("span", { className: "tw-mx-auto tw-px-4", children: jsx(Loader, {}) })) : (jsxs(Fragment, { children: [jsx(BadgeImage, { imageUrl: imageUrl, badgeUrl: badgeUrl, extraMarginForBadge: true, rounded: true }), jsx(BodyText, { size: "small", children: label })] })) })));
|
|
6754
|
+
return (jsxRuntimeExports.jsx("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xxl tw-items-center tw-gap-1.5 tw-rounded-squid-m tw-border tw-border-material-light-thin tw-bg-grey-800 tw-text-grey-300', !isLoading && imageUrl ? 'tw-pl-1 tw-pr-4' : 'tw-px-4', props.className), children: isLoading ? (jsxRuntimeExports.jsx("span", { className: "tw-mx-auto tw-px-4", children: jsxRuntimeExports.jsx(Loader, {}) })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(BadgeImage, { imageUrl: imageUrl, badgeUrl: badgeUrl, extraMarginForBadge: true, rounded: true }), jsxRuntimeExports.jsx(BodyText, { size: "small", children: label })] })) })));
|
|
2615
6755
|
}
|
|
2616
6756
|
|
|
2617
6757
|
function ArrowRightIcon() {
|
|
2618
|
-
return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M14 6L20 12L14 18M19 12H4", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
6758
|
+
return (jsxRuntimeExports.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntimeExports.jsx("path", { d: "M14 6L20 12L14 18M19 12H4", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2619
6759
|
}
|
|
2620
6760
|
function ChevronArrowIcon() {
|
|
2621
|
-
return (jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M6.66663 14L9.64022 8.64754C9.86394 8.24484 9.86394 7.75519 9.64022 7.35249L6.66663 2", stroke: "currentColor", strokeOpacity: "0.66", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2622
|
-
}
|
|
2623
|
-
function ArrowTriangle() {
|
|
2624
|
-
return (jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M2.87921 5.55701C2.21562 4.22933 3.18052 2.6665 4.66531 2.6665H11.3348C12.8196 2.6665 13.7845 4.22933 13.1209 5.55701L9.78615 12.229C9.05029 13.7012 6.94983 13.7012 6.21397 12.229L2.87921 5.55701Z", fill: "currentColor" }) }));
|
|
2625
|
-
}
|
|
2626
|
-
function ChevronLargeDownIcon({ size = '24' }) {
|
|
2627
|
-
return (jsx("svg", { width: size, height: size, viewBox: "0 0 24 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M3 10.5L11.0287 14.9604C11.6328 15.296 12.3672 15.296 12.9713 14.9604L21 10.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2628
|
-
}
|
|
2629
|
-
function ChevronLargeRightIcon() {
|
|
2630
|
-
return (jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M6.66675 14L9.64035 8.64754C9.86407 8.24484 9.86407 7.75519 9.64035 7.35249L6.66675 2", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2631
|
-
}
|
|
2632
|
-
function ChevronRightSmallIcon() {
|
|
2633
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: jsx("path", { d: "M6.66675 10.6667L8.86201 8.47141C9.12236 8.21106 9.12236 7.78896 8.86201 7.52861L6.66675 5.33334", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2634
|
-
}
|
|
2635
|
-
function ArrowLeftIcon() {
|
|
2636
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: jsx("path", { d: "M10 6L4 12L10 18M5 12H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
6761
|
+
return (jsxRuntimeExports.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntimeExports.jsx("path", { d: "M6.66663 14L9.64022 8.64754C9.86394 8.24484 9.86394 7.75519 9.64022 7.35249L6.66663 2", stroke: "currentColor", strokeOpacity: "0.66", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2637
6762
|
}
|
|
2638
6763
|
|
|
2639
6764
|
function ArrowButton(_a) {
|
|
2640
6765
|
var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
|
|
2641
|
-
return (jsxs("button", Object.assign({}, props, { disabled: disabled, className: clsx('tw-flex tw-h-button tw-w-full tw-items-center tw-justify-between tw-gap-1 tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800 tw-p-1 tw-text-grey-300',
|
|
6766
|
+
return (jsxRuntimeExports.jsxs("button", Object.assign({}, props, { disabled: disabled, className: clsx('tw-flex tw-h-button tw-w-full tw-items-center tw-justify-between tw-gap-1 tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800 tw-p-1 tw-text-grey-300',
|
|
2642
6767
|
// disabled styles
|
|
2643
|
-
'disabled:tw-bg-grey-800 disabled:tw-text-grey-600'), children: [jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) }), jsx("span", { "aria-disabled": disabled, className: clsx('tw-flex tw-aspect-square tw-h-[52px] tw-w-[52px] tw-items-center tw-justify-center tw-rounded-full tw-bg-royal-500 tw-text-grey-100',
|
|
6768
|
+
'disabled:tw-bg-grey-800 disabled:tw-text-grey-600'), children: [jsxRuntimeExports.jsx("span", { className: "tw-px-squid-m", children: jsxRuntimeExports.jsx(BodyText, { size: "medium", children: label }) }), jsxRuntimeExports.jsx("span", { "aria-disabled": disabled, className: clsx('tw-flex tw-aspect-square tw-h-[52px] tw-w-[52px] tw-items-center tw-justify-center tw-rounded-full tw-bg-royal-500 tw-text-grey-100',
|
|
2644
6769
|
// disabled styles
|
|
2645
|
-
'aria-disabled:tw-bg-grey-600 aria-disabled:tw-text-grey-800'), children: jsx(ArrowRightIcon, {}) })] })));
|
|
6770
|
+
'aria-disabled:tw-bg-grey-600 aria-disabled:tw-text-grey-800'), children: jsxRuntimeExports.jsx(ArrowRightIcon, {}) })] })));
|
|
2646
6771
|
}
|
|
2647
6772
|
|
|
2648
6773
|
const animationDuration = '500ms';
|
|
2649
6774
|
function BoostButton({ boostMode = 'normal', onToggleBoostMode, }) {
|
|
2650
|
-
const boostIndicatorRef = useRef(null);
|
|
6775
|
+
const boostIndicatorRef = reactExports.useRef(null);
|
|
2651
6776
|
function handleToggleBoostMode() {
|
|
2652
6777
|
if (!boostIndicatorRef.current)
|
|
2653
6778
|
return;
|
|
@@ -2663,9 +6788,9 @@ function BoostButton({ boostMode = 'normal', onToggleBoostMode, }) {
|
|
|
2663
6788
|
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
2664
6789
|
}
|
|
2665
6790
|
}
|
|
2666
|
-
return (jsxs("div", { onClick: handleToggleBoostMode, className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-bg-grey-900 tw-pb-squid-xxs tw-text-grey-300", children: [jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent" }), jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent" }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-items-center tw-justify-between tw-transition-transform data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsx("div", { className: "tw-w-1/2 tw-text-center", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
6791
|
+
return (jsxRuntimeExports.jsxs("div", { onClick: handleToggleBoostMode, className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-bg-grey-900 tw-pb-squid-xxs tw-text-grey-300", children: [jsxRuntimeExports.jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent" }), jsxRuntimeExports.jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent" }), jsxRuntimeExports.jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-items-center tw-justify-between tw-transition-transform data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsxRuntimeExports.jsx("div", { className: "tw-w-1/2 tw-text-center", children: jsxRuntimeExports.jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxRuntimeExports.jsxs("div", { className: "tw-w-1/2 tw-text-center", children: [jsxRuntimeExports.jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsxRuntimeExports.jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
2667
6792
|
boxShadow: generateMarkerLines(40),
|
|
2668
|
-
} })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current', `tw-duration-${animationDuration}`) })] }));
|
|
6793
|
+
} })] }), jsxRuntimeExports.jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current', `tw-duration-${animationDuration}`) })] }));
|
|
2669
6794
|
}
|
|
2670
6795
|
function generateMarkerLines(count) {
|
|
2671
6796
|
const halfCount = Math.ceil(count / 2);
|
|
@@ -2693,400 +6818,157 @@ const buttonVariantClassMap = {
|
|
|
2693
6818
|
const buttonDisabledClass = 'disabled:tw-bg-grey-800 disabled:tw-text-grey-600';
|
|
2694
6819
|
function Button(_a) {
|
|
2695
6820
|
var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
|
|
2696
|
-
return (jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
6821
|
+
return (jsxRuntimeExports.jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
2697
6822
|
// disabled styles
|
|
2698
6823
|
buttonDisabledClass,
|
|
2699
6824
|
// custom classes from props
|
|
2700
|
-
props.className), children: size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
6825
|
+
props.className), children: size === 'lg' ? (jsxRuntimeExports.jsx("span", { className: "tw-px-squid-m", children: jsxRuntimeExports.jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
2701
6826
|
// label only
|
|
2702
|
-
jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
6827
|
+
jsxRuntimeExports.jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
2703
6828
|
// icon only
|
|
2704
6829
|
icon) : (
|
|
2705
6830
|
// icon and label
|
|
2706
|
-
jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
|
|
6831
|
+
jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [icon, jsxRuntimeExports.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
|
|
6832
|
+
}
|
|
6833
|
+
|
|
6834
|
+
function CaptionText(_a) {
|
|
6835
|
+
var { children, bold } = _a, props = __rest(_a, ["children", "bold"]);
|
|
6836
|
+
const boldClass = bold
|
|
6837
|
+
? 'tw-font-typography-bold'
|
|
6838
|
+
: 'tw-font-typography-regular';
|
|
6839
|
+
return (jsxRuntimeExports.jsx("span", Object.assign({}, props, { className: cn(boldClass, 'tw-text-caption tw-leading-caption', props.className), children: children })));
|
|
2707
6840
|
}
|
|
2708
6841
|
|
|
2709
6842
|
function Chip(_a) {
|
|
2710
6843
|
var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
|
|
2711
|
-
return (jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
6844
|
+
return (jsxRuntimeExports.jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsxRuntimeExports.jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
2712
6845
|
}
|
|
2713
6846
|
|
|
2714
|
-
function
|
|
2715
|
-
return (
|
|
6847
|
+
function getDominantColor(_a) {
|
|
6848
|
+
return __awaiter(this, arguments, void 0, function* ({ imageUrl, sampleSize = 1000, }) {
|
|
6849
|
+
return new Promise((resolve, reject) => {
|
|
6850
|
+
const img = document.createElement('img');
|
|
6851
|
+
img.src = imageUrl;
|
|
6852
|
+
img.crossOrigin = 'Anonymous';
|
|
6853
|
+
img.onload = () => {
|
|
6854
|
+
const canvas = document.createElement('canvas');
|
|
6855
|
+
const ctx = canvas.getContext('2d');
|
|
6856
|
+
if (!ctx)
|
|
6857
|
+
return reject(new Error('Could not create canvas context'));
|
|
6858
|
+
const width = img.width;
|
|
6859
|
+
const height = img.height;
|
|
6860
|
+
const aspectRatio = width / height;
|
|
6861
|
+
const newWidth = Math.sqrt(sampleSize * aspectRatio);
|
|
6862
|
+
const newHeight = Math.sqrt(sampleSize / aspectRatio);
|
|
6863
|
+
canvas.width = newWidth;
|
|
6864
|
+
canvas.height = newHeight;
|
|
6865
|
+
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
|
6866
|
+
const imageData = ctx.getImageData(0, 0, newWidth, newHeight);
|
|
6867
|
+
const data = imageData.data;
|
|
6868
|
+
const colorCounts = {};
|
|
6869
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
6870
|
+
const r = data[i];
|
|
6871
|
+
const g = data[i + 1];
|
|
6872
|
+
const b = data[i + 2];
|
|
6873
|
+
const color = `${r},${g},${b}`;
|
|
6874
|
+
colorCounts[color] = (colorCounts[color] || 0) + 1;
|
|
6875
|
+
}
|
|
6876
|
+
let dominantColor = '';
|
|
6877
|
+
let maxCount = 0;
|
|
6878
|
+
for (const color in colorCounts) {
|
|
6879
|
+
if (colorCounts[color] > maxCount) {
|
|
6880
|
+
dominantColor = color;
|
|
6881
|
+
maxCount = colorCounts[color];
|
|
6882
|
+
}
|
|
6883
|
+
}
|
|
6884
|
+
resolve(dominantColor.split(',').map(Number));
|
|
6885
|
+
};
|
|
6886
|
+
img.onerror = reject;
|
|
6887
|
+
});
|
|
6888
|
+
});
|
|
6889
|
+
}
|
|
6890
|
+
function getContrastColor({ r, g, b, }) {
|
|
6891
|
+
const brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
6892
|
+
return brightness >= 128 ? '#000' : '#fff';
|
|
2716
6893
|
}
|
|
2717
6894
|
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
*/
|
|
2722
|
-
const themeTypesKeys = {
|
|
2723
|
-
'accent-gold': {
|
|
2724
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}accent-gold`,
|
|
2725
|
-
},
|
|
2726
|
-
'accent-salmon': {
|
|
2727
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}accent-salmon`,
|
|
2728
|
-
},
|
|
2729
|
-
'grey-100': {
|
|
2730
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-100`,
|
|
2731
|
-
},
|
|
2732
|
-
'grey-200': {
|
|
2733
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-200`,
|
|
2734
|
-
},
|
|
2735
|
-
'grey-300': {
|
|
2736
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-300`,
|
|
2737
|
-
},
|
|
2738
|
-
'grey-400': {
|
|
2739
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-400`,
|
|
2740
|
-
},
|
|
2741
|
-
'grey-500': {
|
|
2742
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-500`,
|
|
2743
|
-
},
|
|
2744
|
-
'grey-600': {
|
|
2745
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-600`,
|
|
2746
|
-
},
|
|
2747
|
-
'grey-700': {
|
|
2748
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-700`,
|
|
2749
|
-
},
|
|
2750
|
-
'grey-800': {
|
|
2751
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-800`,
|
|
2752
|
-
},
|
|
2753
|
-
'grey-900': {
|
|
2754
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-900`,
|
|
2755
|
-
},
|
|
2756
|
-
'material-dark-average': {
|
|
2757
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-dark-average`,
|
|
2758
|
-
},
|
|
2759
|
-
'material-dark-thick': {
|
|
2760
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-dark-thick`,
|
|
2761
|
-
},
|
|
2762
|
-
'material-dark-thin': {
|
|
2763
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-dark-thin`,
|
|
2764
|
-
},
|
|
2765
|
-
'material-light-average': {
|
|
2766
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-average`,
|
|
2767
|
-
},
|
|
2768
|
-
'material-light-thick': {
|
|
2769
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-thick`,
|
|
2770
|
-
},
|
|
2771
|
-
'material-light-thin': {
|
|
2772
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-thin`,
|
|
2773
|
-
},
|
|
2774
|
-
'royal-100': {
|
|
2775
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-100`,
|
|
2776
|
-
},
|
|
2777
|
-
'royal-200': {
|
|
2778
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-200`,
|
|
2779
|
-
},
|
|
2780
|
-
'royal-300': {
|
|
2781
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-300`,
|
|
2782
|
-
},
|
|
2783
|
-
'royal-400': {
|
|
2784
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-400`,
|
|
2785
|
-
},
|
|
2786
|
-
'royal-500': {
|
|
2787
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-500`,
|
|
2788
|
-
},
|
|
2789
|
-
'royal-600': {
|
|
2790
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-600`,
|
|
2791
|
-
},
|
|
2792
|
-
'royal-700': {
|
|
2793
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-700`,
|
|
2794
|
-
},
|
|
2795
|
-
'royal-800': {
|
|
2796
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-800`,
|
|
2797
|
-
},
|
|
2798
|
-
'status-negative': {
|
|
2799
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-negative`,
|
|
2800
|
-
},
|
|
2801
|
-
'status-positive': {
|
|
2802
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-positive`,
|
|
2803
|
-
},
|
|
2804
|
-
'volt-300': {
|
|
2805
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-300`,
|
|
2806
|
-
},
|
|
2807
|
-
'volt-400': {
|
|
2808
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-400`,
|
|
2809
|
-
},
|
|
2810
|
-
'volt-600': {
|
|
2811
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-600`,
|
|
2812
|
-
},
|
|
2813
|
-
'volt-700': {
|
|
2814
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-700`,
|
|
2815
|
-
},
|
|
2816
|
-
'volt-800': {
|
|
2817
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-800`,
|
|
2818
|
-
},
|
|
2819
|
-
'volt-900': {
|
|
2820
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-900`,
|
|
2821
|
-
},
|
|
2822
|
-
};
|
|
6895
|
+
function PlusIcon() {
|
|
6896
|
+
return (jsxRuntimeExports.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntimeExports.jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round" }) }));
|
|
6897
|
+
}
|
|
2823
6898
|
|
|
6899
|
+
const DEFAULT_RGB = [158, 121, 210];
|
|
2824
6900
|
const imageClass = 'tw-w-10 tw-aspect-square tw-ml-2 tw-mr-2 -tw-translate-x-2 tw-flex tw-items-center tw-justify-center';
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
const
|
|
6901
|
+
function Dropdown({ chainImageUrl, tokenImageUrl, tokenSymbol, }) {
|
|
6902
|
+
const [tokenImageRgb, setTokenImageRgb] = reactExports.useState(DEFAULT_RGB);
|
|
6903
|
+
const [chainImageRgb, setChainImageRgb] = reactExports.useState(DEFAULT_RGB);
|
|
6904
|
+
reactExports.useEffect(() => {
|
|
6905
|
+
if (tokenImageUrl) {
|
|
6906
|
+
// get dominant color when image is loaded
|
|
6907
|
+
getDominantColor({ imageUrl: tokenImageUrl })
|
|
6908
|
+
.then((color) => {
|
|
6909
|
+
setTokenImageRgb(color);
|
|
6910
|
+
})
|
|
6911
|
+
.catch((error) => {
|
|
6912
|
+
setTokenImageRgb(DEFAULT_RGB);
|
|
6913
|
+
console.error('Error getting dominant color for token:', error);
|
|
6914
|
+
});
|
|
6915
|
+
}
|
|
6916
|
+
if (chainImageUrl) {
|
|
6917
|
+
getDominantColor({ imageUrl: chainImageUrl })
|
|
6918
|
+
.then((color) => {
|
|
6919
|
+
setChainImageRgb(color);
|
|
6920
|
+
})
|
|
6921
|
+
.catch((error) => {
|
|
6922
|
+
setChainImageRgb(DEFAULT_RGB);
|
|
6923
|
+
console.error('Error getting dominant color for chain:', error);
|
|
6924
|
+
});
|
|
6925
|
+
}
|
|
6926
|
+
}, []);
|
|
6927
|
+
const dropdownGradient = reactExports.useMemo(() => {
|
|
6928
|
+
const defaultRgb = DEFAULT_RGB.join(',');
|
|
2828
6929
|
// if no chain icon, gradient is as follows:
|
|
2829
6930
|
// 0%-100% default color
|
|
2830
6931
|
if (!chainImageUrl) {
|
|
2831
|
-
return `linear-gradient(to right, ${
|
|
6932
|
+
return `linear-gradient(to right, rgb(${defaultRgb}), rgb(${defaultRgb}))`;
|
|
2832
6933
|
}
|
|
6934
|
+
const tokenRgb = tokenImageRgb.join(',');
|
|
6935
|
+
const chainRgb = chainImageRgb.join(',');
|
|
2833
6936
|
// if chain icon present but no token icon, gradient is as follows:
|
|
2834
6937
|
// 0%-25% chain color, 25%-100% default color
|
|
2835
6938
|
if (!tokenImageUrl) {
|
|
2836
|
-
return `linear-gradient(to right, ${
|
|
6939
|
+
return `linear-gradient(to right, rgb(${chainRgb}) 25%, rgb(${defaultRgb}) 30%)`;
|
|
2837
6940
|
}
|
|
2838
6941
|
// if both chain and token icons present, gradient is as follows:
|
|
2839
6942
|
// 0%-20% chain color, 20%-100% token color
|
|
2840
|
-
return `linear-gradient(to right, ${
|
|
2841
|
-
}, [
|
|
2842
|
-
return (jsxs("div", { className: "
|
|
6943
|
+
return `linear-gradient(to right, rgb(${chainRgb}) 20%, rgb(${tokenRgb}) 25%)`;
|
|
6944
|
+
}, [chainImageUrl, tokenImageUrl, tokenImageRgb, chainImageRgb]);
|
|
6945
|
+
return (jsxRuntimeExports.jsxs("div", { className: "dropdown-mask tw-flex tw-h-10 tw-w-[209px] tw-items-center tw-text-grey-100", style: {
|
|
2843
6946
|
backgroundImage: dropdownGradient,
|
|
2844
|
-
}, children: [jsx("div", { className: clsx(imageClass), children: chainImageUrl ? jsx("img", { src: chainImageUrl, alt: "" }) : jsx(PlusIcon, {}) }), tokenImageUrl && chainImageUrl ? (jsx("div", { className: clsx(imageClass), children: jsx("img", { src: tokenImageUrl, alt: "" }) })) : null, tokenImageUrl && chainImageUrl ? (jsx(
|
|
6947
|
+
}, children: [jsxRuntimeExports.jsx("div", { className: clsx(imageClass), children: chainImageUrl ? jsxRuntimeExports.jsx("img", { src: chainImageUrl, alt: "" }) : jsxRuntimeExports.jsx(PlusIcon, {}) }), tokenImageUrl && chainImageUrl ? (jsxRuntimeExports.jsx("div", { className: clsx(imageClass), children: jsxRuntimeExports.jsx("img", { src: tokenImageUrl, alt: "" }) })) : null, tokenImageUrl && chainImageUrl ? (jsxRuntimeExports.jsx(TokenSymbol, { rgb: tokenImageRgb, symbol: tokenSymbol || '' })) : (jsxRuntimeExports.jsx(SelectTokenLabel, {}))] }));
|
|
2845
6948
|
}
|
|
2846
|
-
const TokenSymbol = ({ symbol }) => {
|
|
2847
|
-
return (jsxs("div", { className: "tw-mx-auto tw-flex tw-items-center tw-justify-center tw-gap-1.5",
|
|
6949
|
+
const TokenSymbol = ({ rgb, symbol, }) => {
|
|
6950
|
+
return (jsxRuntimeExports.jsxs("div", { className: "tw-mx-auto tw-flex tw-items-center tw-justify-center tw-gap-1.5", style: {
|
|
6951
|
+
color: getContrastColor({
|
|
6952
|
+
r: Number(rgb[0]),
|
|
6953
|
+
g: Number(rgb[1]),
|
|
6954
|
+
b: Number(rgb[2]),
|
|
6955
|
+
}),
|
|
6956
|
+
}, children: [jsxRuntimeExports.jsx(BodyText, { size: "small", children: symbol }), jsxRuntimeExports.jsx(ChevronArrowIcon, {})] }));
|
|
2848
6957
|
};
|
|
2849
6958
|
const SelectTokenLabel = () => {
|
|
2850
|
-
return (jsxs("div", { className: "tw-mx-auto tw-flex tw-items-center tw-justify-center tw-gap-1.5", children: [jsx(BodyText, { size: "small", children: "Select token" }), jsx(ChevronArrowIcon, {})] }));
|
|
2851
|
-
};
|
|
2852
|
-
|
|
2853
|
-
function EthereumIcon() {
|
|
2854
|
-
return (jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M9.99866 2.91669L9.99866 12.6994L14.471 10.1298L9.99866 2.91669Z", fill: "currentColor" }), jsx("path", { d: "M9.99872 2.91669L5.52637 10.1298L9.99872 12.6995V8.15387V2.91669Z", fill: "currentColor" }), jsx("path", { d: "M9.99866 13.5226V17.0802L14.4737 10.9542L9.99866 13.5226Z", fill: "currentColor" }), jsx("path", { d: "M9.99872 17.0801V13.5225L5.52637 10.9542L9.99872 17.0801Z", fill: "currentColor" }), jsx("path", { d: "M9.99866 12.6994L14.4709 10.1298L9.99866 8.15387V12.6994Z", fill: "currentColor" }), jsx("path", { d: "M5.52637 10.1298L9.99865 12.6994V8.15387L5.52637 10.1298Z", fill: "currentColor" })] }));
|
|
2855
|
-
}
|
|
2856
|
-
|
|
2857
|
-
function FeeButton() {
|
|
2858
|
-
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-px-squid-xs", children: [jsx(Chip, { label: "Fee" }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: 560 })] })] }));
|
|
2859
|
-
}
|
|
2860
|
-
|
|
2861
|
-
function SearchIcon() {
|
|
2862
|
-
return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M20 20L16.05 16.05M18 11C18 14.866 14.866 18 11 18C7.13401 18 4 14.866 4 11C4 7.13401 7.13401 4 11 4C14.866 4 18 7.13401 18 11Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
2863
|
-
}
|
|
2864
|
-
|
|
2865
|
-
function Input(_a) {
|
|
2866
|
-
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon"]);
|
|
2867
|
-
return (jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsx("input", Object.assign({}, props, { className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-medium tw-text-grey-300 tw-outline-none tw-outline-offset-0 placeholder:tw-text-grey-600 focus:tw-outline-2 focus:tw-outline-royal-500', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5', className), placeholder: placeholder })), showIcon ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsx(SearchIcon, {}) })) : null, showPasteButton ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsx(PasteButton, {}) })) : null] }));
|
|
2868
|
-
}
|
|
2869
|
-
const PasteButton = () => {
|
|
2870
|
-
return (jsx("button", { className: "tw-h-[30px] tw-rounded-full tw-border tw-border-grey-700 tw-bg-grey-800 tw-px-2 tw-text-grey-300", children: jsx(CaptionText, { children: "Paste" }) }));
|
|
2871
|
-
};
|
|
2872
|
-
|
|
2873
|
-
const switchSizeClassMap = {
|
|
2874
|
-
small: 'tw-w-[36px] tw-h-squid-m tw-p-0.5',
|
|
2875
|
-
large: 'tw-w-[54px] tw-h-squid-l tw-p-[3px]',
|
|
2876
|
-
};
|
|
2877
|
-
const switchCircleSizeClassMap = {
|
|
2878
|
-
small: 'tw-w-4 tw-h-4',
|
|
2879
|
-
large: 'tw-w-6 tw-h-6',
|
|
6959
|
+
return (jsxRuntimeExports.jsxs("div", { className: "tw-mx-auto tw-flex tw-items-center tw-justify-center tw-gap-1.5", children: [jsxRuntimeExports.jsx(BodyText, { size: "small", children: "Select token" }), jsxRuntimeExports.jsx(ChevronArrowIcon, {})] }));
|
|
2880
6960
|
};
|
|
2881
|
-
function Switch({ checked, onChange, size }) {
|
|
2882
|
-
return (
|
|
2883
|
-
// Switch container
|
|
2884
|
-
jsxs("label", { className: clsx('tw-relative tw-inline-flex tw-items-center tw-justify-end tw-overflow-hidden tw-rounded-squid-m tw-border tw-border-material-light-thin',
|
|
2885
|
-
// size styles
|
|
2886
|
-
switchSizeClassMap[size],
|
|
2887
|
-
// checked styles
|
|
2888
|
-
checked ? 'tw-bg-status-positive' : 'tw-bg-grey-800'), children: [jsx("input", { checked: checked, onChange: (e) => onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" }), jsx("span", { style: {
|
|
2889
|
-
filter: 'drop-shadow(0px 5px 20px rgba(0, 0, 0, 0.33)) drop-shadow(0px 2px 5px rgba(0, 0, 0, 0.20))',
|
|
2890
|
-
}, className: clsx('tw-absolute tw-rounded-full tw-border tw-border-material-light-thin',
|
|
2891
|
-
// size styles
|
|
2892
|
-
switchCircleSizeClassMap[size],
|
|
2893
|
-
// disabled and checked styles
|
|
2894
|
-
checked
|
|
2895
|
-
? 'tw-right-0.5 tw-bg-grey-100'
|
|
2896
|
-
: 'tw-left-0.5 tw-bg-grey-500') })] }));
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
|
-
function Menu(_a) {
|
|
2900
|
-
var { children, menuClassName, contentClassName } = _a, props = __rest(_a, ["children", "menuClassName", "contentClassName"]);
|
|
2901
|
-
return (jsx("div", Object.assign({}, props, { className: menuClassName, children: jsx("div", { style: {
|
|
2902
|
-
boxShadow: '0px 2px 5px 1px rgba(0, 0, 0, 0.20), 0px 5px 20px -1px rgba(0, 0, 0, 0.33)',
|
|
2903
|
-
backdropFilter: 'blur(calc(20px / 2))',
|
|
2904
|
-
}, className: cn('tw-w-full tw-max-w-[320px] tw-items-center tw-justify-center tw-rounded-squid-m tw-border tw-border-material-light-thin tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick', contentClassName), children: typeof children === 'string' ? (jsx(CaptionText, { children: children })) : (children) }) })));
|
|
2905
|
-
}
|
|
2906
|
-
|
|
2907
|
-
const tooltipWidthClassMap = {
|
|
2908
|
-
max: 'tw-w-max',
|
|
2909
|
-
container: 'tw-w-full',
|
|
2910
|
-
};
|
|
2911
|
-
const tooltipThresholdClassMap = {
|
|
2912
|
-
xxs: 'tw-pb-squid-xxs',
|
|
2913
|
-
xs: 'tw-pb-squid-xs',
|
|
2914
|
-
s: 'tw-pb-squid-s',
|
|
2915
|
-
m: 'tw-pb-squid-m',
|
|
2916
|
-
l: 'tw-pb-squid-l',
|
|
2917
|
-
xl: 'tw-pb-squid-xl',
|
|
2918
|
-
xxl: 'tw-pb-squid-xxl',
|
|
2919
|
-
};
|
|
2920
|
-
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', className, }) {
|
|
2921
|
-
return (jsxs("div", { className: cn('tw-relative', className), children: [jsx("div", { className: "tw-peer", children: children }), jsx(Menu, { menuClassName: cn('tw-absolute peer-hover:tw-block hover:tw-block tw-hidden tw-z-40', 'tw-left-1/2 -tw-translate-x-1/2 tw-bottom-full', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold]), children: tooltipContent })] }));
|
|
2922
|
-
}
|
|
2923
|
-
|
|
2924
|
-
function Boost() {
|
|
2925
|
-
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs", children: [jsx(BoostButton, {}), jsx(Chip, { label: "20s", className: "tw-bg-status-positive tw-text-grey-900" })] }));
|
|
2926
|
-
}
|
|
2927
|
-
|
|
2928
|
-
var DetailsToolbarState;
|
|
2929
|
-
(function (DetailsToolbarState) {
|
|
2930
|
-
DetailsToolbarState[DetailsToolbarState["FULL"] = 0] = "FULL";
|
|
2931
|
-
DetailsToolbarState[DetailsToolbarState["LOADING"] = 1] = "LOADING";
|
|
2932
|
-
DetailsToolbarState[DetailsToolbarState["EMPTY"] = 2] = "EMPTY";
|
|
2933
|
-
DetailsToolbarState[DetailsToolbarState["ERROR"] = 3] = "ERROR";
|
|
2934
|
-
})(DetailsToolbarState || (DetailsToolbarState = {}));
|
|
2935
|
-
|
|
2936
|
-
function EmojiSadIcon() {
|
|
2937
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20ZM13.5341 12.4645C11.5815 10.5118 8.41568 10.5118 6.46306 12.4645C6.07254 12.855 6.07254 13.4882 6.46306 13.8787C6.85358 14.2692 7.48675 14.2692 7.87727 13.8787C9.04885 12.7071 10.9483 12.7071 12.1199 13.8787C12.5104 14.2692 13.1436 14.2692 13.5341 13.8787C13.9247 13.4882 13.9247 12.855 13.5341 12.4645ZM8.5 7.5C8.5 8.32843 7.94036 9 7.25 9C6.55964 9 6 8.32843 6 7.5C6 6.67157 6.55964 6 7.25 6C7.94036 6 8.5 6.67157 8.5 7.5ZM12.75 9C13.4404 9 14 8.32843 14 7.5C14 6.67157 13.4404 6 12.75 6C12.0596 6 11.5 6.67157 11.5 7.5C11.5 8.32843 12.0596 9 12.75 9Z", fill: "currentColor" }) }));
|
|
2938
|
-
}
|
|
2939
|
-
|
|
2940
|
-
const detailStateClassMap = {
|
|
2941
|
-
[DetailsToolbarState.LOADING]: 'tw-opacity-33 tw-pointer-events-none',
|
|
2942
|
-
[DetailsToolbarState.EMPTY]: 'tw-pointer-events-none tw-hidden',
|
|
2943
|
-
[DetailsToolbarState.ERROR]: 'tw-opacity-33 tw-pointer-events-none',
|
|
2944
|
-
[DetailsToolbarState.FULL]: '',
|
|
2945
|
-
};
|
|
2946
|
-
function DetailsToolbar({ state = DetailsToolbarState.FULL, errorMessage, }) {
|
|
2947
|
-
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
2948
|
-
return (jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state === DetailsToolbarState.ERROR ? (jsx(ErrorMessage, { message: errorMessage })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, {}) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === DetailsToolbarState.LOADING ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", className: "tw-border-transparent tw-bg-transparent", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, {}) })] })) }));
|
|
2949
|
-
}
|
|
2950
|
-
const ErrorMessage = ({ message }) => {
|
|
2951
|
-
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-status-negative", children: [jsx(EmojiSadIcon, {}), jsx(CaptionText, { children: message })] }));
|
|
2952
|
-
};
|
|
2953
|
-
|
|
2954
|
-
function Modal({ children }) {
|
|
2955
|
-
return (
|
|
2956
|
-
// modal container
|
|
2957
|
-
jsx("div", { className: "tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-thick tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m", style: {
|
|
2958
|
-
backdropFilter: 'blur(20px)',
|
|
2959
|
-
}, children: jsx("div", { className: "tw-relative tw-flex tw-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-gap-squid-xxs tw-self-end tw-overflow-hidden", children: children }) }));
|
|
2960
|
-
}
|
|
2961
|
-
|
|
2962
|
-
// font size, line height, and letter spacing classes
|
|
2963
|
-
const textClassMap = {
|
|
2964
|
-
small: 'tw-text-heading-small tw-tracking-heading-small tw-leading-heading-small',
|
|
2965
|
-
medium: 'tw-text-heading-medium tw-tracking-heading-medium tw-leading-heading-medium',
|
|
2966
|
-
large: 'tw-text-heading-large tw-tracking-heading-large tw-leading-heading-large',
|
|
2967
|
-
};
|
|
2968
|
-
function HeadingText({ children, bold, size }) {
|
|
2969
|
-
const fontWeightClass = bold
|
|
2970
|
-
? 'tw-font-heading-bold'
|
|
2971
|
-
: 'tw-font-heading-regular';
|
|
2972
|
-
return (jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
|
|
2973
|
-
}
|
|
2974
|
-
|
|
2975
|
-
function NavigationBar({ title, displayBackButton = false, logoUrl, }) {
|
|
2976
|
-
return (jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-bg-grey-900 tw-text-grey-300'), children: [jsxs("div", { className: cn('tw-flex tw-h-squid-xxl tw-items-center tw-justify-end tw-gap-x-squid-xs', displayBackButton ? 'tw-px-squid-m' : 'tw-pl-squid-l tw-pr-squid-m'), children: [displayBackButton ? (jsx(Button, { variant: "tertiary", size: "md", icon: jsx(ArrowLeftIcon, {}) })) : null, logoUrl ? (jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end", children: jsx(AddressButton, { label: "Connect" }) })] }), title ? (jsx("div", { className: "tw-flex tw-h-squid-xxl tw-items-center tw-px-squid-l tw-py-squid-xxs", children: jsx(HeadingText, { size: "small", children: title }) })) : null] }));
|
|
2977
|
-
}
|
|
2978
|
-
|
|
2979
|
-
function ProductCard({ children }) {
|
|
2980
|
-
return (jsx("div", { className: "tw-h-card tw-min-h-card tw-w-card tw-rounded-squid-xl tw-border-[1px] tw-border-solid tw-border-material-light-thick tw-bg-material-light-thick tw-p-squid-xs tw-backdrop-blur-[calc(1.25rem/2)]", children: jsx("div", { className: "tw-relative tw-flex tw-h-full tw-max-h-[660px] tw-w-full tw-flex-col tw-overflow-hidden tw-rounded-squid-l tw-bg-grey-900 tw-text-grey-300", children: children }) }));
|
|
2981
|
-
}
|
|
2982
|
-
|
|
2983
|
-
function MaxIcon() {
|
|
2984
|
-
return (jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("g", { "clip-path": "url(#clip0_41_20801)", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM10.6508 4.74074L14.1508 7.74074C14.5701 8.10017 14.6187 8.73147 14.2593 9.15079C13.8998 9.57012 13.2685 9.61868 12.8492 9.25926L10 6.81708L7.15079 9.25926C6.73147 9.61868 6.10017 9.57012 5.74074 9.15079C5.38132 8.73147 5.42988 8.10017 5.84921 7.74074L9.34921 4.74074C9.7237 4.41975 10.2763 4.41975 10.6508 4.74074ZM14.1508 13.7407L10.6508 10.7407C10.2763 10.4198 9.7237 10.4198 9.34921 10.7407L5.84921 13.7407C5.42988 14.1002 5.38132 14.7315 5.74074 15.1508C6.10017 15.5701 6.73147 15.6187 7.15079 15.2593L10 12.8171L12.8492 15.2593C13.2685 15.6187 13.8998 15.5701 14.2593 15.1508C14.6187 14.7315 14.5701 14.1002 14.1508 13.7407Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_41_20801", children: jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
|
|
2985
|
-
}
|
|
2986
6961
|
|
|
2987
|
-
function
|
|
2988
|
-
return (jsxs("
|
|
2989
|
-
}
|
|
2990
|
-
|
|
2991
|
-
function WalletAddress({ address, ens }) {
|
|
2992
|
-
return (jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", children: ens ? ens : (address === null || address === void 0 ? void 0 : address.slice(0, 6)) + '...' + (address === null || address === void 0 ? void 0 : address.slice(-4)) }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronArrowIcon, {}) })] }));
|
|
2993
|
-
}
|
|
2994
|
-
|
|
2995
|
-
function SwapConfiguration({ priceImpactPercentage, amount = 0, swapAmountUsd = 0, balance = '0', isFetching = false, chain, token, direction, }) {
|
|
2996
|
-
const priceImpactClass = (priceImpactPercentage !== null && priceImpactPercentage !== void 0 ? priceImpactPercentage : 0) > 5
|
|
2997
|
-
? 'tw-text-status-negative'
|
|
2998
|
-
: 'tw-text-grey-300';
|
|
2999
|
-
return (jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-px-squid-l tw-pb-squid-m", children: [jsxs("header", { className: "tw-flex tw-items-center tw-gap-1 tw-py-squid-s tw-leading-5 tw-text-grey-300", children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { className: "tw-text-grey-600", size: "small", children: ":" }), jsx(WalletAddress, { ens: "so-so.eth" })] }), jsx(Dropdown, { chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol, chainBgColor: chain === null || chain === void 0 ? void 0 : chain.bgColor, tokenBgColor: token === null || token === void 0 ? void 0 : token.bgColor, tokenTextColor: token === null || token === void 0 ? void 0 : token.textColor }), jsx("input", { className: "tw-h-[75px] tw-w-full tw-bg-transparent tw-py-squid-m tw-text-heading-small tw-font-heading-regular tw-text-royal-400 placeholder:tw-text-grey-600 focus:tw-outline-none", placeholder: "0", value: amount }), !(token === null || token === void 0 ? void 0 : token.iconUrl) || isFetching ? null : (jsxs("footer", { className: "tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-items-center tw-gap-1.5", children: [jsx(SwapInputsIcon, {}), jsx(UsdAmount, { usdAmount: swapAmountUsd }), priceImpactPercentage ? (jsxs("span", { className: clsx('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }), jsxs("div", { className: "tw-flex tw-items-center tw-gap-1.5", children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balance }), jsx(MaxIcon, {})] })] }))] }));
|
|
3000
|
-
}
|
|
3001
|
-
|
|
3002
|
-
function DropdownMenuItem({ label, imageUrl, icon, }) {
|
|
3003
|
-
return (jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", children: jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-pl-squid-xxs", children: [jsx("div", { className: "tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-between tw-rounded-squid-xs", children: imageUrl ? (jsx("img", { src: imageUrl, className: "tw-h-full tw-w-full tw-rounded-squid-xxs" })) : (icon) }), jsx(CaptionText, { children: label })] }) }));
|
|
3004
|
-
}
|
|
3005
|
-
|
|
3006
|
-
function DotGrid1x3HorizontalIcon() {
|
|
3007
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M1.33325 8.00008C1.33325 7.2637 1.93021 6.66675 2.66659 6.66675C3.40297 6.66675 3.99992 7.2637 3.99992 8.00008C3.99992 8.73646 3.40297 9.33341 2.66659 9.33341C1.93021 9.33341 1.33325 8.73646 1.33325 8.00008ZM6.66659 8.00008C6.66659 7.2637 7.26354 6.66675 7.99992 6.66675C8.7363 6.66675 9.33325 7.2637 9.33325 8.00008C9.33325 8.73646 8.7363 9.33341 7.99992 9.33341C7.26354 9.33341 6.66659 8.73646 6.66659 8.00008ZM11.9999 8.00008C11.9999 7.2637 12.5969 6.66675 13.3333 6.66675C14.0696 6.66675 14.6666 7.2637 14.6666 8.00008C14.6666 8.73646 14.0696 9.33341 13.3333 9.33341C12.5969 9.33341 11.9999 8.73646 11.9999 8.00008Z", fill: "currentColor" }) }));
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
|
-
function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', }) {
|
|
3011
|
-
return (jsxs("li", { className: "tw-flex tw-h-list-item-large tw-w-list-item-small tw-items-center tw-gap-squid-xs tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-300", children: [jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [isPending ? (jsx("span", { className: "tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-30 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-rounded-full tw-border tw-border-grey-900 tw-bg-royal-400 tw-p-0.5", children: jsx(DotGrid1x3HorizontalIcon, {}) })) : null, jsx("img", { src: firstImageUrl, className: "tw-absolute tw-z-20 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-z-10 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxs("div", { className: "tw-flex tw-h-10 tw-w-[230px] tw-flex-col", children: [jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-items-center", children: [jsx(CaptionText, { children: fromLabel }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronRightSmallIcon, {}) }), jsx(CaptionText, { children: toLabel })] }), isPending ? (jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsx(CaptionText, { children: dateCompleted }))] }), jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsx(BodyText, { size: "small", children: fromAmount }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronLargeRightIcon, {}) }), jsx(BodyText, { size: "small", children: toAmount })] })] })] }));
|
|
3012
|
-
}
|
|
3013
|
-
|
|
3014
|
-
const listItemSizeMap = {
|
|
3015
|
-
small: 'tw-max-w-list-item-small tw-h-list-item-small tw-px-squid-xs tw-mx-squid-xs',
|
|
3016
|
-
large: 'tw-max-w-list-item-large tw-h-list-item-large tw-px-squid-xs tw-mx-squid-xs',
|
|
3017
|
-
};
|
|
3018
|
-
function ListItem({ title, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className, }) {
|
|
3019
|
-
return (jsxs("li", { className: cn('tw-flex tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-300', listItemSizeMap[size], className), children: [size === 'large' ? (jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, size: "md", rounded: false })) })) : (jsx("div", { className: "tw-h-[30px] tw-w-[30px]", children: mainIcon ? (mainIcon) : (jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-w-full tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xs',
|
|
3020
|
-
// 'large' variant has extra padding
|
|
3021
|
-
size === 'large' && 'tw-px-squid-xxs'), children: [typeof title === 'string' ? (jsx(BodyText, { size: "small", className: "!tw-leading-[13px]", children: title })) : (title), size === 'large' && subtitle ? (jsx(CaptionText, { className: "tw-h-squid-xs !tw-leading-[10px] tw-text-grey-500", children: subtitle })) : null] }), jsxs("span", { className: "tw-flex tw-max-h-4 tw-items-center", children: [size === 'large' ? (jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })) : null, jsx("span", { className: "min-tw-w-4 min-tw-h-4", children: icon ? icon : null })] })] }));
|
|
3022
|
-
}
|
|
3023
|
-
|
|
3024
|
-
function MenuItem({ label, imageUrl, icon }) {
|
|
3025
|
-
return (jsxs("li", { className: "tw-mx-squid-xxs tw-inline-flex tw-max-h-list-item-small tw-items-center tw-justify-start tw-gap-squid-xxs tw-rounded-squid-xs tw-bg-grey-900 tw-py-squid-xxs tw-pl-squid-xxs tw-pr-squid-xl tw-text-grey-300", children: [jsx("div", { className: "tw-h-squid-m tw-w-squid-m", children: imageUrl ? (jsx("img", { className: "tw-h-full tw-w-full tw-rounded-squid-xxs", src: imageUrl, alt: "" })) : icon ? (icon) : null }), jsx(CaptionText, { children: label })] }));
|
|
3026
|
-
}
|
|
3027
|
-
|
|
3028
|
-
function SectionTitle({ title, icon, accessory, actionIcon, className, }) {
|
|
3029
|
-
return (jsxs("header", { className: cn('tw-flex tw-h-[46px] tw-w-full tw-items-center tw-gap-squid-xxs tw-bg-grey-900 tw-px-squid-m tw-pb-squid-xs tw-pt-squid-m tw-text-royal-400', className), children: [icon, jsx(CaptionText, { children: title }), accessory ? (jsx(CaptionText, { className: "tw-flex-1 tw-text-right tw-text-grey-500", children: accessory })) : actionIcon ? (jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end", children: actionIcon })) : null] }));
|
|
6962
|
+
function UsdAmount({ usdAmount }) {
|
|
6963
|
+
return (jsxRuntimeExports.jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxRuntimeExports.jsx(CaptionText, { className: "tw-text-grey-500/65", children: "$" }), jsxRuntimeExports.jsx(CaptionText, { children: usdAmount.toString() })] }));
|
|
3030
6964
|
}
|
|
3031
6965
|
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
* @param style
|
|
3035
|
-
*/
|
|
3036
|
-
const getParsedStyle = (style) => {
|
|
3037
|
-
if (style) {
|
|
3038
|
-
const styleKeys = Object.keys(themeTypesKeys);
|
|
3039
|
-
const parsed = styleKeys.map((sk) => {
|
|
3040
|
-
const themeItem = themeTypesKeys[sk];
|
|
3041
|
-
let userValue = style[sk];
|
|
3042
|
-
return {
|
|
3043
|
-
[themeItem.cssVariable]: userValue,
|
|
3044
|
-
};
|
|
3045
|
-
});
|
|
3046
|
-
// adds a variant with 0.05 opacity for each color
|
|
3047
|
-
// will result in variables like this:
|
|
3048
|
-
// var(--squid-theme-grey-100-005) --> grey-100 with 0.05 opacity
|
|
3049
|
-
// styleKeys.forEach((sk) => {
|
|
3050
|
-
// const themeItem = themeTypesKeys[sk]
|
|
3051
|
-
// const valueWith005Opacity = getHexColorFromOpacityPercentage(
|
|
3052
|
-
// style[sk], // i.e "#ffffff"
|
|
3053
|
-
// 0.05,
|
|
3054
|
-
// )
|
|
3055
|
-
// // { "--squid-theme-grey-100-005": "#ffffff80" }
|
|
3056
|
-
// parsed.push({
|
|
3057
|
-
// [`${themeItem.cssVariable}-005`]: valueWith005Opacity,
|
|
3058
|
-
// })
|
|
3059
|
-
// })
|
|
3060
|
-
parsed.push({
|
|
3061
|
-
[`${themeTypesKeys['grey-100'].cssVariable}-005`]: getHexColorFromOpacityPercentage(style['grey-100'], 0.05),
|
|
3062
|
-
});
|
|
3063
|
-
return parsed.reduce((a, v) => {
|
|
3064
|
-
const key = Object.keys(v)[0];
|
|
3065
|
-
return Object.assign(Object.assign({}, a), { [key]: v[key] });
|
|
3066
|
-
});
|
|
3067
|
-
}
|
|
3068
|
-
};
|
|
3069
|
-
/**
|
|
3070
|
-
* Returns a hexadecimal color with opacity based on the given color and opacity percentage.
|
|
3071
|
-
*
|
|
3072
|
-
* @example getHexColorFromOpacityPercentage('#FF0000', 0.5) // '#FF000080'
|
|
3073
|
-
*
|
|
3074
|
-
* @param {string} color - The base color in hexadecimal format.
|
|
3075
|
-
* @param {number} opacity - The opacity percentage (0-1).
|
|
3076
|
-
* @returns {string} The hexadecimal color with opacity.
|
|
3077
|
-
*/
|
|
3078
|
-
function getHexColorFromOpacityPercentage(color, opacity) {
|
|
3079
|
-
return (color +
|
|
3080
|
-
Math.round(opacity * 255)
|
|
3081
|
-
.toString(16)
|
|
3082
|
-
.padStart(2, '0')).toUpperCase();
|
|
6966
|
+
function EthereumIcon() {
|
|
6967
|
+
return (jsxRuntimeExports.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntimeExports.jsx("path", { d: "M9.99866 2.91669L9.99866 12.6994L14.471 10.1298L9.99866 2.91669Z", fill: "currentColor" }), jsxRuntimeExports.jsx("path", { d: "M9.99872 2.91669L5.52637 10.1298L9.99872 12.6995V8.15387V2.91669Z", fill: "currentColor" }), jsxRuntimeExports.jsx("path", { d: "M9.99866 13.5226V17.0802L14.4737 10.9542L9.99866 13.5226Z", fill: "currentColor" }), jsxRuntimeExports.jsx("path", { d: "M9.99872 17.0801V13.5225L5.52637 10.9542L9.99872 17.0801Z", fill: "currentColor" }), jsxRuntimeExports.jsx("path", { d: "M9.99866 12.6994L14.4709 10.1298L9.99866 8.15387V12.6994Z", fill: "currentColor" }), jsxRuntimeExports.jsx("path", { d: "M5.52637 10.1298L9.99865 12.6994V8.15387L5.52637 10.1298Z", fill: "currentColor" })] }));
|
|
3083
6968
|
}
|
|
3084
6969
|
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
const Provider = squidConfigContext.Provider;
|
|
3088
|
-
const parsedStyle = getParsedStyle(theme);
|
|
3089
|
-
return (jsx(Provider, { value: theme, children: jsx("div", { style: parsedStyle, className: clsx('tw-text-base-content tw-relative tw-font-geist'), children: children }) }));
|
|
6970
|
+
function FeeButton() {
|
|
6971
|
+
return (jsxRuntimeExports.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-px-squid-xs", children: [jsxRuntimeExports.jsx(Chip, { label: "Fee" }), jsxRuntimeExports.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntimeExports.jsx(Chip, { icon: jsxRuntimeExports.jsx(EthereumIcon, {}) }), jsxRuntimeExports.jsx(UsdAmount, { usdAmount: 560 })] })] }));
|
|
3090
6972
|
}
|
|
3091
6973
|
|
|
3092
|
-
export { AddressButton, ArrowButton,
|
|
6974
|
+
export { AddressButton, ArrowButton, BoostButton, Button, Chip, Dropdown, FeeButton };
|