@gearbox-protocol/permissionless-ui 1.15.3 → 1.15.4
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/block-sync/block-sync.cjs +1 -1
- package/dist/cjs/components/buttons/copy-button/copy-button.cjs +1 -1
- package/dist/cjs/components/detailed-page-title/detailed-page-title.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/layout/app-logo/app-logo.cjs +1 -1
- package/dist/cjs/components/liquidation/liquidation-assets-table/liquidation-assets-table.cjs +1 -1
- package/dist/cjs/components/liquidation/liquidation-graph/liquidation-graph.cjs +1 -1
- package/dist/cjs/components/next/index.cjs +1 -1
- package/dist/cjs/components/next/token-icon.cjs +1 -1
- package/dist/cjs/components/page-title/page-title.cjs +1 -1
- package/dist/cjs/components/select/select.cjs +1 -1
- package/dist/cjs/components/tab-control/tab-control.cjs +1 -1
- package/dist/cjs/components/table/grid-error-line.cjs +1 -1
- package/dist/cjs/components/token-icon/index.cjs +1 -1
- package/dist/cjs/components/token-icon/token-icon.cjs +1 -10
- package/dist/cjs/components/typed-intl/index.cjs +1 -1
- package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/utils/format-number.cjs +1 -1
- package/dist/esm/components/block-sync/block-sync.js +61 -54
- package/dist/esm/components/buttons/copy-button/copy-button.js +60 -27
- package/dist/esm/components/detailed-page-title/detailed-page-title.js +60 -37
- package/dist/esm/components/graph/graph.js +260 -301
- package/dist/esm/components/index.js +55 -54
- package/dist/esm/components/layout/app-logo/app-logo.js +4 -4
- package/dist/esm/components/layout/legal-disclaimer/legal-disclaimer.js +4 -1
- package/dist/esm/components/liquidation/liquidation-assets-table/liquidation-assets-table.js +24 -18
- package/dist/esm/components/liquidation/liquidation-graph/liquidation-graph.js +114 -100
- package/dist/esm/components/next/index.js +10 -8
- package/dist/esm/components/next/token-icon.js +4 -5
- package/dist/esm/components/page-title/page-title.js +1 -1
- package/dist/esm/components/select/select.js +7 -7
- package/dist/esm/components/tab-control/tab-control.js +24 -24
- package/dist/esm/components/table/grid-error-line.js +1 -1
- package/dist/esm/components/token-icon/index.js +3 -2
- package/dist/esm/components/token-icon/token-icon.js +42 -75
- package/dist/esm/components/typed-intl/index.js +13 -11
- package/dist/esm/components/with-copy/with-copy.js +52 -29
- package/dist/esm/index.js +169 -168
- package/dist/esm/utils/format-number.js +24 -21
- package/dist/globals.css +1 -1
- package/dist/types/components/buttons/copy-button/copy-button.d.ts +3 -2
- package/dist/types/components/detailed-page-title/detailed-page-title.d.ts +0 -1
- package/dist/types/components/layout/legal-disclaimer/legal-disclaimer.d.ts +1 -1
- package/dist/types/components/liquidation/liquidation-assets-table/liquidation-assets-table.d.ts +1 -1
- package/dist/types/components/next/index.d.ts +1 -0
- package/dist/types/components/next/token-icon.d.ts +2 -2
- package/dist/types/components/token-icon/index.d.ts +1 -1
- package/dist/types/components/token-icon/token-icon.d.ts +15 -3
- package/dist/types/components/typed-intl/index.d.ts +2 -1
- package/dist/types/components/with-copy/with-copy.d.ts +3 -3
- package/dist/types/utils/format-number.d.ts +0 -11
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=1e-10,S=1e-4,F=1e11;function c(t){const i=Math.abs(t);return i<10?4:i<100?2:1}function l(t){return t.replace(/\.?0+$/,"")}function g(t,i={}){const{format:e="full",minimumFractionDigits:o=0,maximumFractionDigits:f,maxExponentialThreshold:d=F,adaptiveDecimals:u=!1}=i,s=f!==void 0?f:e==="short"?1:0,a=Math.abs(t);if(e==="short"){if(a>=5e8){const r=t/1e9,n=u?c(r):s;return`${l(r.toFixed(n))}B`}if(a>=1e6){const r=t/1e6,n=u?c(r):s;return`${l(r.toFixed(n))}M`}if(a>=1e3){const r=t/1e3,n=u?c(r):s;return`${l(r.toFixed(n))}K`}}return d&&a>d?t.toExponential(2):new Intl.NumberFormat("en-US",{minimumFractionDigits:o,maximumFractionDigits:s}).format(t)}function h(t,i){const e=10**i;return(Math.floor(t*e)/e).toFixed(i).replace(/\.?0+$/,"")}function x(t){return Math.abs(t)<m}function D(t){const i=Math.abs(t);return i<m&&i>0}function b(t,i){if(!D(t))return null;const e=`<${S}`;return i?`${e}${i}`:e}const p={EPSILON:m,MIN_DISPLAY_THRESHOLD:S,MAX_EXPONENTIAL_THRESHOLD:F};function N(t,i=2,e=6){if(!Number.isFinite(t))return"∞";const o=1/10**i;return t<o&&t!==0?t.toFixed(e).replace(/\.?0+$/,""):t>1?new Intl.NumberFormat("en-US",{minimumFractionDigits:i,maximumFractionDigits:i}).format(t):t.toFixed(i)}exports.FORMAT_CONSTANTS=p;exports.formatNumberWithSuffix=g;exports.formatPrice=N;exports.formatSmallValue=b;exports.getAdaptiveDecimals=c;exports.isBelowDisplayThreshold=D;exports.isEffectivelyZero=x;exports.toSignificantDigits=h;
|
|
@@ -1,75 +1,82 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { TooltipProvider as
|
|
4
|
-
import { cn as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useEffect as w, useMemo as E } from "react";
|
|
3
|
+
import { TooltipProvider as j, Tooltip as U, TooltipTrigger as D, TooltipContent as L } from "../tooltip/tooltip.js";
|
|
4
|
+
import { cn as u } from "../../utils/cn.js";
|
|
5
|
+
const $ = 1e3 * 60 * 10;
|
|
6
|
+
function B({
|
|
7
7
|
blockByChain: s,
|
|
8
|
-
explorerAddresses:
|
|
9
|
-
networkById:
|
|
8
|
+
explorerAddresses: g,
|
|
9
|
+
networkById: h
|
|
10
10
|
}) {
|
|
11
|
-
const [i,
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
},
|
|
11
|
+
const [i, v] = b(Date.now());
|
|
12
|
+
w(() => {
|
|
13
|
+
const r = () => {
|
|
14
|
+
v(Date.now());
|
|
15
|
+
}, e = window.setInterval(r, 1e3);
|
|
16
16
|
return () => {
|
|
17
|
-
clearInterval(
|
|
17
|
+
clearInterval(e);
|
|
18
18
|
};
|
|
19
19
|
}, []);
|
|
20
|
-
const
|
|
20
|
+
const p = E(() => {
|
|
21
21
|
if (!s) return 0;
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
return
|
|
22
|
+
const r = Object.values(s).reduce((e, a) => {
|
|
23
|
+
const o = a.lastSyncBlock.localTimestamp;
|
|
24
|
+
return e === 0 || e !== 0 && o < e ? o : e;
|
|
25
25
|
}, 0);
|
|
26
|
-
return
|
|
27
|
-
}, [s, i]) >
|
|
28
|
-
/* @__PURE__ */
|
|
26
|
+
return r ? i - r : 0;
|
|
27
|
+
}, [s, i]) > $, m = () => /* @__PURE__ */ c("div", { className: "flex h-[30px] items-center gap-1.5", children: [
|
|
28
|
+
/* @__PURE__ */ t(
|
|
29
29
|
"span",
|
|
30
30
|
{
|
|
31
|
-
className:
|
|
31
|
+
className: u(
|
|
32
|
+
"text-sm leading-[17px]",
|
|
33
|
+
p ? "text-destructive" : "text-success"
|
|
34
|
+
),
|
|
32
35
|
children: "Status"
|
|
33
36
|
}
|
|
34
37
|
),
|
|
35
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ t(
|
|
36
39
|
"div",
|
|
37
40
|
{
|
|
38
|
-
className:
|
|
41
|
+
className: u(
|
|
39
42
|
"w-2 h-2 rounded-full",
|
|
40
|
-
|
|
43
|
+
p ? "bg-destructive" : "bg-success"
|
|
41
44
|
)
|
|
42
45
|
}
|
|
43
46
|
)
|
|
44
|
-
] }),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
(
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
47
|
+
] }), S = () => {
|
|
48
|
+
if (!s) return null;
|
|
49
|
+
const r = Object.entries(s);
|
|
50
|
+
return /* @__PURE__ */ t("div", { className: "flex flex-col text-left text-xs", children: r.map(([e, a], o) => {
|
|
51
|
+
const d = a.lastSyncBlock, l = d?.block || 0n, T = d?.localTimestamp ? i - d.localTimestamp : 0, n = g[Number(e)], f = typeof n == "string" ? n : n && typeof n == "object" && "url" in n ? n.url : void 0, N = h[Number(e)] || "Unknown", x = `[${l.toString()}]`, k = o === r.length - 1;
|
|
52
|
+
return /* @__PURE__ */ c("div", { className: u(!k && "mb-2"), children: [
|
|
53
|
+
/* @__PURE__ */ c("span", { children: [
|
|
54
|
+
N,
|
|
55
|
+
" "
|
|
56
|
+
] }),
|
|
57
|
+
f && l > 0 ? /* @__PURE__ */ t(
|
|
58
|
+
"a",
|
|
59
|
+
{
|
|
60
|
+
href: `${f}/block/${l}`,
|
|
61
|
+
target: "_blank",
|
|
62
|
+
rel: "noopener noreferrer",
|
|
63
|
+
className: "underline hover:text-foreground",
|
|
64
|
+
children: x
|
|
65
|
+
}
|
|
66
|
+
) : /* @__PURE__ */ t("span", { children: x }),
|
|
67
|
+
l > 0 && /* @__PURE__ */ c("span", { children: [
|
|
68
|
+
", updated ",
|
|
69
|
+
(T / 1e3).toFixed(0),
|
|
70
|
+
" seconds ago"
|
|
71
|
+
] })
|
|
72
|
+
] }, e);
|
|
73
|
+
}) });
|
|
74
|
+
};
|
|
75
|
+
return s ? /* @__PURE__ */ t(j, { children: /* @__PURE__ */ c(U, { children: [
|
|
76
|
+
/* @__PURE__ */ t(D, { asChild: !0, children: /* @__PURE__ */ t("div", { className: "cursor-help", children: m() }) }),
|
|
77
|
+
/* @__PURE__ */ t(L, { side: "top", collisionPadding: 8, children: S() })
|
|
78
|
+
] }) }) : m();
|
|
72
79
|
}
|
|
73
80
|
export {
|
|
74
|
-
|
|
81
|
+
B as BlockSync
|
|
75
82
|
};
|
|
@@ -1,31 +1,64 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Copy as
|
|
3
|
-
import * as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { cn as
|
|
6
|
-
import
|
|
1
|
+
import { jsxs as y, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Check as h, Copy as C } from "lucide-react";
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
import { Button as x } from "../button/button.js";
|
|
5
|
+
import { cn as a } from "../../../utils/cn.js";
|
|
6
|
+
import "sonner";
|
|
7
7
|
import "@gearbox-protocol/sdk";
|
|
8
|
-
const
|
|
9
|
-
3: "
|
|
10
|
-
"3.5": "
|
|
11
|
-
4: "
|
|
12
|
-
5: "
|
|
13
|
-
6: "
|
|
14
|
-
},
|
|
15
|
-
({ text:
|
|
16
|
-
s,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
const w = {
|
|
9
|
+
3: "h-3 w-3",
|
|
10
|
+
"3.5": "h-3.5 w-3.5",
|
|
11
|
+
4: "h-4 w-4",
|
|
12
|
+
5: "h-5 w-5",
|
|
13
|
+
6: "h-6 w-6"
|
|
14
|
+
}, N = r.forwardRef(
|
|
15
|
+
({ text: c, className: n, iconSize: l = "3.5", successDuration: p = 1500, ...m }, u) => {
|
|
16
|
+
const [t, s] = r.useState(!1), o = r.useRef(null), f = async () => {
|
|
17
|
+
try {
|
|
18
|
+
await navigator.clipboard.writeText(c), o.current && clearTimeout(o.current), s(!0), o.current = setTimeout(() => {
|
|
19
|
+
s(!1);
|
|
20
|
+
}, p);
|
|
21
|
+
} catch (d) {
|
|
22
|
+
console.error("Failed to copy:", d);
|
|
23
|
+
}
|
|
24
|
+
}, i = w[l];
|
|
25
|
+
return /* @__PURE__ */ y(
|
|
26
|
+
x,
|
|
27
|
+
{
|
|
28
|
+
ref: u,
|
|
29
|
+
variant: "text",
|
|
30
|
+
size: "auto",
|
|
31
|
+
className: a("p-1! border-0! relative", n),
|
|
32
|
+
onClick: f,
|
|
33
|
+
title: t ? "Copied!" : "Copy to clipboard",
|
|
34
|
+
...m,
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ e(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
className: a(
|
|
40
|
+
"absolute inset-0 flex items-center justify-center transition-all duration-200",
|
|
41
|
+
t ? "opacity-100 scale-100 text-green-500" : "opacity-0 scale-50 text-green-500"
|
|
42
|
+
),
|
|
43
|
+
children: /* @__PURE__ */ e(h, { className: i })
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ e(
|
|
47
|
+
"span",
|
|
48
|
+
{
|
|
49
|
+
className: a(
|
|
50
|
+
"flex items-center justify-center transition-all duration-200",
|
|
51
|
+
t ? "opacity-0 scale-50" : "opacity-100 scale-100"
|
|
52
|
+
),
|
|
53
|
+
children: /* @__PURE__ */ e(C, { className: i })
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
27
60
|
);
|
|
28
|
-
|
|
61
|
+
N.displayName = "CopyButton";
|
|
29
62
|
export {
|
|
30
|
-
|
|
63
|
+
N as CopyButton
|
|
31
64
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { Copy as
|
|
3
|
-
import * as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { DropdownMenu as
|
|
1
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { Check as g, Copy as y, ExternalLink as m } from "lucide-react";
|
|
3
|
+
import * as p from "react";
|
|
4
|
+
import { Button as d } from "../buttons/button/button.js";
|
|
5
|
+
import { DropdownMenu as w, DropdownMenuTrigger as N } from "../dropdown-menu/dropdown-menu.js";
|
|
6
6
|
import "../dropdown-menu/dropdown-menu-checkbox-item.js";
|
|
7
|
-
import { DropdownMenuContent as
|
|
8
|
-
import { DropdownMenuItem as
|
|
7
|
+
import { DropdownMenuContent as C } from "../dropdown-menu/dropdown-menu-content.js";
|
|
8
|
+
import { DropdownMenuItem as x } from "../dropdown-menu/dropdown-menu-item.js";
|
|
9
9
|
import "../dropdown-menu/dropdown-menu-label.js";
|
|
10
10
|
import "../dropdown-menu/dropdown-menu-radio-item.js";
|
|
11
11
|
import "../dropdown-menu/dropdown-menu-separator.js";
|
|
@@ -13,44 +13,67 @@ import "../dropdown-menu/dropdown-menu-shortcut.js";
|
|
|
13
13
|
import "../dropdown-menu/dropdown-menu-sub-content.js";
|
|
14
14
|
import "../dropdown-menu/dropdown-menu-sub-trigger.js";
|
|
15
15
|
import { PageTitle as b } from "../page-title/page-title.js";
|
|
16
|
-
import { TokenIcon as
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import { copyToClipboard as D } from "../../utils/copy.js";
|
|
16
|
+
import { TokenIcon as T } from "../token-icon/token-icon.js";
|
|
17
|
+
import { cn as s } from "../../utils/cn.js";
|
|
18
|
+
import "sonner";
|
|
20
19
|
import "@gearbox-protocol/sdk";
|
|
21
|
-
function
|
|
22
|
-
title:
|
|
23
|
-
token:
|
|
24
|
-
toCopy:
|
|
20
|
+
function H({
|
|
21
|
+
title: f,
|
|
22
|
+
token: l,
|
|
23
|
+
toCopy: i,
|
|
25
24
|
explorerLinks: o,
|
|
26
|
-
className:
|
|
25
|
+
className: u
|
|
27
26
|
}) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const [a, c] = p.useState(!1), n = p.useRef(null), h = async () => {
|
|
28
|
+
if (i)
|
|
29
|
+
try {
|
|
30
|
+
await navigator.clipboard.writeText(i), n.current && clearTimeout(n.current), c(!0), n.current = setTimeout(() => {
|
|
31
|
+
c(!1);
|
|
32
|
+
}, 1500);
|
|
33
|
+
} catch (t) {
|
|
34
|
+
console.error("Failed to copy:", t);
|
|
35
|
+
}
|
|
31
36
|
};
|
|
32
37
|
return /* @__PURE__ */ e(
|
|
33
38
|
b,
|
|
34
39
|
{
|
|
35
|
-
icon:
|
|
36
|
-
actions: /* @__PURE__ */
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
icon: l?.symbol && /* @__PURE__ */ e(T, { symbol: l.symbol, size: 36 }),
|
|
41
|
+
actions: /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
42
|
+
i && /* @__PURE__ */ r(
|
|
43
|
+
d,
|
|
39
44
|
{
|
|
40
45
|
variant: "ghost",
|
|
41
46
|
size: "icon",
|
|
42
|
-
onClick:
|
|
43
|
-
title: "Copy address",
|
|
44
|
-
className:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
onClick: h,
|
|
48
|
+
title: a ? "Copied!" : "Copy address",
|
|
49
|
+
className: "relative",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ e(
|
|
52
|
+
"span",
|
|
53
|
+
{
|
|
54
|
+
className: s(
|
|
55
|
+
"absolute inset-0 flex items-center justify-center transition-all duration-200",
|
|
56
|
+
a ? "opacity-100 scale-100 text-green-500" : "opacity-0 scale-50 text-green-500"
|
|
57
|
+
),
|
|
58
|
+
children: /* @__PURE__ */ e(g, { className: "h-4 w-4" })
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ e(
|
|
62
|
+
"span",
|
|
63
|
+
{
|
|
64
|
+
className: s(
|
|
65
|
+
"flex items-center justify-center transition-all duration-200",
|
|
66
|
+
a ? "opacity-0 scale-50" : "opacity-100 scale-100"
|
|
67
|
+
),
|
|
68
|
+
children: /* @__PURE__ */ e(y, { className: "h-4 w-4" })
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
]
|
|
49
72
|
}
|
|
50
73
|
),
|
|
51
|
-
o && o.length > 0 && /* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */ e(
|
|
53
|
-
/* @__PURE__ */ e(
|
|
74
|
+
o && o.length > 0 && /* @__PURE__ */ r(w, { children: [
|
|
75
|
+
/* @__PURE__ */ e(N, { asChild: !0, children: /* @__PURE__ */ e(d, { variant: "ghost", size: "icon", title: "View in explorer", children: /* @__PURE__ */ e(m, { className: "h-4 w-4" }) }) }),
|
|
76
|
+
/* @__PURE__ */ e(C, { align: "end", children: o.map((t) => /* @__PURE__ */ e(x, { asChild: !0, children: /* @__PURE__ */ r(
|
|
54
77
|
"a",
|
|
55
78
|
{
|
|
56
79
|
href: t.link,
|
|
@@ -59,17 +82,17 @@ function J({
|
|
|
59
82
|
className: "flex items-center gap-2",
|
|
60
83
|
children: [
|
|
61
84
|
t.label,
|
|
62
|
-
/* @__PURE__ */ e(
|
|
85
|
+
/* @__PURE__ */ e(m, { className: "h-3 w-3 ml-auto" })
|
|
63
86
|
]
|
|
64
87
|
}
|
|
65
88
|
) }, t.link)) })
|
|
66
89
|
] })
|
|
67
90
|
] }),
|
|
68
|
-
className:
|
|
69
|
-
children:
|
|
91
|
+
className: s(u),
|
|
92
|
+
children: f
|
|
70
93
|
}
|
|
71
94
|
);
|
|
72
95
|
}
|
|
73
96
|
export {
|
|
74
|
-
|
|
97
|
+
H as DetailedPageTitle
|
|
75
98
|
};
|