@gearbox-protocol/ui-kit 3.2.0-next.2 → 3.3.0

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 (41) hide show
  1. package/dist/cjs/components/assets-list-cell/assets-list-cell.cjs +1 -1
  2. package/dist/cjs/components/block-sync/block-sync.cjs +1 -1
  3. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  4. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  5. package/dist/cjs/components/complex-input/complex-input.cjs +1 -1
  6. package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
  7. package/dist/cjs/components/detailed-page-title/detailed-page-title.cjs +1 -1
  8. package/dist/cjs/components/index.cjs +1 -1
  9. package/dist/cjs/components/layout/index.cjs +1 -1
  10. package/dist/cjs/components/layout/main-aside-layout/index.cjs +1 -0
  11. package/dist/cjs/components/layout/main-aside-layout/main-aside-layout.cjs +1 -0
  12. package/dist/cjs/components/loader-guard/loader-guard.cjs +1 -1
  13. package/dist/cjs/components/markdown-viewer/markdown-viewer.cjs +1 -1
  14. package/dist/cjs/components/segmented-control/segmented-control.cjs +1 -1
  15. package/dist/cjs/components/time-to-liquidation/time-to-liquidation.cjs +1 -1
  16. package/dist/cjs/components/tokens-list-cell/tokens-list-cell.cjs +1 -1
  17. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  18. package/dist/cjs/index.cjs +1 -1
  19. package/dist/esm/components/assets-list-cell/assets-list-cell.js +3 -2
  20. package/dist/esm/components/block-sync/block-sync.js +3 -2
  21. package/dist/esm/components/checkbox/checkbox-labeled.js +1 -0
  22. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +1 -0
  23. package/dist/esm/components/complex-input/complex-input.js +3 -2
  24. package/dist/esm/components/compound-apy/compound-apy.js +3 -2
  25. package/dist/esm/components/detailed-page-title/detailed-page-title.js +1 -0
  26. package/dist/esm/components/index.js +361 -359
  27. package/dist/esm/components/layout/index.js +17 -15
  28. package/dist/esm/components/layout/main-aside-layout/index.js +4 -0
  29. package/dist/esm/components/layout/main-aside-layout/main-aside-layout.js +35 -0
  30. package/dist/esm/components/loader-guard/loader-guard.js +9 -8
  31. package/dist/esm/components/markdown-viewer/markdown-viewer.js +3 -2
  32. package/dist/esm/components/segmented-control/segmented-control.js +89 -54
  33. package/dist/esm/components/time-to-liquidation/time-to-liquidation.js +1 -0
  34. package/dist/esm/components/tokens-list-cell/tokens-list-cell.js +3 -2
  35. package/dist/esm/components/with-copy/with-copy.js +3 -2
  36. package/dist/esm/index.js +502 -500
  37. package/dist/globals.css +1 -1
  38. package/dist/types/components/layout/index.d.ts +1 -0
  39. package/dist/types/components/layout/main-aside-layout/index.d.ts +1 -0
  40. package/dist/types/components/layout/main-aside-layout/main-aside-layout.d.ts +17 -0
  41. package/package.json +3 -3
@@ -2,13 +2,14 @@ import { AppLogo as e, AppLogoLink as t } from "./app-logo/app-logo.js";
2
2
  import { Block as m } from "./block/block.js";
3
3
  import { Col as f } from "./col/col.js";
4
4
  import { Container as a } from "./container/container.js";
