@gearbox-protocol/ui-kit 4.0.0-next.45 → 4.0.0-next.47

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 (19) hide show
  1. package/dist/cjs/components/base/health-factor-block/health-factor-block.cjs +1 -1
  2. package/dist/cjs/components/base/liquidation-price-block/liquidation-price-block.cjs +1 -1
  3. package/dist/cjs/components/base/position-assets/constants.cjs +1 -1
  4. package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -1
  5. package/dist/cjs/components/base/time-to-liquidation-block/time-to-liquidation-block.cjs +1 -1
  6. package/dist/cjs/components/base/token-amount/token-amount.cjs +1 -1
  7. package/dist/esm/components/base/health-factor-block/health-factor-block.js +54 -34
  8. package/dist/esm/components/base/liquidation-price-block/liquidation-price-block.js +28 -28
  9. package/dist/esm/components/base/position-assets/constants.js +1 -0
  10. package/dist/esm/components/base/position-assets/position-assets.js +81 -63
  11. package/dist/esm/components/base/time-to-liquidation-block/time-to-liquidation-block.js +20 -20
  12. package/dist/esm/components/base/token-amount/token-amount.js +21 -16
  13. package/dist/types/components/base/health-factor-block/health-factor-block.d.ts +8 -1
  14. package/dist/types/components/base/liquidation-price-block/liquidation-price-block.d.ts +4 -4
  15. package/dist/types/components/base/position-assets/constants.d.ts +1 -0
  16. package/dist/types/components/base/position-assets/position-assets.d.ts +4 -0
  17. package/dist/types/components/base/time-to-liquidation-block/time-to-liquidation-block.d.ts +4 -4
  18. package/dist/types/components/base/token-amount/token-amount.d.ts +8 -1
  19. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("../text/use-title-text.cjs"),i=require("../../fadeout-loading/fadeout-loading.cjs"),d=require("../../health-factor/health-factor.cjs"),u=require("../../typed-intl/index.cjs"),T=require("../../vertical-indicator/vertical-indicator.cjs"),t=require("./constants.cjs");function x({healthFactor:o,healthFactorTo:a,debt:c,debtTo:h,zone:s,isLoading:l,title:n,tip:F,testId:v}){const m=p.useTitleText(),r=a!==void 0;return e.jsx(T.VerticalIndicator,{align:"center",dimPreviousValue:!1,"data-testid":v??t.HealthFactorBlockTest.root,label:n!==void 0?m(n):e.jsx(u.FormattedMessageTyped,{messageId:"components.healthFactorBlock.label"}),tip:F??e.jsx(u.FormattedMessageTyped,{messageId:"components.healthFactorBlock.tip"}),value:e.jsx(i.FadeoutLoading,{loading:l,children:o===void 0?e.jsx("span",{"data-testid":t.HealthFactorBlockTest.value,children:"—"}):e.jsx(d.HealthFactor,{value:o,debt:c,zone:r?void 0:s,"data-testid":t.HealthFactorBlockTest.value})}),valueTo:r?e.jsx(i.FadeoutLoading,{loading:l,children:e.jsx(d.HealthFactor,{value:a,debt:h??c,zone:s,"data-testid":t.HealthFactorBlockTest.valueTo})}):void 0})}exports.HealthFactorBlockTest=t.HealthFactorBlockTest;exports.HealthFactorBlock=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),_=require("../text/use-title-text.cjs"),d=require("../../fadeout-loading/fadeout-loading.cjs"),u=require("../../health-factor/health-factor.cjs"),h=require("../../typed-intl/index.cjs"),v=require("../../vertical-indicator/vertical-indicator.cjs"),m=require("../../../utils/format.cjs"),t=require("./constants.cjs");function j({healthFactor:o,healthFactorTo:s,debt:l,debtTo:x,approximate:c,zone:n,isLoading:r,title:i,tip:p,testId:F}){const T=_.useTitleText(),a=s!==void 0;return e.jsx(v.VerticalIndicator,{align:"center",dimPreviousValue:!1,"data-testid":F??t.HealthFactorBlockTest.root,label:i!==void 0?T(i):e.jsx(h.FormattedMessageTyped,{messageId:"components.healthFactorBlock.label"}),tip:p??e.jsx(h.FormattedMessageTyped,{messageId:"components.healthFactorBlock.tip"}),value:e.jsx(d.FadeoutLoading,{loading:r,children:o===void 0?e.jsx("span",{"data-testid":t.HealthFactorBlockTest.value,children:"—"}):e.jsxs("span",{className:"inline-flex items-center","data-testid":t.HealthFactorBlockTest.value,children:[c&&!a?e.jsx("span",{className:"mr-0.5",children:m.APPROXIMATE_SYMBOL}):null,e.jsx(u.HealthFactor,{value:o,debt:l,zone:a?void 0:n})]})}),valueTo:a?e.jsx(d.FadeoutLoading,{loading:r,children:e.jsxs("span",{className:"inline-flex items-center","data-testid":t.HealthFactorBlockTest.valueTo,children:[c?e.jsx("span",{className:"mr-0.5",children:m.APPROXIMATE_SYMBOL}):null,e.jsx(u.HealthFactor,{value:s,debt:x??l,zone:n})]})}):void 0})}exports.HealthFactorBlockTest=t.HealthFactorBlockTest;exports.HealthFactorBlock=j;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),P=require("../text/use-title-text.cjs"),d=require("../../fadeout-loading/fadeout-loading.cjs"),T=require("../../formatted-number/formatted-number.cjs"),v=require("../../status-elements/status-elements.cjs"),m=require("../../typed-intl/index.cjs"),j=require("../../vertical-indicator/vertical-indicator.cjs"),b=require("../../../utils/format.cjs"),g=require("../../../utils/parse-input-to-bn.cjs"),n=require("./constants.cjs");function L(t,i){if(!(!t||!i))return`${t.symbol} / ${i.symbol}`}function f({price:t,priceTo:i,collateral:o,underlying:s,approximate:r,zone:a,isLoading:c,title:l,tip:x,testId:_}){const p=P.useTitleText(),u=i!==void 0;return e.jsx(j.VerticalIndicator,{align:"center",dimPreviousValue:!1,"data-testid":_??n.LiquidationPriceBlockTest.root,label:l!==void 0?p(l):e.jsx(m.FormattedMessageTyped,{messageId:"components.liquidationPriceBlock.label"}),tip:x??e.jsx(m.FormattedMessageTyped,{messageId:"components.liquidationPriceBlock.tip"}),value:e.jsx(d.FadeoutLoading,{loading:c,children:e.jsx(q,{price:t,approximate:r,zone:u?void 0:a,testId:n.LiquidationPriceBlockTest.value})}),valueTo:u?e.jsx(d.FadeoutLoading,{loading:c,children:e.jsx(q,{price:i??null,approximate:r,zone:a,testId:n.LiquidationPriceBlockTest.valueTo})}):void 0,valueDescription:L(o,s)})}function q({price:t,approximate:i,zone:o,testId:s}){return e.jsxs("span",{className:"inline-flex items-center","data-testid":s,children:[t===void 0?"—":t===null||t===0n?"N/A":e.jsxs(e.Fragment,{children:[i?e.jsx("span",{className:"mr-0.5",children:b.APPROXIMATE_SYMBOL}):null,e.jsx(T.FormattedNumberString,{value:g.bnToLiquidationPriceView(t)})]}),o?e.jsx("span",{className:"ml-1.5",children:e.jsx(v.HealthDot,{zone:o})}):null]})}exports.LiquidationPriceBlockTest=n.LiquidationPriceBlockTest;exports.LiquidationPriceBlock=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),P=require("../text/use-title-text.cjs"),d=require("../../fadeout-loading/fadeout-loading.cjs"),T=require("../../formatted-number/formatted-number.cjs"),v=require("../../status-elements/status-elements.cjs"),m=require("../../typed-intl/index.cjs"),j=require("../../vertical-indicator/vertical-indicator.cjs"),b=require("../../../utils/format.cjs"),g=require("../../../utils/parse-input-to-bn.cjs"),n=require("./constants.cjs");function L(t,i){if(!(!t||!i))return`${t.symbol} / ${i.symbol}`}function f({price:t,priceTo:i,collateral:o,underlying:s,approximate:r,zone:c,isLoading:l,title:u,tip:x,testId:p}){const _=P.useTitleText(),a=i!==void 0;return e.jsx(j.VerticalIndicator,{align:"center",dimPreviousValue:!1,"data-testid":p??n.LiquidationPriceBlockTest.root,label:u!==void 0?_(u):e.jsx(m.FormattedMessageTyped,{messageId:"components.liquidationPriceBlock.label"}),tip:x??e.jsx(m.FormattedMessageTyped,{messageId:"components.liquidationPriceBlock.tip"}),value:e.jsx(d.FadeoutLoading,{loading:l,children:e.jsx(q,{price:t,approximate:r&&!a,zone:a?void 0:c,testId:n.LiquidationPriceBlockTest.value})}),valueTo:a?e.jsx(d.FadeoutLoading,{loading:l,children:e.jsx(q,{price:i??null,approximate:r,zone:c,testId:n.LiquidationPriceBlockTest.valueTo})}):void 0,valueDescription:L(o,s)})}function q({price:t,approximate:i,zone:o,testId:s}){return e.jsxs("span",{className:"inline-flex items-center","data-testid":s,children:[t===void 0?"—":t===null||t===0n?"N/A":e.jsxs(e.Fragment,{children:[i?e.jsx("span",{className:"mr-0.5",children:b.APPROXIMATE_SYMBOL}):null,e.jsx(T.FormattedNumberString,{value:g.bnToLiquidationPriceView(t)})]}),o?e.jsx("span",{className:"ml-1.5",children:e.jsx(v.HealthDot,{zone:o})}):null]})}exports.LiquidationPriceBlockTest=n.LiquidationPriceBlockTest;exports.LiquidationPriceBlock=f;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{static root="position-assets-root";static row="position-assets-row";static empty="position-assets-empty"}exports.PositionAssetsTest=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{static root="position-assets-root";static row="position-assets-row";static worth="position-assets-worth";static empty="position-assets-empty"}exports.PositionAssetsTest=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),h=require("../stack/stack.cjs");require("../../help-tip/help-tip.cjs");require("react");require("react-intl");require("@gearbox-protocol/sdk/onchain");require("clsx");require("tailwind-merge");require("sonner");const m=require("../../../utils/format.cjs");require("luxon");require("../../../utils/z-index.cjs");require("../../points-icon/points-icon.cjs");const u=require("../values/scalars.cjs");require("../../badge/badge.cjs");require("../../badge/chip.cjs");const p=require("../../short-string/short-string.cjs"),k=require("../../token-symbol/token-symbol.cjs"),g=require("../../typography/typography.cjs"),c=require("./constants.cjs"),_=1,f=20;function q({assets:r,to:o,empty:i,approximate:l,testId:e}){const n=d(r,o),a=o!==void 0;return t.jsx(h.Stack,{gap:"sm",align:"end","data-testid":e??c.PositionAssetsTest.root,children:n.length===0?i!==void 0&&t.jsx(g.Typography,{variant:"caption",color:"secondary",as:"div","data-testid":c.PositionAssetsTest.empty,children:i}):n.map(s=>t.jsxs("span",{className:"flex items-center gap-2","data-testid":c.PositionAssetsTest.row,children:[t.jsx(k.TokenSymbol,{size:20,token:s.token}),t.jsxs("span",{className:"flex items-center",children:[a&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-secondary-foreground line-through [&_*]:text-secondary-foreground [&_*]:line-through",children:t.jsx(u.TokenBigint,{data:s.value,token:s.token,showSymbol:!1})}),t.jsx("span",{className:"px-1.5 text-gray-70",children:"→"})]}),l?t.jsx("span",{children:m.APPROXIMATE_SYMBOL}):null,t.jsx(u.TokenBigint,{data:a?s.valueTo:s.value,token:s.token,showSymbol:!1}),t.jsx(p.ShortString,{className:"ml-1",maxLength:f,children:s.token.symbol})]})]},s.token.address))})}function d(r,o){const i=new Map,l=(e,n)=>{const a=e.token.address.toLowerCase(),s=i.get(a);i.set(a,{token:s?.token??e.token,value:n==="from"?e.value:s?.value??0n,valueTo:n==="to"?e.value:s?.valueTo??0n,worth:v(s?.worth,e.valueUsd)})};for(const e of r??[])l(e,"from");for(const e of o??[])l(e,"to");return[...i.values()].filter(e=>e.worth===null||e.worth>=_).sort((e,n)=>(n.worth??0)-(e.worth??0)||e.token.address.localeCompare(n.token.address))}function v(r,o){return r===void 0?o:r===null||o===null?null:Math.max(r,o)}exports.PositionAssetsTest=c.PositionAssetsTest;exports.PositionAssets=q;exports.visibleAssets=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),p=require("../stack/stack.cjs"),v=require("../values/no-value.cjs");require("react");require("@gearbox-protocol/sdk/onchain");require("clsx");require("tailwind-merge");require("sonner");const f=require("../../../utils/format.cjs"),_=require("../../../utils/format-money.cjs");require("luxon");require("../../../utils/z-index.cjs");require("../../points-icon/points-icon.cjs");const d=require("../values/scalars.cjs");require("../../badge/badge.cjs");require("../../badge/chip.cjs");require("react-intl");const x=require("../../short-string/short-string.cjs"),y=require("../../token-symbol/token-symbol.cjs"),h=require("../../typography/typography.cjs"),l=require("./constants.cjs"),g=1,k=20;function q({assets:r,to:n,empty:a,approximate:c,testId:e}){const o=m(r,n),i=n!==void 0;return t.jsx(p.Stack,{gap:"sm",align:"end","data-testid":e??l.PositionAssetsTest.root,children:o.length===0?a!==void 0&&t.jsx(h.Typography,{variant:"caption",color:"secondary",as:"div","data-testid":l.PositionAssetsTest.empty,children:a}):o.map(s=>{const u=i?s.valueToUsd:s.valueUsd;return t.jsxs("span",{className:"flex flex-col items-end","data-testid":l.PositionAssetsTest.row,children:[t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(y.TokenSymbol,{size:20,token:s.token}),t.jsxs("span",{className:"flex items-center",children:[i&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-secondary-foreground line-through [&_*]:text-secondary-foreground [&_*]:line-through",children:t.jsx(d.TokenBigint,{data:s.value,token:s.token,showSymbol:!1})}),t.jsx("span",{className:"px-1.5 text-gray-70",children:"→"})]}),c?t.jsx("span",{children:f.APPROXIMATE_SYMBOL}):null,t.jsx(d.TokenBigint,{data:i?s.valueTo:s.value,token:s.token,showSymbol:!1}),t.jsx(x.ShortString,{className:"ml-1",maxLength:k,children:s.token.symbol})]})]}),t.jsx(h.Typography,{as:"span",variant:"caption",color:"secondary","data-testid":l.PositionAssetsTest.worth,children:u===null?t.jsx(v.NoValue,{}):_.formatMoney(u)})]},s.token.address)})})}function m(r,n){const a=new Map,c=(e,o)=>{const i=e.token.address.toLowerCase(),s=a.get(i);a.set(i,{token:s?.token??e.token,value:o==="from"?e.value:s?.value??0n,valueTo:o==="to"?e.value:s?.valueTo??0n,valueUsd:o==="from"?e.valueUsd:s?.valueUsd??null,valueToUsd:o==="to"?e.valueUsd:s?.valueToUsd??null,worth:T(s?.worth,e.valueUsd)})};for(const e of r??[])c(e,"from");for(const e of n??[])c(e,"to");return[...a.values()].filter(e=>e.worth===null||e.worth>=g).sort((e,o)=>(o.worth??0)-(e.worth??0)||e.token.address.localeCompare(o.token.address))}function T(r,n){return r===void 0?n:r===null||n===null?null:Math.max(r,n)}exports.PositionAssetsTest=l.PositionAssetsTest;exports.PositionAssets=q;exports.visibleAssets=m;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("../text/use-title-text.cjs"),u=require("../../fadeout-loading/fadeout-loading.cjs"),_=require("../../status-elements/status-elements.cjs"),r=require("../../typed-intl/index.cjs"),L=require("../../vertical-indicator/vertical-indicator.cjs"),p=require("../../../utils/format.cjs"),c=require("../../../utils/ttl.cjs"),l=require("./constants.cjs");function g({data:t,dataTo:n,approximate:s,zone:a,isLoading:o,title:i,tip:m,testId:v}){const q=x.useTitleText(),d=n!==void 0;return e.jsx(L.VerticalIndicator,{align:"center",dimPreviousValue:!1,"data-testid":v??l.TimeToLiquidationBlockTest.root,label:i!==void 0?q(i):e.jsx(r.FormattedMessageTyped,{messageId:"components.timeToLiquidationBlock.label"}),tip:m??e.jsx(r.FormattedMessageTyped,{messageId:"components.timeToLiquidationBlock.tip"}),value:e.jsx(u.FadeoutLoading,{loading:o,children:e.jsx(T,{milliseconds:t,approximate:s,zone:d?void 0:a,testId:l.TimeToLiquidationBlockTest.value})}),valueTo:d?e.jsx(u.FadeoutLoading,{loading:o,children:e.jsx(T,{milliseconds:n??null,approximate:s,zone:a,testId:l.TimeToLiquidationBlockTest.valueTo})}):void 0})}function T({milliseconds:t,approximate:n,zone:s,testId:a}){const o=t==null?void 0:c.ttlLeft(t),i=s??(t==null?void 0:c.getTTLZones(t));return e.jsxs("span",{className:"inline-flex items-center","data-testid":a,children:[t===void 0?"—":t===null?"N/A":e.jsxs(e.Fragment,{children:[n?e.jsx("span",{className:"mr-0.5",children:p.APPROXIMATE_SYMBOL}):null,o?.months!==void 0?`${o.months}mo`:o?.day!==void 0?`${o.day}d`:"<1d"]}),t!=null&&i?e.jsx("span",{className:"ml-1.5",children:e.jsx(_.HealthDot,{zone:i})}):null]})}exports.TimeToLiquidationBlockTest=l.TimeToLiquidationBlockTest;exports.TimeToLiquidationBlock=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("../text/use-title-text.cjs"),u=require("../../fadeout-loading/fadeout-loading.cjs"),p=require("../../status-elements/status-elements.cjs"),r=require("../../typed-intl/index.cjs"),_=require("../../vertical-indicator/vertical-indicator.cjs"),L=require("../../../utils/format.cjs"),c=require("../../../utils/ttl.cjs"),l=require("./constants.cjs");function g({data:t,dataTo:n,approximate:s,zone:a,isLoading:o,title:i,tip:m,testId:v}){const q=x.useTitleText(),d=n!==void 0;return e.jsx(_.VerticalIndicator,{align:"center",dimPreviousValue:!1,"data-testid":v??l.TimeToLiquidationBlockTest.root,label:i!==void 0?q(i):e.jsx(r.FormattedMessageTyped,{messageId:"components.timeToLiquidationBlock.label"}),tip:m??e.jsx(r.FormattedMessageTyped,{messageId:"components.timeToLiquidationBlock.tip"}),value:e.jsx(u.FadeoutLoading,{loading:o,children:e.jsx(T,{milliseconds:t,approximate:s&&!d,zone:d?void 0:a,testId:l.TimeToLiquidationBlockTest.value})}),valueTo:d?e.jsx(u.FadeoutLoading,{loading:o,children:e.jsx(T,{milliseconds:n??null,approximate:s,zone:a,testId:l.TimeToLiquidationBlockTest.valueTo})}):void 0})}function T({milliseconds:t,approximate:n,zone:s,testId:a}){const o=t==null?void 0:c.ttlLeft(t),i=s??(t==null?void 0:c.getTTLZones(t));return e.jsxs("span",{className:"inline-flex items-center","data-testid":a,children:[t===void 0?"—":t===null?"N/A":e.jsxs(e.Fragment,{children:[n?e.jsx("span",{className:"mr-0.5",children:L.APPROXIMATE_SYMBOL}):null,o?.months!==void 0?`${o.months}mo`:o?.day!==void 0?`${o.day}d`:"<1d"]}),t!=null&&i?e.jsx("span",{className:"ml-1.5",children:e.jsx(p.HealthDot,{zone:i})}):null]})}exports.TimeToLiquidationBlockTest=l.TimeToLiquidationBlockTest;exports.TimeToLiquidationBlock=g;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("../stack/stack.cjs"),i=require("../values/no-value.cjs");require("react");require("@gearbox-protocol/sdk/onchain");require("clsx");require("tailwind-merge");require("sonner");const a=require("../../../utils/format-money.cjs");require("luxon");require("../../../utils/z-index.cjs");require("../../points-icon/points-icon.cjs");require("viem");require("../../token-icon/token-icon.cjs");require("react-intl");require("../../tooltip/simple-tooltip.cjs");require("../../tooltip/tooltip.cjs");require("../../badge/badge.cjs");require("../../badge/chip.cjs");const c=require("../../token-template/token-template.cjs"),l=require("../../typography/typography.cjs"),n=require("./constants.cjs");function q({data:e,token:o,align:t="end"}){if(e===null)return r.jsx("span",{className:"text-secondary-foreground","data-testid":n.TokenAmountTest.root,children:"—"});const s=o??e.token;return r.jsxs(u.Stack,{gap:"xs",align:t,"data-testid":n.TokenAmountTest.root,children:[r.jsx(c.TokenTemplate,{value:e.value,token:s}),r.jsx(l.Typography,{as:"span",variant:"caption",color:"secondary",children:e.valueUsd===null?r.jsx(i.NoValue,{}):a.formatMoney(e.valueUsd)})]})}exports.TokenAmountTest=n.TokenAmountTest;exports.TokenAmount=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../stack/stack.cjs"),a=require("../values/no-value.cjs");require("react");require("@gearbox-protocol/sdk/onchain");require("clsx");require("tailwind-merge");require("sonner");const c=require("../../../utils/format.cjs"),l=require("../../../utils/format-money.cjs");require("luxon");require("../../../utils/z-index.cjs");require("../../points-icon/points-icon.cjs");require("viem");require("../../token-icon/token-icon.cjs");require("react-intl");require("../../tooltip/simple-tooltip.cjs");require("../../tooltip/tooltip.cjs");require("../../badge/badge.cjs");require("../../badge/chip.cjs");const m=require("../../token-template/token-template.cjs"),q=require("../../typography/typography.cjs"),n=require("./constants.cjs");function p({data:r,token:o,align:t="end",approximate:s}){if(r===null)return e.jsx("span",{className:"text-secondary-foreground","data-testid":n.TokenAmountTest.root,children:"—"});const u=o??r.token;return e.jsxs(i.Stack,{gap:"xs",align:t,"data-testid":n.TokenAmountTest.root,children:[e.jsxs("span",{className:"flex items-center",children:[s?e.jsx("span",{className:"mr-0.5",children:c.APPROXIMATE_SYMBOL}):null,e.jsx(m.TokenTemplate,{value:r.value,token:u})]}),e.jsx(q.Typography,{as:"span",variant:"caption",color:"secondary",children:r.valueUsd===null?e.jsx(a.NoValue,{}):l.formatMoney(r.valueUsd)})]})}exports.TokenAmountTest=n.TokenAmountTest;exports.TokenAmount=p;
