@gearbox-protocol/ui-kit 3.14.0-next.65 → 3.14.0-next.67

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 (141) 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/block-sync-pill/block-sync-pill.cjs +1 -1
  4. package/dist/cjs/components/breakpoint-provider.cjs +1 -0
  5. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  6. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  7. package/dist/cjs/components/complex-input/complex-input.cjs +1 -1
  8. package/dist/cjs/components/composites/index.cjs +1 -1
  9. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-head.cjs +1 -1
  10. package/dist/cjs/components/composites/pool-credit-managers-table/pool-credit-managers-table-head.cjs +1 -1
  11. package/dist/cjs/components/composites/pool-table/columns.cjs +1 -1
  12. package/dist/cjs/components/composites/strategies-table/columns.cjs +1 -1
  13. package/dist/cjs/components/composites/strategies-table/components/cells/cells.cjs +1 -1
  14. package/dist/cjs/components/composites/strategies-table/components/cells/index.cjs +1 -1
  15. package/dist/cjs/components/composites/strategies-table/components/index.cjs +1 -1
  16. package/dist/cjs/components/composites/strategies-table/components/points-feature/points-feature.cjs +1 -1
  17. package/dist/cjs/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.cjs +1 -1
  18. package/dist/cjs/components/composites/strategies-table/components/strategies-table.cjs +1 -1
  19. package/dist/cjs/components/composites/strategies-table/index.cjs +1 -1
  20. package/dist/cjs/components/composites/strategies-table/types/index.cjs +1 -1
  21. package/dist/cjs/components/composites/strategies-table/types/rewards-cell.cjs +1 -0
  22. package/dist/cjs/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.cjs +1 -1
  23. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.cjs +1 -1
  24. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.cjs +1 -1
  25. package/dist/cjs/components/composites/tx-preview/confirm/result/TransactionConfirmFailureResult.cjs +1 -1
  26. package/dist/cjs/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessResult.cjs +1 -1
  27. package/dist/cjs/components/compound-apy/compound-apy-legacy.cjs +1 -0
  28. package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
  29. package/dist/cjs/components/compound-apy/index.cjs +1 -1
  30. package/dist/cjs/components/detailed-page-title/detailed-page-title.cjs +1 -1
  31. package/dist/cjs/components/index.cjs +1 -1
  32. package/dist/cjs/components/markdown-viewer/markdown-viewer.cjs +1 -1
  33. package/dist/cjs/components/pool-apy-tooltip/apy-tooltip.cjs +1 -0
  34. package/dist/cjs/components/pool-apy-tooltip/index.cjs +1 -1
  35. package/dist/cjs/components/pool-apy-tooltip/pool-apy-tooltip.cjs +1 -1
  36. package/dist/cjs/components/time-to-liquidation/time-to-liquidation.cjs +1 -1
  37. package/dist/cjs/components/token-icon/token-icon.cjs +1 -1
  38. package/dist/cjs/components/token-symbol/index.cjs +1 -1
  39. package/dist/cjs/components/token-symbol/token-symbol.cjs +1 -1
  40. package/dist/cjs/components/tokens-list-cell/tokens-list-cell.cjs +1 -1
  41. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  42. package/dist/cjs/components/yield-breakdown-tooltip/index.cjs +1 -0
  43. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -0
  44. package/dist/cjs/hooks/use-debounce-call.cjs +1 -1
  45. package/dist/cjs/hooks/use-media-query.cjs +1 -1
  46. package/dist/cjs/index.cjs +1 -1
  47. package/dist/cjs/locale/en.json.cjs +1 -1
  48. package/dist/cjs/types/common.cjs +1 -1
  49. package/dist/cjs/utils/apy-breakdown.cjs +1 -0
  50. package/dist/cjs/utils/bps.cjs +1 -0
  51. package/dist/cjs/utils/index.cjs +1 -1
  52. package/dist/cjs/utils/token-icon-source.cjs +1 -0
  53. package/dist/esm/components/assets-list-cell/assets-list-cell.js +132 -206
  54. package/dist/esm/components/block-sync/block-sync.js +5 -4
  55. package/dist/esm/components/block-sync-pill/block-sync-pill.js +5 -4
  56. package/dist/esm/components/breakpoint-provider.js +67 -0
  57. package/dist/esm/components/checkbox/checkbox-labeled.js +3 -2
  58. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +3 -2
  59. package/dist/esm/components/complex-input/complex-input.js +5 -4
  60. package/dist/esm/components/composites/index.js +86 -81
  61. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-head.js +3 -2
  62. package/dist/esm/components/composites/pool-credit-managers-table/pool-credit-managers-table-head.js +3 -2
  63. package/dist/esm/components/composites/pool-table/columns.js +61 -60
  64. package/dist/esm/components/composites/strategies-table/columns.js +55 -86
  65. package/dist/esm/components/composites/strategies-table/components/cells/cells.js +150 -110
  66. package/dist/esm/components/composites/strategies-table/components/cells/index.js +7 -5
  67. package/dist/esm/components/composites/strategies-table/components/index.js +32 -30
  68. package/dist/esm/components/composites/strategies-table/components/points-feature/points-feature.js +35 -32
  69. package/dist/esm/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.js +91 -224
  70. package/dist/esm/components/composites/strategies-table/components/strategies-table.js +26 -24
  71. package/dist/esm/components/composites/strategies-table/index.js +36 -31
  72. package/dist/esm/components/composites/strategies-table/types/index.js +5 -1
  73. package/dist/esm/components/composites/strategies-table/types/rewards-cell.js +40 -0
  74. package/dist/esm/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.js +32 -189
  75. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.js +5 -4
  76. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.js +26 -26
  77. package/dist/esm/components/composites/tx-preview/confirm/result/TransactionConfirmFailureResult.js +40 -38
  78. package/dist/esm/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessResult.js +53 -47
  79. package/dist/esm/components/compound-apy/compound-apy-legacy.js +127 -0
  80. package/dist/esm/components/compound-apy/compound-apy.js +56 -245
  81. package/dist/esm/components/compound-apy/index.js +4 -2
  82. package/dist/esm/components/detailed-page-title/detailed-page-title.js +25 -180
  83. package/dist/esm/components/index.js +805 -787
  84. package/dist/esm/components/markdown-viewer/markdown-viewer.js +5 -4
  85. package/dist/esm/components/pool-apy-tooltip/apy-tooltip.js +155 -0
  86. package/dist/esm/components/pool-apy-tooltip/index.js +4 -2
  87. package/dist/esm/components/pool-apy-tooltip/pool-apy-tooltip.js +3 -3
  88. package/dist/esm/components/time-to-liquidation/time-to-liquidation.js +3 -2
  89. package/dist/esm/components/token-icon/token-icon.js +72 -58
  90. package/dist/esm/components/token-symbol/index.js +2 -3
  91. package/dist/esm/components/token-symbol/token-symbol.js +41 -62
  92. package/dist/esm/components/tokens-list-cell/tokens-list-cell.js +35 -192
  93. package/dist/esm/components/with-copy/with-copy.js +5 -4
  94. package/dist/esm/components/yield-breakdown-tooltip/index.js +4 -0
  95. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +222 -0
  96. package/dist/esm/hooks/use-debounce-call.js +3 -2
  97. package/dist/esm/hooks/use-media-query.js +49 -16
  98. package/dist/esm/index.js +974 -946
  99. package/dist/esm/locale/en.json.js +9 -2
  100. package/dist/esm/types/common.js +1 -6
  101. package/dist/esm/utils/apy-breakdown.js +18 -0
  102. package/dist/esm/utils/bps.js +4 -0
  103. package/dist/esm/utils/index.js +105 -95
  104. package/dist/esm/utils/token-icon-source.js +48 -0
  105. package/dist/globals.css +1 -1
  106. package/dist/types/components/assets-list-cell/assets-list-cell.d.ts +44 -4
  107. package/dist/types/components/breakpoint-provider.d.ts +56 -0
  108. package/dist/types/components/composites/pool-table/pool-table-backend-contract.types.d.ts +1 -1
  109. package/dist/types/components/composites/strategies-table/components/cells/cells.d.ts +34 -3
  110. package/dist/types/components/composites/strategies-table/components/points-feature/points-feature.d.ts +14 -10
  111. package/dist/types/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.d.ts +10 -13
  112. package/dist/types/components/composites/strategies-table/index.d.ts +1 -1
  113. package/dist/types/components/composites/strategies-table/types/index.d.ts +1 -0
  114. package/dist/types/components/composites/strategies-table/types/rewards-cell.d.ts +48 -0
  115. package/dist/types/components/composites/strategies-table/types/rewards-tooltip.d.ts +37 -32
  116. package/dist/types/components/composites/strategies-table/types/table.d.ts +27 -12
  117. package/dist/types/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.d.ts +3 -3
  118. package/dist/types/components/composites/tx-preview/confirm/result/TransactionConfirmFailureResult.d.ts +4 -0
  119. package/dist/types/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessResult.d.ts +5 -0
  120. package/dist/types/components/compound-apy/compound-apy-legacy.d.ts +109 -0
  121. package/dist/types/components/compound-apy/compound-apy.d.ts +18 -94
  122. package/dist/types/components/compound-apy/index.d.ts +1 -0
  123. package/dist/types/components/index.d.ts +3 -1
  124. package/dist/types/components/points-icon/index.d.ts +1 -1
  125. package/dist/types/components/points-icon/points-icon.d.ts +13 -2
  126. package/dist/types/components/pool-apy-tooltip/apy-tooltip.d.ts +20 -0
  127. package/dist/types/components/pool-apy-tooltip/index.d.ts +1 -0
  128. package/dist/types/components/pool-apy-tooltip/pool-apy-tooltip.d.ts +18 -1
  129. package/dist/types/components/token-icon/token-icon.d.ts +11 -2
  130. package/dist/types/components/token-symbol/token-symbol.d.ts +4 -4
  131. package/dist/types/components/yield-breakdown-tooltip/index.d.ts +1 -0
  132. package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +32 -0
  133. package/dist/types/hooks/use-media-query.d.ts +5 -1
  134. package/dist/types/index.d.ts +2 -0
  135. package/dist/types/locale/en.json.d.ts +10 -2
  136. package/dist/types/types/common.d.ts +5 -11
  137. package/dist/types/utils/apy-breakdown.d.ts +18 -0
  138. package/dist/types/utils/bps.d.ts +3 -0
  139. package/dist/types/utils/index.d.ts +3 -0
  140. package/dist/types/utils/token-icon-source.d.ts +28 -0
  141. package/package.json +2 -2
