@gearbox-protocol/ui-kit 4.0.0-next.22 → 4.0.0-next.24
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/history-chart/history-chart.cjs +1 -1
- package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
- package/dist/cjs/components/graph/default-config.cjs +1 -1
- package/dist/cjs/components/graph/formatters.cjs +1 -1
- package/dist/cjs/components/graph/graph-current-value.cjs +1 -1
- package/dist/cjs/components/graph/graph-tooltip.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/graph/index.cjs +1 -1
- package/dist/cjs/components/graph/y-axis-scale.cjs +1 -0
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/trading-view/trading-view.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/cjs/locale/en.json.cjs +1 -1
- package/dist/esm/components/base/history-chart/history-chart.js +16 -15
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +41 -25
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +38 -39
- package/dist/esm/components/graph/default-config.js +44 -24
- package/dist/esm/components/graph/formatters.js +123 -128
- package/dist/esm/components/graph/graph-current-value.js +11 -11
- package/dist/esm/components/graph/graph-tooltip.js +6 -6
- package/dist/esm/components/graph/graph.js +597 -547
- package/dist/esm/components/graph/index.js +32 -27
- package/dist/esm/components/graph/y-axis-scale.js +112 -0
- package/dist/esm/components/index.js +496 -491
- package/dist/esm/components/trading-view/trading-view.js +83 -82
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +94 -55
- package/dist/esm/index.js +649 -644
- package/dist/esm/locale/en.json.js +16 -4
- package/dist/types/components/base/history-chart/history-chart.d.ts +2 -1
- package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +4 -2
- package/dist/types/components/graph/default-config.d.ts +23 -0
- package/dist/types/components/graph/formatters.d.ts +5 -1
- package/dist/types/components/graph/graph.d.ts +12 -4
- package/dist/types/components/graph/y-axis-scale.d.ts +48 -0
- package/dist/types/components/trading-view/trading-view.d.ts +5 -1
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +4 -2
- package/dist/types/locale/en.json.d.ts +14 -2
- package/package.json +3 -3
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as v, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as I, useCallback as fe, useRef as C } from "react";
|
|
3
3
|
import { toast as be } from "sonner";
|
|
4
4
|
import { SectionHeading as we } from "../base/section-heading/section-heading.js";
|
|
5
5
|
import { useIsMobile as he } from "../../hooks/use-media-query.js";
|
|
6
6
|
import "@gearbox-protocol/sdk";
|
|
7
|
-
import { cn as
|
|
7
|
+
import { cn as ve } from "../../utils/cn.js";
|
|
8
8
|
import "@gearbox-protocol/sdk/common-utils";
|
|
9
9
|
import "luxon";
|
|
10
10
|
import "../../utils/z-index.js";
|
|
11
|
-
import { DEFAULT_SERIES_COLORS as T, getSeriesColorPalette as
|
|
12
|
-
import { GraphViewWithData as
|
|
11
|
+
import { DEFAULT_SERIES_COLORS as T, getSeriesColorPalette as pe, GraphLegend as xe } from "../graph/graph.js";
|
|
12
|
+
import { GraphViewWithData as ge } from "../graph/graph-view.js";
|
|
13
13
|
import { Select as Se, SelectTrigger as ye, SelectValue as Ae, SelectContent as Ie, SelectItem as Ce } from "../select/select.js";
|
|
14
14
|
import { GraphDropdown as Ne } from "./graph-dropdown.js";
|
|
15
|
-
const Me = ({ size:
|
|
15
|
+
const Me = ({ size: t = 16 }) => /* @__PURE__ */ v(
|
|
16
16
|
"svg",
|
|
17
17
|
{
|
|
18
|
-
width:
|
|
19
|
-
height:
|
|
18
|
+
width: t,
|
|
19
|
+
height: t,
|
|
20
20
|
viewBox: "0 0 24 24",
|
|
21
21
|
fill: "none",
|
|
22
22
|
stroke: "currentColor",
|
|
@@ -25,15 +25,15 @@ const Me = ({ size: e = 16 }) => /* @__PURE__ */ p(
|
|
|
25
25
|
strokeLinejoin: "round",
|
|
26
26
|
"aria-label": "Expand fullscreen",
|
|
27
27
|
children: [
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ o("title", { children: "Expand fullscreen" }),
|
|
29
|
+
/* @__PURE__ */ o("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" })
|
|
30
30
|
]
|
|
31
31
|
}
|
|
32
|
-
), ke = ({ size:
|
|
32
|
+
), ke = ({ size: t = 16 }) => /* @__PURE__ */ v(
|
|
33
33
|
"svg",
|
|
34
34
|
{
|
|
35
|
-
width:
|
|
36
|
-
height:
|
|
35
|
+
width: t,
|
|
36
|
+
height: t,
|
|
37
37
|
viewBox: "0 0 24 24",
|
|
38
38
|
fill: "none",
|
|
39
39
|
stroke: "currentColor",
|
|
@@ -42,8 +42,8 @@ const Me = ({ size: e = 16 }) => /* @__PURE__ */ p(
|
|
|
42
42
|
strokeLinejoin: "round",
|
|
43
43
|
"aria-label": "Exit fullscreen",
|
|
44
44
|
children: [
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ o("title", { children: "Exit fullscreen" }),
|
|
46
|
+
/* @__PURE__ */ o("path", { d: "M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3" })
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
), Ee = {
|
|
@@ -51,45 +51,45 @@ const Me = ({ size: e = 16 }) => /* @__PURE__ */ p(
|
|
|
51
51
|
rightPriceScale: { borderVisible: !1 },
|
|
52
52
|
leftPriceScale: { borderVisible: !1 }
|
|
53
53
|
}, X = "ui-kit:tradingview-series-colors:";
|
|
54
|
-
function j(
|
|
54
|
+
function j(t) {
|
|
55
55
|
if (typeof window > "u" || !window.localStorage)
|
|
56
56
|
return /* @__PURE__ */ new Map();
|
|
57
57
|
try {
|
|
58
|
-
const r = window.localStorage.getItem(X +
|
|
58
|
+
const r = window.localStorage.getItem(X + t);
|
|
59
59
|
if (!r) return /* @__PURE__ */ new Map();
|
|
60
60
|
const c = JSON.parse(r);
|
|
61
61
|
return c == null || typeof c != "object" ? /* @__PURE__ */ new Map() : new Map(
|
|
62
62
|
Object.entries(c).filter(
|
|
63
|
-
([,
|
|
63
|
+
([, n]) => typeof n == "number" && n >= 0 && n < T.length
|
|
64
64
|
)
|
|
65
65
|
);
|
|
66
66
|
} catch {
|
|
67
67
|
return /* @__PURE__ */ new Map();
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
function Re(
|
|
70
|
+
function Re(t, r) {
|
|
71
71
|
if (!(typeof window > "u" || !window.localStorage))
|
|
72
72
|
try {
|
|
73
73
|
window.localStorage.setItem(
|
|
74
|
-
X +
|
|
74
|
+
X + t,
|
|
75
75
|
JSON.stringify(Object.fromEntries(r))
|
|
76
76
|
);
|
|
77
77
|
} catch {
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function $(
|
|
80
|
+
function $(t, r) {
|
|
81
81
|
if (r.size === 0) return;
|
|
82
|
-
const c = j(
|
|
83
|
-
for (const [
|
|
84
|
-
c.set(
|
|
85
|
-
Re(
|
|
82
|
+
const c = j(t);
|
|
83
|
+
for (const [n, p] of r)
|
|
84
|
+
c.set(n, p);
|
|
85
|
+
Re(t, c);
|
|
86
86
|
}
|
|
87
87
|
function Ze({
|
|
88
|
-
data:
|
|
88
|
+
data: t,
|
|
89
89
|
yMeasureUnit: r,
|
|
90
90
|
height: c = 306,
|
|
91
|
-
defaultGraph:
|
|
92
|
-
onGraphSelected:
|
|
91
|
+
defaultGraph: n,
|
|
92
|
+
onGraphSelected: p,
|
|
93
93
|
graphs: f,
|
|
94
94
|
isMultipleSelect: q,
|
|
95
95
|
range: Q,
|
|
@@ -111,9 +111,9 @@ function Ze({
|
|
|
111
111
|
seriesColorPersistenceKey: d,
|
|
112
112
|
title: re,
|
|
113
113
|
trailing: k,
|
|
114
|
-
...
|
|
114
|
+
...ne
|
|
115
115
|
}) {
|
|
116
|
-
const
|
|
116
|
+
const x = I(() => Array.isArray(t) ? t : t ? [t] : [], [t]), oe = I(() => Array.isArray(t) && t.length > 1, [t]), z = he(), le = fe(
|
|
117
117
|
(u, y) => {
|
|
118
118
|
be.error(_);
|
|
119
119
|
},
|
|
@@ -121,16 +121,16 @@ function Ze({
|
|
|
121
121
|
), ie = I(() => {
|
|
122
122
|
if (r)
|
|
123
123
|
return Array.isArray(r) ? r[0] : r;
|
|
124
|
-
}, [r]), se = !!(
|
|
124
|
+
}, [r]), se = !!(p && f && n), i = C(/* @__PURE__ */ new Map()), b = C(0), F = C(!1);
|
|
125
125
|
if (f && f.length > 0 && !F.current) {
|
|
126
126
|
F.current = !0;
|
|
127
127
|
const u = d ? j(d) : /* @__PURE__ */ new Map(), y = String(f[0].value);
|
|
128
128
|
i.current.set(y, 0), b.current = 1;
|
|
129
|
-
for (let
|
|
130
|
-
const
|
|
131
|
-
if (i.current.has(
|
|
132
|
-
const
|
|
133
|
-
i.current.set(
|
|
129
|
+
for (let e = 1; e < f.length; e++) {
|
|
130
|
+
const m = String(f[e].value);
|
|
131
|
+
if (i.current.has(m)) continue;
|
|
132
|
+
const g = u.get(m) ?? e;
|
|
133
|
+
i.current.set(m, g), b.current = Math.max(b.current, g + 1);
|
|
134
134
|
}
|
|
135
135
|
d && $(
|
|
136
136
|
d,
|
|
@@ -140,22 +140,22 @@ function Ze({
|
|
|
140
140
|
const w = I(() => {
|
|
141
141
|
const u = Array.isArray(r) ? r : void 0;
|
|
142
142
|
if (d) {
|
|
143
|
-
const
|
|
144
|
-
for (const [
|
|
145
|
-
i.current.has(
|
|
143
|
+
const e = j(d);
|
|
144
|
+
for (const [m, h] of e)
|
|
145
|
+
i.current.has(m) || (i.current.set(m, h), b.current = Math.max(
|
|
146
146
|
b.current,
|
|
147
147
|
h + 1
|
|
148
148
|
));
|
|
149
149
|
}
|
|
150
|
-
const y =
|
|
151
|
-
const h =
|
|
150
|
+
const y = x.map((e, m) => {
|
|
151
|
+
const h = e?.title || `Series ${m + 1}`, g = n != null ? Array.isArray(n) ? n[0]?.value ?? n[0] : typeof n == "object" && "value" in n ? n.value : n : null, R = x.length === 1 ? g != null ? String(g) : "single" : e?.id || h;
|
|
152
152
|
if (!i.current.has(R)) {
|
|
153
153
|
const l = new Set(
|
|
154
154
|
Array.from(i.current.values())
|
|
155
155
|
);
|
|
156
156
|
let s = b.current;
|
|
157
|
-
for (let
|
|
158
|
-
const A = (b.current +
|
|
157
|
+
for (let a = 0; a < T.length; a++) {
|
|
158
|
+
const A = (b.current + a) % T.length;
|
|
159
159
|
if (!l.has(A)) {
|
|
160
160
|
s = A;
|
|
161
161
|
break;
|
|
@@ -163,33 +163,34 @@ function Ze({
|
|
|
163
163
|
}
|
|
164
164
|
i.current.set(R, s), b.current = s + 1;
|
|
165
165
|
}
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
return
|
|
166
|
+
const me = i.current.get(R) ?? 0, O = pe(me), ae = [...e?.data || []].sort((l, s) => {
|
|
167
|
+
const a = typeof l.time == "number" ? l.time : Number(l.time), A = typeof s.time == "number" ? s.time : Number(s.time);
|
|
168
|
+
return a - A;
|
|
169
169
|
}).reduce((l, s) => {
|
|
170
|
-
const
|
|
171
|
-
return l.length === 0 || l[l.length - 1].time !==
|
|
172
|
-
}, []), J =
|
|
170
|
+
const a = s.time;
|
|
171
|
+
return l.length === 0 || l[l.length - 1].time !== a ? l.push({ time: a, value: s.value }) : l[l.length - 1] = { time: a, value: s.value }, l;
|
|
172
|
+
}, []), J = e?.lineColor ?? e?.color ?? void 0;
|
|
173
173
|
return {
|
|
174
|
-
data:
|
|
174
|
+
data: ae,
|
|
175
175
|
label: h,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
...e?.id != null && { id: e.id },
|
|
177
|
+
yMeasureUnit: u?.[m] ?? (Array.isArray(r) ? void 0 : r),
|
|
178
|
+
...e?.priceScaleId != null && {
|
|
179
|
+
priceScaleId: e.priceScaleId
|
|
179
180
|
},
|
|
180
|
-
...
|
|
181
|
-
seriesType:
|
|
181
|
+
...e?.seriesType != null && {
|
|
182
|
+
seriesType: e.seriesType
|
|
182
183
|
},
|
|
183
|
-
...
|
|
184
|
-
lineStyle:
|
|
184
|
+
...e?.lineStyle != null && {
|
|
185
|
+
lineStyle: e.lineStyle
|
|
185
186
|
},
|
|
186
187
|
...J != null ? {
|
|
187
188
|
lineColor: J,
|
|
188
|
-
...
|
|
189
|
-
topColor:
|
|
189
|
+
...e?.topColor != null && {
|
|
190
|
+
topColor: e.topColor
|
|
190
191
|
},
|
|
191
|
-
...
|
|
192
|
-
bottomColor:
|
|
192
|
+
...e?.bottomColor != null && {
|
|
193
|
+
bottomColor: e.bottomColor
|
|
193
194
|
}
|
|
194
195
|
} : {
|
|
195
196
|
color: O.line,
|
|
@@ -202,56 +203,56 @@ function Ze({
|
|
|
202
203
|
d,
|
|
203
204
|
i.current
|
|
204
205
|
), y;
|
|
205
|
-
}, [
|
|
206
|
+
}, [x, n, r, d]), H = V !== void 0 ? V : M !== void 0 ? M.size > 0 : oe && x.length > 0 ? x.some((u) => !u) : !t, B = C(w);
|
|
206
207
|
w.length > 0 && (B.current = w);
|
|
207
|
-
const W = w.length > 0 ? w : H ? B.current : w, E = re, ce = !z && N ? !0 : S.length > 0 || se || E != null || k != null, ue =
|
|
208
|
+
const W = w.length > 0 ? w : H ? B.current : w, E = re, ce = !z && N ? !0 : S.length > 0 || se || E != null || k != null, ue = p && f && n ? /* @__PURE__ */ o(
|
|
208
209
|
Ne,
|
|
209
210
|
{
|
|
210
|
-
onSelected:
|
|
211
|
+
onSelected: p,
|
|
211
212
|
items: f,
|
|
212
|
-
defaultItem:
|
|
213
|
+
defaultItem: n,
|
|
213
214
|
multiple: q,
|
|
214
215
|
graphsWithNoData: D,
|
|
215
216
|
loadingGraphs: M,
|
|
216
217
|
onNoDataSelected: le
|
|
217
218
|
}
|
|
218
|
-
) : E != null ? /* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
/* @__PURE__ */
|
|
219
|
+
) : E != null ? /* @__PURE__ */ o(we, { className: "min-w-0 truncate", children: E }) : null, de = ce && /* @__PURE__ */ v("div", { className: "flex w-full flex-row flex-wrap items-center justify-between gap-3", children: [
|
|
220
|
+
/* @__PURE__ */ o("div", { className: "min-w-0 flex-1", children: ue }),
|
|
221
|
+
/* @__PURE__ */ v("div", { className: "flex shrink-0 flex-row flex-nowrap items-center gap-3", children: [
|
|
221
222
|
k,
|
|
222
|
-
k != null && S.length > 0 ? /* @__PURE__ */
|
|
223
|
-
S.length > 0 ? /* @__PURE__ */
|
|
224
|
-
/* @__PURE__ */
|
|
223
|
+
k != null && S.length > 0 ? /* @__PURE__ */ o("div", { className: "h-4 w-px shrink-0 bg-border" }) : null,
|
|
224
|
+
S.length > 0 ? /* @__PURE__ */ v(Se, { value: Q, onValueChange: Y, children: [
|
|
225
|
+
/* @__PURE__ */ o(
|
|
225
226
|
ye,
|
|
226
227
|
{
|
|
227
228
|
size: "sm",
|
|
228
229
|
className: "h-8 w-auto min-w-[4.5rem] gap-1.5 border-border bg-muted shadow-none",
|
|
229
|
-
children: /* @__PURE__ */
|
|
230
|
+
children: /* @__PURE__ */ o(Ae, {})
|
|
230
231
|
}
|
|
231
232
|
),
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ o(Ie, { align: "end", children: S.map((u) => /* @__PURE__ */ o(Ce, { value: u.value, children: u.label }, u.value)) })
|
|
233
234
|
] }) : null,
|
|
234
|
-
!z && N && /* @__PURE__ */
|
|
235
|
+
!z && N && /* @__PURE__ */ o(
|
|
235
236
|
"button",
|
|
236
237
|
{
|
|
237
238
|
type: "button",
|
|
238
239
|
className: "flex min-h-[26px] min-w-[44px] cursor-pointer items-center justify-center rounded-md border border-muted bg-muted px-2.5 py-1.5 text-center text-xs font-medium leading-[14px] text-muted-foreground transition-colors hover:border-secondary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
239
240
|
onClick: N,
|
|
240
|
-
children: Z ? /* @__PURE__ */
|
|
241
|
+
children: Z ? /* @__PURE__ */ o(ke, { size: 16 }) : /* @__PURE__ */ o(Me, { size: 16 })
|
|
241
242
|
}
|
|
242
243
|
)
|
|
243
244
|
] })
|
|
244
245
|
] });
|
|
245
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ v(
|
|
246
247
|
"div",
|
|
247
248
|
{
|
|
248
|
-
className:
|
|
249
|
+
className: ve(
|
|
249
250
|
"flex w-full flex-col gap-3 rounded-lg border border-border bg-card p-4 shadow-none",
|
|
250
251
|
U
|
|
251
252
|
),
|
|
252
253
|
children: [
|
|
253
254
|
de,
|
|
254
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ o(
|
|
255
256
|
"div",
|
|
256
257
|
{
|
|
257
258
|
style: {
|
|
@@ -259,10 +260,10 @@ function Ze({
|
|
|
259
260
|
height: c ? `${c}px` : void 0
|
|
260
261
|
},
|
|
261
262
|
className: "w-full",
|
|
262
|
-
children: /* @__PURE__ */
|
|
263
|
-
|
|
263
|
+
children: /* @__PURE__ */ o(
|
|
264
|
+
ge,
|
|
264
265
|
{
|
|
265
|
-
...
|
|
266
|
+
...ne,
|
|
266
267
|
series: w,
|
|
267
268
|
loading: H,
|
|
268
269
|
size: c ? "full" : "default",
|
|
@@ -284,8 +285,8 @@ function Ze({
|
|
|
284
285
|
)
|
|
285
286
|
}
|
|
286
287
|
),
|
|
287
|
-
W.length > 0 ? /* @__PURE__ */
|
|
288
|
-
|
|
288
|
+
W.length > 0 ? /* @__PURE__ */ o(
|
|
289
|
+
xe,
|
|
289
290
|
{
|
|
290
291
|
series: W,
|
|
291
292
|
onUnselect: L,
|
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
import { jsxs as a, jsx as e, Fragment as
|
|
2
|
-
import { PointsIcon as
|
|
3
|
-
import { TokenIcon as
|
|
4
|
-
import { SimpleTooltip as
|
|
1
|
+
import { jsxs as a, jsx as e, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { PointsIcon as A } from "../points-icon/points-icon.js";
|
|
3
|
+
import { TokenIcon as I } from "../token-icon/token-icon.js";
|
|
4
|
+
import { SimpleTooltip as P } from "../tooltip/simple-tooltip.js";
|
|
5
5
|
import "../tooltip/tooltip.js";
|
|
6
6
|
import { FormattedMessageTyped as s } from "../typed-intl/index.js";
|
|
7
7
|
import "react";
|
|
8
|
-
import { tokenRewardsOf as
|
|
8
|
+
import { tokenRewardsOf as T, pointProgramsOf as $, totalApyOf as j } from "../../utils/apy-breakdown.js";
|
|
9
9
|
import "@gearbox-protocol/sdk";
|
|
10
|
-
import { bpsToPercent as
|
|
11
|
-
import { cn as
|
|
10
|
+
import { bpsToPercent as R } from "../../utils/bps.js";
|
|
11
|
+
import { cn as f } from "../../utils/cn.js";
|
|
12
12
|
import "sonner";
|
|
13
|
-
import { formatLeverage as
|
|
14
|
-
import { formatCompactPercent as
|
|
13
|
+
import { formatLeverage as S } from "../../utils/format-leverage.js";
|
|
14
|
+
import { formatCompactPercent as C } from "../../utils/format-money.js";
|
|
15
15
|
import "@gearbox-protocol/sdk/common-utils";
|
|
16
16
|
import "luxon";
|
|
17
17
|
import "../../utils/z-index.js";
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
return
|
|
18
|
+
function p(o) {
|
|
19
|
+
const n = R(o), r = C(Math.abs(n));
|
|
20
|
+
return n < 0 ? `-${r}` : r;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
function m(o, n, r) {
|
|
23
|
+
return o === "7d" ? r : n;
|
|
24
|
+
}
|
|
25
|
+
function Z({
|
|
26
|
+
supplyApy: o,
|
|
27
|
+
maxLeverage: n,
|
|
25
28
|
collateralApy: r,
|
|
26
|
-
borrowApy:
|
|
27
|
-
quotaRate:
|
|
29
|
+
borrowApy: g,
|
|
30
|
+
quotaRate: b,
|
|
31
|
+
period: l,
|
|
28
32
|
children: h,
|
|
29
|
-
className:
|
|
33
|
+
className: w
|
|
30
34
|
}) {
|
|
31
|
-
const d =
|
|
35
|
+
const d = n !== void 0 && n > 0, i = d ? r : r ?? o, k = i ? T(i) : [], v = $(o), x = j(o), u = g != null || b != null ? -((g ?? 0) + (b ?? 0)) : void 0, y = v.filter((t) => t.multiplier != null), B = /* @__PURE__ */ a(
|
|
32
36
|
"div",
|
|
33
37
|
{
|
|
34
|
-
className:
|
|
38
|
+
className: f(
|
|
35
39
|
"flex w-[400px] max-w-[calc(100vw-32px)] flex-col gap-4 p-4",
|
|
36
40
|
"rounded-xl",
|
|
37
41
|
"bg-card text-card-foreground",
|
|
@@ -44,33 +48,59 @@ function V({
|
|
|
44
48
|
/* @__PURE__ */ e("span", { className: "text-base font-semibold leading-4 text-foreground", children: d ? /* @__PURE__ */ e(
|
|
45
49
|
s,
|
|
46
50
|
{
|
|
47
|
-
messageId:
|
|
51
|
+
messageId: m(
|
|
52
|
+
l,
|
|
53
|
+
"components.yieldBreakdown.titleNetAtLeverage",
|
|
54
|
+
"components.yieldBreakdown.titleNetAtLeverage7d"
|
|
55
|
+
),
|
|
48
56
|
values: {
|
|
49
|
-
leverage:
|
|
57
|
+
leverage: S(n)
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
|
-
) : /* @__PURE__ */ e(
|
|
60
|
+
) : /* @__PURE__ */ e(
|
|
61
|
+
s,
|
|
62
|
+
{
|
|
63
|
+
messageId: m(
|
|
64
|
+
l,
|
|
65
|
+
"components.yieldBreakdown.titleNet",
|
|
66
|
+
"components.yieldBreakdown.titleNet7d"
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
) }),
|
|
53
70
|
/* @__PURE__ */ e(
|
|
54
71
|
"span",
|
|
55
72
|
{
|
|
56
|
-
className:
|
|
73
|
+
className: f(
|
|
57
74
|
"rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",
|
|
58
|
-
|
|
75
|
+
x > 0 ? "bg-success/20 text-success" : "bg-muted text-muted-foreground"
|
|
59
76
|
),
|
|
60
|
-
children:
|
|
77
|
+
children: p(x)
|
|
61
78
|
}
|
|
62
79
|
)
|
|
63
80
|
] }),
|
|
64
|
-
|
|
65
|
-
|
|
81
|
+
i?.organicApy != null && /* @__PURE__ */ e(
|
|
82
|
+
c,
|
|
66
83
|
{
|
|
67
|
-
muted:
|
|
68
|
-
label: /* @__PURE__ */ e(
|
|
69
|
-
|
|
84
|
+
muted: i.organicApy < 0,
|
|
85
|
+
label: /* @__PURE__ */ e(
|
|
86
|
+
s,
|
|
87
|
+
{
|
|
88
|
+
messageId: d ? m(
|
|
89
|
+
l,
|
|
90
|
+
"components.yieldBreakdown.collateralApy",
|
|
91
|
+
"components.yieldBreakdown.collateralApy7d"
|
|
92
|
+
) : m(
|
|
93
|
+
l,
|
|
94
|
+
"components.yieldBreakdown.baseApy",
|
|
95
|
+
"components.yieldBreakdown.baseApy7d"
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
value: p(i.organicApy)
|
|
70
100
|
}
|
|
71
101
|
),
|
|
72
|
-
|
|
73
|
-
|
|
102
|
+
k.map((t) => t.supplyApr == null ? null : /* @__PURE__ */ e(
|
|
103
|
+
c,
|
|
74
104
|
{
|
|
75
105
|
muted: t.supplyApr < 0,
|
|
76
106
|
label: /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
@@ -81,24 +111,33 @@ function V({
|
|
|
81
111
|
values: { symbol: t.token.symbol }
|
|
82
112
|
}
|
|
83
113
|
) }),
|
|
84
|
-
/* @__PURE__ */ e(
|
|
114
|
+
/* @__PURE__ */ e(I, { token: t.token, size: 20 })
|
|
85
115
|
] }),
|
|
86
|
-
value:
|
|
116
|
+
value: p(t.supplyApr)
|
|
87
117
|
},
|
|
88
118
|
`incentive-${t.token.address}-${t.supplyApr}`
|
|
89
119
|
)),
|
|
90
|
-
d &&
|
|
91
|
-
|
|
120
|
+
d && u != null && /* @__PURE__ */ e(
|
|
121
|
+
c,
|
|
92
122
|
{
|
|
93
|
-
muted:
|
|
94
|
-
label: /* @__PURE__ */ e(
|
|
95
|
-
|
|
123
|
+
muted: u < 0,
|
|
124
|
+
label: /* @__PURE__ */ e(
|
|
125
|
+
s,
|
|
126
|
+
{
|
|
127
|
+
messageId: m(
|
|
128
|
+
l,
|
|
129
|
+
"components.yieldBreakdown.borrowRate",
|
|
130
|
+
"components.yieldBreakdown.borrowRate7d"
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
value: p(u)
|
|
96
135
|
}
|
|
97
136
|
),
|
|
98
|
-
|
|
137
|
+
y.length > 0 && /* @__PURE__ */ a(N, { children: [
|
|
99
138
|
/* @__PURE__ */ e("div", { className: "h-px w-full bg-divider" }),
|
|
100
|
-
|
|
101
|
-
|
|
139
|
+
y.map((t) => /* @__PURE__ */ e(
|
|
140
|
+
c,
|
|
102
141
|
{
|
|
103
142
|
label: /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
104
143
|
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
@@ -109,7 +148,7 @@ function V({
|
|
|
109
148
|
}
|
|
110
149
|
) }),
|
|
111
150
|
/* @__PURE__ */ e(
|
|
112
|
-
|
|
151
|
+
A,
|
|
113
152
|
{
|
|
114
153
|
reward: {
|
|
115
154
|
name: t.name,
|
|
@@ -128,38 +167,38 @@ function V({
|
|
|
128
167
|
}
|
|
129
168
|
);
|
|
130
169
|
return /* @__PURE__ */ e(
|
|
131
|
-
|
|
170
|
+
P,
|
|
132
171
|
{
|
|
133
172
|
placement: "bottom",
|
|
134
173
|
triangle: !1,
|
|
135
174
|
type: "modal-tooltip",
|
|
136
175
|
minWidth: "100%",
|
|
137
176
|
maxWidth: "100%",
|
|
138
|
-
title: /* @__PURE__ */ e("span", { className:
|
|
139
|
-
triggerClassName:
|
|
140
|
-
children:
|
|
177
|
+
title: /* @__PURE__ */ e("span", { className: w, children: h }),
|
|
178
|
+
triggerClassName: w,
|
|
179
|
+
children: B
|
|
141
180
|
}
|
|
142
181
|
);
|
|
143
182
|
}
|
|
144
|
-
function
|
|
145
|
-
label:
|
|
146
|
-
value:
|
|
183
|
+
function c({
|
|
184
|
+
label: o,
|
|
185
|
+
value: n,
|
|
147
186
|
muted: r = !1
|
|
148
187
|
}) {
|
|
149
188
|
return /* @__PURE__ */ a("div", { className: "flex h-6 items-center justify-between gap-3 text-sm leading-5", children: [
|
|
150
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 font-normal text-muted-foreground", children:
|
|
189
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 font-normal text-muted-foreground", children: o }),
|
|
151
190
|
/* @__PURE__ */ e(
|
|
152
191
|
"span",
|
|
153
192
|
{
|
|
154
|
-
className:
|
|
193
|
+
className: f(
|
|
155
194
|
"shrink-0 font-semibold tabular-nums",
|
|
156
195
|
r ? "text-muted-foreground" : "text-foreground"
|
|
157
196
|
),
|
|
158
|
-
children:
|
|
197
|
+
children: n
|
|
159
198
|
}
|
|
160
199
|
)
|
|
161
200
|
] });
|
|
162
201
|
}
|
|
163
202
|
export {
|
|
164
|
-
|
|
203
|
+
Z as YieldBreakdownTooltip
|
|
165
204
|
};
|