@gearbox-protocol/ui-kit 3.13.0-next.1 → 3.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/composites/pool-table/columns.cjs +1 -1
- package/dist/cjs/components/composites/pool-table/pool-table.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/columns.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/components/cells/cells.cjs +1 -1
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/layout/main-aside-layout/main-aside-layout.cjs +1 -1
- package/dist/cjs/components/rounded-image/rounded-image.cjs +1 -1
- package/dist/cjs/components/token-icon/token-icon.cjs +1 -1
- package/dist/cjs/components/token-symbol/token-symbol.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/cjs/types/common.cjs +1 -1
- package/dist/esm/components/composites/pool-table/columns.js +344 -207
- package/dist/esm/components/composites/pool-table/pool-table.js +94 -102
- package/dist/esm/components/composites/strategies-table/columns.js +1 -1
- package/dist/esm/components/composites/strategies-table/components/cells/cells.js +31 -28
- package/dist/esm/components/compound-apy/compound-apy.js +71 -68
- package/dist/esm/components/layout/main-aside-layout/main-aside-layout.js +22 -70
- package/dist/esm/components/rounded-image/rounded-image.js +16 -16
- package/dist/esm/components/token-icon/token-icon.js +134 -44
- package/dist/esm/components/token-symbol/token-symbol.js +55 -46
- package/dist/esm/locale/en.json.js +1 -0
- package/dist/esm/types/common.js +6 -1
- package/dist/globals.css +1 -1
- package/dist/types/components/composites/pool-table/columns.d.ts +0 -2
- package/dist/types/components/composites/strategies-table/components/cells/cells.d.ts +2 -1
- package/dist/types/components/compound-apy/compound-apy.d.ts +1 -3
- package/dist/types/components/help-tip/help-tip.d.ts +2 -2
- package/dist/types/components/layout/main-aside-layout/main-aside-layout.d.ts +5 -46
- package/dist/types/components/token-icon/index.d.ts +1 -1
- package/dist/types/components/token-icon/token-icon.d.ts +8 -3
- package/dist/types/locale/en.json.d.ts +1 -0
- package/dist/types/types/common.d.ts +11 -1
- package/package.json +4 -4
- package/src/styles/base.css +2 -4
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { IconInfo as
|
|
1
|
+
import { jsx as i, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { IconInfo as N } from "@gearbox-protocol/static";
|
|
3
3
|
import * as y from "react";
|
|
4
|
-
import { PointsIcon as
|
|
5
|
-
import { PoolAPYTooltip as
|
|
6
|
-
import { TokenIcon as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { PointsIcon as j } from "../points-icon/points-icon.js";
|
|
5
|
+
import { PoolAPYTooltip as C } from "../pool-apy-tooltip/pool-apy-tooltip.js";
|
|
6
|
+
import { TokenIcon as L } from "../token-icon/token-icon.js";
|
|
7
|
+
import { isIconComposite as G } from "../../types/common.js";
|
|
8
|
+
import { formatPercentAmount as T } from "../../utils/format-money.js";
|
|
9
|
+
import { getStatic as Z } from "../../utils/static.js";
|
|
9
10
|
import "../accordion/accordion.js";
|
|
10
11
|
import "@fortawesome/free-solid-svg-icons";
|
|
11
12
|
import "../icons/fa-icon.js";
|
|
@@ -53,7 +54,7 @@ import "../with-title/with-title.js";
|
|
|
53
54
|
import "../smart-number-input/balance-indicator.js";
|
|
54
55
|
import "../smart-number-input/smart-number-input.js";
|
|
55
56
|
import "../table/grid-table.js";
|
|
56
|
-
import { getSymbolOrIcon as
|
|
57
|
+
import { getSymbolOrIcon as R } from "../token-symbol/token-symbol.js";
|
|
57
58
|
import "../typography/typography.js";
|
|
58
59
|
import "../help-tip/help-tip.js";
|
|
59
60
|
import "../description/description.js";
|
|
@@ -164,112 +165,114 @@ import "../theme-provider.js";
|
|
|
164
165
|
import "../time-to-liquidation/time-to-liquidation.js";
|
|
165
166
|
import "../toggle/toggle.js";
|
|
166
167
|
import "../with-filter-button/with-filter-button.js";
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
function O(r, m) {
|
|
169
|
+
if (r?.icon !== void 0 && G(r.icon))
|
|
170
|
+
return R(r) ?? (r.symbol || m);
|
|
171
|
+
const n = r?.symbol || m;
|
|
172
|
+
return n === "GEAR" ? { icon: Z("/logo/logo_symbol.png") } : R(r) || n;
|
|
170
173
|
}
|
|
171
|
-
function
|
|
172
|
-
totalAPY:
|
|
173
|
-
totalAPYLoading:
|
|
174
|
-
baseAPY:
|
|
174
|
+
function Fr({
|
|
175
|
+
totalAPY: r,
|
|
176
|
+
totalAPYLoading: m,
|
|
177
|
+
baseAPY: n,
|
|
175
178
|
extraAPY: u,
|
|
176
|
-
externalAPY:
|
|
177
|
-
points:
|
|
178
|
-
apy7DAgo:
|
|
179
|
+
externalAPY: t,
|
|
180
|
+
points: e,
|
|
181
|
+
apy7DAgo: z,
|
|
179
182
|
tokensList: g,
|
|
180
|
-
decimals:
|
|
181
|
-
className:
|
|
183
|
+
decimals: b = 2,
|
|
184
|
+
className: E
|
|
182
185
|
}) {
|
|
183
186
|
const a = y.useMemo(() => {
|
|
184
|
-
if (
|
|
187
|
+
if (t)
|
|
185
188
|
return {
|
|
186
|
-
...
|
|
187
|
-
value:
|
|
189
|
+
...t,
|
|
190
|
+
value: t.value ?? t.apy ?? 0
|
|
188
191
|
};
|
|
189
|
-
}, [
|
|
190
|
-
const d = s.length > 0,
|
|
191
|
-
|
|
192
|
-
...
|
|
193
|
-
].join("-")}%`,
|
|
194
|
-
return /* @__PURE__ */ h("div", { className:
|
|
192
|
+
}, [t]), s = y.useMemo(() => u.filter((d) => (d.apy || 0) > 0), [u]), w = !m && r >= 1e-3, v = () => {
|
|
193
|
+
const d = s.length > 0, V = a && !m && a.totalValue > 0 && a.totalValue !== r, $ = e && e.length > 0, M = `${[
|
|
194
|
+
T(r, b),
|
|
195
|
+
...V ? [T(a.totalValue, b)] : []
|
|
196
|
+
].join("-")}%`, x = Math.max(s.length, 0), I = e?.filter((o) => o.reward) ?? [], l = x + I.length;
|
|
197
|
+
return /* @__PURE__ */ h("div", { className: E, children: [
|
|
195
198
|
/* @__PURE__ */ h("span", { className: "inline-flex items-center", children: [
|
|
196
|
-
|
|
197
|
-
|
|
199
|
+
M,
|
|
200
|
+
w && /* @__PURE__ */ i("span", { className: "ml-1.5 leading-[0] text-gray-70", children: /* @__PURE__ */ i(N, { size: 14 }) })
|
|
198
201
|
] }),
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
(d ||
|
|
201
|
-
s.map((
|
|
202
|
-
const c = g?.[
|
|
203
|
-
return /* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ i("div", {}),
|
|
203
|
+
(d || $) && /* @__PURE__ */ h("span", { className: "relative inline-flex", children: [
|
|
204
|
+
s.map((o, p) => {
|
|
205
|
+
const c = g?.[o.rewardToken], f = p === l - 1;
|
|
206
|
+
return /* @__PURE__ */ i(
|
|
204
207
|
"span",
|
|
205
208
|
{
|
|
206
209
|
style: {
|
|
207
|
-
zIndex: l -
|
|
210
|
+
zIndex: l - p,
|
|
208
211
|
marginRight: f ? 0 : -7
|
|
209
212
|
},
|
|
210
|
-
children: /* @__PURE__ */
|
|
211
|
-
|
|
213
|
+
children: /* @__PURE__ */ i(
|
|
214
|
+
L,
|
|
212
215
|
{
|
|
213
|
-
symbol:
|
|
216
|
+
symbol: O(c, o.rewardTokenSymbol),
|
|
214
217
|
size: 14,
|
|
215
218
|
style: {
|
|
216
|
-
margin:
|
|
219
|
+
margin: o.rewardTokenSymbol === "GEAR" ? "-3px 0 0 0" : "0"
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
222
|
)
|
|
220
223
|
},
|
|
221
|
-
`extra-${
|
|
224
|
+
`extra-${o.rewardToken}-${o.apy}`
|
|
222
225
|
);
|
|
223
226
|
}),
|
|
224
|
-
|
|
225
|
-
const c =
|
|
226
|
-
return /* @__PURE__ */
|
|
227
|
+
I.map((o, p) => {
|
|
228
|
+
const c = p + x, f = c === l - 1;
|
|
229
|
+
return /* @__PURE__ */ i(
|
|
227
230
|
"span",
|
|
228
231
|
{
|
|
229
232
|
style: {
|
|
230
233
|
zIndex: l - c,
|
|
231
234
|
marginRight: f ? 0 : -7
|
|
232
235
|
},
|
|
233
|
-
children: /* @__PURE__ */
|
|
234
|
-
|
|
236
|
+
children: /* @__PURE__ */ i(
|
|
237
|
+
j,
|
|
235
238
|
{
|
|
236
239
|
reward: {
|
|
237
|
-
name:
|
|
238
|
-
type:
|
|
240
|
+
name: o.reward?.name || o.name,
|
|
241
|
+
type: o.reward?.type || o.name.toLowerCase()
|
|
239
242
|
},
|
|
240
243
|
size: 14
|
|
241
244
|
}
|
|
242
245
|
)
|
|
243
246
|
},
|
|
244
|
-
`points-${
|
|
247
|
+
`points-${o.name}-${p}`
|
|
245
248
|
);
|
|
246
249
|
})
|
|
247
250
|
] })
|
|
248
251
|
] });
|
|
249
|
-
},
|
|
250
|
-
if (
|
|
252
|
+
}, S = y.useMemo(() => {
|
|
253
|
+
if (t)
|
|
251
254
|
return {
|
|
252
|
-
totalValue:
|
|
253
|
-
apy:
|
|
254
|
-
name:
|
|
255
|
-
tooltip:
|
|
255
|
+
totalValue: t.totalValue,
|
|
256
|
+
apy: t.value ?? t.apy ?? 0,
|
|
257
|
+
name: t.name,
|
|
258
|
+
tooltip: t.tooltip
|
|
256
259
|
};
|
|
257
|
-
}, [
|
|
258
|
-
return
|
|
259
|
-
|
|
260
|
+
}, [t]);
|
|
261
|
+
return w ? /* @__PURE__ */ i(
|
|
262
|
+
C,
|
|
260
263
|
{
|
|
261
|
-
baseAPY:
|
|
264
|
+
baseAPY: n,
|
|
262
265
|
extraAPY: s,
|
|
263
|
-
totalAPY:
|
|
264
|
-
externalAPY:
|
|
265
|
-
points:
|
|
266
|
-
apy7DAgo:
|
|
266
|
+
totalAPY: r,
|
|
267
|
+
externalAPY: S,
|
|
268
|
+
points: e,
|
|
269
|
+
apy7DAgo: z,
|
|
267
270
|
tokensList: g,
|
|
268
|
-
children:
|
|
271
|
+
children: v()
|
|
269
272
|
}
|
|
270
|
-
) :
|
|
273
|
+
) : v();
|
|
271
274
|
}
|
|
272
275
|
export {
|
|
273
|
-
|
|
274
|
-
|
|
276
|
+
Fr as CompoundAPY,
|
|
277
|
+
O as getRewardTokenSymbol
|
|
275
278
|
};
|
|
@@ -1,83 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as s, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import { cn as a } from "../../../utils/cn.js";
|
|
4
|
+
const d = c.forwardRef(
|
|
5
5
|
({
|
|
6
|
-
children:
|
|
7
|
-
aside:
|
|
8
|
-
asidePosition:
|
|
9
|
-
asideClassName:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, f) => {
|
|
16
|
-
const l = o === "detail", a = m == null ? null : /* @__PURE__ */ i(
|
|
17
|
-
"aside",
|
|
18
|
-
{
|
|
19
|
-
className: x(
|
|
20
|
-
"min-w-0 shrink-0",
|
|
21
|
-
l && [
|
|
22
|
-
"w-full",
|
|
23
|
-
"z-30 lg:w-[420px] lg:min-w-[420px] lg:max-w-[420px]",
|
|
24
|
-
"xl:w-[460px] xl:min-w-[460px] xl:max-w-[460px]",
|
|
25
|
-
"max-h-full lg:max-h-[100vh] overflow-y-visible lg:overflow-y-auto",
|
|
26
|
-
// sticky below 2450px, fixed at ≥2450px
|
|
27
|
-
"lg:max-[2449px]:sticky lg:max-[2449px]:top-4",
|
|
28
|
-
"min-[2450px]:fixed min-[2450px]:top-28 min-[2450px]:right-32"
|
|
29
|
-
],
|
|
30
|
-
n
|
|
31
|
-
),
|
|
32
|
-
children: m
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
return /* @__PURE__ */ c(
|
|
6
|
+
children: i,
|
|
7
|
+
aside: e,
|
|
8
|
+
asidePosition: l = "right",
|
|
9
|
+
asideClassName: t,
|
|
10
|
+
className: m,
|
|
11
|
+
...o
|
|
12
|
+
}, n) => {
|
|
13
|
+
const r = e == null ? null : /* @__PURE__ */ s("aside", { className: a("min-w-0 shrink-0", t), children: e });
|
|
14
|
+
return /* @__PURE__ */ f(
|
|
36
15
|
"div",
|
|
37
16
|
{
|
|
38
|
-
ref:
|
|
39
|
-
className:
|
|
40
|
-
// base: mobile stack (column-reverse), desktop row
|
|
17
|
+
ref: n,
|
|
18
|
+
className: a(
|
|
41
19
|
"flex w-full flex-col-reverse gap-6 lg:flex-row lg:items-start",
|
|
42
|
-
|
|
43
|
-
"relative mx-auto min-w-0",
|
|
44
|
-
// cap width so aside doesn't overflow on medium-wide screens
|
|
45
|
-
"max-w-[calc(80rem+420px+1.5rem)]",
|
|
46
|
-
"xl:max-w-[calc(80rem+460px+1.5rem)]",
|
|
47
|
-
// at ≥2450px aside is fixed → switch wrapper to block so main can
|
|
48
|
-
// centre independently
|
|
49
|
-
"min-[2450px]:block min-[2450px]:max-w-none min-[2450px]:gap-0"
|
|
50
|
-
],
|
|
51
|
-
s
|
|
20
|
+
m
|
|
52
21
|
),
|
|
53
|
-
...
|
|
22
|
+
...o,
|
|
54
23
|
children: [
|
|
55
|
-
|
|
56
|
-
/* @__PURE__ */ i
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
ref: t,
|
|
60
|
-
className: x(
|
|
61
|
-
"min-w-0 flex-1",
|
|
62
|
-
l && [
|
|
63
|
-
"relative z-0 w-full",
|
|
64
|
-
// at ≥2450px: stop growing and centre with explicit max-width
|
|
65
|
-
// (leaves room for the fixed 460px aside + 8rem right offset)
|
|
66
|
-
"min-[2450px]:mx-auto min-[2450px]:flex-none",
|
|
67
|
-
"min-[2450px]:max-w-[min(80rem,calc(100vw-460px-8rem))]"
|
|
68
|
-
],
|
|
69
|
-
p
|
|
70
|
-
),
|
|
71
|
-
children: r
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
e === "right" && a
|
|
24
|
+
l === "left" && r,
|
|
25
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: i }),
|
|
26
|
+
l === "right" && r
|
|
75
27
|
]
|
|
76
28
|
}
|
|
77
29
|
);
|
|
78
30
|
}
|
|
79
31
|
);
|
|
80
|
-
|
|
32
|
+
d.displayName = "MainAsideLayout";
|
|
81
33
|
export {
|
|
82
|
-
|
|
34
|
+
d as MainAsideLayout
|
|
83
35
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { useState as s, useRef as
|
|
1
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import * as L from "react";
|
|
3
|
+
import { useState as s, useRef as j, useEffect as E } from "react";
|
|
4
4
|
import "@gearbox-protocol/sdk";
|
|
5
5
|
import { cn as k } from "../../utils/cn.js";
|
|
6
6
|
import "sonner";
|
|
@@ -8,40 +8,40 @@ import "@gearbox-protocol/sdk/common-utils";
|
|
|
8
8
|
import { getStatic as w } from "../../utils/static.js";
|
|
9
9
|
import "luxon";
|
|
10
10
|
import "../../utils/z-index.js";
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
return i.get(e) ?
|
|
11
|
+
const d = w("/tokens/default.svg"), i = /* @__PURE__ */ new Map();
|
|
12
|
+
function c(e) {
|
|
13
|
+
return i.get(e) ? d : e;
|
|
14
14
|
}
|
|
15
|
-
const N =
|
|
15
|
+
const N = L.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
className: e,
|
|
18
18
|
size: o,
|
|
19
19
|
rounded: f = !0,
|
|
20
20
|
style: l,
|
|
21
21
|
src: r,
|
|
22
|
-
defaultIcon: m =
|
|
22
|
+
defaultIcon: m = d,
|
|
23
23
|
fit: u = "cover",
|
|
24
24
|
...g
|
|
25
25
|
}, p) => {
|
|
26
|
-
const [h, a] = s(void 0), [v, n] = s(!1), t =
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const [h, a] = s(void 0), [v, n] = s(!1), t = j(!1);
|
|
27
|
+
E(() => {
|
|
28
|
+
c(r), a(void 0), n(!1), t.current = !1;
|
|
29
29
|
}, [r]);
|
|
30
|
-
const y = (
|
|
31
|
-
t.current || (t.current = !0, i.set(
|
|
30
|
+
const y = (b) => {
|
|
31
|
+
t.current || (t.current = !0, i.set(b.currentTarget.src, !0), a(m));
|
|
32
32
|
}, R = () => {
|
|
33
33
|
n(!0);
|
|
34
34
|
};
|
|
35
35
|
return (
|
|
36
36
|
// biome-ignore lint/performance/noImgElement: Universal component that works outside Next.js
|
|
37
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ I(
|
|
38
38
|
"img",
|
|
39
39
|
{
|
|
40
40
|
ref: p,
|
|
41
|
-
src: h ||
|
|
41
|
+
src: h || c(r),
|
|
42
42
|
alt: "",
|
|
43
43
|
className: k(
|
|
44
|
-
u === "cover" ? "object-cover" : "object-contain",
|
|
44
|
+
u === "cover" ? "object-cover" : "object-contain object-center",
|
|
45
45
|
f && "rounded-full",
|
|
46
46
|
!v && "bg-gray-90 dark:bg-gray-110 rounded-full",
|
|
47
47
|
e
|
|
@@ -1,53 +1,143 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as r, jsxs as S, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import w from "react";
|
|
3
|
+
import "@gearbox-protocol/sdk";
|
|
4
|
+
import { cn as I } from "../../utils/cn.js";
|
|
5
|
+
import "sonner";
|
|
6
|
+
import "@gearbox-protocol/sdk/common-utils";
|
|
7
|
+
import { getStatic as d } from "../../utils/static.js";
|
|
8
|
+
import "luxon";
|
|
9
|
+
import "../../utils/z-index.js";
|
|
10
|
+
import { RoundedImage as l } from "../rounded-image/rounded-image.js";
|
|
11
|
+
const s = d("/tokens/default.svg");
|
|
12
|
+
function T(t) {
|
|
13
|
+
return t.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase();
|
|
8
14
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
if (typeof e == "object" && e !== null && "icon" in e)
|
|
12
|
-
return e.icon;
|
|
13
|
-
const n = d(e);
|
|
14
|
-
return n ? c(`/tokens/${n}.svg`) : r;
|
|
15
|
+
function j(t) {
|
|
16
|
+
return typeof t == "object" && t !== null && "icon" in t && !("kind" in t);
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
|
|
18
|
+
function k(t) {
|
|
19
|
+
return typeof t == "object" && t !== null && "kind" in t && t.kind === "composite";
|
|
20
|
+
}
|
|
21
|
+
function u(t) {
|
|
22
|
+
if (t.type === "url") return t.url;
|
|
23
|
+
const o = T(t.symbol);
|
|
24
|
+
return o ? d(`/tokens/${o}.svg`) : s;
|
|
25
|
+
}
|
|
26
|
+
function y(t) {
|
|
27
|
+
if (!t || k(t))
|
|
28
|
+
return s;
|
|
29
|
+
if (j(t))
|
|
30
|
+
return t.icon;
|
|
31
|
+
const o = T(t);
|
|
32
|
+
return o ? d(`/tokens/${o}.svg`) : s;
|
|
33
|
+
}
|
|
34
|
+
function F(t) {
|
|
35
|
+
return t ? k(t) ? t.layers.map(u) : [y(t)] : [s];
|
|
36
|
+
}
|
|
37
|
+
const b = 0.65, L = w.forwardRef(function({ symbol: o, size: e = 48, fit: n = "contain", rounded: c = !1, className: a, ...f }, i) {
|
|
38
|
+
if (k(o))
|
|
39
|
+
return /* @__PURE__ */ r(
|
|
40
|
+
N,
|
|
28
41
|
{
|
|
29
|
-
ref:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
rounded:
|
|
34
|
-
|
|
35
|
-
width: n,
|
|
36
|
-
height: n,
|
|
37
|
-
size: n,
|
|
38
|
-
...i
|
|
42
|
+
ref: i,
|
|
43
|
+
composite: o,
|
|
44
|
+
size: e,
|
|
45
|
+
fit: n,
|
|
46
|
+
rounded: c,
|
|
47
|
+
className: a
|
|
39
48
|
}
|
|
40
49
|
);
|
|
50
|
+
const p = y(o);
|
|
51
|
+
return /* @__PURE__ */ r(
|
|
52
|
+
l,
|
|
53
|
+
{
|
|
54
|
+
ref: i,
|
|
55
|
+
className: a,
|
|
56
|
+
src: p,
|
|
57
|
+
alt: "",
|
|
58
|
+
rounded: c,
|
|
59
|
+
fit: n,
|
|
60
|
+
width: e,
|
|
61
|
+
height: e,
|
|
62
|
+
size: e,
|
|
63
|
+
...f
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}), N = w.forwardRef(function({ composite: o, size: e, fit: n, rounded: c, className: a }, f) {
|
|
67
|
+
const { preset: i, layers: p, scaleFactor: U = b } = o, [C, x] = p, g = u(C), R = u(x), m = Math.round(e * U);
|
|
68
|
+
let h;
|
|
69
|
+
switch (i) {
|
|
70
|
+
case "centered_foreground":
|
|
71
|
+
h = /* @__PURE__ */ S(_, { children: [
|
|
72
|
+
/* @__PURE__ */ r(
|
|
73
|
+
l,
|
|
74
|
+
{
|
|
75
|
+
className: "absolute inset-0",
|
|
76
|
+
style: { zIndex: 0 },
|
|
77
|
+
src: g,
|
|
78
|
+
alt: "background",
|
|
79
|
+
rounded: c,
|
|
80
|
+
fit: n,
|
|
81
|
+
size: e
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ r(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: I(
|
|
88
|
+
"absolute left-1/2 top-1/2 z-[1] -translate-x-1/2 -translate-y-1/2",
|
|
89
|
+
"flex items-center justify-center"
|
|
90
|
+
),
|
|
91
|
+
style: {
|
|
92
|
+
width: m,
|
|
93
|
+
height: m
|
|
94
|
+
},
|
|
95
|
+
children: /* @__PURE__ */ r(
|
|
96
|
+
l,
|
|
97
|
+
{
|
|
98
|
+
src: R,
|
|
99
|
+
alt: "foreground",
|
|
100
|
+
rounded: c,
|
|
101
|
+
fit: n,
|
|
102
|
+
size: m
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] });
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
return console.error("Unknown TokenIcon composite preset", i), /* @__PURE__ */ r(
|
|
111
|
+
l,
|
|
112
|
+
{
|
|
113
|
+
src: g,
|
|
114
|
+
alt: "error",
|
|
115
|
+
rounded: c,
|
|
116
|
+
fit: n,
|
|
117
|
+
size: e
|
|
118
|
+
}
|
|
119
|
+
);
|
|
41
120
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
121
|
+
return /* @__PURE__ */ r(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
ref: f,
|
|
125
|
+
className: I("relative inline-block shrink-0", a),
|
|
126
|
+
style: { width: e, height: e },
|
|
127
|
+
children: h
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
N.displayName = "TokenIconComposite";
|
|
132
|
+
L.displayName = "TokenIcon";
|
|
133
|
+
function B(t) {
|
|
134
|
+
for (const o of t)
|
|
135
|
+
for (const e of F(o)) {
|
|
136
|
+
const n = new window.Image();
|
|
137
|
+
n.src = e;
|
|
138
|
+
}
|
|
49
139
|
}
|
|
50
140
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
141
|
+
L as TokenIcon,
|
|
142
|
+
B as preloadTokenIcons
|
|
53
143
|
};
|