@gearbox-protocol/ui-kit 4.0.0-next.20 → 4.0.0-next.22

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 (36) hide show
  1. package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -1
  2. package/dist/cjs/components/base/strategy-apy-breakdown-card/constants.cjs +1 -1
  3. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  4. package/dist/cjs/components/base/values/scalars.cjs +1 -1
  5. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
  6. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table.cjs +1 -1
  7. package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
  8. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
  9. package/dist/cjs/index.cjs +1 -1
  10. package/dist/cjs/locale/en.json.cjs +1 -1
  11. package/dist/cjs/utils/index.cjs +1 -1
  12. package/dist/esm/components/base/position-assets/position-assets.js +62 -39
  13. package/dist/esm/components/base/strategy-apy-breakdown-card/constants.js +7 -3
  14. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +140 -166
  15. package/dist/esm/components/base/values/scalars.js +40 -35
  16. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +60 -61
  17. package/dist/esm/components/composites/pool-assets-table/pool-assets-table.js +22 -24
  18. package/dist/esm/components/compound-apy/compound-apy.js +24 -23
  19. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +15 -15
  20. package/dist/esm/index.js +88 -91
  21. package/dist/esm/locale/en.json.js +3 -7
  22. package/dist/esm/utils/index.js +48 -51
  23. package/dist/globals.css +1 -1
  24. package/dist/types/components/base/position-assets/position-assets.d.ts +19 -13
  25. package/dist/types/components/base/strategy-apy-breakdown-card/constants.d.ts +5 -1
  26. package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +39 -14
  27. package/dist/types/components/base/values/scalars.d.ts +17 -2
  28. package/dist/types/components/composites/pool-assets-table/pool-assets-table-row.d.ts +1 -2
  29. package/dist/types/components/composites/pool-assets-table/pool-assets-table.d.ts +1 -2
  30. package/dist/types/components/compound-apy/compound-apy.d.ts +11 -1
  31. package/dist/types/locale/en.json.d.ts +1 -6
  32. package/dist/types/utils/index.d.ts +0 -1
  33. package/package.json +1 -1
  34. package/dist/cjs/utils/strategy-apy.cjs +0 -1
  35. package/dist/esm/utils/strategy-apy.js +0 -51
  36. package/dist/types/utils/strategy-apy.d.ts +0 -40
@@ -1,82 +1,87 @@
1
- import { jsx as r, jsxs as s } from "react/jsx-runtime";
2
- import { formatUnits as m } from "viem";
1
+ import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
+ import { formatUnits as u } from "viem";
3
3
  import { CompoundAPY as p } from "../../compound-apy/compound-apy.js";
4
- import { SimpleTooltip as u } from "../../tooltip/simple-tooltip.js";
4
+ import { SimpleTooltip as a } from "../../tooltip/simple-tooltip.js";
5
5
  import "../../tooltip/tooltip.js";
6
6
  import "react";
7
7
  import "@gearbox-protocol/sdk";
8
- import { cn as a } from "../../../utils/cn.js";
8
+ import { cn as c } from "../../../utils/cn.js";
9
9
  import "sonner";
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";
10
+ import { formatAssetAmount as d } from "../../../utils/format-asset-amount.js";
11
+ import { formatLeverage as f } from "../../../utils/format-leverage.js";
12
+ import { formatPercentAmount as h, formatMoney as v } from "../../../utils/format-money.js";
13
13
  import "@gearbox-protocol/sdk/common-utils";
14
14
  import "luxon";
15
15
  import "../../../utils/z-index.js";
16
- import { ValueTest as e } from "./constants.js";
17
- const v = "—";
16
+ import { ValueTest as i } from "./constants.js";
17
+ const x = "—";
18
18
  function n() {
19
- return /* @__PURE__ */ r("span", { "data-testid": e.placeholder, children: v });
19
+ return /* @__PURE__ */ r("span", { "data-testid": i.placeholder, children: x });
20
20
  }
21
21
  function l(t) {
22
- return `${f(t / 100, 2)}%`;
23
- }
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
+ return `${h(t / 100, 2)}%`;
26
23
  }
27
24
  function H({
28
- data: t
25
+ data: t,
26
+ tooltip: e = !0
29
27
  }) {
30
- return t == null ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.usd, children: h(t) });
28
+ return t === void 0 ? /* @__PURE__ */ r(n, {}) : typeof t == "number" ? /* @__PURE__ */ r("span", { "data-testid": i.apy, children: l(t) }) : /* @__PURE__ */ r("span", { "data-testid": i.apy, children: /* @__PURE__ */ r(p, { apy: t, tooltip: e }) });
31
29
  }
