@gearbox-protocol/permissionless-ui 1.17.3 → 1.17.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/assets-ratio/assets-ratio.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/esm/components/assets-ratio/assets-ratio.js +64 -41
- package/dist/esm/components/graph/graph.js +167 -179
- package/dist/types/components/assets-ratio/assets-ratio.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),i=require("@gearbox-protocol/sdk"),h=require("react"),T=require("../tooltip/tooltip.cjs"),N=require("../../utils/cn.cjs");require("sonner");function j(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}return n.default=e,Object.freeze(n)}const O=j(h),R=e=>e.reduce((n,o)=>n+o.balanceInUSD,0n),P={0:"bg-[#4976FE]",1:"bg-[#FFE55A]",2:"bg-[#CA5AFF]"},g="bg-[#5ABAFF]",c=4;function F(e){const n=e.filter(t=>t>0);if(n.length===0)return e;const o=n.length*c;if(e.reduce((t,s)=>t+s,0)===0||!n.some(t=>t<c))return e;const E=100-o,l=n.filter(t=>t>c).reduce((t,s)=>t+s-c,0);return e.map(t=>{if(t===0)return 0;if(t<c)return c;if(l===0)return t;const s=t-c;return c+s/l*E})}function S({assets:e,labels:n,className:o}){const[a,b]=O.useMemo(()=>{const d=e.slice(0,3),r=R(e),m=R(e.slice(3)),p=d.map(_=>r>0?Number(_.balanceInUSD*i.PERCENTAGE_FACTOR*i.PERCENTAGE_DECIMALS/r)/Number(i.PERCENTAGE_FACTOR):Number(i.PERCENTAGE_FACTOR)),A=r>0n?Number(m*i.PERCENTAGE_FACTOR*i.PERCENTAGE_DECIMALS/r)/Number(i.PERCENTAGE_FACTOR):0,f=[...p,A],C=F(f);return[C.slice(0,3),C[3]||0]},[e]),E=b>0,l=n?.slice(3),t=l&&l.length>0?l.join(", "):void 0,s=(d,r,m,p,A)=>{const f=u.jsx("span",{className:N.cn("relative inline-flex h-full",m,p?"border-r-2 border-muted":""),style:{width:`${d}%`}});return A?u.jsxs(T.Tooltip,{children:[u.jsx(T.TooltipTrigger,{asChild:!0,children:f}),u.jsx(T.TooltipContent,{children:A})]},`tooltip-${r}-${e.length}`):f};return u.jsx(T.TooltipProvider,{children:u.jsxs("span",{className:N.cn("relative inline-flex overflow-hidden w-full h-[10px] bg-muted border-2 border-muted rounded-[20px]",o),children:[a.map((d,r,m)=>s(d,r,P[r]||g,E||r!==m.length-1,n?.[r])),E&&s(b,3,g,!1,t)]})})}exports.AssetsRatio=S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),fe=require("lightweight-charts"),s=require("react"),ge=require("../../hooks/use-media-query.cjs"),le=require("../../utils/cn.cjs"),B=require("../../utils/colors.cjs"),H=require("./default-config.cjs"),U=require("./formatters.cjs"),de=require("./graph-current-value.cjs"),he=require("./graph-tooltip.cjs"),me=require("./plugins/vertical-line.cjs");function pe(e){const w=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const m in e)if(m!=="default"){const T=Object.getOwnPropertyDescriptor(e,m);Object.defineProperty(w,m,T.get?T:{enumerable:!0,get:()=>e[m]})}}return w.default=e,Object.freeze(w)}const ee=pe(s),G=[{line:"#02c39a",top:"rgba(2, 195, 154, 0.56)",bottom:"rgba(2, 195, 154, 0.04)"},{line:"#3b82f6",top:"rgba(59, 130, 246, 0.56)",bottom:"rgba(59, 130, 246, 0.04)"},{line:"#f59e0b",top:"rgba(245, 158, 11, 0.56)",bottom:"rgba(245, 158, 11, 0.04)"},{line:"#ef4444",top:"rgba(239, 68, 68, 0.56)",bottom:"rgba(239, 68, 68, 0.04)"},{line:"#8b5cf6",top:"rgba(139, 92, 246, 0.56)",bottom:"rgba(139, 92, 246, 0.04)"},{line:"#ec4899",top:"rgba(236, 72, 153, 0.56)",bottom:"rgba(236, 72, 153, 0.04)"},{line:"#10b981",top:"rgba(16, 185, 129, 0.56)",bottom:"rgba(16, 185, 129, 0.04)"},{line:"#06b6d4",top:"rgba(6, 182, 212, 0.56)",bottom:"rgba(6, 182, 212, 0.04)"}];function be({series:e,className:w,showLegend:m=!1,onUnselectSeries:T,xMeasureUnit:P="time",yMeasureUnit:k="token",optionsOverrides:A,verticalLineOptions:D}){const y=s.useRef(null),v=s.useRef(new Map),$=s.useRef(!1),X=s.useRef(new Set),te=s.useRef(0),oe=s.useRef(!0),V=s.useRef(null),W=s.useRef(null),E=ge.useIsMobile(),M=ee.useMemo(()=>e.flatMap(t=>t.data),[e]),se=ee.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[re,Y]=s.useState(()=>{if(!se)return;const t=new Map;for(const r of e)r.data.length>0&&t.set(r.label,r.data[r.data.length-1]);return t}),[ne,L]=s.useState(null);s.useEffect(()=>{const t=()=>{if(y.current&&V.current){const u=V.current.clientWidth,a=V.current.clientHeight;y.current.resize(u,a),y.current.timeScale().fitContent()}},r=V.current,l=r?new ResizeObserver(t):null;return r&&l?.observe(r),()=>{r&&l?.unobserve(r)}},[]),s.useEffect(()=>{if(!W.current||$.current)return;const t=H.getDefaultOptions(),r=B.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)"),l=fe.createChart(W.current,{...t,rightPriceScale:{...t.rightPriceScale||{},visible:!E,textColor:r},...A});return y.current=l,$.current=!0,()=>{l.remove(),y.current=null,$.current=!1,v.current.clear()}},[E,A]),s.useEffect(()=>{const t=y.current;if(!t||e.length===0)return;const r=P==="time"?U.getXFormatter(P,M):U.getXFormatter(P),l=U.getYFormatter(k),u=H.getDefaultOptions();t.applyOptions({localization:{...u.localization||{},timeFormatter:r?(o=>r(parseFloat(o),void 0)):void 0},timeScale:{...u.timeScale||{},tickMarkFormatter:r?(o=>r(parseFloat(o),void 0)):void 0,minBarSpacing:0}});const g=(M.length>0?Math.min(...M.map(o=>o.value)):0)<0,S=M.some(o=>o.value===0),F=!g&&S,i=e.length>1,j=i||E,R=B.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");t.applyOptions({rightPriceScale:{...u.rightPriceScale||{},visible:!E,textColor:R,...F&&{scaleMargins:{top:.3,bottom:0}}}});const p=new Set(v.current.keys()),c=new Set(e.map(o=>o.label));for(const o of p)if(!c.has(o)){const n=v.current.get(o);n&&(t.removeSeries(n),v.current.delete(o))}const b=H.getDefaultSeries(),f=[];let C=0;for(let o=0;o<e.length;o++){const n=e[o],J=G[o%G.length],I=n.color||J.line;let _,N;if(n.color)if(n.topColor&&n.bottomColor)_=n.topColor,N=n.bottomColor;else if(n.topColor){const d=B.generateColorsFromBase(I);_=n.topColor,N=d.bottomColor}else if(n.bottomColor)_=B.generateColorsFromBase(I).topColor,N=n.bottomColor;else{const d=B.generateColorsFromBase(I);_=d.topColor,N=d.bottomColor}else _=n.topColor||J.top,N=n.bottomColor||J.bottom;if(n.data.length===0){const d=v.current.get(n.label);d&&(t.removeSeries(d),v.current.delete(n.label));continue}const ie=(n.data.length>0?Math.min(...n.data.map(d=>d.value)):0)<0,ce=n.data.some(d=>d.value===0),ue=!ie&&ce,K=i?C===0?void 0:`scale-${C}`:void 0;i&&f.push({priceScaleId:K||"right",shouldPreventNegativeAxis:ue,seriesIndex:C});let q=v.current.get(n.label);q?(q.applyOptions({lineColor:I,topColor:_,bottomColor:N,priceScaleId:K}),q.setData(n.data)):(q=t.addAreaSeries({...b,lineColor:I,topColor:_,bottomColor:N,priceScaleId:K,priceFormat:{type:"custom",formatter:d=>l(parseFloat(d.toString()),void 0,"short")}}),q.setData(n.data),v.current.set(n.label,q)),C++}if(i&&f.length>0)for(const o of f)try{const n=t.priceScale(o.priceScaleId);n&&n.applyOptions({visible:!j,autoScale:!0,scaleMargins:{top:.1,bottom:.1,...o.shouldPreventNegativeAxis&&{top:.3,bottom:0}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:R})}catch(n){console.warn(`Failed to configure price scale ${o.priceScaleId} for series ${o.seriesIndex}:`,n)}const x=new Set(e.map(o=>o.label)),O=x.size!==X.current.size||[...x].some(o=>!X.current.has(o)),Q=M.length!==te.current;(oe.current||O||Q||E)&&(t.timeScale().fitContent(),oe.current=!1),X.current=x,te.current=M.length;const z=new Map;for(const o of e)o.data.length>0&&z.set(o.label,o.data[o.data.length-1]);Y(z.size>0?z:void 0)},[e,M,P,k,E]),s.useEffect(()=>{const t=y.current;if(!t||e.length===0)return;const r=e.length===1;let l;for(const a of e)if(a.data.length>0){l=a.data[a.data.length-1].time;break}if(!l)return;const u=a=>{const{time:g=l,seriesData:S,point:F}=a||{},i=Array.from(v.current.values());if(!F||!g){const p=new Map;for(const c of e)c.data.length>0&&p.set(c.label,c.data[c.data.length-1]);if(Y(p.size>0?p:void 0),r)L(null);else if(i[0]&&l){const b=t.timeScale().timeToCoordinate(l),f=e[0];if(f.data.length>0){const C=f.data[f.data.length-1].value,x=i[0].priceToCoordinate(C);b!==null&&x!==null&&L({x:b,y:x})}}return}const j=new Map;let R;for(let p=0;p<e.length;p++){const c=e[p],b=i[p];if(!b)continue;const f=S?.get(b),C=f&&"value"in f?f.value:void 0,x=c.data[c.data.length-1],O=C!==void 0?C:x?.value??0;p===0&&(R=O),j.set(c.label,{value:O,time:g})}if(Y(j),R!==void 0&&i[0]){const c=t.timeScale().timeToCoordinate(g),b=i[0].priceToCoordinate(R);if(c!==null&&b!==null){const f=V.current;if(f){const C=f.querySelector(".LightweightChart");if(C){const x=C.getBoundingClientRect(),O=f.getBoundingClientRect(),Q=c+(x.left-O.left),z=b+(x.top-O.top);L({x:Q,y:z})}else L({x:c,y:b})}else L({x:c,y:b})}else L(null)}else L(null)};return t.subscribeCrosshairMove(u),r||requestAnimationFrame(()=>{const a=Array.from(v.current.values());if(a[0]&&l&&e[0]?.data.length>0){const S=t.timeScale().timeToCoordinate(l),F=e[0].data[e[0].data.length-1].value,i=a[0].priceToCoordinate(F);S!==null&&i!==null&&L({x:S,y:i})}}),()=>{t.unsubscribeCrosshairMove(u)}},[e]),s.useEffect(()=>{const t=y.current;if(!t||e.length===0)return;const r=t.timeScale(),l=Math.max(...e.map(a=>a.data.length)),u=()=>{if(l===0)return;const a=r.getVisibleLogicalRange();if(!a)return;const g={from:0,to:l-1},S=typeof a.from=="number"?a.from:0,F=typeof a.to=="number"?a.to:l-1,i=.01;let j=!1;const R={...a};S<g.from-i&&(R.from=g.from,j=!0),F>g.to+i&&(R.to=g.to,j=!0),j&&r.setVisibleLogicalRange(R)};return r.subscribeVisibleLogicalRangeChange(u),()=>{r.unsubscribeVisibleLogicalRangeChange(u)}},[e]),s.useEffect(()=>{const t=y.current,r=Array.from(v.current.values()),l=[];if(t&&r.length>0&&D){const u=H.getDefaultVerticalLine(),a=r[0];for(const g of D){const S=new me.VertLine(t,a,g.xCoordinate,{...u,...g.options||{}});a.attachPrimitive(S),l.push(S)}}return()=>{if(r.length>0){const u=r[0];for(const a of l)u.detachPrimitive(a)}}},[D]);const Z=e.length===1,ae=ee.useMemo(()=>{if(Z&&e.length>0){const t=e[0];if(t.data.length>0)return t.data[t.data.length-1]}},[Z,e]);return h.jsxs("div",{ref:V,className:le.cn("relative z-[1] w-full h-full overflow-hidden p-0",w),children:[Z&&ae&&h.jsx(de.GraphCurrentValue,{point:ae,xMeasureUnit:P,yMeasureUnit:k}),re&&ne&&h.jsx(he.GraphTooltip,{points:re,xMeasureUnit:P,yMeasureUnit:k,series:e,position:ne,containerRef:V}),m&&h.jsx(Ce,{series:e,onUnselect:T}),h.jsx("div",{ref:W,className:"LightweightChart w-full h-full overflow-hidden"})]})}function Ce({series:e,onUnselect:w}){return h.jsx("div",{className:"absolute top-0 left-2 z-[10] flex flex-wrap gap-2",children:e.map((m,T)=>{const P=G[T%G.length],k=m.color||P.line,A=m.data.length===0;return h.jsxs("div",{className:le.cn("flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",A&&"opacity-50"),children:[h.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:k}}),h.jsxs("span",{className:"text-[10px] sm:text-xs font-medium text-foreground",children:[m.label,A&&" (no data)"]}),w&&h.jsx("button",{type:"button",onClick:D=>{D.stopPropagation(),w(m.label)},className:"ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer","aria-label":`Remove ${m.label}`,children:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground hover:text-foreground","aria-hidden":"true",children:[h.jsx("title",{children:"Close"}),h.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),h.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},m.label)})})}exports.DEFAULT_SERIES_COLORS=G;exports.Graph=be;
|
|
@@ -1,56 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PERCENTAGE_FACTOR as
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
1
|
+
import { jsx as h, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { PERCENTAGE_FACTOR as m, PERCENTAGE_DECIMALS as N } from "@gearbox-protocol/sdk";
|
|
3
|
+
import * as P from "react";
|
|
4
|
+
import { TooltipProvider as R, Tooltip as _, TooltipTrigger as v, TooltipContent as x } from "../tooltip/tooltip.js";
|
|
5
|
+
import { cn as g } from "../../utils/cn.js";
|
|
5
6
|
import "sonner";
|
|
6
|
-
const
|
|
7
|
+
const C = (e) => e.reduce((n, i) => n + i.balanceInUSD, 0n), D = {
|
|
7
8
|
0: "bg-[#4976FE]",
|
|
8
9
|
1: "bg-[#FFE55A]",
|
|
9
10
|
2: "bg-[#CA5AFF]"
|
|
10
|
-
},
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
}, F = "bg-[#5ABAFF]", s = 4;
|
|
12
|
+
function L(e) {
|
|
13
|
+
const n = e.filter((t) => t > 0);
|
|
14
|
+
if (n.length === 0) return e;
|
|
15
|
+
const i = n.length * s;
|
|
16
|
+
if (e.reduce((t, o) => t + o, 0) === 0 || !n.some((t) => t < s)) return e;
|
|
17
|
+
const d = 100 - i, c = n.filter((t) => t > s).reduce((t, o) => t + o - s, 0);
|
|
18
|
+
return e.map((t) => {
|
|
19
|
+
if (t === 0) return 0;
|
|
20
|
+
if (t < s) return s;
|
|
21
|
+
if (c === 0) return t;
|
|
22
|
+
const o = t - s;
|
|
23
|
+
return s + o / c * d;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function G({
|
|
27
|
+
assets: e,
|
|
28
|
+
labels: n,
|
|
29
|
+
className: i
|
|
14
30
|
}) {
|
|
15
|
-
const [
|
|
16
|
-
const
|
|
17
|
-
(
|
|
18
|
-
|
|
19
|
-
) / Number(
|
|
20
|
-
),
|
|
21
|
-
return [
|
|
22
|
-
}, [
|
|
23
|
-
|
|
31
|
+
const [p, A] = P.useMemo(() => {
|
|
32
|
+
const l = e.slice(0, 3), r = C(e), u = C(e.slice(3)), b = l.map(
|
|
33
|
+
(I) => r > 0 ? Number(
|
|
34
|
+
I.balanceInUSD * m * N / r
|
|
35
|
+
) / Number(m) : Number(m)
|
|
36
|
+
), a = r > 0n ? Number(u * m * N / r) / Number(m) : 0, f = [...b, a], T = L(f);
|
|
37
|
+
return [T.slice(0, 3), T[3] || 0];
|
|
38
|
+
}, [e]), d = A > 0, c = n?.slice(3), t = c && c.length > 0 ? c.join(", ") : void 0, o = (l, r, u, b, a) => {
|
|
39
|
+
const f = /* @__PURE__ */ h(
|
|
40
|
+
"span",
|
|
41
|
+
{
|
|
42
|
+
className: g(
|
|
43
|
+
"relative inline-flex h-full",
|
|
44
|
+
u,
|
|
45
|
+
b ? "border-r-2 border-muted" : ""
|
|
46
|
+
),
|
|
47
|
+
style: { width: `${l}%` }
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
return a ? /* @__PURE__ */ E(_, { children: [
|
|
51
|
+
/* @__PURE__ */ h(v, { asChild: !0, children: f }),
|
|
52
|
+
/* @__PURE__ */ h(x, { children: a })
|
|
53
|
+
] }, `tooltip-${r}-${e.length}`) : f;
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ h(R, { children: /* @__PURE__ */ E(
|
|
24
56
|
"span",
|
|
25
57
|
{
|
|
26
|
-
className:
|
|
58
|
+
className: g(
|
|
27
59
|
"relative inline-flex overflow-hidden w-full h-[10px] bg-muted border-2 border-muted rounded-[20px]",
|
|
28
|
-
|
|
60
|
+
i
|
|
29
61
|
),
|
|
30
62
|
children: [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
`${n}-${e}-${t.length}`
|
|
42
|
-
)),
|
|
43
|
-
i && /* @__PURE__ */ a(
|
|
44
|
-
"span",
|
|
45
|
-
{
|
|
46
|
-
className: m("relative inline-flex h-full", p),
|
|
47
|
-
style: { width: `${c}%` }
|
|
48
|
-
}
|
|
49
|
-
)
|
|
63
|
+
p.map(
|
|
64
|
+
(l, r, u) => o(
|
|
65
|
+
l,
|
|
66
|
+
r,
|
|
67
|
+
D[r] || F,
|
|
68
|
+
d || r !== u.length - 1,
|
|
69
|
+
n?.[r]
|
|
70
|
+
)
|
|
71
|
+
),
|
|
72
|
+
d && o(A, 3, F, !1, t)
|
|
50
73
|
]
|
|
51
74
|
}
|
|
52
|
-
);
|
|
75
|
+
) });
|
|
53
76
|
}
|
|
54
77
|
export {
|
|
55
|
-
|
|
78
|
+
G as AssetsRatio
|
|
56
79
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createChart as
|
|
3
|
-
import * as
|
|
4
|
-
import { useRef as
|
|
5
|
-
import { useIsMobile as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { resolveCSSColor as
|
|
8
|
-
import { getDefaultOptions as
|
|
9
|
-
import { getXFormatter as
|
|
10
|
-
import { GraphCurrentValue as
|
|
11
|
-
import { GraphTooltip as
|
|
12
|
-
import { VertLine as
|
|
13
|
-
const
|
|
1
|
+
import { jsxs as H, jsx as S } from "react/jsx-runtime";
|
|
2
|
+
import { createChart as ht } from "lightweight-charts";
|
|
3
|
+
import * as U from "react";
|
|
4
|
+
import { useRef as L, useState as lt, useEffect as D } from "react";
|
|
5
|
+
import { useIsMobile as pt } from "../../hooks/use-media-query.js";
|
|
6
|
+
import { cn as ut } from "../../utils/cn.js";
|
|
7
|
+
import { resolveCSSColor as it, generateColorsFromBase as tt } from "../../utils/colors.js";
|
|
8
|
+
import { getDefaultOptions as st, getDefaultSeries as bt, getDefaultVerticalLine as vt } from "./default-config.js";
|
|
9
|
+
import { getXFormatter as ct, getYFormatter as Ct } from "./formatters.js";
|
|
10
|
+
import { GraphCurrentValue as St } from "./graph-current-value.js";
|
|
11
|
+
import { GraphTooltip as xt } from "./graph-tooltip.js";
|
|
12
|
+
import { VertLine as wt } from "./plugins/vertical-line.js";
|
|
13
|
+
const $ = [
|
|
14
14
|
{
|
|
15
15
|
line: "#02c39a",
|
|
16
16
|
top: "rgba(2, 195, 154, 0.56)",
|
|
@@ -52,78 +52,78 @@ const q = [
|
|
|
52
52
|
bottom: "rgba(6, 182, 212, 0.04)"
|
|
53
53
|
}
|
|
54
54
|
];
|
|
55
|
-
function
|
|
55
|
+
function Dt({
|
|
56
56
|
series: e,
|
|
57
|
-
className:
|
|
57
|
+
className: G,
|
|
58
58
|
showLegend: w = !1,
|
|
59
|
-
onUnselectSeries:
|
|
59
|
+
onUnselectSeries: q,
|
|
60
60
|
xMeasureUnit: y = "time",
|
|
61
61
|
yMeasureUnit: A = "token",
|
|
62
62
|
optionsOverrides: O,
|
|
63
63
|
verticalLineOptions: E
|
|
64
64
|
}) {
|
|
65
|
-
const
|
|
65
|
+
const x = L(null), p = L(/* @__PURE__ */ new Map()), W = L(!1), X = L(/* @__PURE__ */ new Set()), et = L(0), ot = L(!0), V = L(null), Y = L(null), z = pt(), M = U.useMemo(() => e.flatMap((t) => t.data), [e]), ft = U.useMemo(() => {
|
|
66
66
|
if (e.length > 0) {
|
|
67
67
|
const t = e[e.length - 1];
|
|
68
68
|
if (t.data.length > 0)
|
|
69
69
|
return t.data[t.data.length - 1];
|
|
70
70
|
}
|
|
71
|
-
}, [e]), [
|
|
72
|
-
if (!
|
|
71
|
+
}, [e]), [rt, Z] = lt(() => {
|
|
72
|
+
if (!ft) return;
|
|
73
73
|
const t = /* @__PURE__ */ new Map();
|
|
74
|
-
for (const
|
|
75
|
-
|
|
74
|
+
for (const r of e)
|
|
75
|
+
r.data.length > 0 && t.set(r.label, r.data[r.data.length - 1]);
|
|
76
76
|
return t;
|
|
77
|
-
}), [
|
|
77
|
+
}), [nt, R] = lt(null);
|
|
78
78
|
D(() => {
|
|
79
79
|
const t = () => {
|
|
80
|
-
if (
|
|
81
|
-
const c =
|
|
82
|
-
|
|
80
|
+
if (x.current && V.current) {
|
|
81
|
+
const c = V.current.clientWidth, a = V.current.clientHeight;
|
|
82
|
+
x.current.resize(c, a), x.current.timeScale().fitContent();
|
|
83
83
|
}
|
|
84
|
-
},
|
|
85
|
-
return
|
|
86
|
-
|
|
84
|
+
}, r = V.current, l = r ? new ResizeObserver(t) : null;
|
|
85
|
+
return r && l?.observe(r), () => {
|
|
86
|
+
r && l?.unobserve(r);
|
|
87
87
|
};
|
|
88
88
|
}, []), D(() => {
|
|
89
|
-
if (!Y.current ||
|
|
90
|
-
const t =
|
|
89
|
+
if (!Y.current || W.current) return;
|
|
90
|
+
const t = st(), r = it(
|
|
91
91
|
"hsl(var(--foreground))",
|
|
92
92
|
"rgb(0, 0, 0)"
|
|
93
|
-
), l =
|
|
93
|
+
), l = ht(Y.current, {
|
|
94
94
|
...t,
|
|
95
95
|
rightPriceScale: {
|
|
96
96
|
...t.rightPriceScale || {},
|
|
97
97
|
visible: !z,
|
|
98
|
-
textColor:
|
|
98
|
+
textColor: r
|
|
99
99
|
},
|
|
100
100
|
...O
|
|
101
101
|
});
|
|
102
|
-
return
|
|
103
|
-
l.remove(),
|
|
102
|
+
return x.current = l, W.current = !0, () => {
|
|
103
|
+
l.remove(), x.current = null, W.current = !1, p.current.clear();
|
|
104
104
|
};
|
|
105
105
|
}, [z, O]), D(() => {
|
|
106
|
-
const t =
|
|
106
|
+
const t = x.current;
|
|
107
107
|
if (!t || e.length === 0) return;
|
|
108
|
-
const
|
|
108
|
+
const r = y === "time" ? ct(y, M) : ct(y), l = Ct(A), c = st();
|
|
109
109
|
t.applyOptions({
|
|
110
110
|
localization: {
|
|
111
111
|
...c.localization || {},
|
|
112
|
-
timeFormatter:
|
|
112
|
+
timeFormatter: r ? (
|
|
113
113
|
// biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
|
|
114
|
-
((o) =>
|
|
114
|
+
((o) => r(parseFloat(o), void 0))
|
|
115
115
|
) : void 0
|
|
116
116
|
},
|
|
117
117
|
timeScale: {
|
|
118
118
|
...c.timeScale || {},
|
|
119
|
-
tickMarkFormatter:
|
|
119
|
+
tickMarkFormatter: r ? (
|
|
120
120
|
// biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
|
|
121
|
-
((o) =>
|
|
121
|
+
((o) => r(parseFloat(o), void 0))
|
|
122
122
|
) : void 0,
|
|
123
123
|
minBarSpacing: 0
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
|
-
const f = (
|
|
126
|
+
const f = (M.length > 0 ? Math.min(...M.map((o) => o.value)) : 0) < 0, b = M.some((o) => o.value === 0), F = !f && b, i = e.length > 1, P = i || z, C = it(
|
|
127
127
|
"hsl(var(--foreground))",
|
|
128
128
|
"rgb(0, 0, 0)"
|
|
129
129
|
);
|
|
@@ -131,8 +131,8 @@ function Bt({
|
|
|
131
131
|
rightPriceScale: {
|
|
132
132
|
...c.rightPriceScale || {},
|
|
133
133
|
visible: !z,
|
|
134
|
-
textColor:
|
|
135
|
-
...
|
|
134
|
+
textColor: C,
|
|
135
|
+
...F && {
|
|
136
136
|
scaleMargins: {
|
|
137
137
|
top: 0.3,
|
|
138
138
|
bottom: 0
|
|
@@ -140,65 +140,65 @@ function Bt({
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
|
-
const g = new Set(
|
|
143
|
+
const g = new Set(p.current.keys()), s = new Set(e.map((o) => o.label));
|
|
144
144
|
for (const o of g)
|
|
145
145
|
if (!s.has(o)) {
|
|
146
|
-
const
|
|
147
|
-
|
|
146
|
+
const n = p.current.get(o);
|
|
147
|
+
n && (t.removeSeries(n), p.current.delete(o));
|
|
148
148
|
}
|
|
149
|
-
const
|
|
150
|
-
let
|
|
149
|
+
const m = bt(), u = [];
|
|
150
|
+
let h = 0;
|
|
151
151
|
for (let o = 0; o < e.length; o++) {
|
|
152
|
-
const
|
|
153
|
-
let
|
|
154
|
-
if (
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
else if (
|
|
158
|
-
const d =
|
|
159
|
-
|
|
160
|
-
} else if (
|
|
161
|
-
|
|
152
|
+
const n = e[o], K = $[o % $.length], B = n.color || K.line;
|
|
153
|
+
let k, T;
|
|
154
|
+
if (n.color)
|
|
155
|
+
if (n.topColor && n.bottomColor)
|
|
156
|
+
k = n.topColor, T = n.bottomColor;
|
|
157
|
+
else if (n.topColor) {
|
|
158
|
+
const d = tt(B);
|
|
159
|
+
k = n.topColor, T = d.bottomColor;
|
|
160
|
+
} else if (n.bottomColor)
|
|
161
|
+
k = tt(B).topColor, T = n.bottomColor;
|
|
162
162
|
else {
|
|
163
|
-
const d =
|
|
164
|
-
|
|
163
|
+
const d = tt(B);
|
|
164
|
+
k = d.topColor, T = d.bottomColor;
|
|
165
165
|
}
|
|
166
166
|
else
|
|
167
|
-
|
|
168
|
-
if (
|
|
169
|
-
const d =
|
|
170
|
-
d && (t.removeSeries(d),
|
|
167
|
+
k = n.topColor || K.top, T = n.bottomColor || K.bottom;
|
|
168
|
+
if (n.data.length === 0) {
|
|
169
|
+
const d = p.current.get(n.label);
|
|
170
|
+
d && (t.removeSeries(d), p.current.delete(n.label));
|
|
171
171
|
continue;
|
|
172
172
|
}
|
|
173
|
-
const
|
|
173
|
+
const dt = (n.data.length > 0 ? Math.min(...n.data.map((d) => d.value)) : 0) < 0, gt = n.data.some((d) => d.value === 0), mt = !dt && gt, Q = i ? h === 0 ? void 0 : `scale-${h}` : void 0;
|
|
174
174
|
i && u.push({
|
|
175
|
-
priceScaleId:
|
|
176
|
-
shouldPreventNegativeAxis:
|
|
177
|
-
seriesIndex:
|
|
175
|
+
priceScaleId: Q || "right",
|
|
176
|
+
shouldPreventNegativeAxis: mt,
|
|
177
|
+
seriesIndex: h
|
|
178
178
|
});
|
|
179
|
-
let I =
|
|
179
|
+
let I = p.current.get(n.label);
|
|
180
180
|
I ? (I.applyOptions({
|
|
181
|
-
lineColor:
|
|
182
|
-
topColor:
|
|
183
|
-
bottomColor:
|
|
184
|
-
priceScaleId:
|
|
185
|
-
}), I.setData(
|
|
186
|
-
...
|
|
187
|
-
lineColor:
|
|
188
|
-
topColor:
|
|
189
|
-
bottomColor:
|
|
190
|
-
priceScaleId:
|
|
181
|
+
lineColor: B,
|
|
182
|
+
topColor: k,
|
|
183
|
+
bottomColor: T,
|
|
184
|
+
priceScaleId: Q
|
|
185
|
+
}), I.setData(n.data)) : (I = t.addAreaSeries({
|
|
186
|
+
...m,
|
|
187
|
+
lineColor: B,
|
|
188
|
+
topColor: k,
|
|
189
|
+
bottomColor: T,
|
|
190
|
+
priceScaleId: Q,
|
|
191
191
|
priceFormat: {
|
|
192
192
|
type: "custom",
|
|
193
193
|
formatter: (d) => l(parseFloat(d.toString()), void 0, "short")
|
|
194
194
|
}
|
|
195
|
-
}), I.setData(
|
|
195
|
+
}), I.setData(n.data), p.current.set(n.label, I)), h++;
|
|
196
196
|
}
|
|
197
197
|
if (i && u.length > 0)
|
|
198
198
|
for (const o of u)
|
|
199
199
|
try {
|
|
200
|
-
const
|
|
201
|
-
|
|
200
|
+
const n = t.priceScale(o.priceScaleId);
|
|
201
|
+
n && n.applyOptions({
|
|
202
202
|
visible: !P,
|
|
203
203
|
autoScale: !0,
|
|
204
204
|
scaleMargins: {
|
|
@@ -213,36 +213,24 @@ function Bt({
|
|
|
213
213
|
borderVisible: !0,
|
|
214
214
|
borderColor: "rgba(224, 227, 235, 0.1)",
|
|
215
215
|
entireTextOnly: !1,
|
|
216
|
-
textColor:
|
|
216
|
+
textColor: C
|
|
217
217
|
});
|
|
218
|
-
} catch (
|
|
218
|
+
} catch (n) {
|
|
219
219
|
console.warn(
|
|
220
220
|
`Failed to configure price scale ${o.priceScaleId} for series ${o.seriesIndex}:`,
|
|
221
|
-
|
|
221
|
+
n
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
(r) => typeof r.time == "number" ? r.time : Number(r.time)
|
|
228
|
-
);
|
|
229
|
-
m = {
|
|
230
|
-
from: Math.min(...o),
|
|
231
|
-
to: Math.max(...o)
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
const R = new Set(e.map((o) => o.label)), G = ot.current, J = R.size !== G.size || [...R].some((o) => !G.has(o)), H = rt.current, gt = m && H && (m.from !== H.from || m.to !== H.to);
|
|
235
|
-
(nt.current || J || gt || !H || z) && (requestAnimationFrame(() => {
|
|
236
|
-
b.current && b.current.timeScale().fitContent();
|
|
237
|
-
}), nt.current = !1), ot.current = R, rt.current = m;
|
|
238
|
-
const K = /* @__PURE__ */ new Map();
|
|
224
|
+
const v = new Set(e.map((o) => o.label)), N = v.size !== X.current.size || [...v].some((o) => !X.current.has(o)), J = M.length !== et.current;
|
|
225
|
+
(ot.current || N || J || z) && (t.timeScale().fitContent(), ot.current = !1), X.current = v, et.current = M.length;
|
|
226
|
+
const j = /* @__PURE__ */ new Map();
|
|
239
227
|
for (const o of e)
|
|
240
|
-
o.data.length > 0 &&
|
|
241
|
-
Z(
|
|
242
|
-
}, [e,
|
|
243
|
-
const t =
|
|
228
|
+
o.data.length > 0 && j.set(o.label, o.data[o.data.length - 1]);
|
|
229
|
+
Z(j.size > 0 ? j : void 0);
|
|
230
|
+
}, [e, M, y, A, z]), D(() => {
|
|
231
|
+
const t = x.current;
|
|
244
232
|
if (!t || e.length === 0) return;
|
|
245
|
-
const
|
|
233
|
+
const r = e.length === 1;
|
|
246
234
|
let l;
|
|
247
235
|
for (const a of e)
|
|
248
236
|
if (a.data.length > 0) {
|
|
@@ -251,136 +239,136 @@ function Bt({
|
|
|
251
239
|
}
|
|
252
240
|
if (!l) return;
|
|
253
241
|
const c = (a) => {
|
|
254
|
-
const { time: f = l, seriesData:
|
|
255
|
-
if (!
|
|
242
|
+
const { time: f = l, seriesData: b, point: F } = a || {}, i = Array.from(p.current.values());
|
|
243
|
+
if (!F || !f) {
|
|
256
244
|
const g = /* @__PURE__ */ new Map();
|
|
257
245
|
for (const s of e)
|
|
258
246
|
s.data.length > 0 && g.set(s.label, s.data[s.data.length - 1]);
|
|
259
|
-
if (Z(g.size > 0 ? g : void 0),
|
|
260
|
-
|
|
247
|
+
if (Z(g.size > 0 ? g : void 0), r)
|
|
248
|
+
R(null);
|
|
261
249
|
else if (i[0] && l) {
|
|
262
|
-
const
|
|
250
|
+
const m = t.timeScale().timeToCoordinate(l), u = e[0];
|
|
263
251
|
if (u.data.length > 0) {
|
|
264
|
-
const
|
|
265
|
-
|
|
252
|
+
const h = u.data[u.data.length - 1].value, v = i[0].priceToCoordinate(h);
|
|
253
|
+
m !== null && v !== null && R({ x: m, y: v });
|
|
266
254
|
}
|
|
267
255
|
}
|
|
268
256
|
return;
|
|
269
257
|
}
|
|
270
258
|
const P = /* @__PURE__ */ new Map();
|
|
271
|
-
let
|
|
259
|
+
let C;
|
|
272
260
|
for (let g = 0; g < e.length; g++) {
|
|
273
|
-
const s = e[g],
|
|
274
|
-
if (!
|
|
275
|
-
const u =
|
|
276
|
-
g === 0 && (
|
|
261
|
+
const s = e[g], m = i[g];
|
|
262
|
+
if (!m) continue;
|
|
263
|
+
const u = b?.get(m), h = u && "value" in u ? u.value : void 0, v = s.data[s.data.length - 1], N = h !== void 0 ? h : v?.value ?? 0;
|
|
264
|
+
g === 0 && (C = N), P.set(s.label, { value: N, time: f });
|
|
277
265
|
}
|
|
278
|
-
if (Z(P),
|
|
279
|
-
const s = t.timeScale().timeToCoordinate(f),
|
|
280
|
-
if (s !== null &&
|
|
281
|
-
const u =
|
|
266
|
+
if (Z(P), C !== void 0 && i[0]) {
|
|
267
|
+
const s = t.timeScale().timeToCoordinate(f), m = i[0].priceToCoordinate(C);
|
|
268
|
+
if (s !== null && m !== null) {
|
|
269
|
+
const u = V.current;
|
|
282
270
|
if (u) {
|
|
283
|
-
const
|
|
271
|
+
const h = u.querySelector(
|
|
284
272
|
".LightweightChart"
|
|
285
273
|
);
|
|
286
|
-
if (
|
|
287
|
-
const
|
|
288
|
-
|
|
274
|
+
if (h) {
|
|
275
|
+
const v = h.getBoundingClientRect(), N = u.getBoundingClientRect(), J = s + (v.left - N.left), j = m + (v.top - N.top);
|
|
276
|
+
R({ x: J, y: j });
|
|
289
277
|
} else
|
|
290
|
-
|
|
278
|
+
R({ x: s, y: m });
|
|
291
279
|
} else
|
|
292
|
-
|
|
280
|
+
R({ x: s, y: m });
|
|
293
281
|
} else
|
|
294
|
-
|
|
282
|
+
R(null);
|
|
295
283
|
} else
|
|
296
|
-
|
|
284
|
+
R(null);
|
|
297
285
|
};
|
|
298
|
-
return t.subscribeCrosshairMove(c),
|
|
299
|
-
const a = Array.from(
|
|
286
|
+
return t.subscribeCrosshairMove(c), r || requestAnimationFrame(() => {
|
|
287
|
+
const a = Array.from(p.current.values());
|
|
300
288
|
if (a[0] && l && e[0]?.data.length > 0) {
|
|
301
|
-
const
|
|
302
|
-
|
|
289
|
+
const b = t.timeScale().timeToCoordinate(l), F = e[0].data[e[0].data.length - 1].value, i = a[0].priceToCoordinate(F);
|
|
290
|
+
b !== null && i !== null && R({ x: b, y: i });
|
|
303
291
|
}
|
|
304
292
|
}), () => {
|
|
305
293
|
t.unsubscribeCrosshairMove(c);
|
|
306
294
|
};
|
|
307
295
|
}, [e]), D(() => {
|
|
308
|
-
const t =
|
|
296
|
+
const t = x.current;
|
|
309
297
|
if (!t || e.length === 0) return;
|
|
310
|
-
const
|
|
298
|
+
const r = t.timeScale(), l = Math.max(...e.map((a) => a.data.length)), c = () => {
|
|
311
299
|
if (l === 0) return;
|
|
312
|
-
const a =
|
|
300
|
+
const a = r.getVisibleLogicalRange();
|
|
313
301
|
if (!a) return;
|
|
314
302
|
const f = {
|
|
315
303
|
from: 0,
|
|
316
304
|
to: l - 1
|
|
317
|
-
},
|
|
305
|
+
}, b = typeof a.from == "number" ? a.from : 0, F = typeof a.to == "number" ? a.to : l - 1, i = 0.01;
|
|
318
306
|
let P = !1;
|
|
319
|
-
const
|
|
320
|
-
|
|
307
|
+
const C = { ...a };
|
|
308
|
+
b < f.from - i && (C.from = f.from, P = !0), F > f.to + i && (C.to = f.to, P = !0), P && r.setVisibleLogicalRange(C);
|
|
321
309
|
};
|
|
322
|
-
return
|
|
323
|
-
|
|
310
|
+
return r.subscribeVisibleLogicalRangeChange(c), () => {
|
|
311
|
+
r.unsubscribeVisibleLogicalRangeChange(
|
|
324
312
|
c
|
|
325
313
|
);
|
|
326
314
|
};
|
|
327
315
|
}, [e]), D(() => {
|
|
328
|
-
const t =
|
|
329
|
-
if (t &&
|
|
330
|
-
const c =
|
|
316
|
+
const t = x.current, r = Array.from(p.current.values()), l = [];
|
|
317
|
+
if (t && r.length > 0 && E) {
|
|
318
|
+
const c = vt(), a = r[0];
|
|
331
319
|
for (const f of E) {
|
|
332
|
-
const
|
|
320
|
+
const b = new wt(t, a, f.xCoordinate, {
|
|
333
321
|
...c,
|
|
334
322
|
...f.options || {}
|
|
335
323
|
});
|
|
336
|
-
a.attachPrimitive(
|
|
324
|
+
a.attachPrimitive(b), l.push(b);
|
|
337
325
|
}
|
|
338
326
|
}
|
|
339
327
|
return () => {
|
|
340
|
-
if (
|
|
341
|
-
const c =
|
|
328
|
+
if (r.length > 0) {
|
|
329
|
+
const c = r[0];
|
|
342
330
|
for (const a of l)
|
|
343
331
|
c.detachPrimitive(a);
|
|
344
332
|
}
|
|
345
333
|
};
|
|
346
334
|
}, [E]);
|
|
347
|
-
const _ = e.length === 1,
|
|
335
|
+
const _ = e.length === 1, at = U.useMemo(() => {
|
|
348
336
|
if (_ && e.length > 0) {
|
|
349
337
|
const t = e[0];
|
|
350
338
|
if (t.data.length > 0)
|
|
351
339
|
return t.data[t.data.length - 1];
|
|
352
340
|
}
|
|
353
341
|
}, [_, e]);
|
|
354
|
-
return /* @__PURE__ */
|
|
342
|
+
return /* @__PURE__ */ H(
|
|
355
343
|
"div",
|
|
356
344
|
{
|
|
357
|
-
ref:
|
|
358
|
-
className:
|
|
345
|
+
ref: V,
|
|
346
|
+
className: ut(
|
|
359
347
|
"relative z-[1] w-full h-full overflow-hidden p-0",
|
|
360
|
-
|
|
348
|
+
G
|
|
361
349
|
),
|
|
362
350
|
children: [
|
|
363
|
-
_ &&
|
|
364
|
-
|
|
351
|
+
_ && at && /* @__PURE__ */ S(
|
|
352
|
+
St,
|
|
365
353
|
{
|
|
366
|
-
point:
|
|
354
|
+
point: at,
|
|
367
355
|
xMeasureUnit: y,
|
|
368
356
|
yMeasureUnit: A
|
|
369
357
|
}
|
|
370
358
|
),
|
|
371
|
-
|
|
372
|
-
|
|
359
|
+
rt && nt && /* @__PURE__ */ S(
|
|
360
|
+
xt,
|
|
373
361
|
{
|
|
374
|
-
points:
|
|
362
|
+
points: rt,
|
|
375
363
|
xMeasureUnit: y,
|
|
376
364
|
yMeasureUnit: A,
|
|
377
365
|
series: e,
|
|
378
|
-
position:
|
|
379
|
-
containerRef:
|
|
366
|
+
position: nt,
|
|
367
|
+
containerRef: V
|
|
380
368
|
}
|
|
381
369
|
),
|
|
382
|
-
w && /* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */
|
|
370
|
+
w && /* @__PURE__ */ S(yt, { series: e, onUnselect: q }),
|
|
371
|
+
/* @__PURE__ */ S(
|
|
384
372
|
"div",
|
|
385
373
|
{
|
|
386
374
|
ref: Y,
|
|
@@ -391,41 +379,41 @@ function Bt({
|
|
|
391
379
|
}
|
|
392
380
|
);
|
|
393
381
|
}
|
|
394
|
-
function
|
|
382
|
+
function yt({
|
|
395
383
|
series: e,
|
|
396
|
-
onUnselect:
|
|
384
|
+
onUnselect: G
|
|
397
385
|
}) {
|
|
398
|
-
return /* @__PURE__ */
|
|
399
|
-
const y = q
|
|
400
|
-
return /* @__PURE__ */
|
|
386
|
+
return /* @__PURE__ */ S("div", { className: "absolute top-0 left-2 z-[10] flex flex-wrap gap-2", children: e.map((w, q) => {
|
|
387
|
+
const y = $[q % $.length], A = w.color || y.line, O = w.data.length === 0;
|
|
388
|
+
return /* @__PURE__ */ H(
|
|
401
389
|
"div",
|
|
402
390
|
{
|
|
403
|
-
className:
|
|
391
|
+
className: ut(
|
|
404
392
|
"flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
|
|
405
393
|
O && "opacity-50"
|
|
406
394
|
),
|
|
407
395
|
children: [
|
|
408
|
-
/* @__PURE__ */
|
|
396
|
+
/* @__PURE__ */ S(
|
|
409
397
|
"div",
|
|
410
398
|
{
|
|
411
399
|
className: "w-3 h-3 rounded-sm",
|
|
412
400
|
style: { backgroundColor: A }
|
|
413
401
|
}
|
|
414
402
|
),
|
|
415
|
-
/* @__PURE__ */
|
|
403
|
+
/* @__PURE__ */ H("span", { className: "text-[10px] sm:text-xs font-medium text-foreground", children: [
|
|
416
404
|
w.label,
|
|
417
405
|
O && " (no data)"
|
|
418
406
|
] }),
|
|
419
|
-
|
|
407
|
+
G && /* @__PURE__ */ S(
|
|
420
408
|
"button",
|
|
421
409
|
{
|
|
422
410
|
type: "button",
|
|
423
411
|
onClick: (E) => {
|
|
424
|
-
E.stopPropagation(),
|
|
412
|
+
E.stopPropagation(), G(w.label);
|
|
425
413
|
},
|
|
426
414
|
className: "ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer",
|
|
427
415
|
"aria-label": `Remove ${w.label}`,
|
|
428
|
-
children: /* @__PURE__ */
|
|
416
|
+
children: /* @__PURE__ */ H(
|
|
429
417
|
"svg",
|
|
430
418
|
{
|
|
431
419
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -440,9 +428,9 @@ function Pt({
|
|
|
440
428
|
className: "text-muted-foreground hover:text-foreground",
|
|
441
429
|
"aria-hidden": "true",
|
|
442
430
|
children: [
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
/* @__PURE__ */
|
|
445
|
-
/* @__PURE__ */
|
|
431
|
+
/* @__PURE__ */ S("title", { children: "Close" }),
|
|
432
|
+
/* @__PURE__ */ S("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
433
|
+
/* @__PURE__ */ S("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
446
434
|
]
|
|
447
435
|
}
|
|
448
436
|
)
|
|
@@ -455,6 +443,6 @@ function Pt({
|
|
|
455
443
|
}) });
|
|
456
444
|
}
|
|
457
445
|
export {
|
|
458
|
-
|
|
459
|
-
|
|
446
|
+
$ as DEFAULT_SERIES_COLORS,
|
|
447
|
+
Dt as Graph
|
|
460
448
|
};
|
|
@@ -4,6 +4,8 @@ export interface AssetsRatioProps {
|
|
|
4
4
|
assets: Array<Asset & {
|
|
5
5
|
balanceInUSD: bigint;
|
|
6
6
|
}>;
|
|
7
|
+
/** Labels for tooltips (e.g., token symbols). Index corresponds to asset index */
|
|
8
|
+
labels?: string[];
|
|
7
9
|
className?: string;
|
|
8
10
|
}
|
|
9
|
-
export declare function AssetsRatio({ assets, className, }: AssetsRatioProps): React.ReactElement;
|
|
11
|
+
export declare function AssetsRatio({ assets, labels, className, }: AssetsRatioProps): React.ReactElement;
|