@arcblock/ux 3.4.14 → 3.5.0

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 (335) hide show
  1. package/lib/Util/constant.d.ts +6 -0
  2. package/lib/Util/constant.js +25 -16
  3. package/lib/package.json.js +1 -1
  4. package/package.json +12 -9
  5. package/src/ActionButton/ActionButton.stories.jsx +0 -61
  6. package/src/ActionButton/index.jsx +0 -106
  7. package/src/ActivityIndicator/ActivityIndicator.stories.jsx +0 -9
  8. package/src/ActivityIndicator/index.jsx +0 -140
  9. package/src/Address/Address.stories.jsx +0 -38
  10. package/src/Address/compact-text.jsx +0 -76
  11. package/src/Address/did-address.tsx +0 -223
  12. package/src/Address/index.tsx +0 -21
  13. package/src/Address/responsive-did-address.tsx +0 -154
  14. package/src/Alert/Alert.stories.jsx +0 -100
  15. package/src/Alert/index.jsx +0 -130
  16. package/src/AnimationWaiter/AnimationWaiter.stories.jsx +0 -35
  17. package/src/AnimationWaiter/dark-animation.json +0 -1
  18. package/src/AnimationWaiter/default-animation.json +0 -1
  19. package/src/AnimationWaiter/index.jsx +0 -296
  20. package/src/Async/index.tsx +0 -44
  21. package/src/Avatar/Avatar.stories.jsx +0 -11
  22. package/src/Avatar/did-motif.jsx +0 -38
  23. package/src/Avatar/etherscan-blockies.js +0 -81
  24. package/src/Avatar/index.jsx +0 -195
  25. package/src/Badge/Badge.stories.jsx +0 -41
  26. package/src/Badge/index.jsx +0 -101
  27. package/src/Blocklet/Blocklet.stories.jsx +0 -21
  28. package/src/Blocklet/blocklet.jsx +0 -276
  29. package/src/Blocklet/index.js +0 -5
  30. package/src/Blocklet/utils.jsx +0 -58
  31. package/src/BlockletContext/index.tsx +0 -72
  32. package/src/BlockletNFT/BlockletNFT.stories.jsx +0 -21
  33. package/src/BlockletNFT/index.jsx +0 -378
  34. package/src/BlockletV2/Blocklet.stories.jsx +0 -34
  35. package/src/BlockletV2/blocklet.tsx +0 -247
  36. package/src/BlockletV2/components/icon-text.tsx +0 -47
  37. package/src/BlockletV2/components/tooltip-icon.tsx +0 -52
  38. package/src/BlockletV2/index.ts +0 -6
  39. package/src/BlockletV2/utils.js +0 -75
  40. package/src/Button/Button.stories.jsx +0 -24
  41. package/src/Button/index.js +0 -9
  42. package/src/Button/wrap.jsx +0 -126
  43. package/src/ButtonGroup/index.js +0 -16
  44. package/src/CardSelector/index.tsx +0 -136
  45. package/src/Center/Center.stories.jsx +0 -20
  46. package/src/Center/index.tsx +0 -33
  47. package/src/ClickToCopy/ClickToCopy.stories.jsx +0 -24
  48. package/src/ClickToCopy/copy-button.tsx +0 -43
  49. package/src/ClickToCopy/hook.ts +0 -42
  50. package/src/ClickToCopy/index.tsx +0 -96
  51. package/src/CloseButton/index.tsx +0 -37
  52. package/src/CodeBlock/CodeBlock.stories.jsx +0 -22
  53. package/src/CodeBlock/LightBox.tsx +0 -87
  54. package/src/CodeBlock/index.tsx +0 -217
  55. package/src/Colors/Colors.stories.jsx +0 -211
  56. package/src/Colors/index.ts +0 -4
  57. package/src/Colors/themes/default.ts +0 -8
  58. package/src/Colors/themes/did-connect.ts +0 -64
  59. package/src/Colors/themes/temp.ts +0 -52
  60. package/src/Config/Config.stories.jsx +0 -16
  61. package/src/Config/config-provider.tsx +0 -62
  62. package/src/Config/index.ts +0 -2
  63. package/src/Config/theme-mode-toggle.tsx +0 -38
  64. package/src/ContactForm/ContactForm.stories.jsx +0 -32
  65. package/src/ContactForm/index.tsx +0 -264
  66. package/src/CookieConsent/CookieConsent.stories.jsx +0 -33
  67. package/src/CookieConsent/index.tsx +0 -104
  68. package/src/CountDown/CountDown.stories.jsx +0 -15
  69. package/src/CountDown/index.tsx +0 -170
  70. package/src/DID/DID.stories.jsx +0 -37
  71. package/src/DID/index.tsx +0 -393
  72. package/src/DIDConnect/app-icon.tsx +0 -37
  73. package/src/DIDConnect/app-info-item.tsx +0 -93
  74. package/src/DIDConnect/auth-apps/auth-apps-info.tsx +0 -77
  75. package/src/DIDConnect/auth-apps/index.tsx +0 -278
  76. package/src/DIDConnect/auth-apps/switch-role.tsx +0 -47
  77. package/src/DIDConnect/did-connect-container.tsx +0 -326
  78. package/src/DIDConnect/did-connect-footer.tsx +0 -76
  79. package/src/DIDConnect/did-connect-logo.tsx +0 -8
  80. package/src/DIDConnect/icons/did-wallet-logo.tsx +0 -18
  81. package/src/DIDConnect/icons/github-logo.tsx +0 -17
  82. package/src/DIDConnect/index.ts +0 -11
  83. package/src/DIDConnect/landing-page.tsx +0 -218
  84. package/src/DIDConnect/powered-by.tsx +0 -48
  85. package/src/DIDConnect/provider-icon.tsx +0 -62
  86. package/src/DIDConnect/request-storage-access-api-dialog.tsx +0 -304
  87. package/src/DIDConnect/with-container.tsx +0 -323
  88. package/src/DIDConnect/with-ux-theme.tsx +0 -22
  89. package/src/DIDLogo/Logo.stories.jsx +0 -11
  90. package/src/DIDLogo/index.tsx +0 -168
  91. package/src/Datatable/CustomToolbar.jsx +0 -415
  92. package/src/Datatable/Datatable.stories.jsx +0 -92
  93. package/src/Datatable/DatatableContext.jsx +0 -35
  94. package/src/Datatable/TableSearch.jsx +0 -166
  95. package/src/Datatable/index.jsx +0 -652
  96. package/src/Datatable/utils.js +0 -161
  97. package/src/Dialog/Dialog.stories.jsx +0 -21
  98. package/src/Dialog/confirm.jsx +0 -143
  99. package/src/Dialog/dialog.jsx +0 -199
  100. package/src/Dialog/index.js +0 -4
  101. package/src/Dialog/types.d.ts +0 -20
  102. package/src/Dialog/use-confirm.jsx +0 -188
  103. package/src/DriftBot/index.tsx +0 -81
  104. package/src/Earth/Earth.stories.jsx +0 -39
  105. package/src/Earth/countries.json +0 -8057
  106. package/src/Earth/index.tsx +0 -515
  107. package/src/Earth/util.ts +0 -72
  108. package/src/Empty/Empty.stories.jsx +0 -23
  109. package/src/Empty/index.jsx +0 -48
  110. package/src/ErrorBoundary/ErrorBoundary.stories.jsx +0 -13
  111. package/src/ErrorBoundary/fallback.tsx +0 -85
  112. package/src/ErrorBoundary/index.ts +0 -1
  113. package/src/Footer/Footer.stories.jsx +0 -13
  114. package/src/Footer/index.tsx +0 -130
  115. package/src/Header/Header.stories.jsx +0 -30
  116. package/src/Header/addon-button.tsx +0 -41
  117. package/src/Header/auto-hidden.tsx +0 -31
  118. package/src/Header/header-addons.tsx +0 -37
  119. package/src/Header/header.tsx +0 -214
  120. package/src/Header/index.ts +0 -3
  121. package/src/Header/responsive-header.tsx +0 -145
  122. package/src/Icon/Icon.stories.jsx +0 -45
  123. package/src/Icon/image.tsx +0 -53
  124. package/src/Icon/index.tsx +0 -63
  125. package/src/Img/Img.stories.jsx +0 -17
  126. package/src/Img/index.jsx +0 -258
  127. package/src/InfoRow/InfoRow.stories.jsx +0 -14
  128. package/src/InfoRow/index.tsx +0 -91
  129. package/src/Layout/Layout.stories.jsx +0 -24
  130. package/src/Layout/dashboard/external-link.tsx +0 -59
  131. package/src/Layout/dashboard/full-page.tsx +0 -58
  132. package/src/Layout/dashboard/index.tsx +0 -260
  133. package/src/Layout/dashboard/sidebar.tsx +0 -198
  134. package/src/Layout/dashboard-legacy/header.tsx +0 -156
  135. package/src/Layout/dashboard-legacy/index.tsx +0 -127
  136. package/src/Layout/dashboard-legacy/sidebar.tsx +0 -129
  137. package/src/Layout/index.tsx +0 -310
  138. package/src/LoadingMask/index.tsx +0 -108
  139. package/src/Locale/LocaleSelector.stories.jsx +0 -44
  140. package/src/Locale/browser-lang.ts +0 -65
  141. package/src/Locale/context.tsx +0 -162
  142. package/src/Locale/languages.ts +0 -58
  143. package/src/Locale/selector.tsx +0 -174
  144. package/src/Locale/util.ts +0 -38
  145. package/src/Logo/Logo.stories.jsx +0 -23
  146. package/src/Logo/images/logo-dark-text.svg +0 -3
  147. package/src/Logo/images/logo-dark-top.svg +0 -6
  148. package/src/Logo/images/logo-light-text.svg +0 -3
  149. package/src/Logo/images/logo-light-top.svg +0 -6
  150. package/src/Logo/index.tsx +0 -58
  151. package/src/Metric/Metric.stories.jsx +0 -29
  152. package/src/Metric/index.tsx +0 -130
  153. package/src/MuiWrap/index.tsx +0 -10
  154. package/src/NFTDisplay/NFTBroken.svg +0 -34
  155. package/src/NFTDisplay/NFTDisplay.stories.jsx +0 -30
  156. package/src/NFTDisplay/README.md +0 -59
  157. package/src/NFTDisplay/aspect-ratio-container.tsx +0 -36
  158. package/src/NFTDisplay/broken.tsx +0 -51
  159. package/src/NFTDisplay/displayApi.ts +0 -43
  160. package/src/NFTDisplay/index.tsx +0 -393
  161. package/src/NFTDisplay/loading.tsx +0 -16
  162. package/src/NFTDisplay/preview.tsx +0 -84
  163. package/src/NFTDisplay/render-svg.tsx +0 -21
  164. package/src/NFTDisplay/svg-embedder/img.tsx +0 -27
  165. package/src/NFTDisplay/svg-embedder/inline-svg.tsx +0 -36
  166. package/src/NavMenu/NavMenu.stories.jsx +0 -17
  167. package/src/NavMenu/images/OCAP.svg +0 -1
  168. package/src/NavMenu/images/abt-network.svg +0 -1
  169. package/src/NavMenu/images/ai-kit.svg +0 -1
  170. package/src/NavMenu/images/aigne-image-smith.svg +0 -1
  171. package/src/NavMenu/images/aigne.svg +0 -1
  172. package/src/NavMenu/images/aistro.png +0 -0
  173. package/src/NavMenu/images/arcsphere.svg +0 -1
  174. package/src/NavMenu/images/blocklet-framework.svg +0 -1
  175. package/src/NavMenu/images/blocklet-launcher.svg +0 -1
  176. package/src/NavMenu/images/blocklet-server.svg +0 -1
  177. package/src/NavMenu/images/blocklet-store.svg +0 -1
  178. package/src/NavMenu/images/creator-studio.svg +0 -1
  179. package/src/NavMenu/images/did-wallet.svg +0 -1
  180. package/src/NavMenu/images/did.svg +0 -1
  181. package/src/NavMenu/images/nft-studio.svg +0 -1
  182. package/src/NavMenu/images/payment-kit.png +0 -0
  183. package/src/NavMenu/images/vc.svg +0 -1
  184. package/src/NavMenu/images/web3-kit.svg +0 -1
  185. package/src/NavMenu/index.ts +0 -3
  186. package/src/NavMenu/nav-menu-context.tsx +0 -30
  187. package/src/NavMenu/nav-menu.tsx +0 -441
  188. package/src/NavMenu/products.tsx +0 -830
  189. package/src/NavMenu/style.ts +0 -258
  190. package/src/NavMenu/sub-container.tsx +0 -125
  191. package/src/NavMenu/sub-item-group.tsx +0 -42
  192. package/src/OrgTransfer/index.tsx +0 -53
  193. package/src/OrgTransfer/locales.ts +0 -25
  194. package/src/OrgTransfer/selector.tsx +0 -252
  195. package/src/OrgTransfer/type.ts +0 -31
  196. package/src/PageScroller/index.tsx +0 -316
  197. package/src/PageScroller/story/FifthComponent.jsx +0 -7
  198. package/src/PageScroller/story/FirstComponent.jsx +0 -7
  199. package/src/PageScroller/story/FourthComponent.jsx +0 -7
  200. package/src/PageScroller/story/FullPage.jsx +0 -55
  201. package/src/PageScroller/story/PageContain.jsx +0 -59
  202. package/src/PageScroller/story/PageScroller.stories.jsx +0 -18
  203. package/src/PageScroller/story/SecondComponent.jsx +0 -7
  204. package/src/PageScroller/story/ThirdComponent.jsx +0 -7
  205. package/src/PageScroller/story/index.css +0 -115
  206. package/src/PageScroller/usePrevValue.ts +0 -11
  207. package/src/Passport/index.ts +0 -3
  208. package/src/Passport/passport.tsx +0 -118
  209. package/src/PhoneInput/PhoneInput.stories.jsx +0 -12
  210. package/src/PhoneInput/country-select.tsx +0 -148
  211. package/src/PhoneInput/index.tsx +0 -269
  212. package/src/PoweredByArcBlock/index.tsx +0 -27
  213. package/src/PricingTable/PricingPlan.tsx +0 -120
  214. package/src/PricingTable/PricingTable.stories.jsx +0 -38
  215. package/src/PricingTable/index.tsx +0 -59
  216. package/src/QRCode/QRCode.stories.jsx +0 -13
  217. package/src/QRCode/index.tsx +0 -66
  218. package/src/RelativeTime/RelativeTime.stories.jsx +0 -20
  219. package/src/RelativeTime/index.tsx +0 -334
  220. package/src/Result/Result.stories.jsx +0 -61
  221. package/src/Result/common.tsx +0 -119
  222. package/src/Result/index.tsx +0 -30
  223. package/src/Result/result.tsx +0 -65
  224. package/src/Result/translations.ts +0 -57
  225. package/src/Screenshot/BaseScreenshot/index.tsx +0 -73
  226. package/src/Screenshot/BaseScreenshot/shells/Macbook.tsx +0 -38
  227. package/src/Screenshot/BaseScreenshot/shells/Phone.tsx +0 -35
  228. package/src/Screenshot/Screenshot.stories.jsx +0 -44
  229. package/src/Screenshot/devices.css +0 -1366
  230. package/src/Screenshot/index.tsx +0 -300
  231. package/src/SessionBlocklet/index.tsx +0 -178
  232. package/src/SessionManager/SessionManager.stories.jsx +0 -9
  233. package/src/SessionManager/index.tsx +0 -3
  234. package/src/SessionPermission/index.tsx +0 -26
  235. package/src/SessionUser/components/did-space.tsx +0 -68
  236. package/src/SessionUser/components/logged-in.tsx +0 -338
  237. package/src/SessionUser/components/quick-login-item.tsx +0 -132
  238. package/src/SessionUser/components/session-user-item.tsx +0 -93
  239. package/src/SessionUser/components/session-user-switch.tsx +0 -240
  240. package/src/SessionUser/components/un-login.tsx +0 -257
  241. package/src/SessionUser/components/user-info.tsx +0 -201
  242. package/src/SessionUser/index.tsx +0 -68
  243. package/src/SessionUser/libs/translation.ts +0 -30
  244. package/src/SessionUser/libs/utils.ts +0 -39
  245. package/src/SharedBridge/index.tsx +0 -126
  246. package/src/SocialShare/index.tsx +0 -194
  247. package/src/Sparkline/Sparkline.stories.jsx +0 -13
  248. package/src/Sparkline/index.tsx +0 -231
  249. package/src/Spinner/Spinner.stories.jsx +0 -98
  250. package/src/Spinner/index.tsx +0 -20
  251. package/src/SplitButton/SplitButton.stories.jsx +0 -32
  252. package/src/SplitButton/index.tsx +0 -116
  253. package/src/SplitButton/useClickAway.tsx +0 -24
  254. package/src/Success/index.tsx +0 -175
  255. package/src/Switch/Switch.stories.jsx +0 -16
  256. package/src/Switch/index.jsx +0 -79
  257. package/src/Tabs/Tabs.stories.jsx +0 -18
  258. package/src/Tabs/index.tsx +0 -255
  259. package/src/Tag/Tag.stories.jsx +0 -15
  260. package/src/Tag/index.jsx +0 -106
  261. package/src/TextCollapse/TextCollapse.stories.jsx +0 -73
  262. package/src/TextCollapse/index.tsx +0 -85
  263. package/src/Theme/Theme.stories.jsx +0 -11
  264. package/src/Theme/index.ts +0 -21
  265. package/src/Theme/theme-provider.tsx +0 -374
  266. package/src/Theme/theme.ts +0 -229
  267. package/src/Toast/Toast.stories.jsx +0 -28
  268. package/src/Toast/index.tsx +0 -80
  269. package/src/Typography/index.tsx +0 -124
  270. package/src/UserCard/Cards/avatar-only.tsx +0 -27
  271. package/src/UserCard/Cards/basic-info.tsx +0 -43
  272. package/src/UserCard/Cards/index.tsx +0 -16
  273. package/src/UserCard/Cards/social-actions.tsx +0 -196
  274. package/src/UserCard/Container/card.tsx +0 -63
  275. package/src/UserCard/Container/dialog.tsx +0 -37
  276. package/src/UserCard/Content/basic.tsx +0 -330
  277. package/src/UserCard/Content/clock.tsx +0 -82
  278. package/src/UserCard/Content/minimal.tsx +0 -113
  279. package/src/UserCard/Content/shorten-label.tsx +0 -32
  280. package/src/UserCard/Content/tooltip-avatar.tsx +0 -80
  281. package/src/UserCard/UserCard.stories.jsx +0 -19
  282. package/src/UserCard/components.tsx +0 -81
  283. package/src/UserCard/index.tsx +0 -132
  284. package/src/UserCard/types.ts +0 -165
  285. package/src/UserCard/use-follow.tsx +0 -111
  286. package/src/UserCard/utils.ts +0 -155
  287. package/src/Util/WebWalletOpener.stories.jsx +0 -5
  288. package/src/Util/client.ts +0 -4
  289. package/src/Util/constant.ts +0 -60
  290. package/src/Util/deprecate.tsx +0 -29
  291. package/src/Util/federated.ts +0 -125
  292. package/src/Util/iframe.ts +0 -19
  293. package/src/Util/index.ts +0 -760
  294. package/src/Util/logger.ts +0 -44
  295. package/src/Util/passport.ts +0 -127
  296. package/src/Util/security.ts +0 -72
  297. package/src/Util/style.ts +0 -17
  298. package/src/Util/wallet.ts +0 -35
  299. package/src/VerificationCode/index.tsx +0 -83
  300. package/src/Video/Video.stories.jsx +0 -6
  301. package/src/Video/index.tsx +0 -70
  302. package/src/Wallet/Action.stories.jsx +0 -8
  303. package/src/Wallet/Action.tsx +0 -118
  304. package/src/Wallet/Download.stories.jsx +0 -9
  305. package/src/Wallet/Download.tsx +0 -157
  306. package/src/Wallet/Open.tsx +0 -47
  307. package/src/Wallet/OpenInWallet.stories.jsx +0 -5
  308. package/src/Wallet/images/abtwallet.png +0 -0
  309. package/src/Wallet/images/android_download.svg +0 -22
  310. package/src/Wallet/images/app-store.svg +0 -30
  311. package/src/Wallet/images/google-play.svg +0 -69
  312. package/src/WalletOSIcon/index.tsx +0 -47
  313. package/src/WebWalletSWKeeper/index.tsx +0 -117
  314. package/src/WechatPrompt/images/android.png +0 -0
  315. package/src/WechatPrompt/images/ios.png +0 -0
  316. package/src/WechatPrompt/index.tsx +0 -75
  317. package/src/global.d.ts +0 -28
  318. package/src/hooks/use-blocklet-logo.tsx +0 -32
  319. package/src/hooks/use-clock.tsx +0 -62
  320. package/src/hooks/use-location-state.tsx +0 -117
  321. package/src/hooks/use-mobile.tsx +0 -6
  322. package/src/index.ts +0 -79
  323. package/src/type.d.ts +0 -44
  324. package/src/withTheme/index.tsx +0 -72
  325. package/src/withTracker/README.md +0 -37
  326. package/src/withTracker/action/bind-wallet.tsx +0 -17
  327. package/src/withTracker/action/login.tsx +0 -18
  328. package/src/withTracker/action/pay.tsx +0 -14
  329. package/src/withTracker/action/switch-passport.tsx +0 -20
  330. package/src/withTracker/constant/index.tsx +0 -3
  331. package/src/withTracker/env.tsx +0 -1
  332. package/src/withTracker/error_boundary.jsx +0 -34
  333. package/src/withTracker/index.tsx +0 -50
  334. package/src/withTracker/libs/utm.ts +0 -46
  335. package/vite.config.mjs +0 -37
