@gearbox-protocol/permissionless-ui 1.22.0-next.1 → 1.22.0-next.10

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 (58) hide show
  1. package/dist/cjs/components/buttons/button/button.cjs +1 -1
  2. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  3. package/dist/cjs/components/client-adapters/index.cjs +1 -1
  4. package/dist/cjs/components/client-adapters/styled-button/styled-button.cjs +1 -1
  5. package/dist/cjs/components/client-adapters/styled-rounded-image/index.cjs +1 -0
  6. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -0
  7. package/dist/cjs/components/index.cjs +1 -1
  8. package/dist/cjs/components/layout/app-logo/app-logo.cjs +1 -1
  9. package/dist/cjs/components/network-icon/network-icon.cjs +1 -1
  10. package/dist/cjs/components/points-icon/points-icon.cjs +1 -1
  11. package/dist/cjs/components/rounded-image/rounded-image.cjs +1 -1
  12. package/dist/cjs/components/token-icon/token-icon.cjs +1 -1
  13. package/dist/cjs/components/vertical-list/vertical-list.cjs +1 -1
  14. package/dist/cjs/configs/tailwind-preset.cjs +1 -1
  15. package/dist/cjs/index.cjs +1 -1
  16. package/dist/cjs/utils/format-money.cjs +1 -1
  17. package/dist/cjs/utils/format-slippage.cjs +1 -0
  18. package/dist/cjs/utils/index.cjs +1 -1
  19. package/dist/cjs/utils/search-in-token.cjs +1 -1
  20. package/dist/cjs/utils/static.cjs +1 -0
  21. package/dist/esm/components/buttons/button/button.js +18 -13
  22. package/dist/esm/components/checkbox/checkbox-labeled.js +2 -0
  23. package/dist/esm/components/client-adapters/index.js +4 -2
  24. package/dist/esm/components/client-adapters/styled-button/styled-button.js +13 -12
  25. package/dist/esm/components/client-adapters/styled-rounded-image/index.js +4 -0
  26. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +132 -0
  27. package/dist/esm/components/index.js +466 -464
  28. package/dist/esm/components/layout/app-logo/app-logo.js +8 -7
  29. package/dist/esm/components/network-icon/network-icon.js +22 -21
  30. package/dist/esm/components/points-icon/points-icon.js +29 -34
  31. package/dist/esm/components/rounded-image/rounded-image.js +58 -27
  32. package/dist/esm/components/token-icon/token-icon.js +24 -23
  33. package/dist/esm/components/vertical-list/vertical-list.js +39 -33
  34. package/dist/esm/configs/tailwind-preset.js +5 -3
  35. package/dist/esm/index.js +595 -592
  36. package/dist/esm/utils/format-money.js +13 -17
  37. package/dist/esm/utils/format-slippage.js +7 -0
  38. package/dist/esm/utils/index.js +48 -47
  39. package/dist/esm/utils/search-in-token.js +8 -8
  40. package/dist/esm/utils/static.js +6 -0
  41. package/dist/globals.css +1 -1
  42. package/dist/types/components/buttons/button/button.d.ts +1 -1
  43. package/dist/types/components/client-adapters/index.d.ts +1 -0
  44. package/dist/types/components/client-adapters/styled-button/styled-button.d.ts +1 -1
  45. package/dist/types/components/client-adapters/styled-rounded-image/index.d.ts +1 -0
  46. package/dist/types/components/client-adapters/styled-rounded-image/styled-rounded-image.d.ts +9 -0
  47. package/dist/types/components/points-icon/points-icon.d.ts +2 -5
  48. package/dist/types/components/rounded-image/rounded-image.d.ts +19 -4
  49. package/dist/types/components/table/edit-button.d.ts +1 -1
  50. package/dist/types/components/vertical-list/vertical-list.d.ts +2 -5
  51. package/dist/types/configs/tailwind-preset.d.ts +2 -0
  52. package/dist/types/utils/format-money.d.ts +0 -15
  53. package/dist/types/utils/format-slippage.d.ts +15 -0
  54. package/dist/types/utils/index.d.ts +2 -1
  55. package/dist/types/utils/static.d.ts +3 -0
  56. package/package.json +5 -3
  57. package/src/styles/base.css +492 -0
  58. package/src/styles/theme.css +18 -3
