@gearbox-protocol/permissionless-ui 1.22.0-next.7 → 1.22.0-next.9

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 (31) hide show
  1. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  2. package/dist/cjs/components/client-adapters/index.cjs +1 -1
  3. package/dist/cjs/components/client-adapters/styled-rounded-image/index.cjs +1 -0
  4. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -0
  5. package/dist/cjs/components/index.cjs +1 -1
  6. package/dist/cjs/components/layout/app-logo/app-logo.cjs +1 -1
  7. package/dist/cjs/components/points-icon/points-icon.cjs +1 -1
  8. package/dist/cjs/components/rounded-image/rounded-image.cjs +1 -1
  9. package/dist/cjs/components/token-icon/token-icon.cjs +1 -1
  10. package/dist/cjs/index.cjs +1 -1
  11. package/dist/cjs/utils/search-in-token.cjs +1 -1
  12. package/dist/cjs/utils/static.cjs +1 -0
  13. package/dist/esm/components/checkbox/checkbox-labeled.js +2 -0
  14. package/dist/esm/components/client-adapters/index.js +4 -2
  15. package/dist/esm/components/client-adapters/styled-rounded-image/index.js +4 -0
  16. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +132 -0
  17. package/dist/esm/components/index.js +466 -464
  18. package/dist/esm/components/layout/app-logo/app-logo.js +8 -7
  19. package/dist/esm/components/points-icon/points-icon.js +23 -22
  20. package/dist/esm/components/rounded-image/rounded-image.js +53 -27
  21. package/dist/esm/components/token-icon/token-icon.js +16 -15
  22. package/dist/esm/index.js +595 -593
  23. package/dist/esm/utils/search-in-token.js +8 -8
  24. package/dist/esm/utils/static.js +5 -0
  25. package/dist/globals.css +1 -1
  26. package/dist/types/components/client-adapters/index.d.ts +1 -0
  27. package/dist/types/components/client-adapters/styled-rounded-image/index.d.ts +1 -0
  28. package/dist/types/components/client-adapters/styled-rounded-image/styled-rounded-image.d.ts +9 -0
  29. package/dist/types/components/rounded-image/rounded-image.d.ts +13 -4
  30. package/dist/types/utils/static.d.ts +2 -0
  31. package/package.json +1 -1
@@ -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,37 +1,38 @@
1
- import { jsx as m } from "react/jsx-runtime";
1
+ import { jsx as c } from "react/jsx-runtime";
2
2
  import * as p from "react";
3
3
  import { cn as f } from "../../utils/cn.js";
4
4
  import "sonner";
5
5
  import "@gearbox-protocol/sdk";
