@funkit/connect 9.19.1 → 9.20.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/CHANGELOG.md +38 -0
- package/dist/clients/argentWallet-2WSTOUAO.js +7 -0
- package/dist/clients/bifrostWallet-5NQVDZ5P.js +7 -0
- package/dist/clients/bitgetWallet-CBQAJOIK.js +7 -0
- package/dist/clients/bitskiWallet-OLIYN3IU.js +7 -0
- package/dist/clients/bitverseWallet-AQMAJ2NN.js +7 -0
- package/dist/clients/bloomWallet-MJRQJYSG.js +7 -0
- package/dist/clients/braveWallet-T76TVZA6.js +7 -0
- package/dist/clients/bybitWallet-GOPAS32Q.js +7 -0
- package/dist/clients/chunk-4752IYY6.js +94 -0
- package/dist/clients/chunk-47AQXZQE.js +230 -0
- package/dist/clients/chunk-CSONEKIF.js +54 -0
- package/dist/clients/chunk-JOM2J5WB.js +2371 -0
- package/dist/clients/{chunk-TFZV2HO4.js → chunk-JVTKIEOP.js} +2 -223
- package/dist/clients/{polymarket.js → chunk-MOUTRRN3.js} +12 -4
- package/dist/clients/chunk-MRBN4XCA.js +96 -0
- package/dist/clients/chunk-UNCVGPTD.js +186 -0
- package/dist/clients/clvWallet-VVMLP7BK.js +7 -0
- package/dist/clients/coin98Wallet-I5CP5KYZ.js +7 -0
- package/dist/clients/coinbaseWallet-ICYEIYQD.js +7 -0
- package/dist/clients/coreWallet-RFVUHOVE.js +7 -0
- package/dist/clients/dawnWallet-QBFTQLS4.js +7 -0
- package/dist/clients/desigWallet-IBKYOHSY.js +7 -0
- package/dist/clients/enkryptWallet-ZVUZMI7H.js +7 -0
- package/dist/clients/fanatics.js +41 -82
- package/dist/clients/foxWallet-I7D5KIW4.js +7 -0
- package/dist/clients/frameWallet-UDD4OVZX.js +7 -0
- package/dist/clients/frontierWallet-5QV7ZACT.js +7 -0
- package/dist/clients/gateWallet-CJNGQQCV.js +7 -0
- package/dist/clients/imTokenWallet-UPA7ADZ2.js +7 -0
- package/dist/clients/injectedWallet-OIRJSVBZ.js +7 -0
- package/dist/clients/kresusWallet-7ROCNWAU.js +7 -0
- package/dist/clients/ledgerWallet-3FCEIKPD.js +7 -0
- package/dist/clients/lighter.js +9 -179
- package/dist/clients/metaMaskWallet-RMHEKBDR.js +7 -0
- package/dist/clients/mewWallet-ANFGVCZT.js +7 -0
- package/dist/clients/oktoWallet-Q5XCEOTD.js +7 -0
- package/dist/clients/okxWallet-GJMKZIND.js +7 -0
- package/dist/clients/omniWallet-YH4FEL6J.js +7 -0
- package/dist/clients/oneInchWallet-4S73ZPPN.js +7 -0
- package/dist/clients/oneKeyWallet-YVJDPHJS.js +7 -0
- package/dist/clients/phantomWallet-LZDJJ5XR.js +7 -0
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +17293 -0
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.d.ts +30 -0
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +14 -0
- package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +54 -0
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +15 -0
- package/dist/clients/polymarket/index.css +17293 -0
- package/dist/clients/polymarket/index.d.ts +8 -0
- package/dist/clients/polymarket/index.js +42 -0
- package/dist/clients/{polymarket.d.ts → polymarket/polymarket.d.ts} +59 -2
- package/dist/clients/polymarket/polymarket.js +24 -0
- package/dist/clients/polymarket/usePolymarketAccountBalances.d.ts +66 -0
- package/dist/clients/polymarket/usePolymarketAccountBalances.js +12 -0
- package/dist/clients/rabbyWallet-TYX2JDHU.js +7 -0
- package/dist/clients/rainbowWallet-MFJQCICF.js +7 -0
- package/dist/clients/ramperWallet-Q2XAH4WA.js +7 -0
- package/dist/clients/rolly.d.ts +2 -0
- package/dist/clients/rolly.js +6 -2
- package/dist/clients/roninWallet-SAB5ESVK.js +7 -0
- package/dist/clients/safeWallet-Y3VPODK2.js +7 -0
- package/dist/clients/safeheronWallet-MCFXLKO5.js +7 -0
- package/dist/clients/safepalWallet-7YULGM2L.js +7 -0
- package/dist/clients/subWallet-5WUZ4IIO.js +7 -0
- package/dist/clients/tahoWallet-U2VWWO76.js +7 -0
- package/dist/clients/talismanWallet-ZYTPIANG.js +7 -0
- package/dist/clients/tokenPocketWallet-FLFG3JUQ.js +7 -0
- package/dist/clients/tokenaryWallet-S3JS2IGK.js +7 -0
- package/dist/clients/trustWallet-2N5TZJGC.js +7 -0
- package/dist/clients/uniswapWallet-NJQBP5VM.js +7 -0
- package/dist/clients/walletConnectWallet-E4OQJ4DC.js +7 -0
- package/dist/clients/xdefiWallet-ZKBEFEOH.js +7 -0
- package/dist/clients/zealWallet-7VO3C4PM.js +7 -0
- package/dist/clients/zerionWallet-SEPREHKH.js +7 -0
- package/dist/components/Dropdown/AccountSelectDropdown.d.ts +45 -0
- package/dist/components/Dropdown/BaseDropdownItem.d.ts +3 -1
- package/dist/components/FreeUsdcBanner/FreeUsdcBanner.css.d.ts +15 -0
- package/dist/components/FreeUsdcBanner/FreeUsdcBanner.d.ts +5 -5
- package/dist/components/ModalHeightAnimationLayer/ModalHeightAnimationLayer.d.ts +8 -0
- package/dist/domains/aave.d.ts +28 -0
- package/dist/domains/dynamicRouting.d.ts +13 -1
- package/dist/domains/quote.d.ts +2 -2
- package/dist/hooks/track/CheckoutModalEvent.d.ts +1 -0
- package/dist/hooks/useExchangeOptions.d.ts +11 -2
- package/dist/hooks/useTokenAndChainDropdown.d.ts +1 -1
- package/dist/index.css +1325 -88
- package/dist/index.js +4291 -3258
- package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +2 -1
- package/dist/modals/CheckoutModal/InputAmount/aaveClient.d.ts +3 -7
- package/dist/modals/CheckoutModal/InputAmount/useAaveNativeSupply.d.ts +2 -19
- package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +1 -1
- package/dist/modals/CheckoutModal/SourceChange/useSourceChangeLayout.d.ts +10 -0
- package/dist/modals/CheckoutModal/stepTransition.d.ts +27 -1
- package/dist/modals/PolymarketPerpsTransfer/DirectionSwapButton.d.ts +17 -0
- package/dist/modals/PolymarketPerpsTransfer/PerpsTransferBottomBar.d.ts +11 -0
- package/dist/modals/PolymarketPerpsTransfer/PerpsTransferRows.d.ts +10 -0
- package/dist/modals/PolymarketPerpsTransfer/PerpsTransferStep.d.ts +11 -0
- package/dist/modals/PolymarketPerpsTransfer/PolymarketPerpsTransferScreen.d.ts +52 -0
- package/dist/modals/PolymarketPerpsTransfer/TransferActionButton.d.ts +34 -0
- package/dist/modals/PolymarketPerpsTransfer/TransferAmountRow.css.d.ts +13 -0
- package/dist/modals/PolymarketPerpsTransfer/TransferAmountRow.d.ts +27 -0
- package/dist/modals/PolymarketPerpsTransfer/usePerpsTransferForm.d.ts +66 -0
- package/dist/providers/FunkitCheckoutContext/index.d.ts +10 -1
- package/dist/providers/FunkitCheckoutContext/types.d.ts +63 -3
- package/dist/providers/FunkitConfigContext.d.ts +13 -2
- package/dist/providers/FunkitQuoteContext.d.ts +16 -0
- package/dist/utils/freeUsdcBanner.d.ts +3 -0
- package/dist/utils/tokenMath.d.ts +6 -0
- package/dist/wallets/walletConnectors/index.js +43 -43
- package/package.json +7 -6
|
@@ -0,0 +1,2371 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
POLYMARKET_PERPS_ROUTING_ID,
|
|
4
|
+
POLYMARKET_PREDICTIONS_ROUTING_ID
|
|
5
|
+
} from "./chunk-4752IYY6.js";
|
|
6
|
+
import {
|
|
7
|
+
Text
|
|
8
|
+
} from "./chunk-CSONEKIF.js";
|
|
9
|
+
import {
|
|
10
|
+
Box,
|
|
11
|
+
themeVars,
|
|
12
|
+
useFunkitTranslation
|
|
13
|
+
} from "./chunk-JVTKIEOP.js";
|
|
14
|
+
import {
|
|
15
|
+
POLYGON_USDCE,
|
|
16
|
+
PUSD_TOKEN
|
|
17
|
+
} from "./chunk-MOUTRRN3.js";
|
|
18
|
+
import {
|
|
19
|
+
usePolymarketAccountBalances
|
|
20
|
+
} from "./chunk-MRBN4XCA.js";
|
|
21
|
+
import {
|
|
22
|
+
logger
|
|
23
|
+
} from "./chunk-UUHGOBKZ.js";
|
|
24
|
+
|
|
25
|
+
// src/clients/polymarket/PolymarketDepositAccountDropdown.tsx
|
|
26
|
+
import React17 from "react";
|
|
27
|
+
import { polygon } from "viem/chains";
|
|
28
|
+
|
|
29
|
+
// src/components/Dropdown/AccountSelectDropdown.tsx
|
|
30
|
+
import React16, { useEffect as useEffect6 } from "react";
|
|
31
|
+
|
|
32
|
+
// src/components/Dropdown/BaseDropdown.tsx
|
|
33
|
+
import { isMobile } from "@funkit/utils";
|
|
34
|
+
import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
|
|
35
|
+
import React15, { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef2, useState as useState5 } from "react";
|
|
36
|
+
|
|
37
|
+
// src/hooks/useScrollDivider.ts
|
|
38
|
+
import { useCallback, useEffect, useState } from "react";
|
|
39
|
+
var useScrollDivider = () => {
|
|
40
|
+
const [refElement, setRefElement] = useState(null);
|
|
41
|
+
const ref = useCallback((node) => setRefElement(node), []);
|
|
42
|
+
const [isTop, setIsTop] = useState(true);
|
|
43
|
+
const [isAtBottom, setIsAtBottom] = useState(false);
|
|
44
|
+
const [isScrollable, setIsScrollable] = useState(false);
|
|
45
|
+
const [isScrolling, setIsScrolling] = useState(false);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const content = refElement;
|
|
48
|
+
if (!content || !window.ResizeObserver) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const handleScrollPositionChange = () => {
|
|
52
|
+
const { scrollTop, scrollHeight, clientHeight } = content;
|
|
53
|
+
setIsTop(scrollTop === 0);
|
|
54
|
+
setIsAtBottom(scrollTop + clientHeight >= scrollHeight - 1);
|
|
55
|
+
setIsScrollable(scrollHeight > clientHeight + 2);
|
|
56
|
+
};
|
|
57
|
+
const handleContentChange = () => {
|
|
58
|
+
handleScrollPositionChange();
|
|
59
|
+
setTimeout(handleScrollPositionChange, 500);
|
|
60
|
+
};
|
|
61
|
+
const onScrollChange = () => {
|
|
62
|
+
handleScrollPositionChange();
|
|
63
|
+
setIsScrolling(true);
|
|
64
|
+
};
|
|
65
|
+
const onScrollEnd = () => setIsScrolling(false);
|
|
66
|
+
content.addEventListener("scrollend", onScrollEnd);
|
|
67
|
+
content.addEventListener("scroll", onScrollChange);
|
|
68
|
+
const resizeObserver = new window.ResizeObserver(handleContentChange);
|
|
69
|
+
resizeObserver.observe(content);
|
|
70
|
+
const mutationObserver = new MutationObserver(handleContentChange);
|
|
71
|
+
mutationObserver.observe(content, {
|
|
72
|
+
childList: true,
|
|
73
|
+
subtree: true,
|
|
74
|
+
attributes: true,
|
|
75
|
+
attributeFilter: ["style", "class"]
|
|
76
|
+
});
|
|
77
|
+
handleScrollPositionChange();
|
|
78
|
+
return () => {
|
|
79
|
+
content.removeEventListener("scroll", onScrollChange);
|
|
80
|
+
content.removeEventListener("scrollend", onScrollEnd);
|
|
81
|
+
resizeObserver.unobserve(content);
|
|
82
|
+
mutationObserver.disconnect();
|
|
83
|
+
};
|
|
84
|
+
}, [refElement]);
|
|
85
|
+
return {
|
|
86
|
+
ref,
|
|
87
|
+
hasTopDivider: !isTop,
|
|
88
|
+
hasBottomDivider: isScrollable,
|
|
89
|
+
isAtBottom,
|
|
90
|
+
isScrolling,
|
|
91
|
+
isScrollable
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// src/providers/FunkitProvider.tsx
|
|
96
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
97
|
+
import React13, {
|
|
98
|
+
createContext as createContext3,
|
|
99
|
+
useContext as useContext3,
|
|
100
|
+
useEffect as useEffect4,
|
|
101
|
+
useMemo,
|
|
102
|
+
useRef
|
|
103
|
+
} from "react";
|
|
104
|
+
|
|
105
|
+
// src/components/FunTooltip/FunTooltip.tsx
|
|
106
|
+
import * as Tooltip from "@radix-ui/react-tooltip";
|
|
107
|
+
import React, {
|
|
108
|
+
createContext,
|
|
109
|
+
useContext,
|
|
110
|
+
useState as useState2
|
|
111
|
+
} from "react";
|
|
112
|
+
var TooltipAnchorRefContext = createContext(null);
|
|
113
|
+
|
|
114
|
+
// src/components/FunSkeletonLoader/FunSkeletonBlock.tsx
|
|
115
|
+
import React3 from "react";
|
|
116
|
+
|
|
117
|
+
// src/providers/FunkitThemeProvider.tsx
|
|
118
|
+
import React2, { createContext as createContext2, useContext as useContext2, useEffect as useEffect2, useState as useState3 } from "react";
|
|
119
|
+
|
|
120
|
+
// src/themes/baseTheme.ts
|
|
121
|
+
var systemFontStack = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
|
|
122
|
+
var fontStacks = {
|
|
123
|
+
rounded: `SFRounded, ui-rounded, "SF Pro Rounded", ${systemFontStack}`,
|
|
124
|
+
system: systemFontStack,
|
|
125
|
+
fun: `SF Pro, ${systemFontStack}`
|
|
126
|
+
};
|
|
127
|
+
var radiusScales = {
|
|
128
|
+
large: {
|
|
129
|
+
actionButton: "12px",
|
|
130
|
+
actionButtonInner: "10px",
|
|
131
|
+
connectButton: "12px",
|
|
132
|
+
modal: "24px",
|
|
133
|
+
modalMobile: "28px",
|
|
134
|
+
modalActionButton: "24px",
|
|
135
|
+
modalActionButtonMobile: "28px",
|
|
136
|
+
summaryBox: "12px",
|
|
137
|
+
youPayYouReceive: "24px",
|
|
138
|
+
inputAmountSwitcher: "24px",
|
|
139
|
+
qrCode: "12px",
|
|
140
|
+
tooltip: "4px",
|
|
141
|
+
skeleton: "4px",
|
|
142
|
+
dropdown: "12px",
|
|
143
|
+
dropdownItem: "4px",
|
|
144
|
+
dropdownList: "12px",
|
|
145
|
+
modalTopbarIcon: "9999px",
|
|
146
|
+
withdrawalInput: "12px",
|
|
147
|
+
useConnected: "8px"
|
|
148
|
+
},
|
|
149
|
+
medium: {
|
|
150
|
+
actionButton: "10px",
|
|
151
|
+
actionButtonInner: "8px",
|
|
152
|
+
connectButton: "10px",
|
|
153
|
+
modal: "16px",
|
|
154
|
+
modalMobile: "18px",
|
|
155
|
+
modalActionButton: "16px",
|
|
156
|
+
modalActionButtonMobile: "18px",
|
|
157
|
+
summaryBox: "10px",
|
|
158
|
+
youPayYouReceive: "24px",
|
|
159
|
+
inputAmountSwitcher: "24px",
|
|
160
|
+
qrCode: "10px",
|
|
161
|
+
tooltip: "4px",
|
|
162
|
+
skeleton: "4px",
|
|
163
|
+
dropdown: "10px",
|
|
164
|
+
dropdownItem: "4px",
|
|
165
|
+
dropdownList: "10px",
|
|
166
|
+
modalTopbarIcon: "9999px",
|
|
167
|
+
withdrawalInput: "10px",
|
|
168
|
+
useConnected: "8px"
|
|
169
|
+
},
|
|
170
|
+
none: {
|
|
171
|
+
actionButton: "0px",
|
|
172
|
+
actionButtonInner: "0px",
|
|
173
|
+
connectButton: "0px",
|
|
174
|
+
modal: "0px",
|
|
175
|
+
modalMobile: "0px",
|
|
176
|
+
modalActionButton: "0px",
|
|
177
|
+
modalActionButtonMobile: "0px",
|
|
178
|
+
summaryBox: "0px",
|
|
179
|
+
youPayYouReceive: "0px",
|
|
180
|
+
inputAmountSwitcher: "0px",
|
|
181
|
+
qrCode: "0px",
|
|
182
|
+
tooltip: "0px",
|
|
183
|
+
skeleton: "0px",
|
|
184
|
+
dropdown: "0px",
|
|
185
|
+
dropdownItem: "0px",
|
|
186
|
+
dropdownList: "0px",
|
|
187
|
+
modalTopbarIcon: "0px",
|
|
188
|
+
withdrawalInput: "0px",
|
|
189
|
+
useConnected: "0px"
|
|
190
|
+
},
|
|
191
|
+
small: {
|
|
192
|
+
actionButton: "8px",
|
|
193
|
+
actionButtonInner: "6px",
|
|
194
|
+
connectButton: "8px",
|
|
195
|
+
modal: "8px",
|
|
196
|
+
modalMobile: "8px",
|
|
197
|
+
modalActionButton: "8px",
|
|
198
|
+
modalActionButtonMobile: "8px",
|
|
199
|
+
summaryBox: "8px",
|
|
200
|
+
youPayYouReceive: "24px",
|
|
201
|
+
inputAmountSwitcher: "24px",
|
|
202
|
+
qrCode: "8px",
|
|
203
|
+
tooltip: "4px",
|
|
204
|
+
skeleton: "4px",
|
|
205
|
+
dropdown: "8px",
|
|
206
|
+
dropdownItem: "4px",
|
|
207
|
+
dropdownList: "8px",
|
|
208
|
+
modalTopbarIcon: "9999px",
|
|
209
|
+
withdrawalInput: "8px",
|
|
210
|
+
useConnected: "8px"
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
var blurs = {
|
|
214
|
+
large: {
|
|
215
|
+
modalOverlay: "blur(20px)"
|
|
216
|
+
},
|
|
217
|
+
none: {
|
|
218
|
+
modalOverlay: "blur(0px)"
|
|
219
|
+
},
|
|
220
|
+
small: {
|
|
221
|
+
modalOverlay: "blur(8px)"
|
|
222
|
+
},
|
|
223
|
+
tiny: {
|
|
224
|
+
modalOverlay: "blur(4px)"
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
var DEFAULT_FONT_WEIGHTS = {
|
|
228
|
+
regular: "400",
|
|
229
|
+
medium: "500",
|
|
230
|
+
// 510 in figma, but chrome no longer supports 510 - lowered to 500
|
|
231
|
+
semibold: "600",
|
|
232
|
+
// 590 in figma, but chrome no longer supports 590 - raised to 600
|
|
233
|
+
bold: "700",
|
|
234
|
+
heavy: "800"
|
|
235
|
+
};
|
|
236
|
+
var DEFAULT_FONT_SIZES = {
|
|
237
|
+
"10": { fontSize: "10px", lineHeight: "15px" },
|
|
238
|
+
"12": { fontSize: "12px", lineHeight: "14px" },
|
|
239
|
+
"13": { fontSize: "13px", lineHeight: "18px" },
|
|
240
|
+
"14": { fontSize: "14px", lineHeight: "18px" },
|
|
241
|
+
"16": { fontSize: "16px", lineHeight: "20px" },
|
|
242
|
+
"18": { fontSize: "18px", lineHeight: "24px" },
|
|
243
|
+
"20": { fontSize: "20px", lineHeight: "20px" },
|
|
244
|
+
"21": { fontSize: "21px", lineHeight: "21px" },
|
|
245
|
+
"40": { fontSize: "40px", lineHeight: "48px" },
|
|
246
|
+
"57": { fontSize: "57px", lineHeight: "68px" }
|
|
247
|
+
};
|
|
248
|
+
var FONT_SIZINGS = {
|
|
249
|
+
regular: DEFAULT_FONT_SIZES,
|
|
250
|
+
small: {
|
|
251
|
+
"8": { fontSize: "8px", lineHeight: "16px" },
|
|
252
|
+
"10": { fontSize: "8px", lineHeight: "16px" },
|
|
253
|
+
"12": { fontSize: "10px", lineHeight: "16px" },
|
|
254
|
+
"13": { fontSize: "10px", lineHeight: "16px" },
|
|
255
|
+
"14": { fontSize: "12px", lineHeight: "16px" },
|
|
256
|
+
"16": { fontSize: "14px", lineHeight: "18px" },
|
|
257
|
+
"18": { fontSize: "14px", lineHeight: "20px" },
|
|
258
|
+
"20": { fontSize: "18px", lineHeight: "20px" },
|
|
259
|
+
"21": { fontSize: "19px", lineHeight: "19px" },
|
|
260
|
+
"23": { fontSize: "20px", lineHeight: "28px" },
|
|
261
|
+
"40": { fontSize: "34px", lineHeight: "40px" },
|
|
262
|
+
"57": { fontSize: "50px", lineHeight: "60px" }
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
var nestedModalZIndexes = {
|
|
266
|
+
coinbase: 2147483647,
|
|
267
|
+
walletConnect: 99999999999999,
|
|
268
|
+
privy: 999999
|
|
269
|
+
};
|
|
270
|
+
var DEFAULT_MODAL_Z_INDEX = Math.min(...Object.values(nestedModalZIndexes)) - 2;
|
|
271
|
+
var baseTheme = ({
|
|
272
|
+
borderRadius = "large",
|
|
273
|
+
fontStack = "fun",
|
|
274
|
+
fontSizing = "regular",
|
|
275
|
+
customFontFamily,
|
|
276
|
+
customFontWeights = DEFAULT_FONT_WEIGHTS,
|
|
277
|
+
customFontSizings = FONT_SIZINGS[fontSizing],
|
|
278
|
+
customBorderWidths,
|
|
279
|
+
customBorderRadiuses = radiusScales[borderRadius],
|
|
280
|
+
customDimensions,
|
|
281
|
+
customSpacings,
|
|
282
|
+
customTextTransforms,
|
|
283
|
+
overlayBlur = "small",
|
|
284
|
+
modalZIndex = DEFAULT_MODAL_Z_INDEX
|
|
285
|
+
}) => ({
|
|
286
|
+
modalZIndex: String(modalZIndex),
|
|
287
|
+
blurs: {
|
|
288
|
+
modalOverlay: blurs[overlayBlur].modalOverlay
|
|
289
|
+
},
|
|
290
|
+
dimensions: {
|
|
291
|
+
connectExchangeIconSize: "48px",
|
|
292
|
+
cryptoCashToggleIconSize: "20px",
|
|
293
|
+
dollarValueSkeletonHeight: "60px",
|
|
294
|
+
dollarValueSkeletonWidth: "160px",
|
|
295
|
+
inputAmountQuickOptionButtonHeight: "36px",
|
|
296
|
+
inputAmountMinHeight: "76px",
|
|
297
|
+
modalBottomBarButtonHeight: "34px",
|
|
298
|
+
modalTopBarHeight: "56px",
|
|
299
|
+
modalTopbarIconSize: "16px",
|
|
300
|
+
modalTopbarIconWrapperSize: "32px",
|
|
301
|
+
paymentAmountSkeletonBlockHeight: "14px",
|
|
302
|
+
paymentAmountSkeletonBlockWidth: "93px",
|
|
303
|
+
paymentAmountSkeletonCircleSize: "15px",
|
|
304
|
+
paymentMethodItemIconSize: "20px",
|
|
305
|
+
selectAssetItemIconSize: "24px",
|
|
306
|
+
sourceListGap: "4px",
|
|
307
|
+
txBreakdownSkeletonWidth: "72px",
|
|
308
|
+
txSummaryLineSkeletonHeight: "14px",
|
|
309
|
+
txSummaryLineSkeletonWidth: "54px",
|
|
310
|
+
...customDimensions,
|
|
311
|
+
modalBottomBarCloseButtonHeight: customDimensions?.modalBottomBarCloseButtonHeight ?? customDimensions?.modalBottomBarButtonHeight ?? "34px"
|
|
312
|
+
},
|
|
313
|
+
fonts: typeof customFontFamily === "string" ? {
|
|
314
|
+
amountValue: customFontFamily,
|
|
315
|
+
body: customFontFamily,
|
|
316
|
+
buttonTextPrimary: customFontFamily,
|
|
317
|
+
buttonTextSecondary: customFontFamily,
|
|
318
|
+
buttonTextTertiary: customFontFamily,
|
|
319
|
+
dropdownGroupHeader: customFontFamily,
|
|
320
|
+
header: customFontFamily,
|
|
321
|
+
inputAmount: customFontFamily,
|
|
322
|
+
modalTopbarTitle: customFontFamily,
|
|
323
|
+
txStatusDescription: customFontFamily,
|
|
324
|
+
txStatusTitle: customFontFamily
|
|
325
|
+
} : {
|
|
326
|
+
amountValue: fontStacks[fontStack],
|
|
327
|
+
body: fontStacks[fontStack],
|
|
328
|
+
buttonTextPrimary: fontStacks[fontStack],
|
|
329
|
+
buttonTextSecondary: fontStacks[fontStack],
|
|
330
|
+
buttonTextTertiary: fontStacks[fontStack],
|
|
331
|
+
dropdownGroupHeader: fontStacks[fontStack],
|
|
332
|
+
header: fontStacks[fontStack],
|
|
333
|
+
inputAmount: fontStacks[fontStack],
|
|
334
|
+
modalTopbarTitle: fontStacks[fontStack],
|
|
335
|
+
txStatusDescription: fontStacks[fontStack],
|
|
336
|
+
txStatusTitle: fontStacks[fontStack],
|
|
337
|
+
...customFontFamily
|
|
338
|
+
},
|
|
339
|
+
fontWeight: {
|
|
340
|
+
...DEFAULT_FONT_WEIGHTS,
|
|
341
|
+
cryptoCashToggle: DEFAULT_FONT_WEIGHTS.medium,
|
|
342
|
+
dropdownGroupHeader: DEFAULT_FONT_WEIGHTS.medium,
|
|
343
|
+
inputAmount: DEFAULT_FONT_WEIGHTS.medium,
|
|
344
|
+
inputLabel: DEFAULT_FONT_WEIGHTS.medium,
|
|
345
|
+
inputValue: DEFAULT_FONT_WEIGHTS.medium,
|
|
346
|
+
modalTopbarTitle: DEFAULT_FONT_WEIGHTS.medium,
|
|
347
|
+
modalBottomBarButtonText: DEFAULT_FONT_WEIGHTS.medium,
|
|
348
|
+
paymentMethodItemSubtitle: DEFAULT_FONT_WEIGHTS.regular,
|
|
349
|
+
paymentMethodItemTitle: DEFAULT_FONT_WEIGHTS.medium,
|
|
350
|
+
selectAssetItemSubtitle: DEFAULT_FONT_WEIGHTS.regular,
|
|
351
|
+
selectAssetItemTitle: DEFAULT_FONT_WEIGHTS.medium,
|
|
352
|
+
sourceListSectionLabelFontWeight: DEFAULT_FONT_WEIGHTS.medium,
|
|
353
|
+
txBreakdown: DEFAULT_FONT_WEIGHTS.regular,
|
|
354
|
+
txStatusDescription: DEFAULT_FONT_WEIGHTS.regular,
|
|
355
|
+
txStatusTitle: DEFAULT_FONT_WEIGHTS.medium,
|
|
356
|
+
txSummaryLabel: DEFAULT_FONT_WEIGHTS.medium,
|
|
357
|
+
txSummaryValue: DEFAULT_FONT_WEIGHTS.medium,
|
|
358
|
+
formOfPaymentsListSectionLabelFontWeight: DEFAULT_FONT_WEIGHTS.medium,
|
|
359
|
+
withdrawalYouWillReceiveLabel: DEFAULT_FONT_WEIGHTS.regular,
|
|
360
|
+
withdrawalYouWillReceiveValueCrypto: DEFAULT_FONT_WEIGHTS.medium,
|
|
361
|
+
withdrawalYouWillReceiveValueUsd: DEFAULT_FONT_WEIGHTS.regular,
|
|
362
|
+
...customFontWeights
|
|
363
|
+
},
|
|
364
|
+
fontSize: {
|
|
365
|
+
...FONT_SIZINGS[fontSizing],
|
|
366
|
+
body: FONT_SIZINGS[fontSizing][14],
|
|
367
|
+
cryptoCashToggle: FONT_SIZINGS[fontSizing][12],
|
|
368
|
+
"header-14": { fontSize: "14px", lineHeight: "14px" },
|
|
369
|
+
"header-36": { fontSize: "36px", lineHeight: "36px" },
|
|
370
|
+
buttonTextPrimary: FONT_SIZINGS[fontSizing][12],
|
|
371
|
+
buttonTextSecondary: FONT_SIZINGS[fontSizing][10],
|
|
372
|
+
buttonTextTertiary: FONT_SIZINGS[fontSizing][12],
|
|
373
|
+
dollarValue: FONT_SIZINGS[fontSizing][40],
|
|
374
|
+
dropdownGroupHeader: FONT_SIZINGS[fontSizing][12],
|
|
375
|
+
inputAmount: FONT_SIZINGS[fontSizing][57],
|
|
376
|
+
inputLabel: customFontSizings[12] ?? FONT_SIZINGS[fontSizing][12],
|
|
377
|
+
inputValue: customFontSizings[13] ?? FONT_SIZINGS[fontSizing][13],
|
|
378
|
+
modalTopbarSubtitle: FONT_SIZINGS[fontSizing][10],
|
|
379
|
+
modalTopbarTitle: FONT_SIZINGS[fontSizing][13],
|
|
380
|
+
modalBottomBarButtonText: FONT_SIZINGS[fontSizing][12],
|
|
381
|
+
paymentMethodItemSubtitle: FONT_SIZINGS[fontSizing][12],
|
|
382
|
+
paymentMethodItemTitle: FONT_SIZINGS[fontSizing][12],
|
|
383
|
+
selectAssetItemSubtitle: FONT_SIZINGS[fontSizing][10],
|
|
384
|
+
selectAssetItemTitle: FONT_SIZINGS[fontSizing][13],
|
|
385
|
+
txBreakdown: FONT_SIZINGS[fontSizing][12],
|
|
386
|
+
txStatusDescription: FONT_SIZINGS[fontSizing][13],
|
|
387
|
+
txStatusTitle: FONT_SIZINGS[fontSizing][13],
|
|
388
|
+
txSummaryLabel: FONT_SIZINGS[fontSizing][12],
|
|
389
|
+
txSummaryValue: FONT_SIZINGS[fontSizing][12],
|
|
390
|
+
withdrawalYouWillReceive: customFontSizings[12] ?? FONT_SIZINGS[fontSizing][12],
|
|
391
|
+
youPayYouReceivePrimaryFontSize: FONT_SIZINGS[fontSizing][12],
|
|
392
|
+
youPayYouReceiveSecondaryFontSize: FONT_SIZINGS[fontSizing][10],
|
|
393
|
+
depositAddressFontSize: FONT_SIZINGS[fontSizing][10],
|
|
394
|
+
funFeatureListItemFontSize: FONT_SIZINGS[fontSizing][12],
|
|
395
|
+
dropdownItemFontSize: FONT_SIZINGS[fontSizing][12],
|
|
396
|
+
sourceListSectionLabelFontSize: FONT_SIZINGS[fontSizing][12],
|
|
397
|
+
formOfPaymentsListSectionLabelFontSize: FONT_SIZINGS[fontSizing][12],
|
|
398
|
+
quickOptionFontSize: FONT_SIZINGS[fontSizing][14],
|
|
399
|
+
useConnectedFontSize: FONT_SIZINGS[fontSizing][12],
|
|
400
|
+
paymentFeeSummaryTooltip: FONT_SIZINGS[fontSizing][10],
|
|
401
|
+
tooltipContent: FONT_SIZINGS[fontSizing][10],
|
|
402
|
+
...customFontSizings
|
|
403
|
+
},
|
|
404
|
+
radii: {
|
|
405
|
+
actionButton: radiusScales[borderRadius].actionButton,
|
|
406
|
+
actionButtonInner: radiusScales[borderRadius].actionButtonInner,
|
|
407
|
+
connectButton: radiusScales[borderRadius].connectButton,
|
|
408
|
+
menuButton: radiusScales[borderRadius].connectButton,
|
|
409
|
+
modal: radiusScales[borderRadius].modal,
|
|
410
|
+
modalMobile: radiusScales[borderRadius].modalMobile,
|
|
411
|
+
modalActionButton: radiusScales[borderRadius].modalActionButton,
|
|
412
|
+
modalActionButtonMobile: radiusScales[borderRadius].modalActionButtonMobile,
|
|
413
|
+
summaryBox: radiusScales[borderRadius].summaryBox,
|
|
414
|
+
youPayYouReceive: radiusScales[borderRadius].youPayYouReceive,
|
|
415
|
+
inputAmountSwitcher: radiusScales[borderRadius].inputAmountSwitcher,
|
|
416
|
+
qrCode: radiusScales[borderRadius].qrCode,
|
|
417
|
+
skeleton: radiusScales[borderRadius].skeleton,
|
|
418
|
+
tooltip: radiusScales[borderRadius].tooltip,
|
|
419
|
+
dropdown: radiusScales[borderRadius].dropdown,
|
|
420
|
+
dropdownItem: radiusScales[borderRadius].dropdownItem,
|
|
421
|
+
dropdownList: customBorderRadiuses?.dropdownList ?? customBorderRadiuses?.dropdown ?? radiusScales[borderRadius].dropdown,
|
|
422
|
+
modalTopbarIcon: radiusScales[borderRadius].modalTopbarIcon,
|
|
423
|
+
withdrawalInput: radiusScales[borderRadius].withdrawalInput,
|
|
424
|
+
useConnected: radiusScales[borderRadius].useConnected,
|
|
425
|
+
...customBorderRadiuses
|
|
426
|
+
},
|
|
427
|
+
borderWidths: {
|
|
428
|
+
activeOptionBorderWidth: "1px",
|
|
429
|
+
buttonTertiaryBorderWidth: "0px",
|
|
430
|
+
cryptoCashToggleContainerBorderWidth: "0px",
|
|
431
|
+
cryptoCashToggleActiveTabBorderWidth: "1px",
|
|
432
|
+
cryptoCashToggleInactiveTabBorderWidth: "1px",
|
|
433
|
+
txSummaryBoxBorderWidth: "1px",
|
|
434
|
+
...customBorderWidths
|
|
435
|
+
},
|
|
436
|
+
spacing: {
|
|
437
|
+
confirmationStepMarginTop: "6px",
|
|
438
|
+
confirmationStepVerticalGap: "18px",
|
|
439
|
+
cryptoCashToggleContainerPadding: "3px",
|
|
440
|
+
cryptoCashToggleMarginBottom: "16px",
|
|
441
|
+
cryptoCashToggleMarginTop: "24px",
|
|
442
|
+
cryptoCashToggleTabPaddingY: "6px",
|
|
443
|
+
dropdownItemIconGap: "4px",
|
|
444
|
+
dropdownItemPaddingX: "4px",
|
|
445
|
+
dropdownItemPaddingY: "6px",
|
|
446
|
+
dropdownCompactPaddingX: "6px",
|
|
447
|
+
dropdownCompactPaddingY: "6px",
|
|
448
|
+
dropdownPaddingX: "12px",
|
|
449
|
+
dropdownPaddingY: "12px",
|
|
450
|
+
modalBaseHorizontalPadding: "6px",
|
|
451
|
+
modalBottomBarButtonPaddingY: "0px",
|
|
452
|
+
modalBottomHorizontalPadding: "12px",
|
|
453
|
+
modalPaddingBottomUpper: "16px",
|
|
454
|
+
modalPaddingBottomLower: "16px",
|
|
455
|
+
modalTopBarVerticalTextSpacing: "0px",
|
|
456
|
+
selectAssetItemPaddingX: "12px",
|
|
457
|
+
selectAssetItemPaddingY: "8px",
|
|
458
|
+
selectAssetItemTextGap: "0px",
|
|
459
|
+
selectBrokerageItemPaddingX: "12px",
|
|
460
|
+
selectBrokerageItemPaddingY: "11px",
|
|
461
|
+
selectBrokerageListGap: "0px",
|
|
462
|
+
walletConnectorListGap: "10px",
|
|
463
|
+
txBreakdownMarginY: "18px",
|
|
464
|
+
txBreakdownPaddingX: "12px",
|
|
465
|
+
txSummaryBoxPaddingX: "12px",
|
|
466
|
+
txSummaryBoxPaddingY: "12px",
|
|
467
|
+
txSummaryLineItemPadding: "0px",
|
|
468
|
+
txSummaryDividerMarginX: "12px",
|
|
469
|
+
txSummaryDividerMarginY: "12px",
|
|
470
|
+
verticalSectionGap: "18px",
|
|
471
|
+
withdrawalModalPaddingTop: "12px",
|
|
472
|
+
youPayYouReceivePaddingLeft: "12px",
|
|
473
|
+
youPayYouReceivePaddingRight: "16px",
|
|
474
|
+
youPayYouReceivePaddingY: "8px",
|
|
475
|
+
inputPaddingX: "12px",
|
|
476
|
+
inputPaddingY: "12px",
|
|
477
|
+
dropdownActiveItemRegularSizePaddingY: "8px",
|
|
478
|
+
assetListDefaultGap: "4px",
|
|
479
|
+
dropdownGroupDividerMarginY: "8px",
|
|
480
|
+
...customSpacings
|
|
481
|
+
},
|
|
482
|
+
textTransforms: {
|
|
483
|
+
inputAmountQuickOptionButton: "none",
|
|
484
|
+
txStatusTitle: "none",
|
|
485
|
+
...customTextTransforms
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
// src/themes/darkTheme.ts
|
|
490
|
+
var accentColors = {
|
|
491
|
+
blue: { accentColor: "#3898FF", accentColorForeground: "#FFF" },
|
|
492
|
+
green: { accentColor: "#66CC00", accentColorForeground: "#000" },
|
|
493
|
+
orange: { accentColor: "#F6851B", accentColorForeground: "#000" },
|
|
494
|
+
pink: { accentColor: "#FF7AB8", accentColorForeground: "#000" },
|
|
495
|
+
purple: { accentColor: "#7A70FF", accentColorForeground: "#FFF" },
|
|
496
|
+
red: { accentColor: "#F34126", accentColorForeground: "#FFF" },
|
|
497
|
+
white: { accentColor: "#FFF", accentColorForeground: "#000" }
|
|
498
|
+
};
|
|
499
|
+
var defaultAccentColor = accentColors.white;
|
|
500
|
+
var darkTheme = ({
|
|
501
|
+
accentColor = defaultAccentColor.accentColor,
|
|
502
|
+
accentColorForeground = defaultAccentColor.accentColorForeground,
|
|
503
|
+
customColors,
|
|
504
|
+
customShadows,
|
|
505
|
+
...baseThemeOptions
|
|
506
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: just a bunch of ?? defaults
|
|
507
|
+
} = {}) => ({
|
|
508
|
+
...baseTheme(baseThemeOptions),
|
|
509
|
+
colors: {
|
|
510
|
+
accentColor,
|
|
511
|
+
accentColorForeground,
|
|
512
|
+
actionButtonBorder: "rgba(255, 255, 255, 0.04)",
|
|
513
|
+
connectButtonBackground: "#000",
|
|
514
|
+
connectButtonBackgroundError: "#C60000",
|
|
515
|
+
connectButtonText: "#FFF",
|
|
516
|
+
connectButtonTextError: "#FFF",
|
|
517
|
+
connectionIndicator: "#30E000",
|
|
518
|
+
error: accentColors.red.accentColor,
|
|
519
|
+
errorBackground: "#F2E6E4",
|
|
520
|
+
errorBorder: "rgba(243, 65, 38, 0.2)",
|
|
521
|
+
generalBorder: "#292929",
|
|
522
|
+
// strokeColor in figma
|
|
523
|
+
generalBorderDim: "rgba(255, 255, 255, 0.04)",
|
|
524
|
+
menuItemBackground: "rgba(255, 255, 255, 0.03)",
|
|
525
|
+
selectedOptionBorder: "rgba(224, 232, 255, 0.1)",
|
|
526
|
+
focusedOptionBorder: "#8C8C8C",
|
|
527
|
+
standby: "#F6851B",
|
|
528
|
+
success: "#66CC00",
|
|
529
|
+
delayedStatusIcon: customColors?.secondaryText ?? "#8C8C8C",
|
|
530
|
+
// backward compatibility
|
|
531
|
+
chainIconBorder: "#fff",
|
|
532
|
+
// FUNKIT COLORS
|
|
533
|
+
// modal backgrounds
|
|
534
|
+
modalBackdrop: "rgba(0, 0, 0, 0.2)",
|
|
535
|
+
modalBackground: "#000000",
|
|
536
|
+
modalBorder: "#292929",
|
|
537
|
+
modalTopbarIcon: "#FFF",
|
|
538
|
+
modalTopbarIconBackground: customColors?.modalTopbarIconBackground ?? "transparent",
|
|
539
|
+
modalTopbarIconBackgroundHover: customColors?.modalTopbarIconBackgroundHover ?? customColors?.buttonIconBackgroundHover ?? "#333333",
|
|
540
|
+
modalTopbarIconBackgroundPressed: customColors?.modalTopbarIconBackgroundPressed ?? customColors?.buttonIconBackgroundPressed ?? "#333333",
|
|
541
|
+
modalTopbarIconStroke: customColors?.modalTopbarIconStroke ?? customColors?.buttonIconStroke ?? "rgba(255, 255, 255, 0.35)",
|
|
542
|
+
offBackground: "#1F1F1F",
|
|
543
|
+
offBackgroundInverse: "#F2F2F2",
|
|
544
|
+
hoverState: "#333333",
|
|
545
|
+
lightStroke: "#333333",
|
|
546
|
+
mediumStroke: "#333333",
|
|
547
|
+
heavyStroke: "rgba(117, 117, 117, 0.40)",
|
|
548
|
+
strokeColor: "#333333",
|
|
549
|
+
secondaryBackground: "#333333",
|
|
550
|
+
//Text
|
|
551
|
+
primaryText: "#FFF",
|
|
552
|
+
secondaryText: "#8C8C8C",
|
|
553
|
+
tertiaryText: "rgba(255, 255, 255, 0.35)",
|
|
554
|
+
textSelection: "rgba(255, 255, 255, 0.10)",
|
|
555
|
+
selectedDropdownItemText: customColors?.primaryText ?? "#FFF",
|
|
556
|
+
copyButtonBackgroundBase: customColors?.offBackground ?? "#1F1F1F",
|
|
557
|
+
copyButtonBackgroundHover: customColors?.hoverState ?? "#333333",
|
|
558
|
+
copyButtonBackgroundActive: customColors?.inputBorderHover ?? "#525252",
|
|
559
|
+
useConnectedBackgroundBase: customColors?.mediumStroke ?? "#333333",
|
|
560
|
+
useConnectedBackgroundHover: customColors?.mediumStroke ?? "#333333",
|
|
561
|
+
copyButtonBorderBase: customColors?.mediumStroke ?? "#333333",
|
|
562
|
+
copyButtonBorderHover: customColors?.mediumStroke ?? "#333333",
|
|
563
|
+
funFeatureListBackgroundBase: customColors?.offBackground ?? "#1F1F1F",
|
|
564
|
+
funFeatureListBackgroundHover: customColors?.hoverState ?? "#333333",
|
|
565
|
+
funFeatureListBorderColor: "transparent",
|
|
566
|
+
funFeatureListBorderColorHover: "transparent",
|
|
567
|
+
selectedDropdownItemBackground: "transparent",
|
|
568
|
+
alwaysVisibleLabelBackgroundHover: "transparent",
|
|
569
|
+
// input
|
|
570
|
+
inputLabel: customColors?.primaryText ?? "#FFF",
|
|
571
|
+
inputBackground: "#000000",
|
|
572
|
+
inputBackgroundHover: customColors?.offBackground ?? "#1F1F1F",
|
|
573
|
+
inputBorderBase: "#333333",
|
|
574
|
+
inputBorderHover: "#525252",
|
|
575
|
+
// tab
|
|
576
|
+
activeTabBorderColor: "#333333",
|
|
577
|
+
activeTabBackground: "#333333",
|
|
578
|
+
inactiveTabBorderColor: "transparent",
|
|
579
|
+
inactiveTabBackgroundBase: "transparent",
|
|
580
|
+
inactiveTabBackgroundHover: "transparent",
|
|
581
|
+
inactiveTabBackgroundActive: "transparent",
|
|
582
|
+
activeTabText: customColors?.primaryText ?? "#FFF",
|
|
583
|
+
inactiveTabTextBase: customColors?.secondaryText ?? "#8C8C8C",
|
|
584
|
+
inactiveTabHover: customColors?.primaryText ?? "#FFF",
|
|
585
|
+
// button
|
|
586
|
+
actionColor: "#FFF",
|
|
587
|
+
actionColorHover: "rgba(255, 255, 255, 0.8)",
|
|
588
|
+
actionColorDisabled: "rgba(255, 255, 255, 0.65)",
|
|
589
|
+
buttonPrimary: accentColor,
|
|
590
|
+
buttonDisabled: "rgba(255, 255, 255, 0.20)",
|
|
591
|
+
buttonTextPrimary: "#000000",
|
|
592
|
+
buttonTextHover: "#000000",
|
|
593
|
+
buttonTextDisabled: "#000000",
|
|
594
|
+
buttonWarning: accentColors.red.accentColor,
|
|
595
|
+
buttonSuccess: "#2EA200",
|
|
596
|
+
transparent: "transparent",
|
|
597
|
+
buttonBackgroundTertiary: "#333333",
|
|
598
|
+
buttonBackgroundHoverTertiary: "#333333",
|
|
599
|
+
buttonBackgroundDisabledTertiary: "transparent",
|
|
600
|
+
buttonTextTertiary: "#FFF",
|
|
601
|
+
buttonTextDisabledTertiary: "rgba(255, 255, 255, 0.65)",
|
|
602
|
+
buttonBackground: "#FFF",
|
|
603
|
+
buttonBackgroundHover: "#f2f2f2",
|
|
604
|
+
buttonBackgroundPressed: "#FFF",
|
|
605
|
+
buttonBackgroundDisabled: "rgba(255, 255, 255, 0.65)",
|
|
606
|
+
buttonTextSecondaryDisabled: "rgba(255, 255, 255, 0.65)",
|
|
607
|
+
buttonTextSecondary: "#FFFFFF",
|
|
608
|
+
buttonIconBackgroundHover: "#333333",
|
|
609
|
+
buttonIconBackgroundPressed: "#333333",
|
|
610
|
+
buttonIconStroke: "rgba(255, 255, 255, 0.35)",
|
|
611
|
+
buttonBorderTertiary: "transparent",
|
|
612
|
+
buttonBorderFocusedTertiary: "rgba(255, 255, 255, 0.35)",
|
|
613
|
+
buttonFocusedOutline: "none",
|
|
614
|
+
buttonBorderGradient: "none",
|
|
615
|
+
buttonHoverBorderGradient: "none",
|
|
616
|
+
buttonDisabledBorderGradient: "none",
|
|
617
|
+
// TODO: Make common colors when refactoring the design system
|
|
618
|
+
inputAmountQuickOptionBaseBackground: "#1F1F1F",
|
|
619
|
+
inputAmountQuickOptionHoverBackground: "#333333",
|
|
620
|
+
inputAmountQuickOptionActiveBackground: "#333333",
|
|
621
|
+
inputAmountQuickOptionDisabledBackground: "#333333",
|
|
622
|
+
inputAmountQuickOptionBaseBorder: "#f2f2f2",
|
|
623
|
+
inputAmountQuickOptionHoverBorder: "rgba(255, 255, 255, 0.35)",
|
|
624
|
+
inputAmountQuickOptionActiveBorder: "rgba(255, 255, 255, 0.35)",
|
|
625
|
+
inputAmountQuickOptionFocusedBorder: "rgba(255, 255, 255, 0.35)",
|
|
626
|
+
inputAmountFiatDecimalsColor: customColors?.inputAmountFiatDecimalsColor ?? "none",
|
|
627
|
+
youPayYouReceiveBackground: "#000000",
|
|
628
|
+
// modalBackground
|
|
629
|
+
youPayYouReceiveBorder: "#333333",
|
|
630
|
+
// mediumStroke
|
|
631
|
+
youPayYouReceivePrimaryText: "#FFF",
|
|
632
|
+
// primaryText
|
|
633
|
+
youPayYouReceiveSecondaryText: "#8C8C8C",
|
|
634
|
+
// secondaryText
|
|
635
|
+
withdrawalYouWillReceiveLabel: customColors?.withdrawalYouWillReceiveLabel ?? customColors?.primaryText ?? "#FFF",
|
|
636
|
+
withdrawalYouWillReceiveValueCrypto: customColors?.withdrawalYouWillReceiveValueCrypto ?? customColors?.primaryText ?? "#FFF",
|
|
637
|
+
withdrawalYouWillReceiveValueUsd: customColors?.withdrawalYouWillReceiveValueUsd ?? customColors?.secondaryText ?? "#8C8C8C",
|
|
638
|
+
// badges
|
|
639
|
+
badgeBackgroundSuccess: "rgba(124, 242, 136, 0.1)",
|
|
640
|
+
badgeBorderSuccess: "rgba(124, 242, 136, 0.2)",
|
|
641
|
+
badgeTextSuccess: "rgb(124, 242, 136)",
|
|
642
|
+
newBadgeBackground: "linear-gradient(180deg, rgba(57, 76, 56, 0.55) 0%, rgba(61, 81, 65, 0.55) 100%)",
|
|
643
|
+
newBadgeBorder: "rgba(122, 221, 122, 0.3)",
|
|
644
|
+
newBadgeText: "#A4FF9A",
|
|
645
|
+
approvedBadgeBackground: "linear-gradient(180deg, rgba(236, 255, 234, 0.20) 0%, rgba(228, 255, 233, 0.20) 100%)",
|
|
646
|
+
approvedBadgeBorder: "rgba(109, 216, 109, 0.08)",
|
|
647
|
+
approvedBadgeText: "#8FFFA9",
|
|
648
|
+
failedBadgeBackground: "rgba(255, 61, 61, 0.18)",
|
|
649
|
+
failedBadgeBorder: "rgba(255, 255, 255, 0.10)",
|
|
650
|
+
failedBadgeText: "#F88877",
|
|
651
|
+
announceGradientFrom: "#AAAAAA",
|
|
652
|
+
announceGradientTo: "#BEBEBE",
|
|
653
|
+
fiatPendingGradientFrom: "#AAAAAA",
|
|
654
|
+
fiatPendingGradientTo: "#BEBEBE",
|
|
655
|
+
fiatSuccessBackgroundFill: "rgba(102, 204, 0, 0.30)",
|
|
656
|
+
fiatFailedBackgroundFill: "rgba(255, 61, 61, 0.30)",
|
|
657
|
+
fiatStatusIconBorder: "rgba(255, 255, 255, 0.06)",
|
|
658
|
+
fiatAccountIconFill: "#002F5E",
|
|
659
|
+
fiatAccountGradientFrom: "#3A82FE",
|
|
660
|
+
fiatAccountGradientTo: "#73A7FF",
|
|
661
|
+
modalHeaderDivider: "#333333",
|
|
662
|
+
// lightStroke
|
|
663
|
+
modalFooterDivider: "#333333",
|
|
664
|
+
// lightStroke
|
|
665
|
+
spinnerBackground: customColors?.mediumStroke ?? "rgba(0, 0, 0, 0.3)",
|
|
666
|
+
// 30% buttonTextPrimary
|
|
667
|
+
spinnerIndicator: customColors?.primaryText ?? "#000",
|
|
668
|
+
// 100% buttonTextPrimary
|
|
669
|
+
spinnerBackgroundVerifyAccount: "rgba(0, 0, 0, 0.3)",
|
|
670
|
+
// 30% buttonTextPrimary
|
|
671
|
+
spinnerIndicatorVerifyAccount: customColors?.primaryText ?? "#000",
|
|
672
|
+
// 100% buttonTextPrimary
|
|
673
|
+
// Override colors
|
|
674
|
+
...customColors || {},
|
|
675
|
+
// option Boxes
|
|
676
|
+
optionBoxBackground: customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#000",
|
|
677
|
+
// keeps gradient in SourcePaymentMethodItem if optionBoxBackground differs from modal background
|
|
678
|
+
optionBoxBackgroundUninteractive: customColors?.optionBoxBackgroundUninteractive ?? "transparent",
|
|
679
|
+
optionBoxBorderBase: customColors?.optionBoxBorderBase ?? customColors?.mediumStroke ?? "#333333",
|
|
680
|
+
optionBoxBorderHover: customColors?.optionBoxBorderHover ?? customColors?.mediumStroke ?? "#333333",
|
|
681
|
+
optionBoxDefaultModeNotActiveBorderBase: customColors?.optionBoxDefaultModeNotActiveBorderBase ?? "transparent",
|
|
682
|
+
optionBoxDefaultModeNotActiveBorderHover: customColors?.optionBoxDefaultModeNotActiveBorderHover ?? "transparent",
|
|
683
|
+
dropdownActiveItemBackgroundBase: customColors?.dropdownActiveItemBackgroundBase ?? customColors?.modalBackground ?? "#000000",
|
|
684
|
+
openDropdownBackgroundColor: customColors?.openDropdownBackgroundColor ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#000",
|
|
685
|
+
dropdownActiveItemBackgroundHover: customColors?.dropdownActiveItemBackgroundHover ?? customColors?.offBackground ?? "#1F1F1F",
|
|
686
|
+
dropdownActiveItemBackgroundDisabled: customColors?.dropdownActiveItemBackgroundDisabled ?? "transparent",
|
|
687
|
+
dropdownActiveItemBorderBase: customColors?.dropdownActiveItemBorderBase ?? customColors?.mediumStroke ?? "#333333",
|
|
688
|
+
dropdownActiveItemBorderHover: customColors?.dropdownActiveItemBorderHover ?? customColors?.mediumStroke ?? "#333333",
|
|
689
|
+
dropdownGroupHeader: customColors?.dropdownGroupHeader ?? customColors?.primaryText ?? "#FFF",
|
|
690
|
+
// primaryText
|
|
691
|
+
txSummaryBoxBackground: customColors?.txSummaryBoxBackground ?? customColors?.modalBackground ?? "#000",
|
|
692
|
+
txSummaryBoxBorder: customColors?.txSummaryBoxBorder ?? customColors?.lightStroke ?? "#333333",
|
|
693
|
+
modalBackgroundCheckoutComplete: customColors?.modalBackgroundCheckoutComplete ?? customColors?.modalBackground ?? "#000",
|
|
694
|
+
counterRingColor: customColors?.counterRingColor ?? accentColor,
|
|
695
|
+
cryptoCashToggleContainerBorderColor: customColors?.cryptoCashToggleContainerBorderColor ?? "transparent",
|
|
696
|
+
cryptoCashToggleBackground: customColors?.cryptoCashToggleBackground ?? "transparent"
|
|
697
|
+
},
|
|
698
|
+
shadows: {
|
|
699
|
+
connectButton: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
700
|
+
dialog: "0px 8px 32px rgba(0, 0, 0, 0.32)",
|
|
701
|
+
selectedOption: "0px 2px 6px rgba(0, 0, 0, 0.24)",
|
|
702
|
+
selectedWallet: "0px 2px 6px rgba(0, 0, 0, 0.24)",
|
|
703
|
+
dropdown: "0px 0px 0px 1px rgba(255, 255, 255, 0.16), 0px 2px 6px rgba(0, 0, 0, 0.03), 0px 4px 42px rgba(0, 0, 0, 0.06)",
|
|
704
|
+
notification: "0px 0px 0px 1px rgba(255, 255, 255, 0.20), 0px 2px 6px 0px rgba(0, 0, 0, 0.05), 0px 4px 42px 0px rgba(0, 0, 0, 0.06)",
|
|
705
|
+
qrCode: "0px 0px 0px 1px rgba(255, 255, 255, 0.16)",
|
|
706
|
+
buttonShadow: "none",
|
|
707
|
+
buttonShadowTertiary: "none",
|
|
708
|
+
buttonHoverShadow: "none",
|
|
709
|
+
buttonHoverShadowTertiary: "none",
|
|
710
|
+
buttonFocusedShadow: "0px 0px 0px 2px rgba(255, 255, 255, 0.25)",
|
|
711
|
+
buttonFocusedShadowTertiary: "0px 0px 0px 2px rgba(255, 255, 255, 0.25)",
|
|
712
|
+
buttonDisabledShadow: "none",
|
|
713
|
+
buttonDisabledShadowTertiary: "none",
|
|
714
|
+
buttonInnerShadow: "none",
|
|
715
|
+
buttonInnerShadowTertiary: customShadows?.buttonInnerShadow ?? "none",
|
|
716
|
+
buttonFocusedInnerShadow: "none",
|
|
717
|
+
buttonFocusedInnerShadowTertiary: customShadows?.buttonFocusedInnerShadow ?? "none",
|
|
718
|
+
buttonHoverInnerShadow: "none",
|
|
719
|
+
buttonHoverInnerShadowTertiary: customShadows?.buttonHoverInnerShadow ?? "none",
|
|
720
|
+
buttonDisabledInnerShadow: "none",
|
|
721
|
+
buttonDisabledInnerShadowTertiary: customShadows?.buttonDisabledInnerShadow ?? "none",
|
|
722
|
+
selectedDropdownItem: "none",
|
|
723
|
+
// Override shadows
|
|
724
|
+
...customShadows || {}
|
|
725
|
+
},
|
|
726
|
+
moonpayTheme: "dark"
|
|
727
|
+
});
|
|
728
|
+
darkTheme.accentColors = accentColors;
|
|
729
|
+
|
|
730
|
+
// src/themes/lightTheme.ts
|
|
731
|
+
var accentColors2 = {
|
|
732
|
+
blue: { accentColor: "#31A3F8", accentColorForeground: "#31A3F859" },
|
|
733
|
+
green: { accentColor: "#66CC00", accentColorForeground: "#FFF" },
|
|
734
|
+
orange: { accentColor: "#F6851B", accentColorForeground: "#FFF" },
|
|
735
|
+
pink: { accentColor: "#FF5CA0", accentColorForeground: "#FFF" },
|
|
736
|
+
purple: { accentColor: "#5F5AFA", accentColorForeground: "#FFF" },
|
|
737
|
+
red: { accentColor: "#F34126", accentColorForeground: "#FFF" },
|
|
738
|
+
white: { accentColor: "#000000", accentColorForeground: "#FFF" }
|
|
739
|
+
};
|
|
740
|
+
var defaultAccentColor2 = accentColors2.white;
|
|
741
|
+
var lightTheme = ({
|
|
742
|
+
accentColor = defaultAccentColor2.accentColor,
|
|
743
|
+
accentColorForeground = defaultAccentColor2.accentColorForeground,
|
|
744
|
+
customColors,
|
|
745
|
+
customShadows,
|
|
746
|
+
...baseThemeOptions
|
|
747
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: just a bunch of ?? defaults
|
|
748
|
+
} = {}) => ({
|
|
749
|
+
...baseTheme(baseThemeOptions),
|
|
750
|
+
colors: {
|
|
751
|
+
accentColor,
|
|
752
|
+
accentColorForeground,
|
|
753
|
+
actionButtonBorder: "rgba(0, 0, 0, 0.04)",
|
|
754
|
+
connectButtonBackground: "#FFF",
|
|
755
|
+
connectButtonBackgroundError: "#C60000",
|
|
756
|
+
connectButtonText: "#25292E",
|
|
757
|
+
connectButtonTextError: "#FFF",
|
|
758
|
+
connectionIndicator: "#30E000",
|
|
759
|
+
error: accentColors2.red.accentColor,
|
|
760
|
+
errorBackground: "#F2E6E4",
|
|
761
|
+
errorBorder: "rgba(243, 65, 38, 0.2)",
|
|
762
|
+
generalBorder: "#F7F7F7",
|
|
763
|
+
// strokeColor in figma
|
|
764
|
+
generalBorderDim: "rgba(0, 0, 0, 0.03)",
|
|
765
|
+
menuItemBackground: "#FCFCFC",
|
|
766
|
+
selectedOptionBorder: "#F7F7F7",
|
|
767
|
+
focusedOptionBorder: "#737373",
|
|
768
|
+
standby: "#F6851B",
|
|
769
|
+
success: "#66CC00",
|
|
770
|
+
delayedStatusIcon: customColors?.secondaryText ?? "#737373",
|
|
771
|
+
// backward compatibility
|
|
772
|
+
chainIconBorder: "#fff",
|
|
773
|
+
// FUNKIT COLORS
|
|
774
|
+
// modal backgrounds
|
|
775
|
+
modalBackdrop: "rgba(0, 0, 0, 0.2)",
|
|
776
|
+
modalTopbarIcon: "#000",
|
|
777
|
+
modalTopbarIconBackground: customColors?.modalTopbarIconBackground ?? "transparent",
|
|
778
|
+
modalTopbarIconBackgroundHover: customColors?.modalTopbarIconBackgroundHover ?? customColors?.buttonIconBackgroundHover ?? "#F7F7F7",
|
|
779
|
+
modalTopbarIconBackgroundPressed: customColors?.modalTopbarIconBackgroundPressed ?? customColors?.buttonIconBackgroundPressed ?? "#F0F0F0",
|
|
780
|
+
modalTopbarIconStroke: customColors?.modalTopbarIconStroke ?? customColors?.buttonIconStroke ?? "rgba(0, 0, 0, 0.35)",
|
|
781
|
+
modalBackground: "#FFF",
|
|
782
|
+
modalBorder: "#F7F7F7",
|
|
783
|
+
offBackground: "#F7F7F7",
|
|
784
|
+
offBackgroundInverse: "#333333",
|
|
785
|
+
hoverState: "#F0F0F0",
|
|
786
|
+
lightStroke: "#F7F7F7",
|
|
787
|
+
mediumStroke: "#F0F0F0",
|
|
788
|
+
heavyStroke: "#E5E5E5",
|
|
789
|
+
strokeColor: "#E8E8E8",
|
|
790
|
+
secondaryBackground: "#F7F7F7",
|
|
791
|
+
//Text
|
|
792
|
+
primaryText: "#000",
|
|
793
|
+
secondaryText: "#737373",
|
|
794
|
+
tertiaryText: "rgba(0, 0, 0, 0.35)",
|
|
795
|
+
textSelection: "rgba(0, 0, 0, 0.10)",
|
|
796
|
+
selectedDropdownItemText: customColors?.primaryText ?? "#000",
|
|
797
|
+
copyButtonBackgroundBase: customColors?.offBackground ?? "#F7F7F7",
|
|
798
|
+
copyButtonBackgroundHover: customColors?.hoverState ?? "#F0F0F0",
|
|
799
|
+
copyButtonBackgroundActive: customColors?.inputBorderHover ?? "#E5E5E5",
|
|
800
|
+
useConnectedBackgroundBase: customColors?.mediumStroke ?? "#F0F0F0",
|
|
801
|
+
useConnectedBackgroundHover: customColors?.mediumStroke ?? "#F0F0F0",
|
|
802
|
+
copyButtonBorderBase: customColors?.mediumStroke ?? "#F0F0F0",
|
|
803
|
+
copyButtonBorderHover: customColors?.mediumStroke ?? "#F0F0F0",
|
|
804
|
+
funFeatureListBackgroundBase: customColors?.offBackground ?? "#F7F7F7",
|
|
805
|
+
funFeatureListBackgroundHover: customColors?.hoverState ?? "#F0F0F0",
|
|
806
|
+
funFeatureListBorderColor: "transparent",
|
|
807
|
+
funFeatureListBorderColorHover: "transparent",
|
|
808
|
+
selectedDropdownItemBackground: "transparent",
|
|
809
|
+
alwaysVisibleLabelBackgroundHover: "transparent",
|
|
810
|
+
// input
|
|
811
|
+
inputLabel: customColors?.primaryText ?? "#000",
|
|
812
|
+
inputBackground: "#FFFFFF",
|
|
813
|
+
inputBackgroundHover: customColors?.offBackground ?? "#F7F7F7",
|
|
814
|
+
inputBorderBase: "#F0F0F0",
|
|
815
|
+
inputBorderHover: "#E5E5E5",
|
|
816
|
+
// tab
|
|
817
|
+
activeTabBorderColor: "#F7F7F7",
|
|
818
|
+
activeTabBackground: "#F7F7F7",
|
|
819
|
+
inactiveTabBorderColor: "transparent",
|
|
820
|
+
inactiveTabBackgroundBase: "transparent",
|
|
821
|
+
inactiveTabBackgroundHover: "transparent",
|
|
822
|
+
inactiveTabBackgroundActive: "transparent",
|
|
823
|
+
activeTabText: customColors?.primaryText ?? "#000",
|
|
824
|
+
inactiveTabTextBase: customColors?.secondaryText ?? "#737373",
|
|
825
|
+
inactiveTabHover: customColors?.primaryText ?? "#000",
|
|
826
|
+
// button
|
|
827
|
+
actionColor: "#000",
|
|
828
|
+
actionColorHover: "rgba(0, 0, 0, 0.7)",
|
|
829
|
+
actionColorDisabled: "rgba(0, 0, 0, 0.50)",
|
|
830
|
+
buttonPrimary: accentColor,
|
|
831
|
+
buttonDisabled: "#31A3F826",
|
|
832
|
+
buttonWarning: accentColors2.red.accentColor,
|
|
833
|
+
buttonSuccess: "#2EA200",
|
|
834
|
+
buttonTextPrimary: "#FFFFFF",
|
|
835
|
+
buttonTextHover: "#FFF",
|
|
836
|
+
buttonTextDisabled: "#FFF",
|
|
837
|
+
transparent: "transparent",
|
|
838
|
+
buttonBackgroundTertiary: "#F7F7F7",
|
|
839
|
+
buttonBackgroundHoverTertiary: "#F0F0F0",
|
|
840
|
+
buttonBackgroundDisabledTertiary: "transparent",
|
|
841
|
+
buttonTextTertiary: "#000",
|
|
842
|
+
buttonTextDisabledTertiary: "rgba(0, 0, 0, 0.5)",
|
|
843
|
+
buttonBackground: "#000",
|
|
844
|
+
buttonBackgroundHover: "#333333",
|
|
845
|
+
buttonBackgroundPressed: "#000",
|
|
846
|
+
buttonBackgroundDisabled: "rgba(0, 0, 0, 0.5)",
|
|
847
|
+
buttonTextSecondaryDisabled: "rgba(0, 0, 0, 0.5)",
|
|
848
|
+
buttonTextSecondary: "#000000",
|
|
849
|
+
buttonIconBackgroundHover: "#F7F7F7",
|
|
850
|
+
buttonIconBackgroundPressed: "#F0F0F0",
|
|
851
|
+
buttonIconStroke: "rgba(0, 0, 0, 0.35)",
|
|
852
|
+
buttonBorderTertiary: "transparent",
|
|
853
|
+
buttonBorderFocusedTertiary: "rgba(0, 0, 0, 0.35)",
|
|
854
|
+
buttonFocusedOutline: "none",
|
|
855
|
+
buttonBorderGradient: "none",
|
|
856
|
+
buttonHoverBorderGradient: "none",
|
|
857
|
+
buttonDisabledBorderGradient: "none",
|
|
858
|
+
// TODO: Make common colors when refactoring the design system
|
|
859
|
+
inputAmountQuickOptionBaseBackground: "#F7F7F7",
|
|
860
|
+
inputAmountQuickOptionHoverBackground: "#F0F0F0",
|
|
861
|
+
inputAmountQuickOptionActiveBackground: "#F0F0F0",
|
|
862
|
+
inputAmountQuickOptionDisabledBackground: "#F7F7F7",
|
|
863
|
+
inputAmountQuickOptionBaseBorder: "#F7F7F7",
|
|
864
|
+
inputAmountQuickOptionHoverBorder: "rgba(0, 0, 0, 0.35)",
|
|
865
|
+
inputAmountQuickOptionActiveBorder: "rgba(0, 0, 0, 0.35)",
|
|
866
|
+
inputAmountQuickOptionFocusedBorder: "rgba(0, 0, 0, 0.35)",
|
|
867
|
+
inputAmountFiatDecimalsColor: customColors?.inputAmountFiatDecimalsColor ?? "none",
|
|
868
|
+
youPayYouReceiveBackground: "#FFF",
|
|
869
|
+
// modalBackground
|
|
870
|
+
youPayYouReceiveBorder: "#F0F0F0",
|
|
871
|
+
// mediumStroke
|
|
872
|
+
youPayYouReceivePrimaryText: "#000",
|
|
873
|
+
// primaryText
|
|
874
|
+
youPayYouReceiveSecondaryText: "#737373",
|
|
875
|
+
// secondaryText
|
|
876
|
+
withdrawalYouWillReceiveLabel: customColors?.withdrawalYouWillReceiveLabel ?? customColors?.primaryText ?? "#000",
|
|
877
|
+
withdrawalYouWillReceiveValueCrypto: customColors?.withdrawalYouWillReceiveValueCrypto ?? customColors?.primaryText ?? "#000",
|
|
878
|
+
withdrawalYouWillReceiveValueUsd: customColors?.withdrawalYouWillReceiveValueUsd ?? customColors?.secondaryText ?? "#737373",
|
|
879
|
+
// badges
|
|
880
|
+
badgeBackgroundSuccess: "rgba(124, 242, 136, 0.1)",
|
|
881
|
+
badgeBorderSuccess: "rgba(124, 242, 136, 0.2)",
|
|
882
|
+
badgeTextSuccess: "rgb(124, 242, 136)",
|
|
883
|
+
newBadgeBackground: "linear-gradient(180deg, #ECFFEA 0%, #E4FFE9 100%)",
|
|
884
|
+
newBadgeBorder: "rgba(122, 221, 122, 0.5)",
|
|
885
|
+
newBadgeText: "#028320",
|
|
886
|
+
approvedBadgeBackground: "linear-gradient(180deg, #ECFFEA 0%, #E4FFE9 100%)",
|
|
887
|
+
approvedBadgeBorder: "rgba(109, 216, 109, 0.5)",
|
|
888
|
+
approvedBadgeText: "#028320",
|
|
889
|
+
failedBadgeBackground: "rgba(255, 61, 61, 0.08)",
|
|
890
|
+
failedBadgeBorder: "rgba(0, 0, 0, 0.03)",
|
|
891
|
+
failedBadgeText: "#C2341E",
|
|
892
|
+
announceGradientFrom: "#595959",
|
|
893
|
+
announceGradientTo: "#9C9C9C",
|
|
894
|
+
fiatPendingGradientFrom: "#454545",
|
|
895
|
+
fiatPendingGradientTo: "#747474",
|
|
896
|
+
fiatSuccessBackgroundFill: "rgba(102, 204, 0, 0.16)",
|
|
897
|
+
fiatFailedBackgroundFill: "rgba(255, 61, 61, 0.12)",
|
|
898
|
+
fiatStatusIconBorder: "rgba(0, 0, 0, 0.03)",
|
|
899
|
+
fiatAccountIconFill: "#E7F3FE",
|
|
900
|
+
fiatAccountGradientFrom: "#055DF5",
|
|
901
|
+
fiatAccountGradientTo: "#4C8DFD",
|
|
902
|
+
modalHeaderDivider: "#F7F7F7",
|
|
903
|
+
// lightStroke
|
|
904
|
+
modalFooterDivider: "#F7F7F7",
|
|
905
|
+
// lightStroke
|
|
906
|
+
spinnerBackground: customColors?.mediumStroke ?? "rgba(255, 255, 255, 0.3)",
|
|
907
|
+
// 30% buttonTextPrimary
|
|
908
|
+
spinnerIndicator: customColors?.primaryText ?? "#FFF",
|
|
909
|
+
// 100% buttonTextPrimary
|
|
910
|
+
spinnerBackgroundVerifyAccount: "rgba(255, 255, 255, 0.3)",
|
|
911
|
+
// 30% buttonTextPrimary
|
|
912
|
+
spinnerIndicatorVerifyAccount: customColors?.primaryText ?? "#FFF",
|
|
913
|
+
// 100% buttonTextPrimary
|
|
914
|
+
// Override colors
|
|
915
|
+
...customColors || {},
|
|
916
|
+
// option Boxes
|
|
917
|
+
optionBoxBackground: customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
918
|
+
// keeps gradient in SourcePaymentMethodItem if optionBoxBackground differs from modal background
|
|
919
|
+
optionBoxBackgroundUninteractive: customColors?.optionBoxBackgroundUninteractive ?? "transparent",
|
|
920
|
+
optionBoxBorderBase: customColors?.optionBoxBorderBase ?? customColors?.mediumStroke ?? "#F0F0F0",
|
|
921
|
+
optionBoxBorderHover: customColors?.optionBoxBorderHover ?? customColors?.mediumStroke ?? "#F0F0F0",
|
|
922
|
+
optionBoxDefaultModeNotActiveBorderBase: customColors?.optionBoxDefaultModeNotActiveBorderBase ?? "transparent",
|
|
923
|
+
optionBoxDefaultModeNotActiveBorderHover: customColors?.optionBoxDefaultModeNotActiveBorderHover ?? "transparent",
|
|
924
|
+
dropdownActiveItemBackgroundBase: customColors?.dropdownActiveItemBackgroundBase ?? customColors?.modalBackground ?? "#FFF",
|
|
925
|
+
openDropdownBackgroundColor: customColors?.openDropdownBackgroundColor ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
926
|
+
dropdownActiveItemBackgroundHover: customColors?.dropdownActiveItemBackgroundHover ?? customColors?.offBackground ?? "#F7F7F7",
|
|
927
|
+
dropdownActiveItemBackgroundDisabled: customColors?.dropdownActiveItemBackgroundDisabled ?? "transparent",
|
|
928
|
+
dropdownActiveItemBorderBase: customColors?.dropdownActiveItemBorderBase ?? customColors?.mediumStroke ?? "#F0F0F0",
|
|
929
|
+
dropdownActiveItemBorderHover: customColors?.dropdownActiveItemBorderHover ?? customColors?.mediumStroke ?? "#F0F0F0",
|
|
930
|
+
dropdownGroupHeader: customColors?.dropdownGroupHeader ?? customColors?.primaryText ?? "#000",
|
|
931
|
+
// primaryText
|
|
932
|
+
txSummaryBoxBackground: customColors?.txSummaryBoxBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
933
|
+
txSummaryBoxBorder: customColors?.txSummaryBoxBorder ?? customColors?.lightStroke ?? "#F7F7F7",
|
|
934
|
+
modalBackgroundCheckoutComplete: customColors?.modalBackgroundCheckoutComplete ?? customColors?.modalBackground ?? "#FFF",
|
|
935
|
+
counterRingColor: customColors?.counterRingColor ?? accentColor,
|
|
936
|
+
cryptoCashToggleContainerBorderColor: customColors?.cryptoCashToggleContainerBorderColor ?? "transparent",
|
|
937
|
+
cryptoCashToggleBackground: customColors?.cryptoCashToggleBackground ?? "transparent"
|
|
938
|
+
},
|
|
939
|
+
shadows: {
|
|
940
|
+
connectButton: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
941
|
+
dialog: "0px 8px 32px rgba(0, 0, 0, 0.32)",
|
|
942
|
+
selectedOption: "0px 2px 6px rgba(0, 0, 0, 0.24)",
|
|
943
|
+
selectedWallet: "0px 2px 6px rgba(0, 0, 0, 0.12)",
|
|
944
|
+
dropdown: "0px 0px 0px 1px rgba(0, 0, 0, 0.05), 0px 2px 6px 0px rgba(0, 0, 0, 0.03), 0px 4px 42px 0px rgba(0, 0, 0, 0.06)",
|
|
945
|
+
notification: "0px 0px 0px 1px rgba(0, 0, 0, 0.06), 0px 2px 6px 0px rgba(0, 0, 0, 0.05), 0px 4px 42px 0px rgba(0, 0, 0, 0.06)",
|
|
946
|
+
qrCode: "0px 0px 0px 1px rgba(0, 0, 0, 0.10), 0px 1px 4px 0px rgba(0, 0, 0, 0.04), 0px 4px 24px 0px rgba(8, 7, 7, 0.10)",
|
|
947
|
+
buttonShadow: "none",
|
|
948
|
+
buttonShadowTertiary: customShadows?.buttonShadow ?? "none",
|
|
949
|
+
buttonFocusedShadow: "0px 0px 0px 2px rgba(0, 0, 0, 0.25)",
|
|
950
|
+
buttonFocusedShadowTertiary: "0px 0px 0px 2px rgba(0, 0, 0, 0.25)",
|
|
951
|
+
buttonHoverShadow: "none",
|
|
952
|
+
buttonHoverShadowTertiary: "none",
|
|
953
|
+
buttonDisabledShadow: "none",
|
|
954
|
+
buttonDisabledShadowTertiary: customShadows?.buttonDisabledShadow ?? "none",
|
|
955
|
+
buttonInnerShadow: "none",
|
|
956
|
+
buttonInnerShadowTertiary: customShadows?.buttonInnerShadow ?? "none",
|
|
957
|
+
buttonFocusedInnerShadow: "none",
|
|
958
|
+
buttonFocusedInnerShadowTertiary: customShadows?.buttonFocusedInnerShadow ?? "none",
|
|
959
|
+
buttonHoverInnerShadow: "none",
|
|
960
|
+
buttonHoverInnerShadowTertiary: customShadows?.buttonHoverInnerShadow ?? "none",
|
|
961
|
+
buttonDisabledInnerShadow: "none",
|
|
962
|
+
buttonDisabledInnerShadowTertiary: customShadows?.buttonDisabledInnerShadow ?? "none",
|
|
963
|
+
selectedDropdownItem: "none",
|
|
964
|
+
// Override shadows
|
|
965
|
+
...customShadows || {}
|
|
966
|
+
},
|
|
967
|
+
moonpayTheme: "light"
|
|
968
|
+
});
|
|
969
|
+
lightTheme.accentColors = accentColors2;
|
|
970
|
+
|
|
971
|
+
// src/providers/FunkitThemeProvider.tsx
|
|
972
|
+
var DEFAULT_THEME_SET = {
|
|
973
|
+
lightTheme: lightTheme(),
|
|
974
|
+
darkTheme: darkTheme()
|
|
975
|
+
};
|
|
976
|
+
var DEFAULT_THEME = DEFAULT_THEME_SET.darkTheme;
|
|
977
|
+
var ThemeIdContext = createContext2(void 0);
|
|
978
|
+
var ThemeContext = createContext2({
|
|
979
|
+
activeTheme: DEFAULT_THEME,
|
|
980
|
+
lightTheme: void 0,
|
|
981
|
+
darkTheme: void 0,
|
|
982
|
+
setTheme: () => {
|
|
983
|
+
return;
|
|
984
|
+
},
|
|
985
|
+
toggleTheme: () => {
|
|
986
|
+
return;
|
|
987
|
+
},
|
|
988
|
+
themeColorScheme: void 0
|
|
989
|
+
});
|
|
990
|
+
var useActiveTheme = () => {
|
|
991
|
+
const {
|
|
992
|
+
activeTheme,
|
|
993
|
+
setTheme,
|
|
994
|
+
lightTheme: lightTheme2,
|
|
995
|
+
darkTheme: darkTheme2,
|
|
996
|
+
toggleTheme,
|
|
997
|
+
themeColorScheme
|
|
998
|
+
} = useContext2(ThemeContext);
|
|
999
|
+
return {
|
|
1000
|
+
activeTheme,
|
|
1001
|
+
/** Overrides the currently active `theme` with disregard to the `theme` provided to the `FunkitProvider`, ie. `toggleTheme` will switch to the `theme` provided to the `FunkitProvider`, not the theme set by `setTheme` */
|
|
1002
|
+
setTheme,
|
|
1003
|
+
/** Returns the `light` theme as long as a themeSet was passed to the `FunkitProvider`, if only a single theme object was passed it will be returned as `lightTheme` and `darkTheme` making them the same */
|
|
1004
|
+
lightTheme: lightTheme2,
|
|
1005
|
+
/** Returns the `dark` theme as long as a themeSet was passed to the `FunkitProvider`, if only a single theme object was passed it will be returned as `darkTheme` and `lightTheme` making them the same */
|
|
1006
|
+
darkTheme: darkTheme2,
|
|
1007
|
+
/** Toggles between `light` and `dark` themes as long as they were passed to the `FunkitProvider`, if only a single theme object was passed toggling will be disabled */
|
|
1008
|
+
toggleTheme,
|
|
1009
|
+
/** Returns an indication whether a `light` or a `dark` theme should be currently active, has meaning only if a themeSet was passed to the `FunkitProvider`, if only a single theme object was passed it reflects the system color scheme */
|
|
1010
|
+
themeColorScheme
|
|
1011
|
+
};
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
// src/components/FunSkeletonLoader/FunSkeletonLoader.css.ts
|
|
1015
|
+
var animateSkeletonClass = "dj0x602 _1rsrm2f15a";
|
|
1016
|
+
|
|
1017
|
+
// src/components/FunSkeletonLoader/FunSkeletonBlock.tsx
|
|
1018
|
+
function FunSkeletonBlock({
|
|
1019
|
+
borderRadius = "skeleton",
|
|
1020
|
+
fontSize,
|
|
1021
|
+
height,
|
|
1022
|
+
width = "full",
|
|
1023
|
+
...props
|
|
1024
|
+
}) {
|
|
1025
|
+
const { activeTheme } = useActiveTheme();
|
|
1026
|
+
const cssHeight = height ? activeTheme.dimensions[height] || (height.endsWith("px") ? height : `${height}px`) : activeTheme.fontSize[fontSize].lineHeight;
|
|
1027
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1028
|
+
Box,
|
|
1029
|
+
{
|
|
1030
|
+
borderRadius,
|
|
1031
|
+
className: animateSkeletonClass,
|
|
1032
|
+
width,
|
|
1033
|
+
...props,
|
|
1034
|
+
style: { height: cssHeight, ...props.style }
|
|
1035
|
+
}
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
// src/components/FunInput/FunInput.css.ts
|
|
1040
|
+
var baseWrapperStyles = "zue0i60";
|
|
1041
|
+
var baseWrapperStylesNoTransition = "zue0i61";
|
|
1042
|
+
var inputClass = "zue0i64 _1rsrm2f2py _1rsrm2fri _1rsrm2ftj _1rsrm2fvl _1rsrm2fpi";
|
|
1043
|
+
var inputClassDisabled = "zue0i68 _1rsrm2f2ta _1rsrm2fri _1rsrm2ftj _1rsrm2fvl _1rsrm2fpi";
|
|
1044
|
+
var inputClassDisabledNoTransition = "zue0i6a _1rsrm2f2ta _1rsrm2fri _1rsrm2ftj _1rsrm2fvl _1rsrm2fpi";
|
|
1045
|
+
var inputClassError = "zue0i6c _1rsrm2f2py _1rsrm2fri _1rsrm2ftj _1rsrm2fvl _1rsrm2fpi";
|
|
1046
|
+
var inputClassErrorNoTransition = "zue0i6f _1rsrm2f2py _1rsrm2fri _1rsrm2ftj _1rsrm2fvl _1rsrm2fpi";
|
|
1047
|
+
var inputClassNoTransition = "zue0i66 _1rsrm2f2py _1rsrm2fri _1rsrm2ftj _1rsrm2fvl _1rsrm2fpi";
|
|
1048
|
+
var numberInputResetStyle = "zue0i62";
|
|
1049
|
+
|
|
1050
|
+
// src/components/FunInput/FunInput.tsx
|
|
1051
|
+
import React5, {
|
|
1052
|
+
forwardRef,
|
|
1053
|
+
useEffect as useEffect3,
|
|
1054
|
+
useState as useState4
|
|
1055
|
+
} from "react";
|
|
1056
|
+
import clsx from "clsx";
|
|
1057
|
+
|
|
1058
|
+
// src/components/Icons/SearchIcon.tsx
|
|
1059
|
+
import React4 from "react";
|
|
1060
|
+
var SearchIcon = () => {
|
|
1061
|
+
return /* @__PURE__ */ React4.createElement(
|
|
1062
|
+
"svg",
|
|
1063
|
+
{
|
|
1064
|
+
width: "15",
|
|
1065
|
+
height: "15",
|
|
1066
|
+
viewBox: "0 0 15 15",
|
|
1067
|
+
fill: "none",
|
|
1068
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1069
|
+
},
|
|
1070
|
+
/* @__PURE__ */ React4.createElement(
|
|
1071
|
+
"path",
|
|
1072
|
+
{
|
|
1073
|
+
d: "M6.45041 12.9008C5.17464 12.9008 3.92752 12.5225 2.86676 11.8138C1.80599 11.105 0.979229 10.0975 0.491012 8.91887C0.00279446 7.74023 -0.124946 6.44321 0.123947 5.19199C0.37284 3.94074 0.987179 2.79139 1.88928 1.88928C2.79139 0.987179 3.94074 0.37284 5.19199 0.123947C6.44321 -0.124946 7.74023 0.00279446 8.91887 0.491012C10.0975 0.979229 11.105 1.80599 11.8138 2.86676C12.5225 3.92752 12.9008 5.17464 12.9008 6.45041C12.9008 7.29744 12.7339 8.13625 12.4098 8.91887C12.0856 9.70148 11.6105 10.4126 11.0115 11.0115C10.4126 11.6105 9.70148 12.0856 8.91887 12.4098C8.13625 12.7339 7.29744 12.9008 6.45041 12.9008ZM6.45041 1.29351C5.43386 1.29351 4.44014 1.59496 3.59491 2.15972C2.74968 2.72448 2.0909 3.52721 1.70189 4.46637C1.31287 5.40554 1.21108 6.43893 1.4094 7.43596C1.60772 8.43299 2.09724 9.34881 2.81604 10.0676C3.53486 10.7864 4.45067 11.276 5.44769 11.4743C6.44467 11.6726 7.47811 11.5708 8.41731 11.1818C9.35643 10.7927 10.1592 10.134 10.724 9.28876C11.2887 8.44352 11.5902 7.44984 11.5902 6.43328C11.5902 5.07012 11.0487 3.7628 10.0847 2.79891C9.12086 1.83502 7.81356 1.29351 6.45041 1.29351Z",
|
|
1074
|
+
fill: "currentColor"
|
|
1075
|
+
}
|
|
1076
|
+
),
|
|
1077
|
+
/* @__PURE__ */ React4.createElement(
|
|
1078
|
+
"path",
|
|
1079
|
+
{
|
|
1080
|
+
d: "M14.3567 15C14.2723 15.0003 14.1886 14.9839 14.1107 14.9515C14.0327 14.9192 13.962 14.8716 13.9027 14.8115L10.3648 11.2737C10.2513 11.1519 10.1896 10.9907 10.1925 10.8243C10.1954 10.6578 10.2629 10.4991 10.3806 10.3813C10.4983 10.2636 10.6571 10.1962 10.8236 10.1933C10.99 10.1904 11.151 10.2521 11.2729 10.3656L14.8107 13.9035C14.931 14.024 14.9986 14.1872 14.9986 14.3575C14.9986 14.5277 14.931 14.691 14.8107 14.8115C14.7515 14.8716 14.6807 14.9192 14.6027 14.9515C14.5248 14.9839 14.4411 15.0003 14.3567 15Z",
|
|
1081
|
+
fill: "currentColor"
|
|
1082
|
+
}
|
|
1083
|
+
)
|
|
1084
|
+
);
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
// src/components/FunInput/FunInput.tsx
|
|
1088
|
+
var DEFAULT_ICON_FONT_SIZE = "57px";
|
|
1089
|
+
var FunInput = forwardRef(function FunInputWithRef({
|
|
1090
|
+
prefix,
|
|
1091
|
+
suffix,
|
|
1092
|
+
prefixIcon,
|
|
1093
|
+
placeholder,
|
|
1094
|
+
value,
|
|
1095
|
+
label,
|
|
1096
|
+
onChange,
|
|
1097
|
+
onKeyDown,
|
|
1098
|
+
onKeySubmit,
|
|
1099
|
+
onPaste,
|
|
1100
|
+
onMouseDown,
|
|
1101
|
+
onFocus: userOnFocus,
|
|
1102
|
+
onBlur: userOnBlur,
|
|
1103
|
+
adornmentColor = "secondaryText",
|
|
1104
|
+
fontFamily = "body",
|
|
1105
|
+
textWeight = "inputLabel",
|
|
1106
|
+
inputStyle = {},
|
|
1107
|
+
inputProps = { type: "text" },
|
|
1108
|
+
error,
|
|
1109
|
+
alwaysFocused,
|
|
1110
|
+
overrideBorderWidth,
|
|
1111
|
+
overrideBackground,
|
|
1112
|
+
ignoreFontSize,
|
|
1113
|
+
borderRadius = "connectButton",
|
|
1114
|
+
isLoading = false,
|
|
1115
|
+
allowMultiline = false,
|
|
1116
|
+
ignoreBaseTransitions = false,
|
|
1117
|
+
decimalsColor,
|
|
1118
|
+
decimalSeparator,
|
|
1119
|
+
testId
|
|
1120
|
+
}, ref) {
|
|
1121
|
+
const { activeTheme } = useActiveTheme();
|
|
1122
|
+
const [focused, setFocused] = useState4(false);
|
|
1123
|
+
const onFocus = () => {
|
|
1124
|
+
setFocused(true);
|
|
1125
|
+
userOnFocus?.();
|
|
1126
|
+
};
|
|
1127
|
+
const onBlur = () => {
|
|
1128
|
+
setFocused(false);
|
|
1129
|
+
userOnBlur?.();
|
|
1130
|
+
};
|
|
1131
|
+
const isFocused = alwaysFocused || focused;
|
|
1132
|
+
const isValidDecimalColor = !!decimalsColor && activeTheme.colors?.[decimalsColor] !== "none";
|
|
1133
|
+
const getBorderColor = () => {
|
|
1134
|
+
if (error) {
|
|
1135
|
+
return { base: "error" };
|
|
1136
|
+
}
|
|
1137
|
+
if (inputProps.disabled) {
|
|
1138
|
+
return { base: "inputBorderBase" };
|
|
1139
|
+
}
|
|
1140
|
+
if (isFocused) {
|
|
1141
|
+
return { base: "secondaryText" };
|
|
1142
|
+
}
|
|
1143
|
+
return {
|
|
1144
|
+
base: "inputBorderBase",
|
|
1145
|
+
hover: "inputBorderHover"
|
|
1146
|
+
};
|
|
1147
|
+
};
|
|
1148
|
+
const textareaRef = React5.useRef(null);
|
|
1149
|
+
useEffect3(() => {
|
|
1150
|
+
if (allowMultiline) {
|
|
1151
|
+
adjustTextareaHeight(textareaRef.current);
|
|
1152
|
+
}
|
|
1153
|
+
}, [allowMultiline, value]);
|
|
1154
|
+
const { integerPart, decimalPart, shouldColorDecimals } = React5.useMemo(() => {
|
|
1155
|
+
if (!isValidDecimalColor || !value || !decimalSeparator) {
|
|
1156
|
+
return { integerPart: "", decimalPart: "", shouldColorDecimals: false };
|
|
1157
|
+
}
|
|
1158
|
+
const stringValue = String(value);
|
|
1159
|
+
const parts = stringValue.split(decimalSeparator);
|
|
1160
|
+
return {
|
|
1161
|
+
integerPart: parts[0] || "",
|
|
1162
|
+
decimalPart: parts[1] !== void 0 ? `${decimalSeparator}${parts[1]}` : "",
|
|
1163
|
+
shouldColorDecimals: parts[1] !== void 0
|
|
1164
|
+
};
|
|
1165
|
+
}, [value, isValidDecimalColor, decimalSeparator]);
|
|
1166
|
+
const renderInputOrTextarea = () => {
|
|
1167
|
+
const commonProps = {
|
|
1168
|
+
// ref,
|
|
1169
|
+
value,
|
|
1170
|
+
placeholder,
|
|
1171
|
+
onChange,
|
|
1172
|
+
onKeyDown: (e) => {
|
|
1173
|
+
e.stopPropagation();
|
|
1174
|
+
onKeyDown?.(e);
|
|
1175
|
+
if (e.key === "Enter") {
|
|
1176
|
+
onKeySubmit?.();
|
|
1177
|
+
}
|
|
1178
|
+
},
|
|
1179
|
+
onPaste,
|
|
1180
|
+
onMouseDown,
|
|
1181
|
+
onFocus,
|
|
1182
|
+
onBlur,
|
|
1183
|
+
onWheel: (e) => {
|
|
1184
|
+
e.currentTarget.blur();
|
|
1185
|
+
},
|
|
1186
|
+
className: clsx(
|
|
1187
|
+
error ? ignoreBaseTransitions ? inputClassErrorNoTransition : inputClassError : inputProps.disabled ? ignoreBaseTransitions ? inputClassDisabledNoTransition : inputClassDisabled : ignoreBaseTransitions ? inputClassNoTransition : inputClass,
|
|
1188
|
+
numberInputResetStyle
|
|
1189
|
+
),
|
|
1190
|
+
...inputProps,
|
|
1191
|
+
// If decimals are colored, the actual input element is hidden
|
|
1192
|
+
// but keep the caret visible via caretColor
|
|
1193
|
+
style: {
|
|
1194
|
+
...inputStyle,
|
|
1195
|
+
color: shouldColorDecimals ? "transparent" : void 0,
|
|
1196
|
+
caretColor: isValidDecimalColor ? themeVars.colors.primaryText : void 0
|
|
1197
|
+
},
|
|
1198
|
+
"data-auto-focus": inputProps.autoFocus,
|
|
1199
|
+
"data-testid": testId ? `rk-${testId.replace(/^rk-/, "")}` : void 0
|
|
1200
|
+
};
|
|
1201
|
+
const handleTextareaOnChange = (e) => {
|
|
1202
|
+
adjustTextareaHeight(textareaRef.current);
|
|
1203
|
+
if (onChange) {
|
|
1204
|
+
onChange(e);
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
const handleTextAreaOnPaste = (e) => {
|
|
1208
|
+
adjustTextareaHeight(textareaRef.current);
|
|
1209
|
+
if (onPaste) {
|
|
1210
|
+
onPaste(e);
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
const inputElement = allowMultiline ? /* @__PURE__ */ React5.createElement(
|
|
1214
|
+
"textarea",
|
|
1215
|
+
{
|
|
1216
|
+
...commonProps,
|
|
1217
|
+
ref: (el) => {
|
|
1218
|
+
textareaRef.current = el;
|
|
1219
|
+
if (typeof ref === "function") {
|
|
1220
|
+
ref(el);
|
|
1221
|
+
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
1222
|
+
ref.current = el;
|
|
1223
|
+
}
|
|
1224
|
+
},
|
|
1225
|
+
rows: 1,
|
|
1226
|
+
style: {
|
|
1227
|
+
...commonProps.style,
|
|
1228
|
+
resize: "none",
|
|
1229
|
+
boxSizing: "border-box"
|
|
1230
|
+
},
|
|
1231
|
+
onChange: handleTextareaOnChange,
|
|
1232
|
+
onPaste: handleTextAreaOnPaste
|
|
1233
|
+
}
|
|
1234
|
+
) : /* @__PURE__ */ React5.createElement(
|
|
1235
|
+
"input",
|
|
1236
|
+
{
|
|
1237
|
+
...commonProps,
|
|
1238
|
+
ref: (el) => {
|
|
1239
|
+
if (typeof ref === "function") {
|
|
1240
|
+
ref(el);
|
|
1241
|
+
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
1242
|
+
ref.current = el;
|
|
1243
|
+
}
|
|
1244
|
+
},
|
|
1245
|
+
type: inputProps?.type || "text"
|
|
1246
|
+
}
|
|
1247
|
+
);
|
|
1248
|
+
if (shouldColorDecimals) {
|
|
1249
|
+
return /* @__PURE__ */ React5.createElement(Box, { style: { position: "relative", display: "flex", flex: 1 } }, /* @__PURE__ */ React5.createElement(
|
|
1250
|
+
Box,
|
|
1251
|
+
{
|
|
1252
|
+
color: "primaryText",
|
|
1253
|
+
style: {
|
|
1254
|
+
position: "absolute",
|
|
1255
|
+
left: 0,
|
|
1256
|
+
top: 0,
|
|
1257
|
+
pointerEvents: "none",
|
|
1258
|
+
fontFamily: "inherit",
|
|
1259
|
+
fontSize: "inherit",
|
|
1260
|
+
fontWeight: "inherit",
|
|
1261
|
+
lineHeight: "inherit",
|
|
1262
|
+
whiteSpace: "nowrap",
|
|
1263
|
+
display: "flex",
|
|
1264
|
+
alignItems: "center",
|
|
1265
|
+
height: "100%"
|
|
1266
|
+
}
|
|
1267
|
+
},
|
|
1268
|
+
/* @__PURE__ */ React5.createElement("span", { style: { color: "inherit" } }, integerPart),
|
|
1269
|
+
/* @__PURE__ */ React5.createElement(DecimalSpan, { decimalsColor }, decimalPart)
|
|
1270
|
+
), inputElement);
|
|
1271
|
+
}
|
|
1272
|
+
return inputElement;
|
|
1273
|
+
};
|
|
1274
|
+
return /* @__PURE__ */ React5.createElement(
|
|
1275
|
+
Box,
|
|
1276
|
+
{
|
|
1277
|
+
color: "primaryText",
|
|
1278
|
+
display: "flex",
|
|
1279
|
+
flexDirection: "column",
|
|
1280
|
+
fontSize: "inherit",
|
|
1281
|
+
gap: "8",
|
|
1282
|
+
width: "full"
|
|
1283
|
+
},
|
|
1284
|
+
label && /* @__PURE__ */ React5.createElement(Text, { size: "inputLabel", weight: textWeight }, label),
|
|
1285
|
+
isLoading ? /* @__PURE__ */ React5.createElement(FunSkeletonBlock, { height: "44" }) : /* @__PURE__ */ React5.createElement(
|
|
1286
|
+
Box,
|
|
1287
|
+
{
|
|
1288
|
+
borderRadius,
|
|
1289
|
+
fontFamily,
|
|
1290
|
+
minWidth: "full",
|
|
1291
|
+
display: "flex",
|
|
1292
|
+
alignItems: allowMultiline ? "flex-start" : "center",
|
|
1293
|
+
color: adornmentColor,
|
|
1294
|
+
borderColor: getBorderColor(),
|
|
1295
|
+
borderWidth: overrideBorderWidth ?? "1",
|
|
1296
|
+
borderStyle: "solid",
|
|
1297
|
+
fontSize: ignoreFontSize ? "inherit" : "inputValue",
|
|
1298
|
+
fontWeight: "inputValue",
|
|
1299
|
+
className: ignoreBaseTransitions ? baseWrapperStylesNoTransition : baseWrapperStyles,
|
|
1300
|
+
background: overrideBackground || {
|
|
1301
|
+
base: "inputBackground",
|
|
1302
|
+
hover: "inputBackgroundHover"
|
|
1303
|
+
}
|
|
1304
|
+
},
|
|
1305
|
+
prefix && /* @__PURE__ */ React5.createElement(Box, { paddingLeft: "12", height: "max" }, prefix),
|
|
1306
|
+
prefixIcon === "SearchIcon" && /* @__PURE__ */ React5.createElement(
|
|
1307
|
+
Box,
|
|
1308
|
+
{
|
|
1309
|
+
display: "flex",
|
|
1310
|
+
paddingLeft: "12",
|
|
1311
|
+
height: "max",
|
|
1312
|
+
alignItems: "center",
|
|
1313
|
+
color: isFocused ? "primaryText" : "secondaryText"
|
|
1314
|
+
},
|
|
1315
|
+
/* @__PURE__ */ React5.createElement(SearchIcon, null)
|
|
1316
|
+
),
|
|
1317
|
+
prefixIcon === "$" && /* @__PURE__ */ React5.createElement(Box, { display: "flex", alignItems: "center", paddingLeft: "32" }, /* @__PURE__ */ React5.createElement(
|
|
1318
|
+
DollarTextIcon,
|
|
1319
|
+
{
|
|
1320
|
+
fontSize: inputStyle.fontSize || DEFAULT_ICON_FONT_SIZE
|
|
1321
|
+
}
|
|
1322
|
+
)),
|
|
1323
|
+
renderInputOrTextarea(),
|
|
1324
|
+
suffix && /* @__PURE__ */ React5.createElement(
|
|
1325
|
+
Box,
|
|
1326
|
+
{
|
|
1327
|
+
paddingLeft: "4",
|
|
1328
|
+
paddingRight: "10",
|
|
1329
|
+
...allowMultiline ? {
|
|
1330
|
+
style: {
|
|
1331
|
+
paddingTop: `calc(${themeVars.spacing.inputPaddingY} - 3px)`
|
|
1332
|
+
}
|
|
1333
|
+
} : {}
|
|
1334
|
+
},
|
|
1335
|
+
suffix
|
|
1336
|
+
)
|
|
1337
|
+
),
|
|
1338
|
+
error && typeof error === "string" && /* @__PURE__ */ React5.createElement(Text, { color: "error", size: "10" }, error)
|
|
1339
|
+
);
|
|
1340
|
+
});
|
|
1341
|
+
var adjustTextareaHeight = (textarea) => {
|
|
1342
|
+
if (textarea) {
|
|
1343
|
+
textarea.style.height = "auto";
|
|
1344
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
var DollarTextIcon = ({ fontSize }) => /* @__PURE__ */ React5.createElement(
|
|
1348
|
+
Text,
|
|
1349
|
+
{
|
|
1350
|
+
style: {
|
|
1351
|
+
paddingBottom: 2,
|
|
1352
|
+
fontSize,
|
|
1353
|
+
fontWeight: 800
|
|
1354
|
+
}
|
|
1355
|
+
},
|
|
1356
|
+
"$"
|
|
1357
|
+
);
|
|
1358
|
+
var DecimalSpan = ({
|
|
1359
|
+
decimalsColor,
|
|
1360
|
+
children
|
|
1361
|
+
}) => /* @__PURE__ */ React5.createElement(
|
|
1362
|
+
Box,
|
|
1363
|
+
{
|
|
1364
|
+
color: decimalsColor,
|
|
1365
|
+
style: { fontFamily: "inherit", fontSize: "inherit" }
|
|
1366
|
+
},
|
|
1367
|
+
children
|
|
1368
|
+
);
|
|
1369
|
+
|
|
1370
|
+
// src/utils/tokenMath.ts
|
|
1371
|
+
import { formatCurrencyAndStringify } from "@funkit/utils";
|
|
1372
|
+
import * as dnum from "dnum";
|
|
1373
|
+
import { formatUnits } from "viem";
|
|
1374
|
+
function floorToDecimals(value, decimals) {
|
|
1375
|
+
const d = dnum.from(value, decimals);
|
|
1376
|
+
return dnum.toNumber(d, decimals);
|
|
1377
|
+
}
|
|
1378
|
+
function formatUsdFlooredToCent(balanceUsd) {
|
|
1379
|
+
return formatCurrencyAndStringify(floorToDecimals(balanceUsd, 2));
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
// src/components/Icons/CheckIcon.tsx
|
|
1383
|
+
import React6 from "react";
|
|
1384
|
+
var CheckIcon = ({
|
|
1385
|
+
size = 16,
|
|
1386
|
+
className
|
|
1387
|
+
}) => /* @__PURE__ */ React6.createElement(
|
|
1388
|
+
"svg",
|
|
1389
|
+
{
|
|
1390
|
+
width: size,
|
|
1391
|
+
height: size,
|
|
1392
|
+
viewBox: "0 0 16 16",
|
|
1393
|
+
fill: "none",
|
|
1394
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1395
|
+
className
|
|
1396
|
+
},
|
|
1397
|
+
/* @__PURE__ */ React6.createElement(
|
|
1398
|
+
"path",
|
|
1399
|
+
{
|
|
1400
|
+
d: "M12.4919 4.88281L6.25757 11.1172L3.50781 8",
|
|
1401
|
+
stroke: "currentColor",
|
|
1402
|
+
strokeWidth: "1.5",
|
|
1403
|
+
strokeLinecap: "round",
|
|
1404
|
+
strokeLinejoin: "round",
|
|
1405
|
+
pathLength: "100"
|
|
1406
|
+
}
|
|
1407
|
+
)
|
|
1408
|
+
);
|
|
1409
|
+
|
|
1410
|
+
// src/components/Dropdown/BaseDropdownItem.tsx
|
|
1411
|
+
import { noop } from "@funkit/utils";
|
|
1412
|
+
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
1413
|
+
import React7 from "react";
|
|
1414
|
+
import clsx2 from "clsx";
|
|
1415
|
+
|
|
1416
|
+
// src/components/Dropdown/BaseDropdownItem.css.ts
|
|
1417
|
+
var disabledDropdownItemStyles = "_18hhw3k3 _18hhw3k2";
|
|
1418
|
+
var enabledDropdownItemStyles = "_18hhw3k1 _18hhw3k0";
|
|
1419
|
+
|
|
1420
|
+
// src/components/Dropdown/BaseDropdownItem.tsx
|
|
1421
|
+
function BaseDropdownItem({
|
|
1422
|
+
iconComponent,
|
|
1423
|
+
label,
|
|
1424
|
+
description,
|
|
1425
|
+
id,
|
|
1426
|
+
onClick = noop,
|
|
1427
|
+
isSelected = false,
|
|
1428
|
+
isDisabled = false,
|
|
1429
|
+
borderRadius = "connectButton",
|
|
1430
|
+
horizontalIconGap = "dropdownItemIconGap",
|
|
1431
|
+
tagComponent,
|
|
1432
|
+
horizontalPadding = "dropdownItemPaddingX",
|
|
1433
|
+
verticalPadding = "dropdownItemPaddingY"
|
|
1434
|
+
}) {
|
|
1435
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1436
|
+
DropdownMenu.Item,
|
|
1437
|
+
{
|
|
1438
|
+
disabled: isDisabled,
|
|
1439
|
+
onSelect: () => onClick(id),
|
|
1440
|
+
asChild: true
|
|
1441
|
+
},
|
|
1442
|
+
/* @__PURE__ */ React7.createElement(
|
|
1443
|
+
Box,
|
|
1444
|
+
{
|
|
1445
|
+
width: "full",
|
|
1446
|
+
display: "flex",
|
|
1447
|
+
alignItems: "center",
|
|
1448
|
+
justifyContent: "space-between",
|
|
1449
|
+
gap: "24",
|
|
1450
|
+
paddingY: verticalPadding,
|
|
1451
|
+
paddingX: horizontalPadding,
|
|
1452
|
+
className: clsx2(
|
|
1453
|
+
isDisabled ? disabledDropdownItemStyles : enabledDropdownItemStyles
|
|
1454
|
+
),
|
|
1455
|
+
boxShadow: isSelected ? "selectedDropdownItem" : void 0,
|
|
1456
|
+
borderRadius
|
|
1457
|
+
},
|
|
1458
|
+
/* @__PURE__ */ React7.createElement(
|
|
1459
|
+
Box,
|
|
1460
|
+
{
|
|
1461
|
+
display: "flex",
|
|
1462
|
+
alignItems: "center",
|
|
1463
|
+
justifyContent: "flex-start",
|
|
1464
|
+
gap: horizontalIconGap
|
|
1465
|
+
},
|
|
1466
|
+
iconComponent && /* @__PURE__ */ React7.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "center" }, iconComponent),
|
|
1467
|
+
/* @__PURE__ */ React7.createElement(Box, { display: "flex", flexDirection: "column", justifyContent: "center" }, /* @__PURE__ */ React7.createElement(
|
|
1468
|
+
Text,
|
|
1469
|
+
{
|
|
1470
|
+
size: "dropdownItemFontSize",
|
|
1471
|
+
weight: "medium",
|
|
1472
|
+
color: isSelected ? "selectedDropdownItemText" : void 0
|
|
1473
|
+
},
|
|
1474
|
+
label
|
|
1475
|
+
), description != null && /* @__PURE__ */ React7.createElement(Text, { size: "12", color: "secondaryText" }, description))
|
|
1476
|
+
),
|
|
1477
|
+
/* @__PURE__ */ React7.createElement(
|
|
1478
|
+
Box,
|
|
1479
|
+
{
|
|
1480
|
+
display: "flex",
|
|
1481
|
+
alignItems: "center",
|
|
1482
|
+
justifyContent: "center",
|
|
1483
|
+
gap: "16"
|
|
1484
|
+
},
|
|
1485
|
+
tagComponent,
|
|
1486
|
+
/* @__PURE__ */ React7.createElement(
|
|
1487
|
+
Box,
|
|
1488
|
+
{
|
|
1489
|
+
width: "16",
|
|
1490
|
+
height: "16",
|
|
1491
|
+
alignItems: "center",
|
|
1492
|
+
justifyContent: "center",
|
|
1493
|
+
color: isSelected ? "selectedDropdownItemText" : "transparent"
|
|
1494
|
+
},
|
|
1495
|
+
/* @__PURE__ */ React7.createElement(CheckIcon, null)
|
|
1496
|
+
)
|
|
1497
|
+
)
|
|
1498
|
+
)
|
|
1499
|
+
);
|
|
1500
|
+
}
|
|
1501
|
+
var BaseDropdownItem_default = BaseDropdownItem;
|
|
1502
|
+
|
|
1503
|
+
// src/components/Icons/CaretDownIcon.tsx
|
|
1504
|
+
import clsx3 from "clsx";
|
|
1505
|
+
import React8 from "react";
|
|
1506
|
+
|
|
1507
|
+
// src/components/Icons/CaretDownIcon.css.ts
|
|
1508
|
+
var caretClosed = "_1gjdf1i3";
|
|
1509
|
+
var caretOpened = "_1gjdf1i2";
|
|
1510
|
+
|
|
1511
|
+
// src/components/Icons/CaretDownIcon.tsx
|
|
1512
|
+
var CaretDownIcon = () => {
|
|
1513
|
+
return /* @__PURE__ */ React8.createElement(
|
|
1514
|
+
"svg",
|
|
1515
|
+
{
|
|
1516
|
+
width: "8",
|
|
1517
|
+
height: "5",
|
|
1518
|
+
viewBox: "0 0 8 5",
|
|
1519
|
+
fill: "none",
|
|
1520
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1521
|
+
},
|
|
1522
|
+
/* @__PURE__ */ React8.createElement(
|
|
1523
|
+
"path",
|
|
1524
|
+
{
|
|
1525
|
+
d: "M3.45163 2.92973L0.879121 0.393174C0.654314 0.188182 0.317464 0.217886 0.126753 0.459527C-0.0639587 0.701168 -0.036324 1.06324 0.188483 1.26824L3.60944 4.64138C3.65478 4.68988 3.70789 4.72919 3.76623 4.7574C3.83874 4.79249 3.91764 4.80968 3.99714 4.80771C4.07647 4.80576 4.15489 4.78486 4.22578 4.74655C4.23264 4.74283 4.23943 4.73894 4.24614 4.7349C4.28505 4.71152 4.32107 4.68295 4.35332 4.64987L7.82907 1.18704C8.04528 0.97163 8.0581 0.608604 7.8577 0.376205C7.6573 0.143806 7.31956 0.130027 7.10335 0.345432L4.51922 2.91996C4.51922 2.94623 4 3.43025 4 3.43025L3.45163 2.92973Z",
|
|
1526
|
+
fill: "currentColor"
|
|
1527
|
+
}
|
|
1528
|
+
)
|
|
1529
|
+
);
|
|
1530
|
+
};
|
|
1531
|
+
var AnimatedCaretDownIcon = ({
|
|
1532
|
+
expanded,
|
|
1533
|
+
color = "primaryText",
|
|
1534
|
+
compact = false
|
|
1535
|
+
}) => {
|
|
1536
|
+
const animationClassName = clsx3(
|
|
1537
|
+
expanded !== void 0 && (expanded ? caretOpened : caretClosed)
|
|
1538
|
+
);
|
|
1539
|
+
if (compact) {
|
|
1540
|
+
return /* @__PURE__ */ React8.createElement(
|
|
1541
|
+
Box,
|
|
1542
|
+
{
|
|
1543
|
+
color,
|
|
1544
|
+
width: "8",
|
|
1545
|
+
height: "8",
|
|
1546
|
+
display: "flex",
|
|
1547
|
+
alignItems: "center",
|
|
1548
|
+
justifyContent: "center",
|
|
1549
|
+
className: animationClassName
|
|
1550
|
+
},
|
|
1551
|
+
/* @__PURE__ */ React8.createElement(CaretDownIcon, null)
|
|
1552
|
+
);
|
|
1553
|
+
}
|
|
1554
|
+
return /* @__PURE__ */ React8.createElement(
|
|
1555
|
+
Box,
|
|
1556
|
+
{
|
|
1557
|
+
color,
|
|
1558
|
+
width: "16",
|
|
1559
|
+
height: "16",
|
|
1560
|
+
display: "flex",
|
|
1561
|
+
alignItems: "center",
|
|
1562
|
+
justifyContent: "center",
|
|
1563
|
+
className: animationClassName
|
|
1564
|
+
},
|
|
1565
|
+
/* @__PURE__ */ React8.createElement(
|
|
1566
|
+
Box,
|
|
1567
|
+
{
|
|
1568
|
+
width: "8",
|
|
1569
|
+
height: "8",
|
|
1570
|
+
display: "flex",
|
|
1571
|
+
alignItems: "center",
|
|
1572
|
+
justifyContent: "center"
|
|
1573
|
+
},
|
|
1574
|
+
/* @__PURE__ */ React8.createElement(CaretDownIcon, null)
|
|
1575
|
+
)
|
|
1576
|
+
);
|
|
1577
|
+
};
|
|
1578
|
+
|
|
1579
|
+
// src/components/FunNoResults/FunNoResults.tsx
|
|
1580
|
+
import React11 from "react";
|
|
1581
|
+
|
|
1582
|
+
// src/components/Icons/CoinsIcon.tsx
|
|
1583
|
+
import React9 from "react";
|
|
1584
|
+
var CoinsIcon = ({
|
|
1585
|
+
size = 48,
|
|
1586
|
+
bgColor = "#141C41",
|
|
1587
|
+
iconColor = "#878A98"
|
|
1588
|
+
}) => {
|
|
1589
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1590
|
+
"svg",
|
|
1591
|
+
{
|
|
1592
|
+
width: size,
|
|
1593
|
+
height: size,
|
|
1594
|
+
viewBox: "0 0 48 49",
|
|
1595
|
+
fill: "none",
|
|
1596
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1597
|
+
},
|
|
1598
|
+
/* @__PURE__ */ React9.createElement("g", { clipPath: "url(#clip0_30657_22302)" }, /* @__PURE__ */ React9.createElement(
|
|
1599
|
+
"path",
|
|
1600
|
+
{
|
|
1601
|
+
d: "M24 1C36.9787 1 47.5 11.5213 47.5 24.5C47.5 37.4787 36.9787 48 24 48C11.0213 48 0.5 37.4787 0.5 24.5C0.5 11.5213 11.0213 1 24 1Z",
|
|
1602
|
+
fill: bgColor,
|
|
1603
|
+
stroke: bgColor
|
|
1604
|
+
}
|
|
1605
|
+
), /* @__PURE__ */ React9.createElement("g", { clipPath: "url(#clip1_30657_22302)" }, /* @__PURE__ */ React9.createElement(
|
|
1606
|
+
"path",
|
|
1607
|
+
{
|
|
1608
|
+
d: "M25 17C25 18.1046 22.5376 19 19.5 19C16.4624 19 14 18.1046 14 17M25 17C25 15.8954 22.5376 15 19.5 15C16.4624 15 14 15.8954 14 17M25 17V18.5M14 17V29C14 30.1046 16.4624 31 19.5 31M19.5 23C19.3315 23 19.1647 22.9972 19 22.9918C16.1967 22.9 14 22.0433 14 21M19.5 27C16.4624 27 14 26.1046 14 25M34 23.5C34 24.6046 31.5376 25.5 28.5 25.5C25.4624 25.5 23 24.6046 23 23.5M34 23.5C34 22.3954 31.5376 21.5 28.5 21.5C25.4624 21.5 23 22.3954 23 23.5M34 23.5V31C34 32.1046 31.5376 33 28.5 33C25.4624 33 23 32.1046 23 31V23.5M34 27.25C34 28.3546 31.5376 29.25 28.5 29.25C25.4624 29.25 23 28.3546 23 27.25",
|
|
1609
|
+
stroke: iconColor,
|
|
1610
|
+
strokeWidth: "1.5",
|
|
1611
|
+
strokeLinecap: "round",
|
|
1612
|
+
strokeLinejoin: "round"
|
|
1613
|
+
}
|
|
1614
|
+
))),
|
|
1615
|
+
/* @__PURE__ */ React9.createElement("defs", null, /* @__PURE__ */ React9.createElement("clipPath", { id: "clip0_30657_22302" }, /* @__PURE__ */ React9.createElement(
|
|
1616
|
+
"rect",
|
|
1617
|
+
{
|
|
1618
|
+
width: "48",
|
|
1619
|
+
height: "48",
|
|
1620
|
+
fill: "white",
|
|
1621
|
+
transform: "translate(0 0.5)"
|
|
1622
|
+
}
|
|
1623
|
+
)), /* @__PURE__ */ React9.createElement("clipPath", { id: "clip1_30657_22302" }, /* @__PURE__ */ React9.createElement(
|
|
1624
|
+
"rect",
|
|
1625
|
+
{
|
|
1626
|
+
width: "24",
|
|
1627
|
+
height: "24",
|
|
1628
|
+
fill: "white",
|
|
1629
|
+
transform: "translate(12 12)"
|
|
1630
|
+
}
|
|
1631
|
+
)))
|
|
1632
|
+
);
|
|
1633
|
+
};
|
|
1634
|
+
|
|
1635
|
+
// src/components/Icons/SearchSkeletonIcon.tsx
|
|
1636
|
+
import React10 from "react";
|
|
1637
|
+
var SearchSkeletonIcon = () => {
|
|
1638
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1639
|
+
"svg",
|
|
1640
|
+
{
|
|
1641
|
+
width: "122",
|
|
1642
|
+
height: "81",
|
|
1643
|
+
viewBox: "0 0 122 81",
|
|
1644
|
+
fill: "none",
|
|
1645
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1646
|
+
},
|
|
1647
|
+
/* @__PURE__ */ React10.createElement("g", { clipPath: "url(#clip0_7590_15835)" }, /* @__PURE__ */ React10.createElement(
|
|
1648
|
+
"path",
|
|
1649
|
+
{
|
|
1650
|
+
fillRule: "evenodd",
|
|
1651
|
+
clipRule: "evenodd",
|
|
1652
|
+
d: "M99.5636 34.0159C92.9099 34.0159 87.5159 39.4099 87.5159 46.0636C87.5159 52.7174 92.9099 58.1114 99.5636 58.1114C106.217 58.1114 111.611 52.7174 111.611 46.0636C111.611 39.4099 106.217 34.0159 99.5636 34.0159ZM83.5 46.0636C83.5 37.1919 90.6919 30 99.5636 30C108.435 30 115.627 37.1919 115.627 46.0636C115.627 49.7758 114.368 53.1938 112.254 55.9139L120.912 64.5722C121.696 65.3564 121.696 66.6277 120.912 67.4119C120.128 68.196 118.856 68.196 118.072 67.4119L109.414 58.7536C106.694 60.8681 103.276 62.1273 99.5636 62.1273C90.6919 62.1273 83.5 54.9353 83.5 46.0636Z",
|
|
1653
|
+
fill: "currentColor"
|
|
1654
|
+
}
|
|
1655
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1656
|
+
"path",
|
|
1657
|
+
{
|
|
1658
|
+
d: "M117.5 8H4.5C2.29086 8 0.5 9.79086 0.5 12V20C0.5 22.2091 2.29086 24 4.5 24H117.5C119.709 24 121.5 22.2091 121.5 20V12C121.5 9.79086 119.709 8 117.5 8Z",
|
|
1659
|
+
fill: "currentColor"
|
|
1660
|
+
}
|
|
1661
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1662
|
+
"path",
|
|
1663
|
+
{
|
|
1664
|
+
d: "M71.5 30H4.5C2.29086 30 0.5 31.7909 0.5 34V42C0.5 44.2091 2.29086 46 4.5 46H71.5C73.7091 46 75.5 44.2091 75.5 42V34C75.5 31.7909 73.7091 30 71.5 30Z",
|
|
1665
|
+
fill: "currentColor"
|
|
1666
|
+
}
|
|
1667
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1668
|
+
"path",
|
|
1669
|
+
{
|
|
1670
|
+
d: "M71.5 52H4.5C2.29086 52 0.5 53.7909 0.5 56V64C0.5 66.2091 2.29086 68 4.5 68H71.5C73.7091 68 75.5 66.2091 75.5 64V56C75.5 53.7909 73.7091 52 71.5 52Z",
|
|
1671
|
+
fill: "currentColor"
|
|
1672
|
+
}
|
|
1673
|
+
)),
|
|
1674
|
+
/* @__PURE__ */ React10.createElement("defs", null, /* @__PURE__ */ React10.createElement("clipPath", { id: "clip0_7590_15835" }, /* @__PURE__ */ React10.createElement(
|
|
1675
|
+
"rect",
|
|
1676
|
+
{
|
|
1677
|
+
width: "121",
|
|
1678
|
+
height: "81",
|
|
1679
|
+
fill: "white",
|
|
1680
|
+
transform: "translate(0.5)"
|
|
1681
|
+
}
|
|
1682
|
+
)))
|
|
1683
|
+
);
|
|
1684
|
+
};
|
|
1685
|
+
|
|
1686
|
+
// src/components/FunNoResults/FunNoResults.tsx
|
|
1687
|
+
var FunNoResults = ({
|
|
1688
|
+
text,
|
|
1689
|
+
title,
|
|
1690
|
+
variant = "default",
|
|
1691
|
+
actionButton
|
|
1692
|
+
}) => {
|
|
1693
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1694
|
+
Box,
|
|
1695
|
+
{
|
|
1696
|
+
display: "flex",
|
|
1697
|
+
flexDirection: "column",
|
|
1698
|
+
justifyContent: "center",
|
|
1699
|
+
alignItems: "center",
|
|
1700
|
+
gap: variant === "default" ? "12" : "16",
|
|
1701
|
+
color: "secondaryText",
|
|
1702
|
+
style: { flex: 1 }
|
|
1703
|
+
},
|
|
1704
|
+
variant === "default" && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(SearchSkeletonIcon, null), /* @__PURE__ */ React11.createElement(Text, { color: "secondaryText", size: "10" }, text)),
|
|
1705
|
+
variant === "actionable" && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
1706
|
+
CoinsIcon,
|
|
1707
|
+
{
|
|
1708
|
+
bgColor: themeVars.colors.offBackground,
|
|
1709
|
+
iconColor: themeVars.colors.actionColor
|
|
1710
|
+
}
|
|
1711
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1712
|
+
Box,
|
|
1713
|
+
{
|
|
1714
|
+
display: "flex",
|
|
1715
|
+
flexDirection: "column",
|
|
1716
|
+
alignItems: "center",
|
|
1717
|
+
gap: "12"
|
|
1718
|
+
},
|
|
1719
|
+
/* @__PURE__ */ React11.createElement(
|
|
1720
|
+
Box,
|
|
1721
|
+
{
|
|
1722
|
+
display: "flex",
|
|
1723
|
+
flexDirection: "column",
|
|
1724
|
+
alignItems: "center",
|
|
1725
|
+
textAlign: "center",
|
|
1726
|
+
gap: "8"
|
|
1727
|
+
},
|
|
1728
|
+
title && /* @__PURE__ */ React11.createElement(Text, { size: "14", color: "primaryText" }, title),
|
|
1729
|
+
/* @__PURE__ */ React11.createElement(Text, { color: "secondaryText", size: "12" }, text)
|
|
1730
|
+
),
|
|
1731
|
+
actionButton && /* @__PURE__ */ React11.createElement(Box, null, actionButton)
|
|
1732
|
+
))
|
|
1733
|
+
);
|
|
1734
|
+
};
|
|
1735
|
+
|
|
1736
|
+
// src/components/Icons/SwitchIcon.tsx
|
|
1737
|
+
import React12 from "react";
|
|
1738
|
+
var SwitchIcon = () => {
|
|
1739
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1740
|
+
"svg",
|
|
1741
|
+
{
|
|
1742
|
+
width: "15",
|
|
1743
|
+
height: "14",
|
|
1744
|
+
viewBox: "0 0 15 14",
|
|
1745
|
+
fill: "none",
|
|
1746
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1747
|
+
},
|
|
1748
|
+
/* @__PURE__ */ React12.createElement(
|
|
1749
|
+
"path",
|
|
1750
|
+
{
|
|
1751
|
+
fillRule: "evenodd",
|
|
1752
|
+
clipRule: "evenodd",
|
|
1753
|
+
d: "M0.96967 4.86358C0.676777 4.57069 0.676777 4.09582 0.96967 3.80292L3.63634 1.13626C3.92923 0.843363 4.4041 0.843363 4.697 1.13626L7.36366 3.80292C7.65656 4.09582 7.65656 4.57069 7.36366 4.86358C7.07077 5.15648 6.5959 5.15648 6.303 4.86358L4.91667 3.47725L4.91667 12.3333C4.91667 12.7475 4.58088 13.0833 4.16667 13.0833C3.75245 13.0833 3.41667 12.7475 3.41667 12.3333L3.41667 3.47725L2.03033 4.86358C1.73744 5.15648 1.26256 5.15648 0.96967 4.86358ZM7.63634 9.13626C7.92923 8.84336 8.4041 8.84336 8.697 9.13626L10.0833 10.5226V1.66659C10.0833 1.25237 10.4191 0.916586 10.8333 0.916586C11.2475 0.916586 11.5833 1.25237 11.5833 1.66659V10.5226L12.9697 9.13626C13.2626 8.84336 13.7374 8.84336 14.0303 9.13626C14.3232 9.42915 14.3232 9.90402 14.0303 10.1969L11.3637 12.8636C11.0708 13.1565 10.5959 13.1565 10.303 12.8636L7.63634 10.1969C7.34344 9.90402 7.34344 9.42915 7.63634 9.13626Z",
|
|
1754
|
+
fill: "currentColor"
|
|
1755
|
+
}
|
|
1756
|
+
)
|
|
1757
|
+
);
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1760
|
+
// src/components/Dropdown/BaseDropdown.css.ts
|
|
1761
|
+
var BORDER_RADIUS = "dropdown";
|
|
1762
|
+
var baseDropdownItemWrapperStyles = "_1nns6ys3 _1rsrm2f17";
|
|
1763
|
+
var scrollGradientWrapperStyles = "_1nns6ys1";
|
|
1764
|
+
var scrollableDropdownStyles = "_1nns6ys0";
|
|
1765
|
+
|
|
1766
|
+
// src/providers/FunkitProvider.tsx
|
|
1767
|
+
var ThemeIdContext2 = createContext3(void 0);
|
|
1768
|
+
var attr = "data-rk";
|
|
1769
|
+
var createThemeRootProps = (id) => ({ [attr]: id || "" });
|
|
1770
|
+
var useThemeRootProps = () => {
|
|
1771
|
+
const id = useContext3(ThemeIdContext2);
|
|
1772
|
+
return createThemeRootProps(id);
|
|
1773
|
+
};
|
|
1774
|
+
|
|
1775
|
+
// src/components/Dropdown/BaseActiveDropdownItem.tsx
|
|
1776
|
+
import React14 from "react";
|
|
1777
|
+
|
|
1778
|
+
// src/components/Dropdown/BaseActiveDropdownItem.css.ts
|
|
1779
|
+
var baseStyles = "_1dewiqw0";
|
|
1780
|
+
|
|
1781
|
+
// src/components/Dropdown/BaseActiveDropdownItem.tsx
|
|
1782
|
+
function BaseActiveDropdownItem({
|
|
1783
|
+
iconComponent,
|
|
1784
|
+
label,
|
|
1785
|
+
isOpened,
|
|
1786
|
+
onClick,
|
|
1787
|
+
horizontalIconGap = "dropdownItemIconGap",
|
|
1788
|
+
alwaysVisibleLabel,
|
|
1789
|
+
tagComponent,
|
|
1790
|
+
tagPosition = "start",
|
|
1791
|
+
size = "regular",
|
|
1792
|
+
color = "primaryText",
|
|
1793
|
+
arrowColor = "secondaryText",
|
|
1794
|
+
background,
|
|
1795
|
+
labelStyle,
|
|
1796
|
+
compactIcon = false
|
|
1797
|
+
}) {
|
|
1798
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1799
|
+
Box,
|
|
1800
|
+
{
|
|
1801
|
+
display: "flex",
|
|
1802
|
+
alignItems: "center",
|
|
1803
|
+
justifyContent: "space-between",
|
|
1804
|
+
gap: "6",
|
|
1805
|
+
cursor: "pointer",
|
|
1806
|
+
onClick,
|
|
1807
|
+
background: background ?? {
|
|
1808
|
+
base: "dropdownActiveItemBackgroundBase",
|
|
1809
|
+
hover: "dropdownActiveItemBackgroundHover"
|
|
1810
|
+
},
|
|
1811
|
+
borderColor: {
|
|
1812
|
+
base: "dropdownActiveItemBorderBase",
|
|
1813
|
+
hover: "dropdownActiveItemBorderHover"
|
|
1814
|
+
},
|
|
1815
|
+
borderWidth: size === "compact" ? "0" : "1",
|
|
1816
|
+
borderRadius: BORDER_RADIUS,
|
|
1817
|
+
borderStyle: "solid",
|
|
1818
|
+
paddingY: size === "compact" ? "2" : size === "large" ? "10" : "dropdownActiveItemRegularSizePaddingY",
|
|
1819
|
+
paddingX: size === "compact" ? "4" : size === "large" ? "8" : "dropdownPaddingX",
|
|
1820
|
+
className: baseStyles
|
|
1821
|
+
},
|
|
1822
|
+
/* @__PURE__ */ React14.createElement(
|
|
1823
|
+
Box,
|
|
1824
|
+
{
|
|
1825
|
+
display: "flex",
|
|
1826
|
+
alignItems: "center",
|
|
1827
|
+
justifyContent: "space-between",
|
|
1828
|
+
gap: horizontalIconGap,
|
|
1829
|
+
style: size === "compact" ? void 0 : { flex: "1 0 auto" }
|
|
1830
|
+
},
|
|
1831
|
+
alwaysVisibleLabel && /* @__PURE__ */ React14.createElement(Box, { style: { flex: 1 } }, /* @__PURE__ */ React14.createElement(Text, { color: "secondaryText", size: "12" }, alwaysVisibleLabel)),
|
|
1832
|
+
/* @__PURE__ */ React14.createElement(
|
|
1833
|
+
Box,
|
|
1834
|
+
{
|
|
1835
|
+
display: "flex",
|
|
1836
|
+
alignItems: "center",
|
|
1837
|
+
justifyContent: "space-between",
|
|
1838
|
+
gap: horizontalIconGap,
|
|
1839
|
+
background: {
|
|
1840
|
+
base: "transparent",
|
|
1841
|
+
hover: "alwaysVisibleLabelBackgroundHover"
|
|
1842
|
+
},
|
|
1843
|
+
...alwaysVisibleLabel ? {} : { style: { flex: 1 } }
|
|
1844
|
+
},
|
|
1845
|
+
/* @__PURE__ */ React14.createElement(
|
|
1846
|
+
Box,
|
|
1847
|
+
{
|
|
1848
|
+
display: "flex",
|
|
1849
|
+
alignItems: "center",
|
|
1850
|
+
justifyContent: "center",
|
|
1851
|
+
gap: horizontalIconGap,
|
|
1852
|
+
...alwaysVisibleLabel ? { style: { flexDirection: "row-reverse" } } : {}
|
|
1853
|
+
},
|
|
1854
|
+
tagPosition === "start" && tagComponent,
|
|
1855
|
+
/* @__PURE__ */ React14.createElement(Box, { display: "flex", alignItems: "center", gap: horizontalIconGap }, iconComponent && /* @__PURE__ */ React14.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "center" }, iconComponent), /* @__PURE__ */ React14.createElement(
|
|
1856
|
+
Text,
|
|
1857
|
+
{
|
|
1858
|
+
color,
|
|
1859
|
+
size: "dropdownItemFontSize",
|
|
1860
|
+
weight: "medium",
|
|
1861
|
+
style: labelStyle
|
|
1862
|
+
},
|
|
1863
|
+
label
|
|
1864
|
+
))
|
|
1865
|
+
),
|
|
1866
|
+
/* @__PURE__ */ React14.createElement(Box, { display: "flex", alignItems: "center", gap: "5" }, tagPosition === "end" && tagComponent, /* @__PURE__ */ React14.createElement(
|
|
1867
|
+
AnimatedCaretDownIcon,
|
|
1868
|
+
{
|
|
1869
|
+
expanded: isOpened,
|
|
1870
|
+
color: arrowColor,
|
|
1871
|
+
compact: compactIcon
|
|
1872
|
+
}
|
|
1873
|
+
))
|
|
1874
|
+
)
|
|
1875
|
+
)
|
|
1876
|
+
);
|
|
1877
|
+
}
|
|
1878
|
+
var BaseActiveDropdownItem_default = BaseActiveDropdownItem;
|
|
1879
|
+
|
|
1880
|
+
// src/components/Dropdown/BaseDropdown.utils.ts
|
|
1881
|
+
var NO_SELECTION_VALUE = "";
|
|
1882
|
+
var ADDITIONAL_GROUP_KEY = "__additional__";
|
|
1883
|
+
function buildAllOptions(options, allowUnselect, unselectLabel) {
|
|
1884
|
+
if (allowUnselect) {
|
|
1885
|
+
return [
|
|
1886
|
+
{
|
|
1887
|
+
label: unselectLabel ?? "",
|
|
1888
|
+
value: NO_SELECTION_VALUE
|
|
1889
|
+
},
|
|
1890
|
+
...options
|
|
1891
|
+
];
|
|
1892
|
+
}
|
|
1893
|
+
return options;
|
|
1894
|
+
}
|
|
1895
|
+
function filterOptions(allOptions, searchInput) {
|
|
1896
|
+
const search = searchInput?.trim().toLowerCase() ?? "";
|
|
1897
|
+
return allOptions.filter(
|
|
1898
|
+
(option) => option.label.toLowerCase().includes(search)
|
|
1899
|
+
);
|
|
1900
|
+
}
|
|
1901
|
+
function organizeDropdownGroups(filteredOptions, groups, additionalGroup, additionalGroupLabel) {
|
|
1902
|
+
const organizedGroups = [];
|
|
1903
|
+
if (!groups) {
|
|
1904
|
+
organizedGroups.push({
|
|
1905
|
+
key: ADDITIONAL_GROUP_KEY,
|
|
1906
|
+
label: void 0,
|
|
1907
|
+
options: filteredOptions
|
|
1908
|
+
});
|
|
1909
|
+
return {
|
|
1910
|
+
organizedGroups,
|
|
1911
|
+
organizedOptions: filteredOptions
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
const unselectOption = filteredOptions.find(
|
|
1915
|
+
(option) => option.value === NO_SELECTION_VALUE
|
|
1916
|
+
);
|
|
1917
|
+
if (unselectOption) {
|
|
1918
|
+
organizedGroups.push({
|
|
1919
|
+
key: NO_SELECTION_VALUE,
|
|
1920
|
+
label: void 0,
|
|
1921
|
+
options: [unselectOption]
|
|
1922
|
+
});
|
|
1923
|
+
}
|
|
1924
|
+
const optionsByValue = new Map(
|
|
1925
|
+
filteredOptions.filter((option) => option.value !== NO_SELECTION_VALUE).map((option) => [option.value, option])
|
|
1926
|
+
);
|
|
1927
|
+
const inflatedGroups = groups.map((group) => ({
|
|
1928
|
+
...group,
|
|
1929
|
+
// Only take the options that actually exist
|
|
1930
|
+
// Note that this preserves the ordering of `group.values`
|
|
1931
|
+
options: group.values.map((value) => optionsByValue.get(value)).filter((option) => !!option)
|
|
1932
|
+
})).filter((group) => group.options.length > 0);
|
|
1933
|
+
const hasNonEmptyGroup = inflatedGroups.length > 0;
|
|
1934
|
+
for (const group of inflatedGroups) {
|
|
1935
|
+
organizedGroups.push({
|
|
1936
|
+
key: group.key,
|
|
1937
|
+
label: group.label,
|
|
1938
|
+
options: group.options
|
|
1939
|
+
});
|
|
1940
|
+
if (additionalGroup === "others") {
|
|
1941
|
+
for (const option of group.options) {
|
|
1942
|
+
optionsByValue.delete(option.value);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
if (optionsByValue.size > 0) {
|
|
1947
|
+
organizedGroups.push({
|
|
1948
|
+
key: ADDITIONAL_GROUP_KEY,
|
|
1949
|
+
// Only show additional group label if there actually are other groups
|
|
1950
|
+
label: hasNonEmptyGroup ? additionalGroupLabel : void 0,
|
|
1951
|
+
options: [...optionsByValue.values()]
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
const organizedOptions = organizedGroups.flatMap((group) => group.options);
|
|
1955
|
+
return { organizedGroups, organizedOptions };
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
// src/components/Dropdown/BaseDropdown.tsx
|
|
1959
|
+
var HORIZONTAL_ICON_GAP = "4";
|
|
1960
|
+
var activeDropdownItemSize = {
|
|
1961
|
+
compact: "18",
|
|
1962
|
+
regular: "36",
|
|
1963
|
+
large: "40"
|
|
1964
|
+
};
|
|
1965
|
+
function BaseDropdown({
|
|
1966
|
+
activeItemProps,
|
|
1967
|
+
value,
|
|
1968
|
+
options,
|
|
1969
|
+
groups,
|
|
1970
|
+
additionalGroup = "others",
|
|
1971
|
+
additionalGroupLabel,
|
|
1972
|
+
allowUnselect = false,
|
|
1973
|
+
unselectLabel,
|
|
1974
|
+
onOptionSelected,
|
|
1975
|
+
onOpen,
|
|
1976
|
+
renderDropdownOption,
|
|
1977
|
+
searchableOptions = false,
|
|
1978
|
+
searchPlaceholder,
|
|
1979
|
+
placeholder,
|
|
1980
|
+
resetSearchOnClose = true,
|
|
1981
|
+
openToTopOnMobile = true,
|
|
1982
|
+
alwaysOpenToTop = false,
|
|
1983
|
+
openDropdownFullWidth = true,
|
|
1984
|
+
isLoading = false,
|
|
1985
|
+
preloadIconUrls,
|
|
1986
|
+
horizontalIconGap = HORIZONTAL_ICON_GAP,
|
|
1987
|
+
openDropdownBackgroundColor = "openDropdownBackgroundColor",
|
|
1988
|
+
size = "regular",
|
|
1989
|
+
label,
|
|
1990
|
+
maxDropdownHeight,
|
|
1991
|
+
dropdownWidth,
|
|
1992
|
+
dropdownAlign = "end",
|
|
1993
|
+
testId
|
|
1994
|
+
}) {
|
|
1995
|
+
const { t } = useFunkitTranslation();
|
|
1996
|
+
const themeRootProps = useThemeRootProps();
|
|
1997
|
+
const isMobileDevice = isMobile();
|
|
1998
|
+
const [isOpened, setIsOpened] = useState5(false);
|
|
1999
|
+
const [searchInput, setSearchInput] = useState5("");
|
|
2000
|
+
const { ref: scrollRef, hasTopDivider, isAtBottom } = useScrollDivider();
|
|
2001
|
+
const allOptions = useMemo2(
|
|
2002
|
+
() => buildAllOptions(options, allowUnselect, unselectLabel),
|
|
2003
|
+
[options, allowUnselect, unselectLabel]
|
|
2004
|
+
);
|
|
2005
|
+
const selectedOption = allOptions.find((option) => option.value === value);
|
|
2006
|
+
const prevIsOpenedRef = useRef2(false);
|
|
2007
|
+
const portalThemeRef = useRef2(null);
|
|
2008
|
+
const handleSearch = (event) => {
|
|
2009
|
+
setSearchInput(event.target.value);
|
|
2010
|
+
};
|
|
2011
|
+
const filteredOptions = useMemo2(
|
|
2012
|
+
() => filterOptions(allOptions, searchInput),
|
|
2013
|
+
[allOptions, searchInput]
|
|
2014
|
+
);
|
|
2015
|
+
const { organizedGroups, organizedOptions } = useMemo2(
|
|
2016
|
+
() => organizeDropdownGroups(
|
|
2017
|
+
filteredOptions,
|
|
2018
|
+
groups,
|
|
2019
|
+
additionalGroup,
|
|
2020
|
+
additionalGroupLabel
|
|
2021
|
+
),
|
|
2022
|
+
[additionalGroup, additionalGroupLabel, filteredOptions, groups]
|
|
2023
|
+
);
|
|
2024
|
+
const handleOpenChange = useCallback2(
|
|
2025
|
+
(open) => {
|
|
2026
|
+
setIsOpened(open);
|
|
2027
|
+
if (open) {
|
|
2028
|
+
onOpen?.();
|
|
2029
|
+
} else {
|
|
2030
|
+
resetSearchOnClose && setSearchInput("");
|
|
2031
|
+
}
|
|
2032
|
+
},
|
|
2033
|
+
[onOpen, resetSearchOnClose]
|
|
2034
|
+
);
|
|
2035
|
+
useEffect5(() => {
|
|
2036
|
+
if (isOpened && !prevIsOpenedRef.current) {
|
|
2037
|
+
prevIsOpenedRef.current = true;
|
|
2038
|
+
if (selectedOption) {
|
|
2039
|
+
const selectedOptionIndex = organizedOptions.findIndex(
|
|
2040
|
+
(option) => option.value === selectedOption.value
|
|
2041
|
+
);
|
|
2042
|
+
if (selectedOptionIndex !== -1) {
|
|
2043
|
+
requestAnimationFrame(() => {
|
|
2044
|
+
const selectedOptionElement = document.getElementById(
|
|
2045
|
+
`${selectedOption.value}-dropdown-item`
|
|
2046
|
+
);
|
|
2047
|
+
selectedOptionElement?.scrollIntoView({
|
|
2048
|
+
behavior: "instant",
|
|
2049
|
+
block: "center"
|
|
2050
|
+
});
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
} else if (!isOpened) {
|
|
2055
|
+
prevIsOpenedRef.current = false;
|
|
2056
|
+
}
|
|
2057
|
+
}, [isOpened, selectedOption, organizedOptions]);
|
|
2058
|
+
const dropdownSide = alwaysOpenToTop || openToTopOnMobile && isMobileDevice ? "top" : "bottom";
|
|
2059
|
+
return /* @__PURE__ */ React15.createElement(Box, { display: "flex", flexDirection: "column", gap: "4", testId }, label && /* @__PURE__ */ React15.createElement(Text, { size: "12", color: "secondaryText" }, label), /* @__PURE__ */ React15.createElement(
|
|
2060
|
+
DropdownMenu2.Root,
|
|
2061
|
+
{
|
|
2062
|
+
open: isOpened,
|
|
2063
|
+
onOpenChange: handleOpenChange,
|
|
2064
|
+
modal: false
|
|
2065
|
+
},
|
|
2066
|
+
/* @__PURE__ */ React15.createElement(
|
|
2067
|
+
Box,
|
|
2068
|
+
{
|
|
2069
|
+
position: "relative",
|
|
2070
|
+
display: size === "compact" ? "flex" : void 0
|
|
2071
|
+
},
|
|
2072
|
+
isLoading ? /* @__PURE__ */ React15.createElement(FunSkeletonBlock, { height: activeDropdownItemSize[size] }) : /* @__PURE__ */ React15.createElement(DropdownMenu2.Trigger, { asChild: true }, /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
|
|
2073
|
+
BaseActiveDropdownItem_default,
|
|
2074
|
+
{
|
|
2075
|
+
...activeItemProps,
|
|
2076
|
+
size,
|
|
2077
|
+
horizontalIconGap,
|
|
2078
|
+
isOpened,
|
|
2079
|
+
label: activeItemProps?.label ?? selectedOption?.label ?? placeholder ?? ""
|
|
2080
|
+
}
|
|
2081
|
+
))),
|
|
2082
|
+
/* @__PURE__ */ React15.createElement(DropdownMenu2.Portal, null, /* @__PURE__ */ React15.createElement(
|
|
2083
|
+
DropdownMenu2.Content,
|
|
2084
|
+
{
|
|
2085
|
+
...themeRootProps,
|
|
2086
|
+
ref: portalThemeRef,
|
|
2087
|
+
side: dropdownSide,
|
|
2088
|
+
sideOffset: dropdownSide === "top" ? 8 : 6,
|
|
2089
|
+
align: dropdownAlign,
|
|
2090
|
+
className: "funkit-dropdown-content",
|
|
2091
|
+
style: {
|
|
2092
|
+
zIndex: `calc(${themeVars.modalZIndex} + 1)`,
|
|
2093
|
+
width: dropdownWidth ? `${dropdownWidth}px` : openDropdownFullWidth ? "var(--radix-dropdown-menu-trigger-width)" : void 0,
|
|
2094
|
+
transformOrigin: "var(--radix-dropdown-menu-content-transform-origin)"
|
|
2095
|
+
},
|
|
2096
|
+
onCloseAutoFocus: (e) => e.preventDefault()
|
|
2097
|
+
},
|
|
2098
|
+
/* @__PURE__ */ React15.createElement(TooltipAnchorRefContext.Provider, { value: portalThemeRef }, /* @__PURE__ */ React15.createElement(
|
|
2099
|
+
Box,
|
|
2100
|
+
{
|
|
2101
|
+
background: openDropdownBackgroundColor,
|
|
2102
|
+
borderColor: "transparent",
|
|
2103
|
+
borderWidth: "1",
|
|
2104
|
+
borderRadius: "dropdownList",
|
|
2105
|
+
borderStyle: "solid",
|
|
2106
|
+
boxShadow: "dropdown",
|
|
2107
|
+
className: maxDropdownHeight ? scrollGradientWrapperStyles : void 0,
|
|
2108
|
+
"data-fade-top": maxDropdownHeight && hasTopDivider ? "true" : "false",
|
|
2109
|
+
"data-fade-bottom": maxDropdownHeight && !isAtBottom ? "true" : "false"
|
|
2110
|
+
},
|
|
2111
|
+
/* @__PURE__ */ React15.createElement(
|
|
2112
|
+
Box,
|
|
2113
|
+
{
|
|
2114
|
+
className: maxDropdownHeight ? scrollableDropdownStyles : void 0,
|
|
2115
|
+
ref: maxDropdownHeight ? scrollRef : void 0,
|
|
2116
|
+
style: { maxHeight: maxDropdownHeight }
|
|
2117
|
+
},
|
|
2118
|
+
/* @__PURE__ */ React15.createElement(Box, { display: "flex", flexDirection: "column" }, searchableOptions && /* @__PURE__ */ React15.createElement(Box, { paddingTop: "8", paddingX: "8" }, /* @__PURE__ */ React15.createElement(
|
|
2119
|
+
FunInput,
|
|
2120
|
+
{
|
|
2121
|
+
placeholder: searchPlaceholder ?? t("common.searchTokens"),
|
|
2122
|
+
value: searchInput,
|
|
2123
|
+
onChange: handleSearch,
|
|
2124
|
+
prefixIcon: "SearchIcon"
|
|
2125
|
+
}
|
|
2126
|
+
)), organizedOptions.length === 0 ? /* @__PURE__ */ React15.createElement(FunNoResults, { text: t("common.noResultsFound") }) : /* @__PURE__ */ React15.createElement(
|
|
2127
|
+
Box,
|
|
2128
|
+
{
|
|
2129
|
+
as: "ul",
|
|
2130
|
+
display: "flex",
|
|
2131
|
+
flexDirection: "column",
|
|
2132
|
+
paddingY: size === "compact" ? "dropdownCompactPaddingY" : "dropdownPaddingY"
|
|
2133
|
+
},
|
|
2134
|
+
organizedGroups.map(
|
|
2135
|
+
({
|
|
2136
|
+
key: groupKey,
|
|
2137
|
+
label: groupLabel,
|
|
2138
|
+
options: optionsInGroup
|
|
2139
|
+
}, groupIndex) => /* @__PURE__ */ React15.createElement(React15.Fragment, { key: groupKey }, groupIndex > 0 && /* @__PURE__ */ React15.createElement(
|
|
2140
|
+
Box,
|
|
2141
|
+
{
|
|
2142
|
+
height: "1",
|
|
2143
|
+
background: "lightStroke",
|
|
2144
|
+
marginY: "dropdownGroupDividerMarginY"
|
|
2145
|
+
}
|
|
2146
|
+
), groupLabel && /* @__PURE__ */ React15.createElement(
|
|
2147
|
+
Box,
|
|
2148
|
+
{
|
|
2149
|
+
paddingX: size === "compact" ? "dropdownCompactPaddingX" : "dropdownPaddingX"
|
|
2150
|
+
},
|
|
2151
|
+
/* @__PURE__ */ React15.createElement(
|
|
2152
|
+
Box,
|
|
2153
|
+
{
|
|
2154
|
+
paddingX: "dropdownItemPaddingX",
|
|
2155
|
+
paddingY: "dropdownItemPaddingY"
|
|
2156
|
+
},
|
|
2157
|
+
/* @__PURE__ */ React15.createElement(
|
|
2158
|
+
Text,
|
|
2159
|
+
{
|
|
2160
|
+
color: "dropdownGroupHeader",
|
|
2161
|
+
font: "dropdownGroupHeader",
|
|
2162
|
+
size: "dropdownGroupHeader",
|
|
2163
|
+
weight: "dropdownGroupHeader"
|
|
2164
|
+
},
|
|
2165
|
+
groupLabel
|
|
2166
|
+
)
|
|
2167
|
+
)
|
|
2168
|
+
), optionsInGroup.map((singleOption) => {
|
|
2169
|
+
const isSelected = singleOption.value === selectedOption?.value;
|
|
2170
|
+
return /* @__PURE__ */ React15.createElement(
|
|
2171
|
+
Box,
|
|
2172
|
+
{
|
|
2173
|
+
key: singleOption.value,
|
|
2174
|
+
paddingX: size === "compact" ? "dropdownCompactPaddingX" : "dropdownPaddingX"
|
|
2175
|
+
},
|
|
2176
|
+
/* @__PURE__ */ React15.createElement(
|
|
2177
|
+
Box,
|
|
2178
|
+
{
|
|
2179
|
+
id: `${singleOption.value}-dropdown-item`,
|
|
2180
|
+
as: "li",
|
|
2181
|
+
background: {
|
|
2182
|
+
base: isSelected ? "selectedDropdownItemBackground" : "transparent",
|
|
2183
|
+
hover: "offBackground"
|
|
2184
|
+
},
|
|
2185
|
+
className: baseDropdownItemWrapperStyles,
|
|
2186
|
+
onClick: () => {
|
|
2187
|
+
onOptionSelected?.(singleOption);
|
|
2188
|
+
}
|
|
2189
|
+
},
|
|
2190
|
+
renderDropdownOption(
|
|
2191
|
+
singleOption,
|
|
2192
|
+
isSelected
|
|
2193
|
+
)
|
|
2194
|
+
)
|
|
2195
|
+
);
|
|
2196
|
+
}))
|
|
2197
|
+
)
|
|
2198
|
+
))
|
|
2199
|
+
)
|
|
2200
|
+
))
|
|
2201
|
+
)),
|
|
2202
|
+
preloadIconUrls && /* @__PURE__ */ React15.createElement(
|
|
2203
|
+
Box,
|
|
2204
|
+
{
|
|
2205
|
+
display: "none",
|
|
2206
|
+
"aria-hidden": true,
|
|
2207
|
+
style: { position: "absolute", top: "-100%", left: "-100%" }
|
|
2208
|
+
},
|
|
2209
|
+
preloadIconUrls.map((url, index) => /* @__PURE__ */ React15.createElement("img", { key: `${url}-${index}`, src: url, alt: "" }))
|
|
2210
|
+
)
|
|
2211
|
+
)
|
|
2212
|
+
));
|
|
2213
|
+
}
|
|
2214
|
+
var BaseDropdown_default = BaseDropdown;
|
|
2215
|
+
|
|
2216
|
+
// src/components/Dropdown/AccountSelectDropdown.tsx
|
|
2217
|
+
var ACCOUNTS_GROUP = "accounts";
|
|
2218
|
+
var ACTION_GROUP = "action";
|
|
2219
|
+
function AccountSelectDropdown({
|
|
2220
|
+
accounts,
|
|
2221
|
+
selectedValue,
|
|
2222
|
+
onSelect,
|
|
2223
|
+
action,
|
|
2224
|
+
prefixLabel,
|
|
2225
|
+
label,
|
|
2226
|
+
size,
|
|
2227
|
+
dropdownWidth,
|
|
2228
|
+
testId
|
|
2229
|
+
}) {
|
|
2230
|
+
const actionIdCollidesWithAccount = !!action && accounts.some((account) => account.value === action.id);
|
|
2231
|
+
const actionId = action?.id;
|
|
2232
|
+
useEffect6(() => {
|
|
2233
|
+
if (actionIdCollidesWithAccount) {
|
|
2234
|
+
logger.warn("accountSelectDropdown:actionIdCollidesWithAccountValue", {
|
|
2235
|
+
actionId
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
}, [actionIdCollidesWithAccount, actionId]);
|
|
2239
|
+
const options = [
|
|
2240
|
+
...accounts.map((account) => ({
|
|
2241
|
+
value: account.value,
|
|
2242
|
+
label: account.label
|
|
2243
|
+
})),
|
|
2244
|
+
...action ? [{ value: action.id, label: action.label }] : []
|
|
2245
|
+
];
|
|
2246
|
+
const groups = action ? [
|
|
2247
|
+
{
|
|
2248
|
+
key: ACCOUNTS_GROUP,
|
|
2249
|
+
label: "",
|
|
2250
|
+
values: accounts.map((account) => account.value)
|
|
2251
|
+
},
|
|
2252
|
+
{ key: ACTION_GROUP, label: "", values: [action.id] }
|
|
2253
|
+
] : void 0;
|
|
2254
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2255
|
+
BaseDropdown_default,
|
|
2256
|
+
{
|
|
2257
|
+
testId,
|
|
2258
|
+
label,
|
|
2259
|
+
size,
|
|
2260
|
+
dropdownWidth,
|
|
2261
|
+
value: selectedValue,
|
|
2262
|
+
options,
|
|
2263
|
+
groups,
|
|
2264
|
+
activeItemProps: { alwaysVisibleLabel: prefixLabel },
|
|
2265
|
+
renderDropdownOption: (option, isSelected) => {
|
|
2266
|
+
if (action && option.value === action.id) {
|
|
2267
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2268
|
+
BaseDropdownItem_default,
|
|
2269
|
+
{
|
|
2270
|
+
id: option.value,
|
|
2271
|
+
label: option.label,
|
|
2272
|
+
iconComponent: action.icon && // Render the icon in the theme's primary text colour
|
|
2273
|
+
// (the icon uses `currentColor`), matching the label.
|
|
2274
|
+
/* @__PURE__ */ React16.createElement(Box, { display: "flex", color: "primaryText" }, action.icon),
|
|
2275
|
+
horizontalIconGap: "8",
|
|
2276
|
+
onClick: action.onSelect
|
|
2277
|
+
}
|
|
2278
|
+
);
|
|
2279
|
+
}
|
|
2280
|
+
const account = accounts.find((item) => item.value === option.value);
|
|
2281
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2282
|
+
BaseDropdownItem_default,
|
|
2283
|
+
{
|
|
2284
|
+
id: option.value,
|
|
2285
|
+
label: option.label,
|
|
2286
|
+
description: account?.description,
|
|
2287
|
+
isSelected,
|
|
2288
|
+
onClick: onSelect
|
|
2289
|
+
}
|
|
2290
|
+
);
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
// src/clients/polymarket/PolymarketDepositAccountDropdown.tsx
|
|
2297
|
+
var ACCOUNT_DROPDOWN_OPTIONS_WIDTH = 264;
|
|
2298
|
+
var BALANCE_PLACEHOLDER = "\u2014";
|
|
2299
|
+
function formatBalance(balanceUsd) {
|
|
2300
|
+
return balanceUsd === void 0 ? BALANCE_PLACEHOLDER : formatUsdFlooredToCent(balanceUsd);
|
|
2301
|
+
}
|
|
2302
|
+
function PolymarketDepositAccountDropdown({
|
|
2303
|
+
onStepChange,
|
|
2304
|
+
modalState,
|
|
2305
|
+
dynamicRoutingId,
|
|
2306
|
+
applyDynamicTargetAssetCandidate,
|
|
2307
|
+
predictions,
|
|
2308
|
+
perps
|
|
2309
|
+
}) {
|
|
2310
|
+
const { t } = useFunkitTranslation();
|
|
2311
|
+
const balances = usePolymarketAccountBalances({ predictions, perps });
|
|
2312
|
+
const selectedRoutingId = dynamicRoutingId === POLYMARKET_PERPS_ROUTING_ID ? POLYMARKET_PERPS_ROUTING_ID : POLYMARKET_PREDICTIONS_ROUTING_ID;
|
|
2313
|
+
const accountCandidate = (routingId, recipient) => ({
|
|
2314
|
+
tokenAddress: POLYGON_USDCE,
|
|
2315
|
+
tokenChainId: polygon.id.toString(),
|
|
2316
|
+
tokenSymbol: PUSD_TOKEN.symbol,
|
|
2317
|
+
iconSrc: PUSD_TOKEN.iconSrc,
|
|
2318
|
+
dynamicRoutingId: routingId,
|
|
2319
|
+
customRecipient: recipient
|
|
2320
|
+
});
|
|
2321
|
+
const handleSelectAccount = (routingId) => {
|
|
2322
|
+
const isPerps = routingId === POLYMARKET_PERPS_ROUTING_ID;
|
|
2323
|
+
applyDynamicTargetAssetCandidate?.(
|
|
2324
|
+
accountCandidate(
|
|
2325
|
+
isPerps ? POLYMARKET_PERPS_ROUTING_ID : POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
2326
|
+
isPerps ? perps.address : predictions.address
|
|
2327
|
+
)
|
|
2328
|
+
);
|
|
2329
|
+
};
|
|
2330
|
+
return /* @__PURE__ */ React17.createElement(
|
|
2331
|
+
AccountSelectDropdown,
|
|
2332
|
+
{
|
|
2333
|
+
prefixLabel: t("perpsTransfer.depositTo"),
|
|
2334
|
+
dropdownWidth: ACCOUNT_DROPDOWN_OPTIONS_WIDTH,
|
|
2335
|
+
accounts: [
|
|
2336
|
+
{
|
|
2337
|
+
value: POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
2338
|
+
label: t("perpsTransfer.predictions"),
|
|
2339
|
+
description: formatBalance(balances.predictions.balanceUsd)
|
|
2340
|
+
},
|
|
2341
|
+
{
|
|
2342
|
+
value: POLYMARKET_PERPS_ROUTING_ID,
|
|
2343
|
+
label: t("perpsTransfer.perps"),
|
|
2344
|
+
description: formatBalance(balances.perps.balanceUsd)
|
|
2345
|
+
}
|
|
2346
|
+
],
|
|
2347
|
+
selectedValue: selectedRoutingId,
|
|
2348
|
+
onSelect: handleSelectAccount,
|
|
2349
|
+
action: {
|
|
2350
|
+
id: "transfer-between-accounts",
|
|
2351
|
+
label: t("perpsTransfer.transferBetweenAccounts"),
|
|
2352
|
+
icon: /* @__PURE__ */ React17.createElement(SwitchIcon, null),
|
|
2353
|
+
// Navigation is absent on the loading skeleton; the action only fires
|
|
2354
|
+
// on the interactive screen. The transfer step reads balances from the
|
|
2355
|
+
// same shared cache, so none need to be threaded through here.
|
|
2356
|
+
onSelect: () => {
|
|
2357
|
+
if (onStepChange && modalState) {
|
|
2358
|
+
onStepChange({
|
|
2359
|
+
...modalState,
|
|
2360
|
+
step: "perps_transfer" /* PERPS_TRANSFER */
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
);
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
export {
|
|
2370
|
+
PolymarketDepositAccountDropdown
|
|
2371
|
+
};
|