@avail-project/widgets 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/hooks/useNexusError.d.ts +1 -1
- package/dist/common/utils/token-pricing.d.ts +1 -1
- package/dist/common/utils/token-pricing.d.ts.map +1 -1
- package/dist/common/utils/token-pricing.js +4 -1
- package/dist/nexus/NexusProvider.d.ts +4 -2
- package/dist/nexus/NexusProvider.d.ts.map +1 -1
- package/dist/nexus/NexusProvider.js +216 -39
- package/dist/nexus-widget/components/deposit-idle-form.d.ts +2 -1
- package/dist/nexus-widget/components/deposit-idle-form.d.ts.map +1 -1
- package/dist/nexus-widget/components/deposit-idle-form.js +26 -10
- package/dist/nexus-widget/components/nexus-widget-progress-screen.d.ts.map +1 -1
- package/dist/nexus-widget/components/nexus-widget-progress-screen.js +21 -5
- package/dist/nexus-widget/components/pay-with-sources.d.ts.map +1 -1
- package/dist/nexus-widget/components/pay-with-sources.js +43 -54
- package/dist/nexus-widget/components/send-idle-form.d.ts +2 -1
- package/dist/nexus-widget/components/send-idle-form.d.ts.map +1 -1
- package/dist/nexus-widget/components/send-idle-form.js +26 -10
- package/dist/nexus-widget/components/swap-asset-selector.d.ts +1 -1
- package/dist/nexus-widget/components/swap-asset-selector.d.ts.map +1 -1
- package/dist/nexus-widget/components/swap-asset-selector.js +198 -140
- package/dist/nexus-widget/components/swap-idle-form.d.ts +2 -1
- package/dist/nexus-widget/components/swap-idle-form.d.ts.map +1 -1
- package/dist/nexus-widget/components/swap-idle-form.js +3 -3
- package/dist/nexus-widget/components/swap-intent-preview.d.ts +5 -1
- package/dist/nexus-widget/components/swap-intent-preview.d.ts.map +1 -1
- package/dist/nexus-widget/components/swap-intent-preview.js +50 -35
- package/dist/nexus-widget/nexus-widget.d.ts.map +1 -1
- package/dist/nexus-widget/nexus-widget.js +1311 -617
- package/dist/nexus-widget/types.d.ts +1 -1
- package/dist/nexus-widget/types.d.ts.map +1 -1
- package/dist/nexus-widget/utils/deposit-source-selection.d.ts.map +1 -1
- package/dist/nexus-widget/utils/deposit-source-selection.js +68 -4
- package/package.json +5 -5
|
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
import { formatTokenBalance } from "@avail-project/nexus-core/utils";
|
|
5
5
|
import Decimal from "decimal.js";
|
|
6
6
|
import { Check, ChevronDown, ChevronUp, Globe, Info, Loader2, Minus, Search, X, } from "lucide-react";
|
|
7
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
7
|
+
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
8
8
|
import { createPortal } from "react-dom";
|
|
9
9
|
import { CHAIN_METADATA, getSdkSwapSupportedChainIds, getShortChainName, isSwapSupportedBySdkChainList, } from "../../common/utils/constant";
|
|
10
10
|
const tabularNums = {
|
|
@@ -79,6 +79,44 @@ const SelectionControl = ({ selected, indeterminate = false, multi, }) => {
|
|
|
79
79
|
width: 20,
|
|
80
80
|
}, children: [selected && (_jsx(Check, { style: { color: "#FFFFFE", height: 14, width: 14 } })), !selected && indeterminate && (_jsx(Minus, { style: { color: "#FFFFFE", height: 14, width: 14 } }))] }));
|
|
81
81
|
};
|
|
82
|
+
function TokenLogo({ src, label, size, fontSize, style, fallbackBackground = brand, fallbackColor = "#FFFFFE", }) {
|
|
83
|
+
const normalizedSrc = src?.trim();
|
|
84
|
+
const [failed, setFailed] = useState(!normalizedSrc);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
setFailed(!normalizedSrc);
|
|
87
|
+
}, [normalizedSrc]);
|
|
88
|
+
if (!failed && normalizedSrc) {
|
|
89
|
+
return (_jsx("img", { alt: label || "", onError: () => setFailed(true), src: normalizedSrc, style: {
|
|
90
|
+
borderRadius: "999px",
|
|
91
|
+
height: size,
|
|
92
|
+
objectFit: "cover",
|
|
93
|
+
width: size,
|
|
94
|
+
...style,
|
|
95
|
+
} }));
|
|
96
|
+
}
|
|
97
|
+
return (_jsx("div", { style: {
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
backgroundColor: fallbackBackground,
|
|
100
|
+
borderRadius: "999px",
|
|
101
|
+
color: fallbackColor,
|
|
102
|
+
display: "flex",
|
|
103
|
+
flexShrink: 0,
|
|
104
|
+
fontFamily: '"Geist", system-ui, sans-serif',
|
|
105
|
+
fontSize,
|
|
106
|
+
fontWeight: 700,
|
|
107
|
+
height: size,
|
|
108
|
+
justifyContent: "center",
|
|
109
|
+
width: size,
|
|
110
|
+
...style,
|
|
111
|
+
}, children: (label || "?").slice(0, 2).toUpperCase() }));
|
|
112
|
+
}
|
|
113
|
+
const getChainLogo = (token) => {
|
|
114
|
+
if (!token)
|
|
115
|
+
return undefined;
|
|
116
|
+
return token.chainId
|
|
117
|
+
? (CHAIN_METADATA[token.chainId]?.logo ?? token.chainLogo)
|
|
118
|
+
: token.chainLogo;
|
|
119
|
+
};
|
|
82
120
|
/* ── Chain logo cluster ── */
|
|
83
121
|
const ChainLogos = ({ tokens }) => {
|
|
84
122
|
const clusterRef = useRef(null);
|
|
@@ -94,7 +132,7 @@ const ChainLogos = ({ tokens }) => {
|
|
|
94
132
|
seen.add(t.chainId);
|
|
95
133
|
out.push({
|
|
96
134
|
id: t.chainId,
|
|
97
|
-
logo: t
|
|
135
|
+
logo: getChainLogo(t),
|
|
98
136
|
name: getShortChainName(t.chainId, t.chainName),
|
|
99
137
|
balance: t.balance,
|
|
100
138
|
balanceInFiat: t.balanceInFiat,
|
|
@@ -186,17 +224,7 @@ const ChainLogos = ({ tokens }) => {
|
|
|
186
224
|
display: "flex",
|
|
187
225
|
gap: 8,
|
|
188
226
|
minWidth: 0,
|
|
189
|
-
}, children: [
|
|
190
|
-
borderRadius: "999px",
|
|
191
|
-
height: 16,
|
|
192
|
-
objectFit: "cover",
|
|
193
|
-
width: 16,
|
|
194
|
-
} })) : (_jsx("div", { style: {
|
|
195
|
-
backgroundColor: "#E8E8E7",
|
|
196
|
-
borderRadius: "999px",
|
|
197
|
-
height: 16,
|
|
198
|
-
width: 16,
|
|
199
|
-
} })), _jsx("span", { style: {
|
|
227
|
+
}, children: [_jsx(TokenLogo, { fallbackBackground: "#E8E8E7", fallbackColor: "#161615", fontSize: 8, label: chain.name, size: 16, src: chain.logo }), _jsx("span", { style: {
|
|
200
228
|
color: "#363635",
|
|
201
229
|
fontFamily: '"Geist", system-ui, sans-serif',
|
|
202
230
|
fontSize: 13,
|
|
@@ -218,18 +246,7 @@ const ChainLogos = ({ tokens }) => {
|
|
|
218
246
|
alignItems: "center",
|
|
219
247
|
gap: 2,
|
|
220
248
|
position: "relative",
|
|
221
|
-
}, children: [tooltip, shown.map((c
|
|
222
|
-
width: 16,
|
|
223
|
-
height: 16,
|
|
224
|
-
borderRadius: "999px",
|
|
225
|
-
objectFit: "cover",
|
|
226
|
-
border: "1px solid #fff",
|
|
227
|
-
} }, c.id)) : (_jsx("div", { style: {
|
|
228
|
-
width: 16,
|
|
229
|
-
height: 16,
|
|
230
|
-
borderRadius: "999px",
|
|
231
|
-
backgroundColor: "#E8E8E7",
|
|
232
|
-
} }, c.id))), _jsxs("span", { style: {
|
|
249
|
+
}, children: [tooltip, shown.map((c) => (_jsx(TokenLogo, { fallbackBackground: "#E8E8E7", fallbackColor: "#161615", fontSize: 8, label: c.name, size: 16, src: c.logo, style: { border: "1px solid #fff" } }, c.id))), _jsxs("span", { style: {
|
|
233
250
|
fontFamily: '"Geist", system-ui, sans-serif',
|
|
234
251
|
fontSize: 12,
|
|
235
252
|
color: "#848483",
|
|
@@ -327,7 +344,7 @@ function isNativeToken(t) {
|
|
|
327
344
|
return chain.includes("solana");
|
|
328
345
|
return false;
|
|
329
346
|
}
|
|
330
|
-
const MIN_FIAT_THRESHOLD =
|
|
347
|
+
const MIN_FIAT_THRESHOLD = 1;
|
|
331
348
|
const CHAIN_SELECTOR_CLOSE_MS = 220;
|
|
332
349
|
const MODAL_HEIGHT_TRANSITION_MS = 260;
|
|
333
350
|
const modalHeightTransitionStyle = {
|
|
@@ -372,6 +389,8 @@ export const compareChainsBySwapDisplayOrder = (a, b) => {
|
|
|
372
389
|
const UNIFIED_MAINNET_CHAIN_IDS = new Set([
|
|
373
390
|
1, 10, 56, 137, 143, 999, 4114, 8217, 8453, 42161, 43114, 534352, 4326,
|
|
374
391
|
]);
|
|
392
|
+
const UNIFIED_USDC_SYMBOL_KEYS = new Set(["USDC", "USDCE", "USDM"]);
|
|
393
|
+
const UNIFIED_USDT_SYMBOL_KEYS = new Set(["USDT", "USDT0", "USDTE"]);
|
|
375
394
|
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
376
395
|
const getTokenFiatValue = (token) => {
|
|
377
396
|
const parsed = Number(String(token.balanceInFiat ?? "").replace(/[^0-9.]/g, "") || 0);
|
|
@@ -626,9 +645,9 @@ function getUnifiedSymbol(token) {
|
|
|
626
645
|
return null;
|
|
627
646
|
}
|
|
628
647
|
const symbol = normalizeTokenGroupSymbol(token.symbol);
|
|
629
|
-
if (
|
|
648
|
+
if (UNIFIED_USDC_SYMBOL_KEYS.has(symbol))
|
|
630
649
|
return "USDC";
|
|
631
|
-
if (
|
|
650
|
+
if (UNIFIED_USDT_SYMBOL_KEYS.has(symbol))
|
|
632
651
|
return "USDT";
|
|
633
652
|
if (symbol === "ETH")
|
|
634
653
|
return "ETH";
|
|
@@ -702,6 +721,8 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
702
721
|
const [selectedChainFilter, setSelectedChainFilter] = useState(null);
|
|
703
722
|
const [isChainSearchFocused, setIsChainSearchFocused] = useState(false);
|
|
704
723
|
const stableListHeightRef = useRef(0);
|
|
724
|
+
const pendingSelectionScrollTopRef = useRef(null);
|
|
725
|
+
const skipNextSelectionScrollResetRef = useRef(false);
|
|
705
726
|
const [stableListHeight, setStableListHeight] = useState(null);
|
|
706
727
|
const lockedSelectedTokens = useMemo(() => dedupeTokenOptions(lockedTokens), [lockedTokens]);
|
|
707
728
|
const isLockedToken = useCallback((token) => lockedSelectedTokens.some((locked) => sameTokenOption(locked, token)), [lockedSelectedTokens]);
|
|
@@ -716,7 +737,6 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
716
737
|
const next = mergeTokenOptions(tokens, lockedSelectedTokens);
|
|
717
738
|
if (isMulti) {
|
|
718
739
|
setDraftSelectedTokens(next);
|
|
719
|
-
return;
|
|
720
740
|
}
|
|
721
741
|
onSelectionChange?.(next);
|
|
722
742
|
}, [isMulti, lockedSelectedTokens, onSelectionChange]);
|
|
@@ -734,10 +754,23 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
734
754
|
: normalizedInitialFilterTab);
|
|
735
755
|
}, [normalizedInitialFilterTab]);
|
|
736
756
|
useEffect(() => {
|
|
757
|
+
if (skipNextSelectionScrollResetRef.current) {
|
|
758
|
+
skipNextSelectionScrollResetRef.current = false;
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
737
761
|
if (listRef.current) {
|
|
738
762
|
listRef.current.scrollTop = 0;
|
|
739
763
|
}
|
|
740
764
|
}, [query, activeTab, selectedChainFilter]);
|
|
765
|
+
useLayoutEffect(() => {
|
|
766
|
+
const pendingScrollTop = pendingSelectionScrollTopRef.current;
|
|
767
|
+
if (pendingScrollTop === null)
|
|
768
|
+
return;
|
|
769
|
+
if (listRef.current) {
|
|
770
|
+
listRef.current.scrollTop = pendingScrollTop;
|
|
771
|
+
}
|
|
772
|
+
pendingSelectionScrollTopRef.current = null;
|
|
773
|
+
}, [draftSelectedTokens]);
|
|
741
774
|
const allTokens = useMemo(() => {
|
|
742
775
|
const isSwapSupportedToken = (token) => isSwapSupportedBySdkChainList(token.chainId, swapSupportedChains);
|
|
743
776
|
const baseTokens = staticOptions
|
|
@@ -783,7 +816,7 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
783
816
|
if (showBelowMinimumInline) {
|
|
784
817
|
return mergeTokenOptions(result, lockedSelectedTokens);
|
|
785
818
|
}
|
|
786
|
-
return mergeTokenOptions(result.filter((token) => getTokenFiatValue(token) >= MIN_FIAT_THRESHOLD), lockedSelectedTokens
|
|
819
|
+
return mergeTokenOptions(result.filter((token) => getTokenFiatValue(token) >= MIN_FIAT_THRESHOLD), lockedSelectedTokens);
|
|
787
820
|
}, [allTokens, lockedSelectedTokens, selectedChainFilter]);
|
|
788
821
|
const selectionMatchesFilterTab = useCallback((tab) => {
|
|
789
822
|
if (tab === "custom")
|
|
@@ -833,12 +866,14 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
833
866
|
return result;
|
|
834
867
|
}, [activeTab, allTokens, autoSelectFilterTabs, query, selectedChainFilter]);
|
|
835
868
|
const isTokenSelectedForVisibility = useCallback((token) => {
|
|
869
|
+
if (isLockedToken(token))
|
|
870
|
+
return true;
|
|
836
871
|
if (!preserveSelectedBelowMinimum)
|
|
837
872
|
return false;
|
|
838
873
|
return activeSelectedTokens.some((selected) => sameTokenOption(selected, token) ||
|
|
839
874
|
Boolean(selected.isUnified &&
|
|
840
875
|
selected.sourceTokens?.some((source) => sameTokenOption(source, token))));
|
|
841
|
-
}, [activeSelectedTokens, preserveSelectedBelowMinimum]);
|
|
876
|
+
}, [activeSelectedTokens, isLockedToken, preserveSelectedBelowMinimum]);
|
|
842
877
|
const isUnifiedSelectedForVisibility = useCallback((symbol) => preserveSelectedBelowMinimum &&
|
|
843
878
|
activeSelectedTokens.some((selected) => selected.isUnified && selected.unifiedSymbol === symbol), [activeSelectedTokens, preserveSelectedBelowMinimum]);
|
|
844
879
|
/* Split into above/below minimum */
|
|
@@ -864,7 +899,8 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
864
899
|
const unifiedSym = allowUnified ? getUnifiedSymbol(token) : null;
|
|
865
900
|
if (!showBelowMinimumInline &&
|
|
866
901
|
unifiedSym &&
|
|
867
|
-
getTokenFiatValue(token) < MIN_FIAT_THRESHOLD
|
|
902
|
+
getTokenFiatValue(token) < MIN_FIAT_THRESHOLD &&
|
|
903
|
+
!isTokenSelectedForVisibility(token)) {
|
|
868
904
|
continue;
|
|
869
905
|
}
|
|
870
906
|
const key = unifiedSym ?? `${token.contractAddress}-${token.chainId}`;
|
|
@@ -996,9 +1032,111 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
996
1032
|
return relevantTokens.some((st) => group.tokens.some((gt) => sameTokenOption(gt, st)) ||
|
|
997
1033
|
(st.isUnified && st.unifiedSymbol === group.symbol));
|
|
998
1034
|
};
|
|
1035
|
+
const selectorRows = useMemo(() => {
|
|
1036
|
+
if (isMulti) {
|
|
1037
|
+
return groupedFiltered.map((group) => ({
|
|
1038
|
+
fiat: group.totalFiat,
|
|
1039
|
+
group,
|
|
1040
|
+
key: `group:${group.symbol}`,
|
|
1041
|
+
kind: "group",
|
|
1042
|
+
label: group.symbol,
|
|
1043
|
+
searchScore: query.trim()
|
|
1044
|
+
? Math.min(...group.tokens.map((token) => getTokenSearchRank(token, query)?.score ??
|
|
1045
|
+
Number.MAX_SAFE_INTEGER))
|
|
1046
|
+
: 0,
|
|
1047
|
+
}));
|
|
1048
|
+
}
|
|
1049
|
+
const rows = [];
|
|
1050
|
+
const hasQuery = Boolean(query.trim());
|
|
1051
|
+
const getSearchScore = (token) => hasQuery
|
|
1052
|
+
? (getTokenSearchRank(token, query)?.score ?? Number.MAX_SAFE_INTEGER)
|
|
1053
|
+
: 0;
|
|
1054
|
+
const isVisibleTokenRow = (token) => showBelowMinimumInline ||
|
|
1055
|
+
getTokenFiatValue(token) >= MIN_FIAT_THRESHOLD ||
|
|
1056
|
+
isTokenSelectedForVisibility(token) ||
|
|
1057
|
+
isPrioritySearchMatch(token, query);
|
|
1058
|
+
for (const group of groupedFiltered) {
|
|
1059
|
+
if (!group.isUnifiedCandidate) {
|
|
1060
|
+
for (const token of group.tokens) {
|
|
1061
|
+
if (!isVisibleTokenRow(token))
|
|
1062
|
+
continue;
|
|
1063
|
+
rows.push({
|
|
1064
|
+
fiat: getTokenFiatValue(token),
|
|
1065
|
+
key: `token:${token.chainId}:${token.contractAddress}`,
|
|
1066
|
+
kind: "token",
|
|
1067
|
+
label: `${token.symbol} ${token.chainName}`,
|
|
1068
|
+
searchScore: getSearchScore(token),
|
|
1069
|
+
token,
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
continue;
|
|
1073
|
+
}
|
|
1074
|
+
const unifiedSelectedInOther = isGroupUnifiedSelectedInOtherSlot(group);
|
|
1075
|
+
const unifiedSelectedInCurrent = isGroupUnifiedSelectedInCurrentSlot(group);
|
|
1076
|
+
const anyIndividualSelectedInOther = isAnyTokenInGroupSelectedInOtherSlot(group);
|
|
1077
|
+
const anyIndividualSelectedInCurrent = group.tokens.some(isTokenSelectedInCurrentSlot);
|
|
1078
|
+
const shouldHideUnifiedRow = anyIndividualSelectedInOther ||
|
|
1079
|
+
anyIndividualSelectedInCurrent ||
|
|
1080
|
+
(group.totalFiat < MIN_FIAT_THRESHOLD &&
|
|
1081
|
+
!isUnifiedSelectedForVisibility(group.symbol));
|
|
1082
|
+
const shouldHideIndividualRows = unifiedSelectedInOther || unifiedSelectedInCurrent;
|
|
1083
|
+
if (!unifiedSelectedInOther && !shouldHideUnifiedRow) {
|
|
1084
|
+
rows.push({
|
|
1085
|
+
fiat: group.totalFiat,
|
|
1086
|
+
group,
|
|
1087
|
+
key: `group:${group.symbol}`,
|
|
1088
|
+
kind: "group",
|
|
1089
|
+
label: group.symbol,
|
|
1090
|
+
searchScore: hasQuery
|
|
1091
|
+
? Math.min(...group.tokens.map((token) => getTokenSearchRank(token, query)?.score ??
|
|
1092
|
+
Number.MAX_SAFE_INTEGER))
|
|
1093
|
+
: 0,
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
if (!shouldHideIndividualRows) {
|
|
1097
|
+
for (const token of group.tokens) {
|
|
1098
|
+
if (!isVisibleTokenRow(token))
|
|
1099
|
+
continue;
|
|
1100
|
+
rows.push({
|
|
1101
|
+
fiat: getTokenFiatValue(token),
|
|
1102
|
+
key: `token:${token.chainId}:${token.contractAddress}`,
|
|
1103
|
+
kind: "token",
|
|
1104
|
+
label: `${token.symbol} ${token.chainName}`,
|
|
1105
|
+
searchScore: getSearchScore(token),
|
|
1106
|
+
token,
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
return rows.sort((a, b) => {
|
|
1112
|
+
if (hasQuery && a.searchScore !== b.searchScore) {
|
|
1113
|
+
return a.searchScore - b.searchScore;
|
|
1114
|
+
}
|
|
1115
|
+
if (a.fiat !== b.fiat)
|
|
1116
|
+
return b.fiat - a.fiat;
|
|
1117
|
+
if (a.kind !== b.kind)
|
|
1118
|
+
return a.kind === "group" ? -1 : 1;
|
|
1119
|
+
return a.label.localeCompare(b.label);
|
|
1120
|
+
});
|
|
1121
|
+
}, [
|
|
1122
|
+
groupedFiltered,
|
|
1123
|
+
isMulti,
|
|
1124
|
+
isGroupUnifiedSelectedInCurrentSlot,
|
|
1125
|
+
isGroupUnifiedSelectedInOtherSlot,
|
|
1126
|
+
isAnyTokenInGroupSelectedInOtherSlot,
|
|
1127
|
+
isTokenSelectedInCurrentSlot,
|
|
1128
|
+
isTokenSelectedForVisibility,
|
|
1129
|
+
isUnifiedSelectedForVisibility,
|
|
1130
|
+
query,
|
|
1131
|
+
showBelowMinimumInline,
|
|
1132
|
+
]);
|
|
999
1133
|
const handleFilterTabClick = (tab) => {
|
|
1000
1134
|
setActiveTab(tab);
|
|
1001
1135
|
if (autoSelectFilterTabs && isMulti && tab !== "custom") {
|
|
1136
|
+
if (tab === "all" && onFilterTabSelect) {
|
|
1137
|
+
onFilterTabSelect(tab);
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1002
1140
|
if (filterTabBehavior === "source-pool") {
|
|
1003
1141
|
onFilterTabSelect?.(tab);
|
|
1004
1142
|
return;
|
|
@@ -1021,6 +1159,8 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1021
1159
|
onToggle?.(token);
|
|
1022
1160
|
return;
|
|
1023
1161
|
}
|
|
1162
|
+
pendingSelectionScrollTopRef.current = listRef.current?.scrollTop ?? null;
|
|
1163
|
+
skipNextSelectionScrollResetRef.current = true;
|
|
1024
1164
|
setActiveTab("custom");
|
|
1025
1165
|
const current = mergeTokenOptions(activeSelectedTokens, lockedSelectedTokens);
|
|
1026
1166
|
const targets = token.isUnified && token.sourceTokens?.length
|
|
@@ -1069,25 +1209,7 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1069
1209
|
borderBottom: "1px solid #F0F0EF",
|
|
1070
1210
|
boxSizing: "border-box",
|
|
1071
1211
|
opacity: isDisabledByUnified ? 0.5 : 1,
|
|
1072
|
-
}, children: [_jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [_jsx(SelectionControl, { multi: Boolean(isMulti), selected: selectedInCurrent }), _jsx("div", { style: { flexShrink: 0, width: 40, height: 40 }, children:
|
|
1073
|
-
e.target.style.display = "none";
|
|
1074
|
-
}, src: token.logo, style: {
|
|
1075
|
-
width: 40,
|
|
1076
|
-
height: 40,
|
|
1077
|
-
borderRadius: "999px",
|
|
1078
|
-
objectFit: "cover",
|
|
1079
|
-
} })) : (_jsx("div", { style: {
|
|
1080
|
-
width: 40,
|
|
1081
|
-
height: 40,
|
|
1082
|
-
borderRadius: "999px",
|
|
1083
|
-
backgroundColor: brand,
|
|
1084
|
-
display: "flex",
|
|
1085
|
-
alignItems: "center",
|
|
1086
|
-
justifyContent: "center",
|
|
1087
|
-
color: "#fff",
|
|
1088
|
-
fontSize: 14,
|
|
1089
|
-
fontWeight: 700,
|
|
1090
|
-
}, children: token.symbol.slice(0, 2) })) }), _jsxs("div", { style: {
|
|
1212
|
+
}, children: [_jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [_jsx(SelectionControl, { multi: Boolean(isMulti), selected: selectedInCurrent }), _jsx("div", { style: { flexShrink: 0, width: 40, height: 40 }, children: _jsx(TokenLogo, { fontSize: 14, label: token.symbol, size: 40, src: token.logo }) }), _jsxs("div", { style: {
|
|
1091
1213
|
display: "flex",
|
|
1092
1214
|
flexDirection: "column",
|
|
1093
1215
|
alignItems: "flex-start",
|
|
@@ -1096,12 +1218,7 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1096
1218
|
fontWeight: 500,
|
|
1097
1219
|
fontSize: 15,
|
|
1098
1220
|
color: "#161615",
|
|
1099
|
-
}, children: token.symbol }), token.chainName && (_jsxs("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
1100
|
-
borderRadius: "999px",
|
|
1101
|
-
height: 14,
|
|
1102
|
-
objectFit: "cover",
|
|
1103
|
-
width: 14,
|
|
1104
|
-
} })), _jsx("span", { style: {
|
|
1221
|
+
}, children: token.symbol }), token.chainName && (_jsxs("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [_jsx(TokenLogo, { fallbackBackground: "#E8E8E7", fallbackColor: "#161615", fontSize: 7, label: token.chainName, size: 14, src: getChainLogo(token) }), _jsx("span", { style: {
|
|
1105
1222
|
fontFamily: '"Geist", system-ui, sans-serif',
|
|
1106
1223
|
fontSize: 13,
|
|
1107
1224
|
color: "#848483",
|
|
@@ -1121,7 +1238,7 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1121
1238
|
}, children: ["\u2248 ", token.balanceInFiat] })] })] }, `${token.contractAddress}-${token.chainId}`));
|
|
1122
1239
|
};
|
|
1123
1240
|
/* ── Render a unified (multi-chain) group row ── */
|
|
1124
|
-
const renderGroupRow = (group) => {
|
|
1241
|
+
const renderGroupRow = (group, includeIndividualRows = true) => {
|
|
1125
1242
|
if (!group.isUnifiedCandidate) {
|
|
1126
1243
|
return group.tokens
|
|
1127
1244
|
.filter((token) => getTokenFiatValue(token) >= MIN_FIAT_THRESHOLD ||
|
|
@@ -1196,25 +1313,7 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1196
1313
|
flexShrink: 0,
|
|
1197
1314
|
width: 40,
|
|
1198
1315
|
height: 40,
|
|
1199
|
-
}, children:
|
|
1200
|
-
e.target.style.display = "none";
|
|
1201
|
-
}, src: group.logo, style: {
|
|
1202
|
-
width: 40,
|
|
1203
|
-
height: 40,
|
|
1204
|
-
borderRadius: "999px",
|
|
1205
|
-
objectFit: "cover",
|
|
1206
|
-
} })) : (_jsx("div", { style: {
|
|
1207
|
-
width: 40,
|
|
1208
|
-
height: 40,
|
|
1209
|
-
borderRadius: "999px",
|
|
1210
|
-
backgroundColor: brand,
|
|
1211
|
-
display: "flex",
|
|
1212
|
-
alignItems: "center",
|
|
1213
|
-
justifyContent: "center",
|
|
1214
|
-
color: "#fff",
|
|
1215
|
-
fontSize: 14,
|
|
1216
|
-
fontWeight: 700,
|
|
1217
|
-
}, children: group.symbol.slice(0, 2) })) }), _jsxs("div", { style: {
|
|
1316
|
+
}, children: _jsx(TokenLogo, { fontSize: 14, label: group.symbol, size: 40, src: group.logo }) }), _jsxs("div", { style: {
|
|
1218
1317
|
display: "flex",
|
|
1219
1318
|
flexDirection: "column",
|
|
1220
1319
|
alignItems: "flex-start",
|
|
@@ -1251,31 +1350,33 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1251
1350
|
gridTemplateRows: isExpanded ? "1fr" : "0fr",
|
|
1252
1351
|
opacity: isExpanded ? 1 : 0,
|
|
1253
1352
|
transition: "grid-template-rows 0.3s ease, opacity 0.3s ease",
|
|
1254
|
-
}, children: _jsx("div", { style: { overflow: "hidden" }, children: group.tokens.map((token) => renderTokenRow(token, true, false)) }) })) : (
|
|
1353
|
+
}, children: _jsx("div", { style: { overflow: "hidden" }, children: group.tokens.map((token) => renderTokenRow(token, true, false)) }) })) : (includeIndividualRows &&
|
|
1354
|
+
!shouldHideIndividualRows &&
|
|
1255
1355
|
individualTokens.map((token) => renderTokenRow(token)))] }, group.symbol));
|
|
1256
1356
|
};
|
|
1257
1357
|
const isLoading = !staticOptions && swapBalance === null;
|
|
1258
1358
|
const selectedAssetCount = activeSelectedTokens.length;
|
|
1259
1359
|
const requiredUsdAmount = parseTokenAmount(requiredUsd);
|
|
1360
|
+
const shouldCountSelectedUsd = (token, value) => value.gt(0) && (isLockedToken(token) || value.gte(MIN_FIAT_THRESHOLD));
|
|
1260
1361
|
const selectedUsdAmount = activeSelectedTokens.reduce((sum, token) => {
|
|
1261
1362
|
if (token.isUnified && token.sourceTokens?.length) {
|
|
1262
1363
|
return sum.plus(token.sourceTokens.reduce((sourceSum, source) => {
|
|
1263
1364
|
const value = parseTokenAmount(source.balanceInFiat) ?? new Decimal(0);
|
|
1264
|
-
return value
|
|
1365
|
+
return shouldCountSelectedUsd(source, value)
|
|
1265
1366
|
? sourceSum.plus(value)
|
|
1266
1367
|
: sourceSum;
|
|
1267
1368
|
}, new Decimal(0)));
|
|
1268
1369
|
}
|
|
1269
1370
|
const value = parseTokenAmount(token.balanceInFiat) ?? new Decimal(0);
|
|
1270
|
-
return value
|
|
1371
|
+
return shouldCountSelectedUsd(token, value) ? sum.plus(value) : sum;
|
|
1271
1372
|
}, new Decimal(0));
|
|
1272
1373
|
const selectionDeficitUsdAmount = requiredUsdAmount && selectedUsdAmount.lt(requiredUsdAmount)
|
|
1273
1374
|
? requiredUsdAmount.minus(selectedUsdAmount)
|
|
1274
1375
|
: new Decimal(0);
|
|
1275
|
-
const
|
|
1276
|
-
requiredUsdAmount &&
|
|
1376
|
+
const hasSelectionShortfall = Boolean(requiredUsdAmount &&
|
|
1277
1377
|
requiredUsdAmount.gt(0) &&
|
|
1278
1378
|
selectionDeficitUsdAmount.gt(0));
|
|
1379
|
+
const shouldShowSelectionProgress = Boolean(isMulti && hasSelectionShortfall);
|
|
1279
1380
|
const selectionProgressPercent = shouldShowSelectionProgress && requiredUsdAmount
|
|
1280
1381
|
? Decimal.min(100, selectedUsdAmount.div(requiredUsdAmount).mul(100)).toNumber()
|
|
1281
1382
|
: 0;
|
|
@@ -1331,7 +1432,7 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1331
1432
|
balanceInFiat: "$0.00",
|
|
1332
1433
|
chainId: chain.id,
|
|
1333
1434
|
chainName: getShortChainName(chain.id, chain.name),
|
|
1334
|
-
chainLogo: chain.logo,
|
|
1435
|
+
chainLogo: CHAIN_METADATA[chain.id]?.logo ?? chain.logo,
|
|
1335
1436
|
});
|
|
1336
1437
|
}
|
|
1337
1438
|
for (const token of allTokens) {
|
|
@@ -1354,10 +1455,11 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1354
1455
|
? "All chains"
|
|
1355
1456
|
: selectedChainToken?.chainName || "Chain";
|
|
1356
1457
|
const handleDone = () => {
|
|
1357
|
-
if (
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1458
|
+
if (hasSelectionShortfall)
|
|
1459
|
+
return;
|
|
1460
|
+
onDone?.(isMulti
|
|
1461
|
+
? mergeTokenOptions(draftSelectedTokens, lockedSelectedTokens)
|
|
1462
|
+
: undefined);
|
|
1361
1463
|
};
|
|
1362
1464
|
return (_jsxs("div", { ref: selectorRef, style: {
|
|
1363
1465
|
...modalHeightTransitionStyle,
|
|
@@ -1470,13 +1572,7 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1470
1572
|
height: 16,
|
|
1471
1573
|
color: "#161615",
|
|
1472
1574
|
flexShrink: 0,
|
|
1473
|
-
} })) : (_jsx("
|
|
1474
|
-
width: 18,
|
|
1475
|
-
height: 18,
|
|
1476
|
-
borderRadius: "999px",
|
|
1477
|
-
objectFit: "cover",
|
|
1478
|
-
flexShrink: 0,
|
|
1479
|
-
} })), _jsx("span", { style: {
|
|
1575
|
+
} })) : (_jsx(TokenLogo, { fallbackBackground: "#E8E8E7", fallbackColor: "#161615", fontSize: 9, label: selectedChainLabel, size: 18, src: getChainLogo(selectedChainToken) })), _jsx("span", { style: {
|
|
1480
1576
|
color: "#161615",
|
|
1481
1577
|
fontFamily: '"Geist", system-ui, sans-serif',
|
|
1482
1578
|
fontSize: "14px",
|
|
@@ -1539,9 +1635,9 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1539
1635
|
overflowX: "hidden",
|
|
1540
1636
|
overflowY: "visible",
|
|
1541
1637
|
backgroundColor: "#FFFFFE",
|
|
1542
|
-
}, children:
|
|
1543
|
-
?
|
|
1544
|
-
:
|
|
1638
|
+
}, children: selectorRows.map((row) => row.kind === "group"
|
|
1639
|
+
? renderGroupRow(row.group, isMulti)
|
|
1640
|
+
: renderTokenRow(row.token)) })), belowMin.length > 0 && (_jsxs("div", { style: {
|
|
1545
1641
|
backgroundColor: "#FFFFFE",
|
|
1546
1642
|
border: "1px solid #E8E8E7",
|
|
1547
1643
|
borderRadius: 12,
|
|
@@ -1589,21 +1685,10 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1589
1685
|
textAlign: "left",
|
|
1590
1686
|
}, children: showBelowMin
|
|
1591
1687
|
? "Tokens under $1 are unavailable for swaps"
|
|
1592
|
-
: "Hidden to prevent failed swaps" })] })] }), _jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [_jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [belowMin.slice(0, 3).map((t, i) =>
|
|
1593
|
-
width: 18,
|
|
1594
|
-
height: 18,
|
|
1595
|
-
borderRadius: "999px",
|
|
1596
|
-
objectFit: "cover",
|
|
1597
|
-
marginLeft: i > 0 ? -6 : 0,
|
|
1688
|
+
: "Hidden to prevent failed swaps" })] })] }), _jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [_jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [belowMin.slice(0, 3).map((t, i) => _jsx(TokenLogo, { fallbackBackground: "#E8E8E7", fallbackColor: "#161615", fontSize: 8, label: t.symbol, size: 18, src: t.logo, style: {
|
|
1598
1689
|
border: "1.5px solid #fff",
|
|
1599
|
-
} }, `bm-${t.contractAddress}-${t.chainId}`)) : (_jsx("div", { style: {
|
|
1600
|
-
width: 18,
|
|
1601
|
-
height: 18,
|
|
1602
|
-
borderRadius: "999px",
|
|
1603
|
-
backgroundColor: "#E8E8E7",
|
|
1604
1690
|
marginLeft: i > 0 ? -6 : 0,
|
|
1605
|
-
|
|
1606
|
-
} }, `bm-${t.contractAddress}-${t.chainId}`))), belowMin.length > 3 && (_jsxs("div", { style: {
|
|
1691
|
+
} }, `bm-${t.contractAddress}-${t.chainId}`)), belowMin.length > 3 && (_jsxs("div", { style: {
|
|
1607
1692
|
width: 18,
|
|
1608
1693
|
height: 18,
|
|
1609
1694
|
borderRadius: "999px",
|
|
@@ -1642,33 +1727,12 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1642
1727
|
width: 22,
|
|
1643
1728
|
height: 22,
|
|
1644
1729
|
flexShrink: 0,
|
|
1645
|
-
}, children: [token.logo
|
|
1646
|
-
filter: "grayscale(0.2)",
|
|
1647
|
-
width: 22,
|
|
1648
|
-
height: 22,
|
|
1649
|
-
borderRadius: "999px",
|
|
1650
|
-
objectFit: "cover",
|
|
1651
|
-
} })) : (_jsx("div", { style: {
|
|
1652
|
-
width: 22,
|
|
1653
|
-
height: 22,
|
|
1654
|
-
borderRadius: "999px",
|
|
1655
|
-
backgroundColor: "#C8C8C7",
|
|
1656
|
-
display: "flex",
|
|
1657
|
-
alignItems: "center",
|
|
1658
|
-
justifyContent: "center",
|
|
1659
|
-
color: "#fff",
|
|
1660
|
-
fontSize: 9,
|
|
1661
|
-
fontWeight: 700,
|
|
1662
|
-
}, children: token.symbol.slice(0, 2) })), token.chainLogo && (_jsx("img", { alt: "", src: token.chainLogo, style: {
|
|
1730
|
+
}, children: [_jsx(TokenLogo, { fallbackBackground: "#C8C8C7", fontSize: 9, label: token.symbol, size: 22, src: token.logo, style: { filter: "grayscale(0.2)" } }), token.chainLogo && (_jsx(TokenLogo, { fallbackBackground: "#E8E8E7", fallbackColor: "#161615", fontSize: 5, label: token.chainName, size: 10, src: getChainLogo(token), style: {
|
|
1663
1731
|
border: "1.5px solid #FFFFFE",
|
|
1664
|
-
borderRadius: "999px",
|
|
1665
1732
|
bottom: -2,
|
|
1666
1733
|
filter: "grayscale(0.2)",
|
|
1667
|
-
height: 10,
|
|
1668
|
-
objectFit: "cover",
|
|
1669
1734
|
position: "absolute",
|
|
1670
1735
|
right: -2,
|
|
1671
|
-
width: 10,
|
|
1672
1736
|
} }))] }), _jsxs("span", { style: {
|
|
1673
1737
|
fontFamily: '"Geist", system-ui, sans-serif',
|
|
1674
1738
|
fontWeight: 500,
|
|
@@ -1719,7 +1783,7 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1719
1783
|
height: "100%",
|
|
1720
1784
|
transition: "width 240ms ease",
|
|
1721
1785
|
width: `${selectionProgressPercent}%`,
|
|
1722
|
-
} }) })] })), !
|
|
1786
|
+
} }) })] })), !hasSelectionShortfall && (_jsx("button", { onClick: handleDone, style: {
|
|
1723
1787
|
width: "100%",
|
|
1724
1788
|
height: 48,
|
|
1725
1789
|
display: "flex",
|
|
@@ -1892,13 +1956,7 @@ export function SwapAssetSelector({ title, swapBalance, swapSupportedChains, sta
|
|
|
1892
1956
|
borderBottom: "1px solid #F0F0EF",
|
|
1893
1957
|
cursor: "pointer",
|
|
1894
1958
|
boxSizing: "border-box",
|
|
1895
|
-
}, children: [_jsx(RadioDot, { selected: selectedChainFilter === t.chainId }), _jsx("
|
|
1896
|
-
marginLeft: 10,
|
|
1897
|
-
width: 28,
|
|
1898
|
-
height: 28,
|
|
1899
|
-
borderRadius: "999px",
|
|
1900
|
-
objectFit: "cover",
|
|
1901
|
-
} }), _jsx("span", { style: {
|
|
1959
|
+
}, children: [_jsx(RadioDot, { selected: selectedChainFilter === t.chainId }), _jsx(TokenLogo, { fallbackBackground: "#E8E8E7", fallbackColor: "#161615", fontSize: 10, label: t.chainName, size: 28, src: getChainLogo(t), style: { marginLeft: 10 } }), _jsx("span", { style: {
|
|
1902
1960
|
fontFamily: '"Geist", system-ui, sans-serif',
|
|
1903
1961
|
fontSize: 14,
|
|
1904
1962
|
fontWeight: 500,
|
|
@@ -4,6 +4,7 @@ interface SwapIdleFormProps {
|
|
|
4
4
|
defaultRecipientAddress?: string;
|
|
5
5
|
fromTokens: SwapTokenOption[];
|
|
6
6
|
isAmountReadOnly?: boolean;
|
|
7
|
+
isBalanceLoading?: boolean;
|
|
7
8
|
isDestinationPickerDisabled?: boolean;
|
|
8
9
|
hideDestinationTokenDropdownIcon?: boolean;
|
|
9
10
|
isReceiveAmountLoading?: boolean;
|
|
@@ -24,6 +25,6 @@ interface SwapIdleFormProps {
|
|
|
24
25
|
totalBalance: string;
|
|
25
26
|
usdValue: string;
|
|
26
27
|
}
|
|
27
|
-
export declare function SwapIdleForm({ amount, receiveQuoteAmount, receiveQuoteUsd, isReceiveAmountLoading, isReceiveUsdLoading, sourceRouteStatus, sourceRouteMessage, onAmountChange, fromTokens, toToken, totalBalance, usdValue, onOpenSourcePicker, onOpenDestPicker, onOpenRecipientPicker, recipientAddress, defaultRecipientAddress, swapType, onUpdateTokens, isAmountReadOnly, isDestinationPickerDisabled, hideDestinationTokenDropdownIcon, isSourcePickerDisabled, }: SwapIdleFormProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function SwapIdleForm({ amount, receiveQuoteAmount, receiveQuoteUsd, isReceiveAmountLoading, isReceiveUsdLoading, sourceRouteStatus, sourceRouteMessage, onAmountChange, fromTokens, toToken, totalBalance, usdValue, onOpenSourcePicker, onOpenDestPicker, onOpenRecipientPicker, recipientAddress, defaultRecipientAddress, swapType, onUpdateTokens, isAmountReadOnly, isBalanceLoading, isDestinationPickerDisabled, hideDestinationTokenDropdownIcon, isSourcePickerDisabled, }: SwapIdleFormProps): import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export {};
|
|
29
30
|
//# sourceMappingURL=swap-idle-form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap-idle-form.d.ts","sourceRoot":"","sources":["../../../.build-src/nexus-widget/components/swap-idle-form.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAS/B,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,kBAAkB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACrD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC;IAC/C,QAAQ,EAAE,SAAS,GAAG,UAAU,CAAC;IACjC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AA8jBD,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,kBAAkB,EAClB,eAAe,EACf,sBAA8B,EAC9B,mBAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,QAAQ,EACR,cAAc,EACd,gBAAwB,EACxB,2BAAmC,EACnC,gCAAwC,EACxC,sBAA8B,GAC/B,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"swap-idle-form.d.ts","sourceRoot":"","sources":["../../../.build-src/nexus-widget/components/swap-idle-form.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAS/B,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,kBAAkB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACrD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC;IAC/C,QAAQ,EAAE,SAAS,GAAG,UAAU,CAAC;IACjC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AA8jBD,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,kBAAkB,EAClB,eAAe,EACf,sBAA8B,EAC9B,mBAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,QAAQ,EACR,cAAc,EACd,gBAAwB,EACxB,gBAAwB,EACxB,2BAAmC,EACnC,gCAAwC,EACxC,sBAA8B,GAC/B,EAAE,iBAAiB,2CAu9CnB"}
|
|
@@ -335,7 +335,7 @@ const formatAmountInputDisplay = (value) => {
|
|
|
335
335
|
return value;
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
|
-
export function SwapIdleForm({ amount, receiveQuoteAmount, receiveQuoteUsd, isReceiveAmountLoading = false, isReceiveUsdLoading = false, sourceRouteStatus, sourceRouteMessage, onAmountChange, fromTokens, toToken, totalBalance, usdValue, onOpenSourcePicker, onOpenDestPicker, onOpenRecipientPicker, recipientAddress, defaultRecipientAddress, swapType, onUpdateTokens, isAmountReadOnly = false, isDestinationPickerDisabled = false, hideDestinationTokenDropdownIcon = false, isSourcePickerDisabled = false, }) {
|
|
338
|
+
export function SwapIdleForm({ amount, receiveQuoteAmount, receiveQuoteUsd, isReceiveAmountLoading = false, isReceiveUsdLoading = false, sourceRouteStatus, sourceRouteMessage, onAmountChange, fromTokens, toToken, totalBalance, usdValue, onOpenSourcePicker, onOpenDestPicker, onOpenRecipientPicker, recipientAddress, defaultRecipientAddress, swapType, onUpdateTokens, isAmountReadOnly = false, isBalanceLoading = false, isDestinationPickerDisabled = false, hideDestinationTokenDropdownIcon = false, isSourcePickerDisabled = false, }) {
|
|
339
339
|
const [focusedPanel, setFocusedPanel] = useState(null);
|
|
340
340
|
const [focusedRow, setFocusedRow] = useState(null);
|
|
341
341
|
const [tooltip, setTooltip] = useState(null);
|
|
@@ -931,7 +931,7 @@ export function SwapIdleForm({ amount, receiveQuoteAmount, receiveQuoteUsd, isRe
|
|
|
931
931
|
justifyContent: "flex-end",
|
|
932
932
|
alignItems: "center",
|
|
933
933
|
flex: 1,
|
|
934
|
-
}, children: showSourceRouteSkeleton ? (_jsx(SkeletonBar, { height: "16px", width: "124px" })) : token ? (_jsxs("div", { onMouseEnter: (e) => {
|
|
934
|
+
}, children: showSourceRouteSkeleton || isBalanceLoading ? (_jsx(SkeletonBar, { height: "16px", width: "124px" })) : token ? (_jsxs("div", { onMouseEnter: (e) => {
|
|
935
935
|
setTooltip(`asset-send-${index}`);
|
|
936
936
|
setTooltipTriggerRect(e.currentTarget.getBoundingClientRect());
|
|
937
937
|
}, onMouseLeave: () => {
|
|
@@ -1196,7 +1196,7 @@ export function SwapIdleForm({ amount, receiveQuoteAmount, receiveQuoteUsd, isRe
|
|
|
1196
1196
|
fontVariantNumeric: "tabular-nums",
|
|
1197
1197
|
lineHeight: "16px",
|
|
1198
1198
|
whiteSpace: "nowrap",
|
|
1199
|
-
}, children: receiveBalanceLabel }), tooltip === "asset-receive" && (_jsxs("div", { style: {
|
|
1199
|
+
}, children: isBalanceLoading ? (_jsx(SkeletonBar, { height: "16px", width: "96px" })) : (receiveBalanceLabel) }), tooltip === "asset-receive" && (_jsxs("div", { style: {
|
|
1200
1200
|
position: "absolute",
|
|
1201
1201
|
right: 0,
|
|
1202
1202
|
bottom: "calc(100% + 8px)",
|