@gearbox-protocol/ui-kit 3.8.1-next.1 → 3.8.2
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 +52 -44
- 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/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,76 +1,78 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { HeadCell as
|
|
4
|
-
import { HelpTip as
|
|
5
|
-
import { GridLoadingLine as
|
|
6
|
-
import { GridTable as
|
|
7
|
-
import { TableLoaderGuard as
|
|
8
|
-
import { TableLineSm as
|
|
1
|
+
import { jsx as t, Fragment as I, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import * as C from "react";
|
|
3
|
+
import { HeadCell as q } from "../../head-cell/head-cell.js";
|
|
4
|
+
import { HelpTip as R } from "../../help-tip/help-tip.js";
|
|
5
|
+
import { GridLoadingLine as J } from "../../table/grid-loading-line.js";
|
|
6
|
+
import { GridTable as K, GridTableHeader as Q, GridTableBody as U, GridTableRow as O, GridTableHead as V, GridTableCell as j } from "../../table/grid-table.js";
|
|
7
|
+
import { TableLoaderGuard as W } from "../../table/table-loader-guard.js";
|
|
8
|
+
import { TableLineSm as Y, TableCellSm as Z } from "../../table/table-sm.js";
|
|
9
9
|
import "@gearbox-protocol/sdk/common-utils";
|
|
10
10
|
import "@gearbox-protocol/sdk";
|
|
11
|
-
import { useIsMobile as
|
|
12
|
-
import {
|
|
13
|
-
|
|
11
|
+
import { useIsMobile as _, useIsMedium as w } from "../../../hooks/use-media-query.js";
|
|
12
|
+
import { poolTableTestIds as k } from "../../../test-ids/pool-table.js";
|
|
13
|
+
import { cn as L } from "../../../utils/cn.js";
|
|
14
|
+
function H({
|
|
14
15
|
last: e,
|
|
15
|
-
className:
|
|
16
|
+
className: l,
|
|
16
17
|
...d
|
|
17
18
|
}) {
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
19
|
+
return /* @__PURE__ */ t(
|
|
20
|
+
O,
|
|
20
21
|
{
|
|
21
|
-
className:
|
|
22
|
+
className: L(e && "*:after:hidden", l),
|
|
22
23
|
...d
|
|
23
24
|
}
|
|
24
25
|
);
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function ee({
|
|
27
28
|
columns: e,
|
|
28
|
-
sort:
|
|
29
|
+
sort: l,
|
|
29
30
|
isMedium: d
|
|
30
31
|
}) {
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ t(O, { noHover: !0, height: "35px", children: e.map((i) => {
|
|
32
33
|
if (i.hideOnMedium && d) return null;
|
|
33
|
-
const s = i.sort, a = s &&
|
|
34
|
-
direction:
|
|
35
|
-
onSort: () =>
|
|
34
|
+
const s = i.sort, a = s && l ? {
|
|
35
|
+
direction: l.state?.field === s.field ? l.state.sort : null,
|
|
36
|
+
onSort: () => l.set(s.field, s.defaultDirection ?? "desc")
|
|
36
37
|
} : void 0, p = typeof i.header == "function" ? i.header(a) : i.header;
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
38
|
+
return /* @__PURE__ */ t(
|
|
39
|
+
V,
|
|
39
40
|
{
|
|
40
41
|
justify: i.align === "right" ? "end" : i.align === "center" ? "center" : "start",
|
|
41
42
|
size: "sm",
|
|
42
43
|
gapBefore: i.gapBefore,
|
|
43
|
-
className:
|
|
44
|
-
children: a ? /* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
|
|
44
|
+
className: L(i.className, i.headerClassName),
|
|
45
|
+
children: a ? /* @__PURE__ */ N(I, { children: [
|
|
46
|
+
/* @__PURE__ */ t(
|
|
47
|
+
q,
|
|
47
48
|
{
|
|
48
49
|
title: p,
|
|
49
50
|
sortDirection: a.direction ?? void 0,
|
|
50
51
|
onSort: a.onSort
|
|
51
52
|
}
|
|
52
53
|
),
|
|
53
|
-
i.headerTip && /* @__PURE__ */
|
|
54
|
-
] }) : /* @__PURE__ */
|
|
54
|
+
i.headerTip && /* @__PURE__ */ t(R, { className: "ml-1.5", children: i.headerTip })
|
|
55
|
+
] }) : /* @__PURE__ */ N(I, { children: [
|
|
55
56
|
p,
|
|
56
|
-
i.headerTip && /* @__PURE__ */
|
|
57
|
+
i.headerTip && /* @__PURE__ */ t(R, { className: "ml-1.5", children: i.headerTip })
|
|
57
58
|
] })
|
|
58
59
|
},
|
|
59
60
|
i.id
|
|
60
61
|
);
|
|
61
62
|
}) });
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
+
function ie({
|
|
64
65
|
row: e,
|
|
65
|
-
columns:
|
|
66
|
+
columns: l,
|
|
66
67
|
last: d,
|
|
67
68
|
rowHeight: i,
|
|
68
69
|
isSmall: s,
|
|
69
70
|
isMedium: a,
|
|
70
71
|
mobileColumnsXs: p,
|
|
71
|
-
mobileColumnsMd:
|
|
72
|
+
mobileColumnsMd: c,
|
|
73
|
+
rowTestId: u
|
|
72
74
|
}) {
|
|
73
|
-
const f =
|
|
75
|
+
const f = C.useMemo(
|
|
74
76
|
() => ({
|
|
75
77
|
pool: e.pool,
|
|
76
78
|
tokensList: e.tokensList,
|
|
@@ -82,99 +84,113 @@ function Y({
|
|
|
82
84
|
isMobile: s
|
|
83
85
|
}),
|
|
84
86
|
[e, s]
|
|
85
|
-
),
|
|
87
|
+
), M = a ? l.filter((n) => !n.hideOnMedium) : l;
|
|
86
88
|
if (s) {
|
|
87
|
-
const
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
|
|
89
|
+
const n = l.filter((r) => !r.hideOnMobile), [g, ...x] = n, T = (r) => r.mobileCell ? r.mobileCell(f) : r.cell(f);
|
|
90
|
+
return /* @__PURE__ */ t(H, { last: d, href: e.href, "data-testid": u, children: /* @__PURE__ */ t(j, { span: "full", size: "sm", className: "px-3 py-0!", children: /* @__PURE__ */ t(
|
|
91
|
+
Y,
|
|
90
92
|
{
|
|
91
|
-
title:
|
|
93
|
+
title: g ? T(g) : void 0,
|
|
92
94
|
columnsXs: p,
|
|
93
|
-
columnsMd:
|
|
95
|
+
columnsMd: c,
|
|
94
96
|
className: "w-full",
|
|
95
|
-
children:
|
|
97
|
+
children: x.map((r) => /* @__PURE__ */ t(Z, { title: r.mobileTitle, children: T(r) }, r.id))
|
|
96
98
|
}
|
|
97
99
|
) }) });
|
|
98
100
|
}
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
-
|
|
101
|
+
return /* @__PURE__ */ t(
|
|
102
|
+
H,
|
|
101
103
|
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
children:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
last: d,
|
|
105
|
+
href: e.href,
|
|
106
|
+
height: `${i}px`,
|
|
107
|
+
"data-testid": u,
|
|
108
|
+
children: M.map((n) => /* @__PURE__ */ t(
|
|
109
|
+
j,
|
|
110
|
+
{
|
|
111
|
+
textAlign: n.align ?? "left",
|
|
112
|
+
size: "sm",
|
|
113
|
+
gapBefore: n.gapBefore,
|
|
114
|
+
className: n.className,
|
|
115
|
+
children: n.cell(f)
|
|
116
|
+
},
|
|
117
|
+
n.id
|
|
118
|
+
))
|
|
119
|
+
}
|
|
120
|
+
);
|
|
110
121
|
}
|
|
111
|
-
function
|
|
122
|
+
function fe({
|
|
112
123
|
columns: e,
|
|
113
|
-
rows:
|
|
124
|
+
rows: l,
|
|
114
125
|
loading: d = !1,
|
|
115
126
|
partialLoading: i = !1,
|
|
116
127
|
error: s,
|
|
117
128
|
emptyContent: a,
|
|
118
129
|
skeletonRows: p = 5,
|
|
119
|
-
rowHeight:
|
|
120
|
-
size:
|
|
121
|
-
mobileColumnsXs:
|
|
122
|
-
mobileColumnsMd:
|
|
123
|
-
className:
|
|
124
|
-
wrapperClassName:
|
|
125
|
-
sort:
|
|
130
|
+
rowHeight: c = 75,
|
|
131
|
+
size: u = "lg",
|
|
132
|
+
mobileColumnsXs: f = 3,
|
|
133
|
+
mobileColumnsMd: M = 3,
|
|
134
|
+
className: n,
|
|
135
|
+
wrapperClassName: g,
|
|
136
|
+
sort: x,
|
|
137
|
+
rowTestId: T,
|
|
138
|
+
loaderTestId: r
|
|
126
139
|
}) {
|
|
127
|
-
const
|
|
128
|
-
() =>
|
|
129
|
-
[e,
|
|
130
|
-
),
|
|
131
|
-
const o = m.map((
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
134
|
-
const
|
|
135
|
-
return `[&:nth-child(${
|
|
136
|
-
}).filter(Boolean).join(" "),
|
|
137
|
-
return
|
|
138
|
-
}, [m]),
|
|
139
|
-
return s ? null :
|
|
140
|
-
|
|
140
|
+
const z = T ?? k.poolLine, B = r ?? k.poolLineLoading, h = _(), b = w(), m = C.useMemo(
|
|
141
|
+
() => b ? e.filter((o) => !o.hideOnMedium) : e,
|
|
142
|
+
[e, b]
|
|
143
|
+
), D = C.useMemo(() => h ? "1fr" : m.map((o) => o.width ?? "1fr").join(" "), [h, m]), S = C.useMemo(() => {
|
|
144
|
+
const o = m.map((E, F) => {
|
|
145
|
+
const G = E.gapBefore;
|
|
146
|
+
if (!G || G === "none") return null;
|
|
147
|
+
const X = G === "md" ? "pl-10" : "pl-5";
|
|
148
|
+
return `[&:nth-child(${F + 1})]:${X}`;
|
|
149
|
+
}).filter(Boolean).join(" "), v = m[m.length - 1]?.className?.includes("pr-4") ? "last:pr-4" : "";
|
|
150
|
+
return L("px-1 py-2 first:pl-4", v, o);
|
|
151
|
+
}, [m]), y = d || !l, A = !y && l && l.length === 0, $ = i && !y;
|
|
152
|
+
return s ? null : A && a ? /* @__PURE__ */ t(I, { children: a }) : /* @__PURE__ */ N(
|
|
153
|
+
K,
|
|
141
154
|
{
|
|
142
|
-
cols:
|
|
155
|
+
cols: D,
|
|
143
156
|
gap: 0,
|
|
144
|
-
size:
|
|
145
|
-
wrapperClassName:
|
|
146
|
-
className:
|
|
157
|
+
size: u,
|
|
158
|
+
wrapperClassName: L("overflow-visible", g),
|
|
159
|
+
className: n,
|
|
147
160
|
children: [
|
|
148
|
-
!
|
|
149
|
-
/* @__PURE__ */
|
|
150
|
-
|
|
161
|
+
!h && /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ t(ee, { columns: e, sort: x, isMedium: b }) }),
|
|
162
|
+
/* @__PURE__ */ t(
|
|
163
|
+
W,
|
|
151
164
|
{
|
|
152
|
-
showGuard:
|
|
165
|
+
showGuard: y,
|
|
153
166
|
rows: p,
|
|
154
|
-
columns:
|
|
155
|
-
height: `${
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
167
|
+
columns: h ? 1 : m.length,
|
|
168
|
+
height: `${c}px`,
|
|
169
|
+
"data-testid": B,
|
|
170
|
+
cellClassName: h ? "px-1 py-2 first:pl-4 last:pr-4" : S,
|
|
171
|
+
children: /* @__PURE__ */ N(U, { children: [
|
|
172
|
+
l?.map((o, P, v) => /* @__PURE__ */ t(
|
|
173
|
+
ie,
|
|
160
174
|
{
|
|
161
175
|
row: o,
|
|
162
176
|
columns: e,
|
|
163
|
-
last:
|
|
164
|
-
rowHeight:
|
|
165
|
-
isSmall:
|
|
166
|
-
isMedium:
|
|
167
|
-
mobileColumnsXs:
|
|
168
|
-
mobileColumnsMd:
|
|
177
|
+
last: P === v.length - 1 && !$,
|
|
178
|
+
rowHeight: c,
|
|
179
|
+
isSmall: h,
|
|
180
|
+
isMedium: b,
|
|
181
|
+
mobileColumnsXs: f,
|
|
182
|
+
mobileColumnsMd: M,
|
|
183
|
+
rowTestId: z
|
|
169
184
|
},
|
|
170
185
|
`${o.chainId}-${o.pool.address}`
|
|
171
186
|
)),
|
|
172
|
-
|
|
173
|
-
|
|
187
|
+
$ && /* @__PURE__ */ t(
|
|
188
|
+
J,
|
|
174
189
|
{
|
|
175
|
-
height: `${
|
|
190
|
+
height: `${c}px`,
|
|
176
191
|
columns: m.length,
|
|
177
|
-
cellClassName:
|
|
192
|
+
cellClassName: S,
|
|
193
|
+
"data-testid": B,
|
|
178
194
|
last: !0
|
|
179
195
|
}
|
|
180
196
|
)
|
|
@@ -186,5 +202,5 @@ function oe({
|
|
|
186
202
|
);
|
|
187
203
|
}
|
|
188
204
|
export {
|
|
189
|
-
|
|
205
|
+
fe as PoolTable
|
|
190
206
|
};
|