@gearbox-protocol/ui-kit 4.0.0-next.15 → 4.0.0-next.17

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 (51) hide show
  1. package/dist/cjs/components/base/index.cjs +1 -1
  2. package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
  3. package/dist/cjs/components/base/position-assets/constants.cjs +1 -0
  4. package/dist/cjs/components/base/position-assets/index.cjs +1 -0
  5. package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -0
  6. package/dist/cjs/components/base/stat-badge/constants.cjs +1 -1
  7. package/dist/cjs/components/base/stat-badge/stat-badge.cjs +1 -1
  8. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  9. package/dist/cjs/components/base/tabber/tabber.cjs +1 -1
  10. package/dist/cjs/components/base/values/scalars.cjs +1 -1
  11. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  12. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  13. package/dist/cjs/components/index.cjs +1 -1
  14. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  15. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
  16. package/dist/cjs/index.cjs +1 -1
  17. package/dist/cjs/locale/en.json.cjs +1 -1
  18. package/dist/cjs/utils/index.cjs +1 -1
  19. package/dist/cjs/utils/strategy-apy.cjs +1 -0
  20. package/dist/esm/components/base/index.js +112 -108
  21. package/dist/esm/components/base/info-list/info-list.js +7 -6
  22. package/dist/esm/components/base/position-assets/constants.js +8 -0
  23. package/dist/esm/components/base/position-assets/index.js +6 -0
  24. package/dist/esm/components/base/position-assets/position-assets.js +73 -0
  25. package/dist/esm/components/base/stat-badge/constants.js +1 -0
  26. package/dist/esm/components/base/stat-badge/stat-badge.js +87 -52
  27. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +130 -110
  28. package/dist/esm/components/base/tabber/tabber.js +67 -64
  29. package/dist/esm/components/base/values/scalars.js +52 -33
  30. package/dist/esm/components/checkbox/checkbox-labeled.js +1 -1
  31. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +1 -1
  32. package/dist/esm/components/index.js +662 -658
  33. package/dist/esm/components/with-copy/with-copy.js +1 -1
  34. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +20 -19
  35. package/dist/esm/index.js +858 -850
  36. package/dist/esm/locale/en.json.js +2 -1
  37. package/dist/esm/utils/index.js +64 -60
  38. package/dist/esm/utils/strategy-apy.js +41 -0
  39. package/dist/types/components/base/index.d.ts +1 -0
  40. package/dist/types/components/base/position-assets/constants.d.ts +5 -0
  41. package/dist/types/components/base/position-assets/index.d.ts +2 -0
  42. package/dist/types/components/base/position-assets/position-assets.d.ts +49 -0
  43. package/dist/types/components/base/stat-badge/constants.d.ts +1 -0
  44. package/dist/types/components/base/stat-badge/stat-badge.d.ts +11 -1
  45. package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +12 -0
  46. package/dist/types/components/base/tabber/tabber.d.ts +2 -2
  47. package/dist/types/components/base/values/scalars.d.ts +4 -0
  48. package/dist/types/locale/en.json.d.ts +2 -1
  49. package/dist/types/utils/index.d.ts +1 -0
  50. package/dist/types/utils/strategy-apy.d.ts +37 -0
  51. package/package.json +1 -1
@@ -1,63 +1,82 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { CompoundAPY as s } from "../../compound-apy/compound-apy.js";
1
+ import { jsx as r, jsxs as s } from "react/jsx-runtime";
2
+ import { formatUnits as m } from "viem";
3
+ import { CompoundAPY as p } from "../../compound-apy/compound-apy.js";
4
+ import { SimpleTooltip as u } from "../../tooltip/simple-tooltip.js";
5
+ import "../../tooltip/tooltip.js";
3
6
  import "react";
4
7
  import "@gearbox-protocol/sdk";
5
8
  import { cn as a } from "../../../utils/cn.js";
6
9
  import "sonner";
7
- import { formatLeverage as c } from "../../../utils/format-leverage.js";
8
- import { formatPercentAmount as m, formatMoney as l } from "../../../utils/format-money.js";
10
+ import { formatAssetAmount as c } from "../../../utils/format-asset-amount.js";
11
+ import { formatLeverage as d } from "../../../utils/format-leverage.js";
12
+ import { formatPercentAmount as f, formatMoney as h } from "../../../utils/format-money.js";
9
13
  import "@gearbox-protocol/sdk/common-utils";
10
14
  import "luxon";
11
15
  import "../../../utils/z-index.js";
