@gearbox-protocol/ui-kit 4.0.0-next.46 → 4.0.0-next.48

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.
@@ -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"),v=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"),T=require("../../vertical-indicator/vertical-indicator.cjs"),t=require("./constants.cjs");function _({healthFactor:o,healthFactorTo:s,debt:c,debtTo:m,approximate:l,zone:n,isLoading:r,title:i,tip:x,testId:p}){const F=v.useTitleText(),a=s!==void 0;return e.jsx(T.VerticalIndicator,{align:"center",dimPreviousValue:!1,"data-testid":p??t.HealthFactorBlockTest.root,label:i!==void 0?F(i):e.jsx(h.FormattedMessageTyped,{messageId:"components.healthFactorBlock.label"}),tip:x??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.jsx("span",{className:"inline-flex items-center","data-testid":t.HealthFactorBlockTest.value,children:e.jsx(u.HealthFactor,{value:o,debt:c,zone:a?void 0:n,approximate:l&&!a})})}),valueTo:a?e.jsx(d.FadeoutLoading,{loading:r,children:e.jsx("span",{className:"inline-flex items-center","data-testid":t.HealthFactorBlockTest.valueTo,children:e.jsx(u.HealthFactor,{value:s,debt:m??c,zone:n,approximate:l})})}):void 0})}exports.HealthFactorBlockTest=t.HealthFactorBlockTest;exports.HealthFactorBlock=_;
@@ -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"});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("@gearbox-protocol/sdk/onchain"),g=require("class-variance-authority");require("react");const j=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");const a=require("../status-elements/status-elements.cjs"),l=15e3,d=11e3,A=10500,m=t=>{if(t)return t>=l?"good":t>d?"medium":t>A?"bad":t>u.PERCENTAGE_FACTOR?"critical":"liquidation"},D=g.cva("inline-flex items-center font-medium [text-decoration:inherit]",{variants:{zone:{good:"text-success",medium:"text-warning",bad:"text-destructive",critical:"text-destructive",liquidation:"text-liquidation",unset:"[color:unset]"}}});function b({value:t,debt:i,decimals:x=3,zone:e,zoneType:o="color",className:q,...v}){const n=i!==void 0&&i===0n,F=!n&&o==="color",H=!n&&e&&o==="dot",f=!n&&e&&o==="bars",s=F?e===void 0?m(t):e:void 0,c=s===void 0?void 0:s===null?"unset":s,h=()=>{if(n)return"N/A";const _=Number(t);return u.formatPercentage(_,x)};return r.jsxs("span",{className:j.cn(D(c!==void 0?{zone:c}:{}),q),...v,children:[f&&r.jsx("span",{className:"mr-6 shrink-0",children:r.jsx(a.StatusBars,{zone:e})}),h(),H&&r.jsx("span",{className:"ml-1.5",children:r.jsx(a.HealthDot,{zone:e})})]})}exports.BAD_HF=d;exports.GOOD_HF=l;exports.HealthFactor=b;exports.getHFZones=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("@gearbox-protocol/sdk/onchain"),g=require("class-variance-authority");require("react");const j=require("../../utils/cn.cjs");require("sonner");const O=require("../../utils/format.cjs");require("luxon");require("../../utils/z-index.cjs");const a=require("../status-elements/status-elements.cjs"),l=15e3,d=11e3,D=10500,m=t=>{if(t)return t>=l?"good":t>d?"medium":t>D?"bad":t>u.PERCENTAGE_FACTOR?"critical":"liquidation"},N=g.cva("inline-flex items-center font-medium [text-decoration:inherit]",{variants:{zone:{good:"text-success",medium:"text-warning",bad:"text-destructive",critical:"text-destructive",liquidation:"text-liquidation",unset:"[color:unset]"}}});function b({value:t,debt:i,decimals:x=3,zone:e,zoneType:s="color",approximate:q,className:v,..._}){const n=i!==void 0&&i===0n,f=!n&&s==="color",h=!n&&e&&s==="dot",F=!n&&e&&s==="bars",o=f?e===void 0?m(t):e:void 0,c=o===void 0?void 0:o===null?"unset":o,H=()=>{if(n)return"N/A";const A=Number(t);return u.formatPercentage(A,x)};return r.jsxs("span",{className:j.cn(N(c!==void 0?{zone:c}:{}),v),..._,children:[F&&r.jsx("span",{className:"mr-6 shrink-0",children:r.jsx(a.StatusBars,{zone:e})}),q&&!n?r.jsx("span",{className:"mr-0.5",children:O.APPROXIMATE_SYMBOL}):null,H(),h&&r.jsx("span",{className:"ml-1.5",children:r.jsx(a.HealthDot,{zone:e})})]})}exports.BAD_HF=d;exports.GOOD_HF=l;exports.HealthFactor=b;exports.getHFZones=m;
@@ -1,52 +1,67 @@
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 } from "react/jsx-runtime";
2
+ import { useTitleText as g } from "../text/use-title-text.js";
3
+ import { FadeoutLoading as c } from "../../fadeout-loading/fadeout-loading.js";
4
+ import { HealthFactor as m } from "../../health-factor/health-factor.js";
5
+ import { FormattedMessageTyped as p } from "../../typed-intl/index.js";
6
+ import { VerticalIndicator as x } from "../../vertical-indicator/vertical-indicator.js";
7
7
  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,