@@ -1,52 +1,72 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useTitleText as h } from "../text/use-title-text.js";
3
- import { FadeoutLoading as s } from "../../fadeout-loading/fadeout-loading.js";
4
- import { HealthFactor as c } from "../../health-factor/health-factor.js";
5
- import { FormattedMessageTyped as n } from "../../typed-intl/index.js";
6
- import { VerticalIndicator as g } from "../../vertical-indicator/vertical-indicator.js";
1
+ import { jsx as e, jsxs as m } from "react/jsx-runtime";
2
+ import { useTitleText as x } from "../text/use-title-text.js";
3
+ import { FadeoutLoading as c } from "../../fadeout-loading/fadeout-loading.js";
4
+ import { HealthFactor as p } from "../../health-factor/health-factor.js";
5
+ import { FormattedMessageTyped as u } from "../../typed-intl/index.js";
6
+ import { VerticalIndicator as B } from "../../vertical-indicator/vertical-indicator.js";
7
+ import { APPROXIMATE_SYMBOL as v } from "../../../utils/format.js";
7
8
  import { HealthFactorBlockTest as t } from "./constants.js";
8
- function b({
9
- healthFactor: e,
10
- healthFactorTo: a,
11
- debt: r,
12
- debtTo: p,
13
- zone: i,
14
- isLoading: l,
9
+ function j({
10
+ healthFactor: o,
11
+ healthFactorTo: l,
12
+ debt: i,
13
+ debtTo: f,
14
+ approximate: r,
15
+ zone: s,
16
+ isLoading: n,
15
17
  title: d,
16
- tip: u,
17
- testId: v
18
+ tip: h,
19
+ testId: T
18
20
  }) {
19
- const f = h(), m = a !== void 0;
20
- return /* @__PURE__ */ o(
21
- g,
21
+ const g = x(), a = l !== void 0;
22
+ return /* @__PURE__ */ e(
23
+ B,
22
24
  {
23
25
  align: "center",
24
26
  dimPreviousValue: !1,
25
- "data-testid": v ?? t.root,
26
- label: d !== void 0 ? f(d) : /* @__PURE__ */ o(n, { messageId: "components.healthFactorBlock.label" }),
27
- tip: u ?? /* @__PURE__ */ o(n, { messageId: "components.healthFactorBlock.tip" }),
28
- value: /* @__PURE__ */ o(s, { loading: l, children: e === void 0 ? /* @__PURE__ */ o("span", { "data-testid": t.value, children: "—" }) : /* @__PURE__ */ o(
29
- c,
27
+ "data-testid": T ?? t.root,
28
+ label: d !== void 0 ? g(d) : /* @__PURE__ */ e(u, { messageId: "components.healthFactorBlock.label" }),
29
+ tip: h ?? /* @__PURE__ */ e(u, { messageId: "components.healthFactorBlock.tip" }),
30
+ value: /* @__PURE__ */ e(c, { loading: n, children: o === void 0 ? /* @__PURE__ */ e("span", { "data-testid": t.value, children: "—" }) : /* @__PURE__ */ m(
31
+ "span",
30
32
  {
31
- value: e,
32
- debt: r,
33
- zone: m ? void 0 : i,
34
- "data-testid": t.value
33
+ className: "inline-flex items-center",
34
+ "data-testid": t.value,
35
+ children: [
36
+ r && !a ? /* @__PURE__ */ e("span", { className: "mr-0.5", children: v }) : null,
37
+ /* @__PURE__ */ e(
38
+ p,
39
+ {
40
+ value: o,
41
+ debt: i,
42
+ zone: a ? void 0 : s
43
+ }
44
+ )
45
+ ]
35
46
  }
36
47
  ) }),
37
- valueTo: m ? /* @__PURE__ */ o(s, { loading: l, children: /* @__PURE__ */ o(
38
- c,
48
+ valueTo: a ? /* @__PURE__ */ e(c, { loading: n, children: /* @__PURE__ */ m(
49
+ "span",
39
50
  {
40
- value: a,
41
- debt: p ?? r,
42
- zone: i,
43
- "data-testid": t.valueTo
51
+ className: "inline-flex items-center",
52
+ "data-testid": t.valueTo,
53
+ children: [
54
+ r ? /* @__PURE__ */ e("span", { className: "mr-0.5", children: v }) : null,
55
+ /* @__PURE__ */ e(
56
+ p,
57
+ {
58
+ value: l,
59
+ debt: f ?? i,
60
+ zone: s
61
+ }
62
+ )
63
+ ]
44
64
  }
45
65
  ) }) : void 0
46
66
  }
47
67
  );
48
68
  }
49
69
  export {
50
- b as HealthFactorBlock,
70
+ j as HealthFactorBlock,
51
71
  t as HealthFactorBlockTest
52
72
  };
@@ -2,12 +2,12 @@ import { jsx as i, jsxs as c, Fragment as T } from "react/jsx-runtime";
2
2
  import { useTitleText as b } from "../text/use-title-text.js";
3
3
  import { FadeoutLoading as u } from "../../fadeout-loading/fadeout-loading.js";
4
4
  import { FormattedNumberString as g } from "../../formatted-number/formatted-number.js";
5
- import { HealthDot as I } from "../../status-elements/status-elements.js";
6
- import { FormattedMessageTyped as f } from "../../typed-intl/index.js";
7
- import { VerticalIndicator as q } from "../../vertical-indicator/vertical-indicator.js";
8
- import { APPROXIMATE_SYMBOL as x } from "../../../utils/format.js";
5
+ import { HealthDot as x } from "../../status-elements/status-elements.js";
6
+ import { FormattedMessageTyped as p } from "../../typed-intl/index.js";
7
+ import { VerticalIndicator as I } from "../../vertical-indicator/vertical-indicator.js";
8
+ import { APPROXIMATE_SYMBOL as q } from "../../../utils/format.js";
9
9
  import { bnToLiquidationPriceView as B } from "../../../utils/parse-input-to-bn.js";
10
- import { LiquidationPriceBlockTest as l } from "./constants.js";
10
+ import { LiquidationPriceBlockTest as n } from "./constants.js";
11
11
  function L(e, o) {
12
12
  if (!(!e || !o))
13
13
  return `${e.symbol} / ${o.symbol}`;
@@ -17,45 +17,45 @@ function S({
17
17
  priceTo: o,
18
18
  collateral: t,
19
19
  underlying: r,
20
- approximate: n,
21
- zone: a,
22
- isLoading: m,
23
- title: s,
20
+ approximate: a,
21
+ zone: m,
22
+ isLoading: s,
23
+ title: d,
24
24
  tip: v,
25
25
  testId: P
26
26
  }) {
27
- const h = b(), d = o !== void 0;
27
+ const h = b(), l = o !== void 0;
28
28
  return /* @__PURE__ */ i(
29
- q,
29
+ I,
30
30
  {
31
31
  align: "center",
32
32
  dimPreviousValue: !1,
33
- "data-testid": P ?? l.root,
34
- label: s !== void 0 ? h(s) : /* @__PURE__ */ i(f, { messageId: "components.liquidationPriceBlock.label" }),
35
- tip: v ?? /* @__PURE__ */ i(f, { messageId: "components.liquidationPriceBlock.tip" }),
36
- value: /* @__PURE__ */ i(u, { loading: m, children: /* @__PURE__ */ i(
37
- p,
33
+ "data-testid": P ?? n.root,
34
+ label: d !== void 0 ? h(d) : /* @__PURE__ */ i(p, { messageId: "components.liquidationPriceBlock.label" }),
35
+ tip: v ?? /* @__PURE__ */ i(p, { messageId: "components.liquidationPriceBlock.tip" }),
36
+ value: /* @__PURE__ */ i(u, { loading: s, children: /* @__PURE__ */ i(
37
+ f,
38
38
  {
39
39
  price: e,
40
- approximate: n,
41
- zone: d ? void 0 : a,
42
- testId: l.value
40
+ approximate: a && !l,
41
+ zone: l ? void 0 : m,
42
+ testId: n.value
43
43
  }
44
44
  ) }),
45
- valueTo: d ? /* @__PURE__ */ i(u, { loading: m, children: /* @__PURE__ */ i(
46
- p,
45
+ valueTo: l ? /* @__PURE__ */ i(u, { loading: s, children: /* @__PURE__ */ i(
46
+ f,
47
47
  {
48
48
  price: o ?? null,
49
- approximate: n,
50
- zone: a,
51
- testId: l.valueTo
49
+ approximate: a,
50
+ zone: m,
51
+ testId: n.valueTo
52
52
  }
53
53
  ) }) : void 0,
54
54
  valueDescription: L(t, r)
55
55
  }
56
56
  );
57
57
  }
58
- function p({
58
+ function f({
59
59
  price: e,
60
60
  approximate: o,
61
61
  zone: t,
@@ -63,13 +63,13 @@ function p({
63
63
  }) {
64
64
  return /* @__PURE__ */ c("span", { className: "inline-flex items-center", "data-testid": r, children: [
65
65
  e === void 0 ? "—" : e === null || e === 0n ? "N/A" : /* @__PURE__ */ c(T, { children: [
66
- o ? /* @__PURE__ */ i("span", { className: "mr-0.5", children: x }) : null,
66
+ o ? /* @__PURE__ */ i("span", { className: "mr-0.5", children: q }) : null,
67
67
  /* @__PURE__ */ i(g, { value: B(e) })
68
68
  ] }),
69
- t ? /* @__PURE__ */ i("span", { className: "ml-1.5", children: /* @__PURE__ */ i(I, { zone: t }) }) : null
69
+ t ? /* @__PURE__ */ i("span", { className: "ml-1.5", children: /* @__PURE__ */ i(x, { zone: t }) }) : null
70
70
  ] });
71
71
  }
72
72
  export {
73
73
  S as LiquidationPriceBlock,
74
- l as LiquidationPriceBlockTest
74
+ n as LiquidationPriceBlockTest
75
75
  };
@@ -1,6 +1,7 @@
1
1
  class t {
2
2
  static root = "position-assets-root";
3
3
  static row = "position-assets-row";
4
+ static worth = "position-assets-worth";
4
5
  static empty = "position-assets-empty";
5
6
  }
6
7
  export {
@@ -1,99 +1,117 @@
1
- import { jsx as e, jsxs as m, Fragment as p } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as m, Fragment as f } from "react/jsx-runtime";
2
2
  import { Stack as h } from "../stack/stack.js";
3
- import "../../help-tip/help-tip.js";
3
+ import { NoValue as v } from "../values/no-value.js";
4
4
  import "react";
5
- import "react-intl";
6
5
  import "@gearbox-protocol/sdk/onchain";
7
6
  import "clsx";
8
7
  import "tailwind-merge";
9
8
  import "sonner";
10
- import { APPROXIMATE_SYMBOL as f } from "../../../utils/format.js";
9
+ import { APPROXIMATE_SYMBOL as k } from "../../../utils/format.js";
10
+ import { formatMoney as g } from "../../../utils/format-money.js";
11
11
  import "luxon";
12
12
  import "../../../utils/z-index.js";
13
13
  import "../../points-icon/points-icon.js";
14
- import { TokenBigint as d } from "../values/scalars.js";
14
+ import { TokenBigint as p } from "../values/scalars.js";
15
15
  import "../../badge/badge.js";
16
16
  import "../../badge/chip.js";
17
- import { ShortString as u } from "../../short-string/short-string.js";
18
- import { TokenSymbol as k } from "../../token-symbol/token-symbol.js";
19
- import { Typography as v } from "../../typography/typography.js";
20
- import { PositionAssetsTest as c } from "./constants.js";
21
- const g = 1, y = 20;
22
- function I({
17
+ import "react-intl";
18
+ import { ShortString as y } from "../../short-string/short-string.js";
19
+ import { TokenSymbol as T } from "../../token-symbol/token-symbol.js";
20
+ import { Typography as u } from "../../typography/typography.js";
21
+ import { PositionAssetsTest as d } from "./constants.js";
22
+ const x = 1, U = 20;
23
+ function G({
23
24
  assets: s,
24
- to: r,
25
+ to: n,
25
26
  empty: a,
26
- approximate: l,
27
+ approximate: i,
27
28
  testId: o
28
29
  }) {
29
- const n = S(s, r), i = r !== void 0;
30
- return /* @__PURE__ */ e(h, { gap: "sm", align: "end", "data-testid": o ?? c.root, children: n.length === 0 ? a !== void 0 && /* @__PURE__ */ e(
31
- v,
30
+ const r = S(s, n), l = n !== void 0;
31
+ return /* @__PURE__ */ e(h, { gap: "sm", align: "end", "data-testid": o ?? d.root, children: r.length === 0 ? a !== void 0 && /* @__PURE__ */ e(
32
+ u,
32
33
  {
33
34
  variant: "caption",
34
35
  color: "secondary",
35
36
  as: "div",
36
- "data-testid": c.empty,
37
+ "data-testid": d.empty,
37
38
  children: a
38
39
  }
39
- ) : n.map((t) => /* @__PURE__ */ m(
40
- "span",
41
- {
42
- className: "flex items-center gap-2",
43
- "data-testid": c.row,
44
- children: [
45
- /* @__PURE__ */ e(k, { size: 20, token: t.token }),
46
- /* @__PURE__ */ m("span", { className: "flex items-center", children: [
47
- i && /* @__PURE__ */ m(p, { children: [
48
- /* @__PURE__ */ e("span", { className: "text-secondary-foreground line-through [&_*]:text-secondary-foreground [&_*]:line-through", children: /* @__PURE__ */ e(
49
- d,
50
- {
51
- data: t.value,
52
- token: t.token,
53
- showSymbol: !1
54
- }
55
- ) }),
56
- /* @__PURE__ */ e("span", { className: "px-1.5 text-gray-70", children: "→" })
40
+ ) : r.map((t) => {
41
+ const c = l ? t.valueToUsd : t.valueUsd;
42
+ return /* @__PURE__ */ m(
43
+ "span",
44
+ {
45
+ className: "flex flex-col items-end",
46
+ "data-testid": d.row,
47
+ children: [
48
+ /* @__PURE__ */ m("span", { className: "flex items-center gap-2", children: [
49
+ /* @__PURE__ */ e(T, { size: 20, token: t.token }),
50
+ /* @__PURE__ */ m("span", { className: "flex items-center", children: [
51
+ l && /* @__PURE__ */ m(f, { children: [
52
+ /* @__PURE__ */ e("span", { className: "text-secondary-foreground line-through [&_*]:text-secondary-foreground [&_*]:line-through", children: /* @__PURE__ */ e(
53
+ p,
54
+ {
55
+ data: t.value,
56
+ token: t.token,
57
+ showSymbol: !1
58
+ }
59
+ ) }),
60
+ /* @__PURE__ */ e("span", { className: "px-1.5 text-gray-70", children: "→" })
61
+ ] }),
62
+ i ? /* @__PURE__ */ e("span", { children: k }) : null,
63
+ /* @__PURE__ */ e(
64
+ p,
65
+ {
66
+ data: l ? t.valueTo : t.value,
67
+ token: t.token,
68
+ showSymbol: !1
69
+ }
70
+ ),
71
+ /* @__PURE__ */ e(y, { className: "ml-1", maxLength: U, children: t.token.symbol })
72
+ ] })
57
73
  ] }),
58
- l ? /* @__PURE__ */ e("span", { children: f }) : null,
59
74
  /* @__PURE__ */ e(
60
- d,
75
+ u,
61
76
  {
62
- data: i ? t.valueTo : t.value,
63
- token: t.token,
64
- showSymbol: !1
77
+ as: "span",
78
+ variant: "caption",
79
+ color: "secondary",
80
+ "data-testid": d.worth,
81
+ children: c === null ? /* @__PURE__ */ e(v, {}) : g(c)
65
82
  }
66
- ),
67
- /* @__PURE__ */ e(u, { className: "ml-1", maxLength: y, children: t.token.symbol })
68
- ] })
69
- ]
70
- },
71
- t.token.address
72
- )) });
83
+ )
84
+ ]
85
+ },
86
+ t.token.address
87
+ );
88
+ }) });
73
89
  }
74
- function S(s, r) {
75
- const a = /* @__PURE__ */ new Map(), l = (o, n) => {
76
- const i = o.token.address.toLowerCase(), t = a.get(i);
77
- a.set(i, {
90
+ function S(s, n) {
91
+ const a = /* @__PURE__ */ new Map(), i = (o, r) => {
92
+ const l = o.token.address.toLowerCase(), t = a.get(l);
93
+ a.set(l, {
78
94
  token: t?.token ?? o.token,
79
95
  // a token only the other side holds is a zero here, not a gap
80
- value: n === "from" ? o.value : t?.value ?? 0n,
81
- valueTo: n === "to" ? o.value : t?.valueTo ?? 0n,
82
- worth: x(t?.worth, o.valueUsd)
96
+ value: r === "from" ? o.value : t?.value ?? 0n,
97
+ valueTo: r === "to" ? o.value : t?.valueTo ?? 0n,
98
+ valueUsd: r === "from" ? o.valueUsd : t?.valueUsd ?? null,
99
+ valueToUsd: r === "to" ? o.valueUsd : t?.valueToUsd ?? null,
100
+ worth: M(t?.worth, o.valueUsd)
83
101
  });
84
102
  };
85
- for (const o of s ?? []) l(o, "from");
86
- for (const o of r ?? []) l(o, "to");
87
- return [...a.values()].filter((o) => o.worth === null || o.worth >= g).sort(
88
- (o, n) => (n.worth ?? 0) - (o.worth ?? 0) || // a tie has to break the same way every render, or the rows drift
89
- o.token.address.localeCompare(n.token.address)
103
+ for (const o of s ?? []) i(o, "from");
104
+ for (const o of n ?? []) i(o, "to");
105
+ return [...a.values()].filter((o) => o.worth === null || o.worth >= x).sort(
106
+ (o, r) => (r.worth ?? 0) - (o.worth ?? 0) || // a tie has to break the same way every render, or the rows drift
107
+ o.token.address.localeCompare(r.token.address)
90
108
  );
91
109
  }
92
- function x(s, r) {
93
- return s === void 0 ? r : s === null || r === null ? null : Math.max(s, r);
110
+ function M(s, n) {
111
+ return s === void 0 ? n : s === null || n === null ? null : Math.max(s, n);
94
112
  }
95
113
  export {
96
- I as PositionAssets,
97
- c as PositionAssetsTest,
114
+ G as PositionAssets,
115
+ d as PositionAssetsTest,
98
116
  S as visibleAssets
99
117
  };
@@ -4,44 +4,44 @@ import { FadeoutLoading as s } from "../../fadeout-loading/fadeout-loading.js";
4
4
  import { HealthDot as g } from "../../status-elements/status-elements.js";
5
5
  import { FormattedMessageTyped as u } from "../../typed-intl/index.js";
6
6
  import { VerticalIndicator as L } from "../../vertical-indicator/vertical-indicator.js";
7
- import { APPROXIMATE_SYMBOL as I } from "../../../utils/format.js";
8
- import { ttlLeft as x, getTTLZones as B } from "../../../utils/ttl.js";
9
- import { TimeToLiquidationBlockTest as a } from "./constants.js";
7
+ import { APPROXIMATE_SYMBOL as x } from "../../../utils/format.js";
8
+ import { ttlLeft as I, getTTLZones as B } from "../../../utils/ttl.js";
9
+ import { TimeToLiquidationBlockTest as d } from "./constants.js";
10
10
  function j({
11
11
  data: o,
12
12
  dataTo: n,
13
13
  approximate: r,
14
- zone: l,
14
+ zone: a,
15
15
  isLoading: e,
16
16
  title: i,
17
- tip: v,
18
- testId: p
17
+ tip: p,
18
+ testId: v
19
19
  }) {
20
- const T = h(), d = n !== void 0;
20
+ const T = h(), l = n !== void 0;
21
21
  return /* @__PURE__ */ t(
22
22
  L,
23
23
  {
24
24
  align: "center",
25
25
  dimPreviousValue: !1,
26
- "data-testid": p ?? a.root,
26
+ "data-testid": v ?? d.root,
27
27
  label: i !== void 0 ? T(i) : /* @__PURE__ */ t(u, { messageId: "components.timeToLiquidationBlock.label" }),
28
- tip: v ?? /* @__PURE__ */ t(u, { messageId: "components.timeToLiquidationBlock.tip" }),
28
+ tip: p ?? /* @__PURE__ */ t(u, { messageId: "components.timeToLiquidationBlock.tip" }),
29
29
  value: /* @__PURE__ */ t(s, { loading: e, children: /* @__PURE__ */ t(
30
30
  c,
31
31
  {
32
32
  milliseconds: o,
33
- approximate: r,
34
- zone: d ? void 0 : l,
35
- testId: a.value
33
+ approximate: r && !l,
34
+ zone: l ? void 0 : a,
35
+ testId: d.value
36
36
  }
37
37
  ) }),
38
- valueTo: d ? /* @__PURE__ */ t(s, { loading: e, children: /* @__PURE__ */ t(
38
+ valueTo: l ? /* @__PURE__ */ t(s, { loading: e, children: /* @__PURE__ */ t(
39
39
  c,
40
40
  {
41
41
  milliseconds: n ?? null,
42
42
  approximate: r,
43
- zone: l,
44
- testId: a.valueTo
43
+ zone: a,
44
+ testId: d.valueTo
45
45
  }
46
46
  ) }) : void 0
47
47
  }
@@ -51,12 +51,12 @@ function c({
51
51
  milliseconds: o,
52
52
  approximate: n,
53
53
  zone: r,
54
- testId: l
54
+ testId: a
55
55
  }) {
56
- const e = o == null ? void 0 : x(o), i = r ?? (o == null ? void 0 : B(o));
57
- return /* @__PURE__ */ m("span", { className: "inline-flex items-center", "data-testid": l, children: [
56
+ const e = o == null ? void 0 : I(o), i = r ?? (o == null ? void 0 : B(o));
57
+ return /* @__PURE__ */ m("span", { className: "inline-flex items-center", "data-testid": a, children: [
58
58
  o === void 0 ? "—" : o === null ? "N/A" : /* @__PURE__ */ m(f, { children: [
59
- n ? /* @__PURE__ */ t("span", { className: "mr-0.5", children: I }) : null,
59
+ n ? /* @__PURE__ */ t("span", { className: "mr-0.5", children: x }) : null,
60
60
  e?.months !== void 0 ? `${e.months}mo` : e?.day !== void 0 ? `${e.day}d` : "<1d"
61
61
  ] }),
62
62
  o != null && i ? /* @__PURE__ */ t("span", { className: "ml-1.5", children: /* @__PURE__ */ t(g, { zone: i }) }) : null
@@ -64,5 +64,5 @@ function c({
64
64
  }
65
65
  export {
66
66
  j as TimeToLiquidationBlock,
67
- a as TimeToLiquidationBlockTest
67
+ d as TimeToLiquidationBlockTest
68
68
  };
@@ -1,12 +1,13 @@
1
- import { jsx as r, jsxs as e } from "react/jsx-runtime";
2
- import { Stack as n } from "../stack/stack.js";
1
+ import { jsx as r, jsxs as t } from "react/jsx-runtime";
2
+ import { Stack as s } from "../stack/stack.js";
3
3
  import { NoValue as a } from "../values/no-value.js";
4
4
  import "react";
5
5
  import "@gearbox-protocol/sdk/onchain";
6
6
  import "clsx";
7
7
  import "tailwind-merge";
8
8
  import "sonner";
9
- import { formatMoney as s } from "../../../utils/format-money.js";
9
+ import { APPROXIMATE_SYMBOL as l } from "../../../utils/format.js";
10
+ import { formatMoney as c } from "../../../utils/format-money.js";
10
11
  import "luxon";
11
12
  import "../../../utils/z-index.js";
12
13
  import "../../points-icon/points-icon.js";
@@ -17,30 +18,34 @@ import "../../tooltip/simple-tooltip.js";
17
18
  import "../../tooltip/tooltip.js";
18
19
  import "../../badge/badge.js";
19
20
  import "../../badge/chip.js";
20
- import { TokenTemplate as l } from "../../token-template/token-template.js";
21
- import { Typography as u } from "../../typography/typography.js";
22
- import { TokenAmountTest as t } from "./constants.js";
23
- function C({
21
+ import { TokenTemplate as u } from "../../token-template/token-template.js";
22
+ import { Typography as f } from "../../typography/typography.js";
23
+ import { TokenAmountTest as m } from "./constants.js";
24
+ function Y({
24
25
  data: o,
25
- token: m,
26
- align: i = "end"
26
+ token: e,
27
+ align: i = "end",
28
+ approximate: n
27
29
  }) {
28
30
  if (o === null)
29
31
  return /* @__PURE__ */ r(
30
32
  "span",
31
33
  {
32
34
  className: "text-secondary-foreground",
33
- "data-testid": t.root,
35
+ "data-testid": m.root,
34
36
  children: "—"
35
37
  }
36
38
  );
37
- const p = m ?? o.token;
38
- return /* @__PURE__ */ e(n, { gap: "xs", align: i, "data-testid": t.root, children: [
39
- /* @__PURE__ */ r(l, { value: o.value, token: p }),
40
- /* @__PURE__ */ r(u, { as: "span", variant: "caption", color: "secondary", children: o.valueUsd === null ? /* @__PURE__ */ r(a, {}) : s(o.valueUsd) })
39
+ const p = e ?? o.token;
40
+ return /* @__PURE__ */ t(s, { gap: "xs", align: i, "data-testid": m.root, children: [
41
+ /* @__PURE__ */ t("span", { className: "flex items-center", children: [
42
+ n ? /* @__PURE__ */ r("span", { className: "mr-0.5", children: l }) : null,
43
+ /* @__PURE__ */ r(u, { value: o.value, token: p })
44
+ ] }),
45
+ /* @__PURE__ */ r(f, { as: "span", variant: "caption", color: "secondary", children: o.valueUsd === null ? /* @__PURE__ */ r(a, {}) : c(o.valueUsd) })
41
46
  ] });
42
47
  }
43
48
  export {
44
- C as TokenAmount,
45
- t as TokenAmountTest
49
+ Y as TokenAmount,
50
+ m as TokenAmountTest
46
51
  };
@@ -13,6 +13,13 @@ export interface HealthFactorBlockProps {
13
13
  readonly debt: bigint;
14
14
  /** Debt after the operation (defaults to `debt`). */
15
15
  readonly debtTo?: bigint;
16
+ /**
17
+ * Prefixes the figure with {@link APPROXIMATE_SYMBOL}, for a factor the
18
+ * operation projects rather than promises. Only the projected side is
19
+ * marked: on a `from → to` row the "from" is where the account stands now,
20
+ * which is measured, not estimated.
21
+ */
22
+ readonly approximate?: boolean;
16
23
  /** Pre-computed zone; if not set, derived from the value. */
17
24
  readonly zone?: HFZones;
18
25
  readonly isLoading?: boolean;
@@ -26,4 +33,4 @@ export interface HealthFactorBlockProps {
26
33
  * "Health factor" row of a preview: label + help tip on the left, the zone-
27
34
  * colored HF (with optional from → to transition) on the right.
28
35
  */
29
- export declare function HealthFactorBlock({ healthFactor, healthFactorTo, debt, debtTo, zone, isLoading, title, tip, testId, }: HealthFactorBlockProps): React.ReactElement;
36
+ export declare function HealthFactorBlock({ healthFactor, healthFactorTo, debt, debtTo, approximate, zone, isLoading, title, tip, testId, }: HealthFactorBlockProps): React.ReactElement;
@@ -17,10 +17,10 @@ export interface LiquidationPriceBlockProps {
17
17
  /** Underlying token of the quoted pair. */
18
18
  readonly underlying?: Token;
19
19
  /**
20
- * Prefixes the figure with {@link APPROXIMATE_SYMBOL}. For a projection the
21
- * operation cannot promise exactly a routed leg the market can move under.
22
- * Both columns are marked when the row renders `from → to`: the "from" of a
23
- * projected pair is projected too.
20
+ * Prefixes the figure with {@link APPROXIMATE_SYMBOL}, for a value the
21
+ * operation projects rather than promises. Only the projected side is
22
+ * marked: on a `from → to` row the "from" is where the account stands now,
23
+ * which is measured, not estimated.
24
24
  */
25
25
  readonly approximate?: boolean;
26
26
  /** Zone dot next to the price. */
@@ -1,5 +1,6 @@
1
1
  export declare class PositionAssetsTest {
2
2
  static root: string;
3
3
  static row: string;
4
+ static worth: string;
4
5
  static empty: string;
5
6
  }
@@ -53,6 +53,10 @@ export interface AssetRow {
53
53
  * dust and order. `null` when a side the oracle cannot price is involved.
54
54
  */
55
55
  readonly worth: number | null;
56
+ /** USD of the "now" side; `null` where the oracle could not price it. */
57
+ readonly valueUsd: number | null;
58
+ /** USD of the "after" side, for the caption a paired row shows. */
59
+ readonly valueToUsd: number | null;
56
60
  }
57
61
  /**
58
62
  * What earns a row, most valuable first — decided across both sides, so a
@@ -12,10 +12,10 @@ export interface TimeToLiquidationBlockProps {
12
12
  /** Time after the operation; renders a from → to transition. */
13
13
  readonly dataTo?: bigint | null;
14
14
  /**
15
- * Prefixes the figure with {@link APPROXIMATE_SYMBOL}. For a projection the
16
- * operation cannot promise exactly a routed leg the market can move under.
17
- * Both columns are marked when the row renders `from → to`: the "from" of a
18
- * projected pair is projected too.
15
+ * Prefixes the figure with {@link APPROXIMATE_SYMBOL}, for a value the
16
+ * operation projects rather than promises. Only the projected side is
17
+ * marked: on a `from → to` row the "from" is where the account stands now,
18
+ * which is measured, not estimated.
19
19
  */
20
20
  readonly approximate?: boolean;
21
21
  /** Pre-computed zone; if not set, derived from the value. */
@@ -28,5 +28,12 @@ export type TokenAmountProps = TokenAmountDataProps & {
28
28
  * wrapper sets. Pass `start` inside a card, where the left edge is right.
29
29
  */
30
30
  readonly align?: TokenAmountAlign;
31
+ /**
32
+ * Prefixes the token line with {@link APPROXIMATE_SYMBOL}, for a figure the
33
+ * operation projects rather than promises. The USD caption underneath is not
34
+ * marked: the mark belongs beside the amount it hedges, and repeating it on
35
+ * the second line only reads as a second claim.
36
+ */
37
+ readonly approximate?: boolean;
31
38
  };
32
- export declare function TokenAmount({ data, token, align, }: TokenAmountProps): React.ReactElement;
39
+ export declare function TokenAmount({ data, token, align, approximate, }: TokenAmountProps): React.ReactElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "4.0.0-next.45",
3
+ "version": "4.0.0-next.47",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",