@arcblock/ux 3.4.15 → 3.5.1

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 (333) hide show
  1. package/lib/package.json.js +1 -1
  2. package/package.json +10 -7
  3. package/src/ActionButton/ActionButton.stories.jsx +0 -61
  4. package/src/ActionButton/index.jsx +0 -106
  5. package/src/ActivityIndicator/ActivityIndicator.stories.jsx +0 -9
  6. package/src/ActivityIndicator/index.jsx +0 -140
  7. package/src/Address/Address.stories.jsx +0 -38
  8. package/src/Address/compact-text.jsx +0 -76
  9. package/src/Address/did-address.tsx +0 -223
  10. package/src/Address/index.tsx +0 -21
  11. package/src/Address/responsive-did-address.tsx +0 -154
  12. package/src/Alert/Alert.stories.jsx +0 -100
  13. package/src/Alert/index.jsx +0 -130
  14. package/src/AnimationWaiter/AnimationWaiter.stories.jsx +0 -35
  15. package/src/AnimationWaiter/dark-animation.json +0 -1
  16. package/src/AnimationWaiter/default-animation.json +0 -1
  17. package/src/AnimationWaiter/index.jsx +0 -296
  18. package/src/Async/index.tsx +0 -44
  19. package/src/Avatar/Avatar.stories.jsx +0 -11
  20. package/src/Avatar/did-motif.jsx +0 -38
  21. package/src/Avatar/etherscan-blockies.js +0 -81
  22. package/src/Avatar/index.jsx +0 -195
  23. package/src/Badge/Badge.stories.jsx +0 -41
  24. package/src/Badge/index.jsx +0 -101
  25. package/src/Blocklet/Blocklet.stories.jsx +0 -21
  26. package/src/Blocklet/blocklet.jsx +0 -276
  27. package/src/Blocklet/index.js +0 -5
  28. package/src/Blocklet/utils.jsx +0 -58
  29. package/src/BlockletContext/index.tsx +0 -72
  30. package/src/BlockletNFT/BlockletNFT.stories.jsx +0 -21
  31. package/src/BlockletNFT/index.jsx +0 -378
  32. package/src/BlockletV2/Blocklet.stories.jsx +0 -34
  33. package/src/BlockletV2/blocklet.tsx +0 -247
  34. package/src/BlockletV2/components/icon-text.tsx +0 -47
  35. package/src/BlockletV2/components/tooltip-icon.tsx +0 -52
  36. package/src/BlockletV2/index.ts +0 -6
  37. package/src/BlockletV2/utils.js +0 -75
  38. package/src/Button/Button.stories.jsx +0 -24
  39. package/src/Button/index.js +0 -9
  40. package/src/Button/wrap.jsx +0 -126
  41. package/src/ButtonGroup/index.js +0 -16
  42. package/src/CardSelector/index.tsx +0 -136
  43. package/src/Center/Center.stories.jsx +0 -20
  44. package/src/Center/index.tsx +0 -33
  45. package/src/ClickToCopy/ClickToCopy.stories.jsx +0 -24
  46. package/src/ClickToCopy/copy-button.tsx +0 -43
  47. package/src/ClickToCopy/hook.ts +0 -42
  48. package/src/ClickToCopy/index.tsx +0 -96
  49. package/src/CloseButton/index.tsx +0 -37
  50. package/src/CodeBlock/CodeBlock.stories.jsx +0 -22
  51. package/src/CodeBlock/LightBox.tsx +0 -87
  52. package/src/CodeBlock/index.tsx +0 -217
  53. package/src/Colors/Colors.stories.jsx +0 -211
  54. package/src/Colors/index.ts +0 -4
  55. package/src/Colors/themes/default.ts +0 -8
  56. package/src/Colors/themes/did-connect.ts +0 -64
  57. package/src/Colors/themes/temp.ts +0 -52
  58. package/src/Config/Config.stories.jsx +0 -16
  59. package/src/Config/config-provider.tsx +0 -62
  60. package/src/Config/index.ts +0 -2
  61. package/src/Config/theme-mode-toggle.tsx +0 -38
  62. package/src/ContactForm/ContactForm.stories.jsx +0 -32
  63. package/src/ContactForm/index.tsx +0 -264
  64. package/src/CookieConsent/CookieConsent.stories.jsx +0 -33
  65. package/src/CookieConsent/index.tsx +0 -104
  66. package/src/CountDown/CountDown.stories.jsx +0 -15
  67. package/src/CountDown/index.tsx +0 -170
  68. package/src/DID/DID.stories.jsx +0 -37
  69. package/src/DID/index.tsx +0 -393
  70. package/src/DIDConnect/app-icon.tsx +0 -37
  71. package/src/DIDConnect/app-info-item.tsx +0 -93
  72. package/src/DIDConnect/auth-apps/auth-apps-info.tsx +0 -77
  73. package/src/DIDConnect/auth-apps/index.tsx +0 -278
  74. package/src/DIDConnect/auth-apps/switch-role.tsx +0 -47
  75. package/src/DIDConnect/did-connect-container.tsx +0 -326
  76. package/src/DIDConnect/did-connect-footer.tsx +0 -76
  77. package/src/DIDConnect/did-connect-logo.tsx +0 -8
  78. package/src/DIDConnect/icons/did-wallet-logo.tsx +0 -18
  79. package/src/DIDConnect/icons/github-logo.tsx +0 -17
  80. package/src/DIDConnect/index.ts +0 -11
  81. package/src/DIDConnect/landing-page.tsx +0 -218
  82. package/src/DIDConnect/powered-by.tsx +0 -48
  83. package/src/DIDConnect/provider-icon.tsx +0 -62
  84. package/src/DIDConnect/request-storage-access-api-dialog.tsx +0 -304
  85. package/src/DIDConnect/with-container.tsx +0 -323
  86. package/src/DIDConnect/with-ux-theme.tsx +0 -22
  87. package/src/DIDLogo/Logo.stories.jsx +0 -11
  88. package/src/DIDLogo/index.tsx +0 -168
  89. package/src/Datatable/CustomToolbar.jsx +0 -415
  90. package/src/Datatable/Datatable.stories.jsx +0 -92
  91. package/src/Datatable/DatatableContext.jsx +0 -35
  92. package/src/Datatable/TableSearch.jsx +0 -166
  93. package/src/Datatable/index.jsx +0 -652
  94. package/src/Datatable/utils.js +0 -161
  95. package/src/Dialog/Dialog.stories.jsx +0 -21
  96. package/src/Dialog/confirm.jsx +0 -143
  97. package/src/Dialog/dialog.jsx +0 -199
  98. package/src/Dialog/index.js +0 -4
  99. package/src/Dialog/types.d.ts +0 -20
  100. package/src/Dialog/use-confirm.jsx +0 -188
  101. package/src/DriftBot/index.tsx +0 -81
  102. package/src/Earth/Earth.stories.jsx +0 -39
  103. package/src/Earth/countries.json +0 -8057
  104. package/src/Earth/index.tsx +0 -515
  105. package/src/Earth/util.ts +0 -72
  106. package/src/Empty/Empty.stories.jsx +0 -23
  107. package/src/Empty/index.jsx +0 -48
  108. package/src/ErrorBoundary/ErrorBoundary.stories.jsx +0 -13
  109. package/src/ErrorBoundary/fallback.tsx +0 -85
  110. package/src/ErrorBoundary/index.ts +0 -1
  111. package/src/Footer/Footer.stories.jsx +0 -13
  112. package/src/Footer/index.tsx +0 -130
  113. package/src/Header/Header.stories.jsx +0 -30
  114. package/src/Header/addon-button.tsx +0 -41
  115. package/src/Header/auto-hidden.tsx +0 -31
  116. package/src/Header/header-addons.tsx +0 -37
  117. package/src/Header/header.tsx +0 -214
  118. package/src/Header/index.ts +0 -3
  119. package/src/Header/responsive-header.tsx +0 -145
  120. package/src/Icon/Icon.stories.jsx +0 -45
  121. package/src/Icon/image.tsx +0 -53
  122. package/src/Icon/index.tsx +0 -63
  123. package/src/Img/Img.stories.jsx +0 -17
  124. package/src/Img/index.jsx +0 -258
  125. package/src/InfoRow/InfoRow.stories.jsx +0 -14
  126. package/src/InfoRow/index.tsx +0 -91
  127. package/src/Layout/Layout.stories.jsx +0 -24
  128. package/src/Layout/dashboard/external-link.tsx +0 -59
  129. package/src/Layout/dashboard/full-page.tsx +0 -58
  130. package/src/Layout/dashboard/index.tsx +0 -260
  131. package/src/Layout/dashboard/sidebar.tsx +0 -198
  132. package/src/Layout/dashboard-legacy/header.tsx +0 -156
  133. package/src/Layout/dashboard-legacy/index.tsx +0 -127
  134. package/src/Layout/dashboard-legacy/sidebar.tsx +0 -129
  135. package/src/Layout/index.tsx +0 -310
  136. package/src/LoadingMask/index.tsx +0 -108
  137. package/src/Locale/LocaleSelector.stories.jsx +0 -44
  138. package/src/Locale/browser-lang.ts +0 -65
  139. package/src/Locale/context.tsx +0 -162
  140. package/src/Locale/languages.ts +0 -58
  141. package/src/Locale/selector.tsx +0 -174
  142. package/src/Locale/util.ts +0 -38
  143. package/src/Logo/Logo.stories.jsx +0 -23
  144. package/src/Logo/images/logo-dark-text.svg +0 -3
  145. package/src/Logo/images/logo-dark-top.svg +0 -6
  146. package/src/Logo/images/logo-light-text.svg +0 -3
  147. package/src/Logo/images/logo-light-top.svg +0 -6
  148. package/src/Logo/index.tsx +0 -58
  149. package/src/Metric/Metric.stories.jsx +0 -29
  150. package/src/Metric/index.tsx +0 -130
  151. package/src/MuiWrap/index.tsx +0 -10
  152. package/src/NFTDisplay/NFTBroken.svg +0 -34
  153. package/src/NFTDisplay/NFTDisplay.stories.jsx +0 -30
  154. package/src/NFTDisplay/README.md +0 -59
  155. package/src/NFTDisplay/aspect-ratio-container.tsx +0 -36
  156. package/src/NFTDisplay/broken.tsx +0 -51
  157. package/src/NFTDisplay/displayApi.ts +0 -43
  158. package/src/NFTDisplay/index.tsx +0 -393
  159. package/src/NFTDisplay/loading.tsx +0 -16
  160. package/src/NFTDisplay/preview.tsx +0 -84
  161. package/src/NFTDisplay/render-svg.tsx +0 -21
  162. package/src/NFTDisplay/svg-embedder/img.tsx +0 -27
  163. package/src/NFTDisplay/svg-embedder/inline-svg.tsx +0 -36
  164. package/src/NavMenu/NavMenu.stories.jsx +0 -17
  165. package/src/NavMenu/images/OCAP.svg +0 -1
  166. package/src/NavMenu/images/abt-network.svg +0 -1
  167. package/src/NavMenu/images/ai-kit.svg +0 -1
  168. package/src/NavMenu/images/aigne-image-smith.svg +0 -1
  169. package/src/NavMenu/images/aigne.svg +0 -1
  170. package/src/NavMenu/images/aistro.png +0 -0
  171. package/src/NavMenu/images/arcsphere.svg +0 -1
  172. package/src/NavMenu/images/blocklet-framework.svg +0 -1
  173. package/src/NavMenu/images/blocklet-launcher.svg +0 -1
  174. package/src/NavMenu/images/blocklet-server.svg +0 -1
  175. package/src/NavMenu/images/blocklet-store.svg +0 -1
  176. package/src/NavMenu/images/creator-studio.svg +0 -1
  177. package/src/NavMenu/images/did-wallet.svg +0 -1
  178. package/src/NavMenu/images/did.svg +0 -1
  179. package/src/NavMenu/images/nft-studio.svg +0 -1
  180. package/src/NavMenu/images/payment-kit.png +0 -0
  181. package/src/NavMenu/images/vc.svg +0 -1
  182. package/src/NavMenu/images/web3-kit.svg +0 -1
  183. package/src/NavMenu/index.ts +0 -3
  184. package/src/NavMenu/nav-menu-context.tsx +0 -30
  185. package/src/NavMenu/nav-menu.tsx +0 -441
  186. package/src/NavMenu/products.tsx +0 -830
  187. package/src/NavMenu/style.ts +0 -258
  188. package/src/NavMenu/sub-container.tsx +0 -125
  189. package/src/NavMenu/sub-item-group.tsx +0 -42
  190. package/src/OrgTransfer/index.tsx +0 -53
  191. package/src/OrgTransfer/locales.ts +0 -25
  192. package/src/OrgTransfer/selector.tsx +0 -252
  193. package/src/OrgTransfer/type.ts +0 -31
  194. package/src/PageScroller/index.tsx +0 -316
  195. package/src/PageScroller/story/FifthComponent.jsx +0 -7
  196. package/src/PageScroller/story/FirstComponent.jsx +0 -7
  197. package/src/PageScroller/story/FourthComponent.jsx +0 -7
  198. package/src/PageScroller/story/FullPage.jsx +0 -55
  199. package/src/PageScroller/story/PageContain.jsx +0 -59
  200. package/src/PageScroller/story/PageScroller.stories.jsx +0 -18
  201. package/src/PageScroller/story/SecondComponent.jsx +0 -7
  202. package/src/PageScroller/story/ThirdComponent.jsx +0 -7
  203. package/src/PageScroller/story/index.css +0 -115
  204. package/src/PageScroller/usePrevValue.ts +0 -11
  205. package/src/Passport/index.ts +0 -3
  206. package/src/Passport/passport.tsx +0 -118
  207. package/src/PhoneInput/PhoneInput.stories.jsx +0 -12
  208. package/src/PhoneInput/country-select.tsx +0 -148
  209. package/src/PhoneInput/index.tsx +0 -269
  210. package/src/PoweredByArcBlock/index.tsx +0 -27
  211. package/src/PricingTable/PricingPlan.tsx +0 -120
  212. package/src/PricingTable/PricingTable.stories.jsx +0 -38
  213. package/src/PricingTable/index.tsx +0 -59
  214. package/src/QRCode/QRCode.stories.jsx +0 -13
  215. package/src/QRCode/index.tsx +0 -66
  216. package/src/RelativeTime/RelativeTime.stories.jsx +0 -20
  217. package/src/RelativeTime/index.tsx +0 -334
  218. package/src/Result/Result.stories.jsx +0 -61
  219. package/src/Result/common.tsx +0 -119
  220. package/src/Result/index.tsx +0 -30
  221. package/src/Result/result.tsx +0 -65
  222. package/src/Result/translations.ts +0 -57
  223. package/src/Screenshot/BaseScreenshot/index.tsx +0 -73
  224. package/src/Screenshot/BaseScreenshot/shells/Macbook.tsx +0 -38
  225. package/src/Screenshot/BaseScreenshot/shells/Phone.tsx +0 -35
  226. package/src/Screenshot/Screenshot.stories.jsx +0 -44
  227. package/src/Screenshot/devices.css +0 -1366
  228. package/src/Screenshot/index.tsx +0 -300
  229. package/src/SessionBlocklet/index.tsx +0 -178
  230. package/src/SessionManager/SessionManager.stories.jsx +0 -9
  231. package/src/SessionManager/index.tsx +0 -3
  232. package/src/SessionPermission/index.tsx +0 -26
  233. package/src/SessionUser/components/did-space.tsx +0 -68
  234. package/src/SessionUser/components/logged-in.tsx +0 -338
  235. package/src/SessionUser/components/quick-login-item.tsx +0 -132
  236. package/src/SessionUser/components/session-user-item.tsx +0 -93
  237. package/src/SessionUser/components/session-user-switch.tsx +0 -240
  238. package/src/SessionUser/components/un-login.tsx +0 -257
  239. package/src/SessionUser/components/user-info.tsx +0 -201
  240. package/src/SessionUser/index.tsx +0 -68
  241. package/src/SessionUser/libs/translation.ts +0 -30
  242. package/src/SessionUser/libs/utils.ts +0 -39
  243. package/src/SharedBridge/index.tsx +0 -126
  244. package/src/SocialShare/index.tsx +0 -194
  245. package/src/Sparkline/Sparkline.stories.jsx +0 -13
  246. package/src/Sparkline/index.tsx +0 -231
  247. package/src/Spinner/Spinner.stories.jsx +0 -98
  248. package/src/Spinner/index.tsx +0 -20
  249. package/src/SplitButton/SplitButton.stories.jsx +0 -32
  250. package/src/SplitButton/index.tsx +0 -116
  251. package/src/SplitButton/useClickAway.tsx +0 -24
  252. package/src/Success/index.tsx +0 -175
  253. package/src/Switch/Switch.stories.jsx +0 -16
  254. package/src/Switch/index.jsx +0 -79
  255. package/src/Tabs/Tabs.stories.jsx +0 -18
  256. package/src/Tabs/index.tsx +0 -255
  257. package/src/Tag/Tag.stories.jsx +0 -15
  258. package/src/Tag/index.jsx +0 -106
  259. package/src/TextCollapse/TextCollapse.stories.jsx +0 -73
  260. package/src/TextCollapse/index.tsx +0 -85
  261. package/src/Theme/Theme.stories.jsx +0 -11
  262. package/src/Theme/index.ts +0 -21
  263. package/src/Theme/theme-provider.tsx +0 -374
  264. package/src/Theme/theme.ts +0 -229
  265. package/src/Toast/Toast.stories.jsx +0 -28
  266. package/src/Toast/index.tsx +0 -80
  267. package/src/Typography/index.tsx +0 -124
  268. package/src/UserCard/Cards/avatar-only.tsx +0 -27
  269. package/src/UserCard/Cards/basic-info.tsx +0 -43
  270. package/src/UserCard/Cards/index.tsx +0 -16
  271. package/src/UserCard/Cards/social-actions.tsx +0 -196
  272. package/src/UserCard/Container/card.tsx +0 -63
  273. package/src/UserCard/Container/dialog.tsx +0 -37
  274. package/src/UserCard/Content/basic.tsx +0 -330
  275. package/src/UserCard/Content/clock.tsx +0 -82
  276. package/src/UserCard/Content/minimal.tsx +0 -113
  277. package/src/UserCard/Content/shorten-label.tsx +0 -32
  278. package/src/UserCard/Content/tooltip-avatar.tsx +0 -80
  279. package/src/UserCard/UserCard.stories.jsx +0 -19
  280. package/src/UserCard/components.tsx +0 -81
  281. package/src/UserCard/index.tsx +0 -132
  282. package/src/UserCard/types.ts +0 -165
  283. package/src/UserCard/use-follow.tsx +0 -111
  284. package/src/UserCard/utils.ts +0 -155
  285. package/src/Util/WebWalletOpener.stories.jsx +0 -5
  286. package/src/Util/client.ts +0 -4
  287. package/src/Util/constant.ts +0 -70
  288. package/src/Util/deprecate.tsx +0 -29
  289. package/src/Util/federated.ts +0 -125
  290. package/src/Util/iframe.ts +0 -19
  291. package/src/Util/index.ts +0 -760
  292. package/src/Util/logger.ts +0 -44
  293. package/src/Util/passport.ts +0 -127
  294. package/src/Util/security.ts +0 -72
  295. package/src/Util/style.ts +0 -17
  296. package/src/Util/wallet.ts +0 -35
  297. package/src/VerificationCode/index.tsx +0 -83
  298. package/src/Video/Video.stories.jsx +0 -6
  299. package/src/Video/index.tsx +0 -70
  300. package/src/Wallet/Action.stories.jsx +0 -8
  301. package/src/Wallet/Action.tsx +0 -118
  302. package/src/Wallet/Download.stories.jsx +0 -9
  303. package/src/Wallet/Download.tsx +0 -157
  304. package/src/Wallet/Open.tsx +0 -47
  305. package/src/Wallet/OpenInWallet.stories.jsx +0 -5
  306. package/src/Wallet/images/abtwallet.png +0 -0
  307. package/src/Wallet/images/android_download.svg +0 -22
  308. package/src/Wallet/images/app-store.svg +0 -30
  309. package/src/Wallet/images/google-play.svg +0 -69
  310. package/src/WalletOSIcon/index.tsx +0 -47
  311. package/src/WebWalletSWKeeper/index.tsx +0 -117
  312. package/src/WechatPrompt/images/android.png +0 -0
  313. package/src/WechatPrompt/images/ios.png +0 -0
  314. package/src/WechatPrompt/index.tsx +0 -75
  315. package/src/global.d.ts +0 -28
  316. package/src/hooks/use-blocklet-logo.tsx +0 -32
  317. package/src/hooks/use-clock.tsx +0 -62
  318. package/src/hooks/use-location-state.tsx +0 -117
  319. package/src/hooks/use-mobile.tsx +0 -6
  320. package/src/index.ts +0 -79
  321. package/src/type.d.ts +0 -44
  322. package/src/withTheme/index.tsx +0 -72
  323. package/src/withTracker/README.md +0 -37
  324. package/src/withTracker/action/bind-wallet.tsx +0 -17
  325. package/src/withTracker/action/login.tsx +0 -18
  326. package/src/withTracker/action/pay.tsx +0 -14
  327. package/src/withTracker/action/switch-passport.tsx +0 -20
  328. package/src/withTracker/constant/index.tsx +0 -3
  329. package/src/withTracker/env.tsx +0 -1
  330. package/src/withTracker/error_boundary.jsx +0 -34
  331. package/src/withTracker/index.tsx +0 -50
  332. package/src/withTracker/libs/utm.ts +0 -46
  333. package/vite.config.mjs +0 -37