@@ -1,11 +1,12 @@
1
- import { jsxs as m, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
2
  import { Image as r } from "../../image/image.js";
3
3
  import { cn as o } from "../../../utils/cn.js";
4
- function d({
5
- appName: a,
4
+ import { getStatic as l } from "../../../utils/static.js";
5
+ function p({
6
+ appName: m,
6
7
  size: t = "default"
7
8
  }) {
8
- return /* @__PURE__ */ m(
9
+ return /* @__PURE__ */ a(
9
10
  "div",
10
11
  {
11
12
  className: o(
@@ -16,7 +17,7 @@ function d({
16
17
  /* @__PURE__ */ e(
17
18
  r,
18
19
  {
19
- src: "https://static.gearbox.fi/logo/logo_monochrome_white@2x.png",
20
+ src: l("/logo/logo_monochrome_white@2x.png"),
20
21
  alt: "Gearbox Protocol",
21
22
  width: t === "default" ? 120 : 100,
22
23
  height: t === "default" ? 24 : 20,
@@ -27,11 +28,11 @@ function d({
27
28
  )
28
29
  }
29
30
  ),
30
- /* @__PURE__ */ e("span", { className: "text-muted-foreground whitespace-nowrap", children: a })
31
+ /* @__PURE__ */ e("span", { className: "text-muted-foreground whitespace-nowrap", children: m })
31
32
  ]
32
33
  }
33
34
  );
34
35
  }
35
36
  export {
36
- d as AppLogo
37
+ p as AppLogo
37
38
  };
@@ -1,22 +1,23 @@
1
- import { jsx as E } from "react/jsx-runtime";
2
- import { useState as i, useRef as L, useEffect as p } from "react";
3
- import { cn as w } from "../../utils/cn.js";
4
- const l = "https://static.gearbox.finance", o = `${l}/chains/allnetworks.svg`, d = /* @__PURE__ */ new Set();
5
- function f(t) {
6
- if (!t) return o;
7
- const r = t.toLowerCase(), e = `${l}/chains/${r}.svg`;
1
+ import { jsx as S } from "react/jsx-runtime";
2
+ import { useState as i, useRef as p, useEffect as w } from "react";
3
+ import { cn as E } from "../../utils/cn.js";
4
+ import { getStatic as l } from "../../utils/static.js";
5
+ const o = l("/chains/allnetworks.svg"), d = /* @__PURE__ */ new Set();
6
+ function f(r) {
7
+ if (!r) return o;
8
+ const t = r.toLowerCase(), e = l(`/chains/${t}.svg`);
8
9
  return d.has(e) ? o : e;
9
10
  }
10
- function N({
11
- network: t,
12
- size: r = 20,
11
+ function C({
12
+ network: r,
13
+ size: t = 20,
13
14
  className: e
14
15
  }) {
15
- const u = f(t), [s, c] = i(u), [h, a] = i(!1), n = L(!1);
16
- p(() => {
17
- const S = f(t);
18
- c(S), a(!1), n.current = !1;
19
- }, [t]);
16
+ const u = f(r), [s, c] = i(u), [h, a] = i(!1), n = p(!1);
17
+ w(() => {
18
+ const L = f(r);
19
+ c(L), a(!1), n.current = !1;
20
+ }, [r]);
20
21
  const g = () => {
21
22
  n.current || (n.current = !0, d.add(s), c(o));
22
23
  }, m = () => {
@@ -24,19 +25,19 @@ function N({
24
25
  };
25
26
  return (
26
27
  // biome-ignore lint/performance/noImgElement: Simple img for CDN icons with browser caching
27
- /* @__PURE__ */ E(
28
+ /* @__PURE__ */ S(
28
29
  "img",
29
30
  {
30
31
  src: s,
31
32
  alt: "",
32
- width: r,
33
- height: r,
34
- className: w(
33
+ width: t,
34
+ height: t,
35
+ className: E(
35
36
  "object-contain shrink-0",
36
37
  !h && "bg-gray-200 dark:bg-gray-700 rounded-full",
37
38
  e
38
39
  ),
39
- style: { width: r, height: r },
40
+ style: { width: t, height: t },
40
41
  onError: g,
41
42
  onLoad: m
42
43
  }
@@ -44,5 +45,5 @@ function N({
44
45
  );
45
46
  }
46
47
  export {
47
- N as NetworkIcon
48
+ C as NetworkIcon
48
49
  };
@@ -1,43 +1,38 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import * as p from "react";
3
- import { cn as f } from "../../utils/cn.js";
4
- import "sonner";
5
- import "@gearbox-protocol/sdk";
6
- const l = "https://static.gearbox.fi", h = p.forwardRef(
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import * as f from "react";
3
+ import { RoundedImage as l } from "../rounded-image/rounded-image.js";
4
+ import { buildStaticUrl as d } from "../../utils/static.js";
5
+ const u = f.forwardRef(
7
6
  ({
8
7
  reward: o,
9
8
  size: t = 24,
10
- staticBaseUrl: i = l,
11
- rounded: r = !1,
12
- className: n,
9
+ staticBaseUrl: r,
10
+ rounded: n = !1,
11
+ className: i,
13
12
  style: s,
14
- ...a
15
- }, c) => {
16
- const e = `${i}/points/${o.type.toLowerCase()}.svg`;
17
- return (
18
- // biome-ignore lint/performance/noImgElement: External SVG icons from CDN
19
- /* @__PURE__ */ m(
20
- "img",
21
- {
22
- ref: c,
23
- src: e,
24
- alt: o.name,
25
- width: t,
26
- height: t,
27
- className: f(r && "rounded-full", n),
28
- style: {
29
- width: t,
30
- height: t,
31
- objectFit: "contain",
32
- ...s
33
- },
34
- ...a
35
- }
36
- )
13
+ fit: a = "contain",
14
+ ...e
15
+ }, m) => {
16
+ const c = d(r)(
17
+ `/points/${o.type.toLowerCase()}.svg`
18
+ );
19
+ return /* @__PURE__ */ p(
20
+ l,
21
+ {
22
+ className: i,
23
+ ref: m,
24
+ src: c,
25
+ size: t,
26
+ rounded: n,
27
+ fit: a,
28
+ alt: o.name,
29
+ style: s,
30
+ ...e
31
+ }
37
32
  );
38
33
  }
39
34
  );
40
- h.displayName = "PointsIcon";
35
+ u.displayName = "PointsIcon";
41
36
  export {
42
- h as PointsIcon
37
+ u as PointsIcon
43
38
  };
@@ -1,32 +1,63 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import "react";
3
- import { cn as i } from "../../utils/cn.js";
1
+ import { jsx as L } from "react/jsx-runtime";
2
+ import b, { useState as d, useRef as E, useEffect as j } from "react";
3
+ import { cn as k } from "../../utils/cn.js";
4
4
  import "sonner";
5
5
  import "@gearbox-protocol/sdk";
6
- function p({
7
- className: t,
8
- size: o,
9
- style: r,
10
- ...m
11
- }) {
12
- return (
13
- // biome-ignore lint/performance/noImgElement: Universal component that works outside Next.js
14
- /* @__PURE__ */ e(
15
- "img",
16
- {
17
- alt: "",
18
- className: i("rounded-full object-cover", t),
19
- style: {
20
- ...o ? { width: o, height: o } : {},
21
- ...r
22
- },
23
- loading: "lazy",
24
- decoding: "async",
25
- ...m
26
- }
27
- )
28
- );
6
+ import { getStatic as w } from "../../utils/static.js";
7
+ const c = w("/tokens/default.svg"), f = /* @__PURE__ */ new Map();
8
+ function s(e) {
9
+ return f.get(e) ? c : e;
29
10
  }
11
+ const N = b.forwardRef(
12
+ ({
13
+ className: e,
14
+ size: o,
15
+ rounded: l = !0,
16
+ style: i,
17
+ src: r,
18
+ defaultIcon: u = c,
19
+ fit: g = "cover",
20
+ ...m
21
+ }, p) => {
22
+ const [h, a] = d(void 0), [v, n] = d(!1), t = E(!1);
23
+ j(() => {
24
+ s(r), a(void 0), n(!1), t.current = !1;
25
+ }, [r]);
26
+ const y = (I) => {
27
+ t.current || (t.current = !0, f.set(I.currentTarget.src, !0), a(u));
28
+ }, R = () => {
29
+ n(!0);
30
+ };
31
+ return (
32
+ // biome-ignore lint/performance/noImgElement: Universal component that works outside Next.js
33
+ /* @__PURE__ */ L(
34
+ "img",
35
+ {
36
+ ref: p,
37
+ src: h || s(r),
38
+ alt: "",
39
+ className: k(
40
+ g === "cover" ? "object-cover" : "object-contain",
41
+ l && "rounded-full",
42
+ !v && "bg-gray-90 dark:bg-gray-110 rounded-full",
43
+ e
44
+ ),
45
+ style: {
46
+ width: o,
47
+ height: o,
48
+ ...i
49
+ },
50
+ loading: "lazy",
51
+ decoding: "async",
52
+ onError: y,
53
+ onLoad: R,
54
+ ...m
55
+ }
56
+ )
57
+ );
58
+ }
59
+ );
60
+ N.displayName = "RoundedImage";
30
61
  export {
31
- p as RoundedImage
62
+ N as RoundedImage
32
63
  };
@@ -1,47 +1,48 @@
1
1
  import { jsx as p } from "react/jsx-runtime";
2
- import { useState as s, useRef as h } from "react";
3
- import { cn as m } from "../../utils/cn.js";
4
- const a = "https://static.gearbox.fi/tokens/default.svg", i = /* @__PURE__ */ new Set();
5
- function w(t) {
6
- const e = t.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase();
7
- if (!e) return a;
8
- const r = `https://static.gearbox.fi/tokens/${e}.svg`;
9
- return i.has(r) ? a : r;
2
+ import { useState as l, useRef as h } from "react";
3
+ import { cn as w } from "../../utils/cn.js";
4
+ import { getStatic as a } from "../../utils/static.js";
5
+ const c = a("/tokens/default.svg"), d = /* @__PURE__ */ new Set();
6
+ function k(o) {
7
+ const e = o.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase();
8
+ if (!e) return c;
9
+ const r = a(`/tokens/${e}.svg`);
10
+ return d.has(r) ? c : r;
10
11
  }
11
- function I({ symbol: t, size: e = 48, className: r }) {
12
- const n = w(t), [o, l] = s(n), [f, d] = s(!1), c = h(!1), u = () => {
13
- c.current || (c.current = !0, i.add(o), l(a));
14
- }, g = () => {
15
- d(!0);
12
+ function E({ symbol: o, size: e = 48, className: r }) {
13
+ const n = k(o), [t, i] = l(n), [f, u] = l(!1), s = h(!1), g = () => {
14
+ s.current || (s.current = !0, d.add(t), i(c));
15
+ }, m = () => {
16
+ u(!0);
16
17
  };
17
18
  return (
18
19
  // biome-ignore lint/performance/noImgElement: Simple img for CDN icons with browser caching
19
20
  /* @__PURE__ */ p(
20
21
  "img",
21
22
  {
22
- src: o,
23
+ src: t,
23
24
  alt: "",
24
25
  width: e,
25
26
  height: e,
26
- className: m(
27
+ className: w(
27
28
  "object-contain",
28
29
  !f && "bg-gray-200 dark:bg-gray-700 rounded-full",
29
30
  r
30
31
  ),
31
32
  style: { width: e, height: e },
32
- onError: u,
33
- onLoad: g
33
+ onError: g,
34
+ onLoad: m
34
35
  }
35
36
  )
36
37
  );
37
38
  }
38
- function x(t) {
39
- t.forEach((e) => {
40
- const n = `https://static.gearbox.fi/tokens/${e.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase()}.svg`, o = new window.Image();
41
- o.src = n;
39
+ function T(o) {
40
+ o.forEach((e) => {
41
+ const r = e.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase(), n = a(`/tokens/${r}.svg`), t = new window.Image();
42
+ t.src = n;
42
43
  });
43
44
  }
44
45
  export {
45
- I as TokenIcon,
46
- x as preloadTokenIcons
46
+ E as TokenIcon,
47
+ T as preloadTokenIcons
47
48
  };
@@ -1,61 +1,67 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
- import { cva as g } from "class-variance-authority";
3
- import * as a from "react";
4
- import { cn as i } from "../../utils/cn.js";
2
+ import { cva as u } from "class-variance-authority";
3
+ import * as r from "react";
4
+ import { cn as t } from "../../utils/cn.js";
5
5
  import "sonner";
6
6
  import "@gearbox-protocol/sdk";
7
- const u = g("flex flex-col", {
7
+ const c = u("flex flex-col", {
8
8
  variants: {
9
- gap: {
9
+ rowGap: {
10
10
  xs: "gap-1",
11
- sm: "gap-2",
12
- default: "gap-3",
13
- md: "gap-4",
14
- lg: "gap-6"
11
+ default: "gap-4",
12
+ md: "gap-6"
15
13
  },
16
14
  divided: {
17
15
  true: "",
18
16
  false: ""
17
+ },
18
+ nested: {
19
+ true: t(
20
+ "relative py-[2px] pr-0 pl-3",
21
+ "before:content-[''] before:absolute before:top-0 before:left-0 before:block",
22
+ "before:h-full before:border-l-2 before:border-l-gray-40"
23
+ ),
24
+ false: ""
19
25
  }
20
26
  },
21
27
  defaultVariants: {
22
- gap: "default",
23
- divided: !1
28
+ rowGap: "default",
29
+ divided: !1,
30
+ nested: !1
24
31
  }
25
- }), v = a.forwardRef(
32
+ }), v = r.forwardRef(
26
33
  ({
27
- className: o,
28
- gap: m = "default",
29
- divided: r = !1,
30
- nested: p = !1,
31
- children: f,
32
- ...n
33
- }, d) => {
34
- const t = a.Children.toArray(f).filter(
34
+ className: f,
35
+ rowGap: i = "default",
36
+ divided: a = !1,
37
+ nested: n = !1,
38
+ children: p,
39
+ ...m
40
+ }, b) => {
41
+ const o = r.Children.toArray(p).filter(
35
42
  (e) => e != null
36
43
  );
37
44
  return /* @__PURE__ */ s(
38
45
  "ul",
39
46
  {
40
- ref: d,
41
- className: i(
42
- u({ gap: m, divided: r }),
43
- p && "m-0 p-0",
47
+ ref: b,
48
+ className: t(
49
+ c({ rowGap: i, divided: a, nested: n }),
44
50
  "list-none",
45
- o
51
+ f
46
52
  ),
47
- ...n,
48
- children: t.map((e, l) => {
49
- const c = a.isValidElement(e) && e.key ? e.key : `vertical-list-item-${l}`;
50
- return /* @__PURE__ */ s(
53
+ ...m,
54
+ children: o.map((e, l) => {
55
+ const d = r.isValidElement(e) && e.key ? e.key : `vertical-list-item-${l}`;
56
+ return e != null && /* @__PURE__ */ s(
51
57
  "li",
52
58
  {
53
- className: i(
54
- r && l !== t.length - 1 && "pb-3 border-b border-border"
59
+ className: t(
60
+ a && l !== o.length - 1 && "pb-3 border-b border-border"
55
61
  ),
56
62
  children: e
57
63
  },
58
- c
64
+ d
59
65
  );
60
66
  })
61
67
  }
@@ -65,5 +71,5 @@ const u = g("flex flex-col", {
65
71
  v.displayName = "VerticalList";
66
72
  export {
67
73
  v as VerticalList,
68
- u as verticalListVariants
74
+ c as verticalListVariants
69
75
  };
@@ -1,6 +1,6 @@
1
1
  import r from "../_virtual/index.js";
2
2
  import a from "tailwindcss-animate";
3
- const s = {
3
+ const e = {
4
4
  darkMode: "class",
5
5
  safelist: [
6
6
  // Grid columns - dynamically generated in Grid component
@@ -58,6 +58,8 @@ const s = {
58
58
  foreground: "hsl(var(--destructive-foreground))"
59
59
  },
60
60
  success: "hsl(var(--success))",
61
+ "success-foreground": "hsl(var(--success-foreground))",
62
+ "success-hover": "hsl(var(--success-hover))",
61
63
  warning: "hsl(var(--warning))",
62
64
  liquidation: "hsl(var(--liquidation))",
63
65
  border: "hsl(var(--border))",
@@ -128,6 +130,6 @@ const s = {
128
130
  plugins: [a, r({ nocompatible: !0 })]
129
131
  };
130
132
  export {
131
- s as default,
132
- s as preset
133
+ e as default,
134
+ e as preset
133
135
  };