@gearbox-protocol/ui-kit 4.0.0-next.72 → 4.0.0-next.76
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/base/apy-breakdown-body/apy-breakdown-body.cjs +1 -1
- package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown.cjs +1 -1
- package/dist/esm/components/base/apy-breakdown-body/apy-breakdown-body.js +31 -31
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +1 -1
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +2 -5
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown.js +9 -9
- package/dist/types/components/base/apy-breakdown-body/apy-breakdown-body.d.ts +5 -2
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown.d.ts +1 -1
- package/package.json +3 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../../../utils/cn.cjs"),l=require("../../../utils/internal/bps-to-percent.cjs"),c="—",u="400px";function x(n,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../../../utils/cn.cjs"),l=require("../../../utils/internal/bps-to-percent.cjs"),c="—",u="400px";function x(s,n,t){return s==="7d"?t:n}function m(s,n=!1){const t=l.bpsToPercent(s),d=`${Math.abs(t).toFixed(2)}%`;return n&&t<0?`−${d}`:d}function f({title:s,chip:n,chipPositive:t=!1,chipTestId:d,children:r,testId:a}){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":a,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:s}),e.jsx("span",{className:o.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":d,children:n})]}),e.jsx("div",{className:"flex flex-col gap-3",children:r})]})}function p({label:s,value:n,subtext:t,muted:d=!1,testId:r,valueTestId:a,captionTestId:i}){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",d?"text-muted-foreground":"text-foreground"),children:s}),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",d?"text-muted-foreground":"text-foreground"),"data-testid":a,children:n}),t!=null?e.jsx("span",{className:"text-xs leading-4 text-muted-foreground","data-testid":i,children:t}):null]})]})}function g(){return e.jsx("div",{className:"h-px w-full bg-divider"})}exports.APY_BREAKDOWN_TOOLTIP_WIDTH=u;exports.ApyBreakdownBody=f;exports.ApyBreakdownDivider=g;exports.ApyBreakdownRow=p;exports.BREAKDOWN_DASH=c;exports.formatBreakdownRate=m;exports.periodMessageId=x;
|
|
@@ -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),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"),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;
|
package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("@gearbox-protocol/sdk/onchain"),o=require("../apy-breakdown-body/apy-breakdown-body.cjs"),A=require("../../no-value/no-value.cjs"),C=require("../../points-icon/points-icon.cjs"),R=require("../../token-icon/token-icon.cjs"),d=require("../../typed-intl/index.cjs"),c=require("../../../utils/format-leverage.cjs"),k=require("../../../utils/internal/apy-breakdown.cjs"),r=require("./constants.cjs");function S(i){const{borrowApyAvg7D:a,quotaRateAvg7D:p,liquidationThreshold:l}=i;return a===void 0||p===void 0?null:{borrowApy:a,quotaRate:p,liquidationThreshold:l}}function _({data:i,leverage:a,showFormula:p=!1,period:l}){const s=S(i),n=s&&i.collateralApyAvg7D?i.collateralApyAvg7D:void 0,B=s!==null&&n!==void 0,v=B&&s&&n?{organicApy:g.calcNetStrategyApy(s,n.organicApy,a),totalApy:g.calcNetStrategyApy(s,n.totalApy??n.organicApy,a),...n.rewards?{rewards:n.rewards}:{}}:null,y=B&&s?g.calcEffectiveBorrowApy(s,a):null,u=v===null?null:k.totalApyOf(v),x=u===null||y===null?null:u+y,j=n?k.positiveTokenRewardsOf(n):[],T=n?k.pointProgramsOf(n):[],f=j.map(t=>({reward:t,value:Math.round(a*(t.supplyApr??0))})),m=x===null?null:x-f.reduce((t,w)=>t+w.value,0),I=m!==null&&a>0?m/a:void 0,b=s&&y!==null&&a>0?(y-s.borrowApy*(a-1))/a:void 0;return e.jsxs(o.ApyBreakdownBody,{testId:r.StrategyApyBreakdownCardTest.root,title:e.jsx(d.FormattedMessageTyped,{messageId:o.periodMessageId(l,"components.yieldBreakdown.titleNetAtLeverage","components.yieldBreakdown.titleNetAtLeverage7d"),values:{leverage:c.formatLeverage(a)}}),chip:u===null?e.jsx(A.NoValue,{reason:l}):o.formatBreakdownRate(u),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(d.FormattedMessageTyped,{messageId:o.periodMessageId(l,"components.yieldBreakdown.collateralApy","components.yieldBreakdown.collateralApy7d")}),value:m===null?e.jsx(A.NoValue,{reason:l}):o.formatBreakdownRate(m),subtext:p&&I!==void 0?e.jsx(d.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:c.formatLeverageExact(a),base:o.formatBreakdownRate(I)}}):void 0}),f.map(({reward:t,value:w})=>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(d.FormattedMessageTyped,{messageId:"components.apyParts.extraAPY",values:{symbol:t.token.symbol}})}),e.jsx(R.TokenIcon,{token:t.token,symbol:t.token.symbol,size:16,className:"shrink-0"})]}),value:o.formatBreakdownRate(w),subtext:p?e.jsx(d.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:c.formatLeverageExact(a),base:o.formatBreakdownRate(t.supplyApr??0)}}):void 0},`incentive-${t.token.address}-${t.supplyApr??0}`)),e.jsx(o.ApyBreakdownRow,{muted:!0,testId:r.StrategyApyBreakdownCardTest.borrow,valueTestId:r.StrategyApyBreakdownCardTest.value,captionTestId:r.StrategyApyBreakdownCardTest.caption,label:e.jsx(d.FormattedMessageTyped,{messageId:o.periodMessageId(l,"components.yieldBreakdown.borrowRate","components.yieldBreakdown.borrowRate7d")}),value:y===null?e.jsx(A.NoValue,{reason:l}):o.formatBreakdownRate(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("@gearbox-protocol/sdk/onchain"),o=require("../apy-breakdown-body/apy-breakdown-body.cjs"),A=require("../../no-value/no-value.cjs"),C=require("../../points-icon/points-icon.cjs"),R=require("../../token-icon/token-icon.cjs"),d=require("../../typed-intl/index.cjs"),c=require("../../../utils/format-leverage.cjs"),k=require("../../../utils/internal/apy-breakdown.cjs"),r=require("./constants.cjs");function S(i){const{borrowApyAvg7D:a,quotaRateAvg7D:p,liquidationThreshold:l}=i;return a===void 0||p===void 0?null:{borrowApy:a,quotaRate:p,liquidationThreshold:l}}function _({data:i,leverage:a,showFormula:p=!1,period:l}){const s=S(i),n=s&&i.collateralApyAvg7D?i.collateralApyAvg7D:void 0,B=s!==null&&n!==void 0,v=B&&s&&n?{organicApy:g.calcNetStrategyApy(s,n.organicApy,a),totalApy:g.calcNetStrategyApy(s,n.totalApy??n.organicApy,a),...n.rewards?{rewards:n.rewards}:{}}:null,y=B&&s?g.calcEffectiveBorrowApy(s,a):null,u=v===null?null:k.totalApyOf(v),x=u===null||y===null?null:u+y,j=n?k.positiveTokenRewardsOf(n):[],T=n?k.pointProgramsOf(n):[],f=j.map(t=>({reward:t,value:Math.round(a*(t.supplyApr??0))})),m=x===null?null:x-f.reduce((t,w)=>t+w.value,0),I=m!==null&&a>0?m/a:void 0,b=s&&y!==null&&a>0?(y-s.borrowApy*(a-1))/a:void 0;return e.jsxs(o.ApyBreakdownBody,{testId:r.StrategyApyBreakdownCardTest.root,title:e.jsx(d.FormattedMessageTyped,{messageId:o.periodMessageId(l,"components.yieldBreakdown.titleNetAtLeverage","components.yieldBreakdown.titleNetAtLeverage7d"),values:{leverage:c.formatLeverage(a)}}),chip:u===null?e.jsx(A.NoValue,{reason:l}):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(d.FormattedMessageTyped,{messageId:o.periodMessageId(l,"components.yieldBreakdown.collateralApy","components.yieldBreakdown.collateralApy7d")}),value:m===null?e.jsx(A.NoValue,{reason:l}):o.formatBreakdownRate(m),subtext:p&&I!==void 0?e.jsx(d.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:c.formatLeverageExact(a),base:o.formatBreakdownRate(I)}}):void 0}),f.map(({reward:t,value:w})=>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(d.FormattedMessageTyped,{messageId:"components.apyParts.extraAPY",values:{symbol:t.token.symbol}})}),e.jsx(R.TokenIcon,{token:t.token,symbol:t.token.symbol,size:16,className:"shrink-0"})]}),value:o.formatBreakdownRate(w),subtext:p?e.jsx(d.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:c.formatLeverageExact(a),base:o.formatBreakdownRate(t.supplyApr??0)}}):void 0},`incentive-${t.token.address}-${t.supplyApr??0}`)),e.jsx(o.ApyBreakdownRow,{muted:!0,testId:r.StrategyApyBreakdownCardTest.borrow,valueTestId:r.StrategyApyBreakdownCardTest.value,captionTestId:r.StrategyApyBreakdownCardTest.caption,label:e.jsx(d.FormattedMessageTyped,{messageId:o.periodMessageId(l,"components.yieldBreakdown.borrowRate","components.yieldBreakdown.borrowRate7d")}),value:y===null?e.jsx(A.NoValue,{reason:l}):o.formatBreakdownRate(y),subtext:p&&s&&b!==void 0?e.jsx(d.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.borrowFormula",values:{leverage:c.formatLeverageExact(a),totalRate:o.formatBreakdownRate(s.borrowApy+b),borrowRate:o.formatBreakdownRate(s.borrowApy)}}):void 0}),T.length>0?e.jsxs(e.Fragment,{children:[e.jsx(o.ApyBreakdownDivider,{}),T.map(t=>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(d.FormattedMessageTyped,{messageId:"components.yieldBreakdown.programPoints",values:{name:t.name}})}),e.jsx(C.PointsIcon,{reward:{name:t.name,type:t.id},size:16,className:"shrink-0"})]}),value:t.multiplier!=null?`${c.formatLeverageExact(t.multiplier*a)}×`:o.BREAKDOWN_DASH,subtext:p&&t.multiplier!=null?e.jsx(d.FormattedMessageTyped,{messageId:"components.strategyApyBreakdownCard.formula",values:{leverage:c.formatLeverageExact(a),base:c.formatLeverageExact(t.multiplier)}}):void 0},t.id))]}):null]})}exports.StrategyApyBreakdownCardTest=r.StrategyApyBreakdownCardTest;exports.StrategyApyBreakdownCard=_;
|
|
@@ -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"),
|
|
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,19 +1,19 @@
|
|
|
1
|
-
import { jsxs as a, jsx as
|
|
2
|
-
import { cn as
|
|
1
|
+
import { jsxs as a, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { cn as l } from "../../../utils/cn.js";
|
|
3
3
|
import { bpsToPercent as c } from "../../../utils/internal/bps-to-percent.js";
|
|
4
4
|
const x = "—", p = "400px";
|
|
5
|
-
function g(
|
|
6
|
-
return
|
|
5
|
+
function g(t, n, e) {
|
|
6
|
+
return t === "7d" ? e : n;
|
|
7
7
|
}
|
|
8
|
-
function b(n) {
|
|
9
|
-
const
|
|
10
|
-
return
|
|
8
|
+
function b(t, n = !1) {
|
|
9
|
+
const e = c(t), s = `${Math.abs(e).toFixed(2)}%`;
|
|
10
|
+
return n && e < 0 ? `−${s}` : s;
|
|
11
11
|
}
|
|
12
12
|
function h({
|
|
13
|
-
title:
|
|
14
|
-
chip:
|
|
13
|
+
title: t,
|
|
14
|
+
chip: n,
|
|
15
15
|
chipPositive: e = !1,
|
|
16
|
-
chipTestId:
|
|
16
|
+
chipTestId: s,
|
|
17
17
|
children: r,
|
|
18
18
|
testId: o
|
|
19
19
|
}) {
|
|
@@ -24,32 +24,32 @@ function h({
|
|
|
24
24
|
"data-testid": o,
|
|
25
25
|
children: [
|
|
26
26
|
/* @__PURE__ */ a("div", { className: "flex min-h-6 items-center justify-between gap-3", children: [
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ d("span", { className: "min-w-0 text-base font-semibold leading-5 text-foreground", children: t }),
|
|
28
|
+
/* @__PURE__ */ d(
|
|
29
29
|
"span",
|
|
30
30
|
{
|
|
31
|
-
className:
|
|
31
|
+
className: l(
|
|
32
32
|
"shrink-0 rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",
|
|
33
33
|
e ? "bg-success/20 text-success" : "bg-muted text-muted-foreground"
|
|
34
34
|
),
|
|
35
|
-
"data-testid":
|
|
36
|
-
children:
|
|
35
|
+
"data-testid": s,
|
|
36
|
+
children: n
|
|
37
37
|
}
|
|
38
38
|
)
|
|
39
39
|
] }),
|
|
40
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col gap-3", children: r })
|
|
41
41
|
]
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
function N({
|
|
46
|
-
label:
|
|
47
|
-
value:
|
|
46
|
+
label: t,
|
|
47
|
+
value: n,
|
|
48
48
|
subtext: e,
|
|
49
|
-
muted:
|
|
49
|
+
muted: s = !1,
|
|
50
50
|
testId: r,
|
|
51
51
|
valueTestId: o,
|
|
52
|
-
captionTestId:
|
|
52
|
+
captionTestId: i
|
|
53
53
|
}) {
|
|
54
54
|
return /* @__PURE__ */ a(
|
|
55
55
|
"div",
|
|
@@ -57,33 +57,33 @@ function N({
|
|
|
57
57
|
className: "flex items-start justify-between gap-3",
|
|
58
58
|
"data-testid": r,
|
|
59
59
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ d(
|
|
61
61
|
"span",
|
|
62
62
|
{
|
|
63
|
-
className:
|
|
63
|
+
className: l(
|
|
64
64
|
"min-w-0 text-sm font-semibold leading-5",
|
|
65
|
-
|
|
65
|
+
s ? "text-muted-foreground" : "text-foreground"
|
|
66
66
|
),
|
|
67
|
-
children:
|
|
67
|
+
children: t
|
|
68
68
|
}
|
|
69
69
|
),
|
|
70
70
|
/* @__PURE__ */ a("span", { className: "flex shrink-0 flex-col items-end", children: [
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ d(
|
|
72
72
|
"span",
|
|
73
73
|
{
|
|
74
|
-
className:
|
|
74
|
+
className: l(
|
|
75
75
|
"text-sm font-semibold leading-5 tabular-nums",
|
|
76
|
-
|
|
76
|
+
s ? "text-muted-foreground" : "text-foreground"
|
|
77
77
|
),
|
|
78
78
|
"data-testid": o,
|
|
79
|
-
children:
|
|
79
|
+
children: n
|
|
80
80
|
}
|
|
81
81
|
),
|
|
82
|
-
e != null ? /* @__PURE__ */
|
|
82
|
+
e != null ? /* @__PURE__ */ d(
|
|
83
83
|
"span",
|
|
84
84
|
{
|
|
85
85
|
className: "text-xs leading-4 text-muted-foreground",
|
|
86
|
-
"data-testid":
|
|
86
|
+
"data-testid": i,
|
|
87
87
|
children: e
|
|
88
88
|
}
|
|
89
89
|
) : null
|
|
@@ -93,7 +93,7 @@ function N({
|
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
function w() {
|
|
96
|
-
return /* @__PURE__ */
|
|
96
|
+
return /* @__PURE__ */ d("div", { className: "h-px w-full bg-divider" });
|
|
97
97
|
}
|
|
98
98
|
export {
|
|
99
99
|
p as APY_BREAKDOWN_TOOLTIP_WIDTH,
|
|
@@ -53,7 +53,7 @@ function U({
|
|
|
53
53
|
values: { leverage: E(t) }
|
|
54
54
|
}
|
|
55
55
|
),
|
|
56
|
-
chip: u === null ? /* @__PURE__ */ e(k, { reason: r }) : i(u),
|
|
56
|
+
chip: u === null ? /* @__PURE__ */ e(k, { reason: r }) : i(u, !0),
|
|
57
57
|
chipPositive: (u ?? 0) > 0,
|
|
58
58
|
chipTestId: n.net,
|
|
59
59
|
children: [
|
|
@@ -140,7 +140,7 @@ function U({
|
|
|
140
140
|
)
|
|
141
141
|
}
|
|
142
142
|
),
|
|
143
|
-
value: p === null ? /* @__PURE__ */ e(k, { reason: r }) : i(
|
|
143
|
+
value: p === null ? /* @__PURE__ */ e(k, { reason: r }) : i(p),
|
|
144
144
|
subtext: d && a && x !== void 0 ? /* @__PURE__ */ e(
|
|
145
145
|
s,
|
|
146
146
|
{
|
|
@@ -151,9 +151,6 @@ function U({
|
|
|
151
151
|
// interest plus the quota, added before either is rounded, so
|
|
152
152
|
// the caption is not the sum of two figures it also printed.
|
|
153
153
|
totalRate: i(a.borrowApy + x),
|
|
154
|
-
// Magnitudes, not signed rates: the row above already carries
|
|
155
|
-
// the minus, and `− −0.88%` reads as arithmetic to decode
|
|
156
|
-
// rather than a cost to understand.
|
|
157
154
|
borrowRate: i(a.borrowApy)
|
|
158
155
|
}
|
|
159
156
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as p, Fragment as B } from "react/jsx-runtime";
|
|
2
|
-
import { ApyBreakdownBody as A, formatBreakdownRate as c, ApyBreakdownRow as u, periodMessageId as
|
|
2
|
+
import { ApyBreakdownBody as A, formatBreakdownRate as c, ApyBreakdownRow as u, periodMessageId as w, ApyBreakdownDivider as v } from "../base/apy-breakdown-body/apy-breakdown-body.js";
|
|
3
3
|
import { PoolApyBreakdownCard as h } from "../base/pool-apy-breakdown-card/pool-apy-breakdown-card.js";
|
|
4
4
|
import { PointsIcon as b } from "../points-icon/points-icon.js";
|
|
5
5
|
import { TokenIcon as I } from "../token-icon/token-icon.js";
|
|
@@ -48,14 +48,14 @@ function $({
|
|
|
48
48
|
quotaRate: i,
|
|
49
49
|
period: t
|
|
50
50
|
}) {
|
|
51
|
-
const n = y, d = n ? R(n) : [], g = T(l), m = x(l),
|
|
51
|
+
const n = y, d = n ? R(n) : [], g = T(l), m = x(l), k = s != null || i != null ? (s ?? 0) + (i ?? 0) : void 0, f = g.filter((o) => o.multiplier != null);
|
|
52
52
|
return /* @__PURE__ */ p(
|
|
53
53
|
A,
|
|
54
54
|
{
|
|
55
55
|
title: /* @__PURE__ */ e(
|
|
56
56
|
a,
|
|
57
57
|
{
|
|
58
|
-
messageId:
|
|
58
|
+
messageId: w(
|
|
59
59
|
t,
|
|
60
60
|
"components.yieldBreakdown.titleNetAtLeverage",
|
|
61
61
|
"components.yieldBreakdown.titleNetAtLeverage7d"
|
|
@@ -63,7 +63,7 @@ function $({
|
|
|
63
63
|
values: { leverage: P(r) }
|
|
64
64
|
}
|
|
65
65
|
),
|
|
66
|
-
chip: c(m),
|
|
66
|
+
chip: c(m, !0),
|
|
67
67
|
chipPositive: m > 0,
|
|
68
68
|
children: [
|
|
69
69
|
n?.organicApy != null ? /* @__PURE__ */ e(
|
|
@@ -73,7 +73,7 @@ function $({
|
|
|
73
73
|
label: /* @__PURE__ */ e(
|
|
74
74
|
a,
|
|
75
75
|
{
|
|
76
|
-
messageId:
|
|
76
|
+
messageId: w(
|
|
77
77
|
t,
|
|
78
78
|
"components.yieldBreakdown.collateralApy",
|
|
79
79
|
"components.yieldBreakdown.collateralApy7d"
|
|
@@ -103,21 +103,21 @@ function $({
|
|
|
103
103
|
`incentive-${o.token.address}-${o.supplyApr}`
|
|
104
104
|
)
|
|
105
105
|
),
|
|
106
|
-
|
|
106
|
+
k != null ? /* @__PURE__ */ e(
|
|
107
107
|
u,
|
|
108
108
|
{
|
|
109
|
-
muted:
|
|
109
|
+
muted: !0,
|
|
110
110
|
label: /* @__PURE__ */ e(
|
|
111
111
|
a,
|
|
112
112
|
{
|
|
113
|
-
messageId:
|
|
113
|
+
messageId: w(
|
|
114
114
|
t,
|
|
115
115
|
"components.yieldBreakdown.borrowRate",
|
|
116
116
|
"components.yieldBreakdown.borrowRate7d"
|
|
117
117
|
)
|
|
118
118
|
}
|
|
119
119
|
),
|
|
120
|
-
value: c(
|
|
120
|
+
value: c(k)
|
|
121
121
|
}
|
|
122
122
|
) : null,
|
|
123
123
|
f.length > 0 ? /* @__PURE__ */ p(B, { children: [
|
|
@@ -6,13 +6,16 @@ export declare const BREAKDOWN_DASH = "\u2014";
|
|
|
6
6
|
export declare const APY_BREAKDOWN_TOOLTIP_WIDTH = "400px";
|
|
7
7
|
export declare function periodMessageId(period: "7d" | undefined, base: LocaleKeys, with7d: LocaleKeys): LocaleKeys;
|
|
8
8
|
/**
|
|
9
|
-
* A rate as the rows write it: two decimals,
|
|
9
|
+
* A rate as the rows write it: two decimals, magnitude only.
|
|
10
10
|
*
|
|
11
11
|
* Two decimals at every scale, unlike the compact form the rest of the kit
|
|
12
12
|
* uses above 1000%. A breakdown is read by adding it up, and `1.2K%` carries
|
|
13
13
|
* three significant figures — enough to make a correct column look wrong.
|
|
14
|
+
*
|
|
15
|
+
* `signed` is for the net chip, the one figure whose direction is not already
|
|
16
|
+
* stated by the row it sits on.
|
|
14
17
|
*/
|
|
15
|
-
export declare function formatBreakdownRate(value: Bps): string;
|
|
18
|
+
export declare function formatBreakdownRate(value: Bps, signed?: boolean): string;
|
|
16
19
|
export interface ApyBreakdownBodyProps {
|
|
17
20
|
/** Heading to the left of the chip — "Net APY (7d)" and the like. */
|
|
18
21
|
readonly title: React.ReactNode;
|
|
@@ -20,7 +20,7 @@ export interface YieldBreakdownTooltipProps {
|
|
|
20
20
|
* to {@link supplyApy} when omitted.
|
|
21
21
|
*/
|
|
22
22
|
collateralApy?: ApyBreakdown;
|
|
23
|
-
/** Strategy base borrow cost in bps (
|
|
23
|
+
/** Strategy base borrow cost in bps (the row prints its magnitude). */
|
|
24
24
|
borrowApy?: Bps;
|
|
25
25
|
/** Strategy quota rate in bps, at 1x (folded into Borrow Rate). */
|
|
26
26
|
quotaRate?: Bps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/ui-kit",
|
|
3
|
-
"version": "4.0.0-next.
|
|
3
|
+
"version": "4.0.0-next.76",
|
|
4
4
|
"description": "Internal UI components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"biome check --no-errors-on-unmatched --write"
|
|
163
163
|
]
|
|
164
164
|
},
|
|
165
|
-
"packageManager": "pnpm@
|
|
165
|
+
"packageManager": "pnpm@12.3.1",
|
|
166
166
|
"browserslist": [
|
|
167
167
|
">0.3%",
|
|
168
168
|
"not dead",
|
|
@@ -171,15 +171,5 @@
|
|
|
171
171
|
"Firefox >= 80",
|
|
172
172
|
"Safari >= 13",
|
|
173
173
|
"Edge >= 80"
|
|
174
|
-
]
|
|
175
|
-
"pnpm": {
|
|
176
|
-
"onlyBuiltDependencies": [
|
|
177
|
-
"bufferutil",
|
|
178
|
-
"esbuild",
|
|
179
|
-
"keccak",
|
|
180
|
-
"secp256k1",
|
|
181
|
-
"sharp",
|
|
182
|
-
"utf-8-validate"
|
|
183
|
-
]
|
|
184
|
-
}
|
|
174
|
+
]
|
|
185
175
|
}
|