@gearbox-protocol/ui-kit 3.11.1 → 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.
@@ -1,133 +1,157 @@
1
- import { jsx as i, jsxs as c } from "react/jsx-runtime";
2
- import { AssetsListCell as A } from "../../assets-list-cell/assets-list-cell.js";
1
+ import { jsx as i, jsxs as m } from "react/jsx-runtime";
2
+ import { AssetsListCell as k } from "../../assets-list-cell/assets-list-cell.js";
3
3
  import { CompoundAPY as C } from "../../compound-apy/compound-apy.js";
4
- import { Description as m } from "../../description/description.js";
5
- import { NetworkIcon as P } from "../../network-icon/network-icon.js";
6
- import { PercentIndicator as x } from "../../percent-indicator/percent-indicator.js";
7
- import { PoolAPYTooltip as N } from "../../pool-apy-tooltip/pool-apy-tooltip.js";
8
- import { PoolIndicatorIcon as v } from "../../pool-indicator-icon/pool-indicator-icon.js";
4
+ import { Description as p } from "../../description/description.js";
5
+ import { NetworkIcon as N } from "../../network-icon/network-icon.js";
6
+ import { PercentIndicator as v } from "../../percent-indicator/percent-indicator.js";
7
+ import { PoolAPYTooltip as P } from "../../pool-apy-tooltip/pool-apy-tooltip.js";
8
+ import { PoolIndicatorIcon as x } from "../../pool-indicator-icon/pool-indicator-icon.js";
9
9
  import { PoolPointsIndicator as D } from "../../pool-points-indicator/pool-points-indicator.js";
10
- import { Skeleton as u } from "../../skeleton/skeleton.js";
10
+ import { RWA_GRADIENT_BORDER_CLASS as I } from "../../rwa-styles/index.js";
11
+ import { Skeleton as f } from "../../skeleton/skeleton.js";
11
12
  import "react";
12
13
  import "@gearbox-protocol/sdk";
13
- import "clsx";
14
- import "tailwind-merge";
14
+ import { cn as Y } from "../../../utils/cn.js";
15
15
  import "sonner";
16
- import { percentageTemplate as I, formatMoney as f } from "../../../utils/format-money.js";
17
- import { tokenTemplate as h } from "../../../utils/templates.js";
16
+ import { percentageTemplate as z, formatMoney as g } from "../../../utils/format-money.js";
17
+ import { tokenTemplate as T } from "../../../utils/templates.js";
18
18
  import "luxon";
19
19
  import "../../../utils/z-index.js";
20
- import { TokenSymbol as Y } from "../../token-symbol/token-symbol.js";
21
- import { FormattedMessageTyped as g } from "../../typed-intl/index.js";
22
- import { poolTableTestIds as z } from "../../../test-ids/pool-table.js";
20
+ import { TokenSymbol as S } from "../../token-symbol/token-symbol.js";
21
+ import { SimpleTooltip as B } from "../../tooltip/simple-tooltip.js";
22
+ import "../../tooltip/tooltip.js";
23
+ import { FormattedMessageTyped as w } from "../../typed-intl/index.js";
24
+ import { poolTableTestIds as L } from "../../../test-ids/pool-table.js";
23
25
  function d(e, l, o) {
24
26
  const t = e?.header ?? /* @__PURE__ */ i(
25
- g,
27
+ w,
26
28
  {
27
29
  messageId: e?.headerMessageId ?? l
28
30
  }
29
31
  );
30
- let n;
32
+ let r;
31
33
  if (e?.headerTip !== null) {
32
- const r = e?.headerTipMessageId ?? o;
33
- n = e?.headerTip ?? (r && /* @__PURE__ */ i(g, { messageId: r }));
34
+ const n = e?.headerTipMessageId ?? o;
35
+ r = e?.headerTip ?? (n && /* @__PURE__ */ i(w, { messageId: n }));
34
36
  }
35
- return { header: t, headerTip: n, mobileTitle: e?.mobileTitle ?? t };
37
+ return { header: t, headerTip: r, mobileTitle: e?.mobileTitle ?? t };
36
38
  }
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(
40
- N,
39
+ function M({
40
+ ctx: e,
41
+ rwaTooltip: l
42
+ }) {
43
+ const { pool: o, underlyingToken: t, points: r, apy: n, isMobile: a } = e, s = a ? 20 : 24, c = /* @__PURE__ */ i(S, { token: t, size: s }), h = o.poolType === "rwa", u = r && r.length > 0 && n ? /* @__PURE__ */ i(
44
+ P,
41
45
  {
42
46
  totalAPY: n.totalAPY,
43
47
  baseAPY: n.baseAPY,
44
48
  extraAPY: n.extraAPY,
45
- points: t,
49
+ points: r,
46
50
  tokensList: e.tokensList,
47
- children: /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(v, { size: a, children: s }) })
51
+ children: /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(x, { size: s, children: c }) })
48
52
  }
