@gearbox-protocol/permissionless-ui 1.15.3 → 1.15.4

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 (54) hide show
  1. package/dist/cjs/components/block-sync/block-sync.cjs +1 -1
  2. package/dist/cjs/components/buttons/copy-button/copy-button.cjs +1 -1
  3. package/dist/cjs/components/detailed-page-title/detailed-page-title.cjs +1 -1
  4. package/dist/cjs/components/graph/graph.cjs +1 -1
  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/liquidation/liquidation-assets-table/liquidation-assets-table.cjs +1 -1
  8. package/dist/cjs/components/liquidation/liquidation-graph/liquidation-graph.cjs +1 -1
  9. package/dist/cjs/components/next/index.cjs +1 -1
  10. package/dist/cjs/components/next/token-icon.cjs +1 -1
  11. package/dist/cjs/components/page-title/page-title.cjs +1 -1
  12. package/dist/cjs/components/select/select.cjs +1 -1
  13. package/dist/cjs/components/tab-control/tab-control.cjs +1 -1
  14. package/dist/cjs/components/table/grid-error-line.cjs +1 -1
  15. package/dist/cjs/components/token-icon/index.cjs +1 -1
  16. package/dist/cjs/components/token-icon/token-icon.cjs +1 -10
  17. package/dist/cjs/components/typed-intl/index.cjs +1 -1
  18. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  19. package/dist/cjs/index.cjs +1 -1
  20. package/dist/cjs/utils/format-number.cjs +1 -1
  21. package/dist/esm/components/block-sync/block-sync.js +61 -54
  22. package/dist/esm/components/buttons/copy-button/copy-button.js +60 -27
  23. package/dist/esm/components/detailed-page-title/detailed-page-title.js +60 -37
  24. package/dist/esm/components/graph/graph.js +260 -301
  25. package/dist/esm/components/index.js +55 -54
  26. package/dist/esm/components/layout/app-logo/app-logo.js +4 -4
  27. package/dist/esm/components/layout/legal-disclaimer/legal-disclaimer.js +4 -1
  28. package/dist/esm/components/liquidation/liquidation-assets-table/liquidation-assets-table.js +24 -18
  29. package/dist/esm/components/liquidation/liquidation-graph/liquidation-graph.js +114 -100
  30. package/dist/esm/components/next/index.js +10 -8
  31. package/dist/esm/components/next/token-icon.js +4 -5
  32. package/dist/esm/components/page-title/page-title.js +1 -1
  33. package/dist/esm/components/select/select.js +7 -7
  34. package/dist/esm/components/tab-control/tab-control.js +24 -24
  35. package/dist/esm/components/table/grid-error-line.js +1 -1
  36. package/dist/esm/components/token-icon/index.js +3 -2
  37. package/dist/esm/components/token-icon/token-icon.js +42 -75
  38. package/dist/esm/components/typed-intl/index.js +13 -11
  39. package/dist/esm/components/with-copy/with-copy.js +52 -29
  40. package/dist/esm/index.js +169 -168
  41. package/dist/esm/utils/format-number.js +24 -21
  42. package/dist/globals.css +1 -1
  43. package/dist/types/components/buttons/copy-button/copy-button.d.ts +3 -2
  44. package/dist/types/components/detailed-page-title/detailed-page-title.d.ts +0 -1
  45. package/dist/types/components/layout/legal-disclaimer/legal-disclaimer.d.ts +1 -1
  46. package/dist/types/components/liquidation/liquidation-assets-table/liquidation-assets-table.d.ts +1 -1
  47. package/dist/types/components/next/index.d.ts +1 -0
  48. package/dist/types/components/next/token-icon.d.ts +2 -2
  49. package/dist/types/components/token-icon/index.d.ts +1 -1
  50. package/dist/types/components/token-icon/token-icon.d.ts +15 -3
  51. package/dist/types/components/typed-intl/index.d.ts +2 -1
  52. package/dist/types/components/with-copy/with-copy.d.ts +3 -3
  53. package/dist/types/utils/format-number.d.ts +0 -11
  54. package/package.json +1 -1