8
+ function N({
9
+ healthFactor: a,
10
+ healthFactorTo: i,
11
+ debt: l,
12
+ debtTo: u,
13
+ approximate: r,
14
+ zone: n,
15
+ isLoading: s,
15
16
  title: d,
16
- tip: u,
17
- testId: v
17
+ tip: v,
18
+ testId: f
18
19
  }) {
19
- const f = h(), m = a !== void 0;
20
- return /* @__PURE__ */ o(
21
- g,
20
+ const h = g(), o = i !== void 0;
21
+ return /* @__PURE__ */ e(
22
+ x,
22
23
  {
23
24
  align: "center",
24
25
  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,
26
+ "data-testid": f ?? t.root,
27
+ label: d !== void 0 ? h(d) : /* @__PURE__ */ e(p, { messageId: "components.healthFactorBlock.label" }),
28
+ tip: v ?? /* @__PURE__ */ e(p, { messageId: "components.healthFactorBlock.tip" }),
29
+ value: /* @__PURE__ */ e(c, { loading: s, children: a === void 0 ? /* @__PURE__ */ e("span", { "data-testid": t.value, children: "—" }) : /* @__PURE__ */ e(
30
+ "span",
30
31
  {
31
- value: e,
32
- debt: r,
33
- zone: m ? void 0 : i,
34
- "data-testid": t.value
32
+ className: "inline-flex items-center",
33
+ "data-testid": t.value,
34
+ children: /* @__PURE__ */ e(
35
+ m,
36
+ {
37
+ value: a,
38
+ debt: l,
39
+ zone: o ? void 0 : n,
40
+ approximate: r && !o
41
+ }
42
+ )
35
43
  }
36
44
  ) }),
37
- valueTo: m ? /* @__PURE__ */ o(s, { loading: l, children: /* @__PURE__ */ o(
38
- c,
45
+ valueTo: o ? /* @__PURE__ */ e(c, { loading: s, children: /* @__PURE__ */ e(
46
+ "span",
39
47
  {
40
- value: a,
41
- debt: p ?? r,
42
- zone: i,
43
- "data-testid": t.valueTo
48
+ className: "inline-flex items-center",
49
+ "data-testid": t.valueTo,
50
+ children: /* @__PURE__ */ e(
51
+ m,
52
+ {
53
+ value: i,
54
+ debt: u ?? l,
55
+ zone: n,
56
+ approximate: r
57
+ }
58
+ )
44
59
  }
45
60
  ) }) : void 0
46
61
  }
47
62
  );
48
63
  }
49
64
  export {
50
- b as HealthFactorBlock,
65
+ N as HealthFactorBlock,
51
66
  t as HealthFactorBlockTest
52
67
  };
@@ -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
  };
@@ -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,16 +1,17 @@
1
- import { jsxs as x, jsx as i } from "react/jsx-runtime";
2
- import { PERCENTAGE_FACTOR as h, formatPercentage as C } from "@gearbox-protocol/sdk/onchain";
3
- import { cva as F } from "class-variance-authority";
1
+ import { jsxs as h, jsx as n } from "react/jsx-runtime";
2
+ import { PERCENTAGE_FACTOR as A, formatPercentage as N } from "@gearbox-protocol/sdk/onchain";
3
+ import { cva as C } from "class-variance-authority";
4
4
  import "react";
5
- import { cn as H } from "../../utils/cn.js";
5
+ import { cn as F } from "../../utils/cn.js";
6
6
  import "sonner";
7
+ import { APPROXIMATE_SYMBOL as H } from "../../utils/format.js";
7
8
  import "luxon";
8
9
  import "../../utils/z-index.js";
9
- import { StatusBars as N, HealthDot as g } from "../status-elements/status-elements.js";
10
- const A = 15e3, D = 11e3, b = 10500, w = (t) => {
10
+ import { StatusBars as g, HealthDot as D } from "../status-elements/status-elements.js";
11
+ const O = 15e3, _ = 11e3, b = 10500, w = (t) => {
11
12
  if (t)
12
- return t >= A ? "good" : t > D ? "medium" : t > b ? "bad" : t > h ? "critical" : "liquidation";
13
- }, V = F(
13
+ return t >= O ? "good" : t > _ ? "medium" : t > b ? "bad" : t > A ? "critical" : "liquidation";
14
+ }, B = C(
14
15
  "inline-flex items-center font-medium [text-decoration:inherit]",
15
16
  {
16
17
  variants: {
@@ -25,41 +26,43 @@ const A = 15e3, D = 11e3, b = 10500, w = (t) => {
25
26
  }
26
27
  }
27
28
  );
28
- function P({
29
+ function S({
29
30
  value: t,
30
31
  debt: s,
31
32
  decimals: c = 3,
32
33
  zone: o,
33
- zoneType: n = "color",
34
- className: m,
34
+ zoneType: i = "color",
35
+ approximate: m,
36
+ className: l,
35
37
  ...u
36
38
  }) {
37
- const r = s !== void 0 && s === 0n, d = !r && n === "color", l = !r && o && n === "dot", f = !r && o && n === "bars", e = d ? o === void 0 ? w(t) : o : void 0, a = e === void 0 ? void 0 : e === null ? "unset" : e, p = () => {
39
+ const r = s !== void 0 && s === 0n, d = !r && i === "color", f = !r && o && i === "dot", p = !r && o && i === "bars", e = d ? o === void 0 ? w(t) : o : void 0, a = e === void 0 ? void 0 : e === null ? "unset" : e, v = () => {
38
40
  if (r) return "N/A";
39
- const v = Number(t);
40
- return C(v, c);
41
+ const x = Number(t);
42
+ return N(x, c);
41
43
  };
42
- return /* @__PURE__ */ x(
44
+ return /* @__PURE__ */ h(
43
45
  "span",
44
46
  {
45
- className: H(
46
- V(
47
+ className: F(
48
+ B(
47
49
  a !== void 0 ? { zone: a } : {}
48
50
  ),
49
- m
51
+ l
50
52
  ),
51
53
  ...u,
52
54
  children: [
53
- f && /* @__PURE__ */ i("span", { className: "mr-6 shrink-0", children: /* @__PURE__ */ i(N, { zone: o }) }),
54
- p(),
55
- l && /* @__PURE__ */ i("span", { className: "ml-1.5", children: /* @__PURE__ */ i(g, { zone: o }) })
55
+ p && /* @__PURE__ */ n("span", { className: "mr-6 shrink-0", children: /* @__PURE__ */ n(g, { zone: o }) }),
56
+ m && !r ? /* @__PURE__ */ n("span", { className: "mr-0.5", children: H }) : null,
57
+ v(),
58
+ f && /* @__PURE__ */ n("span", { className: "ml-1.5", children: /* @__PURE__ */ n(D, { zone: o }) })
56
59
  ]
57
60
  }
58
61
  );
59
62
  }
60
63
  export {
61
- D as BAD_HF,
62
- A as GOOD_HF,
63
- P as HealthFactor,
64
+ _ as BAD_HF,
65
+ O as GOOD_HF,
66
+ S as HealthFactor,
64
67
  w as getHFZones
65
68
  };
@@ -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
+ * Marks the figure as projected rather than promised, with a leading `≈` in
18
+ * the factor's own colour. Only the projected side is marked: on a
19
+ * `from → to` row the "from" is where the account stands now, which is
20
+ * 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. */
@@ -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. */
@@ -23,6 +23,15 @@ export interface HealthFactorProps extends React.HTMLAttributes<HTMLSpanElement>
23
23
  * @default "color"
24
24
  */
25
25
  zoneType?: "color" | "bars" | "dot";
26
+ /**
27
+ * Marks the figure as projected rather than measured, with a leading `≈`.
28
+ *
29
+ * Drawn here, inside the zone-colored span, because the symbol belongs to the
30
+ * number: a caller placing it beside this component leaves it uncolored while
31
+ * the value it qualifies is red. Suppressed on a zero debt, where there is no
32
+ * factor to approximate — only "N/A".
33
+ */
34
+ approximate?: boolean;
26
35
  }
27
36
  /**
28
37
  * HealthFactor — primitive under {@link HealthFactorBlock} (zones / bars / dot).
@@ -41,4 +50,4 @@ export interface HealthFactorProps extends React.HTMLAttributes<HTMLSpanElement>
41
50
  * <HealthFactor value={15000} debt={0n} /> // "N/A"
42
51
  * ```
43
52
  */
44
- export declare function HealthFactor({ value, debt, decimals, zone, zoneType, className, ...props }: HealthFactorProps): React.JSX.Element;
53
+ export declare function HealthFactor({ value, debt, decimals, zone, zoneType, approximate, className, ...props }: HealthFactorProps): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "4.0.0-next.46",
3
+ "version": "4.0.0-next.48",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",