@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
|
@@ -1,204 +1,184 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as c, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { APY_BREAKDOWN_TOOLTIP_WIDTH as B, ApyBreakdownBody as v, formatBreakdownRate as u, ApyBreakdownRow as y, periodMessageId as w, ApyBreakdownDivider as h } from "../base/apy-breakdown-body/apy-breakdown-body.js";
|
|
3
|
+
import { PoolApyBreakdownCard as b } from "../base/pool-apy-breakdown-card/pool-apy-breakdown-card.js";
|
|
4
|
+
import { PointsIcon as I } from "../points-icon/points-icon.js";
|
|
5
|
+
import { TokenIcon as P } from "../token-icon/token-icon.js";
|
|
6
|
+
import { SimpleTooltip as T } from "../tooltip/simple-tooltip.js";
|
|
5
7
|
import "../tooltip/tooltip.js";
|
|
6
|
-
import { FormattedMessageTyped as
|
|
7
|
-
import "
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
import { FormattedMessageTyped as d } from "../typed-intl/index.js";
|
|
9
|
+
import { tokenRewardsOf as O, pointProgramsOf as R, totalApyOf as x } from "../../utils/apy-breakdown.js";
|
|
10
|
+
import { formatLeverage as N } from "../../utils/format-leverage.js";
|
|
11
|
+
function S({
|
|
12
|
+
title: t,
|
|
13
|
+
children: l,
|
|
14
|
+
placement: s = "left",
|
|
15
|
+
open: a,
|
|
16
|
+
className: i,
|
|
17
|
+
triggerClassName: n
|
|
18
|
+
}) {
|
|
19
|
+
return /* @__PURE__ */ e(
|
|
20
|
+
T,
|
|
21
|
+
{
|
|
22
|
+
placement: s,
|
|
23
|
+
triangle: !1,
|
|
24
|
+
type: "modal-tooltip",
|
|
25
|
+
minWidth: B,
|
|
26
|
+
maxWidth: B,
|
|
27
|
+
title: t,
|
|
28
|
+
open: a,
|
|
29
|
+
className: i,
|
|
30
|
+
triggerClassName: n,
|
|
31
|
+
children: l
|
|
32
|
+
}
|
|
33
|
+
);
|
|
21
34
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
35
|
+
function H({
|
|
36
|
+
supplyApy: t,
|
|
37
|
+
maxLeverage: l,
|
|
38
|
+
collateralApy: s,
|
|
39
|
+
borrowApy: a,
|
|
40
|
+
quotaRate: i,
|
|
41
|
+
period: n,
|
|
42
|
+
children: r,
|
|
43
|
+
className: m,
|
|
44
|
+
open: g
|
|
45
|
+
}) {
|
|
46
|
+
const p = l !== void 0 && l > 0;
|
|
47
|
+
return /* @__PURE__ */ e(
|
|
48
|
+
S,
|
|
49
|
+
{
|
|
50
|
+
placement: "bottom",
|
|
51
|
+
title: /* @__PURE__ */ e("span", { className: m, children: r }),
|
|
52
|
+
triggerClassName: m,
|
|
53
|
+
open: g,
|
|
54
|
+
children: p ? /* @__PURE__ */ e(
|
|
55
|
+
W,
|
|
56
|
+
{
|
|
57
|
+
supplyApy: t,
|
|
58
|
+
maxLeverage: l,
|
|
59
|
+
collateralApy: s,
|
|
60
|
+
borrowApy: a,
|
|
61
|
+
quotaRate: i,
|
|
62
|
+
period: n
|
|
63
|
+
}
|
|
64
|
+
) : /* @__PURE__ */ e(b, { data: t, period: n })
|
|
65
|
+
}
|
|
66
|
+
);
|
|
24
67
|
}
|
|
25
|
-
function
|
|
26
|
-
supplyApy:
|
|
27
|
-
maxLeverage:
|
|
28
|
-
collateralApy:
|
|
29
|
-
borrowApy:
|
|
30
|
-
quotaRate:
|
|
31
|
-
period:
|
|
32
|
-
children: h,
|
|
33
|
-
className: w
|
|
68
|
+
function W({
|
|
69
|
+
supplyApy: t,
|
|
70
|
+
maxLeverage: l,
|
|
71
|
+
collateralApy: s,
|
|
72
|
+
borrowApy: a,
|
|
73
|
+
quotaRate: i,
|
|
74
|
+
period: n
|
|
34
75
|
}) {
|
|
35
|
-
const
|
|
36
|
-
|
|
76
|
+
const r = s, m = r ? O(r) : [], g = R(t), p = x(t), f = a != null || i != null ? -((a ?? 0) + (i ?? 0)) : void 0, k = g.filter((o) => o.multiplier != null);
|
|
77
|
+
return /* @__PURE__ */ c(
|
|
78
|
+
v,
|
|
37
79
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
80
|
+
title: /* @__PURE__ */ e(
|
|
81
|
+
d,
|
|
82
|
+
{
|
|
83
|
+
messageId: w(
|
|
84
|
+
n,
|
|
85
|
+
"components.yieldBreakdown.titleNetAtLeverage",
|
|
86
|
+
"components.yieldBreakdown.titleNetAtLeverage7d"
|
|
87
|
+
),
|
|
88
|
+
values: { leverage: N(l) }
|
|
89
|
+
}
|
|
45
90
|
),
|
|
91
|
+
chip: u(p),
|
|
92
|
+
chipPositive: p > 0,
|
|
46
93
|
children: [
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
s,
|
|
50
|
-
{
|
|
51
|
-
messageId: m(
|
|
52
|
-
l,
|
|
53
|
-
"components.yieldBreakdown.titleNetAtLeverage",
|
|
54
|
-
"components.yieldBreakdown.titleNetAtLeverage7d"
|
|
55
|
-
),
|
|
56
|
-
values: {
|
|
57
|
-
leverage: S(n)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
) : /* @__PURE__ */ e(
|
|
61
|
-
s,
|
|
62
|
-
{
|
|
63
|
-
messageId: m(
|
|
64
|
-
l,
|
|
65
|
-
"components.yieldBreakdown.titleNet",
|
|
66
|
-
"components.yieldBreakdown.titleNet7d"
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
) }),
|
|
70
|
-
/* @__PURE__ */ e(
|
|
71
|
-
"span",
|
|
72
|
-
{
|
|
73
|
-
className: f(
|
|
74
|
-
"rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",
|
|
75
|
-
x > 0 ? "bg-success/20 text-success" : "bg-muted text-muted-foreground"
|
|
76
|
-
),
|
|
77
|
-
children: p(x)
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
] }),
|
|
81
|
-
i?.organicApy != null && /* @__PURE__ */ e(
|
|
82
|
-
c,
|
|
94
|
+
r?.organicApy != null ? /* @__PURE__ */ e(
|
|
95
|
+
y,
|
|
83
96
|
{
|
|
84
|
-
muted:
|
|
97
|
+
muted: r.organicApy < 0,
|
|
85
98
|
label: /* @__PURE__ */ e(
|
|
86
|
-
|
|
99
|
+
d,
|
|
87
100
|
{
|
|
88
|
-
messageId:
|
|
89
|
-
|
|
101
|
+
messageId: w(
|
|
102
|
+
n,
|
|
90
103
|
"components.yieldBreakdown.collateralApy",
|
|
91
104
|
"components.yieldBreakdown.collateralApy7d"
|
|
92
|
-
) : m(
|
|
93
|
-
l,
|
|
94
|
-
"components.yieldBreakdown.baseApy",
|
|
95
|
-
"components.yieldBreakdown.baseApy7d"
|
|
96
105
|
)
|
|
97
106
|
}
|
|
98
107
|
),
|
|
99
|
-
value:
|
|
108
|
+
value: u(r.organicApy)
|
|
100
109
|
}
|
|
110
|
+
) : null,
|
|
111
|
+
m.map(
|
|
112
|
+
(o) => o.supplyApr == null ? null : /* @__PURE__ */ e(
|
|
113
|
+
y,
|
|
114
|
+
{
|
|
115
|
+
muted: o.supplyApr < 0,
|
|
116
|
+
label: /* @__PURE__ */ c("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
117
|
+
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
118
|
+
d,
|
|
119
|
+
{
|
|
120
|
+
messageId: "components.apyParts.extraAPY",
|
|
121
|
+
values: { symbol: o.token.symbol }
|
|
122
|
+
}
|
|
123
|
+
) }),
|
|
124
|
+
/* @__PURE__ */ e(P, { token: o.token, size: 20 })
|
|
125
|
+
] }),
|
|
126
|
+
value: u(o.supplyApr)
|
|
127
|
+
},
|
|
128
|
+
`incentive-${o.token.address}-${o.supplyApr}`
|
|
129
|
+
)
|
|
101
130
|
),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{
|
|
105
|
-
muted: t.supplyApr < 0,
|
|
106
|
-
label: /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
107
|
-
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
108
|
-
s,
|
|
109
|
-
{
|
|
110
|
-
messageId: "components.apyParts.extraAPY",
|
|
111
|
-
values: { symbol: t.token.symbol }
|
|
112
|
-
}
|
|
113
|
-
) }),
|
|
114
|
-
/* @__PURE__ */ e(I, { token: t.token, size: 20 })
|
|
115
|
-
] }),
|
|
116
|
-
value: p(t.supplyApr)
|
|
117
|
-
},
|
|
118
|
-
`incentive-${t.token.address}-${t.supplyApr}`
|
|
119
|
-
)),
|
|
120
|
-
d && u != null && /* @__PURE__ */ e(
|
|
121
|
-
c,
|
|
131
|
+
f != null ? /* @__PURE__ */ e(
|
|
132
|
+
y,
|
|
122
133
|
{
|
|
123
|
-
muted:
|
|
134
|
+
muted: f < 0,
|
|
124
135
|
label: /* @__PURE__ */ e(
|
|
125
|
-
|
|
136
|
+
d,
|
|
126
137
|
{
|
|
127
|
-
messageId:
|
|
128
|
-
|
|
138
|
+
messageId: w(
|
|
139
|
+
n,
|
|
129
140
|
"components.yieldBreakdown.borrowRate",
|
|
130
141
|
"components.yieldBreakdown.borrowRate7d"
|
|
131
142
|
)
|
|
132
143
|
}
|
|
133
144
|
),
|
|
134
|
-
value:
|
|
145
|
+
value: u(f)
|
|
135
146
|
}
|
|
136
|
-
),
|
|
137
|
-
|
|
138
|
-
/* @__PURE__ */ e(
|
|
139
|
-
|
|
140
|
-
|
|
147
|
+
) : null,
|
|
148
|
+
k.length > 0 ? /* @__PURE__ */ c(A, { children: [
|
|
149
|
+
/* @__PURE__ */ e(h, {}),
|
|
150
|
+
k.map((o) => /* @__PURE__ */ e(
|
|
151
|
+
y,
|
|
141
152
|
{
|
|
142
|
-
label: /* @__PURE__ */
|
|
153
|
+
label: /* @__PURE__ */ c("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
143
154
|
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
144
|
-
|
|
155
|
+
d,
|
|
145
156
|
{
|
|
146
157
|
messageId: "components.yieldBreakdown.programPoints",
|
|
147
|
-
values: { name:
|
|
158
|
+
values: { name: o.name }
|
|
148
159
|
}
|
|
149
160
|
) }),
|
|
150
161
|
/* @__PURE__ */ e(
|
|
151
|
-
|
|
162
|
+
I,
|
|
152
163
|
{
|
|
153
164
|
reward: {
|
|
154
|
-
name:
|
|
155
|
-
type:
|
|
165
|
+
name: o.name,
|
|
166
|
+
type: o.id
|
|
156
167
|
},
|
|
157
168
|
size: 20
|
|
158
169
|
}
|
|
159
170
|
)
|
|
160
171
|
] }),
|
|
161
|
-
value: `${
|
|
172
|
+
value: `${o.multiplier}×`
|
|
162
173
|
},
|
|
163
|
-
`points-${
|
|
174
|
+
`points-${o.id}`
|
|
164
175
|
))
|
|
165
|
-
] })
|
|
176
|
+
] }) : null
|
|
166
177
|
]
|
|
167
178
|
}
|
|
168
179
|
);
|
|
169
|
-
return /* @__PURE__ */ e(
|
|
170
|
-
P,
|
|
171
|
-
{
|
|
172
|
-
placement: "bottom",
|
|
173
|
-
triangle: !1,
|
|
174
|
-
type: "modal-tooltip",
|
|
175
|
-
minWidth: "100%",
|
|
176
|
-
maxWidth: "100%",
|
|
177
|
-
title: /* @__PURE__ */ e("span", { className: w, children: h }),
|
|
178
|
-
triggerClassName: w,
|
|
179
|
-
children: B
|
|
180
|
-
}
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
function c({
|
|
184
|
-
label: o,
|
|
185
|
-
value: n,
|
|
186
|
-
muted: r = !1
|
|
187
|
-
}) {
|
|
188
|
-
return /* @__PURE__ */ a("div", { className: "flex h-6 items-center justify-between gap-3 text-sm leading-5", children: [
|
|
189
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 font-normal text-muted-foreground", children: o }),
|
|
190
|
-
/* @__PURE__ */ e(
|
|
191
|
-
"span",
|
|
192
|
-
{
|
|
193
|
-
className: f(
|
|
194
|
-
"shrink-0 font-semibold tabular-nums",
|
|
195
|
-
r ? "text-muted-foreground" : "text-foreground"
|
|
196
|
-
),
|
|
197
|
-
children: n
|
|
198
|
-
}
|
|
199
|
-
)
|
|
200
|
-
] });
|
|
201
180
|
}
|
|
202
181
|
export {
|
|
203
|
-
|
|
182
|
+
S as ApyBreakdownTooltip,
|
|
183
|
+
H as YieldBreakdownTooltip
|
|
204
184
|
};
|