@arcblock/ux 2.10.67 → 2.10.69

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 (294) hide show
  1. package/lib/Address/did-address.d.ts +6 -5
  2. package/lib/Address/index.d.ts +1 -1
  3. package/lib/Avatar/index.d.ts +10 -8
  4. package/lib/Avatar/index.js +6 -4
  5. package/lib/Blocklet/blocklet.d.ts +4 -4
  6. package/lib/Blocklet/blocklet.js +2 -2
  7. package/lib/BlockletContext/index.d.ts +3 -3
  8. package/lib/BlockletNFT/index.d.ts +6 -6
  9. package/lib/BlockletNFT/index.js +3 -3
  10. package/lib/BlockletV2/blocklet.d.ts +2 -2
  11. package/lib/Button/wrap.d.ts +4 -4
  12. package/lib/Button/wrap.js +2 -2
  13. package/lib/CardSelector/index.js +0 -1
  14. package/lib/Center/index.d.ts +1 -1
  15. package/lib/ClickToCopy/copy-button.d.ts +5 -4
  16. package/lib/ClickToCopy/copy-button.js +0 -1
  17. package/lib/ClickToCopy/hook.d.ts +3 -8
  18. package/lib/ClickToCopy/index.d.ts +6 -4
  19. package/lib/CodeBlock/index.d.ts +3 -1
  20. package/lib/CookieConsent/index.d.ts +8 -29
  21. package/lib/CookieConsent/index.js +3 -17
  22. package/lib/CountDown/index.d.ts +21 -25
  23. package/lib/CountDown/index.js +12 -11
  24. package/lib/DID/index.d.ts +9 -8
  25. package/lib/Datatable/index.d.ts +5 -5
  26. package/lib/Datatable/index.js +5 -5
  27. package/lib/Dialog/confirm.d.ts +6 -6
  28. package/lib/Dialog/confirm.js +3 -3
  29. package/lib/Dialog/types.d.ts +1 -1
  30. package/lib/DidLogo/index.d.ts +5 -25
  31. package/lib/DidLogo/index.js +4 -15
  32. package/lib/DriftBot/index.d.ts +13 -19
  33. package/lib/DriftBot/index.js +5 -6
  34. package/lib/Earth/index.d.ts +28 -10
  35. package/lib/Earth/index.js +12 -52
  36. package/lib/Earth/util.d.ts +10 -5
  37. package/lib/Earth/util.js +1 -0
  38. package/lib/ErrorBoundary/fallback.d.ts +12 -19
  39. package/lib/ErrorBoundary/fallback.js +2 -19
  40. package/lib/ErrorBoundary/index.d.ts +1 -1
  41. package/lib/Footer/index.d.ts +17 -24
  42. package/lib/Footer/index.js +2 -11
  43. package/lib/Header/header.d.ts +2 -2
  44. package/lib/Icon/image.d.ts +3 -2
  45. package/lib/Icon/index.d.ts +6 -4
  46. package/lib/Img/index.d.ts +1 -1
  47. package/lib/Img/index.js +1 -1
  48. package/lib/InfoRow/index.d.ts +9 -32
  49. package/lib/InfoRow/index.js +10 -23
  50. package/lib/Layout/dashboard/external-link.d.ts +13 -14
  51. package/lib/Layout/dashboard/external-link.js +5 -22
  52. package/lib/Layout/dashboard/full-page.d.ts +19 -11
  53. package/lib/Layout/dashboard/full-page.js +2 -6
  54. package/lib/Layout/dashboard/index.d.ts +20 -39
  55. package/lib/Layout/dashboard/index.js +10 -38
  56. package/lib/Layout/dashboard/sidebar.d.ts +17 -20
  57. package/lib/Layout/dashboard/sidebar.js +3 -16
  58. package/lib/Layout/dashboard-legacy/header.d.ts +10 -36
  59. package/lib/Layout/dashboard-legacy/header.js +5 -24
  60. package/lib/Layout/dashboard-legacy/index.d.ts +17 -56
  61. package/lib/Layout/dashboard-legacy/index.js +12 -41
  62. package/lib/Layout/dashboard-legacy/sidebar.d.ts +15 -26
  63. package/lib/Layout/dashboard-legacy/sidebar.js +5 -15
  64. package/lib/Layout/index.d.ts +17 -56
  65. package/lib/Layout/index.js +24 -50
  66. package/lib/LoadingMask/index.d.ts +8 -31
  67. package/lib/LoadingMask/index.js +3 -19
  68. package/lib/Locale/browser-lang.d.ts +4 -1
  69. package/lib/Locale/browser-lang.js +8 -3
  70. package/lib/Locale/context.d.ts +18 -8
  71. package/lib/Locale/context.js +1 -1
  72. package/lib/Locale/languages.d.ts +9 -55
  73. package/lib/Locale/selector.d.ts +10 -26
  74. package/lib/Locale/selector.js +8 -25
  75. package/lib/Locale/util.d.ts +4 -3
  76. package/lib/Locale/util.js +0 -1
  77. package/lib/Logo/index.d.ts +9 -40
  78. package/lib/Logo/index.js +88 -46
  79. package/lib/Metric/index.d.ts +9 -31
  80. package/lib/Metric/index.js +5 -20
  81. package/lib/NFTDisplay/aspect-ratio-container.d.ts +5 -12
  82. package/lib/NFTDisplay/aspect-ratio-container.js +0 -5
  83. package/lib/NFTDisplay/broken.d.ts +3 -13
  84. package/lib/NFTDisplay/broken.js +80 -10
  85. package/lib/NFTDisplay/displayApi.d.ts +1 -1
  86. package/lib/NFTDisplay/index.d.ts +28 -6
  87. package/lib/NFTDisplay/index.js +17 -51
  88. package/lib/NFTDisplay/svg-embedder/img.d.ts +8 -23
  89. package/lib/NFTDisplay/svg-embedder/img.js +3 -17
  90. package/lib/NFTDisplay/svg-embedder/inline-svg.d.ts +7 -13
  91. package/lib/NFTDisplay/svg-embedder/inline-svg.js +1 -8
  92. package/lib/NavMenu/nav-menu.d.ts +2 -0
  93. package/lib/NavMenu/nav-menu.js +0 -1
  94. package/lib/PageScroller/index.d.ts +14 -13
  95. package/lib/PageScroller/index.js +12 -37
  96. package/lib/PageScroller/usePrevValue.d.ts +1 -1
  97. package/lib/PageScroller/usePrevValue.js +1 -2
  98. package/lib/Passport/index.d.ts +1 -1
  99. package/lib/Passport/passport.d.ts +10 -30
  100. package/lib/Passport/passport.js +5 -19
  101. package/lib/PoweredByArcBlock/index.d.ts +4 -14
  102. package/lib/PoweredByArcBlock/index.js +1 -8
  103. package/lib/PricingTable/PricingPlan.d.ts +11 -9
  104. package/lib/PricingTable/PricingPlan.js +0 -4
  105. package/lib/PricingTable/index.d.ts +5 -3
  106. package/lib/PricingTable/index.js +1 -5
  107. package/lib/QRCode/index.d.ts +11 -22
  108. package/lib/QRCode/index.js +2 -17
  109. package/lib/RelativeTime/index.d.ts +12 -40
  110. package/lib/RelativeTime/index.js +7 -27
  111. package/lib/Result/common.d.ts +26 -45
  112. package/lib/Result/common.js +2 -4
  113. package/lib/Result/index.d.ts +5 -18
  114. package/lib/Result/index.js +1 -9
  115. package/lib/Result/result.d.ts +7 -29
  116. package/lib/Result/result.js +2 -17
  117. package/lib/Result/translations.d.ts +2 -54
  118. package/lib/Screenshot/BaseScreenshot/index.d.ts +7 -24
  119. package/lib/Screenshot/BaseScreenshot/index.js +2 -15
  120. package/lib/Screenshot/BaseScreenshot/shells/Macbook.d.ts +25 -19
  121. package/lib/Screenshot/BaseScreenshot/shells/Phone.d.ts +25 -19
  122. package/lib/Screenshot/index.d.ts +84 -28
  123. package/lib/Screenshot/index.js +14 -43
  124. package/lib/SessionBlocklet/index.d.ts +6 -19
  125. package/lib/SessionBlocklet/index.js +5 -15
  126. package/lib/SessionManager/index.d.ts +1 -1
  127. package/lib/SessionPermission/index.d.ts +9 -17
  128. package/lib/SessionPermission/index.js +3 -11
  129. package/lib/SessionUser/components/logged-in.d.ts +9 -31
  130. package/lib/SessionUser/components/logged-in.js +13 -29
  131. package/lib/SessionUser/components/session-user-item.d.ts +8 -1
  132. package/lib/SessionUser/components/session-user-item.js +2 -12
  133. package/lib/SessionUser/components/session-user-switch.d.ts +9 -21
  134. package/lib/SessionUser/components/session-user-switch.js +3 -15
  135. package/lib/SessionUser/components/un-login.d.ts +7 -23
  136. package/lib/SessionUser/components/un-login.js +4 -16
  137. package/lib/SessionUser/components/user-info.d.ts +12 -29
  138. package/lib/SessionUser/components/user-info.js +4 -19
  139. package/lib/SessionUser/index.d.ts +7 -30
  140. package/lib/SessionUser/index.js +5 -26
  141. package/lib/SessionUser/libs/translation.d.ts +2 -31
  142. package/lib/SessionUser/libs/translation.js +1 -0
  143. package/lib/SessionUser/libs/utils.d.ts +10 -9
  144. package/lib/Sparkline/index.d.ts +22 -1
  145. package/lib/Sparkline/index.js +25 -17
  146. package/lib/Spinner/index.d.ts +6 -1
  147. package/lib/Spinner/index.js +4 -11
  148. package/lib/Success/index.d.ts +5 -21
  149. package/lib/Success/index.js +10 -19
  150. package/lib/Tabs/index.d.ts +12 -26
  151. package/lib/Tabs/index.js +7 -37
  152. package/lib/TextCollapse/index.d.ts +10 -10
  153. package/lib/TextCollapse/index.js +4 -21
  154. package/lib/Theme/index.js +0 -2
  155. package/lib/Theme/theme-provider.d.ts +1 -1
  156. package/lib/Theme/theme.d.ts +4 -1
  157. package/lib/Theme/theme.js +1 -2
  158. package/lib/Typography/index.d.ts +5 -24
  159. package/lib/Typography/index.js +5 -17
  160. package/lib/Util/index.d.ts +17 -8
  161. package/lib/Util/index.js +22 -3
  162. package/lib/Video/index.d.ts +12 -16
  163. package/lib/Video/index.js +0 -14
  164. package/lib/Wallet/Action.d.ts +13 -18
  165. package/lib/Wallet/Action.js +0 -7
  166. package/lib/Wallet/Download.d.ts +24 -30
  167. package/lib/Wallet/Download.js +201 -18
  168. package/lib/Wallet/Open.d.ts +5 -15
  169. package/lib/Wallet/Open.js +5 -11
  170. package/lib/WalletOSIcon/index.d.ts +6 -25
  171. package/lib/WalletOSIcon/index.js +3 -16
  172. package/lib/WebWalletSWKeeper/index.d.ts +8 -20
  173. package/lib/WebWalletSWKeeper/index.js +14 -19
  174. package/lib/WechatPrompt/index.js +2 -0
  175. package/lib/global.d.ts +15 -0
  176. package/lib/type.d.ts +12 -3
  177. package/lib/withTheme/index.d.ts +8 -6
  178. package/lib/withTracker/index.d.ts +1 -1
  179. package/lib/withTracker/index.js +3 -0
  180. package/package.json +9 -5
  181. package/src/Address/did-address.tsx +7 -6
  182. package/src/Address/index.tsx +1 -1
  183. package/src/Avatar/index.jsx +6 -4
  184. package/src/Blocklet/blocklet.jsx +2 -2
  185. package/src/BlockletContext/index.tsx +3 -3
  186. package/src/BlockletNFT/index.jsx +3 -3
  187. package/src/BlockletV2/blocklet.tsx +2 -2
  188. package/src/Button/wrap.jsx +2 -2
  189. package/src/CardSelector/index.tsx +0 -1
  190. package/src/Center/index.tsx +1 -1
  191. package/src/ClickToCopy/copy-button.tsx +4 -4
  192. package/src/ClickToCopy/hook.ts +3 -2
  193. package/src/ClickToCopy/index.tsx +6 -5
  194. package/src/CodeBlock/index.tsx +3 -1
  195. package/src/CookieConsent/{index.jsx → index.tsx} +16 -19
  196. package/src/CountDown/{index.jsx → index.tsx} +30 -16
  197. package/src/DID/index.tsx +9 -8
  198. package/src/Datatable/index.jsx +5 -5
  199. package/src/Dialog/confirm.jsx +3 -3
  200. package/src/Dialog/types.d.ts +1 -1
  201. package/src/DidLogo/{index.jsx → index.tsx} +7 -14
  202. package/src/DriftBot/{index.jsx → index.tsx} +13 -11
  203. package/src/Earth/{index.jsx → index.tsx} +94 -66
  204. package/src/Earth/{util.js → util.ts} +20 -17
  205. package/src/ErrorBoundary/{fallback.jsx → fallback.tsx} +20 -21
  206. package/src/Footer/{index.jsx → index.tsx} +17 -14
  207. package/src/Header/header.tsx +2 -3
  208. package/src/Header/responsive-header.tsx +0 -1
  209. package/src/Icon/image.tsx +3 -3
  210. package/src/Icon/index.tsx +7 -4
  211. package/src/Img/index.jsx +1 -1
  212. package/src/InfoRow/{index.jsx → index.tsx} +32 -25
  213. package/src/Layout/dashboard/external-link.tsx +46 -0
  214. package/src/Layout/dashboard/{full-page.jsx → full-page.tsx} +20 -9
  215. package/src/Layout/dashboard/{index.jsx → index.tsx} +42 -44
  216. package/src/Layout/dashboard/{sidebar.jsx → sidebar.tsx} +23 -20
  217. package/src/Layout/dashboard-legacy/{header.jsx → header.tsx} +16 -26
  218. package/src/Layout/dashboard-legacy/{index.jsx → index.tsx} +32 -46
  219. package/src/Layout/dashboard-legacy/{sidebar.jsx → sidebar.tsx} +27 -19
  220. package/src/Layout/{index.jsx → index.tsx} +41 -47
  221. package/src/LoadingMask/{index.jsx → index.tsx} +18 -20
  222. package/src/Locale/{browser-lang.js → browser-lang.ts} +9 -7
  223. package/src/Locale/context.tsx +18 -11
  224. package/src/Locale/{languages.js → languages.ts} +1 -1
  225. package/src/Locale/{selector.jsx → selector.tsx} +32 -29
  226. package/src/Locale/{util.js → util.ts} +9 -2
  227. package/src/Logo/index.tsx +58 -0
  228. package/src/Metric/{index.jsx → index.tsx} +23 -18
  229. package/src/NFTDisplay/{aspect-ratio-container.jsx → aspect-ratio-container.tsx} +9 -7
  230. package/src/NFTDisplay/{broken.jsx → broken.tsx} +7 -12
  231. package/src/NFTDisplay/{displayApi.js → displayApi.ts} +4 -4
  232. package/src/NFTDisplay/{index.jsx → index.tsx} +59 -64
  233. package/src/NFTDisplay/svg-embedder/{img.jsx → img.tsx} +10 -18
  234. package/src/NFTDisplay/svg-embedder/{inline-svg.jsx → inline-svg.tsx} +8 -9
  235. package/src/NavMenu/nav-menu.tsx +2 -3
  236. package/src/PageScroller/{index.jsx → index.tsx} +40 -53
  237. package/src/PageScroller/{usePrevValue.js → usePrevValue.ts} +2 -3
  238. package/src/Passport/{passport.jsx → passport.tsx} +22 -19
  239. package/src/PoweredByArcBlock/{index.jsx → index.tsx} +6 -11
  240. package/src/PricingTable/{PricingPlan.jsx → PricingPlan.tsx} +15 -5
  241. package/src/PricingTable/{index.jsx → index.tsx} +9 -6
  242. package/src/QRCode/{index.jsx → index.tsx} +14 -19
  243. package/src/RelativeTime/{index.jsx → index.tsx} +24 -24
  244. package/src/Result/{common.jsx → common.tsx} +17 -13
  245. package/src/Result/index.tsx +30 -0
  246. package/src/Result/{result.jsx → result.tsx} +8 -17
  247. package/src/Result/{translations.js → translations.ts} +3 -1
  248. package/src/Screenshot/BaseScreenshot/{index.jsx → index.tsx} +9 -15
  249. package/src/Screenshot/BaseScreenshot/shells/{Macbook.jsx → Macbook.tsx} +3 -1
  250. package/src/Screenshot/BaseScreenshot/shells/{Phone.jsx → Phone.tsx} +3 -1
  251. package/src/Screenshot/{index.jsx → index.tsx} +60 -54
  252. package/src/SessionBlocklet/{index.jsx → index.tsx} +9 -14
  253. package/src/SessionPermission/index.tsx +25 -0
  254. package/src/SessionUser/components/{logged-in.jsx → logged-in.tsx} +49 -31
  255. package/src/SessionUser/components/session-user-item.tsx +97 -0
  256. package/src/SessionUser/components/{session-user-switch.jsx → session-user-switch.tsx} +16 -21
  257. package/src/SessionUser/components/{un-login.jsx → un-login.tsx} +10 -15
  258. package/src/SessionUser/components/{user-info.jsx → user-info.tsx} +16 -22
  259. package/src/SessionUser/index.tsx +26 -0
  260. package/src/SessionUser/libs/{translation.js → translation.ts} +3 -1
  261. package/src/SessionUser/libs/utils.ts +39 -0
  262. package/src/Sparkline/{index.jsx → index.tsx} +38 -22
  263. package/src/Spinner/index.tsx +20 -0
  264. package/src/Success/{index.jsx → index.tsx} +13 -16
  265. package/src/Tabs/{index.jsx → index.tsx} +26 -40
  266. package/src/TextCollapse/{index.jsx → index.tsx} +26 -21
  267. package/src/Theme/index.ts +0 -1
  268. package/src/Theme/theme-provider.tsx +1 -1
  269. package/src/Theme/theme.ts +6 -3
  270. package/src/Typography/{index.jsx → index.tsx} +19 -22
  271. package/src/Util/index.ts +26 -9
  272. package/src/Video/{index.jsx → index.tsx} +7 -10
  273. package/src/Wallet/{Action.jsx → Action.tsx} +16 -12
  274. package/src/Wallet/{Download.jsx → Download.tsx} +25 -21
  275. package/src/Wallet/{Open.jsx → Open.tsx} +8 -11
  276. package/src/WalletOSIcon/{index.jsx → index.tsx} +8 -16
  277. package/src/WebWalletSWKeeper/{index.jsx → index.tsx} +21 -24
  278. package/src/WechatPrompt/{index.jsx → index.tsx} +1 -0
  279. package/src/global.d.ts +15 -0
  280. package/src/type.d.ts +12 -3
  281. package/src/withTheme/{index.jsx → index.tsx} +12 -2
  282. package/src/withTracker/{index.jsx → index.tsx} +6 -4
  283. package/src/Layout/dashboard/external-link.jsx +0 -47
  284. package/src/Logo/index.jsx +0 -66
  285. package/src/Result/index.jsx +0 -33
  286. package/src/SessionPermission/index.jsx +0 -28
  287. package/src/SessionUser/components/session-user-item.jsx +0 -93
  288. package/src/SessionUser/index.jsx +0 -38
  289. package/src/SessionUser/libs/utils.js +0 -37
  290. package/src/Spinner/index.jsx +0 -21
  291. /package/src/ErrorBoundary/{index.jsx → index.ts} +0 -0
  292. /package/src/NFTDisplay/{loading.jsx → loading.tsx} +0 -0
  293. /package/src/Passport/{index.jsx → index.ts} +0 -0
  294. /package/src/SessionManager/{index.jsx → index.tsx} +0 -0