49
- ) : l.hasPoints ? /* @__PURE__ */ i(D, { size: a, children: s }) : s;
53
+ ) : o.hasPoints ? /* @__PURE__ */ i(D, { size: s, children: c }) : c;
54
+ return h ? /* @__PURE__ */ i(
55
+ B,
56
+ {
57
+ placement: "top",
58
+ useTitleAsTrigger: !0,
59
+ title: /* @__PURE__ */ i(
60
+ "div",
61
+ {
62
+ className: Y(
63
+ "relative inline-flex rounded-full p-1",
64
+ I
65
+ ),
66
+ children: /* @__PURE__ */ i("div", { className: "relative z-10", children: u })
67
+ }
68
+ ),
69
+ children: l ?? "RWA market"
70
+ }
71
+ ) : u;
50
72
  }
51
- function M(e) {
73
+ function F(e) {
52
74
  const l = e.underlyingToken?.title ?? e.underlyingToken?.symbol ?? "", o = e.pool.version;
53
75
  return o && o >= 300 && o < 310 ? `${l} v${Math.floor(o / 100)}` : l;
54
76
  }
55
- function S({
77
+ function R({
56
78
  ctx: e,
57
79
  renderDescription: l,
58
- getPoolName: o
80
+ getPoolName: o,
81
+ rwaTooltip: t
59
82
  }) {
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: [
63
- t.network && /* @__PURE__ */ i(
64
- P,
83
+ const { pool: r } = e, n = o ? o(e) : F(e), a = r.poolType === "rwa";
84
+ return /* @__PURE__ */ m("div", { className: "grid grid-cols-[auto_1fr] gap-x-3", children: [
85
+ a && /* @__PURE__ */ i("span", { className: "hidden", "data-rwa-pool-marker": "true" }),
86
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-3 shrink-0 leading-0", children: [
87
+ r.network && /* @__PURE__ */ i(
88
+ N,
65
89
  {
66
- network: t.network,
90
+ network: r.network,
67
91
  isTest: !1,
68
92
  size: 14,
69
93
  showTooltip: !0
70
94
  }
71
95
  ),
72
- /* @__PURE__ */ i(B, { ctx: e })
96
+ /* @__PURE__ */ i(M, { ctx: e, rwaTooltip: t })
73
97
  ] }),
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: [
98
+ /* @__PURE__ */ m("div", { className: "flex md:flex-col min-w-0 overflow-hidden items-center md:items-start gap-2 md:gap-0", children: [
75
99
  /* @__PURE__ */ i("span", { className: "truncate max-w-full", children: n }),
76
- l && /* @__PURE__ */ i(m, { className: "min-w-0 text-xs", children: l(e) })
100
+ l && /* @__PURE__ */ i(p, { className: "min-w-0 text-xs", children: l(e) })
77
101
  ] })
78
102
  ] });
79
103
  }
80
- function F({ ctx: e }) {
104
+ function j({ ctx: e }) {
81
105
  const { pool: l, underlyingToken: o, loading: t } = e;
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(
106
+ return /* @__PURE__ */ m("div", { className: "flex flex-col items-start md:items-end", children: [
107
+ /* @__PURE__ */ i(f, { loading: !!t, width: 60, children: g(l.expectedLiquidityInUSD ?? 0) }),
108
+ /* @__PURE__ */ i(p, { children: T(
85
109
  l.expectedLiquidity,
86
110
  o
87
111
  ) })
88
112
  ] });
89
113
  }
90
- function L({ ctx: e }) {
114
+ function O({ ctx: e }) {
91
115
  const { pool: l, underlyingToken: o, loading: t } = e;
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(
116
+ return /* @__PURE__ */ m("div", { className: "flex flex-col items-start md:items-end", children: [
117
+ /* @__PURE__ */ i(f, { loading: !!t, width: 60, children: g(l.totalBorrowedInUSD ?? 0) }),
118
+ /* @__PURE__ */ i(p, { children: T(
95
119
  l.totalBorrowed,
96
120
  o
97
121
  ) })
98
122
  ] });
99
123
  }
100
- function j({ ctx: e }) {
101
- const { pool: l, loading: o, underlyingToken: t } = e, n = t?.decimals ?? 18, r = l.poolTokenSymbol != null ? {
124
+ function _({ ctx: e }) {
125
+ const { pool: l, loading: o, underlyingToken: t } = e, r = t?.decimals ?? 18, n = l.poolTokenSymbol != null ? {
102
126
  title: l.poolTokenSymbol,
103
- decimals: n
127
+ decimals: r
104
128
  } : t;
105
- return /* @__PURE__ */ c(
129
+ return /* @__PURE__ */ m(
106
130
  "div",
107
131
  {
108
132
  className: "flex flex-col items-start md:items-end",
109
- "data-testid": z.poolLineCellBalance,
133
+ "data-testid": L.poolLineCellBalance,
110
134
  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) })
135
+ /* @__PURE__ */ i(f, { loading: !!o, width: 60, children: g(l.userBalanceInUSD ?? 0) }),
136
+ l.userBalance !== void 0 && n && /* @__PURE__ */ i(p, { children: T(l.userBalance, n) })
113
137
  ]
114
138
  }
115
139
  );
116
140
  }
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(
120
- A,
141
+ function U(e, l, o) {
142
+ const t = e.pool.collateralTokens, { tokensList: r, isMobile: n } = e, { mode: a = "cascade", ...s } = o ?? {};
143
+ return !t?.length || !r ? null : /* @__PURE__ */ i(
144
+ k,
121
145
  {
122
146
  maxAssets: l,
123
- tokensList: n,
124
- balances: t.map((p) => ({ token: p })),
125
- iconSize: r ? 20 : 24,
147
+ tokensList: r,
148
+ balances: t.map((c) => ({ token: c })),
149
+ iconSize: n ? 20 : 24,
126
150
  options: { mode: a, ...s }
127
151
  }
128
152
  );
129
153
  }
130
- function ae(e) {
154
+ function ue(e) {
131
155
  const { header: l, mobileTitle: o } = d(
132
156
  e,
133
157
  "components.poolTable.pool"
@@ -139,17 +163,18 @@ function ae(e) {
139
163
  align: "left",
140
164
  className: "pl-4",
141
165
  cell: (t) => /* @__PURE__ */ i(
142
- S,
166
+ R,
143
167
  {
144
168
  ctx: t,
145
169
  renderDescription: e?.renderDescription,
146
- getPoolName: e?.getPoolName
170
+ getPoolName: e?.getPoolName,
171
+ rwaTooltip: e?.rwaTooltip
147
172
  }
148
173
  ),
149
174
  mobileTitle: o
150
175
  };
151
176
  }
152
- function de(e) {
177
+ function pe(e) {
153
178
  const { header: l, mobileTitle: o } = d(
154
179
  e,
155
180
  "components.poolTable.supply"
@@ -161,11 +186,11 @@ function de(e) {
161
186
  align: "right",
162
187
  hideOnMedium: e?.hideOnMedium,
163
188
  sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "supply", defaultDirection: "desc" },
164
- cell: (t) => /* @__PURE__ */ i(F, { ctx: t }),
189
+ cell: (t) => /* @__PURE__ */ i(j, { ctx: t }),
165
190
  mobileTitle: o
166
191
  };
167
192
  }
168
- function se(e) {
193
+ function fe(e) {
169
194
  const { header: l, headerTip: o, mobileTitle: t } = d(
170
195
  e,
171
196
  "components.poolTable.supplyApy",
@@ -178,24 +203,24 @@ function se(e) {
178
203
  width: e?.width ?? "1.25fr",
179
204
  align: "right",
180
205
  sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "apy", defaultDirection: "desc" },
181
- cell: (n) => {
182
- const { apy: r, loading: a, points: s, tokensList: p } = n, {
183
- totalAPY: T = 0,
184
- baseAPY: b = [],
185
- extraAPY: w = [],
206
+ cell: (r) => {
207
+ const { apy: n, loading: a, points: s, tokensList: c } = r, {
208
+ totalAPY: h = 0,
209
+ baseAPY: u = [],
210
+ extraAPY: b = [],
186
211
  externalAPY: y,
187
- apy7DAgo: k
188
- } = r ?? {};
189
- return /* @__PURE__ */ i(u, { width: 60, loading: !!a, children: /* @__PURE__ */ i(
212
+ apy7DAgo: A
213
+ } = n ?? {};
214
+ return /* @__PURE__ */ i(f, { width: 60, loading: !!a, children: /* @__PURE__ */ i(
190
215
  C,
191
216
  {
192
- totalAPY: T,
217
+ totalAPY: h,
193
218
  totalAPYLoading: !!a,
194
- baseAPY: b,
195
- extraAPY: w,
219
+ baseAPY: u,
220
+ extraAPY: b,
196
221
  points: s,
197
- apy7DAgo: k,
198
- tokensList: p,
222
+ apy7DAgo: A,
223
+ tokensList: c,
199
224
  externalAPY: y
200
225
  }
201
226
  ) });
@@ -203,7 +228,7 @@ function se(e) {
203
228
  mobileTitle: t
204
229
  };
205
230
  }
206
- function ce(e) {
231
+ function he(e) {
207
232
  const { header: l, mobileTitle: o } = d(
208
233
  e,
209
234
  "components.poolTable.borrowed"
@@ -213,11 +238,11 @@ function ce(e) {
213
238
  header: l,
214
239
  width: e?.width ?? "1.15fr",
215
240
  align: "right",
216
- cell: (t) => /* @__PURE__ */ i(L, { ctx: t }),
241
+ cell: (t) => /* @__PURE__ */ i(O, { ctx: t }),
217
242
  mobileTitle: o
218
243
  };
219
244
  }
220
- function me(e) {
245
+ function ge(e) {
221
246
  const { header: l, headerTip: o, mobileTitle: t } = d(
222
247
  e,
223
248
  "components.poolTable.borrowApy"
@@ -228,14 +253,14 @@ function me(e) {
228
253
  headerTip: o,
229
254
  width: e?.width ?? "150px",
230
255
  align: "right",
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) });
256
+ cell: (r) => {
257
+ const n = r.pool.borrowAPY ?? e?.getBorrowRate?.(r.pool) ?? 0;
258
+ return /* @__PURE__ */ i("div", { className: "flex justify-start md:justify-end", children: z(n) });
234
259
  },
235
260
  mobileTitle: t
236
261
  };
237
262
  }
238
- function ue(e) {
263
+ function Te(e) {
239
264
  const { header: l, mobileTitle: o } = d(
240
265
  e,
241
266
  "components.poolTable.utilization"
@@ -248,14 +273,14 @@ function ue(e) {
248
273
  className: "pr-4",
249
274
  sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "utilization", defaultDirection: "desc" },
250
275
  cell: (t) => {
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 }) });
276
+ const r = t.pool.utilization ?? 0;
277
+ return /* @__PURE__ */ i("div", { className: "flex justify-start md:justify-end", children: /* @__PURE__ */ i(v, { percent: r }) });
253
278
  },
254
279
  mobileTitle: o
255
280
  };
256
281
  }
257
- function pe(e) {
258
- const l = e?.maxAssets ?? 5, o = (r) => O(r, l, e?.options), { header: t, mobileTitle: n } = d(
282
+ function we(e) {
283
+ const l = e?.maxAssets ?? 5, o = (n) => U(n, l, e?.options), { header: t, mobileTitle: r } = d(
259
284
  e,
260
285
  "components.poolTable.collateral"
261
286
  );
@@ -267,10 +292,10 @@ function pe(e) {
267
292
  gapBefore: e?.gapBefore ?? "md",
268
293
  cell: e?.cell ?? o,
269
294
  mobileCell: e?.mobileCell ?? e?.cell ?? o,
270
- mobileTitle: n
295
+ mobileTitle: r
271
296
  };
272
297
  }
273
- function fe(e) {
298
+ function be(e) {
274
299
  const { header: l, mobileTitle: o } = d(
275
300
  e,
276
301
  "components.poolTable.balance"
@@ -283,22 +308,22 @@ function fe(e) {
283
308
  className: e?.className ?? "pr-4",
284
309
  headerClassName: e?.headerClassName ?? "pr-4",
285
310
  sort: e?.sortField !== void 0 ? { field: e.sortField, defaultDirection: "desc" } : { field: "balance", defaultDirection: "desc" },
286
- cell: e?.cell ?? ((t) => /* @__PURE__ */ i(j, { ctx: t })),
311
+ cell: e?.cell ?? ((t) => /* @__PURE__ */ i(_, { ctx: t })),
287
312
  mobileTitle: o
288
313
  };
289
314
  }
290
- function he(e) {
315
+ function ye(e) {
291
316
  return e;
292
317
  }
293
318
  export {
294
- fe as balanceColumn,
295
- me as borrowApyColumn,
296
- ce as borrowedColumn,
297
- pe as collateralColumn,
298
- he as customColumn,
299
- M as defaultPoolName,
300
- ae as poolColumn,
301
- se as supplyApyColumn,
302
- de as supplyColumn,
303
- ue as utilizationColumn
319
+ be as balanceColumn,
320
+ ge as borrowApyColumn,
321
+ he as borrowedColumn,
322
+ we as collateralColumn,
323
+ ye as customColumn,
324
+ F as defaultPoolName,
325
+ ue as poolColumn,
326
+ fe as supplyApyColumn,
327
+ pe as supplyColumn,
328
+ Te as utilizationColumn
304
329
  };