@gearbox-protocol/ui-kit 3.13.1 → 3.14.0-next.10
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/buttons/button/button.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-button/styled-button.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.cjs +1 -1
- package/dist/cjs/components/graph/formatters.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/layout/main-aside-layout/main-aside-layout.cjs +1 -1
- package/dist/cjs/components/smart-number-input/smart-number-input.cjs +1 -1
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/esm/components/buttons/button/button.js +1 -0
- package/dist/esm/components/client-adapters/styled-button/styled-button.js +11 -11
- package/dist/esm/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.js +131 -122
- package/dist/esm/components/graph/formatters.js +127 -132
- package/dist/esm/components/graph/graph.js +339 -293
- package/dist/esm/components/health-factor/health-factor.js +3 -3
- package/dist/esm/components/layout/main-aside-layout/main-aside-layout.js +104 -21
- package/dist/esm/components/smart-number-input/smart-number-input.js +253 -104
- package/dist/esm/components/trading-view/trading-view.js +58 -58
- package/dist/esm/locale/en.json.js +2 -0
- package/dist/globals.css +1 -1
- package/dist/types/components/buttons/button/button.d.ts +4 -3
- package/dist/types/components/graph/graph.d.ts +8 -1
- package/dist/types/components/help-tip/help-tip.d.ts +2 -2
- package/dist/types/components/layout/main-aside-layout/main-aside-layout.d.ts +80 -5
- package/dist/types/components/smart-number-input/smart-number-input.d.ts +52 -0
- package/dist/types/components/tip-card/tip-card.d.ts +1 -1
- package/dist/types/components/trading-view/trading-view.d.ts +7 -0
- package/dist/types/locale/en.json.d.ts +2 -0
- package/package.json +3 -3
- package/src/styles/base.css +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),y=require("@radix-ui/react-slot"),f=require("class-variance-authority"),h=require("react");require("@gearbox-protocol/sdk");const t=require("../../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../../utils/z-index.cjs");function v(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const d=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,d.get?d:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const m=v(h),i=f.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors cursor-pointer disabled:!cursor-not-allowed [&_svg]:pointer-events-none [&_svg:not([style*='width']):not([style*='height'])]:size-4 [&_svg]:shrink-0 border border-transparent outline-none focus-visible:outline-none",{variants:{variant:{default:t.cn("text-primary-foreground bg-primary border border-primary","hover:bg-accent hover:border-accent","disabled:text-secondary-foreground disabled:bg-gray-20 disabled:border-gray-20"),destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 disabled:opacity-50",outline:t.cn("text-primary-foreground bg-transparent border border-gray-40","hover:bg-gray-60 hover:border-gray-60","disabled:text-secondary-foreground disabled:bg-gray-20 disabled:border-gray-20"),secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 disabled:opacity-50",ghost:"hover:bg-secondary hover:text-accent-foreground disabled:opacity-50",white:t.cn("font-medium text-white-foreground bg-white border border-white","shadow-[0_1px_1px_0_rgba(0,0,0,0.15)]","hover:shadow-[0_3px_3px_0_rgba(0,0,0,0.25)]","disabled:text-gray-80 disabled:bg-gray-110 disabled:border-gray-110","disabled:shadow-[0_1px_1px_0_rgba(0,0,0,0.15)]"),neutral:t.cn("text-primary-foreground bg-gray-60 border border-gray-60","hover:bg-gray-90 hover:border-gray-90","disabled:text-secondary-foreground disabled:bg-gray-20 disabled:border-gray-20"),success:t.cn("font-medium text-success-foreground bg-success border border-success","hover:bg-success-hover hover:border-success-hover","disabled:text-secondary-foreground disabled:bg-gray-20 disabled:border-gray-20"),link:"text-primary underline-offset-4 hover:underline disabled:opacity-50",text:"text-muted-foreground hover:text-foreground hover:bg-transparent disabled:opacity-50",pink:"bg-pink-700 hover:bg-pink-600 disabled:bg-pink-700 text-primary-foreground disabled:opacity-50","pink-outline":"border-pink-700 hover:border-pink-600 disabled:border-pink-700 text-foreground disabled:opacity-50",blue:"bg-blue-800 hover:bg-blue-700 disabled:bg-blue-700 text-primary-foreground disabled:opacity-50","blue-outline":"border-blue-800 hover:border-blue-700 disabled:border-blue-800 text-foreground disabled:opacity-50"},size:{auto:"h-auto p-1.5",xs:"px-3 py-0.5 text-xs rounded-full",sm:"h-7 px-3 !text-xs !leading-[14px] rounded-[6px]",md:"h-8 px-3.5 !text-sm !leading-4 rounded-[8px]",default:"px-4 h-[40px] !text-[15px] !leading-[18px] rounded-[12px]",lg:"px-4 h-[44px] !text-[16px] !leading-[19px] rounded-[22px]",icon:"h-9 w-9 p-2"},width:{compact:"w-auto",wide:"w-full"}},defaultVariants:{variant:"default",size:"default",width:"compact"}}),s=m.forwardRef(({className:e,variant:o,size:r,width:d,asChild:b=!1,disabled:n,onClick:u,...c},l)=>{const g=b?y.Slot:"button",p=a=>{if(n){a.preventDefault(),a.stopPropagation();return}u?.(a)};return x.jsx(g,{className:t.cn(i({variant:o,size:r,className:e,width:d})),ref:l,disabled:n,onClick:p,...c})});s.displayName="Button";exports.Button=s;exports.buttonVariants=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),s=require("react"),a=require("../../buttons/button/button.cjs");require("@gearbox-protocol/sdk");const l=require("../../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../../utils/z-index.cjs");function d(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const f=d(s),m={primary:"default",outlined:"outline",neutral:"neutral",white:"white",success:"success"},u=f.forwardRef(({$size:e="lg",$width:r="compact",$color:t="primary",className:n,...o},c)=>i.jsx(a.Button,{ref:c,size:e,width:r,variant:m[t],className:l.cn("inline-block whitespace-normal",n),...o}));u.displayName="StyledButton";exports.StyledButton=u;
|
|
@@ -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"),B=require("@fortawesome/free-solid-svg-icons"),a=require("@gearbox-protocol/sdk"),k=require("viem"),D=require("../../../../icon-button/icon-button.cjs"),E=require("../../../../icons/fa-icon.cjs"),W=require("../../../../separate-line/separate-line.cjs"),T=require("../../../../skeleton/skeleton.cjs");require("react");const H=require("../../../../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../../../../utils/z-index.cjs");const b=require("../../../../tip-card/tip-card.cjs"),o=require("../../../../typed-intl/index.cjs"),c=require("../../../../typography/typography.cjs"),I=require("../../../../vertical-indicator/vertical-indicator.cjs"),f=require("../../../../vertical-list/vertical-list.cjs"),A=require("../../../../vspace/vspace.cjs"),p=require("../apy-feature/apy-feature.cjs"),d=require("../points-feature/points-feature.cjs"),O=require("./rewards-tooltip-root.cjs"),U=0;function X({cellInfo:n,targetToken:r,apyListByNetwork:s,tokensList:m,strategyCreditManagers:_,onClose:v,theme:Y="modal"}){const{maxAPY:R,minCreditManager:i,bonusAPY:P,maxLeverage:F,apyLoading:u,hasPoints:L,isPointsWithAPY:M,rewards:x,debtRewards:g,rewardRates:S,debtRewardRates:N,quotaRate:$}=n,q=i?.chainId||U,h=s?.[q]?.apyList?.[r]||0,l=s?.[q]?.extraCollateralAPYList?.[i?.pool||k.zeroAddress]?.[r],V=M||!L,z=h>0||l!==void 0&&l.value>0||x.length>0||g.length>0;return e.jsxs(O.RewardsTooltipRoot,{theme:Y,children:[v&&e.jsx("div",{style:{position:"absolute",top:"-10px",right:"-10px"},children:e.jsx(D.IconButton,{size:26,buttonType:"filledDark",onClick:v,children:e.jsx(E.FaIcon,{icon:B.faXmark,style:{width:"12px",height:"12px"}})})}),z&&e.jsxs(e.Fragment,{children:[e.jsx(b.TipCard,{textColor:"dark",children:e.jsxs(w,{title:e.jsx(o.FormattedMessageTyped,{messageId:"components.rewardsTooltip.without.title"}),children:[h>0&&e.jsx(T.Skeleton,{className:"inline-block align-text-bottom",width:50,loading:u,children:e.jsx(p.APYFeatureTooltip,{value:`${a.formatPercentage(h)}%`})}),l&&l.value>0&&e.jsx(T.Skeleton,{className:"inline-block align-text-bottom",width:50,loading:u,children:e.jsx(p.APYFeatureTooltip,{title:e.jsx(o.FormattedMessageTyped,{messageId:"components.rewardsTooltip.without.extra"}),tip:e.jsx(o.FormattedMessageTyped,{messageId:"components.rewardsTooltip.without.extra.tip"}),value:`${a.formatPercentage(l.value)}%`})}),x.map(t=>e.jsx(d.PointsFeatureTooltip,{reward:t,points:t.multiplier},["base",t.multiplier,t.name,t.type,t.units].join("-"))),g.map(t=>e.jsx(d.PointsFeatureTooltip,{reward:t,points:t.multiplier,tip:e.jsx(C,{tokensList:m,strategyCreditManagers:_,reward:t})},["debt",t.multiplier,t.name,t.type,t.units,t.cm].join("-")))]})}),e.jsx(A.VSpace,{height:16})]}),e.jsxs(b.TipCard,{textColor:"dark",borderColor:"gradient",children:[e.jsx(f.VerticalList,{children:e.jsxs(w,{title:e.jsx(o.FormattedMessageTyped,{messageId:"components.rewardsTooltip.with.title",values:{leverage:F>0?`${a.formatLeverage(Number(F))}×`:""}}),children:[V&&e.jsx(T.Skeleton,{className:"inline-block align-text-bottom",width:50,loading:u,children:e.jsx(p.APYFeatureTooltip,{value:`${a.formatPercentage(R)}%`})}),x.map((t,j)=>{const y=S?.[j]||0n;return e.jsx(d.PointsFeatureTooltip,{reward:t,points:y},["base",t.multiplier,t.name,t.type,t.units].join("-"))}),g.map((t,j)=>{const y=N?.[j]||0n;return e.jsx(d.PointsFeatureTooltip,{reward:t,points:y,tip:e.jsx(C,{tokensList:m,strategyCreditManagers:_,reward:t})},["debt",t.multiplier,t.name,t.type,t.units,t.cm].join("-"))})]})}),e.jsx(W.SeparateLine,{margin:16}),e.jsxs(f.VerticalList,{children:[i&&e.jsx(I.VerticalIndicator,{label:e.jsx(c.Typography,{as:"span",color:"secondary",children:e.jsx(o.FormattedMessageTyped,{values:{symbol:m?.[i.underlyingToken]?.title||"Utilization"},messageId:"components.rewardsTooltip.with.borrowRate"})}),value:e.jsx(c.Typography,{as:"span",color:"secondary",children:`${a.formatPercentage(i.baseBorrowRate)}%`})}),i&&e.jsx(I.VerticalIndicator,{label:e.jsx(c.Typography,{as:"span",color:"secondary",children:e.jsx(o.FormattedMessageTyped,{messageId:"components.rewardsTooltip.with.quotaRate"})}),value:e.jsx(c.Typography,{as:"span",color:"secondary",children:`${a.formatPercentage(Number($))}%`})})]})]}),P&&e.jsxs(e.Fragment,{children:[e.jsx(A.VSpace,{height:16}),e.jsx(b.TipCard,{backgroundColor:"gray-10",textColor:"light",borderColor:"dark",children:e.jsx(w,{title:e.jsx(o.FormattedMessageTyped,{messageId:"components.rewardsTooltip.with.bonusAPY.title"}),children:e.jsx("div",{className:"flex-col-12",children:e.jsx(p.APYFeatureTooltip,{theme:"light",tip:e.jsx(o.FormattedMessageTyped,{messageId:"components.rewardsTooltip.with.bonusAPY.tip"}),value:`${a.formatPercentage(P.value)}%`})})})})]})]})}function w({title:n,children:r,theme:s="main"}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:H.cn("flex-col-12",s==="main"?"mb-3":"mb-2"),children:e.jsx(c.Typography,{as:"span",variant:"bodySmall",weight:s==="main"?"bold":"normal",color:s==="main"?"default":"secondary",children:n})}),e.jsx("div",{className:"flex-row-row gap-2 w-full",children:r})]})}function C({reward:n,strategyCreditManagers:r,tokensList:s}){return n.cm==="any"?e.jsx(o.FormattedMessageTyped,{messageId:"components.strategiesTable.line.points.tipAny"}):e.jsx(o.FormattedMessageTyped,{messageId:"components.strategiesTable.line.points.tip",values:{symbol:s?.[r[n.cm]?.underlyingToken||k.zeroAddress]?.title||"unknown"}})}exports.RewardsTooltipContent=X;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("lightweight-charts"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("lightweight-charts"),S=require("luxon"),h=require("../../utils/format-number.cjs"),{MIN_DISPLAY_THRESHOLD:M,MAX_EXPONENTIAL_THRESHOLD:_}=h.FORMAT_CONSTANTS,O=(t,e,a="full")=>{if(h.isBelowDisplayThreshold(t))return e?`<${M}${e}`:`<${M}`;if(t===0)return e?`0${e}`:"0";const r=h.formatNumberWithSuffix(t,{maxExponentialThreshold:_,minimumFractionDigits:0,maximumFractionDigits:a==="short"?1:0,format:a,adaptiveDecimals:a==="short"});return e?`${r}${e}`:r},X=2,p=(t,e)=>{if(h.isBelowDisplayThreshold(t))return e?`<${M}${e}`:`<${M}`;if(t===0)return e?`0${e}`:"0";const a=h.toSignificantDigits(t,X);return e?`${a}${e}`:a},w=4,y=t=>{if(h.isBelowDisplayThreshold(t))return`<${M}`;if(t===0)return"0";const e=Math.round(t),a=Math.abs(t-e);return a>0&&a<.01?t.toFixed(12).replace(/0+$/,"").replace(/\.$/,""):h.toSignificantDigits(t,w)},P=(t,e)=>{if(h.isBelowDisplayThreshold(t))return e?`<${M} ${e}`:`<${M}`;if(t===0)return e?`0 ${e}`:"0";const a=Number.isInteger(t),r=Math.abs(t),s=a&&r>=1e3,i=Math.round(t),o=Math.abs(t-i);if(o>0&&o<.01&&!s){const D=t.toFixed(12).replace(/0+$/,"").replace(/\.$/,"");return e?`${D} ${e}`:D}const F=h.formatNumberWithSuffix(t,{maxExponentialThreshold:_,minimumFractionDigits:a?0:2,maximumFractionDigits:s?1:a?0:2,format:s?"short":"full",adaptiveDecimals:s});return e?`${F} ${e}`:F},E={"%":p,$:O,token:P,none:y},b=t=>E[t]||E.token;function C(t,e,a=4){if(t===0)return e?`0 ${e}`:"0";const r=e&&Math.abs(t)>=1e3?0:a,s=t.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:r});return e?`${s} ${e}`:s}function U(t,e,a){const r=a?.yScaleMin;let s=t.length>0?Math.min(...t):0,i=t.length>0?Math.max(...t):0,o=[];const u=()=>{const n=(s+i)/2;let c=1,m="";return n>=1e9?(c=1e9,m="B"):n>=1e6?(c=1e6,m="M"):n>=1e3&&(c=1e3,m="K"),{scale:c,suffix:m}},F=8,D=.02;let x=0;const A=(n,c,m,d)=>{const l=(c>1?n/c:n).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:d,useGrouping:!1});return c>1?`${l}${m}`:l},H=(n,c,m)=>{for(let d=0;d<=F;d++){const g=new Set;let l=!0;for(const $ of n){const f=A($,c,m,d);if(g.has(f)){l=!1;break}g.add(f)}if(l)return d}return F},R=n=>{if(r!==void 0&&n<r)return"";if(n===0)return"0";const{scale:c,suffix:m}=u();return A(n,c,m,x)};return{formatter:n=>R(n),tickmarksFormatter:n=>{const{scale:c,suffix:m}=u(),d=i-s,g=d>0?o.filter(f=>Math.abs(f)>=d*D):o,l=n.filter(f=>f!==0&&!(r!==void 0&&f<r));x=H([...l,...g],c,m);const $=new Set;return n.map(f=>{if(r!==void 0&&f<r)return"";const k=f===0?"0":A(f,c,m,x);return!k||$.has(k)?"":($.add(k),k)})},updateVisibleRange:n=>{n.length>0&&(s=Math.min(...n),i=Math.max(...n))},updateLastValues:n=>{o=[...n]}}}const L=t=>S.DateTime.fromSeconds(Number(t)).toFormat("dd/LL/yyyy HH:mm"),Y=t=>S.DateTime.fromSeconds(Number(t)).toFormat("HH:mm"),q=(t,e)=>p(Number(t),e),N={time:L,"%":q};function B(t){const e=new Map;return(a,r,s)=>{const i=S.DateTime.fromSeconds(Number(a));let o;if(t===0)o=i.toFormat("HH:mm");else switch(r){case T.TickMarkType.Year:o=i.toFormat("yyyy");break;case T.TickMarkType.Month:o=i.toFormat("MMM yy");break;case T.TickMarkType.DayOfMonth:o=t>365?i.toFormat("dd MMM yy"):i.toFormat("dd MMM");break;case T.TickMarkType.Time:case T.TickMarkType.TimeWithSeconds:o=i.toFormat("HH:mm");break;default:o=i.toFormat("dd MMM")}let u=e.get(r);return u||(u=new Set,e.set(r,u)),u.has(o)?" ":(u.add(o),o)}}const I=(t,e)=>{if(t==="time"&&e&&e.length>0){const r=S.DateTime.fromSeconds(Number(e[0].time)),s=S.DateTime.fromSeconds(Number(e[e.length-1].time)),i=r.hasSame(s,"day"),o=i?0:Math.ceil(s.diff(r,"days").days);return{timeFormatter:i?Y:L,tickMarkFormatter:B(o)}}const a=N[t]||N.time;return{timeFormatter:a,tickMarkFormatter:r=>a(r,void 0)}},G=(t,e)=>I(t,e).timeFormatter;exports.createAdaptiveYAxisFormatter=U;exports.formatExactValue=C;exports.getXFormatter=G;exports.getXFormatters=I;exports.getYFormatter=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),fe=require("lightweight-charts"),f=require("react"),Ae=require("../../hooks/use-media-query.cjs"),de=require("../../utils/cn.cjs"),D=require("../../utils/colors.cjs"),U=require("./default-config.cjs"),H=require("./formatters.cjs"),Oe=require("./graph-current-value.cjs"),De=require("./graph-tooltip.cjs"),qe=require("./plugins/vertical-line.cjs");function ze(e){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const N=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(m,s,N.get?N:{enumerable:!0,get:()=>e[s]})}}return m.default=e,Object.freeze(m)}const ge=ze(f);function ke(e,m,s){const N=e.labelText??"",h=e.value,w=h===void 0?"":typeof h=="number"?m==="$"?`$${H.formatExactValue(h,void 0,s)}`:m==="%"?`${H.formatExactValue(h,void 0,s)}%`:H.formatExactValue(h,m!=="none"&&m!=="%"&&m!=="$"?m:void 0,s):String(h);return{labelText:N,valueStr:w}}function je(e,m){for(let s=e.length-1;s>=0;s--)if(Number(e[s].time)<=m)return e[s].value;return 0}const ee=[{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:"#ef4444",top:"rgba(239, 68, 68, 0.56)",bottom:"rgba(239, 68, 68, 0.04)"},{line:"#f59e0b",top:"rgba(245, 158, 11, 0.56)",bottom:"rgba(245, 158, 11, 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:"#06b6d4",top:"rgba(6, 182, 212, 0.56)",bottom:"rgba(6, 182, 212, 0.04)"},{line:"#ea580c",top:"rgba(234, 88, 12, 0.56)",bottom:"rgba(234, 88, 12, 0.04)"},{line:"#84cc16",top:"rgba(132, 204, 22, 0.56)",bottom:"rgba(132, 204, 22, 0.04)"},{line:"#d946ef",top:"rgba(217, 70, 239, 0.56)",bottom:"rgba(217, 70, 239, 0.04)"},{line:"#0ea5e9",top:"rgba(14, 165, 233, 0.56)",bottom:"rgba(14, 165, 233, 0.04)"},{line:"#14b8a6",top:"rgba(20, 184, 166, 0.56)",bottom:"rgba(20, 184, 166, 0.04)"},{line:"#eab308",top:"rgba(234, 179, 8, 0.56)",bottom:"rgba(234, 179, 8, 0.04)"},{line:"#f43f5e",top:"rgba(244, 63, 94, 0.56)",bottom:"rgba(244, 63, 94, 0.04)"},{line:"#6366f1",top:"rgba(99, 102, 241, 0.56)",bottom:"rgba(99, 102, 241, 0.04)"},{line:"#10b981",top:"rgba(16, 185, 129, 0.56)",bottom:"rgba(16, 185, 129, 0.04)"},{line:"#78716c",top:"rgba(120, 113, 108, 0.56)",bottom:"rgba(120, 113, 108, 0.04)"},{line:"#64748b",top:"rgba(100, 116, 139, 0.56)",bottom:"rgba(100, 116, 139, 0.04)"},{line:"#475569",top:"rgba(71, 85, 105, 0.56)",bottom:"rgba(71, 85, 105, 0.04)"}],$e=137.5;function be(e){if(e<ee.length)return ee[e];const s=(e-ee.length)*$e%360,N=D.hslToHex(s,70,50),{topColor:h,bottomColor:w}=D.generateColorsFromBase(N);return{line:N,top:h,bottom:w}}function Be({series:e,className:m,showLegend:s=!1,onUnselectSeries:N,xMeasureUnit:h="time",yMeasureUnit:w="token",optionsOverrides:W,verticalLineOptions:S,currentValueDecimals:te,useSharedPriceScale:P=!1,showCurrentValue:Pe=!0,graphTitle:oe,yScaleMin:me,yScaleMinMultiple:he,visibleTimeFrom:A}){const L=f.useRef(null),V=f.useRef(new Map),re=f.useRef(!1),pe=f.useRef(!0),ne=f.useRef(null),Le=f.useRef(null),O=f.useRef(null),ae=f.useRef(null),K=f.useRef(null),y=Ae.useIsMobile(),M=ge.useMemo(()=>e.flatMap(t=>t.data),[e]),Te=ge.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[Ce,le]=f.useState(()=>{if(!Te)return;const t=new Map;for(const a of e)a.data.length>0&&t.set(a.label,a.data[a.data.length-1]);return t}),[ve,E]=f.useState(null),[xe,Se]=f.useState([]);f.useEffect(()=>{const t=()=>{try{if(L.current&&O.current){const l=O.current.clientWidth,c=O.current.clientHeight;L.current.resize(l,c)}}catch{}},a=O.current,r=a?new ResizeObserver(t):null;return K.current=r,a&&r?.observe(a),()=>{a&&r?.unobserve(a),r?.disconnect(),K.current=null}},[]),f.useEffect(()=>{if(!ae.current||re.current)return;const t=U.getDefaultOptions(),a=D.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)"),r=fe.createChart(ae.current,{...t,rightPriceScale:{...t.rightPriceScale||{},visible:!y,textColor:a},...y&&{crosshair:{...t.crosshair,mode:fe.CrosshairMode.Magnet}},...W});return L.current=r,re.current=!0,()=>{K.current?.disconnect(),K.current=null,r.remove(),L.current=null,re.current=!1,V.current.clear()}},[y,W]),f.useEffect(()=>{const t=L.current;if(!t||e.length===0)return;const r=e.filter(o=>o.data.length>0).length<=1?me:he,l=h==="time"?H.getXFormatters(h,M):H.getXFormatters(h),c=M.map(o=>o.value),{formatter:u,tickmarksFormatter:d,updateVisibleRange:T,updateLastValues:p}=H.createAdaptiveYAxisFormatter(c,w,{yScaleMin:r});ne.current=T,Le.current=p;const F=e.filter(o=>o.data.length>0).map(o=>o.data[o.data.length-1].value);p(F);const k=U.getDefaultOptions();t.applyOptions({localization:{...k.localization||{},timeFormatter:o=>l.timeFormatter(parseFloat(o),void 0)},timeScale:{...k.timeScale||{},tickMarkFormatter:l.tickMarkFormatter,minBarSpacing:0}});const b=(M.length>0?Math.min(...M.map(o=>o.value)):0)<0,R=M.some(o=>o.value===0),C=!b&&R,x=e.length>1&&!P,v=e.length>1&&!P||y,_=D.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");t.applyOptions({rightPriceScale:{...k.rightPriceScale||{},visible:!v,textColor:_,...C&&{scaleMargins:{top:.3,bottom:0}}}});const X=new Set(V.current.keys()),se=new Set(e.map(o=>o.label));for(const o of X)if(!se.has(o)){const n=V.current.get(o);n&&(t.removeSeries(n),V.current.delete(o))}const Fe=U.getDefaultSeries(),ie=[];let J=0;for(let o=0;o<e.length;o++){const n=e[o],Z=be(o),q=n.lineColor??n.color??Z.line;let I,z;if(n.lineColor??n.color)if(n.topColor&&n.bottomColor)I=n.topColor,z=n.bottomColor;else if(n.topColor){const i=D.generateColorsFromBase(q);I=n.topColor,z=i.bottomColor}else if(n.bottomColor)I=D.generateColorsFromBase(q).topColor,z=n.bottomColor;else{const i=D.generateColorsFromBase(q);I=i.topColor,z=i.bottomColor}else I=n.topColor||Z.top,z=n.bottomColor||Z.bottom;if(n.data.length===0){const i=V.current.get(n.label);i&&(t.removeSeries(i),V.current.delete(n.label));continue}const Me=(n.data.length>0?Math.min(...n.data.map(i=>i.value)):0)<0,Ee=n.data.some(i=>i.value===0),_e=!Me&&Ee,Ne=P||!x||J===0?"right":`scale-${J}`;x&&ie.push({priceScaleId:Ne||"right",shouldPreventNegativeAxis:_e,seriesIndex:J});const we=(P||!x)&&r!==void 0&&typeof r=="number",Ve={lineColor:q,topColor:I,bottomColor:z,priceScaleId:Ne,priceFormat:{type:"custom",minMove:.01,formatter:we&&typeof r=="number"?i=>u(i<r?r:i):u,tickmarksFormatter:d},autoscaleInfoProvider:i=>{if(!we)return i();const G=i();if(G?.priceRange){const Y=r;G.priceRange.minValue=Y}return G}};let $=V.current.get(n.label);const B=n.data.map(i=>({...i,time:i.time}));if(A!==void 0&&B.length>0&&Number(B[0].time)>A){const i=Number(B[0].time),G=i-A,Y=86400,Ie=G>180*Y?7*Y:G>30*Y?Y:6*3600,ye=[];for(let ue=A;ue<i;ue+=Ie)ye.push({time:ue});B.unshift(...ye)}$?($.applyOptions(Ve),$.setData(B)):($=t.addSeries(fe.AreaSeries,{...Fe,...Ve}),$.setData(B),V.current.set(n.label,$)),J++}if(x&&ie.length>0)for(const o of ie)try{const n=t.priceScale(o.priceScaleId);n&&n.applyOptions({visible:!1,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:_})}catch(n){console.warn(`Failed to configure price scale ${o.priceScaleId} for series ${o.seriesIndex}:`,n)}else if(!x)try{const o=t.priceScale("right");o&&o.applyOptions({visible:!y,autoScale:!0,scaleMargins:{top:.1,bottom:r!==void 0||C?0:.1,...C&&{top:.3}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:_})}catch{}if(r!==void 0&&!y&&(P||!x)&&t.applyOptions({handleScroll:{vertTouchDrag:!1}}),M.length>0){const o=M.map(I=>Number(I.time)),n=Math.min(...o),Z=A!==void 0?Math.min(A,n):n,q=Math.max(...o);t.timeScale().setVisibleRange({from:Z,to:q})}pe.current&&(pe.current=!1);const ce=new Map;for(const o of e)o.data.length>0&&ce.set(o.label,o.data[o.data.length-1]);le(ce.size>0?ce:void 0)},[e,M,h,w,y,P,me,he,A]),f.useEffect(()=>{const t=L.current;if(!t||e.length===0)return;const a=e.length===1;let r;for(const c of e)if(c.data.length>0){r=c.data[c.data.length-1].time;break}if(!r)return;const l=c=>{const{time:u=r,seriesData:d,point:T}=c||{},p=Array.from(V.current.values());if(!T||!u){const j=new Map;for(const b of e)b.data.length>0&&j.set(b.label,b.data[b.data.length-1]);if(le(j.size>0?j:void 0),a||P)E(null);else if(p[0]&&r){const R=t.timeScale().timeToCoordinate(r),C=e[0];if(C.data.length>0){const x=C.data[C.data.length-1].value,v=p[0].priceToCoordinate(x);R!==null&&v!==null&&E({x:R,y:v})}}return}const F=new Map;let k;for(let j=0;j<e.length;j++){const b=e[j],R=p[j];if(!R)continue;const C=d?.get(R),x=C&&"value"in C?C.value:void 0;let v;if(x!==void 0)v=x;else if(a){const _=Number(u),X=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;_<X?v=Number.NaN:v=b.data[b.data.length-1]?.value??0}else v=je(b.data,Number(u));Number.isNaN(v)||(k===void 0&&(k=v),F.set(b.label,{value:v,time:u}))}if(le(F),k!==void 0&&p[0]){const b=t.timeScale().timeToCoordinate(u),R=p[0].priceToCoordinate(k);if(b!==null&&R!==null){const C=O.current;if(C){const x=C.querySelector(".LightweightChart");if(x){const v=x.getBoundingClientRect(),_=C.getBoundingClientRect(),X=b+(v.left-_.left),se=R+(v.top-_.top);E({x:X,y:se})}else E({x:b,y:R})}else E({x:b,y:R})}else E(null)}else E(null)};return t.subscribeCrosshairMove(l),y&&t.subscribeClick(l),!a&&!P&&requestAnimationFrame(()=>{const c=Array.from(V.current.values());if(c[0]&&r&&e[0]?.data.length>0){const d=t.timeScale().timeToCoordinate(r),T=e[0].data[e[0].data.length-1].value,p=c[0].priceToCoordinate(T);d!==null&&p!==null&&E({x:d,y:p})}}),()=>{t.unsubscribeCrosshairMove(l),y&&t.unsubscribeClick(l)}},[e,P,y]),f.useEffect(()=>{const t=L.current;if(!t||e.length===0)return;const a=t.timeScale(),r=()=>{if(!ne.current)return;const l=a.getVisibleRange();if(!l)return;const c=Number(l.from),u=Number(l.to),d=[];for(const T of e)for(const p of T.data){const F=Number(p.time);F>=c&&F<=u&&d.push(p.value)}d.length>0&&ne.current(d)};return a.subscribeVisibleLogicalRangeChange(r),()=>{a.unsubscribeVisibleLogicalRangeChange(r)}},[e]),f.useEffect(()=>{const t=L.current,a=Array.from(V.current.values()),r=[];if(t&&a.length>0&&S){const l=U.getDefaultVerticalLine(),c=a[0];for(const u of S){const d=new qe.VertLine(t,c,u.xCoordinate,{...l,...u.options||{}});c.attachPrimitive(d),r.push(d)}}return()=>{if(a.length>0){const l=a[0];for(const c of r)l.detachPrimitive(c)}}},[S]),f.useEffect(()=>{const t=L.current;if(!t||!S?.length){Se([]);return}const a=()=>{const c=t.timeScale(),u=S.map(d=>c.timeToCoordinate(d.xCoordinate)??null);Se(u)};a();const r=t.timeScale(),l=()=>{a()};return r.subscribeVisibleLogicalRangeChange(l),()=>{r.unsubscribeVisibleLogicalRangeChange(l)}},[S]);const Q=e.length===1,Re=ge.useMemo(()=>{if(Q&&e.length>0){const t=e[0];if(t.data.length>0)return t.data[t.data.length-1]}},[Q,e]);return g.jsxs("div",{ref:O,className:de.cn("relative z-[1] w-full h-full overflow-hidden p-0",m),children:[oe!=null&&oe!==!1&&Q?g.jsx("div",{className:"absolute top-2 left-2 right-2 z-[100] pointer-events-none",children:g.jsx("div",{className:"text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis",children:oe})}):Pe&&Q&&Re&&g.jsx(Oe.GraphCurrentValue,{point:Re,xMeasureUnit:h,yMeasureUnit:w,decimals:te}),Ce&&ve&&g.jsx(De.GraphTooltip,{points:Ce,xMeasureUnit:h,yMeasureUnit:w,series:e,position:ve,containerRef:O,decimals:te}),s&&g.jsx(Ge,{series:e,onUnselect:N}),S&&S.length>0&&xe.length===S.length&&g.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:S.map((t,a)=>{const r=xe[a],l=t.options??{},c=l.showLabel!==!1;if(r===null||!c)return null;const{labelText:u,valueStr:d}=ke(l,w,te);if(!(u||d))return null;const p=l.labelBackgroundColor??l.color??"hsl(var(--background))",F=l.labelTextColor??"hsl(var(--foreground))",k=`${String(t.xCoordinate)}-${u}`;return g.jsxs("div",{className:"absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",style:{left:r,transform:"translateX(-50%)",backgroundColor:p,color:F},children:[u&&g.jsx("span",{className:"block",children:u}),d&&g.jsx("span",{className:de.cn("block",u&&"mt-0.5"),children:d})]},k)})}),g.jsx("div",{ref:ae,className:"LightweightChart w-full h-full overflow-hidden"})]})}function Ge({series:e,onUnselect:m}){return g.jsx("div",{className:"absolute top-0 left-2 z-[10] flex flex-wrap gap-2",children:e.map((s,N)=>{const h=be(N),w=(s.lineColor??s.color)||h.line,W=s.data.length===0;return g.jsxs("div",{className:de.cn("flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",W&&"opacity-50"),children:[g.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:w}}),g.jsxs("span",{className:"text-[10px] sm:text-xs font-medium text-foreground",children:[s.label,W&&" (no data)"]}),m&&g.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),m(s.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 ${s.label}`,children:g.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:[g.jsx("title",{children:"Close"}),g.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),g.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},s.label)})})}exports.DEFAULT_SERIES_COLORS=ee;exports.Graph=Be;exports.getSeriesColorPalette=be;exports.getStepForwardValue=je;exports.getVerticalLineTooltipContent=ke;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),ge=require("lightweight-charts"),f=require("react"),Oe=require("../../hooks/use-media-query.cjs"),he=require("../../utils/cn.cjs"),z=require("../../utils/colors.cjs"),ee=require("./default-config.cjs"),Y=require("./formatters.cjs"),ze=require("./graph-current-value.cjs"),Ae=require("./graph-tooltip.cjs"),qe=require("./plugins/vertical-line.cjs");function $e(e){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const N=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(b,s,N.get?N:{enumerable:!0,get:()=>e[s]})}}return b.default=e,Object.freeze(b)}const de=$e(f);function Me(e,b,s){const N=e.labelText??"",m=e.value,w=m===void 0?"":typeof m=="number"?b==="$"?`$${Y.formatExactValue(m,void 0,s)}`:b==="%"?`${Y.formatExactValue(m,void 0,s)}%`:Y.formatExactValue(m,b!=="none"&&b!=="%"&&b!=="$"?b:void 0,s):String(m);return{labelText:N,valueStr:w}}function Pe(e,b){for(let s=e.length-1;s>=0;s--)if(Number(e[s].time)<=b)return e[s].value;return 0}const te=[{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:"#ef4444",top:"rgba(239, 68, 68, 0.56)",bottom:"rgba(239, 68, 68, 0.04)"},{line:"#f59e0b",top:"rgba(245, 158, 11, 0.56)",bottom:"rgba(245, 158, 11, 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:"#06b6d4",top:"rgba(6, 182, 212, 0.56)",bottom:"rgba(6, 182, 212, 0.04)"},{line:"#ea580c",top:"rgba(234, 88, 12, 0.56)",bottom:"rgba(234, 88, 12, 0.04)"},{line:"#84cc16",top:"rgba(132, 204, 22, 0.56)",bottom:"rgba(132, 204, 22, 0.04)"},{line:"#d946ef",top:"rgba(217, 70, 239, 0.56)",bottom:"rgba(217, 70, 239, 0.04)"},{line:"#0ea5e9",top:"rgba(14, 165, 233, 0.56)",bottom:"rgba(14, 165, 233, 0.04)"},{line:"#14b8a6",top:"rgba(20, 184, 166, 0.56)",bottom:"rgba(20, 184, 166, 0.04)"},{line:"#eab308",top:"rgba(234, 179, 8, 0.56)",bottom:"rgba(234, 179, 8, 0.04)"},{line:"#f43f5e",top:"rgba(244, 63, 94, 0.56)",bottom:"rgba(244, 63, 94, 0.04)"},{line:"#6366f1",top:"rgba(99, 102, 241, 0.56)",bottom:"rgba(99, 102, 241, 0.04)"},{line:"#10b981",top:"rgba(16, 185, 129, 0.56)",bottom:"rgba(16, 185, 129, 0.04)"},{line:"#78716c",top:"rgba(120, 113, 108, 0.56)",bottom:"rgba(120, 113, 108, 0.04)"},{line:"#64748b",top:"rgba(100, 116, 139, 0.56)",bottom:"rgba(100, 116, 139, 0.04)"},{line:"#475569",top:"rgba(71, 85, 105, 0.56)",bottom:"rgba(71, 85, 105, 0.04)"}],We=137.5;function be(e){if(e<te.length)return te[e];const s=(e-te.length)*We%360,N=z.hslToHex(s,70,50),{topColor:m,bottomColor:w}=z.generateColorsFromBase(N);return{line:N,top:m,bottom:w}}function Be({series:e,className:b,showLegend:s=!1,onUnselectSeries:N,xMeasureUnit:m="time",yMeasureUnit:w="token",optionsOverrides:H,verticalLineOptions:S,currentValueDecimals:oe,useSharedPriceScale:j=!1,showCurrentValue:je=!0,graphTitle:re,yScaleMin:me,yScaleMinMultiple:pe,visibleTimeFrom:I,disableZoom:Q=!1}){const V=f.useRef(null),y=f.useRef(new Map),ne=f.useRef(!1),Ce=f.useRef(!0),ae=f.useRef(null),Te=f.useRef(null),O=f.useRef(null),le=f.useRef(null),J=f.useRef(null),k=Oe.useIsMobile(),D=de.useMemo(()=>e.flatMap(t=>t.data),[e]),Le=de.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[ve,se]=f.useState(()=>{if(!Le)return;const t=new Map;for(const a of e)a.data.length>0&&t.set(a.label,a.data[a.data.length-1]);return t}),[xe,E]=f.useState(null),[Se,Re]=f.useState([]);f.useEffect(()=>{const t=()=>{try{if(V.current&&O.current){const l=O.current.clientWidth,c=O.current.clientHeight;V.current.resize(l,c)}}catch{}},a=O.current,r=a?new ResizeObserver(t):null;return J.current=r,a&&r?.observe(a),()=>{a&&r?.unobserve(a),r?.disconnect(),J.current=null}},[]),f.useEffect(()=>{if(!le.current||ne.current)return;const t=ee.getDefaultOptions(),a=z.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)"),r=Q?{handleScale:{mouseWheel:!1,pinch:!1,axisPressedMouseMove:!1,axisDoubleClickReset:!1},handleScroll:{mouseWheel:!1,pressedMouseMove:!1,horzTouchDrag:!1,vertTouchDrag:!1}}:{},l=ge.createChart(le.current,{...t,rightPriceScale:{...t.rightPriceScale||{},visible:!k,textColor:a},...k&&{crosshair:{...t.crosshair,mode:ge.CrosshairMode.Magnet}},...r,...H});return V.current=l,ne.current=!0,()=>{J.current?.disconnect(),J.current=null,l.remove(),V.current=null,ne.current=!1,y.current.clear()}},[k,H,Q]),f.useEffect(()=>{const t=V.current;t&&t.applyOptions(Q?{handleScale:{mouseWheel:!1,pinch:!1,axisPressedMouseMove:!1,axisDoubleClickReset:!1},handleScroll:{mouseWheel:!1,pressedMouseMove:!1,horzTouchDrag:!1,vertTouchDrag:!1}}:{handleScale:{mouseWheel:!0,pinch:!0,axisPressedMouseMove:!0,axisDoubleClickReset:!0},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0}})},[Q]),f.useEffect(()=>{const t=V.current;if(!t||e.length===0)return;const r=e.filter(o=>o.data.length>0).length<=1?me:pe,l=m==="time"?Y.getXFormatters(m,D):Y.getXFormatters(m),c=D.map(o=>o.value),{formatter:u,tickmarksFormatter:d,updateVisibleRange:T,updateLastValues:p}=Y.createAdaptiveYAxisFormatter(c,w,{yScaleMin:r});ae.current=T,Te.current=p;const L=e.filter(o=>o.data.length>0).map(o=>o.data[o.data.length-1].value);p(L);const M=ee.getDefaultOptions();t.applyOptions({localization:{...M.localization||{},timeFormatter:o=>l.timeFormatter(parseFloat(o),void 0)},timeScale:{...M.timeScale||{},tickMarkFormatter:l.tickMarkFormatter,minBarSpacing:0}});const h=(D.length>0?Math.min(...D.map(o=>o.value)):0)<0,R=D.some(o=>o.value===0),C=!h&&R,x=e.length>1&&!j,v=e.length>1&&!j||k,F=z.resolveCSSColor("hsl(var(--foreground))","rgb(0, 0, 0)");t.applyOptions({rightPriceScale:{...M.rightPriceScale||{},visible:!v,textColor:F,...C&&{scaleMargins:{top:.3,bottom:0}}}});const X=new Set(y.current.keys()),ie=new Set(e.map(o=>o.label));for(const o of X)if(!ie.has(o)){const n=y.current.get(o);n&&(t.removeSeries(n),y.current.delete(o))}const De=ee.getDefaultSeries(),ce=[];let U=0;for(let o=0;o<e.length;o++){const n=e[o],K=be(o),A=n.lineColor??n.color??K.line;let _,q;if(n.lineColor??n.color)if(n.topColor&&n.bottomColor)_=n.topColor,q=n.bottomColor;else if(n.topColor){const i=z.generateColorsFromBase(A);_=n.topColor,q=i.bottomColor}else if(n.bottomColor)_=z.generateColorsFromBase(A).topColor,q=n.bottomColor;else{const i=z.generateColorsFromBase(A);_=i.topColor,q=i.bottomColor}else _=n.topColor||K.top,q=n.bottomColor||K.bottom;if(n.data.length===0){const i=y.current.get(n.label);i&&(t.removeSeries(i),y.current.delete(n.label));continue}const Ee=(n.data.length>0?Math.min(...n.data.map(i=>i.value)):0)<0,Fe=n.data.some(i=>i.value===0),_e=!Ee&&Fe,we=j||!x||U===0?"right":`scale-${U}`;x&&ce.push({priceScaleId:we||"right",shouldPreventNegativeAxis:_e,seriesIndex:U});const ye=(j||!x)&&r!==void 0&&typeof r=="number",Ve={lineColor:A,topColor:_,bottomColor:q,priceScaleId:we,priceFormat:{type:"custom",minMove:.01,formatter:ye&&typeof r=="number"?i=>u(i<r?r:i):u,tickmarksFormatter:d},autoscaleInfoProvider:i=>{if(!ye)return i();const B=i();if(B?.priceRange){const G=r;B.priceRange.minValue=G}return B}};let $=y.current.get(n.label);const W=n.data.map(i=>({...i,time:i.time}));if(I!==void 0&&W.length>0&&Number(W[0].time)>I){const i=Number(W[0].time),B=i-I,G=86400,Ie=B>180*G?7*G:B>30*G?G:6*3600,ke=[];for(let fe=I;fe<i;fe+=Ie)ke.push({time:fe});W.unshift(...ke)}$?($.applyOptions(Ve),$.setData(W)):($=t.addSeries(ge.AreaSeries,{...De,...Ve}),$.setData(W),y.current.set(n.label,$)),U++}if(x&&ce.length>0)for(const o of ce)try{const n=t.priceScale(o.priceScaleId);n&&n.applyOptions({visible:!1,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:F})}catch(n){console.warn(`Failed to configure price scale ${o.priceScaleId} for series ${o.seriesIndex}:`,n)}else if(!x)try{const o=t.priceScale("right");o&&o.applyOptions({visible:!k,autoScale:!0,scaleMargins:{top:.1,bottom:r!==void 0||C?0:.1,...C&&{top:.3}},alignLabels:!0,borderVisible:!0,borderColor:"rgba(224, 227, 235, 0.1)",entireTextOnly:!1,textColor:F})}catch{}if(r!==void 0&&!k&&(j||!x)&&t.applyOptions({handleScroll:{vertTouchDrag:!1}}),D.length>0){const o=D.map(_=>Number(_.time)),n=Math.min(...o),K=I!==void 0?Math.min(I,n):n,A=Math.max(...o);t.timeScale().setVisibleRange({from:K,to:A})}Ce.current&&(Ce.current=!1);const ue=new Map;for(const o of e)o.data.length>0&&ue.set(o.label,o.data[o.data.length-1]);se(ue.size>0?ue:void 0)},[e,D,m,w,k,j,me,pe,I]),f.useEffect(()=>{const t=V.current;if(!t||e.length===0)return;const a=e.length===1;let r;for(const c of e)if(c.data.length>0){r=c.data[c.data.length-1].time;break}if(!r)return;const l=c=>{const{time:u=r,seriesData:d,point:T}=c||{},p=Array.from(y.current.values());if(!T||!u){const P=new Map;for(const h of e)h.data.length>0&&P.set(h.label,h.data[h.data.length-1]);if(se(P.size>0?P:void 0),a||j)E(null);else if(p[0]&&r){const R=t.timeScale().timeToCoordinate(r),C=e[0];if(C.data.length>0){const x=C.data[C.data.length-1].value,v=p[0].priceToCoordinate(x);R!==null&&v!==null&&E({x:R,y:v})}}return}const L=new Map;let M;for(let P=0;P<e.length;P++){const h=e[P],R=p[P];if(!R)continue;const C=d?.get(R),x=C&&"value"in C?C.value:void 0;let v;if(x!==void 0)v=x;else if(a){const F=Number(u),X=h.data.length>0?Number(h.data[0].time):Number.POSITIVE_INFINITY;F<X?v=Number.NaN:v=h.data[h.data.length-1]?.value??0}else v=Pe(h.data,Number(u));Number.isNaN(v)||(M===void 0&&(M=v),L.set(h.label,{value:v,time:u}))}if(se(L),M!==void 0&&p[0]){const h=t.timeScale().timeToCoordinate(u),R=p[0].priceToCoordinate(M);if(h!==null&&R!==null){const C=O.current;if(C){const x=C.querySelector(".LightweightChart");if(x){const v=x.getBoundingClientRect(),F=C.getBoundingClientRect(),X=h+(v.left-F.left),ie=R+(v.top-F.top);E({x:X,y:ie})}else E({x:h,y:R})}else E({x:h,y:R})}else E(null)}else E(null)};return t.subscribeCrosshairMove(l),k&&t.subscribeClick(l),!a&&!j&&requestAnimationFrame(()=>{const c=Array.from(y.current.values());if(c[0]&&r&&e[0]?.data.length>0){const d=t.timeScale().timeToCoordinate(r),T=e[0].data[e[0].data.length-1].value,p=c[0].priceToCoordinate(T);d!==null&&p!==null&&E({x:d,y:p})}}),()=>{t.unsubscribeCrosshairMove(l),k&&t.unsubscribeClick(l)}},[e,j,k]),f.useEffect(()=>{const t=V.current;if(!t||e.length===0)return;const a=t.timeScale(),r=()=>{if(!ae.current)return;const l=a.getVisibleRange();if(!l)return;const c=Number(l.from),u=Number(l.to),d=[];for(const T of e)for(const p of T.data){const L=Number(p.time);L>=c&&L<=u&&d.push(p.value)}d.length>0&&ae.current(d)};return a.subscribeVisibleLogicalRangeChange(r),()=>{a.unsubscribeVisibleLogicalRangeChange(r)}},[e]),f.useEffect(()=>{const t=V.current,a=Array.from(y.current.values()),r=[];if(t&&a.length>0&&S){const l=ee.getDefaultVerticalLine(),c=a[0];for(const u of S){const d=new qe.VertLine(t,c,u.xCoordinate,{...l,...u.options||{}});c.attachPrimitive(d),r.push(d)}}return()=>{if(a.length>0){const l=a[0];for(const c of r)l.detachPrimitive(c)}}},[S,e]),f.useEffect(()=>{const t=V.current;if(!t||!S?.length){Re([]);return}const a=()=>{const c=t.timeScale(),u=S.map(d=>c.timeToCoordinate(d.xCoordinate)??null);Re(u)};a();const r=t.timeScale(),l=()=>{a()};return r.subscribeVisibleLogicalRangeChange(l),()=>{r.unsubscribeVisibleLogicalRangeChange(l)}},[S,e]);const Z=e.length===1,Ne=de.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 g.jsxs("div",{ref:O,className:he.cn("relative z-[1] w-full h-full overflow-hidden p-0",b),children:[re!=null&&re!==!1&&Z?g.jsx("div",{className:"absolute top-2 left-2 right-2 z-[100] pointer-events-none",children:g.jsx("div",{className:"text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis",children:re})}):je&&Z&&Ne&&g.jsx(ze.GraphCurrentValue,{point:Ne,xMeasureUnit:m,yMeasureUnit:w,decimals:oe}),ve&&xe&&g.jsx(Ae.GraphTooltip,{points:ve,xMeasureUnit:m,yMeasureUnit:w,series:e,position:xe,containerRef:O,decimals:oe}),s&&g.jsx(Ge,{series:e,onUnselect:N}),S&&S.length>0&&Se.length===S.length&&g.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:S.map((t,a)=>{const r=Se[a],l=t.options??{},c=l.showLabel!==!1;if(r===null||!c)return null;const{labelText:u,valueStr:d}=Me(l,w,oe);if(!(u||d))return null;const p=l.labelBackgroundColor??l.color??"hsl(var(--background))",L=l.labelTextColor??"hsl(var(--foreground))",M=`${String(t.xCoordinate)}-${u}`;return g.jsxs("div",{className:"absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",style:{left:r,transform:"translateX(-50%)",backgroundColor:p,color:L},children:[u&&g.jsx("span",{className:"block",children:u}),d&&g.jsx("span",{className:he.cn("block",u&&"mt-0.5"),children:d})]},M)})}),g.jsx("div",{ref:le,className:"LightweightChart w-full h-full overflow-hidden"})]})}function Ge({series:e,onUnselect:b}){return g.jsx("div",{className:"absolute top-0 left-2 z-[10] flex flex-wrap gap-2",children:e.map((s,N)=>{const m=be(N),w=(s.lineColor??s.color)||m.line,H=s.data.length===0;return g.jsxs("div",{className:he.cn("flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",H&&"opacity-50"),children:[g.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:w}}),g.jsxs("span",{className:"text-[10px] sm:text-xs font-medium text-foreground",children:[s.label,H&&" (no data)"]}),b&&g.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),b(s.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 ${s.label}`,children:g.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:[g.jsx("title",{children:"Close"}),g.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),g.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},s.label)})})}exports.DEFAULT_SERIES_COLORS=te;exports.Graph=Be;exports.getSeriesColorPalette=be;exports.getStepForwardValue=Pe;exports.getVerticalLineTooltipContent=Me;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),y=require("react"),r=require("../../../utils/cn.cjs");function h(x){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(x){for(const e in x)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(x,e);Object.defineProperty(t,e,a.get?a:{enumerable:!0,get:()=>x[e]})}}return t.default=x,Object.freeze(t)}const b=h(y),o=b.forwardRef(({children:x,aside:t,asidePosition:e="right",asideClassName:a,mainClassName:s,mainRef:f,variant:u="default",centeredMain:w=!1,className:g,...d},v)=>{const n=u==="detail",i=e==="left",l=n&&w,c=t==null?null:m.jsx("aside",{className:r.cn("min-w-0 shrink-0",n&&!l&&["w-full","z-30 lg:w-[420px] lg:min-w-[420px] lg:max-w-[420px]","xl:w-[460px] xl:min-w-[460px] xl:max-w-[460px]","max-h-full lg:max-h-[100vh] overflow-y-visible lg:overflow-y-auto","lg:max-[2449px]:sticky lg:max-[2449px]:top-4","min-[2450px]:fixed min-[2450px]:top-28",i?"min-[2450px]:left-32":"min-[2450px]:right-32"],l&&["w-full","z-30 lg:w-[420px] lg:min-w-[420px] lg:max-w-[420px]","xl:w-[460px] xl:min-w-[460px] xl:max-w-[460px]","overflow-y-visible lg:max-h-[100vh] lg:overflow-y-auto","lg:max-[1799px]:sticky lg:max-[1799px]:top-4"],a),children:t}),p=l?m.jsx("div",{"aria-hidden":!0,className:"hidden shrink-0 min-[1800px]:block min-[1800px]:w-[8rem]"}):null;return m.jsxs("div",{ref:v,className:r.cn("flex w-full flex-col-reverse gap-6 lg:items-start",!l&&"lg:flex-row",n&&!l&&["relative mx-auto min-w-0","max-w-[calc(80rem+420px+1.5rem)]","xl:max-w-[calc(80rem+460px+1.5rem)]","min-[2450px]:block min-[2450px]:max-w-none min-[2450px]:gap-0"],l&&["relative mx-auto min-w-0 lg:flex-row","max-w-[calc(80rem+420px+1.5rem)] xl:max-w-[calc(80rem+460px+1.5rem)]","min-[1800px]:max-w-none min-[1800px]:justify-center"],g),...d,children:[e==="left"&&c,e==="right"&&p,m.jsx("div",{ref:f,className:r.cn("min-w-0",!l&&"flex-1",n&&!l&&["relative z-0 w-full","min-[2450px]:mx-auto min-[2450px]:flex-none","min-[2450px]:max-w-[min(80rem,calc(100vw-460px-8rem))]",i&&"min-[2450px]:ml-[calc(460px+8rem)]"],l&&"relative z-0 w-full flex-1 lg:max-w-[96rem]",s),children:x}),e==="left"&&p,e==="right"&&c]})});o.displayName="MainAsideLayout";exports.MainAsideLayout=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),q=require("class-variance-authority"),de=require("react"),me=require("react-dom"),pe=require("../checkbox/checkbox.cjs");require("../checkbox/checkbox-labeled.cjs");const fe=require("../currency-button/currency-button.cjs"),he=require("../health-factor/health-factor.cjs"),xe=require("@fortawesome/free-solid-svg-icons"),ge=require("../icons/fa-icon.cjs"),be=require("../slider/slider.cjs");require("../slider/slider-context.cjs");const I=require("../typed-intl/index.cjs"),j=require("../../hooks/use-media-query.cjs"),v=require("../../test-ids/smart-number-input.cjs"),ve=require("../../utils/bn-to-input-view.cjs");require("@gearbox-protocol/sdk");const ye=require("../../utils/parse-input-to-bn.cjs"),y=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");const we=require("./balance-indicator.cjs");function Ne(n){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const o in n)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(r,o,a.get?a:{enumerable:!0,get:()=>n[o]})}}return r.default=n,Object.freeze(r)}const c=Ne(de),Ie=q.cva("relative w-full text-foreground bg-gray-20 border border-gray-30 transition-[background-color] duration-100 ease-linear [&:hover]:bg-gray-30 [&:hover]:border-gray-40 data-[active=true]:bg-gray-30 data-[active=true]:outline data-[active=true]:outline-2 data-[active=true]:outline-primary data-[active=true]:outline-offset-[-2px] data-[disabled=true]:cursor-not-allowed",{variants:{size:{sm:"px-3 py-[7px] min-h-[60px] rounded-[8px]",md:"pl-4 pr-3 py-[10px] min-h-[82px] rounded-lg"}},defaultVariants:{size:"md"}}),je=q.cva("font-medium text-foreground",{variants:{size:{sm:"text-xs",md:"text-sm"}},defaultVariants:{size:"md"}}),ke=q.cva("w-full p-0 bg-transparent border-none outline-none text-foreground placeholder:text-secondary-foreground focus:outline-none",{variants:{size:{sm:"text-[18px]! leading-[21px]!",md:"text-[28px]! leading-[33px]!"}},defaultVariants:{size:"md"}});function k(n){return Math.round(n*100)}function qe(n){return n/100}function Me(n,r){if(!r)return null;const o=parseFloat(n.replace(",",".")||"0");if(!Number.isFinite(o)||o===0)return null;const a=o*r,x=Math.abs(a)<100;try{return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:x?2:0,maximumFractionDigits:x?2:0}).format(a)}catch{return"$0"}}const S=c.forwardRef(({amount:n,token:r,label:o,maxAmount:a,maxAmountLimit:h,maxButtonLabel:x,chainId:L,network:B,maxButton:V=!0,disabled:d=!1,active:D=!1,size:R="md",symbolMaxLength:E,tokenOptions:w,multiSelectMode:O=!1,onSetAmount:p,onShowSelectDialog:M,onRemove:_,onFocus:P,onBlur:$,usdPrice:C,hfSlider:l},H)=>{const{formatMessage:U}=I.useIntlTyped(),W=c.useId(),T=r?.decimals??18,Q=e=>{const s=e.target.value,[i,u]=ye.parseInputToBN(s,T);i===null||u===null||p&&p(i,u)},X=()=>{if(p){const e=a&&h&&a>h?h:a||0n,s=ve.bnToInputView(e,T);p(e,s)}},[G,z]=c.useState(!1),J=()=>{z(!0),P?.()},K=()=>{z(!1),$?.()},Y=j.useIsMobile(),Z=l?.min??1,A=l?.max??3,ee=l?.step??.01,te=Math.max(1,Math.round(1/ee)),f=R??"md",ne=Y,se=j.useIsTablet(),re=j.useIsDesktop(),ae=E??(ne?20:se?30:re?22:30),[m,N]=c.useState(!1),g=c.useRef(null),F=c.useRef(null),[oe,ce]=c.useState({});c.useLayoutEffect(()=>{if(!m||!g.current)return;const e=()=>{const s=g.current?.getBoundingClientRect();s&&ce({position:"fixed",top:s.bottom+4,right:window.innerWidth-s.right,minWidth:s.width,zIndex:9999})};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[m]),c.useEffect(()=>{if(!m)return;const e=s=>{const i=s.target,u=g.current?.contains(i),ue=F.current?.contains(i);!u&&!ue&&N(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[m]);const b=!!(w&&w.length>0),ie=!d&&b?()=>N(e=>!e):M,le=!!(r||M||b);return t.jsxs("div",{ref:H,className:Ie({size:f}),"data-testid":v.smartNumberInputTestIds.root,"data-active":G,"data-disabled":d,children:[_&&t.jsx("div",{className:"absolute top-0 right-0 flex h-5 w-5 translate-x-1/2 -translate-y-1/2 items-center justify-center","data-testid":v.smartNumberInputTestIds.close,children:t.jsx("button",{type:"button",onClick:_,className:"flex h-5 w-5 items-center justify-center rounded-full bg-muted hover:bg-muted/80 text-muted-foreground",children:t.jsx(ge.FaIcon,{icon:xe.faXmark,className:"size-3"})})}),t.jsxs("div",{className:"mb-2 flex justify-between text-sm leading-[120%]",children:[t.jsx("span",{className:y.cn(je({size:f}),"grow shrink-0 basis-0"),"data-testid":v.smartNumberInputTestIds.label,children:o??t.jsx(I.FormattedMessageTyped,{messageId:"components.smartNumberInput.amountLabel"})}),l!==void 0?t.jsxs("div",{className:"ml-auto flex w-1/2 min-w-0 items-center gap-1",children:[t.jsx("span",{className:"shrink-0 text-xs text-secondary-foreground",children:"HF"}),t.jsx("div",{className:"min-w-0 flex-1 [&>div]:px-0 [&>div]:pb-0",children:t.jsx(be.Slider,{from:k(Z),to:k(A),value:k(l.value),precision:te,markerStep:0,epsilon:0,onChangeValue:e=>l.onChange(qe(e))})}),t.jsx(he.HealthFactor,{value:Math.round(l.value*1e4),debt:1n,decimals:2,className:"shrink-0 text-xs tabular-nums"})]}):a!==void 0&&r&&t.jsx(we.BalanceIndicator,{title:x,token:r,maxAmount:a,size:f,disabled:d,maxButton:V,onMaxButtonClick:X})]}),t.jsxs("div",{className:y.cn("flex w-full max-w-full shrink-0 basis-full items-center"),children:[t.jsx("div",{className:"mr-3 grow shrink-0 basis-0",children:t.jsx("input",{type:"text",inputMode:"decimal",autoComplete:"off",autoCorrect:"off",spellCheck:"false",pattern:"^[0-9]*[.,]?[0-9]*$",placeholder:"0",value:n,onChange:Q,onFocus:J,onBlur:K,disabled:d||!p,className:y.cn(ke({size:f}),d&&"cursor-not-allowed"),"data-testid":v.smartNumberInputTestIds.input,minLength:1,maxLength:79,title:U({messageId:"components.smartNumberInput.inputTitle"})})}),le?t.jsxs("div",{ref:g,className:"shrink-0",children:[t.jsx(fe.CurrencyButton,{active:b?m:D,size:f,disabled:d,token:r,showSelectDialog:ie,chainId:L,network:B,maxLength:ae,children:r?.symbol??t.jsx(I.FormattedMessageTyped,{messageId:"components.smartNumberInput.selectToken"})}),b&&m&&me.createPortal(t.jsx("div",{ref:F,style:oe,className:"overflow-hidden rounded-lg border border-gray-30 bg-gray-20 shadow-lg",children:w?.map((e,s)=>{const i=`${W}-${s}`,u="flex w-full min-w-0 items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-gray-30";return O?t.jsxs("div",{className:u,children:[t.jsx(pe.Checkbox,{id:i,checked:!!e.checked,color:"secondary",size:"md",className:"shrink-0",onCheckedChange:()=>e.onSelect()}),t.jsxs("label",{htmlFor:i,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-left",children:[e.icon?t.jsx("span",{className:"inline-flex shrink-0 items-center",children:e.icon}):null,t.jsx("span",{className:"truncate",children:e.label})]})]},s):t.jsxs("button",{type:"button",onClick:()=>{e.onSelect(),N(!1)},className:y.cn(u,"text-left"),children:[e.icon?t.jsx("span",{className:"inline-flex shrink-0 items-center",children:e.icon}):null,t.jsx("span",{className:"truncate",children:e.label})]},s)})}),document.body)]}):null]}),C!==void 0&&(()=>{const e=Me(n,C);return e?t.jsx("div",{className:"mt-1 text-xs leading-[130%] text-secondary-foreground",children:e}):null})()]})});S.displayName="SmartNumberInput";exports.SmartNumberInput=S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),x=require("react"),re=require("sonner"),ne=require("../../hooks/use-media-query.cjs");require("@gearbox-protocol/sdk");const oe=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");const ie=require("../buttons/range-buttons/range-buttons.cjs"),j=require("../graph/graph.cjs"),se=require("../graph/graph-view.cjs"),le=require("./graph-dropdown.cjs"),ce=({size:e=16})=>o.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Expand fullscreen",children:[o.jsx("title",{children:"Expand fullscreen"}),o.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})]}),ue=({size:e=16})=>o.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Exit fullscreen",children:[o.jsx("title",{children:"Exit fullscreen"}),o.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"})]}),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),x=require("react"),re=require("sonner"),ne=require("../../hooks/use-media-query.cjs");require("@gearbox-protocol/sdk");const oe=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");const ie=require("../buttons/range-buttons/range-buttons.cjs"),j=require("../graph/graph.cjs"),se=require("../graph/graph-view.cjs"),le=require("./graph-dropdown.cjs"),ce=({size:e=16})=>o.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Expand fullscreen",children:[o.jsx("title",{children:"Expand fullscreen"}),o.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})]}),ue=({size:e=16})=>o.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"Exit fullscreen",children:[o.jsx("title",{children:"Exit fullscreen"}),o.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"})]}),N="ui-kit:tradingview-series-colors:";function M(e){if(typeof window>"u"||!window.localStorage)return new Map;try{const t=window.localStorage.getItem(N+e);if(!t)return new Map;const c=JSON.parse(t);return c==null||typeof c!="object"?new Map:new Map(Object.entries(c).filter(([,r])=>typeof r=="number"&&r>=0&&r<j.DEFAULT_SERIES_COLORS.length))}catch{return new Map}}function ae(e,t){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(N+e,JSON.stringify(Object.fromEntries(t)))}catch{}}function q(e,t){if(t.size===0)return;const c=M(e);for(const[r,b]of t)c.set(r,b);ae(e,c)}function de({data:e,yMeasureUnit:t,height:c=306,defaultGraph:r,onGraphSelected:b,graphs:m,isMultipleSelect:T,range:V,rangeList:I,setRange:F,onGraphExpanded:y,isGraphExpanded:z,onUnselectSeries:B,graphsWithNoData:D,loadingGraphs:A,noDataMessage:R="No data available for this graph",currentValueDecimals:W,containerClassName:H,useSharedPriceScale:J,showCurrentValue:$,yScaleMin:Q,yScaleMinMultiple:X,seriesColorPersistenceKey:u,...Y}){const v=x.useMemo(()=>Array.isArray(e)?e:e?[e]:[],[e]),C=x.useMemo(()=>Array.isArray(e)&&e.length>1,[e]),k=ne.useIsMobile(),Z=x.useCallback((w,S)=>{re.toast.error(R)},[R]),U=x.useMemo(()=>{if(t)return Array.isArray(t)?t[0]:t},[t]),P=(!k&&y||I.length>0||b&&m&&r)&&o.jsxs("div",{className:"z-10 w-full flex flex-row flex-wrap sm:flex-nowrap items-center gap-2",children:[o.jsx("div",{children:b&&m&&r&&o.jsx(le.GraphDropdown,{onSelected:b,items:m,defaultItem:r,multiple:T,graphsWithNoData:D,loadingGraphs:A,onNoDataSelected:Z})}),o.jsxs("div",{className:"flex flex-row flex-nowrap justify-start sm:justify-end items-center flex-1",children:[o.jsx(ie.RangeButtons,{range:V,rangeList:I,setRange:F}),!k&&y&&o.jsx("button",{type:"button",className:"px-2.5 py-1.5 flex min-w-[44px] min-h-[26px] justify-center items-center text-xs leading-[14px] font-medium text-center rounded-md border cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring bg-muted border-muted text-muted-foreground hover:border-secondary ml-1.5",onClick:y,children:z?o.jsx(ue,{size:16}):o.jsx(ce,{size:16})})]})]}),s=x.useRef(new Map),f=x.useRef(0),L=x.useRef(!1);if(m&&m.length>0&&!L.current){L.current=!0;const w=u?M(u):new Map,S=String(m[0].value);s.current.set(S,0),f.current=1;for(let n=1;n<m.length;n++){const a=String(m[n].value);if(s.current.has(a))continue;const h=w.get(a)??n;s.current.set(a,h),f.current=Math.max(f.current,h+1)}u&&q(u,s.current)}const K=x.useMemo(()=>{const w=Array.isArray(t)?t:void 0;if(u){const n=M(u);for(const[a,g]of n)s.current.has(a)||(s.current.set(a,g),f.current=Math.max(f.current,g+1))}const S=v.map((n,a)=>{const g=n?.title||`Series ${a+1}`,h=r!=null?Array.isArray(r)?r[0]?.value??r[0]:typeof r=="object"&&"value"in r?r.value:r:null,_=v.length===1?h!=null?String(h):"single":n?.id||g;if(!s.current.has(_)){const i=new Set(Array.from(s.current.values()));let l=f.current;for(let d=0;d<j.DEFAULT_SERIES_COLORS.length;d++){const p=(f.current+d)%j.DEFAULT_SERIES_COLORS.length;if(!i.has(p)){l=p;break}}s.current.set(_,l),f.current=l+1}const ee=s.current.get(_)??0,E=j.getSeriesColorPalette(ee),te=[...n?.data||[]].sort((i,l)=>{const d=typeof i.time=="number"?i.time:Number(i.time),p=typeof l.time=="number"?l.time:Number(l.time);return d-p}).reduce((i,l)=>{const d=l.time;return i.length===0||i[i.length-1].time!==d?i.push({time:d,value:l.value}):i[i.length-1]={time:d,value:l.value},i},[]),O=n?.lineColor??n?.color??void 0;return{data:te,label:g,yMeasureUnit:w?.[a]??(Array.isArray(t)?void 0:t),...O!=null?{lineColor:O,...n?.topColor!=null&&{topColor:n.topColor},...n?.bottomColor!=null&&{bottomColor:n.bottomColor}}:{color:E.line,topColor:E.top,bottomColor:E.bottom}}});return u&&s.current.size>0&&q(u,s.current),S},[v,r,t,u]),G=A!==void 0?A.size>0:C&&v.length>0?v.some(w=>!w):!e;return o.jsx("div",{style:{width:"100%",height:c?`${c}px`:void 0},className:"w-full",children:o.jsx(se.GraphViewWithData,{series:K,loading:G,toolbar:P,size:c?"full":"default",containerClassName:oe.cn("h-full",H),showLegend:C,onUnselectSeries:B,yMeasureUnit:U,currentValueDecimals:W,useSharedPriceScale:J,showCurrentValue:$,yScaleMin:Q,yScaleMinMultiple:X,...Y})})}exports.TradingView=de;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={"errors.networkError":"Network error. Can't fetch data","errors.incorrectAddressError":"Incorrect address. Please, check url","errors.noOpenedAccountsError":"You have no opened Credit Accounts. Perhaps, you have recently been liquidated? Check notification centre to see more.","errors.notFound":"Not found","errors.tooManyRequests":"Too many requests","errors.incorrectAddress":"Incorrect address","components.errorMessage.oops":"Oops...","components.alertModal.ok":"Ok","components.footer.privacy":"Privacy Notice","components.footer.terms":"Terms of Service","components.footer.disclosure":"Risk Disclosure Statement","components.footer.legalNotice":"Legal Notice","components.footer.legal":"Legal Info","components.footer.gearbox":"Copyright © Gearbox Foundation 2023-2026.","components.footer.built":"Built at ETHGlobal MarketMake hackathon.","components.footer.version":"Version {value}","components.liquidationPrice.check":"Check Area","components.loading.loading":"Loading","components.loading.loadingPercent":"Loading {percent}%","components.loading.wait":"Please wait...","components.smartNumberInput.balance":"Balance","components.smartNumberInput.inputTitle":"Token Amount","components.smartNumberInput.confirm.input":"Input","components.tipWindow.title":"Tip","components.healthFactor.low":"Extremely low! This HF may not cover possible oracle deviations.","components.headCell":"Sort by {value}","components.graphView.noData":"Can't get data for this graph","components.filterBlock.reset":"Reset All","components.filterModal.searchPlaceholder":"Search options...","components.filterModal.noOptionsAvailable":"No options available","components.filterModal.noOptionsMatchSearch":"No options match your search","components.filterModal.reset":"Reset","components.filterModal.apply":"Apply","components.APY.tip":"These APYs are derived from the underlying protocols’ APIs and may differ in reality. Check respective protocols for their methodology.","components.creditSessionDetailedLiquidation.graph.noData":"No data","components.creditSessionDetailedLiquidation.graph.legend.point":"Current price","components.creditSessionDetailedLiquidation.graph.legend.area":"Liquidation Area","components.creditSessionDetailedLiquidation.graph.tip.hf":"Health Factor","components.creditSessionDetailedLiquidation.graph.tip.price":"Price","components.creditSessionDetailedLiquidation.table.noData":"No data","components.creditSessionDetailedLiquidation.table.seeGraph":"See graph","components.creditSessionDetailedLiquidation.table.asset":"Asset","components.creditSessionDetailedLiquidation.table.currentPrice":"Current price","components.creditSessionDetailedLiquidation.table.modelPrice":"Model price","components.apyParts.features.points":"Points","components.apyParts.features.incent":"Incent.","components.apyParts.supplyAPY":"Organic APY","components.apyParts.title":"APY type","components.apyParts.supplyAPY.tip":"Yield from lending funds","components.apyParts.tokenYield":"Intrinsic APY","components.apyParts.tokenYield.tip":"Yield from holding wstETH","components.apyParts.extraAPY":"{symbol} Incentive","components.apyParts.extraAPY.tip":"Calculated at the current rate","components.apyParts.totalAPY":"Overall APY","components.apyParts.points":"{symbol} Incentive","components.apyParts.points.condition.crossDeposit":"For cross-chain deposits made via Omni","components.openCopyButtons.copy":"Copy to clipboard","components.poolAssetsTable.asset":"Asset","components.poolAssetsTable.rate":"Effective rate","components.poolAssetsTable.limits":"Limits Usage","components.poolAssetsTable.usage":"{amount} of {total}","components.poolAssetsTable.head.name":"Credit Manager","components.poolAssetsTable.head.currentDebt":"Current Debt","components.poolAssetsTable.head.assets":"Asset LT","components.poolCreditManagersTable.assets":"{amount} assets","components.creditManagerInfo.title":"Assets and LT’s","components.creditManagerInfo.info.title":"Credit Managers","components.creditManagerInfo.info.copy.tip":"Copy Credit Manager address","components.creditManagerInfo.info.minDebt":"Min debt","components.creditManagerInfo.info.maxDebt":"Max debt","components.creditManagerInfo.info.liquidationFee":"Liquid. fee","components.creditManagerInfo.info.liquidationPremium":"Liquid. premium","components.creditManagerInfo.info.interestFee":"Interest fee","components.creditManagerInfo.info.debtLimit":"Debt limit","components.creditManagerInfo.info.maxEnabledTokens":"Max tokens","dialogs.oraclesAndLTInfo.filter.hide0Quota":"Hide 0-Quota","components.oraclesAndLTInfo.title":"Oracles and LTs","components.oraclesAndLTTable.head.token":"Token","components.oraclesAndLTTable.head.oracles":"Oracles","components.oraclesAndLTTable.head.lt":"LT","components.poolTable.pool":"Market","components.poolTable.market":"Market","components.poolTable.description.universal":"Universal","components.poolTable.supply":"Supply","components.poolTable.borrowed":"Borrowed","components.poolTable.supplyApy":"Supply APY","components.poolTable.supplyApy.tip":"Annual percentage yield that you earn for supplying capital. This number constantly changes as the utilization of the Markets goes up and down","components.poolTable.depositApy":"Deposit APY","components.poolTable.depositApy.tip":"Deposit APY breakdown: base rate, extra rewards, and points","components.poolTable.borrowApy":"Borrow APY","components.poolTable.utilizationApy":"Utilization APY","components.poolTable.borrowApy.tip":"On top of the utilization borrow APY, there is a borrow quota APY for different assets","components.poolTable.utilization":"Utilization","components.poolTable.collateral":"Collateral","components.poolTable.collateral.showAll":"Show All","components.poolTable.balance":"Your Balance","components.poolTable.balance.tip":`You don't earn token rewards, only organic yield. Please migrate liquidity by using "Migrate" flow above.`,"components.poolTable.emptyList":"No Pools found","components.poolTable.notFound.dashboard":"You currently have no open Market positions.","components.poolTable.notFound.list":"No Markets found","components.poolTable.notFound.description.dashboard":"Choose earn above.","components.poolTable.notFound.description.list":"Choose another chain or toggle Show All Markets","components.poolTable.externalApy.tooltipShort":"{value} APY boost when depositing via {name}","components.poolTable.line.rwa.tip":"This is RWA market.","components.rewardsTooltip.without.title":"Without Leverage","components.rewardsTooltip.without.extra":"Extra APY","components.rewardsTooltip.without.extra.tip":"Any deposit through Gearbox","components.rewardsTooltip.with.title":"With {leverage} Leverage","components.rewardsTooltip.with.borrowRate":"{symbol} borrow rate","components.rewardsTooltip.with.quotaRate":"Quota rate","components.rewardsTooltip.with.bonusAPY.title":"Target Bonuses Yield","components.rewardsTooltip.with.bonusAPY.tip":"Expected Bonuses APY is calculated by the Asset Issuer and represents the expected value to be paid out in points.","components.rewardsTooltip.with.extra":"+ Extra APR","components.rewardsTooltip.button":"Click to show rewards details","components.strategiesTable.head.name":"Strategy","components.strategiesTable.head.rewards":"Rewards","components.strategiesTable.head.leverage":"Max Leverage","components.strategiesTable.head.earn":"You Can Earn","components.strategiesTable.body.notFound":"No strategy found","components.strategiesTable.line.disabled":"This strategy is currently not available, cause of lack or quota or liquidity. Please contact us on Discord, and we’ll assist you.","components.strategiesTable.line.name.disabled":"This strategy is currently not available","components.strategiesTable.line.points.tip":"For debt nominated in {symbol}","components.strategiesTable.line.points.tipAny":"For debt","components.strategiesTable.line.0slippage":"0-slippage","components.strategiesTable.line.0slippage.tip":"Wrapping/unwrapping happens directly through smart-contracts, so {symbol} deposits and withdrawals don't incur slippage.","components.strategiesTable.line.rwa":"RWA","components.strategiesTable.line.rwa.tip":"This strategy is available on RWA market."};module.exports=e;
|
|
1
|
+
"use strict";const e={"errors.networkError":"Network error. Can't fetch data","errors.incorrectAddressError":"Incorrect address. Please, check url","errors.noOpenedAccountsError":"You have no opened Credit Accounts. Perhaps, you have recently been liquidated? Check notification centre to see more.","errors.notFound":"Not found","errors.tooManyRequests":"Too many requests","errors.incorrectAddress":"Incorrect address","components.errorMessage.oops":"Oops...","components.alertModal.ok":"Ok","components.footer.privacy":"Privacy Notice","components.footer.terms":"Terms of Service","components.footer.disclosure":"Risk Disclosure Statement","components.footer.legalNotice":"Legal Notice","components.footer.legal":"Legal Info","components.footer.gearbox":"Copyright © Gearbox Foundation 2023-2026.","components.footer.built":"Built at ETHGlobal MarketMake hackathon.","components.footer.version":"Version {value}","components.liquidationPrice.check":"Check Area","components.loading.loading":"Loading","components.loading.loadingPercent":"Loading {percent}%","components.loading.wait":"Please wait...","components.smartNumberInput.balance":"Balance","components.smartNumberInput.amountLabel":"Amount","components.smartNumberInput.inputTitle":"Token Amount","components.smartNumberInput.confirm.input":"Input","components.smartNumberInput.selectToken":"Select token","components.tipWindow.title":"Tip","components.healthFactor.low":"Extremely low! This HF may not cover possible oracle deviations.","components.headCell":"Sort by {value}","components.graphView.noData":"Can't get data for this graph","components.filterBlock.reset":"Reset All","components.filterModal.searchPlaceholder":"Search options...","components.filterModal.noOptionsAvailable":"No options available","components.filterModal.noOptionsMatchSearch":"No options match your search","components.filterModal.reset":"Reset","components.filterModal.apply":"Apply","components.APY.tip":"These APYs are derived from the underlying protocols’ APIs and may differ in reality. Check respective protocols for their methodology.","components.creditSessionDetailedLiquidation.graph.noData":"No data","components.creditSessionDetailedLiquidation.graph.legend.point":"Current price","components.creditSessionDetailedLiquidation.graph.legend.area":"Liquidation Area","components.creditSessionDetailedLiquidation.graph.tip.hf":"Health Factor","components.creditSessionDetailedLiquidation.graph.tip.price":"Price","components.creditSessionDetailedLiquidation.table.noData":"No data","components.creditSessionDetailedLiquidation.table.seeGraph":"See graph","components.creditSessionDetailedLiquidation.table.asset":"Asset","components.creditSessionDetailedLiquidation.table.currentPrice":"Current price","components.creditSessionDetailedLiquidation.table.modelPrice":"Model price","components.apyParts.features.points":"Points","components.apyParts.features.incent":"Incent.","components.apyParts.supplyAPY":"Organic APY","components.apyParts.title":"APY type","components.apyParts.supplyAPY.tip":"Yield from lending funds","components.apyParts.tokenYield":"Intrinsic APY","components.apyParts.tokenYield.tip":"Yield from holding wstETH","components.apyParts.extraAPY":"{symbol} Incentive","components.apyParts.extraAPY.tip":"Calculated at the current rate","components.apyParts.totalAPY":"Overall APY","components.apyParts.points":"{symbol} Incentive","components.apyParts.points.condition.crossDeposit":"For cross-chain deposits made via Omni","components.openCopyButtons.copy":"Copy to clipboard","components.poolAssetsTable.asset":"Asset","components.poolAssetsTable.rate":"Effective rate","components.poolAssetsTable.limits":"Limits Usage","components.poolAssetsTable.usage":"{amount} of {total}","components.poolAssetsTable.head.name":"Credit Manager","components.poolAssetsTable.head.currentDebt":"Current Debt","components.poolAssetsTable.head.assets":"Asset LT","components.poolCreditManagersTable.assets":"{amount} assets","components.creditManagerInfo.title":"Assets and LT’s","components.creditManagerInfo.info.title":"Credit Managers","components.creditManagerInfo.info.copy.tip":"Copy Credit Manager address","components.creditManagerInfo.info.minDebt":"Min debt","components.creditManagerInfo.info.maxDebt":"Max debt","components.creditManagerInfo.info.liquidationFee":"Liquid. fee","components.creditManagerInfo.info.liquidationPremium":"Liquid. premium","components.creditManagerInfo.info.interestFee":"Interest fee","components.creditManagerInfo.info.debtLimit":"Debt limit","components.creditManagerInfo.info.maxEnabledTokens":"Max tokens","dialogs.oraclesAndLTInfo.filter.hide0Quota":"Hide 0-Quota","components.oraclesAndLTInfo.title":"Oracles and LTs","components.oraclesAndLTTable.head.token":"Token","components.oraclesAndLTTable.head.oracles":"Oracles","components.oraclesAndLTTable.head.lt":"LT","components.poolTable.pool":"Market","components.poolTable.market":"Market","components.poolTable.description.universal":"Universal","components.poolTable.supply":"Supply","components.poolTable.borrowed":"Borrowed","components.poolTable.supplyApy":"Supply APY","components.poolTable.supplyApy.tip":"Annual percentage yield that you earn for supplying capital. This number constantly changes as the utilization of the Markets goes up and down","components.poolTable.depositApy":"Deposit APY","components.poolTable.depositApy.tip":"Deposit APY breakdown: base rate, extra rewards, and points","components.poolTable.borrowApy":"Borrow APY","components.poolTable.utilizationApy":"Utilization APY","components.poolTable.borrowApy.tip":"On top of the utilization borrow APY, there is a borrow quota APY for different assets","components.poolTable.utilization":"Utilization","components.poolTable.collateral":"Collateral","components.poolTable.collateral.showAll":"Show All","components.poolTable.balance":"Your Balance","components.poolTable.balance.tip":`You don't earn token rewards, only organic yield. Please migrate liquidity by using "Migrate" flow above.`,"components.poolTable.emptyList":"No Pools found","components.poolTable.notFound.dashboard":"You currently have no open Market positions.","components.poolTable.notFound.list":"No Markets found","components.poolTable.notFound.description.dashboard":"Choose earn above.","components.poolTable.notFound.description.list":"Choose another chain or toggle Show All Markets","components.poolTable.externalApy.tooltipShort":"{value} APY boost when depositing via {name}","components.poolTable.line.rwa.tip":"This is RWA market.","components.rewardsTooltip.without.title":"Without Leverage","components.rewardsTooltip.without.extra":"Extra APY","components.rewardsTooltip.without.extra.tip":"Any deposit through Gearbox","components.rewardsTooltip.with.title":"With {leverage} Leverage","components.rewardsTooltip.with.borrowRate":"{symbol} borrow rate","components.rewardsTooltip.with.quotaRate":"Quota rate","components.rewardsTooltip.with.bonusAPY.title":"Target Bonuses Yield","components.rewardsTooltip.with.bonusAPY.tip":"Expected Bonuses APY is calculated by the Asset Issuer and represents the expected value to be paid out in points.","components.rewardsTooltip.with.extra":"+ Extra APR","components.rewardsTooltip.button":"Click to show rewards details","components.strategiesTable.head.name":"Strategy","components.strategiesTable.head.rewards":"Rewards","components.strategiesTable.head.leverage":"Max Leverage","components.strategiesTable.head.earn":"You Can Earn","components.strategiesTable.body.notFound":"No strategy found","components.strategiesTable.line.disabled":"This strategy is currently not available, cause of lack or quota or liquidity. Please contact us on Discord, and we’ll assist you.","components.strategiesTable.line.name.disabled":"This strategy is currently not available","components.strategiesTable.line.points.tip":"For debt nominated in {symbol}","components.strategiesTable.line.points.tipAny":"For debt","components.strategiesTable.line.0slippage":"0-slippage","components.strategiesTable.line.0slippage.tip":"Wrapping/unwrapping happens directly through smart-contracts, so {symbol} deposits and withdrawals don't incur slippage.","components.strategiesTable.line.rwa":"RWA","components.strategiesTable.line.rwa.tip":"This strategy is available on RWA market."};module.exports=e;
|
|
@@ -56,6 +56,7 @@ const h = x(
|
|
|
56
56
|
auto: "h-auto p-1.5",
|
|
57
57
|
xs: "px-3 py-0.5 text-xs rounded-full",
|
|
58
58
|
sm: "h-7 px-3 !text-xs !leading-[14px] rounded-[6px]",
|
|
59
|
+
md: "h-8 px-3.5 !text-sm !leading-4 rounded-[8px]",
|
|
59
60
|
default: "px-4 h-[40px] !text-[15px] !leading-[18px] rounded-[12px]",
|
|
60
61
|
lg: "px-4 h-[44px] !text-[16px] !leading-[19px] rounded-[22px]",
|
|
61
62
|
icon: "h-9 w-9 p-2"
|
|
@@ -2,37 +2,37 @@ import { jsx as a } from "react/jsx-runtime";
|
|
|
2
2
|
import * as n from "react";
|
|
3
3
|
import { Button as p } from "../../buttons/button/button.js";
|
|
4
4
|
import "@gearbox-protocol/sdk";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as s } from "../../../utils/cn.js";
|
|
6
6
|
import "sonner";
|
|
7
7
|
import "@gearbox-protocol/sdk/common-utils";
|
|
8
8
|
import "luxon";
|
|
9
9
|
import "../../../utils/z-index.js";
|
|
10
|
-
const
|
|
10
|
+
const c = {
|
|
11
11
|
primary: "default",
|
|
12
12
|
outlined: "outline",
|
|
13
13
|
neutral: "neutral",
|
|
14
14
|
white: "white",
|
|
15
15
|
success: "success"
|
|
16
|
-
},
|
|
16
|
+
}, l = n.forwardRef(
|
|
17
17
|
({
|
|
18
18
|
$size: t = "lg",
|
|
19
19
|
$width: r = "compact",
|
|
20
20
|
$color: o = "primary",
|
|
21
|
-
className:
|
|
22
|
-
...
|
|
21
|
+
className: i,
|
|
22
|
+
...e
|
|
23
23
|
}, m) => /* @__PURE__ */ a(
|
|
24
24
|
p,
|
|
25
25
|
{
|
|
26
26
|
ref: m,
|
|
27
|
-
size: t
|
|
27
|
+
size: t,
|
|
28
28
|
width: r,
|
|
29
|
-
variant:
|
|
30
|
-
className:
|
|
31
|
-
...
|
|
29
|
+
variant: c[o],
|
|
30
|
+
className: s("inline-block whitespace-normal", i),
|
|
31
|
+
...e
|
|
32
32
|
}
|
|
33
33
|
)
|
|
34
34
|
);
|
|
35
|
-
|
|
35
|
+
l.displayName = "StyledButton";
|
|
36
36
|
export {
|
|
37
|
-
|
|
37
|
+
l as StyledButton
|
|
38
38
|
};
|