@@ -1,11 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import PropTypes from 'prop-types';
3
2
  import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
4
3
  import Fab from '@mui/material/Fab';
5
4
  import { styled } from '../Theme';
6
5
  export default function OpenInWallet({
7
- locale,
8
- link
6
+ link,
7
+ locale = 'zh'
9
8
  }) {
10
9
  const buttonText = locale === 'zh' ? '在 DID 钱包打开' : 'Open in DID Wallet';
11
10
  const browser = useBrowser();
@@ -15,7 +14,9 @@ export default function OpenInWallet({
15
14
  size: "small",
16
15
  href: deepLink,
17
16
  variant: "extended",
18
- color: "primary",
17
+ color: "primary"
18
+ // @ts-expect-error
19
+ ,
19
20
  rounded: true,
20
21
  target: "_blank",
21
22
  className: "open-in-wallet-button",
@@ -24,13 +25,6 @@ export default function OpenInWallet({
24
25
  }
25
26
  return null;
26
27
  }
27
- OpenInWallet.propTypes = {
28
- locale: PropTypes.oneOf(['en', 'zh']),
29
- link: PropTypes.string.isRequired
30
- };
31
- OpenInWallet.defaultProps = {
32
- locale: 'zh'
33
- };
34
28
  const Button = styled(Fab)`
35
29
  && {
36
30
  font-size: 12px;
@@ -1,26 +1,7 @@
1
- declare function WalletOSIcon({ loading, walletOS, provider, color }: {
2
- loading: any;
3
- walletOS: any;
4
- provider: any;
5
- color: any;
6
- }): import("react/jsx-runtime").JSX.Element | null;
7
- declare namespace WalletOSIcon {
8
- namespace propTypes {
9
- let loading: PropTypes.Requireable<boolean>;
10
- let walletOS: PropTypes.Requireable<string>;
11
- let provider: PropTypes.Requireable<string>;
12
- let color: PropTypes.Requireable<string>;
13
- }
14
- namespace defaultProps {
15
- let loading_1: boolean;
16
- export { loading_1 as loading };
17
- let walletOS_1: null;
18
- export { walletOS_1 as walletOS };
19
- let provider_1: null;
20
- export { provider_1 as provider };
21
- let color_1: string;
22
- export { color_1 as color };
23
- }
1
+ export interface WalletOSIconProps {
2
+ loading?: false | true;
3
+ walletOS?: string;
4
+ provider?: string;
5
+ color?: string;
24
6
  }
25
- export default WalletOSIcon;
26
- import PropTypes from 'prop-types';
7
+ export default function WalletOSIcon({ loading, walletOS, provider, color }: WalletOSIconProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import PropTypes from 'prop-types';
3
2
  import { Icon } from '@iconify/react';
4
3
  import ApiIcon from '@iconify-icons/mdi/api';
5
4
  import IOSRoundedIcon from '@iconify-icons/material-symbols/ios-rounded';
@@ -10,10 +9,10 @@ import QuestionMarkRoundedIcon from '@iconify-icons/material-symbols/question-ma
10
9
  import MailOutlineRoundedIcon from '@iconify-icons/material-symbols/mail-outline-rounded';
11
10
  import { LOGIN_PROVIDER } from '../Util/constant';
12
11
  export default function WalletOSIcon({
13
- loading,
12
+ loading = false,
14
13
  walletOS,
15
14
  provider,
16
- color
15
+ color = 'black'
17
16
  }) {
18
17
  if (loading) {
19
18
  return /*#__PURE__*/_jsx(Icon, {
@@ -67,16 +66,4 @@ export default function WalletOSIcon({
67
66
  });
68
67
  }
69
68
  return null;
70
- }
71
- WalletOSIcon.propTypes = {
72
- loading: PropTypes.bool,
73
- walletOS: PropTypes.string,
74
- provider: PropTypes.string,
75
- color: PropTypes.string
76
- };
77
- WalletOSIcon.defaultProps = {
78
- loading: false,
79
- walletOS: null,
80
- provider: null,
81
- color: 'black'
82
- };
69
+ }
@@ -1,21 +1,9 @@
1
- export default WebWalletSWKeeper;
2
- export function withWebWalletSWKeeper(Component: any): ({ webWalletUrl, maxIdleTime, ...rest }: {
3
- [x: string]: any;
4
- webWalletUrl: any;
5
- maxIdleTime: any;
6
- }) => import("react/jsx-runtime").JSX.Element;
7
- declare function WebWalletSWKeeper({ webWalletUrl, maxIdleTime }: {
8
- webWalletUrl: any;
9
- maxIdleTime: any;
10
- }): null;
11
- declare namespace WebWalletSWKeeper {
12
- namespace propTypes {
13
- let webWalletUrl: PropTypes.Validator<string>;
14
- let maxIdleTime: PropTypes.Requireable<number>;
15
- }
16
- namespace defaultProps {
17
- export { DEFAULT_MAX_IDLE_TIME as maxIdleTime };
18
- }
1
+ interface WebWalletSWKeeperProps {
2
+ webWalletUrl: string;
3
+ maxIdleTime: number;
19
4
  }
20
- import PropTypes from 'prop-types';
21
- declare const DEFAULT_MAX_IDLE_TIME: number;
5
+ declare function WebWalletSWKeeper({ webWalletUrl, maxIdleTime }: WebWalletSWKeeperProps): null;
6
+ export declare const withWebWalletSWKeeper: <P extends {
7
+ webWalletUrl: string;
8
+ }>(Component: React.ComponentType<P>) => ({ webWalletUrl, maxIdleTime, ...rest }: WebWalletSWKeeperProps & P) => import("react/jsx-runtime").JSX.Element;
9
+ export default WebWalletSWKeeper;
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import useIdle from 'react-use/lib/useIdle';
5
4
  import { useLocalStorageState } from 'ahooks';
6
5
  import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
@@ -17,15 +16,15 @@ const injectIframe = webWalletUrl => {
17
16
  const iframe = document.createElement('iframe');
18
17
  iframe.title = 'abt wallet';
19
18
  iframe.id = id;
20
- iframe.style.width = 0;
21
- iframe.style.height = 0;
22
- iframe.style.border = 0;
19
+ iframe.style.width = '0';
20
+ iframe.style.height = '0';
21
+ iframe.style.border = '0';
23
22
  // https://stackoverflow.com/questions/27858989/iframe-with-0-height-creates-a-gap
24
23
  iframe.style.display = 'block';
25
24
  // fix: 页面自动滚动到底部问题 (https://github.com/blocklet/abt-wallet/issues/1160)
26
25
  // top: 0 可能不是必须的, 但测试中发现, 如果不设置, 在某些特殊情况下似乎也会导致页面自动滚动到底部
27
26
  iframe.style.position = 'absolute';
28
- iframe.style.top = 0;
27
+ iframe.style.top = '0';
29
28
  iframe.src = `${webWalletUrl}?action=iframe`;
30
29
  document.body.appendChild(iframe);
31
30
  };
@@ -37,7 +36,7 @@ const removeIframe = () => {
37
36
  };
38
37
  const cleanup = () => {
39
38
  removeIframe();
40
- id = null;
39
+ id = '';
41
40
  };
42
41
  const enable = webWalletUrl => {
43
42
  if (!id) {
@@ -45,11 +44,10 @@ const enable = webWalletUrl => {
45
44
  injectIframe(webWalletUrl);
46
45
  }
47
46
  };
48
-
49
47
  // 该组件通过嵌入一个 web wallet iframe 帮助 web wallet service worker 延最大空闲时间
50
48
  function WebWalletSWKeeper({
51
49
  webWalletUrl,
52
- maxIdleTime
50
+ maxIdleTime = DEFAULT_MAX_IDLE_TIME
53
51
  }) {
54
52
  // 渲染前先记录是否已经存在一个 WebWalletSWKeeper 实例
55
53
  const instanceExists = useRef(!!id);
@@ -73,14 +71,6 @@ function WebWalletSWKeeper({
73
71
  useEffect(() => () => _cleanup(), []);
74
72
  return null;
75
73
  }
76
- WebWalletSWKeeper.propTypes = {
77
- webWalletUrl: PropTypes.string.isRequired,
78
- maxIdleTime: PropTypes.number
79
- };
80
- WebWalletSWKeeper.defaultProps = {
81
- maxIdleTime: DEFAULT_MAX_IDLE_TIME
82
- };
83
- export default WebWalletSWKeeper;
84
74
  export const withWebWalletSWKeeper = Component => {
85
75
  // eslint-disable-next-line react/prop-types
86
76
  return function WithWebWalletSWKeeperComponent({
@@ -102,14 +92,19 @@ export const withWebWalletSWKeeper = Component => {
102
92
  // - 检查到 wallet 浏览器插件
103
93
  // - webWalletUrl 与当前页面 url 的 protocol 不同
104
94
  // - wallet webview
95
+
96
+ const props = {
97
+ webWalletUrl,
98
+ ...rest
99
+ };
105
100
  return /*#__PURE__*/_jsxs(_Fragment, {
106
101
  children: [!disabled && !extension && isSameProtocol && !isWalletWebview && /*#__PURE__*/_jsx(WebWalletSWKeeper, {
107
102
  webWalletUrl: webWalletUrl,
108
103
  maxIdleTime: maxIdleTime
109
104
  }), /*#__PURE__*/_jsx(Component, {
110
- webWalletUrl: webWalletUrl,
111
- ...rest
105
+ ...props
112
106
  })]
113
107
  });
114
108
  };
115
- };
109
+ };
110
+ export default WebWalletSWKeeper;
@@ -13,6 +13,8 @@ export default function WechatPrompt() {
13
13
  if (!browser.wechat) {
14
14
  return null;
15
15
  }
16
+
17
+ // @ts-expect-error
16
18
  if (browser.android) {
17
19
  return /*#__PURE__*/_jsx(Dialog, {
18
20
  open: true,
package/lib/global.d.ts CHANGED
@@ -1,4 +1,19 @@
1
1
  declare module '@arcblock/did-motif';
2
+ declare module 'd3-geo';
3
+ declare module 'topojson-client';
4
+ declare module 'versor';
5
+ declare module 'axios/*';
6
+
7
+ // ux svg 由 babel-plugin-inline-react-svg 处理
8
+ declare module '*.svg' {
9
+ import * as React from 'react';
10
+ const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
11
+ export { ReactComponent };
12
+ }
13
+
14
+ declare module '*.png' {
15
+ export default string;
16
+ }
2
17
 
3
18
  type Blocklet = import('./type').Blocklet;
4
19
 
package/lib/type.d.ts CHANGED
@@ -1,5 +1,14 @@
1
+ import type { Theme } from '@mui/material';
2
+ import type { LiteralUnion } from 'type-fest';
3
+
1
4
  export type $TSFixMe = any;
5
+ export type Translations = Record<string, Record<string, any>>;
6
+ export type Locale = LiteralUnion<'en' | 'zh', string>;
2
7
 
8
+ // TODO: 以下为 blocklet 应用专属的全局对象类型,可以更加具体
9
+ export type User = Record<string, any>;
10
+ export type Session = Record<string, any>;
11
+ export type Passport = Record<string, any>;
3
12
  export type Blocklet = {
4
13
  appId: string;
5
14
  appIds: string[];
@@ -16,15 +25,15 @@ export type Blocklet = {
16
25
  version: string;
17
26
  mode: string;
18
27
  tenantMode: 'single' | 'multiple';
19
- theme: TTheme;
20
- navigation: TNavigation[];
28
+ theme: Theme;
29
+ navigation: $TSFixMe[];
21
30
  preferences: Record<string, any>;
22
31
  languages: {
23
32
  code: string;
24
33
  name: string;
25
34
  }[];
26
35
  passportColor: string;
27
- componentMountPoints: TComponent[];
36
+ componentMountPoints: $TSFixMe[];
28
37
  alsoKnownAs: string[];
29
38
  trustedFactories: string[];
30
39
  [x: string]: any;
@@ -1,7 +1,9 @@
1
+ import { type PaletteOptions } from '@mui/material/styles/createPalette';
2
+ import { type TypographyOptions } from '@mui/material/styles/createTypography';
3
+ declare function withTheme<P extends object>(Component: React.ComponentType<P>, { mode, pageWidth, palette, typography, }?: {
4
+ mode?: string;
5
+ pageWidth?: string;
6
+ palette?: PaletteOptions;
7
+ typography?: TypographyOptions;
8
+ }): (props: P) => import("react/jsx-runtime").JSX.Element;
1
9
  export default withTheme;
2
- declare function withTheme(Component: any, { mode, pageWidth, palette, typography }?: {
3
- mode?: string | undefined;
4
- pageWidth?: string | undefined;
5
- palette: any;
6
- typography: any;
7
- }): (props: any) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- declare function _default(WrappedComponent: any): (props: any) => import("react/jsx-runtime").JSX.Element;
1
+ declare const _default: <P extends object>(WrappedComponent: React.ComponentType<P>) => (props: P) => import("react/jsx-runtime").JSX.Element;
2
2
  export default _default;
@@ -30,7 +30,10 @@ export default WrappedComponent => {
30
30
  if (trackingId) {
31
31
  ReactGA.initialize(trackingId);
32
32
  }
33
+
34
+ // @ts-ignore
33
35
  window.trackPage = trackPage;
36
+ // @ts-ignore
34
37
  window.trackEvent = trackEvent;
35
38
  return function TrackedComponent(props) {
36
39
  const location = useLocation();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.10.67",
3
+ "version": "2.10.69",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -43,7 +43,10 @@
43
43
  "@babel/preset-env": "^7.19.3",
44
44
  "@babel/preset-react": "^7.18.6",
45
45
  "@babel/preset-typescript": "^7.24.7",
46
+ "@types/base64-url": "^2.2.2",
47
+ "@types/pako": "^2.0.3",
46
48
  "@types/react": "^18.3.4",
49
+ "@types/react-helmet": "^6.1.11",
47
50
  "@typescript-eslint/eslint-plugin": "^8.7.0",
48
51
  "@typescript-eslint/parser": "^8.7.0",
49
52
  "babel-plugin-inline-react-svg": "^1.1.2",
@@ -64,12 +67,12 @@
64
67
  "react": ">=18.2.0",
65
68
  "react-router-dom": ">=6.22.3"
66
69
  },
67
- "gitHead": "6832c5e23016283254d930ae879573fbb07710b2",
70
+ "gitHead": "4b3b22a5487469fdbd2abd68c0bb74cb06a68bd9",
68
71
  "dependencies": {
69
72
  "@arcblock/did-motif": "^1.1.13",
70
- "@arcblock/icons": "^2.10.67",
71
- "@arcblock/nft-display": "^2.10.67",
72
- "@arcblock/react-hooks": "^2.10.67",
73
+ "@arcblock/icons": "^2.10.69",
74
+ "@arcblock/nft-display": "^2.10.69",
75
+ "@arcblock/react-hooks": "^2.10.69",
73
76
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
74
77
  "@fontsource/inter": "^5.0.16",
75
78
  "@fontsource/ubuntu-mono": "^5.0.18",
@@ -111,6 +114,7 @@
111
114
  "react-use": "^17.4.0",
112
115
  "rebound": "^0.1.0",
113
116
  "topojson-client": "^3.1.0",
117
+ "type-fest": "^4.28.0",
114
118
  "versor": "^0.0.4"
115
119
  }
116
120
  }
@@ -8,8 +8,9 @@ import React, { forwardRef, ReactNode, useImperativeHandle, useRef, useState } f
8
8
  import { styled } from '../Theme';
9
9
  import { getFontSize } from '../Util';
10
10
  import CompactText from './compact-text';
11
+ import type { Locale, Translations } from '../type';
11
12
 
12
- const translations = {
13
+ const translations: Translations = {
13
14
  en: {
14
15
  copy: 'Click To Copy',
15
16
  copied: 'Copied!',
@@ -26,18 +27,18 @@ export interface HTMLDidAddressElement extends HTMLDivElement {
26
27
  export interface IDidAddressProps extends BoxProps {
27
28
  component?: React.ElementType;
28
29
  size?: number;
29
- copyable?: boolean;
30
+ copyable?: true | false;
30
31
  // compact mode 下, hover 时会在 tooltip 中显示完整地址, showCopyButtonInTooltip = true 时会在完整地址后显示一个复制按钮
31
- showCopyButtonInTooltip?: boolean;
32
+ showCopyButtonInTooltip?: false | true;
32
33
  content?: string;
33
- inline?: boolean;
34
+ inline?: false | true;
34
35
  prepend?: ReactNode;
35
36
  append?: ReactNode;
36
37
  // 紧凑模式
37
- compact?: boolean;
38
+ compact?: false | true;
38
39
  startChars?: number;
39
40
  endChars?: number;
40
- locale?: 'en' | 'zh';
41
+ locale?: Locale;
41
42
  }
42
43
 
43
44
  /**
@@ -3,7 +3,7 @@ import DidAddress, { HTMLDidAddressElement, IDidAddressProps } from './did-addre
3
3
  import ResponsiveDidAddress from './responsive-did-address';
4
4
 
5
5
  export interface IDidAddressWrapper extends IDidAddressProps {
6
- responsive?: boolean;
6
+ responsive?: true | false;
7
7
  }
8
8
 
9
9
  const DidAddressWrapper = forwardRef<HTMLDidAddressElement, IDidAddressWrapper>(
@@ -13,14 +13,15 @@ import { DID_PREFIX } from '../Util/constant';
13
13
  /**
14
14
  * Avatar component
15
15
  * @typedef {{
16
+ * src?: string;
16
17
  * did?: string;
17
18
  * size?: number;
18
19
  * variant?: 'circle' | 'rounded' | 'default';
19
- * animation?: boolean;
20
+ * animation?: false | true;
20
21
  * shape?: '' | 'rectangle' | 'square' | 'hexagon' | 'circle';
21
- * blockiesPadding?: boolean;
22
- * responsive?: boolean;
23
- * } & Omit<import('../Img').ImgProps, 'size'>} AvatarProps
22
+ * blockiesPadding?: true | false;
23
+ * responsive?: false | true;
24
+ * } & Omit<import('../Img').ImgProps, 'size' | 'src'>} AvatarProps
24
25
  */
25
26
 
26
27
  /**
@@ -30,6 +31,7 @@ import { DID_PREFIX } from '../Util/constant';
30
31
  */
31
32
  function Avatar(props) {
32
33
  const [imgError, setImgError] = useState(false);
34
+ /** @type {AvatarProps} */
33
35
  const newProps = mergeProps(props, Avatar, []);
34
36
  const { did = '', size, src, variant, animation, shape, blockiesPadding, responsive, ...rest } = newProps;
35
37
 
@@ -132,8 +132,8 @@ const Div = styled('div')`
132
132
  * cover?: string;
133
133
  * version?: string;
134
134
  * buttonText?: string;
135
- * buttonDisabled?: boolean;
136
- * buttonLoading?: boolean;
135
+ * buttonDisabled?: false | true;
136
+ * buttonLoading?: false | true;
137
137
  * button?: JSX.Element;
138
138
  * onButtonClick?: Function;
139
139
  * onMainClick?: Function;
@@ -11,12 +11,12 @@ function BlockletProvider({
11
11
  baseUrl = '',
12
12
  loading = null,
13
13
  }: {
14
- children: React.ReactNode;
14
+ children?: React.ReactNode;
15
15
  /**
16
16
  * baseUrl 为 blocklet origin + blocklet prefix
17
17
  */
18
- baseUrl: string;
19
- loading: React.ReactNode;
18
+ baseUrl?: string;
19
+ loading?: React.ReactNode;
20
20
  }) {
21
21
  const [blockletData, setBlockletData] = useState<Blocklet | null>(null);
22
22
  const getBlockleData = useMemoizedFn(async () => {
@@ -208,10 +208,10 @@ BlockletIcon.propTypes = {
208
208
  * description?: string;
209
209
  * cover?: string;
210
210
  * did?: string;
211
- * isStickyButton?: boolean;
211
+ * isStickyButton?: false | true;
212
212
  * buttonText?: string;
213
- * buttonDisabled?: boolean;
214
- * buttonLoading?: boolean;
213
+ * buttonDisabled?: false | true;
214
+ * buttonLoading?: false | true;
215
215
  * button?: JSX.Element;
216
216
  * addons?: Array<any>;
217
217
  * size?: 'xs' | 'sm' | 'md' | 'auto';
@@ -26,8 +26,8 @@ export interface IBlockletStore extends CardProps {
26
26
  };
27
27
  button?: React.ReactNode;
28
28
  buttonText?: string;
29
- buttonDisabled?: boolean;
30
- buttonLoading?: boolean;
29
+ buttonDisabled?: false | true;
30
+ buttonLoading?: false | true;
31
31
  onButtonClick?: Function;
32
32
  onMainClick?: Function;
33
33
  className?: string;
@@ -21,8 +21,8 @@ const extendedColors = {
21
21
  /**
22
22
  * @typedef {import('@mui/material').ButtonProps} MuiButtonProps
23
23
  * @typedef {{
24
- * rounded?: boolean,
25
- * loading?: boolean,
24
+ * rounded?: false | true,
25
+ * loading?: false | true,
26
26
  * forwardedRef?: import('react').ForwardedRef<any>,
27
27
  * color?: MuiButtonProps['color'] | 'reverse' | 'did'
28
28
  * }} CustomButtonProps
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-unused-vars */
2
1
  import { useState, useEffect, useRef } from 'react';
3
2
  import styled from '@emotion/styled';
4
3
  import noop from 'lodash/noop';
@@ -4,7 +4,7 @@ export default function Center({
4
4
  children,
5
5
  relative = 'screen',
6
6
  }: {
7
- children: React.ReactNode;
7
+ children?: React.ReactNode;
8
8
  /**
9
9
  * 容器相对尺寸,默认相对屏幕(screen),可设置为父容器(parent)
10
10
  */
@@ -1,15 +1,15 @@
1
- /* eslint-disable no-unused-vars */
2
1
  import Tooltip from '@mui/material/Tooltip';
3
2
  import { green } from '@mui/material/colors';
4
3
  import CopyIcon from '@mui/icons-material/ContentCopy';
5
4
  import CheckIcon from '@mui/icons-material/Check';
6
5
  import useCopy from './hook';
6
+ import type { Locale } from '../type';
7
7
 
8
8
  export interface CopyButtonProps extends React.HTMLAttributes<HTMLSpanElement> {
9
9
  content?: string;
10
- locale?: 'en' | 'zh';
11
- render?: (props: { copyButton: React.ReactNode; containerRef: React.RefObject<HTMLElement> }) => React.ReactNode;
12
- showTooltip?: boolean;
10
+ locale?: Locale;
11
+ render?: (props: { copyButton: React.ReactNode; containerRef: React.RefObject<HTMLElement> }) => JSX.Element | null;
12
+ showTooltip?: true | false;
13
13
  }
14
14
 
15
15
  export default function CopyButton({
@@ -1,7 +1,8 @@
1
1
  import { useState, useEffect, useRef } from 'react';
2
2
  import Copy from 'copy-to-clipboard';
3
+ import type { Locale, Translations } from '../type';
3
4
 
4
- const translations = {
5
+ const translations: Translations = {
5
6
  en: {
6
7
  copy: 'Click To Copy',
7
8
  copied: 'Copied!',
@@ -12,7 +13,7 @@ const translations = {
12
13
  },
13
14
  };
14
15
 
15
- export default function useCopy({ content, locale = 'en' }: { content?: string; locale?: 'en' | 'zh' }) {
16
+ export default function useCopy({ content, locale = 'en' }: { content?: string; locale?: Locale }) {
16
17
  const [copied, setCopied] = useState(false);
17
18
  const containerRef = useRef<HTMLElement | null>(null);
18
19
  const copy = (e: React.MouseEvent) => {
@@ -1,11 +1,12 @@
1
1
  import { useSize } from 'ahooks';
2
- import Tooltip from '@mui/material/Tooltip';
2
+ import Tooltip, { type TooltipProps } from '@mui/material/Tooltip';
3
3
 
4
4
  import { useSnackbar } from 'notistack';
5
5
  import useCopy from './hook';
6
6
  import Toast, { ToastProvider } from '../Toast';
7
7
  import { mergeProps } from '../Util';
8
8
  import { styled } from '../Theme';
9
+ import type { Locale } from '../type';
9
10
 
10
11
  export { default as CopyButton } from './copy-button';
11
12
 
@@ -26,13 +27,13 @@ const UnstyledContainer = styled('span')`
26
27
  cursor: pointer;
27
28
  `;
28
29
 
29
- export interface ClickToCopyProps extends React.HTMLAttributes<HTMLDivElement> {
30
+ export interface ClickToCopyProps extends TooltipProps {
30
31
  content?: string;
31
- locale?: 'en' | 'zh';
32
+ locale?: Locale;
32
33
  tip?: string;
33
34
  tipPlacement?: string;
34
35
  copiedTip?: string;
35
- unstyled?: boolean;
36
+ unstyled?: false | true;
36
37
  }
37
38
 
38
39
  export default function ClickToCopy(props: ClickToCopyProps) {
@@ -74,6 +75,6 @@ ClickToCopy.defaultProps = {
74
75
  tip: '',
75
76
  copiedTip: '',
76
77
  tipPlacement: 'right',
77
- locale: 'en' as const,
78
+ locale: 'en',
78
79
  unstyled: false,
79
80
  };
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable react/no-danger */
2
2
  import { useState } from 'react';
3
3
  import Copy from 'copy-to-clipboard';
4
+ import { type SxProps } from '@mui/material';
4
5
 
5
6
  import hljs from 'highlight.js/lib/core';
6
7
  import javascript from 'highlight.js/lib/languages/javascript';
@@ -59,7 +60,8 @@ export interface CodeBlockProps extends React.HTMLAttributes<HTMLPreElement> {
59
60
  code?: string;
60
61
  language?: string;
61
62
  children?: React.ReactNode;
62
- dark?: boolean;
63
+ dark?: true | false;
64
+ sx?: SxProps;
63
65
  }
64
66
 
65
67
  export default function CodeBlock({