@gearbox-protocol/ui-kit 4.5.1 → 4.6.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/apy-breakdown-body/apy-breakdown-body.cjs +1 -1
- package/dist/cjs/components/base/apy-breakdown-body/index.cjs +1 -1
- package/dist/cjs/components/base/info-list/info-list.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/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown.cjs +1 -1
- package/dist/esm/components/base/apy-breakdown-body/apy-breakdown-body.js +70 -45
- package/dist/esm/components/base/apy-breakdown-body/index.js +8 -7
- package/dist/esm/components/base/info-list/info-list.js +14 -13
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +68 -64
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +109 -105
- package/dist/esm/components/compound-apy/compound-apy.js +22 -20
- package/dist/esm/components/graph/graph.js +53 -52
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown.js +92 -79
- package/dist/types/components/base/apy-breakdown-body/apy-breakdown-body.d.ts +5 -0
- package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +3 -1
- package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +3 -1
- package/dist/types/components/compound-apy/compound-apy.d.ts +3 -1
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown.d.ts +3 -1
- package/package.json +2 -2
|
@@ -206,7 +206,7 @@ function oo({
|
|
|
206
206
|
disableZoom: ke = !1,
|
|
207
207
|
hideDefaultTooltip: be = !1
|
|
208
208
|
}) {
|
|
209
|
-
const I = H(null),
|
|
209
|
+
const I = H(null), V = H(/* @__PURE__ */ new Map()), Se = H(!1), Le = H(!0), Me = H([]), ce = H(0), B = H(null), ve = H(null), De = H(null), R = gt(), ue = _e.useMemo(() => e.flatMap((t) => t.data), [e]), et = _e.useMemo(() => {
|
|
210
210
|
if (e.length > 0) {
|
|
211
211
|
const t = e[e.length - 1];
|
|
212
212
|
if (t.data.length > 0)
|
|
@@ -267,7 +267,7 @@ function oo({
|
|
|
267
267
|
ce.current = 0;
|
|
268
268
|
}
|
|
269
269
|
return nt((l) => l + 1), () => {
|
|
270
|
-
r.remove(), I.current = null, Se.current = !1,
|
|
270
|
+
r.remove(), I.current = null, Se.current = !1, V.current.clear();
|
|
271
271
|
};
|
|
272
272
|
}, [R]), W(() => {
|
|
273
273
|
const t = I.current;
|
|
@@ -312,21 +312,21 @@ function oo({
|
|
|
312
312
|
o
|
|
313
313
|
])
|
|
314
314
|
), m = (i, o, d) => {
|
|
315
|
-
const { formatter:
|
|
315
|
+
const { formatter: L, tickmarksFormatter: N, updateVisibleRange: E } = xt(i, o, {
|
|
316
316
|
yScaleMin: r
|
|
317
317
|
});
|
|
318
|
-
return { formatter:
|
|
318
|
+
return { formatter: L, tickmarksFormatter: N, updateVisibleRange: E, labels: d };
|
|
319
319
|
}, p = [];
|
|
320
320
|
if (z)
|
|
321
321
|
for (const i of ["left", "right"]) {
|
|
322
322
|
const o = /* @__PURE__ */ new Set(), d = [];
|
|
323
|
-
let
|
|
324
|
-
for (const
|
|
325
|
-
if (
|
|
326
|
-
o.size === 0 &&
|
|
327
|
-
for (const E of
|
|
323
|
+
let L = u;
|
|
324
|
+
for (const N of e)
|
|
325
|
+
if (N.data.length !== 0 && a.get(N.label) === i) {
|
|
326
|
+
o.size === 0 && N.yMeasureUnit && (L = N.yMeasureUnit), o.add(N.label);
|
|
327
|
+
for (const E of N.data) d.push(E.value);
|
|
328
328
|
}
|
|
329
|
-
o.size > 0 && p.push(m(d,
|
|
329
|
+
o.size > 0 && p.push(m(d, L, o));
|
|
330
330
|
}
|
|
331
331
|
else {
|
|
332
332
|
const i = ue.map((d) => d.value), o = new Set(
|
|
@@ -357,7 +357,7 @@ function oo({
|
|
|
357
357
|
minBarSpacing: 0
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
|
-
const v = !z && e.length > 1 && !K, X = z ? R : e.length > 1 && !K || R,
|
|
360
|
+
const v = !z && e.length > 1 && !K, X = z ? R : e.length > 1 && !K || R, k = ne(
|
|
361
361
|
"hsl(var(--muted-foreground))",
|
|
362
362
|
"rgb(163, 163, 163)"
|
|
363
363
|
);
|
|
@@ -369,20 +369,20 @@ function oo({
|
|
|
369
369
|
...x.leftPriceScale || {},
|
|
370
370
|
...S?.leftPriceScale,
|
|
371
371
|
visible: z && !R,
|
|
372
|
-
textColor:
|
|
372
|
+
textColor: k
|
|
373
373
|
},
|
|
374
374
|
rightPriceScale: {
|
|
375
375
|
...x.rightPriceScale || {},
|
|
376
376
|
...S?.rightPriceScale,
|
|
377
377
|
visible: z ? !R : !X,
|
|
378
|
-
textColor:
|
|
378
|
+
textColor: k
|
|
379
379
|
}
|
|
380
380
|
});
|
|
381
|
-
const O = new Set(
|
|
381
|
+
const O = new Set(V.current.keys()), $ = new Set(e.map(ie));
|
|
382
382
|
for (const i of O)
|
|
383
383
|
if (!$.has(i)) {
|
|
384
|
-
const o =
|
|
385
|
-
o && (t.removeSeries(o),
|
|
384
|
+
const o = V.current.get(i);
|
|
385
|
+
o && (t.removeSeries(o), V.current.delete(i));
|
|
386
386
|
}
|
|
387
387
|
const g = St(), M = [];
|
|
388
388
|
let T = 0;
|
|
@@ -403,25 +403,25 @@ function oo({
|
|
|
403
403
|
Number.isFinite(i.priceTop) && d.push(i.priceTop), Number.isFinite(i.priceBottom) && d.push(i.priceBottom), C.set(o, d);
|
|
404
404
|
}
|
|
405
405
|
for (let i = 0; i < e.length; i++) {
|
|
406
|
-
const o = e[i], d = ie(o),
|
|
406
|
+
const o = e[i], d = ie(o), L = Oe(i), N = o.lineColor ?? o.color ?? L.line;
|
|
407
407
|
let E, q;
|
|
408
408
|
if (o.lineColor ?? o.color)
|
|
409
409
|
if (o.topColor && o.bottomColor)
|
|
410
410
|
E = o.topColor, q = o.bottomColor;
|
|
411
411
|
else if (o.topColor) {
|
|
412
|
-
const b = Pe(
|
|
412
|
+
const b = Pe(N);
|
|
413
413
|
E = o.topColor, q = b.bottomColor;
|
|
414
414
|
} else if (o.bottomColor)
|
|
415
|
-
E = Pe(
|
|
415
|
+
E = Pe(N).topColor, q = o.bottomColor;
|
|
416
416
|
else {
|
|
417
|
-
const b = Pe(
|
|
417
|
+
const b = Pe(N);
|
|
418
418
|
E = b.topColor, q = b.bottomColor;
|
|
419
419
|
}
|
|
420
420
|
else
|
|
421
|
-
E = o.topColor ||
|
|
421
|
+
E = o.topColor || L.top, q = o.bottomColor || L.bottom;
|
|
422
422
|
if (o.data.length === 0) {
|
|
423
|
-
const b =
|
|
424
|
-
b && (t.removeSeries(b),
|
|
423
|
+
const b = V.current.get(d);
|
|
424
|
+
b && (t.removeSeries(b), V.current.delete(d));
|
|
425
425
|
continue;
|
|
426
426
|
}
|
|
427
427
|
const fe = o.data.length > 0 ? Math.min(...o.data.map((b) => b.value)) : 0, de = o.data.length > 0 ? Math.max(...o.data.map((b) => b.value)) : 0, it = fe < 0, lt = o.data.some((b) => b.value === 0), st = !it && lt, Xe = Tt(de - fe), $e = z ? o.priceScaleId ?? (T === 0 ? "left" : "right") : K || !v || T === 0 ? "right" : `scale-${T}`;
|
|
@@ -457,11 +457,12 @@ function oo({
|
|
|
457
457
|
}
|
|
458
458
|
return w;
|
|
459
459
|
}, Ge = y.get(o.label) ?? p[0], je = Ge.formatter, ut = Ge.tickmarksFormatter, xe = {
|
|
460
|
-
lineColor:
|
|
460
|
+
lineColor: N,
|
|
461
461
|
topColor: E,
|
|
462
462
|
bottomColor: q,
|
|
463
463
|
priceScaleId: $e,
|
|
464
464
|
...o.seriesType === "line" && {
|
|
465
|
+
color: N,
|
|
465
466
|
lineStyle: o.lineStyle ?? le.Solid
|
|
466
467
|
},
|
|
467
468
|
priceFormat: {
|
|
@@ -474,7 +475,7 @@ function oo({
|
|
|
474
475
|
},
|
|
475
476
|
autoscaleInfoProvider: ct
|
|
476
477
|
}, He = o.seriesType === "line";
|
|
477
|
-
let A =
|
|
478
|
+
let A = V.current.get(d);
|
|
478
479
|
const te = o.data.map((b) => ({
|
|
479
480
|
...b,
|
|
480
481
|
time: b.time
|
|
@@ -485,13 +486,13 @@ function oo({
|
|
|
485
486
|
j.push({ time: we });
|
|
486
487
|
te.unshift(...j);
|
|
487
488
|
}
|
|
488
|
-
A && A.seriesType() !== (He ? "Line" : "Area") && (t.removeSeries(A),
|
|
489
|
+
A && A.seriesType() !== (He ? "Line" : "Area") && (t.removeSeries(A), V.current.delete(d), A = void 0), A ? (A.applyOptions(xe), A.setData(te)) : (He ? A = t.addSeries(dt, {
|
|
489
490
|
...g,
|
|
490
491
|
...xe
|
|
491
492
|
}) : A = t.addSeries(mt, {
|
|
492
493
|
...g,
|
|
493
494
|
...xe
|
|
494
|
-
}), A.setData(te),
|
|
495
|
+
}), A.setData(te), V.current.set(d, A)), T++;
|
|
495
496
|
}
|
|
496
497
|
if (z)
|
|
497
498
|
try {
|
|
@@ -502,7 +503,7 @@ function oo({
|
|
|
502
503
|
alignLabels: !0,
|
|
503
504
|
entireTextOnly: !1,
|
|
504
505
|
tickMarkDensity: pe,
|
|
505
|
-
textColor:
|
|
506
|
+
textColor: k,
|
|
506
507
|
...S?.rightPriceScale
|
|
507
508
|
};
|
|
508
509
|
i?.applyOptions(d), o?.applyOptions(d);
|
|
@@ -522,7 +523,7 @@ function oo({
|
|
|
522
523
|
alignLabels: !0,
|
|
523
524
|
entireTextOnly: !1,
|
|
524
525
|
tickMarkDensity: pe,
|
|
525
|
-
textColor:
|
|
526
|
+
textColor: k
|
|
526
527
|
});
|
|
527
528
|
} catch (o) {
|
|
528
529
|
console.warn(
|
|
@@ -543,7 +544,7 @@ function oo({
|
|
|
543
544
|
alignLabels: !0,
|
|
544
545
|
entireTextOnly: !1,
|
|
545
546
|
tickMarkDensity: pe,
|
|
546
|
-
textColor:
|
|
547
|
+
textColor: k,
|
|
547
548
|
...S?.rightPriceScale
|
|
548
549
|
});
|
|
549
550
|
} catch {
|
|
@@ -558,29 +559,29 @@ function oo({
|
|
|
558
559
|
const i = ue.map((d) => Number(d.time)).filter((d) => Number.isFinite(d)), o = new Set(i).size - 1;
|
|
559
560
|
if (o >= 0) {
|
|
560
561
|
const d = () => {
|
|
561
|
-
const
|
|
562
|
+
const L = t.timeScale();
|
|
562
563
|
if (h !== "time") {
|
|
563
|
-
|
|
564
|
+
L.applyOptions({
|
|
564
565
|
fixLeftEdge: !0,
|
|
565
566
|
fixRightEdge: !0
|
|
566
|
-
}),
|
|
567
|
+
}), L.setVisibleLogicalRange({ from: 0, to: o });
|
|
567
568
|
return;
|
|
568
569
|
}
|
|
569
|
-
const
|
|
570
|
-
|
|
570
|
+
const N = z && !R, E = z ? !R : !X, q = !N, fe = !E;
|
|
571
|
+
L.applyOptions({
|
|
571
572
|
fixLeftEdge: !q,
|
|
572
573
|
fixRightEdge: !fe
|
|
573
574
|
}), Z = requestAnimationFrame(() => {
|
|
574
575
|
const de = Vt({
|
|
575
576
|
lastIndex: o,
|
|
576
|
-
width:
|
|
577
|
+
width: L.width(),
|
|
577
578
|
padLeft: q,
|
|
578
579
|
padRight: fe
|
|
579
580
|
});
|
|
580
581
|
try {
|
|
581
|
-
de &&
|
|
582
|
+
de && L.setVisibleLogicalRange(de);
|
|
582
583
|
} catch {
|
|
583
|
-
|
|
584
|
+
L.fitContent();
|
|
584
585
|
}
|
|
585
586
|
});
|
|
586
587
|
};
|
|
@@ -627,7 +628,7 @@ function oo({
|
|
|
627
628
|
}
|
|
628
629
|
if (!r) return;
|
|
629
630
|
const l = (a) => {
|
|
630
|
-
const { time: m = r, seriesData: p, point: y } = a || {}, x = e[0], v = x ?
|
|
631
|
+
const { time: m = r, seriesData: p, point: y } = a || {}, x = e[0], v = x ? V.current.get(ie(x)) : void 0;
|
|
631
632
|
if (!y || !m) {
|
|
632
633
|
const $ = /* @__PURE__ */ new Map();
|
|
633
634
|
for (const g of e)
|
|
@@ -644,9 +645,9 @@ function oo({
|
|
|
644
645
|
return;
|
|
645
646
|
}
|
|
646
647
|
const X = /* @__PURE__ */ new Map();
|
|
647
|
-
let
|
|
648
|
+
let k, O = v;
|
|
648
649
|
for (let $ = 0; $ < e.length; $++) {
|
|
649
|
-
const g = e[$], M =
|
|
650
|
+
const g = e[$], M = V.current.get(ie(g));
|
|
650
651
|
if (!M) continue;
|
|
651
652
|
const T = p?.get(M), G = T && "value" in T ? T.value : void 0;
|
|
652
653
|
let C;
|
|
@@ -660,10 +661,10 @@ function oo({
|
|
|
660
661
|
if (Number(m) < Z) continue;
|
|
661
662
|
C = At(g.data, Number(m));
|
|
662
663
|
}
|
|
663
|
-
Number.isNaN(C) || (
|
|
664
|
+
Number.isNaN(C) || (k === void 0 && (k = C, O = M), X.set(g.label, { value: C, time: m }));
|
|
664
665
|
}
|
|
665
|
-
if (Ce(X),
|
|
666
|
-
const g = t.timeScale().timeToCoordinate(m), M = O.priceToCoordinate(
|
|
666
|
+
if (Ce(X), k !== void 0 && O) {
|
|
667
|
+
const g = t.timeScale().timeToCoordinate(m), M = O.priceToCoordinate(k);
|
|
667
668
|
if (g !== null && M !== null) {
|
|
668
669
|
const T = B.current;
|
|
669
670
|
if (T) {
|
|
@@ -683,7 +684,7 @@ function oo({
|
|
|
683
684
|
Q(null);
|
|
684
685
|
};
|
|
685
686
|
return t.subscribeCrosshairMove(l), R && t.subscribeClick(l), !s && !K && !be && requestAnimationFrame(() => {
|
|
686
|
-
const a = e[0], m = a ?
|
|
687
|
+
const a = e[0], m = a ? V.current.get(ie(a)) : void 0;
|
|
687
688
|
if (m && r && a.data.length > 0) {
|
|
688
689
|
const y = t.timeScale().timeToCoordinate(r), x = a.data[a.data.length - 1].value, v = m.priceToCoordinate(x);
|
|
689
690
|
y !== null && v !== null && Q({ x: y, y: v });
|
|
@@ -705,8 +706,8 @@ function oo({
|
|
|
705
706
|
for (const v of e)
|
|
706
707
|
if (y.labels.has(v.label))
|
|
707
708
|
for (const X of v.data) {
|
|
708
|
-
const
|
|
709
|
-
|
|
709
|
+
const k = Number(X.time);
|
|
710
|
+
k >= m && k <= p && x.push(X.value);
|
|
710
711
|
}
|
|
711
712
|
x.length > 0 && y.updateVisibleRange(x);
|
|
712
713
|
}
|
|
@@ -717,7 +718,7 @@ function oo({
|
|
|
717
718
|
);
|
|
718
719
|
};
|
|
719
720
|
}, [e]), W(() => {
|
|
720
|
-
const t = I.current, s = Array.from(
|
|
721
|
+
const t = I.current, s = Array.from(V.current.values()), r = [];
|
|
721
722
|
if (t && s.length > 0 && P) {
|
|
722
723
|
const l = vt(), a = s[0];
|
|
723
724
|
for (const m of P) {
|
|
@@ -755,7 +756,7 @@ function oo({
|
|
|
755
756
|
for (const l of D) {
|
|
756
757
|
if (!Number.isFinite(l.price)) continue;
|
|
757
758
|
const a = Qe(
|
|
758
|
-
|
|
759
|
+
V.current,
|
|
759
760
|
e,
|
|
760
761
|
l.seriesLabel
|
|
761
762
|
);
|
|
@@ -797,7 +798,7 @@ function oo({
|
|
|
797
798
|
const s = "rgba(239, 68, 68, 0.12)";
|
|
798
799
|
for (const r of F) {
|
|
799
800
|
const l = Qe(
|
|
800
|
-
|
|
801
|
+
V.current,
|
|
801
802
|
e,
|
|
802
803
|
r.seriesLabel
|
|
803
804
|
);
|
|
@@ -899,7 +900,7 @@ function oo({
|
|
|
899
900
|
se
|
|
900
901
|
), p = l.tooltipText ?? "";
|
|
901
902
|
if (!(a || m || p)) return null;
|
|
902
|
-
const x = l.labelBackgroundColor ?? l.color ?? "hsl(var(--background))", v = l.labelTextColor ?? "hsl(var(--foreground))", X = `${String(t.xCoordinate)}-${a}-${p}`,
|
|
903
|
+
const x = l.labelBackgroundColor ?? l.color ?? "hsl(var(--background))", v = l.labelTextColor ?? "hsl(var(--foreground))", X = `${String(t.xCoordinate)}-${a}-${p}`, k = zt(
|
|
903
904
|
r,
|
|
904
905
|
tt,
|
|
905
906
|
ot[s]
|
|
@@ -915,7 +916,7 @@ function oo({
|
|
|
915
916
|
p && "pointer-events-auto cursor-default"
|
|
916
917
|
),
|
|
917
918
|
style: {
|
|
918
|
-
...
|
|
919
|
+
...k,
|
|
919
920
|
backgroundColor: x,
|
|
920
921
|
color: v
|
|
921
922
|
},
|
|
@@ -1,140 +1,153 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { ApyBreakdownBody as
|
|
3
|
-
import { PoolApyBreakdownCard as
|
|
4
|
-
import { PointsIcon as
|
|
5
|
-
import { TokenIcon as
|
|
6
|
-
import { FormattedMessageTyped as
|
|
7
|
-
import { formatLeverage as
|
|
8
|
-
import { tokenRewardsOf as R, pointProgramsOf as T, totalApyOf as
|
|
9
|
-
import { ApyBreakdownTooltip as
|
|
10
|
-
function
|
|
11
|
-
supplyApy:
|
|
12
|
-
maxLeverage:
|
|
13
|
-
collateralApy:
|
|
14
|
-
borrowApy:
|
|
15
|
-
quotaRate:
|
|
16
|
-
period:
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { ApyBreakdownBody as v, formatBreakdownRate as u, ApyBreakdownRow as y, periodMessageId as f, RewardLinks as h, ApyBreakdownDivider as b } from "../base/apy-breakdown-body/apy-breakdown-body.js";
|
|
3
|
+
import { PoolApyBreakdownCard as I } from "../base/pool-apy-breakdown-card/pool-apy-breakdown-card.js";
|
|
4
|
+
import { PointsIcon as P } from "../points-icon/points-icon.js";
|
|
5
|
+
import { TokenIcon as x } from "../token-icon/token-icon.js";
|
|
6
|
+
import { FormattedMessageTyped as s } from "../typed-intl/index.js";
|
|
7
|
+
import { formatLeverage as N } from "../../utils/format-leverage.js";
|
|
8
|
+
import { tokenRewardsOf as R, pointProgramsOf as T, totalApyOf as $ } from "../../utils/internal/apy-breakdown.js";
|
|
9
|
+
import { ApyBreakdownTooltip as O } from "./yield-breakdown-tooltip.js";
|
|
10
|
+
function H({
|
|
11
|
+
supplyApy: t,
|
|
12
|
+
maxLeverage: a,
|
|
13
|
+
collateralApy: g,
|
|
14
|
+
borrowApy: i,
|
|
15
|
+
quotaRate: d,
|
|
16
|
+
period: l,
|
|
17
|
+
hideRewardLinks: m = !1,
|
|
17
18
|
children: n,
|
|
18
|
-
className:
|
|
19
|
-
open:
|
|
19
|
+
className: p,
|
|
20
|
+
open: k
|
|
20
21
|
}) {
|
|
21
|
-
const
|
|
22
|
+
const c = a !== void 0 && a > 0;
|
|
22
23
|
return /* @__PURE__ */ e(
|
|
23
|
-
|
|
24
|
+
O,
|
|
24
25
|
{
|
|
25
26
|
placement: "bottom",
|
|
26
|
-
title: /* @__PURE__ */ e("span", { className:
|
|
27
|
-
triggerClassName:
|
|
28
|
-
open:
|
|
29
|
-
children:
|
|
30
|
-
|
|
27
|
+
title: /* @__PURE__ */ e("span", { className: p, children: n }),
|
|
28
|
+
triggerClassName: p,
|
|
29
|
+
open: k,
|
|
30
|
+
children: c ? /* @__PURE__ */ e(
|
|
31
|
+
S,
|
|
31
32
|
{
|
|
32
|
-
supplyApy:
|
|
33
|
-
maxLeverage:
|
|
34
|
-
collateralApy:
|
|
35
|
-
borrowApy:
|
|
36
|
-
quotaRate:
|
|
37
|
-
period:
|
|
33
|
+
supplyApy: t,
|
|
34
|
+
maxLeverage: a,
|
|
35
|
+
collateralApy: g,
|
|
36
|
+
borrowApy: i,
|
|
37
|
+
quotaRate: d,
|
|
38
|
+
period: l,
|
|
39
|
+
hideRewardLinks: m
|
|
38
40
|
}
|
|
39
|
-
) : /* @__PURE__ */ e(
|
|
41
|
+
) : /* @__PURE__ */ e(
|
|
42
|
+
I,
|
|
43
|
+
{
|
|
44
|
+
data: t,
|
|
45
|
+
period: l,
|
|
46
|
+
hideRewardLinks: m
|
|
47
|
+
}
|
|
48
|
+
)
|
|
40
49
|
}
|
|
41
50
|
);
|
|
42
51
|
}
|
|
43
|
-
function
|
|
44
|
-
supplyApy:
|
|
45
|
-
maxLeverage:
|
|
46
|
-
collateralApy:
|
|
47
|
-
borrowApy:
|
|
48
|
-
quotaRate:
|
|
49
|
-
period:
|
|
52
|
+
function S({
|
|
53
|
+
supplyApy: t,
|
|
54
|
+
maxLeverage: a,
|
|
55
|
+
collateralApy: g,
|
|
56
|
+
borrowApy: i,
|
|
57
|
+
quotaRate: d,
|
|
58
|
+
period: l,
|
|
59
|
+
hideRewardLinks: m
|
|
50
60
|
}) {
|
|
51
|
-
const n =
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
|
|
61
|
+
const n = g, p = n ? R(n) : [], k = T(t), c = $(t), w = i != null || d != null ? (i ?? 0) + (d ?? 0) : void 0, B = k.filter((o) => o.multiplier != null);
|
|
62
|
+
return /* @__PURE__ */ r(
|
|
63
|
+
v,
|
|
54
64
|
{
|
|
55
65
|
title: /* @__PURE__ */ e(
|
|
56
|
-
|
|
66
|
+
s,
|
|
57
67
|
{
|
|
58
|
-
messageId:
|
|
59
|
-
|
|
68
|
+
messageId: f(
|
|
69
|
+
l,
|
|
60
70
|
"components.yieldBreakdown.titleNetAtLeverage",
|
|
61
71
|
"components.yieldBreakdown.titleNetAtLeverage7d"
|
|
62
72
|
),
|
|
63
|
-
values: { leverage:
|
|
73
|
+
values: { leverage: N(a) }
|
|
64
74
|
}
|
|
65
75
|
),
|
|
66
|
-
chip: c
|
|
67
|
-
chipPositive:
|
|
76
|
+
chip: u(c, !0),
|
|
77
|
+
chipPositive: c > 0,
|
|
68
78
|
children: [
|
|
69
79
|
n?.organicApy != null ? /* @__PURE__ */ e(
|
|
70
|
-
|
|
80
|
+
y,
|
|
71
81
|
{
|
|
72
82
|
muted: n.organicApy < 0,
|
|
73
83
|
label: /* @__PURE__ */ e(
|
|
74
|
-
|
|
84
|
+
s,
|
|
75
85
|
{
|
|
76
|
-
messageId:
|
|
77
|
-
|
|
86
|
+
messageId: f(
|
|
87
|
+
l,
|
|
78
88
|
"components.yieldBreakdown.collateralApy",
|
|
79
89
|
"components.yieldBreakdown.collateralApy7d"
|
|
80
90
|
)
|
|
81
91
|
}
|
|
82
92
|
),
|
|
83
|
-
value:
|
|
93
|
+
value: u(n.organicApy)
|
|
84
94
|
}
|
|
85
95
|
) : null,
|
|
86
|
-
|
|
96
|
+
p.map(
|
|
87
97
|
(o) => o.supplyApr == null ? null : /* @__PURE__ */ e(
|
|
88
|
-
|
|
98
|
+
y,
|
|
89
99
|
{
|
|
90
100
|
muted: o.supplyApr < 0,
|
|
91
|
-
label: /* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
label: /* @__PURE__ */ r("span", { className: "flex flex-col gap-0.5", children: [
|
|
102
|
+
/* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
103
|
+
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
104
|
+
s,
|
|
105
|
+
{
|
|
106
|
+
messageId: "components.apyParts.extraAPY",
|
|
107
|
+
values: { symbol: o.token.symbol }
|
|
108
|
+
}
|
|
109
|
+
) }),
|
|
110
|
+
/* @__PURE__ */ e(x, { token: o.token, size: 20 })
|
|
111
|
+
] }),
|
|
112
|
+
m ? null : /* @__PURE__ */ e(h, { links: o.links })
|
|
100
113
|
] }),
|
|
101
|
-
value:
|
|
114
|
+
value: u(o.supplyApr)
|
|
102
115
|
},
|
|
103
116
|
`incentive-${o.token.address}-${o.supplyApr}`
|
|
104
117
|
)
|
|
105
118
|
),
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
w != null ? /* @__PURE__ */ e(
|
|
120
|
+
y,
|
|
108
121
|
{
|
|
109
122
|
muted: !0,
|
|
110
123
|
label: /* @__PURE__ */ e(
|
|
111
|
-
|
|
124
|
+
s,
|
|
112
125
|
{
|
|
113
|
-
messageId:
|
|
114
|
-
|
|
126
|
+
messageId: f(
|
|
127
|
+
l,
|
|
115
128
|
"components.yieldBreakdown.borrowRate",
|
|
116
129
|
"components.yieldBreakdown.borrowRate7d"
|
|
117
130
|
)
|
|
118
131
|
}
|
|
119
132
|
),
|
|
120
|
-
value:
|
|
133
|
+
value: u(w)
|
|
121
134
|
}
|
|
122
135
|
) : null,
|
|
123
|
-
|
|
124
|
-
/* @__PURE__ */ e(
|
|
125
|
-
|
|
126
|
-
|
|
136
|
+
B.length > 0 ? /* @__PURE__ */ r(A, { children: [
|
|
137
|
+
/* @__PURE__ */ e(b, {}),
|
|
138
|
+
B.map((o) => /* @__PURE__ */ e(
|
|
139
|
+
y,
|
|
127
140
|
{
|
|
128
|
-
label: /* @__PURE__ */
|
|
141
|
+
label: /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
129
142
|
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
130
|
-
|
|
143
|
+
s,
|
|
131
144
|
{
|
|
132
145
|
messageId: "components.yieldBreakdown.programPoints",
|
|
133
146
|
values: { name: o.name }
|
|
134
147
|
}
|
|
135
148
|
) }),
|
|
136
149
|
/* @__PURE__ */ e(
|
|
137
|
-
|
|
150
|
+
P,
|
|
138
151
|
{
|
|
139
152
|
reward: {
|
|
140
153
|
name: o.name,
|
|
@@ -154,5 +167,5 @@ function $({
|
|
|
154
167
|
);
|
|
155
168
|
}
|
|
156
169
|
export {
|
|
157
|
-
|
|
170
|
+
H as YieldBreakdownTooltip
|
|
158
171
|
};
|
|
@@ -44,4 +44,9 @@ export interface ApyBreakdownRowProps {
|
|
|
44
44
|
readonly captionTestId?: string;
|
|
45
45
|
}
|
|
46
46
|
export declare function ApyBreakdownRow({ label, value, subtext, muted, testId, valueTestId, captionTestId, }: ApyBreakdownRowProps): React.ReactElement;
|
|
47
|
+
export interface RewardLinksProps {
|
|
48
|
+
readonly links?: readonly string[];
|
|
49
|
+
}
|
|
50
|
+
/** "merkl.xyz ↗" under an incentive row, one link per campaign page. */
|
|
51
|
+
export declare function RewardLinks({ links, }: RewardLinksProps): React.ReactElement | null;
|
|
47
52
|
export declare function ApyBreakdownDivider(): React.ReactElement;
|
|
@@ -7,6 +7,8 @@ export interface PoolApyBreakdownCardProps {
|
|
|
7
7
|
readonly data?: ApyBreakdown;
|
|
8
8
|
/** When `"7d"`, labels carry the averaging-window suffix. */
|
|
9
9
|
readonly period?: "7d";
|
|
10
|
+
/** Leaves the campaign links out, where the breakdown sits in a list. */
|
|
11
|
+
readonly hideRewardLinks?: boolean;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* How a pool's net APY is arrived at: base yield plus incentives.
|
|
@@ -15,4 +17,4 @@ export interface PoolApyBreakdownCardProps {
|
|
|
15
17
|
* that row is still shown as Incentive APY at 0%. Points sit under a divider
|
|
16
18
|
* when present; they are not addends.
|
|
17
19
|
*/
|
|
18
|
-
export declare function PoolApyBreakdownCard({ data, period, }: PoolApyBreakdownCardProps): React.ReactElement;
|
|
20
|
+
export declare function PoolApyBreakdownCard({ data, period, hideRewardLinks, }: PoolApyBreakdownCardProps): React.ReactElement;
|
package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export interface StrategyApyBreakdownCardProps {
|
|
|
24
24
|
readonly showFormula?: boolean;
|
|
25
25
|
/** When `"7d"`, labels carry the averaging-window suffix. */
|
|
26
26
|
readonly period?: "7d";
|
|
27
|
+
/** Leaves the campaign links out, where the breakdown sits in a list. */
|
|
28
|
+
readonly hideRewardLinks?: boolean;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* How a strategy's net APY is arrived at: collateral yield on the leveraged
|
|
@@ -42,4 +44,4 @@ export interface StrategyApyBreakdownCardProps {
|
|
|
42
44
|
* remainder, so the column adds up to the chip even when each reward rounds
|
|
43
45
|
* its own way.
|
|
44
46
|
*/
|
|
45
|
-
export declare function StrategyApyBreakdownCard({ data, leverage, showFormula, period, }: StrategyApyBreakdownCardProps): React.ReactElement;
|
|
47
|
+
export declare function StrategyApyBreakdownCard({ data, leverage, showFormula, period, hideRewardLinks, }: StrategyApyBreakdownCardProps): React.ReactElement;
|
|
@@ -35,6 +35,8 @@ export interface CompoundAPYProps {
|
|
|
35
35
|
tooltip?: boolean;
|
|
36
36
|
/** When `"7d"`, tooltip labels carry the averaging-window suffix. */
|
|
37
37
|
period?: "7d";
|
|
38
|
+
/** Forwarded to {@link YieldBreakdownTooltip}. */
|
|
39
|
+
hideRewardLinks?: boolean;
|
|
38
40
|
className?: string;
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
@@ -43,4 +45,4 @@ export interface CompoundAPYProps {
|
|
|
43
45
|
* No `tokensList`, no external APY, no 7D history, no "soon" points state.
|
|
44
46
|
* For the legacy percent-based API see {@link CompoundAPYLegacy}.
|
|
45
47
|
*/
|
|
46
|
-
export declare function CompoundAPY({ apy, maxLeverage, collateralApy, borrowApy, quotaRate, decimals, tooltip, period, className, }: CompoundAPYProps): import("react").JSX.Element;
|
|
48
|
+
export declare function CompoundAPY({ apy, maxLeverage, collateralApy, borrowApy, quotaRate, decimals, tooltip, period, hideRewardLinks, className, }: CompoundAPYProps): import("react").JSX.Element;
|
|
@@ -26,6 +26,8 @@ export interface YieldBreakdownTooltipProps {
|
|
|
26
26
|
quotaRate?: Bps;
|
|
27
27
|
/** When `"7d"`, labels carry the averaging-window suffix. */
|
|
28
28
|
period?: "7d";
|
|
29
|
+
/** Leaves the campaign links out, where the breakdown sits in a list. */
|
|
30
|
+
hideRewardLinks?: boolean;
|
|
29
31
|
children?: React.ReactNode;
|
|
30
32
|
className?: string;
|
|
31
33
|
/** Controlled open state. Specs pass it because jsdom has no hover. */
|
|
@@ -35,4 +37,4 @@ export interface YieldBreakdownTooltipProps {
|
|
|
35
37
|
* Earn APY tooltip — a pool hands {@link PoolApyBreakdownCard}; a strategy
|
|
36
38
|
* (positions list) still itemises unlevered collateral, borrow and rewards.
|
|
37
39
|
*/
|
|
38
|
-
export declare function YieldBreakdownTooltip({ supplyApy, maxLeverage, collateralApy, borrowApy, quotaRate, period, children, className, open, }: YieldBreakdownTooltipProps): React.JSX.Element;
|
|
40
|
+
export declare function YieldBreakdownTooltip({ supplyApy, maxLeverage, collateralApy, borrowApy, quotaRate, period, hideRewardLinks, children, className, open, }: YieldBreakdownTooltipProps): React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/ui-kit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "Internal UI components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"@commitlint/cli": "^20.1.0",
|
|
111
111
|
"@commitlint/config-conventional": "^20.0.0",
|
|
112
112
|
"@gearbox-protocol/biome-config": "^1.0.2",
|
|
113
|
-
"@gearbox-protocol/sdk": "
|
|
113
|
+
"@gearbox-protocol/sdk": "17.5.0",
|
|
114
114
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
115
115
|
"@storybook/addon-a11y": "^10.0.8",
|
|
116
116
|
"@storybook/addon-docs": "^10.0.8",
|