12
- import { ValueTest as r } from "./constants.js";
13
- const d = "—";
14
- function i() {
15
- return /* @__PURE__ */ e("span", { "data-testid": r.placeholder, children: d });
16
+ import { ValueTest as e } from "./constants.js";
17
+ const v = "—";
18
+ function n() {
19
+ return /* @__PURE__ */ r("span", { "data-testid": e.placeholder, children: v });
16
20
  }
17
- function o(t) {
18
- return `${m(t / 100, 2)}%`;
21
+ function l(t) {
22
+ return `${f(t / 100, 2)}%`;
19
23
  }
20
- function P({ data: t }) {
21
- return t === void 0 ? /* @__PURE__ */ e(i, {}) : typeof t == "number" ? /* @__PURE__ */ e("span", { "data-testid": r.apy, children: o(t) }) : /* @__PURE__ */ e("span", { "data-testid": r.apy, children: /* @__PURE__ */ e(s, { apy: t }) });
24
+ function E({ data: t }) {
25
+ return t === void 0 ? /* @__PURE__ */ r(n, {}) : typeof t == "number" ? /* @__PURE__ */ r("span", { "data-testid": e.apy, children: l(t) }) : /* @__PURE__ */ r("span", { "data-testid": e.apy, children: /* @__PURE__ */ r(p, { apy: t }) });
22
26
  }
23
- function $({
27
+ function H({
24
28
  data: t
25
29
  }) {
26
- return t == null ? /* @__PURE__ */ e(i, {}) : /* @__PURE__ */ e("span", { "data-testid": r.usd, children: l(t) });
30
+ return t == null ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.usd, children: h(t) });
27
31
  }
28
- function z({
32
+ function N({
29
33
  data: t
30
34
  }) {
31
- return t === void 0 ? /* @__PURE__ */ e(i, {}) : /* @__PURE__ */ e("span", { "data-testid": r.leverage, children: `${c(t)}x` });
35
+ return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.leverage, children: `${d(t)}x` });
32
36
  }
33
37
  function w({
34
38
  data: t
35
39
  }) {
36
- return t === void 0 ? /* @__PURE__ */ e(i, {}) : /* @__PURE__ */ e("span", { "data-testid": r.utilization, children: o(t) });
40
+ return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.utilization, children: l(t) });
37
41
  }
38
- function B({
42
+ function D({
39
43
  data: t
40
44
  }) {
41
45
  if (t === void 0)
42
- return /* @__PURE__ */ e(i, {});
43
- const n = t < 1e4 ? "text-destructive" : t < 11e3 ? "text-warning" : "text-success";
44
- return /* @__PURE__ */ e("span", { "data-testid": r.healthFactor, className: a(n), children: (t / 1e4).toFixed(2) });
46
+ return /* @__PURE__ */ r(n, {});
47
+ const i = t < 1e4 ? "text-destructive" : t < 11e3 ? "text-warning" : "text-success";
48
+ return /* @__PURE__ */ r("span", { "data-testid": e.healthFactor, className: a(i), children: (t / 1e4).toFixed(2) });
45
49
  }
46
- function C({
50
+ function M({
47
51
  data: t,
48
- token: n
52
+ token: i
49
53
  }) {
50
- if (t === void 0 || n === void 0)
51
- return /* @__PURE__ */ e(i, {});
52
- const u = Number(t) / 10 ** n.decimals;
53
- return /* @__PURE__ */ e("span", { "data-testid": r.tokenBigint, children: `${u.toLocaleString(void 0, { maximumFractionDigits: 6 })} ${n.symbol}` });
54
+ if (t === void 0 || i === void 0)
55
+ return /* @__PURE__ */ r(n, {});
56
+ const o = m(t, i.decimals);
57
+ return (
58
+ // `title` also keeps the amount where a hover tooltip cannot reach:
59
+ // keyboard, touch, and the browser's own find
60
+ /* @__PURE__ */ s("span", { "data-testid": e.tokenBigint, title: `${o} ${i.symbol}`, children: [
61
+ /* @__PURE__ */ r(
62
+ u,
63
+ {
64
+ placement: "top",
65
+ className: "break-all",
66
+ title: /* @__PURE__ */ r("span", { children: c(t, i.decimals) }),
67
+ children: /* @__PURE__ */ r("span", { children: o })
68
+ }
69
+ ),
70
+ ` ${i.symbol}`
71
+ ] })
72
+ );
54
73
  }
55
74
  export {
56
- P as ApyValue,
57
- B as HealthFactorValue,
58
- z as LeverageValue,
59
- C as TokenBigint,
60
- $ as UsdValue,
75
+ E as ApyValue,
76
+ D as HealthFactorValue,
77
+ N as LeverageValue,
78
+ M as TokenBigint,
79
+ H as UsdValue,
61
80
  w as UtilizationValue,
62
- o as bps
81
+ l as bps
63
82
  };
@@ -37,6 +37,7 @@ import "../simple-accordion/simple-accordion.js";
37
37
  import "../tip-card/tip-card.js";
38
38
  import "../typography/typography.js";
39
39
  import "../points-icon/points-icon.js";
40
+ import "viem";
40
41
  import "../vertical-indicator/vertical-indicator.js";
41
42
  import "../base/page-title/page-title.js";
42
43
  import "../detailed-page-title/detailed-page-title-copy-button.js";
@@ -72,7 +73,6 @@ import "../dialog/dialog-header.js";
72
73
  import "../dialog/dialog-title.js";
73
74
  import "../dialog/dialog-modal-container.js";
74
75
  import "../dialog/dialog-overlay.js";
75
- import "viem";
76
76
  import "../input/input.js";
77
77
  import { Label as k } from "../label/label.js";
78
78
  import "../simple-dropdown/simple-dropdown.js";
@@ -37,6 +37,7 @@ import "../../simple-accordion/simple-accordion.js";
37
37
  import "../../tip-card/tip-card.js";
38
38
  import "../../typography/typography.js";
39
39
  import "../../points-icon/points-icon.js";
40
+ import "viem";
40
41
  import "../../vertical-indicator/vertical-indicator.js";
41
42
  import "../../base/page-title/page-title.js";
42
43
  import "../../detailed-page-title/detailed-page-title-copy-button.js";
@@ -73,7 +74,6 @@ import "../../dialog/dialog-header.js";
73
74
  import "../../dialog/dialog-title.js";
74
75
  import "../../dialog/dialog-modal-container.js";
75
76
  import "../../dialog/dialog-overlay.js";
76
- import "viem";
77
77
  import "../../input/input.js";
78
78
  import "../../label/label.js";
79
79
  import "../../simple-dropdown/simple-dropdown.js";