@gearbox-protocol/permissionless-ui 1.17.2 → 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/asset-line/asset-line.cjs +1 -1
- package/dist/cjs/components/assets-ratio/assets-ratio.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/options-list/options-list.cjs +1 -1
- package/dist/cjs/components/table/grid-table.cjs +1 -1
- package/dist/cjs/components/table/table.cjs +1 -1
- package/dist/cjs/components/token-icon/token-icon.cjs +1 -1
- package/dist/cjs/components/token-symbol/token-symbol.cjs +1 -1
- package/dist/esm/components/asset-line/asset-line.js +40 -35
- package/dist/esm/components/assets-ratio/assets-ratio.js +64 -41
- package/dist/esm/components/graph/graph.js +167 -179
- package/dist/esm/components/options-list/options-list.js +13 -13
- package/dist/esm/components/table/grid-table.js +70 -59
- package/dist/esm/components/table/table.js +47 -44
- package/dist/esm/components/token-icon/token-icon.js +2 -2
- package/dist/esm/components/token-symbol/token-symbol.js +9 -9
- package/dist/globals.css +1 -1
- package/dist/types/components/asset-line/asset-line.d.ts +7 -0
- package/dist/types/components/assets-ratio/assets-ratio.d.ts +3 -1
- package/dist/types/components/token-icon/token-icon.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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"),R=require("react"),g=require("../description/description.cjs"),h=require("../short-string/short-string.cjs"),l=require("../table/grid-table.cjs"),w=require("../token-symbol/token-symbol.cjs"),p=require("../vspace/vspace.cjs"),L=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk");function A(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const C=A(R),G={default:24,sm:20,md:24,lg:28},x={default:0,sm:2,md:4,lg:4},S=C.forwardRef(({token:t,tokenLabel:s,tokenDescription:r,network:n,chainId:j,value:a,valueDescription:o,size:c="default",iconSize:b=c,gapSize:d=c,last:_,symbolMaxLength:q,descriptionMaxLength:y,onSelect:m,hideValue:u=!1,rounded:N=!0,className:T},O)=>{const i=s||t?.title,f=c==="md"?"default":c;return e.jsxs(l.GridTableRow,{ref:O,className:L.cn(m&&"cursor-pointer",T),onClick:m,cols:u?"1fr":"1fr 1fr",noRound:!N,last:_,children:[e.jsx(l.GridTableCell,{size:f,className:"text-left",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(w.TokenSymbol,{token:t,size:G[b],chainId:j,network:n}),e.jsxs("div",{className:"flex-1 min-w-0",children:[i&&e.jsx(h.ShortString,{maxLength:q,children:i}),i&&r&&e.jsx(p.VSpace,{height:x[d]}),r&&e.jsx(g.Description,{children:e.jsx(h.ShortString,{maxLength:y,showTooltip:!1,children:String(r)})})]})]})}),!u&&e.jsxs(l.GridTableCell,{size:f,className:"text-right",children:[a,a&&o&&e.jsx(p.VSpace,{height:x[d]}),o&&e.jsx(g.Description,{children:o})]})]})});S.displayName="AssetLine";exports.AssetLine=S;
|
|
@@ -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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),m=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),m=require("react"),f=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk");function b(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=b(m);function x({className:e,children:r,...t}){const l=i.Children.toArray(r).length,a=i.Children.map(r,(o,c)=>{if(i.isValidElement(o)){const u=c===0,d=c===l-1;return i.cloneElement(o,{first:u,last:d})}return o});return n.jsx("div",{className:f.cn("m-0 p-0 w-full flex flex-wrap",e),...t,children:a})}function p({icon:e,title:r,subTitle:t,onClick:s,endingIcon:l,last:a=!1,className:o}){return n.jsxs("button",{type:"button",onClick:s,className:f.cn("relative z-0 pt-5 px-4 flex flex-row items-start gap-4 w-full cursor-pointer text-left","before:absolute before:-z-10 before:left-0 before:hidden before:w-full before:inset-y-0 before:content-[''] before:bg-muted/50 before:rounded-lg","hover:before:block",!a&&"after:absolute after:bottom-0 after:inset-x-3 after:h-px after:content-[''] after:bg-border",o),children:[e&&n.jsx("div",{className:"w-6 h-6 text-muted-foreground flex items-center justify-center",children:e}),n.jsx("div",{className:"pb-5 flex-1 flex flex-col gap-2",children:n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("div",{className:"text-base leading-[1.2] font-medium",children:r}),t&&n.jsx("div",{className:"text-sm text-muted-foreground",children:t})]})}),l&&n.jsx("div",{className:"ml-4 text-muted-foreground transition-colors",children:l})]})}exports.OptionsItem=p;exports.OptionsList=x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),n=require("class-variance-authority"),_=require("react"),m=require("../layout/col/col.cjs"),p=require("../layout/grid/grid.cjs"),l=require("../../utils/cn.cjs");function z(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const d=z(_),T=n.cva("w-full",{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),y=d.forwardRef(({className:e,size:a,cols:t=12,gap:r=0,...i},o)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx(p.Grid,{ref:o,cols:t,gap:r,className:l.cn(T({size:a,className:e})),...i})}));y.displayName="GridTable";const g=d.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:l.cn("contents","[&>*>*]:after:absolute [&>*>*]:after:bottom-0 [&>*>*]:after:inset-x-0 [&>*>*]:after:h-px [&>*>*]:after:bg-border",e),...a}));g.displayName="GridTableHeader";const x=d.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:l.cn("contents [&>*:last-child>*]:after:hidden",e),...a}));x.displayName="GridTableBody";const G=d.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:l.cn("contents [&>*]:border-t [&>*]:bg-muted/50 [&>*]:font-medium",e),...a}));G.displayName="GridTableFooter";const j=d.forwardRef(({className:e,cols:a,gap:t=0,last:r,height:i,hideValue:o,noHover:w,noRound:b,style:R,...C},V)=>{const u=typeof i=="number"?`${i}px`:i;return s.jsx(p.Grid,{ref:V,cols:a,gap:t,className:l.cn("contents [&>*]:relative [&>*]:transition-colors data-[state=selected]:[&>*]:bg-muted","md:[&>*]:after:absolute md:[&>*]:after:bottom-0 md:[&>*]:after:inset-x-0 md:[&>*]:after:h-px md:[&>*]:after:bg-border",!b&&["md:[&>*:first-child]:after:left-3","md:[&>*:last-child]:after:right-3"],!w&&["[&>*]:z-0","[&>*]:before:absolute [&>*]:before:inset-0 [&>*]:before:-z-10 [&>*]:before:bg-muted/50 [&>*]:before:opacity-0 [&>*]:before:transition-opacity","hover:[&>*]:before:opacity-100",!b&&"[&>*:first-child]:before:rounded-l-lg [&>*:last-child]:before:rounded-r-lg"],r&&"md:[&>*]:after:hidden",o&&"[&>*]:opacity-0",e),style:{...R,...u?{height:u}:{}},...C})});j.displayName="GridTableRow";const h=n.cva("flex items-center justify-startborder-b text-left align-middle font-medium text-muted-foreground !bg-transparent",{variants:{size:{sm:"min-h-8 px-1 py-2 text-xs",default:"min-h-10 px-2 py-2.5",lg:"min-h-12 px-4 py-3"},justify:{start:"justify-start",center:"justify-center",end:"justify-end"}},defaultVariants:{size:"default",justify:"start"}}),c=d.forwardRef(({className:e,size:a,span:t=1,justify:r="start",...i},o)=>s.jsx(m.Col,{ref:o,span:t,className:l.cn(h({size:a,justify:r,className:e})),...i}));c.displayName="GridTableHead";const N=n.cva("align-middle",{variants:{size:{sm:"p-2",default:"p-4",lg:"p-6"},textAlign:{left:"text-left",center:"text-center",right:"text-right"}},defaultVariants:{size:"default"}}),f=d.forwardRef(({className:e,size:a,span:t=1,textAlign:r,...i},o)=>s.jsx(m.Col,{ref:o,span:t,className:l.cn(N({size:a,textAlign:r,className:e})),...i}));f.displayName="GridTableCell";const v=d.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:l.cn("col-span-full mt-4 text-sm text-muted-foreground",e),...a}));v.displayName="GridTableCaption";const H=f,q=c;exports.GridTable=y;exports.GridTableBody=x;exports.GridTableCaption=v;exports.GridTableCell=f;exports.GridTableFooter=G;exports.GridTableHead=c;exports.GridTableHeader=g;exports.GridTableRow=j;exports.Td=H;exports.Th=q;exports.gridTableCellVariants=N;exports.gridTableHeadVariants=h;exports.gridTableVariants=T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("class-variance-authority"),_=require("lucide-react"),C=require("react"),H=require("../buttons/button/button.cjs"),n=require("../tooltip/tooltip.cjs"),s=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk");function V(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const l=V(C),c=i.cva("w-full caption-bottom",{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),b=l.forwardRef(({className:e,size:a,...t},o)=>r.jsx("div",{className:"relative w-full overflow-auto rounded-lg border border-input bg-card",children:r.jsx("table",{ref:o,className:s.cn(c({size:a,className:e})),...t})}));b.displayName="Table";const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("class-variance-authority"),_=require("lucide-react"),C=require("react"),H=require("../buttons/button/button.cjs"),n=require("../tooltip/tooltip.cjs"),s=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk");function V(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const l=V(C),c=i.cva("w-full caption-bottom",{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),b=l.forwardRef(({className:e,size:a,...t},o)=>r.jsx("div",{className:"relative w-full overflow-auto rounded-lg border border-input bg-card",children:r.jsx("table",{ref:o,className:s.cn(c({size:a,className:e})),...t})}));b.displayName="Table";const f=l.forwardRef(({className:e,...a},t)=>r.jsx("thead",{ref:t,className:s.cn("[&_tr]:after:inset-x-0 [&_tr]:after:bg-input [&_tr]:hover:bg-transparent [&_tr]:hover:before:opacity-0",e),...a}));f.displayName="TableHeader";const u=l.forwardRef(({className:e,...a},t)=>r.jsx("tbody",{ref:t,className:s.cn("[&_tr:last-child]:after:hidden",e),...a}));u.displayName="TableBody";const m=l.forwardRef(({className:e,...a},t)=>r.jsx("tfoot",{ref:t,className:s.cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...a}));m.displayName="TableFooter";const p=l.forwardRef(({className:e,...a},t)=>r.jsx("tr",{ref:t,className:s.cn("relative transition-colors data-[state=selected]:bg-muted","before:absolute before:inset-0 before:-z-10 before:rounded-lg before:bg-muted/50 before:opacity-0 before:transition-opacity","hover:before:opacity-100","after:absolute after:bottom-0 after:inset-x-3 after:h-px after:bg-border",e),...a}));p.displayName="TableRow";const x=i.cva("border-b bg-muted/50 text-left align-middle font-medium text-muted-foreground border-input",{variants:{size:{sm:"h-8 px-1 text-xs",default:"h-10 px-2",lg:"h-12 px-4"}},defaultVariants:{size:"default"}}),d=l.forwardRef(({className:e,size:a,...t},o)=>r.jsx("th",{ref:o,className:s.cn(x({size:a,className:e})),...t}));d.displayName="TableHead";const g=i.cva("align-middle",{variants:{size:{sm:"p-1",default:"p-2",lg:"p-4"}},defaultVariants:{size:"default"}}),T=l.forwardRef(({className:e,size:a,...t},o)=>r.jsx("td",{ref:o,className:s.cn(g({size:a,className:e})),...t}));T.displayName="TableCell";const y=l.forwardRef(({className:e,...a},t)=>r.jsx("caption",{ref:t,className:s.cn("mt-4 text-sm text-muted-foreground",e),...a}));y.displayName="TableCaption";const h=l.forwardRef(({title:e,isSorted:a,direction:t,setSort:o,placement:j="right",children:v,className:w,...N},R)=>r.jsx(d,{ref:R,className:w,...N,children:r.jsx(n.TooltipProvider,{children:r.jsxs(n.Tooltip,{delayDuration:200,children:[r.jsx(n.TooltipTrigger,{asChild:!0,children:r.jsxs("div",{className:s.cn("group flex items-center gap-1 w-fit cursor-pointer hover:text-foreground",j==="left"?"flex-row-reverse":"flex-row"),onClick:()=>o(t==="asc"?"desc":"asc"),children:[v,r.jsx(H.Button,{variant:"text",size:"auto",className:a?void 0:"opacity-0 group-hover:opacity-100",children:r.jsx(_.ArrowDown,{className:s.cn("h-4 w-4",t==="desc"?"rotate-180":"","transition-transform duration-200 ease-in-out")})})]})}),r.jsxs(n.TooltipContent,{side:"top",children:["Sort by ",e]})]})})}));h.displayName="SortingTableHead";exports.SortingTableHead=h;exports.Table=b;exports.TableBody=u;exports.TableCaption=y;exports.TableCell=T;exports.TableFooter=m;exports.TableHead=d;exports.TableHeader=f;exports.TableRow=p;exports.tableCellVariants=g;exports.tableHeadVariants=x;exports.tableVariants=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),c=require("react"),p=require("../../utils/cn.cjs"),s="https://static.gearbox.fi/tokens/default.svg",i=new Set;function k(t){const e=t.replace("/","").replace(" ","").replace("-f","").replace("-","_").toLowerCase();if(!e)return s;const n=`https://static.gearbox.fi/tokens/${e}.svg`;return i.has(n)?s:n}function m({symbol:t,size:e=48,className:n}){const o=k(t),[r,l]=c.useState(o),[u,d]=c.useState(!1),a=c.useRef(!1),f=()=>{a.current||(a.current=!0,i.add(r),l(s))},g=()=>{d(!0)};return h.jsx("img",{src:r,alt:"",width:e,height:e,className:p.cn("object-contain
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),c=require("react"),p=require("../../utils/cn.cjs"),s="https://static.gearbox.fi/tokens/default.svg",i=new Set;function k(t){const e=t.replace("/","").replace(" ","").replace("-f","").replace("-","_").toLowerCase();if(!e)return s;const n=`https://static.gearbox.fi/tokens/${e}.svg`;return i.has(n)?s:n}function m({symbol:t,size:e=48,className:n}){const o=k(t),[r,l]=c.useState(o),[u,d]=c.useState(!1),a=c.useRef(!1),f=()=>{a.current||(a.current=!0,i.add(r),l(s))},g=()=>{d(!0)};return h.jsx("img",{src:r,alt:"",width:e,height:e,className:p.cn("object-contain",!u&&"bg-gray-200 dark:bg-gray-700 rounded-full",n),style:{width:e,height:e},onError:f,onLoad:g})}function b(t){t.forEach(e=>{const o=`https://static.gearbox.fi/tokens/${e.replace("/","").replace(" ","").replace("-f","").replace("-","_").toLowerCase()}.svg`,r=new window.Image;r.src=o})}exports.TokenIcon=m;exports.preloadTokenIcons=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("../token-icon/token-icon.cjs");require("react");const d=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk");function f(e){if(e)return typeof e=="string"?e:e.symbol}function x(e){if(e)return typeof e=="string"?e:e.title}function g({token:e,title:s,className:c,comment:r,showIcon:o=!0,showSymbol:l=!1,size:u=24,chainId:h,network:p,maxLength:y,...a}){const n=f(e),i=s||x(e);return t.jsxs("div",{className:d.cn("flex items-center gap-3",c),...a,children:[o&&n&&t.jsx(m.TokenIcon,{symbol:n,size:u,className:"shrink-0 self-center"}),l&&i&&t.jsxs("div",{className:"flex items-center gap-1 self-center",children:[t.jsx("div",{className:"text-xs sm:text-sm md:text-base font-medium truncate whitespace-pre-wrap leading-tight",children:i}),r&&t.jsxs("div",{className:"text-md text-muted-foreground leading-tight",children:["(",r,")"]})]})]})}exports.TokenSymbol=g;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import * as G from "react";
|
|
3
|
-
import { Description as
|
|
3
|
+
import { Description as n } from "../description/description.js";
|
|
4
4
|
import { ShortString as h } from "../short-string/short-string.js";
|
|
5
5
|
import { GridTableRow as I, GridTableCell as p } from "../table/grid-table.js";
|
|
6
|
-
import { TokenSymbol as
|
|
6
|
+
import { TokenSymbol as j } from "../token-symbol/token-symbol.js";
|
|
7
7
|
import { VSpace as g } from "../vspace/vspace.js";
|
|
8
|
-
import { cn as
|
|
8
|
+
import { cn as y } from "../../utils/cn.js";
|
|
9
9
|
import "sonner";
|
|
10
10
|
import "@gearbox-protocol/sdk";
|
|
11
|
-
const
|
|
11
|
+
const E = {
|
|
12
12
|
default: 24,
|
|
13
13
|
sm: 20,
|
|
14
14
|
md: 24,
|
|
@@ -18,66 +18,71 @@ const y = {
|
|
|
18
18
|
sm: 2,
|
|
19
19
|
md: 4,
|
|
20
20
|
lg: 4
|
|
21
|
-
},
|
|
21
|
+
}, Z = G.forwardRef(
|
|
22
22
|
({
|
|
23
|
-
token:
|
|
23
|
+
token: i,
|
|
24
24
|
tokenLabel: S,
|
|
25
|
-
tokenDescription:
|
|
25
|
+
tokenDescription: l,
|
|
26
26
|
network: N,
|
|
27
27
|
chainId: b,
|
|
28
28
|
value: s,
|
|
29
|
-
valueDescription:
|
|
29
|
+
valueDescription: m,
|
|
30
30
|
size: e = "default",
|
|
31
31
|
iconSize: u = e,
|
|
32
|
-
gapSize:
|
|
33
|
-
last:
|
|
34
|
-
symbolMaxLength:
|
|
35
|
-
descriptionMaxLength:
|
|
36
|
-
onSelect:
|
|
37
|
-
hideValue:
|
|
32
|
+
gapSize: a = e,
|
|
33
|
+
last: w,
|
|
34
|
+
symbolMaxLength: L,
|
|
35
|
+
descriptionMaxLength: R,
|
|
36
|
+
onSelect: c,
|
|
37
|
+
hideValue: d = !1,
|
|
38
|
+
rounded: T = !0,
|
|
38
39
|
className: A
|
|
39
40
|
}, C) => {
|
|
40
|
-
const
|
|
41
|
+
const o = S || i?.title, f = e === "md" ? "default" : e;
|
|
41
42
|
return /* @__PURE__ */ t(
|
|
42
43
|
I,
|
|
43
44
|
{
|
|
44
45
|
ref: C,
|
|
45
|
-
className:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
onClick: d,
|
|
51
|
-
cols: a ? "1fr" : "1fr 1fr",
|
|
52
|
-
noRound: !0,
|
|
46
|
+
className: y(c && "cursor-pointer", A),
|
|
47
|
+
onClick: c,
|
|
48
|
+
cols: d ? "1fr" : "1fr 1fr",
|
|
49
|
+
noRound: !T,
|
|
50
|
+
last: w,
|
|
53
51
|
children: [
|
|
54
|
-
/* @__PURE__ */ r(p, { size:
|
|
52
|
+
/* @__PURE__ */ r(p, { size: f, className: "text-left", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
|
|
55
53
|
/* @__PURE__ */ r(
|
|
56
|
-
|
|
54
|
+
j,
|
|
57
55
|
{
|
|
58
|
-
token:
|
|
59
|
-
size:
|
|
56
|
+
token: i,
|
|
57
|
+
size: E[u],
|
|
60
58
|
chainId: b,
|
|
61
59
|
network: N
|
|
62
60
|
}
|
|
63
61
|
),
|
|
64
62
|
/* @__PURE__ */ t("div", { className: "flex-1 min-w-0", children: [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
o && /* @__PURE__ */ r(h, { maxLength: L, children: o }),
|
|
64
|
+
o && l && /* @__PURE__ */ r(g, { height: x[a] }),
|
|
65
|
+
l && /* @__PURE__ */ r(n, { children: /* @__PURE__ */ r(
|
|
66
|
+
h,
|
|
67
|
+
{
|
|
68
|
+
maxLength: R,
|
|
69
|
+
showTooltip: !1,
|
|
70
|
+
children: String(l)
|
|
71
|
+
}
|
|
72
|
+
) })
|
|
68
73
|
] })
|
|
69
74
|
] }) }),
|
|
70
|
-
!
|
|
75
|
+
!d && /* @__PURE__ */ t(p, { size: f, className: "text-right", children: [
|
|
71
76
|
s,
|
|
72
|
-
s &&
|
|
73
|
-
|
|
77
|
+
s && m && /* @__PURE__ */ r(g, { height: x[a] }),
|
|
78
|
+
m && /* @__PURE__ */ r(n, { children: m })
|
|
74
79
|
] })
|
|
75
80
|
]
|
|
76
81
|
}
|
|
77
82
|
);
|
|
78
83
|
}
|
|
79
84
|
);
|
|
80
|
-
|
|
85
|
+
Z.displayName = "AssetLine";
|
|
81
86
|
export {
|
|
82
|
-
|
|
87
|
+
Z as AssetLine
|
|
83
88
|
};
|
|
@@ -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
|
};
|