@gearbox-protocol/permissionless-ui 1.17.0 → 1.17.2
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/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/esm/components/asset-line/asset-line.js +31 -30
- package/dist/esm/components/graph/graph.js +64 -64
- package/dist/esm/components/options-list/options-list.js +7 -8
- package/dist/esm/components/table/grid-table.js +40 -38
- package/dist/types/components/options-list/options-list.d.ts +1 -1
- package/dist/types/components/table/grid-table.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),T=require("react"),g=require("../description/description.cjs"),h=require("../short-string/short-string.cjs"),l=require("../table/grid-table.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),T=require("react"),g=require("../description/description.cjs"),h=require("../short-string/short-string.cjs"),l=require("../table/grid-table.cjs"),R=require("../token-symbol/token-symbol.cjs"),x=require("../vspace/vspace.cjs"),L=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk");function w(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 A=w(T),C={default:24,sm:20,md:24,lg:28},S={default:0,sm:2,md:4,lg:4},b=A.forwardRef(({token:t,tokenLabel:s,tokenDescription:r,network:n,chainId:j,value:a,valueDescription:o,size:c="default",iconSize:p=c,gapSize:d=c,last:_,symbolMaxLength:q,descriptionMaxLength:y,onSelect:m,hideValue:u=!1,className:N},O)=>{const i=s||t?.title,f=c==="md"?"default":c;return e.jsxs(l.GridTableRow,{ref:O,className:L.cn(_&&"[&>*]:border-0",m&&"cursor-pointer",N),onClick:m,cols:u?"1fr":"1fr 1fr",noRound:!0,children:[e.jsx(l.GridTableCell,{size:f,className:"text-left",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(R.TokenSymbol,{token:t,size:C[p],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(x.VSpace,{height:S[d]}),r&&e.jsx(g.Description,{children:e.jsx(h.ShortString,{maxLength:y,children:String(r)})})]})]})}),!u&&e.jsxs(l.GridTableCell,{size:f,className:"text-right",children:[a,a&&o&&e.jsx(x.VSpace,{height:S[d]}),o&&e.jsx(g.Description,{children:o})]})]})});b.displayName="AssetLine";exports.AssetLine=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),me=require("lightweight-charts"),i=require("react"),he=require("../../hooks/use-media-query.cjs"),se=require("../../utils/cn.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),me=require("lightweight-charts"),i=require("react"),he=require("../../hooks/use-media-query.cjs"),se=require("../../utils/cn.cjs"),I=require("../../utils/colors.cjs"),$=require("./default-config.cjs"),ee=require("./formatters.cjs"),pe=require("./graph-current-value.cjs"),be=require("./graph-tooltip.cjs"),ve=require("./plugins/vertical-line.cjs");function Ce(e){const L=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const h in e)if(h!=="default"){const _=Object.getOwnPropertyDescriptor(e,h);Object.defineProperty(L,h,_.get?_:{enumerable:!0,get:()=>e[h]})}}return L.default=e,Object.freeze(L)}const te=Ce(i),B=[{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 Se({series:e,className:L,showLegend:h=!1,onUnselectSeries:_,xMeasureUnit:P="time",yMeasureUnit:k="token",optionsOverrides:A,verticalLineOptions:D}){const S=i.useRef(null),x=i.useRef(new Map),X=i.useRef(!1),oe=i.useRef(new Set),re=i.useRef(null),ne=i.useRef(!0),M=i.useRef(null),W=i.useRef(null),E=he.useIsMobile(),V=te.useMemo(()=>e.flatMap(t=>t.data),[e]),ce=te.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[ae,Y]=i.useState(()=>{if(!ce)return;const t=new Map;for(const n of e)n.data.length>0&&t.set(n.label,n.data[n.data.length-1]);return t}),[le,j]=i.useState(null);i.useEffect(()=>{const t=()=>{if(S.current&&M.current){const u=M.current.clientWidth,a=M.current.clientHeight;S.current.resize(u,a),S.current.timeScale().fitContent()}},n=M.current,l=n?new ResizeObserver(t):null;return n&&l?.observe(n),()=>{n&&l?.unobserve(n)}},[]),i.useEffect(()=>{if(!W.current||X.current)return;const t=$.getDefaultOptions(),n=I.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)"),l=me.createChart(W.current,{...t,rightPriceScale:{...t.rightPriceScale||{},visible:!E,textColor:n},...A});return S.current=l,X.current=!0,()=>{l.remove(),S.current=null,X.current=!1,x.current.clear()}},[E,A]),i.useEffect(()=>{const t=S.current;if(!t||e.length===0)return;const n=P==="time"?ee.getXFormatter(P,V):ee.getXFormatter(P),l=ee.getYFormatter(k),u=$.getDefaultOptions();t.applyOptions({localization:{...u.localization||{},timeFormatter:n?(o=>n(parseFloat(o),void 0)):void 0},timeScale:{...u.timeScale||{},tickMarkFormatter:n?(o=>n(parseFloat(o),void 0)):void 0,minBarSpacing:0}});const g=(V.length>0?Math.min(...V.map(o=>o.value)):0)<0,R=V.some(o=>o.value===0),T=!g&&R,s=e.length>1,F=s||E,y=I.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");t.applyOptions({rightPriceScale:{...u.rightPriceScale||{},visible:!E,textColor:y,...T&&{scaleMargins:{top:.3,bottom:0}}}});const b=new Set(x.current.keys()),c=new Set(e.map(o=>o.label));for(const o of b)if(!c.has(o)){const r=x.current.get(o);r&&(t.removeSeries(r),x.current.delete(o))}const v=$.getDefaultSeries(),f=[];let C=0;for(let o=0;o<e.length;o++){const r=e[o],K=B[o%B.length],z=r.color||K.line;let N,O;if(r.color)if(r.topColor&&r.bottomColor)N=r.topColor,O=r.bottomColor;else if(r.topColor){const d=I.generateColorsFromBase(z);N=r.topColor,O=d.bottomColor}else if(r.bottomColor)N=I.generateColorsFromBase(z).topColor,O=r.bottomColor;else{const d=I.generateColorsFromBase(z);N=d.topColor,O=d.bottomColor}else N=r.topColor||K.top,O=r.bottomColor||K.bottom;if(r.data.length===0){const d=x.current.get(r.label);d&&(t.removeSeries(d),x.current.delete(r.label));continue}const fe=(r.data.length>0?Math.min(...r.data.map(d=>d.value)):0)<0,ge=r.data.some(d=>d.value===0),de=!fe&&ge,U=s?C===0?void 0:`scale-${C}`:void 0;s&&f.push({priceScaleId:U||"right",shouldPreventNegativeAxis:de,seriesIndex:C});let q=x.current.get(r.label);q?(q.applyOptions({lineColor:z,topColor:N,bottomColor:O,priceScaleId:U}),q.setData(r.data)):(q=t.addAreaSeries({...v,lineColor:z,topColor:N,bottomColor:O,priceScaleId:U,priceFormat:{type:"custom",formatter:d=>l(parseFloat(d.toString()),void 0,"short")}}),q.setData(r.data),x.current.set(r.label,q)),C++}if(s&&f.length>0)for(const o of f)try{const r=t.priceScale(o.priceScaleId);r&&r.applyOptions({visible:!F,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:y})}catch(r){console.warn(`Failed to configure price scale ${o.priceScaleId} for series ${o.seriesIndex}:`,r)}let p=null;if(V.length>0){const o=V.map(r=>typeof r.time=="number"?r.time:Number(r.time));p={from:Math.min(...o),to:Math.max(...o)}}const w=new Set(e.map(o=>o.label)),G=oe.current,Q=w.size!==G.size||[...w].some(o=>!G.has(o)),H=re.current,ue=p&&H&&(p.from!==H.from||p.to!==H.to);(ne.current||Q||ue||!H||E)&&(requestAnimationFrame(()=>{S.current&&S.current.timeScale().fitContent()}),ne.current=!1),oe.current=w,re.current=p;const J=new Map;for(const o of e)o.data.length>0&&J.set(o.label,o.data[o.data.length-1]);Y(J.size>0?J:void 0)},[e,V,P,k,E]),i.useEffect(()=>{const t=S.current;if(!t||e.length===0)return;const n=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:R,point:T}=a||{},s=Array.from(x.current.values());if(!T||!g){const b=new Map;for(const c of e)c.data.length>0&&b.set(c.label,c.data[c.data.length-1]);if(Y(b.size>0?b:void 0),n)j(null);else if(s[0]&&l){const v=t.timeScale().timeToCoordinate(l),f=e[0];if(f.data.length>0){const C=f.data[f.data.length-1].value,p=s[0].priceToCoordinate(C);v!==null&&p!==null&&j({x:v,y:p})}}return}const F=new Map;let y;for(let b=0;b<e.length;b++){const c=e[b],v=s[b];if(!v)continue;const f=R?.get(v),C=f&&"value"in f?f.value:void 0,p=c.data[c.data.length-1],w=C!==void 0?C:p?.value??0;b===0&&(y=w),F.set(c.label,{value:w,time:g})}if(Y(F),y!==void 0&&s[0]){const c=t.timeScale().timeToCoordinate(g),v=s[0].priceToCoordinate(y);if(c!==null&&v!==null){const f=M.current;if(f){const C=f.querySelector(".LightweightChart");if(C){const p=C.getBoundingClientRect(),w=f.getBoundingClientRect(),G=c+(p.left-w.left),Q=v+(p.top-w.top);j({x:G,y:Q})}else j({x:c,y:v})}else j({x:c,y:v})}else j(null)}else j(null)};return t.subscribeCrosshairMove(u),n||requestAnimationFrame(()=>{const a=Array.from(x.current.values());if(a[0]&&l&&e[0]?.data.length>0){const R=t.timeScale().timeToCoordinate(l),T=e[0].data[e[0].data.length-1].value,s=a[0].priceToCoordinate(T);R!==null&&s!==null&&j({x:R,y:s})}}),()=>{t.unsubscribeCrosshairMove(u)}},[e]),i.useEffect(()=>{const t=S.current;if(!t||e.length===0)return;const n=t.timeScale(),l=Math.max(...e.map(a=>a.data.length)),u=()=>{if(l===0)return;const a=n.getVisibleLogicalRange();if(!a)return;const g={from:0,to:l-1},R=typeof a.from=="number"?a.from:0,T=typeof a.to=="number"?a.to:l-1,s=.01;let F=!1;const y={...a};R<g.from-s&&(y.from=g.from,F=!0),T>g.to+s&&(y.to=g.to,F=!0),F&&n.setVisibleLogicalRange(y)};return n.subscribeVisibleLogicalRangeChange(u),()=>{n.unsubscribeVisibleLogicalRangeChange(u)}},[e]),i.useEffect(()=>{const t=S.current,n=Array.from(x.current.values()),l=[];if(t&&n.length>0&&D){const u=$.getDefaultVerticalLine(),a=n[0];for(const g of D){const R=new ve.VertLine(t,a,g.xCoordinate,{...u,...g.options||{}});a.attachPrimitive(R),l.push(R)}}return()=>{if(n.length>0){const u=n[0];for(const a of l)u.detachPrimitive(a)}}},[D]);const Z=e.length===1,ie=te.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 m.jsxs("div",{ref:M,className:se.cn("relative z-[1] w-full h-full overflow-hidden p-0",L),children:[Z&&ie&&m.jsx(pe.GraphCurrentValue,{point:ie,xMeasureUnit:P,yMeasureUnit:k}),ae&&le&&m.jsx(be.GraphTooltip,{points:ae,xMeasureUnit:P,yMeasureUnit:k,series:e,position:le,containerRef:M}),h&&m.jsx(xe,{series:e,onUnselect:_}),m.jsx("div",{ref:W,className:"LightweightChart w-full h-full overflow-hidden"})]})}function xe({series:e,onUnselect:L}){return m.jsx("div",{className:"absolute top-0 left-2 z-[10] flex flex-wrap gap-2",children:e.map((h,_)=>{const P=B[_%B.length],k=h.color||P.line,A=h.data.length===0;return m.jsxs("div",{className:se.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:[m.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:k}}),m.jsxs("span",{className:"text-[10px] sm:text-xs font-medium text-foreground",children:[h.label,A&&" (no data)"]}),L&&m.jsx("button",{type:"button",onClick:D=>{D.stopPropagation(),L(h.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 ${h.label}`,children:m.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:[m.jsx("title",{children:"Close"}),m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},h.label)})})}exports.DEFAULT_SERIES_COLORS=B;exports.Graph=Se;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),m=require("react"),c=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
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),m=require("react"),c=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 o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{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,(s,f)=>{if(i.isValidElement(s)){const u=f===0,d=f===l-1;return i.cloneElement(s,{first:u,last:d})}return s});return n.jsx("div",{className:c.cn("m-0 p-0 w-full flex flex-wrap",e),...t,children:a})}function p({icon:e,title:r,subTitle:t,onClick:o,endingIcon:l,last:a=!1,className:s}){return n.jsxs("button",{type:"button",onClick:o,className:c.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-foreground/10 before:rounded-lg","hover:before:block",!a&&"after:absolute after:bottom-0 after:left-0 after:w-full after:h-px after:content-[''] after:bg-border",s),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 i=require("react/jsx-runtime"),n=require("class-variance-authority"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("class-variance-authority"),_=require("react"),u=require("../layout/col/col.cjs"),m=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(_),p=n.cva("w-full",{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),T=d.forwardRef(({className:e,size:a,cols:t=12,gap:r=0,...s},o)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx(m.Grid,{ref:o,cols:t,gap:r,className:l.cn(p({size:a,className:e})),...s})}));T.displayName="GridTable";const y=d.forwardRef(({className:e,...a},t)=>i.jsx("div",{ref:t,className:l.cn("contents [&>*]:border-b [&>*]:border-border",e),...a}));y.displayName="GridTableHeader";const g=d.forwardRef(({className:e,...a},t)=>i.jsx("div",{ref:t,className:l.cn("contents [&>*:last-child>*]:border-0",e),...a}));g.displayName="GridTableBody";const x=d.forwardRef(({className:e,...a},t)=>i.jsx("div",{ref:t,className:l.cn("contents [&>*]:border-t [&>*]:bg-muted/50 [&>*]:font-medium",e),...a}));x.displayName="GridTableFooter";const G=d.forwardRef(({className:e,cols:a,gap:t=0,last:r,height:s,hideValue:o,noHover:w,noRound:R,style:h,...C},V)=>{const f=typeof s=="number"?`${s}px`:s;return i.jsx(m.Grid,{ref:V,cols:a,gap:t,className:l.cn("contents md:[&>*]:border-b [&>*]:border-border [&>*]:transition-colors data-[state=selected]:[&>*]:bg-muted",!w&&["[&>*]:relative [&>*]:z-0","[&>*]:before:absolute [&>*]:before:inset-0 [&>*]:before:-z-10 [&>*]:before:bg-muted/50 [&>*]:before:opacity-0 [&>*]:before:transition-opacity","hover:[&>*]:before:opacity-100",!R&&"[&>*:first-child]:before:rounded-l-lg [&>*:last-child]:before:rounded-r-lg"],r&&"[&>*]:border-b-0",o&&"[&>*]:opacity-0",e),style:{...h,...f?{height:f}:{}},...C})});G.displayName="GridTableRow";const j=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",...s},o)=>i.jsx(u.Col,{ref:o,span:t,className:l.cn(j({size:a,justify:r,className:e})),...s}));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"}}),b=d.forwardRef(({className:e,size:a,span:t=1,textAlign:r,...s},o)=>i.jsx(u.Col,{ref:o,span:t,className:l.cn(N({size:a,textAlign:r,className:e})),...s}));b.displayName="GridTableCell";const v=d.forwardRef(({className:e,...a},t)=>i.jsx("div",{ref:t,className:l.cn("col-span-full mt-4 text-sm text-muted-foreground",e),...a}));v.displayName="GridTableCaption";const H=b,q=c;exports.GridTable=T;exports.GridTableBody=g;exports.GridTableCaption=v;exports.GridTableCell=b;exports.GridTableFooter=x;exports.GridTableHead=c;exports.GridTableHeader=y;exports.GridTableRow=G;exports.Td=H;exports.Th=q;exports.gridTableCellVariants=N;exports.gridTableHeadVariants=j;exports.gridTableVariants=p;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { Description as
|
|
2
|
+
import * as G from "react";
|
|
3
|
+
import { Description as f } from "../description/description.js";
|
|
4
4
|
import { ShortString as h } from "../short-string/short-string.js";
|
|
5
|
-
import { GridTableRow as
|
|
6
|
-
import { TokenSymbol as
|
|
5
|
+
import { GridTableRow as I, GridTableCell as p } from "../table/grid-table.js";
|
|
6
|
+
import { TokenSymbol as T } from "../token-symbol/token-symbol.js";
|
|
7
7
|
import { VSpace as g } from "../vspace/vspace.js";
|
|
8
|
-
import { cn as
|
|
8
|
+
import { cn as j } from "../../utils/cn.js";
|
|
9
9
|
import "sonner";
|
|
10
10
|
import "@gearbox-protocol/sdk";
|
|
11
11
|
const y = {
|
|
@@ -18,7 +18,7 @@ const y = {
|
|
|
18
18
|
sm: 2,
|
|
19
19
|
md: 4,
|
|
20
20
|
lg: 4
|
|
21
|
-
}, E =
|
|
21
|
+
}, E = G.forwardRef(
|
|
22
22
|
({
|
|
23
23
|
token: o,
|
|
24
24
|
tokenLabel: S,
|
|
@@ -28,48 +28,49 @@ const y = {
|
|
|
28
28
|
value: s,
|
|
29
29
|
valueDescription: l,
|
|
30
30
|
size: e = "default",
|
|
31
|
-
iconSize:
|
|
31
|
+
iconSize: u = e,
|
|
32
32
|
gapSize: c = e,
|
|
33
|
-
last:
|
|
34
|
-
symbolMaxLength:
|
|
35
|
-
descriptionMaxLength:
|
|
36
|
-
onSelect:
|
|
37
|
-
hideValue:
|
|
38
|
-
className:
|
|
39
|
-
},
|
|
40
|
-
const i = S || o?.title,
|
|
33
|
+
last: L,
|
|
34
|
+
symbolMaxLength: R,
|
|
35
|
+
descriptionMaxLength: w,
|
|
36
|
+
onSelect: d,
|
|
37
|
+
hideValue: a = !1,
|
|
38
|
+
className: A
|
|
39
|
+
}, C) => {
|
|
40
|
+
const i = S || o?.title, n = e === "md" ? "default" : e;
|
|
41
41
|
return /* @__PURE__ */ t(
|
|
42
|
-
|
|
42
|
+
I,
|
|
43
43
|
{
|
|
44
|
-
ref:
|
|
45
|
-
className:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
ref: C,
|
|
45
|
+
className: j(
|
|
46
|
+
L && "[&>*]:border-0",
|
|
47
|
+
d && "cursor-pointer",
|
|
48
|
+
A
|
|
49
49
|
),
|
|
50
|
-
onClick:
|
|
51
|
-
cols:
|
|
50
|
+
onClick: d,
|
|
51
|
+
cols: a ? "1fr" : "1fr 1fr",
|
|
52
|
+
noRound: !0,
|
|
52
53
|
children: [
|
|
53
|
-
/* @__PURE__ */ r(p, { size:
|
|
54
|
+
/* @__PURE__ */ r(p, { size: n, className: "text-left", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
|
|
54
55
|
/* @__PURE__ */ r(
|
|
55
|
-
|
|
56
|
+
T,
|
|
56
57
|
{
|
|
57
58
|
token: o,
|
|
58
|
-
size: y[
|
|
59
|
+
size: y[u],
|
|
59
60
|
chainId: b,
|
|
60
61
|
network: N
|
|
61
62
|
}
|
|
62
63
|
),
|
|
63
64
|
/* @__PURE__ */ t("div", { className: "flex-1 min-w-0", children: [
|
|
64
|
-
i && /* @__PURE__ */ r(h, { maxLength:
|
|
65
|
+
i && /* @__PURE__ */ r(h, { maxLength: R, children: i }),
|
|
65
66
|
i && m && /* @__PURE__ */ r(g, { height: x[c] }),
|
|
66
|
-
m && /* @__PURE__ */ r(
|
|
67
|
+
m && /* @__PURE__ */ r(f, { children: /* @__PURE__ */ r(h, { maxLength: w, children: String(m) }) })
|
|
67
68
|
] })
|
|
68
69
|
] }) }),
|
|
69
|
-
!
|
|
70
|
+
!a && /* @__PURE__ */ t(p, { size: n, className: "text-right", children: [
|
|
70
71
|
s,
|
|
71
72
|
s && l && /* @__PURE__ */ r(g, { height: x[c] }),
|
|
72
|
-
l && /* @__PURE__ */ r(
|
|
73
|
+
l && /* @__PURE__ */ r(f, { children: l })
|
|
73
74
|
] })
|
|
74
75
|
]
|
|
75
76
|
}
|
|
@@ -3,7 +3,7 @@ import { createChart as vt } from "lightweight-charts";
|
|
|
3
3
|
import * as tt from "react";
|
|
4
4
|
import { useRef as V, useState as st, useEffect as D } from "react";
|
|
5
5
|
import { useIsMobile as Ct } from "../../hooks/use-media-query.js";
|
|
6
|
-
import { cn as
|
|
6
|
+
import { cn as dt } from "../../utils/cn.js";
|
|
7
7
|
import { resolveCSSColor as ct, generateColorsFromBase as et } from "../../utils/colors.js";
|
|
8
8
|
import { getDefaultOptions as ut, getDefaultSeries as St, getDefaultVerticalLine as xt } from "./default-config.js";
|
|
9
9
|
import { getXFormatter as ft, getYFormatter as Rt } from "./formatters.js";
|
|
@@ -54,22 +54,22 @@ const q = [
|
|
|
54
54
|
];
|
|
55
55
|
function Bt({
|
|
56
56
|
series: e,
|
|
57
|
-
className:
|
|
57
|
+
className: B,
|
|
58
58
|
showLegend: w = !1,
|
|
59
59
|
onUnselectSeries: W,
|
|
60
60
|
xMeasureUnit: y = "time",
|
|
61
|
-
yMeasureUnit:
|
|
61
|
+
yMeasureUnit: A = "token",
|
|
62
62
|
optionsOverrides: O,
|
|
63
63
|
verticalLineOptions: E
|
|
64
64
|
}) {
|
|
65
|
-
const b = V(null), v = V(/* @__PURE__ */ new Map()), X = V(!1), ot = V(/* @__PURE__ */ new Set()), rt = V(null), nt = V(!0),
|
|
65
|
+
const b = V(null), v = V(/* @__PURE__ */ new Map()), X = V(!1), ot = V(/* @__PURE__ */ new Set()), rt = V(null), nt = V(!0), M = V(null), Y = V(null), z = Ct(), F = tt.useMemo(() => e.flatMap((t) => t.data), [e]), mt = tt.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
71
|
}, [e]), [at, Z] = st(() => {
|
|
72
|
-
if (!
|
|
72
|
+
if (!mt) return;
|
|
73
73
|
const t = /* @__PURE__ */ new Map();
|
|
74
74
|
for (const n of e)
|
|
75
75
|
n.data.length > 0 && t.set(n.label, n.data[n.data.length - 1]);
|
|
@@ -77,11 +77,11 @@ function Bt({
|
|
|
77
77
|
}), [lt, L] = st(null);
|
|
78
78
|
D(() => {
|
|
79
79
|
const t = () => {
|
|
80
|
-
if (b.current &&
|
|
81
|
-
const c =
|
|
80
|
+
if (b.current && M.current) {
|
|
81
|
+
const c = M.current.clientWidth, a = M.current.clientHeight;
|
|
82
82
|
b.current.resize(c, a), b.current.timeScale().fitContent();
|
|
83
83
|
}
|
|
84
|
-
}, n =
|
|
84
|
+
}, n = M.current, l = n ? new ResizeObserver(t) : null;
|
|
85
85
|
return n && l?.observe(n), () => {
|
|
86
86
|
n && l?.unobserve(n);
|
|
87
87
|
};
|
|
@@ -94,7 +94,7 @@ function Bt({
|
|
|
94
94
|
...t,
|
|
95
95
|
rightPriceScale: {
|
|
96
96
|
...t.rightPriceScale || {},
|
|
97
|
-
visible: !
|
|
97
|
+
visible: !z,
|
|
98
98
|
textColor: n
|
|
99
99
|
},
|
|
100
100
|
...O
|
|
@@ -102,10 +102,10 @@ function Bt({
|
|
|
102
102
|
return b.current = l, X.current = !0, () => {
|
|
103
103
|
l.remove(), b.current = null, X.current = !1, v.current.clear();
|
|
104
104
|
};
|
|
105
|
-
}, [
|
|
105
|
+
}, [z, O]), D(() => {
|
|
106
106
|
const t = b.current;
|
|
107
107
|
if (!t || e.length === 0) return;
|
|
108
|
-
const n = y === "time" ? ft(y,
|
|
108
|
+
const n = y === "time" ? ft(y, F) : ft(y), l = Rt(A), c = ut();
|
|
109
109
|
t.applyOptions({
|
|
110
110
|
localization: {
|
|
111
111
|
...c.localization || {},
|
|
@@ -123,16 +123,16 @@ function Bt({
|
|
|
123
123
|
minBarSpacing: 0
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
|
-
const f = (
|
|
126
|
+
const f = (F.length > 0 ? Math.min(...F.map((o) => o.value)) : 0) < 0, C = F.some((o) => o.value === 0), N = !f && C, i = e.length > 1, P = i || z, S = ct(
|
|
127
127
|
"hsl(var(--foreground))",
|
|
128
128
|
"rgb(0, 0, 0)"
|
|
129
129
|
);
|
|
130
130
|
t.applyOptions({
|
|
131
131
|
rightPriceScale: {
|
|
132
132
|
...c.rightPriceScale || {},
|
|
133
|
-
visible: !
|
|
133
|
+
visible: !z,
|
|
134
134
|
textColor: S,
|
|
135
|
-
...
|
|
135
|
+
...N && {
|
|
136
136
|
scaleMargins: {
|
|
137
137
|
top: 0.3,
|
|
138
138
|
bottom: 0
|
|
@@ -149,28 +149,28 @@ function Bt({
|
|
|
149
149
|
const h = St(), u = [];
|
|
150
150
|
let p = 0;
|
|
151
151
|
for (let o = 0; o < e.length; o++) {
|
|
152
|
-
const r = e[o], Q = q[o % q.length],
|
|
153
|
-
let
|
|
152
|
+
const r = e[o], Q = q[o % q.length], j = r.color || Q.line;
|
|
153
|
+
let T, k;
|
|
154
154
|
if (r.color)
|
|
155
155
|
if (r.topColor && r.bottomColor)
|
|
156
|
-
|
|
156
|
+
T = r.topColor, k = r.bottomColor;
|
|
157
157
|
else if (r.topColor) {
|
|
158
|
-
const
|
|
159
|
-
|
|
158
|
+
const d = et(j);
|
|
159
|
+
T = r.topColor, k = d.bottomColor;
|
|
160
160
|
} else if (r.bottomColor)
|
|
161
|
-
|
|
161
|
+
T = et(j).topColor, k = r.bottomColor;
|
|
162
162
|
else {
|
|
163
|
-
const
|
|
164
|
-
|
|
163
|
+
const d = et(j);
|
|
164
|
+
T = d.topColor, k = d.bottomColor;
|
|
165
165
|
}
|
|
166
166
|
else
|
|
167
|
-
|
|
167
|
+
T = r.topColor || Q.top, k = r.bottomColor || Q.bottom;
|
|
168
168
|
if (r.data.length === 0) {
|
|
169
|
-
const
|
|
170
|
-
|
|
169
|
+
const d = v.current.get(r.label);
|
|
170
|
+
d && (t.removeSeries(d), v.current.delete(r.label));
|
|
171
171
|
continue;
|
|
172
172
|
}
|
|
173
|
-
const ht = (r.data.length > 0 ? Math.min(...r.data.map((
|
|
173
|
+
const ht = (r.data.length > 0 ? Math.min(...r.data.map((d) => d.value)) : 0) < 0, pt = r.data.some((d) => d.value === 0), bt = !ht && pt, U = i ? p === 0 ? void 0 : `scale-${p}` : void 0;
|
|
174
174
|
i && u.push({
|
|
175
175
|
priceScaleId: U || "right",
|
|
176
176
|
shouldPreventNegativeAxis: bt,
|
|
@@ -178,19 +178,19 @@ function Bt({
|
|
|
178
178
|
});
|
|
179
179
|
let I = v.current.get(r.label);
|
|
180
180
|
I ? (I.applyOptions({
|
|
181
|
-
lineColor:
|
|
182
|
-
topColor:
|
|
183
|
-
bottomColor:
|
|
181
|
+
lineColor: j,
|
|
182
|
+
topColor: T,
|
|
183
|
+
bottomColor: k,
|
|
184
184
|
priceScaleId: U
|
|
185
185
|
}), I.setData(r.data)) : (I = t.addAreaSeries({
|
|
186
186
|
...h,
|
|
187
|
-
lineColor:
|
|
188
|
-
topColor:
|
|
189
|
-
bottomColor:
|
|
187
|
+
lineColor: j,
|
|
188
|
+
topColor: T,
|
|
189
|
+
bottomColor: k,
|
|
190
190
|
priceScaleId: U,
|
|
191
191
|
priceFormat: {
|
|
192
192
|
type: "custom",
|
|
193
|
-
formatter: (
|
|
193
|
+
formatter: (d) => l(parseFloat(d.toString()), void 0, "short")
|
|
194
194
|
}
|
|
195
195
|
}), I.setData(r.data), v.current.set(r.label, I)), p++;
|
|
196
196
|
}
|
|
@@ -221,25 +221,25 @@ function Bt({
|
|
|
221
221
|
r
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
|
-
let
|
|
225
|
-
if (
|
|
226
|
-
const o =
|
|
224
|
+
let m = null;
|
|
225
|
+
if (F.length > 0) {
|
|
226
|
+
const o = F.map(
|
|
227
227
|
(r) => typeof r.time == "number" ? r.time : Number(r.time)
|
|
228
228
|
);
|
|
229
|
-
|
|
229
|
+
m = {
|
|
230
230
|
from: Math.min(...o),
|
|
231
231
|
to: Math.max(...o)
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
-
const R = new Set(e.map((o) => o.label)),
|
|
235
|
-
(nt.current || J || gt || !
|
|
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
236
|
b.current && b.current.timeScale().fitContent();
|
|
237
|
-
}), nt.current = !1), ot.current = R, rt.current =
|
|
237
|
+
}), nt.current = !1), ot.current = R, rt.current = m;
|
|
238
238
|
const K = /* @__PURE__ */ new Map();
|
|
239
239
|
for (const o of e)
|
|
240
240
|
o.data.length > 0 && K.set(o.label, o.data[o.data.length - 1]);
|
|
241
241
|
Z(K.size > 0 ? K : void 0);
|
|
242
|
-
}, [e,
|
|
242
|
+
}, [e, F, y, A, z]), D(() => {
|
|
243
243
|
const t = b.current;
|
|
244
244
|
if (!t || e.length === 0) return;
|
|
245
245
|
const n = e.length === 1;
|
|
@@ -251,8 +251,8 @@ function Bt({
|
|
|
251
251
|
}
|
|
252
252
|
if (!l) return;
|
|
253
253
|
const c = (a) => {
|
|
254
|
-
const { time: f = l, seriesData: C, point:
|
|
255
|
-
if (!
|
|
254
|
+
const { time: f = l, seriesData: C, point: N } = a || {}, i = Array.from(v.current.values());
|
|
255
|
+
if (!N || !f) {
|
|
256
256
|
const g = /* @__PURE__ */ new Map();
|
|
257
257
|
for (const s of e)
|
|
258
258
|
s.data.length > 0 && g.set(s.label, s.data[s.data.length - 1]);
|
|
@@ -261,8 +261,8 @@ function Bt({
|
|
|
261
261
|
else if (i[0] && l) {
|
|
262
262
|
const h = t.timeScale().timeToCoordinate(l), u = e[0];
|
|
263
263
|
if (u.data.length > 0) {
|
|
264
|
-
const p = u.data[u.data.length - 1].value,
|
|
265
|
-
h !== null &&
|
|
264
|
+
const p = u.data[u.data.length - 1].value, m = i[0].priceToCoordinate(p);
|
|
265
|
+
h !== null && m !== null && L({ x: h, y: m });
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
return;
|
|
@@ -272,20 +272,20 @@ function Bt({
|
|
|
272
272
|
for (let g = 0; g < e.length; g++) {
|
|
273
273
|
const s = e[g], h = i[g];
|
|
274
274
|
if (!h) continue;
|
|
275
|
-
const u = C?.get(h), p = u && "value" in u ? u.value : void 0,
|
|
275
|
+
const u = C?.get(h), p = u && "value" in u ? u.value : void 0, m = s.data[s.data.length - 1], R = p !== void 0 ? p : m?.value ?? 0;
|
|
276
276
|
g === 0 && (S = R), P.set(s.label, { value: R, time: f });
|
|
277
277
|
}
|
|
278
278
|
if (Z(P), S !== void 0 && i[0]) {
|
|
279
279
|
const s = t.timeScale().timeToCoordinate(f), h = i[0].priceToCoordinate(S);
|
|
280
280
|
if (s !== null && h !== null) {
|
|
281
|
-
const u =
|
|
281
|
+
const u = M.current;
|
|
282
282
|
if (u) {
|
|
283
283
|
const p = u.querySelector(
|
|
284
284
|
".LightweightChart"
|
|
285
285
|
);
|
|
286
286
|
if (p) {
|
|
287
|
-
const
|
|
288
|
-
L({ x:
|
|
287
|
+
const m = p.getBoundingClientRect(), R = u.getBoundingClientRect(), G = s + (m.left - R.left), J = h + (m.top - R.top);
|
|
288
|
+
L({ x: G, y: J });
|
|
289
289
|
} else
|
|
290
290
|
L({ x: s, y: h });
|
|
291
291
|
} else
|
|
@@ -298,7 +298,7 @@ function Bt({
|
|
|
298
298
|
return t.subscribeCrosshairMove(c), n || requestAnimationFrame(() => {
|
|
299
299
|
const a = Array.from(v.current.values());
|
|
300
300
|
if (a[0] && l && e[0]?.data.length > 0) {
|
|
301
|
-
const C = t.timeScale().timeToCoordinate(l),
|
|
301
|
+
const C = t.timeScale().timeToCoordinate(l), N = e[0].data[e[0].data.length - 1].value, i = a[0].priceToCoordinate(N);
|
|
302
302
|
C !== null && i !== null && L({ x: C, y: i });
|
|
303
303
|
}
|
|
304
304
|
}), () => {
|
|
@@ -314,10 +314,10 @@ function Bt({
|
|
|
314
314
|
const f = {
|
|
315
315
|
from: 0,
|
|
316
316
|
to: l - 1
|
|
317
|
-
}, C = typeof a.from == "number" ? a.from : 0,
|
|
317
|
+
}, C = typeof a.from == "number" ? a.from : 0, N = typeof a.to == "number" ? a.to : l - 1, i = 0.01;
|
|
318
318
|
let P = !1;
|
|
319
319
|
const S = { ...a };
|
|
320
|
-
C < f.from - i && (S.from = f.from, P = !0),
|
|
320
|
+
C < f.from - i && (S.from = f.from, P = !0), N > f.to + i && (S.to = f.to, P = !0), P && n.setVisibleLogicalRange(S);
|
|
321
321
|
};
|
|
322
322
|
return n.subscribeVisibleLogicalRangeChange(c), () => {
|
|
323
323
|
n.unsubscribeVisibleLogicalRangeChange(
|
|
@@ -354,10 +354,10 @@ function Bt({
|
|
|
354
354
|
return /* @__PURE__ */ $(
|
|
355
355
|
"div",
|
|
356
356
|
{
|
|
357
|
-
ref:
|
|
358
|
-
className:
|
|
357
|
+
ref: M,
|
|
358
|
+
className: dt(
|
|
359
359
|
"relative z-[1] w-full h-full overflow-hidden p-0",
|
|
360
|
-
|
|
360
|
+
B
|
|
361
361
|
),
|
|
362
362
|
children: [
|
|
363
363
|
_ && it && /* @__PURE__ */ x(
|
|
@@ -365,7 +365,7 @@ function Bt({
|
|
|
365
365
|
{
|
|
366
366
|
point: it,
|
|
367
367
|
xMeasureUnit: y,
|
|
368
|
-
yMeasureUnit:
|
|
368
|
+
yMeasureUnit: A
|
|
369
369
|
}
|
|
370
370
|
),
|
|
371
371
|
at && lt && /* @__PURE__ */ x(
|
|
@@ -373,10 +373,10 @@ function Bt({
|
|
|
373
373
|
{
|
|
374
374
|
points: at,
|
|
375
375
|
xMeasureUnit: y,
|
|
376
|
-
yMeasureUnit:
|
|
376
|
+
yMeasureUnit: A,
|
|
377
377
|
series: e,
|
|
378
378
|
position: lt,
|
|
379
|
-
containerRef:
|
|
379
|
+
containerRef: M
|
|
380
380
|
}
|
|
381
381
|
),
|
|
382
382
|
w && /* @__PURE__ */ x(Pt, { series: e, onUnselect: W }),
|
|
@@ -393,14 +393,14 @@ function Bt({
|
|
|
393
393
|
}
|
|
394
394
|
function Pt({
|
|
395
395
|
series: e,
|
|
396
|
-
onUnselect:
|
|
396
|
+
onUnselect: B
|
|
397
397
|
}) {
|
|
398
398
|
return /* @__PURE__ */ x("div", { className: "absolute top-0 left-2 z-[10] flex flex-wrap gap-2", children: e.map((w, W) => {
|
|
399
|
-
const y = q[W % q.length],
|
|
399
|
+
const y = q[W % q.length], A = w.color || y.line, O = w.data.length === 0;
|
|
400
400
|
return /* @__PURE__ */ $(
|
|
401
401
|
"div",
|
|
402
402
|
{
|
|
403
|
-
className:
|
|
403
|
+
className: dt(
|
|
404
404
|
"flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
|
|
405
405
|
O && "opacity-50"
|
|
406
406
|
),
|
|
@@ -409,19 +409,19 @@ function Pt({
|
|
|
409
409
|
"div",
|
|
410
410
|
{
|
|
411
411
|
className: "w-3 h-3 rounded-sm",
|
|
412
|
-
style: { backgroundColor:
|
|
412
|
+
style: { backgroundColor: A }
|
|
413
413
|
}
|
|
414
414
|
),
|
|
415
415
|
/* @__PURE__ */ $("span", { className: "text-[10px] sm:text-xs font-medium text-foreground", children: [
|
|
416
416
|
w.label,
|
|
417
417
|
O && " (no data)"
|
|
418
418
|
] }),
|
|
419
|
-
|
|
419
|
+
B && /* @__PURE__ */ x(
|
|
420
420
|
"button",
|
|
421
421
|
{
|
|
422
422
|
type: "button",
|
|
423
423
|
onClick: (E) => {
|
|
424
|
-
E.stopPropagation(),
|
|
424
|
+
E.stopPropagation(), B(w.label);
|
|
425
425
|
},
|
|
426
426
|
className: "ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer",
|
|
427
427
|
"aria-label": `Remove ${w.label}`,
|
|
@@ -8,9 +8,9 @@ function g({
|
|
|
8
8
|
children: o,
|
|
9
9
|
...l
|
|
10
10
|
}) {
|
|
11
|
-
const f = n.Children.toArray(o).length,
|
|
11
|
+
const f = n.Children.toArray(o).length, s = n.Children.map(o, (t, i) => {
|
|
12
12
|
if (n.isValidElement(t)) {
|
|
13
|
-
const m =
|
|
13
|
+
const m = i === 0, u = i === f - 1;
|
|
14
14
|
return n.cloneElement(t, {
|
|
15
15
|
first: m,
|
|
16
16
|
last: u
|
|
@@ -18,7 +18,7 @@ function g({
|
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
});
|
|
21
|
-
return /* @__PURE__ */ e("div", { className: d("m-0 p-0 w-full flex flex-wrap", r), ...l, children:
|
|
21
|
+
return /* @__PURE__ */ e("div", { className: d("m-0 p-0 w-full flex flex-wrap", r), ...l, children: s });
|
|
22
22
|
}
|
|
23
23
|
function v({
|
|
24
24
|
icon: r,
|
|
@@ -26,9 +26,8 @@ function v({
|
|
|
26
26
|
subTitle: l,
|
|
27
27
|
onClick: a,
|
|
28
28
|
endingIcon: f,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
className: s
|
|
29
|
+
last: s = !1,
|
|
30
|
+
className: t
|
|
32
31
|
}) {
|
|
33
32
|
return /* @__PURE__ */ c(
|
|
34
33
|
"button",
|
|
@@ -39,8 +38,8 @@ function v({
|
|
|
39
38
|
"relative z-0 pt-5 px-4 flex flex-row items-start gap-4 w-full cursor-pointer text-left",
|
|
40
39
|
"before:absolute before:-z-10 before:left-0 before:hidden before:w-full before:inset-y-0 before:content-[''] before:bg-foreground/10 before:rounded-lg",
|
|
41
40
|
"hover:before:block",
|
|
42
|
-
!
|
|
43
|
-
|
|
41
|
+
!s && "after:absolute after:bottom-0 after:left-0 after:w-full after:h-px after:content-[''] after:bg-border",
|
|
42
|
+
t
|
|
44
43
|
),
|
|
45
44
|
children: [
|
|
46
45
|
r && /* @__PURE__ */ e("div", { className: "w-6 h-6 text-muted-foreground flex items-center justify-center", children: r }),
|
|
@@ -4,7 +4,7 @@ import * as s from "react";
|
|
|
4
4
|
import { Col as m } from "../layout/col/col.js";
|
|
5
5
|
import { Grid as b } from "../layout/grid/grid.js";
|
|
6
6
|
import { cn as o } from "../../utils/cn.js";
|
|
7
|
-
const
|
|
7
|
+
const G = n("w-full", {
|
|
8
8
|
variants: {
|
|
9
9
|
size: {
|
|
10
10
|
sm: "text-xs",
|
|
@@ -15,20 +15,20 @@ const g = n("w-full", {
|
|
|
15
15
|
defaultVariants: {
|
|
16
16
|
size: "default"
|
|
17
17
|
}
|
|
18
|
-
}),
|
|
18
|
+
}), N = s.forwardRef(
|
|
19
19
|
({ className: e, size: t, cols: a = 12, gap: i = 0, ...r }, l) => /* @__PURE__ */ d("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ d(
|
|
20
20
|
b,
|
|
21
21
|
{
|
|
22
22
|
ref: l,
|
|
23
23
|
cols: a,
|
|
24
24
|
gap: i,
|
|
25
|
-
className: o(
|
|
25
|
+
className: o(G({ size: t, className: e })),
|
|
26
26
|
...r
|
|
27
27
|
}
|
|
28
28
|
) })
|
|
29
29
|
);
|
|
30
|
-
|
|
31
|
-
const
|
|
30
|
+
N.displayName = "GridTable";
|
|
31
|
+
const v = s.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ d(
|
|
32
32
|
"div",
|
|
33
33
|
{
|
|
34
34
|
ref: a,
|
|
@@ -36,8 +36,8 @@ const N = s.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ d(
|
|
|
36
36
|
...t
|
|
37
37
|
}
|
|
38
38
|
));
|
|
39
|
-
|
|
40
|
-
const
|
|
39
|
+
v.displayName = "GridTableHeader";
|
|
40
|
+
const w = s.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ d(
|
|
41
41
|
"div",
|
|
42
42
|
{
|
|
43
43
|
ref: a,
|
|
@@ -45,8 +45,8 @@ const v = s.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ d(
|
|
|
45
45
|
...t
|
|
46
46
|
}
|
|
47
47
|
));
|
|
48
|
-
|
|
49
|
-
const
|
|
48
|
+
w.displayName = "GridTableBody";
|
|
49
|
+
const h = s.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ d(
|
|
50
50
|
"div",
|
|
51
51
|
{
|
|
52
52
|
ref: a,
|
|
@@ -57,8 +57,8 @@ const w = s.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ d(
|
|
|
57
57
|
...t
|
|
58
58
|
}
|
|
59
59
|
));
|
|
60
|
-
|
|
61
|
-
const
|
|
60
|
+
h.displayName = "GridTableFooter";
|
|
61
|
+
const R = s.forwardRef(
|
|
62
62
|
({
|
|
63
63
|
className: e,
|
|
64
64
|
cols: t,
|
|
@@ -67,37 +67,39 @@ const h = s.forwardRef(
|
|
|
67
67
|
height: r,
|
|
68
68
|
hideValue: l,
|
|
69
69
|
noHover: u,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
noRound: y,
|
|
71
|
+
style: x,
|
|
72
|
+
...T
|
|
73
|
+
}, g) => {
|
|
73
74
|
const f = typeof r == "number" ? `${r}px` : r;
|
|
74
75
|
return /* @__PURE__ */ d(
|
|
75
76
|
b,
|
|
76
77
|
{
|
|
77
|
-
ref:
|
|
78
|
+
ref: g,
|
|
78
79
|
cols: t,
|
|
79
80
|
gap: a,
|
|
80
81
|
className: o(
|
|
81
82
|
"contents md:[&>*]:border-b [&>*]:border-border [&>*]:transition-colors data-[state=selected]:[&>*]:bg-muted",
|
|
82
|
-
// Hover background with rounded corners on first and last cells (unless noHover)
|
|
83
|
+
// Hover background with optional rounded corners on first and last cells (unless noHover)
|
|
83
84
|
!u && [
|
|
84
85
|
"[&>*]:relative [&>*]:z-0",
|
|
85
86
|
"[&>*]:before:absolute [&>*]:before:inset-0 [&>*]:before:-z-10 [&>*]:before:bg-muted/50 [&>*]:before:opacity-0 [&>*]:before:transition-opacity",
|
|
86
87
|
"hover:[&>*]:before:opacity-100",
|
|
87
|
-
|
|
88
|
+
// Only add rounded corners if noRound is not set
|
|
89
|
+
!y && "[&>*:first-child]:before:rounded-l-lg [&>*:last-child]:before:rounded-r-lg"
|
|
88
90
|
],
|
|
89
91
|
i && "[&>*]:border-b-0",
|
|
90
92
|
l && "[&>*]:opacity-0",
|
|
91
93
|
e
|
|
92
94
|
),
|
|
93
|
-
style: { ...
|
|
94
|
-
...
|
|
95
|
+
style: { ...x, ...f ? { height: f } : {} },
|
|
96
|
+
...T
|
|
95
97
|
}
|
|
96
98
|
);
|
|
97
99
|
}
|
|
98
100
|
);
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
+
R.displayName = "GridTableRow";
|
|
102
|
+
const z = n(
|
|
101
103
|
"flex items-center justify-startborder-b text-left align-middle font-medium text-muted-foreground !bg-transparent",
|
|
102
104
|
{
|
|
103
105
|
variants: {
|
|
@@ -123,13 +125,13 @@ const R = n(
|
|
|
123
125
|
{
|
|
124
126
|
ref: l,
|
|
125
127
|
span: a,
|
|
126
|
-
className: o(
|
|
128
|
+
className: o(z({ size: t, justify: i, className: e })),
|
|
127
129
|
...r
|
|
128
130
|
}
|
|
129
131
|
)
|
|
130
132
|
);
|
|
131
133
|
c.displayName = "GridTableHead";
|
|
132
|
-
const
|
|
134
|
+
const j = n("align-middle", {
|
|
133
135
|
variants: {
|
|
134
136
|
size: {
|
|
135
137
|
sm: "p-2",
|
|
@@ -151,13 +153,13 @@ const z = n("align-middle", {
|
|
|
151
153
|
{
|
|
152
154
|
ref: l,
|
|
153
155
|
span: a,
|
|
154
|
-
className: o(
|
|
156
|
+
className: o(j({ size: t, textAlign: i, className: e })),
|
|
155
157
|
...r
|
|
156
158
|
}
|
|
157
159
|
)
|
|
158
160
|
);
|
|
159
161
|
p.displayName = "GridTableCell";
|
|
160
|
-
const
|
|
162
|
+
const C = s.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ d(
|
|
161
163
|
"div",
|
|
162
164
|
{
|
|
163
165
|
ref: a,
|
|
@@ -168,20 +170,20 @@ const j = s.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ d(
|
|
|
168
170
|
...t
|
|
169
171
|
}
|
|
170
172
|
));
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
+
C.displayName = "GridTableCaption";
|
|
174
|
+
const S = p, $ = c;
|
|
173
175
|
export {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
176
|
+
N as GridTable,
|
|
177
|
+
w as GridTableBody,
|
|
178
|
+
C as GridTableCaption,
|
|
177
179
|
p as GridTableCell,
|
|
178
|
-
|
|
180
|
+
h as GridTableFooter,
|
|
179
181
|
c as GridTableHead,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
v as GridTableHeader,
|
|
183
|
+
R as GridTableRow,
|
|
184
|
+
S as Td,
|
|
185
|
+
$ as Th,
|
|
186
|
+
j as gridTableCellVariants,
|
|
187
|
+
z as gridTableHeadVariants,
|
|
188
|
+
G as gridTableVariants
|
|
187
189
|
};
|
|
@@ -13,4 +13,4 @@ export interface OptionsItemProps {
|
|
|
13
13
|
last?: boolean;
|
|
14
14
|
className?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare function OptionsItem({ icon, title, subTitle, onClick, endingIcon,
|
|
16
|
+
export declare function OptionsItem({ icon, title, subTitle, onClick, endingIcon, last, className, }: OptionsItemProps): React.ReactElement;
|
|
@@ -109,6 +109,10 @@ interface GridTableRowProps extends GridProps {
|
|
|
109
109
|
* Whether to disable hover effect (useful for header rows)
|
|
110
110
|
*/
|
|
111
111
|
noHover?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Whether to disable rounded corners on hover (useful for stacked rows like in AssetLine)
|
|
114
|
+
*/
|
|
115
|
+
noRound?: boolean;
|
|
112
116
|
}
|
|
113
117
|
/**
|
|
114
118
|
* GridTableRow — row component of a GridTable.
|