@funkit/connect 9.21.1-next.0 → 9.23.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +26 -18
  2. package/dist/clients/aave.d.ts +2 -0
  3. package/dist/clients/aave.js +3 -0
  4. package/dist/clients/{chunk-7HNGV6JU.js → chunk-KSSSSWR6.js} +1 -1
  5. package/dist/clients/{chunk-4HCOSF4M.js → chunk-NCCAYPLO.js} +1 -1
  6. package/dist/clients/{chunk-NCUPPJ2Z.js → chunk-OWXKWC7I.js} +8 -8
  7. package/dist/clients/{chunk-NUJ6ZM5F.js → chunk-ZMVXBMON.js} +1 -1
  8. package/dist/clients/fanatics.css +1 -1
  9. package/dist/clients/fanatics.js +3 -3
  10. package/dist/clients/lighter.css +1 -1
  11. package/dist/clients/lighter.js +3 -3
  12. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +11 -11
  13. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +5 -5
  14. package/dist/clients/polymarket/index.css +11 -11
  15. package/dist/clients/polymarket/index.js +5 -5
  16. package/dist/components/Icons/New/ArrowCircleUpRightIcon.d.ts +4 -0
  17. package/dist/domains/swapped.d.ts +10 -1
  18. package/dist/hooks/queries/useRecentCheckouts.d.ts +4 -2
  19. package/dist/hooks/queries/useRecentDeposits.d.ts +4 -9
  20. package/dist/hooks/track/CheckoutModalEvent.d.ts +1 -0
  21. package/dist/hooks/useEffectEvent.d.ts +1 -3
  22. package/dist/hooks/usePaymentMethodTabs.d.ts +5 -0
  23. package/dist/hooks/usePaymentSources.d.ts +1 -1
  24. package/dist/hooks/useTokenTransferConfig.d.ts +0 -7
  25. package/dist/index.css +11 -11
  26. package/dist/index.js +1470 -1250
  27. package/dist/interfaces/identity.d.ts +7 -0
  28. package/dist/modals/CheckoutModal/InputAmount/InputAmountLayout.d.ts +6 -1
  29. package/dist/modals/CheckoutModal/SourceChange/CryptoCashToggle.d.ts +2 -2
  30. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +31 -0
  31. package/dist/providers/FunkitConfigContext.d.ts +2 -0
  32. package/dist/providers/SwappedProvider.d.ts +2 -2
  33. package/dist/utils/checkout.d.ts +18 -20
  34. package/dist/utils/customer.d.ts +13 -1
  35. package/dist/utils/tokenTransfer/disabledList.d.ts +14 -1
  36. package/dist/utils/tokenTransfer/types.d.ts +30 -5
  37. package/dist/wallets/walletConnectors/index.js +48 -48
  38. package/package.json +2 -2
  39. package/dist/__generated__/default_configs.d.ts +0 -901
  40. package/dist/__generated__/default_feature_gates.d.ts +0 -20
  41. package/dist/chunk-6K4U3Z4Z.js +0 -375
  42. package/dist/chunk-NBECXHBY.js +0 -249
  43. package/dist/chunk-PFIXC5YK.js +0 -249
  44. package/dist/clients/chunk-25ICASD7.js +0 -2371
  45. package/dist/clients/chunk-7GWX2ZS4.js +0 -69
  46. package/dist/clients/chunk-EGMA6ATZ.js +0 -2371
  47. package/dist/clients/chunk-GGXTLJ7J.js +0 -290
  48. package/dist/clients/chunk-HRWCNZJA.js +0 -230
  49. package/dist/clients/chunk-JTGKAPID.js +0 -2382
  50. package/dist/clients/chunk-L7PABCF2.js +0 -54
  51. package/dist/clients/chunk-OJLDTEKB.js +0 -54
  52. package/dist/clients/chunk-SSSQQ32F.js +0 -186
  53. package/dist/clients/chunk-UVWNEQMD.js +0 -186
  54. package/dist/clients/chunk-YLZ7COFH.js +0 -230
  55. package/dist/clients/chunk-ZEFHAWRH.js +0 -69
  56. package/dist/clients/polymarket.d.ts +0 -161
  57. package/dist/clients/polymarket.js +0 -688
  58. package/dist/interfaces/logTransport.d.ts +0 -51
  59. package/dist/interfaces/swapped-transport.d.ts +0 -78
  60. package/dist/modals/CheckoutModal/SourceChange/EmptyFormOfPaymentsMessage.d.ts +0 -4
  61. package/dist/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.d.ts +0 -4
  62. package/dist/modals/CheckoutModal/SwappedIframe/SwappedErrorMessage.d.ts +0 -6
  63. package/dist/utils/flags/resolver.d.ts +0 -34
  64. package/dist/wallets/walletConnectors/chunk-2VP2F6EK.js +0 -70
  65. package/dist/wallets/walletConnectors/chunk-4T6ZSRJF.js +0 -69
  66. package/dist/wallets/walletConnectors/chunk-6BW3HLBG.js +0 -96
  67. package/dist/wallets/walletConnectors/chunk-CCQV2ZET.js +0 -218
  68. package/dist/wallets/walletConnectors/chunk-CPI4TD43.js +0 -99
  69. package/dist/wallets/walletConnectors/chunk-F5XEEVG6.js +0 -98
  70. package/dist/wallets/walletConnectors/chunk-HNRB7KJU.js +0 -92
  71. package/dist/wallets/walletConnectors/chunk-HTHAK6XB.js +0 -93
  72. package/dist/wallets/walletConnectors/chunk-MIQTHJ6X.js +0 -66
  73. package/dist/wallets/walletConnectors/chunk-RB3HR4R2.js +0 -95
  74. package/dist/wallets/walletConnectors/chunk-RVOY537T.js +0 -100
  75. package/dist/wallets/walletConnectors/chunk-STVVP43G.js +0 -94
  76. package/dist/wallets/walletConnectors/chunk-UK7C2JXW.js +0 -87
  77. package/dist/wallets/walletConnectors/chunk-VAPGUPHO.js +0 -92
  78. package/dist/wallets/walletConnectors/chunk-VTM6EECM.js +0 -110
  79. package/dist/wallets/walletConnectors/chunk-X6CGV36L.js +0 -103
  80. package/dist/wallets/walletConnectors/chunk-YEZM4CK4.js +0 -96
  81. package/dist/wallets/walletConnectors/chunk-ZNX4EMPB.js +0 -106
  82. /package/dist/clients/{chunk-JD3FIVZ7.js → chunk-52NKHZS2.js} +0 -0
