@funkit/connect 10.0.0 → 10.1.0-next.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 +7 -0
- package/dist/clients/chunk-42XZD2Y3.js +1112 -0
- package/dist/clients/chunk-5UIZBNLC.js +1175 -0
- package/dist/clients/chunk-BO7AZVPG.js +1112 -0
- package/dist/clients/chunk-BUCJRBW7.js +1472 -0
- package/dist/clients/{chunk-2NBYHUIW.js → chunk-ETB2YYFT.js} +1 -1
- package/dist/clients/{chunk-ZAXSDMDU.js → chunk-HD4Y4NKC.js} +2 -2
- package/dist/clients/{chunk-E3USJY7A.js → chunk-JNZY3GAA.js} +1 -1
- package/dist/clients/chunk-ME4OAQIY.js +696 -0
- package/dist/clients/chunk-PEVDOGEA.js +109 -0
- package/dist/clients/chunk-QIWGVVAW.js +1113 -0
- package/dist/clients/chunk-VJZW3MA3.js +94 -0
- package/dist/clients/chunk-WEETVC7U.js +1113 -0
- package/dist/clients/chunk-Y2KXVS36.js +230 -0
- package/dist/clients/fanatics.css +1 -1
- package/dist/clients/fanatics.js +2 -2
- package/dist/clients/lighter.css +11 -11
- package/dist/clients/lighter.d.ts +12 -2
- package/dist/clients/lighter.js +21 -9
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +11 -11
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +3 -3
- package/dist/clients/polymarket/index.css +11 -11
- package/dist/clients/polymarket/index.js +3 -3
- package/dist/clients/polymarket/usePolymarketAccountBalances.d.ts +66 -0
- package/dist/hooks/useIsTokenWhitelisted.d.ts +30 -0
- package/dist/index.css +11 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +78 -31
- package/dist/modals/CheckoutModal/buildRelayChains.d.ts +12 -0
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +32 -5
- package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +3 -3
- package/dist/providers/FunkitCheckoutContext/types.d.ts +20 -2
- package/dist/providers/FunkitFlagsProvider.d.ts +26 -0
- package/dist/utils/flags/config.d.ts +333 -0
- package/dist/utils/flags/endpoint.d.ts +22 -0
- package/dist/utils/flags/hash.d.ts +13 -0
- package/dist/utils/flags/impl.d.ts +10 -0
- package/dist/utils/flags/types.d.ts +49 -0
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/chunk-4NV5BYRP.js +95 -0
- package/dist/wallets/walletConnectors/chunk-AVDUNQUW.js +96 -0
- package/dist/wallets/walletConnectors/chunk-GUQM4QSL.js +66 -0
- package/dist/wallets/walletConnectors/chunk-IULPZP2Q.js +69 -0
- package/dist/wallets/walletConnectors/chunk-JPN6TWIT.js +92 -0
- package/dist/wallets/walletConnectors/chunk-KCRO2AGO.js +106 -0
- package/dist/wallets/walletConnectors/chunk-KI5Y2BBF.js +94 -0
- package/dist/wallets/walletConnectors/chunk-NR2OGDHQ.js +103 -0
- package/dist/wallets/walletConnectors/chunk-OEEGYENV.js +87 -0
- package/dist/wallets/walletConnectors/chunk-OX37G4YT.js +98 -0
- package/dist/wallets/walletConnectors/chunk-SWFF3TWJ.js +100 -0
- package/dist/wallets/walletConnectors/chunk-TKB2OY6G.js +99 -0
- package/dist/wallets/walletConnectors/chunk-W2LCLDPX.js +70 -0
- package/dist/wallets/walletConnectors/chunk-WAHGI5L7.js +96 -0
- package/dist/wallets/walletConnectors/chunk-WKNQMP4A.js +93 -0
- package/dist/wallets/walletConnectors/chunk-XCNHV3HS.js +110 -0
- package/dist/wallets/walletConnectors/chunk-YO2K4MBH.js +218 -0
- package/dist/wallets/walletConnectors/chunk-YQFGVZGR.js +92 -0
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +61 -61
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +1 -1
- /package/dist/clients/{chunk-LUHEVXPD.js → chunk-HMP3LHMW.js} +0 -0
|
@@ -0,0 +1,1472 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Text,
|
|
5
|
+
themeVars
|
|
6
|
+
} from "./chunk-PEVDOGEA.js";
|
|
7
|
+
import {
|
|
8
|
+
useFunkitTranslation
|
|
9
|
+
} from "./chunk-STLOQEN7.js";
|
|
10
|
+
|
|
11
|
+
// src/providers/FunkitConfigContext.tsx
|
|
12
|
+
import {
|
|
13
|
+
createContext,
|
|
14
|
+
useContext,
|
|
15
|
+
useMemo
|
|
16
|
+
} from "react";
|
|
17
|
+
var DEFAULT_TEXT_CUSTOMIZATIONS = {
|
|
18
|
+
virtualFiat: "Deposit with SEPA",
|
|
19
|
+
brokerageOrExchange: "Connect Exchange",
|
|
20
|
+
debitOrCredit: "Deposit with Card",
|
|
21
|
+
accountBalance: "Wallet",
|
|
22
|
+
selectAccount: "Select an exchange",
|
|
23
|
+
perpsTransferTitle: "Transfer",
|
|
24
|
+
sourceMethodTitle: "Your source",
|
|
25
|
+
tokensListTitle: "Your tokens",
|
|
26
|
+
transferTokens: "Transfer Crypto",
|
|
27
|
+
bitcoinLightning: "Bitcoin Lightning",
|
|
28
|
+
cashAppLightning: "Cash App",
|
|
29
|
+
receiveDropdownTitle: "",
|
|
30
|
+
// Default to empty
|
|
31
|
+
receiveDropdownLabel: "Asset to Receive",
|
|
32
|
+
confirmationScreen: {
|
|
33
|
+
payAmountLabel: "You send",
|
|
34
|
+
receiveAmountLabel: "You receive"
|
|
35
|
+
},
|
|
36
|
+
paymentMethodSubtitles: {}
|
|
37
|
+
};
|
|
38
|
+
var DEFAULT_UI_CUSTOMIZATIONS = {
|
|
39
|
+
alignTitle: "center",
|
|
40
|
+
alwaysShowTopDivider: false,
|
|
41
|
+
showModalTitle: true,
|
|
42
|
+
callToActionsUppercase: false,
|
|
43
|
+
enableCompactList: false,
|
|
44
|
+
checkoutHistory: {
|
|
45
|
+
showGetHelpAsAlert: true,
|
|
46
|
+
simplifiedUi: false
|
|
47
|
+
},
|
|
48
|
+
confirmationScreen: {
|
|
49
|
+
preferDestinationWhenSame: false,
|
|
50
|
+
showAmountSummaryAbovePaymentMethod: false,
|
|
51
|
+
showDisclaimerAsAlert: true,
|
|
52
|
+
showInstantTimeEstimate: false,
|
|
53
|
+
showLeftAlignedDollarValueWithLabel: false,
|
|
54
|
+
showPaymentAmountUsd: false,
|
|
55
|
+
showReceiveAmountUsd: false,
|
|
56
|
+
showSelectedRoute: false,
|
|
57
|
+
stepIndicatorType: "spinner",
|
|
58
|
+
showTokenAmount: true,
|
|
59
|
+
showTransactionDigest: "none"
|
|
60
|
+
},
|
|
61
|
+
sourceChangeScreen: {
|
|
62
|
+
bottomBarCloseButton: {
|
|
63
|
+
enabled: false,
|
|
64
|
+
labelKey: "common.close"
|
|
65
|
+
},
|
|
66
|
+
showTargetAssetSelection: false,
|
|
67
|
+
showWalletOnInsufficientBalance: false,
|
|
68
|
+
showWalletConnect: true,
|
|
69
|
+
showCustomTopComponentDivider: false,
|
|
70
|
+
paymentMethodIcons: {}
|
|
71
|
+
},
|
|
72
|
+
inputAmountScreen: {
|
|
73
|
+
allowTokenAmountInput: true
|
|
74
|
+
},
|
|
75
|
+
selectAssetScreen: {
|
|
76
|
+
isSecondaryTokenSymbolVisible: true,
|
|
77
|
+
navigateOnAssetClick: false
|
|
78
|
+
},
|
|
79
|
+
transferCryptoScreen: {
|
|
80
|
+
showYouSendYouReceive: false
|
|
81
|
+
},
|
|
82
|
+
withdrawalScreen: {},
|
|
83
|
+
selectBrokerageScreen: {},
|
|
84
|
+
connectExchangeScreen: {},
|
|
85
|
+
customIcons: {},
|
|
86
|
+
customFontFamily: {
|
|
87
|
+
primary: "",
|
|
88
|
+
secondary: "",
|
|
89
|
+
tertiary: ""
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
var DEFAULT_FUNKIT_CONFIG = {
|
|
93
|
+
apiKey: "",
|
|
94
|
+
appName: "",
|
|
95
|
+
textCustomizations: DEFAULT_TEXT_CUSTOMIZATIONS,
|
|
96
|
+
uiCustomizations: DEFAULT_UI_CUSTOMIZATIONS
|
|
97
|
+
};
|
|
98
|
+
var FunkitConfigContext = createContext(
|
|
99
|
+
DEFAULT_FUNKIT_CONFIG
|
|
100
|
+
);
|
|
101
|
+
function useFunkitConfig() {
|
|
102
|
+
const originalFunkitConfig = useContext(FunkitConfigContext);
|
|
103
|
+
const { t } = useFunkitTranslation();
|
|
104
|
+
const translatedDefaults = useMemo(() => {
|
|
105
|
+
return {
|
|
106
|
+
virtualFiat: t("textCustomizations.virtualFiat"),
|
|
107
|
+
brokerageOrExchange: t("textCustomizations.brokerageOrExchange"),
|
|
108
|
+
debitOrCredit: t("textCustomizations.debitOrCredit"),
|
|
109
|
+
accountBalance: t("textCustomizations.accountBalance"),
|
|
110
|
+
selectAccount: t("textCustomizations.selectAccount"),
|
|
111
|
+
perpsTransferTitle: t("perpsTransfer.title"),
|
|
112
|
+
sourceMethodTitle: t("textCustomizations.sourceMethodTitle"),
|
|
113
|
+
tokensListTitle: t("textCustomizations.tokensListTitle"),
|
|
114
|
+
transferTokens: t("textCustomizations.transferTokens"),
|
|
115
|
+
bitcoinLightning: t("textCustomizations.bitcoinLightning"),
|
|
116
|
+
cashAppLightning: t("textCustomizations.cashAppLightning"),
|
|
117
|
+
receiveDropdownTitle: t("textCustomizations.receiveDropdownTitle"),
|
|
118
|
+
receiveDropdownLabel: t("textCustomizations.receiveDropdownLabel"),
|
|
119
|
+
confirmationScreen: {
|
|
120
|
+
payAmountLabel: t("textCustomizations.payAmountLabel"),
|
|
121
|
+
receiveAmountLabel: t("textCustomizations.receiveAmountLabel")
|
|
122
|
+
},
|
|
123
|
+
paymentMethodSubtitles: {}
|
|
124
|
+
};
|
|
125
|
+
}, [t]);
|
|
126
|
+
const finalFunkitConfig = useMemo(() => {
|
|
127
|
+
return {
|
|
128
|
+
...DEFAULT_FUNKIT_CONFIG,
|
|
129
|
+
...originalFunkitConfig,
|
|
130
|
+
textCustomizations: {
|
|
131
|
+
...translatedDefaults,
|
|
132
|
+
...originalFunkitConfig.textCustomizations,
|
|
133
|
+
confirmationScreen: {
|
|
134
|
+
...translatedDefaults.confirmationScreen,
|
|
135
|
+
...originalFunkitConfig.textCustomizations?.confirmationScreen
|
|
136
|
+
},
|
|
137
|
+
paymentMethodSubtitles: {
|
|
138
|
+
...translatedDefaults.paymentMethodSubtitles,
|
|
139
|
+
...originalFunkitConfig.textCustomizations?.paymentMethodSubtitles
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
uiCustomizations: {
|
|
143
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations,
|
|
144
|
+
...originalFunkitConfig.uiCustomizations,
|
|
145
|
+
checkoutHistory: {
|
|
146
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations.checkoutHistory,
|
|
147
|
+
...originalFunkitConfig.uiCustomizations?.checkoutHistory
|
|
148
|
+
},
|
|
149
|
+
confirmationScreen: {
|
|
150
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations.confirmationScreen,
|
|
151
|
+
...originalFunkitConfig.uiCustomizations?.confirmationScreen
|
|
152
|
+
},
|
|
153
|
+
connectExchangeScreen: {
|
|
154
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations.connectExchangeScreen,
|
|
155
|
+
...originalFunkitConfig.uiCustomizations?.connectExchangeScreen
|
|
156
|
+
},
|
|
157
|
+
inputAmountScreen: {
|
|
158
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations.inputAmountScreen,
|
|
159
|
+
...originalFunkitConfig.uiCustomizations?.inputAmountScreen
|
|
160
|
+
},
|
|
161
|
+
selectAssetScreen: {
|
|
162
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectAssetScreen,
|
|
163
|
+
...originalFunkitConfig.uiCustomizations?.selectAssetScreen
|
|
164
|
+
},
|
|
165
|
+
selectBrokerageScreen: {
|
|
166
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectBrokerageScreen,
|
|
167
|
+
...originalFunkitConfig.uiCustomizations?.selectBrokerageScreen
|
|
168
|
+
},
|
|
169
|
+
sourceChangeScreen: {
|
|
170
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen,
|
|
171
|
+
...originalFunkitConfig.uiCustomizations?.sourceChangeScreen,
|
|
172
|
+
bottomBarCloseButton: {
|
|
173
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen.bottomBarCloseButton,
|
|
174
|
+
...originalFunkitConfig.uiCustomizations?.sourceChangeScreen?.bottomBarCloseButton
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
transferCryptoScreen: {
|
|
178
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations.transferCryptoScreen,
|
|
179
|
+
...originalFunkitConfig.uiCustomizations?.transferCryptoScreen
|
|
180
|
+
},
|
|
181
|
+
withdrawalScreen: {
|
|
182
|
+
...DEFAULT_FUNKIT_CONFIG.uiCustomizations.withdrawalScreen,
|
|
183
|
+
...originalFunkitConfig.uiCustomizations?.withdrawalScreen
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}, [originalFunkitConfig, translatedDefaults]);
|
|
188
|
+
return finalFunkitConfig;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// src/components/FunTooltip/FunTooltip.tsx
|
|
192
|
+
import * as Tooltip from "@radix-ui/react-tooltip";
|
|
193
|
+
import React, {
|
|
194
|
+
createContext as createContext2,
|
|
195
|
+
useContext as useContext2,
|
|
196
|
+
useState
|
|
197
|
+
} from "react";
|
|
198
|
+
var TooltipAnchorRefContext = createContext2(null);
|
|
199
|
+
|
|
200
|
+
// src/components/FunInput/FunInput.tsx
|
|
201
|
+
import React5, {
|
|
202
|
+
forwardRef,
|
|
203
|
+
useEffect as useEffect2,
|
|
204
|
+
useState as useState3
|
|
205
|
+
} from "react";
|
|
206
|
+
import clsx from "clsx";
|
|
207
|
+
|
|
208
|
+
// src/providers/FunkitThemeProvider.tsx
|
|
209
|
+
import React2, { createContext as createContext3, useContext as useContext3, useEffect, useState as useState2 } from "react";
|
|
210
|
+
|
|
211
|
+
// src/themes/baseTheme.ts
|
|
212
|
+
var systemFontStack = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
|
|
213
|
+
var fontStacks = {
|
|
214
|
+
rounded: `SFRounded, ui-rounded, "SF Pro Rounded", ${systemFontStack}`,
|
|
215
|
+
system: systemFontStack,
|
|
216
|
+
fun: `SF Pro, ${systemFontStack}`
|
|
217
|
+
};
|
|
218
|
+
var radiusScales = {
|
|
219
|
+
large: {
|
|
220
|
+
actionButton: "12px",
|
|
221
|
+
actionButtonInner: "10px",
|
|
222
|
+
connectButton: "12px",
|
|
223
|
+
modal: "24px",
|
|
224
|
+
modalMobile: "28px",
|
|
225
|
+
modalActionButton: "24px",
|
|
226
|
+
modalActionButtonMobile: "28px",
|
|
227
|
+
summaryBox: "12px",
|
|
228
|
+
youPayYouReceive: "24px",
|
|
229
|
+
inputAmountSwitcher: "24px",
|
|
230
|
+
qrCode: "12px",
|
|
231
|
+
tooltip: "4px",
|
|
232
|
+
skeleton: "4px",
|
|
233
|
+
dropdown: "12px",
|
|
234
|
+
dropdownItem: "4px",
|
|
235
|
+
dropdownList: "12px",
|
|
236
|
+
modalTopbarIcon: "9999px",
|
|
237
|
+
withdrawalInput: "12px",
|
|
238
|
+
useConnected: "8px"
|
|
239
|
+
},
|
|
240
|
+
medium: {
|
|
241
|
+
actionButton: "10px",
|
|
242
|
+
actionButtonInner: "8px",
|
|
243
|
+
connectButton: "10px",
|
|
244
|
+
modal: "16px",
|
|
245
|
+
modalMobile: "18px",
|
|
246
|
+
modalActionButton: "16px",
|
|
247
|
+
modalActionButtonMobile: "18px",
|
|
248
|
+
summaryBox: "10px",
|
|
249
|
+
youPayYouReceive: "24px",
|
|
250
|
+
inputAmountSwitcher: "24px",
|
|
251
|
+
qrCode: "10px",
|
|
252
|
+
tooltip: "4px",
|
|
253
|
+
skeleton: "4px",
|
|
254
|
+
dropdown: "10px",
|
|
255
|
+
dropdownItem: "4px",
|
|
256
|
+
dropdownList: "10px",
|
|
257
|
+
modalTopbarIcon: "9999px",
|
|
258
|
+
withdrawalInput: "10px",
|
|
259
|
+
useConnected: "8px"
|
|
260
|
+
},
|
|
261
|
+
none: {
|
|
262
|
+
actionButton: "0px",
|
|
263
|
+
actionButtonInner: "0px",
|
|
264
|
+
connectButton: "0px",
|
|
265
|
+
modal: "0px",
|
|
266
|
+
modalMobile: "0px",
|
|
267
|
+
modalActionButton: "0px",
|
|
268
|
+
modalActionButtonMobile: "0px",
|
|
269
|
+
summaryBox: "0px",
|
|
270
|
+
youPayYouReceive: "0px",
|
|
271
|
+
inputAmountSwitcher: "0px",
|
|
272
|
+
qrCode: "0px",
|
|
273
|
+
tooltip: "0px",
|
|
274
|
+
skeleton: "0px",
|
|
275
|
+
dropdown: "0px",
|
|
276
|
+
dropdownItem: "0px",
|
|
277
|
+
dropdownList: "0px",
|
|
278
|
+
modalTopbarIcon: "0px",
|
|
279
|
+
withdrawalInput: "0px",
|
|
280
|
+
useConnected: "0px"
|
|
281
|
+
},
|
|
282
|
+
small: {
|
|
283
|
+
actionButton: "8px",
|
|
284
|
+
actionButtonInner: "6px",
|
|
285
|
+
connectButton: "8px",
|
|
286
|
+
modal: "8px",
|
|
287
|
+
modalMobile: "8px",
|
|
288
|
+
modalActionButton: "8px",
|
|
289
|
+
modalActionButtonMobile: "8px",
|
|
290
|
+
summaryBox: "8px",
|
|
291
|
+
youPayYouReceive: "24px",
|
|
292
|
+
inputAmountSwitcher: "24px",
|
|
293
|
+
qrCode: "8px",
|
|
294
|
+
tooltip: "4px",
|
|
295
|
+
skeleton: "4px",
|
|
296
|
+
dropdown: "8px",
|
|
297
|
+
dropdownItem: "4px",
|
|
298
|
+
dropdownList: "8px",
|
|
299
|
+
modalTopbarIcon: "9999px",
|
|
300
|
+
withdrawalInput: "8px",
|
|
301
|
+
useConnected: "8px"
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
var blurs = {
|
|
305
|
+
large: {
|
|
306
|
+
modalOverlay: "blur(20px)"
|
|
307
|
+
},
|
|
308
|
+
none: {
|
|
309
|
+
modalOverlay: "blur(0px)"
|
|
310
|
+
},
|
|
311
|
+
small: {
|
|
312
|
+
modalOverlay: "blur(8px)"
|
|
313
|
+
},
|
|
314
|
+
tiny: {
|
|
315
|
+
modalOverlay: "blur(4px)"
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
var DEFAULT_FONT_WEIGHTS = {
|
|
319
|
+
regular: "400",
|
|
320
|
+
medium: "500",
|
|
321
|
+
// 510 in figma, but chrome no longer supports 510 - lowered to 500
|
|
322
|
+
semibold: "600",
|
|
323
|
+
// 590 in figma, but chrome no longer supports 590 - raised to 600
|
|
324
|
+
bold: "700",
|
|
325
|
+
heavy: "800"
|
|
326
|
+
};
|
|
327
|
+
var DEFAULT_FONT_SIZES = {
|
|
328
|
+
"10": { fontSize: "10px", lineHeight: "15px" },
|
|
329
|
+
"12": { fontSize: "12px", lineHeight: "14px" },
|
|
330
|
+
"13": { fontSize: "13px", lineHeight: "18px" },
|
|
331
|
+
"14": { fontSize: "14px", lineHeight: "18px" },
|
|
332
|
+
"16": { fontSize: "16px", lineHeight: "20px" },
|
|
333
|
+
"18": { fontSize: "18px", lineHeight: "24px" },
|
|
334
|
+
"20": { fontSize: "20px", lineHeight: "20px" },
|
|
335
|
+
"21": { fontSize: "21px", lineHeight: "21px" },
|
|
336
|
+
"40": { fontSize: "40px", lineHeight: "48px" },
|
|
337
|
+
"57": { fontSize: "57px", lineHeight: "68px" }
|
|
338
|
+
};
|
|
339
|
+
var FONT_SIZINGS = {
|
|
340
|
+
regular: DEFAULT_FONT_SIZES,
|
|
341
|
+
small: {
|
|
342
|
+
"8": { fontSize: "8px", lineHeight: "16px" },
|
|
343
|
+
"10": { fontSize: "8px", lineHeight: "16px" },
|
|
344
|
+
"12": { fontSize: "10px", lineHeight: "16px" },
|
|
345
|
+
"13": { fontSize: "10px", lineHeight: "16px" },
|
|
346
|
+
"14": { fontSize: "12px", lineHeight: "16px" },
|
|
347
|
+
"16": { fontSize: "14px", lineHeight: "18px" },
|
|
348
|
+
"18": { fontSize: "14px", lineHeight: "20px" },
|
|
349
|
+
"20": { fontSize: "18px", lineHeight: "20px" },
|
|
350
|
+
"21": { fontSize: "19px", lineHeight: "19px" },
|
|
351
|
+
"23": { fontSize: "20px", lineHeight: "28px" },
|
|
352
|
+
"40": { fontSize: "34px", lineHeight: "40px" },
|
|
353
|
+
"57": { fontSize: "50px", lineHeight: "60px" }
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
var nestedModalZIndexes = {
|
|
357
|
+
coinbase: 2147483647,
|
|
358
|
+
walletConnect: 99999999999999,
|
|
359
|
+
privy: 999999
|
|
360
|
+
};
|
|
361
|
+
var DEFAULT_MODAL_Z_INDEX = Math.min(...Object.values(nestedModalZIndexes)) - 2;
|
|
362
|
+
var baseTheme = ({
|
|
363
|
+
borderRadius = "large",
|
|
364
|
+
fontStack = "fun",
|
|
365
|
+
fontSizing = "regular",
|
|
366
|
+
customFontFamily,
|
|
367
|
+
customFontWeights = DEFAULT_FONT_WEIGHTS,
|
|
368
|
+
customFontSizings = FONT_SIZINGS[fontSizing],
|
|
369
|
+
customBorderWidths,
|
|
370
|
+
customBorderRadiuses = radiusScales[borderRadius],
|
|
371
|
+
customDimensions,
|
|
372
|
+
customOpacities,
|
|
373
|
+
customSpacings,
|
|
374
|
+
customTextTransforms,
|
|
375
|
+
overlayBlur = "small",
|
|
376
|
+
modalZIndex = DEFAULT_MODAL_Z_INDEX
|
|
377
|
+
}) => ({
|
|
378
|
+
modalZIndex: String(modalZIndex),
|
|
379
|
+
blurs: {
|
|
380
|
+
modalOverlay: blurs[overlayBlur].modalOverlay
|
|
381
|
+
},
|
|
382
|
+
dimensions: {
|
|
383
|
+
connectExchangeIconSize: "48px",
|
|
384
|
+
cryptoCashToggleIconSize: "20px",
|
|
385
|
+
dollarValueSkeletonHeight: "60px",
|
|
386
|
+
dollarValueSkeletonWidth: "160px",
|
|
387
|
+
inputAmountQuickOptionButtonHeight: "36px",
|
|
388
|
+
inputAmountMinHeight: "76px",
|
|
389
|
+
modalBottomBarButtonHeight: "34px",
|
|
390
|
+
modalTopBarHeight: "56px",
|
|
391
|
+
modalTopbarIconSize: "16px",
|
|
392
|
+
modalTopbarIconWrapperSize: "32px",
|
|
393
|
+
paymentAmountSkeletonBlockHeight: "14px",
|
|
394
|
+
paymentAmountSkeletonBlockWidth: "93px",
|
|
395
|
+
paymentAmountSkeletonCircleSize: "15px",
|
|
396
|
+
paymentMethodItemIconSize: "20px",
|
|
397
|
+
selectAssetItemIconSize: "24px",
|
|
398
|
+
sourceListGap: "4px",
|
|
399
|
+
txBreakdownSkeletonWidth: "72px",
|
|
400
|
+
txSummaryLineSkeletonHeight: "14px",
|
|
401
|
+
txSummaryLineSkeletonWidth: "54px",
|
|
402
|
+
...customDimensions,
|
|
403
|
+
modalBottomBarCloseButtonHeight: customDimensions?.modalBottomBarCloseButtonHeight ?? customDimensions?.modalBottomBarButtonHeight ?? "34px"
|
|
404
|
+
},
|
|
405
|
+
fonts: typeof customFontFamily === "string" ? {
|
|
406
|
+
amountValue: customFontFamily,
|
|
407
|
+
body: customFontFamily,
|
|
408
|
+
buttonTextPrimary: customFontFamily,
|
|
409
|
+
buttonTextSecondary: customFontFamily,
|
|
410
|
+
buttonTextTertiary: customFontFamily,
|
|
411
|
+
dropdownGroupHeader: customFontFamily,
|
|
412
|
+
header: customFontFamily,
|
|
413
|
+
inputAmount: customFontFamily,
|
|
414
|
+
modalTopbarTitle: customFontFamily,
|
|
415
|
+
txStatusDescription: customFontFamily,
|
|
416
|
+
txStatusTitle: customFontFamily
|
|
417
|
+
} : {
|
|
418
|
+
amountValue: fontStacks[fontStack],
|
|
419
|
+
body: fontStacks[fontStack],
|
|
420
|
+
buttonTextPrimary: fontStacks[fontStack],
|
|
421
|
+
buttonTextSecondary: fontStacks[fontStack],
|
|
422
|
+
buttonTextTertiary: fontStacks[fontStack],
|
|
423
|
+
dropdownGroupHeader: fontStacks[fontStack],
|
|
424
|
+
header: fontStacks[fontStack],
|
|
425
|
+
inputAmount: fontStacks[fontStack],
|
|
426
|
+
modalTopbarTitle: fontStacks[fontStack],
|
|
427
|
+
txStatusDescription: fontStacks[fontStack],
|
|
428
|
+
txStatusTitle: fontStacks[fontStack],
|
|
429
|
+
...customFontFamily
|
|
430
|
+
},
|
|
431
|
+
fontWeight: {
|
|
432
|
+
...DEFAULT_FONT_WEIGHTS,
|
|
433
|
+
cryptoCashToggle: DEFAULT_FONT_WEIGHTS.medium,
|
|
434
|
+
dropdownGroupHeader: DEFAULT_FONT_WEIGHTS.medium,
|
|
435
|
+
inputAmount: DEFAULT_FONT_WEIGHTS.medium,
|
|
436
|
+
inputLabel: DEFAULT_FONT_WEIGHTS.medium,
|
|
437
|
+
inputValue: DEFAULT_FONT_WEIGHTS.medium,
|
|
438
|
+
modalTopbarTitle: DEFAULT_FONT_WEIGHTS.medium,
|
|
439
|
+
modalBottomBarButtonText: DEFAULT_FONT_WEIGHTS.medium,
|
|
440
|
+
paymentMethodItemSubtitle: DEFAULT_FONT_WEIGHTS.regular,
|
|
441
|
+
paymentMethodItemTitle: DEFAULT_FONT_WEIGHTS.medium,
|
|
442
|
+
selectAssetItemSubtitle: DEFAULT_FONT_WEIGHTS.regular,
|
|
443
|
+
selectAssetItemTitle: DEFAULT_FONT_WEIGHTS.medium,
|
|
444
|
+
sourceListSectionLabelFontWeight: DEFAULT_FONT_WEIGHTS.medium,
|
|
445
|
+
txBreakdown: DEFAULT_FONT_WEIGHTS.regular,
|
|
446
|
+
txStatusDescription: DEFAULT_FONT_WEIGHTS.regular,
|
|
447
|
+
txStatusTitle: DEFAULT_FONT_WEIGHTS.medium,
|
|
448
|
+
txSummaryLabel: DEFAULT_FONT_WEIGHTS.medium,
|
|
449
|
+
txSummaryValue: DEFAULT_FONT_WEIGHTS.medium,
|
|
450
|
+
formOfPaymentsListSectionLabelFontWeight: DEFAULT_FONT_WEIGHTS.medium,
|
|
451
|
+
withdrawalYouWillReceiveLabel: DEFAULT_FONT_WEIGHTS.regular,
|
|
452
|
+
withdrawalYouWillReceiveValueCrypto: DEFAULT_FONT_WEIGHTS.medium,
|
|
453
|
+
withdrawalYouWillReceiveValueUsd: DEFAULT_FONT_WEIGHTS.regular,
|
|
454
|
+
...customFontWeights
|
|
455
|
+
},
|
|
456
|
+
fontSize: {
|
|
457
|
+
...FONT_SIZINGS[fontSizing],
|
|
458
|
+
body: FONT_SIZINGS[fontSizing][14],
|
|
459
|
+
cryptoCashToggle: FONT_SIZINGS[fontSizing][12],
|
|
460
|
+
"header-14": { fontSize: "14px", lineHeight: "14px" },
|
|
461
|
+
"header-36": { fontSize: "36px", lineHeight: "36px" },
|
|
462
|
+
buttonTextPrimary: FONT_SIZINGS[fontSizing][12],
|
|
463
|
+
buttonTextSecondary: FONT_SIZINGS[fontSizing][10],
|
|
464
|
+
buttonTextTertiary: FONT_SIZINGS[fontSizing][12],
|
|
465
|
+
dollarValue: FONT_SIZINGS[fontSizing][40],
|
|
466
|
+
dropdownGroupHeader: FONT_SIZINGS[fontSizing][12],
|
|
467
|
+
inputAmount: FONT_SIZINGS[fontSizing][57],
|
|
468
|
+
inputLabel: customFontSizings[12] ?? FONT_SIZINGS[fontSizing][12],
|
|
469
|
+
inputValue: customFontSizings[13] ?? FONT_SIZINGS[fontSizing][13],
|
|
470
|
+
modalTopbarSubtitle: FONT_SIZINGS[fontSizing][10],
|
|
471
|
+
modalTopbarTitle: FONT_SIZINGS[fontSizing][13],
|
|
472
|
+
modalBottomBarButtonText: FONT_SIZINGS[fontSizing][12],
|
|
473
|
+
paymentMethodItemSubtitle: FONT_SIZINGS[fontSizing][12],
|
|
474
|
+
paymentMethodItemTitle: FONT_SIZINGS[fontSizing][12],
|
|
475
|
+
selectAssetItemSubtitle: FONT_SIZINGS[fontSizing][10],
|
|
476
|
+
selectAssetItemTitle: FONT_SIZINGS[fontSizing][13],
|
|
477
|
+
txBreakdown: FONT_SIZINGS[fontSizing][12],
|
|
478
|
+
txStatusDescription: FONT_SIZINGS[fontSizing][13],
|
|
479
|
+
txStatusTitle: FONT_SIZINGS[fontSizing][13],
|
|
480
|
+
txSummaryLabel: FONT_SIZINGS[fontSizing][12],
|
|
481
|
+
txSummaryValue: FONT_SIZINGS[fontSizing][12],
|
|
482
|
+
withdrawalYouWillReceive: customFontSizings[12] ?? FONT_SIZINGS[fontSizing][12],
|
|
483
|
+
youPayYouReceivePrimaryFontSize: FONT_SIZINGS[fontSizing][12],
|
|
484
|
+
youPayYouReceiveSecondaryFontSize: FONT_SIZINGS[fontSizing][10],
|
|
485
|
+
depositAddressFontSize: FONT_SIZINGS[fontSizing][10],
|
|
486
|
+
funFeatureListItemFontSize: FONT_SIZINGS[fontSizing][12],
|
|
487
|
+
dropdownItemFontSize: FONT_SIZINGS[fontSizing][12],
|
|
488
|
+
sourceListSectionLabelFontSize: FONT_SIZINGS[fontSizing][12],
|
|
489
|
+
formOfPaymentsListSectionLabelFontSize: FONT_SIZINGS[fontSizing][12],
|
|
490
|
+
quickOptionFontSize: FONT_SIZINGS[fontSizing][14],
|
|
491
|
+
useConnectedFontSize: FONT_SIZINGS[fontSizing][12],
|
|
492
|
+
paymentFeeSummaryTooltip: FONT_SIZINGS[fontSizing][10],
|
|
493
|
+
tooltipContent: FONT_SIZINGS[fontSizing][10],
|
|
494
|
+
...customFontSizings
|
|
495
|
+
},
|
|
496
|
+
radii: {
|
|
497
|
+
actionButton: radiusScales[borderRadius].actionButton,
|
|
498
|
+
actionButtonInner: radiusScales[borderRadius].actionButtonInner,
|
|
499
|
+
connectButton: radiusScales[borderRadius].connectButton,
|
|
500
|
+
menuButton: radiusScales[borderRadius].connectButton,
|
|
501
|
+
modal: radiusScales[borderRadius].modal,
|
|
502
|
+
modalMobile: radiusScales[borderRadius].modalMobile,
|
|
503
|
+
modalActionButton: radiusScales[borderRadius].modalActionButton,
|
|
504
|
+
modalActionButtonMobile: radiusScales[borderRadius].modalActionButtonMobile,
|
|
505
|
+
summaryBox: radiusScales[borderRadius].summaryBox,
|
|
506
|
+
youPayYouReceive: radiusScales[borderRadius].youPayYouReceive,
|
|
507
|
+
inputAmountSwitcher: radiusScales[borderRadius].inputAmountSwitcher,
|
|
508
|
+
qrCode: radiusScales[borderRadius].qrCode,
|
|
509
|
+
skeleton: radiusScales[borderRadius].skeleton,
|
|
510
|
+
tooltip: radiusScales[borderRadius].tooltip,
|
|
511
|
+
dropdown: radiusScales[borderRadius].dropdown,
|
|
512
|
+
dropdownItem: radiusScales[borderRadius].dropdownItem,
|
|
513
|
+
dropdownList: customBorderRadiuses?.dropdownList ?? customBorderRadiuses?.dropdown ?? radiusScales[borderRadius].dropdown,
|
|
514
|
+
modalTopbarIcon: radiusScales[borderRadius].modalTopbarIcon,
|
|
515
|
+
withdrawalInput: radiusScales[borderRadius].withdrawalInput,
|
|
516
|
+
useConnected: radiusScales[borderRadius].useConnected,
|
|
517
|
+
...customBorderRadiuses
|
|
518
|
+
},
|
|
519
|
+
borderWidths: {
|
|
520
|
+
activeOptionBorderWidth: "1px",
|
|
521
|
+
buttonTertiaryBorderWidth: "0px",
|
|
522
|
+
cryptoCashToggleContainerBorderWidth: "0px",
|
|
523
|
+
cryptoCashToggleActiveTabBorderWidth: "1px",
|
|
524
|
+
cryptoCashToggleInactiveTabBorderWidth: "1px",
|
|
525
|
+
txSummaryBoxBorderWidth: "1px",
|
|
526
|
+
...customBorderWidths
|
|
527
|
+
},
|
|
528
|
+
opacities: {
|
|
529
|
+
buttonPrimaryDisabled: "1",
|
|
530
|
+
...customOpacities
|
|
531
|
+
},
|
|
532
|
+
spacing: {
|
|
533
|
+
confirmationStepMarginTop: "6px",
|
|
534
|
+
confirmationStepVerticalGap: "18px",
|
|
535
|
+
cryptoCashToggleContainerPadding: "3px",
|
|
536
|
+
cryptoCashToggleMarginBottom: "16px",
|
|
537
|
+
cryptoCashToggleMarginTop: "24px",
|
|
538
|
+
cryptoCashToggleTabPaddingY: "6px",
|
|
539
|
+
dropdownItemIconGap: "4px",
|
|
540
|
+
dropdownItemPaddingX: "4px",
|
|
541
|
+
dropdownItemPaddingY: "6px",
|
|
542
|
+
dropdownCompactPaddingX: "6px",
|
|
543
|
+
dropdownCompactPaddingY: "6px",
|
|
544
|
+
dropdownPaddingX: "12px",
|
|
545
|
+
dropdownPaddingY: "12px",
|
|
546
|
+
modalBaseHorizontalPadding: "6px",
|
|
547
|
+
modalBottomBarButtonPaddingY: "0px",
|
|
548
|
+
modalBottomHorizontalPadding: "12px",
|
|
549
|
+
modalPaddingBottomUpper: "16px",
|
|
550
|
+
modalPaddingBottomLower: "16px",
|
|
551
|
+
modalTopBarVerticalTextSpacing: "0px",
|
|
552
|
+
selectAssetItemPaddingX: "12px",
|
|
553
|
+
selectAssetItemPaddingY: "8px",
|
|
554
|
+
selectAssetItemTextGap: "0px",
|
|
555
|
+
selectBrokerageItemPaddingX: "12px",
|
|
556
|
+
selectBrokerageItemPaddingY: "11px",
|
|
557
|
+
selectBrokerageListGap: "0px",
|
|
558
|
+
walletConnectorListGap: "10px",
|
|
559
|
+
txBreakdownMarginY: "18px",
|
|
560
|
+
txBreakdownPaddingX: "12px",
|
|
561
|
+
txSummaryBoxPaddingX: "12px",
|
|
562
|
+
txSummaryBoxPaddingY: "12px",
|
|
563
|
+
txSummaryLineItemPadding: "0px",
|
|
564
|
+
txSummaryDividerMarginX: "12px",
|
|
565
|
+
txSummaryDividerMarginY: "12px",
|
|
566
|
+
verticalSectionGap: "18px",
|
|
567
|
+
withdrawalModalPaddingTop: "12px",
|
|
568
|
+
youPayYouReceivePaddingLeft: "12px",
|
|
569
|
+
youPayYouReceivePaddingRight: "16px",
|
|
570
|
+
youPayYouReceivePaddingY: "8px",
|
|
571
|
+
inputPaddingX: "12px",
|
|
572
|
+
inputPaddingY: "12px",
|
|
573
|
+
dropdownActiveItemRegularSizePaddingY: "8px",
|
|
574
|
+
assetListDefaultGap: "4px",
|
|
575
|
+
dropdownGroupDividerMarginY: "8px",
|
|
576
|
+
...customSpacings
|
|
577
|
+
},
|
|
578
|
+
textTransforms: {
|
|
579
|
+
inputAmountQuickOptionButton: "none",
|
|
580
|
+
txStatusTitle: "none",
|
|
581
|
+
...customTextTransforms
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
// src/themes/darkTheme.ts
|
|
586
|
+
var accentColors = {
|
|
587
|
+
blue: { accentColor: "#3898FF", accentColorForeground: "#FFF" },
|
|
588
|
+
green: { accentColor: "#66CC00", accentColorForeground: "#000" },
|
|
589
|
+
orange: { accentColor: "#F6851B", accentColorForeground: "#000" },
|
|
590
|
+
pink: { accentColor: "#FF7AB8", accentColorForeground: "#000" },
|
|
591
|
+
purple: { accentColor: "#7A70FF", accentColorForeground: "#FFF" },
|
|
592
|
+
red: { accentColor: "#F34126", accentColorForeground: "#FFF" },
|
|
593
|
+
white: { accentColor: "#FFF", accentColorForeground: "#000" }
|
|
594
|
+
};
|
|
595
|
+
var defaultAccentColor = accentColors.white;
|
|
596
|
+
var darkTheme = ({
|
|
597
|
+
accentColor = defaultAccentColor.accentColor,
|
|
598
|
+
accentColorForeground = defaultAccentColor.accentColorForeground,
|
|
599
|
+
customColors,
|
|
600
|
+
customShadows,
|
|
601
|
+
...baseThemeOptions
|
|
602
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: just a bunch of ?? defaults
|
|
603
|
+
} = {}) => ({
|
|
604
|
+
...baseTheme(baseThemeOptions),
|
|
605
|
+
colors: {
|
|
606
|
+
accentColor,
|
|
607
|
+
accentColorForeground,
|
|
608
|
+
actionButtonBorder: "rgba(255, 255, 255, 0.04)",
|
|
609
|
+
connectButtonBackground: "#000",
|
|
610
|
+
connectButtonBackgroundError: "#C60000",
|
|
611
|
+
connectButtonText: "#FFF",
|
|
612
|
+
connectButtonTextError: "#FFF",
|
|
613
|
+
connectionIndicator: "#30E000",
|
|
614
|
+
error: accentColors.red.accentColor,
|
|
615
|
+
errorBackground: "#F2E6E4",
|
|
616
|
+
errorBorder: "rgba(243, 65, 38, 0.2)",
|
|
617
|
+
generalBorder: "#292929",
|
|
618
|
+
// strokeColor in figma
|
|
619
|
+
generalBorderDim: "rgba(255, 255, 255, 0.04)",
|
|
620
|
+
menuItemBackground: "rgba(255, 255, 255, 0.03)",
|
|
621
|
+
selectedOptionBorder: "rgba(224, 232, 255, 0.1)",
|
|
622
|
+
focusedOptionBorder: "#8C8C8C",
|
|
623
|
+
standby: "#F6851B",
|
|
624
|
+
success: "#66CC00",
|
|
625
|
+
delayedStatusIcon: customColors?.secondaryText ?? "#8C8C8C",
|
|
626
|
+
// backward compatibility
|
|
627
|
+
chainIconBorder: "#fff",
|
|
628
|
+
// FUNKIT COLORS
|
|
629
|
+
// modal backgrounds
|
|
630
|
+
modalBackdrop: "rgba(0, 0, 0, 0.2)",
|
|
631
|
+
modalBackground: "#000000",
|
|
632
|
+
modalBorder: "#292929",
|
|
633
|
+
modalTopbarIcon: "#FFF",
|
|
634
|
+
modalTopbarIconBackground: customColors?.modalTopbarIconBackground ?? "transparent",
|
|
635
|
+
modalTopbarIconBackgroundHover: customColors?.modalTopbarIconBackgroundHover ?? customColors?.buttonIconBackgroundHover ?? "#333333",
|
|
636
|
+
modalTopbarIconBackgroundPressed: customColors?.modalTopbarIconBackgroundPressed ?? customColors?.buttonIconBackgroundPressed ?? "#333333",
|
|
637
|
+
modalTopbarIconStroke: customColors?.modalTopbarIconStroke ?? customColors?.buttonIconStroke ?? "rgba(255, 255, 255, 0.35)",
|
|
638
|
+
offBackground: "#1F1F1F",
|
|
639
|
+
offBackgroundInverse: "#F2F2F2",
|
|
640
|
+
hoverState: "#333333",
|
|
641
|
+
lightStroke: "#333333",
|
|
642
|
+
mediumStroke: "#333333",
|
|
643
|
+
heavyStroke: "rgba(117, 117, 117, 0.40)",
|
|
644
|
+
strokeColor: "#333333",
|
|
645
|
+
secondaryBackground: "#333333",
|
|
646
|
+
//Text
|
|
647
|
+
primaryText: "#FFF",
|
|
648
|
+
secondaryText: "#8C8C8C",
|
|
649
|
+
tertiaryText: "rgba(255, 255, 255, 0.35)",
|
|
650
|
+
textSelection: "rgba(255, 255, 255, 0.10)",
|
|
651
|
+
selectedDropdownItemText: customColors?.primaryText ?? "#FFF",
|
|
652
|
+
copyButtonBackgroundBase: customColors?.offBackground ?? "#1F1F1F",
|
|
653
|
+
copyButtonBackgroundHover: customColors?.hoverState ?? "#333333",
|
|
654
|
+
copyButtonBackgroundActive: customColors?.inputBorderHover ?? "#525252",
|
|
655
|
+
useConnectedBackgroundBase: customColors?.mediumStroke ?? "#333333",
|
|
656
|
+
useConnectedBackgroundHover: customColors?.mediumStroke ?? "#333333",
|
|
657
|
+
copyButtonBorderBase: customColors?.mediumStroke ?? "#333333",
|
|
658
|
+
copyButtonBorderHover: customColors?.mediumStroke ?? "#333333",
|
|
659
|
+
funFeatureListBackgroundBase: customColors?.offBackground ?? "#1F1F1F",
|
|
660
|
+
funFeatureListBackgroundHover: customColors?.hoverState ?? "#333333",
|
|
661
|
+
funFeatureListBorderColor: "transparent",
|
|
662
|
+
funFeatureListBorderColorHover: "transparent",
|
|
663
|
+
selectedDropdownItemBackground: "transparent",
|
|
664
|
+
alwaysVisibleLabelBackgroundHover: "transparent",
|
|
665
|
+
// input
|
|
666
|
+
inputLabel: customColors?.primaryText ?? "#FFF",
|
|
667
|
+
inputBackground: "#000000",
|
|
668
|
+
inputBackgroundHover: customColors?.offBackground ?? "#1F1F1F",
|
|
669
|
+
inputBorderBase: "#333333",
|
|
670
|
+
inputBorderHover: "#525252",
|
|
671
|
+
// tab
|
|
672
|
+
activeTabBorderColor: "#333333",
|
|
673
|
+
activeTabBackground: "#333333",
|
|
674
|
+
inactiveTabBorderColor: "transparent",
|
|
675
|
+
inactiveTabBackgroundBase: "transparent",
|
|
676
|
+
inactiveTabBackgroundHover: "transparent",
|
|
677
|
+
inactiveTabBackgroundActive: "transparent",
|
|
678
|
+
activeTabText: customColors?.primaryText ?? "#FFF",
|
|
679
|
+
inactiveTabTextBase: customColors?.secondaryText ?? "#8C8C8C",
|
|
680
|
+
inactiveTabHover: customColors?.primaryText ?? "#FFF",
|
|
681
|
+
// button
|
|
682
|
+
actionColor: "#FFF",
|
|
683
|
+
actionColorHover: "rgba(255, 255, 255, 0.8)",
|
|
684
|
+
actionColorDisabled: "rgba(255, 255, 255, 0.65)",
|
|
685
|
+
buttonPrimary: accentColor,
|
|
686
|
+
buttonDisabled: "rgba(255, 255, 255, 0.20)",
|
|
687
|
+
buttonTextPrimary: "#000000",
|
|
688
|
+
buttonTextHover: "#000000",
|
|
689
|
+
buttonTextDisabled: "#000000",
|
|
690
|
+
buttonWarning: accentColors.red.accentColor,
|
|
691
|
+
buttonSuccess: "#2EA200",
|
|
692
|
+
transparent: "transparent",
|
|
693
|
+
buttonBackgroundTertiary: "#333333",
|
|
694
|
+
buttonBackgroundHoverTertiary: "#333333",
|
|
695
|
+
buttonBackgroundDisabledTertiary: "transparent",
|
|
696
|
+
buttonTextTertiary: "#FFF",
|
|
697
|
+
buttonTextDisabledTertiary: "rgba(255, 255, 255, 0.65)",
|
|
698
|
+
buttonBackground: "#FFF",
|
|
699
|
+
buttonBackgroundHover: "#f2f2f2",
|
|
700
|
+
buttonBackgroundPressed: "#FFF",
|
|
701
|
+
buttonBackgroundDisabled: "rgba(255, 255, 255, 0.65)",
|
|
702
|
+
buttonTextSecondaryDisabled: "rgba(255, 255, 255, 0.65)",
|
|
703
|
+
buttonTextSecondary: "#FFFFFF",
|
|
704
|
+
buttonIconBackgroundHover: "#333333",
|
|
705
|
+
buttonIconBackgroundPressed: "#333333",
|
|
706
|
+
buttonIconStroke: "rgba(255, 255, 255, 0.35)",
|
|
707
|
+
buttonBorderTertiary: "transparent",
|
|
708
|
+
buttonBorderFocusedTertiary: "rgba(255, 255, 255, 0.35)",
|
|
709
|
+
buttonFocusedOutline: "none",
|
|
710
|
+
buttonBorderGradient: "none",
|
|
711
|
+
buttonHoverBorderGradient: "none",
|
|
712
|
+
buttonDisabledBorderGradient: "none",
|
|
713
|
+
// TODO: Make common colors when refactoring the design system
|
|
714
|
+
inputAmountQuickOptionBaseBackground: "#1F1F1F",
|
|
715
|
+
inputAmountQuickOptionHoverBackground: "#333333",
|
|
716
|
+
inputAmountQuickOptionActiveBackground: "#333333",
|
|
717
|
+
inputAmountQuickOptionDisabledBackground: "#333333",
|
|
718
|
+
inputAmountQuickOptionBaseBorder: "#f2f2f2",
|
|
719
|
+
inputAmountQuickOptionHoverBorder: "rgba(255, 255, 255, 0.35)",
|
|
720
|
+
inputAmountQuickOptionActiveBorder: "rgba(255, 255, 255, 0.35)",
|
|
721
|
+
inputAmountQuickOptionFocusedBorder: "rgba(255, 255, 255, 0.35)",
|
|
722
|
+
inputAmountFiatDecimalsColor: customColors?.inputAmountFiatDecimalsColor ?? "none",
|
|
723
|
+
youPayYouReceiveBackground: "#000000",
|
|
724
|
+
// modalBackground
|
|
725
|
+
youPayYouReceiveBorder: "#333333",
|
|
726
|
+
// mediumStroke
|
|
727
|
+
youPayYouReceivePrimaryText: "#FFF",
|
|
728
|
+
// primaryText
|
|
729
|
+
youPayYouReceiveSecondaryText: "#8C8C8C",
|
|
730
|
+
// secondaryText
|
|
731
|
+
withdrawalYouWillReceiveLabel: customColors?.withdrawalYouWillReceiveLabel ?? customColors?.primaryText ?? "#FFF",
|
|
732
|
+
withdrawalYouWillReceiveValueCrypto: customColors?.withdrawalYouWillReceiveValueCrypto ?? customColors?.primaryText ?? "#FFF",
|
|
733
|
+
withdrawalYouWillReceiveValueUsd: customColors?.withdrawalYouWillReceiveValueUsd ?? customColors?.secondaryText ?? "#8C8C8C",
|
|
734
|
+
// badges
|
|
735
|
+
badgeBackgroundSuccess: "rgba(124, 242, 136, 0.1)",
|
|
736
|
+
badgeBorderSuccess: "rgba(124, 242, 136, 0.2)",
|
|
737
|
+
badgeTextSuccess: "rgb(124, 242, 136)",
|
|
738
|
+
newBadgeBackground: "linear-gradient(180deg, rgba(57, 76, 56, 0.55) 0%, rgba(61, 81, 65, 0.55) 100%)",
|
|
739
|
+
newBadgeBorder: "rgba(122, 221, 122, 0.3)",
|
|
740
|
+
newBadgeText: "#A4FF9A",
|
|
741
|
+
approvedBadgeBackground: "linear-gradient(180deg, rgba(236, 255, 234, 0.20) 0%, rgba(228, 255, 233, 0.20) 100%)",
|
|
742
|
+
approvedBadgeBorder: "rgba(109, 216, 109, 0.08)",
|
|
743
|
+
approvedBadgeText: "#8FFFA9",
|
|
744
|
+
failedBadgeBackground: "rgba(255, 61, 61, 0.18)",
|
|
745
|
+
failedBadgeBorder: "rgba(255, 255, 255, 0.10)",
|
|
746
|
+
failedBadgeText: "#F88877",
|
|
747
|
+
announceGradientFrom: "#AAAAAA",
|
|
748
|
+
announceGradientTo: "#BEBEBE",
|
|
749
|
+
fiatPendingGradientFrom: "#AAAAAA",
|
|
750
|
+
fiatPendingGradientTo: "#BEBEBE",
|
|
751
|
+
fiatSuccessBackgroundFill: "rgba(102, 204, 0, 0.30)",
|
|
752
|
+
fiatFailedBackgroundFill: "rgba(255, 61, 61, 0.30)",
|
|
753
|
+
fiatStatusIconBorder: "rgba(255, 255, 255, 0.06)",
|
|
754
|
+
fiatAccountIconFill: "#002F5E",
|
|
755
|
+
fiatAccountGradientFrom: "#3A82FE",
|
|
756
|
+
fiatAccountGradientTo: "#73A7FF",
|
|
757
|
+
modalHeaderDivider: "#333333",
|
|
758
|
+
// lightStroke
|
|
759
|
+
modalFooterDivider: "#333333",
|
|
760
|
+
// lightStroke
|
|
761
|
+
spinnerBackground: customColors?.mediumStroke ?? "rgba(0, 0, 0, 0.3)",
|
|
762
|
+
// 30% buttonTextPrimary
|
|
763
|
+
spinnerIndicator: customColors?.primaryText ?? "#000",
|
|
764
|
+
// 100% buttonTextPrimary
|
|
765
|
+
spinnerBackgroundVerifyAccount: "rgba(0, 0, 0, 0.3)",
|
|
766
|
+
// 30% buttonTextPrimary
|
|
767
|
+
spinnerIndicatorVerifyAccount: customColors?.primaryText ?? "#000",
|
|
768
|
+
// 100% buttonTextPrimary
|
|
769
|
+
// Override colors
|
|
770
|
+
...customColors || {},
|
|
771
|
+
// option Boxes
|
|
772
|
+
optionBoxBackground: customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#000",
|
|
773
|
+
// keeps gradient in SourcePaymentMethodItem if optionBoxBackground differs from modal background
|
|
774
|
+
optionBoxBorderedBackground: customColors?.optionBoxBorderedBackground ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#000",
|
|
775
|
+
optionBoxBackgroundUninteractive: customColors?.optionBoxBackgroundUninteractive ?? "transparent",
|
|
776
|
+
optionBoxBorderBase: customColors?.optionBoxBorderBase ?? customColors?.mediumStroke ?? "#333333",
|
|
777
|
+
optionBoxBorderHover: customColors?.optionBoxBorderHover ?? customColors?.mediumStroke ?? "#333333",
|
|
778
|
+
optionBoxDefaultModeNotActiveBorderBase: customColors?.optionBoxDefaultModeNotActiveBorderBase ?? "transparent",
|
|
779
|
+
optionBoxDefaultModeNotActiveBorderHover: customColors?.optionBoxDefaultModeNotActiveBorderHover ?? "transparent",
|
|
780
|
+
dropdownActiveItemBackgroundBase: customColors?.dropdownActiveItemBackgroundBase ?? customColors?.modalBackground ?? "#000000",
|
|
781
|
+
openDropdownBackgroundColor: customColors?.openDropdownBackgroundColor ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#000",
|
|
782
|
+
dropdownActiveItemBackgroundHover: customColors?.dropdownActiveItemBackgroundHover ?? customColors?.offBackground ?? "#1F1F1F",
|
|
783
|
+
dropdownActiveItemBackgroundDisabled: customColors?.dropdownActiveItemBackgroundDisabled ?? "transparent",
|
|
784
|
+
dropdownActiveItemBorderBase: customColors?.dropdownActiveItemBorderBase ?? customColors?.mediumStroke ?? "#333333",
|
|
785
|
+
dropdownActiveItemBorderHover: customColors?.dropdownActiveItemBorderHover ?? customColors?.mediumStroke ?? "#333333",
|
|
786
|
+
dropdownGroupHeader: customColors?.dropdownGroupHeader ?? customColors?.primaryText ?? "#FFF",
|
|
787
|
+
// primaryText
|
|
788
|
+
txSummaryBoxBackground: customColors?.txSummaryBoxBackground ?? customColors?.modalBackground ?? "#000",
|
|
789
|
+
txSummaryBoxBorder: customColors?.txSummaryBoxBorder ?? customColors?.lightStroke ?? "#333333",
|
|
790
|
+
modalBackgroundCheckoutComplete: customColors?.modalBackgroundCheckoutComplete ?? customColors?.modalBackground ?? "#000",
|
|
791
|
+
counterRingColor: customColors?.counterRingColor ?? accentColor,
|
|
792
|
+
cryptoCashToggleContainerBorderColor: customColors?.cryptoCashToggleContainerBorderColor ?? "transparent",
|
|
793
|
+
cryptoCashToggleBackground: customColors?.cryptoCashToggleBackground ?? "transparent",
|
|
794
|
+
qrCodeBackground: customColors?.qrCodeBackground ?? customColors?.modalBackground ?? "#000000",
|
|
795
|
+
qrCodeForeground: customColors?.qrCodeForeground ?? customColors?.primaryText ?? "#FFFFFF"
|
|
796
|
+
},
|
|
797
|
+
shadows: {
|
|
798
|
+
connectButton: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
799
|
+
dialog: "0px 8px 32px rgba(0, 0, 0, 0.32)",
|
|
800
|
+
selectedOption: "0px 2px 6px rgba(0, 0, 0, 0.24)",
|
|
801
|
+
selectedWallet: "0px 2px 6px rgba(0, 0, 0, 0.24)",
|
|
802
|
+
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)",
|
|
803
|
+
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)",
|
|
804
|
+
qrCode: "0px 0px 0px 1px rgba(255, 255, 255, 0.16)",
|
|
805
|
+
buttonShadow: "none",
|
|
806
|
+
buttonShadowTertiary: "none",
|
|
807
|
+
buttonHoverShadow: "none",
|
|
808
|
+
buttonHoverShadowTertiary: "none",
|
|
809
|
+
buttonFocusedShadow: "0px 0px 0px 2px rgba(255, 255, 255, 0.25)",
|
|
810
|
+
buttonFocusedShadowTertiary: "0px 0px 0px 2px rgba(255, 255, 255, 0.25)",
|
|
811
|
+
buttonDisabledShadow: "none",
|
|
812
|
+
buttonDisabledShadowTertiary: "none",
|
|
813
|
+
buttonInnerShadow: "none",
|
|
814
|
+
buttonInnerShadowTertiary: customShadows?.buttonInnerShadow ?? "none",
|
|
815
|
+
buttonFocusedInnerShadow: "none",
|
|
816
|
+
buttonFocusedInnerShadowTertiary: customShadows?.buttonFocusedInnerShadow ?? "none",
|
|
817
|
+
buttonHoverInnerShadow: "none",
|
|
818
|
+
buttonHoverInnerShadowTertiary: customShadows?.buttonHoverInnerShadow ?? "none",
|
|
819
|
+
buttonDisabledInnerShadow: "none",
|
|
820
|
+
buttonDisabledInnerShadowTertiary: customShadows?.buttonDisabledInnerShadow ?? "none",
|
|
821
|
+
selectedDropdownItem: "none",
|
|
822
|
+
// Override shadows
|
|
823
|
+
...customShadows || {}
|
|
824
|
+
},
|
|
825
|
+
moonpayTheme: "dark"
|
|
826
|
+
});
|
|
827
|
+
darkTheme.accentColors = accentColors;
|
|
828
|
+
|
|
829
|
+
// src/themes/lightTheme.ts
|
|
830
|
+
var accentColors2 = {
|
|
831
|
+
blue: { accentColor: "#31A3F8", accentColorForeground: "#31A3F859" },
|
|
832
|
+
green: { accentColor: "#66CC00", accentColorForeground: "#FFF" },
|
|
833
|
+
orange: { accentColor: "#F6851B", accentColorForeground: "#FFF" },
|
|
834
|
+
pink: { accentColor: "#FF5CA0", accentColorForeground: "#FFF" },
|
|
835
|
+
purple: { accentColor: "#5F5AFA", accentColorForeground: "#FFF" },
|
|
836
|
+
red: { accentColor: "#F34126", accentColorForeground: "#FFF" },
|
|
837
|
+
white: { accentColor: "#000000", accentColorForeground: "#FFF" }
|
|
838
|
+
};
|
|
839
|
+
var defaultAccentColor2 = accentColors2.white;
|
|
840
|
+
var lightTheme = ({
|
|
841
|
+
accentColor = defaultAccentColor2.accentColor,
|
|
842
|
+
accentColorForeground = defaultAccentColor2.accentColorForeground,
|
|
843
|
+
customColors,
|
|
844
|
+
customShadows,
|
|
845
|
+
...baseThemeOptions
|
|
846
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: just a bunch of ?? defaults
|
|
847
|
+
} = {}) => ({
|
|
848
|
+
...baseTheme(baseThemeOptions),
|
|
849
|
+
colors: {
|
|
850
|
+
accentColor,
|
|
851
|
+
accentColorForeground,
|
|
852
|
+
actionButtonBorder: "rgba(0, 0, 0, 0.04)",
|
|
853
|
+
connectButtonBackground: "#FFF",
|
|
854
|
+
connectButtonBackgroundError: "#C60000",
|
|
855
|
+
connectButtonText: "#25292E",
|
|
856
|
+
connectButtonTextError: "#FFF",
|
|
857
|
+
connectionIndicator: "#30E000",
|
|
858
|
+
error: accentColors2.red.accentColor,
|
|
859
|
+
errorBackground: "#F2E6E4",
|
|
860
|
+
errorBorder: "rgba(243, 65, 38, 0.2)",
|
|
861
|
+
generalBorder: "#F7F7F7",
|
|
862
|
+
// strokeColor in figma
|
|
863
|
+
generalBorderDim: "rgba(0, 0, 0, 0.03)",
|
|
864
|
+
menuItemBackground: "#FCFCFC",
|
|
865
|
+
selectedOptionBorder: "#F7F7F7",
|
|
866
|
+
focusedOptionBorder: "#737373",
|
|
867
|
+
standby: "#F6851B",
|
|
868
|
+
success: "#66CC00",
|
|
869
|
+
delayedStatusIcon: customColors?.secondaryText ?? "#737373",
|
|
870
|
+
// backward compatibility
|
|
871
|
+
chainIconBorder: "#fff",
|
|
872
|
+
// FUNKIT COLORS
|
|
873
|
+
// modal backgrounds
|
|
874
|
+
modalBackdrop: "rgba(0, 0, 0, 0.2)",
|
|
875
|
+
modalTopbarIcon: "#000",
|
|
876
|
+
modalTopbarIconBackground: customColors?.modalTopbarIconBackground ?? "transparent",
|
|
877
|
+
modalTopbarIconBackgroundHover: customColors?.modalTopbarIconBackgroundHover ?? customColors?.buttonIconBackgroundHover ?? "#F7F7F7",
|
|
878
|
+
modalTopbarIconBackgroundPressed: customColors?.modalTopbarIconBackgroundPressed ?? customColors?.buttonIconBackgroundPressed ?? "#F0F0F0",
|
|
879
|
+
modalTopbarIconStroke: customColors?.modalTopbarIconStroke ?? customColors?.buttonIconStroke ?? "rgba(0, 0, 0, 0.35)",
|
|
880
|
+
modalBackground: "#FFF",
|
|
881
|
+
modalBorder: "#F7F7F7",
|
|
882
|
+
offBackground: "#F7F7F7",
|
|
883
|
+
offBackgroundInverse: "#333333",
|
|
884
|
+
hoverState: "#F0F0F0",
|
|
885
|
+
lightStroke: "#F7F7F7",
|
|
886
|
+
mediumStroke: "#F0F0F0",
|
|
887
|
+
heavyStroke: "#E5E5E5",
|
|
888
|
+
strokeColor: "#E8E8E8",
|
|
889
|
+
secondaryBackground: "#F7F7F7",
|
|
890
|
+
//Text
|
|
891
|
+
primaryText: "#000",
|
|
892
|
+
secondaryText: "#737373",
|
|
893
|
+
tertiaryText: "rgba(0, 0, 0, 0.35)",
|
|
894
|
+
textSelection: "rgba(0, 0, 0, 0.10)",
|
|
895
|
+
selectedDropdownItemText: customColors?.primaryText ?? "#000",
|
|
896
|
+
copyButtonBackgroundBase: customColors?.offBackground ?? "#F7F7F7",
|
|
897
|
+
copyButtonBackgroundHover: customColors?.hoverState ?? "#F0F0F0",
|
|
898
|
+
copyButtonBackgroundActive: customColors?.inputBorderHover ?? "#E5E5E5",
|
|
899
|
+
useConnectedBackgroundBase: customColors?.mediumStroke ?? "#F0F0F0",
|
|
900
|
+
useConnectedBackgroundHover: customColors?.mediumStroke ?? "#F0F0F0",
|
|
901
|
+
copyButtonBorderBase: customColors?.mediumStroke ?? "#F0F0F0",
|
|
902
|
+
copyButtonBorderHover: customColors?.mediumStroke ?? "#F0F0F0",
|
|
903
|
+
funFeatureListBackgroundBase: customColors?.offBackground ?? "#F7F7F7",
|
|
904
|
+
funFeatureListBackgroundHover: customColors?.hoverState ?? "#F0F0F0",
|
|
905
|
+
funFeatureListBorderColor: "transparent",
|
|
906
|
+
funFeatureListBorderColorHover: "transparent",
|
|
907
|
+
selectedDropdownItemBackground: "transparent",
|
|
908
|
+
alwaysVisibleLabelBackgroundHover: "transparent",
|
|
909
|
+
// input
|
|
910
|
+
inputLabel: customColors?.primaryText ?? "#000",
|
|
911
|
+
inputBackground: "#FFFFFF",
|
|
912
|
+
inputBackgroundHover: customColors?.offBackground ?? "#F7F7F7",
|
|
913
|
+
inputBorderBase: "#F0F0F0",
|
|
914
|
+
inputBorderHover: "#E5E5E5",
|
|
915
|
+
// tab
|
|
916
|
+
activeTabBorderColor: "#F7F7F7",
|
|
917
|
+
activeTabBackground: "#F7F7F7",
|
|
918
|
+
inactiveTabBorderColor: "transparent",
|
|
919
|
+
inactiveTabBackgroundBase: "transparent",
|
|
920
|
+
inactiveTabBackgroundHover: "transparent",
|
|
921
|
+
inactiveTabBackgroundActive: "transparent",
|
|
922
|
+
activeTabText: customColors?.primaryText ?? "#000",
|
|
923
|
+
inactiveTabTextBase: customColors?.secondaryText ?? "#737373",
|
|
924
|
+
inactiveTabHover: customColors?.primaryText ?? "#000",
|
|
925
|
+
// button
|
|
926
|
+
actionColor: "#000",
|
|
927
|
+
actionColorHover: "rgba(0, 0, 0, 0.7)",
|
|
928
|
+
actionColorDisabled: "rgba(0, 0, 0, 0.50)",
|
|
929
|
+
buttonPrimary: accentColor,
|
|
930
|
+
buttonDisabled: "#31A3F826",
|
|
931
|
+
buttonWarning: accentColors2.red.accentColor,
|
|
932
|
+
buttonSuccess: "#2EA200",
|
|
933
|
+
buttonTextPrimary: "#FFFFFF",
|
|
934
|
+
buttonTextHover: "#FFF",
|
|
935
|
+
buttonTextDisabled: "#FFF",
|
|
936
|
+
transparent: "transparent",
|
|
937
|
+
buttonBackgroundTertiary: "#F7F7F7",
|
|
938
|
+
buttonBackgroundHoverTertiary: "#F0F0F0",
|
|
939
|
+
buttonBackgroundDisabledTertiary: "transparent",
|
|
940
|
+
buttonTextTertiary: "#000",
|
|
941
|
+
buttonTextDisabledTertiary: "rgba(0, 0, 0, 0.5)",
|
|
942
|
+
buttonBackground: "#000",
|
|
943
|
+
buttonBackgroundHover: "#333333",
|
|
944
|
+
buttonBackgroundPressed: "#000",
|
|
945
|
+
buttonBackgroundDisabled: "rgba(0, 0, 0, 0.5)",
|
|
946
|
+
buttonTextSecondaryDisabled: "rgba(0, 0, 0, 0.5)",
|
|
947
|
+
buttonTextSecondary: "#000000",
|
|
948
|
+
buttonIconBackgroundHover: "#F7F7F7",
|
|
949
|
+
buttonIconBackgroundPressed: "#F0F0F0",
|
|
950
|
+
buttonIconStroke: "rgba(0, 0, 0, 0.35)",
|
|
951
|
+
buttonBorderTertiary: "transparent",
|
|
952
|
+
buttonBorderFocusedTertiary: "rgba(0, 0, 0, 0.35)",
|
|
953
|
+
buttonFocusedOutline: "none",
|
|
954
|
+
buttonBorderGradient: "none",
|
|
955
|
+
buttonHoverBorderGradient: "none",
|
|
956
|
+
buttonDisabledBorderGradient: "none",
|
|
957
|
+
// TODO: Make common colors when refactoring the design system
|
|
958
|
+
inputAmountQuickOptionBaseBackground: "#F7F7F7",
|
|
959
|
+
inputAmountQuickOptionHoverBackground: "#F0F0F0",
|
|
960
|
+
inputAmountQuickOptionActiveBackground: "#F0F0F0",
|
|
961
|
+
inputAmountQuickOptionDisabledBackground: "#F7F7F7",
|
|
962
|
+
inputAmountQuickOptionBaseBorder: "#F7F7F7",
|
|
963
|
+
inputAmountQuickOptionHoverBorder: "rgba(0, 0, 0, 0.35)",
|
|
964
|
+
inputAmountQuickOptionActiveBorder: "rgba(0, 0, 0, 0.35)",
|
|
965
|
+
inputAmountQuickOptionFocusedBorder: "rgba(0, 0, 0, 0.35)",
|
|
966
|
+
inputAmountFiatDecimalsColor: customColors?.inputAmountFiatDecimalsColor ?? "none",
|
|
967
|
+
youPayYouReceiveBackground: "#FFF",
|
|
968
|
+
// modalBackground
|
|
969
|
+
youPayYouReceiveBorder: "#F0F0F0",
|
|
970
|
+
// mediumStroke
|
|
971
|
+
youPayYouReceivePrimaryText: "#000",
|
|
972
|
+
// primaryText
|
|
973
|
+
youPayYouReceiveSecondaryText: "#737373",
|
|
974
|
+
// secondaryText
|
|
975
|
+
withdrawalYouWillReceiveLabel: customColors?.withdrawalYouWillReceiveLabel ?? customColors?.primaryText ?? "#000",
|
|
976
|
+
withdrawalYouWillReceiveValueCrypto: customColors?.withdrawalYouWillReceiveValueCrypto ?? customColors?.primaryText ?? "#000",
|
|
977
|
+
withdrawalYouWillReceiveValueUsd: customColors?.withdrawalYouWillReceiveValueUsd ?? customColors?.secondaryText ?? "#737373",
|
|
978
|
+
// badges
|
|
979
|
+
badgeBackgroundSuccess: "rgba(124, 242, 136, 0.1)",
|
|
980
|
+
badgeBorderSuccess: "rgba(124, 242, 136, 0.2)",
|
|
981
|
+
badgeTextSuccess: "rgb(124, 242, 136)",
|
|
982
|
+
newBadgeBackground: "linear-gradient(180deg, #ECFFEA 0%, #E4FFE9 100%)",
|
|
983
|
+
newBadgeBorder: "rgba(122, 221, 122, 0.5)",
|
|
984
|
+
newBadgeText: "#028320",
|
|
985
|
+
approvedBadgeBackground: "linear-gradient(180deg, #ECFFEA 0%, #E4FFE9 100%)",
|
|
986
|
+
approvedBadgeBorder: "rgba(109, 216, 109, 0.5)",
|
|
987
|
+
approvedBadgeText: "#028320",
|
|
988
|
+
failedBadgeBackground: "rgba(255, 61, 61, 0.08)",
|
|
989
|
+
failedBadgeBorder: "rgba(0, 0, 0, 0.03)",
|
|
990
|
+
failedBadgeText: "#C2341E",
|
|
991
|
+
announceGradientFrom: "#595959",
|
|
992
|
+
announceGradientTo: "#9C9C9C",
|
|
993
|
+
fiatPendingGradientFrom: "#454545",
|
|
994
|
+
fiatPendingGradientTo: "#747474",
|
|
995
|
+
fiatSuccessBackgroundFill: "rgba(102, 204, 0, 0.16)",
|
|
996
|
+
fiatFailedBackgroundFill: "rgba(255, 61, 61, 0.12)",
|
|
997
|
+
fiatStatusIconBorder: "rgba(0, 0, 0, 0.03)",
|
|
998
|
+
fiatAccountIconFill: "#E7F3FE",
|
|
999
|
+
fiatAccountGradientFrom: "#055DF5",
|
|
1000
|
+
fiatAccountGradientTo: "#4C8DFD",
|
|
1001
|
+
modalHeaderDivider: "#F7F7F7",
|
|
1002
|
+
// lightStroke
|
|
1003
|
+
modalFooterDivider: "#F7F7F7",
|
|
1004
|
+
// lightStroke
|
|
1005
|
+
spinnerBackground: customColors?.mediumStroke ?? "rgba(255, 255, 255, 0.3)",
|
|
1006
|
+
// 30% buttonTextPrimary
|
|
1007
|
+
spinnerIndicator: customColors?.primaryText ?? "#FFF",
|
|
1008
|
+
// 100% buttonTextPrimary
|
|
1009
|
+
spinnerBackgroundVerifyAccount: "rgba(255, 255, 255, 0.3)",
|
|
1010
|
+
// 30% buttonTextPrimary
|
|
1011
|
+
spinnerIndicatorVerifyAccount: customColors?.primaryText ?? "#FFF",
|
|
1012
|
+
// 100% buttonTextPrimary
|
|
1013
|
+
// Override colors
|
|
1014
|
+
...customColors || {},
|
|
1015
|
+
// option Boxes
|
|
1016
|
+
optionBoxBackground: customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
1017
|
+
// keeps gradient in SourcePaymentMethodItem if optionBoxBackground differs from modal background
|
|
1018
|
+
optionBoxBorderedBackground: customColors?.optionBoxBorderedBackground ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
1019
|
+
optionBoxBackgroundUninteractive: customColors?.optionBoxBackgroundUninteractive ?? "transparent",
|
|
1020
|
+
optionBoxBorderBase: customColors?.optionBoxBorderBase ?? customColors?.mediumStroke ?? "#F0F0F0",
|
|
1021
|
+
optionBoxBorderHover: customColors?.optionBoxBorderHover ?? customColors?.mediumStroke ?? "#F0F0F0",
|
|
1022
|
+
optionBoxDefaultModeNotActiveBorderBase: customColors?.optionBoxDefaultModeNotActiveBorderBase ?? "transparent",
|
|
1023
|
+
optionBoxDefaultModeNotActiveBorderHover: customColors?.optionBoxDefaultModeNotActiveBorderHover ?? "transparent",
|
|
1024
|
+
dropdownActiveItemBackgroundBase: customColors?.dropdownActiveItemBackgroundBase ?? customColors?.modalBackground ?? "#FFF",
|
|
1025
|
+
openDropdownBackgroundColor: customColors?.openDropdownBackgroundColor ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
1026
|
+
dropdownActiveItemBackgroundHover: customColors?.dropdownActiveItemBackgroundHover ?? customColors?.offBackground ?? "#F7F7F7",
|
|
1027
|
+
dropdownActiveItemBackgroundDisabled: customColors?.dropdownActiveItemBackgroundDisabled ?? "transparent",
|
|
1028
|
+
dropdownActiveItemBorderBase: customColors?.dropdownActiveItemBorderBase ?? customColors?.mediumStroke ?? "#F0F0F0",
|
|
1029
|
+
dropdownActiveItemBorderHover: customColors?.dropdownActiveItemBorderHover ?? customColors?.mediumStroke ?? "#F0F0F0",
|
|
1030
|
+
dropdownGroupHeader: customColors?.dropdownGroupHeader ?? customColors?.primaryText ?? "#000",
|
|
1031
|
+
// primaryText
|
|
1032
|
+
txSummaryBoxBackground: customColors?.txSummaryBoxBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
1033
|
+
txSummaryBoxBorder: customColors?.txSummaryBoxBorder ?? customColors?.lightStroke ?? "#F7F7F7",
|
|
1034
|
+
modalBackgroundCheckoutComplete: customColors?.modalBackgroundCheckoutComplete ?? customColors?.modalBackground ?? "#FFF",
|
|
1035
|
+
counterRingColor: customColors?.counterRingColor ?? accentColor,
|
|
1036
|
+
cryptoCashToggleContainerBorderColor: customColors?.cryptoCashToggleContainerBorderColor ?? "transparent",
|
|
1037
|
+
cryptoCashToggleBackground: customColors?.cryptoCashToggleBackground ?? "transparent",
|
|
1038
|
+
qrCodeBackground: customColors?.qrCodeBackground ?? customColors?.modalBackground ?? "#FFF",
|
|
1039
|
+
qrCodeForeground: customColors?.qrCodeForeground ?? customColors?.primaryText ?? "#000"
|
|
1040
|
+
},
|
|
1041
|
+
shadows: {
|
|
1042
|
+
connectButton: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
1043
|
+
dialog: "0px 8px 32px rgba(0, 0, 0, 0.32)",
|
|
1044
|
+
selectedOption: "0px 2px 6px rgba(0, 0, 0, 0.24)",
|
|
1045
|
+
selectedWallet: "0px 2px 6px rgba(0, 0, 0, 0.12)",
|
|
1046
|
+
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)",
|
|
1047
|
+
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)",
|
|
1048
|
+
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)",
|
|
1049
|
+
buttonShadow: "none",
|
|
1050
|
+
buttonShadowTertiary: customShadows?.buttonShadow ?? "none",
|
|
1051
|
+
buttonFocusedShadow: "0px 0px 0px 2px rgba(0, 0, 0, 0.25)",
|
|
1052
|
+
buttonFocusedShadowTertiary: "0px 0px 0px 2px rgba(0, 0, 0, 0.25)",
|
|
1053
|
+
buttonHoverShadow: "none",
|
|
1054
|
+
buttonHoverShadowTertiary: "none",
|
|
1055
|
+
buttonDisabledShadow: "none",
|
|
1056
|
+
buttonDisabledShadowTertiary: customShadows?.buttonDisabledShadow ?? "none",
|
|
1057
|
+
buttonInnerShadow: "none",
|
|
1058
|
+
buttonInnerShadowTertiary: customShadows?.buttonInnerShadow ?? "none",
|
|
1059
|
+
buttonFocusedInnerShadow: "none",
|
|
1060
|
+
buttonFocusedInnerShadowTertiary: customShadows?.buttonFocusedInnerShadow ?? "none",
|
|
1061
|
+
buttonHoverInnerShadow: "none",
|
|
1062
|
+
buttonHoverInnerShadowTertiary: customShadows?.buttonHoverInnerShadow ?? "none",
|
|
1063
|
+
buttonDisabledInnerShadow: "none",
|
|
1064
|
+
buttonDisabledInnerShadowTertiary: customShadows?.buttonDisabledInnerShadow ?? "none",
|
|
1065
|
+
selectedDropdownItem: "none",
|
|
1066
|
+
// Override shadows
|
|
1067
|
+
...customShadows || {}
|
|
1068
|
+
},
|
|
1069
|
+
moonpayTheme: "light"
|
|
1070
|
+
});
|
|
1071
|
+
lightTheme.accentColors = accentColors2;
|
|
1072
|
+
|
|
1073
|
+
// src/providers/FunkitThemeProvider.tsx
|
|
1074
|
+
var DEFAULT_THEME_SET = {
|
|
1075
|
+
lightTheme: lightTheme(),
|
|
1076
|
+
darkTheme: darkTheme()
|
|
1077
|
+
};
|
|
1078
|
+
var DEFAULT_THEME = DEFAULT_THEME_SET.darkTheme;
|
|
1079
|
+
var ThemeIdContext = createContext3(void 0);
|
|
1080
|
+
var ThemeContext = createContext3({
|
|
1081
|
+
activeTheme: DEFAULT_THEME,
|
|
1082
|
+
lightTheme: void 0,
|
|
1083
|
+
darkTheme: void 0,
|
|
1084
|
+
setTheme: () => {
|
|
1085
|
+
return;
|
|
1086
|
+
},
|
|
1087
|
+
toggleTheme: () => {
|
|
1088
|
+
return;
|
|
1089
|
+
},
|
|
1090
|
+
themeColorScheme: void 0
|
|
1091
|
+
});
|
|
1092
|
+
var useActiveTheme = () => {
|
|
1093
|
+
const {
|
|
1094
|
+
activeTheme,
|
|
1095
|
+
setTheme,
|
|
1096
|
+
lightTheme: lightTheme2,
|
|
1097
|
+
darkTheme: darkTheme2,
|
|
1098
|
+
toggleTheme,
|
|
1099
|
+
themeColorScheme
|
|
1100
|
+
} = useContext3(ThemeContext);
|
|
1101
|
+
return {
|
|
1102
|
+
activeTheme,
|
|
1103
|
+
/** 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` */
|
|
1104
|
+
setTheme,
|
|
1105
|
+
/** 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 */
|
|
1106
|
+
lightTheme: lightTheme2,
|
|
1107
|
+
/** 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 */
|
|
1108
|
+
darkTheme: darkTheme2,
|
|
1109
|
+
/** 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 */
|
|
1110
|
+
toggleTheme,
|
|
1111
|
+
/** 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 */
|
|
1112
|
+
themeColorScheme
|
|
1113
|
+
};
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
// src/components/FunSkeletonLoader/FunSkeletonBlock.tsx
|
|
1117
|
+
import React3 from "react";
|
|
1118
|
+
|
|
1119
|
+
// src/components/FunSkeletonLoader/FunSkeletonLoader.css.ts
|
|
1120
|
+
var animateSkeletonClass = "FunSkeletonLoader_animateSkeletonClass__dj0x602 sprinkles_background_inputBorderHover_base__1rsrm2f15a";
|
|
1121
|
+
|
|
1122
|
+
// src/components/FunSkeletonLoader/FunSkeletonBlock.tsx
|
|
1123
|
+
function FunSkeletonBlock({
|
|
1124
|
+
borderRadius = "skeleton",
|
|
1125
|
+
fontSize,
|
|
1126
|
+
height,
|
|
1127
|
+
width = "full",
|
|
1128
|
+
...props
|
|
1129
|
+
}) {
|
|
1130
|
+
const { activeTheme } = useActiveTheme();
|
|
1131
|
+
const cssHeight = height ? activeTheme.dimensions[height] || (height.endsWith("px") ? height : `${height}px`) : activeTheme.fontSize[fontSize].lineHeight;
|
|
1132
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1133
|
+
Box,
|
|
1134
|
+
{
|
|
1135
|
+
borderRadius,
|
|
1136
|
+
className: animateSkeletonClass,
|
|
1137
|
+
width,
|
|
1138
|
+
...props,
|
|
1139
|
+
style: { height: cssHeight, ...props.style }
|
|
1140
|
+
}
|
|
1141
|
+
);
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
// src/components/Icons/SearchIcon.tsx
|
|
1145
|
+
import React4 from "react";
|
|
1146
|
+
var SearchIcon = () => {
|
|
1147
|
+
return /* @__PURE__ */ React4.createElement(
|
|
1148
|
+
"svg",
|
|
1149
|
+
{
|
|
1150
|
+
width: "15",
|
|
1151
|
+
height: "15",
|
|
1152
|
+
viewBox: "0 0 15 15",
|
|
1153
|
+
fill: "none",
|
|
1154
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1155
|
+
},
|
|
1156
|
+
/* @__PURE__ */ React4.createElement(
|
|
1157
|
+
"path",
|
|
1158
|
+
{
|
|
1159
|
+
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",
|
|
1160
|
+
fill: "currentColor"
|
|
1161
|
+
}
|
|
1162
|
+
),
|
|
1163
|
+
/* @__PURE__ */ React4.createElement(
|
|
1164
|
+
"path",
|
|
1165
|
+
{
|
|
1166
|
+
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",
|
|
1167
|
+
fill: "currentColor"
|
|
1168
|
+
}
|
|
1169
|
+
)
|
|
1170
|
+
);
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
// src/components/FunInput/FunInput.css.ts
|
|
1174
|
+
var baseWrapperStyles = "FunInput_baseWrapperStyles__zue0i60";
|
|
1175
|
+
var baseWrapperStylesNoTransition = "FunInput_baseWrapperStylesNoTransition__zue0i61";
|
|
1176
|
+
var inputClass = "FunInput_inputClass__zue0i64 sprinkles_color_primaryText_base__1rsrm2f2qy sprinkles_paddingLeft_inputPaddingX__1rsrm2fri sprinkles_paddingRight_inputPaddingX__1rsrm2ftj sprinkles_paddingTop_inputPaddingY__1rsrm2fvl sprinkles_paddingBottom_inputPaddingY__1rsrm2fpi";
|
|
1177
|
+
var inputClassDisabled = "FunInput_inputClassDisabled__zue0i68 sprinkles_color_actionColorDisabled_base__1rsrm2f2ua sprinkles_paddingLeft_inputPaddingX__1rsrm2fri sprinkles_paddingRight_inputPaddingX__1rsrm2ftj sprinkles_paddingTop_inputPaddingY__1rsrm2fvl sprinkles_paddingBottom_inputPaddingY__1rsrm2fpi";
|
|
1178
|
+
var inputClassDisabledNoTransition = "FunInput_inputClassDisabledNoTransition__zue0i6a sprinkles_color_actionColorDisabled_base__1rsrm2f2ua sprinkles_paddingLeft_inputPaddingX__1rsrm2fri sprinkles_paddingRight_inputPaddingX__1rsrm2ftj sprinkles_paddingTop_inputPaddingY__1rsrm2fvl sprinkles_paddingBottom_inputPaddingY__1rsrm2fpi";
|
|
1179
|
+
var inputClassError = "FunInput_inputClassError__zue0i6c sprinkles_color_primaryText_base__1rsrm2f2qy sprinkles_paddingLeft_inputPaddingX__1rsrm2fri sprinkles_paddingRight_inputPaddingX__1rsrm2ftj sprinkles_paddingTop_inputPaddingY__1rsrm2fvl sprinkles_paddingBottom_inputPaddingY__1rsrm2fpi";
|
|
1180
|
+
var inputClassErrorNoTransition = "FunInput_inputClassErrorNoTransition__zue0i6f sprinkles_color_primaryText_base__1rsrm2f2qy sprinkles_paddingLeft_inputPaddingX__1rsrm2fri sprinkles_paddingRight_inputPaddingX__1rsrm2ftj sprinkles_paddingTop_inputPaddingY__1rsrm2fvl sprinkles_paddingBottom_inputPaddingY__1rsrm2fpi";
|
|
1181
|
+
var inputClassNoTransition = "FunInput_inputClassNoTransition__zue0i66 sprinkles_color_primaryText_base__1rsrm2f2qy sprinkles_paddingLeft_inputPaddingX__1rsrm2fri sprinkles_paddingRight_inputPaddingX__1rsrm2ftj sprinkles_paddingTop_inputPaddingY__1rsrm2fvl sprinkles_paddingBottom_inputPaddingY__1rsrm2fpi";
|
|
1182
|
+
var numberInputResetStyle = "FunInput_numberInputResetStyle__zue0i62";
|
|
1183
|
+
|
|
1184
|
+
// src/components/FunInput/FunInput.tsx
|
|
1185
|
+
var DEFAULT_ICON_FONT_SIZE = "57px";
|
|
1186
|
+
var FunInput = forwardRef(function FunInputWithRef({
|
|
1187
|
+
prefix,
|
|
1188
|
+
suffix,
|
|
1189
|
+
prefixIcon,
|
|
1190
|
+
placeholder,
|
|
1191
|
+
value,
|
|
1192
|
+
label,
|
|
1193
|
+
onChange,
|
|
1194
|
+
onKeyDown,
|
|
1195
|
+
onKeySubmit,
|
|
1196
|
+
onPaste,
|
|
1197
|
+
onMouseDown,
|
|
1198
|
+
onFocus: userOnFocus,
|
|
1199
|
+
onBlur: userOnBlur,
|
|
1200
|
+
adornmentColor = "secondaryText",
|
|
1201
|
+
fontFamily = "body",
|
|
1202
|
+
textWeight = "inputLabel",
|
|
1203
|
+
inputStyle = {},
|
|
1204
|
+
inputProps = { type: "text" },
|
|
1205
|
+
error,
|
|
1206
|
+
alwaysFocused,
|
|
1207
|
+
overrideBorderWidth,
|
|
1208
|
+
overrideBackground,
|
|
1209
|
+
ignoreFontSize,
|
|
1210
|
+
borderRadius = "connectButton",
|
|
1211
|
+
isLoading = false,
|
|
1212
|
+
allowMultiline = false,
|
|
1213
|
+
ignoreBaseTransitions = false,
|
|
1214
|
+
decimalsColor,
|
|
1215
|
+
decimalSeparator,
|
|
1216
|
+
testId
|
|
1217
|
+
}, ref) {
|
|
1218
|
+
const { activeTheme } = useActiveTheme();
|
|
1219
|
+
const [focused, setFocused] = useState3(false);
|
|
1220
|
+
const onFocus = () => {
|
|
1221
|
+
setFocused(true);
|
|
1222
|
+
userOnFocus?.();
|
|
1223
|
+
};
|
|
1224
|
+
const onBlur = () => {
|
|
1225
|
+
setFocused(false);
|
|
1226
|
+
userOnBlur?.();
|
|
1227
|
+
};
|
|
1228
|
+
const isFocused = alwaysFocused || focused;
|
|
1229
|
+
const isValidDecimalColor = !!decimalsColor && activeTheme.colors?.[decimalsColor] !== "none";
|
|
1230
|
+
const getBorderColor = () => {
|
|
1231
|
+
if (error) {
|
|
1232
|
+
return { base: "error" };
|
|
1233
|
+
}
|
|
1234
|
+
if (inputProps.disabled) {
|
|
1235
|
+
return { base: "inputBorderBase" };
|
|
1236
|
+
}
|
|
1237
|
+
if (isFocused) {
|
|
1238
|
+
return { base: "secondaryText" };
|
|
1239
|
+
}
|
|
1240
|
+
return {
|
|
1241
|
+
base: "inputBorderBase",
|
|
1242
|
+
hover: "inputBorderHover"
|
|
1243
|
+
};
|
|
1244
|
+
};
|
|
1245
|
+
const textareaRef = React5.useRef(null);
|
|
1246
|
+
useEffect2(() => {
|
|
1247
|
+
if (allowMultiline) {
|
|
1248
|
+
adjustTextareaHeight(textareaRef.current);
|
|
1249
|
+
}
|
|
1250
|
+
}, [allowMultiline, value]);
|
|
1251
|
+
const { integerPart, decimalPart, shouldColorDecimals } = React5.useMemo(() => {
|
|
1252
|
+
if (!isValidDecimalColor || !value || !decimalSeparator) {
|
|
1253
|
+
return { integerPart: "", decimalPart: "", shouldColorDecimals: false };
|
|
1254
|
+
}
|
|
1255
|
+
const stringValue = String(value);
|
|
1256
|
+
const parts = stringValue.split(decimalSeparator);
|
|
1257
|
+
return {
|
|
1258
|
+
integerPart: parts[0] || "",
|
|
1259
|
+
decimalPart: parts[1] !== void 0 ? `${decimalSeparator}${parts[1]}` : "",
|
|
1260
|
+
shouldColorDecimals: parts[1] !== void 0
|
|
1261
|
+
};
|
|
1262
|
+
}, [value, isValidDecimalColor, decimalSeparator]);
|
|
1263
|
+
const renderInputOrTextarea = () => {
|
|
1264
|
+
const commonProps = {
|
|
1265
|
+
// ref,
|
|
1266
|
+
value,
|
|
1267
|
+
placeholder,
|
|
1268
|
+
onChange,
|
|
1269
|
+
onKeyDown: (e) => {
|
|
1270
|
+
e.stopPropagation();
|
|
1271
|
+
onKeyDown?.(e);
|
|
1272
|
+
if (e.key === "Enter") {
|
|
1273
|
+
onKeySubmit?.();
|
|
1274
|
+
}
|
|
1275
|
+
},
|
|
1276
|
+
onPaste,
|
|
1277
|
+
onMouseDown,
|
|
1278
|
+
onFocus,
|
|
1279
|
+
onBlur,
|
|
1280
|
+
onWheel: (e) => {
|
|
1281
|
+
e.currentTarget.blur();
|
|
1282
|
+
},
|
|
1283
|
+
className: clsx(
|
|
1284
|
+
error ? ignoreBaseTransitions ? inputClassErrorNoTransition : inputClassError : inputProps.disabled ? ignoreBaseTransitions ? inputClassDisabledNoTransition : inputClassDisabled : ignoreBaseTransitions ? inputClassNoTransition : inputClass,
|
|
1285
|
+
numberInputResetStyle
|
|
1286
|
+
),
|
|
1287
|
+
...inputProps,
|
|
1288
|
+
// If decimals are colored, the actual input element is hidden
|
|
1289
|
+
// but keep the caret visible via caretColor
|
|
1290
|
+
style: {
|
|
1291
|
+
...inputStyle,
|
|
1292
|
+
color: shouldColorDecimals ? "transparent" : void 0,
|
|
1293
|
+
caretColor: isValidDecimalColor ? themeVars.colors.primaryText : void 0
|
|
1294
|
+
},
|
|
1295
|
+
"data-auto-focus": inputProps.autoFocus,
|
|
1296
|
+
"data-testid": testId ? `rk-${testId.replace(/^rk-/, "")}` : void 0
|
|
1297
|
+
};
|
|
1298
|
+
const handleTextareaOnChange = (e) => {
|
|
1299
|
+
adjustTextareaHeight(textareaRef.current);
|
|
1300
|
+
if (onChange) {
|
|
1301
|
+
onChange(e);
|
|
1302
|
+
}
|
|
1303
|
+
};
|
|
1304
|
+
const handleTextAreaOnPaste = (e) => {
|
|
1305
|
+
adjustTextareaHeight(textareaRef.current);
|
|
1306
|
+
if (onPaste) {
|
|
1307
|
+
onPaste(e);
|
|
1308
|
+
}
|
|
1309
|
+
};
|
|
1310
|
+
const inputElement = allowMultiline ? /* @__PURE__ */ React5.createElement(
|
|
1311
|
+
"textarea",
|
|
1312
|
+
{
|
|
1313
|
+
...commonProps,
|
|
1314
|
+
ref: (el) => {
|
|
1315
|
+
textareaRef.current = el;
|
|
1316
|
+
if (typeof ref === "function") {
|
|
1317
|
+
ref(el);
|
|
1318
|
+
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
1319
|
+
ref.current = el;
|
|
1320
|
+
}
|
|
1321
|
+
},
|
|
1322
|
+
rows: 1,
|
|
1323
|
+
style: {
|
|
1324
|
+
...commonProps.style,
|
|
1325
|
+
resize: "none",
|
|
1326
|
+
boxSizing: "border-box"
|
|
1327
|
+
},
|
|
1328
|
+
onChange: handleTextareaOnChange,
|
|
1329
|
+
onPaste: handleTextAreaOnPaste
|
|
1330
|
+
}
|
|
1331
|
+
) : /* @__PURE__ */ React5.createElement(
|
|
1332
|
+
"input",
|
|
1333
|
+
{
|
|
1334
|
+
...commonProps,
|
|
1335
|
+
ref: (el) => {
|
|
1336
|
+
if (typeof ref === "function") {
|
|
1337
|
+
ref(el);
|
|
1338
|
+
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
1339
|
+
ref.current = el;
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
type: inputProps?.type || "text"
|
|
1343
|
+
}
|
|
1344
|
+
);
|
|
1345
|
+
if (shouldColorDecimals) {
|
|
1346
|
+
return /* @__PURE__ */ React5.createElement(Box, { style: { position: "relative", display: "flex", flex: 1 } }, /* @__PURE__ */ React5.createElement(
|
|
1347
|
+
Box,
|
|
1348
|
+
{
|
|
1349
|
+
color: "primaryText",
|
|
1350
|
+
style: {
|
|
1351
|
+
position: "absolute",
|
|
1352
|
+
left: 0,
|
|
1353
|
+
top: 0,
|
|
1354
|
+
pointerEvents: "none",
|
|
1355
|
+
fontFamily: "inherit",
|
|
1356
|
+
fontSize: "inherit",
|
|
1357
|
+
fontWeight: "inherit",
|
|
1358
|
+
lineHeight: "inherit",
|
|
1359
|
+
whiteSpace: "nowrap",
|
|
1360
|
+
display: "flex",
|
|
1361
|
+
alignItems: "center",
|
|
1362
|
+
height: "100%"
|
|
1363
|
+
}
|
|
1364
|
+
},
|
|
1365
|
+
/* @__PURE__ */ React5.createElement("span", { style: { color: "inherit" } }, integerPart),
|
|
1366
|
+
/* @__PURE__ */ React5.createElement(DecimalSpan, { decimalsColor }, decimalPart)
|
|
1367
|
+
), inputElement);
|
|
1368
|
+
}
|
|
1369
|
+
return inputElement;
|
|
1370
|
+
};
|
|
1371
|
+
return /* @__PURE__ */ React5.createElement(
|
|
1372
|
+
Box,
|
|
1373
|
+
{
|
|
1374
|
+
color: "primaryText",
|
|
1375
|
+
display: "flex",
|
|
1376
|
+
flexDirection: "column",
|
|
1377
|
+
fontSize: "inherit",
|
|
1378
|
+
gap: "8",
|
|
1379
|
+
width: "full"
|
|
1380
|
+
},
|
|
1381
|
+
label && /* @__PURE__ */ React5.createElement(Text, { size: "inputLabel", weight: textWeight }, label),
|
|
1382
|
+
isLoading ? /* @__PURE__ */ React5.createElement(FunSkeletonBlock, { height: "44" }) : /* @__PURE__ */ React5.createElement(
|
|
1383
|
+
Box,
|
|
1384
|
+
{
|
|
1385
|
+
borderRadius,
|
|
1386
|
+
fontFamily,
|
|
1387
|
+
minWidth: "full",
|
|
1388
|
+
display: "flex",
|
|
1389
|
+
alignItems: allowMultiline ? "flex-start" : "center",
|
|
1390
|
+
color: adornmentColor,
|
|
1391
|
+
borderColor: getBorderColor(),
|
|
1392
|
+
borderWidth: overrideBorderWidth ?? "1",
|
|
1393
|
+
borderStyle: "solid",
|
|
1394
|
+
fontSize: ignoreFontSize ? "inherit" : "inputValue",
|
|
1395
|
+
fontWeight: "inputValue",
|
|
1396
|
+
className: ignoreBaseTransitions ? baseWrapperStylesNoTransition : baseWrapperStyles,
|
|
1397
|
+
background: overrideBackground || {
|
|
1398
|
+
base: "inputBackground",
|
|
1399
|
+
hover: "inputBackgroundHover"
|
|
1400
|
+
}
|
|
1401
|
+
},
|
|
1402
|
+
prefix && /* @__PURE__ */ React5.createElement(Box, { paddingLeft: "12", height: "max" }, prefix),
|
|
1403
|
+
prefixIcon === "SearchIcon" && /* @__PURE__ */ React5.createElement(
|
|
1404
|
+
Box,
|
|
1405
|
+
{
|
|
1406
|
+
display: "flex",
|
|
1407
|
+
paddingLeft: "12",
|
|
1408
|
+
height: "max",
|
|
1409
|
+
alignItems: "center",
|
|
1410
|
+
color: isFocused ? "primaryText" : "secondaryText"
|
|
1411
|
+
},
|
|
1412
|
+
/* @__PURE__ */ React5.createElement(SearchIcon, null)
|
|
1413
|
+
),
|
|
1414
|
+
prefixIcon === "$" && /* @__PURE__ */ React5.createElement(Box, { display: "flex", alignItems: "center", paddingLeft: "32" }, /* @__PURE__ */ React5.createElement(
|
|
1415
|
+
DollarTextIcon,
|
|
1416
|
+
{
|
|
1417
|
+
fontSize: inputStyle.fontSize || DEFAULT_ICON_FONT_SIZE
|
|
1418
|
+
}
|
|
1419
|
+
)),
|
|
1420
|
+
renderInputOrTextarea(),
|
|
1421
|
+
suffix && /* @__PURE__ */ React5.createElement(
|
|
1422
|
+
Box,
|
|
1423
|
+
{
|
|
1424
|
+
paddingLeft: "4",
|
|
1425
|
+
paddingRight: "10",
|
|
1426
|
+
...allowMultiline ? {
|
|
1427
|
+
style: {
|
|
1428
|
+
paddingTop: `calc(${themeVars.spacing.inputPaddingY} - 3px)`
|
|
1429
|
+
}
|
|
1430
|
+
} : {}
|
|
1431
|
+
},
|
|
1432
|
+
suffix
|
|
1433
|
+
)
|
|
1434
|
+
),
|
|
1435
|
+
error && typeof error === "string" && /* @__PURE__ */ React5.createElement(Text, { color: "error", size: "10" }, error)
|
|
1436
|
+
);
|
|
1437
|
+
});
|
|
1438
|
+
var adjustTextareaHeight = (textarea) => {
|
|
1439
|
+
if (textarea) {
|
|
1440
|
+
textarea.style.height = "auto";
|
|
1441
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
1442
|
+
}
|
|
1443
|
+
};
|
|
1444
|
+
var DollarTextIcon = ({ fontSize }) => /* @__PURE__ */ React5.createElement(
|
|
1445
|
+
Text,
|
|
1446
|
+
{
|
|
1447
|
+
style: {
|
|
1448
|
+
paddingBottom: 2,
|
|
1449
|
+
fontSize,
|
|
1450
|
+
fontWeight: 800
|
|
1451
|
+
}
|
|
1452
|
+
},
|
|
1453
|
+
"$"
|
|
1454
|
+
);
|
|
1455
|
+
var DecimalSpan = ({
|
|
1456
|
+
decimalsColor,
|
|
1457
|
+
children
|
|
1458
|
+
}) => /* @__PURE__ */ React5.createElement(
|
|
1459
|
+
Box,
|
|
1460
|
+
{
|
|
1461
|
+
color: decimalsColor,
|
|
1462
|
+
style: { fontFamily: "inherit", fontSize: "inherit" }
|
|
1463
|
+
},
|
|
1464
|
+
children
|
|
1465
|
+
);
|
|
1466
|
+
|
|
1467
|
+
export {
|
|
1468
|
+
useFunkitConfig,
|
|
1469
|
+
TooltipAnchorRefContext,
|
|
1470
|
+
FunSkeletonBlock,
|
|
1471
|
+
FunInput
|
|
1472
|
+
};
|