@gearbox-protocol/ui-kit 4.0.0-next.53 → 4.0.0-next.54

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react/jsx-runtime"),n=require("react");require("@gearbox-protocol/sdk/onchain");const h=require("../../utils/cn.cjs"),I=require("../../utils/static.cjs");require("luxon");require("../../utils/z-index.cjs");function _(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const L=_(n),i=I.getStatic("/tokens/default.svg"),l=new Map;function d(e){return l.get(e)?i:e}const f=L.forwardRef(({className:e,size:t,rounded:r=!0,style:o,src:a,defaultIcon:g=i,fit:b="cover",...m},y)=>{const[j,s]=n.useState(void 0),[p,u]=n.useState(!1),c=n.useRef(!1);n.useEffect(()=>{d(a),s(void 0),u(!1),c.current=!1},[a]);const R=q=>{c.current||(c.current=!0,l.set(q.currentTarget.src,!0),s(g))},v=()=>{u(!0)};return O.jsx("img",{ref:y,src:j||d(a),alt:"",className:h.cn(b==="cover"?"object-cover":"object-contain object-center",r&&"rounded-full",!p&&"bg-gray-90 dark:bg-gray-110 rounded-full",e),style:{width:t,height:t,...o},loading:"lazy",decoding:"async",onError:R,onLoad:v,...m})});f.displayName="RoundedImage";exports.RoundedImage=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react/jsx-runtime"),c=require("react");require("@gearbox-protocol/sdk/onchain");const _=require("../../utils/cn.cjs"),L=require("../../utils/static.cjs");require("luxon");require("../../utils/z-index.cjs");function S(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const T=S(c),g=L.getStatic("/tokens/default.svg"),m=new Map;function f(e){return m.get(e)?g:e}const b=T.forwardRef(({className:e,size:r,rounded:n=!0,style:o,src:s,defaultIcon:p=g,fit:y="cover",...R},a)=>{const[j,l]=c.useState(void 0),[h,u]=c.useState(!1),i=c.useRef(!1),d=c.useRef(null),v=t=>{d.current=t,typeof a=="function"?a(t):a&&(a.current=t),t?.complete&&t.naturalWidth>0&&u(!0)};c.useEffect(()=>{f(s),l(void 0),i.current=!1;const t=d.current;u(!!t?.complete&&t.naturalWidth>0)},[s]);const q=t=>{i.current||(i.current=!0,m.set(t.currentTarget.src,!0),l(p))},O=()=>{u(!0)};return I.jsx("img",{ref:v,src:j||f(s),alt:"",className:_.cn(y==="cover"?"object-cover":"object-contain object-center",n&&"rounded-full",!h&&"bg-gray-90 dark:bg-gray-110 rounded-full",e),style:{width:r,height:r,...o},loading:"lazy",decoding:"async",onError:q,onLoad:O,...R})});b.displayName="RoundedImage";exports.RoundedImage=b;
@@ -1,65 +1,69 @@
1
- import { jsx as I } from "react/jsx-runtime";
2
- import * as L from "react";
3
- import { useState as s, useRef as j, useEffect as E } from "react";
1
+ import { jsx as E } from "react/jsx-runtime";
2
+ import * as k from "react";
3
+ import { useState as d, useRef as l, useEffect as w } from "react";
4
4
  import "@gearbox-protocol/sdk/onchain";
5
- import { cn as k } from "../../utils/cn.js";
6
- import { getStatic as w } from "../../utils/static.js";
5
+ import { cn as N } from "../../utils/cn.js";
6
+ import { getStatic as T } from "../../utils/static.js";
7
7
  import "luxon";
8
8
  import "../../utils/z-index.js";
9
- const d = w("/tokens/default.svg"), i = /* @__PURE__ */ new Map();
10
- function c(e) {
11
- return i.get(e) ? d : e;
9
+ const u = T("/tokens/default.svg"), m = /* @__PURE__ */ new Map();
10
+ function f(t) {
11
+ return m.get(t) ? u : t;
12
12
  }
13
- const N = L.forwardRef(
13
+ const U = k.forwardRef(
14
14
  ({
15
- className: e,
16
- size: o,
17
- rounded: f = !0,
18
- style: l,
19
- src: r,
20
- defaultIcon: u = d,
21
- fit: m = "cover",
22
- ...g
23
- }, p) => {
24
- const [h, a] = s(void 0), [v, n] = s(!1), t = j(!1);
25
- E(() => {
26
- c(r), a(void 0), n(!1), t.current = !1;
27
- }, [r]);
28
- const y = (b) => {
29
- t.current || (t.current = !0, i.set(b.currentTarget.src, !0), a(u));
30
- }, R = () => {
15
+ className: t,
16
+ size: c,
17
+ rounded: g = !0,
18
+ style: p,
19
+ src: o,
20
+ defaultIcon: h = u,
21
+ fit: R = "cover",
22
+ ...y
23
+ }, r) => {
24
+ const [v, s] = d(void 0), [b, n] = d(!1), a = l(!1), i = l(null), I = (e) => {
25
+ i.current = e, typeof r == "function" ? r(e) : r && (r.current = e), e?.complete && e.naturalWidth > 0 && n(!0);
26
+ };
27
+ w(() => {
28
+ f(o), s(void 0), a.current = !1;
29
+ const e = i.current;
30
+ n(!!e?.complete && e.naturalWidth > 0);
31
+ }, [o]);
32
+ const L = (e) => {
33
+ a.current || (a.current = !0, m.set(e.currentTarget.src, !0), s(h));
34
+ }, j = () => {
31
35
  n(!0);
32
36
  };
33
37
  return (
34
38
  // biome-ignore lint/performance/noImgElement: Universal component that works outside Next.js
35
- /* @__PURE__ */ I(
39
+ /* @__PURE__ */ E(
36
40
  "img",
37
41
  {
38
- ref: p,
39
- src: h || c(r),
42
+ ref: I,
43
+ src: v || f(o),
40
44
  alt: "",
41
- className: k(
42
- m === "cover" ? "object-cover" : "object-contain object-center",
43
- f && "rounded-full",
44
- !v && "bg-gray-90 dark:bg-gray-110 rounded-full",
45
- e
45
+ className: N(
46
+ R === "cover" ? "object-cover" : "object-contain object-center",
47
+ g && "rounded-full",
48
+ !b && "bg-gray-90 dark:bg-gray-110 rounded-full",
49
+ t
46
50
  ),
47
51
  style: {
48
- width: o,
49
- height: o,
50
- ...l
52
+ width: c,
53
+ height: c,
54
+ ...p
51
55
  },
52
56
  loading: "lazy",
53
57
  decoding: "async",
54
- onError: y,
55
- onLoad: R,
56
- ...g
58
+ onError: L,
59
+ onLoad: j,
60
+ ...y
57
61
  }
58
62
  )
59
63
  );
60
64
  }
61
65
  );
62
- N.displayName = "RoundedImage";
66
+ U.displayName = "RoundedImage";
63
67
  export {
64
- N as RoundedImage
68
+ U as RoundedImage
65
69
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "4.0.0-next.53",
3
+ "version": "4.0.0-next.54",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",