@gearbox-protocol/ui-kit 4.0.0-next.16 → 4.0.0-next.18

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.
Files changed (42) hide show
  1. package/dist/cjs/components/base/index.cjs +1 -1
  2. package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
  3. package/dist/cjs/components/base/position-assets/constants.cjs +1 -0
  4. package/dist/cjs/components/base/position-assets/index.cjs +1 -0
  5. package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -0
  6. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  7. package/dist/cjs/components/base/values/scalars.cjs +1 -1
  8. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  9. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  10. package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
  11. package/dist/cjs/components/index.cjs +1 -1
  12. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  13. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
  14. package/dist/cjs/index.cjs +1 -1
  15. package/dist/cjs/utils/index.cjs +1 -1
  16. package/dist/cjs/utils/strategy-apy.cjs +1 -1
  17. package/dist/esm/components/base/index.js +112 -108
  18. package/dist/esm/components/base/info-list/info-list.js +7 -6
  19. package/dist/esm/components/base/position-assets/constants.js +8 -0
  20. package/dist/esm/components/base/position-assets/index.js +6 -0
  21. package/dist/esm/components/base/position-assets/position-assets.js +73 -0
  22. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +121 -116
  23. package/dist/esm/components/base/values/scalars.js +52 -33
  24. package/dist/esm/components/checkbox/checkbox-labeled.js +1 -1
  25. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +1 -1
  26. package/dist/esm/components/compound-apy/compound-apy.js +2 -2
  27. package/dist/esm/components/index.js +662 -658
  28. package/dist/esm/components/with-copy/with-copy.js +1 -1
  29. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +20 -21
  30. package/dist/esm/index.js +851 -848
  31. package/dist/esm/utils/index.js +29 -30
  32. package/dist/esm/utils/strategy-apy.js +41 -31
  33. package/dist/types/components/base/index.d.ts +1 -0
  34. package/dist/types/components/base/position-assets/constants.d.ts +5 -0
  35. package/dist/types/components/base/position-assets/index.d.ts +2 -0
  36. package/dist/types/components/base/position-assets/position-assets.d.ts +49 -0
  37. package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +7 -13
  38. package/dist/types/components/base/values/scalars.d.ts +4 -0
  39. package/dist/types/components/compound-apy/compound-apy.d.ts +2 -2
  40. package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +3 -3
  41. package/dist/types/utils/strategy-apy.d.ts +21 -18
  42. package/package.json +2 -2
