@cfxjs/sirius-next-common 0.1.26 → 0.1.28

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 (307) hide show
  1. package/dist/chunk-24MUZRQJ.js +108 -0
  2. package/dist/chunk-24MUZRQJ.js.map +1 -0
  3. package/dist/chunk-24Z2NTKQ.js +43 -0
  4. package/dist/chunk-24Z2NTKQ.js.map +1 -0
  5. package/dist/chunk-26ABIFHL.js +127 -0
  6. package/dist/chunk-26ABIFHL.js.map +1 -0
  7. package/dist/chunk-27S75HVO.js +108 -0
  8. package/dist/chunk-27S75HVO.js.map +1 -0
  9. package/dist/chunk-2ATI4GSO.js +130 -0
  10. package/dist/chunk-2ATI4GSO.js.map +1 -0
  11. package/dist/chunk-2RR4CX3F.js +141 -0
  12. package/dist/chunk-2RR4CX3F.js.map +1 -0
  13. package/dist/chunk-2S6T3LVP.js +212 -0
  14. package/dist/chunk-2S6T3LVP.js.map +1 -0
  15. package/dist/chunk-3357K7AW.js +108 -0
  16. package/dist/chunk-3357K7AW.js.map +1 -0
  17. package/dist/chunk-3BLNV3M6.js +49 -0
  18. package/dist/chunk-3BLNV3M6.js.map +1 -0
  19. package/dist/chunk-3DOLNPRU.js +27 -0
  20. package/dist/chunk-3DOLNPRU.js.map +1 -0
  21. package/dist/chunk-3MYGXIHH.js +108 -0
  22. package/dist/chunk-3MYGXIHH.js.map +1 -0
  23. package/dist/chunk-3PCM3OLN.js +141 -0
  24. package/dist/chunk-3PCM3OLN.js.map +1 -0
  25. package/dist/chunk-3TBXOB3R.js +141 -0
  26. package/dist/chunk-3TBXOB3R.js.map +1 -0
  27. package/dist/chunk-3XY72AXV.js +49 -0
  28. package/dist/chunk-3XY72AXV.js.map +1 -0
  29. package/dist/chunk-3YBIEQO6.js +212 -0
  30. package/dist/chunk-3YBIEQO6.js.map +1 -0
  31. package/dist/chunk-4A4J7WSV.js +86 -0
  32. package/dist/chunk-4A4J7WSV.js.map +1 -0
  33. package/dist/chunk-4ESGRQGT.js +108 -0
  34. package/dist/chunk-4ESGRQGT.js.map +1 -0
  35. package/dist/chunk-5BIMFEMU.js +1478 -0
  36. package/dist/chunk-5BIMFEMU.js.map +1 -0
  37. package/dist/chunk-5SRYL5WC.js +212 -0
  38. package/dist/chunk-5SRYL5WC.js.map +1 -0
  39. package/dist/chunk-62YQFYHZ.js +3629 -0
  40. package/dist/chunk-62YQFYHZ.js.map +1 -0
  41. package/dist/chunk-6HKZB5HS.js +49 -0
  42. package/dist/chunk-6HKZB5HS.js.map +1 -0
  43. package/dist/chunk-6NC6XI6T.js +108 -0
  44. package/dist/chunk-6NC6XI6T.js.map +1 -0
  45. package/dist/chunk-6VGNSL3V.js +108 -0
  46. package/dist/chunk-6VGNSL3V.js.map +1 -0
  47. package/dist/chunk-74Z6QJ2V.js +108 -0
  48. package/dist/chunk-74Z6QJ2V.js.map +1 -0
  49. package/dist/chunk-77BWMAR2.js +105 -0
  50. package/dist/chunk-77BWMAR2.js.map +1 -0
  51. package/dist/chunk-7EX3S2AT.js +2324 -0
  52. package/dist/chunk-7EX3S2AT.js.map +1 -0
  53. package/dist/chunk-7LU43J6Y.js +2199 -0
  54. package/dist/chunk-7LU43J6Y.js.map +1 -0
  55. package/dist/chunk-7ONFLU6G.js +127 -0
  56. package/dist/chunk-7ONFLU6G.js.map +1 -0
  57. package/dist/chunk-7S7HFNGN.js +49 -0
  58. package/dist/chunk-7S7HFNGN.js.map +1 -0
  59. package/dist/chunk-7T3QFG4C.js +108 -0
  60. package/dist/chunk-7T3QFG4C.js.map +1 -0
  61. package/dist/chunk-ACI4CZ3N.js +141 -0
  62. package/dist/chunk-ACI4CZ3N.js.map +1 -0
  63. package/dist/chunk-AF3NCC5P.js +127 -0
  64. package/dist/chunk-AF3NCC5P.js.map +1 -0
  65. package/dist/chunk-AFTE3PC6.js +141 -0
  66. package/dist/chunk-AFTE3PC6.js.map +1 -0
  67. package/dist/chunk-ARSX76AK.js +49 -0
  68. package/dist/chunk-ARSX76AK.js.map +1 -0
  69. package/dist/chunk-AVOJOQXO.js +108 -0
  70. package/dist/chunk-AVOJOQXO.js.map +1 -0
  71. package/dist/chunk-AWLKSOKJ.js +49 -0
  72. package/dist/chunk-AWLKSOKJ.js.map +1 -0
  73. package/dist/chunk-B5CBBNRH.js +141 -0
  74. package/dist/chunk-B5CBBNRH.js.map +1 -0
  75. package/dist/chunk-BJAVQP5F.js +212 -0
  76. package/dist/chunk-BJAVQP5F.js.map +1 -0
  77. package/dist/chunk-C4DWCONF.js +212 -0
  78. package/dist/chunk-C4DWCONF.js.map +1 -0
  79. package/dist/chunk-CM2VKLWZ.js +127 -0
  80. package/dist/chunk-CM2VKLWZ.js.map +1 -0
  81. package/dist/chunk-CRPUM7SJ.js +212 -0
  82. package/dist/chunk-CRPUM7SJ.js.map +1 -0
  83. package/dist/chunk-CSBHWPRR.js +105 -0
  84. package/dist/chunk-CSBHWPRR.js.map +1 -0
  85. package/dist/chunk-CT7PENLL.js +105 -0
  86. package/dist/chunk-CT7PENLL.js.map +1 -0
  87. package/dist/chunk-DIAD272J.js +49 -0
  88. package/dist/chunk-DIAD272J.js.map +1 -0
  89. package/dist/chunk-DXONM5CJ.js +141 -0
  90. package/dist/chunk-DXONM5CJ.js.map +1 -0
  91. package/dist/chunk-E4LV6EXS.js +108 -0
  92. package/dist/chunk-E4LV6EXS.js.map +1 -0
  93. package/dist/chunk-E6E6MHRM.js +212 -0
  94. package/dist/chunk-E6E6MHRM.js.map +1 -0
  95. package/dist/chunk-E77PCJ2L.js +141 -0
  96. package/dist/chunk-E77PCJ2L.js.map +1 -0
  97. package/dist/chunk-E7F44FIR.js +105 -0
  98. package/dist/chunk-E7F44FIR.js.map +1 -0
  99. package/dist/chunk-EK2YUTFC.js +141 -0
  100. package/dist/chunk-EK2YUTFC.js.map +1 -0
  101. package/dist/chunk-EKQJYLLX.js +212 -0
  102. package/dist/chunk-EKQJYLLX.js.map +1 -0
  103. package/dist/chunk-FA77TXZD.js +127 -0
  104. package/dist/chunk-FA77TXZD.js.map +1 -0
  105. package/dist/chunk-FAFYYMFU.js +108 -0
  106. package/dist/chunk-FAFYYMFU.js.map +1 -0
  107. package/dist/chunk-FHTHKUN5.js +126 -0
  108. package/dist/chunk-FHTHKUN5.js.map +1 -0
  109. package/dist/chunk-GAWACXC2.js +127 -0
  110. package/dist/chunk-GAWACXC2.js.map +1 -0
  111. package/dist/chunk-GR3BLVJV.js +212 -0
  112. package/dist/chunk-GR3BLVJV.js.map +1 -0
  113. package/dist/chunk-GRCSAYBS.js +141 -0
  114. package/dist/chunk-GRCSAYBS.js.map +1 -0
  115. package/dist/chunk-GTRGNGUL.js +212 -0
  116. package/dist/chunk-GTRGNGUL.js.map +1 -0
  117. package/dist/chunk-H6EWZ7XZ.js +105 -0
  118. package/dist/chunk-H6EWZ7XZ.js.map +1 -0
  119. package/dist/chunk-HH3OPBBE.js +108 -0
  120. package/dist/chunk-HH3OPBBE.js.map +1 -0
  121. package/dist/chunk-HRVIZJEA.js +63 -0
  122. package/dist/chunk-HRVIZJEA.js.map +1 -0
  123. package/dist/chunk-I5GYABMO.js +141 -0
  124. package/dist/chunk-I5GYABMO.js.map +1 -0
  125. package/dist/chunk-I5J6GFME.js +141 -0
  126. package/dist/chunk-I5J6GFME.js.map +1 -0
  127. package/dist/chunk-IHFBGGHI.js +2297 -0
  128. package/dist/chunk-IHFBGGHI.js.map +1 -0
  129. package/dist/chunk-IHHNRYGC.js +108 -0
  130. package/dist/chunk-IHHNRYGC.js.map +1 -0
  131. package/dist/chunk-IPF6TU3K.js +212 -0
  132. package/dist/chunk-IPF6TU3K.js.map +1 -0
  133. package/dist/chunk-JNSJK2TR.js +2323 -0
  134. package/dist/chunk-JNSJK2TR.js.map +1 -0
  135. package/dist/chunk-JY62VTMC.js +49 -0
  136. package/dist/chunk-JY62VTMC.js.map +1 -0
  137. package/dist/chunk-KKC3SV7X.js +212 -0
  138. package/dist/chunk-KKC3SV7X.js.map +1 -0
  139. package/dist/chunk-KLKFSFIO.js +127 -0
  140. package/dist/chunk-KLKFSFIO.js.map +1 -0
  141. package/dist/chunk-KLXG7TWR.js +212 -0
  142. package/dist/chunk-KLXG7TWR.js.map +1 -0
  143. package/dist/chunk-KONLD7QH.js +108 -0
  144. package/dist/chunk-KONLD7QH.js.map +1 -0
  145. package/dist/chunk-KVZ4GBCQ.js +212 -0
  146. package/dist/chunk-KVZ4GBCQ.js.map +1 -0
  147. package/dist/chunk-LCX6G6UD.js +49 -0
  148. package/dist/chunk-LCX6G6UD.js.map +1 -0
  149. package/dist/chunk-LTJESAOY.js +49 -0
  150. package/dist/chunk-LTJESAOY.js.map +1 -0
  151. package/dist/chunk-LVOIDBQG.js +5083 -0
  152. package/dist/chunk-LVOIDBQG.js.map +1 -0
  153. package/dist/chunk-M7MZHGIW.js +141 -0
  154. package/dist/chunk-M7MZHGIW.js.map +1 -0
  155. package/dist/chunk-MFLND54Z.js +105 -0
  156. package/dist/chunk-MFLND54Z.js.map +1 -0
  157. package/dist/chunk-MU2VXMVI.js +105 -0
  158. package/dist/chunk-MU2VXMVI.js.map +1 -0
  159. package/dist/chunk-MYFQGX4G.js +130 -0
  160. package/dist/chunk-MYFQGX4G.js.map +1 -0
  161. package/dist/chunk-NIVSHXEJ.js +141 -0
  162. package/dist/chunk-NIVSHXEJ.js.map +1 -0
  163. package/dist/chunk-NJMWUDSI.js +2323 -0
  164. package/dist/chunk-NJMWUDSI.js.map +1 -0
  165. package/dist/chunk-NP4YOCMX.js +127 -0
  166. package/dist/chunk-NP4YOCMX.js.map +1 -0
  167. package/dist/chunk-NVIXO3FX.js +127 -0
  168. package/dist/chunk-NVIXO3FX.js.map +1 -0
  169. package/dist/chunk-OB5SKTJ7.js +2294 -0
  170. package/dist/chunk-OB5SKTJ7.js.map +1 -0
  171. package/dist/chunk-OWG3KRZJ.js +108 -0
  172. package/dist/chunk-OWG3KRZJ.js.map +1 -0
  173. package/dist/chunk-P3FVYMA6.js +127 -0
  174. package/dist/chunk-P3FVYMA6.js.map +1 -0
  175. package/dist/chunk-PJDWYUHP.js +3629 -0
  176. package/dist/chunk-PJDWYUHP.js.map +1 -0
  177. package/dist/chunk-PS6RUUUK.js +86 -0
  178. package/dist/chunk-PS6RUUUK.js.map +1 -0
  179. package/dist/chunk-QAFEK7IY.js +105 -0
  180. package/dist/chunk-QAFEK7IY.js.map +1 -0
  181. package/dist/chunk-QFPKRXR3.js +108 -0
  182. package/dist/chunk-QFPKRXR3.js.map +1 -0
  183. package/dist/chunk-R3N37XCV.js +212 -0
  184. package/dist/chunk-R3N37XCV.js.map +1 -0
  185. package/dist/chunk-R4E42CNE.js +2324 -0
  186. package/dist/chunk-R4E42CNE.js.map +1 -0
  187. package/dist/chunk-R4FMLRKR.js +105 -0
  188. package/dist/chunk-R4FMLRKR.js.map +1 -0
  189. package/dist/chunk-R4ISWFAU.js +2323 -0
  190. package/dist/chunk-R4ISWFAU.js.map +1 -0
  191. package/dist/chunk-R5KOPIFI.js +127 -0
  192. package/dist/chunk-R5KOPIFI.js.map +1 -0
  193. package/dist/chunk-RHM7WSYL.js +127 -0
  194. package/dist/chunk-RHM7WSYL.js.map +1 -0
  195. package/dist/chunk-RMOYI7RJ.js +212 -0
  196. package/dist/chunk-RMOYI7RJ.js.map +1 -0
  197. package/dist/chunk-RQB4FWW7.js +2296 -0
  198. package/dist/chunk-RQB4FWW7.js.map +1 -0
  199. package/dist/chunk-RRQLWLKC.js +127 -0
  200. package/dist/chunk-RRQLWLKC.js.map +1 -0
  201. package/dist/chunk-S7BWR5IZ.js +212 -0
  202. package/dist/chunk-S7BWR5IZ.js.map +1 -0
  203. package/dist/chunk-SUHRSNAI.js +63 -0
  204. package/dist/chunk-SUHRSNAI.js.map +1 -0
  205. package/dist/chunk-T5J4XBWF.js +127 -0
  206. package/dist/chunk-T5J4XBWF.js.map +1 -0
  207. package/dist/chunk-T5OKHLM7.js +86 -0
  208. package/dist/chunk-T5OKHLM7.js.map +1 -0
  209. package/dist/chunk-T6TINFBB.js +49 -0
  210. package/dist/chunk-T6TINFBB.js.map +1 -0
  211. package/dist/chunk-TK4FIUGX.js +105 -0
  212. package/dist/chunk-TK4FIUGX.js.map +1 -0
  213. package/dist/chunk-TSYM32RM.js +2218 -0
  214. package/dist/chunk-TSYM32RM.js.map +1 -0
  215. package/dist/chunk-TYLFHFBL.js +127 -0
  216. package/dist/chunk-TYLFHFBL.js.map +1 -0
  217. package/dist/chunk-TZ6FCCCJ.js +105 -0
  218. package/dist/chunk-TZ6FCCCJ.js.map +1 -0
  219. package/dist/chunk-UFO7XI55.js +212 -0
  220. package/dist/chunk-UFO7XI55.js.map +1 -0
  221. package/dist/chunk-UHGU5YPX.js +127 -0
  222. package/dist/chunk-UHGU5YPX.js.map +1 -0
  223. package/dist/chunk-UTXIA4ZA.js +105 -0
  224. package/dist/chunk-UTXIA4ZA.js.map +1 -0
  225. package/dist/chunk-UYI6WFT7.js +105 -0
  226. package/dist/chunk-UYI6WFT7.js.map +1 -0
  227. package/dist/chunk-VENIIRNN.js +49 -0
  228. package/dist/chunk-VENIIRNN.js.map +1 -0
  229. package/dist/chunk-VIX553CW.js +108 -0
  230. package/dist/chunk-VIX553CW.js.map +1 -0
  231. package/dist/chunk-VLYJFH7W.js +49 -0
  232. package/dist/chunk-VLYJFH7W.js.map +1 -0
  233. package/dist/chunk-VOXSIPTX.js +141 -0
  234. package/dist/chunk-VOXSIPTX.js.map +1 -0
  235. package/dist/chunk-VZNGE73T.js +105 -0
  236. package/dist/chunk-VZNGE73T.js.map +1 -0
  237. package/dist/chunk-W2J2VZEP.js +108 -0
  238. package/dist/chunk-W2J2VZEP.js.map +1 -0
  239. package/dist/chunk-X3QTCV4Q.js +212 -0
  240. package/dist/chunk-X3QTCV4Q.js.map +1 -0
  241. package/dist/chunk-X5ZOQIDW.js +108 -0
  242. package/dist/chunk-X5ZOQIDW.js.map +1 -0
  243. package/dist/chunk-XHG32AO6.js +141 -0
  244. package/dist/chunk-XHG32AO6.js.map +1 -0
  245. package/dist/chunk-XJSNK6B3.js +127 -0
  246. package/dist/chunk-XJSNK6B3.js.map +1 -0
  247. package/dist/chunk-XRKRGNVZ.js +141 -0
  248. package/dist/chunk-XRKRGNVZ.js.map +1 -0
  249. package/dist/chunk-XVA5MO4M.js +2324 -0
  250. package/dist/chunk-XVA5MO4M.js.map +1 -0
  251. package/dist/chunk-XXEJA3Q7.js +86 -0
  252. package/dist/chunk-XXEJA3Q7.js.map +1 -0
  253. package/dist/chunk-XZAEVXPG.js +108 -0
  254. package/dist/chunk-XZAEVXPG.js.map +1 -0
  255. package/dist/chunk-YCVZY6JX.js +141 -0
  256. package/dist/chunk-YCVZY6JX.js.map +1 -0
  257. package/dist/chunk-YQAMFHXE.js +212 -0
  258. package/dist/chunk-YQAMFHXE.js.map +1 -0
  259. package/dist/chunk-YRB4D655.js +141 -0
  260. package/dist/chunk-YRB4D655.js.map +1 -0
  261. package/dist/chunk-YVPSUVSB.js +141 -0
  262. package/dist/chunk-YVPSUVSB.js.map +1 -0
  263. package/dist/chunk-YWEJJEJY.js +105 -0
  264. package/dist/chunk-YWEJJEJY.js.map +1 -0
  265. package/dist/chunk-YXOEPMQS.js +127 -0
  266. package/dist/chunk-YXOEPMQS.js.map +1 -0
  267. package/dist/chunk-ZBNO57AP.js +141 -0
  268. package/dist/chunk-ZBNO57AP.js.map +1 -0
  269. package/dist/chunk-ZZDH4KPF.js +212 -0
  270. package/dist/chunk-ZZDH4KPF.js.map +1 -0
  271. package/dist/components/AddressContainer/CoreAddressContainer.js +6 -6
  272. package/dist/components/AddressContainer/EVMAddressContainer.js +6 -6
  273. package/dist/components/AddressContainer/addressSwitcher.js +4 -4
  274. package/dist/components/AddressContainer/addressView.js +3 -3
  275. package/dist/components/AddressContainer/label.js +2 -2
  276. package/dist/components/Age/index.js +2 -2
  277. package/dist/components/CopyButton/index.js +1 -1
  278. package/dist/components/DownloadCSV/index.js +1 -1
  279. package/dist/components/Highlight/index.js +12 -2
  280. package/dist/components/Highlight/index.js.map +1 -1
  281. package/dist/components/InfoIconWithTooltip/index.js +1 -1
  282. package/dist/components/PhishingAddressContainer/PhishingWarningIcon.d.ts +6 -0
  283. package/dist/components/PhishingAddressContainer/PhishingWarningIcon.js +7 -0
  284. package/dist/components/PhishingAddressContainer/PhishingWarningIcon.js.map +1 -0
  285. package/dist/components/PhishingAddressContainer/index.d.ts +15 -0
  286. package/dist/components/PhishingAddressContainer/index.js +124 -0
  287. package/dist/components/PhishingAddressContainer/index.js.map +1 -0
  288. package/dist/components/PhishingAddressContainer/phishing-warning.svg.svg +3 -0
  289. package/dist/components/Price/index.js +1 -1
  290. package/dist/components/Select/index.js +1 -1
  291. package/dist/components/Select/select.js +1 -1
  292. package/dist/components/Text/index.js +2 -2
  293. package/dist/components/Tooltip/index.d.ts +1 -1
  294. package/dist/components/Tooltip/index.js +1 -1
  295. package/dist/components/Tooltip/tt.d.ts +28 -0
  296. package/dist/components/Tooltip/tt.js +8 -0
  297. package/dist/components/Tooltip/tt.js.map +1 -0
  298. package/dist/components/TransactionAction/coreTransactionAction.js +6 -6
  299. package/dist/components/TransactionAction/evmTransactionAction.js +6 -6
  300. package/dist/contants/cssVariable.d.ts +20 -0
  301. package/dist/contants/cssVariable.js +41 -0
  302. package/dist/contants/cssVariable.js.map +1 -0
  303. package/dist/uno.css +6 -4
  304. package/dist/utils/contractManagerTool.d.ts +50 -0
  305. package/dist/utils/contractManagerTool.js +92 -0
  306. package/dist/utils/contractManagerTool.js.map +1 -0
  307. package/package.json +5 -5
