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