@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"),q=require("class-variance-authority"),o=require("react"),V=require("../../utils/cn.cjs"),D=require("./graph.cjs");function L(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,i.get?i:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const A=L(o),k=q.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=A.forwardRef(({className:t,variant:s,size:a,padding:i,title:n,description:r,toolbar:l,loading:c=!1,emptyMessage:d,error:u,children:f,...p},v)=>{const m=n||r||l;return e.jsxs("div",{ref:v,className:V.cn("flex flex-col",k({variant:s,size:a,padding:i,className:t})),...p,children:[m&&e.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4 shrink-0",children:[(n||r)&&e.jsxs("div",{className:"flex-1",children:[n&&e.jsx("h3",{className:"text-base sm:text-lg font-semibold leading-none tracking-tight",children:n}),r&&e.jsx("p",{className:"mt-1 text-xs sm:text-sm text-muted-foreground",children:r})]}),l&&e.jsx("div",{className:"shrink-0 w-full",children:l})]}),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.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),e.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:"Loading..."})]})}),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:V.cn("w-full h-full transition-[filter] duration-300 delay-300",c&&"blur-sm pointer-events-none"),children:!u&&f})]})]})});j.displayName="GraphView";function H({series:t,data:s,lineColor:a,color:i,topColor:n,bottomColor:r,graphId:l,onUnselectSeries:c,loading:d,title:u,description:f,toolbar:p,emptyMessage:v="No data available",error:m,containerClassName:R,variant:G,size:W,padding:S,yMeasureUnit:g,showCurrentValue:b,...O}){const h=o.useMemo(()=>{if(t&&t.length>0)return t;if(s&&s.length>0){const y=a??i;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},...n&&{topColor:n},...r&&{bottomColor:r}}]}return[]},[t,s,g,a,i,n,r]),z=!d&&h.length===0,N=o.useRef(h);h.length>0&&(N.current=h);const w=d&&h.length===0?N.current:h,_=w.length>0;return e.jsx(j,{className:R,variant:G,size:W,padding:S,title:u,description:f,toolbar:p,loading:d,error:m,emptyMessage:z?v:void 0,children:_&&!m&&e.jsx(D.Graph,{series:w,yMeasureUnit:g,...c?{onUnselectSeries:c}:{},...b!==void 0?{showCurrentValue:b}:{},...O})})}function M(t=0){const s=o.useRef(null),a=o.useRef(null),[i,n]=o.useState(null);return o.useEffect(()=>{const r=()=>{if(s.current&&a.current){const d=a.current.clientWidth,u=s.current.clientWidth;n(d-u-t)}},l=a.current,c=l?new ResizeObserver(r):null;return l&&c?.observe(l),()=>{l&&c?.unobserve(l)}},[t]),{graphWidth:i,parentRef:a,asideRef:s}}exports.GraphView=j;exports.GraphViewWithData=H;exports.graphViewVariants=k;exports.useGraphAside=M;
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 m, jsx as e } from "react/jsx-runtime";
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 I } from "./graph.js";
7
- const O = A(
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
- ), R = B.forwardRef(
38
+ ), y = B.forwardRef(
38
39
  ({
39
40
  className: n,
40
41
  variant: t,
41
42
  size: l,
42
- padding: o,
43
- title: a,
44
- description: r,
45
- toolbar: s,
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
- ...x
51
- }, p) => {
52
- const u = a || r || s;
53
- return /* @__PURE__ */ m(
51
+ ...p
52
+ }, x) => {
53
+ const u = r || s || a;
54
+ return /* @__PURE__ */ o(
54
55
  "div",
55
56
  {
56
- ref: p,
57
+ ref: x,
57
58
  className: j(
58
59
  "flex flex-col",
59
- O({ variant: t, size: l, padding: o, className: n })
60
+ q({ variant: t, size: l, padding: m, className: n })
60
61
  ),
61
- ...x,
62
+ ...p,
62
63
  children: [
63
- u && /* @__PURE__ */ m("div", { className: "mb-4 flex items-start justify-between gap-4 shrink-0", children: [
64
- (a || r) && /* @__PURE__ */ m("div", { className: "flex-1", children: [
65
- a && /* @__PURE__ */ e("h3", { className: "text-base sm:text-lg font-semibold leading-none tracking-tight", children: a }),
66
- r && /* @__PURE__ */ e("p", { className: "mt-1 text-xs sm:text-sm text-muted-foreground", children: r })
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
- s && /* @__PURE__ */ e("div", { className: "shrink-0 w-full", children: s })
69
+ a && /* @__PURE__ */ e("div", { className: "shrink-0 w-full", children: a })
69
70
  ] }),
70
- /* @__PURE__ */ m("div", { className: "relative flex-1 w-full min-h-0", children: [
71
- i && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-10 flex items-center justify-center opacity-0 animate-delayed-fade-in", children: /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-2", children: [
72
- /* @__PURE__ */ e("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }),
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__ */ m("div", { className: "flex flex-col items-center gap-2 text-muted-foreground", children: [
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
- R.displayName = "GraphView";
136
- function Q({
133
+ y.displayName = "GraphView";
134
+ function X({
137
135
  series: n,
138
136
  data: t,
139
137
  lineColor: l,
140
- color: o,
141
- topColor: a,
142
- bottomColor: r,
143
- graphId: s,
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: x,
149
- emptyMessage: p = "No data available",
146
+ toolbar: p,
147
+ emptyMessage: x = "No data available",
150
148
  error: u,
151
- containerClassName: V,
152
- variant: W,
153
- size: G,
154
- padding: z,
149
+ containerClassName: R,
150
+ variant: V,
151
+ size: z,
152
+ padding: G,
155
153
  yMeasureUnit: g,
156
- showCurrentValue: b,
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 y = l ?? o;
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
- ...y && { lineColor: y },
173
- ...a && { topColor: a },
174
- ...r && { bottomColor: r }
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, o, a, r]), H = !d && h.length === 0, w = N(h);
180
- h.length > 0 && (w.current = h);
181
- const k = d && h.length === 0 ? w.current : h, S = k.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
- R,
181
+ y,
184
182
  {
185
- className: V,
186
- variant: W,
187
- size: G,
188
- padding: z,
183
+ className: R,
184
+ variant: V,
185
+ size: z,
186
+ padding: G,
189
187
  title: c,
190
188
  description: f,
191
- toolbar: x,
189
+ toolbar: p,
192
190
  loading: d,
193
191
  error: u,
194
- emptyMessage: H ? p : void 0,
192
+ emptyMessage: H ? x : void 0,
195
193
  children: S && !u && /* @__PURE__ */ e(
196
- I,
194
+ O,
197
195
  {
198
196
  series: k,
199
197
  yMeasureUnit: g,
200
198
  ...i ? { onUnselectSeries: i } : {},
201
- ...b !== void 0 ? { showCurrentValue: b } : {},
199
+ ...w !== void 0 ? { showCurrentValue: w } : {},
202
200
  ...L
203
201
  }
204
202
  )
205
203
  }
206
204
  );
207
205
  }
208
- function T(n = 0) {
209
- const t = N(null), l = N(null), [o, a] = M(null);
206
+ function Y(n = 0) {
207
+ const t = N(null), l = N(null), [m, r] = M(null);
210
208
  return E(() => {
211
- const r = () => {
209
+ const s = () => {
212
210
  if (t.current && l.current) {
213
211
  const d = l.current.clientWidth, c = t.current.clientWidth;
214
- a(d - c - n);
212
+ r(d - c - n);
215
213
  }
216
- }, s = l.current, i = s ? new ResizeObserver(r) : null;
217
- return s && i?.observe(s), () => {
218
- s && i?.unobserve(s);
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: o, parentRef: l, asideRef: t };
218
+ }, [n]), { graphWidth: m, parentRef: l, asideRef: t };
221
219
  }
222
220
  export {
223
- R as GraphView,
224
- Q as GraphViewWithData,
225
- O as graphViewVariants,
226
- T as useGraphAside
221
+ y as GraphView,
222
+ X as GraphViewWithData,
223
+ q as graphViewVariants,
224
+ Y as useGraphAside
227
225
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/permissionless-ui",
3
- "version": "1.26.0",
3
+ "version": "1.26.1",
4
4
  "description": "Internal UI components",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/index.js",