5
- import { Footer as L, FooterLink as l, FooterLinkSection as c, GearboxFooter as g } from "./footer/footer.js";
6
- import { Grid as u } from "./grid/grid.js";
7
- import { Header as s, useMobileMenu as b } from "./header/header.js";
8
- import { Layout as y } from "./layout/layout.js";
9
- import { LegalDisclaimer as C } from "./legal-disclaimer/legal-disclaimer.js";
10
- import { PageLayout as M } from "./page-layout/page-layout.js";
11
- import { SocialIcons as B } from "./social-icons/social-icons.js";
5
+ import { Footer as L, FooterLink as l, FooterLinkSection as c, GearboxFooter as u } from "./footer/footer.js";
6
+ import { Grid as k } from "./grid/grid.js";
7
+ import { Header as F, useMobileMenu as d } from "./header/header.js";
8
+ import { Layout as A } from "./layout/layout.js";
9
+ import { LegalDisclaimer as b } from "./legal-disclaimer/legal-disclaimer.js";
10
+ import { MainAsideLayout as G } from "./main-aside-layout/main-aside-layout.js";
11
+ import { PageLayout as B } from "./page-layout/page-layout.js";
12
+ import { SocialIcons as H } from "./social-icons/social-icons.js";
12
13
  export {
13
14
  e as AppLogo,
14
15
  t as AppLogoLink,
@@ -18,12 +19,13 @@ export {
18
19
  L as Footer,
19
20
  l as FooterLink,
20
21
  c as FooterLinkSection,
21
- g as GearboxFooter,
22
- u as Grid,
23
- s as Header,
24
- y as Layout,
25
- C as LegalDisclaimer,
26
- M as PageLayout,
27
- B as SocialIcons,
28
- b as useMobileMenu
22
+ u as GearboxFooter,
23
+ k as Grid,
24
+ F as Header,
25
+ A as Layout,
26
+ b as LegalDisclaimer,
27
+ G as MainAsideLayout,
28
+ B as PageLayout,
29
+ H as SocialIcons,
30
+ d as useMobileMenu
29
31
  };
@@ -0,0 +1,4 @@
1
+ import { MainAsideLayout as e } from "./main-aside-layout.js";
2
+ export {
3
+ e as MainAsideLayout
4
+ };
@@ -0,0 +1,35 @@
1
+ import { jsx as s, jsxs as f } from "react/jsx-runtime";
2
+ import * as c from "react";
3
+ import { cn as a } from "../../../utils/cn.js";
4
+ const d = c.forwardRef(
5
+ ({
6
+ children: i,
7
+ aside: e,
8
+ asidePosition: l = "right",
9
+ asideClassName: t,
10
+ className: m,
11
+ ...o
12
+ }, n) => {
13
+ const r = e == null ? null : /* @__PURE__ */ s("aside", { className: a("min-w-0 shrink-0", t), children: e });
14
+ return /* @__PURE__ */ f(
15
+ "div",
16
+ {
17
+ ref: n,
18
+ className: a(
19
+ "flex w-full flex-col-reverse gap-6 lg:flex-row lg:items-start",
20
+ m
21
+ ),
22
+ ...o,
23
+ children: [
24
+ l === "left" && r,
25
+ /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: i }),
26
+ l === "right" && r
27
+ ]
28
+ }
29
+ );
30
+ }
31
+ );
32
+ d.displayName = "MainAsideLayout";
33
+ export {
34
+ d as MainAsideLayout
35
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsx as m, jsxs as o } from "react/jsx-runtime";
2
- import { Guard as e } from "../guard/guard.js";
2
+ import { Guard as p } from "../guard/guard.js";
3
3
  import "../base-link/base-link.js";
4
4
  import "react";
5
5
  import "@gearbox-protocol/sdk";
@@ -10,21 +10,22 @@ import "@gearbox-protocol/sdk/common-utils";
10
10
  import "luxon";
11
11
  import "../../utils/z-index.js";
12
12
  import "../layout/col/col.js";
13
- import { Container as p } from "../layout/container/container.js";
13
+ import { Container as e } from "../layout/container/container.js";
14
14
  import "../layout/footer/footer.js";
15
15
  import "../layout/grid/grid.js";
16
16
  import "../layout/header/header.js";
17
17
  import "../layout/layout/layout.js";
18
+ import "../layout/main-aside-layout/main-aside-layout.js";
18
19
  import "../buttons/back-button/back-button.js";
19
20
  import "../page-title/page-title.js";
20
21
  import "../layout/social-icons/social-icons.js";
21
22
  import { Skeleton as r } from "../skeleton/skeleton.js";
