@gearbox-protocol/ui-kit 4.0.0-next.14 → 4.0.0-next.16

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 (64) hide show
  1. package/dist/cjs/components/base/stat-badge/constants.cjs +1 -1
  2. package/dist/cjs/components/base/stat-badge/stat-badge.cjs +1 -1
  3. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  4. package/dist/cjs/components/base/tabber/tabber.cjs +1 -1
  5. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  6. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  7. package/dist/cjs/components/index.cjs +1 -1
  8. package/dist/cjs/components/sdk-status-pill/constants.cjs +1 -0
  9. package/dist/cjs/components/sdk-status-pill/index.cjs +1 -0
  10. package/dist/cjs/components/sdk-status-pill/sdk-status-pill.cjs +1 -0
  11. package/dist/cjs/components/sdk-status-pill/sdk-status.cjs +1 -0
  12. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  13. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
  14. package/dist/cjs/index.cjs +1 -1
  15. package/dist/cjs/locale/en.json.cjs +1 -1
  16. package/dist/cjs/utils/index.cjs +1 -1
  17. package/dist/cjs/utils/strategy-apy.cjs +1 -0
  18. package/dist/esm/components/base/stat-badge/constants.js +1 -0
  19. package/dist/esm/components/base/stat-badge/stat-badge.js +87 -52
  20. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +130 -110
  21. package/dist/esm/components/base/tabber/tabber.js +67 -64
  22. package/dist/esm/components/checkbox/checkbox-labeled.js +1 -1
  23. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +1 -1
  24. package/dist/esm/components/index.js +234 -235
  25. package/dist/esm/components/sdk-status-pill/constants.js +8 -0
  26. package/dist/esm/components/sdk-status-pill/index.js +8 -0
  27. package/dist/esm/components/sdk-status-pill/sdk-status-pill.js +59 -0
  28. package/dist/esm/components/sdk-status-pill/sdk-status.js +6 -0
  29. package/dist/esm/components/with-copy/with-copy.js +1 -1
  30. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +20 -19
  31. package/dist/esm/index.js +567 -564
  32. package/dist/esm/locale/en.json.js +5 -9
  33. package/dist/esm/utils/index.js +64 -60
  34. package/dist/esm/utils/strategy-apy.js +41 -0
  35. package/dist/types/components/base/stat-badge/constants.d.ts +1 -0
  36. package/dist/types/components/base/stat-badge/stat-badge.d.ts +11 -1
  37. package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +12 -0
  38. package/dist/types/components/base/tabber/tabber.d.ts +2 -2
  39. package/dist/types/components/index.d.ts +1 -1
  40. package/dist/types/components/sdk-status-pill/constants.d.ts +5 -0
  41. package/dist/types/components/sdk-status-pill/index.d.ts +3 -0
  42. package/dist/types/components/sdk-status-pill/sdk-status-pill.d.ts +27 -0
  43. package/dist/types/components/sdk-status-pill/sdk-status.d.ts +11 -0
  44. package/dist/types/index.d.ts +1 -2
  45. package/dist/types/locale/en.json.d.ts +5 -9
  46. package/dist/types/types/index.d.ts +0 -1
  47. package/dist/types/utils/index.d.ts +1 -0
  48. package/dist/types/utils/strategy-apy.d.ts +37 -0
  49. package/package.json +1 -1
  50. package/dist/cjs/components/sync-status-pill/constants.cjs +0 -1
  51. package/dist/cjs/components/sync-status-pill/get-sync-status.cjs +0 -1
  52. package/dist/cjs/components/sync-status-pill/index.cjs +0 -1
  53. package/dist/cjs/components/sync-status-pill/sync-status-pill.cjs +0 -1
  54. package/dist/cjs/types/footer.cjs +0 -1
  55. package/dist/esm/components/sync-status-pill/constants.js +0 -10
  56. package/dist/esm/components/sync-status-pill/get-sync-status.js +0 -78
  57. package/dist/esm/components/sync-status-pill/index.js +0 -9
  58. package/dist/esm/components/sync-status-pill/sync-status-pill.js +0 -137
  59. package/dist/esm/types/footer.js +0 -1
  60. package/dist/types/components/sync-status-pill/constants.d.ts +0 -7
  61. package/dist/types/components/sync-status-pill/get-sync-status.d.ts +0 -100
  62. package/dist/types/components/sync-status-pill/index.d.ts +0 -3
  63. package/dist/types/components/sync-status-pill/sync-status-pill.d.ts +0 -42
  64. package/dist/types/types/footer.d.ts +0 -7