@@ -0,0 +1,8 @@
1
+ class t {
2
+ static root = "position-assets-root";
3
+ static row = "position-assets-row";
4
+ static empty = "position-assets-empty";
5
+ }
6
+ export {
7
+ t as PositionAssetsTest
8
+ };
@@ -0,0 +1,6 @@
1
+ import { PositionAssetsTest as t } from "./constants.js";
2
+ import { PositionAssets as i } from "./position-assets.js";
3
+ export {
4
+ i as PositionAssets,
5
+ t as PositionAssetsTest
6
+ };
@@ -0,0 +1,73 @@
1
+ import { jsx as i, jsxs as p } from "react/jsx-runtime";
2
+ import { Stack as d } from "../stack/stack.js";
3
+ import "react";
4
+ import "@gearbox-protocol/sdk";
5
+ import "clsx";
6
+ import "tailwind-merge";
7
+ import "sonner";
8
+ import "@gearbox-protocol/sdk/common-utils";
9
+ import "luxon";
10
+ import "../../../utils/z-index.js";
11
+ import "../../points-icon/points-icon.js";
12
+ import { TokenBigint as c } from "../values/scalars.js";
13
+ import "../../badge/badge.js";
14
+ import "../../badge/chip.js";
15
+ import "react-intl";
16
+ import { TokenSymbol as f } from "../../token-symbol/token-symbol.js";
17
+ import { Typography as u } from "../../typography/typography.js";
18
+ import { PositionAssetsTest as m } from "./constants.js";
19
+ const k = 1;
20
+ function _({
21
+ assets: r,
22
+ against: e,
23
+ empty: s,
24
+ testId: n
25
+ }) {
26
+ const t = h(r, e);
27
+ return /* @__PURE__ */ i(d, { gap: "sm", align: "end", "data-testid": n ?? m.root, children: t.length === 0 ? s !== void 0 && /* @__PURE__ */ i(
28
+ u,
29
+ {
30
+ variant: "caption",
31
+ color: "secondary",
32
+ as: "div",
33
+ "data-testid": m.empty,
34
+ children: s
35
+ }
36
+ ) : t.map((o) => /* @__PURE__ */ p(
37
+ "span",
38
+ {
39
+ className: "flex items-center gap-2",
40
+ "data-testid": m.row,
41
+ children: [
42
+ /* @__PURE__ */ i(f, { size: 20, token: o.token }),
43
+ /* @__PURE__ */ i(c, { data: o.value, token: o.token })
44
+ ]
45
+ },
46
+ o.token.address
47
+ )) });
48
+ }
49
+ function h(r, e) {
50
+ const s = /* @__PURE__ */ new Map(), n = (t, o) => {
51
+ const l = t.token.address.toLowerCase(), a = s.get(l);
52
+ s.set(l, {
53
+ token: a?.token ?? t.token,
54
+ // a token the other side alone holds is a zero here, not a gap
55
+ value: o ? t.value : a?.value ?? 0n,
56
+ worth: v(a?.worth, t.valueUsd)
57
+ });
58
+ };
59
+ for (const t of r ?? []) n(t, !0);
60
+ for (const t of e ?? []) n(t, !1);
61
+ return [...s.values()].filter((t) => t.worth === null || t.worth >= k).sort(
62
+ (t, o) => (o.worth ?? 0) - (t.worth ?? 0) || // a tie has to break the same way on both sides, or the rows drift
63
+ t.token.address.localeCompare(o.token.address)
64
+ );
65
+ }
66
+ function v(r, e) {
67
+ return r === void 0 ? e : r === null || e === null ? null : Math.max(r, e);
68
+ }
69
+ export {
70
+ _ as PositionAssets,
71
+ m as PositionAssetsTest,
72
+ h as visibleAssets
73
+ };
@@ -1,194 +1,199 @@
1
- import { jsxs as u, jsx as l, Fragment as M } from "react/jsx-runtime";
2
- import { PointsIcon as $ } from "../../points-icon/points-icon.js";
3
- import { TokenIcon as q } from "../../token-icon/token-icon.js";
4
- import { FormattedMessageTyped as d } from "../../typed-intl/index.js";
1
+ import { jsxs as i, jsx as t, Fragment as B } from "react/jsx-runtime";
2
+ import { PointsIcon as I } from "../../points-icon/points-icon.js";
3
+ import { TokenIcon as P } from "../../token-icon/token-icon.js";
4
+ import { FormattedMessageTyped as p } from "../../typed-intl/index.js";
5
5
  import "react";
6
- import { positiveTokenRewardsOf as F, pointProgramsOf as T, totalApyOf as R } from "../../../utils/apy-breakdown.js";
6
+ import { positiveTokenRewardsOf as M, pointProgramsOf as L, totalApyOf as T } from "../../../utils/apy-breakdown.js";
7
7
  import "@gearbox-protocol/sdk";
8
- import { bpsToPercent as j } from "../../../utils/bps.js";
9
- import { cn as w } from "../../../utils/cn.js";
8
+ import { bpsToPercent as $ } from "../../../utils/bps.js";
9
+ import { cn as h } from "../../../utils/cn.js";
10
10
  import "sonner";
11
- import { formatLeverage as s } from "../../../utils/format-leverage.js";
12
- import { formatCompactPercent as S } from "../../../utils/format-money.js";
13
- import { strategyApyPartsAtLeverage as O } from "../../../utils/strategy-apy.js";
11
+ import { formatLeverage as a } from "../../../utils/format-leverage.js";
12
+ import { formatCompactPercent as F } from "../../../utils/format-money.js";
13
+ import { strategyApyPartsAtLeverage as j } from "../../../utils/strategy-apy.js";
14
14
  import "@gearbox-protocol/sdk/common-utils";