32
30
  function N({
33
31
  data: t
34
32
  }) {
35
- return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.leverage, children: `${d(t)}x` });
33
+ return t == null ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": i.usd, children: v(t) });
36
34
  }
37
35
  function w({
38
36
  data: t
39
37
  }) {
40
- return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.utilization, children: l(t) });
38
+ return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": i.leverage, children: `${f(t)}x` });
41
39
  }
42
40
  function D({
43
41
  data: t
42
+ }) {
43
+ return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": i.utilization, children: l(t) });
44
+ }
45
+ function M({
46
+ data: t
44
47
  }) {
45
48
  if (t === void 0)
46
49
  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) });
50
+ const e = t < 1e4 ? "text-destructive" : t < 11e3 ? "text-warning" : "text-success";
51
+ return /* @__PURE__ */ r("span", { "data-testid": i.healthFactor, className: c(e), children: (t / 1e4).toFixed(2) });
49
52
  }
50
- function M({
53
+ function O({
51
54
  data: t,
52
- token: i
55
+ token: e,
56
+ showSymbol: s = !0
53
57
  }) {
54
- if (t === void 0 || i === void 0)
58
+ if (t === void 0 || e === void 0)
55
59
  return /* @__PURE__ */ r(n, {});
56
- const o = m(t, i.decimals);
60
+ const o = u(t, e.decimals);
57
61
  return (
58
62
  // `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: [
63
+ // keyboard, touch, and the browser's own find — and keeps the symbol
64
+ // reachable there even when the row is the one printing it
65
+ /* @__PURE__ */ m("span", { "data-testid": i.tokenBigint, title: `${o} ${e.symbol}`, children: [
61
66
  /* @__PURE__ */ r(
62
- u,
67
+ a,
63
68
  {
64
69
  placement: "top",
65
70
  className: "break-all",
66
- title: /* @__PURE__ */ r("span", { children: c(t, i.decimals) }),
71
+ title: /* @__PURE__ */ r("span", { children: d(t, e.decimals) }),
67
72
  children: /* @__PURE__ */ r("span", { children: o })
68
73
  }
69
74
  ),
70
- ` ${i.symbol}`
75
+ s && ` ${e.symbol}`
71
76
  ] })
72
77
  );
73
78
  }
74
79
  export {
75
- E as ApyValue,
76
- D as HealthFactorValue,
77
- N as LeverageValue,
78
- M as TokenBigint,
79
- H as UsdValue,
80
- w as UtilizationValue,
80
+ H as ApyValue,
81
+ M as HealthFactorValue,
82
+ w as LeverageValue,
83
+ O as TokenBigint,
84
+ N as UsdValue,
85
+ D as UtilizationValue,
81
86
  l as bps
82
87
  };
@@ -1,148 +1,147 @@
1
- import { jsx as e, jsxs as s, Fragment as C } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as m, Fragment as N } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import "@gearbox-protocol/sdk";
4
4
  import "clsx";
5
5
  import "tailwind-merge";
6
6
  import "sonner";
7
- import { formatMoney as S } from "../../../utils/format-money.js";
7
+ import { formatMoney as y } from "../../../utils/format-money.js";
8
8
  import "@gearbox-protocol/sdk/common-utils";
9
9
  import "luxon";
10
10
  import "../../../utils/z-index.js";
11
11
  import "../../points-icon/points-icon.js";
12
- import { UtilizationValue as y } from "../../base/values/scalars.js";
12
+ import { UtilizationValue as C } from "../../base/values/scalars.js";
13
13
  import "../../badge/badge.js";
14
14
  import "../../badge/chip.js";
15
- import { FormattedMessageTyped as m } from "../../typed-intl/index.js";
16
- import { AllocationWheel as L } from "../../collateral-allocation-tooltip/allocation-wheel.js";
15
+ import { FormattedMessageTyped as a } from "../../typed-intl/index.js";
16
+ import { AllocationWheel as S } from "../../collateral-allocation-tooltip/allocation-wheel.js";
17
17
  import "@fortawesome/free-solid-svg-icons";
18
18
  import "../../icons/fa-icon.js";
19
19
  import "../../token-icon/token-icon.js";
20
20
  import "../../tooltip/simple-tooltip.js";
21
21
  import "../../tooltip/tooltip.js";
22
- import { NameCell as U } from "../../name-cell/name-cell.js";
23
- import { ShortString as x } from "../../short-string/short-string.js";
22
+ import { NameCell as L } from "../../name-cell/name-cell.js";
23
+ import { ShortString as b } from "../../short-string/short-string.js";
24
24
  import "react-intl";
25
25
  import "../../buttons/button/button.js";
26
- import { GridTableRow as k, GridTableCell as o } from "../../table/grid-table.js";
26
+ import { GridTableRow as U, GridTableCell as o } from "../../table/grid-table.js";
27
27
  import "../../skeleton/skeleton.js";
28
28
  import "../../table/table.js";
29
- import { TableLineSm as w, TableCellSm as a } from "../../table/table-sm.js";
30
- import { TokenSymbol as I } from "../../token-symbol/token-symbol.js";
31
- import { TokenTemplate as b } from "../../token-template/token-template.js";
32
- import { VerticalIndicator as P } from "../../vertical-indicator/vertical-indicator.js";
33
- import { PoolAssetsTableTest as n } from "./constants.js";
34
- function j(i, t) {
29
+ import { TableLineSm as k, TableCellSm as n } from "../../table/table-sm.js";
30
+ import { TokenSymbol as w } from "../../token-symbol/token-symbol.js";
31
+ import { TokenTemplate as v } from "../../token-template/token-template.js";
32
+ import { VerticalIndicator as I } from "../../vertical-indicator/vertical-indicator.js";
33
+ import { PoolAssetsTableTest as p } from "./constants.js";
34
+ function P(i, t) {
35
35
  if (t !== 0n)
36
36
  return Number(i * 10000n / t);
37
37
  }
38
- function B(i, t) {
38
+ function j(i, t) {
39
39
  return t <= 0n || i <= 0n ? 0 : Number(i * 10000n / t) / 1e4;
40
40
  }
41
- function he({
42
- poolName: i,
43
- asset: t,
44
- underlyingToken: p,
45
- last: T,
41
+ function ue({
42
+ asset: i,
43
+ underlyingToken: t,
44
+ last: x,
46
45
  isCompact: c,
47
- totalUsed: z,
48
- colorIndex: A
46
+ totalUsed: T,
47
+ colorIndex: z
49
48
  }) {
50
- const { token: d, limit: r, used: l } = t, N = c ? 40 : 21, u = B(l.value, z), h = () => /* @__PURE__ */ e(
51
- U,
49
+ const { token: r, limit: s, used: l } = i, A = c ? 40 : 21, d = j(l.value, T), u = () => /* @__PURE__ */ e(
50
+ L,
52
51
  {
53
- leading: /* @__PURE__ */ e(I, { size: 32, token: d }),
54
- title: /* @__PURE__ */ e(x, { maxLength: N, children: d.name }),
55
- subtitle: /* @__PURE__ */ e(x, { maxLength: 20, children: i })
52
+ leading: /* @__PURE__ */ e(w, { size: 32, token: r }),
53
+ title: /* @__PURE__ */ e(b, { maxLength: A, children: r.symbol }),
54
+ subtitle: /* @__PURE__ */ e(b, { maxLength: 20, children: r.name })
56
55
  }
57
- ), f = () => /* @__PURE__ */ s(
56
+ ), h = () => /* @__PURE__ */ m(
58
57
  "div",
59
58
  {
60
59
  className: "flex items-center justify-end gap-2",
61
- "data-testid": n.exposureCell,
60
+ "data-testid": p.exposureCell,
62
61
  children: [
63
62
  /* @__PURE__ */ e(
64
- L,
63
+ S,
65
64
  {
66
- share: u,
67
- colorIndex: A,
68
- idle: u === 0
65
+ share: d,
66
+ colorIndex: z,
67
+ idle: d === 0
69
68
  }
70
69
  ),
71
70
  /* @__PURE__ */ e(
72
- P,
71
+ I,
73
72
  {
74
73
  value: /* @__PURE__ */ e(
75
- b,
74
+ v,
76
75
  {
77
76
  decimalPartLength: 2,
78
77
  precision: 2,
79
78
  showSymbol: !1,
80
- token: p,
79
+ token: t,
81
80
  value: l.value
82
81
  }
83
82
  ),
84
- valueDescription: l.valueUsd === null ? "—" : S(l.valueUsd)
83
+ valueDescription: l.valueUsd === null ? "—" : y(l.valueUsd)
85
84
  }
86
85
  )
87
86
  ]
88
87
  }
89
- ), g = () => /* @__PURE__ */ e("div", { "data-testid": n.capCell, children: r.value === 0n ? /* @__PURE__ */ e("span", { children: "—" }) : /* @__PURE__ */ e(
90
- b,
88
+ ), f = () => /* @__PURE__ */ e("div", { "data-testid": p.capCell, children: s.value === 0n ? /* @__PURE__ */ e("span", { children: "—" }) : /* @__PURE__ */ e(
89
+ v,
91
90
  {
92
91
  decimalPartLength: 2,
93
92
  precision: 2,
94
93
  showSymbol: !1,
95
- token: p,
96
- value: r.value
94
+ token: t,
95
+ value: s.value
97
96
  }
98
- ) }), v = () => /* @__PURE__ */ e("div", { "data-testid": n.capUtilizationCell, children: /* @__PURE__ */ e(y, { data: j(l.value, r.value) }) });
97
+ ) }), g = () => /* @__PURE__ */ e("div", { "data-testid": p.capUtilizationCell, children: /* @__PURE__ */ e(C, { data: P(l.value, s.value) }) });
99
98
  return /* @__PURE__ */ e(
100
- k,
99
+ U,
101
100
  {
102
- last: T,
101
+ last: x,
103
102
  height: "auto",
104
103
  className: "cursor-default",
105
104
  style: { minHeight: "75px" },
106
- children: c ? /* @__PURE__ */ e(o, { className: "px-3 py-0!", size: "sm", span: "full", children: /* @__PURE__ */ s(
107
- w,
105
+ children: c ? /* @__PURE__ */ e(o, { className: "px-3 py-0!", size: "sm", span: "full", children: /* @__PURE__ */ m(
106
+ k,
108
107
  {
109
108
  className: "w-full",
110
109
  columns: 3,
111
110
  columnsXs: 3,
112
- title: h(),
111
+ title: u(),
113
112
  children: [
114
113
  /* @__PURE__ */ e(
115
- a,
114
+ n,
116
115
  {
117
- title: /* @__PURE__ */ e(m, { messageId: "components.poolAssetsTable.exposure" }),
118
- children: f()
116
+ title: /* @__PURE__ */ e(a, { messageId: "components.poolAssetsTable.exposure" }),
117
+ children: h()
119
118
  }
120
119
  ),
121
120
  /* @__PURE__ */ e(
122
- a,
121
+ n,
123
122
  {
124
- title: /* @__PURE__ */ e(m, { messageId: "components.poolAssetsTable.cap" }),
125
- children: g()
123
+ title: /* @__PURE__ */ e(a, { messageId: "components.poolAssetsTable.cap" }),
124
+ children: f()
126
125
  }
127
126
  ),
128
127
  /* @__PURE__ */ e(
129
- a,
128
+ n,
130
129
  {
131
- title: /* @__PURE__ */ e(m, { messageId: "components.poolAssetsTable.capUtilization" }),
132
- children: v()
130
+ title: /* @__PURE__ */ e(a, { messageId: "components.poolAssetsTable.capUtilization" }),
131
+ children: g()
133
132
  }
134
133
  )
135
134
  ]
136
135
  }
137
- ) }) : /* @__PURE__ */ s(C, { children: [
138
- /* @__PURE__ */ e(o, { className: "pl-4", size: "sm", textAlign: "left", children: h() }),
136
+ ) }) : /* @__PURE__ */ m(N, { children: [
137
+ /* @__PURE__ */ e(o, { className: "pl-4", size: "sm", textAlign: "left", children: u() }),
138
+ /* @__PURE__ */ e(o, { size: "sm", textAlign: "right", children: h() }),
139
139
  /* @__PURE__ */ e(o, { size: "sm", textAlign: "right", children: f() }),
140
- /* @__PURE__ */ e(o, { size: "sm", textAlign: "right", children: g() }),
141
- /* @__PURE__ */ e(o, { className: "pr-4", size: "sm", textAlign: "right", children: v() })
140
+ /* @__PURE__ */ e(o, { className: "pr-4", size: "sm", textAlign: "right", children: g() })
142
141
  ] })
143
142
  }
144
143
  );
145
144
  }
146
145
  export {
147
- he as PoolAssetsTableRow
146
+ ue as PoolAssetsTableRow
148
147
  };
@@ -1,5 +1,5 @@
1
- import { jsx as o, jsxs as c } from "react/jsx-runtime";
2
- import { Card as f } from "../../cards/card/card.js";
1
+ import { jsx as o, jsxs as n } from "react/jsx-runtime";
2
+ import { Card as c } from "../../cards/card/card.js";
3
3
  import "clsx";
4
4
  import "tailwind-merge";
5
5
  import "react";
@@ -12,41 +12,39 @@ import "luxon";
12
12
  import "../../../utils/z-index.js";
13
13
  import "react-intl";
14
14
  import "../../buttons/button/button.js";
15
- import { GridTable as b, GridTableHeader as T, GridTableBody as h } from "../../table/grid-table.js";
15
+ import { GridTable as f, GridTableHeader as b, GridTableBody as T } from "../../table/grid-table.js";
16
16
  import "../../skeleton/skeleton.js";
17
17
  import "../../table/table.js";
18
- import { useIsMobile as u } from "../../../hooks/use-media-query.js";
19
- import { useObservedWidthKey as x } from "../../../hooks/use-observed-width-key.js";
20
- import { PoolAssetsTableTest as v } from "./constants.js";
21
- import { PoolAssetsTableHead as w } from "./pool-assets-table-head.js";
22
- import { PoolAssetsTableRow as A } from "./pool-assets-table-row.js";
23
- const C = 680;
24
- function q({
18
+ import { useIsMobile as h } from "../../../hooks/use-media-query.js";
19
+ import { useObservedWidthKey as u } from "../../../hooks/use-observed-width-key.js";
20
+ import { PoolAssetsTableTest as x } from "./constants.js";
21
+ import { PoolAssetsTableHead as v } from "./pool-assets-table-head.js";
22
+ import { PoolAssetsTableRow as w } from "./pool-assets-table-row.js";
23
+ const A = 680;
24
+ function U({
25
25
  list: t,
26
- poolName: s,
27
- sort: p,
28
- underlyingToken: l
26
+ sort: s,
27
+ underlyingToken: p
29
28
  }) {
30
- const a = u(), { ref: d, widthKey: m } = x(), i = m > 0 ? m < C : a, n = t.reduce((r, e) => r + e.used.value, 0n);
31
- return /* @__PURE__ */ o(f, { ref: d, className: "overflow-hidden rounded-lg p-2", children: /* @__PURE__ */ c(
32
- b,
29
+ const l = h(), { ref: a, widthKey: m } = u(), i = m > 0 ? m < A : l, d = t.reduce((r, e) => r + e.used.value, 0n);
30
+ return /* @__PURE__ */ o(c, { ref: a, className: "overflow-hidden rounded-lg p-2", children: /* @__PURE__ */ n(
31
+ f,
33
32
  {
34
33
  cols: i ? "1fr" : "1fr max-content max-content minmax(0,1fr)",
35
- "data-testid": v.root,
34
+ "data-testid": x.root,
36
35
  gap: 0,
37
36
  size: "lg",
38
37
  wrapperClassName: "overflow-visible",
39
38
  children: [
40
- !i && /* @__PURE__ */ o(T, { children: /* @__PURE__ */ o(w, { sort: p }) }),
41
- /* @__PURE__ */ o(h, { children: t.map((r, e) => /* @__PURE__ */ o(
42
- A,
39
+ !i && /* @__PURE__ */ o(b, { children: /* @__PURE__ */ o(v, { sort: s }) }),
40
+ /* @__PURE__ */ o(T, { children: t.map((r, e) => /* @__PURE__ */ o(
41
+ w,
43
42
  {
44
43
  asset: r,
45
- poolName: s,
46
- underlyingToken: l,
44
+ underlyingToken: p,
47
45
  last: e === t.length - 1,
48
46
  isCompact: i,
49
- totalUsed: n,
47
+ totalUsed: d,
50
48
  colorIndex: e
51
49
  },
52
50
  r.token.address
@@ -56,5 +54,5 @@ function q({
56
54
  ) });
57
55
  }
58
56
  export {
59
- q as PoolAssetsTable
57
+ U as PoolAssetsTable
60
58
  };
@@ -1,19 +1,19 @@
1
- import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { useId as g } from "react";
3
- import { YieldBreakdownTooltip as w } from "../yield-breakdown-tooltip/yield-breakdown-tooltip.js";
4
- import { totalApyOf as x, positiveTokenRewardsOf as v, pointProgramsOf as C } from "../../utils/apy-breakdown.js";
1
+ import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
+ import { useId as w } from "react";
3
+ import { YieldBreakdownTooltip as x } from "../yield-breakdown-tooltip/yield-breakdown-tooltip.js";
4
+ import { totalApyOf as v, positiveTokenRewardsOf as C, pointProgramsOf as I } from "../../utils/apy-breakdown.js";
5
5
  import "@gearbox-protocol/sdk";
6
- import { bpsToPercent as I } from "../../utils/bps.js";
7
- import { cn as k } from "../../utils/cn.js";
6
+ import { bpsToPercent as k } from "../../utils/bps.js";
7
+ import { cn as P } from "../../utils/cn.js";
8
8
  import "sonner";
9
- import { formatCompactPercent as P } from "../../utils/format-money.js";
9
+ import { formatCompactPercent as A } from "../../utils/format-money.js";
10
10
  import "@gearbox-protocol/sdk/common-utils";
11
11
  import "luxon";
12
12
  import "../../utils/z-index.js";
13
13
  const l = 14;
14
- function A() {
15
- const t = `additional-incentives-${g().replace(/:/g, "")}`;
16
- return /* @__PURE__ */ n(
14
+ function O() {
15
+ const t = `additional-incentives-${w().replace(/:/g, "")}`;
16
+ return /* @__PURE__ */ r(
17
17
  "svg",
18
18
  {
19
19
  width: l,
@@ -42,7 +42,7 @@ function A() {
42
42
  strokeLinecap: "round"
43
43
  }
44
44
  ),
45
- /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ n(
45
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ r(
46
46
  "linearGradient",
47
47
  {
48
48
  id: t,
@@ -62,32 +62,33 @@ function A() {
62
62
  );
63
63
  }
64
64
  function c(t) {
65
- return t == null ? !1 : v(t).length > 0 || C(t).length > 0;
65
+ return t == null ? !1 : C(t).length > 0 || I(t).length > 0;
66
66
  }
67
- function E({
67
+ function U({
68
68
  apy: t,
69
69
  maxLeverage: p,
70
- collateralApy: r,
70
+ collateralApy: n,
71
71
  borrowApy: d,
72
72
  quotaRate: a,
73
73
  decimals: m = 2,
74
+ tooltip: f = !0,
74
75
  className: o
75
76
  }) {
76
77
  if (!t)
77
78
  return /* @__PURE__ */ e("span", { className: "text-secondary-foreground", children: "—" });
78
- const i = x(t), f = c(t) || c(r), h = i >= 1, s = () => {
79
- const u = P(I(i), m);
80
- return /* @__PURE__ */ n("div", { className: k("inline-flex items-center gap-1.5", o), children: [
81
- /* @__PURE__ */ e("span", { className: "inline-flex items-center", children: u }),
82
- f ? /* @__PURE__ */ e(A, {}) : null
79
+ const i = v(t), h = c(t) || c(n), u = f && i >= 1, s = () => {
80
+ const g = A(k(i), m);
81
+ return /* @__PURE__ */ r("div", { className: P("inline-flex items-center gap-1.5", o), children: [
82
+ /* @__PURE__ */ e("span", { className: "inline-flex items-center", children: g }),
83
+ h ? /* @__PURE__ */ e(O, {}) : null
83
84
  ] });
84
85
  };
85
- return h ? /* @__PURE__ */ e(
86
- w,
86
+ return u ? /* @__PURE__ */ e(
87
+ x,
87
88
  {
88
89
  supplyApy: t,
89
90
  maxLeverage: p,
90
- collateralApy: r,
91
+ collateralApy: n,
91
92
  borrowApy: d,
92
93
  quotaRate: a,
93
94
  className: o,
@@ -96,5 +97,5 @@ function E({
96
97
  ) : s();
97
98
  }
98
99
  export {
99
- E as CompoundAPY
100
+ U as CompoundAPY
100
101
  };
@@ -8,7 +8,7 @@ import "react";
8
8
  import { tokenRewardsOf as I, pointProgramsOf as B, totalApyOf as T } from "../../utils/apy-breakdown.js";
9
9
  import "@gearbox-protocol/sdk";
10
10
  import { bpsToPercent as $ } from "../../utils/bps.js";
11
- import { cn as p } from "../../utils/cn.js";
11
+ import { cn as c } from "../../utils/cn.js";
12
12
  import "sonner";
13
13
  import { formatLeverage as j } from "../../utils/format-leverage.js";
14
14
  import { formatCompactPercent as S } from "../../utils/format-money.js";
@@ -23,15 +23,15 @@ function V({
23
23
  supplyApy: n,
24
24
  maxLeverage: o,
25
25
  collateralApy: r,
26
- borrowApy: c,
27
- quotaRate: u,
26
+ borrowApy: u,
27
+ quotaRate: f,
28
28
  children: h,
29
- className: f
29
+ className: g
30
30
  }) {
31
- const g = o !== void 0 && o > 0, l = r ?? n, w = I(l), y = B(n), b = T(n), d = c != null || u != null ? -((c ?? 0) + (u ?? 0)) : void 0, x = y.filter((t) => t.multiplier != null), v = /* @__PURE__ */ a(
31
+ const d = o !== void 0 && o > 0, l = d ? r : r ?? n, w = l ? I(l) : [], y = B(n), b = T(n), p = u != null || f != null ? -((u ?? 0) + (f ?? 0)) : void 0, x = y.filter((t) => t.multiplier != null), v = /* @__PURE__ */ a(
32
32
  "div",
33
33
  {
34
- className: p(
34
+ className: c(
35
35
  "flex w-[400px] max-w-[calc(100vw-32px)] flex-col gap-4 p-4",
36
36
  "rounded-xl",
37
37
  "bg-card text-card-foreground",
@@ -41,7 +41,7 @@ function V({
41
41
  ),
42
42
  children: [
43
43
  /* @__PURE__ */ a("div", { className: "flex h-6 items-center justify-between gap-3", children: [
44
- /* @__PURE__ */ e("span", { className: "text-base font-semibold leading-4 text-foreground", children: g ? /* @__PURE__ */ e(
44
+ /* @__PURE__ */ e("span", { className: "text-base font-semibold leading-4 text-foreground", children: d ? /* @__PURE__ */ e(
45
45
  s,
46
46
  {
47
47
  messageId: "components.yieldBreakdown.titleNetAtLeverage",
@@ -53,7 +53,7 @@ function V({
53
53
  /* @__PURE__ */ e(
54
54
  "span",
55
55
  {
56
- className: p(
56
+ className: c(
57
57
  "rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",
58
58
  b > 0 ? "bg-success/20 text-success" : "bg-muted text-muted-foreground"
59
59
  ),
@@ -61,7 +61,7 @@ function V({
61
61
  }
62
62
  )
63
63
  ] }),
64
- l.organicApy != null && /* @__PURE__ */ e(
64
+ l?.organicApy != null && /* @__PURE__ */ e(
65
65
  m,
66
66
  {
67
67
  muted: l.organicApy < 0,
@@ -87,12 +87,12 @@ function V({
87
87
  },
88
88
  `incentive-${t.token.address}-${t.supplyApr}`
89
89
  )),
90
- g && d != null && /* @__PURE__ */ e(
90
+ d && p != null && /* @__PURE__ */ e(
91
91
  m,
92
92
  {
93
- muted: d < 0,
93
+ muted: p < 0,
94
94
  label: /* @__PURE__ */ e(s, { messageId: "components.yieldBreakdown.borrowRate" }),
95
- value: i(d)
95
+ value: i(p)
96
96
  }
97
97
  ),
98
98
  x.length > 0 && /* @__PURE__ */ a(k, { children: [
@@ -135,8 +135,8 @@ function V({
135
135
  type: "modal-tooltip",
136
136
  minWidth: "100%",
137
137
  maxWidth: "100%",
138
- title: /* @__PURE__ */ e("span", { className: f, children: h }),
139
- triggerClassName: f,
138
+ title: /* @__PURE__ */ e("span", { className: g, children: h }),
139
+ triggerClassName: g,
140
140
  children: v
141
141
  }
142
142
  );
@@ -151,7 +151,7 @@ function m({
151
151
  /* @__PURE__ */ e(
152
152
  "span",
153
153
  {
154
- className: p(
154
+ className: c(
155
155
  "shrink-0 font-semibold tabular-nums",
156
156
  r ? "text-muted-foreground" : "text-foreground"
157
157
  ),