@gearbox-protocol/ui-kit 4.0.0-next.22 → 4.0.0-next.23
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("react");require("@gearbox-protocol/sdk");require("clsx");require("tailwind-merge");require("sonner");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("react");require("@gearbox-protocol/sdk");require("clsx");require("tailwind-merge");require("sonner");const _=require("../../../utils/format-money.cjs");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../../utils/z-index.cjs");require("../../points-icon/points-icon.cjs");const v=require("../../base/values/scalars.cjs");require("../../badge/badge.cjs");require("../../badge/chip.cjs");const o=require("../../typed-intl/index.cjs"),S=require("../../collateral-allocation-tooltip/allocation-wheel.cjs");require("@fortawesome/free-solid-svg-icons");require("../../icons/fa-icon.cjs");require("../../token-icon/token-icon.cjs");require("../../tooltip/simple-tooltip.cjs");require("../../tooltip/tooltip.cjs");const f=require("../../name-cell/name-cell.cjs"),y=require("../../short-string/short-string.cjs");require("react-intl");require("../../buttons/button/button.cjs");const t=require("../../table/grid-table.cjs");require("../../skeleton/skeleton.cjs");require("../../table/table.cjs");const i=require("../../table/table-sm.cjs"),C=require("../../token-symbol/token-symbol.cjs"),b=require("../../token-template/token-template.cjs"),A=require("../../vertical-indicator/vertical-indicator.cjs"),a=require("./constants.cjs");function z(s,l){if(l!==0n)return Number(s*10000n/l)}function k(s,l){return l<=0n||s<=0n?0:Number(s*10000n/l)/1e4}function N({asset:s,underlyingToken:l,last:h,isCompact:c,totalUsed:q,colorIndex:j}){const{token:u,limit:n,used:r}=s,g=c?40:21,m=k(r.value,q),d=()=>e.jsx(f.NameCell,{leading:e.jsx(C.TokenSymbol,{size:32,token:u}),title:e.jsx(y.ShortString,{maxLength:g,children:u.symbol})}),p=()=>e.jsxs("div",{className:"flex items-center justify-end gap-2","data-testid":a.PoolAssetsTableTest.exposureCell,children:[e.jsx(S.AllocationWheel,{share:m,colorIndex:j,idle:m===0}),e.jsx(A.VerticalIndicator,{value:e.jsx(b.TokenTemplate,{decimalPartLength:2,precision:2,showSymbol:!1,token:l,value:r.value}),valueDescription:r.valueUsd===null?"—":_.formatMoney(r.valueUsd)})]}),x=()=>e.jsx("div",{"data-testid":a.PoolAssetsTableTest.capCell,children:n.value===0n?e.jsx("span",{children:"—"}):e.jsx(b.TokenTemplate,{decimalPartLength:2,precision:2,showSymbol:!1,token:l,value:n.value})}),T=()=>e.jsx("div",{"data-testid":a.PoolAssetsTableTest.capUtilizationCell,children:e.jsx(v.UtilizationValue,{data:z(r.value,n.value)})});return e.jsx(t.GridTableRow,{last:h,height:"auto",className:"cursor-default",style:{minHeight:"75px"},children:c?e.jsx(t.GridTableCell,{className:"px-3 py-0!",size:"sm",span:"full",children:e.jsxs(i.TableLineSm,{className:"w-full",columns:3,columnsXs:3,title:d(),children:[e.jsx(i.TableCellSm,{title:e.jsx(o.FormattedMessageTyped,{messageId:"components.poolAssetsTable.exposure"}),children:p()}),e.jsx(i.TableCellSm,{title:e.jsx(o.FormattedMessageTyped,{messageId:"components.poolAssetsTable.cap"}),children:x()}),e.jsx(i.TableCellSm,{title:e.jsx(o.FormattedMessageTyped,{messageId:"components.poolAssetsTable.capUtilization"}),children:T()})]})}):e.jsxs(e.Fragment,{children:[e.jsx(t.GridTableCell,{className:"pl-4",size:"sm",textAlign:"left",children:d()}),e.jsx(t.GridTableCell,{size:"sm",textAlign:"right",children:p()}),e.jsx(t.GridTableCell,{size:"sm",textAlign:"right",children:x()}),e.jsx(t.GridTableCell,{className:"pr-4",size:"sm",textAlign:"right",children:T()})]})})}exports.PoolAssetsTableRow=N;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as A } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "@gearbox-protocol/sdk";
|
|
4
4
|
import "clsx";
|
|
5
5
|
import "tailwind-merge";
|
|
6
6
|
import "sonner";
|
|
7
|
-
import { formatMoney as
|
|
7
|
+
import { formatMoney as N } from "../../../utils/format-money.js";
|
|
8
8
|
import "@gearbox-protocol/sdk/common-utils";
|
|
9
9
|
import "luxon";
|
|
10
10
|
import "../../../utils/z-index.js";
|
|
11
11
|
import "../../points-icon/points-icon.js";
|
|
12
|
-
import { UtilizationValue as
|
|
12
|
+
import { UtilizationValue as y } from "../../base/values/scalars.js";
|
|
13
13
|
import "../../badge/badge.js";
|
|
14
14
|
import "../../badge/chip.js";
|
|
15
|
-
import { FormattedMessageTyped as
|
|
16
|
-
import { AllocationWheel as
|
|
15
|
+
import { FormattedMessageTyped as m } from "../../typed-intl/index.js";
|
|
16
|
+
import { AllocationWheel as C } from "../../collateral-allocation-tooltip/allocation-wheel.js";
|
|
17
17
|
import "@fortawesome/free-solid-svg-icons";
|
|
18
18
|
import "../../icons/fa-icon.js";
|
|
19
19
|
import "../../token-icon/token-icon.js";
|
|
20
20
|
import "../../tooltip/simple-tooltip.js";
|
|
21
21
|
import "../../tooltip/tooltip.js";
|
|
22
|
-
import { NameCell as
|
|
23
|
-
import { ShortString as
|
|
22
|
+
import { NameCell as S } from "../../name-cell/name-cell.js";
|
|
23
|
+
import { ShortString as U } from "../../short-string/short-string.js";
|
|
24
24
|
import "react-intl";
|
|
25
25
|
import "../../buttons/button/button.js";
|
|
26
|
-
import { GridTableRow as
|
|
26
|
+
import { GridTableRow as k, GridTableCell as o } from "../../table/grid-table.js";
|
|
27
27
|
import "../../skeleton/skeleton.js";
|
|
28
28
|
import "../../table/table.js";
|
|
29
|
-
import { TableLineSm as
|
|
30
|
-
import { TokenSymbol as
|
|
29
|
+
import { TableLineSm as w, TableCellSm as a } from "../../table/table-sm.js";
|
|
30
|
+
import { TokenSymbol as L } from "../../token-symbol/token-symbol.js";
|
|
31
31
|
import { TokenTemplate as v } from "../../token-template/token-template.js";
|
|
32
32
|
import { VerticalIndicator as I } from "../../vertical-indicator/vertical-indicator.js";
|
|
33
|
-
import { PoolAssetsTableTest as
|
|
33
|
+
import { PoolAssetsTableTest as n } from "./constants.js";
|
|
34
34
|
function P(i, t) {
|
|
35
35
|
if (t !== 0n)
|
|
36
36
|
return Number(i * 10000n / t);
|
|
@@ -41,29 +41,28 @@ function j(i, t) {
|
|
|
41
41
|
function ue({
|
|
42
42
|
asset: i,
|
|
43
43
|
underlyingToken: t,
|
|
44
|
-
last:
|
|
45
|
-
isCompact:
|
|
46
|
-
totalUsed:
|
|
47
|
-
colorIndex:
|
|
44
|
+
last: b,
|
|
45
|
+
isCompact: p,
|
|
46
|
+
totalUsed: x,
|
|
47
|
+
colorIndex: T
|
|
48
48
|
}) {
|
|
49
|
-
const { token:
|
|
50
|
-
|
|
49
|
+
const { token: c, limit: r, used: l } = i, z = p ? 40 : 21, d = j(l.value, x), u = () => /* @__PURE__ */ e(
|
|
50
|
+
S,
|
|
51
51
|
{
|
|
52
|
-
leading: /* @__PURE__ */ e(
|
|
53
|
-
title: /* @__PURE__ */ e(
|
|
54
|
-
subtitle: /* @__PURE__ */ e(b, { maxLength: 20, children: r.name })
|
|
52
|
+
leading: /* @__PURE__ */ e(L, { size: 32, token: c }),
|
|
53
|
+
title: /* @__PURE__ */ e(U, { maxLength: z, children: c.symbol })
|
|
55
54
|
}
|
|
56
|
-
), h = () => /* @__PURE__ */
|
|
55
|
+
), h = () => /* @__PURE__ */ s(
|
|
57
56
|
"div",
|
|
58
57
|
{
|
|
59
58
|
className: "flex items-center justify-end gap-2",
|
|
60
|
-
"data-testid":
|
|
59
|
+
"data-testid": n.exposureCell,
|
|
61
60
|
children: [
|
|
62
61
|
/* @__PURE__ */ e(
|
|
63
|
-
|
|
62
|
+
C,
|
|
64
63
|
{
|
|
65
64
|
share: d,
|
|
66
|
-
colorIndex:
|
|
65
|
+
colorIndex: T,
|
|
67
66
|
idle: d === 0
|
|
68
67
|
}
|
|
69
68
|
),
|
|
@@ -80,30 +79,30 @@ function ue({
|
|
|
80
79
|
value: l.value
|
|
81
80
|
}
|
|
82
81
|
),
|
|
83
|
-
valueDescription: l.valueUsd === null ? "—" :
|
|
82
|
+
valueDescription: l.valueUsd === null ? "—" : N(l.valueUsd)
|
|
84
83
|
}
|
|
85
84
|
)
|
|
86
85
|
]
|
|
87
86
|
}
|
|
88
|
-
), f = () => /* @__PURE__ */ e("div", { "data-testid":
|
|
87
|
+
), f = () => /* @__PURE__ */ e("div", { "data-testid": n.capCell, children: r.value === 0n ? /* @__PURE__ */ e("span", { children: "—" }) : /* @__PURE__ */ e(
|
|
89
88
|
v,
|
|
90
89
|
{
|
|
91
90
|
decimalPartLength: 2,
|
|
92
91
|
precision: 2,
|
|
93
92
|
showSymbol: !1,
|
|
94
93
|
token: t,
|
|
95
|
-
value:
|
|
94
|
+
value: r.value
|
|
96
95
|
}
|
|
97
|
-
) }), g = () => /* @__PURE__ */ e("div", { "data-testid":
|
|
96
|
+
) }), g = () => /* @__PURE__ */ e("div", { "data-testid": n.capUtilizationCell, children: /* @__PURE__ */ e(y, { data: P(l.value, r.value) }) });
|
|
98
97
|
return /* @__PURE__ */ e(
|
|
99
|
-
|
|
98
|
+
k,
|
|
100
99
|
{
|
|
101
|
-
last:
|
|
100
|
+
last: b,
|
|
102
101
|
height: "auto",
|
|
103
102
|
className: "cursor-default",
|
|
104
103
|
style: { minHeight: "75px" },
|
|
105
|
-
children:
|
|
106
|
-
|
|
104
|
+
children: p ? /* @__PURE__ */ e(o, { className: "px-3 py-0!", size: "sm", span: "full", children: /* @__PURE__ */ s(
|
|
105
|
+
w,
|
|
107
106
|
{
|
|
108
107
|
className: "w-full",
|
|
109
108
|
columns: 3,
|
|
@@ -111,29 +110,29 @@ function ue({
|
|
|
111
110
|
title: u(),
|
|
112
111
|
children: [
|
|
113
112
|
/* @__PURE__ */ e(
|
|
114
|
-
|
|
113
|
+
a,
|
|
115
114
|
{
|
|
116
|
-
title: /* @__PURE__ */ e(
|
|
115
|
+
title: /* @__PURE__ */ e(m, { messageId: "components.poolAssetsTable.exposure" }),
|
|
117
116
|
children: h()
|
|
118
117
|
}
|
|
119
118
|
),
|
|
120
119
|
/* @__PURE__ */ e(
|
|
121
|
-
|
|
120
|
+
a,
|
|
122
121
|
{
|
|
123
|
-
title: /* @__PURE__ */ e(
|
|
122
|
+
title: /* @__PURE__ */ e(m, { messageId: "components.poolAssetsTable.cap" }),
|
|
124
123
|
children: f()
|
|
125
124
|
}
|
|
126
125
|
),
|
|
127
126
|
/* @__PURE__ */ e(
|
|
128
|
-
|
|
127
|
+
a,
|
|
129
128
|
{
|
|
130
|
-
title: /* @__PURE__ */ e(
|
|
129
|
+
title: /* @__PURE__ */ e(m, { messageId: "components.poolAssetsTable.capUtilization" }),
|
|
131
130
|
children: g()
|
|
132
131
|
}
|
|
133
132
|
)
|
|
134
133
|
]
|
|
135
134
|
}
|
|
136
|
-
) }) : /* @__PURE__ */
|
|
135
|
+
) }) : /* @__PURE__ */ s(A, { children: [
|
|
137
136
|
/* @__PURE__ */ e(o, { className: "pl-4", size: "sm", textAlign: "left", children: u() }),
|
|
138
137
|
/* @__PURE__ */ e(o, { size: "sm", textAlign: "right", children: h() }),
|
|
139
138
|
/* @__PURE__ */ e(o, { size: "sm", textAlign: "right", children: f() }),
|