@gearbox-protocol/ui-kit 4.0.0-next.35 → 4.0.0-next.36

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 s=require("react/jsx-runtime");require("react");require("@gearbox-protocol/sdk/onchain");const n=require("../../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../../utils/z-index.cjs");const r=require("./constants.cjs");function i({data:t}){if(t===void 0||t.total.valueUsd===null)return s.jsx("span",{"data-testid":r.ValueTest.placeholder,children:"—"});const e=t.total.valueUsd,u=e>0?"+":e<0?"−":"";return s.jsx("span",{"data-testid":r.ValueTest.pnl,className:n.cn(e>0&&"text-success",e<0&&"text-destructive"),children:`${u}$${Math.abs(e).toFixed(2)}`})}exports.PnlValue=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime");require("react");require("@gearbox-protocol/sdk/onchain");const u=require("../../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../../utils/z-index.cjs");const r=require("./constants.cjs");function i({data:t}){const e=typeof t=="number"?t:t?.total.valueUsd??null;if(e===null)return s.jsx("span",{"data-testid":r.ValueTest.placeholder,children:"—"});const n=e>0?"+":e<0?"−":"";return s.jsx("span",{"data-testid":r.ValueTest.pnl,className:u.cn(e>0&&"text-success",e<0&&"text-destructive"),children:`${n}$${Math.abs(e).toFixed(2)}`})}exports.PnlValue=i;
@@ -1,4 +1,4 @@
1
- import { jsx as o } from "react/jsx-runtime";
1
+ import { jsx as r } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import "@gearbox-protocol/sdk/onchain";
4
4
  import { cn as s } from "../../../utils/cn.js";
@@ -6,17 +6,18 @@ import "sonner";
6
6
  import "@gearbox-protocol/sdk/common-utils";
7
7
  import "luxon";
8
8
  import "../../../utils/z-index.js";
9
- import { ValueTest as r } from "./constants.js";
9
+ import { ValueTest as o } from "./constants.js";
10
10
  function x({
11
11
  data: e
12
12
  }) {
13
- if (e === void 0 || e.total.valueUsd === null)
14
- return /* @__PURE__ */ o("span", { "data-testid": r.placeholder, children: "—" });
15
- const t = e.total.valueUsd, i = t > 0 ? "+" : t < 0 ? "" : "";
16
- return /* @__PURE__ */ o(
13
+ const t = typeof e == "number" ? e : e?.total.valueUsd ?? null;
14
+ if (t === null)
15
+ return /* @__PURE__ */ r("span", { "data-testid": o.placeholder, children: "" });
16
+ const i = t > 0 ? "+" : t < 0 ? "−" : "";
17
+ return /* @__PURE__ */ r(
17
18
  "span",
18
19
  {
19
- "data-testid": r.pnl,
20
+ "data-testid": o.pnl,
20
21
  className: s(t > 0 && "text-success", t < 0 && "text-destructive"),
21
22
  children: `${i}$${Math.abs(t).toFixed(2)}`
22
23
  }
@@ -1,6 +1,12 @@
1
1
  import { PnlBreakdown } from '@gearbox-protocol/sdk/model';
2
2
  import { default as React } from 'react';
3
- /** Realised + unrealised PnL of a position, signed. */
3
+ /**
4
+ * Realised + unrealised PnL, signed.
5
+ *
6
+ * A breakdown (a position's own) or a bare USD figure (a wallet's total, which
7
+ * the model carries as a plain number) — the same pairing {@link ApyValue}
8
+ * makes between a breakdown and a bare rate.
9
+ */
4
10
  export declare function PnlValue({ data, }: {
5
- readonly data: PnlBreakdown | undefined;
11
+ readonly data: PnlBreakdown | number | null | undefined;
6
12
  }): 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.35",
3
+ "version": "4.0.0-next.36",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",