@gearbox-protocol/ui-kit 3.11.1 → 3.11.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.
@@ -1,78 +1,79 @@
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";
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 _, 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({
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
- O,
21
+ H,
21
22
  {
22
- className: L(e && "*:after:hidden", l),
23
+ className: u(e && "*:after:hidden", l),
23
24
  ...d
24
25
  }
25
26
  );
26
27
  }
27
- function ee({
28
+ function ie({
28
29
  columns: e,
29
30
  sort: l,
30
31
  isMedium: d
31
32
  }) {
32
- return /* @__PURE__ */ t(O, { noHover: !0, height: "35px", children: e.map((i) => {
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, p = typeof i.header == "function" ? i.header(a) : i.header;
38
+ } : void 0, m = typeof i.header == "function" ? i.header(a) : i.header;
38
39
  return /* @__PURE__ */ t(
39
- V,
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: L(i.className, i.headerClassName),
45
- children: a ? /* @__PURE__ */ N(I, { children: [
45
+ className: u(i.className, i.headerClassName),
46
+ children: a ? /* @__PURE__ */ N(G, { children: [
46
47
  /* @__PURE__ */ t(
47
- q,
48
+ F,
48
49
  {
49
- title: p,
50
+ title: m,
50
51
  sortDirection: a.direction ?? void 0,
51
52
  onSort: a.onSort
52
53
  }
53
54
  ),
54
- i.headerTip && /* @__PURE__ */ t(R, { className: "ml-1.5", children: i.headerTip })
55
- ] }) : /* @__PURE__ */ N(I, { children: [
56
- p,
57
- i.headerTip && /* @__PURE__ */ t(R, { className: "ml-1.5", children: i.headerTip })
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 ie({
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: p,
72
- mobileColumnsMd: c,
73
- rowTestId: u
72
+ mobileColumnsXs: m,
73
+ mobileColumnsMd: h,
74
+ rowTestId: g
74
75
  }) {
75
- const f = C.useMemo(
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((n) => !n.hideOnMedium) : l;
88
+ ), M = a ? l.filter((r) => !r.hideOnMedium) : l;
88
89
  if (s) {
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(
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: g ? T(g) : void 0,
94
- columnsXs: p,
95
- columnsMd: c,
94
+ title: b ? T(b) : void 0,
95
+ columnsXs: m,
96
+ columnsMd: h,
96
97
  className: "w-full",
97
- children: x.map((r) => /* @__PURE__ */ t(Z, { title: r.mobileTitle, children: T(r) }, r.id))
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
- H,
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": u,
108
- children: M.map((n) => /* @__PURE__ */ t(
109
- j,
111
+ "data-testid": g,
112
+ children: M.map((r) => /* @__PURE__ */ t(
113
+ $,
110
114
  {
111
- textAlign: n.align ?? "left",
115
+ textAlign: r.align ?? "left",
112
116
  size: "sm",
113
- gapBefore: n.gapBefore,
114
- className: n.className,
115
- children: n.cell(f)
117
+ gapBefore: r.gapBefore,
118
+ className: r.className,
119
+ children: r.cell(c)
116
120
  },
117
- n.id
121
+ r.id
118
122
  ))
119
123
  }
120
124
  );
121
125
  }
122
- function fe({
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: p = 5,
130
- rowHeight: c = 75,
131
- size: u = "lg",
132
- mobileColumnsXs: f = 3,
133
+ skeletonRows: m = 5,
134
+ rowHeight: h = 75,
135
+ size: g = "lg",
136
+ mobileColumnsXs: c = 3,
133
137
  mobileColumnsMd: M = 3,
134
- className: n,
135
- wrapperClassName: g,
138
+ className: r,
139
+ wrapperClassName: b,
136
140
  sort: x,
137
141
  rowTestId: T,
138
- loaderTestId: r
142
+ loaderTestId: n
139
143
  }) {
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,
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: D,
159
+ cols: A,
156
160
  gap: 0,
157
- size: u,
158
- wrapperClassName: L("overflow-visible", g),
159
- className: n,
161
+ size: g,
162
+ wrapperClassName: u(
163
+ "overflow-visible",
164
+ V,
165
+ b
166
+ ),
167
+ className: r,
160
168
  children: [
161
- !h && /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ t(ee, { columns: e, sort: x, isMedium: b }) }),
169
+ !f && /* @__PURE__ */ t(J, { children: /* @__PURE__ */ t(ie, { columns: e, sort: x, isMedium: C }) }),
162
170
  /* @__PURE__ */ t(
163
- W,
171
+ U,
164
172
  {
165
173
  showGuard: y,
166
- rows: p,
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,
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: P === v.length - 1 && !$,
178
- rowHeight: c,
179
- isSmall: h,
180
- isMedium: b,
181
- mobileColumnsXs: f,
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: z
191
+ rowTestId: _
184
192
  },
185
193
  `${o.chainId}-${o.pool.address}`
186
194
  )),
187
- $ && /* @__PURE__ */ t(
188
- J,
195
+ I && /* @__PURE__ */ t(
196
+ X,
189
197
  {
190
- height: `${c}px`,
191
- columns: m.length,
198
+ height: `${h}px`,
199
+ columns: p.length,
192
200
  cellClassName: S,
193
- "data-testid": B,
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
- fe as PoolTable
213
+ ge as PoolTable
206
214
  };