@@ -0,0 +1,8 @@
1
+ class s {
2
+ static root = "sdk-status-pill-root";
3
+ static dot = "sdk-status-pill-dot";
4
+ static tooltip = "sdk-status-pill-tooltip";
5
+ }
6
+ export {
7
+ s as SdkStatusPillTest
8
+ };
@@ -0,0 +1,8 @@
1
+ import { SdkStatusPillTest as r } from "./constants.js";
2
+ import { sdkStatusDotVariant as s } from "./sdk-status.js";
3
+ import { SdkStatusPill as e } from "./sdk-status-pill.js";
4
+ export {
5
+ e as SdkStatusPill,
6
+ r as SdkStatusPillTest,
7
+ s as sdkStatusDotVariant
8
+ };
@@ -0,0 +1,59 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { StatusDot as a } from "../status-dot/status-dot.js";
3
+ import { SimpleTooltip as c } from "../tooltip/simple-tooltip.js";
4
+ import "../tooltip/tooltip.js";
5
+ import { useIntlTyped as m } from "../typed-intl/index.js";
6
+ import "react";
7
+ import "@gearbox-protocol/sdk/common-utils";
8
+ import { useMediaQuery as d } from "../../hooks/use-media-query.js";
9
+ import { SdkStatusPillTest as e } from "./constants.js";
10
+ import { sdkStatusDotVariant as l } from "./sdk-status.js";
11
+ const p = "(hover: none)", u = {
12
+ loading: "components.sdkStatus.connecting",
13
+ ready: "components.sdkStatus.connected",
14
+ error: "components.sdkStatus.disconnected"
15
+ };
16
+ function M({
17
+ status: o
18
+ }) {
19
+ const { formatMessage: s } = m(), i = !d(p), r = s({ messageId: u[o] }), n = (
20
+ // `<output>` rather than a span with role="status": same implicit live
21
+ // region, and the status is announced without the dot being focusable.
22
+ //
23
+ // The box is `size-6`, not the dot's 6px: a 6px hover/tap target is far
24
+ // under the 24px WCAG 2.5.8 minimum and genuinely hard to hit, while the
25
+ // dot itself has to stay small to keep the footer quiet.
26
+ //
27
+ // `-m-1.5` keeps that out of the layout in both axes, so the footer row
28
+ // keeps its height and the links do not shift.
29
+ /* @__PURE__ */ t(
30
+ "output",
31
+ {
32
+ className: "-m-1.5 flex size-6 cursor-pointer items-center justify-center",
33
+ "data-testid": e.root,
34
+ "aria-label": r,
35
+ children: /* @__PURE__ */ t(
36
+ a,
37
+ {
38
+ variant: l(o),
39
+ size: "xs",
40
+ pulse: o === "loading",
41
+ "data-testid": e.dot
42
+ }
43
+ )
44
+ }
45
+ )
46
+ );
47
+ return /* @__PURE__ */ t(
48
+ c,
49
+ {
50
+ title: n,
51
+ trigger: i ? "hover" : "click",
52
+ placement: "top",
53
+ children: /* @__PURE__ */ t("span", { className: "text-xs", "data-testid": e.tooltip, children: r })
54
+ }
55
+ );
56
+ }
57
+ export {
58
+ M as SdkStatusPill
59
+ };
@@ -0,0 +1,6 @@
1
+ function a(t) {
2
+ return t === "ready" ? "success" : "default";
3
+ }
4
+ export {
5
+ a as sdkStatusDotVariant
6
+ };
@@ -128,10 +128,10 @@ import "../legal-agreement/legal-agreement-theme.js";
128
128
  import "../loader/loader.js";
129
129
  import "../loading/loading.js";
130
130
  import "../loading-bar/loading-bar.js";
131
+ import "../status-dot/status-dot.js";
131
132
  import "../segmented-control/segmented-control.js";
132
133
  import "../separate-line/separate-line.js";
133
134
  import "../split-list/split-list.js";
134
- import "../status-dot/status-dot.js";
135
135
  import "../textarea/textarea.js";
136
136
  import "../theme-provider.js";