22
- function A({
23
+ function B({
23
24
  showGuard: s,
24
- children: a,
25
- loader: i
25
+ children: i,
26
+ loader: a
26
27
  }) {
27
- const t = /* @__PURE__ */ m(p, { children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-4 p-4 sm:p-6 w-full", children: [
28
+ const t = /* @__PURE__ */ m(e, { children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-4 p-4 sm:p-6 w-full", children: [
28
29
  /* @__PURE__ */ m(r, { className: "h-6 sm:h-8 w-48 sm:w-64" }),
29
30
  /* @__PURE__ */ o("div", { className: "space-y-2 mb-4", children: [
30
31
  /* @__PURE__ */ m(r, { className: "h-3 sm:h-4 w-full" }),
@@ -36,8 +37,8 @@ function A({
36
37
  /* @__PURE__ */ m(r, { className: "h-48 sm:h-64 md:h-72 md:w-1/3 w-full" })
37
38
  ] })
38
39
  ] }) }), l = s;
39
- return /* @__PURE__ */ m(e, { showGuard: l, guard: l && (i || t), children: a });
40
+ return /* @__PURE__ */ m(p, { showGuard: l, guard: l && (a || t), children: i });
40
41
  }
41
42
  export {
42
- A as LoaderGuard
43
+ B as LoaderGuard
43
44
  };
@@ -15,6 +15,7 @@ import "../layout/footer/footer.js";
15
15
  import "../layout/grid/grid.js";
16
16
  import "../layout/header/header.js";
17
17
  import "../layout/layout/layout.js";
18
+ import "../layout/main-aside-layout/main-aside-layout.js";
18
19
  import { PageLayout as w } from "../layout/page-layout/page-layout.js";
19
20
  import "../layout/social-icons/social-icons.js";
20
21
  import "../accordion/accordion.js";
@@ -178,7 +179,7 @@ function a(o) {
178
179
  }
179
180
  return { id: T(l), displayText: o };
180
181
  }
181
- function Tr({
182
+ function vr({
182
183
  content: o,
183
184
  title: l,
184
185
  backButton: s,
@@ -390,5 +391,5 @@ function Tr({
390
391
  return c ? d : /* @__PURE__ */ r(w, { title: l || "", backButton: s, children: d });
391
392
  }
392
393
  export {
393
- Tr as MarkdownViewer
394
+ vr as MarkdownViewer
394
395
  };
@@ -1,13 +1,14 @@
1
- import { jsxs as p, jsx as s } from "react/jsx-runtime";
2
- import { cva as u } from "class-variance-authority";
3
- import * as g from "react";
1
+ import { jsxs as C, jsx as f } from "react/jsx-runtime";
2
+ import { cva as k } from "class-variance-authority";
3
+ import * as R from "react";
4
+ import { useRef as w, useState as I, useCallback as v, useLayoutEffect as y } from "react";
4
5
  import "@gearbox-protocol/sdk";
5
- import { cn as m } from "../../utils/cn.js";
6
+ import { cn as g } from "../../utils/cn.js";
6
7
  import "sonner";
7
8
  import "@gearbox-protocol/sdk/common-utils";
8
9
  import "luxon";
9
10
  import "../../utils/z-index.js";
10
- const h = u(
11
+ const S = k(
11
12
  "relative z-0 flex w-full flex-row flex-nowrap items-center bg-gray-30",
12
13
  {
13
14
  variants: {
@@ -18,7 +19,7 @@ const h = u(
18
19
  },
19
20
  defaultVariants: { size: "md" }
20
21
  }
21
- ), x = u("", {
22
+ ), V = k("", {
22
23
  variants: {
23
24
  size: {
24
25
  sm: "rounded-sm",
@@ -26,70 +27,104 @@ const h = u(
26
27
  }
27
28
  },
28
29
  defaultVariants: { size: "md" }
29
- }), b = g.forwardRef(({ className: l, name: d, items: t, size: r = "md", ...n }, e) => {
30
- const o = t.findIndex((a) => a.checked), i = o < 0 ? 0 : o, c = t.length;
31
- return /* @__PURE__ */ p("div", { ref: e, className: m(h({ size: r }), l), ...n, children: [
32
- t.map((a, f) => /* @__PURE__ */ s(
33
- v,
34
- {
35
- ...a,
36
- name: d
37
- },
38
- typeof a.value == "string" ? a.value : f
39
- )),
40
- /* @__PURE__ */ s(
41
- "div",
42
- {
43
- className: m(
44
- "absolute top-0 left-0 z-[-1] h-full bg-gray-60 shadow-[0_2px_2px_rgba(0,0,0,0.25)] transition-transform duration-200 ease-in-out",
45
- x({ size: r })
46
- ),
47
- style: {
48
- width: c > 0 ? `${100 / c}%` : "0%",
49
- transform: `translateX(${c > 0 ? 100 * i : 0}%)`
50
- }
51
- }
52
- )
53
- ] });
30
+ }), $ = R.forwardRef(({ className: b, name: m, items: n, size: l = "md", ...u }, t) => {
31
+ const r = n.findIndex((e) => e.checked), s = r < 0 ? 0 : r, o = n.length, i = w(null), p = w([]), [h, x] = I({ left: 0, width: 0 }), d = v(() => {
32
+ const e = p.current[s];
33
+ if (!e || o === 0) {
34
+ x({ left: 0, width: 0 });
35
+ return;
36
+ }
37
+ x({
38
+ left: e.offsetLeft,
39
+ width: e.offsetWidth
40
+ });
41
+ }, [o, s]);
42
+ y(() => {
43
+ d();
44
+ }, [d]), y(() => {
45
+ const e = new ResizeObserver(() => d()), a = i.current;
46
+ a && e.observe(a);
47
+ for (const c of p.current)
48
+ c && e.observe(c);
49
+ return () => e.disconnect();
50
+ }, [d]);
51
+ const z = v(
52
+ (e) => {
53
+ i.current = e, typeof t == "function" ? t(e) : t && (t.current = e);
54
+ },
55
+ [t]
56
+ );
57
+ return /* @__PURE__ */ C(
58
+ "div",
59
+ {
60
+ ref: z,
61
+ className: g(S({ size: l }), b),
62
+ ...u,
63
+ children: [
64
+ n.map((e, a) => /* @__PURE__ */ f(
65
+ N,
66
+ {
67
+ ...e,
68
+ name: m,
69
+ ref: (c) => {
70
+ p.current[a] = c;
71
+ }
72
+ },
73
+ typeof e.value == "string" ? e.value : a
74
+ )),
75
+ /* @__PURE__ */ f(
76
+ "div",
77
+ {
78
+ className: g(
79
+ "pointer-events-none absolute top-0 left-0 z-[-1] h-full bg-gray-60 shadow-[0_2px_2px_rgba(0,0,0,0.25)] transition-[transform,width] duration-200 ease-in-out",
80
+ V({ size: l })
81
+ ),
82
+ style: h.width > 0 ? {
83
+ width: `${h.width}px`,
84
+ transform: `translateX(${h.left}px)`
85
+ } : {
86
+ width: o > 0 ? `${100 / o}%` : "0%",
87
+ transform: o > 0 ? `translateX(${100 * s}%)` : "translateX(0)"
88
+ }
89
+ }
90
+ )
91
+ ]
92
+ }
93
+ );
54
94
  });
55
- b.displayName = "SegmentedControl";
56
- function v({
57
- name: l,
58
- switchLabel: d,
59
- label: t,
60
- onChange: r,
61
- onSelect: n,
62
- ...e
63
- }) {
64
- const o = r ?? (n ? (i) => {
65
- i.preventDefault(), n();
95
+ $.displayName = "SegmentedControl";
96
+ const N = R.forwardRef(function({ name: m, switchLabel: n, label: l, onChange: u, onSelect: t, ...r }, s) {
97
+ const o = u ?? (t ? (i) => {
98
+ i.preventDefault(), t();
66
99
  } : void 0);
67
- return /* @__PURE__ */ p(
100
+ return /* @__PURE__ */ C(
68
101
  "label",
69
102
  {
70
- className: m(
103
+ ref: s,
104
+ className: g(
71
105
  "relative m-0 block h-full grow shrink-0 basis-0 cursor-pointer select-none",
72
- e.disabled && "cursor-default opacity-50"
106
+ r.disabled && "cursor-default opacity-50"
73
107
  ),
74
- "data-checked": e.checked,
75
- "data-disabled": e.disabled,
108
+ "data-checked": r.checked,
109
+ "data-disabled": r.disabled,
76
110
  children: [
77
- /* @__PURE__ */ s(
111
+ /* @__PURE__ */ f(
78
112
  "input",
79
113
  {
80
114
  type: "radio",
81
- name: l,
115
+ name: m,
82
116
  className: "absolute h-0 w-0 cursor-pointer opacity-0",
83
- ...e,
117
+ ...r,
84
118
  onChange: o
85
119
  }
86
120
  ),
87
- /* @__PURE__ */ s("span", { className: "flex h-full grow shrink-0 basis-0 items-center justify-center px-2 py-1", children: d ?? t })
121
+ /* @__PURE__ */ f("span", { className: "flex h-full grow shrink-0 basis-0 items-center justify-center px-2 py-1", children: n ?? l })
88
122
  ]
89
123
  }
90
124
  );
91
- }
125
+ });
126
+ N.displayName = "SegmentedControlItem";
92
127
  export {
93
- b as SegmentedControl,
94
- h as segmentedControlVariants
128
+ $ as SegmentedControl,
129
+ S as segmentedControlVariants
95
130
  };
@@ -109,6 +109,7 @@ import "../layout/footer/footer.js";
109
109
  import "../layout/grid/grid.js";
110
110
  import "../layout/header/header.js";
111
111
  import "../layout/layout/layout.js";
112
+ import "../layout/main-aside-layout/main-aside-layout.js";
112
113
  import "../page-title/page-title.js";
113
114
  import "../layout/social-icons/social-icons.js";
114
115
  import "../link/link.js";
@@ -108,6 +108,7 @@ import "../layout/footer/footer.js";
108
108
  import "../layout/grid/grid.js";
109
109
  import "../layout/header/header.js";
110
110
  import "../layout/layout/layout.js";
111
+ import "../layout/main-aside-layout/main-aside-layout.js";
111
112
  import "../page-title/page-title.js";
112
113
  import "../layout/social-icons/social-icons.js";
113
114
  import "../link/link.js";
@@ -157,7 +158,7 @@ import "../tip-card/tip-card.js";
157
158
  import "../toggle/toggle.js";
158
159
  import "../typography/typography.js";
159
160
  import "../with-filter-button/with-filter-button.js";
160
- function Mr({
161
+ function zr({
161
162
  balances: a,
162
163
  tokensList: l,
163
164
  maxAssets: p = 3,
@@ -220,5 +221,5 @@ function Mr({
220
221
  ] });
221
222
  }
222
223
  export {
223
- Mr as TokensListCell
224
+ zr as TokensListCell
224
225
  };
@@ -108,6 +108,7 @@ import "../layout/footer/footer.js";
108
108
  import "../layout/grid/grid.js";
109
109
  import "../layout/header/header.js";
110
110
  import "../layout/layout/layout.js";
111
+ import "../layout/main-aside-layout/main-aside-layout.js";
111
112
  import "../page-title/page-title.js";
112
113
  import "../layout/social-icons/social-icons.js";
113
114
  import "../link/link.js";
@@ -157,7 +158,7 @@ import "../tip-card/tip-card.js";
157
158
  import "../toggle/toggle.js";
158
159
  import "../typography/typography.js";
159
160
  import "../with-filter-button/with-filter-button.js";
160
- function jr({
161
+ function Tr({
161
162
  toCopy: u,
162
163
  children: d,
163
164
  onCopySuccess: f,
@@ -239,5 +240,5 @@ function jr({
239
240
  return a ? /* @__PURE__ */ t(T, { placement: "top", triangle: !0, title: c(), children: a }) : c();
240
241
  }
241
242
  export {
242
- jr as WithCopy
243
+ Tr as WithCopy
243
244
  };