@gearbox-protocol/ui-kit 4.5.2 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/cjs/components/base/apy-breakdown-body/apy-breakdown-body.cjs +1 -1
  2. package/dist/cjs/components/base/apy-breakdown-body/index.cjs +1 -1
  3. package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
  4. package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
  5. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  6. package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
  7. package/dist/cjs/components/link/link.cjs +1 -1
  8. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown.cjs +1 -1
  9. package/dist/esm/components/base/apy-breakdown-body/apy-breakdown-body.js +70 -45
  10. package/dist/esm/components/base/apy-breakdown-body/index.js +8 -7
  11. package/dist/esm/components/base/info-list/info-list.js +14 -13
  12. package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +68 -64
  13. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +109 -105
  14. package/dist/esm/components/compound-apy/compound-apy.js +22 -20
  15. package/dist/esm/components/link/link.js +14 -14
  16. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown.js +92 -79
  17. package/dist/types/components/base/apy-breakdown-body/apy-breakdown-body.d.ts +5 -0
  18. package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +3 -1
  19. package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +3 -1
  20. package/dist/types/components/compound-apy/compound-apy.d.ts +3 -1
  21. package/dist/types/components/yield-breakdown-tooltip/yield-breakdown.d.ts +3 -1
  22. package/package.json +2 -2
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../../../utils/cn.cjs"),i=require("../../../utils/internal/bps-to-percent.cjs"),c="—",u="400px";function x(t,n,s){return t==="7d"?s:n}function m(t,n=!1){const s=i.bpsToPercent(t),a=`${Math.abs(s).toFixed(2)}%`;return n&&s<0?`−${a}`:a}function f(t){return Number(Math.abs(i.bpsToPercent(t)).toFixed(2))}function p({title:t,chip:n,chipPositive:s=!1,chipTestId:a,children:r,testId:d}){return e.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-4 rounded-xl border border-border bg-card p-4","data-testid":d,children:[e.jsxs("div",{className:"flex min-h-6 items-center justify-between gap-3",children:[e.jsx("span",{className:"min-w-0 text-base font-semibold leading-5 text-foreground",children:t}),e.jsx("span",{className:o.cn("shrink-0 rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",s?"bg-success/20 text-success":"bg-muted text-muted-foreground"),"data-testid":a,children:n})]}),e.jsx("div",{className:"flex flex-col gap-3",children:r})]})}function b({label:t,value:n,subtext:s,muted:a=!1,testId:r,valueTestId:d,captionTestId:l}){return e.jsxs("div",{className:"flex items-start justify-between gap-3","data-testid":r,children:[e.jsx("span",{className:o.cn("min-w-0 text-sm font-semibold leading-5",a?"text-muted-foreground":"text-foreground"),children:t}),e.jsxs("span",{className:"flex shrink-0 flex-col items-end",children:[e.jsx("span",{className:o.cn("text-sm font-semibold leading-5 tabular-nums",a?"text-muted-foreground":"text-foreground"),"data-testid":d,children:n}),s!=null?e.jsx("span",{className:"text-xs leading-4 text-muted-foreground","data-testid":l,children:s}):null]})]})}function g(){return e.jsx("div",{className:"h-px w-full bg-divider"})}exports.APY_BREAKDOWN_TOOLTIP_WIDTH=u;exports.ApyBreakdownBody=p;exports.ApyBreakdownDivider=g;exports.ApyBreakdownRow=b;exports.BREAKDOWN_DASH=c;exports.breakdownRateValue=f;exports.formatBreakdownRate=m;exports.periodMessageId=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("react"),u=require("../../link/link.cjs"),d=require("../../../utils/cn.cjs"),i=require("../../../utils/internal/bps-to-percent.cjs"),m="—",x="400px";function f(s,e,t){return s==="7d"?t:e}function p(s,e=!1){const t=i.bpsToPercent(s),r=`${Math.abs(t).toFixed(2)}%`;return e&&t<0?`−${r}`:r}function g(s){return Number(Math.abs(i.bpsToPercent(s)).toFixed(2))}function b({title:s,chip:e,chipPositive:t=!1,chipTestId:r,children:a,testId:o}){return n.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-4 rounded-xl border border-border bg-card p-4","data-testid":o,children:[n.jsxs("div",{className:"flex min-h-6 items-center justify-between gap-3",children:[n.jsx("span",{className:"min-w-0 text-base font-semibold leading-5 text-foreground",children:s}),n.jsx("span",{className:d.cn("shrink-0 rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",t?"bg-success/20 text-success":"bg-muted text-muted-foreground"),"data-testid":r,children:e})]}),n.jsx("div",{className:"flex flex-col gap-3",children:a})]})}function w({label:s,value:e,subtext:t,muted:r=!1,testId:a,valueTestId:o,captionTestId:l}){return n.jsxs("div",{className:"flex items-start justify-between gap-3","data-testid":a,children:[n.jsx("span",{className:d.cn("min-w-0 text-sm font-semibold leading-5",r?"text-muted-foreground":"text-foreground"),children:s}),n.jsxs("span",{className:"flex shrink-0 flex-col items-end",children:[n.jsx("span",{className:d.cn("text-sm font-semibold leading-5 tabular-nums",r?"text-muted-foreground":"text-foreground"),"data-testid":o,children:e}),t!=null?n.jsx("span",{className:"text-xs leading-4 text-muted-foreground","data-testid":l,children:t}):null]})]})}function h(s){let e;try{e=new URL(s)}catch{return}if(!(e.protocol!=="https:"&&e.protocol!=="http:"))return e.hostname.split(".").slice(-2).join(".")}function j({links:s}){const e=(s??[]).flatMap(t=>{const r=h(t);return r?[{href:t,domain:r}]:[]});return e.length===0?null:n.jsx("span",{className:"block text-xs font-normal leading-4 text-muted-foreground",children:e.map(({href:t,domain:r},a)=>n.jsxs(c.Fragment,{children:[a>0?", ":null,n.jsx(u.Link,{href:t,external:!0,size:"unset",color:"secondary",children:r})]},t))})}function k(){return n.jsx("div",{className:"h-px w-full bg-divider"})}exports.APY_BREAKDOWN_TOOLTIP_WIDTH=x;exports.ApyBreakdownBody=b;exports.ApyBreakdownDivider=k;exports.ApyBreakdownRow=w;exports.BREAKDOWN_DASH=m;exports.RewardLinks=j;exports.breakdownRateValue=g;exports.formatBreakdownRate=p;exports.periodMessageId=f;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./apy-breakdown-body.cjs");exports.APY_BREAKDOWN_TOOLTIP_WIDTH=e.APY_BREAKDOWN_TOOLTIP_WIDTH;exports.ApyBreakdownBody=e.ApyBreakdownBody;exports.ApyBreakdownDivider=e.ApyBreakdownDivider;exports.ApyBreakdownRow=e.ApyBreakdownRow;exports.BREAKDOWN_DASH=e.BREAKDOWN_DASH;exports.breakdownRateValue=e.breakdownRateValue;exports.formatBreakdownRate=e.formatBreakdownRate;exports.periodMessageId=e.periodMessageId;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./apy-breakdown-body.cjs");exports.APY_BREAKDOWN_TOOLTIP_WIDTH=e.APY_BREAKDOWN_TOOLTIP_WIDTH;exports.ApyBreakdownBody=e.ApyBreakdownBody;exports.ApyBreakdownDivider=e.ApyBreakdownDivider;exports.ApyBreakdownRow=e.ApyBreakdownRow;exports.BREAKDOWN_DASH=e.BREAKDOWN_DASH;exports.RewardLinks=e.RewardLinks;exports.breakdownRateValue=e.breakdownRateValue;exports.formatBreakdownRate=e.formatBreakdownRate;exports.periodMessageId=e.periodMessageId;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("../stack/stack.cjs"),l=require("../text/use-title-text.cjs"),q=require("../values/constants.cjs");require("../../help-tip/help-tip.cjs");require("react");require("react-intl");require("clsx");require("tailwind-merge");require("@gearbox-protocol/sdk/onchain");require("../../../utils/z-index.cjs");require("viem");const d=require("../../points-icon/points-icon.cjs");require("../../token-icon/token-icon.cjs");const p=require("../../../utils/internal/apy-breakdown.cjs");require("../../tooltip/simple-tooltip.cjs");require("../../tooltip/tooltip.cjs");require("../../badge/badge.cjs");require("../../badge/chip.cjs");require("../../typography/typography.cjs");const f=require("../../vertical-indicator/vertical-indicator.cjs"),r=require("./constants.cjs");function _({children:t}){return e.jsx(u.Stack,{gap:"sm","data-testid":r.InfoListTest.root,children:t})}function o({title:t,size:i="sm",align:s="start","data-testid":n=r.InfoListTest.line,...a}){const c=l.useTitleText();return e.jsx(f.VerticalIndicator,{label:c(t),size:i,align:s,"data-testid":n,...a})}function m({data:t,title:i="components.yieldBreakdown.points"}){const s=t?p.pointProgramsOf(t):[];return s.length===0?null:e.jsx(o,{title:i,value:e.jsx("span",{className:"inline-flex flex-wrap items-center gap-1.5","data-testid":q.ValueTest.points,children:s.map(n=>e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(d.PointsIcon,{reward:{name:n.name,type:n.id},size:16}),e.jsx("span",{children:n.name})]},n.id))})})}exports.InfoListTest=r.InfoListTest;exports.InfoLine=o;exports.InfoList=_;exports.PointsInfoLine=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("../stack/stack.cjs"),l=require("../text/use-title-text.cjs"),q=require("../values/constants.cjs");require("../../help-tip/help-tip.cjs");require("react");require("react-intl");require("clsx");require("tailwind-merge");require("@gearbox-protocol/sdk/onchain");require("../../../utils/z-index.cjs");require("viem");require("../../link/link.cjs");const d=require("../../points-icon/points-icon.cjs");require("../../token-icon/token-icon.cjs");const p=require("../../../utils/internal/apy-breakdown.cjs");require("../../tooltip/simple-tooltip.cjs");require("../../tooltip/tooltip.cjs");require("../../badge/badge.cjs");require("../../badge/chip.cjs");require("../../typography/typography.cjs");const f=require("../../vertical-indicator/vertical-indicator.cjs"),r=require("./constants.cjs");function _({children:t}){return e.jsx(u.Stack,{gap:"sm","data-testid":r.InfoListTest.root,children:t})}function o({title:t,size:s="sm",align:i="start","data-testid":n=r.InfoListTest.line,...a}){const c=l.useTitleText();return e.jsx(f.VerticalIndicator,{label:c(t),size:s,align:i,"data-testid":n,...a})}function m({data:t,title:s="components.yieldBreakdown.points"}){const i=t?p.pointProgramsOf(t):[];return i.length===0?null:e.jsx(o,{title:s,value:e.jsx("span",{className:"inline-flex flex-wrap items-center gap-1.5","data-testid":q.ValueTest.points,children:i.map(n=>e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(d.PointsIcon,{reward:{name:n.name,type:n.id},size:16}),e.jsx("span",{children:n.name})]},n.id))})})}exports.InfoListTest=r.InfoListTest;exports.InfoLine=o;exports.InfoList=_;exports.PointsInfoLine=m;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../apy-breakdown-body/apy-breakdown-body.cjs"),l=require("../../no-value/no-value.cjs"),m=require("../../points-icon/points-icon.cjs"),k=require("../../token-icon/token-icon.cjs"),r=require("../../typed-intl/index.cjs"),p=require("../../../utils/internal/apy-breakdown.cjs"),t=require("./constants.cjs");function u({data:s,period:a}){const d=s?p.totalApyOf(s):void 0,i=s?.organicApy,c=s?p.tokenRewardsOf(s):[],y=s?p.pointProgramsOf(s):[];return e.jsxs(o.ApyBreakdownBody,{testId:t.PoolApyBreakdownCardTest.root,title:e.jsx(r.FormattedMessageTyped,{messageId:o.periodMessageId(a,"components.poolApyBreakdownCard.title","components.poolApyBreakdownCard.title7d")}),chip:d==null?e.jsx(l.NoValue,{reason:a}):o.formatBreakdownRate(d,!0),chipPositive:(d??0)>0,chipTestId:t.PoolApyBreakdownCardTest.net,children:[e.jsx(o.ApyBreakdownRow,{valueTestId:t.PoolApyBreakdownCardTest.value,label:e.jsx(r.FormattedMessageTyped,{messageId:o.periodMessageId(a,"components.poolApyBreakdownCard.organicApy","components.poolApyBreakdownCard.organicApy7d")}),value:i==null?e.jsx(l.NoValue,{reason:a}):o.formatBreakdownRate(i)}),c.length>0?c.map(n=>e.jsx(o.ApyBreakdownRow,{valueTestId:t.PoolApyBreakdownCardTest.value,label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(r.FormattedMessageTyped,{messageId:o.periodMessageId(a,"components.poolApyBreakdownCard.tokenIncentiveApy","components.poolApyBreakdownCard.tokenIncentiveApy7d"),values:{symbol:n.token.symbol}})}),e.jsx(k.TokenIcon,{token:n.token,symbol:n.token.symbol,size:16,className:"shrink-0"})]}),value:o.formatBreakdownRate(n.supplyApr??0)},`incentive-${n.token.address}`)):e.jsx(o.ApyBreakdownRow,{valueTestId:t.PoolApyBreakdownCardTest.value,label:e.jsx(r.FormattedMessageTyped,{messageId:o.periodMessageId(a,"components.poolApyBreakdownCard.incentiveApy","components.poolApyBreakdownCard.incentiveApy7d")}),value:s==null?e.jsx(l.NoValue,{reason:a}):o.formatBreakdownRate(0)}),y.length>0?e.jsxs(e.Fragment,{children:[e.jsx(o.ApyBreakdownDivider,{}),y.map(n=>e.jsx(o.ApyBreakdownRow,{valueTestId:t.PoolApyBreakdownCardTest.points,label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(r.FormattedMessageTyped,{messageId:"components.yieldBreakdown.programPoints",values:{name:n.name}})}),e.jsx(m.PointsIcon,{reward:{name:n.name,type:n.id},size:16,className:"shrink-0"})]}),value:n.multiplier!=null?`${n.multiplier}×`:o.BREAKDOWN_DASH},n.id))]}):null]})}exports.PoolApyBreakdownCardTest=t.PoolApyBreakdownCardTest;exports.PoolApyBreakdownCard=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../apy-breakdown-body/apy-breakdown-body.cjs"),d=require("../../no-value/no-value.cjs"),k=require("../../points-icon/points-icon.cjs"),u=require("../../token-icon/token-icon.cjs"),t=require("../../typed-intl/index.cjs"),p=require("../../../utils/internal/apy-breakdown.cjs"),r=require("./constants.cjs");function w({data:s,period:a,hideRewardLinks:m=!1}){const l=s?p.totalApyOf(s):void 0,i=s?.organicApy,c=s?p.tokenRewardsOf(s):[],y=s?p.pointProgramsOf(s):[];return e.jsxs(o.ApyBreakdownBody,{testId:r.PoolApyBreakdownCardTest.root,title:e.jsx(t.FormattedMessageTyped,{messageId:o.periodMessageId(a,"components.poolApyBreakdownCard.title","components.poolApyBreakdownCard.title7d")}),chip:l==null?e.jsx(d.NoValue,{reason:a}):o.formatBreakdownRate(l,!0),chipPositive:(l??0)>0,chipTestId:r.PoolApyBreakdownCardTest.net,children:[e.jsx(o.ApyBreakdownRow,{valueTestId:r.PoolApyBreakdownCardTest.value,label:e.jsx(t.FormattedMessageTyped,{messageId:o.periodMessageId(a,"components.poolApyBreakdownCard.organicApy","components.poolApyBreakdownCard.organicApy7d")}),value:i==null?e.jsx(d.NoValue,{reason:a}):o.formatBreakdownRate(i)}),c.length>0?c.map(n=>e.jsx(o.ApyBreakdownRow,{valueTestId:r.PoolApyBreakdownCardTest.value,label:e.jsxs("span",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(t.FormattedMessageTyped,{messageId:o.periodMessageId(a,"components.poolApyBreakdownCard.tokenIncentiveApy","components.poolApyBreakdownCard.tokenIncentiveApy7d"),values:{symbol:n.token.symbol}})}),e.jsx(u.TokenIcon,{token:n.token,symbol:n.token.symbol,size:16,className:"shrink-0"})]}),m?null:e.jsx(o.RewardLinks,{links:n.links})]}),value:o.formatBreakdownRate(n.supplyApr??0)},`incentive-${n.token.address}`)):e.jsx(o.ApyBreakdownRow,{valueTestId:r.PoolApyBreakdownCardTest.value,label:e.jsx(t.FormattedMessageTyped,{messageId:o.periodMessageId(a,"components.poolApyBreakdownCard.incentiveApy","components.poolApyBreakdownCard.incentiveApy7d")}),value:s==null?e.jsx(d.NoValue,{reason:a}):o.formatBreakdownRate(0)}),y.length>0?e.jsxs(e.Fragment,{children:[e.jsx(o.ApyBreakdownDivider,{}),y.map(n=>e.jsx(o.ApyBreakdownRow,{valueTestId:r.PoolApyBreakdownCardTest.points,label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(t.FormattedMessageTyped,{messageId:"components.yieldBreakdown.programPoints",values:{name:n.name}})}),e.jsx(k.PointsIcon,{reward:{name:n.name,type:n.id},size:16,className:"shrink-0"})]}),value:n.multiplier!=null?`${n.multiplier}×`:o.BREAKDOWN_DASH},n.id))]}):null]})}exports.PoolApyBreakdownCardTest=r.PoolApyBreakdownCardTest;exports.PoolApyBreakdownCard=w;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("@gearbox-protocol/sdk/onchain"),o=require("../apy-breakdown-body/apy-breakdown-body.cjs"),v=require("../../no-value/no-value.cjs"),M=require("../../points-icon/points-icon.cjs"),h=require("../../token-icon/token-icon.cjs"),i=require("../../typed-intl/index.cjs"),p=require("../../../utils/format-leverage.cjs"),B=require("../../../utils/internal/apy-breakdown.cjs"),r=require("./constants.cjs");function q(y){const{borrowApyAvg7D:t,quotaRateAvg7D:l,liquidationThreshold:s}=y;return t===void 0||l===void 0?null:{borrowApy:t,quotaRate:l,liquidationThreshold:s}}function N(y,t,l){const s=o.breakdownRateValue(y),n=l-t*s;return n>0&&t>0?s+Math.ceil(n/t*100)/100:s}function L({data:y,leverage:t,showFormula:l=!1,period:s}){const n=q(y),d=n&&y.collateralApyAvg7D?y.collateralApyAvg7D:void 0,x=n!==null&&d!==void 0,T=x&&n&&d?{organicApy:k.calcNetStrategyApy(n,d.organicApy,t),totalApy:k.calcNetStrategyApy(n,d.totalApy??d.organicApy,t),...d.rewards?{rewards:d.rewards}:{}}:null,c=x&&n?k.calcEffectiveBorrowApy(n,t):null,u=T===null?null:B.totalApyOf(T),b=u===null||c===null?null:u+c,_=d?B.positiveTokenRewardsOf(d):[],f=d?B.pointProgramsOf(d):[],I=_.map(a=>({reward:a,value:Math.round(t*(a.supplyApr??0))})),m=b===null?null:b-I.reduce((a,A)=>a+A.value,0),j=m!==null&&t>0?m/t:void 0,R=n&&c!==null&&t>0?(c-n.borrowApy*(t-1))/t:void 0,C=Number(p.formatLeverageExact(t)),w=c===null?void 0:o.breakdownRateValue(c),g=n&&R!==void 0&&w!==void 0?N(n.borrowApy+R,C,w):void 0,S=g!==void 0&&w!==void 0?C*g-w:void 0;return e.jsxs(o.ApyBreakdownBody,{testId:r.StrategyApyBreakdownCardTest.root,title:e.jsx(i.FormattedMessageTyped,{messageId:o.periodMessageId(s,"components.yieldBreakdown.titleNetAtLeverage","components.yieldBreakdown.titleNetAtLeverage7d"),values:{leverage:p.formatLeverage(t)}}),chip:u===null?e.jsx(v.NoValue,{reason:s}):o.formatBreakdownRate(u,!0),chipPositive:(u??0)>0,chipTestId:r.StrategyApyBreakdownCardTest.net,children:[e.jsx(o.ApyBreakdownRow,{testId:r.StrategyApyBreakdownCardTest.collateral,valueTestId:r.StrategyApyBreakdownCardTest.value,captionTestId:r.StrategyApyBreakdownCardTest.caption,label:e.jsx(i.FormattedMessageTyped,{messageId:o.periodMessageId(s,"components.yieldBreakdown.collateralApy","components.yieldBreakdown.collateralApy7d")}),value:m===null?e.jsx(v.NoValue,{reason:s}):o.formatBreakdownRate(m),subtext:l&&j!==void 0?e.jsx(i.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:p.formatLeverageExact(t),base:o.formatBreakdownRate(j)}}):void 0}),I.map(({reward:a,value:A})=>e.jsx(o.ApyBreakdownRow,{valueTestId:r.StrategyApyBreakdownCardTest.value,captionTestId:r.StrategyApyBreakdownCardTest.caption,label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(i.FormattedMessageTyped,{messageId:"components.apyParts.extraAPY",values:{symbol:a.token.symbol}})}),e.jsx(h.TokenIcon,{token:a.token,symbol:a.token.symbol,size:16,className:"shrink-0"})]}),value:o.formatBreakdownRate(A),subtext:l?e.jsx(i.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:p.formatLeverageExact(t),base:o.formatBreakdownRate(a.supplyApr??0)}}):void 0},`incentive-${a.token.address}-${a.supplyApr??0}`)),e.jsx(o.ApyBreakdownRow,{muted:!0,testId:r.StrategyApyBreakdownCardTest.borrow,valueTestId:r.StrategyApyBreakdownCardTest.value,captionTestId:r.StrategyApyBreakdownCardTest.caption,label:e.jsx(i.FormattedMessageTyped,{messageId:o.periodMessageId(s,"components.yieldBreakdown.borrowRate","components.yieldBreakdown.borrowRate7d")}),value:c===null?e.jsx(v.NoValue,{reason:s}):o.formatBreakdownRate(c),subtext:l&&g!==void 0&&S!==void 0?e.jsx(i.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.borrowFormula",values:{leverage:p.formatLeverageExact(t),totalRate:`${g.toFixed(2)}%`,borrowRate:`${Math.abs(S).toFixed(2)}%`}}):void 0}),f.length>0?e.jsxs(e.Fragment,{children:[e.jsx(o.ApyBreakdownDivider,{}),f.map(a=>e.jsx(o.ApyBreakdownRow,{valueTestId:r.StrategyApyBreakdownCardTest.points,captionTestId:r.StrategyApyBreakdownCardTest.caption,label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(i.FormattedMessageTyped,{messageId:"components.yieldBreakdown.programPoints",values:{name:a.name}})}),e.jsx(M.PointsIcon,{reward:{name:a.name,type:a.id},size:16,className:"shrink-0"})]}),value:a.multiplier!=null?`${p.formatLeverageExact(a.multiplier*t)}×`:o.BREAKDOWN_DASH,subtext:l&&a.multiplier!=null?e.jsx(i.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:p.formatLeverageExact(t),base:p.formatLeverageExact(a.multiplier)}}):void 0},a.id))]}):null]})}exports.StrategyApyBreakdownCardTest=r.StrategyApyBreakdownCardTest;exports.StrategyApyBreakdownCard=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("@gearbox-protocol/sdk/onchain"),o=require("../apy-breakdown-body/apy-breakdown-body.cjs"),B=require("../../no-value/no-value.cjs"),M=require("../../points-icon/points-icon.cjs"),q=require("../../token-icon/token-icon.cjs"),i=require("../../typed-intl/index.cjs"),p=require("../../../utils/format-leverage.cjs"),x=require("../../../utils/internal/apy-breakdown.cjs"),n=require("./constants.cjs");function N(y){const{borrowApyAvg7D:t,quotaRateAvg7D:l,liquidationThreshold:s}=y;return t===void 0||l===void 0?null:{borrowApy:t,quotaRate:l,liquidationThreshold:s}}function L(y,t,l){const s=o.breakdownRateValue(y),m=l-t*s;return m>0&&t>0?s+Math.ceil(m/t*100)/100:s}function F({data:y,leverage:t,showFormula:l=!1,period:s,hideRewardLinks:m=!1}){const r=N(y),d=r&&y.collateralApyAvg7D?y.collateralApyAvg7D:void 0,T=r!==null&&d!==void 0,b=T&&r&&d?{organicApy:v.calcNetStrategyApy(r,d.organicApy,t),totalApy:v.calcNetStrategyApy(r,d.totalApy??d.organicApy,t),...d.rewards?{rewards:d.rewards}:{}}:null,c=T&&r?v.calcEffectiveBorrowApy(r,t):null,u=b===null?null:x.totalApyOf(b),f=u===null||c===null?null:u+c,h=d?x.positiveTokenRewardsOf(d):[],I=d?x.pointProgramsOf(d):[],j=h.map(a=>({reward:a,value:Math.round(t*(a.supplyApr??0))})),w=f===null?null:f-j.reduce((a,A)=>a+A.value,0),R=w!==null&&t>0?w/t:void 0,C=r&&c!==null&&t>0?(c-r.borrowApy*(t-1))/t:void 0,S=Number(p.formatLeverageExact(t)),g=c===null?void 0:o.breakdownRateValue(c),k=r&&C!==void 0&&g!==void 0?L(r.borrowApy+C,S,g):void 0,_=k!==void 0&&g!==void 0?S*k-g:void 0;return e.jsxs(o.ApyBreakdownBody,{testId:n.StrategyApyBreakdownCardTest.root,title:e.jsx(i.FormattedMessageTyped,{messageId:o.periodMessageId(s,"components.yieldBreakdown.titleNetAtLeverage","components.yieldBreakdown.titleNetAtLeverage7d"),values:{leverage:p.formatLeverage(t)}}),chip:u===null?e.jsx(B.NoValue,{reason:s}):o.formatBreakdownRate(u,!0),chipPositive:(u??0)>0,chipTestId:n.StrategyApyBreakdownCardTest.net,children:[e.jsx(o.ApyBreakdownRow,{testId:n.StrategyApyBreakdownCardTest.collateral,valueTestId:n.StrategyApyBreakdownCardTest.value,captionTestId:n.StrategyApyBreakdownCardTest.caption,label:e.jsx(i.FormattedMessageTyped,{messageId:o.periodMessageId(s,"components.yieldBreakdown.collateralApy","components.yieldBreakdown.collateralApy7d")}),value:w===null?e.jsx(B.NoValue,{reason:s}):o.formatBreakdownRate(w),subtext:l&&R!==void 0?e.jsx(i.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:p.formatLeverageExact(t),base:o.formatBreakdownRate(R)}}):void 0}),j.map(({reward:a,value:A})=>e.jsx(o.ApyBreakdownRow,{valueTestId:n.StrategyApyBreakdownCardTest.value,captionTestId:n.StrategyApyBreakdownCardTest.caption,label:e.jsxs("span",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(i.FormattedMessageTyped,{messageId:"components.apyParts.extraAPY",values:{symbol:a.token.symbol}})}),e.jsx(q.TokenIcon,{token:a.token,symbol:a.token.symbol,size:16,className:"shrink-0"})]}),m?null:e.jsx(o.RewardLinks,{links:a.links})]}),value:o.formatBreakdownRate(A),subtext:l?e.jsx(i.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:p.formatLeverageExact(t),base:o.formatBreakdownRate(a.supplyApr??0)}}):void 0},`incentive-${a.token.address}-${a.supplyApr??0}`)),e.jsx(o.ApyBreakdownRow,{muted:!0,testId:n.StrategyApyBreakdownCardTest.borrow,valueTestId:n.StrategyApyBreakdownCardTest.value,captionTestId:n.StrategyApyBreakdownCardTest.caption,label:e.jsx(i.FormattedMessageTyped,{messageId:o.periodMessageId(s,"components.yieldBreakdown.borrowRate","components.yieldBreakdown.borrowRate7d")}),value:c===null?e.jsx(B.NoValue,{reason:s}):o.formatBreakdownRate(c),subtext:l&&k!==void 0&&_!==void 0?e.jsx(i.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.borrowFormula",values:{leverage:p.formatLeverageExact(t),totalRate:`${k.toFixed(2)}%`,borrowRate:`${Math.abs(_).toFixed(2)}%`}}):void 0}),I.length>0?e.jsxs(e.Fragment,{children:[e.jsx(o.ApyBreakdownDivider,{}),I.map(a=>e.jsx(o.ApyBreakdownRow,{valueTestId:n.StrategyApyBreakdownCardTest.points,captionTestId:n.StrategyApyBreakdownCardTest.caption,label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(i.FormattedMessageTyped,{messageId:"components.yieldBreakdown.programPoints",values:{name:a.name}})}),e.jsx(M.PointsIcon,{reward:{name:a.name,type:a.id},size:16,className:"shrink-0"})]}),value:a.multiplier!=null?`${p.formatLeverageExact(a.multiplier*t)}×`:o.BREAKDOWN_DASH,subtext:l&&a.multiplier!=null?e.jsx(i.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:p.formatLeverageExact(t),base:p.formatLeverageExact(a.multiplier)}}):void 0},a.id))]}):null]})}exports.StrategyApyBreakdownCardTest=n.StrategyApyBreakdownCardTest;exports.StrategyApyBreakdownCard=F;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("react"),w=require("../no-value/no-value.cjs"),_=require("../yield-breakdown-tooltip/yield-breakdown.cjs"),v=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/onchain");const C=require("../../utils/internal/format-percent.cjs");require("../../utils/z-index.cjs");const t=require("../../utils/internal/apy-breakdown.cjs"),q=require("../../utils/internal/bps-to-percent.cjs"),l=14;function P(){const n=`additional-incentives-${j.useId().replace(/:/g,"")}`;return e.jsxs("svg",{width:l,height:l,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"size-3.5 shrink-0 overflow-clip",role:"img","aria-label":"Incentives",children:[e.jsx("title",{children:"Incentives"}),e.jsx("path",{d:"M7 14C10.866 14 14 10.866 14 7C14 3.13401 10.866 0 7 0C3.13401 0 0 3.13401 0 7C0 10.866 3.13401 14 7 14Z",fill:`url(#${n})`}),e.jsx("path",{d:"M7 3.75V10.25M3.75 7H10.25",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:n,x1:"0",y1:"7",x2:"14",y2:"7",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FF2D8D"}),e.jsx("stop",{offset:"1",stopColor:"#FF6C20"})]})})]})}function c(n){return n==null?!1:t.positiveTokenRewardsOf(n).length>0||t.pointProgramsOf(n).length>0}function k({apy:n,maxLeverage:u,collateralApy:r,borrowApy:a,quotaRate:d,decimals:p=2,tooltip:h=!0,period:x,className:s}){if(!n)return e.jsx(w.NoValue,{});const i=t.totalApyOf(n),f=c(n)||c(r),m=h&&i>=1,o=()=>{const g=C.formatCompactPercent(q.bpsToPercent(i),p);return e.jsxs("div",{className:v.cn("inline-flex items-center gap-1.5",s),children:[e.jsx("span",{className:"inline-flex items-center",children:g}),f?e.jsx(P,{}):null]})};return m?e.jsx(_.YieldBreakdownTooltip,{supplyApy:n,maxLeverage:u,collateralApy:r,borrowApy:a,quotaRate:d,period:x,className:s,children:o()}):o()}exports.CompoundAPY=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("react"),_=require("../no-value/no-value.cjs"),v=require("../yield-breakdown-tooltip/yield-breakdown.cjs"),C=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/onchain");const q=require("../../utils/internal/format-percent.cjs");require("../../utils/z-index.cjs");const t=require("../../utils/internal/apy-breakdown.cjs"),P=require("../../utils/internal/bps-to-percent.cjs"),l=14;function k(){const n=`additional-incentives-${w.useId().replace(/:/g,"")}`;return e.jsxs("svg",{width:l,height:l,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"size-3.5 shrink-0 overflow-clip",role:"img","aria-label":"Incentives",children:[e.jsx("title",{children:"Incentives"}),e.jsx("path",{d:"M7 14C10.866 14 14 10.866 14 7C14 3.13401 10.866 0 7 0C3.13401 0 0 3.13401 0 7C0 10.866 3.13401 14 7 14Z",fill:`url(#${n})`}),e.jsx("path",{d:"M7 3.75V10.25M3.75 7H10.25",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:n,x1:"0",y1:"7",x2:"14",y2:"7",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FF2D8D"}),e.jsx("stop",{offset:"1",stopColor:"#FF6C20"})]})})]})}function c(n){return n==null?!1:t.positiveTokenRewardsOf(n).length>0||t.pointProgramsOf(n).length>0}function I({apy:n,maxLeverage:u,collateralApy:r,borrowApy:a,quotaRate:d,decimals:p=2,tooltip:h=!0,period:x,hideRewardLinks:f,className:s}){if(!n)return e.jsx(_.NoValue,{});const i=t.totalApyOf(n),m=c(n)||c(r),g=h&&i>=1,o=()=>{const j=q.formatCompactPercent(P.bpsToPercent(i),p);return e.jsxs("div",{className:C.cn("inline-flex items-center gap-1.5",s),children:[e.jsx("span",{className:"inline-flex items-center",children:j}),m?e.jsx(k,{}):null]})};return g?e.jsx(v.YieldBreakdownTooltip,{supplyApy:n,maxLeverage:u,collateralApy:r,borrowApy:a,quotaRate:d,period:x,hideRewardLinks:f,className:s,children:o()}):o()}exports.CompoundAPY=I;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),b=require("@gearbox-protocol/static"),g=require("class-variance-authority"),N=require("../base-link/base-link.cjs"),h=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/onchain");require("../../utils/z-index.cjs");const k=g.cva("[&_.icon-wrap]:-mt-px [&_.icon-wrap]:pl-1.5 [&_.icon-wrap]:leading-none [&_.icon-wrap]:text-secondary-foreground hover:[&_.icon-wrap]:text-foreground",{variants:{variant:{default:"[&_.content-wrap]:border-b [&_.content-wrap]:border-transparent hover:[&_.content-wrap]:border-foreground",underlined:"[&_.content-wrap]:border-b [&_.content-wrap]:border-gray-110 hover:[&_.content-wrap]:border-foreground",unset:"[&_.content-wrap]:border-0"}},defaultVariants:{variant:"default"}});function p({className:d,children:e,href:u,target:m,variant:r="default",size:x="default",color:w="main",external:t=!1,asChild:f=!1,leadingIcon:c,...j}){const a=t?n.jsx("span",{className:"icon-wrap -mt-px pl-1.5 leading-none",children:n.jsx(b.IconExternal,{size:14})}):null,o=c?n.jsx("span",{className:"icon-wrap-start -mt-px pr-1.5 leading-none",children:c}):null,i=o?n.jsxs("span",{className:"inline-flex items-center",children:[o,n.jsx("span",{className:"content-wrap",children:e}),a]}):t&&typeof e=="string"?(()=>{const s=e.trimEnd().lastIndexOf(" "),l=s===-1?"":e.slice(0,s+1),_=s===-1?e:e.slice(s+1);return n.jsxs(n.Fragment,{children:[l?n.jsx("span",{className:"content-wrap",children:l}):null,n.jsxs("span",{className:"inline-flex items-center whitespace-nowrap",children:[n.jsx("span",{className:"content-wrap",children:_}),a]})]})})():a?n.jsxs("span",{className:"inline-flex items-center",children:[n.jsx("span",{className:"content-wrap",children:e}),a]}):n.jsx("span",{className:"content-wrap",children:e});return n.jsx(N.BaseLink,{href:u,target:m,external:t,variant:r==="underlined"?"default":r,size:x,color:w,className:h.cn(k({variant:r}),d),...j,children:f?n.jsx("span",{children:i}):i})}p.displayName="Link";exports.Link=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),b=require("@gearbox-protocol/static"),N=require("class-variance-authority"),g=require("../base-link/base-link.cjs"),h=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/onchain");require("../../utils/z-index.cjs");const k=N.cva("[&_.icon-wrap]:-mt-px [&_.icon-wrap]:pl-1.5 [&_.icon-wrap]:leading-none [&_.icon-wrap]:text-secondary-foreground hover:[&_.icon-wrap]:text-foreground",{variants:{variant:{default:"[&_.content-wrap]:border-b [&_.content-wrap]:border-transparent hover:[&_.content-wrap]:border-foreground",underlined:"[&_.content-wrap]:border-b [&_.content-wrap]:border-gray-110 hover:[&_.content-wrap]:border-foreground",unset:"[&_.content-wrap]:border-0"}},defaultVariants:{variant:"default"}});function p({className:d,children:e,href:u,target:m,variant:r="default",size:x="default",color:w="main",external:t=!1,asChild:f=!1,leadingIcon:c,...j}){const a=t?n.jsx("span",{className:"icon-wrap -mt-px pl-1.5 leading-none",children:n.jsx(b.IconExternal,{size:14})}):null,o=c?n.jsx("span",{className:"icon-wrap-start -mt-px pr-1.5 leading-none",children:c}):null,i=o?n.jsxs("span",{className:"inline-flex items-center",children:[o,n.jsx("span",{className:"content-wrap",children:e}),a]}):t&&typeof e=="string"?(()=>{const s=e.trimEnd().lastIndexOf(" "),l=s===-1?"":e.slice(0,s+1),_=s===-1?e:e.slice(s+1);return n.jsxs(n.Fragment,{children:[l?n.jsx("span",{className:"content-wrap",children:l}):null,n.jsxs("span",{className:"inline-flex items-center whitespace-nowrap",children:[n.jsx("span",{className:"pb-px",children:n.jsx("span",{className:"content-wrap",children:_})}),a]})]})})():a?n.jsxs("span",{className:"inline-flex items-center",children:[n.jsx("span",{className:"content-wrap",children:e}),a]}):n.jsx("span",{className:"content-wrap",children:e});return n.jsx(g.BaseLink,{href:u,target:m,external:t,variant:r==="underlined"?"default":r,size:x,color:w,className:h.cn(k({variant:r}),d),...j,children:f?n.jsx("span",{children:i}):i})}p.displayName="Link";exports.Link=p;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../base/apy-breakdown-body/apy-breakdown-body.cjs"),B=require("../base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs"),g=require("../points-icon/points-icon.cjs"),x=require("../token-icon/token-icon.cjs"),l=require("../typed-intl/index.cjs"),j=require("../../utils/format-leverage.cjs"),u=require("../../utils/internal/apy-breakdown.cjs"),A=require("./yield-breakdown-tooltip.cjs");function v({supplyApy:a,maxLeverage:r,collateralApy:m,borrowApy:d,quotaRate:i,period:s,children:t,className:p,open:y}){const c=r!==void 0&&r>0;return e.jsx(A.ApyBreakdownTooltip,{placement:"bottom",title:e.jsx("span",{className:p,children:t}),triggerClassName:p,open:y,children:c?e.jsx(_,{supplyApy:a,maxLeverage:r,collateralApy:m,borrowApy:d,quotaRate:i,period:s}):e.jsx(B.PoolApyBreakdownCard,{data:a,period:s})})}function _({supplyApy:a,maxLeverage:r,collateralApy:m,borrowApy:d,quotaRate:i,period:s}){const t=m,p=t?u.tokenRewardsOf(t):[],y=u.pointProgramsOf(a),c=u.totalApyOf(a),w=d!=null||i!=null?(d??0)+(i??0):void 0,k=y.filter(o=>o.multiplier!=null);return e.jsxs(n.ApyBreakdownBody,{title:e.jsx(l.FormattedMessageTyped,{messageId:n.periodMessageId(s,"components.yieldBreakdown.titleNetAtLeverage","components.yieldBreakdown.titleNetAtLeverage7d"),values:{leverage:j.formatLeverage(r)}}),chip:n.formatBreakdownRate(c,!0),chipPositive:c>0,children:[t?.organicApy!=null?e.jsx(n.ApyBreakdownRow,{muted:t.organicApy<0,label:e.jsx(l.FormattedMessageTyped,{messageId:n.periodMessageId(s,"components.yieldBreakdown.collateralApy","components.yieldBreakdown.collateralApy7d")}),value:n.formatBreakdownRate(t.organicApy)}):null,p.map(o=>o.supplyApr==null?null:e.jsx(n.ApyBreakdownRow,{muted:o.supplyApr<0,label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(l.FormattedMessageTyped,{messageId:"components.apyParts.extraAPY",values:{symbol:o.token.symbol}})}),e.jsx(x.TokenIcon,{token:o.token,size:20})]}),value:n.formatBreakdownRate(o.supplyApr)},`incentive-${o.token.address}-${o.supplyApr}`)),w!=null?e.jsx(n.ApyBreakdownRow,{muted:!0,label:e.jsx(l.FormattedMessageTyped,{messageId:n.periodMessageId(s,"components.yieldBreakdown.borrowRate","components.yieldBreakdown.borrowRate7d")}),value:n.formatBreakdownRate(w)}):null,k.length>0?e.jsxs(e.Fragment,{children:[e.jsx(n.ApyBreakdownDivider,{}),k.map(o=>e.jsx(n.ApyBreakdownRow,{label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(l.FormattedMessageTyped,{messageId:"components.yieldBreakdown.programPoints",values:{name:o.name}})}),e.jsx(g.PointsIcon,{reward:{name:o.name,type:o.id},size:20})]}),value:`${o.multiplier}×`},`points-${o.id}`))]}):null]})}exports.YieldBreakdownTooltip=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../base/apy-breakdown-body/apy-breakdown-body.cjs"),g=require("../base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs"),x=require("../points-icon/points-icon.cjs"),j=require("../token-icon/token-icon.cjs"),l=require("../typed-intl/index.cjs"),A=require("../../utils/format-leverage.cjs"),k=require("../../utils/internal/apy-breakdown.cjs"),f=require("./yield-breakdown-tooltip.cjs");function v({supplyApy:a,maxLeverage:r,collateralApy:u,borrowApy:d,quotaRate:i,period:t,hideRewardLinks:p=!1,children:s,className:c,open:y}){const m=r!==void 0&&r>0;return e.jsx(f.ApyBreakdownTooltip,{placement:"bottom",title:e.jsx("span",{className:c,children:s}),triggerClassName:c,open:y,children:m?e.jsx(_,{supplyApy:a,maxLeverage:r,collateralApy:u,borrowApy:d,quotaRate:i,period:t,hideRewardLinks:p}):e.jsx(g.PoolApyBreakdownCard,{data:a,period:t,hideRewardLinks:p})})}function _({supplyApy:a,maxLeverage:r,collateralApy:u,borrowApy:d,quotaRate:i,period:t,hideRewardLinks:p}){const s=u,c=s?k.tokenRewardsOf(s):[],y=k.pointProgramsOf(a),m=k.totalApyOf(a),w=d!=null||i!=null?(d??0)+(i??0):void 0,B=y.filter(o=>o.multiplier!=null);return e.jsxs(n.ApyBreakdownBody,{title:e.jsx(l.FormattedMessageTyped,{messageId:n.periodMessageId(t,"components.yieldBreakdown.titleNetAtLeverage","components.yieldBreakdown.titleNetAtLeverage7d"),values:{leverage:A.formatLeverage(r)}}),chip:n.formatBreakdownRate(m,!0),chipPositive:m>0,children:[s?.organicApy!=null?e.jsx(n.ApyBreakdownRow,{muted:s.organicApy<0,label:e.jsx(l.FormattedMessageTyped,{messageId:n.periodMessageId(t,"components.yieldBreakdown.collateralApy","components.yieldBreakdown.collateralApy7d")}),value:n.formatBreakdownRate(s.organicApy)}):null,c.map(o=>o.supplyApr==null?null:e.jsx(n.ApyBreakdownRow,{muted:o.supplyApr<0,label:e.jsxs("span",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(l.FormattedMessageTyped,{messageId:"components.apyParts.extraAPY",values:{symbol:o.token.symbol}})}),e.jsx(j.TokenIcon,{token:o.token,size:20})]}),p?null:e.jsx(n.RewardLinks,{links:o.links})]}),value:n.formatBreakdownRate(o.supplyApr)},`incentive-${o.token.address}-${o.supplyApr}`)),w!=null?e.jsx(n.ApyBreakdownRow,{muted:!0,label:e.jsx(l.FormattedMessageTyped,{messageId:n.periodMessageId(t,"components.yieldBreakdown.borrowRate","components.yieldBreakdown.borrowRate7d")}),value:n.formatBreakdownRate(w)}):null,B.length>0?e.jsxs(e.Fragment,{children:[e.jsx(n.ApyBreakdownDivider,{}),B.map(o=>e.jsx(n.ApyBreakdownRow,{label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(l.FormattedMessageTyped,{messageId:"components.yieldBreakdown.programPoints",values:{name:o.name}})}),e.jsx(x.PointsIcon,{reward:{name:o.name,type:o.id},size:20})]}),value:`${o.multiplier}×`},`points-${o.id}`))]}):null]})}exports.YieldBreakdownTooltip=v;
@@ -1,33 +1,35 @@
1
- import { jsxs as d, jsx as a } from "react/jsx-runtime";
1
+ import { jsxs as s, jsx as a } from "react/jsx-runtime";
2
+ import { Fragment as m } from "react";
3
+ import { Link as u } from "../../link/link.js";
2
4
  import { cn as i } from "../../../utils/cn.js";
3
5
  import { bpsToPercent as l } from "../../../utils/internal/bps-to-percent.js";
4
- const x = "—", p = "400px";
5
- function b(e, n, t) {
6
- return e === "7d" ? t : n;
6
+ const w = "—", N = "400px";
7
+ function k(n, e, t) {
8
+ return n === "7d" ? t : e;
7
9
  }
8
- function g(e, n = !1) {
9
- const t = l(e), s = `${Math.abs(t).toFixed(2)}%`;
10
- return n && t < 0 ? `−${s}` : s;
10
+ function y(n, e = !1) {
11
+ const t = l(n), r = `${Math.abs(t).toFixed(2)}%`;
12
+ return e && t < 0 ? `−${r}` : r;
11
13
  }
12
- function h(e) {
13
- return Number(Math.abs(l(e)).toFixed(2));
14
+ function v(n) {
15
+ return Number(Math.abs(l(n)).toFixed(2));
14
16
  }
15
- function N({
16
- title: e,
17
- chip: n,
17
+ function A({
18
+ title: n,
19
+ chip: e,
18
20
  chipPositive: t = !1,
19
- chipTestId: s,
20
- children: r,
21
- testId: o
21
+ chipTestId: r,
22
+ children: o,
23
+ testId: d
22
24
  }) {
23
- return /* @__PURE__ */ d(
25
+ return /* @__PURE__ */ s(
24
26
  "div",
25
27
  {
26
28
  className: "flex w-full min-w-0 flex-col gap-4 rounded-xl border border-border bg-card p-4",
27
- "data-testid": o,
29
+ "data-testid": d,
28
30
  children: [
29
- /* @__PURE__ */ d("div", { className: "flex min-h-6 items-center justify-between gap-3", children: [
30
- /* @__PURE__ */ a("span", { className: "min-w-0 text-base font-semibold leading-5 text-foreground", children: e }),
31
+ /* @__PURE__ */ s("div", { className: "flex min-h-6 items-center justify-between gap-3", children: [
32
+ /* @__PURE__ */ a("span", { className: "min-w-0 text-base font-semibold leading-5 text-foreground", children: n }),
31
33
  /* @__PURE__ */ a(
32
34
  "span",
33
35
  {
@@ -35,51 +37,51 @@ function N({
35
37
  "shrink-0 rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",
36
38
  t ? "bg-success/20 text-success" : "bg-muted text-muted-foreground"
37
39
  ),
38
- "data-testid": s,
39
- children: n
40
+ "data-testid": r,
41
+ children: e
40
42
  }
41
43
  )
42
44
  ] }),
43
- /* @__PURE__ */ a("div", { className: "flex flex-col gap-3", children: r })
45
+ /* @__PURE__ */ a("div", { className: "flex flex-col gap-3", children: o })
44
46
  ]
45
47
  }
46
48
  );
47
49
  }
48
- function w({
49
- label: e,
50
- value: n,
50
+ function B({
51
+ label: n,
52
+ value: e,
51
53
  subtext: t,
52
- muted: s = !1,
53
- testId: r,
54
- valueTestId: o,
54
+ muted: r = !1,
55
+ testId: o,
56
+ valueTestId: d,
55
57
  captionTestId: c
56
58
  }) {
57
- return /* @__PURE__ */ d(
59
+ return /* @__PURE__ */ s(
58
60
  "div",
59
61
  {
60
62
  className: "flex items-start justify-between gap-3",
61
- "data-testid": r,
63
+ "data-testid": o,
62
64
  children: [
63
65
  /* @__PURE__ */ a(
64
66
  "span",
65
67
  {
66
68
  className: i(
67
69
  "min-w-0 text-sm font-semibold leading-5",
68
- s ? "text-muted-foreground" : "text-foreground"
70
+ r ? "text-muted-foreground" : "text-foreground"
69
71
  ),
70
- children: e
72
+ children: n
71
73
  }
72
74
  ),
73
- /* @__PURE__ */ d("span", { className: "flex shrink-0 flex-col items-end", children: [
75
+ /* @__PURE__ */ s("span", { className: "flex shrink-0 flex-col items-end", children: [
74
76
  /* @__PURE__ */ a(
75
77
  "span",
76
78
  {
77
79
  className: i(
78
80
  "text-sm font-semibold leading-5 tabular-nums",
79
- s ? "text-muted-foreground" : "text-foreground"
81
+ r ? "text-muted-foreground" : "text-foreground"
80
82
  ),
81
- "data-testid": o,
82
- children: n
83
+ "data-testid": d,
84
+ children: e
83
85
  }
84
86
  ),
85
87
  t != null ? /* @__PURE__ */ a(
@@ -95,16 +97,39 @@ function w({
95
97
  }
96
98
  );
97
99
  }
98
- function y() {
100
+ function f(n) {
101
+ let e;
102
+ try {
103
+ e = new URL(n);
104
+ } catch {
105
+ return;
106
+ }
107
+ if (!(e.protocol !== "https:" && e.protocol !== "http:"))
108
+ return e.hostname.split(".").slice(-2).join(".");
109
+ }
110
+ function R({
111
+ links: n
112
+ }) {
113
+ const e = (n ?? []).flatMap((t) => {
114
+ const r = f(t);
115
+ return r ? [{ href: t, domain: r }] : [];
116
+ });
117
+ return e.length === 0 ? null : /* @__PURE__ */ a("span", { className: "block text-xs font-normal leading-4 text-muted-foreground", children: e.map(({ href: t, domain: r }, o) => /* @__PURE__ */ s(m, { children: [
118
+ o > 0 ? ", " : null,
119
+ /* @__PURE__ */ a(u, { href: t, external: !0, size: "unset", color: "secondary", children: r })
120
+ ] }, t)) });
121
+ }
122
+ function D() {
99
123
  return /* @__PURE__ */ a("div", { className: "h-px w-full bg-divider" });
100
124
  }
101
125
  export {
102
- p as APY_BREAKDOWN_TOOLTIP_WIDTH,
103
- N as ApyBreakdownBody,
104
- y as ApyBreakdownDivider,
105
- w as ApyBreakdownRow,
106
- x as BREAKDOWN_DASH,
107
- h as breakdownRateValue,
108
- g as formatBreakdownRate,
109
- b as periodMessageId
126
+ N as APY_BREAKDOWN_TOOLTIP_WIDTH,
127
+ A as ApyBreakdownBody,
128
+ D as ApyBreakdownDivider,
129
+ B as ApyBreakdownRow,
130
+ w as BREAKDOWN_DASH,
131
+ R as RewardLinks,
132
+ v as breakdownRateValue,
133
+ y as formatBreakdownRate,
134
+ k as periodMessageId
110
135
  };
@@ -1,11 +1,12 @@
1
- import { APY_BREAKDOWN_TOOLTIP_WIDTH as a, ApyBreakdownBody as r, ApyBreakdownDivider as d, ApyBreakdownRow as A, BREAKDOWN_DASH as B, breakdownRateValue as w, formatBreakdownRate as k, periodMessageId as n } from "./apy-breakdown-body.js";
1
+ import { APY_BREAKDOWN_TOOLTIP_WIDTH as o, ApyBreakdownBody as r, ApyBreakdownDivider as d, ApyBreakdownRow as w, BREAKDOWN_DASH as A, RewardLinks as B, breakdownRateValue as k, formatBreakdownRate as n, periodMessageId as R } from "./apy-breakdown-body.js";
2
2
  export {
3
- a as APY_BREAKDOWN_TOOLTIP_WIDTH,
3
+ o as APY_BREAKDOWN_TOOLTIP_WIDTH,
4
4
  r as ApyBreakdownBody,
5
5
  d as ApyBreakdownDivider,
6
- A as ApyBreakdownRow,
7
- B as BREAKDOWN_DASH,
8
- w as breakdownRateValue,
9
- k as formatBreakdownRate,
10
- n as periodMessageId
6
+ w as ApyBreakdownRow,
7
+ A as BREAKDOWN_DASH,
8
+ B as RewardLinks,
9
+ k as breakdownRateValue,
10
+ n as formatBreakdownRate,
11
+ R as periodMessageId
11
12
  };
@@ -10,6 +10,7 @@ import "tailwind-merge";
10
10
  import "@gearbox-protocol/sdk/onchain";
11
11
  import "../../../utils/z-index.js";
12
12
  import "viem";
13
+ import "../../link/link.js";
13
14
  import { PointsIcon as c } from "../../points-icon/points-icon.js";
14
15
  import "../../token-icon/token-icon.js";
15
16
  import { pointProgramsOf as d } from "../../../utils/internal/apy-breakdown.js";
@@ -20,15 +21,15 @@ import "../../badge/chip.js";
20
21
  import "../../typography/typography.js";
21
22
  import { VerticalIndicator as u } from "../../vertical-indicator/vertical-indicator.js";
22
23
  import { InfoListTest as n } from "./constants.js";
23
- function E({
24
+ function F({
24
25
  children: t
25
26
  }) {
26
27
  return /* @__PURE__ */ o(a, { gap: "sm", "data-testid": n.root, children: t });
27
28
  }
28
29
  function x({
29
30
  title: t,
30
- size: r = "sm",
31
- align: e = "start",
31
+ size: e = "sm",
32
+ align: r = "start",
32
33
  "data-testid": i = n.line,
33
34
  ...m
34
35
  }) {
@@ -37,28 +38,28 @@ function x({
37
38
  u,
38
39
  {
39
40
  label: p(t),
40
- size: r,
41
- align: e,
41
+ size: e,
42
+ align: r,
42
43
  "data-testid": i,
43
44
  ...m
44
45
  }
45
46
  );
46
47
  }
47
- function F({
48
+ function G({
48
49
  data: t,
49
- title: r = "components.yieldBreakdown.points"
50
+ title: e = "components.yieldBreakdown.points"
50
51
  }) {
51
- const e = t ? d(t) : [];
52
- return e.length === 0 ? null : /* @__PURE__ */ o(
52
+ const r = t ? d(t) : [];
53
+ return r.length === 0 ? null : /* @__PURE__ */ o(
53
54
  x,
54
55
  {
55
- title: r,
56
+ title: e,
56
57
  value: /* @__PURE__ */ o(
57
58
  "span",
58
59
  {
59
60
  className: "inline-flex flex-wrap items-center gap-1.5",
60
61
  "data-testid": f.points,
61
- children: e.map((i) => /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1", children: [
62
+ children: r.map((i) => /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1", children: [
62
63
  /* @__PURE__ */ o(
63
64
  c,
64
65
  {
@@ -75,7 +76,7 @@ function F({
75
76
  }
76
77
  export {
77
78
  x as InfoLine,
78
- E as InfoList,
79
+ F as InfoList,
79
80
  n as InfoListTest,
80
- F as PointsInfoLine
81
+ G as PointsInfoLine
81
82
  };
@@ -1,123 +1,127 @@
1
- import { jsxs as r, jsx as e, Fragment as u } from "react/jsx-runtime";
2
- import { ApyBreakdownBody as A, formatBreakdownRate as t, ApyBreakdownRow as p, periodMessageId as i, ApyBreakdownDivider as v, BREAKDOWN_DASH as w } from "../apy-breakdown-body/apy-breakdown-body.js";
1
+ import { jsxs as a, jsx as e, Fragment as A } from "react/jsx-runtime";
2
+ import { ApyBreakdownBody as v, formatBreakdownRate as t, ApyBreakdownRow as p, periodMessageId as i, RewardLinks as w, ApyBreakdownDivider as g, BREAKDOWN_DASH as f } from "../apy-breakdown-body/apy-breakdown-body.js";
3
3
  import { NoValue as d } from "../../no-value/no-value.js";
4
- import { PointsIcon as g } from "../../points-icon/points-icon.js";
5
- import { TokenIcon as B } from "../../token-icon/token-icon.js";
6
- import { FormattedMessageTyped as l } from "../../typed-intl/index.js";
7
- import { totalApyOf as I, tokenRewardsOf as f, pointProgramsOf as h } from "../../../utils/internal/apy-breakdown.js";
8
- import { PoolApyBreakdownCardTest as a } from "./constants.js";
9
- function D({
10
- data: n,
11
- period: s
4
+ import { PointsIcon as B } from "../../points-icon/points-icon.js";
5
+ import { TokenIcon as I } from "../../token-icon/token-icon.js";
6
+ import { FormattedMessageTyped as r } from "../../typed-intl/index.js";
7
+ import { totalApyOf as h, tokenRewardsOf as C, pointProgramsOf as b } from "../../../utils/internal/apy-breakdown.js";
8
+ import { PoolApyBreakdownCardTest as s } from "./constants.js";
9
+ function z({
10
+ data: o,
11
+ period: l,
12
+ hideRewardLinks: u = !1
12
13
  }) {
13
- const m = n ? I(n) : void 0, c = n?.organicApy, y = n ? f(n) : [], k = n ? h(n) : [];
14
- return /* @__PURE__ */ r(
15
- A,
14
+ const m = o ? h(o) : void 0, c = o?.organicApy, y = o ? C(o) : [], k = o ? b(o) : [];
15
+ return /* @__PURE__ */ a(
16
+ v,
16
17
  {
17
- testId: a.root,
18
+ testId: s.root,
18
19
  title: /* @__PURE__ */ e(
19
- l,
20
+ r,
20
21
  {
21
22
  messageId: i(
22
- s,
23
+ l,
23
24
  "components.poolApyBreakdownCard.title",
24
25
  "components.poolApyBreakdownCard.title7d"
25
26
  )
26
27
  }
27
28
  ),
28
- chip: m == null ? /* @__PURE__ */ e(d, { reason: s }) : t(m, !0),
29
+ chip: m == null ? /* @__PURE__ */ e(d, { reason: l }) : t(m, !0),
29
30
  chipPositive: (m ?? 0) > 0,
30
- chipTestId: a.net,
31
+ chipTestId: s.net,
31
32
  children: [
32
33
  /* @__PURE__ */ e(
33
34
  p,
34
35
  {
35
- valueTestId: a.value,
36
+ valueTestId: s.value,
36
37
  label: /* @__PURE__ */ e(
37
- l,
38
+ r,
38
39
  {
39
40
  messageId: i(
40
- s,
41
+ l,
41
42
  "components.poolApyBreakdownCard.organicApy",
42
43
  "components.poolApyBreakdownCard.organicApy7d"
43
44
  )
44
45
  }
45
46
  ),
46
- value: c == null ? /* @__PURE__ */ e(d, { reason: s }) : t(c)
47
+ value: c == null ? /* @__PURE__ */ e(d, { reason: l }) : t(c)
47
48
  }
48
49
  ),
49
- y.length > 0 ? y.map((o) => /* @__PURE__ */ e(
50
+ y.length > 0 ? y.map((n) => /* @__PURE__ */ e(
50
51
  p,
51
52
  {
52
- valueTestId: a.value,
53
- label: /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5", children: [
54
- /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
55
- l,
56
- {
57
- messageId: i(
58
- s,
59
- "components.poolApyBreakdownCard.tokenIncentiveApy",
60
- "components.poolApyBreakdownCard.tokenIncentiveApy7d"
61
- ),
62
- values: { symbol: o.token.symbol }
63
- }
64
- ) }),
65
- /* @__PURE__ */ e(
66
- B,
67
- {
68
- token: o.token,
69
- symbol: o.token.symbol,
70
- size: 16,
71
- className: "shrink-0"
72
- }
73
- )
53
+ valueTestId: s.value,
54
+ label: /* @__PURE__ */ a("span", { className: "flex flex-col gap-0.5", children: [
55
+ /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
56
+ /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
57
+ r,
58
+ {
59
+ messageId: i(
60
+ l,
61
+ "components.poolApyBreakdownCard.tokenIncentiveApy",
62
+ "components.poolApyBreakdownCard.tokenIncentiveApy7d"
63
+ ),
64
+ values: { symbol: n.token.symbol }
65
+ }
66
+ ) }),
67
+ /* @__PURE__ */ e(
68
+ I,
69
+ {
70
+ token: n.token,
71
+ symbol: n.token.symbol,
72
+ size: 16,
73
+ className: "shrink-0"
74
+ }
75
+ )
76
+ ] }),
77
+ u ? null : /* @__PURE__ */ e(w, { links: n.links })
74
78
  ] }),
75
- value: t(o.supplyApr ?? 0)
79
+ value: t(n.supplyApr ?? 0)
76
80
  },
77
- `incentive-${o.token.address}`
81
+ `incentive-${n.token.address}`
78
82
  )) : /* @__PURE__ */ e(
79
83
  p,
80
84
  {
81
- valueTestId: a.value,
85
+ valueTestId: s.value,
82
86
  label: /* @__PURE__ */ e(
83
- l,
87
+ r,
84
88
  {
85
89
  messageId: i(
86
- s,
90
+ l,
87
91
  "components.poolApyBreakdownCard.incentiveApy",
88
92
  "components.poolApyBreakdownCard.incentiveApy7d"
89
93
  )
90
94
  }
91
95
  ),
92
- value: n == null ? /* @__PURE__ */ e(d, { reason: s }) : t(0)
96
+ value: o == null ? /* @__PURE__ */ e(d, { reason: l }) : t(0)
93
97
  }
94
98
  ),
95
- k.length > 0 ? /* @__PURE__ */ r(u, { children: [
96
- /* @__PURE__ */ e(v, {}),
97
- k.map((o) => /* @__PURE__ */ e(
99
+ k.length > 0 ? /* @__PURE__ */ a(A, { children: [
100
+ /* @__PURE__ */ e(g, {}),
101
+ k.map((n) => /* @__PURE__ */ e(
98
102
  p,
99
103
  {
100
- valueTestId: a.points,
101
- label: /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5", children: [
104
+ valueTestId: s.points,
105
+ label: /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
102
106
  /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
103
- l,
107
+ r,
104
108
  {
105
109
  messageId: "components.yieldBreakdown.programPoints",
106
- values: { name: o.name }
110
+ values: { name: n.name }
107
111
  }
108
112
  ) }),
109
113
  /* @__PURE__ */ e(
110
- g,
114
+ B,
111
115
  {
112
- reward: { name: o.name, type: o.id },
116
+ reward: { name: n.name, type: n.id },
113
117
  size: 16,
114
118
  className: "shrink-0"
115
119
  }
116
120
  )
117
121
  ] }),
118
- value: o.multiplier != null ? `${o.multiplier}×` : w
122
+ value: n.multiplier != null ? `${n.multiplier}×` : f
119
123
  },
120
- o.id
124
+ n.id
121
125
  ))
122
126
  ] }) : null
123
127
  ]
@@ -125,6 +129,6 @@ function D({
125
129
  );
126
130
  }
127
131
  export {
128
- D as PoolApyBreakdownCard,
129
- a as PoolApyBreakdownCardTest
132
+ z as PoolApyBreakdownCard,
133
+ s as PoolApyBreakdownCardTest
130
134
  };