15
15
  import "luxon";
16
16
  import "../../../utils/z-index.js";
17
- import { StrategyApyBreakdownCardTest as h } from "./constants.js";
18
- const i = "—";
19
- function a(e) {
20
- const r = j(e);
21
- if (Math.abs(r) >= 1e3) {
22
- const p = S(Math.abs(r));
23
- return r < 0 ? `−${p}` : p;
17
+ import { StrategyApyBreakdownCardTest as w } from "./constants.js";
18
+ const u = "—";
19
+ function s(e) {
20
+ const n = $(e);
21
+ if (Math.abs(n) >= 1e3) {
22
+ const d = F(Math.abs(n));
23
+ return n < 0 ? `−${d}` : d;
24
24
  }
25
- const m = Math.abs(r).toFixed(2);
26
- return r < 0 ? `−${m}%` : `${m}%`;
25
+ const m = Math.abs(n).toFixed(2);
26
+ return n < 0 ? `−${m}%` : `${m}%`;
27
27
  }
28
- function z(e) {
28
+ function S(e) {
29
29
  return e == null || e <= 0 ? "bg-muted text-muted-foreground" : "bg-success/20 text-success";
30
30
  }
31
31
  function g({
32
32
  base: e,
33
- leverage: r
33
+ leverage: n
34
34
  }) {
35
- return /* @__PURE__ */ l(
36
- d,
35
+ return /* @__PURE__ */ t(
36
+ p,
37
37
  {
38
38
  messageId: "components.strategyApyBreakdownCard.formula",
39
- values: { base: e, leverage: r }
39
+ values: { base: e, leverage: n }
40
40
  }
41
41
  );
42
42
  }
43
- function oe({
43
+ function te({
44
44
  data: e,
45
- leverage: r
45
+ leverage: n
46
46
  }) {
47
- const t = r ?? (e.maxLeverage != null && e.maxLeverage > 0 ? e.maxLeverage : void 0), m = t != null ? s(t) : i, p = e.collateralApy ? F(e.collateralApy) : [], k = e.collateralApy ? T(e.collateralApy) : [], n = t != null ? O({
48
- leverage: t,
49
- maxLeverage: e.maxLeverage,
47
+ const o = n ?? (e.maxLeverage != null && e.maxLeverage > 0 ? e.maxLeverage : void 0), m = o != null ? a(o) : u, d = e.collateralApy ? M(e.collateralApy) : [], k = e.collateralApy ? L(e.collateralApy) : [], r = o != null ? j({
48
+ leverage: o,
50
49
  borrowApy: e.borrowApy,
51
- additionalBorrowApy: e.additionalBorrowApy
52
- }) : void 0, y = e.collateralApy?.organicApy, b = y != null && t != null ? y * t : void 0, f = p.map(
53
- (o) => o.supplyApr != null && t != null ? o.supplyApr * t : void 0
54
- ), N = e.borrowApy != null && n != null ? -n.borrowCost : void 0, L = e.additionalBorrowApy, x = L != null && L !== 0, B = x && n != null ? n.quotaRate : void 0, C = x && n != null ? -n.quotaCost : void 0, I = b != null && n != null && f.every((o) => o != null) ? b + f.reduce((o, c) => o + (c ?? 0), 0) - n.totalCost : void 0, P = t != null && e.maxLeverage != null && e.maxLeverage > 0 && Math.abs(t - e.maxLeverage) < 1e-9, A = e.netApy != null ? R(e.netApy) : P && e.maxLeverageApy != null ? R(e.maxLeverageApy) : I;
55
- return /* @__PURE__ */ u(
50
+ quotaRate: e.quotaRate,
51
+ liquidationThreshold: e.liquidationThreshold,
52
+ quotaMode: e.quotaMode
53
+ }) : void 0, f = e.collateralApy?.organicApy, y = f != null && o != null ? f * o : void 0, v = d.map(
54
+ (l) => l.supplyApr != null && o != null ? l.supplyApr * o : void 0
55
+ ), N = e.borrowApy != null && r != null ? -r.borrowCost : void 0, x = e.quotaRate != null && e.quotaRate !== 0, q = x && r != null ? r.quotaRate : void 0, R = x && r != null ? -r.quotaCost : void 0, C = y != null && r != null && v.every((l) => l != null) ? y + v.reduce((l, c) => l + (c ?? 0), 0) - r.totalCost : void 0, A = e.netApy != null ? T(e.netApy) : C;
56
+ return /* @__PURE__ */ i(
56
57
  "div",
57
58
  {
58
59
  className: "flex w-full min-w-0 flex-col gap-4 rounded-xl border border-border bg-card p-4",
59
- "data-testid": h.root,
60
+ "data-testid": w.root,
60
61
  children: [
61
- /* @__PURE__ */ u("div", { className: "flex h-6 items-center justify-between gap-3", children: [
62
- /* @__PURE__ */ l("span", { className: "text-base font-semibold leading-4 text-foreground", children: /* @__PURE__ */ l(
63
- d,
62
+ /* @__PURE__ */ i("div", { className: "flex h-6 items-center justify-between gap-3", children: [
63
+ /* @__PURE__ */ t("span", { className: "text-base font-semibold leading-4 text-foreground", children: /* @__PURE__ */ t(
64
+ p,
64
65
  {
65
66
  messageId: "components.strategyApyBreakdownCard.titleAtLeverage",
66
67
  values: { leverage: m }
67
68
  }
68
69
  ) }),
69
- /* @__PURE__ */ l(
70
+ /* @__PURE__ */ t(
70
71
  "span",
71
72
  {
72
- className: w(
73
+ className: h(
73
74
  "rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",
74
- z(A)
75
+ S(A)
75
76
  ),
76
- "data-testid": h.net,
77
- children: A == null ? i : a(A)
77
+ "data-testid": w.net,
78
+ children: A == null ? u : s(A)
78
79
  }
79
80
  )
80
81
  ] }),
81
- /* @__PURE__ */ u("div", { className: "flex flex-col gap-3", children: [
82
- /* @__PURE__ */ l(
83
- v,
82
+ /* @__PURE__ */ i("div", { className: "flex flex-col gap-3", children: [
83
+ /* @__PURE__ */ t(
84
+ b,
84
85
  {
85
- label: /* @__PURE__ */ l(d, { messageId: "components.strategyApyBreakdownCard.collateralApy" }),
86
- value: b == null ? i : a(b),
87
- subtext: y != null && t != null ? /* @__PURE__ */ l(
86
+ label: /* @__PURE__ */ t(p, { messageId: "components.strategyApyBreakdownCard.collateralApy" }),
87
+ value: y == null ? u : s(y),
88
+ subtext: f != null && o != null ? /* @__PURE__ */ t(
88
89
  g,
89
90
  {
90
- base: a(y),
91
- leverage: s(t)
91
+ base: s(f),
92
+ leverage: a(o)
92
93
  }
93
94
  ) : void 0
94
95
  }
95
96
  ),
96
- p.map((o, c) => /* @__PURE__ */ l(
97
- v,
97
+ d.map((l, c) => /* @__PURE__ */ t(
98
+ b,
98
99
  {
99
- label: /* @__PURE__ */ u("span", { className: "inline-flex items-center gap-1.5", children: [
100
- /* @__PURE__ */ l("span", { children: /* @__PURE__ */ l(
101
- d,
100
+ label: /* @__PURE__ */ i("span", { className: "inline-flex items-center gap-1.5", children: [
101
+ /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(
102
+ p,
102
103
  {
103
104
  messageId: "components.apyParts.extraAPY",
104
- values: { symbol: o.token.symbol }
105
+ values: { symbol: l.token.symbol }
105
106
  }
106
107
  ) }),
107
- /* @__PURE__ */ l(
108
- q,
108
+ /* @__PURE__ */ t(
109
+ P,
109
110
  {
110
- token: o.token,
111
- symbol: o.token.symbol,
111
+ token: l.token,
112
+ symbol: l.token.symbol,
112
113
  size: 16,
113
114
  className: "shrink-0"
114
115
  }
115
116
  )
116
117
  ] }),
117
- value: f[c] == null ? i : a(f[c]),
118
- subtext: o.supplyApr != null && t != null ? /* @__PURE__ */ l(
118
+ value: v[c] == null ? u : s(v[c]),
119
+ subtext: l.supplyApr != null && o != null ? /* @__PURE__ */ t(
119
120
  g,
120
121
  {
121
- base: a(o.supplyApr),
122
- leverage: s(t)
122
+ base: s(l.supplyApr),
123
+ leverage: a(o)
123
124
  }
124
125
  ) : void 0
125
126
  },
126
- `incentive-${o.token.address}-${o.supplyApr ?? 0}`
127
+ `incentive-${l.token.address}-${l.supplyApr ?? 0}`
127
128
  )),
128
- /* @__PURE__ */ l(
129
- v,
129
+ /* @__PURE__ */ t(
130
+ b,
130
131
  {
131
132
  muted: !0,
132
- label: /* @__PURE__ */ l(d, { messageId: "components.strategyApyBreakdownCard.borrowRate" }),
133
- value: N == null ? i : a(N),
134
- subtext: e.borrowApy != null && n != null ? /* @__PURE__ */ l(
133
+ label: /* @__PURE__ */ t(p, { messageId: "components.strategyApyBreakdownCard.borrowRate" }),
134
+ value: N == null ? u : s(N),
135
+ subtext: e.borrowApy != null && r != null ? /* @__PURE__ */ t(
135
136
  g,
136
137
  {
137
- base: a(-e.borrowApy),
138
- leverage: s(n.debtMultiplier)
138
+ base: s(-e.borrowApy),
139
+ leverage: a(r.debtMultiplier)
139
140
  }
140
141
  ) : void 0
141
142
  }
142
143
  ),
143
- x ? /* @__PURE__ */ l(
144
- v,
144
+ x ? /* @__PURE__ */ t(
145
+ b,
145
146
  {
146
147
  muted: !0,
147
- label: /* @__PURE__ */ l(d, { messageId: "components.strategyApyBreakdownCard.quotaRate" }),
148
- value: C == null ? i : a(C),
149
- subtext: B != null && t != null ? /* @__PURE__ */ l(
150
- g,
151
- {
152
- base: a(-B),
153
- leverage: s(t)
154
- }
148
+ label: /* @__PURE__ */ t(p, { messageId: "components.strategyApyBreakdownCard.quotaRate" }),
149
+ value: R == null ? u : s(R),
150
+ subtext: q != null && r != null ? (
151
+ // The quota is charged on the LT-weighted position, so this
152
+ // multiplier is not the leverage the row above uses.
153
+ /* @__PURE__ */ t(
154
+ g,
155
+ {
156
+ base: s(-q),
157
+ leverage: a(r.quotaMultiplier)
158
+ }
159
+ )
155
160
  ) : void 0
156
161
  }
157
162
  ) : null,
158
- k.length > 0 ? /* @__PURE__ */ u(M, { children: [
159
- /* @__PURE__ */ l("div", { className: "h-px w-full bg-divider" }),
160
- k.map((o) => {
161
- const c = o.multiplier != null && t != null ? o.multiplier * t : void 0;
162
- return /* @__PURE__ */ l(
163
- v,
163
+ k.length > 0 ? /* @__PURE__ */ i(B, { children: [
164
+ /* @__PURE__ */ t("div", { className: "h-px w-full bg-divider" }),
165
+ k.map((l) => {
166
+ const c = l.multiplier != null && o != null ? l.multiplier * o : void 0;
167
+ return /* @__PURE__ */ t(
168
+ b,
164
169
  {
165
- label: /* @__PURE__ */ u("span", { className: "inline-flex items-center gap-1.5", children: [
166
- /* @__PURE__ */ l("span", { children: /* @__PURE__ */ l(
167
- d,
170
+ label: /* @__PURE__ */ i("span", { className: "inline-flex items-center gap-1.5", children: [
171
+ /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(
172
+ p,
168
173
  {
169
174
  messageId: "components.yieldBreakdown.programPoints",
170
- values: { name: o.name }
175
+ values: { name: l.name }
171
176
  }
172
177
  ) }),
173
- /* @__PURE__ */ l(
174
- $,
178
+ /* @__PURE__ */ t(
179
+ I,
175
180
  {
176
- reward: { name: o.name, type: o.id },
181
+ reward: { name: l.name, type: l.id },
177
182
  size: 16,
178
183
  className: "shrink-0"
179
184
  }
180
185
  )
181
186
  ] }),
182
- value: c != null ? `${s(c)}×` : i,
183
- subtext: o.multiplier != null && t != null ? /* @__PURE__ */ l(
187
+ value: c != null ? `${a(c)}×` : u,
188
+ subtext: l.multiplier != null && o != null ? /* @__PURE__ */ t(
184
189
  g,
185
190
  {
186
- base: s(o.multiplier),
187
- leverage: s(t)
191
+ base: a(l.multiplier),
192
+ leverage: a(o)
188
193
  }
189
194
  ) : void 0
190
195
  },
191
- o.id
196
+ l.id
192
197
  );
193
198
  })
194
199
  ] }) : null
@@ -197,38 +202,38 @@ function oe({
197
202
  }
198
203
  );
199
204
  }
200
- function v({
205
+ function b({
201
206
  label: e,
202
- value: r,
203
- subtext: t,
207
+ value: n,
208
+ subtext: o,
204
209
  muted: m = !1
205
210
  }) {
206
- const p = m ? "text-muted-foreground" : "text-foreground";
207
- return /* @__PURE__ */ u(
211
+ const d = m ? "text-muted-foreground" : "text-foreground";
212
+ return /* @__PURE__ */ i(
208
213
  "div",
209
214
  {
210
215
  className: "flex items-start justify-between gap-3",
211
- "data-testid": h.row,
216
+ "data-testid": w.row,
212
217
  children: [
213
- /* @__PURE__ */ l("span", { className: w("min-w-0 text-sm font-semibold leading-5", p), children: e }),
214
- /* @__PURE__ */ u("span", { className: "flex shrink-0 flex-col items-end", children: [
215
- /* @__PURE__ */ l(
218
+ /* @__PURE__ */ t("span", { className: h("min-w-0 text-sm font-semibold leading-5", d), children: e }),
219
+ /* @__PURE__ */ i("span", { className: "flex shrink-0 flex-col items-end", children: [
220
+ /* @__PURE__ */ t(
216
221
  "span",
217
222
  {
218
- className: w(
223
+ className: h(
219
224
  "text-sm font-semibold leading-5 tabular-nums",
220
- r === i || m ? "text-muted-foreground" : "text-foreground"
225
+ n === u || m ? "text-muted-foreground" : "text-foreground"
221
226
  ),
222
- children: r
227
+ children: n
223
228
  }
224
229
  ),
225
- t != null ? /* @__PURE__ */ l("span", { className: "text-xs leading-4 text-muted-foreground", children: t }) : null
230
+ o != null ? /* @__PURE__ */ t("span", { className: "text-xs leading-4 text-muted-foreground", children: o }) : null
226
231
  ] })
227
232
  ]
228
233
  }
229
234
  );
230
235
  }
231
236
  export {
232
- oe as StrategyApyBreakdownCard,
233
- h as StrategyApyBreakdownCardTest
237
+ te as StrategyApyBreakdownCard,
238
+ w as StrategyApyBreakdownCardTest
234
239
  };
@@ -1,63 +1,82 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { CompoundAPY as s } from "../../compound-apy/compound-apy.js";
1
+ import { jsx as r, jsxs as s } from "react/jsx-runtime";
2
+ import { formatUnits as m } from "viem";
3
+ import { CompoundAPY as p } from "../../compound-apy/compound-apy.js";
4
+ import { SimpleTooltip as u } from "../../tooltip/simple-tooltip.js";
5
+ import "../../tooltip/tooltip.js";
3
6
  import "react";
4
7
  import "@gearbox-protocol/sdk";
5
8
  import { cn as a } from "../../../utils/cn.js";
6
9
  import "sonner";
7
- import { formatLeverage as c } from "../../../utils/format-leverage.js";
8
- import { formatPercentAmount as m, formatMoney as l } from "../../../utils/format-money.js";
10
+ import { formatAssetAmount as c } from "../../../utils/format-asset-amount.js";
11
+ import { formatLeverage as d } from "../../../utils/format-leverage.js";
12
+ import { formatPercentAmount as f, formatMoney as h } from "../../../utils/format-money.js";
9
13
  import "@gearbox-protocol/sdk/common-utils";
10
14
  import "luxon";
11
15
  import "../../../utils/z-index.js";
12
- import { ValueTest as r } from "./constants.js";
13
- const d = "—";
14
- function i() {
15
- return /* @__PURE__ */ e("span", { "data-testid": r.placeholder, children: d });
16
+ import { ValueTest as e } from "./constants.js";
17
+ const v = "—";
18
+ function n() {
19
+ return /* @__PURE__ */ r("span", { "data-testid": e.placeholder, children: v });
16
20
  }
17
- function o(t) {
18
- return `${m(t / 100, 2)}%`;
21
+ function l(t) {
22
+ return `${f(t / 100, 2)}%`;
19
23
  }
20
- function P({ data: t }) {
21
- return t === void 0 ? /* @__PURE__ */ e(i, {}) : typeof t == "number" ? /* @__PURE__ */ e("span", { "data-testid": r.apy, children: o(t) }) : /* @__PURE__ */ e("span", { "data-testid": r.apy, children: /* @__PURE__ */ e(s, { apy: t }) });
24
+ function E({ data: t }) {
25
+ return t === void 0 ? /* @__PURE__ */ r(n, {}) : typeof t == "number" ? /* @__PURE__ */ r("span", { "data-testid": e.apy, children: l(t) }) : /* @__PURE__ */ r("span", { "data-testid": e.apy, children: /* @__PURE__ */ r(p, { apy: t }) });
22
26
  }
23
- function $({
27
+ function H({
24
28
  data: t
25
29
  }) {
26
- return t == null ? /* @__PURE__ */ e(i, {}) : /* @__PURE__ */ e("span", { "data-testid": r.usd, children: l(t) });
30
+ return t == null ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.usd, children: h(t) });
27
31
  }
28
- function z({
32
+ function N({
29
33
  data: t
30
34
  }) {
31
- return t === void 0 ? /* @__PURE__ */ e(i, {}) : /* @__PURE__ */ e("span", { "data-testid": r.leverage, children: `${c(t)}x` });
35
+ return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.leverage, children: `${d(t)}x` });
32
36
  }
33
37
  function w({
34
38
  data: t
35
39
  }) {
36
- return t === void 0 ? /* @__PURE__ */ e(i, {}) : /* @__PURE__ */ e("span", { "data-testid": r.utilization, children: o(t) });
40
+ return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.utilization, children: l(t) });
37
41
  }
38
- function B({
42
+ function D({
39
43
  data: t
40
44
  }) {
41
45
  if (t === void 0)
42
- return /* @__PURE__ */ e(i, {});
43
- const n = t < 1e4 ? "text-destructive" : t < 11e3 ? "text-warning" : "text-success";
44
- return /* @__PURE__ */ e("span", { "data-testid": r.healthFactor, className: a(n), children: (t / 1e4).toFixed(2) });
46
+ return /* @__PURE__ */ r(n, {});
47
+ const i = t < 1e4 ? "text-destructive" : t < 11e3 ? "text-warning" : "text-success";
48
+ return /* @__PURE__ */ r("span", { "data-testid": e.healthFactor, className: a(i), children: (t / 1e4).toFixed(2) });
45
49
  }
46
- function C({
50
+ function M({
47
51
  data: t,
48
- token: n
52
+ token: i
49
53
  }) {
50
- if (t === void 0 || n === void 0)
51
- return /* @__PURE__ */ e(i, {});
52
- const u = Number(t) / 10 ** n.decimals;
53
- return /* @__PURE__ */ e("span", { "data-testid": r.tokenBigint, children: `${u.toLocaleString(void 0, { maximumFractionDigits: 6 })} ${n.symbol}` });
54
+ if (t === void 0 || i === void 0)
55
+ return /* @__PURE__ */ r(n, {});
56
+ const o = m(t, i.decimals);
57
+ return (
58
+ // `title` also keeps the amount where a hover tooltip cannot reach:
59
+ // keyboard, touch, and the browser's own find
60
+ /* @__PURE__ */ s("span", { "data-testid": e.tokenBigint, title: `${o} ${i.symbol}`, children: [
61
+ /* @__PURE__ */ r(
62
+ u,
63
+ {
64
+ placement: "top",
65
+ className: "break-all",
66
+ title: /* @__PURE__ */ r("span", { children: c(t, i.decimals) }),
67
+ children: /* @__PURE__ */ r("span", { children: o })
68
+ }
69
+ ),
70
+ ` ${i.symbol}`
71
+ ] })
72
+ );
54
73
  }
55
74
  export {
56
- P as ApyValue,
57
- B as HealthFactorValue,
58
- z as LeverageValue,
59
- C as TokenBigint,
60
- $ as UsdValue,
75
+ E as ApyValue,
76
+ D as HealthFactorValue,
77
+ N as LeverageValue,
78
+ M as TokenBigint,
79
+ H as UsdValue,
61
80
  w as UtilizationValue,
62
- o as bps
81
+ l as bps
63
82
  };
@@ -37,6 +37,7 @@ import "../simple-accordion/simple-accordion.js";
37
37
  import "../tip-card/tip-card.js";
38
38
  import "../typography/typography.js";
39
39
  import "../points-icon/points-icon.js";
40
+ import "viem";
40
41
  import "../vertical-indicator/vertical-indicator.js";
41
42
  import "../base/page-title/page-title.js";
42
43
  import "../detailed-page-title/detailed-page-title-copy-button.js";
@@ -72,7 +73,6 @@ import "../dialog/dialog-header.js";
72
73
  import "../dialog/dialog-title.js";
73
74
  import "../dialog/dialog-modal-container.js";
74
75
  import "../dialog/dialog-overlay.js";
75
- import "viem";
76
76
  import "../input/input.js";
77
77
  import { Label as k } from "../label/label.js";
78
78
  import "../simple-dropdown/simple-dropdown.js";
@@ -37,6 +37,7 @@ import "../../simple-accordion/simple-accordion.js";
37
37
  import "../../tip-card/tip-card.js";
38
38
  import "../../typography/typography.js";
39
39
  import "../../points-icon/points-icon.js";
40
+ import "viem";
40
41
  import "../../vertical-indicator/vertical-indicator.js";
41
42
  import "../../base/page-title/page-title.js";
42
43
  import "../../detailed-page-title/detailed-page-title-copy-button.js";
@@ -73,7 +74,6 @@ import "../../dialog/dialog-header.js";
73
74
  import "../../dialog/dialog-title.js";
74
75
  import "../../dialog/dialog-modal-container.js";
75
76
  import "../../dialog/dialog-overlay.js";
76
- import "viem";
77
77
  import "../../input/input.js";
78
78
  import "../../label/label.js";
79
79
  import "../../simple-dropdown/simple-dropdown.js";
@@ -69,7 +69,7 @@ function E({
69
69
  maxLeverage: p,
70
70
  collateralApy: r,
71
71
  borrowApy: d,
72
- additionalBorrowApy: a,
72
+ quotaRate: a,
73
73
  decimals: m = 2,
74
74
  className: o
75
75
  }) {
@@ -89,7 +89,7 @@ function E({
89
89
  maxLeverage: p,
90
90
  collateralApy: r,
91
91
  borrowApy: d,
92
- additionalBorrowApy: a,
92
+ quotaRate: a,
93
93
  className: o,
94
94
  children: s()
95
95
  }