@gearbox-protocol/ui-kit 4.0.0-next.27 → 4.0.0-next.28
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/apy-breakdown-body/apy-breakdown-body.cjs +1 -0
- package/dist/cjs/components/base/apy-breakdown-body/index.cjs +1 -0
- package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
- package/dist/cjs/components/base/pool-apy-breakdown-card/constants.cjs +1 -1
- package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/index.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/base/apy-breakdown-body/apy-breakdown-body.js +106 -0
- package/dist/esm/components/base/apy-breakdown-body/index.js +10 -0
- package/dist/esm/components/base/info-list/info-list.js +1 -1
- package/dist/esm/components/base/pool-apy-breakdown-card/constants.js +5 -2
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +111 -57
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +138 -209
- package/dist/esm/components/index.js +45 -44
- package/dist/esm/components/yield-breakdown-tooltip/index.js +2 -1
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +136 -156
- package/dist/esm/index.js +191 -190
- package/dist/globals.css +1 -1
- package/dist/types/components/base/apy-breakdown-body/apy-breakdown-body.d.ts +42 -0
- package/dist/types/components/base/apy-breakdown-body/index.d.ts +2 -0
- package/dist/types/components/base/pool-apy-breakdown-card/constants.d.ts +3 -0
- package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +9 -7
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +23 -3
- package/package.json +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsxs as a, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { bpsToPercent as c } from "../../../utils/bps.js";
|
|
3
|
+
import { cn as i } from "../../../utils/cn.js";
|
|
4
|
+
const x = "—", p = "400px";
|
|
5
|
+
function g(n, t, e) {
|
|
6
|
+
return n === "7d" ? e : t;
|
|
7
|
+
}
|
|
8
|
+
function b(n) {
|
|
9
|
+
const t = c(n), e = `${Math.abs(t).toFixed(2)}%`;
|
|
10
|
+
return t < 0 ? `−${e}` : e;
|
|
11
|
+
}
|
|
12
|
+
function h({
|
|
13
|
+
title: n,
|
|
14
|
+
chip: t,
|
|
15
|
+
chipPositive: e = !1,
|
|
16
|
+
chipTestId: d,
|
|
17
|
+
children: r,
|
|
18
|
+
testId: o
|
|
19
|
+
}) {
|
|
20
|
+
return /* @__PURE__ */ a(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
className: "flex w-full min-w-0 flex-col gap-4 rounded-xl border border-border bg-card p-4",
|
|
24
|
+
"data-testid": o,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ a("div", { className: "flex min-h-6 items-center justify-between gap-3", children: [
|
|
27
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 text-base font-semibold leading-5 text-foreground", children: n }),
|
|
28
|
+
/* @__PURE__ */ s(
|
|
29
|
+
"span",
|
|
30
|
+
{
|
|
31
|
+
className: i(
|
|
32
|
+
"shrink-0 rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",
|
|
33
|
+
e ? "bg-success/20 text-success" : "bg-muted text-muted-foreground"
|
|
34
|
+
),
|
|
35
|
+
"data-testid": d,
|
|
36
|
+
children: t
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col gap-3", children: r })
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function N({
|
|
46
|
+
label: n,
|
|
47
|
+
value: t,
|
|
48
|
+
subtext: e,
|
|
49
|
+
muted: d = !1,
|
|
50
|
+
testId: r,
|
|
51
|
+
valueTestId: o,
|
|
52
|
+
captionTestId: l
|
|
53
|
+
}) {
|
|
54
|
+
return /* @__PURE__ */ a(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: "flex items-start justify-between gap-3",
|
|
58
|
+
"data-testid": r,
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ s(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
className: i(
|
|
64
|
+
"min-w-0 text-sm font-semibold leading-5",
|
|
65
|
+
d ? "text-muted-foreground" : "text-foreground"
|
|
66
|
+
),
|
|
67
|
+
children: n
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ a("span", { className: "flex shrink-0 flex-col items-end", children: [
|
|
71
|
+
/* @__PURE__ */ s(
|
|
72
|
+
"span",
|
|
73
|
+
{
|
|
74
|
+
className: i(
|
|
75
|
+
"text-sm font-semibold leading-5 tabular-nums",
|
|
76
|
+
d ? "text-muted-foreground" : "text-foreground"
|
|
77
|
+
),
|
|
78
|
+
"data-testid": o,
|
|
79
|
+
children: t
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
e != null ? /* @__PURE__ */ s(
|
|
83
|
+
"span",
|
|
84
|
+
{
|
|
85
|
+
className: "text-xs leading-4 text-muted-foreground",
|
|
86
|
+
"data-testid": l,
|
|
87
|
+
children: e
|
|
88
|
+
}
|
|
89
|
+
) : null
|
|
90
|
+
] })
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function w() {
|
|
96
|
+
return /* @__PURE__ */ s("div", { className: "h-px w-full bg-divider" });
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
p as APY_BREAKDOWN_TOOLTIP_WIDTH,
|
|
100
|
+
h as ApyBreakdownBody,
|
|
101
|
+
w as ApyBreakdownDivider,
|
|
102
|
+
N as ApyBreakdownRow,
|
|
103
|
+
x as BREAKDOWN_DASH,
|
|
104
|
+
b as formatBreakdownRate,
|
|
105
|
+
g as periodMessageId
|
|
106
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { APY_BREAKDOWN_TOOLTIP_WIDTH as r, ApyBreakdownBody as d, ApyBreakdownDivider as a, ApyBreakdownRow as A, BREAKDOWN_DASH as B, formatBreakdownRate as p, periodMessageId as w } from "./apy-breakdown-body.js";
|
|
2
|
+
export {
|
|
3
|
+
r as APY_BREAKDOWN_TOOLTIP_WIDTH,
|
|
4
|
+
d as ApyBreakdownBody,
|
|
5
|
+
a as ApyBreakdownDivider,
|
|
6
|
+
A as ApyBreakdownRow,
|
|
7
|
+
B as BREAKDOWN_DASH,
|
|
8
|
+
p as formatBreakdownRate,
|
|
9
|
+
w as periodMessageId
|
|
10
|
+
};
|
|
@@ -14,9 +14,9 @@ import { PointsValue as l } from "../values/points-value.js";
|
|
|
14
14
|
import "viem";
|
|
15
15
|
import "../../points-icon/points-icon.js";
|
|
16
16
|
import "../../token-icon/token-icon.js";
|
|
17
|
+
import "react-intl";
|
|
17
18
|
import "../../tooltip/simple-tooltip.js";
|
|
18
19
|
import "../../tooltip/tooltip.js";
|
|
19
|
-
import "react-intl";
|
|
20
20
|
import "../../badge/badge.js";
|
|
21
21
|
import "../../badge/chip.js";
|
|
22
22
|
import { Typography as u } from "../../typography/typography.js";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
class
|
|
1
|
+
class o {
|
|
2
2
|
static root = "pool-apy-breakdown-card-root";
|
|
3
|
+
static net = "pool-apy-breakdown-card-net";
|
|
3
4
|
static value = "pool-apy-breakdown-card-value";
|
|
5
|
+
static reward = "pool-apy-breakdown-card-reward";
|
|
6
|
+
static points = "pool-apy-breakdown-card-points";
|
|
4
7
|
}
|
|
5
8
|
export {
|
|
6
|
-
|
|
9
|
+
o as PoolApyBreakdownCardTest
|
|
7
10
|
};
|
|
@@ -1,74 +1,128 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import "luxon";
|
|
12
|
-
import "../../../utils/z-index.js";
|
|
13
|
-
import { SideCard as s } from "../side-card/side-card.js";
|
|
14
|
-
import { PoolApyBreakdownCardTest as p } from "./constants.js";
|
|
15
|
-
function t(r, o, i) {
|
|
16
|
-
return r === "7d" ? i : o;
|
|
17
|
-
}
|
|
18
|
-
function n({
|
|
19
|
-
title: r,
|
|
20
|
-
value: o
|
|
1
|
+
import { jsxs as a, jsx as o, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import { ApyBreakdownBody as w, BREAKDOWN_DASH as t, formatBreakdownRate as p, ApyBreakdownRow as i, periodMessageId as c, ApyBreakdownDivider as g } from "../apy-breakdown-body/apy-breakdown-body.js";
|
|
3
|
+
import { PointsIcon as f } from "../../points-icon/points-icon.js";
|
|
4
|
+
import { TokenIcon as B } from "../../token-icon/token-icon.js";
|
|
5
|
+
import { FormattedMessageTyped as s } from "../../typed-intl/index.js";
|
|
6
|
+
import { totalApyOf as I, tokenRewardsOf as h, pointProgramsOf as b } from "../../../utils/apy-breakdown.js";
|
|
7
|
+
import { PoolApyBreakdownCardTest as l } from "./constants.js";
|
|
8
|
+
function D({
|
|
9
|
+
data: n,
|
|
10
|
+
period: d
|
|
21
11
|
}) {
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
const r = n ? I(n) : void 0, m = n?.organicApy, y = n == null ? void 0 : (r ?? 0) - (m ?? 0), u = n ? h(n) : [], A = n ? b(n) : [], k = [...u.filter((e) => e.supplyApr != null), ...A];
|
|
13
|
+
return /* @__PURE__ */ a(
|
|
14
|
+
w,
|
|
24
15
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
return /* @__PURE__ */ d(
|
|
36
|
-
s,
|
|
37
|
-
{
|
|
38
|
-
title: t(
|
|
39
|
-
o,
|
|
40
|
-
"components.poolApyBreakdownCard.title",
|
|
41
|
-
"components.poolApyBreakdownCard.title7d"
|
|
16
|
+
testId: l.root,
|
|
17
|
+
title: /* @__PURE__ */ o(
|
|
18
|
+
s,
|
|
19
|
+
{
|
|
20
|
+
messageId: c(
|
|
21
|
+
d,
|
|
22
|
+
"components.poolApyBreakdownCard.title",
|
|
23
|
+
"components.poolApyBreakdownCard.title7d"
|
|
24
|
+
)
|
|
25
|
+
}
|
|
42
26
|
),
|
|
43
|
-
|
|
27
|
+
chip: r == null ? t : p(r),
|
|
28
|
+
chipPositive: (r ?? 0) > 0,
|
|
29
|
+
chipTestId: l.net,
|
|
44
30
|
children: [
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
|
|
31
|
+
/* @__PURE__ */ o(
|
|
32
|
+
i,
|
|
47
33
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
valueTestId: l.value,
|
|
35
|
+
label: /* @__PURE__ */ o(
|
|
36
|
+
s,
|
|
37
|
+
{
|
|
38
|
+
messageId: c(
|
|
39
|
+
d,
|
|
40
|
+
"components.poolApyBreakdownCard.organicApy",
|
|
41
|
+
"components.poolApyBreakdownCard.organicApy7d"
|
|
42
|
+
)
|
|
43
|
+
}
|
|
52
44
|
),
|
|
53
|
-
value:
|
|
45
|
+
value: m == null ? t : p(m)
|
|
54
46
|
}
|
|
55
47
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
48
|
+
/* @__PURE__ */ o(
|
|
49
|
+
i,
|
|
58
50
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
valueTestId: l.value,
|
|
52
|
+
label: /* @__PURE__ */ o(
|
|
53
|
+
s,
|
|
54
|
+
{
|
|
55
|
+
messageId: c(
|
|
56
|
+
d,
|
|
57
|
+
"components.poolApyBreakdownCard.incentiveApy",
|
|
58
|
+
"components.poolApyBreakdownCard.incentiveApy7d"
|
|
59
|
+
)
|
|
60
|
+
}
|
|
63
61
|
),
|
|
64
|
-
value:
|
|
62
|
+
value: y == null ? t : p(y)
|
|
65
63
|
}
|
|
66
|
-
)
|
|
64
|
+
),
|
|
65
|
+
k.length > 0 ? /* @__PURE__ */ a(v, { children: [
|
|
66
|
+
/* @__PURE__ */ o(g, {}),
|
|
67
|
+
u.map(
|
|
68
|
+
(e) => e.supplyApr == null ? null : /* @__PURE__ */ o(
|
|
69
|
+
i,
|
|
70
|
+
{
|
|
71
|
+
valueTestId: l.reward,
|
|
72
|
+
label: /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
73
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
|
|
74
|
+
s,
|
|
75
|
+
{
|
|
76
|
+
messageId: "components.apyParts.extraAPY",
|
|
77
|
+
values: { symbol: e.token.symbol }
|
|
78
|
+
}
|
|
79
|
+
) }),
|
|
80
|
+
/* @__PURE__ */ o(
|
|
81
|
+
B,
|
|
82
|
+
{
|
|
83
|
+
token: e.token,
|
|
84
|
+
symbol: e.token.symbol,
|
|
85
|
+
size: 16,
|
|
86
|
+
className: "shrink-0"
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] }),
|
|
90
|
+
value: p(e.supplyApr)
|
|
91
|
+
},
|
|
92
|
+
`incentive-${e.token.address}-${e.supplyApr}`
|
|
93
|
+
)
|
|
94
|
+
),
|
|
95
|
+
A.map((e) => /* @__PURE__ */ o(
|
|
96
|
+
i,
|
|
97
|
+
{
|
|
98
|
+
valueTestId: l.points,
|
|
99
|
+
label: /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
100
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
|
|
101
|
+
s,
|
|
102
|
+
{
|
|
103
|
+
messageId: "components.yieldBreakdown.programPoints",
|
|
104
|
+
values: { name: e.name }
|
|
105
|
+
}
|
|
106
|
+
) }),
|
|
107
|
+
/* @__PURE__ */ o(
|
|
108
|
+
f,
|
|
109
|
+
{
|
|
110
|
+
reward: { name: e.name, type: e.id },
|
|
111
|
+
size: 16,
|
|
112
|
+
className: "shrink-0"
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] }),
|
|
116
|
+
value: e.multiplier != null ? `${e.multiplier}×` : t
|
|
117
|
+
},
|
|
118
|
+
e.id
|
|
119
|
+
))
|
|
120
|
+
] }) : null
|
|
67
121
|
]
|
|
68
122
|
}
|
|
69
123
|
);
|
|
70
124
|
}
|
|
71
125
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
126
|
+
D as PoolApyBreakdownCard,
|
|
127
|
+
l as PoolApyBreakdownCardTest
|
|
74
128
|
};
|