6
- const l = "https://static.gearbox.fi", h = p.forwardRef(
6
+ import { STATIC_SERVER as l } from "../../utils/static.js";
7
+ const h = p.forwardRef(
7
8
  ({
8
- reward: o,
9
- size: t = 24,
10
- staticBaseUrl: i = l,
11
- rounded: r = !1,
12
- className: n,
13
- style: s,
14
- ...a
15
- }, c) => {
16
- const e = `${i}/points/${o.type.toLowerCase()}.svg`;
9
+ reward: t,
10
+ size: o = 24,
11
+ staticBaseUrl: r = l,
12
+ rounded: i = !1,
13
+ className: m,
14
+ style: n,
15
+ ...e
16
+ }, s) => {
17
+ const a = `${r}/points/${t.type.toLowerCase()}.svg`;
17
18
  return (
18
19
  // biome-ignore lint/performance/noImgElement: External SVG icons from CDN
19
- /* @__PURE__ */ m(
20
+ /* @__PURE__ */ c(
20
21
  "img",
21
22
  {
22
- ref: c,
23
- src: e,
24
- alt: o.name,
25
- width: t,
26
- height: t,
27
- className: f(r && "rounded-full", n),
23
+ ref: s,
24
+ src: a,
25
+ alt: t.name,
26
+ width: o,
27
+ height: o,
28
+ className: f(i && "rounded-full", m),
28
29
  style: {
29
- width: t,
30
- height: t,
30
+ width: o,
31
+ height: o,
31
32
  objectFit: "contain",
32
- ...s
33
+ ...n
33
34
  },
34
- ...a
35
+ ...e
35
36
  }
36
37
  )
37
38
  );
@@ -1,32 +1,58 @@
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 I } from "react/jsx-runtime";
2
+ import L, { useState as o, useRef as b } 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 v } from "../../utils/static.js";
7
+ const a = v("/tokens/default.svg"), n = /* @__PURE__ */ new Map();
8
+ function w(e) {
9
+ return n.get(e) ? a : e;
29
10
  }
11
+ const E = L.forwardRef(
12
+ ({
13
+ className: e,
14
+ size: r,
15
+ rounded: d,
16
+ style: s,
17
+ src: c,
18
+ defaultIcon: l = a,
19
+ ...i
20
+ }, f) => {
21
+ const [u, g] = o(void 0), [m, p] = o(!1), t = b(!1), h = (R) => {
22
+ t.current || (t.current = !0, n.set(R.currentTarget.src, !0), g(l));
23
+ }, y = () => {
24
+ p(!0);
25
+ };
26
+ return (
27
+ // biome-ignore lint/performance/noImgElement: Universal component that works outside Next.js
28
+ /* @__PURE__ */ I(
29
+ "img",
30
+ {
31
+ ref: f,
32
+ src: u || w(c),
33
+ alt: "",
34
+ className: k(
35
+ "object-cover",
36
+ d && "rounded-full",
37
+ !m && "bg-gray-90 dark:bg-gray-110 rounded-full",
38
+ e
39
+ ),
40
+ style: {
41
+ width: r,
42
+ height: r,
43
+ ...s
44
+ },
45
+ loading: "lazy",
46
+ decoding: "async",
47
+ onError: h,
48
+ onLoad: y,
49
+ ...i
50
+ }
51
+ )
52
+ );
53
+ }
54
+ );
55
+ E.displayName = "RoundedImage";
30
56
  export {
31
- p as RoundedImage
57
+ E as RoundedImage
32
58
  };
@@ -1,15 +1,16 @@
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";
2
+ import { useState as s, useRef as m } from "react";
3
+ import { cn as h } from "../../utils/cn.js";
4
+ import { getStatic as w } from "../../utils/static.js";
4
5
  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();
6
+ function k(r) {
7
+ const e = r.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase();
7
8
  if (!e) return a;
8
- const r = `https://static.gearbox.fi/tokens/${e}.svg`;
9
- return i.has(r) ? a : r;
9
+ const t = `https://static.gearbox.fi/tokens/${e}.svg`;
10
+ return i.has(t) ? a : t;
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 = () => {
12
+ function x({ symbol: r, size: e = 48, className: t }) {
13
+ const n = k(r), [o, l] = s(n), [f, d] = s(!1), c = m(!1), u = () => {
13
14
  c.current || (c.current = !0, i.add(o), l(a));
14
15
  }, g = () => {
15
16
  d(!0);
@@ -23,10 +24,10 @@ function I({ symbol: t, size: e = 48, className: r }) {
23
24
  alt: "",
24
25
  width: e,
25
26
  height: e,
26
- className: m(
27
+ className: h(
27
28
  "object-contain",
28
29
  !f && "bg-gray-200 dark:bg-gray-700 rounded-full",
29
- r
30
+ t
30
31
  ),
31
32
  style: { width: e, height: e },
32
33
  onError: u,
@@ -35,13 +36,13 @@ function I({ symbol: t, size: e = 48, className: r }) {
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();
39
+ function C(r) {
40
+ r.forEach((e) => {
41
+ const t = e.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase(), n = w(`/tokens/${t}.svg`), o = new window.Image();
41
42
  o.src = n;
42
43
  });
43
44
  }
44
45
  export {
45
- I as TokenIcon,
46
- x as preloadTokenIcons
46
+ x as TokenIcon,
47
+ C as preloadTokenIcons
47
48
  };