137
137
  function or({
@@ -1,25 +1,26 @@
1
- import { jsxs as a, jsx as e, Fragment as k } from "react/jsx-runtime";
2
- import { PointsIcon as N } from "../points-icon/points-icon.js";
3
- import { TokenIcon as P } from "../token-icon/token-icon.js";
4
- import { SimpleTooltip as A } from "../tooltip/simple-tooltip.js";
1
+ import { jsxs as a, jsx as e, Fragment as P } from "react/jsx-runtime";
2
+ import { PointsIcon as A } from "../points-icon/points-icon.js";
3
+ import { TokenIcon as I } from "../token-icon/token-icon.js";
4
+ import { SimpleTooltip as T } from "../tooltip/simple-tooltip.js";
5
5
  import "../tooltip/tooltip.js";
6
6
  import { FormattedMessageTyped as s } from "../typed-intl/index.js";
7
7
  import "react";
8
- import { tokenRewardsOf as I, pointProgramsOf as B, totalApyOf as T } from "../../utils/apy-breakdown.js";
8
+ import { tokenRewardsOf as B, pointProgramsOf as R, totalApyOf as $ } from "../../utils/apy-breakdown.js";
9
9
  import "@gearbox-protocol/sdk";
10
- import { bpsToPercent as $ } from "../../utils/bps.js";
10
+ import { bpsToPercent as j } from "../../utils/bps.js";
11
11
  import { cn as p } from "../../utils/cn.js";
12
12
  import "sonner";
13
- import { formatLeverage as j } from "../../utils/format-leverage.js";
14
- import { formatCompactPercent as R } from "../../utils/format-money.js";
13
+ import { formatLeverage as S } from "../../utils/format-leverage.js";
14
+ import { formatCompactPercent as C } from "../../utils/format-money.js";
15
+ import { strategyQuotaRate as O } from "../../utils/strategy-apy.js";
15
16
  import "@gearbox-protocol/sdk/common-utils";
16
17
  import "luxon";
17
18
  import "../../utils/z-index.js";
18
19
  function i(n) {
19
- const o = $(n), r = R(Math.abs(o));
20
+ const o = j(n), r = C(Math.abs(o));
20
21
  return o < 0 ? `-${r}` : r;
21
22
  }
22
- function U({
23
+ function L({
23
24
  supplyApy: n,
24
25
  maxLeverage: o,
25
26
  collateralApy: r,
@@ -28,7 +29,7 @@ function U({
28
29
  children: h,
29
30
  className: f
30
31
  }) {
31
- const g = o !== void 0 && o > 0, l = r ?? n, w = I(l), y = B(n), b = T(n), d = c != null || u != null ? -((c ?? 0) + (u ?? 0)) : void 0, x = y.filter((t) => t.multiplier != null), v = /* @__PURE__ */ a(
32
+ const g = o !== void 0 && o > 0, l = r ?? n, y = B(l), w = R(n), b = $(n), v = c != null || u != null, k = O({ additionalBorrowApy: u, maxLeverage: o }), d = v ? -((c ?? 0) + k) : void 0, x = w.filter((t) => t.multiplier != null), N = /* @__PURE__ */ a(
32
33
  "div",
33
34
  {
34
35
  className: p(
@@ -46,7 +47,7 @@ function U({
46
47
  {
47
48
  messageId: "components.yieldBreakdown.titleNetAtLeverage",
48
49
  values: {
49
- leverage: j(o)
50
+ leverage: S(o)
50
51
  }
51
52
  }
52
53
  ) : /* @__PURE__ */ e(s, { messageId: "components.apyParts.totalAPY" }) }),
@@ -69,7 +70,7 @@ function U({
69
70
  value: i(l.organicApy)
70
71
  }
71
72
  ),
72
- w.map((t) => t.supplyApr == null ? null : /* @__PURE__ */ e(
73
+ y.map((t) => t.supplyApr == null ? null : /* @__PURE__ */ e(
73
74
  m,
74
75
  {
75
76
  muted: t.supplyApr < 0,
@@ -81,7 +82,7 @@ function U({
81
82
  values: { symbol: t.token.symbol }
82
83
  }
83
84
  ) }),
84
- /* @__PURE__ */ e(P, { token: t.token, size: 20 })
85
+ /* @__PURE__ */ e(I, { token: t.token, size: 20 })
85
86
  ] }),
86
87
  value: i(t.supplyApr)
87
88
  },
@@ -95,7 +96,7 @@ function U({
95
96
  value: i(d)
96
97
  }
97
98
  ),
98
- x.length > 0 && /* @__PURE__ */ a(k, { children: [
99
+ x.length > 0 && /* @__PURE__ */ a(P, { children: [
99
100
  /* @__PURE__ */ e("div", { className: "h-px w-full bg-divider" }),
100
101
  x.map((t) => /* @__PURE__ */ e(
101
102
  m,
@@ -109,7 +110,7 @@ function U({
109
110
  }
110
111
  ) }),
111
112
  /* @__PURE__ */ e(
112
- N,
113
+ A,
113
114
  {
114
115
  reward: {
115
116
  name: t.name,
@@ -128,7 +129,7 @@ function U({
128
129
  }
129
130
  );
130
131
  return /* @__PURE__ */ e(
131
- A,
132
+ T,
132
133
  {
133
134
  placement: "bottom",
134
135
  triangle: !1,
@@ -137,7 +138,7 @@ function U({
137
138
  maxWidth: "100%",
138
139
  title: /* @__PURE__ */ e("span", { className: f, children: h }),
139
140
  triggerClassName: f,
140
- children: v
141
+ children: N
141
142
  }
142
143
  );
143
144
  }
@@ -161,5 +162,5 @@ function m({
161
162
  ] });
162
163
  }
163
164
  export {
164
- U as YieldBreakdownTooltip
165
+ L as YieldBreakdownTooltip
165
166
  };