@gearbox-protocol/ui-kit 3.14.0-next.46 → 3.14.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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("@gearbox-protocol/sdk"),f=require("class-variance-authority");require("react");const H=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");const _=require("../status-elements/status-elements.cjs"),a=15e3,l=11e3,g=10500,d=e=>{if(e)return e>=a?"good":e>l?"medium":e>g?"bad":e>u.PERCENTAGE_FACTOR?"critical":"liquidation"},A=f.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 C({value:e,debt:o,decimals:m=3,zone:t,zoneType:i="color",className:q,...v}){const s=o!==void 0&&o===0n,r=!s&&i==="color"?t===void 0?d(e):t:void 0,c=r===void 0?void 0:r===null?"unset":r,x=()=>{if(s)return"N/A";const F=Number(e);return u.formatPercentage(F,m)};return n.jsxs("span",{className:H.cn(A(c!==void 0?{zone:c}:{}),q),...v,children:[t&&i==="bars"&&n.jsx("span",{className:"mr-6 shrink-0",children:n.jsx(_.StatusBars,{zone:t})}),x()]})}exports.BAD_HF=l;exports.GOOD_HF=a;exports.HealthFactor=C;exports.getHFZones=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("@gearbox-protocol/sdk"),h=require("class-variance-authority");require("react");const j=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");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=h.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:q=3,zone:e,zoneType:s="color",className:x,...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,_=()=>{if(n)return"N/A";const g=Number(t);return u.formatPercentage(g,q)};return r.jsxs("span",{className:j.cn(D(c!==void 0?{zone:c}:{}),x),...v,children:[f&&r.jsx("span",{className:"mr-6 shrink-0",children:r.jsx(a.StatusBars,{zone:e})}),_(),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,17 +1,17 @@
1
- import { jsxs as f, jsx as c } from "react/jsx-runtime";
2
- import { formatPercentage as p, PERCENTAGE_FACTOR as v } from "@gearbox-protocol/sdk";
3
- import { cva as x } from "class-variance-authority";
1
+ import { jsxs as x, jsx as i } from "react/jsx-runtime";
2
+ import { formatPercentage as h, PERCENTAGE_FACTOR as C } from "@gearbox-protocol/sdk";
3
+ import { cva as F } from "class-variance-authority";
4
4
  import "react";
5
- import { cn as C } from "../../utils/cn.js";
5
+ import { cn as H } from "../../utils/cn.js";
6
6
  import "sonner";
7
7
  import "@gearbox-protocol/sdk/common-utils";
8
8
  import "luxon";
9
9
  import "../../utils/z-index.js";
10
- import { StatusBars as F } from "../status-elements/status-elements.js";
11
- const g = 15e3, A = 11e3, H = 10500, N = (t) => {
10
+ import { StatusBars as N, HealthDot as g } from "../status-elements/status-elements.js";
11
+ const A = 15e3, D = 11e3, b = 10500, w = (t) => {
12
12
  if (t)
13
- return t >= g ? "good" : t > A ? "medium" : t > H ? "bad" : t > v ? "critical" : "liquidation";
14
- }, b = x(
13
+ return t >= A ? "good" : t > D ? "medium" : t > b ? "bad" : t > C ? "critical" : "liquidation";
14
+ }, V = F(
15
15
  "inline-flex items-center font-medium [text-decoration:inherit]",
16
16
  {
17
17
  variants: {
@@ -26,40 +26,41 @@ const g = 15e3, A = 11e3, H = 10500, N = (t) => {
26
26
  }
27
27
  }
28
28
  );
29
- function G({
29
+ function k({
30
30
  value: t,
31
- debt: e,
32
- decimals: a = 3,
31
+ debt: s,
32
+ decimals: c = 3,
33
33
  zone: o,
34
- zoneType: i = "color",
34
+ zoneType: n = "color",
35
35
  className: m,
36
36
  ...u
37
37
  }) {
38
- const n = e !== void 0 && e === 0n, r = !n && i === "color" ? o === void 0 ? N(t) : o : void 0, s = r === void 0 ? void 0 : r === null ? "unset" : r, d = () => {
39
- if (n) return "N/A";
40
- const l = Number(t);
41
- return p(l, a);
38
+ 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
+ if (r) return "N/A";
40
+ const v = Number(t);
41
+ return h(v, c);
42
42
  };
43
- return /* @__PURE__ */ f(
43
+ return /* @__PURE__ */ x(
44
44
  "span",
45
45
  {
46
- className: C(
47
- b(
48
- s !== void 0 ? { zone: s } : {}
46
+ className: H(
47
+ V(
48
+ a !== void 0 ? { zone: a } : {}
49
49
  ),
50
50
  m
51
51
  ),
52
52
  ...u,
53
53
  children: [
54
- o && i === "bars" && /* @__PURE__ */ c("span", { className: "mr-6 shrink-0", children: /* @__PURE__ */ c(F, { zone: o }) }),
55
- d()
54
+ f && /* @__PURE__ */ i("span", { className: "mr-6 shrink-0", children: /* @__PURE__ */ i(N, { zone: o }) }),
55
+ p(),
56
+ l && /* @__PURE__ */ i("span", { className: "ml-1.5", children: /* @__PURE__ */ i(g, { zone: o }) })
56
57
  ]
57
58
  }
58
59
  );
59
60
  }
60
61
  export {
61
- A as BAD_HF,
62
- g as GOOD_HF,
63
- G as HealthFactor,
64
- N as getHFZones
62
+ D as BAD_HF,
63
+ A as GOOD_HF,
64
+ k as HealthFactor,
65
+ w as getHFZones
65
66
  };
@@ -18,21 +18,24 @@ export interface HealthFactorProps extends React.HTMLAttributes<HTMLSpanElement>
18
18
  /** Pre-computed zone; if not set, derived from value. */
19
19
  zone?: HFZones | null;
20
20
  /**
21
- * How to indicate zone: "color" (text color only) or "bars" (StatusBars before value).
21
+ * How to indicate zone: "color" (text color only), "bars" (StatusBars before value),
22
+ * or "dot" (HealthDot after value, text stays default color).
22
23
  * @default "color"
23
24
  */
24
- zoneType?: "color" | "bars";
25
+ zoneType?: "color" | "bars" | "dot";
25
26
  }
26
27
  /**
27
28
  * HealthFactor — displays health factor value with optional zone color or StatusBars.
28
29
  *
29
30
  * @usage
30
31
  * Use for account/collateral health: value in basis points, zero debt shows "N/A".
31
- * zoneType "color" colors the text; zoneType "bars" shows StatusBars (and optional color).
32
+ * zoneType "color" colors the text; zoneType "bars" shows StatusBars;
33
+ * zoneType "dot" shows a HealthDot dot after the value while keeping text default color.
32
34
  *
33
35
  * @example
34
36
  * ```tsx
35
37
  * <HealthFactor value={15000} debt={1000000n} />
38
+ * <HealthFactor value={15000} debt={1000000n} zoneType="dot" zone="good" />
36
39
  * <HealthFactor value={12000} debt={1000000n} zoneType="bars" zone="medium" />
37
40
  * <HealthFactor value={15000} debt={0n} /> // "N/A"
38
41
  * ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "3.14.0-next.46",
3
+ "version": "3.14.0-next.47",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",