@gearbox-protocol/ui-kit 3.8.1 → 3.9.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.
@@ -1,8 +1,8 @@
1
- import { jsx as i, jsxs as s } from "react/jsx-runtime";
1
+ import { jsx as i, jsxs as c } from "react/jsx-runtime";
2
2
  import { AssetsListCell as A } from "../../assets-list-cell/assets-list-cell.js";
3
- import { CompoundAPY as P } from "../../compound-apy/compound-apy.js";
3
+ import { CompoundAPY as C } from "../../compound-apy/compound-apy.js";
4
4
  import { Description as m } from "../../description/description.js";
5
- import { NetworkIcon as C } from "../../network-icon/network-icon.js";
5
+ import { NetworkIcon as P } from "../../network-icon/network-icon.js";
6
6
  import { PercentIndicator as x } from "../../percent-indicator/percent-indicator.js";
7
7
  import { PoolAPYTooltip as N } from "../../pool-apy-tooltip/pool-apy-tooltip.js";
8
8
  import { PoolIndicatorIcon as v } from "../../pool-indicator-icon/pool-indicator-icon.js";
@@ -13,54 +13,55 @@ import "@gearbox-protocol/sdk";
13
13
  import "clsx";
14
14
  import "tailwind-merge";
15
15
  import "sonner";
16
- import { percentageTemplate as I, formatMoney as p } from "../../../utils/format-money.js";
17
- import { tokenTemplate as f } from "../../../utils/templates.js";
16
+ import { percentageTemplate as I, formatMoney as f } from "../../../utils/format-money.js";
17
+ import { tokenTemplate as h } from "../../../utils/templates.js";
18
18
  import "luxon";
19
19
  import "../../../utils/z-index.js";
20
20
  import { TokenSymbol as Y } from "../../token-symbol/token-symbol.js";
21
- import { FormattedMessageTyped as h } from "../../typed-intl/index.js";
22
- function a(e, l, o) {
21
+ import { FormattedMessageTyped as g } from "../../typed-intl/index.js";
22
+ import { poolTableTestIds as z } from "../../../test-ids/pool-table.js";
23
+ function d(e, l, o) {
23
24
  const t = e?.header ?? /* @__PURE__ */ i(
24
- h,
25
+ g,
25
26
  {
26
27
  messageId: e?.headerMessageId ?? l
27
28
  }
28
29
  );
29
- let r;
30
+ let n;
30
31
  if (e?.headerTip !== null) {
31
- const n = e?.headerTipMessageId ?? o;
32
- r = e?.headerTip ?? (n && /* @__PURE__ */ i(h, { messageId: n }));
32
+ const r = e?.headerTipMessageId ?? o;
33
+ n = e?.headerTip ?? (r && /* @__PURE__ */ i(g, { messageId: r }));
33
34
  }
34
- return { header: t, headerTip: r, mobileTitle: e?.mobileTitle ?? t };
35
+ return { header: t, headerTip: n, mobileTitle: e?.mobileTitle ?? t };
35
36
  }
36
- function z({ ctx: e }) {
37
- const { pool: l, underlyingToken: o, points: t, apy: r, isMobile: n } = e, d = n ? 20 : 24, c = /* @__PURE__ */ i(Y, { token: o, size: d });
38
- return t && t.length > 0 && r ? /* @__PURE__ */ i(
37
+ function B({ ctx: e }) {
38
+ const { pool: l, underlyingToken: o, points: t, apy: n, isMobile: r } = e, a = r ? 20 : 24, s = /* @__PURE__ */ i(Y, { token: o, size: a });
39
+ return t && t.length > 0 && n ? /* @__PURE__ */ i(
39
40
  N,
40
41
  {
41
- totalAPY: r.totalAPY,
42
- baseAPY: r.baseAPY,
43
- extraAPY: r.extraAPY,
42
+ totalAPY: n.totalAPY,
43
+ baseAPY: n.baseAPY,
44
+ extraAPY: n.extraAPY,
44
45
  points: t,
45
46
  tokensList: e.tokensList,
46
- children: /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(v, { size: d, children: c }) })
47
+ children: /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(v, { size: a, children: s }) })
47
48
  }
48
- ) : l.hasPoints ? /* @__PURE__ */ i(D, { size: d, children: c }) : c;
49
+ ) : l.hasPoints ? /* @__PURE__ */ i(D, { size: a, children: s }) : s;
49
50
  }