@@ -45,6 +45,7 @@ import "../auth/wallet-ui-context.js";
45
45
  import "../avatar/avatar.js";
46
46
  import "../badge/badge.js";
47
47
  import "../navigation-context/navigation-context.js";
48
+ import "../breakpoint-provider.js";
48
49
  import "../button-checkbox/button-checkbox.js";
49
50
  import "../card-grid/card-grid.js";
50
51
  import "../cards/card/card.js";
@@ -73,13 +74,12 @@ import "../dialog/dialog-modal-container.js";
73
74
  import "../text-button/text-button.js";
74
75
  import "../vertical-indicator/vertical-indicator.js";
75
76
  import "../points-icon/points-icon.js";
76
- import "../skeleton/skeleton.js";
77
77
  import "../vertical-list/vertical-list.js";
78
+ import "../skeleton/skeleton.js";
78
79
  import "../rounded-image/rounded-image.js";
79
80
  import "../progress/progress.js";
80
81
  import "../pool-indicator-icon/pool-indicator-icon.js";
81
82
  import "../composites/strategies-table/components/feature/feature.styles.js";
82
- import "viem";
83
83
  import "../icon-button/icon-button.js";
84
84
  import "../separate-line/separate-line.js";
85
85
  import "../tip-card/tip-card.js";