@@ -1,158 +1,172 @@
1
- import { jsxs as H, jsx as i } from "react/jsx-runtime";
2
- import { useCallback as I } from "react";
3
- import { VSpace as N } from "../../vspace/vspace.js";
4
- import { useHF as Q } from "../../../hooks/use-hf.js";
5
- import { useLiquidationHeatmap as Z } from "../../../hooks/use-liquidation/index.js";
6
- import { XYPlot as ii, XAxis as ei, YAxis as ti, ColorHeatmap as ai, XLine as oi, YLine as ni } from "../../../utils/reactochart-compat.js";
7
- import { LiquidationGraphLegend as ri } from "../liquidation-graph-legend/liquidation-graph-legend.js";
8
- import { LiquidationGraphTip as li } from "../liquidation-graph-tip/liquidation-graph-tip.js";
9
- import { DEFAULT_AXIS_MIN as O, DEFAULT_AXIS_MAX as E, useLiquidationGraphCurrentActiveValue as si, useWithLiquidationGraphActivePrices as ci, useIsAxisInRelativeUnits as F, useLiquidationGraphActivePrice as G, formatAxisLabel as R, formatAxisTipLabel as S, getCellClass as mi } from "../../../hooks/use-liquidation/utils.js";
10
- const ui = 300, xi = 300, hi = "rct-crosshair-x", di = "rct-crosshair-y";
11
- function Ci({
12
- graphParams: T,
13
- assets: d,
14
- liquidationThresholds: v,
15
- quotas: p,
16
- quotasInfo: f,
17
- underlyingToken: l,
18
- debt: L,
1
+ import { jsx as e, jsxs as Y } from "react/jsx-runtime";
2
+ import { useCallback as F } from "react";
3
+ import { FormattedMessageTyped as Q } from "../../typed-intl/index.js";
4
+ import { VSpace as H } from "../../vspace/vspace.js";
5
+ import { useHF as Z } from "../../../hooks/use-hf.js";
6
+ import { useLiquidationHeatmap as ee } from "../../../hooks/use-liquidation/index.js";
7
+ import { XYPlot as ie, XAxis as te, YAxis as ae, ColorHeatmap as oe, XLine as ne, YLine as re } from "../../../utils/reactochart-compat.js";
8
+ import { LiquidationGraphLegend as se } from "../liquidation-graph-legend/liquidation-graph-legend.js";
9
+ import { LiquidationGraphTip as le } from "../liquidation-graph-tip/liquidation-graph-tip.js";
10
+ import { DEFAULT_AXIS_MIN as O, DEFAULT_AXIS_MAX as S, useLiquidationGraphCurrentActiveValue as ce, useWithLiquidationGraphActivePrices as me, useIsAxisInRelativeUnits as T, useLiquidationGraphActivePrice as D, formatAxisLabel as E, formatAxisTipLabel as G, getCellClass as de } from "../../../hooks/use-liquidation/utils.js";
11
+ const ue = 300, xe = 300, he = "rct-crosshair-x", pe = "rct-crosshair-y";
12
+ function Xe({
13
+ graphParams: R,
14
+ assets: f,
15
+ liquidationThresholds: L,
16
+ quotas: A,
17
+ quotasInfo: y,
18
+ underlyingToken: s,
19
+ debt: g,
19
20
  prices: c,
20
21
  tokensList: m,
21
- width: A = ui,
22
- height: _ = xi,
23
- maxLabelLength: k
22
+ width: d = ue,
23
+ height: M = xe,
24
+ maxLabelLength: q
24
25
  }) {
25
- const { xAxis: y, yAxis: M, currentPoint: u } = T, {
26
- min: P = O,
27
- max: b = E,
26
+ const { xAxis: u, yAxis: x, currentPoint: h } = R, {
27
+ min: b = O,
28
+ max: P = S,
28
29
  label: t,
29
- order: x = "straight",
30
- nextOrder: q
31
- } = y || {}, {
30
+ order: p = "straight",
31
+ nextOrder: _
32
+ } = u || {}, {
32
33
  min: C = O,
33
- max: X = E,
34
+ max: X = S,
34
35
  label: a,
35
- order: h = "straight",
36
- nextOrder: D
37
- } = M || {}, U = Z({
38
- xMin: P,
39
- xMax: b,
36
+ order: v = "straight",
37
+ nextOrder: k
38
+ } = x || {}, W = ee({
39
+ xMin: b,
40
+ xMax: P,
40
41
  yMin: C,
41
42
  yMax: X,
42
43
  xLabel: t,
43
44
  yLabel: a,
44
- assets: d,
45
- quotas: p,
45
+ assets: f,
46
+ quotas: A,
46
47
  prices: c,
47
- liquidationThresholds: v,
48
- underlyingTokenAddress: l,
49
- debt: L,
50
- quotasInfo: f,
48
+ liquidationThresholds: L,
49
+ underlyingTokenAddress: s,
50
+ debt: g,
51
+ quotasInfo: y,
51
52
  tokensList: m
52
- }), { activePoint: g, handleMouseLeave: W, handleMouseMove: j } = si(), [o, n] = g || [], V = ci({
53
+ }), { activePoint: w, handleMouseLeave: j, handleMouseMove: U } = ce(), [o, n] = w || [], $ = me({
53
54
  prices: c,
54
- activePoint: g,
55
+ activePoint: w,
55
56
  xLabel: t,
56
57
  yLabel: a
57
- }), $ = Q({
58
- quotas: p,
59
- quotasInfo: f,
60
- assets: d,
61
- prices: V,
62
- liquidationThresholds: v,
63
- underlyingToken: l,
64
- debt: L,
58
+ }), V = Z({
59
+ quotas: A,
60
+ quotasInfo: y,
61
+ assets: f,
62
+ prices: $,
63
+ liquidationThresholds: L,
64
+ underlyingToken: s,
65
+ debt: g,
65
66
  tokensList: m
66
- }), s = c[l] || 1n, r = m[l], w = F(t, r), Y = F(a, r), z = G(
67
- o || u[0],
68
- s,
69
- w,
70
- x
71
- ), B = G(
72
- n || u[1],
73
- s,
74
- Y,
75
- h
76
- ), J = I(
77
- R(s, w, x),
67
+ }), l = c[s] || 1n, r = m[s], N = T(t, r), I = T(a, r), z = D(
68
+ o || h[0],
69
+ l,
70
+ N,
71
+ p
72
+ ), B = D(
73
+ n || h[1],
74
+ l,
75
+ I,
76
+ v
77
+ ), J = F(
78
+ E(l, N, p),
78
79
  []
79
- ), K = I(
80
- R(s, Y, h),
80
+ ), K = F(
81
+ E(l, I, v),
81
82
  []
82
83
  );
83
- return /* @__PURE__ */ H("div", { className: "mx-auto", style: { width: `${A}px`, maxWidth: "100%" }, children: [
84
- /* @__PURE__ */ i("div", { className: "w-full", children: /* @__PURE__ */ i(
85
- li,
84
+ return !u?.label && !x?.label ? /* @__PURE__ */ e(
85
+ "div",
86
+ {
87
+ className: "mx-auto flex items-center justify-center text-sm text-muted-foreground",
88
+ style: { width: `${d}px`, maxWidth: "100%", height: `${M}px` },
89
+ children: /* @__PURE__ */ e(
90
+ Q,
91
+ {
92
+ messageId: "components.creditSessionDetailedLiquidation.graph.noData",
93
+ defaultMessage: "No data"
94
+ }
95
+ )
96
+ }
97
+ ) : /* @__PURE__ */ Y("div", { className: "mx-auto", style: { width: `${d}px`, maxWidth: "100%" }, children: [
98
+ /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ e(
99
+ le,
86
100
  {
87
101
  underlyingToken: r,
88
- hf: $.hf,
89
- xAxis: y,
90
- yAxis: M,
102
+ hf: V.hf,
103
+ xAxis: u,
104
+ yAxis: x,
91
105
  activePointX: z,
92
106
  activePointY: B,
93
- maxLabelLength: k
107
+ maxLabelLength: q
94
108
  }
95
109
  ) }),
96
- /* @__PURE__ */ i(N, { height: 16 }),
97
- /* @__PURE__ */ i("div", { className: "w-full liquidation-graph-container", children: /* @__PURE__ */ H(
98
- ii,
110
+ /* @__PURE__ */ e(H, { height: 16 }),
111
+ /* @__PURE__ */ e("div", { className: "w-full liquidation-graph-container overflow-hidden", children: /* @__PURE__ */ Y(
112
+ ie,
99
113
  {
100
- width: A,
101
- height: _,
102
- xDomain: [P, b],
114
+ width: d,
115
+ height: M,
116
+ xDomain: [b, P],
103
117
  yDomain: [C, X],
104
- onMouseMove: j,
105
- onMouseLeave: W,
118
+ onMouseMove: U,
119
+ onMouseLeave: j,
106
120
  children: [
107
- /* @__PURE__ */ i(
108
- ei,
121
+ /* @__PURE__ */ e(
122
+ te,
109
123
  {
110
124
  showLine: !1,
111
- title: S(t, r, x),
125
+ title: G(t, r, p),
112
126
  titleAlign: "right",
113
127
  tickCount: 5,
114
128
  labelFormat: J,
115
129
  showLabels: !!t,
116
130
  showTicks: !!t,
117
- onMouseClickAxis: q,
131
+ onMouseClickAxis: _,
118
132
  nice: !1
119
133
  }
120
134
  ),
121
- /* @__PURE__ */ i(
122
- ti,
135
+ /* @__PURE__ */ e(
136
+ ae,
123
137
  {
124
138
  showLine: !1,
125
- title: S(a, r, h),
139
+ title: G(a, r, v),
126
140
  titleAlign: "top",
127
141
  tickCount: 5,
128
142
  labelFormat: K,
129
143
  showLabels: !!a,
130
144
  showTicks: !!a,
131
- onMouseClickAxis: D,
145
+ onMouseClickAxis: k,
132
146
  nice: !1
133
147
  }
134
148
  ),
135
- /* @__PURE__ */ i(
136
- ai,
149
+ /* @__PURE__ */ e(
150
+ oe,
137
151
  {
138
- data: U,
139
- value: (e) => e.value,
140
- x: (e) => e.x,
141
- xEnd: (e) => e.xEnd,
142
- y: (e) => e.y,
143
- yEnd: (e) => e.yEnd,
144
- rectClassName: (e) => mi(e, u, o, n)
152
+ data: W,
153
+ value: (i) => i.value,
154
+ x: (i) => i.x,
155
+ xEnd: (i) => i.xEnd,
156
+ y: (i) => i.y,
157
+ yEnd: (i) => i.yEnd,
158
+ rectClassName: (i) => de(i, h, o, n)
145
159
  }
146
160
  ),
147
- o != null && /* @__PURE__ */ i(oi, { value: o, className: hi }),
148
- n != null && /* @__PURE__ */ i(ni, { value: n, className: di })
161
+ o != null && /* @__PURE__ */ e(ne, { value: o, className: he }),
162
+ n != null && /* @__PURE__ */ e(re, { value: n, className: pe })
149
163
  ]
150
164
  }
151
165
  ) }),
152
- /* @__PURE__ */ i(N, { height: 12 }),
153
- /* @__PURE__ */ i("div", { className: "w-full", children: /* @__PURE__ */ i(ri, {}) })
166
+ /* @__PURE__ */ e(H, { height: 12 }),
167
+ /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ e(se, {}) })
154
168
  ] });
155
169
  }
156
170
  export {
157
- Ci as LiquidationGraph
171
+ Xe as LiquidationGraph
158
172
  };
@@ -1,12 +1,14 @@
1
1
  import { SignInRequired as e } from "../auth/signin-required.js";
2
- import { BackButton as n } from "./back-button.js";
3
- import { NextMarkdownViewer as f } from "./next-markdown-viewer.js";
4
- import { SIWEClientProvider as m } from "./siwe-provider.js";
5
- import { TokenIcon as d } from "./token-icon.js";
2
+ import { preloadTokenIcons as n } from "../token-icon/token-icon.js";
3
+ import { BackButton as x } from "./back-button.js";
4
+ import { NextMarkdownViewer as m } from "./next-markdown-viewer.js";
5
+ import { SIWEClientProvider as d } from "./siwe-provider.js";
6
+ import { TokenIcon as I } from "./token-icon.js";
6
7
  export {
7
- n as BackButton,
8
- f as NextMarkdownViewer,
9
- m as SIWEClientProvider,
8
+ x as BackButton,
9
+ m as NextMarkdownViewer,
10
+ d as SIWEClientProvider,
10
11
  e as SignInRequired,
11
- d as TokenIcon
12
+ I as TokenIcon,
13
+ n as preloadTokenIcons
12
14
  };
@@ -1,9 +1,8 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import e from "next/image";
3
- import { TokenIcon as m } from "../token-icon/token-icon.js";
4
- function I(o) {
5
- return /* @__PURE__ */ n(m, { ...o, ImageComponent: e });
2
+ import { TokenIcon as r } from "../token-icon/token-icon.js";
3
+ function c(o) {
4
+ return /* @__PURE__ */ n(r, { ...o });
6
5
  }
7
6
  export {
8
- I as TokenIcon
7
+ c as TokenIcon
9
8
  };
@@ -69,7 +69,7 @@ const h = s(
69
69
  m && /* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground mt-1", children: m })
70
70
  ] })
71
71
  ] }),
72
- i && /* @__PURE__ */ e("div", { className: "shrink-0 flex items-center gap-2 ml-auto md:ml-auto", children: i })
72
+ i && /* @__PURE__ */ e("div", { className: "shrink-0 flex items-center gap-2 md:ml-auto", children: i })
73
73
  ] }) })
74
74
  ] })
75
75
  );
@@ -1,15 +1,15 @@
1
1
  import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
2
  import * as e from "@radix-ui/react-select";
3
3
  import { cva as u } from "class-variance-authority";
4
- import { ChevronDown as c, ChevronUp as h, Check as b } from "lucide-react";
4
+ import { ChevronDown as c, ChevronUp as h, Check as g } from "lucide-react";
5
5
  import * as l from "react";
6
6
  import { cn as s } from "../../utils/cn.js";
7
7
  import "sonner";
8
8
  import "@gearbox-protocol/sdk";
9
- const g = (a) => /* @__PURE__ */ t(e.Root, { ...a });
10
- g.displayName = "Select";
9
+ const b = (a) => /* @__PURE__ */ t(e.Root, { ...a });
10
+ b.displayName = "Select";
11
11
  const T = e.Group, V = e.Value, y = u(
12
- "flex w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 bg-[rgb(40,40,40)] text-foreground cursor-pointer",
12
+ "group flex w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 bg-[rgb(40,40,40)] text-foreground cursor-pointer",
13
13
  {
14
14
  variants: {
15
15
  size: {
@@ -36,7 +36,7 @@ const T = e.Group, V = e.Value, y = u(
36
36
  ...n,
37
37
  children: [
38
38
  o,
39
- /* @__PURE__ */ t(e.Icon, { asChild: !0, children: /* @__PURE__ */ t(c, { className: "h-4 w-4 opacity-50" }) })
39
+ /* @__PURE__ */ t(e.Icon, { asChild: !0, children: /* @__PURE__ */ t(c, { className: "h-4 w-4 opacity-50 transition-transform duration-200 group-data-[state=open]:rotate-180" }) })
40
40
  ]
41
41
  }
42
42
  ));
@@ -114,7 +114,7 @@ const S = l.forwardRef(({ className: a, children: o, ...r }, d) => /* @__PURE__
114
114
  ),
115
115
  ...r,
116
116
  children: [
117
- /* @__PURE__ */ t("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(e.ItemIndicator, { children: /* @__PURE__ */ t(b, { className: "h-4 w-4" }) }) }),
117
+ /* @__PURE__ */ t("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(e.ItemIndicator, { children: /* @__PURE__ */ t(g, { className: "h-4 w-4" }) }) }),
118
118
  /* @__PURE__ */ t(e.ItemText, { children: o })
119
119
  ]
120
120
  }
@@ -130,7 +130,7 @@ const v = l.forwardRef(({ className: a, ...o }, r) => /* @__PURE__ */ t(
130
130
  ));
131
131
  v.displayName = e.Separator.displayName;
132
132
  export {
133
- g as Select,
133
+ b as Select,
134
134
  x as SelectContent,
135
135
  T as SelectGroup,
136
136
  S as SelectItem,
@@ -1,4 +1,4 @@
1
- import { jsxs as C, jsx as f, Fragment as S } from "react/jsx-runtime";
1
+ import { jsx as f, jsxs as C, Fragment as S } from "react/jsx-runtime";
2
2
  import { useRef as h, useState as v, useCallback as m, useMemo as w, useEffect as T } from "react";
3
3
  import { useLocation as U, useNavigate as N } from "react-router-dom";
4
4
  import { cn as b } from "../../utils/cn.js";
@@ -44,27 +44,27 @@ function q({
44
44
  c.current,
45
45
  d
46
46
  ), e = (n, a) => () => t.handleTabChange(n, a);
47
- return /* @__PURE__ */ C("div", { className: "relative w-full flex flex-col border-b border-border", children: [
48
- l && /* @__PURE__ */ f(
49
- "div",
50
- {
51
- className: "absolute bottom-[-1px] left-0 h-[3px] bg-primary transition-transform duration-200 ease-in-out",
52
- style: {
53
- width: `${l.width}px`,
54
- transform: `translate(${l.left}px)`
55
- }
56
- }
57
- ),
58
- /* @__PURE__ */ f(
59
- "div",
60
- {
61
- ref: c,
62
- className: b(
63
- "relative bottom-[-1px] flex items-stretch gap-3 overflow-x-auto overflow-y-hidden w-full",
64
- "navbar-scrollbar",
65
- i && "border-b border-border"
47
+ return /* @__PURE__ */ f("div", { className: "relative w-full flex flex-col border-b border-border", children: /* @__PURE__ */ C(
48
+ "div",
49
+ {
50
+ ref: c,
51
+ className: b(
52
+ "relative bottom-[-1px] flex items-stretch gap-3 overflow-x-auto overflow-y-hidden w-full",
53
+ "navbar-scrollbar",
54
+ i && "border-b border-border"
55
+ ),
56
+ children: [
57
+ l && /* @__PURE__ */ f(
58
+ "div",
59
+ {
60
+ className: "absolute bottom-[-1px] left-0 h-[3px] bg-primary transition-transform duration-200 ease-in-out pointer-events-none",
61
+ style: {
62
+ width: `${l.width}px`,
63
+ transform: `translate(${l.left}px)`
64
+ }
65
+ }
66
66
  ),
67
- children: r.map((n, a, u) => {
67
+ r.map((n, a, u) => {
68
68
  const p = n.id === t.id, x = a === u.length - 1;
69
69
  return /* @__PURE__ */ f(
70
70
  "button",
@@ -88,9 +88,9 @@ function q({
88
88
  `tab-item-${n.id}`
89
89
  );
90
90
  })
91
- }
92
- )
93
- ] });
91
+ ]
92
+ }
93
+ ) });
94
94
  }
95
95
  function B({
96
96
  icon: r,
@@ -9,7 +9,7 @@ function C({
9
9
  btnTitle: i,
10
10
  onClick: s,
11
11
  last: n = !0,
12
- height: a = "75px"
12
+ height: a = "100px"
13
13
  }) {
14
14
  return /* @__PURE__ */ e(
15
15
  "div",
@@ -1,4 +1,5 @@
1
- import { TokenIcon as n } from "./token-icon.js";
1
+ import { TokenIcon as n, preloadTokenIcons as r } from "./token-icon.js";
2
2
  export {
3
- n as TokenIcon
3
+ n as TokenIcon,
4
+ r as preloadTokenIcons
4
5
  };
@@ -1,80 +1,47 @@
1
- import { jsxs as h, jsx as o } from "react/jsx-runtime";
2
- import { useState as i } from "react";
3
- import { Image as f } from "../image/image.js";
4
- import { cn as u } from "../../utils/cn.js";
5
- function k({
6
- symbol: a,
7
- size: t = 48,
8
- className: r,
9
- ImageComponent: n = f
10
- }) {
11
- const s = a.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase(), c = "https://static.gearbox.fi/tokens/default.svg", [l, p] = i(
12
- `https://static.gearbox.fi/tokens/${s}.svg`
13
- ), [e, d] = i(!0);
14
- return /* @__PURE__ */ h(
15
- "div",
16
- {
17
- style: {
18
- width: t,
19
- height: t,
20
- position: "relative",
21
- display: "inline-block",
22
- border: "none"
23
- },
24
- children: [
25
- e && /* @__PURE__ */ o(
26
- "div",
27
- {
28
- style: {
29
- width: t,
30
- height: t,
31
- borderRadius: "50%",
32
- backgroundColor: "#9ca3af",
33
- position: "absolute",
34
- top: 0,
35
- left: 0,
36
- animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
37
- }
38
- }
39
- ),
40
- /* @__PURE__ */ o(
41
- "div",
42
- {
43
- style: {
44
- width: t,
45
- height: t,
46
- position: "relative",
47
- opacity: e ? 0 : 1,
48
- transition: "opacity 0.3s ease-in-out"
49
- },
50
- children: /* @__PURE__ */ o(
51
- n,
52
- {
53
- src: l,
54
- alt: "",
55
- width: t,
56
- height: t,
57
- className: u("w-full h-full object-contain block", r),
58
- onError: () => p(c),
59
- onLoad: () => d(!1)
60
- }
61
- )
62
- }
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;
10
+ }
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);
16
+ };
17
+ return (
18
+ // biome-ignore lint/performance/noImgElement: Simple img for CDN icons with browser caching
19
+ /* @__PURE__ */ p(
20
+ "img",
21
+ {
22
+ src: o,
23
+ alt: "",
24
+ width: e,
25
+ height: e,
26
+ className: m(
27
+ "object-contain rounded-full",
28
+ !f && "bg-gray-200 dark:bg-gray-700",
29
+ r
63
30
  ),
64
- /* @__PURE__ */ o("style", { children: `
65
- @keyframes pulse {
66
- 0%, 100% {
67
- opacity: 1;
68
- }
69
- 50% {
70
- opacity: 0.5;
71
- }
72
- }
73
- ` })
74
- ]
75
- }
31
+ style: { width: e, height: e },
32
+ onError: u,
33
+ onLoad: g
34
+ }
35
+ )
76
36
  );
77
37
  }
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;
42
+ });
43
+ }
78
44
  export {
79
- k as TokenIcon
45
+ I as TokenIcon,
46
+ x as preloadTokenIcons
80
47
  };
@@ -1,25 +1,27 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useCallback as s, useMemo as a } from "react";
3
- import { FormattedMessage as i, useIntl as m } from "react-intl";
4
- const d = (e) => /* @__PURE__ */ o("strong", { children: e });
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useCallback as a, useMemo as i } from "react";
3
+ import { FormattedMessage as m, useIntl as d } from "react-intl";
4
+ const l = (e) => /* @__PURE__ */ r("strong", { children: e });
5
5
  function f({
6
6
  messageId: e,
7
- values: t
7
+ values: t,
8
+ defaultMessage: o
8
9
  }) {
9
- return /* @__PURE__ */ o(
10
- i,
10
+ return /* @__PURE__ */ r(
11
+ m,
11
12
  {
12
13
  id: e,
13
- values: { strong: d, ...t }
14
+ defaultMessage: o,
15
+ values: { strong: l, ...t }
14
16
  }
15
17
  );
16
18
  }
17
19
  function g() {
18
- const e = m(), t = s(
19
- ({ messageId: r }, n) => e.formatMessage({ id: r }, n),
20
+ const e = d(), t = a(
21
+ ({ messageId: n }, s) => e.formatMessage({ id: n }, s),
20
22
  [e]
21
23
  );
22
- return a(
24
+ return i(
23
25
  () => ({ formatMessage: t, intl: e }),
24
26
  [e, t]
25
27
  );