@gearbox-protocol/ui-kit 4.0.0-next.71 → 4.0.0-next.72
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 t=require("react/jsx-runtime"),l=require("viem"),a=require("../../compound-apy/compound-apy.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("viem"),a=require("../../compound-apy/compound-apy.cjs"),i=require("../../no-value/no-value.cjs"),c=require("../../tooltip/simple-tooltip.cjs");require("../../tooltip/tooltip.cjs");const p=require("../../../utils/cn.cjs"),d=require("../../../utils/format-leverage.cjs"),m=require("../../../utils/format-money.cjs");require("@gearbox-protocol/sdk/onchain");require("../../../utils/z-index.cjs");const V=require("../../../utils/internal/format-asset-amount.cjs"),u=require("../../../utils/internal/format-bps.cjs"),s=require("./constants.cjs");function f({data:e,tooltip:n=!0,period:r}){return e===void 0?t.jsx(i.NoValue,{reason:r}):typeof e=="number"?t.jsx("span",{"data-testid":s.ValueTest.apy,children:u.bps(e)}):t.jsx("span",{"data-testid":s.ValueTest.apy,children:t.jsx(a.CompoundAPY,{apy:e,tooltip:n,period:r})})}function x({data:e}){return e==null?t.jsx(i.NoValue,{}):t.jsx("span",{"data-testid":s.ValueTest.usd,children:m.formatMoney(e)})}function j({data:e}){return e===void 0?t.jsx(i.NoValue,{}):t.jsx("span",{"data-testid":s.ValueTest.leverage,children:`${d.formatLeverage(e)}x`})}function v({data:e}){return e===void 0?t.jsx(i.NoValue,{}):t.jsx("span",{"data-testid":s.ValueTest.utilization,children:u.bps(e)})}function _({data:e,debt:n}){if(e===void 0)return t.jsx(i.NoValue,{});const r=n===0n?void 0:e<1e4?"text-destructive":e<11e3?"text-warning":"text-success";return t.jsx("span",{"data-testid":s.ValueTest.healthFactor,className:p.cn(r),children:(e/1e4).toFixed(2)})}function h({data:e,token:n,showSymbol:r=!0}){if(e===void 0||n===void 0)return t.jsx(i.NoValue,{});const o=l.formatUnits(e,n.decimals);return t.jsxs("span",{"data-testid":s.ValueTest.tokenBigint,title:`${o} ${n.symbol}`,children:[t.jsx(c.SimpleTooltip,{placement:"top",className:"break-all",title:t.jsx("span",{children:V.formatAssetAmount(e,n.decimals)}),children:t.jsx("span",{children:o})}),r&&` ${n.symbol}`]})}exports.ApyValue=f;exports.HealthFactorValue=_;exports.LeverageValue=j;exports.TokenBigint=h;exports.UsdValue=x;exports.UtilizationValue=v;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
2
2
|
import { formatUnits as u } from "viem";
|
|
3
3
|
import { CompoundAPY as p } from "../../compound-apy/compound-apy.js";
|
|
4
|
-
import { NoValue as
|
|
4
|
+
import { NoValue as o } from "../../no-value/no-value.js";
|
|
5
5
|
import { SimpleTooltip as a } from "../../tooltip/simple-tooltip.js";
|
|
6
6
|
import "../../tooltip/tooltip.js";
|
|
7
7
|
import { cn as f } from "../../../utils/cn.js";
|
|
@@ -15,40 +15,41 @@ import { ValueTest as i } from "./constants.js";
|
|
|
15
15
|
function B({
|
|
16
16
|
data: t,
|
|
17
17
|
tooltip: e = !0,
|
|
18
|
-
period:
|
|
18
|
+
period: n
|
|
19
19
|
}) {
|
|
20
|
-
return t === void 0 ? /* @__PURE__ */ r(
|
|
20
|
+
return t === void 0 ? /* @__PURE__ */ r(o, { reason: n }) : typeof t == "number" ? /* @__PURE__ */ r("span", { "data-testid": i.apy, children: m(t) }) : /* @__PURE__ */ r("span", { "data-testid": i.apy, children: /* @__PURE__ */ r(p, { apy: t, tooltip: e, period: n }) });
|
|
21
21
|
}
|
|
22
22
|
function L({
|
|
23
23
|
data: t
|
|
24
24
|
}) {
|
|
25
|
-
return t == null ? /* @__PURE__ */ r(
|
|
25
|
+
return t == null ? /* @__PURE__ */ r(o, {}) : /* @__PURE__ */ r("span", { "data-testid": i.usd, children: d(t) });
|
|
26
26
|
}
|
|
27
27
|
function w({
|
|
28
28
|
data: t
|
|
29
29
|
}) {
|
|
30
|
-
return t === void 0 ? /* @__PURE__ */ r(
|
|
30
|
+
return t === void 0 ? /* @__PURE__ */ r(o, {}) : /* @__PURE__ */ r("span", { "data-testid": i.leverage, children: `${c(t)}x` });
|
|
31
31
|
}
|
|
32
32
|
function C({
|
|
33
33
|
data: t
|
|
34
34
|
}) {
|
|
35
|
-
return t === void 0 ? /* @__PURE__ */ r(
|
|
35
|
+
return t === void 0 ? /* @__PURE__ */ r(o, {}) : /* @__PURE__ */ r("span", { "data-testid": i.utilization, children: m(t) });
|
|
36
36
|
}
|
|
37
37
|
function H({
|
|
38
|
-
data: t
|
|
38
|
+
data: t,
|
|
39
|
+
debt: e
|
|
39
40
|
}) {
|
|
40
41
|
if (t === void 0)
|
|
41
|
-
return /* @__PURE__ */ r(
|
|
42
|
-
const
|
|
43
|
-
return /* @__PURE__ */ r("span", { "data-testid": i.healthFactor, className: f(
|
|
42
|
+
return /* @__PURE__ */ r(o, {});
|
|
43
|
+
const n = e === 0n ? void 0 : t < 1e4 ? "text-destructive" : t < 11e3 ? "text-warning" : "text-success";
|
|
44
|
+
return /* @__PURE__ */ r("span", { "data-testid": i.healthFactor, className: f(n), children: (t / 1e4).toFixed(2) });
|
|
44
45
|
}
|
|
45
46
|
function M({
|
|
46
47
|
data: t,
|
|
47
48
|
token: e,
|
|
48
|
-
showSymbol:
|
|
49
|
+
showSymbol: n = !0
|
|
49
50
|
}) {
|
|
50
51
|
if (t === void 0 || e === void 0)
|
|
51
|
-
return /* @__PURE__ */ r(
|
|
52
|
+
return /* @__PURE__ */ r(o, {});
|
|
52
53
|
const s = u(t, e.decimals);
|
|
53
54
|
return (
|
|
54
55
|
// `title` also keeps the amount where a hover tooltip cannot reach:
|
|
@@ -64,7 +65,7 @@ function M({
|
|
|
64
65
|
children: /* @__PURE__ */ r("span", { children: s })
|
|
65
66
|
}
|
|
66
67
|
),
|
|
67
|
-
|
|
68
|
+
n && ` ${e.symbol}`
|
|
68
69
|
] })
|
|
69
70
|
);
|
|
70
71
|
}
|
|
@@ -36,9 +36,19 @@ export declare function LeverageValue({ data, }: {
|
|
|
36
36
|
export declare function UtilizationValue({ data, }: {
|
|
37
37
|
readonly data: Bps | undefined;
|
|
38
38
|
}): React.ReactElement;
|
|
39
|
-
/**
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Health factor with its zone: below 1 the account is liquidatable.
|
|
41
|
+
*
|
|
42
|
+
* Pass `debt` wherever a repaid account can reach this: with nothing to
|
|
43
|
+
* liquidate the figure has no zone, and the SDK reports one that would read as
|
|
44
|
+
* the worst there is — `0` bps from the on-chain `MAX_UINT256` sentinel, or
|
|
45
|
+
* `65535` down the price-failed path. The figure still shows; only the colour
|
|
46
|
+
* goes. ({@link HealthFactor}, the block, takes the same prop and answers
|
|
47
|
+
* "N/A" instead — a table cell that blanks out loses its column's alignment.)
|
|
48
|
+
*/
|
|
49
|
+
export declare function HealthFactorValue({ data, debt, }: {
|
|
41
50
|
readonly data: Bps | undefined;
|
|
51
|
+
readonly debt?: bigint;
|
|
42
52
|
}): React.ReactElement;
|
|
43
53
|
/**
|
|
44
54
|
* A bare `bigint` in token units (simulate previews carry these): the only
|