@gearbox-protocol/permissionless-ui 1.26.0 → 1.26.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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),O=require("class-variance-authority"),o=require("react"),q=require("../arc-loader/arc-loader.cjs"),k=require("../../utils/cn.cjs"),A=require("./graph.cjs");function D(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const l=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,l.get?l:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const H=D(o),V=O.cva("relative w-full overflow-hidden rounded-lg border-border border bg-card text-card-foreground",{variants:{variant:{default:"shadow",elevated:"shadow-lg",outlined:"border-2",ghost:"border-0 shadow-none"},size:{sm:"h-48 sm:h-64",default:"h-64 sm:h-96",lg:"h-96 sm:h-[32rem]",xl:"h-[32rem] sm:h-[48rem]",full:"h-full"},padding:{none:"p-0",sm:"p-2",default:"p-4 sm:p-6",lg:"p-6"}},defaultVariants:{variant:"default",size:"default",padding:"default"}}),j=H.forwardRef(({className:t,variant:s,size:a,padding:l,title:r,description:n,toolbar:i,loading:c=!1,emptyMessage:d,error:u,children:f,...p},v)=>{const m=r||n||i;return e.jsxs("div",{ref:v,className:k.cn("flex flex-col",V({variant:s,size:a,padding:l,className:t})),...p,children:[m&&e.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4 shrink-0",children:[(r||n)&&e.jsxs("div",{className:"flex-1",children:[r&&e.jsx("h3",{className:"text-base sm:text-lg font-semibold leading-none tracking-tight",children:r}),n&&e.jsx("p",{className:"mt-1 text-xs sm:text-sm text-muted-foreground",children:n})]}),i&&e.jsx("div",{className:"shrink-0 w-full",children:i})]}),e.jsxs("div",{className:"relative flex-1 w-full min-h-0",children:[c&&e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center opacity-0 animate-delayed-fade-in",children:e.jsx("div",{className:"flex flex-col items-center gap-2",children:e.jsx(q.ArcLoader,{size:32,strokeWidth:3})})}),u&&e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx("svg",{className:"h-12 w-12",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:u})]})}),!u&&!f&&d&&e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("svg",{className:"h-12 w-12",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})}),e.jsx("span",{className:"text-xs sm:text-sm",children:d})]})}),e.jsx("div",{className:k.cn("w-full h-full transition-[filter] duration-300 delay-300",c&&"blur-sm pointer-events-none"),children:!u&&f})]})]})});j.displayName="GraphView";function M({series:t,data:s,lineColor:a,color:l,topColor:r,bottomColor:n,graphId:i,onUnselectSeries:c,loading:d,title:u,description:f,toolbar:p,emptyMessage:v="No data available",error:m,containerClassName:R,variant:W,size:G,padding:S,yMeasureUnit:g,showCurrentValue:b,..._}){const h=o.useMemo(()=>{if(t&&t.length>0)return t;if(s&&s.length>0){const y=a??l;return[{data:s.map(x=>({time:typeof x.time=="number"?x.time:Number(x.time),value:x.value})),label:"Value",yMeasureUnit:g,...y&&{lineColor:y},...r&&{topColor:r},...n&&{bottomColor:n}}]}return[]},[t,s,g,a,l,r,n]),z=!d&&h.length===0,N=o.useRef(h);h.length>0&&(N.current=h);const w=d&&h.length===0?N.current:h,L=w.length>0;return e.jsx(j,{className:R,variant:W,size:G,padding:S,title:u,description:f,toolbar:p,loading:d,error:m,emptyMessage:z?v:void 0,children:L&&!m&&e.jsx(A.Graph,{series:w,yMeasureUnit:g,...c?{onUnselectSeries:c}:{},...b!==void 0?{showCurrentValue:b}:{},..._})})}function P(t=0){const s=o.useRef(null),a=o.useRef(null),[l,r]=o.useState(null);return o.useEffect(()=>{const n=()=>{if(s.current&&a.current){const d=a.current.clientWidth,u=s.current.clientWidth;r(d-u-t)}},i=a.current,c=i?new ResizeObserver(n):null;return i&&c?.observe(i),()=>{i&&c?.unobserve(i)}},[t]),{graphWidth:l,parentRef:a,asideRef:s}}exports.GraphView=j;exports.GraphViewWithData=M;exports.graphViewVariants=V;exports.useGraphAside=P;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { cva as A } from "class-variance-authority";
|
|
3
3
|
import * as B from "react";
|
|
4
4
|
import { useMemo as D, useRef as N, useState as M, useEffect as E } from "react";
|
|
5
|
+
import { ArcLoader as I } from "../arc-loader/arc-loader.js";
|
|
5
6
|
import { cn as j } from "../../utils/cn.js";
|
|
6
|
-
import { Graph as
|
|
7
|
-
const
|
|
7
|
+
import { Graph as O } from "./graph.js";
|
|
8
|
+
const q = A(
|
|
8
9
|
"relative w-full overflow-hidden rounded-lg border-border border bg-card text-card-foreground",
|
|
9
10
|
{
|
|
10
11
|
variants: {
|
|
@@ -34,45 +35,42 @@ const O = A(
|
|
|
34
35
|
padding: "default"
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
),
|
|
38
|
+
), y = B.forwardRef(
|
|
38
39
|
({
|
|
39
40
|
className: n,
|
|
40
41
|
variant: t,
|
|
41
42
|
size: l,
|
|
42
|
-
padding:
|
|
43
|
-
title:
|
|
44
|
-
description:
|
|
45
|
-
toolbar:
|
|
43
|
+
padding: m,
|
|
44
|
+
title: r,
|
|
45
|
+
description: s,
|
|
46
|
+
toolbar: a,
|
|
46
47
|
loading: i = !1,
|
|
47
48
|
emptyMessage: d,
|
|
48
49
|
error: c,
|
|
49
50
|
children: f,
|
|
50
|
-
...
|
|
51
|
-
},
|
|
52
|
-
const u =
|
|
53
|
-
return /* @__PURE__ */
|
|
51
|
+
...p
|
|
52
|
+
}, x) => {
|
|
53
|
+
const u = r || s || a;
|
|
54
|
+
return /* @__PURE__ */ o(
|
|
54
55
|
"div",
|
|
55
56
|
{
|
|
56
|
-
ref:
|
|
57
|
+
ref: x,
|
|
57
58
|
className: j(
|
|
58
59
|
"flex flex-col",
|
|
59
|
-
|
|
60
|
+
q({ variant: t, size: l, padding: m, className: n })
|
|
60
61
|
),
|
|
61
|
-
...
|
|
62
|
+
...p,
|
|
62
63
|
children: [
|
|
63
|
-
u && /* @__PURE__ */
|
|
64
|
-
(
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
u && /* @__PURE__ */ o("div", { className: "mb-4 flex items-start justify-between gap-4 shrink-0", children: [
|
|
65
|
+
(r || s) && /* @__PURE__ */ o("div", { className: "flex-1", children: [
|
|
66
|
+
r && /* @__PURE__ */ e("h3", { className: "text-base sm:text-lg font-semibold leading-none tracking-tight", children: r }),
|
|
67
|
+
s && /* @__PURE__ */ e("p", { className: "mt-1 text-xs sm:text-sm text-muted-foreground", children: s })
|
|
67
68
|
] }),
|
|
68
|
-
|
|
69
|
+
a && /* @__PURE__ */ e("div", { className: "shrink-0 w-full", children: a })
|
|
69
70
|
] }),
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
i && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-10 flex items-center justify-center opacity-0 animate-delayed-fade-in", children: /* @__PURE__ */
|
|
72
|
-
|
|
73
|
-
/* @__PURE__ */ e("span", { className: "text-xs sm:text-sm text-muted-foreground", children: "Loading..." })
|
|
74
|
-
] }) }),
|
|
75
|
-
c && /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-2 text-destructive", children: [
|
|
71
|
+
/* @__PURE__ */ o("div", { className: "relative flex-1 w-full min-h-0", children: [
|
|
72
|
+
i && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-10 flex items-center justify-center opacity-0 animate-delayed-fade-in", children: /* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-2", children: /* @__PURE__ */ e(I, { size: 32, strokeWidth: 3 }) }) }),
|
|
73
|
+
c && /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center gap-2 text-destructive", children: [
|
|
76
74
|
/* @__PURE__ */ e(
|
|
77
75
|
"svg",
|
|
78
76
|
{
|
|
@@ -94,7 +92,7 @@ const O = A(
|
|
|
94
92
|
),
|
|
95
93
|
/* @__PURE__ */ e("span", { className: "text-xs sm:text-sm font-medium", children: c })
|
|
96
94
|
] }) }),
|
|
97
|
-
!c && !f && d && /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */
|
|
95
|
+
!c && !f && d && /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center gap-2 text-muted-foreground", children: [
|
|
98
96
|
/* @__PURE__ */ e(
|
|
99
97
|
"svg",
|
|
100
98
|
{
|
|
@@ -132,35 +130,35 @@ const O = A(
|
|
|
132
130
|
);
|
|
133
131
|
}
|
|
134
132
|
);
|
|
135
|
-
|
|
136
|
-
function
|
|
133
|
+
y.displayName = "GraphView";
|
|
134
|
+
function X({
|
|
137
135
|
series: n,
|
|
138
136
|
data: t,
|
|
139
137
|
lineColor: l,
|
|
140
|
-
color:
|
|
141
|
-
topColor:
|
|
142
|
-
bottomColor:
|
|
143
|
-
graphId:
|
|
138
|
+
color: m,
|
|
139
|
+
topColor: r,
|
|
140
|
+
bottomColor: s,
|
|
141
|
+
graphId: a,
|
|
144
142
|
onUnselectSeries: i,
|
|
145
143
|
loading: d,
|
|
146
144
|
title: c,
|
|
147
145
|
description: f,
|
|
148
|
-
toolbar:
|
|
149
|
-
emptyMessage:
|
|
146
|
+
toolbar: p,
|
|
147
|
+
emptyMessage: x = "No data available",
|
|
150
148
|
error: u,
|
|
151
|
-
containerClassName:
|
|
152
|
-
variant:
|
|
153
|
-
size:
|
|
154
|
-
padding:
|
|
149
|
+
containerClassName: R,
|
|
150
|
+
variant: V,
|
|
151
|
+
size: z,
|
|
152
|
+
padding: G,
|
|
155
153
|
yMeasureUnit: g,
|
|
156
|
-
showCurrentValue:
|
|
154
|
+
showCurrentValue: w,
|
|
157
155
|
...L
|
|
158
156
|
}) {
|
|
159
157
|
const h = D(() => {
|
|
160
158
|
if (n && n.length > 0)
|
|
161
159
|
return n;
|
|
162
160
|
if (t && t.length > 0) {
|
|
163
|
-
const
|
|
161
|
+
const W = l ?? m;
|
|
164
162
|
return [
|
|
165
163
|
{
|
|
166
164
|
data: t.map((v) => ({
|
|
@@ -169,59 +167,59 @@ function Q({
|
|
|
169
167
|
})),
|
|
170
168
|
label: "Value",
|
|
171
169
|
yMeasureUnit: g,
|
|
172
|
-
...
|
|
173
|
-
...
|
|
174
|
-
...
|
|
170
|
+
...W && { lineColor: W },
|
|
171
|
+
...r && { topColor: r },
|
|
172
|
+
...s && { bottomColor: s }
|
|
175
173
|
}
|
|
176
174
|
];
|
|
177
175
|
}
|
|
178
176
|
return [];
|
|
179
|
-
}, [n, t, g, l,
|
|
180
|
-
h.length > 0 && (
|
|
181
|
-
const k = d && h.length === 0 ?
|
|
177
|
+
}, [n, t, g, l, m, r, s]), H = !d && h.length === 0, b = N(h);
|
|
178
|
+
h.length > 0 && (b.current = h);
|
|
179
|
+
const k = d && h.length === 0 ? b.current : h, S = k.length > 0;
|
|
182
180
|
return /* @__PURE__ */ e(
|
|
183
|
-
|
|
181
|
+
y,
|
|
184
182
|
{
|
|
185
|
-
className:
|
|
186
|
-
variant:
|
|
187
|
-
size:
|
|
188
|
-
padding:
|
|
183
|
+
className: R,
|
|
184
|
+
variant: V,
|
|
185
|
+
size: z,
|
|
186
|
+
padding: G,
|
|
189
187
|
title: c,
|
|
190
188
|
description: f,
|
|
191
|
-
toolbar:
|
|
189
|
+
toolbar: p,
|
|
192
190
|
loading: d,
|
|
193
191
|
error: u,
|
|
194
|
-
emptyMessage: H ?
|
|
192
|
+
emptyMessage: H ? x : void 0,
|
|
195
193
|
children: S && !u && /* @__PURE__ */ e(
|
|
196
|
-
|
|
194
|
+
O,
|
|
197
195
|
{
|
|
198
196
|
series: k,
|
|
199
197
|
yMeasureUnit: g,
|
|
200
198
|
...i ? { onUnselectSeries: i } : {},
|
|
201
|
-
...
|
|
199
|
+
...w !== void 0 ? { showCurrentValue: w } : {},
|
|
202
200
|
...L
|
|
203
201
|
}
|
|
204
202
|
)
|
|
205
203
|
}
|
|
206
204
|
);
|
|
207
205
|
}
|
|
208
|
-
function
|
|
209
|
-
const t = N(null), l = N(null), [
|
|
206
|
+
function Y(n = 0) {
|
|
207
|
+
const t = N(null), l = N(null), [m, r] = M(null);
|
|
210
208
|
return E(() => {
|
|
211
|
-
const
|
|
209
|
+
const s = () => {
|
|
212
210
|
if (t.current && l.current) {
|
|
213
211
|
const d = l.current.clientWidth, c = t.current.clientWidth;
|
|
214
|
-
|
|
212
|
+
r(d - c - n);
|
|
215
213
|
}
|
|
216
|
-
},
|
|
217
|
-
return
|
|
218
|
-
|
|
214
|
+
}, a = l.current, i = a ? new ResizeObserver(s) : null;
|
|
215
|
+
return a && i?.observe(a), () => {
|
|
216
|
+
a && i?.unobserve(a);
|
|
219
217
|
};
|
|
220
|
-
}, [n]), { graphWidth:
|
|
218
|
+
}, [n]), { graphWidth: m, parentRef: l, asideRef: t };
|
|
221
219
|
}
|
|
222
220
|
export {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
221
|
+
y as GraphView,
|
|
222
|
+
X as GraphViewWithData,
|
|
223
|
+
q as graphViewVariants,
|
|
224
|
+
Y as useGraphAside
|
|
227
225
|
};
|