@gearbox-protocol/ui-kit 3.4.0 → 3.5.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/assets-list-cell/assets-list-cell.cjs +1 -1
- package/dist/cjs/components/block-sync/block-sync.cjs +1 -1
- package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
- package/dist/cjs/components/complex-input/complex-input.cjs +1 -1
- package/dist/cjs/components/composites/index.cjs +1 -0
- package/dist/cjs/components/composites/pool-table/columns.cjs +1 -0
- package/dist/cjs/components/composites/pool-table/index.cjs +1 -0
- package/dist/cjs/components/composites/pool-table/pool-table-backend-contract.types.cjs +1 -0
- package/dist/cjs/components/composites/pool-table/pool-table.cjs +1 -0
- package/dist/cjs/components/composites/pool-table/types.cjs +1 -0
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/detailed-page-title/detailed-page-title.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/markdown-viewer/markdown-viewer.cjs +1 -1
- package/dist/cjs/components/pool-apy-tooltip/pool-apy-tooltip.cjs +1 -1
- package/dist/cjs/components/time-to-liquidation/time-to-liquidation.cjs +1 -1
- package/dist/cjs/components/tokens-list-cell/tokens-list-cell.cjs +1 -1
- package/dist/cjs/components/tooltip/simple-tooltip.cjs +1 -1
- package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/assets-list-cell/assets-list-cell.js +7 -7
- package/dist/esm/components/block-sync/block-sync.js +7 -7
- package/dist/esm/components/checkbox/checkbox-labeled.js +7 -7
- package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +7 -7
- package/dist/esm/components/complex-input/complex-input.js +7 -7
- package/dist/esm/components/composites/index.js +14 -0
- package/dist/esm/components/composites/pool-table/columns.js +248 -0
- package/dist/esm/components/composites/pool-table/index.js +14 -0
- package/dist/esm/components/composites/pool-table/pool-table-backend-contract.types.js +1 -0
- package/dist/esm/components/composites/pool-table/pool-table.js +190 -0
- package/dist/esm/components/composites/pool-table/types.js +1 -0
- package/dist/esm/components/compound-apy/compound-apy.js +41 -41
- package/dist/esm/components/detailed-page-title/detailed-page-title.js +12 -12
- package/dist/esm/components/index.js +644 -632
- package/dist/esm/components/markdown-viewer/markdown-viewer.js +7 -7
- package/dist/esm/components/pool-apy-tooltip/pool-apy-tooltip.js +11 -11
- package/dist/esm/components/time-to-liquidation/time-to-liquidation.js +7 -7
- package/dist/esm/components/tokens-list-cell/tokens-list-cell.js +7 -7
- package/dist/esm/components/tooltip/simple-tooltip.js +64 -60
- package/dist/esm/components/with-copy/with-copy.js +7 -7
- package/dist/esm/index.js +748 -736
- package/dist/globals.css +1 -1
- package/dist/types/components/composites/index.d.ts +1 -0
- package/dist/types/components/composites/pool-table/columns.d.ts +98 -0
- package/dist/types/components/composites/pool-table/index.d.ts +3 -0
- package/dist/types/components/composites/pool-table/pool-table-backend-contract.types.d.ts +160 -0
- package/dist/types/components/composites/pool-table/pool-table.d.ts +32 -0
- package/dist/types/components/composites/pool-table/types.d.ts +127 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { AssetsListCell as w } from "../../assets-list-cell/assets-list-cell.js";
|
|
3
|
+
import { CompoundAPY as y } from "../../compound-apy/compound-apy.js";
|
|
4
|
+
import { Description as s } from "../../description/description.js";
|
|
5
|
+
import { NetworkIcon as P } from "../../network-icon/network-icon.js";
|
|
6
|
+
import { PercentIndicator as b } from "../../percent-indicator/percent-indicator.js";
|
|
7
|
+
import { PoolAPYTooltip as T } from "../../pool-apy-tooltip/pool-apy-tooltip.js";
|
|
8
|
+
import { PoolIndicatorIcon as k } from "../../pool-indicator-icon/pool-indicator-icon.js";
|
|
9
|
+
import { PoolPointsIndicator as A } from "../../pool-points-indicator/pool-points-indicator.js";
|
|
10
|
+
import { Skeleton as m } from "../../skeleton/skeleton.js";
|
|
11
|
+
import "react";
|
|
12
|
+
import "@gearbox-protocol/sdk";
|
|
13
|
+
import "clsx";
|
|
14
|
+
import "tailwind-merge";
|
|
15
|
+
import "sonner";
|
|
16
|
+
import { percentageTemplate as C, formatMoney as u } from "../../../utils/format-money.js";
|
|
17
|
+
import { tokenTemplate as h } from "../../../utils/templates.js";
|
|
18
|
+
import "luxon";
|
|
19
|
+
import "../../../utils/z-index.js";
|
|
20
|
+
import { TokenSymbol as x } from "../../token-symbol/token-symbol.js";
|
|
21
|
+
function N({ ctx: e }) {
|
|
22
|
+
const { pool: l, underlyingToken: r, points: t, apy: o, isMobile: n } = e, d = n ? 20 : 24, c = /* @__PURE__ */ i(x, { token: r, size: d });
|
|
23
|
+
return t && t.length > 0 && o ? /* @__PURE__ */ i(
|
|
24
|
+
T,
|
|
25
|
+
{
|
|
26
|
+
totalAPY: o.totalAPY,
|
|
27
|
+
baseAPY: o.baseAPY,
|
|
28
|
+
extraAPY: o.extraAPY,
|
|
29
|
+
points: t,
|
|
30
|
+
tokensList: e.tokensList,
|
|
31
|
+
children: /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(k, { size: d, children: c }) })
|
|
32
|
+
}
|
|
33
|
+
) : l.hasPoints ? /* @__PURE__ */ i(A, { size: d, children: c }) : c;
|
|
34
|
+
}
|
|
35
|
+
function Y(e) {
|
|
36
|
+
const l = e.underlyingToken?.title ?? e.underlyingToken?.symbol ?? "", r = e.pool.version;
|
|
37
|
+
return r && r >= 300 && r < 310 ? `${l} v${Math.floor(r / 100)}` : l;
|
|
38
|
+
}
|
|
39
|
+
function v({
|
|
40
|
+
ctx: e,
|
|
41
|
+
renderDescription: l,
|
|
42
|
+
getPoolName: r
|
|
43
|
+
}) {
|
|
44
|
+
const { pool: t } = e, o = r ? r(e) : Y(e);
|
|
45
|
+
return /* @__PURE__ */ a("div", { className: "grid grid-cols-[auto_1fr] gap-x-3", children: [
|
|
46
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-3 shrink-0 leading-0", children: [
|
|
47
|
+
t.network && /* @__PURE__ */ i(
|
|
48
|
+
P,
|
|
49
|
+
{
|
|
50
|
+
network: t.network,
|
|
51
|
+
isTest: !1,
|
|
52
|
+
size: 14,
|
|
53
|
+
showTooltip: !0
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ i(N, { ctx: e })
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ a("div", { className: "flex md:flex-col min-w-0 overflow-hidden items-center md:items-start gap-2 md:gap-0", children: [
|
|
59
|
+
/* @__PURE__ */ i("span", { className: "truncate max-w-full", children: o }),
|
|
60
|
+
l && /* @__PURE__ */ i(s, { className: "min-w-0 text-xs", children: l(e) })
|
|
61
|
+
] })
|
|
62
|
+
] });
|
|
63
|
+
}
|
|
64
|
+
function D({ ctx: e }) {
|
|
65
|
+
const { pool: l, underlyingToken: r, loading: t } = e;
|
|
66
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-col items-start md:items-end", children: [
|
|
67
|
+
/* @__PURE__ */ i(m, { loading: !!t, width: 60, children: u(l.expectedLiquidityInUSD ?? 0) }),
|
|
68
|
+
/* @__PURE__ */ i(s, { children: h(
|
|
69
|
+
l.expectedLiquidity,
|
|
70
|
+
r
|
|
71
|
+
) })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
function B({ ctx: e }) {
|
|
75
|
+
const { pool: l, underlyingToken: r, loading: t } = e;
|
|
76
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-col items-start md:items-end", children: [
|
|
77
|
+
/* @__PURE__ */ i(m, { loading: !!t, width: 60, children: u(l.totalBorrowedInUSD ?? 0) }),
|
|
78
|
+
/* @__PURE__ */ i(s, { children: h(
|
|
79
|
+
l.totalBorrowed,
|
|
80
|
+
r
|
|
81
|
+
) })
|
|
82
|
+
] });
|
|
83
|
+
}
|
|
84
|
+
function S({ ctx: e }) {
|
|
85
|
+
const { pool: l, loading: r, underlyingToken: t } = e, o = t?.decimals ?? 18, n = l.poolTokenSymbol != null ? {
|
|
86
|
+
title: l.poolTokenSymbol,
|
|
87
|
+
decimals: o
|
|
88
|
+
} : t;
|
|
89
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-col items-start md:items-end", children: [
|
|
90
|
+
/* @__PURE__ */ i(m, { loading: !!r, width: 60, children: u(l.userBalanceInUSD ?? 0) }),
|
|
91
|
+
l.userBalance !== void 0 && n && /* @__PURE__ */ i(s, { children: h(l.userBalance, n) })
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
function z(e, l) {
|
|
95
|
+
const r = e.pool.collateralTokens, { tokensList: t, isMobile: o } = e;
|
|
96
|
+
return !r?.length || !t ? null : /* @__PURE__ */ i(
|
|
97
|
+
w,
|
|
98
|
+
{
|
|
99
|
+
maxAssets: l,
|
|
100
|
+
tokensList: t,
|
|
101
|
+
balances: r.map((n) => ({ token: n })),
|
|
102
|
+
iconSize: o ? 20 : 24,
|
|
103
|
+
options: { mode: "cascade" }
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function Z(e) {
|
|
108
|
+
return {
|
|
109
|
+
id: "pool",
|
|
110
|
+
header: e?.header ?? "Pool",
|
|
111
|
+
width: e?.width ?? "186px",
|
|
112
|
+
align: "left",
|
|
113
|
+
className: "pl-4",
|
|
114
|
+
cell: (l) => /* @__PURE__ */ i(
|
|
115
|
+
v,
|
|
116
|
+
{
|
|
117
|
+
ctx: l,
|
|
118
|
+
renderDescription: e?.renderDescription,
|
|
119
|
+
getPoolName: e?.getPoolName
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
mobileTitle: e?.header ?? "Pool"
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function ee(e) {
|
|
126
|
+
return {
|
|
127
|
+
id: "supply",
|
|
128
|
+
header: e?.header ?? "Supply",
|
|
129
|
+
width: e?.width ?? "1fr",
|
|
130
|
+
align: "right",
|
|
131
|
+
hideOnMedium: e?.hideOnMedium,
|
|
132
|
+
sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "supply", defaultDirection: "desc" },
|
|
133
|
+
cell: (l) => /* @__PURE__ */ i(D, { ctx: l }),
|
|
134
|
+
mobileTitle: e?.header ?? "Supply"
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function le(e) {
|
|
138
|
+
return {
|
|
139
|
+
id: "supplyApy",
|
|
140
|
+
header: e?.header ?? "Supply APY",
|
|
141
|
+
headerTip: e?.headerTip,
|
|
142
|
+
width: e?.width ?? "1.25fr",
|
|
143
|
+
align: "right",
|
|
144
|
+
sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "apy", defaultDirection: "desc" },
|
|
145
|
+
cell: (l) => {
|
|
146
|
+
const { apy: r, loading: t, points: o, tokensList: n } = l, {
|
|
147
|
+
totalAPY: d = 0,
|
|
148
|
+
baseAPY: c = [],
|
|
149
|
+
extraAPY: f = [],
|
|
150
|
+
externalAPY: p,
|
|
151
|
+
apy7DAgo: g
|
|
152
|
+
} = r ?? {};
|
|
153
|
+
return /* @__PURE__ */ i(m, { width: 60, loading: !!t, children: /* @__PURE__ */ i(
|
|
154
|
+
y,
|
|
155
|
+
{
|
|
156
|
+
totalAPY: d,
|
|
157
|
+
totalAPYLoading: !!t,
|
|
158
|
+
baseAPY: c,
|
|
159
|
+
extraAPY: f,
|
|
160
|
+
points: o,
|
|
161
|
+
apy7DAgo: g,
|
|
162
|
+
tokensList: n,
|
|
163
|
+
externalAPY: p
|
|
164
|
+
}
|
|
165
|
+
) });
|
|
166
|
+
},
|
|
167
|
+
mobileTitle: e?.header ?? "Supply APY"
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function re(e) {
|
|
171
|
+
return {
|
|
172
|
+
id: "borrowed",
|
|
173
|
+
header: e?.header ?? "Borrowed",
|
|
174
|
+
width: e?.width ?? "1.15fr",
|
|
175
|
+
align: "right",
|
|
176
|
+
cell: (l) => /* @__PURE__ */ i(B, { ctx: l }),
|
|
177
|
+
mobileTitle: e?.header ?? "Borrowed"
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function ie(e) {
|
|
181
|
+
return {
|
|
182
|
+
id: "borrowApy",
|
|
183
|
+
header: e?.header ?? "Borrow APY",
|
|
184
|
+
headerTip: e?.headerTip,
|
|
185
|
+
width: e?.width ?? "150px",
|
|
186
|
+
align: "right",
|
|
187
|
+
cell: (l) => {
|
|
188
|
+
const r = l.pool.borrowAPY ?? e?.getBorrowRate?.(l.pool) ?? 0;
|
|
189
|
+
return /* @__PURE__ */ i("div", { className: "flex justify-start md:justify-end", children: C(r) });
|
|
190
|
+
},
|
|
191
|
+
mobileTitle: e?.header ?? "Borrow APY"
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function te(e) {
|
|
195
|
+
return {
|
|
196
|
+
id: "utilization",
|
|
197
|
+
header: e?.header ?? "Utilization",
|
|
198
|
+
width: e?.width ?? "150px",
|
|
199
|
+
align: "right",
|
|
200
|
+
className: "pr-4",
|
|
201
|
+
sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "utilization", defaultDirection: "desc" },
|
|
202
|
+
cell: (l) => {
|
|
203
|
+
const r = l.pool.utilization ?? 0;
|
|
204
|
+
return /* @__PURE__ */ i("div", { className: "flex justify-start md:justify-end", children: /* @__PURE__ */ i(b, { percent: r }) });
|
|
205
|
+
},
|
|
206
|
+
mobileTitle: e?.header ?? "Utilization"
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function oe(e) {
|
|
210
|
+
const l = e?.maxAssets ?? 5, r = (t) => z(t, l);
|
|
211
|
+
return {
|
|
212
|
+
id: "collateral",
|
|
213
|
+
header: e?.header ?? "Collateral",
|
|
214
|
+
width: e?.width ?? "148px",
|
|
215
|
+
align: e?.align ?? "left",
|
|
216
|
+
gapBefore: e?.gapBefore ?? "md",
|
|
217
|
+
cell: e?.cell ?? r,
|
|
218
|
+
mobileCell: e?.mobileCell ?? e?.cell ?? r,
|
|
219
|
+
mobileTitle: e?.header ?? "Collateral"
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function ne(e) {
|
|
223
|
+
return {
|
|
224
|
+
id: "balance",
|
|
225
|
+
header: e?.header ?? "Your Balance",
|
|
226
|
+
width: e?.width ?? "1.15fr",
|
|
227
|
+
align: "right",
|
|
228
|
+
className: e?.className ?? "pr-4",
|
|
229
|
+
headerClassName: e?.headerClassName ?? "pr-4",
|
|
230
|
+
sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "balance", defaultDirection: "desc" },
|
|
231
|
+
cell: e?.cell ?? ((l) => /* @__PURE__ */ i(S, { ctx: l })),
|
|
232
|
+
mobileTitle: e?.header ?? "Your Balance"
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function ae(e) {
|
|
236
|
+
return e;
|
|
237
|
+
}
|
|
238
|
+
export {
|
|
239
|
+
ne as balanceColumn,
|
|
240
|
+
ie as borrowApyColumn,
|
|
241
|
+
re as borrowedColumn,
|
|
242
|
+
oe as collateralColumn,
|
|
243
|
+
ae as customColumn,
|
|
244
|
+
Z as poolColumn,
|
|
245
|
+
le as supplyApyColumn,
|
|
246
|
+
ee as supplyColumn,
|
|
247
|
+
te as utilizationColumn
|
|
248
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { balanceColumn as u, borrowApyColumn as m, borrowedColumn as n, collateralColumn as p, customColumn as r, poolColumn as C, supplyApyColumn as a, supplyColumn as e, utilizationColumn as t } from "./columns.js";
|
|
2
|
+
import { PoolTable as y } from "./pool-table.js";
|
|
3
|
+
export {
|
|
4
|
+
y as PoolTable,
|
|
5
|
+
u as balanceColumn,
|
|
6
|
+
m as borrowApyColumn,
|
|
7
|
+
n as borrowedColumn,
|
|
8
|
+
p as collateralColumn,
|
|
9
|
+
r as customColumn,
|
|
10
|
+
C as poolColumn,
|
|
11
|
+
a as supplyApyColumn,
|
|
12
|
+
e as supplyColumn,
|
|
13
|
+
t as utilizationColumn
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { jsx as l, Fragment as G, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import * as b from "react";
|
|
3
|
+
import { HeadCell as D } from "../../head-cell/head-cell.js";
|
|
4
|
+
import { HelpTip as $ } from "../../help-tip/help-tip.js";
|
|
5
|
+
import { GridLoadingLine as A } from "../../table/grid-loading-line.js";
|
|
6
|
+
import { GridTable as E, GridTableHeader as F, GridTableBody as X, GridTableRow as k, GridTableHead as q, GridTableCell as P } from "../../table/grid-table.js";
|
|
7
|
+
import { TableLoaderGuard as J } from "../../table/table-loader-guard.js";
|
|
8
|
+
import { TableLineSm as K, TableCellSm as Q } from "../../table/table-sm.js";
|
|
9
|
+
import "@gearbox-protocol/sdk/common-utils";
|
|
10
|
+
import "@gearbox-protocol/sdk";
|
|
11
|
+
import { useIsMobile as U, useIsMedium as V } from "../../../hooks/use-media-query.js";
|
|
12
|
+
import { cn as T } from "../../../utils/cn.js";
|
|
13
|
+
function j({
|
|
14
|
+
last: e,
|
|
15
|
+
className: n,
|
|
16
|
+
...d
|
|
17
|
+
}) {
|
|
18
|
+
return /* @__PURE__ */ l(
|
|
19
|
+
k,
|
|
20
|
+
{
|
|
21
|
+
className: T(e && "*:after:hidden", n),
|
|
22
|
+
...d
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function W({
|
|
27
|
+
columns: e,
|
|
28
|
+
sort: n,
|
|
29
|
+
isMedium: d
|
|
30
|
+
}) {
|
|
31
|
+
return /* @__PURE__ */ l(k, { noHover: !0, height: "35px", children: e.map((i) => {
|
|
32
|
+
if (i.hideOnMedium && d) return null;
|
|
33
|
+
const s = i.sort, a = s && n ? {
|
|
34
|
+
direction: n.state?.field === s.field ? n.state.sort : null,
|
|
35
|
+
onSort: () => n.set(s.field, s.defaultDirection ?? "desc")
|
|
36
|
+
} : void 0, p = typeof i.header == "function" ? i.header(a) : i.header;
|
|
37
|
+
return /* @__PURE__ */ l(
|
|
38
|
+
q,
|
|
39
|
+
{
|
|
40
|
+
justify: i.align === "right" ? "end" : i.align === "center" ? "center" : "start",
|
|
41
|
+
size: "sm",
|
|
42
|
+
gapBefore: i.gapBefore,
|
|
43
|
+
className: T(i.className, i.headerClassName),
|
|
44
|
+
children: a ? /* @__PURE__ */ C(G, { children: [
|
|
45
|
+
/* @__PURE__ */ l(
|
|
46
|
+
D,
|
|
47
|
+
{
|
|
48
|
+
title: p,
|
|
49
|
+
sortDirection: a.direction ?? void 0,
|
|
50
|
+
onSort: a.onSort
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
i.headerTip && /* @__PURE__ */ l($, { className: "ml-1.5", children: i.headerTip })
|
|
54
|
+
] }) : /* @__PURE__ */ C(G, { children: [
|
|
55
|
+
p,
|
|
56
|
+
i.headerTip && /* @__PURE__ */ l($, { className: "ml-1.5", children: i.headerTip })
|
|
57
|
+
] })
|
|
58
|
+
},
|
|
59
|
+
i.id
|
|
60
|
+
);
|
|
61
|
+
}) });
|
|
62
|
+
}
|
|
63
|
+
function Y({
|
|
64
|
+
row: e,
|
|
65
|
+
columns: n,
|
|
66
|
+
last: d,
|
|
67
|
+
rowHeight: i,
|
|
68
|
+
isSmall: s,
|
|
69
|
+
isMedium: a,
|
|
70
|
+
mobileColumnsXs: p,
|
|
71
|
+
mobileColumnsMd: h
|
|
72
|
+
}) {
|
|
73
|
+
const f = b.useMemo(
|
|
74
|
+
() => ({
|
|
75
|
+
pool: e.pool,
|
|
76
|
+
tokensList: e.tokensList,
|
|
77
|
+
underlyingToken: e.tokensList?.[e.pool.underlyingToken],
|
|
78
|
+
apy: e.apy,
|
|
79
|
+
points: e.points,
|
|
80
|
+
loading: e.loading,
|
|
81
|
+
chainId: e.chainId,
|
|
82
|
+
isMobile: s
|
|
83
|
+
}),
|
|
84
|
+
[e, s]
|
|
85
|
+
), N = a ? n.filter((r) => !r.hideOnMedium) : n;
|
|
86
|
+
if (s) {
|
|
87
|
+
const r = n.filter((t) => !t.hideOnMobile), [c, ...M] = r, u = (t) => t.mobileCell ? t.mobileCell(f) : t.cell(f);
|
|
88
|
+
return /* @__PURE__ */ l(j, { last: d, href: e.href, children: /* @__PURE__ */ l(P, { span: "full", size: "sm", className: "px-3 py-0!", children: /* @__PURE__ */ l(
|
|
89
|
+
K,
|
|
90
|
+
{
|
|
91
|
+
title: c ? u(c) : void 0,
|
|
92
|
+
columnsXs: p,
|
|
93
|
+
columnsMd: h,
|
|
94
|
+
className: "w-full",
|
|
95
|
+
children: M.map((t) => /* @__PURE__ */ l(Q, { title: t.mobileTitle, children: u(t) }, t.id))
|
|
96
|
+
}
|
|
97
|
+
) }) });
|
|
98
|
+
}
|
|
99
|
+
return /* @__PURE__ */ l(j, { last: d, href: e.href, height: `${i}px`, children: N.map((r) => /* @__PURE__ */ l(
|
|
100
|
+
P,
|
|
101
|
+
{
|
|
102
|
+
textAlign: r.align ?? "left",
|
|
103
|
+
size: "sm",
|
|
104
|
+
gapBefore: r.gapBefore,
|
|
105
|
+
className: r.className,
|
|
106
|
+
children: r.cell(f)
|
|
107
|
+
},
|
|
108
|
+
r.id
|
|
109
|
+
)) });
|
|
110
|
+
}
|
|
111
|
+
function oe({
|
|
112
|
+
columns: e,
|
|
113
|
+
rows: n,
|
|
114
|
+
loading: d = !1,
|
|
115
|
+
partialLoading: i = !1,
|
|
116
|
+
error: s,
|
|
117
|
+
emptyContent: a,
|
|
118
|
+
skeletonRows: p = 5,
|
|
119
|
+
rowHeight: h = 75,
|
|
120
|
+
size: f = "lg",
|
|
121
|
+
mobileColumnsXs: N = 3,
|
|
122
|
+
mobileColumnsMd: r = 3,
|
|
123
|
+
className: c,
|
|
124
|
+
wrapperClassName: M,
|
|
125
|
+
sort: u
|
|
126
|
+
}) {
|
|
127
|
+
const t = U(), g = V(), m = b.useMemo(
|
|
128
|
+
() => g ? e.filter((o) => !o.hideOnMedium) : e,
|
|
129
|
+
[e, g]
|
|
130
|
+
), I = b.useMemo(() => t ? "1fr" : m.map((o) => o.width ?? "1fr").join(" "), [t, m]), v = b.useMemo(() => {
|
|
131
|
+
const o = m.map((H, O) => {
|
|
132
|
+
const L = H.gapBefore;
|
|
133
|
+
if (!L || L === "none") return null;
|
|
134
|
+
const z = L === "md" ? "pl-10" : "pl-5";
|
|
135
|
+
return `[&:nth-child(${O + 1})]:${z}`;
|
|
136
|
+
}).filter(Boolean).join(" "), y = m[m.length - 1]?.className?.includes("pr-4") ? "last:pr-4" : "";
|
|
137
|
+
return T("px-1 py-2 first:pl-4", y, o);
|
|
138
|
+
}, [m]), x = d || !n, R = !x && n && n.length === 0, B = i && !x;
|
|
139
|
+
return s ? null : R && a ? /* @__PURE__ */ l(G, { children: a }) : /* @__PURE__ */ C(
|
|
140
|
+
E,
|
|
141
|
+
{
|
|
142
|
+
cols: I,
|
|
143
|
+
gap: 0,
|
|
144
|
+
size: f,
|
|
145
|
+
wrapperClassName: T("overflow-visible", M),
|
|
146
|
+
className: c,
|
|
147
|
+
children: [
|
|
148
|
+
!t && /* @__PURE__ */ l(F, { children: /* @__PURE__ */ l(W, { columns: e, sort: u, isMedium: g }) }),
|
|
149
|
+
/* @__PURE__ */ l(
|
|
150
|
+
J,
|
|
151
|
+
{
|
|
152
|
+
showGuard: x,
|
|
153
|
+
rows: p,
|
|
154
|
+
columns: t ? 1 : m.length,
|
|
155
|
+
height: `${h}px`,
|
|
156
|
+
cellClassName: t ? "px-1 py-2 first:pl-4 last:pr-4" : v,
|
|
157
|
+
children: /* @__PURE__ */ C(X, { children: [
|
|
158
|
+
n?.map((o, S, y) => /* @__PURE__ */ l(
|
|
159
|
+
Y,
|
|
160
|
+
{
|
|
161
|
+
row: o,
|
|
162
|
+
columns: e,
|
|
163
|
+
last: S === y.length - 1 && !B,
|
|
164
|
+
rowHeight: h,
|
|
165
|
+
isSmall: t,
|
|
166
|
+
isMedium: g,
|
|
167
|
+
mobileColumnsXs: N,
|
|
168
|
+
mobileColumnsMd: r
|
|
169
|
+
},
|
|
170
|
+
`${o.chainId}-${o.pool.address}`
|
|
171
|
+
)),
|
|
172
|
+
B && /* @__PURE__ */ l(
|
|
173
|
+
A,
|
|
174
|
+
{
|
|
175
|
+
height: `${h}px`,
|
|
176
|
+
columns: m.length,
|
|
177
|
+
cellClassName: v,
|
|
178
|
+
last: !0
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] })
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
export {
|
|
189
|
+
oe as PoolTable
|
|
190
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as r, jsxs as h } from "react/jsx-runtime";
|
|
2
|
-
import { IconInfo as
|
|
2
|
+
import { IconInfo as $ } from "@gearbox-protocol/static";
|
|
3
3
|
import * as y from "react";
|
|
4
|
-
import { PointsIcon as
|
|
5
|
-
import { PoolAPYTooltip as
|
|
6
|
-
import { TokenIcon as
|
|
7
|
-
import { formatPercentAmount as
|
|
8
|
-
import { getStatic as
|
|
4
|
+
import { PointsIcon as M } from "../points-icon/points-icon.js";
|
|
5
|
+
import { PoolAPYTooltip as N } from "../pool-apy-tooltip/pool-apy-tooltip.js";
|
|
6
|
+
import { TokenIcon as j } from "../token-icon/token-icon.js";
|
|
7
|
+
import { formatPercentAmount as I } from "../../utils/format-money.js";
|
|
8
|
+
import { getStatic as L } from "../../utils/static.js";
|
|
9
9
|
import "../accordion/accordion.js";
|
|
10
10
|
import "@fortawesome/free-solid-svg-icons";
|
|
11
11
|
import "../icons/fa-icon.js";
|
|
@@ -52,9 +52,16 @@ import "../input/input.js";
|
|
|
52
52
|
import "../with-title/with-title.js";
|
|
53
53
|
import "../smart-number-input/balance-indicator.js";
|
|
54
54
|
import "../smart-number-input/smart-number-input.js";
|
|
55
|
+
import "../description/description.js";
|
|
56
|
+
import "../rounded-image/rounded-image.js";
|
|
57
|
+
import "../progress/progress.js";
|
|
58
|
+
import "../pool-indicator-icon/pool-indicator-icon.js";
|
|
59
|
+
import "../skeleton/skeleton.js";
|
|
60
|
+
import { getSymbolOrIcon as C } from "../token-symbol/token-symbol.js";
|
|
61
|
+
import "../help-tip/help-tip.js";
|
|
62
|
+
import "../table/grid-table.js";
|
|
55
63
|
import "../confirm-menu/confirm-menu.js";
|
|
56
64
|
import "../currency-button/currency-button.js";
|
|
57
|
-
import "../description/description.js";
|
|
58
65
|
import "../detailed-apy/detailed-apy.js";
|
|
59
66
|
import "../detailed-page-title/detailed-page-title.js";
|
|
60
67
|
import "../detailed-page-title/detailed-page-title-copy-button.js";
|
|
@@ -99,7 +106,6 @@ import "../filter/variants.js";
|
|
|
99
106
|
import "../graph/formatters.js";
|
|
100
107
|
import "lightweight-charts";
|
|
101
108
|
import "../graph/graph-view.js";
|
|
102
|
-
import "../help-tip/help-tip.js";
|
|
103
109
|
import "../health-factor/health-factor.js";
|
|
104
110
|
import "../horizontal-indicator/horizontal-indicator.js";
|
|
105
111
|
import "../icon-button/icon-button.js";
|
|
@@ -113,12 +119,10 @@ import "../layout/main-aside-layout/main-aside-layout.js";
|
|
|
113
119
|
import "../page-title/page-title.js";
|
|
114
120
|
import "../layout/social-icons/social-icons.js";
|
|
115
121
|
import "../link/link.js";
|
|
116
|
-
import { getSymbolOrIcon as L } from "../token-symbol/token-symbol.js";
|
|
117
122
|
import "../../utils/reactochart-compat.js";
|
|
118
123
|
import "../status-elements/status-elements.js";
|
|
119
124
|
import "../text-button/text-button.js";
|
|
120
125
|
import "../loader/loader.js";
|
|
121
|
-
import "../skeleton/skeleton.js";
|
|
122
126
|
import "../loading/loading.js";
|
|
123
127
|
import "../loading-bar/loading-bar.js";
|
|
124
128
|
import "react-markdown";
|
|
@@ -128,11 +132,8 @@ import "../navbar/navbar-indicator-context.js";
|
|
|
128
132
|
import "../app-bar/app-bar.js";
|
|
129
133
|
import "../navitem/navitem.js";
|
|
130
134
|
import "../simple-dropdown/simple-dropdown.js";
|
|
131
|
-
import "../progress/progress.js";
|
|
132
|
-
import "../pool-indicator-icon/pool-indicator-icon.js";
|
|
133
135
|
import "../progress-bar/progress-bar.js";
|
|
134
136
|
import "../radio-group/radio-group.js";
|
|
135
|
-
import "../rounded-image/rounded-image.js";
|
|
136
137
|
import "../search-bar/search-bar.js";
|
|
137
138
|
import "../segmented-control/segmented-control.js";
|
|
138
139
|
import "../select/select.js";
|
|
@@ -150,7 +151,6 @@ import "../stat-badge/stat-badge.js";
|
|
|
150
151
|
import "../status-dot/status-dot.js";
|
|
151
152
|
import "../stepper/stepper.js";
|
|
152
153
|
import "../switch/switch.js";
|
|
153
|
-
import "../table/grid-table.js";
|
|
154
154
|
import "../table/table.js";
|
|
155
155
|
import "../table/grid-table-loader.js";
|
|
156
156
|
import "../textarea/textarea.js";
|
|
@@ -162,21 +162,21 @@ import "../typography/typography.js";
|
|
|
162
162
|
import "../vertical-indicator/vertical-indicator.js";
|
|
163
163
|
import "../vertical-list/vertical-list.js";
|
|
164
164
|
import "../with-filter-button/with-filter-button.js";
|
|
165
|
-
function
|
|
165
|
+
function G(i, p) {
|
|
166
166
|
const e = i?.symbol || p;
|
|
167
|
-
return e === "GEAR" ? { icon:
|
|
167
|
+
return e === "GEAR" ? { icon: L("/logo/logo_symbol.png") } : C(i) || e;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function _r({
|
|
170
170
|
totalAPY: i,
|
|
171
171
|
totalAPYLoading: p,
|
|
172
172
|
baseAPY: e,
|
|
173
173
|
extraAPY: u,
|
|
174
174
|
externalAPY: o,
|
|
175
175
|
points: n,
|
|
176
|
-
apy7DAgo:
|
|
176
|
+
apy7DAgo: R,
|
|
177
177
|
tokensList: g,
|
|
178
178
|
decimals: w = 2,
|
|
179
|
-
className:
|
|
179
|
+
className: z
|
|
180
180
|
}) {
|
|
181
181
|
const a = y.useMemo(() => {
|
|
182
182
|
if (o)
|
|
@@ -184,18 +184,18 @@ function Wr({
|
|
|
184
184
|
...o,
|
|
185
185
|
value: o.value ?? o.apy ?? 0
|
|
186
186
|
};
|
|
187
|
-
}, [o]), s = y.useMemo(() => u.filter((d) => (d.apy || 0) > 0), [u]), b = () => {
|
|
188
|
-
const d = s.length > 0,
|
|
189
|
-
|
|
190
|
-
...
|
|
191
|
-
].join("-")}%`,
|
|
192
|
-
return /* @__PURE__ */ h("div", { className:
|
|
187
|
+
}, [o]), s = y.useMemo(() => u.filter((d) => (d.apy || 0) > 0), [u]), b = !p && i >= 1e-3, x = () => {
|
|
188
|
+
const d = s.length > 0, S = a && !p && a.totalValue > 0 && a.totalValue !== i, k = n && n.length > 0, V = `${[
|
|
189
|
+
I(i, w),
|
|
190
|
+
...S ? [I(a.totalValue, w)] : []
|
|
191
|
+
].join("-")}%`, T = Math.max(s.length, 0), v = n?.filter((t) => t.reward) ?? [], l = T + v.length;
|
|
192
|
+
return /* @__PURE__ */ h("div", { className: z, children: [
|
|
193
193
|
/* @__PURE__ */ h("span", { className: "inline-flex items-center", children: [
|
|
194
|
-
|
|
195
|
-
/* @__PURE__ */ r("span", { className: "ml-1.5 leading-[0] text-gray-70", children: /* @__PURE__ */ r(
|
|
194
|
+
V,
|
|
195
|
+
b && /* @__PURE__ */ r("span", { className: "ml-1.5 leading-[0] text-gray-70", children: /* @__PURE__ */ r($, { size: 14 }) })
|
|
196
196
|
] }),
|
|
197
197
|
/* @__PURE__ */ r("div", {}),
|
|
198
|
-
(d ||
|
|
198
|
+
(d || k) && /* @__PURE__ */ h("span", { className: "relative inline-flex", children: [
|
|
199
199
|
s.map((t, m) => {
|
|
200
200
|
const c = g?.[t.rewardToken], f = m === l - 1;
|
|
201
201
|
return /* @__PURE__ */ r(
|
|
@@ -206,9 +206,9 @@ function Wr({
|
|
|
206
206
|
marginRight: f ? 0 : -7
|
|
207
207
|
},
|
|
208
208
|
children: /* @__PURE__ */ r(
|
|
209
|
-
|
|
209
|
+
j,
|
|
210
210
|
{
|
|
211
|
-
symbol:
|
|
211
|
+
symbol: G(c, t.rewardTokenSymbol),
|
|
212
212
|
size: 14,
|
|
213
213
|
style: {
|
|
214
214
|
margin: t.rewardTokenSymbol === "GEAR" ? "-3px 0 0 0" : "0"
|
|
@@ -220,7 +220,7 @@ function Wr({
|
|
|
220
220
|
);
|
|
221
221
|
}),
|
|
222
222
|
v.map((t, m) => {
|
|
223
|
-
const c = m +
|
|
223
|
+
const c = m + T, f = c === l - 1;
|
|
224
224
|
return /* @__PURE__ */ r(
|
|
225
225
|
"span",
|
|
226
226
|
{
|
|
@@ -229,7 +229,7 @@ function Wr({
|
|
|
229
229
|
marginRight: f ? 0 : -7
|
|
230
230
|
},
|
|
231
231
|
children: /* @__PURE__ */ r(
|
|
232
|
-
|
|
232
|
+
M,
|
|
233
233
|
{
|
|
234
234
|
reward: {
|
|
235
235
|
name: t.reward?.name || t.name,
|
|
@@ -244,7 +244,7 @@ function Wr({
|
|
|
244
244
|
})
|
|
245
245
|
] })
|
|
246
246
|
] });
|
|
247
|
-
},
|
|
247
|
+
}, E = y.useMemo(() => {
|
|
248
248
|
if (o)
|
|
249
249
|
return {
|
|
250
250
|
totalValue: o.totalValue,
|
|
@@ -253,21 +253,21 @@ function Wr({
|
|
|
253
253
|
tooltip: o.tooltip
|
|
254
254
|
};
|
|
255
255
|
}, [o]);
|
|
256
|
-
return
|
|
257
|
-
|
|
256
|
+
return b ? /* @__PURE__ */ r(
|
|
257
|
+
N,
|
|
258
258
|
{
|
|
259
259
|
baseAPY: e,
|
|
260
260
|
extraAPY: s,
|
|
261
261
|
totalAPY: i,
|
|
262
|
-
externalAPY:
|
|
262
|
+
externalAPY: E,
|
|
263
263
|
points: n,
|
|
264
|
-
apy7DAgo:
|
|
264
|
+
apy7DAgo: R,
|
|
265
265
|
tokensList: g,
|
|
266
|
-
children:
|
|
266
|
+
children: x()
|
|
267
267
|
}
|
|
268
|
-
) :
|
|
268
|
+
) : x();
|
|
269
269
|
}
|
|
270
270
|
export {
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
_r as CompoundAPY,
|
|
272
|
+
G as getRewardTokenSymbol
|
|
273
273
|
};
|