@@ -1,2382 +0,0 @@
1
- "use client";
2
- import {
3
- usePolymarketAccountBalances
4
- } from "./chunk-MRBN4XCA.js";
5
- import {
6
- Text
7
- } from "./chunk-L7PABCF2.js";
8
- import {
9
- Box,
10
- themeVars,
11
- useFunkitTranslation
12
- } from "./chunk-7GWX2ZS4.js";
13
- import {
14
- POLYMARKET_PERPS_ROUTING_ID,
15
- POLYMARKET_PREDICTIONS_ROUTING_ID
16
- } from "./chunk-4752IYY6.js";
17
- import {
18
- POLYGON_USDCE,
19
- PUSD_TOKEN
20
- } from "./chunk-MOUTRRN3.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
- customOpacities,
282
- customSpacings,
283
- customTextTransforms,
284
- overlayBlur = "small",
285
- modalZIndex = DEFAULT_MODAL_Z_INDEX
286
- }) => ({
287
- modalZIndex: String(modalZIndex),
288
- blurs: {
289
- modalOverlay: blurs[overlayBlur].modalOverlay
290
- },
291
- dimensions: {
292
- connectExchangeIconSize: "48px",
293
- cryptoCashToggleIconSize: "20px",
294
- dollarValueSkeletonHeight: "60px",
295
- dollarValueSkeletonWidth: "160px",
296
- inputAmountQuickOptionButtonHeight: "36px",
297
- inputAmountMinHeight: "76px",
298
- modalBottomBarButtonHeight: "34px",
299
- modalTopBarHeight: "56px",
300
- modalTopbarIconSize: "16px",
301
- modalTopbarIconWrapperSize: "32px",
302
- paymentAmountSkeletonBlockHeight: "14px",
303
- paymentAmountSkeletonBlockWidth: "93px",
304
- paymentAmountSkeletonCircleSize: "15px",
305
- paymentMethodItemIconSize: "20px",
306
- selectAssetItemIconSize: "24px",
307
- sourceListGap: "4px",
308
- txBreakdownSkeletonWidth: "72px",
309
- txSummaryLineSkeletonHeight: "14px",
310
- txSummaryLineSkeletonWidth: "54px",
311
- ...customDimensions,
312
- modalBottomBarCloseButtonHeight: customDimensions?.modalBottomBarCloseButtonHeight ?? customDimensions?.modalBottomBarButtonHeight ?? "34px"
313
- },
314
- fonts: typeof customFontFamily === "string" ? {
315
- amountValue: customFontFamily,
316
- body: customFontFamily,
317
- buttonTextPrimary: customFontFamily,
318
- buttonTextSecondary: customFontFamily,
319
- buttonTextTertiary: customFontFamily,
320
- dropdownGroupHeader: customFontFamily,
321
- header: customFontFamily,
322
- inputAmount: customFontFamily,
323
- modalTopbarTitle: customFontFamily,
324
- txStatusDescription: customFontFamily,
325
- txStatusTitle: customFontFamily
326
- } : {
327
- amountValue: fontStacks[fontStack],
328
- body: fontStacks[fontStack],
329
- buttonTextPrimary: fontStacks[fontStack],
330
- buttonTextSecondary: fontStacks[fontStack],
331
- buttonTextTertiary: fontStacks[fontStack],
332
- dropdownGroupHeader: fontStacks[fontStack],
333
- header: fontStacks[fontStack],
334
- inputAmount: fontStacks[fontStack],
335
- modalTopbarTitle: fontStacks[fontStack],
336
- txStatusDescription: fontStacks[fontStack],
337
- txStatusTitle: fontStacks[fontStack],
338
- ...customFontFamily
339
- },
340
- fontWeight: {
341
- ...DEFAULT_FONT_WEIGHTS,
342
- cryptoCashToggle: DEFAULT_FONT_WEIGHTS.medium,
343
- dropdownGroupHeader: DEFAULT_FONT_WEIGHTS.medium,
344
- inputAmount: DEFAULT_FONT_WEIGHTS.medium,
345
- inputLabel: DEFAULT_FONT_WEIGHTS.medium,
346
- inputValue: DEFAULT_FONT_WEIGHTS.medium,
347
- modalTopbarTitle: DEFAULT_FONT_WEIGHTS.medium,
348
- modalBottomBarButtonText: DEFAULT_FONT_WEIGHTS.medium,
349
- paymentMethodItemSubtitle: DEFAULT_FONT_WEIGHTS.regular,
350
- paymentMethodItemTitle: DEFAULT_FONT_WEIGHTS.medium,
351
- selectAssetItemSubtitle: DEFAULT_FONT_WEIGHTS.regular,
352
- selectAssetItemTitle: DEFAULT_FONT_WEIGHTS.medium,
353
- sourceListSectionLabelFontWeight: DEFAULT_FONT_WEIGHTS.medium,
354
- txBreakdown: DEFAULT_FONT_WEIGHTS.regular,
355
- txStatusDescription: DEFAULT_FONT_WEIGHTS.regular,
356
- txStatusTitle: DEFAULT_FONT_WEIGHTS.medium,
357
- txSummaryLabel: DEFAULT_FONT_WEIGHTS.medium,
358
- txSummaryValue: DEFAULT_FONT_WEIGHTS.medium,
359
- formOfPaymentsListSectionLabelFontWeight: DEFAULT_FONT_WEIGHTS.medium,
360
- withdrawalYouWillReceiveLabel: DEFAULT_FONT_WEIGHTS.regular,
361
- withdrawalYouWillReceiveValueCrypto: DEFAULT_FONT_WEIGHTS.medium,
362
- withdrawalYouWillReceiveValueUsd: DEFAULT_FONT_WEIGHTS.regular,
363
- ...customFontWeights
364
- },
365
- fontSize: {
366
- ...FONT_SIZINGS[fontSizing],
367
- body: FONT_SIZINGS[fontSizing][14],
368
- cryptoCashToggle: FONT_SIZINGS[fontSizing][12],
369
- "header-14": { fontSize: "14px", lineHeight: "14px" },
370
- "header-36": { fontSize: "36px", lineHeight: "36px" },
371
- buttonTextPrimary: FONT_SIZINGS[fontSizing][12],
372
- buttonTextSecondary: FONT_SIZINGS[fontSizing][10],
373
- buttonTextTertiary: FONT_SIZINGS[fontSizing][12],
374
- dollarValue: FONT_SIZINGS[fontSizing][40],
375
- dropdownGroupHeader: FONT_SIZINGS[fontSizing][12],
376
- inputAmount: FONT_SIZINGS[fontSizing][57],
377
- inputLabel: customFontSizings[12] ?? FONT_SIZINGS[fontSizing][12],
378
- inputValue: customFontSizings[13] ?? FONT_SIZINGS[fontSizing][13],
379
- modalTopbarSubtitle: FONT_SIZINGS[fontSizing][10],
380
- modalTopbarTitle: FONT_SIZINGS[fontSizing][13],
381
- modalBottomBarButtonText: FONT_SIZINGS[fontSizing][12],
382
- paymentMethodItemSubtitle: FONT_SIZINGS[fontSizing][12],
383
- paymentMethodItemTitle: FONT_SIZINGS[fontSizing][12],
384
- selectAssetItemSubtitle: FONT_SIZINGS[fontSizing][10],
385
- selectAssetItemTitle: FONT_SIZINGS[fontSizing][13],
386
- txBreakdown: FONT_SIZINGS[fontSizing][12],
387
- txStatusDescription: FONT_SIZINGS[fontSizing][13],
388
- txStatusTitle: FONT_SIZINGS[fontSizing][13],
389
- txSummaryLabel: FONT_SIZINGS[fontSizing][12],
390
- txSummaryValue: FONT_SIZINGS[fontSizing][12],
391
- withdrawalYouWillReceive: customFontSizings[12] ?? FONT_SIZINGS[fontSizing][12],
392
- youPayYouReceivePrimaryFontSize: FONT_SIZINGS[fontSizing][12],
393
- youPayYouReceiveSecondaryFontSize: FONT_SIZINGS[fontSizing][10],
394
- depositAddressFontSize: FONT_SIZINGS[fontSizing][10],
395
- funFeatureListItemFontSize: FONT_SIZINGS[fontSizing][12],
396
- dropdownItemFontSize: FONT_SIZINGS[fontSizing][12],
397
- sourceListSectionLabelFontSize: FONT_SIZINGS[fontSizing][12],
398
- formOfPaymentsListSectionLabelFontSize: FONT_SIZINGS[fontSizing][12],
399
- quickOptionFontSize: FONT_SIZINGS[fontSizing][14],
400
- useConnectedFontSize: FONT_SIZINGS[fontSizing][12],
401
- paymentFeeSummaryTooltip: FONT_SIZINGS[fontSizing][10],
402
- tooltipContent: FONT_SIZINGS[fontSizing][10],
403
- ...customFontSizings
404
- },
405
- radii: {
406
- actionButton: radiusScales[borderRadius].actionButton,
407
- actionButtonInner: radiusScales[borderRadius].actionButtonInner,
408
- connectButton: radiusScales[borderRadius].connectButton,
409
- menuButton: radiusScales[borderRadius].connectButton,
410
- modal: radiusScales[borderRadius].modal,
411
- modalMobile: radiusScales[borderRadius].modalMobile,
412
- modalActionButton: radiusScales[borderRadius].modalActionButton,
413
- modalActionButtonMobile: radiusScales[borderRadius].modalActionButtonMobile,
414
- summaryBox: radiusScales[borderRadius].summaryBox,
415
- youPayYouReceive: radiusScales[borderRadius].youPayYouReceive,
416
- inputAmountSwitcher: radiusScales[borderRadius].inputAmountSwitcher,
417
- qrCode: radiusScales[borderRadius].qrCode,
418
- skeleton: radiusScales[borderRadius].skeleton,
419
- tooltip: radiusScales[borderRadius].tooltip,
420
- dropdown: radiusScales[borderRadius].dropdown,
421
- dropdownItem: radiusScales[borderRadius].dropdownItem,
422
- dropdownList: customBorderRadiuses?.dropdownList ?? customBorderRadiuses?.dropdown ?? radiusScales[borderRadius].dropdown,
423
- modalTopbarIcon: radiusScales[borderRadius].modalTopbarIcon,
424
- withdrawalInput: radiusScales[borderRadius].withdrawalInput,
425
- useConnected: radiusScales[borderRadius].useConnected,
426
- ...customBorderRadiuses
427
- },
428
- borderWidths: {
429
- activeOptionBorderWidth: "1px",
430
- buttonTertiaryBorderWidth: "0px",
431
- cryptoCashToggleContainerBorderWidth: "0px",
432
- cryptoCashToggleActiveTabBorderWidth: "1px",
433
- cryptoCashToggleInactiveTabBorderWidth: "1px",
434
- txSummaryBoxBorderWidth: "1px",
435
- ...customBorderWidths
436
- },
437
- opacities: {
438
- buttonPrimaryDisabled: "1",
439
- ...customOpacities
440
- },
441
- spacing: {
442
- confirmationStepMarginTop: "6px",
443
- confirmationStepVerticalGap: "18px",
444
- cryptoCashToggleContainerPadding: "3px",
445
- cryptoCashToggleMarginBottom: "16px",
446
- cryptoCashToggleMarginTop: "24px",
447
- cryptoCashToggleTabPaddingY: "6px",
448
- dropdownItemIconGap: "4px",
449
- dropdownItemPaddingX: "4px",
450
- dropdownItemPaddingY: "6px",
451
- dropdownCompactPaddingX: "6px",
452
- dropdownCompactPaddingY: "6px",
453
- dropdownPaddingX: "12px",
454
- dropdownPaddingY: "12px",
455
- modalBaseHorizontalPadding: "6px",
456
- modalBottomBarButtonPaddingY: "0px",
457
- modalBottomHorizontalPadding: "12px",
458
- modalPaddingBottomUpper: "16px",
459
- modalPaddingBottomLower: "16px",
460
- modalTopBarVerticalTextSpacing: "0px",
461
- selectAssetItemPaddingX: "12px",
462
- selectAssetItemPaddingY: "8px",
463
- selectAssetItemTextGap: "0px",
464
- selectBrokerageItemPaddingX: "12px",
465
- selectBrokerageItemPaddingY: "11px",
466
- selectBrokerageListGap: "0px",
467
- walletConnectorListGap: "10px",
468
- txBreakdownMarginY: "18px",
469
- txBreakdownPaddingX: "12px",
470
- txSummaryBoxPaddingX: "12px",
471
- txSummaryBoxPaddingY: "12px",
472
- txSummaryLineItemPadding: "0px",
473
- txSummaryDividerMarginX: "12px",
474
- txSummaryDividerMarginY: "12px",
475
- verticalSectionGap: "18px",
476
- withdrawalModalPaddingTop: "12px",
477
- youPayYouReceivePaddingLeft: "12px",
478
- youPayYouReceivePaddingRight: "16px",
479
- youPayYouReceivePaddingY: "8px",
480
- inputPaddingX: "12px",
481
- inputPaddingY: "12px",
482
- dropdownActiveItemRegularSizePaddingY: "8px",
483
- assetListDefaultGap: "4px",
484
- dropdownGroupDividerMarginY: "8px",
485
- ...customSpacings
486
- },
487
- textTransforms: {
488
- inputAmountQuickOptionButton: "none",
489
- txStatusTitle: "none",
490
- ...customTextTransforms
491
- }
492
- });
493
-
494
- // src/themes/darkTheme.ts
495
- var accentColors = {
496
- blue: { accentColor: "#3898FF", accentColorForeground: "#FFF" },
497
- green: { accentColor: "#66CC00", accentColorForeground: "#000" },
498
- orange: { accentColor: "#F6851B", accentColorForeground: "#000" },
499
- pink: { accentColor: "#FF7AB8", accentColorForeground: "#000" },
500
- purple: { accentColor: "#7A70FF", accentColorForeground: "#FFF" },
501
- red: { accentColor: "#F34126", accentColorForeground: "#FFF" },
502
- white: { accentColor: "#FFF", accentColorForeground: "#000" }
503
- };
504
- var defaultAccentColor = accentColors.white;
505
- var darkTheme = ({
506
- accentColor = defaultAccentColor.accentColor,
507
- accentColorForeground = defaultAccentColor.accentColorForeground,
508
- customColors,
509
- customShadows,
510
- ...baseThemeOptions
511
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: just a bunch of ?? defaults
512
- } = {}) => ({
513
- ...baseTheme(baseThemeOptions),
514
- colors: {
515
- accentColor,
516
- accentColorForeground,
517
- actionButtonBorder: "rgba(255, 255, 255, 0.04)",
518
- connectButtonBackground: "#000",
519
- connectButtonBackgroundError: "#C60000",
520
- connectButtonText: "#FFF",
521
- connectButtonTextError: "#FFF",
522
- connectionIndicator: "#30E000",
523
- error: accentColors.red.accentColor,
524
- errorBackground: "#F2E6E4",
525
- errorBorder: "rgba(243, 65, 38, 0.2)",
526
- generalBorder: "#292929",
527
- // strokeColor in figma
528
- generalBorderDim: "rgba(255, 255, 255, 0.04)",
529
- menuItemBackground: "rgba(255, 255, 255, 0.03)",
530
- selectedOptionBorder: "rgba(224, 232, 255, 0.1)",
531
- focusedOptionBorder: "#8C8C8C",
532
- standby: "#F6851B",
533
- success: "#66CC00",
534
- delayedStatusIcon: customColors?.secondaryText ?? "#8C8C8C",
535
- // backward compatibility
536
- chainIconBorder: "#fff",
537
- // FUNKIT COLORS
538
- // modal backgrounds
539
- modalBackdrop: "rgba(0, 0, 0, 0.2)",
540
- modalBackground: "#000000",
541
- modalBorder: "#292929",
542
- modalTopbarIcon: "#FFF",
543
- modalTopbarIconBackground: customColors?.modalTopbarIconBackground ?? "transparent",
544
- modalTopbarIconBackgroundHover: customColors?.modalTopbarIconBackgroundHover ?? customColors?.buttonIconBackgroundHover ?? "#333333",
545
- modalTopbarIconBackgroundPressed: customColors?.modalTopbarIconBackgroundPressed ?? customColors?.buttonIconBackgroundPressed ?? "#333333",
546
- modalTopbarIconStroke: customColors?.modalTopbarIconStroke ?? customColors?.buttonIconStroke ?? "rgba(255, 255, 255, 0.35)",
547
- offBackground: "#1F1F1F",
548
- offBackgroundInverse: "#F2F2F2",
549
- hoverState: "#333333",
550
- lightStroke: "#333333",
551
- mediumStroke: "#333333",
552
- heavyStroke: "rgba(117, 117, 117, 0.40)",
553
- strokeColor: "#333333",
554
- secondaryBackground: "#333333",
555
- //Text
556
- primaryText: "#FFF",
557
- secondaryText: "#8C8C8C",
558
- tertiaryText: "rgba(255, 255, 255, 0.35)",
559
- textSelection: "rgba(255, 255, 255, 0.10)",
560
- selectedDropdownItemText: customColors?.primaryText ?? "#FFF",
561
- copyButtonBackgroundBase: customColors?.offBackground ?? "#1F1F1F",
562
- copyButtonBackgroundHover: customColors?.hoverState ?? "#333333",
563
- copyButtonBackgroundActive: customColors?.inputBorderHover ?? "#525252",
564
- useConnectedBackgroundBase: customColors?.mediumStroke ?? "#333333",
565
- useConnectedBackgroundHover: customColors?.mediumStroke ?? "#333333",
566
- copyButtonBorderBase: customColors?.mediumStroke ?? "#333333",
567
- copyButtonBorderHover: customColors?.mediumStroke ?? "#333333",
568
- funFeatureListBackgroundBase: customColors?.offBackground ?? "#1F1F1F",
569
- funFeatureListBackgroundHover: customColors?.hoverState ?? "#333333",
570
- funFeatureListBorderColor: "transparent",
571
- funFeatureListBorderColorHover: "transparent",
572
- selectedDropdownItemBackground: "transparent",
573
- alwaysVisibleLabelBackgroundHover: "transparent",
574
- // input
575
- inputLabel: customColors?.primaryText ?? "#FFF",
576
- inputBackground: "#000000",
577
- inputBackgroundHover: customColors?.offBackground ?? "#1F1F1F",
578
- inputBorderBase: "#333333",
579
- inputBorderHover: "#525252",
580
- // tab
581
- activeTabBorderColor: "#333333",
582
- activeTabBackground: "#333333",
583
- inactiveTabBorderColor: "transparent",
584
- inactiveTabBackgroundBase: "transparent",
585
- inactiveTabBackgroundHover: "transparent",
586
- inactiveTabBackgroundActive: "transparent",
587
- activeTabText: customColors?.primaryText ?? "#FFF",
588
- inactiveTabTextBase: customColors?.secondaryText ?? "#8C8C8C",
589
- inactiveTabHover: customColors?.primaryText ?? "#FFF",
590
- // button
591
- actionColor: "#FFF",
592
- actionColorHover: "rgba(255, 255, 255, 0.8)",
593
- actionColorDisabled: "rgba(255, 255, 255, 0.65)",
594
- buttonPrimary: accentColor,
595
- buttonDisabled: "rgba(255, 255, 255, 0.20)",
596
- buttonTextPrimary: "#000000",
597
- buttonTextHover: "#000000",
598
- buttonTextDisabled: "#000000",
599
- buttonWarning: accentColors.red.accentColor,
600
- buttonSuccess: "#2EA200",
601
- transparent: "transparent",
602
- buttonBackgroundTertiary: "#333333",
603
- buttonBackgroundHoverTertiary: "#333333",
604
- buttonBackgroundDisabledTertiary: "transparent",
605
- buttonTextTertiary: "#FFF",
606
- buttonTextDisabledTertiary: "rgba(255, 255, 255, 0.65)",
607
- buttonBackground: "#FFF",
608
- buttonBackgroundHover: "#f2f2f2",
609
- buttonBackgroundPressed: "#FFF",
610
- buttonBackgroundDisabled: "rgba(255, 255, 255, 0.65)",
611
- buttonTextSecondaryDisabled: "rgba(255, 255, 255, 0.65)",
612
- buttonTextSecondary: "#FFFFFF",
613
- buttonIconBackgroundHover: "#333333",
614
- buttonIconBackgroundPressed: "#333333",
615
- buttonIconStroke: "rgba(255, 255, 255, 0.35)",
616
- buttonBorderTertiary: "transparent",
617
- buttonBorderFocusedTertiary: "rgba(255, 255, 255, 0.35)",
618
- buttonFocusedOutline: "none",
619
- buttonBorderGradient: "none",
620
- buttonHoverBorderGradient: "none",
621
- buttonDisabledBorderGradient: "none",
622
- // TODO: Make common colors when refactoring the design system
623
- inputAmountQuickOptionBaseBackground: "#1F1F1F",
624
- inputAmountQuickOptionHoverBackground: "#333333",
625
- inputAmountQuickOptionActiveBackground: "#333333",
626
- inputAmountQuickOptionDisabledBackground: "#333333",
627
- inputAmountQuickOptionBaseBorder: "#f2f2f2",
628
- inputAmountQuickOptionHoverBorder: "rgba(255, 255, 255, 0.35)",
629
- inputAmountQuickOptionActiveBorder: "rgba(255, 255, 255, 0.35)",
630
- inputAmountQuickOptionFocusedBorder: "rgba(255, 255, 255, 0.35)",
631
- inputAmountFiatDecimalsColor: customColors?.inputAmountFiatDecimalsColor ?? "none",
632
- youPayYouReceiveBackground: "#000000",
633
- // modalBackground
634
- youPayYouReceiveBorder: "#333333",
635
- // mediumStroke
636
- youPayYouReceivePrimaryText: "#FFF",
637
- // primaryText
638
- youPayYouReceiveSecondaryText: "#8C8C8C",
639
- // secondaryText
640
- withdrawalYouWillReceiveLabel: customColors?.withdrawalYouWillReceiveLabel ?? customColors?.primaryText ?? "#FFF",
641
- withdrawalYouWillReceiveValueCrypto: customColors?.withdrawalYouWillReceiveValueCrypto ?? customColors?.primaryText ?? "#FFF",
642
- withdrawalYouWillReceiveValueUsd: customColors?.withdrawalYouWillReceiveValueUsd ?? customColors?.secondaryText ?? "#8C8C8C",
643
- // badges
644
- badgeBackgroundSuccess: "rgba(124, 242, 136, 0.1)",
645
- badgeBorderSuccess: "rgba(124, 242, 136, 0.2)",
646
- badgeTextSuccess: "rgb(124, 242, 136)",
647
- newBadgeBackground: "linear-gradient(180deg, rgba(57, 76, 56, 0.55) 0%, rgba(61, 81, 65, 0.55) 100%)",
648
- newBadgeBorder: "rgba(122, 221, 122, 0.3)",
649
- newBadgeText: "#A4FF9A",
650
- approvedBadgeBackground: "linear-gradient(180deg, rgba(236, 255, 234, 0.20) 0%, rgba(228, 255, 233, 0.20) 100%)",
651
- approvedBadgeBorder: "rgba(109, 216, 109, 0.08)",
652
- approvedBadgeText: "#8FFFA9",
653
- failedBadgeBackground: "rgba(255, 61, 61, 0.18)",
654
- failedBadgeBorder: "rgba(255, 255, 255, 0.10)",
655
- failedBadgeText: "#F88877",
656
- announceGradientFrom: "#AAAAAA",
657
- announceGradientTo: "#BEBEBE",
658
- fiatPendingGradientFrom: "#AAAAAA",
659
- fiatPendingGradientTo: "#BEBEBE",
660
- fiatSuccessBackgroundFill: "rgba(102, 204, 0, 0.30)",
661
- fiatFailedBackgroundFill: "rgba(255, 61, 61, 0.30)",
662
- fiatStatusIconBorder: "rgba(255, 255, 255, 0.06)",
663
- fiatAccountIconFill: "#002F5E",
664
- fiatAccountGradientFrom: "#3A82FE",
665
- fiatAccountGradientTo: "#73A7FF",
666
- modalHeaderDivider: "#333333",
667
- // lightStroke
668
- modalFooterDivider: "#333333",
669
- // lightStroke
670
- spinnerBackground: customColors?.mediumStroke ?? "rgba(0, 0, 0, 0.3)",
671
- // 30% buttonTextPrimary
672
- spinnerIndicator: customColors?.primaryText ?? "#000",
673
- // 100% buttonTextPrimary
674
- spinnerBackgroundVerifyAccount: "rgba(0, 0, 0, 0.3)",
675
- // 30% buttonTextPrimary
676
- spinnerIndicatorVerifyAccount: customColors?.primaryText ?? "#000",
677
- // 100% buttonTextPrimary
678
- // Override colors
679
- ...customColors || {},
680
- // option Boxes
681
- optionBoxBackground: customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#000",
682
- // keeps gradient in SourcePaymentMethodItem if optionBoxBackground differs from modal background
683
- optionBoxBorderedBackground: customColors?.optionBoxBorderedBackground ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#000",
684
- optionBoxBackgroundUninteractive: customColors?.optionBoxBackgroundUninteractive ?? "transparent",
685
- optionBoxBorderBase: customColors?.optionBoxBorderBase ?? customColors?.mediumStroke ?? "#333333",
686
- optionBoxBorderHover: customColors?.optionBoxBorderHover ?? customColors?.mediumStroke ?? "#333333",
687
- optionBoxDefaultModeNotActiveBorderBase: customColors?.optionBoxDefaultModeNotActiveBorderBase ?? "transparent",
688
- optionBoxDefaultModeNotActiveBorderHover: customColors?.optionBoxDefaultModeNotActiveBorderHover ?? "transparent",
689
- dropdownActiveItemBackgroundBase: customColors?.dropdownActiveItemBackgroundBase ?? customColors?.modalBackground ?? "#000000",
690
- openDropdownBackgroundColor: customColors?.openDropdownBackgroundColor ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#000",
691
- dropdownActiveItemBackgroundHover: customColors?.dropdownActiveItemBackgroundHover ?? customColors?.offBackground ?? "#1F1F1F",
692
- dropdownActiveItemBackgroundDisabled: customColors?.dropdownActiveItemBackgroundDisabled ?? "transparent",
693
- dropdownActiveItemBorderBase: customColors?.dropdownActiveItemBorderBase ?? customColors?.mediumStroke ?? "#333333",
694
- dropdownActiveItemBorderHover: customColors?.dropdownActiveItemBorderHover ?? customColors?.mediumStroke ?? "#333333",
695
- dropdownGroupHeader: customColors?.dropdownGroupHeader ?? customColors?.primaryText ?? "#FFF",
696
- // primaryText
697
- txSummaryBoxBackground: customColors?.txSummaryBoxBackground ?? customColors?.modalBackground ?? "#000",
698
- txSummaryBoxBorder: customColors?.txSummaryBoxBorder ?? customColors?.lightStroke ?? "#333333",
699
- modalBackgroundCheckoutComplete: customColors?.modalBackgroundCheckoutComplete ?? customColors?.modalBackground ?? "#000",
700
- counterRingColor: customColors?.counterRingColor ?? accentColor,
701
- cryptoCashToggleContainerBorderColor: customColors?.cryptoCashToggleContainerBorderColor ?? "transparent",
702
- cryptoCashToggleBackground: customColors?.cryptoCashToggleBackground ?? "transparent",
703
- qrCodeBackground: customColors?.qrCodeBackground ?? customColors?.modalBackground ?? "#000000",
704
- qrCodeForeground: customColors?.qrCodeForeground ?? customColors?.primaryText ?? "#FFFFFF"
705
- },
706
- shadows: {
707
- connectButton: "0px 4px 12px rgba(0, 0, 0, 0.1)",
708
- dialog: "0px 8px 32px rgba(0, 0, 0, 0.32)",
709
- selectedOption: "0px 2px 6px rgba(0, 0, 0, 0.24)",
710
- selectedWallet: "0px 2px 6px rgba(0, 0, 0, 0.24)",
711
- 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)",
712
- 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)",
713
- qrCode: "0px 0px 0px 1px rgba(255, 255, 255, 0.16)",
714
- buttonShadow: "none",
715
- buttonShadowTertiary: "none",
716
- buttonHoverShadow: "none",
717
- buttonHoverShadowTertiary: "none",
718
- buttonFocusedShadow: "0px 0px 0px 2px rgba(255, 255, 255, 0.25)",
719
- buttonFocusedShadowTertiary: "0px 0px 0px 2px rgba(255, 255, 255, 0.25)",
720
- buttonDisabledShadow: "none",
721
- buttonDisabledShadowTertiary: "none",
722
- buttonInnerShadow: "none",
723
- buttonInnerShadowTertiary: customShadows?.buttonInnerShadow ?? "none",
724
- buttonFocusedInnerShadow: "none",
725
- buttonFocusedInnerShadowTertiary: customShadows?.buttonFocusedInnerShadow ?? "none",
726
- buttonHoverInnerShadow: "none",
727
- buttonHoverInnerShadowTertiary: customShadows?.buttonHoverInnerShadow ?? "none",
728
- buttonDisabledInnerShadow: "none",
729
- buttonDisabledInnerShadowTertiary: customShadows?.buttonDisabledInnerShadow ?? "none",
730
- selectedDropdownItem: "none",
731
- // Override shadows
732
- ...customShadows || {}
733
- },
734
- moonpayTheme: "dark"
735
- });
736
- darkTheme.accentColors = accentColors;
737
-
738
- // src/themes/lightTheme.ts
739
- var accentColors2 = {
740
- blue: { accentColor: "#31A3F8", accentColorForeground: "#31A3F859" },
741
- green: { accentColor: "#66CC00", accentColorForeground: "#FFF" },
742
- orange: { accentColor: "#F6851B", accentColorForeground: "#FFF" },
743
- pink: { accentColor: "#FF5CA0", accentColorForeground: "#FFF" },
744
- purple: { accentColor: "#5F5AFA", accentColorForeground: "#FFF" },
745
- red: { accentColor: "#F34126", accentColorForeground: "#FFF" },
746
- white: { accentColor: "#000000", accentColorForeground: "#FFF" }
747
- };
748
- var defaultAccentColor2 = accentColors2.white;
749
- var lightTheme = ({
750
- accentColor = defaultAccentColor2.accentColor,
751
- accentColorForeground = defaultAccentColor2.accentColorForeground,
752
- customColors,
753
- customShadows,
754
- ...baseThemeOptions
755
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: just a bunch of ?? defaults
756
- } = {}) => ({
757
- ...baseTheme(baseThemeOptions),
758
- colors: {
759
- accentColor,
760
- accentColorForeground,
761
- actionButtonBorder: "rgba(0, 0, 0, 0.04)",
762
- connectButtonBackground: "#FFF",
763
- connectButtonBackgroundError: "#C60000",
764
- connectButtonText: "#25292E",
765
- connectButtonTextError: "#FFF",
766
- connectionIndicator: "#30E000",
767
- error: accentColors2.red.accentColor,
768
- errorBackground: "#F2E6E4",
769
- errorBorder: "rgba(243, 65, 38, 0.2)",
770
- generalBorder: "#F7F7F7",
771
- // strokeColor in figma
772
- generalBorderDim: "rgba(0, 0, 0, 0.03)",
773
- menuItemBackground: "#FCFCFC",
774
- selectedOptionBorder: "#F7F7F7",
775
- focusedOptionBorder: "#737373",
776
- standby: "#F6851B",
777
- success: "#66CC00",
778
- delayedStatusIcon: customColors?.secondaryText ?? "#737373",
779
- // backward compatibility
780
- chainIconBorder: "#fff",
781
- // FUNKIT COLORS
782
- // modal backgrounds
783
- modalBackdrop: "rgba(0, 0, 0, 0.2)",
784
- modalTopbarIcon: "#000",
785
- modalTopbarIconBackground: customColors?.modalTopbarIconBackground ?? "transparent",
786
- modalTopbarIconBackgroundHover: customColors?.modalTopbarIconBackgroundHover ?? customColors?.buttonIconBackgroundHover ?? "#F7F7F7",
787
- modalTopbarIconBackgroundPressed: customColors?.modalTopbarIconBackgroundPressed ?? customColors?.buttonIconBackgroundPressed ?? "#F0F0F0",
788
- modalTopbarIconStroke: customColors?.modalTopbarIconStroke ?? customColors?.buttonIconStroke ?? "rgba(0, 0, 0, 0.35)",
789
- modalBackground: "#FFF",
790
- modalBorder: "#F7F7F7",
791
- offBackground: "#F7F7F7",
792
- offBackgroundInverse: "#333333",
793
- hoverState: "#F0F0F0",
794
- lightStroke: "#F7F7F7",
795
- mediumStroke: "#F0F0F0",
796
- heavyStroke: "#E5E5E5",
797
- strokeColor: "#E8E8E8",
798
- secondaryBackground: "#F7F7F7",
799
- //Text
800
- primaryText: "#000",
801
- secondaryText: "#737373",
802
- tertiaryText: "rgba(0, 0, 0, 0.35)",
803
- textSelection: "rgba(0, 0, 0, 0.10)",
804
- selectedDropdownItemText: customColors?.primaryText ?? "#000",
805
- copyButtonBackgroundBase: customColors?.offBackground ?? "#F7F7F7",
806
- copyButtonBackgroundHover: customColors?.hoverState ?? "#F0F0F0",
807
- copyButtonBackgroundActive: customColors?.inputBorderHover ?? "#E5E5E5",
808
- useConnectedBackgroundBase: customColors?.mediumStroke ?? "#F0F0F0",
809
- useConnectedBackgroundHover: customColors?.mediumStroke ?? "#F0F0F0",
810
- copyButtonBorderBase: customColors?.mediumStroke ?? "#F0F0F0",
811
- copyButtonBorderHover: customColors?.mediumStroke ?? "#F0F0F0",
812
- funFeatureListBackgroundBase: customColors?.offBackground ?? "#F7F7F7",
813
- funFeatureListBackgroundHover: customColors?.hoverState ?? "#F0F0F0",
814
- funFeatureListBorderColor: "transparent",
815
- funFeatureListBorderColorHover: "transparent",
816
- selectedDropdownItemBackground: "transparent",
817
- alwaysVisibleLabelBackgroundHover: "transparent",
818
- // input
819
- inputLabel: customColors?.primaryText ?? "#000",
820
- inputBackground: "#FFFFFF",
821
- inputBackgroundHover: customColors?.offBackground ?? "#F7F7F7",
822
- inputBorderBase: "#F0F0F0",
823
- inputBorderHover: "#E5E5E5",
824
- // tab
825
- activeTabBorderColor: "#F7F7F7",
826
- activeTabBackground: "#F7F7F7",
827
- inactiveTabBorderColor: "transparent",
828
- inactiveTabBackgroundBase: "transparent",
829
- inactiveTabBackgroundHover: "transparent",
830
- inactiveTabBackgroundActive: "transparent",
831
- activeTabText: customColors?.primaryText ?? "#000",
832
- inactiveTabTextBase: customColors?.secondaryText ?? "#737373",
833
- inactiveTabHover: customColors?.primaryText ?? "#000",
834
- // button
835
- actionColor: "#000",
836
- actionColorHover: "rgba(0, 0, 0, 0.7)",
837
- actionColorDisabled: "rgba(0, 0, 0, 0.50)",
838
- buttonPrimary: accentColor,
839
- buttonDisabled: "#31A3F826",
840
- buttonWarning: accentColors2.red.accentColor,
841
- buttonSuccess: "#2EA200",
842
- buttonTextPrimary: "#FFFFFF",
843
- buttonTextHover: "#FFF",
844
- buttonTextDisabled: "#FFF",
845
- transparent: "transparent",
846
- buttonBackgroundTertiary: "#F7F7F7",
847
- buttonBackgroundHoverTertiary: "#F0F0F0",
848
- buttonBackgroundDisabledTertiary: "transparent",
849
- buttonTextTertiary: "#000",
850
- buttonTextDisabledTertiary: "rgba(0, 0, 0, 0.5)",
851
- buttonBackground: "#000",
852
- buttonBackgroundHover: "#333333",
853
- buttonBackgroundPressed: "#000",
854
- buttonBackgroundDisabled: "rgba(0, 0, 0, 0.5)",
855
- buttonTextSecondaryDisabled: "rgba(0, 0, 0, 0.5)",
856
- buttonTextSecondary: "#000000",
857
- buttonIconBackgroundHover: "#F7F7F7",
858
- buttonIconBackgroundPressed: "#F0F0F0",
859
- buttonIconStroke: "rgba(0, 0, 0, 0.35)",
860
- buttonBorderTertiary: "transparent",
861
- buttonBorderFocusedTertiary: "rgba(0, 0, 0, 0.35)",
862
- buttonFocusedOutline: "none",
863
- buttonBorderGradient: "none",
864
- buttonHoverBorderGradient: "none",
865
- buttonDisabledBorderGradient: "none",
866
- // TODO: Make common colors when refactoring the design system
867
- inputAmountQuickOptionBaseBackground: "#F7F7F7",
868
- inputAmountQuickOptionHoverBackground: "#F0F0F0",
869
- inputAmountQuickOptionActiveBackground: "#F0F0F0",
870
- inputAmountQuickOptionDisabledBackground: "#F7F7F7",
871
- inputAmountQuickOptionBaseBorder: "#F7F7F7",
872
- inputAmountQuickOptionHoverBorder: "rgba(0, 0, 0, 0.35)",
873
- inputAmountQuickOptionActiveBorder: "rgba(0, 0, 0, 0.35)",
874
- inputAmountQuickOptionFocusedBorder: "rgba(0, 0, 0, 0.35)",
875
- inputAmountFiatDecimalsColor: customColors?.inputAmountFiatDecimalsColor ?? "none",
876
- youPayYouReceiveBackground: "#FFF",
877
- // modalBackground
878
- youPayYouReceiveBorder: "#F0F0F0",
879
- // mediumStroke
880
- youPayYouReceivePrimaryText: "#000",
881
- // primaryText
882
- youPayYouReceiveSecondaryText: "#737373",
883
- // secondaryText
884
- withdrawalYouWillReceiveLabel: customColors?.withdrawalYouWillReceiveLabel ?? customColors?.primaryText ?? "#000",
885
- withdrawalYouWillReceiveValueCrypto: customColors?.withdrawalYouWillReceiveValueCrypto ?? customColors?.primaryText ?? "#000",
886
- withdrawalYouWillReceiveValueUsd: customColors?.withdrawalYouWillReceiveValueUsd ?? customColors?.secondaryText ?? "#737373",
887
- // badges
888
- badgeBackgroundSuccess: "rgba(124, 242, 136, 0.1)",
889
- badgeBorderSuccess: "rgba(124, 242, 136, 0.2)",
890
- badgeTextSuccess: "rgb(124, 242, 136)",
891
- newBadgeBackground: "linear-gradient(180deg, #ECFFEA 0%, #E4FFE9 100%)",
892
- newBadgeBorder: "rgba(122, 221, 122, 0.5)",
893
- newBadgeText: "#028320",
894
- approvedBadgeBackground: "linear-gradient(180deg, #ECFFEA 0%, #E4FFE9 100%)",
895
- approvedBadgeBorder: "rgba(109, 216, 109, 0.5)",
896
- approvedBadgeText: "#028320",
897
- failedBadgeBackground: "rgba(255, 61, 61, 0.08)",
898
- failedBadgeBorder: "rgba(0, 0, 0, 0.03)",
899
- failedBadgeText: "#C2341E",
900
- announceGradientFrom: "#595959",
901
- announceGradientTo: "#9C9C9C",
902
- fiatPendingGradientFrom: "#454545",
903
- fiatPendingGradientTo: "#747474",
904
- fiatSuccessBackgroundFill: "rgba(102, 204, 0, 0.16)",
905
- fiatFailedBackgroundFill: "rgba(255, 61, 61, 0.12)",
906
- fiatStatusIconBorder: "rgba(0, 0, 0, 0.03)",
907
- fiatAccountIconFill: "#E7F3FE",
908
- fiatAccountGradientFrom: "#055DF5",
909
- fiatAccountGradientTo: "#4C8DFD",
910
- modalHeaderDivider: "#F7F7F7",
911
- // lightStroke
912
- modalFooterDivider: "#F7F7F7",
913
- // lightStroke
914
- spinnerBackground: customColors?.mediumStroke ?? "rgba(255, 255, 255, 0.3)",
915
- // 30% buttonTextPrimary
916
- spinnerIndicator: customColors?.primaryText ?? "#FFF",
917
- // 100% buttonTextPrimary
918
- spinnerBackgroundVerifyAccount: "rgba(255, 255, 255, 0.3)",
919
- // 30% buttonTextPrimary
920
- spinnerIndicatorVerifyAccount: customColors?.primaryText ?? "#FFF",
921
- // 100% buttonTextPrimary
922
- // Override colors
923
- ...customColors || {},
924
- // option Boxes
925
- optionBoxBackground: customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#FFF",
926
- // keeps gradient in SourcePaymentMethodItem if optionBoxBackground differs from modal background
927
- optionBoxBorderedBackground: customColors?.optionBoxBorderedBackground ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#FFF",
928
- optionBoxBackgroundUninteractive: customColors?.optionBoxBackgroundUninteractive ?? "transparent",
929
- optionBoxBorderBase: customColors?.optionBoxBorderBase ?? customColors?.mediumStroke ?? "#F0F0F0",
930
- optionBoxBorderHover: customColors?.optionBoxBorderHover ?? customColors?.mediumStroke ?? "#F0F0F0",
931
- optionBoxDefaultModeNotActiveBorderBase: customColors?.optionBoxDefaultModeNotActiveBorderBase ?? "transparent",
932
- optionBoxDefaultModeNotActiveBorderHover: customColors?.optionBoxDefaultModeNotActiveBorderHover ?? "transparent",
933
- dropdownActiveItemBackgroundBase: customColors?.dropdownActiveItemBackgroundBase ?? customColors?.modalBackground ?? "#FFF",
934
- openDropdownBackgroundColor: customColors?.openDropdownBackgroundColor ?? customColors?.optionBoxBackground ?? customColors?.modalBackground ?? "#FFF",
935
- dropdownActiveItemBackgroundHover: customColors?.dropdownActiveItemBackgroundHover ?? customColors?.offBackground ?? "#F7F7F7",
936
- dropdownActiveItemBackgroundDisabled: customColors?.dropdownActiveItemBackgroundDisabled ?? "transparent",
937
- dropdownActiveItemBorderBase: customColors?.dropdownActiveItemBorderBase ?? customColors?.mediumStroke ?? "#F0F0F0",
938
- dropdownActiveItemBorderHover: customColors?.dropdownActiveItemBorderHover ?? customColors?.mediumStroke ?? "#F0F0F0",
939
- dropdownGroupHeader: customColors?.dropdownGroupHeader ?? customColors?.primaryText ?? "#000",
940
- // primaryText
941
- txSummaryBoxBackground: customColors?.txSummaryBoxBackground ?? customColors?.modalBackground ?? "#FFF",
942
- txSummaryBoxBorder: customColors?.txSummaryBoxBorder ?? customColors?.lightStroke ?? "#F7F7F7",
943
- modalBackgroundCheckoutComplete: customColors?.modalBackgroundCheckoutComplete ?? customColors?.modalBackground ?? "#FFF",
944
- counterRingColor: customColors?.counterRingColor ?? accentColor,
945
- cryptoCashToggleContainerBorderColor: customColors?.cryptoCashToggleContainerBorderColor ?? "transparent",
946
- cryptoCashToggleBackground: customColors?.cryptoCashToggleBackground ?? "transparent",
947
- qrCodeBackground: customColors?.qrCodeBackground ?? customColors?.modalBackground ?? "#FFF",
948
- qrCodeForeground: customColors?.qrCodeForeground ?? customColors?.primaryText ?? "#000"
949
- },
950
- shadows: {
951
- connectButton: "0px 4px 12px rgba(0, 0, 0, 0.1)",
952
- dialog: "0px 8px 32px rgba(0, 0, 0, 0.32)",
953
- selectedOption: "0px 2px 6px rgba(0, 0, 0, 0.24)",
954
- selectedWallet: "0px 2px 6px rgba(0, 0, 0, 0.12)",
955
- 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)",
956
- 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)",
957
- 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)",
958
- buttonShadow: "none",
959
- buttonShadowTertiary: customShadows?.buttonShadow ?? "none",
960
- buttonFocusedShadow: "0px 0px 0px 2px rgba(0, 0, 0, 0.25)",
961
- buttonFocusedShadowTertiary: "0px 0px 0px 2px rgba(0, 0, 0, 0.25)",
962
- buttonHoverShadow: "none",
963
- buttonHoverShadowTertiary: "none",
964
- buttonDisabledShadow: "none",
965
- buttonDisabledShadowTertiary: customShadows?.buttonDisabledShadow ?? "none",
966
- buttonInnerShadow: "none",
967
- buttonInnerShadowTertiary: customShadows?.buttonInnerShadow ?? "none",
968
- buttonFocusedInnerShadow: "none",
969
- buttonFocusedInnerShadowTertiary: customShadows?.buttonFocusedInnerShadow ?? "none",
970
- buttonHoverInnerShadow: "none",
971
- buttonHoverInnerShadowTertiary: customShadows?.buttonHoverInnerShadow ?? "none",
972
- buttonDisabledInnerShadow: "none",
973
- buttonDisabledInnerShadowTertiary: customShadows?.buttonDisabledInnerShadow ?? "none",
974
- selectedDropdownItem: "none",
975
- // Override shadows
976
- ...customShadows || {}
977
- },
978
- moonpayTheme: "light"
979
- });
980
- lightTheme.accentColors = accentColors2;
981
-
982
- // src/providers/FunkitThemeProvider.tsx
983
- var DEFAULT_THEME_SET = {
984
- lightTheme: lightTheme(),
985
- darkTheme: darkTheme()
986
- };
987
- var DEFAULT_THEME = DEFAULT_THEME_SET.darkTheme;
988
- var ThemeIdContext = createContext2(void 0);
989
- var ThemeContext = createContext2({
990
- activeTheme: DEFAULT_THEME,
991
- lightTheme: void 0,
992
- darkTheme: void 0,
993
- setTheme: () => {
994
- return;
995
- },
996
- toggleTheme: () => {
997
- return;
998
- },
999
- themeColorScheme: void 0
1000
- });
1001
- var useActiveTheme = () => {
1002
- const {
1003
- activeTheme,
1004
- setTheme,
1005
- lightTheme: lightTheme2,
1006
- darkTheme: darkTheme2,
1007
- toggleTheme,
1008
- themeColorScheme
1009
- } = useContext2(ThemeContext);
1010
- return {
1011
- activeTheme,
1012
- /** 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` */
1013
- setTheme,
1014
- /** 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 */
1015
- lightTheme: lightTheme2,
1016
- /** 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 */
1017
- darkTheme: darkTheme2,
1018
- /** 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 */
1019
- toggleTheme,
1020
- /** 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 */
1021
- themeColorScheme
1022
- };
1023
- };
1024
-
1025
- // src/components/FunSkeletonLoader/FunSkeletonLoader.css.ts
1026
- var animateSkeletonClass = "FunSkeletonLoader_animateSkeletonClass__dj0x602 sprinkles_background_inputBorderHover_base__1rsrm2f15a";
1027
-
1028
- // src/components/FunSkeletonLoader/FunSkeletonBlock.tsx
1029
- function FunSkeletonBlock({
1030
- borderRadius = "skeleton",
1031
- fontSize,
1032
- height,
1033
- width = "full",
1034
- ...props
1035
- }) {
1036
- const { activeTheme } = useActiveTheme();
1037
- const cssHeight = height ? activeTheme.dimensions[height] || (height.endsWith("px") ? height : `${height}px`) : activeTheme.fontSize[fontSize].lineHeight;
1038
- return /* @__PURE__ */ React3.createElement(
1039
- Box,
1040
- {
1041
- borderRadius,
1042
- className: animateSkeletonClass,
1043
- width,
1044
- ...props,
1045
- style: { height: cssHeight, ...props.style }
1046
- }
1047
- );
1048
- }
1049
-
1050
- // src/components/FunInput/FunInput.css.ts
1051
- var baseWrapperStyles = "FunInput_baseWrapperStyles__zue0i60";
1052
- var baseWrapperStylesNoTransition = "FunInput_baseWrapperStylesNoTransition__zue0i61";
1053
- 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";
1054
- 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";
1055
- 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";
1056
- 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";
1057
- 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";
1058
- 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";
1059
- var numberInputResetStyle = "FunInput_numberInputResetStyle__zue0i62";
1060
-
1061
- // src/components/FunInput/FunInput.tsx
1062
- import React5, {
1063
- forwardRef,
1064
- useEffect as useEffect3,
1065
- useState as useState4
1066
- } from "react";
1067
- import clsx from "clsx";
1068
-
1069
- // src/components/Icons/SearchIcon.tsx
1070
- import React4 from "react";
1071
- var SearchIcon = () => {
1072
- return /* @__PURE__ */ React4.createElement(
1073
- "svg",
1074
- {
1075
- width: "15",
1076
- height: "15",
1077
- viewBox: "0 0 15 15",
1078
- fill: "none",
1079
- xmlns: "http://www.w3.org/2000/svg"
1080
- },
1081
- /* @__PURE__ */ React4.createElement(
1082
- "path",
1083
- {
1084
- 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",
1085
- fill: "currentColor"
1086
- }
1087
- ),
1088
- /* @__PURE__ */ React4.createElement(
1089
- "path",
1090
- {
1091
- 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",
1092
- fill: "currentColor"
1093
- }
1094
- )
1095
- );
1096
- };
1097
-
1098
- // src/components/FunInput/FunInput.tsx
1099
- var DEFAULT_ICON_FONT_SIZE = "57px";
1100
- var FunInput = forwardRef(function FunInputWithRef({
1101
- prefix,
1102
- suffix,
1103
- prefixIcon,
1104
- placeholder,
1105
- value,
1106
- label,
1107
- onChange,
1108
- onKeyDown,
1109
- onKeySubmit,
1110
- onPaste,
1111
- onMouseDown,
1112
- onFocus: userOnFocus,
1113
- onBlur: userOnBlur,
1114
- adornmentColor = "secondaryText",
1115
- fontFamily = "body",
1116
- textWeight = "inputLabel",
1117
- inputStyle = {},
1118
- inputProps = { type: "text" },
1119
- error,
1120
- alwaysFocused,
1121
- overrideBorderWidth,
1122
- overrideBackground,
1123
- ignoreFontSize,
1124
- borderRadius = "connectButton",
1125
- isLoading = false,
1126
- allowMultiline = false,
1127
- ignoreBaseTransitions = false,
1128
- decimalsColor,
1129
- decimalSeparator,
1130
- testId
1131
- }, ref) {
1132
- const { activeTheme } = useActiveTheme();
1133
- const [focused, setFocused] = useState4(false);
1134
- const onFocus = () => {
1135
- setFocused(true);
1136
- userOnFocus?.();
1137
- };
1138
- const onBlur = () => {
1139
- setFocused(false);
1140
- userOnBlur?.();
1141
- };
1142
- const isFocused = alwaysFocused || focused;
1143
- const isValidDecimalColor = !!decimalsColor && activeTheme.colors?.[decimalsColor] !== "none";
1144
- const getBorderColor = () => {
1145
- if (error) {
1146
- return { base: "error" };
1147
- }
1148
- if (inputProps.disabled) {
1149
- return { base: "inputBorderBase" };
1150
- }
1151
- if (isFocused) {
1152
- return { base: "secondaryText" };
1153
- }
1154
- return {
1155
- base: "inputBorderBase",
1156
- hover: "inputBorderHover"
1157
- };
1158
- };
1159
- const textareaRef = React5.useRef(null);
1160
- useEffect3(() => {
1161
- if (allowMultiline) {
1162
- adjustTextareaHeight(textareaRef.current);
1163
- }
1164
- }, [allowMultiline, value]);
1165
- const { integerPart, decimalPart, shouldColorDecimals } = React5.useMemo(() => {
1166
- if (!isValidDecimalColor || !value || !decimalSeparator) {
1167
- return { integerPart: "", decimalPart: "", shouldColorDecimals: false };
1168
- }
1169
- const stringValue = String(value);
1170
- const parts = stringValue.split(decimalSeparator);
1171
- return {
1172
- integerPart: parts[0] || "",
1173
- decimalPart: parts[1] !== void 0 ? `${decimalSeparator}${parts[1]}` : "",
1174
- shouldColorDecimals: parts[1] !== void 0
1175
- };
1176
- }, [value, isValidDecimalColor, decimalSeparator]);
1177
- const renderInputOrTextarea = () => {
1178
- const commonProps = {
1179
- // ref,
1180
- value,
1181
- placeholder,
1182
- onChange,
1183
- onKeyDown: (e) => {
1184
- e.stopPropagation();
1185
- onKeyDown?.(e);
1186
- if (e.key === "Enter") {
1187
- onKeySubmit?.();
1188
- }
1189
- },
1190
- onPaste,
1191
- onMouseDown,
1192
- onFocus,
1193
- onBlur,
1194
- onWheel: (e) => {
1195
- e.currentTarget.blur();
1196
- },
1197
- className: clsx(
1198
- error ? ignoreBaseTransitions ? inputClassErrorNoTransition : inputClassError : inputProps.disabled ? ignoreBaseTransitions ? inputClassDisabledNoTransition : inputClassDisabled : ignoreBaseTransitions ? inputClassNoTransition : inputClass,
1199
- numberInputResetStyle
1200
- ),
1201
- ...inputProps,
1202
- // If decimals are colored, the actual input element is hidden
1203
- // but keep the caret visible via caretColor
1204
- style: {
1205
- ...inputStyle,
1206
- color: shouldColorDecimals ? "transparent" : void 0,
1207
- caretColor: isValidDecimalColor ? themeVars.colors.primaryText : void 0
1208
- },
1209
- "data-auto-focus": inputProps.autoFocus,
1210
- "data-testid": testId ? `rk-${testId.replace(/^rk-/, "")}` : void 0
1211
- };
1212
- const handleTextareaOnChange = (e) => {
1213
- adjustTextareaHeight(textareaRef.current);
1214
- if (onChange) {
1215
- onChange(e);
1216
- }
1217
- };
1218
- const handleTextAreaOnPaste = (e) => {
1219
- adjustTextareaHeight(textareaRef.current);
1220
- if (onPaste) {
1221
- onPaste(e);
1222
- }
1223
- };
1224
- const inputElement = allowMultiline ? /* @__PURE__ */ React5.createElement(
1225
- "textarea",
1226
- {
1227
- ...commonProps,
1228
- ref: (el) => {
1229
- textareaRef.current = el;
1230
- if (typeof ref === "function") {
1231
- ref(el);
1232
- } else if (ref && typeof ref === "object" && "current" in ref) {
1233
- ref.current = el;
1234
- }
1235
- },
1236
- rows: 1,
1237
- style: {
1238
- ...commonProps.style,
1239
- resize: "none",
1240
- boxSizing: "border-box"
1241
- },
1242
- onChange: handleTextareaOnChange,
1243
- onPaste: handleTextAreaOnPaste
1244
- }
1245
- ) : /* @__PURE__ */ React5.createElement(
1246
- "input",
1247
- {
1248
- ...commonProps,
1249
- ref: (el) => {
1250
- if (typeof ref === "function") {
1251
- ref(el);
1252
- } else if (ref && typeof ref === "object" && "current" in ref) {
1253
- ref.current = el;
1254
- }
1255
- },
1256
- type: inputProps?.type || "text"
1257
- }
1258
- );
1259
- if (shouldColorDecimals) {
1260
- return /* @__PURE__ */ React5.createElement(Box, { style: { position: "relative", display: "flex", flex: 1 } }, /* @__PURE__ */ React5.createElement(
1261
- Box,
1262
- {
1263
- color: "primaryText",
1264
- style: {
1265
- position: "absolute",
1266
- left: 0,
1267
- top: 0,
1268
- pointerEvents: "none",
1269
- fontFamily: "inherit",
1270
- fontSize: "inherit",
1271
- fontWeight: "inherit",
1272
- lineHeight: "inherit",
1273
- whiteSpace: "nowrap",
1274
- display: "flex",
1275
- alignItems: "center",
1276
- height: "100%"
1277
- }
1278
- },
1279
- /* @__PURE__ */ React5.createElement("span", { style: { color: "inherit" } }, integerPart),
1280
- /* @__PURE__ */ React5.createElement(DecimalSpan, { decimalsColor }, decimalPart)
1281
- ), inputElement);
1282
- }
1283
- return inputElement;
1284
- };
1285
- return /* @__PURE__ */ React5.createElement(
1286
- Box,
1287
- {
1288
- color: "primaryText",
1289
- display: "flex",
1290
- flexDirection: "column",
1291
- fontSize: "inherit",
1292
- gap: "8",
1293
- width: "full"
1294
- },
1295
- label && /* @__PURE__ */ React5.createElement(Text, { size: "inputLabel", weight: textWeight }, label),
1296
- isLoading ? /* @__PURE__ */ React5.createElement(FunSkeletonBlock, { height: "44" }) : /* @__PURE__ */ React5.createElement(
1297
- Box,
1298
- {
1299
- borderRadius,
1300
- fontFamily,
1301
- minWidth: "full",
1302
- display: "flex",
1303
- alignItems: allowMultiline ? "flex-start" : "center",
1304
- color: adornmentColor,
1305
- borderColor: getBorderColor(),
1306
- borderWidth: overrideBorderWidth ?? "1",
1307
- borderStyle: "solid",
1308
- fontSize: ignoreFontSize ? "inherit" : "inputValue",
1309
- fontWeight: "inputValue",
1310
- className: ignoreBaseTransitions ? baseWrapperStylesNoTransition : baseWrapperStyles,
1311
- background: overrideBackground || {
1312
- base: "inputBackground",
1313
- hover: "inputBackgroundHover"
1314
- }
1315
- },
1316
- prefix && /* @__PURE__ */ React5.createElement(Box, { paddingLeft: "12", height: "max" }, prefix),
1317
- prefixIcon === "SearchIcon" && /* @__PURE__ */ React5.createElement(
1318
- Box,
1319
- {
1320
- display: "flex",
1321
- paddingLeft: "12",
1322
- height: "max",
1323
- alignItems: "center",
1324
- color: isFocused ? "primaryText" : "secondaryText"
1325
- },
1326
- /* @__PURE__ */ React5.createElement(SearchIcon, null)
1327
- ),
1328
- prefixIcon === "$" && /* @__PURE__ */ React5.createElement(Box, { display: "flex", alignItems: "center", paddingLeft: "32" }, /* @__PURE__ */ React5.createElement(
1329
- DollarTextIcon,
1330
- {
1331
- fontSize: inputStyle.fontSize || DEFAULT_ICON_FONT_SIZE
1332
- }
1333
- )),
1334
- renderInputOrTextarea(),
1335
- suffix && /* @__PURE__ */ React5.createElement(
1336
- Box,
1337
- {
1338
- paddingLeft: "4",
1339
- paddingRight: "10",
1340
- ...allowMultiline ? {
1341
- style: {
1342
- paddingTop: `calc(${themeVars.spacing.inputPaddingY} - 3px)`
1343
- }
1344
- } : {}
1345
- },
1346
- suffix
1347
- )
1348
- ),
1349
- error && typeof error === "string" && /* @__PURE__ */ React5.createElement(Text, { color: "error", size: "10" }, error)
1350
- );
1351
- });
1352
- var adjustTextareaHeight = (textarea) => {
1353
- if (textarea) {
1354
- textarea.style.height = "auto";
1355
- textarea.style.height = `${textarea.scrollHeight}px`;
1356
- }
1357
- };
1358
- var DollarTextIcon = ({ fontSize }) => /* @__PURE__ */ React5.createElement(
1359
- Text,
1360
- {
1361
- style: {
1362
- paddingBottom: 2,
1363
- fontSize,
1364
- fontWeight: 800
1365
- }
1366
- },
1367
- "$"
1368
- );
1369
- var DecimalSpan = ({
1370
- decimalsColor,
1371
- children
1372
- }) => /* @__PURE__ */ React5.createElement(
1373
- Box,
1374
- {
1375
- color: decimalsColor,
1376
- style: { fontFamily: "inherit", fontSize: "inherit" }
1377
- },
1378
- children
1379
- );
1380
-
1381
- // src/utils/tokenMath.ts
1382
- import { formatCurrencyAndStringify } from "@funkit/utils";
1383
- import * as dnum from "dnum";
1384
- import { formatUnits } from "viem";
1385
- function floorToDecimals(value, decimals) {
1386
- const d = dnum.from(value, decimals);
1387
- return dnum.toNumber(d, decimals);
1388
- }
1389
- function formatUsdFlooredToCent(balanceUsd) {
1390
- return formatCurrencyAndStringify(floorToDecimals(balanceUsd, 2));
1391
- }
1392
-
1393
- // src/components/Icons/CheckIcon.tsx
1394
- import React6 from "react";
1395
- var CheckIcon = ({
1396
- size = 16,
1397
- className
1398
- }) => /* @__PURE__ */ React6.createElement(
1399
- "svg",
1400
- {
1401
- width: size,
1402
- height: size,
1403
- viewBox: "0 0 16 16",
1404
- fill: "none",
1405
- xmlns: "http://www.w3.org/2000/svg",
1406
- className
1407
- },
1408
- /* @__PURE__ */ React6.createElement(
1409
- "path",
1410
- {
1411
- d: "M12.4919 4.88281L6.25757 11.1172L3.50781 8",
1412
- stroke: "currentColor",
1413
- strokeWidth: "1.5",
1414
- strokeLinecap: "round",
1415
- strokeLinejoin: "round",
1416
- pathLength: "100"
1417
- }
1418
- )
1419
- );
1420
-
1421
- // src/components/Dropdown/BaseDropdownItem.tsx
1422
- import { noop } from "@funkit/utils";
1423
- import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
1424
- import React7 from "react";
1425
- import clsx2 from "clsx";
1426
-
1427
- // src/components/Dropdown/BaseDropdownItem.css.ts
1428
- var disabledDropdownItemStyles = "BaseDropdownItem_disabledDropdownItemStyles__18hhw3k3 BaseDropdownItem__18hhw3k2";
1429
- var enabledDropdownItemStyles = "BaseDropdownItem_enabledDropdownItemStyles__18hhw3k1 BaseDropdownItem__18hhw3k0";
1430
-
1431
- // src/components/Dropdown/BaseDropdownItem.tsx
1432
- function BaseDropdownItem({
1433
- iconComponent,
1434
- label,
1435
- description,
1436
- id,
1437
- onClick = noop,
1438
- isSelected = false,
1439
- isDisabled = false,
1440
- borderRadius = "connectButton",
1441
- horizontalIconGap = "dropdownItemIconGap",
1442
- tagComponent,
1443
- horizontalPadding = "dropdownItemPaddingX",
1444
- verticalPadding = "dropdownItemPaddingY"
1445
- }) {
1446
- return /* @__PURE__ */ React7.createElement(
1447
- DropdownMenu.Item,
1448
- {
1449
- disabled: isDisabled,
1450
- onSelect: () => onClick(id),
1451
- asChild: true
1452
- },
1453
- /* @__PURE__ */ React7.createElement(
1454
- Box,
1455
- {
1456
- width: "full",
1457
- display: "flex",
1458
- alignItems: "center",
1459
- justifyContent: "space-between",
1460
- gap: "24",
1461
- paddingY: verticalPadding,
1462
- paddingX: horizontalPadding,
1463
- className: clsx2(
1464
- isDisabled ? disabledDropdownItemStyles : enabledDropdownItemStyles
1465
- ),
1466
- boxShadow: isSelected ? "selectedDropdownItem" : void 0,
1467
- borderRadius
1468
- },
1469
- /* @__PURE__ */ React7.createElement(
1470
- Box,
1471
- {
1472
- display: "flex",
1473
- alignItems: "center",
1474
- justifyContent: "flex-start",
1475
- gap: horizontalIconGap
1476
- },
1477
- iconComponent && /* @__PURE__ */ React7.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "center" }, iconComponent),
1478
- /* @__PURE__ */ React7.createElement(Box, { display: "flex", flexDirection: "column", justifyContent: "center" }, /* @__PURE__ */ React7.createElement(
1479
- Text,
1480
- {
1481
- size: "dropdownItemFontSize",
1482
- weight: "medium",
1483
- color: isSelected ? "selectedDropdownItemText" : void 0
1484
- },
1485
- label
1486
- ), description != null && /* @__PURE__ */ React7.createElement(Text, { size: "12", color: "secondaryText" }, description))
1487
- ),
1488
- /* @__PURE__ */ React7.createElement(
1489
- Box,
1490
- {
1491
- display: "flex",
1492
- alignItems: "center",
1493
- justifyContent: "center",
1494
- gap: "16"
1495
- },
1496
- tagComponent,
1497
- /* @__PURE__ */ React7.createElement(
1498
- Box,
1499
- {
1500
- width: "16",
1501
- height: "16",
1502
- alignItems: "center",
1503
- justifyContent: "center",
1504
- color: isSelected ? "selectedDropdownItemText" : "transparent"
1505
- },
1506
- /* @__PURE__ */ React7.createElement(CheckIcon, null)
1507
- )
1508
- )
1509
- )
1510
- );
1511
- }
1512
- var BaseDropdownItem_default = BaseDropdownItem;
1513
-
1514
- // src/components/Icons/CaretDownIcon.tsx
1515
- import clsx3 from "clsx";
1516
- import React8 from "react";
1517
-
1518
- // src/components/Icons/CaretDownIcon.css.ts
1519
- var caretClosed = "CaretDownIcon_caretClosed__1gjdf1i3";
1520
- var caretOpened = "CaretDownIcon_caretOpened__1gjdf1i2";
1521
-
1522
- // src/components/Icons/CaretDownIcon.tsx
1523
- var CaretDownIcon = () => {
1524
- return /* @__PURE__ */ React8.createElement(
1525
- "svg",
1526
- {
1527
- width: "8",
1528
- height: "5",
1529
- viewBox: "0 0 8 5",
1530
- fill: "none",
1531
- xmlns: "http://www.w3.org/2000/svg"
1532
- },
1533
- /* @__PURE__ */ React8.createElement(
1534
- "path",
1535
- {
1536
- 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",
1537
- fill: "currentColor"
1538
- }
1539
- )
1540
- );
1541
- };
1542
- var AnimatedCaretDownIcon = ({
1543
- expanded,
1544
- color = "primaryText",
1545
- compact = false
1546
- }) => {
1547
- const animationClassName = clsx3(
1548
- expanded !== void 0 && (expanded ? caretOpened : caretClosed)
1549
- );
1550
- if (compact) {
1551
- return /* @__PURE__ */ React8.createElement(
1552
- Box,
1553
- {
1554
- color,
1555
- width: "8",
1556
- height: "8",
1557
- display: "flex",
1558
- alignItems: "center",
1559
- justifyContent: "center",
1560
- className: animationClassName
1561
- },
1562
- /* @__PURE__ */ React8.createElement(CaretDownIcon, null)
1563
- );
1564
- }
1565
- return /* @__PURE__ */ React8.createElement(
1566
- Box,
1567
- {
1568
- color,
1569
- width: "16",
1570
- height: "16",
1571
- display: "flex",
1572
- alignItems: "center",
1573
- justifyContent: "center",
1574
- className: animationClassName
1575
- },
1576
- /* @__PURE__ */ React8.createElement(
1577
- Box,
1578
- {
1579
- width: "8",
1580
- height: "8",
1581
- display: "flex",
1582
- alignItems: "center",
1583
- justifyContent: "center"
1584
- },
1585
- /* @__PURE__ */ React8.createElement(CaretDownIcon, null)
1586
- )
1587
- );
1588
- };
1589
-
1590
- // src/components/FunNoResults/FunNoResults.tsx
1591
- import React11 from "react";
1592
-
1593
- // src/components/Icons/CoinsIcon.tsx
1594
- import React9 from "react";
1595
- var CoinsIcon = ({
1596
- size = 48,
1597
- bgColor = "#141C41",
1598
- iconColor = "#878A98"
1599
- }) => {
1600
- return /* @__PURE__ */ React9.createElement(
1601
- "svg",
1602
- {
1603
- width: size,
1604
- height: size,
1605
- viewBox: "0 0 48 49",
1606
- fill: "none",
1607
- xmlns: "http://www.w3.org/2000/svg"
1608
- },
1609
- /* @__PURE__ */ React9.createElement("g", { clipPath: "url(#clip0_30657_22302)" }, /* @__PURE__ */ React9.createElement(
1610
- "path",
1611
- {
1612
- 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",
1613
- fill: bgColor,
1614
- stroke: bgColor
1615
- }
1616
- ), /* @__PURE__ */ React9.createElement("g", { clipPath: "url(#clip1_30657_22302)" }, /* @__PURE__ */ React9.createElement(
1617
- "path",
1618
- {
1619
- 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",
1620
- stroke: iconColor,
1621
- strokeWidth: "1.5",
1622
- strokeLinecap: "round",
1623
- strokeLinejoin: "round"
1624
- }
1625
- ))),
1626
- /* @__PURE__ */ React9.createElement("defs", null, /* @__PURE__ */ React9.createElement("clipPath", { id: "clip0_30657_22302" }, /* @__PURE__ */ React9.createElement(
1627
- "rect",
1628
- {
1629
- width: "48",
1630
- height: "48",
1631
- fill: "white",
1632
- transform: "translate(0 0.5)"
1633
- }
1634
- )), /* @__PURE__ */ React9.createElement("clipPath", { id: "clip1_30657_22302" }, /* @__PURE__ */ React9.createElement(
1635
- "rect",
1636
- {
1637
- width: "24",
1638
- height: "24",
1639
- fill: "white",
1640
- transform: "translate(12 12)"
1641
- }
1642
- )))
1643
- );
1644
- };
1645
-
1646
- // src/components/Icons/SearchSkeletonIcon.tsx
1647
- import React10 from "react";
1648
- var SearchSkeletonIcon = () => {
1649
- return /* @__PURE__ */ React10.createElement(
1650
- "svg",
1651
- {
1652
- width: "122",
1653
- height: "81",
1654
- viewBox: "0 0 122 81",
1655
- fill: "none",
1656
- xmlns: "http://www.w3.org/2000/svg"
1657
- },
1658
- /* @__PURE__ */ React10.createElement("g", { clipPath: "url(#clip0_7590_15835)" }, /* @__PURE__ */ React10.createElement(
1659
- "path",
1660
- {
1661
- fillRule: "evenodd",
1662
- clipRule: "evenodd",
1663
- 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",
1664
- fill: "currentColor"
1665
- }
1666
- ), /* @__PURE__ */ React10.createElement(
1667
- "path",
1668
- {
1669
- 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",
1670
- fill: "currentColor"
1671
- }
1672
- ), /* @__PURE__ */ React10.createElement(
1673
- "path",
1674
- {
1675
- 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",
1676
- fill: "currentColor"
1677
- }
1678
- ), /* @__PURE__ */ React10.createElement(
1679
- "path",
1680
- {
1681
- 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",
1682
- fill: "currentColor"
1683
- }
1684
- )),
1685
- /* @__PURE__ */ React10.createElement("defs", null, /* @__PURE__ */ React10.createElement("clipPath", { id: "clip0_7590_15835" }, /* @__PURE__ */ React10.createElement(
1686
- "rect",
1687
- {
1688
- width: "121",
1689
- height: "81",
1690
- fill: "white",
1691
- transform: "translate(0.5)"
1692
- }
1693
- )))
1694
- );
1695
- };
1696
-
1697
- // src/components/FunNoResults/FunNoResults.tsx
1698
- var FunNoResults = ({
1699
- text,
1700
- title,
1701
- variant = "default",
1702
- actionButton
1703
- }) => {
1704
- return /* @__PURE__ */ React11.createElement(
1705
- Box,
1706
- {
1707
- display: "flex",
1708
- flexDirection: "column",
1709
- justifyContent: "center",
1710
- alignItems: "center",
1711
- gap: variant === "default" ? "12" : "16",
1712
- color: "secondaryText",
1713
- style: { flex: 1 }
1714
- },
1715
- variant === "default" && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(SearchSkeletonIcon, null), /* @__PURE__ */ React11.createElement(Text, { color: "secondaryText", size: "10" }, text)),
1716
- variant === "actionable" && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
1717
- CoinsIcon,
1718
- {
1719
- bgColor: themeVars.colors.offBackground,
1720
- iconColor: themeVars.colors.actionColor
1721
- }
1722
- ), /* @__PURE__ */ React11.createElement(
1723
- Box,
1724
- {
1725
- display: "flex",
1726
- flexDirection: "column",
1727
- alignItems: "center",
1728
- gap: "12"
1729
- },
1730
- /* @__PURE__ */ React11.createElement(
1731
- Box,
1732
- {
1733
- display: "flex",
1734
- flexDirection: "column",
1735
- alignItems: "center",
1736
- textAlign: "center",
1737
- gap: "8"
1738
- },
1739
- title && /* @__PURE__ */ React11.createElement(Text, { size: "14", color: "primaryText" }, title),
1740
- /* @__PURE__ */ React11.createElement(Text, { color: "secondaryText", size: "12" }, text)
1741
- ),
1742
- actionButton && /* @__PURE__ */ React11.createElement(Box, null, actionButton)
1743
- ))
1744
- );
1745
- };
1746
-
1747
- // src/components/Icons/SwitchIcon.tsx
1748
- import React12 from "react";
1749
- var SwitchIcon = () => {
1750
- return /* @__PURE__ */ React12.createElement(
1751
- "svg",
1752
- {
1753
- width: "15",
1754
- height: "14",
1755
- viewBox: "0 0 15 14",
1756
- fill: "none",
1757
- xmlns: "http://www.w3.org/2000/svg"
1758
- },
1759
- /* @__PURE__ */ React12.createElement(
1760
- "path",
1761
- {
1762
- fillRule: "evenodd",
1763
- clipRule: "evenodd",
1764
- 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",
1765
- fill: "currentColor"
1766
- }
1767
- )
1768
- );
1769
- };
1770
-
1771
- // src/components/Dropdown/BaseDropdown.css.ts
1772
- var BORDER_RADIUS = "dropdown";
1773
- var baseDropdownItemWrapperStyles = "BaseDropdown_baseDropdownItemWrapperStyles__1nns6ys3 sprinkles_borderRadius_dropdownItem__1rsrm2f17";
1774
- var scrollGradientWrapperStyles = "BaseDropdown_scrollGradientWrapperStyles__1nns6ys1";
1775
- var scrollableDropdownStyles = "BaseDropdown_scrollableDropdownStyles__1nns6ys0";
1776
-
1777
- // src/providers/FunkitProvider.tsx
1778
- var ThemeIdContext2 = createContext3(void 0);
1779
- var attr = "data-rk";
1780
- var createThemeRootProps = (id) => ({ [attr]: id || "" });
1781
- var useThemeRootProps = () => {
1782
- const id = useContext3(ThemeIdContext2);
1783
- return createThemeRootProps(id);
1784
- };
1785
-
1786
- // src/components/Dropdown/BaseActiveDropdownItem.tsx
1787
- import React14 from "react";
1788
-
1789
- // src/components/Dropdown/BaseActiveDropdownItem.css.ts
1790
- var baseStyles = "BaseActiveDropdownItem_baseStyles__1dewiqw0";
1791
-
1792
- // src/components/Dropdown/BaseActiveDropdownItem.tsx
1793
- function BaseActiveDropdownItem({
1794
- iconComponent,
1795
- label,
1796
- isOpened,
1797
- onClick,
1798
- horizontalIconGap = "dropdownItemIconGap",
1799
- alwaysVisibleLabel,
1800
- tagComponent,
1801
- tagPosition = "start",
1802
- size = "regular",
1803
- color = "primaryText",
1804
- arrowColor = "secondaryText",
1805
- background,
1806
- labelStyle,
1807
- compactIcon = false
1808
- }) {
1809
- return /* @__PURE__ */ React14.createElement(
1810
- Box,
1811
- {
1812
- display: "flex",
1813
- alignItems: "center",
1814
- justifyContent: "space-between",
1815
- gap: "6",
1816
- cursor: "pointer",
1817
- onClick,
1818
- background: background ?? {
1819
- base: "dropdownActiveItemBackgroundBase",
1820
- hover: "dropdownActiveItemBackgroundHover"
1821
- },
1822
- borderColor: {
1823
- base: "dropdownActiveItemBorderBase",
1824
- hover: "dropdownActiveItemBorderHover"
1825
- },
1826
- borderWidth: size === "compact" ? "0" : "1",
1827
- borderRadius: BORDER_RADIUS,
1828
- borderStyle: "solid",
1829
- paddingY: size === "compact" ? "2" : size === "large" ? "10" : "dropdownActiveItemRegularSizePaddingY",
1830
- paddingX: size === "compact" ? "4" : size === "large" ? "8" : "dropdownPaddingX",
1831
- className: baseStyles
1832
- },
1833
- /* @__PURE__ */ React14.createElement(
1834
- Box,
1835
- {
1836
- display: "flex",
1837
- alignItems: "center",
1838
- justifyContent: "space-between",
1839
- gap: horizontalIconGap,
1840
- style: size === "compact" ? void 0 : { flex: "1 0 auto" }
1841
- },
1842
- alwaysVisibleLabel && /* @__PURE__ */ React14.createElement(Box, { style: { flex: 1 } }, /* @__PURE__ */ React14.createElement(Text, { color: "secondaryText", size: "12" }, alwaysVisibleLabel)),
1843
- /* @__PURE__ */ React14.createElement(
1844
- Box,
1845
- {
1846
- display: "flex",
1847
- alignItems: "center",
1848
- justifyContent: "space-between",
1849
- gap: horizontalIconGap,
1850
- background: {
1851
- base: "transparent",
1852
- hover: "alwaysVisibleLabelBackgroundHover"
1853
- },
1854
- ...alwaysVisibleLabel ? {} : { style: { flex: 1 } }
1855
- },
1856
- /* @__PURE__ */ React14.createElement(
1857
- Box,
1858
- {
1859
- display: "flex",
1860
- alignItems: "center",
1861
- justifyContent: "center",
1862
- gap: horizontalIconGap,
1863
- ...alwaysVisibleLabel ? { style: { flexDirection: "row-reverse" } } : {}
1864
- },
1865
- tagPosition === "start" && tagComponent,
1866
- /* @__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(
1867
- Text,
1868
- {
1869
- color,
1870
- size: "dropdownItemFontSize",
1871
- weight: "medium",
1872
- style: labelStyle
1873
- },
1874
- label
1875
- ))
1876
- ),
1877
- /* @__PURE__ */ React14.createElement(Box, { display: "flex", alignItems: "center", gap: "5" }, tagPosition === "end" && tagComponent, /* @__PURE__ */ React14.createElement(
1878
- AnimatedCaretDownIcon,
1879
- {
1880
- expanded: isOpened,
1881
- color: arrowColor,
1882
- compact: compactIcon
1883
- }
1884
- ))
1885
- )
1886
- )
1887
- );
1888
- }
1889
- var BaseActiveDropdownItem_default = BaseActiveDropdownItem;
1890
-
1891
- // src/components/Dropdown/BaseDropdown.utils.ts
1892
- var NO_SELECTION_VALUE = "";
1893
- var ADDITIONAL_GROUP_KEY = "__additional__";
1894
- function buildAllOptions(options, allowUnselect, unselectLabel) {
1895
- if (allowUnselect) {
1896
- return [
1897
- {
1898
- label: unselectLabel ?? "",
1899
- value: NO_SELECTION_VALUE
1900
- },
1901
- ...options
1902
- ];
1903
- }
1904
- return options;
1905
- }
1906
- function filterOptions(allOptions, searchInput) {
1907
- const search = searchInput?.trim().toLowerCase() ?? "";
1908
- return allOptions.filter(
1909
- (option) => option.label.toLowerCase().includes(search)
1910
- );
1911
- }
1912
- function organizeDropdownGroups(filteredOptions, groups, additionalGroup, additionalGroupLabel) {
1913
- const organizedGroups = [];
1914
- if (!groups) {
1915
- organizedGroups.push({
1916
- key: ADDITIONAL_GROUP_KEY,
1917
- label: void 0,
1918
- options: filteredOptions
1919
- });
1920
- return {
1921
- organizedGroups,
1922
- organizedOptions: filteredOptions
1923
- };
1924
- }
1925
- const unselectOption = filteredOptions.find(
1926
- (option) => option.value === NO_SELECTION_VALUE
1927
- );
1928
- if (unselectOption) {
1929
- organizedGroups.push({
1930
- key: NO_SELECTION_VALUE,
1931
- label: void 0,
1932
- options: [unselectOption]
1933
- });
1934
- }
1935
- const optionsByValue = new Map(
1936
- filteredOptions.filter((option) => option.value !== NO_SELECTION_VALUE).map((option) => [option.value, option])
1937
- );
1938
- const inflatedGroups = groups.map((group) => ({
1939
- ...group,
1940
- // Only take the options that actually exist
1941
- // Note that this preserves the ordering of `group.values`
1942
- options: group.values.map((value) => optionsByValue.get(value)).filter((option) => !!option)
1943
- })).filter((group) => group.options.length > 0);
1944
- const hasNonEmptyGroup = inflatedGroups.length > 0;
1945
- for (const group of inflatedGroups) {
1946
- organizedGroups.push({
1947
- key: group.key,
1948
- label: group.label,
1949
- options: group.options
1950
- });
1951
- if (additionalGroup === "others") {
1952
- for (const option of group.options) {
1953
- optionsByValue.delete(option.value);
1954
- }
1955
- }
1956
- }
1957
- if (optionsByValue.size > 0) {
1958
- organizedGroups.push({
1959
- key: ADDITIONAL_GROUP_KEY,
1960
- // Only show additional group label if there actually are other groups
1961
- label: hasNonEmptyGroup ? additionalGroupLabel : void 0,
1962
- options: [...optionsByValue.values()]
1963
- });
1964
- }
1965
- const organizedOptions = organizedGroups.flatMap((group) => group.options);
1966
- return { organizedGroups, organizedOptions };
1967
- }
1968
-
1969
- // src/components/Dropdown/BaseDropdown.tsx
1970
- var HORIZONTAL_ICON_GAP = "4";
1971
- var activeDropdownItemSize = {
1972
- compact: "18",
1973
- regular: "36",
1974
- large: "40"
1975
- };
1976
- function BaseDropdown({
1977
- activeItemProps,
1978
- value,
1979
- options,
1980
- groups,
1981
- additionalGroup = "others",
1982
- additionalGroupLabel,
1983
- allowUnselect = false,
1984
- unselectLabel,
1985
- onOptionSelected,
1986
- onOpen,
1987
- renderDropdownOption,
1988
- searchableOptions = false,
1989
- searchPlaceholder,
1990
- placeholder,
1991
- resetSearchOnClose = true,
1992
- openToTopOnMobile = true,
1993
- alwaysOpenToTop = false,
1994
- openDropdownFullWidth = true,
1995
- isLoading = false,
1996
- preloadIconUrls,
1997
- horizontalIconGap = HORIZONTAL_ICON_GAP,
1998
- openDropdownBackgroundColor = "openDropdownBackgroundColor",
1999
- size = "regular",
2000
- label,
2001
- maxDropdownHeight,
2002
- dropdownWidth,
2003
- dropdownAlign = "end",
2004
- testId
2005
- }) {
2006
- const { t } = useFunkitTranslation();
2007
- const themeRootProps = useThemeRootProps();
2008
- const isMobileDevice = isMobile();
2009
- const [isOpened, setIsOpened] = useState5(false);
2010
- const [searchInput, setSearchInput] = useState5("");
2011
- const { ref: scrollRef, hasTopDivider, isAtBottom } = useScrollDivider();
2012
- const allOptions = useMemo2(
2013
- () => buildAllOptions(options, allowUnselect, unselectLabel),
2014
- [options, allowUnselect, unselectLabel]
2015
- );
2016
- const selectedOption = allOptions.find((option) => option.value === value);
2017
- const prevIsOpenedRef = useRef2(false);
2018
- const portalThemeRef = useRef2(null);
2019
- const handleSearch = (event) => {
2020
- setSearchInput(event.target.value);
2021
- };
2022
- const filteredOptions = useMemo2(
2023
- () => filterOptions(allOptions, searchInput),
2024
- [allOptions, searchInput]
2025
- );
2026
- const { organizedGroups, organizedOptions } = useMemo2(
2027
- () => organizeDropdownGroups(
2028
- filteredOptions,
2029
- groups,
2030
- additionalGroup,
2031
- additionalGroupLabel
2032
- ),
2033
- [additionalGroup, additionalGroupLabel, filteredOptions, groups]
2034
- );
2035
- const handleOpenChange = useCallback2(
2036
- (open) => {
2037
- setIsOpened(open);
2038
- if (open) {
2039
- onOpen?.();
2040
- } else {
2041
- resetSearchOnClose && setSearchInput("");
2042
- }
2043
- },
2044
- [onOpen, resetSearchOnClose]
2045
- );
2046
- useEffect5(() => {
2047
- if (isOpened && !prevIsOpenedRef.current) {
2048
- prevIsOpenedRef.current = true;
2049
- if (selectedOption) {
2050
- const selectedOptionIndex = organizedOptions.findIndex(
2051
- (option) => option.value === selectedOption.value
2052
- );
2053
- if (selectedOptionIndex !== -1) {
2054
- requestAnimationFrame(() => {
2055
- const selectedOptionElement = document.getElementById(
2056
- `${selectedOption.value}-dropdown-item`
2057
- );
2058
- selectedOptionElement?.scrollIntoView({
2059
- behavior: "instant",
2060
- block: "center"
2061
- });
2062
- });
2063
- }
2064
- }
2065
- } else if (!isOpened) {
2066
- prevIsOpenedRef.current = false;
2067
- }
2068
- }, [isOpened, selectedOption, organizedOptions]);
2069
- const dropdownSide = alwaysOpenToTop || openToTopOnMobile && isMobileDevice ? "top" : "bottom";
2070
- 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(
2071
- DropdownMenu2.Root,
2072
- {
2073
- open: isOpened,
2074
- onOpenChange: handleOpenChange,
2075
- modal: false
2076
- },
2077
- /* @__PURE__ */ React15.createElement(
2078
- Box,
2079
- {
2080
- position: "relative",
2081
- display: size === "compact" ? "flex" : void 0
2082
- },
2083
- isLoading ? /* @__PURE__ */ React15.createElement(FunSkeletonBlock, { height: activeDropdownItemSize[size] }) : /* @__PURE__ */ React15.createElement(DropdownMenu2.Trigger, { asChild: true }, /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
2084
- BaseActiveDropdownItem_default,
2085
- {
2086
- ...activeItemProps,
2087
- size,
2088
- horizontalIconGap,
2089
- isOpened,
2090
- label: activeItemProps?.label ?? selectedOption?.label ?? placeholder ?? ""
2091
- }
2092
- ))),
2093
- /* @__PURE__ */ React15.createElement(DropdownMenu2.Portal, null, /* @__PURE__ */ React15.createElement(
2094
- DropdownMenu2.Content,
2095
- {
2096
- ...themeRootProps,
2097
- ref: portalThemeRef,
2098
- side: dropdownSide,
2099
- sideOffset: dropdownSide === "top" ? 8 : 6,
2100
- align: dropdownAlign,
2101
- className: "funkit-dropdown-content",
2102
- style: {
2103
- zIndex: `calc(${themeVars.modalZIndex} + 1)`,
2104
- width: dropdownWidth ? `${dropdownWidth}px` : openDropdownFullWidth ? "var(--radix-dropdown-menu-trigger-width)" : void 0,
2105
- transformOrigin: "var(--radix-dropdown-menu-content-transform-origin)"
2106
- },
2107
- onCloseAutoFocus: (e) => e.preventDefault()
2108
- },
2109
- /* @__PURE__ */ React15.createElement(TooltipAnchorRefContext.Provider, { value: portalThemeRef }, /* @__PURE__ */ React15.createElement(
2110
- Box,
2111
- {
2112
- background: openDropdownBackgroundColor,
2113
- borderColor: "transparent",
2114
- borderWidth: "1",
2115
- borderRadius: "dropdownList",
2116
- borderStyle: "solid",
2117
- boxShadow: "dropdown",
2118
- className: maxDropdownHeight ? scrollGradientWrapperStyles : void 0,
2119
- "data-fade-top": maxDropdownHeight && hasTopDivider ? "true" : "false",
2120
- "data-fade-bottom": maxDropdownHeight && !isAtBottom ? "true" : "false"
2121
- },
2122
- /* @__PURE__ */ React15.createElement(
2123
- Box,
2124
- {
2125
- className: maxDropdownHeight ? scrollableDropdownStyles : void 0,
2126
- ref: maxDropdownHeight ? scrollRef : void 0,
2127
- style: { maxHeight: maxDropdownHeight }
2128
- },
2129
- /* @__PURE__ */ React15.createElement(Box, { display: "flex", flexDirection: "column" }, searchableOptions && /* @__PURE__ */ React15.createElement(Box, { paddingTop: "8", paddingX: "8" }, /* @__PURE__ */ React15.createElement(
2130
- FunInput,
2131
- {
2132
- placeholder: searchPlaceholder ?? t("common.searchTokens"),
2133
- value: searchInput,
2134
- onChange: handleSearch,
2135
- prefixIcon: "SearchIcon"
2136
- }
2137
- )), organizedOptions.length === 0 ? /* @__PURE__ */ React15.createElement(FunNoResults, { text: t("common.noResultsFound") }) : /* @__PURE__ */ React15.createElement(
2138
- Box,
2139
- {
2140
- as: "ul",
2141
- display: "flex",
2142
- flexDirection: "column",
2143
- paddingY: size === "compact" ? "dropdownCompactPaddingY" : "dropdownPaddingY"
2144
- },
2145
- organizedGroups.map(
2146
- ({
2147
- key: groupKey,
2148
- label: groupLabel,
2149
- options: optionsInGroup
2150
- }, groupIndex) => /* @__PURE__ */ React15.createElement(React15.Fragment, { key: groupKey }, groupIndex > 0 && /* @__PURE__ */ React15.createElement(
2151
- Box,
2152
- {
2153
- height: "1",
2154
- background: "lightStroke",
2155
- marginY: "dropdownGroupDividerMarginY"
2156
- }
2157
- ), groupLabel && /* @__PURE__ */ React15.createElement(
2158
- Box,
2159
- {
2160
- paddingX: size === "compact" ? "dropdownCompactPaddingX" : "dropdownPaddingX"
2161
- },
2162
- /* @__PURE__ */ React15.createElement(
2163
- Box,
2164
- {
2165
- paddingX: "dropdownItemPaddingX",
2166
- paddingY: "dropdownItemPaddingY"
2167
- },
2168
- /* @__PURE__ */ React15.createElement(
2169
- Text,
2170
- {
2171
- color: "dropdownGroupHeader",
2172
- font: "dropdownGroupHeader",
2173
- size: "dropdownGroupHeader",
2174
- weight: "dropdownGroupHeader"
2175
- },
2176
- groupLabel
2177
- )
2178
- )
2179
- ), optionsInGroup.map((singleOption) => {
2180
- const isSelected = singleOption.value === selectedOption?.value;
2181
- return /* @__PURE__ */ React15.createElement(
2182
- Box,
2183
- {
2184
- key: singleOption.value,
2185
- paddingX: size === "compact" ? "dropdownCompactPaddingX" : "dropdownPaddingX"
2186
- },
2187
- /* @__PURE__ */ React15.createElement(
2188
- Box,
2189
- {
2190
- id: `${singleOption.value}-dropdown-item`,
2191
- as: "li",
2192
- background: {
2193
- base: isSelected ? "selectedDropdownItemBackground" : "transparent",
2194
- hover: "offBackground"
2195
- },
2196
- className: baseDropdownItemWrapperStyles,
2197
- onClick: () => {
2198
- onOptionSelected?.(singleOption);
2199
- }
2200
- },
2201
- renderDropdownOption(
2202
- singleOption,
2203
- isSelected
2204
- )
2205
- )
2206
- );
2207
- }))
2208
- )
2209
- ))
2210
- )
2211
- ))
2212
- )),
2213
- preloadIconUrls && /* @__PURE__ */ React15.createElement(
2214
- Box,
2215
- {
2216
- display: "none",
2217
- "aria-hidden": true,
2218
- style: { position: "absolute", top: "-100%", left: "-100%" }
2219
- },
2220
- preloadIconUrls.map((url, index) => /* @__PURE__ */ React15.createElement("img", { key: `${url}-${index}`, src: url, alt: "" }))
2221
- )
2222
- )
2223
- ));
2224
- }
2225
- var BaseDropdown_default = BaseDropdown;
2226
-
2227
- // src/components/Dropdown/AccountSelectDropdown.tsx
2228
- var ACCOUNTS_GROUP = "accounts";
2229
- var ACTION_GROUP = "action";
2230
- function AccountSelectDropdown({
2231
- accounts,
2232
- selectedValue,
2233
- onSelect,
2234
- action,
2235
- prefixLabel,
2236
- label,
2237
- size,
2238
- dropdownWidth,
2239
- testId
2240
- }) {
2241
- const actionIdCollidesWithAccount = !!action && accounts.some((account) => account.value === action.id);
2242
- const actionId = action?.id;
2243
- useEffect6(() => {
2244
- if (actionIdCollidesWithAccount) {
2245
- logger.warn("accountSelectDropdown:actionIdCollidesWithAccountValue", {
2246
- actionId
2247
- });
2248
- }
2249
- }, [actionIdCollidesWithAccount, actionId]);
2250
- const options = [
2251
- ...accounts.map((account) => ({
2252
- value: account.value,
2253
- label: account.label
2254
- })),
2255
- ...action ? [{ value: action.id, label: action.label }] : []
2256
- ];
2257
- const groups = action ? [
2258
- {
2259
- key: ACCOUNTS_GROUP,
2260
- label: "",
2261
- values: accounts.map((account) => account.value)
2262
- },
2263
- { key: ACTION_GROUP, label: "", values: [action.id] }
2264
- ] : void 0;
2265
- return /* @__PURE__ */ React16.createElement(
2266
- BaseDropdown_default,
2267
- {
2268
- testId,
2269
- label,
2270
- size,
2271
- dropdownWidth,
2272
- value: selectedValue,
2273
- options,
2274
- groups,
2275
- activeItemProps: { alwaysVisibleLabel: prefixLabel },
2276
- renderDropdownOption: (option, isSelected) => {
2277
- if (action && option.value === action.id) {
2278
- return /* @__PURE__ */ React16.createElement(
2279
- BaseDropdownItem_default,
2280
- {
2281
- id: option.value,
2282
- label: option.label,
2283
- iconComponent: action.icon && // Render the icon in the theme's primary text colour
2284
- // (the icon uses `currentColor`), matching the label.
2285
- /* @__PURE__ */ React16.createElement(Box, { display: "flex", color: "primaryText" }, action.icon),
2286
- horizontalIconGap: "8",
2287
- onClick: action.onSelect
2288
- }
2289
- );
2290
- }
2291
- const account = accounts.find((item) => item.value === option.value);
2292
- return /* @__PURE__ */ React16.createElement(
2293
- BaseDropdownItem_default,
2294
- {
2295
- id: option.value,
2296
- label: option.label,
2297
- description: account?.description,
2298
- isSelected,
2299
- onClick: onSelect
2300
- }
2301
- );
2302
- }
2303
- }
2304
- );
2305
- }
2306
-
2307
- // src/clients/polymarket/PolymarketDepositAccountDropdown.tsx
2308
- var ACCOUNT_DROPDOWN_OPTIONS_WIDTH = 264;
2309
- var BALANCE_PLACEHOLDER = "\u2014";
2310
- function formatBalance(balanceUsd) {
2311
- return balanceUsd === void 0 ? BALANCE_PLACEHOLDER : formatUsdFlooredToCent(balanceUsd);
2312
- }
2313
- function PolymarketDepositAccountDropdown({
2314
- onStepChange,
2315
- modalState,
2316
- dynamicRoutingId,
2317
- applyDynamicTargetAssetCandidate,
2318
- predictions,
2319
- perps
2320
- }) {
2321
- const { t } = useFunkitTranslation();
2322
- const balances = usePolymarketAccountBalances({ predictions, perps });
2323
- const selectedRoutingId = dynamicRoutingId === POLYMARKET_PERPS_ROUTING_ID ? POLYMARKET_PERPS_ROUTING_ID : POLYMARKET_PREDICTIONS_ROUTING_ID;
2324
- const accountCandidate = (routingId, recipient) => ({
2325
- tokenAddress: POLYGON_USDCE,
2326
- tokenChainId: polygon.id.toString(),
2327
- tokenSymbol: PUSD_TOKEN.symbol,
2328
- iconSrc: PUSD_TOKEN.iconSrc,
2329
- dynamicRoutingId: routingId,
2330
- customRecipient: recipient
2331
- });
2332
- const handleSelectAccount = (routingId) => {
2333
- const isPerps = routingId === POLYMARKET_PERPS_ROUTING_ID;
2334
- applyDynamicTargetAssetCandidate?.(
2335
- accountCandidate(
2336
- isPerps ? POLYMARKET_PERPS_ROUTING_ID : POLYMARKET_PREDICTIONS_ROUTING_ID,
2337
- isPerps ? perps.address : predictions.address
2338
- )
2339
- );
2340
- };
2341
- return /* @__PURE__ */ React17.createElement(
2342
- AccountSelectDropdown,
2343
- {
2344
- prefixLabel: t("perpsTransfer.depositTo"),
2345
- dropdownWidth: ACCOUNT_DROPDOWN_OPTIONS_WIDTH,
2346
- accounts: [
2347
- {
2348
- value: POLYMARKET_PREDICTIONS_ROUTING_ID,
2349
- label: t("perpsTransfer.predictions"),
2350
- description: formatBalance(balances.predictions.balanceUsd)
2351
- },
2352
- {
2353
- value: POLYMARKET_PERPS_ROUTING_ID,
2354
- label: t("perpsTransfer.perps"),
2355
- description: formatBalance(balances.perps.balanceUsd)
2356
- }
2357
- ],
2358
- selectedValue: selectedRoutingId,
2359
- onSelect: handleSelectAccount,
2360
- action: {
2361
- id: "transfer-between-accounts",
2362
- label: t("perpsTransfer.transferBetweenAccounts"),
2363
- icon: /* @__PURE__ */ React17.createElement(SwitchIcon, null),
2364
- // Navigation is absent on the loading skeleton; the action only fires
2365
- // on the interactive screen. The transfer step reads balances from the
2366
- // same shared cache, so none need to be threaded through here.
2367
- onSelect: () => {
2368
- if (onStepChange && modalState) {
2369
- onStepChange({
2370
- ...modalState,
2371
- step: "perps_transfer" /* PERPS_TRANSFER */
2372
- });
2373
- }
2374
- }
2375
- }
2376
- }
2377
- );
2378
- }
2379
-
2380
- export {
2381
- PolymarketDepositAccountDropdown
2382
- };