@@ -1,85 +0,0 @@
1
- import { Alert, AlertTitle, Box, Typography, type AlertProps } from '@mui/material';
2
- import { ReactNode } from 'react';
3
- import { useRouteError } from 'react-router-dom';
4
-
5
- import Button from '../Button';
6
-
7
- interface InternalErrorFallbackProps {
8
- title?: string;
9
- desc: string;
10
- extraContent?: ReactNode;
11
- severity?: AlertProps['severity'];
12
- }
13
-
14
- function InternalErrorFallback({
15
- title = 'Something went wrong...',
16
- desc,
17
- extraContent = null,
18
- severity = 'error',
19
- }: InternalErrorFallbackProps) {
20
- const gotoHome = () => window.location.replace('/');
21
- const refresh = () => window.location.reload();
22
-
23
- return (
24
- <Alert
25
- severity={severity}
26
- variant="outlined"
27
- icon={false}
28
- sx={{
29
- justifyContent: 'center',
30
- }}>
31
- {title ? <AlertTitle>{title}</AlertTitle> : null}
32
- {desc ? (
33
- <Typography
34
- variant="body2"
35
- sx={{
36
- mb: 1,
37
- }}>
38
- {desc}
39
- </Typography>
40
- ) : null}
41
- {extraContent ?? (
42
- <Box sx={{ display: 'flex', gap: 1, justifyContent: 'center', alignItems: 'center' }}>
43
- <Button variant="outlined" color={severity} size="small" onClick={gotoHome}>
44
- Home
45
- </Button>
46
-
47
- <Button variant="contained" color={severity} size="small" onClick={refresh}>
48
- Refresh
49
- </Button>
50
- </Box>
51
- )}
52
- </Alert>
53
- );
54
- }
55
-
56
- export interface ErrorFallbackProps {
57
- error: Error;
58
- }
59
-
60
- export function ErrorFallback({ error }: ErrorFallbackProps) {
61
- return <InternalErrorFallback desc={error.message} />;
62
- }
63
-
64
- export interface ErrorFallbackRetryProps {
65
- error: Error;
66
- resetErrorBoundary: () => void;
67
- }
68
-
69
- export function ErrorFallbackRetry({ error, resetErrorBoundary }: ErrorFallbackRetryProps) {
70
- return (
71
- <InternalErrorFallback
72
- desc={error.message}
73
- extraContent={
74
- <Button variant="contained" color="error" size="small" onClick={resetErrorBoundary}>
75
- Try again
76
- </Button>
77
- }
78
- />
79
- );
80
- }
81
-
82
- export function ReactRouterErrorFallback() {
83
- const error = useRouteError() as Error;
84
- return <InternalErrorFallback title="Current route occurred an error" desc={error.message} />;
85
- }
@@ -1 +0,0 @@
1
- export * from './fallback';
@@ -1,13 +0,0 @@
1
- export { default as Basic } from './demo/basic';
2
- export { default as DarkMode } from './demo/dark-mode';
3
- export { default as CustomCopyStart } from './demo/custom-copy-start';
4
- export { default as CustomBrand } from './demo/custom-brand';
5
- export { default as Addon } from './demo/addon';
6
-
7
- export default {
8
- title: 'Layout/Footer',
9
-
10
- parameters: {
11
- layout: 'fullscreen',
12
- },
13
- };
@@ -1,130 +0,0 @@
1
- /* eslint-disable react/no-unused-prop-types */
2
- import { Typography, Container as MuiContainer, Box } from '@mui/material';
3
-
4
- import { mergeProps } from '../Util';
5
- import Logo from '../Logo';
6
- import { styled } from '../Theme';
7
-
8
- export interface FooterProps {
9
- dark?: false | true;
10
- className?: string;
11
- copyStart?: number | string;
12
- brand?: string;
13
- style?: React.CSSProperties;
14
- addon?: React.ReactNode;
15
- }
16
-
17
- export default function Footer({ ...props }: FooterProps) {
18
- const newProps = mergeProps(props, Footer, ['dark', 'style']);
19
- const { className = '', copyStart = '2017', style = {}, brand = 'ArcBlock', dark = false, addon = null } = newProps;
20
-
21
- const endYearString = `${new Date().getFullYear()}`;
22
- const copyStartString = `${copyStart}`;
23
- const copyYear = endYearString === copyStartString ? endYearString : `${copyStartString}-${endYearString}`;
24
-
25
- return (
26
- <Container className={className} style={style} dark={dark}>
27
- <MuiContainer maxWidth={false}>
28
- <Typography component="div" className="footer">
29
- <Typography component="p" className="footer-item">
30
- <span className="footer-copy">Copyright &copy; {copyYear} </span>
31
- <span className="footer-brand">{brand}</span>
32
- </Typography>
33
- {addon && (
34
- <Typography
35
- component="div"
36
- className="footer-item"
37
- sx={{ order: { xs: '-1', md: 'initial' }, ml: { xs: 0, md: 'auto' }, width: { xs: '100%', md: 'auto' } }}>
38
- {addon}
39
- </Typography>
40
- )}
41
- <Typography component="p" className="footer-item" style={{ justifyContent: 'flex-end', flexShrink: 0 }}>
42
- Powered by
43
- <Logo mode={dark ? 'light' : 'dark'} layout="horizontal" className="logo-container" />
44
- </Typography>
45
- </Typography>
46
- </MuiContainer>
47
- <Box
48
- sx={{
49
- position: 'absolute',
50
- right: 16,
51
- bottom: 0,
52
- fontSize: 12,
53
- color: 'transparent',
54
- '::selection': { background: '#000', color: '#fff' },
55
- }}>
56
- {window?.blocklet?.version}
57
- </Box>
58
- </Container>
59
- );
60
- }
61
-
62
- type ContainerProps = {
63
- dark: boolean;
64
- };
65
-
66
- const Container = styled('div', {
67
- shouldForwardProp: (prop) => prop !== 'dark',
68
- })<ContainerProps>`
69
- position: relative;
70
- margin-top: ${({ theme }) => theme.spacing(2)};
71
- padding: 24px 0 32px;
72
- border-top: 1px solid ${(props) => props.theme.palette.divider};
73
- box-sizing: border-box;
74
- width: 100%;
75
-
76
- @media (max-width: 540px) {
77
- padding: 8px 0;
78
- }
79
-
80
- .footer {
81
- display: flex;
82
- align-items: center;
83
- justify-content: space-between;
84
- flex-wrap: wrap;
85
-
86
- .footer-item {
87
- color: ${(props) => {
88
- return props.theme.palette.text.hint;
89
- }};
90
- display: flex;
91
- align-items: center;
92
- flex-wrap: wrap;
93
- font-size: 0.9rem;
94
- }
95
-
96
- .footer-brand {
97
- margin-left: 8px;
98
- margin-right: 8px;
99
- }
100
-
101
- .logo-container {
102
- margin-left: 24px;
103
- width: 90px;
104
- opacity: 0.5;
105
- }
106
-
107
- @media (max-width: 540px) {
108
- .footer-item {
109
- font-size: 0.7rem;
110
- }
111
-
112
- .logo-container {
113
- margin: 0 0 0 16px;
114
- width: 70px;
115
- height: 40px;
116
- }
117
- }
118
-
119
- @media (max-width: 380px) {
120
- .footer-item {
121
- font-size: 0.65rem;
122
- }
123
-
124
- .logo-container {
125
- margin: 0 0 0 8px;
126
- height: 24px;
127
- }
128
- }
129
- }
130
- `;
@@ -1,30 +0,0 @@
1
- import Basic from './demo/basic';
2
- import WithNavigation from './demo/with-navigation';
3
- import WithNavigationAlignRight from './demo/with-navigation-align-right';
4
- import ResponsiveHeader from './demo/responsive-header';
5
-
6
- export default {
7
- title: 'Layout/Header',
8
- parameters: {
9
- layout: 'fullscreen',
10
- docs: {
11
- description: {
12
- component:
13
- 'A generic page header component that supports common design elements such as logo, brand title, brand description, etc., and provides content slots for displaying navigation and action buttons.',
14
- },
15
- },
16
- design: {
17
- type: 'figma',
18
- url: 'https://www.figma.com/file/E8TSBWCOyXzETmVOjzbqvw/ArcBlock-UI-Kit?node-id=1504%3A4630',
19
- },
20
- },
21
- };
22
-
23
- const argTypes = {
24
- maxWidth: { control: 'select', options: ['xs', 'sm', 'md', 'lg', 'xl', false] },
25
- };
26
-
27
- Basic.argTypes = argTypes;
28
- ResponsiveHeader.argTypes = argTypes;
29
-
30
- export { Basic, WithNavigation, WithNavigationAlignRight, ResponsiveHeader };
@@ -1,41 +0,0 @@
1
- import { Button, ButtonProps } from '@mui/material';
2
-
3
- type Props<D extends React.ElementType, P = {}> = {
4
- icon?: React.ReactNode;
5
- children: React.ReactNode;
6
- } & ButtonProps<D, P>;
7
-
8
- // eslint-disable-next-line import/prefer-default-export
9
- export function AddonButton<D extends React.ElementType, P = {}>({
10
- icon = undefined,
11
- children,
12
- sx,
13
- ...rest
14
- }: Props<D, P>) {
15
- const mergedSx = [
16
- {
17
- height: 32,
18
- minWidth: 32,
19
- borderColor: 'divider',
20
- borderRadius: '100vh',
21
- fontSize: 14,
22
- color: 'text.secondary',
23
-
24
- ...(!children && {
25
- padding: 0,
26
- height: 32,
27
-
28
- '.MuiButton-startIcon': {
29
- margin: 0,
30
- },
31
- }),
32
- },
33
- ...(Array.isArray(sx) ? sx : [sx]),
34
- ];
35
-
36
- return (
37
- <Button startIcon={icon} color="inherit" variant="outlined" sx={mergedSx} {...rest}>
38
- {children}
39
- </Button>
40
- );
41
- }
@@ -1,31 +0,0 @@
1
- import { Box, type BoxProps } from '@mui/material';
2
-
3
- import { styled } from '../Theme';
4
-
5
- export interface AutoHiddenProps extends BoxProps {
6
- height: number | string;
7
- }
8
-
9
- /**
10
- * 一个容器组件, 当子元素 width 超出该容器时自动隐藏子元素, 必须设置明确的 height 值
11
- */
12
- function AutoHidden({ height, ...rest }: AutoHiddenProps) {
13
- return <Root height={height} {...rest} />;
14
- }
15
-
16
- const Root = styled(Box)`
17
- overflow: hidden;
18
- &:before {
19
- content: '';
20
- display: inline-block;
21
- width: 1px;
22
- height: 100%;
23
- float: left;
24
- }
25
- > * {
26
- float: left;
27
- white-space: nowrap;
28
- }
29
- `;
30
-
31
- export default AutoHidden;
@@ -1,37 +0,0 @@
1
- import { Box, type BoxProps } from '@mui/material';
2
-
3
- export default function HeaderAddons({ children, ...rest }: BoxProps) {
4
- return (
5
- <Box
6
- sx={{
7
- display: 'flex',
8
- alignItems: 'center',
9
- gap: 1.5,
10
- '> *': {
11
- m: '0px!important',
12
- },
13
- '.MuiIconButton-root': {
14
- width: 32,
15
- height: 32,
16
- p: 0,
17
- border: 1,
18
- borderColor: 'divider',
19
- },
20
- '.MuiIconButton-root svg, .MuiButton-root svg': {
21
- fontSize: 18,
22
- width: '1em!important',
23
- height: '1em!important',
24
- },
25
- '.arc-session-user-logged-in > *, .arc-session-user-logged-in svg': {
26
- width: '100%!important',
27
- height: '100%!important',
28
- },
29
- '.arc-session-user-unlogin svg': {
30
- transform: 'scale(1)!important',
31
- },
32
- }}
33
- {...rest}>
34
- {children}
35
- </Box>
36
- );
37
- }
@@ -1,214 +0,0 @@
1
- import { Box, type BoxProps, Container, type Breakpoint } from '@mui/material';
2
- import { useRef, useState, useEffect, type JSX } from 'react';
3
- import AutoHidden from './auto-hidden';
4
- import { styled } from '../Theme';
5
- import HeaderAddons from './header-addons';
6
-
7
- export interface HeaderProps extends Omit<BoxProps, 'maxWidth'> {
8
- /** logo img/svg, 可以包裹一个 a 标签 */
9
- logo?: React.ReactNode;
10
- /** 相当于 Title, 可以包裹一个 a 标签 */
11
- brand?: React.ReactNode;
12
- /** brand 右侧的内容区域, 可显示一个 badge 或 tag */
13
- brandAddon?: React.ReactNode;
14
- /** brand 下方的描述 */
15
- description?: React.ReactNode;
16
- /** 右侧区域, 可以放置 icons/actions/login 等 */
17
- addons?: React.ReactNode;
18
- /** logo 左侧内容 */
19
- prepend?: React.ReactNode;
20
- align?: 'left' | 'right';
21
- maxWidth?: Breakpoint | false;
22
- homeLink?: string | ((brandContent: React.ReactNode) => JSX.Element | null);
23
- }
24
-
25
- /**
26
- * Header 组件
27
- * TODO: Layout/dashboard 可以复用此处的 header
28
- */
29
- function Header({
30
- logo = null,
31
- brand = null,
32
- brandAddon = null,
33
- description = null,
34
- children = null,
35
- addons = null,
36
- prepend = null,
37
- align = 'left',
38
- maxWidth = false,
39
- homeLink = '/',
40
- ...rest
41
- }: HeaderProps) {
42
- const logoRef = useRef<HTMLDivElement>(null);
43
- const [brandWrapperMinWidth, setBrandWrapperMinWidth] = useState('0px');
44
- const style = { minWidth: brandWrapperMinWidth };
45
-
46
- useEffect(() => {
47
- const { searchParams } = new URL(window.location.href);
48
- if (searchParams.get('inviter')) {
49
- window.localStorage.setItem('inviter', searchParams.get('inviter')!);
50
- }
51
-
52
- if (logoRef.current) {
53
- setBrandWrapperMinWidth(`${logoRef.current.offsetWidth}px`);
54
- }
55
- }, []);
56
-
57
- const renderBrand = () => {
58
- const brandContent = (
59
- <>
60
- {logo && (
61
- <div className="header-logo" ref={logoRef}>
62
- {logo}
63
- </div>
64
- )}
65
- {brand && (
66
- <AutoHidden height={44} sx={{ flexShrink: { xs: 1 } }}>
67
- <div className="header-brand">
68
- <div className="header-brand-title">
69
- <h2>{brand}</h2>
70
- </div>
71
- <div className="header-brand-desc">{description}</div>
72
- </div>
73
- </AutoHidden>
74
- )}
75
- </>
76
- );
77
- if (typeof homeLink === 'function') {
78
- return homeLink(brandContent);
79
- }
80
- return <a href={homeLink}>{brandContent}</a>;
81
- };
82
-
83
- return (
84
- <Root {...rest}>
85
- <Container maxWidth={maxWidth} className="header-container">
86
- {prepend}
87
- <div className="header-brand-wrapper" style={style}>
88
- {renderBrand()}
89
- </div>
90
- <div className="header-brand-addon">{brandAddon}</div>
91
- {align === 'right' && (
92
- <Box
93
- sx={{
94
- display: 'inline-block',
95
- flexGrow: 1,
96
- }}
97
- />
98
- )}
99
- {children}
100
- {align === 'left' && (
101
- <Box
102
- sx={{
103
- display: 'inline-block',
104
- flexGrow: 1,
105
- }}
106
- />
107
- )}
108
- <HeaderAddons className="header-addons">{addons}</HeaderAddons>
109
- </Container>
110
- </Root>
111
- );
112
- }
113
-
114
- const Root = styled(Box)`
115
- position: relative;
116
- font-size: 14px;
117
- z-index: ${({ theme }) => theme.zIndex.appBar};
118
- background: ${({ theme }) => theme.palette.background.default};
119
- .header-container {
120
- display: flex;
121
- align-items: center;
122
- height: 64px;
123
- }
124
-
125
- .header-brand-wrapper {
126
- flex-shrink: 2;
127
- > a {
128
- display: flex;
129
- align-items: center;
130
- height: 100%;
131
- line-height: 1;
132
- color: inherit;
133
- text-decoration: none;
134
- }
135
- }
136
- .header-brand-wrapper .header-logo {
137
- display: inline-flex;
138
- position: relative;
139
- height: 44px;
140
- margin-right: 16px;
141
- img,
142
- svg {
143
- width: auto;
144
- height: 100%;
145
- max-height: 100%;
146
- }
147
- }
148
- .header-brand {
149
- display: flex;
150
- flex-direction: column;
151
- justify-content: center;
152
- height: 44px;
153
- margin-right: 16px;
154
- line-height: 1;
155
- a {
156
- color: inherit;
157
- text-decoration: none;
158
- }
159
- .header-brand-title {
160
- display: flex;
161
- align-items: center;
162
- h2 {
163
- margin: 0;
164
- font-size: 16px;
165
- }
166
- }
167
- .header-brand-desc {
168
- margin-top: 4px;
169
- color: ${({ theme }) => {
170
- return theme.palette.text.hint;
171
- }};
172
- }
173
- }
174
- .header-brand-addon {
175
- margin-right: 16px;
176
- }
177
- .header-addons {
178
- display: flex;
179
- align-items: center;
180
- }
181
- ${(props) => props.theme.breakpoints.down('lg')} {
182
- .header-brand {
183
- margin-right: 12px;
184
- .header-brand-title {
185
- h2 {
186
- font-size: 14px;
187
- }
188
- }
189
- }
190
- .header-brand-addon {
191
- display: none;
192
- }
193
- }
194
- ${(props) => props.theme.breakpoints.down('md')} {
195
- .header-menu {
196
- display: inline-block;
197
- }
198
- .header-brand-wrapper .header-logo {
199
- height: 32px;
200
- }
201
- .header-brand {
202
- .header-brand-title {
203
- h2 {
204
- font-size: 13px;
205
- }
206
- }
207
- .header-brand-desc {
208
- font-size: 12px;
209
- }
210
- }
211
- }
212
- `;
213
-
214
- export default Header;
@@ -1,3 +0,0 @@
1
- export { default as Header } from './header';
2
- export { default as ResponsiveHeader } from './responsive-header';
3
- export { default as HeaderAddons } from './header-addons';