@funkit/connect 9.24.0-next.0 → 9.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -4
- package/dist/clients/aave.d.ts +9 -0
- package/dist/clients/aave.js +4 -1
- package/dist/clients/{chunk-4HCOSF4M.js → chunk-7G3QEQFB.js} +2 -2
- package/dist/clients/{chunk-7FIVHWNC.js → chunk-7UIDHSYG.js} +47 -0
- package/dist/clients/{chunk-UUHGOBKZ.js → chunk-AHYOV7AV.js} +2 -1
- package/dist/clients/{chunk-S7FRYR55.js → chunk-ME4OAQIY.js} +1 -1
- package/dist/clients/{chunk-CEBG7XQ5.js → chunk-MXPZTW2H.js} +212 -1126
- package/dist/clients/chunk-SQ2RX7WY.js +1110 -0
- package/dist/clients/{chunk-KWIR3HO4.js → chunk-VJZW3MA3.js} +1 -1
- package/dist/clients/{chunk-MRBN4XCA.js → chunk-ZEXZQOAO.js} +1 -1
- package/dist/clients/fanatics.css +1 -1
- package/dist/clients/fanatics.js +4 -6
- package/dist/clients/lighter.css +2816 -1
- package/dist/clients/lighter.js +44 -28
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +217 -222
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +7 -8
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +3 -3
- package/dist/clients/polymarket/index.css +217 -222
- package/dist/clients/polymarket/index.js +7 -8
- package/dist/clients/polymarket/polymarket.js +2 -2
- package/dist/clients/polymarket/usePolymarketAccountBalances.js +2 -2
- package/dist/clients/rolly.js +1 -1
- package/dist/components/FunCheckoutHistory/FunCheckoutHistoryContent.d.ts +1 -2
- package/dist/components/FunTooltip/FunTooltip.d.ts +10 -5
- package/dist/components/FunTransactionSummary/DestinationHealthFactorRow.d.ts +15 -0
- package/dist/components/FunTransactionSummary/DestinationYieldRows.d.ts +1 -0
- package/dist/components/FunTransactionSummary/PaymentAmountSummary.d.ts +2 -1
- package/dist/components/FunTransactionSummary/PaymentMethodSummary.d.ts +8 -1
- package/dist/domains/aave.d.ts +14 -9
- package/dist/domains/nado.d.ts +9 -0
- package/dist/hooks/track/CheckoutModalEvent.d.ts +0 -1
- package/dist/hooks/track/WithdrawModalEvent.d.ts +9 -1
- package/dist/hooks/useGetAssetHoldingsFromRpc.d.ts +23 -0
- package/dist/hooks/useInjectedAssetHoldings.d.ts +23 -0
- package/dist/hooks/useXstockAssetHoldings.d.ts +15 -0
- package/dist/hooks/useXstocksWrappedTokenAddress.d.ts +16 -0
- package/dist/index.css +11 -16
- package/dist/index.js +4696 -4117
- package/dist/modals/CheckoutModal/CheckoutComplete/CheckoutComplete.d.ts +1 -1
- package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +0 -1
- package/dist/modals/CheckoutModal/InputAmount/useNadoDirectTransfer.d.ts +64 -0
- package/dist/modals/CheckoutModal/SelectAsset/SelectAsset.d.ts +1 -1
- package/dist/modals/CheckoutModal/stepTransition.d.ts +0 -3
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +25 -4
- package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +10 -1
- package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +8 -1
- package/dist/modals/WithdrawalModal/WithdrawalSwappedIframeController.d.ts +11 -0
- package/dist/modals/WithdrawalModal/types.d.ts +1 -0
- package/dist/providers/FunkitCheckoutContext/types.d.ts +29 -12
- package/dist/utils/assets.d.ts +7 -0
- package/dist/utils/checkoutHistory.d.ts +1 -5
- package/dist/utils/customer.d.ts +6 -0
- package/dist/wallets/walletConnectors/index.js +50 -50
- package/package.json +6 -6
- package/dist/__generated__/default_configs.d.ts +0 -901
- package/dist/__generated__/default_feature_gates.d.ts +0 -20
- package/dist/clients/chunk-25ICASD7.js +0 -2371
- package/dist/clients/chunk-3GO74QTP.js +0 -2382
- package/dist/clients/chunk-7GWX2ZS4.js +0 -69
- package/dist/clients/chunk-7HNGV6JU.js +0 -54
- package/dist/clients/chunk-A32VN2DX.js +0 -2382
- package/dist/clients/chunk-ELLXM7RO.js +0 -186
- package/dist/clients/chunk-GGXTLJ7J.js +0 -290
- package/dist/clients/chunk-GUWXVR5S.js +0 -186
- package/dist/clients/chunk-HRWCNZJA.js +0 -230
- package/dist/clients/chunk-JBWB54MX.js +0 -69
- package/dist/clients/chunk-JD3FIVZ7.js +0 -69
- package/dist/clients/chunk-JTGKAPID.js +0 -2382
- package/dist/clients/chunk-L7PABCF2.js +0 -54
- package/dist/clients/chunk-LII3SVUH.js +0 -230
- package/dist/clients/chunk-NCUPPJ2Z.js +0 -2382
- package/dist/clients/chunk-NPPIETHZ.js +0 -54
- package/dist/clients/chunk-NUJ6ZM5F.js +0 -186
- package/dist/clients/chunk-UVWNEQMD.js +0 -186
- package/dist/clients/chunk-VVTNR7YH.js +0 -2382
- package/dist/clients/chunk-YYMIRDCQ.js +0 -230
- package/dist/clients/chunk-ZNVFASTH.js +0 -54
- package/dist/clients/nado.d.ts +0 -78
- package/dist/clients/nado.js +0 -107
- package/dist/clients/polymarket.d.ts +0 -161
- package/dist/clients/polymarket.js +0 -688
- package/dist/components/FunCheckoutHistory/FunCheckoutHistoryHelp.d.ts +0 -10
- package/dist/interfaces/logTransport.d.ts +0 -51
- package/dist/interfaces/swapped-transport.d.ts +0 -78
- package/dist/modals/CheckoutModal/CheckoutHelp/CheckoutHelp.d.ts +0 -9
- package/dist/modals/CheckoutModal/SourceChange/EmptyFormOfPaymentsMessage.d.ts +0 -4
- package/dist/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.d.ts +0 -4
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedErrorMessage.d.ts +0 -6
- package/dist/utils/flags/resolver.d.ts +0 -34
- package/dist/wallets/walletConnectors/chunk-4NV5BYRP.js +0 -95
- package/dist/wallets/walletConnectors/chunk-AVDUNQUW.js +0 -96
- package/dist/wallets/walletConnectors/chunk-GUQM4QSL.js +0 -66
- package/dist/wallets/walletConnectors/chunk-IULPZP2Q.js +0 -69
- package/dist/wallets/walletConnectors/chunk-JPN6TWIT.js +0 -92
- package/dist/wallets/walletConnectors/chunk-KCRO2AGO.js +0 -106
- package/dist/wallets/walletConnectors/chunk-KI5Y2BBF.js +0 -94
- package/dist/wallets/walletConnectors/chunk-NR2OGDHQ.js +0 -103
- package/dist/wallets/walletConnectors/chunk-OEEGYENV.js +0 -87
- package/dist/wallets/walletConnectors/chunk-OX37G4YT.js +0 -98
- package/dist/wallets/walletConnectors/chunk-SWFF3TWJ.js +0 -100
- package/dist/wallets/walletConnectors/chunk-TKB2OY6G.js +0 -99
- package/dist/wallets/walletConnectors/chunk-W2LCLDPX.js +0 -70
- package/dist/wallets/walletConnectors/chunk-WAHGI5L7.js +0 -96
- package/dist/wallets/walletConnectors/chunk-WKNQMP4A.js +0 -93
- package/dist/wallets/walletConnectors/chunk-XCNHV3HS.js +0 -110
- package/dist/wallets/walletConnectors/chunk-YO2K4MBH.js +0 -218
- package/dist/wallets/walletConnectors/chunk-YQFGVZGR.js +0 -92
|
@@ -0,0 +1,1110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
usePolymarketAccountBalances
|
|
4
|
+
} from "./chunk-ZEXZQOAO.js";
|
|
5
|
+
import {
|
|
6
|
+
POLYMARKET_PERPS_ROUTING_ID,
|
|
7
|
+
POLYMARKET_PREDICTIONS_ROUTING_ID
|
|
8
|
+
} from "./chunk-VJZW3MA3.js";
|
|
9
|
+
import {
|
|
10
|
+
FunInput,
|
|
11
|
+
FunSkeletonBlock,
|
|
12
|
+
TooltipAnchorRefContext
|
|
13
|
+
} from "./chunk-MXPZTW2H.js";
|
|
14
|
+
import {
|
|
15
|
+
Box,
|
|
16
|
+
Text,
|
|
17
|
+
themeVars,
|
|
18
|
+
useFunkitTranslation
|
|
19
|
+
} from "./chunk-7UIDHSYG.js";
|
|
20
|
+
import {
|
|
21
|
+
POLYGON_USDCE,
|
|
22
|
+
PUSD_TOKEN
|
|
23
|
+
} from "./chunk-ME4OAQIY.js";
|
|
24
|
+
import {
|
|
25
|
+
logger
|
|
26
|
+
} from "./chunk-AHYOV7AV.js";
|
|
27
|
+
|
|
28
|
+
// src/clients/polymarket/PolymarketDepositAccountDropdown.tsx
|
|
29
|
+
import React12 from "react";
|
|
30
|
+
import { polygon } from "viem/chains";
|
|
31
|
+
|
|
32
|
+
// src/components/Dropdown/AccountSelectDropdown.tsx
|
|
33
|
+
import React11, { useEffect as useEffect4 } from "react";
|
|
34
|
+
|
|
35
|
+
// src/components/Dropdown/BaseDropdown.tsx
|
|
36
|
+
import { isMobile } from "@funkit/utils";
|
|
37
|
+
import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
|
|
38
|
+
import React10, { useCallback as useCallback2, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
|
|
39
|
+
|
|
40
|
+
// src/hooks/useScrollDivider.ts
|
|
41
|
+
import { useCallback, useEffect, useState } from "react";
|
|
42
|
+
var useScrollDivider = () => {
|
|
43
|
+
const [refElement, setRefElement] = useState(null);
|
|
44
|
+
const ref = useCallback((node) => setRefElement(node), []);
|
|
45
|
+
const [isTop, setIsTop] = useState(true);
|
|
46
|
+
const [isAtBottom, setIsAtBottom] = useState(false);
|
|
47
|
+
const [isScrollable, setIsScrollable] = useState(false);
|
|
48
|
+
const [isScrolling, setIsScrolling] = useState(false);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const content = refElement;
|
|
51
|
+
if (!content || !window.ResizeObserver) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const handleScrollPositionChange = () => {
|
|
55
|
+
const { scrollTop, scrollHeight, clientHeight } = content;
|
|
56
|
+
setIsTop(scrollTop === 0);
|
|
57
|
+
setIsAtBottom(scrollTop + clientHeight >= scrollHeight - 1);
|
|
58
|
+
setIsScrollable(scrollHeight > clientHeight + 2);
|
|
59
|
+
};
|
|
60
|
+
const handleContentChange = () => {
|
|
61
|
+
handleScrollPositionChange();
|
|
62
|
+
setTimeout(handleScrollPositionChange, 500);
|
|
63
|
+
};
|
|
64
|
+
const onScrollChange = () => {
|
|
65
|
+
handleScrollPositionChange();
|
|
66
|
+
setIsScrolling(true);
|
|
67
|
+
};
|
|
68
|
+
const onScrollEnd = () => setIsScrolling(false);
|
|
69
|
+
content.addEventListener("scrollend", onScrollEnd);
|
|
70
|
+
content.addEventListener("scroll", onScrollChange);
|
|
71
|
+
const resizeObserver = new window.ResizeObserver(handleContentChange);
|
|
72
|
+
resizeObserver.observe(content);
|
|
73
|
+
const mutationObserver = new MutationObserver(handleContentChange);
|
|
74
|
+
mutationObserver.observe(content, {
|
|
75
|
+
childList: true,
|
|
76
|
+
subtree: true,
|
|
77
|
+
attributes: true,
|
|
78
|
+
attributeFilter: ["style", "class"]
|
|
79
|
+
});
|
|
80
|
+
handleScrollPositionChange();
|
|
81
|
+
return () => {
|
|
82
|
+
content.removeEventListener("scroll", onScrollChange);
|
|
83
|
+
content.removeEventListener("scrollend", onScrollEnd);
|
|
84
|
+
resizeObserver.unobserve(content);
|
|
85
|
+
mutationObserver.disconnect();
|
|
86
|
+
};
|
|
87
|
+
}, [refElement]);
|
|
88
|
+
return {
|
|
89
|
+
ref,
|
|
90
|
+
hasTopDivider: !isTop,
|
|
91
|
+
hasBottomDivider: isScrollable,
|
|
92
|
+
isAtBottom,
|
|
93
|
+
isScrolling,
|
|
94
|
+
isScrollable
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// src/providers/FunkitProvider.tsx
|
|
99
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
100
|
+
import React8, {
|
|
101
|
+
createContext,
|
|
102
|
+
useContext,
|
|
103
|
+
useEffect as useEffect2,
|
|
104
|
+
useMemo,
|
|
105
|
+
useRef
|
|
106
|
+
} from "react";
|
|
107
|
+
|
|
108
|
+
// src/utils/tokenMath.ts
|
|
109
|
+
import { formatCurrencyAndStringify } from "@funkit/utils";
|
|
110
|
+
import * as dnum from "dnum";
|
|
111
|
+
import { formatUnits } from "viem";
|
|
112
|
+
function floorToDecimals(value, decimals) {
|
|
113
|
+
const d = dnum.from(value, decimals);
|
|
114
|
+
return dnum.toNumber(d, decimals);
|
|
115
|
+
}
|
|
116
|
+
function formatUsdFlooredToCent(balanceUsd) {
|
|
117
|
+
return formatCurrencyAndStringify(floorToDecimals(balanceUsd, 2));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/components/Icons/CheckIcon.tsx
|
|
121
|
+
import React from "react";
|
|
122
|
+
var CheckIcon = ({
|
|
123
|
+
size = 16,
|
|
124
|
+
className
|
|
125
|
+
}) => /* @__PURE__ */ React.createElement(
|
|
126
|
+
"svg",
|
|
127
|
+
{
|
|
128
|
+
width: size,
|
|
129
|
+
height: size,
|
|
130
|
+
viewBox: "0 0 16 16",
|
|
131
|
+
fill: "none",
|
|
132
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
133
|
+
className
|
|
134
|
+
},
|
|
135
|
+
/* @__PURE__ */ React.createElement(
|
|
136
|
+
"path",
|
|
137
|
+
{
|
|
138
|
+
d: "M12.4919 4.88281L6.25757 11.1172L3.50781 8",
|
|
139
|
+
stroke: "currentColor",
|
|
140
|
+
strokeWidth: "1.5",
|
|
141
|
+
strokeLinecap: "round",
|
|
142
|
+
strokeLinejoin: "round",
|
|
143
|
+
pathLength: "100"
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
// src/components/Dropdown/BaseDropdownItem.tsx
|
|
149
|
+
import { noop } from "@funkit/utils";
|
|
150
|
+
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
151
|
+
import React2 from "react";
|
|
152
|
+
import clsx from "clsx";
|
|
153
|
+
|
|
154
|
+
// src/components/Dropdown/BaseDropdownItem.css.ts
|
|
155
|
+
var disabledDropdownItemStyles = "_18hhw3k3 _18hhw3k2";
|
|
156
|
+
var enabledDropdownItemStyles = "_18hhw3k1 _18hhw3k0";
|
|
157
|
+
|
|
158
|
+
// src/components/Dropdown/BaseDropdownItem.tsx
|
|
159
|
+
function BaseDropdownItem({
|
|
160
|
+
iconComponent,
|
|
161
|
+
label,
|
|
162
|
+
description,
|
|
163
|
+
id,
|
|
164
|
+
onClick = noop,
|
|
165
|
+
isSelected = false,
|
|
166
|
+
isDisabled = false,
|
|
167
|
+
borderRadius = "connectButton",
|
|
168
|
+
horizontalIconGap = "dropdownItemIconGap",
|
|
169
|
+
tagComponent,
|
|
170
|
+
horizontalPadding = "dropdownItemPaddingX",
|
|
171
|
+
verticalPadding = "dropdownItemPaddingY"
|
|
172
|
+
}) {
|
|
173
|
+
return /* @__PURE__ */ React2.createElement(
|
|
174
|
+
DropdownMenu.Item,
|
|
175
|
+
{
|
|
176
|
+
disabled: isDisabled,
|
|
177
|
+
onSelect: () => onClick(id),
|
|
178
|
+
asChild: true
|
|
179
|
+
},
|
|
180
|
+
/* @__PURE__ */ React2.createElement(
|
|
181
|
+
Box,
|
|
182
|
+
{
|
|
183
|
+
width: "full",
|
|
184
|
+
display: "flex",
|
|
185
|
+
alignItems: "center",
|
|
186
|
+
justifyContent: "space-between",
|
|
187
|
+
gap: "24",
|
|
188
|
+
paddingY: verticalPadding,
|
|
189
|
+
paddingX: horizontalPadding,
|
|
190
|
+
className: clsx(
|
|
191
|
+
isDisabled ? disabledDropdownItemStyles : enabledDropdownItemStyles
|
|
192
|
+
),
|
|
193
|
+
boxShadow: isSelected ? "selectedDropdownItem" : void 0,
|
|
194
|
+
borderRadius
|
|
195
|
+
},
|
|
196
|
+
/* @__PURE__ */ React2.createElement(
|
|
197
|
+
Box,
|
|
198
|
+
{
|
|
199
|
+
display: "flex",
|
|
200
|
+
alignItems: "center",
|
|
201
|
+
justifyContent: "flex-start",
|
|
202
|
+
gap: horizontalIconGap
|
|
203
|
+
},
|
|
204
|
+
iconComponent && /* @__PURE__ */ React2.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "center" }, iconComponent),
|
|
205
|
+
/* @__PURE__ */ React2.createElement(Box, { display: "flex", flexDirection: "column", justifyContent: "center" }, /* @__PURE__ */ React2.createElement(
|
|
206
|
+
Text,
|
|
207
|
+
{
|
|
208
|
+
size: "dropdownItemFontSize",
|
|
209
|
+
weight: "medium",
|
|
210
|
+
color: isSelected ? "selectedDropdownItemText" : void 0
|
|
211
|
+
},
|
|
212
|
+
label
|
|
213
|
+
), description != null && /* @__PURE__ */ React2.createElement(Text, { size: "12", color: "secondaryText" }, description))
|
|
214
|
+
),
|
|
215
|
+
/* @__PURE__ */ React2.createElement(
|
|
216
|
+
Box,
|
|
217
|
+
{
|
|
218
|
+
display: "flex",
|
|
219
|
+
alignItems: "center",
|
|
220
|
+
justifyContent: "center",
|
|
221
|
+
gap: "16"
|
|
222
|
+
},
|
|
223
|
+
tagComponent,
|
|
224
|
+
/* @__PURE__ */ React2.createElement(
|
|
225
|
+
Box,
|
|
226
|
+
{
|
|
227
|
+
width: "16",
|
|
228
|
+
height: "16",
|
|
229
|
+
alignItems: "center",
|
|
230
|
+
justifyContent: "center",
|
|
231
|
+
color: isSelected ? "selectedDropdownItemText" : "transparent"
|
|
232
|
+
},
|
|
233
|
+
/* @__PURE__ */ React2.createElement(CheckIcon, null)
|
|
234
|
+
)
|
|
235
|
+
)
|
|
236
|
+
)
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
var BaseDropdownItem_default = BaseDropdownItem;
|
|
240
|
+
|
|
241
|
+
// src/components/Icons/CaretDownIcon.tsx
|
|
242
|
+
import clsx2 from "clsx";
|
|
243
|
+
import React3 from "react";
|
|
244
|
+
|
|
245
|
+
// src/components/Icons/CaretDownIcon.css.ts
|
|
246
|
+
var caretClosed = "_1gjdf1i3";
|
|
247
|
+
var caretOpened = "_1gjdf1i2";
|
|
248
|
+
|
|
249
|
+
// src/components/Icons/CaretDownIcon.tsx
|
|
250
|
+
var CaretDownIcon = () => {
|
|
251
|
+
return /* @__PURE__ */ React3.createElement(
|
|
252
|
+
"svg",
|
|
253
|
+
{
|
|
254
|
+
width: "8",
|
|
255
|
+
height: "5",
|
|
256
|
+
viewBox: "0 0 8 5",
|
|
257
|
+
fill: "none",
|
|
258
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
259
|
+
},
|
|
260
|
+
/* @__PURE__ */ React3.createElement(
|
|
261
|
+
"path",
|
|
262
|
+
{
|
|
263
|
+
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",
|
|
264
|
+
fill: "currentColor"
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
);
|
|
268
|
+
};
|
|
269
|
+
var AnimatedCaretDownIcon = ({
|
|
270
|
+
expanded,
|
|
271
|
+
color = "primaryText",
|
|
272
|
+
compact = false
|
|
273
|
+
}) => {
|
|
274
|
+
const animationClassName = clsx2(
|
|
275
|
+
expanded !== void 0 && (expanded ? caretOpened : caretClosed)
|
|
276
|
+
);
|
|
277
|
+
if (compact) {
|
|
278
|
+
return /* @__PURE__ */ React3.createElement(
|
|
279
|
+
Box,
|
|
280
|
+
{
|
|
281
|
+
color,
|
|
282
|
+
width: "8",
|
|
283
|
+
height: "8",
|
|
284
|
+
display: "flex",
|
|
285
|
+
alignItems: "center",
|
|
286
|
+
justifyContent: "center",
|
|
287
|
+
className: animationClassName
|
|
288
|
+
},
|
|
289
|
+
/* @__PURE__ */ React3.createElement(CaretDownIcon, null)
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
return /* @__PURE__ */ React3.createElement(
|
|
293
|
+
Box,
|
|
294
|
+
{
|
|
295
|
+
color,
|
|
296
|
+
width: "16",
|
|
297
|
+
height: "16",
|
|
298
|
+
display: "flex",
|
|
299
|
+
alignItems: "center",
|
|
300
|
+
justifyContent: "center",
|
|
301
|
+
className: animationClassName
|
|
302
|
+
},
|
|
303
|
+
/* @__PURE__ */ React3.createElement(
|
|
304
|
+
Box,
|
|
305
|
+
{
|
|
306
|
+
width: "8",
|
|
307
|
+
height: "8",
|
|
308
|
+
display: "flex",
|
|
309
|
+
alignItems: "center",
|
|
310
|
+
justifyContent: "center"
|
|
311
|
+
},
|
|
312
|
+
/* @__PURE__ */ React3.createElement(CaretDownIcon, null)
|
|
313
|
+
)
|
|
314
|
+
);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
// src/components/FunNoResults/FunNoResults.tsx
|
|
318
|
+
import React6 from "react";
|
|
319
|
+
|
|
320
|
+
// src/components/Icons/CoinsIcon.tsx
|
|
321
|
+
import React4 from "react";
|
|
322
|
+
var CoinsIcon = ({
|
|
323
|
+
size = 48,
|
|
324
|
+
bgColor = "#141C41",
|
|
325
|
+
iconColor = "#878A98"
|
|
326
|
+
}) => {
|
|
327
|
+
return /* @__PURE__ */ React4.createElement(
|
|
328
|
+
"svg",
|
|
329
|
+
{
|
|
330
|
+
width: size,
|
|
331
|
+
height: size,
|
|
332
|
+
viewBox: "0 0 48 49",
|
|
333
|
+
fill: "none",
|
|
334
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
335
|
+
},
|
|
336
|
+
/* @__PURE__ */ React4.createElement("g", { clipPath: "url(#clip0_30657_22302)" }, /* @__PURE__ */ React4.createElement(
|
|
337
|
+
"path",
|
|
338
|
+
{
|
|
339
|
+
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",
|
|
340
|
+
fill: bgColor,
|
|
341
|
+
stroke: bgColor
|
|
342
|
+
}
|
|
343
|
+
), /* @__PURE__ */ React4.createElement("g", { clipPath: "url(#clip1_30657_22302)" }, /* @__PURE__ */ React4.createElement(
|
|
344
|
+
"path",
|
|
345
|
+
{
|
|
346
|
+
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",
|
|
347
|
+
stroke: iconColor,
|
|
348
|
+
strokeWidth: "1.5",
|
|
349
|
+
strokeLinecap: "round",
|
|
350
|
+
strokeLinejoin: "round"
|
|
351
|
+
}
|
|
352
|
+
))),
|
|
353
|
+
/* @__PURE__ */ React4.createElement("defs", null, /* @__PURE__ */ React4.createElement("clipPath", { id: "clip0_30657_22302" }, /* @__PURE__ */ React4.createElement(
|
|
354
|
+
"rect",
|
|
355
|
+
{
|
|
356
|
+
width: "48",
|
|
357
|
+
height: "48",
|
|
358
|
+
fill: "white",
|
|
359
|
+
transform: "translate(0 0.5)"
|
|
360
|
+
}
|
|
361
|
+
)), /* @__PURE__ */ React4.createElement("clipPath", { id: "clip1_30657_22302" }, /* @__PURE__ */ React4.createElement(
|
|
362
|
+
"rect",
|
|
363
|
+
{
|
|
364
|
+
width: "24",
|
|
365
|
+
height: "24",
|
|
366
|
+
fill: "white",
|
|
367
|
+
transform: "translate(12 12)"
|
|
368
|
+
}
|
|
369
|
+
)))
|
|
370
|
+
);
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
// src/components/Icons/SearchSkeletonIcon.tsx
|
|
374
|
+
import React5 from "react";
|
|
375
|
+
var SearchSkeletonIcon = () => {
|
|
376
|
+
return /* @__PURE__ */ React5.createElement(
|
|
377
|
+
"svg",
|
|
378
|
+
{
|
|
379
|
+
width: "122",
|
|
380
|
+
height: "81",
|
|
381
|
+
viewBox: "0 0 122 81",
|
|
382
|
+
fill: "none",
|
|
383
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
384
|
+
},
|
|
385
|
+
/* @__PURE__ */ React5.createElement("g", { clipPath: "url(#clip0_7590_15835)" }, /* @__PURE__ */ React5.createElement(
|
|
386
|
+
"path",
|
|
387
|
+
{
|
|
388
|
+
fillRule: "evenodd",
|
|
389
|
+
clipRule: "evenodd",
|
|
390
|
+
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",
|
|
391
|
+
fill: "currentColor"
|
|
392
|
+
}
|
|
393
|
+
), /* @__PURE__ */ React5.createElement(
|
|
394
|
+
"path",
|
|
395
|
+
{
|
|
396
|
+
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",
|
|
397
|
+
fill: "currentColor"
|
|
398
|
+
}
|
|
399
|
+
), /* @__PURE__ */ React5.createElement(
|
|
400
|
+
"path",
|
|
401
|
+
{
|
|
402
|
+
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",
|
|
403
|
+
fill: "currentColor"
|
|
404
|
+
}
|
|
405
|
+
), /* @__PURE__ */ React5.createElement(
|
|
406
|
+
"path",
|
|
407
|
+
{
|
|
408
|
+
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",
|
|
409
|
+
fill: "currentColor"
|
|
410
|
+
}
|
|
411
|
+
)),
|
|
412
|
+
/* @__PURE__ */ React5.createElement("defs", null, /* @__PURE__ */ React5.createElement("clipPath", { id: "clip0_7590_15835" }, /* @__PURE__ */ React5.createElement(
|
|
413
|
+
"rect",
|
|
414
|
+
{
|
|
415
|
+
width: "121",
|
|
416
|
+
height: "81",
|
|
417
|
+
fill: "white",
|
|
418
|
+
transform: "translate(0.5)"
|
|
419
|
+
}
|
|
420
|
+
)))
|
|
421
|
+
);
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
// src/components/FunNoResults/FunNoResults.tsx
|
|
425
|
+
var FunNoResults = ({
|
|
426
|
+
text,
|
|
427
|
+
title,
|
|
428
|
+
variant = "default",
|
|
429
|
+
actionButton
|
|
430
|
+
}) => {
|
|
431
|
+
return /* @__PURE__ */ React6.createElement(
|
|
432
|
+
Box,
|
|
433
|
+
{
|
|
434
|
+
display: "flex",
|
|
435
|
+
flexDirection: "column",
|
|
436
|
+
justifyContent: "center",
|
|
437
|
+
alignItems: "center",
|
|
438
|
+
gap: variant === "default" ? "12" : "16",
|
|
439
|
+
color: "secondaryText",
|
|
440
|
+
style: { flex: 1 }
|
|
441
|
+
},
|
|
442
|
+
variant === "default" && /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(SearchSkeletonIcon, null), /* @__PURE__ */ React6.createElement(Text, { color: "secondaryText", size: "10" }, text)),
|
|
443
|
+
variant === "actionable" && /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
|
|
444
|
+
CoinsIcon,
|
|
445
|
+
{
|
|
446
|
+
bgColor: themeVars.colors.offBackground,
|
|
447
|
+
iconColor: themeVars.colors.actionColor
|
|
448
|
+
}
|
|
449
|
+
), /* @__PURE__ */ React6.createElement(
|
|
450
|
+
Box,
|
|
451
|
+
{
|
|
452
|
+
display: "flex",
|
|
453
|
+
flexDirection: "column",
|
|
454
|
+
alignItems: "center",
|
|
455
|
+
gap: "12"
|
|
456
|
+
},
|
|
457
|
+
/* @__PURE__ */ React6.createElement(
|
|
458
|
+
Box,
|
|
459
|
+
{
|
|
460
|
+
display: "flex",
|
|
461
|
+
flexDirection: "column",
|
|
462
|
+
alignItems: "center",
|
|
463
|
+
textAlign: "center",
|
|
464
|
+
gap: "8"
|
|
465
|
+
},
|
|
466
|
+
title && /* @__PURE__ */ React6.createElement(Text, { size: "14", color: "primaryText" }, title),
|
|
467
|
+
/* @__PURE__ */ React6.createElement(Text, { color: "secondaryText", size: "12" }, text)
|
|
468
|
+
),
|
|
469
|
+
actionButton && /* @__PURE__ */ React6.createElement(Box, null, actionButton)
|
|
470
|
+
))
|
|
471
|
+
);
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
// src/components/Icons/SwitchIcon.tsx
|
|
475
|
+
import React7 from "react";
|
|
476
|
+
var SwitchIcon = () => {
|
|
477
|
+
return /* @__PURE__ */ React7.createElement(
|
|
478
|
+
"svg",
|
|
479
|
+
{
|
|
480
|
+
width: "15",
|
|
481
|
+
height: "14",
|
|
482
|
+
viewBox: "0 0 15 14",
|
|
483
|
+
fill: "none",
|
|
484
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
485
|
+
},
|
|
486
|
+
/* @__PURE__ */ React7.createElement(
|
|
487
|
+
"path",
|
|
488
|
+
{
|
|
489
|
+
fillRule: "evenodd",
|
|
490
|
+
clipRule: "evenodd",
|
|
491
|
+
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",
|
|
492
|
+
fill: "currentColor"
|
|
493
|
+
}
|
|
494
|
+
)
|
|
495
|
+
);
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
// src/providers/FunkitProvider.tsx
|
|
499
|
+
var ThemeIdContext = createContext(void 0);
|
|
500
|
+
var attr = "data-rk";
|
|
501
|
+
var createThemeRootProps = (id) => ({ [attr]: id || "" });
|
|
502
|
+
var useThemeRootProps = () => {
|
|
503
|
+
const id = useContext(ThemeIdContext);
|
|
504
|
+
return createThemeRootProps(id);
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
// src/components/Dropdown/BaseActiveDropdownItem.tsx
|
|
508
|
+
import React9 from "react";
|
|
509
|
+
|
|
510
|
+
// src/components/Dropdown/BaseActiveDropdownItem.css.ts
|
|
511
|
+
var baseStyles = "_1dewiqw0";
|
|
512
|
+
|
|
513
|
+
// src/components/Dropdown/BaseDropdown.css.ts
|
|
514
|
+
var BORDER_RADIUS = "dropdown";
|
|
515
|
+
var baseDropdownItemWrapperStyles = "_1nns6ys3 _1rsrm2f17";
|
|
516
|
+
var scrollGradientWrapperStyles = "_1nns6ys1";
|
|
517
|
+
var scrollableDropdownStyles = "_1nns6ys0";
|
|
518
|
+
|
|
519
|
+
// src/components/Dropdown/BaseActiveDropdownItem.tsx
|
|
520
|
+
function BaseActiveDropdownItem({
|
|
521
|
+
iconComponent,
|
|
522
|
+
label,
|
|
523
|
+
isOpened,
|
|
524
|
+
onClick,
|
|
525
|
+
horizontalIconGap = "dropdownItemIconGap",
|
|
526
|
+
alwaysVisibleLabel,
|
|
527
|
+
tagComponent,
|
|
528
|
+
tagPosition = "start",
|
|
529
|
+
size = "regular",
|
|
530
|
+
color = "primaryText",
|
|
531
|
+
arrowColor = "secondaryText",
|
|
532
|
+
background,
|
|
533
|
+
labelStyle,
|
|
534
|
+
compactIcon = false
|
|
535
|
+
}) {
|
|
536
|
+
return /* @__PURE__ */ React9.createElement(
|
|
537
|
+
Box,
|
|
538
|
+
{
|
|
539
|
+
display: "flex",
|
|
540
|
+
alignItems: "center",
|
|
541
|
+
justifyContent: "space-between",
|
|
542
|
+
gap: "6",
|
|
543
|
+
cursor: "pointer",
|
|
544
|
+
onClick,
|
|
545
|
+
background: background ?? {
|
|
546
|
+
base: "dropdownActiveItemBackgroundBase",
|
|
547
|
+
hover: "dropdownActiveItemBackgroundHover"
|
|
548
|
+
},
|
|
549
|
+
borderColor: {
|
|
550
|
+
base: "dropdownActiveItemBorderBase",
|
|
551
|
+
hover: "dropdownActiveItemBorderHover"
|
|
552
|
+
},
|
|
553
|
+
borderWidth: size === "compact" ? "0" : "1",
|
|
554
|
+
borderRadius: BORDER_RADIUS,
|
|
555
|
+
borderStyle: "solid",
|
|
556
|
+
paddingY: size === "compact" ? "2" : size === "large" ? "10" : "dropdownActiveItemRegularSizePaddingY",
|
|
557
|
+
paddingX: size === "compact" ? "4" : size === "large" ? "8" : "dropdownPaddingX",
|
|
558
|
+
className: baseStyles
|
|
559
|
+
},
|
|
560
|
+
/* @__PURE__ */ React9.createElement(
|
|
561
|
+
Box,
|
|
562
|
+
{
|
|
563
|
+
display: "flex",
|
|
564
|
+
alignItems: "center",
|
|
565
|
+
justifyContent: "space-between",
|
|
566
|
+
gap: horizontalIconGap,
|
|
567
|
+
style: size === "compact" ? void 0 : { flex: "1 0 auto" }
|
|
568
|
+
},
|
|
569
|
+
alwaysVisibleLabel && /* @__PURE__ */ React9.createElement(Box, { style: { flex: 1 } }, /* @__PURE__ */ React9.createElement(Text, { color: "secondaryText", size: "12" }, alwaysVisibleLabel)),
|
|
570
|
+
/* @__PURE__ */ React9.createElement(
|
|
571
|
+
Box,
|
|
572
|
+
{
|
|
573
|
+
display: "flex",
|
|
574
|
+
alignItems: "center",
|
|
575
|
+
justifyContent: "space-between",
|
|
576
|
+
gap: horizontalIconGap,
|
|
577
|
+
background: {
|
|
578
|
+
base: "transparent",
|
|
579
|
+
hover: "alwaysVisibleLabelBackgroundHover"
|
|
580
|
+
},
|
|
581
|
+
...alwaysVisibleLabel ? {} : { style: { flex: 1 } }
|
|
582
|
+
},
|
|
583
|
+
/* @__PURE__ */ React9.createElement(
|
|
584
|
+
Box,
|
|
585
|
+
{
|
|
586
|
+
display: "flex",
|
|
587
|
+
alignItems: "center",
|
|
588
|
+
justifyContent: "center",
|
|
589
|
+
gap: horizontalIconGap,
|
|
590
|
+
...alwaysVisibleLabel ? { style: { flexDirection: "row-reverse" } } : {}
|
|
591
|
+
},
|
|
592
|
+
tagPosition === "start" && tagComponent,
|
|
593
|
+
/* @__PURE__ */ React9.createElement(Box, { display: "flex", alignItems: "center", gap: horizontalIconGap }, iconComponent && /* @__PURE__ */ React9.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "center" }, iconComponent), /* @__PURE__ */ React9.createElement(
|
|
594
|
+
Text,
|
|
595
|
+
{
|
|
596
|
+
color,
|
|
597
|
+
size: "dropdownItemFontSize",
|
|
598
|
+
weight: "medium",
|
|
599
|
+
style: labelStyle
|
|
600
|
+
},
|
|
601
|
+
label
|
|
602
|
+
))
|
|
603
|
+
),
|
|
604
|
+
/* @__PURE__ */ React9.createElement(Box, { display: "flex", alignItems: "center", gap: "5" }, tagPosition === "end" && tagComponent, /* @__PURE__ */ React9.createElement(
|
|
605
|
+
AnimatedCaretDownIcon,
|
|
606
|
+
{
|
|
607
|
+
expanded: isOpened,
|
|
608
|
+
color: arrowColor,
|
|
609
|
+
compact: compactIcon
|
|
610
|
+
}
|
|
611
|
+
))
|
|
612
|
+
)
|
|
613
|
+
)
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
var BaseActiveDropdownItem_default = BaseActiveDropdownItem;
|
|
617
|
+
|
|
618
|
+
// src/components/Dropdown/BaseDropdown.utils.ts
|
|
619
|
+
var NO_SELECTION_VALUE = "";
|
|
620
|
+
var ADDITIONAL_GROUP_KEY = "__additional__";
|
|
621
|
+
function buildAllOptions(options, allowUnselect, unselectLabel) {
|
|
622
|
+
if (allowUnselect) {
|
|
623
|
+
return [
|
|
624
|
+
{
|
|
625
|
+
label: unselectLabel ?? "",
|
|
626
|
+
value: NO_SELECTION_VALUE
|
|
627
|
+
},
|
|
628
|
+
...options
|
|
629
|
+
];
|
|
630
|
+
}
|
|
631
|
+
return options;
|
|
632
|
+
}
|
|
633
|
+
function filterOptions(allOptions, searchInput) {
|
|
634
|
+
const search = searchInput?.trim().toLowerCase() ?? "";
|
|
635
|
+
return allOptions.filter(
|
|
636
|
+
(option) => option.label.toLowerCase().includes(search)
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
function organizeDropdownGroups(filteredOptions, groups, additionalGroup, additionalGroupLabel) {
|
|
640
|
+
const organizedGroups = [];
|
|
641
|
+
if (!groups) {
|
|
642
|
+
organizedGroups.push({
|
|
643
|
+
key: ADDITIONAL_GROUP_KEY,
|
|
644
|
+
label: void 0,
|
|
645
|
+
options: filteredOptions
|
|
646
|
+
});
|
|
647
|
+
return {
|
|
648
|
+
organizedGroups,
|
|
649
|
+
organizedOptions: filteredOptions
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
const unselectOption = filteredOptions.find(
|
|
653
|
+
(option) => option.value === NO_SELECTION_VALUE
|
|
654
|
+
);
|
|
655
|
+
if (unselectOption) {
|
|
656
|
+
organizedGroups.push({
|
|
657
|
+
key: NO_SELECTION_VALUE,
|
|
658
|
+
label: void 0,
|
|
659
|
+
options: [unselectOption]
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
const optionsByValue = new Map(
|
|
663
|
+
filteredOptions.filter((option) => option.value !== NO_SELECTION_VALUE).map((option) => [option.value, option])
|
|
664
|
+
);
|
|
665
|
+
const inflatedGroups = groups.map((group) => ({
|
|
666
|
+
...group,
|
|
667
|
+
// Only take the options that actually exist
|
|
668
|
+
// Note that this preserves the ordering of `group.values`
|
|
669
|
+
options: group.values.map((value) => optionsByValue.get(value)).filter((option) => !!option)
|
|
670
|
+
})).filter((group) => group.options.length > 0);
|
|
671
|
+
const hasNonEmptyGroup = inflatedGroups.length > 0;
|
|
672
|
+
for (const group of inflatedGroups) {
|
|
673
|
+
organizedGroups.push({
|
|
674
|
+
key: group.key,
|
|
675
|
+
label: group.label,
|
|
676
|
+
options: group.options
|
|
677
|
+
});
|
|
678
|
+
if (additionalGroup === "others") {
|
|
679
|
+
for (const option of group.options) {
|
|
680
|
+
optionsByValue.delete(option.value);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
if (optionsByValue.size > 0) {
|
|
685
|
+
organizedGroups.push({
|
|
686
|
+
key: ADDITIONAL_GROUP_KEY,
|
|
687
|
+
// Only show additional group label if there actually are other groups
|
|
688
|
+
label: hasNonEmptyGroup ? additionalGroupLabel : void 0,
|
|
689
|
+
options: [...optionsByValue.values()]
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
const organizedOptions = organizedGroups.flatMap((group) => group.options);
|
|
693
|
+
return { organizedGroups, organizedOptions };
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// src/components/Dropdown/BaseDropdown.tsx
|
|
697
|
+
var HORIZONTAL_ICON_GAP = "4";
|
|
698
|
+
var activeDropdownItemSize = {
|
|
699
|
+
compact: "18",
|
|
700
|
+
regular: "36",
|
|
701
|
+
large: "40"
|
|
702
|
+
};
|
|
703
|
+
function BaseDropdown({
|
|
704
|
+
activeItemProps,
|
|
705
|
+
value,
|
|
706
|
+
options,
|
|
707
|
+
groups,
|
|
708
|
+
additionalGroup = "others",
|
|
709
|
+
additionalGroupLabel,
|
|
710
|
+
allowUnselect = false,
|
|
711
|
+
unselectLabel,
|
|
712
|
+
onOptionSelected,
|
|
713
|
+
onOpen,
|
|
714
|
+
renderDropdownOption,
|
|
715
|
+
searchableOptions = false,
|
|
716
|
+
searchPlaceholder,
|
|
717
|
+
placeholder,
|
|
718
|
+
resetSearchOnClose = true,
|
|
719
|
+
openToTopOnMobile = true,
|
|
720
|
+
alwaysOpenToTop = false,
|
|
721
|
+
openDropdownFullWidth = true,
|
|
722
|
+
isLoading = false,
|
|
723
|
+
preloadIconUrls,
|
|
724
|
+
horizontalIconGap = HORIZONTAL_ICON_GAP,
|
|
725
|
+
openDropdownBackgroundColor = "openDropdownBackgroundColor",
|
|
726
|
+
size = "regular",
|
|
727
|
+
label,
|
|
728
|
+
maxDropdownHeight,
|
|
729
|
+
dropdownWidth,
|
|
730
|
+
dropdownAlign = "end",
|
|
731
|
+
testId
|
|
732
|
+
}) {
|
|
733
|
+
const { t } = useFunkitTranslation();
|
|
734
|
+
const themeRootProps = useThemeRootProps();
|
|
735
|
+
const isMobileDevice = isMobile();
|
|
736
|
+
const [isOpened, setIsOpened] = useState2(false);
|
|
737
|
+
const [searchInput, setSearchInput] = useState2("");
|
|
738
|
+
const { ref: scrollRef, hasTopDivider, isAtBottom } = useScrollDivider();
|
|
739
|
+
const allOptions = useMemo2(
|
|
740
|
+
() => buildAllOptions(options, allowUnselect, unselectLabel),
|
|
741
|
+
[options, allowUnselect, unselectLabel]
|
|
742
|
+
);
|
|
743
|
+
const selectedOption = allOptions.find((option) => option.value === value);
|
|
744
|
+
const prevIsOpenedRef = useRef2(false);
|
|
745
|
+
const portalThemeRef = useRef2(null);
|
|
746
|
+
const handleSearch = (event) => {
|
|
747
|
+
setSearchInput(event.target.value);
|
|
748
|
+
};
|
|
749
|
+
const filteredOptions = useMemo2(
|
|
750
|
+
() => filterOptions(allOptions, searchInput),
|
|
751
|
+
[allOptions, searchInput]
|
|
752
|
+
);
|
|
753
|
+
const { organizedGroups, organizedOptions } = useMemo2(
|
|
754
|
+
() => organizeDropdownGroups(
|
|
755
|
+
filteredOptions,
|
|
756
|
+
groups,
|
|
757
|
+
additionalGroup,
|
|
758
|
+
additionalGroupLabel
|
|
759
|
+
),
|
|
760
|
+
[additionalGroup, additionalGroupLabel, filteredOptions, groups]
|
|
761
|
+
);
|
|
762
|
+
const handleOpenChange = useCallback2(
|
|
763
|
+
(open) => {
|
|
764
|
+
setIsOpened(open);
|
|
765
|
+
if (open) {
|
|
766
|
+
onOpen?.();
|
|
767
|
+
} else {
|
|
768
|
+
resetSearchOnClose && setSearchInput("");
|
|
769
|
+
}
|
|
770
|
+
},
|
|
771
|
+
[onOpen, resetSearchOnClose]
|
|
772
|
+
);
|
|
773
|
+
useEffect3(() => {
|
|
774
|
+
if (isOpened && !prevIsOpenedRef.current) {
|
|
775
|
+
prevIsOpenedRef.current = true;
|
|
776
|
+
if (selectedOption) {
|
|
777
|
+
const selectedOptionIndex = organizedOptions.findIndex(
|
|
778
|
+
(option) => option.value === selectedOption.value
|
|
779
|
+
);
|
|
780
|
+
if (selectedOptionIndex !== -1) {
|
|
781
|
+
requestAnimationFrame(() => {
|
|
782
|
+
const selectedOptionElement = document.getElementById(
|
|
783
|
+
`${selectedOption.value}-dropdown-item`
|
|
784
|
+
);
|
|
785
|
+
selectedOptionElement?.scrollIntoView({
|
|
786
|
+
behavior: "instant",
|
|
787
|
+
block: "center"
|
|
788
|
+
});
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
} else if (!isOpened) {
|
|
793
|
+
prevIsOpenedRef.current = false;
|
|
794
|
+
}
|
|
795
|
+
}, [isOpened, selectedOption, organizedOptions]);
|
|
796
|
+
const dropdownSide = alwaysOpenToTop || openToTopOnMobile && isMobileDevice ? "top" : "bottom";
|
|
797
|
+
return /* @__PURE__ */ React10.createElement(Box, { display: "flex", flexDirection: "column", gap: "4", testId }, label && /* @__PURE__ */ React10.createElement(Text, { size: "12", color: "secondaryText" }, label), /* @__PURE__ */ React10.createElement(
|
|
798
|
+
DropdownMenu2.Root,
|
|
799
|
+
{
|
|
800
|
+
open: isOpened,
|
|
801
|
+
onOpenChange: handleOpenChange,
|
|
802
|
+
modal: false
|
|
803
|
+
},
|
|
804
|
+
/* @__PURE__ */ React10.createElement(
|
|
805
|
+
Box,
|
|
806
|
+
{
|
|
807
|
+
position: "relative",
|
|
808
|
+
display: size === "compact" ? "flex" : void 0
|
|
809
|
+
},
|
|
810
|
+
isLoading ? /* @__PURE__ */ React10.createElement(FunSkeletonBlock, { height: activeDropdownItemSize[size] }) : /* @__PURE__ */ React10.createElement(DropdownMenu2.Trigger, { asChild: true }, /* @__PURE__ */ React10.createElement("div", null, /* @__PURE__ */ React10.createElement(
|
|
811
|
+
BaseActiveDropdownItem_default,
|
|
812
|
+
{
|
|
813
|
+
color: !selectedOption && !activeItemProps?.label && !!placeholder ? "secondaryText" : "primaryText",
|
|
814
|
+
...activeItemProps,
|
|
815
|
+
size,
|
|
816
|
+
horizontalIconGap,
|
|
817
|
+
isOpened,
|
|
818
|
+
label: activeItemProps?.label ?? selectedOption?.label ?? placeholder ?? ""
|
|
819
|
+
}
|
|
820
|
+
))),
|
|
821
|
+
/* @__PURE__ */ React10.createElement(DropdownMenu2.Portal, null, /* @__PURE__ */ React10.createElement(
|
|
822
|
+
DropdownMenu2.Content,
|
|
823
|
+
{
|
|
824
|
+
...themeRootProps,
|
|
825
|
+
ref: portalThemeRef,
|
|
826
|
+
side: dropdownSide,
|
|
827
|
+
sideOffset: dropdownSide === "top" ? 8 : 6,
|
|
828
|
+
align: dropdownAlign,
|
|
829
|
+
className: "funkit-dropdown-content",
|
|
830
|
+
style: {
|
|
831
|
+
zIndex: `calc(${themeVars.modalZIndex} + 1)`,
|
|
832
|
+
width: dropdownWidth ? `${dropdownWidth}px` : openDropdownFullWidth ? "var(--radix-dropdown-menu-trigger-width)" : void 0,
|
|
833
|
+
transformOrigin: "var(--radix-dropdown-menu-content-transform-origin)"
|
|
834
|
+
},
|
|
835
|
+
onCloseAutoFocus: (e) => e.preventDefault()
|
|
836
|
+
},
|
|
837
|
+
/* @__PURE__ */ React10.createElement(TooltipAnchorRefContext.Provider, { value: portalThemeRef }, /* @__PURE__ */ React10.createElement(
|
|
838
|
+
Box,
|
|
839
|
+
{
|
|
840
|
+
background: openDropdownBackgroundColor,
|
|
841
|
+
borderColor: "transparent",
|
|
842
|
+
borderWidth: "1",
|
|
843
|
+
borderRadius: "dropdownList",
|
|
844
|
+
borderStyle: "solid",
|
|
845
|
+
boxShadow: "dropdown",
|
|
846
|
+
className: maxDropdownHeight ? scrollGradientWrapperStyles : void 0,
|
|
847
|
+
"data-fade-top": maxDropdownHeight && hasTopDivider ? "true" : "false",
|
|
848
|
+
"data-fade-bottom": maxDropdownHeight && !isAtBottom ? "true" : "false"
|
|
849
|
+
},
|
|
850
|
+
/* @__PURE__ */ React10.createElement(
|
|
851
|
+
Box,
|
|
852
|
+
{
|
|
853
|
+
className: maxDropdownHeight ? scrollableDropdownStyles : void 0,
|
|
854
|
+
ref: maxDropdownHeight ? scrollRef : void 0,
|
|
855
|
+
style: { maxHeight: maxDropdownHeight }
|
|
856
|
+
},
|
|
857
|
+
/* @__PURE__ */ React10.createElement(Box, { display: "flex", flexDirection: "column" }, searchableOptions && /* @__PURE__ */ React10.createElement(Box, { paddingTop: "8", paddingX: "8" }, /* @__PURE__ */ React10.createElement(
|
|
858
|
+
FunInput,
|
|
859
|
+
{
|
|
860
|
+
placeholder: searchPlaceholder ?? t("common.searchTokens"),
|
|
861
|
+
value: searchInput,
|
|
862
|
+
onChange: handleSearch,
|
|
863
|
+
prefixIcon: "SearchIcon"
|
|
864
|
+
}
|
|
865
|
+
)), organizedOptions.length === 0 ? /* @__PURE__ */ React10.createElement(FunNoResults, { text: t("common.noResultsFound") }) : /* @__PURE__ */ React10.createElement(
|
|
866
|
+
Box,
|
|
867
|
+
{
|
|
868
|
+
as: "ul",
|
|
869
|
+
display: "flex",
|
|
870
|
+
flexDirection: "column",
|
|
871
|
+
paddingY: size === "compact" ? "dropdownCompactPaddingY" : "dropdownPaddingY"
|
|
872
|
+
},
|
|
873
|
+
organizedGroups.map(
|
|
874
|
+
({
|
|
875
|
+
key: groupKey,
|
|
876
|
+
label: groupLabel,
|
|
877
|
+
options: optionsInGroup
|
|
878
|
+
}, groupIndex) => /* @__PURE__ */ React10.createElement(React10.Fragment, { key: groupKey }, groupIndex > 0 && /* @__PURE__ */ React10.createElement(
|
|
879
|
+
Box,
|
|
880
|
+
{
|
|
881
|
+
height: "1",
|
|
882
|
+
background: "lightStroke",
|
|
883
|
+
marginY: "dropdownGroupDividerMarginY"
|
|
884
|
+
}
|
|
885
|
+
), groupLabel && /* @__PURE__ */ React10.createElement(
|
|
886
|
+
Box,
|
|
887
|
+
{
|
|
888
|
+
paddingX: size === "compact" ? "dropdownCompactPaddingX" : "dropdownPaddingX"
|
|
889
|
+
},
|
|
890
|
+
/* @__PURE__ */ React10.createElement(
|
|
891
|
+
Box,
|
|
892
|
+
{
|
|
893
|
+
paddingX: "dropdownItemPaddingX",
|
|
894
|
+
paddingY: "dropdownItemPaddingY"
|
|
895
|
+
},
|
|
896
|
+
/* @__PURE__ */ React10.createElement(
|
|
897
|
+
Text,
|
|
898
|
+
{
|
|
899
|
+
color: "dropdownGroupHeader",
|
|
900
|
+
font: "dropdownGroupHeader",
|
|
901
|
+
size: "dropdownGroupHeader",
|
|
902
|
+
weight: "dropdownGroupHeader"
|
|
903
|
+
},
|
|
904
|
+
groupLabel
|
|
905
|
+
)
|
|
906
|
+
)
|
|
907
|
+
), optionsInGroup.map((singleOption) => {
|
|
908
|
+
const isSelected = singleOption.value === selectedOption?.value;
|
|
909
|
+
return /* @__PURE__ */ React10.createElement(
|
|
910
|
+
Box,
|
|
911
|
+
{
|
|
912
|
+
key: singleOption.value,
|
|
913
|
+
paddingX: size === "compact" ? "dropdownCompactPaddingX" : "dropdownPaddingX"
|
|
914
|
+
},
|
|
915
|
+
/* @__PURE__ */ React10.createElement(
|
|
916
|
+
Box,
|
|
917
|
+
{
|
|
918
|
+
id: `${singleOption.value}-dropdown-item`,
|
|
919
|
+
as: "li",
|
|
920
|
+
background: {
|
|
921
|
+
base: isSelected ? "selectedDropdownItemBackground" : "transparent",
|
|
922
|
+
hover: "offBackground"
|
|
923
|
+
},
|
|
924
|
+
className: baseDropdownItemWrapperStyles,
|
|
925
|
+
onClick: () => {
|
|
926
|
+
onOptionSelected?.(singleOption);
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
renderDropdownOption(
|
|
930
|
+
singleOption,
|
|
931
|
+
isSelected
|
|
932
|
+
)
|
|
933
|
+
)
|
|
934
|
+
);
|
|
935
|
+
}))
|
|
936
|
+
)
|
|
937
|
+
))
|
|
938
|
+
)
|
|
939
|
+
))
|
|
940
|
+
)),
|
|
941
|
+
preloadIconUrls && /* @__PURE__ */ React10.createElement(
|
|
942
|
+
Box,
|
|
943
|
+
{
|
|
944
|
+
display: "none",
|
|
945
|
+
"aria-hidden": true,
|
|
946
|
+
style: { position: "absolute", top: "-100%", left: "-100%" }
|
|
947
|
+
},
|
|
948
|
+
preloadIconUrls.map((url, index) => /* @__PURE__ */ React10.createElement("img", { key: `${url}-${index}`, src: url, alt: "" }))
|
|
949
|
+
)
|
|
950
|
+
)
|
|
951
|
+
));
|
|
952
|
+
}
|
|
953
|
+
var BaseDropdown_default = BaseDropdown;
|
|
954
|
+
|
|
955
|
+
// src/components/Dropdown/AccountSelectDropdown.tsx
|
|
956
|
+
var ACCOUNTS_GROUP = "accounts";
|
|
957
|
+
var ACTION_GROUP = "action";
|
|
958
|
+
function AccountSelectDropdown({
|
|
959
|
+
accounts,
|
|
960
|
+
selectedValue,
|
|
961
|
+
onSelect,
|
|
962
|
+
action,
|
|
963
|
+
prefixLabel,
|
|
964
|
+
label,
|
|
965
|
+
size,
|
|
966
|
+
dropdownWidth,
|
|
967
|
+
testId
|
|
968
|
+
}) {
|
|
969
|
+
const actionIdCollidesWithAccount = !!action && accounts.some((account) => account.value === action.id);
|
|
970
|
+
const actionId = action?.id;
|
|
971
|
+
useEffect4(() => {
|
|
972
|
+
if (actionIdCollidesWithAccount) {
|
|
973
|
+
logger.warn("accountSelectDropdown:actionIdCollidesWithAccountValue", {
|
|
974
|
+
actionId
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
}, [actionIdCollidesWithAccount, actionId]);
|
|
978
|
+
const options = [
|
|
979
|
+
...accounts.map((account) => ({
|
|
980
|
+
value: account.value,
|
|
981
|
+
label: account.label
|
|
982
|
+
})),
|
|
983
|
+
...action ? [{ value: action.id, label: action.label }] : []
|
|
984
|
+
];
|
|
985
|
+
const groups = action ? [
|
|
986
|
+
{
|
|
987
|
+
key: ACCOUNTS_GROUP,
|
|
988
|
+
label: "",
|
|
989
|
+
values: accounts.map((account) => account.value)
|
|
990
|
+
},
|
|
991
|
+
{ key: ACTION_GROUP, label: "", values: [action.id] }
|
|
992
|
+
] : void 0;
|
|
993
|
+
return /* @__PURE__ */ React11.createElement(
|
|
994
|
+
BaseDropdown_default,
|
|
995
|
+
{
|
|
996
|
+
testId,
|
|
997
|
+
label,
|
|
998
|
+
size,
|
|
999
|
+
dropdownWidth,
|
|
1000
|
+
value: selectedValue,
|
|
1001
|
+
options,
|
|
1002
|
+
groups,
|
|
1003
|
+
activeItemProps: { alwaysVisibleLabel: prefixLabel },
|
|
1004
|
+
renderDropdownOption: (option, isSelected) => {
|
|
1005
|
+
if (action && option.value === action.id) {
|
|
1006
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1007
|
+
BaseDropdownItem_default,
|
|
1008
|
+
{
|
|
1009
|
+
id: option.value,
|
|
1010
|
+
label: option.label,
|
|
1011
|
+
iconComponent: action.icon && // Render the icon in the theme's primary text colour
|
|
1012
|
+
// (the icon uses `currentColor`), matching the label.
|
|
1013
|
+
/* @__PURE__ */ React11.createElement(Box, { display: "flex", color: "primaryText" }, action.icon),
|
|
1014
|
+
horizontalIconGap: "8",
|
|
1015
|
+
onClick: action.onSelect
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
1019
|
+
const account = accounts.find((item) => item.value === option.value);
|
|
1020
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1021
|
+
BaseDropdownItem_default,
|
|
1022
|
+
{
|
|
1023
|
+
id: option.value,
|
|
1024
|
+
label: option.label,
|
|
1025
|
+
description: account?.description,
|
|
1026
|
+
isSelected,
|
|
1027
|
+
onClick: onSelect
|
|
1028
|
+
}
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// src/clients/polymarket/PolymarketDepositAccountDropdown.tsx
|
|
1036
|
+
var ACCOUNT_DROPDOWN_OPTIONS_WIDTH = 264;
|
|
1037
|
+
var BALANCE_PLACEHOLDER = "\u2014";
|
|
1038
|
+
function formatBalance(balanceUsd) {
|
|
1039
|
+
return balanceUsd === void 0 ? BALANCE_PLACEHOLDER : formatUsdFlooredToCent(balanceUsd);
|
|
1040
|
+
}
|
|
1041
|
+
function PolymarketDepositAccountDropdown({
|
|
1042
|
+
onStepChange,
|
|
1043
|
+
modalState,
|
|
1044
|
+
dynamicRoutingId,
|
|
1045
|
+
applyDynamicTargetAssetCandidate,
|
|
1046
|
+
predictions,
|
|
1047
|
+
perps
|
|
1048
|
+
}) {
|
|
1049
|
+
const { t } = useFunkitTranslation();
|
|
1050
|
+
const balances = usePolymarketAccountBalances({ predictions, perps });
|
|
1051
|
+
const selectedRoutingId = dynamicRoutingId === POLYMARKET_PERPS_ROUTING_ID ? POLYMARKET_PERPS_ROUTING_ID : POLYMARKET_PREDICTIONS_ROUTING_ID;
|
|
1052
|
+
const accountCandidate = (routingId, recipient) => ({
|
|
1053
|
+
tokenAddress: POLYGON_USDCE,
|
|
1054
|
+
tokenChainId: polygon.id.toString(),
|
|
1055
|
+
tokenSymbol: PUSD_TOKEN.symbol,
|
|
1056
|
+
iconSrc: PUSD_TOKEN.iconSrc,
|
|
1057
|
+
dynamicRoutingId: routingId,
|
|
1058
|
+
customRecipient: recipient
|
|
1059
|
+
});
|
|
1060
|
+
const handleSelectAccount = (routingId) => {
|
|
1061
|
+
const isPerps = routingId === POLYMARKET_PERPS_ROUTING_ID;
|
|
1062
|
+
applyDynamicTargetAssetCandidate?.(
|
|
1063
|
+
accountCandidate(
|
|
1064
|
+
isPerps ? POLYMARKET_PERPS_ROUTING_ID : POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
1065
|
+
isPerps ? perps.address : predictions.address
|
|
1066
|
+
)
|
|
1067
|
+
);
|
|
1068
|
+
};
|
|
1069
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1070
|
+
AccountSelectDropdown,
|
|
1071
|
+
{
|
|
1072
|
+
prefixLabel: t("perpsTransfer.depositTo"),
|
|
1073
|
+
dropdownWidth: ACCOUNT_DROPDOWN_OPTIONS_WIDTH,
|
|
1074
|
+
accounts: [
|
|
1075
|
+
{
|
|
1076
|
+
value: POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
1077
|
+
label: t("perpsTransfer.predictions"),
|
|
1078
|
+
description: formatBalance(balances.predictions.balanceUsd)
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
value: POLYMARKET_PERPS_ROUTING_ID,
|
|
1082
|
+
label: t("perpsTransfer.perps"),
|
|
1083
|
+
description: formatBalance(balances.perps.balanceUsd)
|
|
1084
|
+
}
|
|
1085
|
+
],
|
|
1086
|
+
selectedValue: selectedRoutingId,
|
|
1087
|
+
onSelect: handleSelectAccount,
|
|
1088
|
+
action: {
|
|
1089
|
+
id: "transfer-between-accounts",
|
|
1090
|
+
label: t("perpsTransfer.transferBetweenAccounts"),
|
|
1091
|
+
icon: /* @__PURE__ */ React12.createElement(SwitchIcon, null),
|
|
1092
|
+
// Navigation is absent on the loading skeleton; the action only fires
|
|
1093
|
+
// on the interactive screen. The transfer step reads balances from the
|
|
1094
|
+
// same shared cache, so none need to be threaded through here.
|
|
1095
|
+
onSelect: () => {
|
|
1096
|
+
if (onStepChange && modalState) {
|
|
1097
|
+
onStepChange({
|
|
1098
|
+
...modalState,
|
|
1099
|
+
step: "perps_transfer" /* PERPS_TRANSFER */
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
export {
|
|
1109
|
+
PolymarketDepositAccountDropdown
|
|
1110
|
+
};
|