@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.
- package/dist/cjs/components/composites/pool-table/columns.cjs +1 -1
- package/dist/cjs/components/composites/pool-table/pool-table.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/test-ids/index.cjs +1 -1
- package/dist/cjs/test-ids/pool-table.cjs +1 -0
- package/dist/esm/components/composites/pool-table/columns.js +106 -98
- package/dist/esm/components/composites/pool-table/pool-table.js +115 -99
- package/dist/esm/index.js +276 -274
- package/dist/esm/test-ids/index.js +7 -5
- package/dist/esm/test-ids/pool-table.js +9 -0
- package/dist/types/components/composites/pool-table/columns.d.ts +2 -0
- package/dist/types/components/composites/pool-table/pool-table.d.ts +1 -1
- package/dist/types/components/composites/pool-table/types.d.ts +4 -0
- package/dist/types/test-ids/index.d.ts +1 -0
- package/dist/types/test-ids/pool-table.d.ts +10 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
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
|
|
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
|
|
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
|
|
17
|
-
import { tokenTemplate as
|
|
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
|
|
22
|
-
|
|
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
|
-
|
|
25
|
+
g,
|
|
25
26
|
{
|
|
26
27
|
messageId: e?.headerMessageId ?? l
|
|
27
28
|
}
|
|
28
29
|
);
|
|
29
|
-
let
|
|
30
|
+
let n;
|
|
30
31
|
if (e?.headerTip !== null) {
|
|
31
|
-
const
|
|
32
|
-
|
|
32
|
+
const r = e?.headerTipMessageId ?? o;
|
|
33
|
+
n = e?.headerTip ?? (r && /* @__PURE__ */ i(g, { messageId: r }));
|
|
33
34
|
}
|
|
34
|
-
return { header: t, headerTip:
|
|
35
|
+
return { header: t, headerTip: n, mobileTitle: e?.mobileTitle ?? t };
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
-
const { pool: l, underlyingToken: o, points: t, apy:
|
|
38
|
-
return t && t.length > 0 &&
|
|
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:
|
|
42
|
-
baseAPY:
|
|
43
|
-
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:
|
|
47
|
+
children: /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(v, { size: a, children: s }) })
|
|
47
48
|
}
|
|
48
|
-
) : l.hasPoints ? /* @__PURE__ */ i(D, { size:
|
|
49
|
+
) : l.hasPoints ? /* @__PURE__ */ i(D, { size: a, children: s }) : s;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
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
|
|
55
|
+
function S({
|
|
55
56
|
ctx: e,
|
|
56
57
|
renderDescription: l,
|
|
57
58
|
getPoolName: o
|
|
58
59
|
}) {
|
|
59
|
-
const { pool: t } = e,
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
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(
|
|
72
|
+
/* @__PURE__ */ i(B, { ctx: e })
|
|
72
73
|
] }),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */ i("span", { className: "truncate max-w-full", children:
|
|
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
|
|
80
|
+
function F({ ctx: e }) {
|
|
80
81
|
const { pool: l, underlyingToken: o, loading: t } = e;
|
|
81
|
-
return /* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */ i(u, { loading: !!t, width: 60, children:
|
|
83
|
-
/* @__PURE__ */ i(m, { children:
|
|
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
|
|
90
|
+
function L({ ctx: e }) {
|
|
90
91
|
const { pool: l, underlyingToken: o, loading: t } = e;
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */ i(u, { loading: !!t, width: 60, children:
|
|
93
|
-
/* @__PURE__ */ i(m, { children:
|
|
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
|
|
100
|
-
const { pool: l, loading: o, underlyingToken: t } = e,
|
|
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:
|
|
103
|
+
decimals: n
|
|
103
104
|
} : t;
|
|
104
|
-
return /* @__PURE__ */
|
|
105
|
-
|
|
106
|
-
|
|
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
|
|
110
|
-
const
|
|
111
|
-
return !
|
|
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:
|
|
116
|
-
balances:
|
|
123
|
+
tokensList: n,
|
|
124
|
+
balances: t.map((p) => ({ token: p })),
|
|
117
125
|
iconSize: r ? 20 : 24,
|
|
118
|
-
options: { mode:
|
|
126
|
+
options: { mode: a, ...s }
|
|
119
127
|
}
|
|
120
128
|
);
|
|
121
129
|
}
|
|
122
|
-
function
|
|
123
|
-
const { header: l, mobileTitle: o } =
|
|
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
|
-
|
|
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
|
|
145
|
-
const { header: l, mobileTitle: o } =
|
|
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(
|
|
164
|
+
cell: (t) => /* @__PURE__ */ i(F, { ctx: t }),
|
|
157
165
|
mobileTitle: o
|
|
158
166
|
};
|
|
159
167
|
}
|
|
160
|
-
function
|
|
161
|
-
const { header: l, headerTip: o, mobileTitle: t } =
|
|
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: (
|
|
174
|
-
const { apy:
|
|
175
|
-
totalAPY:
|
|
176
|
-
baseAPY:
|
|
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
|
-
} =
|
|
181
|
-
return /* @__PURE__ */ i(u, { width: 60, loading: !!
|
|
182
|
-
|
|
188
|
+
} = r ?? {};
|
|
189
|
+
return /* @__PURE__ */ i(u, { width: 60, loading: !!a, children: /* @__PURE__ */ i(
|
|
190
|
+
C,
|
|
183
191
|
{
|
|
184
|
-
totalAPY:
|
|
185
|
-
totalAPYLoading: !!
|
|
186
|
-
baseAPY:
|
|
192
|
+
totalAPY: T,
|
|
193
|
+
totalAPYLoading: !!a,
|
|
194
|
+
baseAPY: b,
|
|
187
195
|
extraAPY: w,
|
|
188
|
-
points:
|
|
196
|
+
points: s,
|
|
189
197
|
apy7DAgo: k,
|
|
190
|
-
tokensList:
|
|
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
|
|
199
|
-
const { header: l, mobileTitle: o } =
|
|
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(
|
|
216
|
+
cell: (t) => /* @__PURE__ */ i(L, { ctx: t }),
|
|
209
217
|
mobileTitle: o
|
|
210
218
|
};
|
|
211
219
|
}
|
|
212
|
-
function
|
|
213
|
-
const { header: l, headerTip: o, mobileTitle: t } =
|
|
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: (
|
|
224
|
-
const
|
|
225
|
-
return /* @__PURE__ */ i("div", { className: "flex justify-start md:justify-end", children: I(
|
|
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
|
|
231
|
-
const { header: l, mobileTitle: o } =
|
|
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
|
|
244
|
-
return /* @__PURE__ */ i("div", { className: "flex justify-start md:justify-end", children: /* @__PURE__ */ i(x, { percent:
|
|
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
|
|
250
|
-
const l = e?.maxAssets ?? 5, o = (
|
|
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:
|
|
270
|
+
mobileTitle: n
|
|
263
271
|
};
|
|
264
272
|
}
|
|
265
|
-
function
|
|
266
|
-
const { header: l, mobileTitle: o } =
|
|
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(
|
|
286
|
+
cell: e?.cell ?? ((t) => /* @__PURE__ */ i(j, { ctx: t })),
|
|
279
287
|
mobileTitle: o
|
|
280
288
|
};
|
|
281
289
|
}
|
|
282
|
-
function
|
|
290
|
+
function he(e) {
|
|
283
291
|
return e;
|
|
284
292
|
}
|
|
285
293
|
export {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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
|
};
|