@@ -1,101 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import { Typography } from '@mui/material';
3
- import isUndefined from 'lodash/isUndefined';
4
-
5
- import colors from '../Colors';
6
- import { mergeProps } from '../Util';
7
- import { withDeprecated } from '../Util/deprecate';
8
- import { styled } from '../Theme';
9
-
10
- const types = {
11
- error: {
12
- color: colors.common.white,
13
- backgroundColor: colors.error.main,
14
- },
15
- warning: {
16
- color: colors.common.white,
17
- backgroundColor: colors.warning.main,
18
- },
19
- success: {
20
- color: colors.common.white,
21
- backgroundColor: colors.success.main,
22
- },
23
- primary: {
24
- color: colors.common.white,
25
- backgroundColor: colors.primary.main,
26
- },
27
- reverse: {
28
- color: colors.common.white,
29
- backgroundColor: colors.grey[900],
30
- },
31
- };
32
-
33
- /**
34
- * Badge component to display notification badge
35
- * @typedef {{
36
- * children: import('react').ReactNode;
37
- * content?: string;
38
- * type?: 'error' | 'warning' | 'success' | 'primary' | 'reverse';
39
- * className?: string;
40
- * style?: object | string;
41
- * } & import('@mui/material').TypographyProps } BadgeProps
42
- */
43
-
44
- /**
45
- * Badge notification component
46
- * @param {BadgeProps} props
47
- * @returns {JSX.Element}
48
- */
49
- function Badge({ ...rawProps }) {
50
- const props = Object.assign({}, rawProps);
51
- if (isUndefined(props.type)) {
52
- props.type = 'primary';
53
- }
54
- if (isUndefined(props.content)) {
55
- props.content = '';
56
- }
57
- if (isUndefined(props.className)) {
58
- props.className = '';
59
- }
60
- if (isUndefined(props.style)) {
61
- props.style = {};
62
- }
63
- const newProps = mergeProps(props, Badge, ['style']);
64
- const { type, content, children, style, className, forwardedRef, ...rest } = newProps;
65
- const styles = Object.assign(types[type] || types.primary, style);
66
-
67
- return (
68
- <Span ref={forwardedRef} component="span" className={className} style={styles} {...rest}>
69
- {content || children}
70
- </Span>
71
- );
72
- }
73
-
74
- Badge.propTypes = {
75
- children: PropTypes.any.isRequired,
76
- content: PropTypes.string,
77
- type: PropTypes.oneOf(Object.keys(types)),
78
- className: PropTypes.string,
79
- style: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
80
- };
81
-
82
- export default withDeprecated(
83
- /**
84
- * @param {BadgeProps} props - Badge组件的属性
85
- * @param {React.Ref<HTMLSpanElement>} ref - 转发的ref
86
- * @returns {JSX.Element}
87
- */
88
- ({ ref, ...props }) => <Badge {...props} forwardedRef={ref} />,
89
- { name: 'Badge', alternative: '@arcblock/ux/lib/Tag' }
90
- );
91
-
92
- const Span = styled(Typography)`
93
- && {
94
- display: inline-flex;
95
- justify-content: center;
96
- align-items: center;
97
- padding: 2px 10px;
98
- height: 24px;
99
- line-height: 24px;
100
- }
101
- `;
@@ -1,21 +0,0 @@
1
- import Basic from './demo/basic';
2
-
3
- export default {
4
- title: 'ArcBlock/Blocklet',
5
-
6
- parameters: {
7
- docs: {
8
- description: {
9
- component: 'Blocklet component is used to display Blocklet Information',
10
- },
11
- },
12
- design: {
13
- type: 'figma',
14
- url: 'https://www.figma.com/file/E8TSBWCOyXzETmVOjzbqvw/ArcBlock-UI-Kit?node-id=1342%3A3524',
15
- },
16
- },
17
- };
18
-
19
- Basic.storyName = 'Blocklet';
20
-
21
- export { Basic };
@@ -1,276 +0,0 @@
1
- /* eslint-disable react/no-danger */
2
- import { isValidElement } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { CircularProgress, Typography, useMediaQuery } from '@mui/material';
5
-
6
- import Avatar from '../Avatar';
7
- import Button from '../Button';
8
- import Img from '../Img';
9
- import { useTheme, styled } from '../Theme';
10
- import { strippedString } from './utils';
11
-
12
- const Div = styled('div')`
13
- &.arcblock-blocklet {
14
- padding: ${(props) => props.theme.spacing(2)} ${(props) => props.theme.spacing(2)} 0
15
- ${(props) => props.theme.spacing(2)};
16
- }
17
- .arcblock-blocklet__content {
18
- cursor: pointer;
19
- display: flex;
20
- ${(props) => props.theme.breakpoints.up('sm')} {
21
- align-items: center;
22
- }
23
- }
24
- .arcblock-blocklet__cover {
25
- width: 64px;
26
- height: 64px;
27
- margin-right: ${(props) => props.theme.spacing(2)};
28
- overflow: hidden;
29
- border-radius: 12px;
30
- /* see: https://stackoverflow.com/questions/49066011/overflow-hidden-with-border-radius-not-working-on-safari */
31
- transform: translateZ(0);
32
- ${(props) => props.theme.breakpoints.up('sm')} {
33
- width: 80px;
34
- height: 80px;
35
- margin-bottom: 12px;
36
- }
37
- }
38
- .arcblock-blocklet__button--hover {
39
- &:not(.Mui-disabled) {
40
- position: relative;
41
- z-index: 1;
42
- &::before {
43
- content: '';
44
- position: absolute;
45
- height: 100%;
46
- width: 100%;
47
- left: 0;
48
- top: 0;
49
- transition: opacity 0.3s;
50
- }
51
- &:hover::before {
52
- opacity: 0;
53
- }
54
- &::after {
55
- content: '';
56
- position: absolute;
57
- height: 100%;
58
- width: 100%;
59
- background-color: ${(props) => props.theme.palette.primary.main};
60
- transform: scale(0.1);
61
- opacity: 0;
62
- z-index: -1;
63
- transition:
64
- transform 0.3s,
65
- opacity 0.3s,
66
- background-color 0.3s;
67
- }
68
- &:hover::after {
69
- opacity: 1;
70
- transform-origin: center;
71
- transform: scale(1);
72
- }
73
- }
74
-
75
- &:not(.Mui-disabled) {
76
- background-color: transparent !important;
77
- color: ${(props) => props.theme.palette.primary.main};
78
- }
79
- &:not(.Mui-disabled) {
80
- &:hover {
81
- color: ${(props) => props.theme.palette.common.white};
82
- }
83
- }
84
- }
85
- .arcblock-blocklet__info {
86
- flex: 1;
87
- overflow: hidden;
88
- border-bottom: 1px solid ${(props) => props.theme.palette.divider};
89
- padding-bottom: ${(props) => props.theme.spacing(2)};
90
- }
91
- .arcblock-blocklet__text {
92
- height: 65px;
93
- overflow: hidden;
94
- }
95
- /* 设置多行文本溢出显示省略号 兼容fireFox、safari */
96
- .arcblock-blocklet__title {
97
- margin: 0;
98
- font-size: 16px;
99
- font-weight: 500;
100
- overflow: hidden;
101
- text-overflow: ellipsis;
102
- white-space: nowrap;
103
- }
104
- .arcblock-blocklet__describe {
105
- margin-top: ${(props) => props.theme.spacing(0.5)};
106
- color: ${(props) => props.theme.palette.grey[600]};
107
- font-size: 14px;
108
- font-weight: 500;
109
- line-height: 17px;
110
- max-height: 34px;
111
- overflow: hidden;
112
- text-overflow: ellipsis;
113
- display: -webkit-box;
114
- -webkit-line-clamp: 2;
115
- -webkit-box-orient: vertical;
116
- word-break: break-word;
117
- }
118
- .arcblock-blocklet__version {
119
- color: ${(props) => props.theme.palette.grey[600]};
120
- font-size: 12px;
121
- }
122
- `;
123
-
124
- /**
125
- * BlockletStore component
126
- * @typedef {{
127
- * title?: string | JSX.Element;
128
- * did?: string;
129
- * description?: string | JSX.Element;
130
- * cover?: string;
131
- * version?: string;
132
- * buttonText?: string;
133
- * buttonDisabled?: false | true;
134
- * buttonLoading?: false | true;
135
- * button?: JSX.Element;
136
- * onButtonClick?: Function;
137
- * onMainClick?: Function;
138
- * className?: string;
139
- * } & import('react').ComponentPropsWithoutRef<"div"> } BlockletStoreProps
140
- */
141
-
142
- /**
143
- * BlockletStore component
144
- * @param {BlockletStoreProps} props
145
- * @returns {JSX.Element}
146
- */
147
- export default function BlockletStore({
148
- title = '',
149
- did = null,
150
- description = '',
151
- cover = null,
152
- version = null,
153
- button = null,
154
- buttonText = 'Install',
155
- buttonDisabled = false,
156
- buttonLoading = false,
157
- onButtonClick = null,
158
- onMainClick = null,
159
- className = null,
160
- ...rest
161
- }) {
162
- const wrapHandler =
163
- (handler, stopFn = () => false) =>
164
- (e, ...args) => {
165
- if (stopFn()) {
166
- e.preventDefault();
167
- e.stopPropagation();
168
- } else if (handler instanceof Function) {
169
- e.preventDefault();
170
- e.stopPropagation();
171
- handler(...args);
172
- }
173
- };
174
- const _onButtonClick = wrapHandler(onButtonClick, () => {
175
- // stop click while custom button or buttonDisabled or buttondLoading
176
- if (button || buttonDisabled || buttonLoading) {
177
- return true;
178
- }
179
- return false;
180
- });
181
- const theme = useTheme();
182
- const isUpSm = useMediaQuery(theme.breakpoints.up('sm'));
183
- const _onMainClick = wrapHandler(onMainClick);
184
- const didAvatarSize = isUpSm ? 80 : 64;
185
- return (
186
- <Div className={`${className} arcblock-blocklet`} {...rest}>
187
- <div className="arcblock-blocklet__content" onClick={_onMainClick}>
188
- {cover ? (
189
- <div className="arcblock-blocklet__cover">
190
- <Img src={cover} />
191
- </div>
192
- ) : (
193
- did && (
194
- <div className="arcblock-blocklet__cover">
195
- <Avatar did={did} size={didAvatarSize} />
196
- </div>
197
- )
198
- )}
199
- <div className="arcblock-blocklet__info">
200
- <div className="arcblock-blocklet__text">
201
- {isValidElement(title) ? (
202
- <Typography component="h3" variant="h3" className="arcblock-blocklet__title">
203
- {title}
204
- </Typography>
205
- ) : (
206
- <Typography
207
- component="h3"
208
- variant="h3"
209
- className="arcblock-blocklet__title"
210
- title={strippedString(title)}
211
- dangerouslySetInnerHTML={{ __html: title }}
212
- />
213
- )}
214
-
215
- {isValidElement(description) ? (
216
- <Typography component="div" variant="body2" className="arcblock-blocklet__describe">
217
- {description}
218
- </Typography>
219
- ) : (
220
- <Typography
221
- component="div"
222
- variant="body2"
223
- className="arcblock-blocklet__describe"
224
- title={strippedString(description)}
225
- dangerouslySetInnerHTML={{ __html: description }}
226
- />
227
- )}
228
- </div>
229
- <div
230
- style={{
231
- display: 'flex',
232
- alignItems: 'center',
233
- marginTop: '10px',
234
- flexFlow: 'wrap',
235
- }}>
236
- <div onClick={_onButtonClick} style={{ marginRight: '12px' }}>
237
- {button ||
238
- (onButtonClick && (
239
- <Button
240
- className="arcblock-blocklet__button--hover"
241
- variant="outlined"
242
- color="primary"
243
- size="small"
244
- disabled={buttonDisabled || buttonLoading}
245
- style={{
246
- padding: '3px 6px',
247
- fontSize: '14px',
248
- minWidth: '92px',
249
- textAlign: 'center',
250
- }}>
251
- {buttonLoading && <CircularProgress size={15} style={{ marginRight: 3, color: 'inherit' }} />}
252
- {buttonText}
253
- </Button>
254
- ))}
255
- </div>
256
- <div className="arcblock-blocklet__version">{version && `v${version}`}</div>
257
- </div>
258
- </div>
259
- </div>
260
- </Div>
261
- );
262
- }
263
- BlockletStore.propTypes = {
264
- title: PropTypes.string || PropTypes.node,
265
- did: PropTypes.string,
266
- description: PropTypes.string || PropTypes.node,
267
- cover: PropTypes.string,
268
- buttonText: PropTypes.string,
269
- buttonDisabled: PropTypes.bool,
270
- buttonLoading: PropTypes.bool,
271
- button: PropTypes.element,
272
- version: PropTypes.string,
273
- onButtonClick: PropTypes.func,
274
- onMainClick: PropTypes.func,
275
- className: PropTypes.string,
276
- };
@@ -1,5 +0,0 @@
1
- import ActionButton, { strippedString } from './utils';
2
- import Blocklet from './blocklet';
3
-
4
- export { ActionButton, strippedString };
5
- export default Blocklet;
@@ -1,58 +0,0 @@
1
- import { styled } from '../Theme';
2
-
3
- const ActionButton = styled('div')`
4
- background-color: transparent !important;
5
- & > :not(.Mui-disabled) {
6
- position: relative;
7
- z-index: 1;
8
- &::before {
9
- content: '';
10
- position: absolute;
11
- height: 100%;
12
- width: 100%;
13
- left: 0;
14
- top: 0;
15
- transition: opacity 0.3s;
16
- }
17
- &:hover::before {
18
- opacity: 0;
19
- }
20
- &::after {
21
- content: '';
22
- position: absolute;
23
- height: 100%;
24
- width: 100%;
25
- top: 0;
26
- left: 0;
27
- border-radius: 2px;
28
- background-color: ${(props) => props.theme.palette.primary.main};
29
- transform: scale(0.1);
30
- opacity: 0;
31
- z-index: -1;
32
- transition:
33
- transform 0.3s,
34
- opacity 0.3s,
35
- background-color 0.3s;
36
- }
37
- &:hover::after {
38
- opacity: 1;
39
- transform-origin: center;
40
- transform: scale(1);
41
- }
42
- }
43
- & > :not(.Mui-disabled) {
44
- background-color: transparent !important;
45
- color: ${(props) => props.theme.palette.primary.main}!important;
46
- }
47
- & > :not(.Mui-disabled) {
48
- &:hover {
49
- color: ${(props) => props.theme.palette.common.white}!important;
50
- }
51
- }
52
- `;
53
-
54
- export default ActionButton;
55
-
56
- export const strippedString = (originalString = '') => {
57
- return originalString.replace(/(<([^>]+)>)/gi, '').trim();
58
- };
@@ -1,72 +0,0 @@
1
- import { useMemoizedFn, useAsyncEffect } from 'ahooks';
2
- import { createContext, use, useState } from 'react';
3
- import type { Blocklet } from '../type';
4
- import { getBlockletData, getFederatedEnabled, getMaster } from '../Util/federated';
5
-
6
- const BlockletContext = createContext<{
7
- blocklet: Blocklet | null;
8
- masterBlocklet: Blocklet | null;
9
- }>({
10
- blocklet: null,
11
- masterBlocklet: null,
12
- });
13
-
14
- const { Provider, Consumer } = BlockletContext;
15
-
16
- function BlockletProvider({
17
- children,
18
- baseUrl = '',
19
- loading = null,
20
- }: {
21
- children: React.ReactNode;
22
- /**
23
- * baseUrl 为 blocklet origin + blocklet prefix
24
- */
25
- baseUrl?: string;
26
- loading?: React.ReactNode;
27
- }) {
28
- const [blockletData, setBlockletData] = useState<Blocklet | null>(null);
29
- const [masterBlockletData, setMasterBlockletData] = useState<Blocklet | null>(null);
30
- const getBlockleDataWithCache = useMemoizedFn(async () => {
31
- if (!baseUrl || window.location.href.startsWith(baseUrl)) {
32
- throw new Error('no blocklet data');
33
- }
34
- const jsonData = await getBlockletData(baseUrl);
35
- return jsonData;
36
- });
37
-
38
- useAsyncEffect(async () => {
39
- let result = null;
40
- let resultMaster = null;
41
- try {
42
- result = await getBlockleDataWithCache();
43
- } catch {
44
- // NOTICE: 如果获取指定 blockletData 失败,则使用 window.blocklet
45
- const data = globalThis.blocklet || globalThis.env;
46
- result = data;
47
- }
48
- if (result) {
49
- if (getFederatedEnabled(result)) {
50
- const masterSite = getMaster(result);
51
- if (masterSite) {
52
- resultMaster = await getBlockletData(masterSite.appUrl);
53
- }
54
- }
55
- }
56
- setBlockletData(result);
57
- setMasterBlockletData(resultMaster);
58
- // eslint-disable-next-line react-hooks/exhaustive-deps
59
- }, [baseUrl]);
60
- return (
61
- <Provider value={{ blocklet: blockletData, masterBlocklet: masterBlockletData }}>
62
- {blockletData ? children : loading || null}
63
- </Provider>
64
- );
65
- }
66
-
67
- function useBlockletContext() {
68
- const { blocklet, masterBlocklet } = use(BlockletContext);
69
- return { blocklet, masterBlocklet };
70
- }
71
-
72
- export { BlockletContext, BlockletProvider, Consumer as BlockletConsumer, useBlockletContext };
@@ -1,21 +0,0 @@
1
- import Basic from './demo/basic';
2
-
3
- export default {
4
- title: 'ArcBlock/BlockletNFT',
5
-
6
- parameters: {
7
- docs: {
8
- description: {
9
- component: 'BlockletNFT component is used to display Blocklet NFT Information',
10
- },
11
- },
12
- design: {
13
- type: 'figma',
14
- url: 'https://www.figma.com/file/E8TSBWCOyXzETmVOjzbqvw/ArcBlock-UI-Kit?node-id=1342%3A3524',
15
- },
16
- },
17
- };
18
-
19
- Basic.storyName = 'BlockletNFT';
20
-
21
- export { Basic };