50
- function B(e) {
51
+ function M(e) {
51
52
  const l = e.underlyingToken?.title ?? e.underlyingToken?.symbol ?? "", o = e.pool.version;
52
53
  return o && o >= 300 && o < 310 ? `${l} v${Math.floor(o / 100)}` : l;
53
54
  }
54
- function M({
55
+ function S({
55
56
  ctx: e,
56
57
  renderDescription: l,
57
58
  getPoolName: o
58
59
  }) {
59
- const { pool: t } = e, r = o ? o(e) : B(e);
60
- return /* @__PURE__ */ s("div", { className: "grid grid-cols-[auto_1fr] gap-x-3", children: [
61
- /* @__PURE__ */ s("div", { className: "flex items-center gap-3 shrink-0 leading-0", children: [
60
+ const { pool: t } = e, n = o ? o(e) : M(e);
61
+ return /* @__PURE__ */ c("div", { className: "grid grid-cols-[auto_1fr] gap-x-3", children: [
62
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-3 shrink-0 leading-0", children: [
62
63
  t.network && /* @__PURE__ */ i(
63
- C,
64
+ P,
64
65
  {
65
66
  network: t.network,
66
67
  isTest: !1,
@@ -68,59 +69,66 @@ function M({
68
69
  showTooltip: !0
69
70
  }
70
71
  ),
71
- /* @__PURE__ */ i(z, { ctx: e })
72
+ /* @__PURE__ */ i(B, { ctx: e })
72
73
  ] }),
73
- /* @__PURE__ */ s("div", { className: "flex md:flex-col min-w-0 overflow-hidden items-center md:items-start gap-2 md:gap-0", children: [
74
- /* @__PURE__ */ i("span", { className: "truncate max-w-full", children: r }),
74
+ /* @__PURE__ */ c("div", { className: "flex md:flex-col min-w-0 overflow-hidden items-center md:items-start gap-2 md:gap-0", children: [
75
+ /* @__PURE__ */ i("span", { className: "truncate max-w-full", children: n }),
75
76
  l && /* @__PURE__ */ i(m, { className: "min-w-0 text-xs", children: l(e) })
76
77
  ] })
77
78
  ] });
78
79
  }
79
- function S({ ctx: e }) {
80
+ function F({ ctx: e }) {
80
81
  const { pool: l, underlyingToken: o, loading: t } = e;
81
- return /* @__PURE__ */ s("div", { className: "flex flex-col items-start md:items-end", children: [
82
- /* @__PURE__ */ i(u, { loading: !!t, width: 60, children: p(l.expectedLiquidityInUSD ?? 0) }),
83
- /* @__PURE__ */ i(m, { children: f(
82
+ return /* @__PURE__ */ c("div", { className: "flex flex-col items-start md:items-end", children: [
83
+ /* @__PURE__ */ i(u, { loading: !!t, width: 60, children: f(l.expectedLiquidityInUSD ?? 0) }),
84
+ /* @__PURE__ */ i(m, { children: h(
84
85
  l.expectedLiquidity,
85
86
  o
86
87
  ) })
87
88
  ] });
88
89
  }
89
- function F({ ctx: e }) {
90
+ function L({ ctx: e }) {
90
91
  const { pool: l, underlyingToken: o, loading: t } = e;
91
- return /* @__PURE__ */ s("div", { className: "flex flex-col items-start md:items-end", children: [
92
- /* @__PURE__ */ i(u, { loading: !!t, width: 60, children: p(l.totalBorrowedInUSD ?? 0) }),
93
- /* @__PURE__ */ i(m, { children: f(
92
+ return /* @__PURE__ */ c("div", { className: "flex flex-col items-start md:items-end", children: [
93
+ /* @__PURE__ */ i(u, { loading: !!t, width: 60, children: f(l.totalBorrowedInUSD ?? 0) }),
94
+ /* @__PURE__ */ i(m, { children: h(
94
95
  l.totalBorrowed,
95
96
  o
96
97
  ) })
97
98
  ] });
98
99
  }
99
- function L({ ctx: e }) {
100
- const { pool: l, loading: o, underlyingToken: t } = e, r = t?.decimals ?? 18, n = l.poolTokenSymbol != null ? {
100
+ function j({ ctx: e }) {
101
+ const { pool: l, loading: o, underlyingToken: t } = e, n = t?.decimals ?? 18, r = l.poolTokenSymbol != null ? {
101
102
  title: l.poolTokenSymbol,
102
- decimals: r
103
+ decimals: n
103
104
  } : t;
104
- return /* @__PURE__ */ s("div", { className: "flex flex-col items-start md:items-end", children: [
105
- /* @__PURE__ */ i(u, { loading: !!o, width: 60, children: p(l.userBalanceInUSD ?? 0) }),
106
- l.userBalance !== void 0 && n && /* @__PURE__ */ i(m, { children: f(l.userBalance, n) })
107
- ] });
105
+ return /* @__PURE__ */ c(
106
+ "div",
107
+ {
108
+ className: "flex flex-col items-start md:items-end",
109
+ "data-testid": z.poolLineCellBalance,
110
+ children: [
111
+ /* @__PURE__ */ i(u, { loading: !!o, width: 60, children: f(l.userBalanceInUSD ?? 0) }),
112
+ l.userBalance !== void 0 && r && /* @__PURE__ */ i(m, { children: h(l.userBalance, r) })
113
+ ]
114
+ }
115
+ );
108
116
  }
109
- function j(e, l) {
110
- const o = e.pool.collateralTokens, { tokensList: t, isMobile: r } = e;
111
- return !o?.length || !t ? null : /* @__PURE__ */ i(
117
+ function O(e, l, o) {
118
+ const t = e.pool.collateralTokens, { tokensList: n, isMobile: r } = e, { mode: a = "cascade", ...s } = o ?? {};
119
+ return !t?.length || !n ? null : /* @__PURE__ */ i(
112
120
  A,
113
121
  {
114
122
  maxAssets: l,
115
- tokensList: t,
116
- balances: o.map((n) => ({ token: n })),
123
+ tokensList: n,
124
+ balances: t.map((p) => ({ token: p })),
117
125
  iconSize: r ? 20 : 24,
118
- options: { mode: "cascade" }
126
+ options: { mode: a, ...s }
119
127
  }
120
128
  );
121
129
  }
122
- function re(e) {
123
- const { header: l, mobileTitle: o } = a(
130
+ function ae(e) {
131
+ const { header: l, mobileTitle: o } = d(
124
132
  e,
125
133
  "components.poolTable.pool"
126
134
  );
@@ -131,7 +139,7 @@ function re(e) {
131
139
  align: "left",
132
140
  className: "pl-4",
133
141
  cell: (t) => /* @__PURE__ */ i(
134
- M,
142
+ S,
135
143
  {
136
144
  ctx: t,
137
145
  renderDescription: e?.renderDescription,
@@ -141,8 +149,8 @@ function re(e) {
141
149
  mobileTitle: o
142
150
  };
143
151
  }
144
- function ne(e) {
145
- const { header: l, mobileTitle: o } = a(
152
+ function de(e) {
153
+ const { header: l, mobileTitle: o } = d(
146
154
  e,
147
155
  "components.poolTable.supply"
148
156
  );
@@ -153,12 +161,12 @@ function ne(e) {
153
161
  align: "right",
154
162
  hideOnMedium: e?.hideOnMedium,
155
163
  sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "supply", defaultDirection: "desc" },
156
- cell: (t) => /* @__PURE__ */ i(S, { ctx: t }),
164
+ cell: (t) => /* @__PURE__ */ i(F, { ctx: t }),
157
165
  mobileTitle: o
158
166
  };
159
167
  }
160
- function ae(e) {
161
- const { header: l, headerTip: o, mobileTitle: t } = a(
168
+ function se(e) {
169
+ const { header: l, headerTip: o, mobileTitle: t } = d(
162
170
  e,
163
171
  "components.poolTable.supplyApy",
164
172
  "components.poolTable.supplyApy.tip"
@@ -170,24 +178,24 @@ function ae(e) {
170
178
  width: e?.width ?? "1.25fr",
171
179
  align: "right",
172
180
  sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "apy", defaultDirection: "desc" },
173
- cell: (r) => {
174
- const { apy: n, loading: d, points: c, tokensList: g } = r, {
175
- totalAPY: b = 0,
176
- baseAPY: T = [],
181
+ cell: (n) => {
182
+ const { apy: r, loading: a, points: s, tokensList: p } = n, {
183
+ totalAPY: T = 0,
184
+ baseAPY: b = [],
177
185
  extraAPY: w = [],
178
186
  externalAPY: y,
179
187
  apy7DAgo: k
180
- } = n ?? {};
181
- return /* @__PURE__ */ i(u, { width: 60, loading: !!d, children: /* @__PURE__ */ i(
182
- P,
188
+ } = r ?? {};
189
+ return /* @__PURE__ */ i(u, { width: 60, loading: !!a, children: /* @__PURE__ */ i(
190
+ C,
183
191
  {
184
- totalAPY: b,
185
- totalAPYLoading: !!d,
186
- baseAPY: T,
192
+ totalAPY: T,
193
+ totalAPYLoading: !!a,
194
+ baseAPY: b,
187
195
  extraAPY: w,
188
- points: c,
196
+ points: s,
189
197
  apy7DAgo: k,
190
- tokensList: g,
198
+ tokensList: p,
191
199
  externalAPY: y
192
200
  }
193
201
  ) });
@@ -195,8 +203,8 @@ function ae(e) {
195
203
  mobileTitle: t
196
204
  };
197
205
  }
198
- function de(e) {
199
- const { header: l, mobileTitle: o } = a(
206
+ function ce(e) {
207
+ const { header: l, mobileTitle: o } = d(
200
208
  e,
201
209
  "components.poolTable.borrowed"
202
210
  );
@@ -205,12 +213,12 @@ function de(e) {
205
213
  header: l,
206
214
  width: e?.width ?? "1.15fr",
207
215
  align: "right",
208
- cell: (t) => /* @__PURE__ */ i(F, { ctx: t }),
216
+ cell: (t) => /* @__PURE__ */ i(L, { ctx: t }),
209
217
  mobileTitle: o
210
218
  };
211
219
  }
212
- function se(e) {
213
- const { header: l, headerTip: o, mobileTitle: t } = a(
220
+ function me(e) {
221
+ const { header: l, headerTip: o, mobileTitle: t } = d(
214
222
  e,
215
223
  "components.poolTable.borrowApy"
216
224
  );
@@ -220,15 +228,15 @@ function se(e) {
220
228
  headerTip: o,
221
229
  width: e?.width ?? "150px",
222
230
  align: "right",
223
- cell: (r) => {
224
- const n = r.pool.borrowAPY ?? e?.getBorrowRate?.(r.pool) ?? 0;
225
- return /* @__PURE__ */ i("div", { className: "flex justify-start md:justify-end", children: I(n) });
231
+ cell: (n) => {
232
+ const r = n.pool.borrowAPY ?? e?.getBorrowRate?.(n.pool) ?? 0;
233
+ return /* @__PURE__ */ i("div", { className: "flex justify-start md:justify-end", children: I(r) });
226
234
  },
227
235
  mobileTitle: t
228
236
  };
229
237
  }
230
- function ce(e) {
231
- const { header: l, mobileTitle: o } = a(
238
+ function ue(e) {
239
+ const { header: l, mobileTitle: o } = d(
232
240
  e,
233
241
  "components.poolTable.utilization"
234
242
  );
@@ -240,14 +248,14 @@ function ce(e) {
240
248
  className: "pr-4",
241
249
  sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "utilization", defaultDirection: "desc" },
242
250
  cell: (t) => {
243
- const r = t.pool.utilization ?? 0;
244
- return /* @__PURE__ */ i("div", { className: "flex justify-start md:justify-end", children: /* @__PURE__ */ i(x, { percent: r }) });
251
+ const n = t.pool.utilization ?? 0;
252
+ return /* @__PURE__ */ i("div", { className: "flex justify-start md:justify-end", children: /* @__PURE__ */ i(x, { percent: n }) });
245
253
  },
246
254
  mobileTitle: o
247
255
  };
248
256
  }
249
- function me(e) {
250
- const l = e?.maxAssets ?? 5, o = (n) => j(n, l), { header: t, mobileTitle: r } = a(
257
+ function pe(e) {
258
+ const l = e?.maxAssets ?? 5, o = (r) => O(r, l, e?.options), { header: t, mobileTitle: n } = d(
251
259
  e,
252
260
  "components.poolTable.collateral"
253
261
  );
@@ -259,11 +267,11 @@ function me(e) {
259
267
  gapBefore: e?.gapBefore ?? "md",
260
268
  cell: e?.cell ?? o,
261
269
  mobileCell: e?.mobileCell ?? e?.cell ?? o,
262
- mobileTitle: r
270
+ mobileTitle: n
263
271
  };
264
272
  }
265
- function ue(e) {
266
- const { header: l, mobileTitle: o } = a(
273
+ function fe(e) {
274
+ const { header: l, mobileTitle: o } = d(
267
275
  e,
268
276
  "components.poolTable.balance"
269
277
  );
@@ -275,21 +283,21 @@ function ue(e) {
275
283
  className: e?.className ?? "pr-4",
276
284
  headerClassName: e?.headerClassName ?? "pr-4",
277
285
  sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "balance", defaultDirection: "desc" },
278
- cell: e?.cell ?? ((t) => /* @__PURE__ */ i(L, { ctx: t })),
286
+ cell: e?.cell ?? ((t) => /* @__PURE__ */ i(j, { ctx: t })),
279
287
  mobileTitle: o
280
288
  };
281
289
  }
282
- function pe(e) {
290
+ function he(e) {
283
291
  return e;
284
292
  }
285
293
  export {
286
- ue as balanceColumn,
287
- se as borrowApyColumn,
288
- de as borrowedColumn,
289
- me as collateralColumn,
290
- pe as customColumn,
291
- re as poolColumn,
292
- ae as supplyApyColumn,
293
- ne as supplyColumn,
294
- ce as utilizationColumn
294
+ fe as balanceColumn,
295
+ me as borrowApyColumn,
296
+ ce as borrowedColumn,
297
+ pe as collateralColumn,
298
+ he as customColumn,
299
+ ae as poolColumn,
300
+ se as supplyApyColumn,
301
+ de as supplyColumn,
302
+ ue as utilizationColumn
295
303
  };