@@ -101,6 +101,7 @@ import "../dialog/dialog-footer.js";
101
101
  import "../dialog/dialog-header.js";
102
102
  import "../dialog/dialog-title.js";
103
103
  import "../dialog/dialog-overlay.js";
104
+ import "viem";
104
105
  import "../label/label.js";
105
106
  import "../dropdown-menu/dropdown-menu.js";
106
107
  import "../dropdown-menu/dropdown-menu-checkbox-item.js";
@@ -187,7 +188,7 @@ function a(o) {
187
188
  }
188
189
  return { id: T(l), displayText: o };
189
190
  }
190
- function Vr({
191
+ function Br({
191
192
  content: o,
192
193
  title: l,
193
194
  backButton: s,
@@ -399,5 +400,5 @@ function Vr({
399
400
  return c ? d : /* @__PURE__ */ r(w, { title: l || "", backButton: s, children: d });
400
401
  }
401
402
  export {
402
- Vr as MarkdownViewer
403
+ Br as MarkdownViewer
403
404
  };
@@ -0,0 +1,155 @@
1
+ import { jsxs as r, jsx as e, Fragment as x } from "react/jsx-runtime";
2
+ import { faPlus as u } from "@fortawesome/free-solid-svg-icons";
3
+ import { FaIcon as h } from "../icons/fa-icon.js";
4
+ import { PointsIcon as y } from "../points-icon/points-icon.js";
5
+ import { TokenIcon as g } from "../token-icon/token-icon.js";
6
+ import { SimpleTooltip as v } from "../tooltip/simple-tooltip.js";
7
+ import "../tooltip/tooltip.js";
8
+ import { FormattedMessageTyped as o } from "../typed-intl/index.js";
9
+ import { VerticalIndicator as i } from "../vertical-indicator/vertical-indicator.js";
10
+ import { VerticalList as a } from "../vertical-list/vertical-list.js";
11
+ import "react";
12
+ import { positiveTokenRewardsOf as P, pointProgramsOf as N, totalApyOf as A } from "../../utils/apy-breakdown.js";
13
+ import "@gearbox-protocol/sdk";
14
+ import { bpsToPercent as l } from "../../utils/bps.js";
15
+ import { cn as d } from "../../utils/cn.js";
16
+ import "sonner";
17
+ import { percentTemplate as m } from "../../utils/format-money.js";
18
+ import "@gearbox-protocol/sdk/common-utils";
19
+ import "luxon";
20
+ import "../../utils/z-index.js";
21
+ function D({ apy: s, children: c, className: n }) {
22
+ const f = P(s), p = N(s), b = /* @__PURE__ */ r(
23
+ "div",
24
+ {
25
+ className: d(
26
+ "w-[370px] max-w-[calc(100vw-32px)] p-6",
27
+ "bg-popover",
28
+ "border border-border",
29
+ "rounded-lg",
30
+ "shadow-[0_4px_28px_4px_rgba(0,0,0,0.15)]",
31
+ "text-left font-normal"
32
+ ),
33
+ children: [
34
+ /* @__PURE__ */ r(a, { children: [
35
+ /* @__PURE__ */ e(
36
+ i,
37
+ {
38
+ size: "sm",
39
+ label: /* @__PURE__ */ e(
40
+ o,
41
+ {
42
+ messageId: "components.apyParts.supplyAPY"
43
+ }
44
+ ),
45
+ description: /* @__PURE__ */ e(
46
+ o,
47
+ {
48
+ messageId: "components.apyParts.supplyAPY.tip"
49
+ }
50
+ ),
51
+ value: m(l(s.organicApy))
52
+ }
53
+ ),
54
+ f.map((t) => /* @__PURE__ */ e(
55
+ i,
56
+ {
57
+ size: "sm",
58
+ label: /* @__PURE__ */ r("span", { className: "inline-flex items-center", children: [
59
+ /* @__PURE__ */ e(
60
+ o,
61
+ {
62
+ messageId: "components.apyParts.extraAPY",
63
+ values: { symbol: t.token.symbol }
64
+ }
65
+ ),
66
+ /* @__PURE__ */ e("span", { className: "ml-1 inline-flex", children: /* @__PURE__ */ e(g, { token: t.token, size: 14 }) })
67
+ ] }),
68
+ description: /* @__PURE__ */ e(
69
+ o,
70
+ {
71
+ messageId: "components.apyParts.extraAPY.tip"
72
+ }
73
+ ),
74
+ value: m(l(t.supplyApr ?? 0))
75
+ },
76
+ `extra-${t.token.address}-${t.supplyApr ?? 0}`
77
+ ))
78
+ ] }),
79
+ /* @__PURE__ */ e("div", { className: "my-5 border-t border-border" }),
80
+ /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(
81
+ i,
82
+ {
83
+ size: "sm",
84
+ label: /* @__PURE__ */ e("span", { className: "font-bold", children: /* @__PURE__ */ e(
85
+ o,
86
+ {
87
+ messageId: "components.apyParts.totalAPY"
88
+ }
89
+ ) }),
90
+ value: m(l(A(s)))
91
+ }
92
+ ) }),
93
+ p.length > 0 && /* @__PURE__ */ r(x, { children: [
94
+ /* @__PURE__ */ e("div", { className: "relative my-2.5 mx-6 border-t-2 border-border", children: /* @__PURE__ */ e(
95
+ "div",
96
+ {
97
+ className: d(
98
+ "absolute -top-2.5 left-1/2 -translate-x-1/2",
99
+ "w-5 h-5",
100
+ "flex items-center justify-center",
101
+ "rounded-full",
102
+ "bg-gray-20"
103
+ ),
104
+ children: /* @__PURE__ */ e(h, { icon: u, className: "size-2.5 text-white" })
105
+ }
106
+ ) }),
107
+ /* @__PURE__ */ e("div", { className: "h-6" }),
108
+ /* @__PURE__ */ e(a, { children: p.map((t) => /* @__PURE__ */ e(
109
+ i,
110
+ {
111
+ size: "sm",
112
+ label: /* @__PURE__ */ r("span", { className: "inline-flex items-center", children: [
113
+ /* @__PURE__ */ e(
114
+ o,
115
+ {
116
+ messageId: "components.apyParts.points",
117
+ values: { symbol: t.name }
118
+ }
119
+ ),
120
+ /* @__PURE__ */ e("span", { className: "ml-2 inline-flex", children: /* @__PURE__ */ e(
121
+ y,
122
+ {
123
+ reward: {
124
+ name: t.name,
125
+ type: t.id
126
+ },
127
+ size: 16
128
+ }
129
+ ) })
130
+ ] }),
131
+ value: t.multiplier != null ? `${t.multiplier}x` : "—"
132
+ },
133
+ `points-${t.id}`
134
+ )) })
135
+ ] })
136
+ ]
137
+ }
138
+ );
139
+ return /* @__PURE__ */ e(
140
+ v,
141
+ {
142
+ placement: "bottom",
143
+ triangle: !1,
144
+ type: "modal-tooltip",
145
+ minWidth: "100%",
146
+ maxWidth: "100%",
147
+ title: /* @__PURE__ */ e("span", { className: n, children: c }),
148
+ triggerClassName: n,
149
+ children: b
150
+ }
151
+ );
152
+ }
153
+ export {
154
+ D as ApyTooltip
155
+ };
@@ -1,4 +1,6 @@
1
- import { PoolAPYTooltip as p } from "./pool-apy-tooltip.js";
1
+ import { ApyTooltip as r } from "./apy-tooltip.js";
2
+ import { PoolAPYTooltip as l } from "./pool-apy-tooltip.js";
2
3
  export {
3
- p as PoolAPYTooltip
4
+ r as ApyTooltip,
5
+ l as PoolAPYTooltip
4
6
  };
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as n, Fragment as b } from "react/jsx-runtime";
2
2
  import { faPlus as P } from "@fortawesome/free-solid-svg-icons";
3
3
  import { IconLighting as T } from "@gearbox-protocol/static";
4
- import { getRewardTokenSymbol as k } from "../compound-apy/compound-apy.js";
4
+ import { getRewardTokenSymbol as k } from "../compound-apy/compound-apy-legacy.js";
5
5
  import { FaIcon as S } from "../icons/fa-icon.js";
6
6
  import { PointsIcon as _ } from "../points-icon/points-icon.js";
7
7
  import { Skeleton as z } from "../skeleton/skeleton.js";
@@ -110,7 +110,7 @@ function oe({
110
110
  /* @__PURE__ */ e("span", { className: "ml-1 inline-flex", children: /* @__PURE__ */ e(
111
111
  C,
112
112
  {
113
- symbol: k(l, t.rewardTokenSymbol),
113
+ token: k(l, t.rewardTokenSymbol),
114
114
  size: 14
115
115
  }
116
116
  ) })
@@ -185,7 +185,7 @@ function oe({
185
185
  "div",
186
186
  {
187
187
  className: u(
188
- "absolute -top-[10px] left-0",
188
+ "absolute -top-[10px] left-1/2 -translate-x-1/2",
189
189
  "w-5 h-5",
190
190
  "flex items-center justify-center",
191
191
  "rounded-full",
@@ -33,6 +33,7 @@ import "../avatar/avatar.js";
33
33
  import "../badge/badge.js";
34
34
  import "../base-link/base-link.js";
35
35
  import "../navigation-context/navigation-context.js";
36
+ import "../breakpoint-provider.js";
36
37
  import "../button-checkbox/button-checkbox.js";
37
38
  import "../card-grid/card-grid.js";
38
39
  import "../cards/card/card.js";
@@ -61,13 +62,12 @@ import "../dialog/dialog-modal-container.js";
61
62
  import "../text-button/text-button.js";
62
63
  import "../vertical-indicator/vertical-indicator.js";
63
64
  import "../points-icon/points-icon.js";
64
- import "../skeleton/skeleton.js";
65
65
  import "../vertical-list/vertical-list.js";
66
+ import "../skeleton/skeleton.js";
66
67
  import "../rounded-image/rounded-image.js";
67
68
  import "../progress/progress.js";
68
69
  import "../pool-indicator-icon/pool-indicator-icon.js";
69
70
  import "../composites/strategies-table/components/feature/feature.styles.js";
70
- import "viem";
71
71
  import "../icon-button/icon-button.js";
72
72
  import "../separate-line/separate-line.js";
73
73
  import "../tip-card/tip-card.js";
@@ -89,6 +89,7 @@ import "../dialog/dialog-footer.js";
89
89
  import "../dialog/dialog-header.js";
90
90
  import "../dialog/dialog-title.js";
91
91
  import "../dialog/dialog-overlay.js";
92
+ import "viem";
92
93
  import "../label/label.js";
93
94
  import "../dropdown-menu/dropdown-menu.js";
94
95
  import "../dropdown-menu/dropdown-menu-checkbox-item.js";
@@ -1,80 +1,94 @@
1
- import { jsx as r, jsxs as S, Fragment as _ } from "react/jsx-runtime";
2
- import w from "react";
1
+ import { jsx as r, jsxs as R, Fragment as _ } from "react/jsx-runtime";
2
+ import N from "react";
3
3
  import "@gearbox-protocol/sdk";
4
- import { cn as I } from "../../utils/cn.js";
4
+ import { cn as T } from "../../utils/cn.js";
5
5
  import "sonner";
6
6
  import "@gearbox-protocol/sdk/common-utils";
7
- import { getStatic as d } from "../../utils/static.js";
7
+ import { getStatic as g } from "../../utils/static.js";
8
+ import { getTokenIcon as w } from "../../utils/token-icon-source.js";
8
9
  import "luxon";
9
10
  import "../../utils/z-index.js";
10
- import { RoundedImage as l } from "../rounded-image/rounded-image.js";
11
- const s = d("/tokens/default.svg");
12
- function T(t) {
11
+ import { RoundedImage as u } from "../rounded-image/rounded-image.js";
12
+ const s = g("/tokens/default.svg");
13
+ function U(t) {
13
14
  return t.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase();
14
15
  }
15
16
  function j(t) {
16
17
  return typeof t == "object" && t !== null && "icon" in t && !("kind" in t);
17
18
  }
18
- function k(t) {
19
+ function I(t) {
19
20
  return typeof t == "object" && t !== null && "kind" in t && t.kind === "composite";
20
21
  }
21
- function u(t) {
22
+ function k(t) {
22
23
  if (t.type === "url") return t.url;
23
- const o = T(t.symbol);
24
- return o ? d(`/tokens/${o}.svg`) : s;
24
+ const o = U(t.symbol);
25
+ return o ? g(`/tokens/${o}.svg`) : s;
25
26
  }
26
- function y(t) {
27
- if (!t || k(t))
27
+ function C(t) {
28
+ if (!t || I(t))
28
29
  return s;
29
30
  if (j(t))
30
31
  return t.icon;
31
- const o = T(t);
32
- return o ? d(`/tokens/${o}.svg`) : s;
32
+ const o = U(t);
33
+ return o ? g(`/tokens/${o}.svg`) : s;
33
34
  }
34
35
  function F(t) {
35
- return t ? k(t) ? t.layers.map(u) : [y(t)] : [s];
36
+ return t ? I(t) ? t.layers.map(k) : [C(t)] : [s];
37
+ }
38
+ const L = 0.65;
39
+ function v(t, o) {
40
+ return t !== void 0 ? w(t) : typeof o == "string" ? w(o) : o;
36
41
  }
37
- const b = 0.65, L = w.forwardRef(function({ symbol: o, size: e = 48, fit: n = "contain", rounded: c = !1, className: a, ...f }, i) {
38
- if (k(o))
42
+ const D = N.forwardRef(function({
43
+ token: o,
44
+ symbol: e,
45
+ size: n = 48,
46
+ fit: c = "contain",
47
+ rounded: a = !1,
48
+ className: l,
49
+ ...f
50
+ }, m) {
51
+ const i = v(o, e);
52
+ if (I(i))
39
53
  return /* @__PURE__ */ r(
40
- N,
54
+ S,
41
55
  {
42
- ref: i,
43
- composite: o,
44
- size: e,
45
- fit: n,
46
- rounded: c,
47
- className: a
56
+ ref: m,
57
+ composite: i,
58
+ size: n,
59
+ fit: c,
60
+ rounded: a,
61
+ className: l
48
62
  }
49
63
  );
50
- const p = y(o);
64
+ const p = C(i);
51
65
  return /* @__PURE__ */ r(
52
- l,
66
+ u,
53
67
  {
54
- ref: i,
55
- className: a,
68
+ ref: m,
69
+ className: l,
56
70
  src: p,
57
71
  alt: "",
58
- rounded: c,
59
- fit: n,
60
- width: e,
61
- height: e,
62
- size: e,
72
+ rounded: a,
73
+ fit: c,
74
+ width: n,
75
+ height: n,
76
+ size: n,
63
77
  ...f
64
78
  }
65
79
  );
66
- }), N = w.forwardRef(function({ composite: o, size: e, fit: n, rounded: c, className: a }, f) {
67
- const { preset: i, layers: p, scaleFactor: U = b } = o, [C, x] = p, g = u(C), R = u(x), m = Math.round(e * U);
68
- let h;
69
- switch (i) {
80
+ }), S = N.forwardRef(function({ composite: o, size: e, fit: n, rounded: c, className: a }, l) {
81
+ const { preset: f, layers: m, scaleFactor: i = L } = o, [p, b] = m, h = k(p), x = k(b), d = Math.round(e * i);
82
+ let y;
83
+ switch (f) {
70
84
  case "centered_foreground":
71
- h = /* @__PURE__ */ S(_, { children: [
85
+ y = /* @__PURE__ */ R(_, { children: [
72
86
  /* @__PURE__ */ r(
73
- l,
87
+ u,
74
88
  {
75
89
  className: "absolute inset-0",
76
90
  style: { zIndex: 0 },
77
- src: g,
91
+ src: h,
78
92
  alt: "background",
79
93
  rounded: c,
80
94
  fit: n,
@@ -84,22 +98,22 @@ const b = 0.65, L = w.forwardRef(function({ symbol: o, size: e = 48, fit: n = "c
84
98
  /* @__PURE__ */ r(
85
99
  "div",
86
100
  {
87
- className: I(
101
+ className: T(
88
102
  "absolute left-1/2 top-1/2 z-[1] -translate-x-1/2 -translate-y-1/2",
89
103
  "flex items-center justify-center"
90
104
  ),
91
105
  style: {
92
- width: m,
93
- height: m
106
+ width: d,
107
+ height: d
94
108
  },
95
109
  children: /* @__PURE__ */ r(
96
- l,
110
+ u,
97
111
  {
98
- src: R,
112
+ src: x,
99
113
  alt: "foreground",
100
114
  rounded: c,
101
115
  fit: n,
102
- size: m
116
+ size: d
103
117
  }
104
118
  )
105
119
  }
@@ -107,10 +121,10 @@ const b = 0.65, L = w.forwardRef(function({ symbol: o, size: e = 48, fit: n = "c
107
121
  ] });
108
122
  break;
109
123
  default:
110
- return console.error("Unknown TokenIcon composite preset", i), /* @__PURE__ */ r(
111
- l,
124
+ return console.error("Unknown TokenIcon composite preset", f), /* @__PURE__ */ r(
125
+ u,
112
126
  {
113
- src: g,
127
+ src: h,
114
128
  alt: "error",
115
129
  rounded: c,
116
130
  fit: n,
@@ -121,16 +135,16 @@ const b = 0.65, L = w.forwardRef(function({ symbol: o, size: e = 48, fit: n = "c
121
135
  return /* @__PURE__ */ r(
122
136
  "div",
123
137
  {
124
- ref: f,
125
- className: I("relative inline-block shrink-0", a),
138
+ ref: l,
139
+ className: T("relative inline-block shrink-0", a),
126
140
  style: { width: e, height: e },
127
- children: h
141
+ children: y
128
142
  }
129
143
  );
130
144
  });
131
- N.displayName = "TokenIconComposite";
132
- L.displayName = "TokenIcon";
133
- function B(t) {
145
+ S.displayName = "TokenIconComposite";
146
+ D.displayName = "TokenIcon";
147
+ function K(t) {
134
148
  for (const o of t)
135
149
  for (const e of F(o)) {
136
150
  const n = new window.Image();
@@ -138,6 +152,6 @@ function B(t) {
138
152
  }
139
153
  }
140
154
  export {
141
- L as TokenIcon,
142
- B as preloadTokenIcons
155
+ D as TokenIcon,
156
+ K as preloadTokenIcons
143
157
  };
@@ -1,5 +1,4 @@
1
- import { TokenSymbol as m, getSymbolOrIcon as r } from "./token-symbol.js";
1
+ import { TokenSymbol as m } from "./token-symbol.js";
2
2
  export {
3
- m as TokenSymbol,
4
- r as getSymbolOrIcon
3
+ m as TokenSymbol
5
4
  };
@@ -1,20 +1,19 @@
1
- import { jsxs as t, jsx as i } from "react/jsx-runtime";
2
- import { cva as y } from "class-variance-authority";
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { cva as v } from "class-variance-authority";
3
3
  import N from "react";
4
4
  import { RoundedImage as x } from "../rounded-image/rounded-image.js";
5
5
  import { ShortString as S } from "../short-string/short-string.js";
6
- import { TokenIcon as l } from "../token-icon/token-icon.js";
7
- import { SimpleTooltip as I } from "../tooltip/simple-tooltip.js";
6
+ import { TokenIcon as s } from "../token-icon/token-icon.js";
7
+ import { SimpleTooltip as T } from "../tooltip/simple-tooltip.js";
8
8
  import "../tooltip/tooltip.js";
9
- import { isIconComposite as b } from "../../types/common.js";
10
9
  import "@gearbox-protocol/sdk";
11
- import { cn as T } from "../../utils/cn.js";
10
+ import { cn as y } from "../../utils/cn.js";
12
11
  import "sonner";
13
12
  import "@gearbox-protocol/sdk/common-utils";
14
- import { getNetworkIcon as R } from "../../utils/network-icons.js";
13
+ import { getNetworkIcon as I } from "../../utils/network-icons.js";
15
14
  import "luxon";
16
15
  import "../../utils/z-index.js";
17
- const _ = y("", {
16
+ const b = v("", {
18
17
  variants: {
19
18
  marginSize: {
20
19
  sm: "gap-1",
@@ -26,83 +25,64 @@ const _ = y("", {
26
25
  marginSize: "md"
27
26
  }
28
27
  });
29
- function j(r) {
30
- if (r) {
31
- if (typeof r == "string") return r;
32
- if (r.icon !== void 0) {
33
- if (typeof r.icon == "string")
34
- return { icon: r.icon };
35
- if (b(r.icon))
36
- return r.icon;
37
- }
38
- return r.symbol;
39
- }
40
- }
41
- function z(r) {
28
+ function R(r) {
42
29
  if (r)
43
- return typeof r == "string" ? r : r.title;
30
+ return typeof r == "string" ? r : "title" in r && r.title ? r.title : r.symbol;
44
31
  }
45
- const V = N.forwardRef(
32
+ const _ = N.forwardRef(
46
33
  ({
47
34
  className: r,
48
- marginSize: d = "lg",
49
- token: n,
50
- title: m,
51
- size: s = 24,
52
- showSymbol: f = !1,
35
+ marginSize: c = "lg",
36
+ token: m,
37
+ title: o,
38
+ size: a = 24,
39
+ showSymbol: d = !1,
53
40
  showIcon: p = !0,
54
- maxLength: u,
55
- chainId: C,
56
- comment: c,
57
- network: e,
41
+ maxLength: f,
42
+ chainId: j,
43
+ comment: l,
44
+ network: i,
58
45
  ...g
59
- }, h) => {
60
- const o = j(n), v = m || z(n), a = () => e ? /* @__PURE__ */ t("div", { className: "relative", children: [
61
- /* @__PURE__ */ i(
62
- l,
46
+ }, u) => {
47
+ const h = o || R(m), n = () => i ? /* @__PURE__ */ t("div", { className: "relative", children: [
48
+ /* @__PURE__ */ e(
49
+ s,
63
50
  {
64
- symbol: o,
65
- size: s,
51
+ token: m,
52
+ size: a,
66
53
  className: "shrink-0 self-center"
67
54
  }
68
55
  ),
69
- /* @__PURE__ */ i("div", { className: "absolute -top-[10px] -right-[7px]", children: /* @__PURE__ */ i(
56
+ /* @__PURE__ */ e("div", { className: "absolute -top-[10px] -right-[7px]", children: /* @__PURE__ */ e(
70
57
  x,
71
58
  {
72
- src: R(e),
73
- alt: e,
59
+ src: I(i),
60
+ alt: i,
74
61
  size: 14,
75
62
  rounded: !0
76
63
  }
77
64
  ) })
78
- ] }) : /* @__PURE__ */ i(
79
- l,
80
- {
81
- symbol: o,
82
- size: s,
83
- className: "shrink-0 self-center"
84
- }
85
- );
65
+ ] }) : /* @__PURE__ */ e(s, { token: m, size: a, className: "shrink-0 self-center" });
86
66
  return /* @__PURE__ */ t(
87
67
  "div",
88
68
  {
89
- ref: h,
90
- className: T(
69
+ ref: u,
70
+ className: y(
91
71
  "flex items-center",
92
- _({ marginSize: d }),
72
+ b({ marginSize: c }),
93
73
  r
94
74
  ),
95
75
  ...g,
96
76
  children: [
97
- p && o && (e !== void 0 ? /* @__PURE__ */ t(I, { title: a(), children: [
77
+ p && m && (i !== void 0 ? /* @__PURE__ */ t(T, { title: n(), children: [
98
78
  "Network: ",
99
- e
100
- ] }) : a()),
101
- (m || f) && /* @__PURE__ */ t("div", { className: "flex items-center gap-1 self-center", children: [
102
- /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(S, { maxLength: u, children: v }) }),
103
- c && /* @__PURE__ */ t("div", { className: "text-md text-muted-foreground leading-tight", children: [
79
+ i
80
+ ] }) : n()),
81
+ (o || d) && /* @__PURE__ */ t("div", { className: "flex items-center gap-1 self-center", children: [
82
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(S, { maxLength: f, children: h }) }),
83
+ l && /* @__PURE__ */ t("div", { className: "text-md text-muted-foreground leading-tight", children: [
104
84
  "(",
105
- c,
85
+ l,
106
86
  ")"
107
87
  ] })
108
88
  ] })
@@ -111,8 +91,7 @@ const V = N.forwardRef(
111
91
  );
112
92
  }
113
93
  );
114
- V.displayName = "TokenSymbol";
94
+ _.displayName = "TokenSymbol";
115
95
  export {
116
- V as TokenSymbol,
117
- j as getSymbolOrIcon
96
+ _ as TokenSymbol
118
97
  };