@gearbox-protocol/ui-kit 4.0.1 → 4.1.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/dist/cjs/components/base/review-button/review-button.cjs +1 -1
- package/dist/cjs/components/base/segmented-tabs/segmented-tabs.cjs +1 -1
- package/dist/cjs/components/buttons/button/button.variants.cjs +1 -1
- package/dist/cjs/components/buttons/tab-button/tab-button.cjs +1 -1
- package/dist/cjs/components/client-adapters/index.cjs +1 -1
- package/dist/cjs/components/graph/default-config.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/rounded-image/rounded-image.cjs +1 -1
- package/dist/cjs/components/token-icon/token-icon-source.cjs +1 -1
- package/dist/cjs/components/token-icon/token-icon.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/base/review-button/review-button.js +19 -25
- package/dist/esm/components/base/segmented-tabs/segmented-tabs.js +7 -6
- package/dist/esm/components/buttons/button/button.variants.js +5 -5
- package/dist/esm/components/buttons/tab-button/tab-button.js +12 -9
- package/dist/esm/components/client-adapters/index.js +2 -4
- package/dist/esm/components/graph/default-config.js +20 -20
- package/dist/esm/components/index.js +279 -281
- package/dist/esm/components/navbar-logo/navbar-logo.js +10 -13
- package/dist/esm/components/rounded-image/rounded-image.js +42 -45
- package/dist/esm/components/token-icon/token-icon-source.js +51 -44
- package/dist/esm/components/token-icon/token-icon.js +28 -136
- package/dist/esm/index.js +327 -329
- package/dist/globals.css +1 -1
- package/dist/types/components/client-adapters/index.d.ts +0 -1
- package/dist/types/components/token-icon/token-icon-source.d.ts +4 -42
- package/dist/types/components/token-icon/token-icon.d.ts +6 -17
- package/dist/types/components/token-symbol/token-symbol.d.ts +1 -1
- package/dist/types/types/common.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/client-adapters/styled-button/index.cjs +0 -1
- package/dist/cjs/components/client-adapters/styled-button/styled-button.cjs +0 -1
- package/dist/esm/components/client-adapters/styled-button/index.js +0 -4
- package/dist/esm/components/client-adapters/styled-button/styled-button.js +0 -29
- package/dist/types/components/client-adapters/styled-button/index.d.ts +0 -1
- package/dist/types/components/client-adapters/styled-button/styled-button.d.ts +0 -18
|
@@ -9,19 +9,16 @@ function p({
|
|
|
9
9
|
...n
|
|
10
10
|
}) {
|
|
11
11
|
const r = o ? { width: o, height: o } : {};
|
|
12
|
-
return (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...n
|
|
23
|
-
}
|
|
24
|
-
)
|
|
12
|
+
return /* @__PURE__ */ a(
|
|
13
|
+
"img",
|
|
14
|
+
{
|
|
15
|
+
alt: "Logo",
|
|
16
|
+
className: c("object-contain", t),
|
|
17
|
+
style: { ...r, ...i },
|
|
18
|
+
loading: "lazy",
|
|
19
|
+
decoding: "async",
|
|
20
|
+
...n
|
|
21
|
+
}
|
|
25
22
|
);
|
|
26
23
|
}
|
|
27
24
|
export {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { useState as i, useRef as
|
|
4
|
-
import { cn as
|
|
1
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import * as w from "react";
|
|
3
|
+
import { useState as i, useRef as f, useEffect as N } from "react";
|
|
4
|
+
import { cn as k } from "../../utils/cn.js";
|
|
5
5
|
import "@gearbox-protocol/sdk/onchain";
|
|
6
6
|
import "../../utils/z-index.js";
|
|
7
|
-
import { getStatic as
|
|
8
|
-
const u =
|
|
9
|
-
function
|
|
7
|
+
import { getStatic as x } from "../../utils/internal/static.js";
|
|
8
|
+
const u = x("/tokens/default.svg"), m = /* @__PURE__ */ new Map();
|
|
9
|
+
function l(t) {
|
|
10
10
|
return m.get(t) ? u : t;
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const C = w.forwardRef(
|
|
13
13
|
({
|
|
14
14
|
className: t,
|
|
15
15
|
size: c,
|
|
@@ -20,49 +20,46 @@ const U = k.forwardRef(
|
|
|
20
20
|
fit: R = "cover",
|
|
21
21
|
...y
|
|
22
22
|
}, r) => {
|
|
23
|
-
const [v, s] = i(void 0), [b,
|
|
24
|
-
d.current = e, typeof r == "function" ? r(e) : r && (r.current = e), e?.complete && e.naturalWidth > 0 &&
|
|
23
|
+
const [v, s] = i(void 0), [b, a] = i(!1), n = f(!1), d = f(null), L = (e) => {
|
|
24
|
+
d.current = e, typeof r == "function" ? r(e) : r && (r.current = e), e?.complete && e.naturalWidth > 0 && a(!0);
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
N(() => {
|
|
27
|
+
l(o), s(void 0), n.current = !1;
|
|
28
28
|
const e = d.current;
|
|
29
|
-
|
|
29
|
+
a(!!e?.complete && e.naturalWidth > 0);
|
|
30
30
|
}, [o]);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
31
|
+
const j = (e) => {
|
|
32
|
+
n.current || (n.current = !0, m.set(e.currentTarget.src, !0), s(h));
|
|
33
|
+
}, E = () => {
|
|
34
|
+
a(!0);
|
|
35
35
|
};
|
|
36
|
-
return (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
...y
|
|
60
|
-
}
|
|
61
|
-
)
|
|
36
|
+
return /* @__PURE__ */ I(
|
|
37
|
+
"img",
|
|
38
|
+
{
|
|
39
|
+
ref: L,
|
|
40
|
+
src: v || l(o),
|
|
41
|
+
alt: "",
|
|
42
|
+
className: k(
|
|
43
|
+
R === "cover" ? "object-cover" : "object-contain object-center",
|
|
44
|
+
g && "rounded-full",
|
|
45
|
+
!b && "bg-gray-90 dark:bg-gray-110 rounded-full",
|
|
46
|
+
t
|
|
47
|
+
),
|
|
48
|
+
style: {
|
|
49
|
+
width: c,
|
|
50
|
+
height: c,
|
|
51
|
+
...p
|
|
52
|
+
},
|
|
53
|
+
loading: "lazy",
|
|
54
|
+
decoding: "async",
|
|
55
|
+
onError: j,
|
|
56
|
+
onLoad: E,
|
|
57
|
+
...y
|
|
58
|
+
}
|
|
62
59
|
);
|
|
63
60
|
}
|
|
64
61
|
);
|
|
65
|
-
|
|
62
|
+
C.displayName = "RoundedImage";
|
|
66
63
|
export {
|
|
67
|
-
|
|
64
|
+
C as RoundedImage
|
|
68
65
|
};
|
|
@@ -1,48 +1,55 @@
|
|
|
1
|
-
import { getStatic as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
{ prefix: "sd", requiresVersion: !0 },
|
|
6
|
-
{ prefix: "d", requiresVersion: !0 }
|
|
7
|
-
];
|
|
8
|
-
function c(e) {
|
|
9
|
-
for (const { prefix: i, requiresVersion: t } of u) {
|
|
10
|
-
if (!e.startsWith(i)) continue;
|
|
11
|
-
let r = e.slice(i.length);
|
|
12
|
-
if (r.endsWith(o) && (r = r.slice(0, -o.length)), n.test(r))
|
|
13
|
-
r = r.replace(n, "");
|
|
14
|
-
else if (t)
|
|
15
|
-
continue;
|
|
16
|
-
if (r) return r;
|
|
17
|
-
}
|
|
1
|
+
import { getStatic as d } from "../../utils/internal/static.js";
|
|
2
|
+
const r = d("/tokens/default.svg"), u = d("/logo/logo_symbol.png");
|
|
3
|
+
function e(t) {
|
|
4
|
+
return t.replaceAll("/", "").replaceAll(" ", "").toLowerCase();
|
|
18
5
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
6
|
+
const w = {
|
|
7
|
+
// Curve factory pools, on the base pool's icon.
|
|
8
|
+
"crvusdfrax-f": "crvusdfrax",
|
|
9
|
+
"crvusdusdc-f": "crvusdusdc",
|
|
10
|
+
"crvusdusdt-f": "crvusdusdt",
|
|
11
|
+
"cvxcrvusdfrax-f": "cvxcrvusdfrax",
|
|
12
|
+
"cvxcrvusdusdc-f": "cvxcrvusdusdc",
|
|
13
|
+
"cvxcrvusdusdt-f": "cvxcrvusdusdt",
|
|
14
|
+
"stkcvxcrvusdfrax-f": "stkcvxcrvusdfrax",
|
|
15
|
+
"stkcvxcrvusdusdc-f": "stkcvxcrvusdusdc",
|
|
16
|
+
"stkcvxcrvusdusdt-f": "stkcvxcrvusdusdt",
|
|
17
|
+
// Mellow withdrawal phantoms. The SDK reports all of them as one `wdwstETH`;
|
|
18
|
+
// only the backend tells the vaults apart, and the icon never did.
|
|
19
|
+
"wdwsteth[cp0xlrt]": "wdwsteth",
|
|
20
|
+
"wdwsteth[pzeth]": "wdwsteth",
|
|
21
|
+
"wdwsteth[re7lrt]": "wdwsteth",
|
|
22
|
+
"wdwsteth[rsteth]": "wdwsteth",
|
|
23
|
+
"wdwsteth[steaklrt]": "wdwsteth",
|
|
24
|
+
// Withdrawal phantoms of a single asset.
|
|
25
|
+
wdiusd: "iusd",
|
|
26
|
+
wdrseth: "rseth",
|
|
27
|
+
// Curator variants of a pool share token.
|
|
28
|
+
"dwbtc-v3-0": "dwbtcv3",
|
|
29
|
+
"dwethv3-cp0x": "dwethv3",
|
|
30
|
+
// Wrappers and staked versions, on the asset they hold.
|
|
31
|
+
fweth: "weth",
|
|
32
|
+
fwsteth: "wsteth",
|
|
33
|
+
kpkfrxusd: "frxusd",
|
|
34
|
+
kpkweth: "weth",
|
|
35
|
+
kpkwsteth: "wsteth",
|
|
36
|
+
stkrlusdusdc: "rlusdusdc",
|
|
37
|
+
syusd: "yusd",
|
|
38
|
+
xtz: "wxtz",
|
|
39
|
+
// Curated vaults, on their underlying.
|
|
40
|
+
"cyb-cbbtc": "cbbtc",
|
|
41
|
+
"cyb-tbtc": "tbtc",
|
|
42
|
+
"cyb-wbtc": "wbtc",
|
|
43
|
+
re7tbtc: "tbtc",
|
|
44
|
+
re7usdc: "usdc"
|
|
45
|
+
};
|
|
46
|
+
function f(t) {
|
|
47
|
+
const s = typeof t == "string" ? t : t?.symbol;
|
|
48
|
+
if (!s) return r;
|
|
49
|
+
if (s === "GEAR") return u;
|
|
50
|
+
const c = e(s);
|
|
51
|
+
return c ? d(`/tokens/${w[c] ?? c}.svg`) : r;
|
|
44
52
|
}
|
|
45
53
|
export {
|
|
46
|
-
|
|
47
|
-
c as parseShareTokenUnderlying
|
|
54
|
+
f as getTokenIconUrl
|
|
48
55
|
};
|
|
@@ -1,143 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return typeof t == "object" && t !== null && "kind" in t && t.kind === "composite";
|
|
18
|
-
}
|
|
19
|
-
function T(t) {
|
|
20
|
-
if (t.type === "url") return t.url;
|
|
21
|
-
const e = w(t.symbol);
|
|
22
|
-
return e ? k(`/tokens/${e}.svg`) : u;
|
|
23
|
-
}
|
|
24
|
-
function j(t) {
|
|
25
|
-
if (!t || N(t))
|
|
26
|
-
return u;
|
|
27
|
-
if (_(t))
|
|
28
|
-
return t.icon;
|
|
29
|
-
const e = w(t);
|
|
30
|
-
return e ? k(`/tokens/${e}.svg`) : u;
|
|
31
|
-
}
|
|
32
|
-
const F = 0.65;
|
|
33
|
-
function L(t, e) {
|
|
34
|
-
return t !== void 0 ? I(t) : typeof e == "string" ? I(e) : e;
|
|
35
|
-
}
|
|
36
|
-
const v = b.forwardRef(function({
|
|
37
|
-
token: e,
|
|
38
|
-
symbol: n,
|
|
39
|
-
size: o = 48,
|
|
40
|
-
fit: c = "contain",
|
|
41
|
-
rounded: s = !1,
|
|
42
|
-
className: a,
|
|
43
|
-
...l
|
|
44
|
-
}, f) {
|
|
45
|
-
const i = L(e, n);
|
|
46
|
-
if (N(i))
|
|
47
|
-
return /* @__PURE__ */ r(
|
|
48
|
-
C,
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import i from "react";
|
|
3
|
+
import { getTokenIconUrl as d } from "./token-icon-source.js";
|
|
4
|
+
import { RoundedImage as p } from "../rounded-image/rounded-image.js";
|
|
5
|
+
const l = i.forwardRef(
|
|
6
|
+
function({
|
|
7
|
+
token: n,
|
|
8
|
+
symbol: r,
|
|
9
|
+
size: o = 48,
|
|
10
|
+
fit: t = "contain",
|
|
11
|
+
rounded: e = !1,
|
|
12
|
+
className: m,
|
|
13
|
+
...a
|
|
14
|
+
}, c) {
|
|
15
|
+
return /* @__PURE__ */ f(
|
|
16
|
+
p,
|
|
49
17
|
{
|
|
50
|
-
ref:
|
|
51
|
-
|
|
18
|
+
ref: c,
|
|
19
|
+
className: m,
|
|
20
|
+
src: d(n ?? r),
|
|
21
|
+
alt: "",
|
|
22
|
+
rounded: e,
|
|
23
|
+
fit: t,
|
|
24
|
+
width: o,
|
|
25
|
+
height: o,
|
|
52
26
|
size: o,
|
|
53
|
-
|
|
54
|
-
rounded: s,
|
|
55
|
-
className: a
|
|
27
|
+
...a
|
|
56
28
|
}
|
|
57
29
|
);
|
|
58
|
-
const p = j(i);
|
|
59
|
-
return /* @__PURE__ */ r(
|
|
60
|
-
m,
|
|
61
|
-
{
|
|
62
|
-
ref: f,
|
|
63
|
-
className: a,
|
|
64
|
-
src: p,
|
|
65
|
-
alt: "",
|
|
66
|
-
rounded: s,
|
|
67
|
-
fit: c,
|
|
68
|
-
width: o,
|
|
69
|
-
height: o,
|
|
70
|
-
size: o,
|
|
71
|
-
...l
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
}), C = b.forwardRef(function({ composite: e, size: n, fit: o, rounded: c, className: s }, a) {
|
|
75
|
-
const { preset: l, layers: f, scaleFactor: i = F } = e, [p, S] = f, g = T(p), U = T(S), d = Math.round(n * i);
|
|
76
|
-
let h;
|
|
77
|
-
switch (l) {
|
|
78
|
-
case "centered_foreground":
|
|
79
|
-
h = /* @__PURE__ */ x(R, { children: [
|
|
80
|
-
/* @__PURE__ */ r(
|
|
81
|
-
m,
|
|
82
|
-
{
|
|
83
|
-
className: "absolute inset-0",
|
|
84
|
-
style: { zIndex: 0 },
|
|
85
|
-
src: g,
|
|
86
|
-
alt: "background",
|
|
87
|
-
rounded: c,
|
|
88
|
-
fit: o,
|
|
89
|
-
size: n
|
|
90
|
-
}
|
|
91
|
-
),
|
|
92
|
-
/* @__PURE__ */ r(
|
|
93
|
-
"div",
|
|
94
|
-
{
|
|
95
|
-
className: y(
|
|
96
|
-
"absolute left-1/2 top-1/2 z-[1] -translate-x-1/2 -translate-y-1/2",
|
|
97
|
-
"flex items-center justify-center"
|
|
98
|
-
),
|
|
99
|
-
style: {
|
|
100
|
-
width: d,
|
|
101
|
-
height: d
|
|
102
|
-
},
|
|
103
|
-
children: /* @__PURE__ */ r(
|
|
104
|
-
m,
|
|
105
|
-
{
|
|
106
|
-
src: U,
|
|
107
|
-
alt: "foreground",
|
|
108
|
-
rounded: c,
|
|
109
|
-
fit: o,
|
|
110
|
-
size: d
|
|
111
|
-
}
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
] });
|
|
116
|
-
break;
|
|
117
|
-
default:
|
|
118
|
-
return console.error("Unknown TokenIcon composite preset", l), /* @__PURE__ */ r(
|
|
119
|
-
m,
|
|
120
|
-
{
|
|
121
|
-
src: g,
|
|
122
|
-
alt: "error",
|
|
123
|
-
rounded: c,
|
|
124
|
-
fit: o,
|
|
125
|
-
size: n
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
30
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
{
|
|
132
|
-
ref: a,
|
|
133
|
-
className: y("relative inline-block shrink-0", s),
|
|
134
|
-
style: { width: n, height: n },
|
|
135
|
-
children: h
|
|
136
|
-
}
|
|
137
|
-
);
|
|
138
|
-
});
|
|
139
|
-
C.displayName = "TokenIconComposite";
|
|
140
|
-
v.displayName = "TokenIcon";
|
|
31
|
+
);
|
|
32
|
+
l.displayName = "TokenIcon";
|
|
141
33
|
export {
|
|
142
|
-
|
|
34
|
+
l as TokenIcon
|
|
143
35
|
};
|