@@ -0,0 +1,127 @@
1
+ import {
2
+ convertCheckSum
3
+ } from "./chunk-RTFAJGPO.js";
4
+ import {
5
+ Text
6
+ } from "./chunk-MU2VXMVI.js";
7
+ import {
8
+ getTranslations
9
+ } from "./chunk-DQGLZCIG.js";
10
+
11
+ // src/components/AddressContainer/addressView.tsx
12
+ import { Translation } from "react-i18next";
13
+ import { shortenAddress } from "@cfx-kit/dapp-utils/dist/address";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
+ var defaultPCMaxWidth = 138;
16
+ var renderTooltipContent = (tooltipContent) => {
17
+ return Object.entries(tooltipContent).map(([key, { label, value, hideLabel }]) => {
18
+ if (value) {
19
+ return /* @__PURE__ */ jsxs("div", { children: [
20
+ !hideLabel && /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Translation, { children: (t) => t(label) }) }),
21
+ value
22
+ ] }, key);
23
+ }
24
+ return null;
25
+ }).filter(Boolean);
26
+ };
27
+ var convertLink = ({
28
+ link,
29
+ type,
30
+ hrefAddress,
31
+ cfxAddress
32
+ }) => {
33
+ if (typeof link === "string") {
34
+ return link;
35
+ }
36
+ const address = hrefAddress || cfxAddress;
37
+ if (address && typeof address === "string") {
38
+ const pathname = window.location.pathname.toLowerCase();
39
+ const addressLower = address.toLowerCase();
40
+ if (pathname.includes("/address/" + addressLower)) {
41
+ return false;
42
+ }
43
+ if (type === "pow") {
44
+ return `/address/${address}`;
45
+ }
46
+ if (type === "pos") {
47
+ return `/pos/accounts/${address}`;
48
+ }
49
+ }
50
+ return false;
51
+ };
52
+ var RenderAddress = ({
53
+ cfxAddress,
54
+ alias,
55
+ hoverValue,
56
+ hrefAddress,
57
+ content,
58
+ link = "",
59
+ isFull = false,
60
+ isFullNameTag = false,
61
+ style = {},
62
+ maxWidth,
63
+ prefix = null,
64
+ suffix = null,
65
+ type = "pow",
66
+ addressLabel = "",
67
+ ENSLabel = "",
68
+ nametag = "",
69
+ hideAliasPrefixInHover = false
70
+ }) => {
71
+ const translations = getTranslations();
72
+ const name = content || ENSLabel || nametag || addressLabel || alias;
73
+ const defaultStyle = {
74
+ maxWidth: `${name && isFullNameTag || isFull ? "auto" : (maxWidth || defaultPCMaxWidth) + "px"}`
75
+ };
76
+ const href = convertLink({ link, type, hrefAddress, cfxAddress });
77
+ const Wrapper = href ? "a" : "div";
78
+ const tooltipContent = {
79
+ ENSLabel: {
80
+ label: translations?.ens?.tip,
81
+ value: ENSLabel
82
+ },
83
+ nametag: {
84
+ label: translations?.nametag?.tip,
85
+ value: nametag
86
+ },
87
+ addressLabel: {
88
+ label: translations?.profile.address.myNameTag,
89
+ value: addressLabel
90
+ },
91
+ alias: {
92
+ label: translations?.profile.address.publicNameTag,
93
+ value: alias,
94
+ hideLabel: hideAliasPrefixInHover
95
+ }
96
+ };
97
+ const checksumAddress = convertCheckSum(cfxAddress);
98
+ const cfxAddressLabel = typeof cfxAddress === "string" && !isFull ? shortenAddress(checksumAddress) : checksumAddress;
99
+ return /* @__PURE__ */ jsxs("div", { className: "inline-flex", children: [
100
+ prefix,
101
+ /* @__PURE__ */ jsx(
102
+ Text,
103
+ {
104
+ tag: "span",
105
+ hoverValue: /* @__PURE__ */ jsxs(Fragment, { children: [
106
+ renderTooltipContent(tooltipContent),
107
+ /* @__PURE__ */ jsx("div", { children: hoverValue || checksumAddress })
108
+ ] }),
109
+ children: /* @__PURE__ */ jsx(
110
+ Wrapper,
111
+ {
112
+ className: "block relative align-bottom cursor-default truncate",
113
+ style: { ...defaultStyle, ...style },
114
+ ...href ? { href: String(href) } : {},
115
+ children: name || cfxAddressLabel
116
+ }
117
+ )
118
+ }
119
+ ),
120
+ suffix
121
+ ] });
122
+ };
123
+
124
+ export {
125
+ RenderAddress
126
+ };
127
+ //# sourceMappingURL=chunk-RRQLWLKC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/AddressContainer/addressView.tsx"],"sourcesContent":["import { Translation } from 'react-i18next';\nimport { Text } from '../Text';\nimport { convertCheckSum } from '../../utils/address';\nimport { getTranslations } from '../../store';\nimport { TooltipContent, RenderAddressProps } from './types';\nimport { shortenAddress } from '@cfx-kit/dapp-utils/dist/address';\n\nconst defaultPCMaxWidth = 138;\n\n// common\nconst renderTooltipContent = (tooltipContent: TooltipContent) => {\n return Object.entries(tooltipContent)\n .map(([key, { label, value, hideLabel }]) => {\n if (value) {\n return (\n <div key={key}>\n {!hideLabel && (\n <span>\n <Translation>{t => t(label)}</Translation>\n </span>\n )}\n {value}\n </div>\n );\n }\n return null;\n })\n .filter(Boolean);\n};\n\n// common\nconst convertLink = ({\n link,\n type,\n hrefAddress,\n cfxAddress,\n}: RenderAddressProps) => {\n if (typeof link === 'string') {\n return link;\n }\n\n const address = hrefAddress || cfxAddress;\n\n if (address && typeof address === 'string') {\n const pathname = window.location.pathname.toLowerCase();\n const addressLower = address.toLowerCase();\n if (pathname.includes('/address/' + addressLower)) {\n return false;\n }\n\n if (type === 'pow') {\n return `/address/${address}`;\n }\n\n if (type === 'pos') {\n return `/pos/accounts/${address}`;\n }\n }\n\n return false;\n};\n\n// common\nexport const RenderAddress = ({\n cfxAddress,\n alias,\n hoverValue,\n hrefAddress,\n content,\n link = '',\n isFull = false,\n isFullNameTag = false,\n style = {},\n maxWidth,\n prefix = null,\n suffix = null,\n type = 'pow',\n addressLabel = '',\n ENSLabel = '',\n nametag = '',\n hideAliasPrefixInHover = false,\n}: RenderAddressProps) => {\n const translations = getTranslations();\n\n const name = content || ENSLabel || nametag || addressLabel || alias;\n\n const defaultStyle = {\n maxWidth: `${(name && isFullNameTag) || isFull ? 'auto' : (maxWidth || defaultPCMaxWidth) + 'px'}`,\n };\n\n const href = convertLink({ link, type, hrefAddress, cfxAddress });\n\n const Wrapper = href ? 'a' : 'div';\n\n const tooltipContent: TooltipContent = {\n ENSLabel: {\n label: (translations as any)?.ens?.tip,\n value: ENSLabel,\n },\n nametag: {\n label: translations?.nametag?.tip,\n value: nametag,\n },\n addressLabel: {\n label: translations?.profile.address.myNameTag,\n value: addressLabel,\n },\n alias: {\n label: translations?.profile.address.publicNameTag,\n value: alias,\n hideLabel: hideAliasPrefixInHover,\n },\n };\n\n const checksumAddress = convertCheckSum(cfxAddress);\n\n const cfxAddressLabel =\n typeof cfxAddress === 'string' && !isFull\n ? shortenAddress(checksumAddress!)\n : checksumAddress;\n\n return (\n <div className=\"inline-flex\">\n {prefix}\n <Text\n tag=\"span\"\n hoverValue={\n <>\n {renderTooltipContent(tooltipContent)}\n <div>{hoverValue || checksumAddress}</div>\n </>\n }\n >\n <Wrapper\n className=\"block relative align-bottom cursor-default truncate\"\n style={{ ...defaultStyle, ...style }}\n {...(href ? { href: String(href) } : {})}\n >\n {name || cfxAddressLabel}\n </Wrapper>\n </Text>\n {suffix}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,mBAAmB;AAK5B,SAAS,sBAAsB;AAUrB,SAgHA,UA7GM,KAHN;AARV,IAAM,oBAAoB;AAG1B,IAAM,uBAAuB,CAAC,mBAAmC;AAC/D,SAAO,OAAO,QAAQ,cAAc,EACjC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,OAAO,UAAU,CAAC,MAAM;AAC3C,QAAI,OAAO;AACT,aACE,qBAAC,SACE;AAAA,SAAC,aACA,oBAAC,UACC,8BAAC,eAAa,iBAAK,EAAE,KAAK,GAAE,GAC9B;AAAA,QAED;AAAA,WANO,GAOV;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,CAAC,EACA,OAAO,OAAO;AACnB;AAGA,IAAM,cAAc,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA0B;AACxB,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,eAAe;AAE/B,MAAI,WAAW,OAAO,YAAY,UAAU;AAC1C,UAAM,WAAW,OAAO,SAAS,SAAS,YAAY;AACtD,UAAM,eAAe,QAAQ,YAAY;AACzC,QAAI,SAAS,SAAS,cAAc,YAAY,GAAG;AACjD,aAAO;AAAA,IACT;AAEA,QAAI,SAAS,OAAO;AAClB,aAAO,YAAY;AAAA,IACrB;AAEA,QAAI,SAAS,OAAO;AAClB,aAAO,iBAAiB;AAAA,IAC1B;AAAA,EACF;AAEA,SAAO;AACT;AAGO,IAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAA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AAI,OAAO,EAAE,MAAM,OAAO,IAAI,EAAE,IAAI,CAAC;AAAA,YAErC,kBAAQ;AAAA;AAAA,QACX;AAAA;AAAA,IACF;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
@@ -0,0 +1,212 @@
1
+ import {
2
+ RenderAddress
3
+ } from "./chunk-P3FVYMA6.js";
4
+ import {
5
+ formatAddress,
6
+ isInnerContractAddress
7
+ } from "./chunk-RTFAJGPO.js";
8
+ import {
9
+ Tooltip
10
+ } from "./chunk-OB5SKTJ7.js";
11
+ import {
12
+ coreCorrespondsToEspace,
13
+ formatString,
14
+ getNetwork
15
+ } from "./chunk-4WJBUQY7.js";
16
+ import {
17
+ getEnvConfig,
18
+ getTranslations,
19
+ useGlobalData
20
+ } from "./chunk-DQGLZCIG.js";
21
+
22
+ // src/components/AddressContainer/addressSwitcher.tsx
23
+ import { AlertTriangle, File } from "@zeit-ui/react-icons";
24
+ import InternalContractIcon from "./internal-contract-icon-ZH2RG3CU.png";
25
+ import ContractIcon from "./contract-icon-P3W2HUAA.png";
26
+ import VerifiedIcon from "./verified-VJRHZNN7.png";
27
+ import isMeIcon from "./me-SIV36SR7.png";
28
+ import { isPosAddress } from "@cfx-kit/dapp-utils/dist/address";
29
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
30
+ var ContractCreatedAddress = (props) => {
31
+ const { contractCreated = "", outputType, t, isFull } = props;
32
+ const translations = getTranslations();
33
+ const contractAddress = formatAddress(contractCreated, outputType);
34
+ const customProps = {
35
+ content: t(translations.transaction.contractCreation),
36
+ alias: t(translations.transaction.contractCreation),
37
+ hrefAddress: contractAddress,
38
+ cfxAddress: contractAddress,
39
+ maxWidth: 160
40
+ };
41
+ const mergedProps = { ...props, ...customProps };
42
+ return RenderAddress({
43
+ ...mergedProps,
44
+ prefix: /* @__PURE__ */ jsx("div", { className: `mr-[2px] flex-shrink-0 ${isFull ? "icon" : ""}`, children: /* @__PURE__ */ jsx(Tooltip, { title: mergedProps.content, children: /* @__PURE__ */ jsx("div", { className: "relative w-[16px] h-[16px]", children: /* @__PURE__ */ jsx(
45
+ "img",
46
+ {
47
+ className: "w-[16px] h-[16px] align-bottom mb-[3px]",
48
+ src: ContractIcon,
49
+ alt: mergedProps.content
50
+ }
51
+ ) }) }) })
52
+ });
53
+ };
54
+ var CoreHexAddress = (props) => {
55
+ const { value, t, isFull, maxWidth } = props;
56
+ const { globalData } = useGlobalData();
57
+ const ENV_CONFIG = getEnvConfig();
58
+ const translations = getTranslations();
59
+ const hexAddress = formatAddress(value, "hex");
60
+ const network = getNetwork(
61
+ globalData?.networks,
62
+ coreCorrespondsToEspace(ENV_CONFIG.ENV_NETWORK_ID)
63
+ );
64
+ const url = `${window.location.protocol}${network.url}/address/${hexAddress}`;
65
+ return RenderAddress({
66
+ cfxAddress: hexAddress,
67
+ hoverValue: hexAddress,
68
+ link: url,
69
+ isFull,
70
+ maxWidth,
71
+ suffixSize: 0,
72
+ prefix: /* @__PURE__ */ jsx("div", { className: "mr-[2px] flex-shrink-0", children: /* @__PURE__ */ jsx(Tooltip, { title: t(translations.general.eSpaceAddress), children: /* @__PURE__ */ jsx(File, { size: 16, color: "#17B38A" }) }) })
73
+ });
74
+ };
75
+ var InvalidAddress = (props) => {
76
+ const {
77
+ value,
78
+ alias,
79
+ t,
80
+ isFull,
81
+ maxWidth,
82
+ isFullNameTag,
83
+ hideAliasPrefixInHover
84
+ } = props;
85
+ const translations = getTranslations();
86
+ const tip = t(translations.general.invalidAddress);
87
+ return RenderAddress({
88
+ cfxAddress: value,
89
+ alias,
90
+ hoverValue: `${tip}: ${value}`,
91
+ content: alias ? formatString(alias, "tag") : value,
92
+ link: false,
93
+ isFull,
94
+ isFullNameTag,
95
+ maxWidth,
96
+ style: { color: "#e00909" },
97
+ prefix: /* @__PURE__ */ jsx("div", { className: "mr-[2px] flex-shrink-0", children: /* @__PURE__ */ jsx(Tooltip, { title: tip, children: /* @__PURE__ */ jsx(AlertTriangle, { size: 16, color: "#e00909" }) }) }),
98
+ hideAliasPrefixInHover
99
+ });
100
+ };
101
+ var ContractAddress = (props) => {
102
+ const { showIcon, verify, t, cfxAddress, isFull } = props;
103
+ const translations = getTranslations();
104
+ const isInnerContract = cfxAddress && isInnerContractAddress(cfxAddress);
105
+ const typeText = t(
106
+ isInnerContract ? translations.general.internalContract : verify ? translations.general.verifiedContract : translations.general.unverifiedContract
107
+ );
108
+ return RenderAddress({
109
+ ...props,
110
+ prefix: showIcon ? /* @__PURE__ */ jsx("div", { className: `mr-[2px] flex-shrink-0 ${isFull ? "icon" : ""}`, children: /* @__PURE__ */ jsx(Tooltip, { title: typeText, children: /* @__PURE__ */ jsx("div", { className: "relative w-[16px] h-[16px]", children: isInnerContract ? /* @__PURE__ */ jsx(
111
+ "img",
112
+ {
113
+ className: "w-[16px] h-[16px] align-bottom mb-[5px]",
114
+ src: InternalContractIcon,
115
+ alt: typeText
116
+ }
117
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
118
+ /* @__PURE__ */ jsx(
119
+ "img",
120
+ {
121
+ className: "w-[16px] h-[16px] align-bottom mb-[5px]",
122
+ src: ContractIcon,
123
+ alt: typeText
124
+ }
125
+ ),
126
+ verify ? /* @__PURE__ */ jsx(
127
+ "img",
128
+ {
129
+ className: "w-[8px] h-[8px] absolute bottom-[-1px] right-[1px]",
130
+ src: VerifiedIcon,
131
+ alt: ""
132
+ }
133
+ ) : /* @__PURE__ */ jsx(Fragment, {})
134
+ ] }) }) }) }) : /* @__PURE__ */ jsx(Fragment, {})
135
+ });
136
+ };
137
+ var MyAddress = (props) => {
138
+ const { isFull } = props;
139
+ return RenderAddress({
140
+ ...props,
141
+ suffix: /* @__PURE__ */ jsx("div", { className: "mr-[2px] flex-shrink-0", children: /* @__PURE__ */ jsx(
142
+ "img",
143
+ {
144
+ className: "w-[38.5px] h-[16px] ml-[3px] align-bottom",
145
+ src: isMeIcon,
146
+ alt: "is me",
147
+ style: {
148
+ marginBottom: isFull ? "6px" : "4px"
149
+ }
150
+ }
151
+ ) })
152
+ });
153
+ };
154
+ var PosAddress = (props) => {
155
+ const {
156
+ alias,
157
+ isFull,
158
+ isFullNameTag,
159
+ maxWidth,
160
+ t,
161
+ link,
162
+ isMe,
163
+ hideAliasPrefixInHover
164
+ } = props;
165
+ const value = props.value;
166
+ if (!value) {
167
+ return /* @__PURE__ */ jsx(Fragment, { children: "--" });
168
+ }
169
+ if (isMe) {
170
+ return MyAddress(props);
171
+ }
172
+ const translations = getTranslations();
173
+ const content = alias ? formatString(alias, "tag") : formatString(value, "posAddress");
174
+ if (!isPosAddress(value)) {
175
+ const tip = t(translations.general.invalidPosAddress);
176
+ return RenderAddress({
177
+ cfxAddress: value,
178
+ alias,
179
+ hoverValue: `${tip}: ${value}`,
180
+ content,
181
+ link: false,
182
+ isFull,
183
+ isFullNameTag,
184
+ maxWidth,
185
+ style: { color: "#e00909" },
186
+ prefix: /* @__PURE__ */ jsx("div", { className: "mr-[2px] flex-shrink-0", children: /* @__PURE__ */ jsx(Tooltip, { title: tip, children: /* @__PURE__ */ jsx(AlertTriangle, { size: 16, color: "#e00909" }) }) }),
187
+ type: "pos",
188
+ hideAliasPrefixInHover
189
+ });
190
+ }
191
+ return RenderAddress({
192
+ cfxAddress: value,
193
+ alias,
194
+ link,
195
+ isFull,
196
+ isFullNameTag,
197
+ maxWidth,
198
+ type: "pos",
199
+ content,
200
+ hideAliasPrefixInHover
201
+ });
202
+ };
203
+
204
+ export {
205
+ ContractCreatedAddress,
206
+ CoreHexAddress,
207
+ InvalidAddress,
208
+ ContractAddress,
209
+ MyAddress,
210
+ PosAddress
211
+ };
212
+ //# sourceMappingURL=chunk-S7BWR5IZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/AddressContainer/addressSwitcher.tsx"],"sourcesContent":["import { WithTranslation } from 'react-i18next';\nimport { AlertTriangle, File } from '@zeit-ui/react-icons';\nimport InternalContractIcon from '../../images/internal-contract-icon.png';\nimport ContractIcon from '../../images/contract-icon.png';\nimport VerifiedIcon from '../../images/verified.png';\nimport isMeIcon from '../../images/me.png';\nimport { Tooltip } from '../Tooltip';\nimport { isPosAddress } from '@cfx-kit/dapp-utils/dist/address';\nimport { formatAddress, isInnerContractAddress } from '../../utils/address';\nimport { getTranslations, getEnvConfig, useGlobalData } from '../../store';\nimport { getNetwork, formatString, coreCorrespondsToEspace } from 'src/utils';\nimport { Props } from './types';\nimport { RenderAddress } from './addressView';\n\n// common\nexport const ContractCreatedAddress = (\n props: Props & WithTranslation & { outputType: 'hex' | 'base32' },\n) => {\n const { contractCreated = '', outputType, t, isFull } = props;\n\n const translations = getTranslations();\n\n const contractAddress = formatAddress(contractCreated, outputType);\n\n const customProps = {\n content: t(translations.transaction.contractCreation),\n alias: t(translations.transaction.contractCreation),\n hrefAddress: contractAddress,\n cfxAddress: contractAddress,\n maxWidth: 160,\n };\n\n const mergedProps = { ...props, ...customProps };\n return RenderAddress({\n ...mergedProps,\n prefix: (\n <div className={`mr-[2px] flex-shrink-0 ${isFull ? 'icon' : ''}`}>\n <Tooltip title={mergedProps.content}>\n <div className=\"relative w-[16px] h-[16px]\">\n <img\n className=\"w-[16px] h-[16px] align-bottom mb-[3px]\"\n src={ContractIcon}\n alt={mergedProps.content}\n />\n </div>\n </Tooltip>\n </div>\n ),\n });\n};\n\n// core\nexport const CoreHexAddress = (props: Props & WithTranslation) => {\n const { value, t, isFull, maxWidth } = props;\n const { globalData } = useGlobalData();\n\n const ENV_CONFIG = getEnvConfig();\n const translations = getTranslations();\n const hexAddress = formatAddress(value, 'hex');\n const network = getNetwork(\n globalData?.networks,\n coreCorrespondsToEspace(ENV_CONFIG.ENV_NETWORK_ID),\n );\n const url = `${window.location.protocol}${network.url}/address/${hexAddress}`;\n\n return RenderAddress({\n cfxAddress: hexAddress,\n hoverValue: hexAddress,\n link: url,\n isFull,\n maxWidth,\n suffixSize: 0,\n prefix: (\n <div className=\"mr-[2px] flex-shrink-0\">\n <Tooltip title={t((translations as any).general.eSpaceAddress)}>\n <File size={16} color=\"#17B38A\" />\n </Tooltip>\n </div>\n ),\n });\n};\n\n// common\nexport const InvalidAddress = (props: Props & WithTranslation) => {\n const {\n value,\n alias,\n t,\n isFull,\n maxWidth,\n isFullNameTag,\n hideAliasPrefixInHover,\n } = props;\n\n const translations = getTranslations();\n\n const tip = t(translations.general.invalidAddress);\n\n return RenderAddress({\n cfxAddress: value,\n alias,\n hoverValue: `${tip}: ${value}`,\n content: alias ? formatString(alias, 'tag') : value,\n link: false,\n isFull,\n isFullNameTag,\n maxWidth,\n style: { color: '#e00909' },\n prefix: (\n <div className=\"mr-[2px] flex-shrink-0\">\n <Tooltip title={tip}>\n <AlertTriangle size={16} color=\"#e00909\" />\n </Tooltip>\n </div>\n ),\n hideAliasPrefixInHover,\n });\n};\n\n// common\nexport const ContractAddress = (props: Props & WithTranslation) => {\n const { showIcon, verify, t, cfxAddress, isFull } = props;\n\n const translations = getTranslations();\n\n const isInnerContract = cfxAddress && isInnerContractAddress(cfxAddress);\n\n const typeText = t(\n isInnerContract\n ? translations.general.internalContract\n : verify\n ? translations.general.verifiedContract\n : translations.general.unverifiedContract,\n );\n\n return RenderAddress({\n ...props,\n prefix: showIcon ? (\n <div className={`mr-[2px] flex-shrink-0 ${isFull ? 'icon' : ''}`}>\n <Tooltip title={typeText}>\n <div className=\"relative w-[16px] h-[16px]\">\n {isInnerContract ? (\n <img\n className=\"w-[16px] h-[16px] align-bottom mb-[5px]\"\n src={InternalContractIcon}\n alt={typeText}\n />\n ) : (\n <>\n <img\n className=\"w-[16px] h-[16px] align-bottom mb-[5px]\"\n src={ContractIcon}\n alt={typeText}\n />\n {verify ? (\n <img\n className=\"w-[8px] h-[8px] absolute bottom-[-1px] right-[1px]\"\n src={VerifiedIcon}\n alt={''}\n />\n ) : (\n <></>\n )}\n </>\n )}\n </div>\n </Tooltip>\n </div>\n ) : (\n <></>\n ),\n });\n};\n\n// common\nexport const MyAddress = (props: Props & WithTranslation) => {\n const { isFull } = props;\n return RenderAddress({\n ...props,\n suffix: (\n <div className=\"mr-[2px] flex-shrink-0\">\n <img\n className=\"w-[38.5px] h-[16px] ml-[3px] align-bottom\"\n src={isMeIcon}\n alt=\"is me\"\n style={{\n marginBottom: isFull ? '6px' : '4px',\n }}\n />\n </div>\n ),\n });\n};\n\n// core\nexport const PosAddress = (props: Props & WithTranslation) => {\n const {\n alias,\n isFull,\n isFullNameTag,\n maxWidth,\n t,\n link,\n isMe,\n hideAliasPrefixInHover,\n } = props;\n const value = props.value;\n if (!value) {\n return <>--</>;\n }\n if (isMe) {\n return MyAddress(props);\n }\n const translations = getTranslations();\n const content = alias\n ? formatString(alias, 'tag')\n : formatString(value, 'posAddress');\n if (!isPosAddress(value)) {\n const tip = t(translations.general.invalidPosAddress);\n return RenderAddress({\n cfxAddress: value,\n alias,\n hoverValue: `${tip}: ${value}`,\n content,\n link: false,\n isFull,\n isFullNameTag,\n maxWidth,\n style: { color: '#e00909' },\n prefix: (\n <div className=\"mr-[2px] flex-shrink-0\">\n <Tooltip title={tip}>\n <AlertTriangle size={16} color=\"#e00909\" />\n </Tooltip>\n </div>\n ),\n type: 'pos',\n hideAliasPrefixInHover,\n });\n }\n\n return RenderAddress({\n cfxAddress: value,\n alias,\n link,\n isFull,\n isFullNameTag,\n maxWidth,\n type: 'pos',\n content,\n hideAliasPrefixInHover,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,eAAe,YAAY;AACpC,OAAO,0BAA0B;AACjC,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AACzB,OAAO,cAAc;AAErB,SAAS,oBAAoB;AAgCjB,SA0HM,UA1HN,KA6GE,YA7GF;AAxBL,IAAM,yBAAyB,CACpC,UACG;AACH,QAAM,EAAE,kBAAkB,IAAI,YAAY,GAAG,OAAO,IAAI;AAExD,QAAM,eAAe,gBAAgB;AAErC,QAAM,kBAAkB,cAAc,iBAAiB,UAAU;AAEjE,QAAM,cAAc;AAAA,IAClB,SAAS,EA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AAM;AAAA,IACN;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -0,0 +1,63 @@
1
+ // src/components/Tooltip/tt.tsx
2
+ import {
3
+ useEffect,
4
+ useId,
5
+ isValidElement,
6
+ cloneElement,
7
+ Children
8
+ } from "react";
9
+ import { machine, connect } from "@zag-js/tooltip";
10
+ import { useMachine, normalizeProps } from "@zag-js/react";
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
+ var Tooltip = ({
13
+ id,
14
+ open = false,
15
+ openDelay = 200,
16
+ closeDelay = 200,
17
+ arrow = true,
18
+ positioning,
19
+ children,
20
+ containerClassName,
21
+ trigger,
22
+ ...props
23
+ }) => {
24
+ const uniqueId = useId();
25
+ const [state, send] = useMachine(
26
+ machine({
27
+ id: id ?? uniqueId,
28
+ openDelay,
29
+ closeDelay,
30
+ positioning,
31
+ ...props
32
+ })
33
+ );
34
+ const api = connect(state, send, normalizeProps);
35
+ useEffect(() => {
36
+ if (open === true) {
37
+ api.open();
38
+ } else {
39
+ api.close();
40
+ }
41
+ }, [open]);
42
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
43
+ typeof trigger === "function" ? trigger({ triggerProps: api.triggerProps }) : null,
44
+ api.isOpen && /* @__PURE__ */ jsxs(
45
+ "div",
46
+ {
47
+ className: `ui-tooltip${containerClassName ? ` ${containerClassName}` : ""}`,
48
+ ...api.positionerProps,
49
+ children: [
50
+ arrow && /* @__PURE__ */ jsx("div", { ...api.arrowProps, children: /* @__PURE__ */ jsx("div", { ...api.arrowTipProps }) }),
51
+ typeof children === "function" && children({ contentProps: api.contentProps }),
52
+ typeof children !== "function" ? Children.count(children) === 1 && isValidElement(children) ? cloneElement(children, { ...api.contentProps }) : /* @__PURE__ */ jsx("div", { ...api.contentProps, children }) : null
53
+ ]
54
+ }
55
+ )
56
+ ] });
57
+ };
58
+ var tt_default = Tooltip;
59
+
60
+ export {
61
+ tt_default
62
+ };
63
+ //# sourceMappingURL=chunk-SUHRSNAI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Tooltip/tt.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n isValidElement,\n cloneElement,\n Children,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { machine, connect, type PositioningOptions } from '@zag-js/tooltip';\nimport { useMachine, normalizeProps } from '@zag-js/react';\n\ninterface Props {\n id?: string;\n open?: boolean;\n openDelay?: number;\n closeDelay?: number;\n closeOnPointerDown?: boolean;\n closeOnEscape?: boolean;\n arrow?: boolean;\n interactive?: boolean;\n positioning?: PositioningOptions;\n onOpen?: VoidFunction;\n onClose?: VoidFunction;\n containerClassName?: string;\n children?:\n | (({\n contentProps,\n }: {\n contentProps: HTMLAttributes<HTMLElement>;\n }) => JSX.Element)\n | ReactNode;\n trigger?: ({\n triggerProps,\n }: {\n triggerProps: Omit<HTMLAttributes<HTMLElement>, 'color'>;\n }) => JSX.Element;\n}\n\nconst Tooltip: React.FC<Props> = ({\n id,\n open = false,\n openDelay = 200,\n closeDelay = 200,\n arrow = true,\n positioning,\n children,\n containerClassName,\n trigger,\n ...props\n}) => {\n const uniqueId = useId();\n const [state, send] = useMachine(\n machine({\n id: id ?? uniqueId,\n openDelay,\n closeDelay,\n positioning,\n ...props,\n }),\n );\n const api = connect(state, send, normalizeProps);\n\n useEffect(() => {\n if (open === true) {\n api.open();\n } else {\n api.close();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n\n return (\n <>\n {typeof trigger === 'function'\n ? trigger({ triggerProps: api.triggerProps })\n : null}\n {api.isOpen && (\n <div\n className={`ui-tooltip${containerClassName ? ` ${containerClassName}` : ''}`}\n {...api.positionerProps}\n >\n {arrow && (\n <div {...api.arrowProps}>\n <div {...api.arrowTipProps} />\n </div>\n )}\n {typeof children === 'function' &&\n children({ contentProps: api.contentProps })}\n {typeof children !== 'function' ? (\n Children.count(children) === 1 && isValidElement(children) ? (\n cloneElement(children, { ...api.contentProps })\n ) : (\n <div {...api.contentProps}>{children}</div>\n )\n ) : null}\n </div>\n )}\n </>\n );\n};\n\nexport type { PositioningOptions } from '@zag-js/tooltip';\nexport default Tooltip;\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,SAAS,eAAwC;AAC1D,SAAS,YAAY,sBAAsB;AA+DvC,mBAWU,KANN,YALJ;AAlCJ,IAAM,UAA2B,CAAC;AAAA,EAChC;AAAA,EACA,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,WAAW,MAAM;AACvB,QAAM,CAAC,OAAO,IAAI,IAAI;AAAA,IACpB,QAAQ;AAAA,MACN,IAAI,MAAM;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,QAAM,MAAM,QAAQ,OAAO,MAAM,cAAc;AAE/C,YAAU,MAAM;AACd,QAAI,SAAS,MAAM;AACjB,UAAI,KAAK;AAAA,IACX,OAAO;AACL,UAAI,MAAM;AAAA,IACZ;AAAA,EAEF,GAAG,CAAC,IAAI,CAAC;AAET,SACE,iCACG;AAAA,WAAO,YAAY,aAChB,QAAQ,EAAE,cAAc,IAAI,aAAa,CAAC,IAC1C;AAAA,IACH,IAAI,UACH;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,aAAa,qBAAqB,IAAI,uBAAuB;AAAA,QACvE,GAAG,IAAI;AAAA,QAEP;AAAA,mBACC,oBAAC,SAAK,GAAG,IAAI,YACX,8BAAC,SAAK,GAAG,IAAI,eAAe,GAC9B;AAAA,UAED,OAAO,aAAa,cACnB,SAAS,EAAE,cAAc,IAAI,aAAa,CAAC;AAAA,UAC5C,OAAO,aAAa,aACnB,SAAS,MAAM,QAAQ,MAAM,KAAK,eAAe,QAAQ,IACvD,aAAa,UAAU,EAAE,GAAG,IAAI,aAAa,CAAC,IAE9C,oBAAC,SAAK,GAAG,IAAI,cAAe,UAAS,IAErC;AAAA;AAAA;AAAA,IACN;AAAA,KAEJ;AAEJ;AAGA,IAAO,aAAQ;","names":[]}
@@ -0,0 +1,127 @@
1
+ import {
2
+ convertCheckSum
3
+ } from "./chunk-RTFAJGPO.js";
4
+ import {
5
+ Text
6
+ } from "./chunk-TZ6FCCCJ.js";
7
+ import {
8
+ getTranslations
9
+ } from "./chunk-DQGLZCIG.js";
10
+
11
+ // src/components/AddressContainer/addressView.tsx
12
+ import { Translation } from "react-i18next";
13
+ import { shortenAddress } from "@cfx-kit/dapp-utils/dist/address";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
+ var defaultPCMaxWidth = 138;
16
+ var renderTooltipContent = (tooltipContent) => {
17
+ return Object.entries(tooltipContent).map(([key, { label, value, hideLabel }]) => {
18
+ if (value) {
19
+ return /* @__PURE__ */ jsxs("div", { children: [
20
+ !hideLabel && /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Translation, { children: (t) => t(label) }) }),
21
+ value
22
+ ] }, key);
23
+ }
24
+ return null;
25
+ }).filter(Boolean);
26
+ };
27
+ var convertLink = ({
28
+ link,
29
+ type,
30
+ hrefAddress,
31
+ cfxAddress
32
+ }) => {
33
+ if (typeof link === "string") {
34
+ return link;
35
+ }
36
+ const address = hrefAddress || cfxAddress;
37
+ if (address && typeof address === "string") {
38
+ const pathname = window.location.pathname.toLowerCase();
39
+ const addressLower = address.toLowerCase();
40
+ if (pathname.includes("/address/" + addressLower)) {
41
+ return false;
42
+ }
43
+ if (type === "pow") {
44
+ return `/address/${address}`;
45
+ }
46
+ if (type === "pos") {
47
+ return `/pos/accounts/${address}`;
48
+ }
49
+ }
50
+ return false;
51
+ };
52
+ var RenderAddress = ({
53
+ cfxAddress,
54
+ alias,
55
+ hoverValue,
56
+ hrefAddress,
57
+ content,
58
+ link = "",
59
+ isFull = false,
60
+ isFullNameTag = false,
61
+ style = {},
62
+ maxWidth,
63
+ prefix = null,
64
+ suffix = null,
65
+ type = "pow",
66
+ addressLabel = "",
67
+ ENSLabel = "",
68
+ nametag = "",
69
+ hideAliasPrefixInHover = false
70
+ }) => {
71
+ const translations = getTranslations();
72
+ const name = content || ENSLabel || nametag || addressLabel || alias;
73
+ const defaultStyle = {
74
+ maxWidth: `${name && isFullNameTag || isFull ? "auto" : (maxWidth || defaultPCMaxWidth) + "px"}`
75
+ };
76
+ const href = convertLink({ link, type, hrefAddress, cfxAddress });
77
+ const Wrapper = href ? "a" : "div";
78
+ const tooltipContent = {
79
+ ENSLabel: {
80
+ label: translations?.ens?.tip,
81
+ value: ENSLabel
82
+ },
83
+ nametag: {
84
+ label: translations?.nametag?.tip,
85
+ value: nametag
86
+ },
87
+ addressLabel: {
88
+ label: translations?.profile.address.myNameTag,
89
+ value: addressLabel
90
+ },
91
+ alias: {
92
+ label: translations?.profile.address.publicNameTag,
93
+ value: alias,
94
+ hideLabel: hideAliasPrefixInHover
95
+ }
96
+ };
97
+ const checksumAddress = convertCheckSum(cfxAddress);
98
+ const cfxAddressLabel = typeof cfxAddress === "string" && !isFull ? shortenAddress(checksumAddress) : checksumAddress;
99
+ return /* @__PURE__ */ jsxs("div", { className: "inline-flex", children: [
100
+ prefix,
101
+ /* @__PURE__ */ jsx(
102
+ Text,
103
+ {
104
+ tag: "span",
105
+ hoverValue: /* @__PURE__ */ jsxs(Fragment, { children: [
106
+ renderTooltipContent(tooltipContent),
107
+ /* @__PURE__ */ jsx("div", { children: hoverValue || checksumAddress })
108
+ ] }),
109
+ children: /* @__PURE__ */ jsx(
110
+ Wrapper,
111
+ {
112
+ className: "block relative align-bottom cursor-default truncate",
113
+ style: { ...defaultStyle, ...style },
114
+ ...href ? { href: String(href) } : {},
115
+ children: name || cfxAddressLabel
116
+ }
117
+ )
118
+ }
119
+ ),
120
+ suffix
121
+ ] });
122
+ };
123
+
124
+ export {
125
+ RenderAddress
126
+ };
127
+ //# sourceMappingURL=chunk-T5J4XBWF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/AddressContainer/addressView.tsx"],"sourcesContent":["import { Translation } from 'react-i18next';\nimport { Text } from '../Text';\nimport { convertCheckSum } from '../../utils/address';\nimport { getTranslations } from '../../store';\nimport { TooltipContent, RenderAddressProps } from './types';\nimport { shortenAddress } from '@cfx-kit/dapp-utils/dist/address';\n\nconst defaultPCMaxWidth = 138;\n\n// common\nconst renderTooltipContent = (tooltipContent: TooltipContent) => {\n return Object.entries(tooltipContent)\n .map(([key, { label, value, hideLabel }]) => {\n if (value) {\n return (\n <div key={key}>\n {!hideLabel && (\n <span>\n <Translation>{t => t(label)}</Translation>\n </span>\n )}\n {value}\n </div>\n );\n }\n return null;\n })\n .filter(Boolean);\n};\n\n// common\nconst convertLink = ({\n link,\n type,\n hrefAddress,\n cfxAddress,\n}: RenderAddressProps) => {\n if (typeof link === 'string') {\n return link;\n }\n\n const address = hrefAddress || cfxAddress;\n\n if (address && typeof address === 'string') {\n const pathname = window.location.pathname.toLowerCase();\n const addressLower = address.toLowerCase();\n if (pathname.includes('/address/' + addressLower)) {\n return false;\n }\n\n if (type === 'pow') {\n return `/address/${address}`;\n }\n\n if (type === 'pos') {\n return `/pos/accounts/${address}`;\n }\n }\n\n return false;\n};\n\n// common\nexport const RenderAddress = ({\n cfxAddress,\n alias,\n hoverValue,\n hrefAddress,\n content,\n link = '',\n isFull = false,\n isFullNameTag = false,\n style = {},\n maxWidth,\n prefix = null,\n suffix = null,\n type = 'pow',\n addressLabel = '',\n ENSLabel = '',\n nametag = '',\n hideAliasPrefixInHover = false,\n}: RenderAddressProps) => {\n const translations = getTranslations();\n\n const name = content || ENSLabel || nametag || addressLabel || alias;\n\n const defaultStyle = {\n maxWidth: `${(name && isFullNameTag) || isFull ? 'auto' : (maxWidth || defaultPCMaxWidth) + 'px'}`,\n };\n\n const href = convertLink({ link, type, hrefAddress, cfxAddress });\n\n const Wrapper = href ? 'a' : 'div';\n\n const tooltipContent: TooltipContent = {\n ENSLabel: {\n label: (translations as any)?.ens?.tip,\n value: ENSLabel,\n },\n nametag: {\n label: translations?.nametag?.tip,\n value: nametag,\n },\n addressLabel: {\n label: translations?.profile.address.myNameTag,\n value: addressLabel,\n },\n alias: {\n label: translations?.profile.address.publicNameTag,\n value: alias,\n hideLabel: hideAliasPrefixInHover,\n },\n };\n\n const checksumAddress = convertCheckSum(cfxAddress);\n\n const cfxAddressLabel =\n typeof cfxAddress === 'string' && !isFull\n ? shortenAddress(checksumAddress!)\n : checksumAddress;\n\n return (\n <div className=\"inline-flex\">\n {prefix}\n <Text\n tag=\"span\"\n hoverValue={\n <>\n {renderTooltipContent(tooltipContent)}\n <div>{hoverValue || checksumAddress}</div>\n </>\n }\n >\n <Wrapper\n className=\"block relative align-bottom cursor-default truncate\"\n style={{ ...defaultStyle, ...style }}\n {...(href ? { href: String(href) } : {})}\n >\n {name || cfxAddressLabel}\n </Wrapper>\n </Text>\n {suffix}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,mBAAmB;AAK5B,SAAS,sBAAsB;AAUrB,SAgHA,UA7GM,KAHN;AARV,IAAM,oBAAoB;AAG1B,IAAM,uBAAuB,CAAC,mBAAmC;AAC/D,SAAO,OAAO,QAAQ,cAAc,EACjC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,OAAO,UAAU,CAAC,MAAM;AAC3C,QAAI,OAAO;AACT,aACE,qBAAC,SACE;AAAA,SAAC,aACA,oBAAC,UACC,8BAAC,eAAa,iBAAK,EAAE,KAAK,GAAE,GAC9B;AAAA,QAED;AAAA,WANO,GAOV;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,CAAC,EACA,OAAO,OAAO;AACnB;AAGA,IAAM,cAAc,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA0B;AACxB,MAAI,OAAO,SAAS,UAAU;AAC5B,W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AAQ;AAAA,MACrC,OAAO;AAAA,MACP,WAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,kBAAkB,gBAAgB,UAAU;AAElD,QAAM,kBACJ,OAAO,eAAe,YAAY,CAAC,SAC/B,eAAe,eAAgB,IAC/B;AAEN,SACE,qBAAC,SAAI,WAAU,eACZ;AAAA;AAAA,IACD;AAAA,MAAC;AAAA;AAAA,QACC,KAAI;AAAA,QACJ,YACE,iCACG;AAAA,+BAAqB,cAAc;AAAA,UACpC,oBAAC,SAAK,wBAAc,iBAAgB;AAAA,WACtC;AAAA,QAGF;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO,EAAE,GAAG,cAAc,GAAG,MAAM;AAAA,YAClC,GAAI,OAAO,EAAE,MAAM,OAAO,IAAI,EAAE,IAAI,CAAC;AAAA,YAErC,kBAAQ;AAAA;AAAA,QACX;AAAA;AAAA,IACF;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
@@ -0,0 +1,86 @@
1
+ import {
2
+ tt_default
3
+ } from "./chunk-HRVIZJEA.js";
4
+ import {
5
+ cn
6
+ } from "./chunk-4WJBUQY7.js";
7
+
8
+ // src/components/Tooltip/index.tsx
9
+ import {
10
+ useRef
11
+ } from "react";
12
+ import clsx from "clsx";
13
+ import { useClickAway } from "@cfx-kit/react-utils/dist/hooks";
14
+ import { jsx } from "react/jsx-runtime";
15
+ var Tooltip = ({
16
+ title,
17
+ children = null,
18
+ positioning = {},
19
+ className,
20
+ ...rest
21
+ }) => {
22
+ const { placement = "top" } = positioning;
23
+ const onCloseRef = useRef();
24
+ const triggerRef = useRef(null);
25
+ const triggerContentRef = useRef(null);
26
+ useClickAway([triggerRef, triggerContentRef], (e) => {
27
+ onCloseRef.current?.(
28
+ e
29
+ );
30
+ });
31
+ return /* @__PURE__ */ jsx(
32
+ tt_default,
33
+ {
34
+ trigger: ({ triggerProps }) => {
35
+ onCloseRef.current = triggerProps.onClick;
36
+ triggerProps.onClick = (e) => {
37
+ triggerProps.onPointerMove?.(e);
38
+ };
39
+ return /* @__PURE__ */ jsx(
40
+ "span",
41
+ {
42
+ ref: triggerRef,
43
+ ...title ? triggerProps : {},
44
+ className: cn(className, triggerProps.className),
45
+ children
46
+ }
47
+ );
48
+ },
49
+ containerClassName: clsx(
50
+ "sirius-next-tooltip",
51
+ "lh-normal max-w-250px z-1000 w-max min-w-unset!",
52
+ "all-[a]:text-[var(--theme-color-blue0)] all-[a:hover]:text-[var(--theme-color-blue2)]",
53
+ "[&.ui-tooltip>[data-part=arrow]]:[--arrow-size:6px] [&.ui-tooltip>[data-part=arrow]]:[--arrow-background:#333]"
54
+ ),
55
+ openDelay: 0,
56
+ closeOnPointerDown: false,
57
+ ...rest,
58
+ positioning: {
59
+ ...positioning,
60
+ placement
61
+ },
62
+ children: ({ contentProps }) => {
63
+ const _onPointerLeave = contentProps.onPointerLeave;
64
+ contentProps.onPointerLeave = (e) => {
65
+ if (e.pointerType === "touch")
66
+ return;
67
+ _onPointerLeave?.(e);
68
+ };
69
+ return /* @__PURE__ */ jsx(
70
+ "div",
71
+ {
72
+ className: "px-8px py-6px text-12px text-#fff text-left shadow break-words ws-normal bg-#333 min-w-30px min-h-32px decoration-none rounded-2px",
73
+ ref: (_ref) => _ref ? triggerContentRef.current = _ref.parentElement : triggerContentRef.current = null,
74
+ ...contentProps,
75
+ children: title
76
+ }
77
+ );
78
+ }
79
+ }
80
+ );
81
+ };
82
+
83
+ export {
84
+ Tooltip
85
+ };
86
+ //# sourceMappingURL=chunk-T5OKHLM7.js.map