@arcblock/ux 3.4.15 → 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.
- package/lib/package.json.js +1 -1
- package/package.json +10 -7
- package/src/ActionButton/ActionButton.stories.jsx +0 -61
- package/src/ActionButton/index.jsx +0 -106
- package/src/ActivityIndicator/ActivityIndicator.stories.jsx +0 -9
- package/src/ActivityIndicator/index.jsx +0 -140
- package/src/Address/Address.stories.jsx +0 -38
- package/src/Address/compact-text.jsx +0 -76
- package/src/Address/did-address.tsx +0 -223
- package/src/Address/index.tsx +0 -21
- package/src/Address/responsive-did-address.tsx +0 -154
- package/src/Alert/Alert.stories.jsx +0 -100
- package/src/Alert/index.jsx +0 -130
- package/src/AnimationWaiter/AnimationWaiter.stories.jsx +0 -35
- package/src/AnimationWaiter/dark-animation.json +0 -1
- package/src/AnimationWaiter/default-animation.json +0 -1
- package/src/AnimationWaiter/index.jsx +0 -296
- package/src/Async/index.tsx +0 -44
- package/src/Avatar/Avatar.stories.jsx +0 -11
- package/src/Avatar/did-motif.jsx +0 -38
- package/src/Avatar/etherscan-blockies.js +0 -81
- package/src/Avatar/index.jsx +0 -195
- package/src/Badge/Badge.stories.jsx +0 -41
- package/src/Badge/index.jsx +0 -101
- package/src/Blocklet/Blocklet.stories.jsx +0 -21
- package/src/Blocklet/blocklet.jsx +0 -276
- package/src/Blocklet/index.js +0 -5
- package/src/Blocklet/utils.jsx +0 -58
- package/src/BlockletContext/index.tsx +0 -72
- package/src/BlockletNFT/BlockletNFT.stories.jsx +0 -21
- package/src/BlockletNFT/index.jsx +0 -378
- package/src/BlockletV2/Blocklet.stories.jsx +0 -34
- package/src/BlockletV2/blocklet.tsx +0 -247
- package/src/BlockletV2/components/icon-text.tsx +0 -47
- package/src/BlockletV2/components/tooltip-icon.tsx +0 -52
- package/src/BlockletV2/index.ts +0 -6
- package/src/BlockletV2/utils.js +0 -75
- package/src/Button/Button.stories.jsx +0 -24
- package/src/Button/index.js +0 -9
- package/src/Button/wrap.jsx +0 -126
- package/src/ButtonGroup/index.js +0 -16
- package/src/CardSelector/index.tsx +0 -136
- package/src/Center/Center.stories.jsx +0 -20
- package/src/Center/index.tsx +0 -33
- package/src/ClickToCopy/ClickToCopy.stories.jsx +0 -24
- package/src/ClickToCopy/copy-button.tsx +0 -43
- package/src/ClickToCopy/hook.ts +0 -42
- package/src/ClickToCopy/index.tsx +0 -96
- package/src/CloseButton/index.tsx +0 -37
- package/src/CodeBlock/CodeBlock.stories.jsx +0 -22
- package/src/CodeBlock/LightBox.tsx +0 -87
- package/src/CodeBlock/index.tsx +0 -217
- package/src/Colors/Colors.stories.jsx +0 -211
- package/src/Colors/index.ts +0 -4
- package/src/Colors/themes/default.ts +0 -8
- package/src/Colors/themes/did-connect.ts +0 -64
- package/src/Colors/themes/temp.ts +0 -52
- package/src/Config/Config.stories.jsx +0 -16
- package/src/Config/config-provider.tsx +0 -62
- package/src/Config/index.ts +0 -2
- package/src/Config/theme-mode-toggle.tsx +0 -38
- package/src/ContactForm/ContactForm.stories.jsx +0 -32
- package/src/ContactForm/index.tsx +0 -264
- package/src/CookieConsent/CookieConsent.stories.jsx +0 -33
- package/src/CookieConsent/index.tsx +0 -104
- package/src/CountDown/CountDown.stories.jsx +0 -15
- package/src/CountDown/index.tsx +0 -170
- package/src/DID/DID.stories.jsx +0 -37
- package/src/DID/index.tsx +0 -393
- package/src/DIDConnect/app-icon.tsx +0 -37
- package/src/DIDConnect/app-info-item.tsx +0 -93
- package/src/DIDConnect/auth-apps/auth-apps-info.tsx +0 -77
- package/src/DIDConnect/auth-apps/index.tsx +0 -278
- package/src/DIDConnect/auth-apps/switch-role.tsx +0 -47
- package/src/DIDConnect/did-connect-container.tsx +0 -326
- package/src/DIDConnect/did-connect-footer.tsx +0 -76
- package/src/DIDConnect/did-connect-logo.tsx +0 -8
- package/src/DIDConnect/icons/did-wallet-logo.tsx +0 -18
- package/src/DIDConnect/icons/github-logo.tsx +0 -17
- package/src/DIDConnect/index.ts +0 -11
- package/src/DIDConnect/landing-page.tsx +0 -218
- package/src/DIDConnect/powered-by.tsx +0 -48
- package/src/DIDConnect/provider-icon.tsx +0 -62
- package/src/DIDConnect/request-storage-access-api-dialog.tsx +0 -304
- package/src/DIDConnect/with-container.tsx +0 -323
- package/src/DIDConnect/with-ux-theme.tsx +0 -22
- package/src/DIDLogo/Logo.stories.jsx +0 -11
- package/src/DIDLogo/index.tsx +0 -168
- package/src/Datatable/CustomToolbar.jsx +0 -415
- package/src/Datatable/Datatable.stories.jsx +0 -92
- package/src/Datatable/DatatableContext.jsx +0 -35
- package/src/Datatable/TableSearch.jsx +0 -166
- package/src/Datatable/index.jsx +0 -652
- package/src/Datatable/utils.js +0 -161
- package/src/Dialog/Dialog.stories.jsx +0 -21
- package/src/Dialog/confirm.jsx +0 -143
- package/src/Dialog/dialog.jsx +0 -199
- package/src/Dialog/index.js +0 -4
- package/src/Dialog/types.d.ts +0 -20
- package/src/Dialog/use-confirm.jsx +0 -188
- package/src/DriftBot/index.tsx +0 -81
- package/src/Earth/Earth.stories.jsx +0 -39
- package/src/Earth/countries.json +0 -8057
- package/src/Earth/index.tsx +0 -515
- package/src/Earth/util.ts +0 -72
- package/src/Empty/Empty.stories.jsx +0 -23
- package/src/Empty/index.jsx +0 -48
- package/src/ErrorBoundary/ErrorBoundary.stories.jsx +0 -13
- package/src/ErrorBoundary/fallback.tsx +0 -85
- package/src/ErrorBoundary/index.ts +0 -1
- package/src/Footer/Footer.stories.jsx +0 -13
- package/src/Footer/index.tsx +0 -130
- package/src/Header/Header.stories.jsx +0 -30
- package/src/Header/addon-button.tsx +0 -41
- package/src/Header/auto-hidden.tsx +0 -31
- package/src/Header/header-addons.tsx +0 -37
- package/src/Header/header.tsx +0 -214
- package/src/Header/index.ts +0 -3
- package/src/Header/responsive-header.tsx +0 -145
- package/src/Icon/Icon.stories.jsx +0 -45
- package/src/Icon/image.tsx +0 -53
- package/src/Icon/index.tsx +0 -63
- package/src/Img/Img.stories.jsx +0 -17
- package/src/Img/index.jsx +0 -258
- package/src/InfoRow/InfoRow.stories.jsx +0 -14
- package/src/InfoRow/index.tsx +0 -91
- package/src/Layout/Layout.stories.jsx +0 -24
- package/src/Layout/dashboard/external-link.tsx +0 -59
- package/src/Layout/dashboard/full-page.tsx +0 -58
- package/src/Layout/dashboard/index.tsx +0 -260
- package/src/Layout/dashboard/sidebar.tsx +0 -198
- package/src/Layout/dashboard-legacy/header.tsx +0 -156
- package/src/Layout/dashboard-legacy/index.tsx +0 -127
- package/src/Layout/dashboard-legacy/sidebar.tsx +0 -129
- package/src/Layout/index.tsx +0 -310
- package/src/LoadingMask/index.tsx +0 -108
- package/src/Locale/LocaleSelector.stories.jsx +0 -44
- package/src/Locale/browser-lang.ts +0 -65
- package/src/Locale/context.tsx +0 -162
- package/src/Locale/languages.ts +0 -58
- package/src/Locale/selector.tsx +0 -174
- package/src/Locale/util.ts +0 -38
- package/src/Logo/Logo.stories.jsx +0 -23
- package/src/Logo/images/logo-dark-text.svg +0 -3
- package/src/Logo/images/logo-dark-top.svg +0 -6
- package/src/Logo/images/logo-light-text.svg +0 -3
- package/src/Logo/images/logo-light-top.svg +0 -6
- package/src/Logo/index.tsx +0 -58
- package/src/Metric/Metric.stories.jsx +0 -29
- package/src/Metric/index.tsx +0 -130
- package/src/MuiWrap/index.tsx +0 -10
- package/src/NFTDisplay/NFTBroken.svg +0 -34
- package/src/NFTDisplay/NFTDisplay.stories.jsx +0 -30
- package/src/NFTDisplay/README.md +0 -59
- package/src/NFTDisplay/aspect-ratio-container.tsx +0 -36
- package/src/NFTDisplay/broken.tsx +0 -51
- package/src/NFTDisplay/displayApi.ts +0 -43
- package/src/NFTDisplay/index.tsx +0 -393
- package/src/NFTDisplay/loading.tsx +0 -16
- package/src/NFTDisplay/preview.tsx +0 -84
- package/src/NFTDisplay/render-svg.tsx +0 -21
- package/src/NFTDisplay/svg-embedder/img.tsx +0 -27
- package/src/NFTDisplay/svg-embedder/inline-svg.tsx +0 -36
- package/src/NavMenu/NavMenu.stories.jsx +0 -17
- package/src/NavMenu/images/OCAP.svg +0 -1
- package/src/NavMenu/images/abt-network.svg +0 -1
- package/src/NavMenu/images/ai-kit.svg +0 -1
- package/src/NavMenu/images/aigne-image-smith.svg +0 -1
- package/src/NavMenu/images/aigne.svg +0 -1
- package/src/NavMenu/images/aistro.png +0 -0
- package/src/NavMenu/images/arcsphere.svg +0 -1
- package/src/NavMenu/images/blocklet-framework.svg +0 -1
- package/src/NavMenu/images/blocklet-launcher.svg +0 -1
- package/src/NavMenu/images/blocklet-server.svg +0 -1
- package/src/NavMenu/images/blocklet-store.svg +0 -1
- package/src/NavMenu/images/creator-studio.svg +0 -1
- package/src/NavMenu/images/did-wallet.svg +0 -1
- package/src/NavMenu/images/did.svg +0 -1
- package/src/NavMenu/images/nft-studio.svg +0 -1
- package/src/NavMenu/images/payment-kit.png +0 -0
- package/src/NavMenu/images/vc.svg +0 -1
- package/src/NavMenu/images/web3-kit.svg +0 -1
- package/src/NavMenu/index.ts +0 -3
- package/src/NavMenu/nav-menu-context.tsx +0 -30
- package/src/NavMenu/nav-menu.tsx +0 -441
- package/src/NavMenu/products.tsx +0 -830
- package/src/NavMenu/style.ts +0 -258
- package/src/NavMenu/sub-container.tsx +0 -125
- package/src/NavMenu/sub-item-group.tsx +0 -42
- package/src/OrgTransfer/index.tsx +0 -53
- package/src/OrgTransfer/locales.ts +0 -25
- package/src/OrgTransfer/selector.tsx +0 -252
- package/src/OrgTransfer/type.ts +0 -31
- package/src/PageScroller/index.tsx +0 -316
- package/src/PageScroller/story/FifthComponent.jsx +0 -7
- package/src/PageScroller/story/FirstComponent.jsx +0 -7
- package/src/PageScroller/story/FourthComponent.jsx +0 -7
- package/src/PageScroller/story/FullPage.jsx +0 -55
- package/src/PageScroller/story/PageContain.jsx +0 -59
- package/src/PageScroller/story/PageScroller.stories.jsx +0 -18
- package/src/PageScroller/story/SecondComponent.jsx +0 -7
- package/src/PageScroller/story/ThirdComponent.jsx +0 -7
- package/src/PageScroller/story/index.css +0 -115
- package/src/PageScroller/usePrevValue.ts +0 -11
- package/src/Passport/index.ts +0 -3
- package/src/Passport/passport.tsx +0 -118
- package/src/PhoneInput/PhoneInput.stories.jsx +0 -12
- package/src/PhoneInput/country-select.tsx +0 -148
- package/src/PhoneInput/index.tsx +0 -269
- package/src/PoweredByArcBlock/index.tsx +0 -27
- package/src/PricingTable/PricingPlan.tsx +0 -120
- package/src/PricingTable/PricingTable.stories.jsx +0 -38
- package/src/PricingTable/index.tsx +0 -59
- package/src/QRCode/QRCode.stories.jsx +0 -13
- package/src/QRCode/index.tsx +0 -66
- package/src/RelativeTime/RelativeTime.stories.jsx +0 -20
- package/src/RelativeTime/index.tsx +0 -334
- package/src/Result/Result.stories.jsx +0 -61
- package/src/Result/common.tsx +0 -119
- package/src/Result/index.tsx +0 -30
- package/src/Result/result.tsx +0 -65
- package/src/Result/translations.ts +0 -57
- package/src/Screenshot/BaseScreenshot/index.tsx +0 -73
- package/src/Screenshot/BaseScreenshot/shells/Macbook.tsx +0 -38
- package/src/Screenshot/BaseScreenshot/shells/Phone.tsx +0 -35
- package/src/Screenshot/Screenshot.stories.jsx +0 -44
- package/src/Screenshot/devices.css +0 -1366
- package/src/Screenshot/index.tsx +0 -300
- package/src/SessionBlocklet/index.tsx +0 -178
- package/src/SessionManager/SessionManager.stories.jsx +0 -9
- package/src/SessionManager/index.tsx +0 -3
- package/src/SessionPermission/index.tsx +0 -26
- package/src/SessionUser/components/did-space.tsx +0 -68
- package/src/SessionUser/components/logged-in.tsx +0 -338
- package/src/SessionUser/components/quick-login-item.tsx +0 -132
- package/src/SessionUser/components/session-user-item.tsx +0 -93
- package/src/SessionUser/components/session-user-switch.tsx +0 -240
- package/src/SessionUser/components/un-login.tsx +0 -257
- package/src/SessionUser/components/user-info.tsx +0 -201
- package/src/SessionUser/index.tsx +0 -68
- package/src/SessionUser/libs/translation.ts +0 -30
- package/src/SessionUser/libs/utils.ts +0 -39
- package/src/SharedBridge/index.tsx +0 -126
- package/src/SocialShare/index.tsx +0 -194
- package/src/Sparkline/Sparkline.stories.jsx +0 -13
- package/src/Sparkline/index.tsx +0 -231
- package/src/Spinner/Spinner.stories.jsx +0 -98
- package/src/Spinner/index.tsx +0 -20
- package/src/SplitButton/SplitButton.stories.jsx +0 -32
- package/src/SplitButton/index.tsx +0 -116
- package/src/SplitButton/useClickAway.tsx +0 -24
- package/src/Success/index.tsx +0 -175
- package/src/Switch/Switch.stories.jsx +0 -16
- package/src/Switch/index.jsx +0 -79
- package/src/Tabs/Tabs.stories.jsx +0 -18
- package/src/Tabs/index.tsx +0 -255
- package/src/Tag/Tag.stories.jsx +0 -15
- package/src/Tag/index.jsx +0 -106
- package/src/TextCollapse/TextCollapse.stories.jsx +0 -73
- package/src/TextCollapse/index.tsx +0 -85
- package/src/Theme/Theme.stories.jsx +0 -11
- package/src/Theme/index.ts +0 -21
- package/src/Theme/theme-provider.tsx +0 -374
- package/src/Theme/theme.ts +0 -229
- package/src/Toast/Toast.stories.jsx +0 -28
- package/src/Toast/index.tsx +0 -80
- package/src/Typography/index.tsx +0 -124
- package/src/UserCard/Cards/avatar-only.tsx +0 -27
- package/src/UserCard/Cards/basic-info.tsx +0 -43
- package/src/UserCard/Cards/index.tsx +0 -16
- package/src/UserCard/Cards/social-actions.tsx +0 -196
- package/src/UserCard/Container/card.tsx +0 -63
- package/src/UserCard/Container/dialog.tsx +0 -37
- package/src/UserCard/Content/basic.tsx +0 -330
- package/src/UserCard/Content/clock.tsx +0 -82
- package/src/UserCard/Content/minimal.tsx +0 -113
- package/src/UserCard/Content/shorten-label.tsx +0 -32
- package/src/UserCard/Content/tooltip-avatar.tsx +0 -80
- package/src/UserCard/UserCard.stories.jsx +0 -19
- package/src/UserCard/components.tsx +0 -81
- package/src/UserCard/index.tsx +0 -132
- package/src/UserCard/types.ts +0 -165
- package/src/UserCard/use-follow.tsx +0 -111
- package/src/UserCard/utils.ts +0 -155
- package/src/Util/WebWalletOpener.stories.jsx +0 -5
- package/src/Util/client.ts +0 -4
- package/src/Util/constant.ts +0 -70
- package/src/Util/deprecate.tsx +0 -29
- package/src/Util/federated.ts +0 -125
- package/src/Util/iframe.ts +0 -19
- package/src/Util/index.ts +0 -760
- package/src/Util/logger.ts +0 -44
- package/src/Util/passport.ts +0 -127
- package/src/Util/security.ts +0 -72
- package/src/Util/style.ts +0 -17
- package/src/Util/wallet.ts +0 -35
- package/src/VerificationCode/index.tsx +0 -83
- package/src/Video/Video.stories.jsx +0 -6
- package/src/Video/index.tsx +0 -70
- package/src/Wallet/Action.stories.jsx +0 -8
- package/src/Wallet/Action.tsx +0 -118
- package/src/Wallet/Download.stories.jsx +0 -9
- package/src/Wallet/Download.tsx +0 -157
- package/src/Wallet/Open.tsx +0 -47
- package/src/Wallet/OpenInWallet.stories.jsx +0 -5
- package/src/Wallet/images/abtwallet.png +0 -0
- package/src/Wallet/images/android_download.svg +0 -22
- package/src/Wallet/images/app-store.svg +0 -30
- package/src/Wallet/images/google-play.svg +0 -69
- package/src/WalletOSIcon/index.tsx +0 -47
- package/src/WebWalletSWKeeper/index.tsx +0 -117
- package/src/WechatPrompt/images/android.png +0 -0
- package/src/WechatPrompt/images/ios.png +0 -0
- package/src/WechatPrompt/index.tsx +0 -75
- package/src/global.d.ts +0 -28
- package/src/hooks/use-blocklet-logo.tsx +0 -32
- package/src/hooks/use-clock.tsx +0 -62
- package/src/hooks/use-location-state.tsx +0 -117
- package/src/hooks/use-mobile.tsx +0 -6
- package/src/index.ts +0 -79
- package/src/type.d.ts +0 -44
- package/src/withTheme/index.tsx +0 -72
- package/src/withTracker/README.md +0 -37
- package/src/withTracker/action/bind-wallet.tsx +0 -17
- package/src/withTracker/action/login.tsx +0 -18
- package/src/withTracker/action/pay.tsx +0 -14
- package/src/withTracker/action/switch-passport.tsx +0 -20
- package/src/withTracker/constant/index.tsx +0 -3
- package/src/withTracker/env.tsx +0 -1
- package/src/withTracker/error_boundary.jsx +0 -34
- package/src/withTracker/index.tsx +0 -50
- package/src/withTracker/libs/utm.ts +0 -46
- package/vite.config.mjs +0 -37
package/lib/package.json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
"**/*.svg?react",
|
|
37
37
|
"**/*.svg"
|
|
38
38
|
],
|
|
39
|
+
"files": [
|
|
40
|
+
"lib"
|
|
41
|
+
],
|
|
39
42
|
"publishConfig": {
|
|
40
43
|
"access": "public"
|
|
41
44
|
},
|
|
@@ -74,16 +77,16 @@
|
|
|
74
77
|
"react": "^19.0.0",
|
|
75
78
|
"react-router-dom": "^6.22.3"
|
|
76
79
|
},
|
|
77
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "1cfc816004525cf1b352ec2b64d459f4769f0237",
|
|
78
81
|
"dependencies": {
|
|
79
|
-
"@arcblock/bridge": "3.
|
|
82
|
+
"@arcblock/bridge": "3.5.0",
|
|
80
83
|
"@arcblock/did": "^1.29.4",
|
|
81
84
|
"@arcblock/did-motif": "^1.1.14",
|
|
82
|
-
"@arcblock/icons": "3.
|
|
83
|
-
"@arcblock/nft-display": "3.
|
|
84
|
-
"@arcblock/react-hooks": "3.
|
|
85
|
+
"@arcblock/icons": "3.5.0",
|
|
86
|
+
"@arcblock/nft-display": "3.5.0",
|
|
87
|
+
"@arcblock/react-hooks": "3.5.0",
|
|
85
88
|
"@blocklet/js-sdk": "^1.17.7",
|
|
86
|
-
"@blocklet/theme": "3.
|
|
89
|
+
"@blocklet/theme": "3.5.0",
|
|
87
90
|
"@fontsource/roboto": "~5.1.1",
|
|
88
91
|
"@fontsource/ubuntu-mono": "^5.2.6",
|
|
89
92
|
"@iconify-icons/logos": "^1.2.36",
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { createTheme, ThemeProvider } from '../Theme';
|
|
2
|
-
import ActionButton from '.';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Deprecated/ActionButton',
|
|
6
|
-
|
|
7
|
-
parameters: {
|
|
8
|
-
readme: {
|
|
9
|
-
sidebar: '<!-- PROPS -->',
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export function WithDifferentColor() {
|
|
15
|
-
return (
|
|
16
|
-
<ThemeProvider theme={createTheme()}>
|
|
17
|
-
<div>
|
|
18
|
-
<ActionButton href="/" theme="inherit">
|
|
19
|
-
Default Button
|
|
20
|
-
</ActionButton>
|
|
21
|
-
<ActionButton href="/" theme="primary">
|
|
22
|
-
Primary Button
|
|
23
|
-
</ActionButton>
|
|
24
|
-
<ActionButton href="/" theme="secondary">
|
|
25
|
-
Secondary Button
|
|
26
|
-
</ActionButton>
|
|
27
|
-
<ActionButton href="/" theme="reverse">
|
|
28
|
-
Reverse Button
|
|
29
|
-
</ActionButton>
|
|
30
|
-
</div>
|
|
31
|
-
</ThemeProvider>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
WithDifferentColor.storyName = 'with different color';
|
|
36
|
-
|
|
37
|
-
export function WithDifferentVariant() {
|
|
38
|
-
return (
|
|
39
|
-
<ThemeProvider theme={createTheme()}>
|
|
40
|
-
<div>
|
|
41
|
-
<ActionButton href="/" variant="text">
|
|
42
|
-
Text Button
|
|
43
|
-
</ActionButton>
|
|
44
|
-
<ActionButton href="/" variant="outlined">
|
|
45
|
-
Outlined Button
|
|
46
|
-
</ActionButton>
|
|
47
|
-
<ActionButton href="/" variant="contained">
|
|
48
|
-
Contained Button
|
|
49
|
-
</ActionButton>
|
|
50
|
-
|
|
51
|
-
<div style={{ background: '#222', padding: 12, marginTop: 24 }}>
|
|
52
|
-
<ActionButton href="/" variant="contained" theme="reverse">
|
|
53
|
-
Contained Reverse Button
|
|
54
|
-
</ActionButton>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
</ThemeProvider>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
WithDifferentVariant.storyName = 'with different variant';
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import isUndefined from 'lodash/isUndefined';
|
|
3
|
-
|
|
4
|
-
import Button from '../Button';
|
|
5
|
-
import { mergeProps } from '../Util';
|
|
6
|
-
import { withDeprecated } from '../Util/deprecate';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Action button component
|
|
10
|
-
* @typedef {{
|
|
11
|
-
* href: string;
|
|
12
|
-
* children?: import('react').ReactNode;
|
|
13
|
-
* gradient?: string;
|
|
14
|
-
* color?: string;
|
|
15
|
-
* icon?: string;
|
|
16
|
-
* border?: string;
|
|
17
|
-
* text?: string;
|
|
18
|
-
* theme?: string;
|
|
19
|
-
* variant?: string;
|
|
20
|
-
* size?: string;
|
|
21
|
-
* width?: string;
|
|
22
|
-
* }} ActionButtonProps
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Action button component
|
|
27
|
-
* @param {ActionButtonProps} props
|
|
28
|
-
* @returns {JSX.Element}
|
|
29
|
-
*/
|
|
30
|
-
function ActionButton({ ...rawProps }) {
|
|
31
|
-
const props = Object.assign({}, rawProps);
|
|
32
|
-
if (isUndefined(props.gradient)) {
|
|
33
|
-
props.gradient = '';
|
|
34
|
-
}
|
|
35
|
-
if (isUndefined(props.icon)) {
|
|
36
|
-
props.icon = '';
|
|
37
|
-
}
|
|
38
|
-
if (isUndefined(props.text)) {
|
|
39
|
-
props.text = '';
|
|
40
|
-
}
|
|
41
|
-
if (isUndefined(props.color)) {
|
|
42
|
-
props.color = '';
|
|
43
|
-
}
|
|
44
|
-
if (isUndefined(props.border)) {
|
|
45
|
-
props.border = '';
|
|
46
|
-
}
|
|
47
|
-
if (isUndefined(props.width)) {
|
|
48
|
-
props.width = '';
|
|
49
|
-
}
|
|
50
|
-
if (isUndefined(props.theme)) {
|
|
51
|
-
props.theme = 'inherit';
|
|
52
|
-
}
|
|
53
|
-
if (isUndefined(props.variant)) {
|
|
54
|
-
props.variant = 'outlined';
|
|
55
|
-
}
|
|
56
|
-
if (isUndefined(props.size)) {
|
|
57
|
-
props.size = 'large';
|
|
58
|
-
}
|
|
59
|
-
/** @type {ActionButtonProps & {}} */
|
|
60
|
-
const newProps = mergeProps(props, ActionButton);
|
|
61
|
-
const { href, icon, size, color, theme, variant, gradient, children, text, ...rest } = newProps;
|
|
62
|
-
|
|
63
|
-
/** @type {import('react').CSSProperties} */
|
|
64
|
-
const styles = {};
|
|
65
|
-
if (gradient) {
|
|
66
|
-
styles.backgroundImage = gradient;
|
|
67
|
-
styles.borderColor = 'transparent';
|
|
68
|
-
}
|
|
69
|
-
const attrs = ['color', 'border', 'width'];
|
|
70
|
-
attrs.forEach((x) => {
|
|
71
|
-
if (newProps[x]) {
|
|
72
|
-
styles[x] = newProps[x];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<Button
|
|
78
|
-
color={theme}
|
|
79
|
-
href={href}
|
|
80
|
-
target="_blank"
|
|
81
|
-
variant={variant}
|
|
82
|
-
style={styles}
|
|
83
|
-
size={size}
|
|
84
|
-
className="action-button"
|
|
85
|
-
{...rest}>
|
|
86
|
-
{!!icon && <i className={icon} />}
|
|
87
|
-
{text || children}
|
|
88
|
-
</Button>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
ActionButton.propTypes = {
|
|
93
|
-
href: PropTypes.string.isRequired,
|
|
94
|
-
children: PropTypes.any,
|
|
95
|
-
gradient: PropTypes.string,
|
|
96
|
-
color: PropTypes.string,
|
|
97
|
-
icon: PropTypes.string,
|
|
98
|
-
border: PropTypes.string,
|
|
99
|
-
text: PropTypes.string,
|
|
100
|
-
theme: PropTypes.string,
|
|
101
|
-
variant: PropTypes.string,
|
|
102
|
-
size: PropTypes.string,
|
|
103
|
-
width: PropTypes.string,
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export default withDeprecated(ActionButton, { name: 'ActionButton' });
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { green, blue } from '@mui/material/colors';
|
|
4
|
-
|
|
5
|
-
import Logo from '../Logo';
|
|
6
|
-
import { styled, useTheme } from '../Theme';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* ActivityIndicator is used when we want to tell the user the request they made on the UI will take time.
|
|
10
|
-
* @typedef {{
|
|
11
|
-
* interval?: number;
|
|
12
|
-
* messages: string[];
|
|
13
|
-
* } & import('react').ComponentPropsWithoutRef<"div"> } ActivityIndicatorProps
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @description ActivityIndicator is used when we want to tell the user the request they made on the UI will take time.
|
|
18
|
-
* @param {ActivityIndicatorProps} props
|
|
19
|
-
* @returns {JSX.Element}
|
|
20
|
-
*/
|
|
21
|
-
export default function ActivityIndicator({ messages = ['Loading data...'], interval = 3000, ...rest }) {
|
|
22
|
-
const [index, setIndex] = useState(0);
|
|
23
|
-
const { palette } = useTheme();
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
const timer = setInterval(() => {
|
|
27
|
-
setIndex((index + 1) % messages.length);
|
|
28
|
-
}, interval);
|
|
29
|
-
|
|
30
|
-
return () => {
|
|
31
|
-
clearTimeout(timer);
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<Div {...rest}>
|
|
37
|
-
<div className="pm-loader-container">
|
|
38
|
-
<div className="pm-loader-text">
|
|
39
|
-
<p>{messages[index]}</p>
|
|
40
|
-
</div>
|
|
41
|
-
<div className="pm-loader-atoms">
|
|
42
|
-
<Logo style={{ transform: 'scale(0.6)' }} showText={false} />
|
|
43
|
-
<Orbit size={56} orbitColor={green[500]} atomColor={green[500]} duration={1} />
|
|
44
|
-
<Orbit size={80} orbitColor={blue[800]} atomColor={blue[800]} duration={1.5} />
|
|
45
|
-
<Orbit size={100} orbitColor={palette.grey[900]} atomColor={palette.grey[900]} />
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</Div>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
ActivityIndicator.propTypes = {
|
|
53
|
-
interval: PropTypes.number,
|
|
54
|
-
messages: PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const Div = styled('div')`
|
|
58
|
-
&& {
|
|
59
|
-
box-sizing: border-box;
|
|
60
|
-
padding: 20px;
|
|
61
|
-
width: 100%;
|
|
62
|
-
height: 100%;
|
|
63
|
-
min-height: 360px;
|
|
64
|
-
z-index: 100;
|
|
65
|
-
transition: opacity 0.5s linear;
|
|
66
|
-
display: flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
flex-direction: column;
|
|
69
|
-
justify-content: center;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.pm-loader-text {
|
|
73
|
-
color: ${({ theme }) => theme.palette.grey[900]};
|
|
74
|
-
font-size: 14px;
|
|
75
|
-
text-align: center;
|
|
76
|
-
position: relative;
|
|
77
|
-
height: 70px;
|
|
78
|
-
-webkit-user-select: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.pm-loader-container {
|
|
82
|
-
width: 100%;
|
|
83
|
-
height: 100%;
|
|
84
|
-
display: flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
flex-direction: column;
|
|
87
|
-
justify-content: center;
|
|
88
|
-
flex: 1;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.pm-loader-atoms {
|
|
92
|
-
width: 100px;
|
|
93
|
-
height: 100px;
|
|
94
|
-
display: flex;
|
|
95
|
-
position: relative;
|
|
96
|
-
align-items: center;
|
|
97
|
-
justify-content: center;
|
|
98
|
-
}
|
|
99
|
-
`;
|
|
100
|
-
|
|
101
|
-
function Orbit({ size, orbitColor, atomColor, duration = 2, ...rest }) {
|
|
102
|
-
return (
|
|
103
|
-
<OrbitRoot $duration={duration} style={{ width: size, height: size, border: `1px solid ${orbitColor}` }} {...rest}>
|
|
104
|
-
<div style={{ background: atomColor }} />
|
|
105
|
-
</OrbitRoot>
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
Orbit.propTypes = {
|
|
110
|
-
size: PropTypes.number.isRequired,
|
|
111
|
-
orbitColor: PropTypes.string.isRequired,
|
|
112
|
-
atomColor: PropTypes.string.isRequired,
|
|
113
|
-
duration: PropTypes.number,
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const OrbitRoot = styled('div')`
|
|
117
|
-
@keyframes orbit {
|
|
118
|
-
0% {
|
|
119
|
-
transform: rotate(0deg);
|
|
120
|
-
}
|
|
121
|
-
100% {
|
|
122
|
-
transform: rotate(360deg);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
position: absolute;
|
|
127
|
-
border-radius: 50%;
|
|
128
|
-
animation: orbit ${({ $duration }) => $duration}s infinite;
|
|
129
|
-
animation-timing-function: linear;
|
|
130
|
-
transform-origin: center;
|
|
131
|
-
|
|
132
|
-
> div {
|
|
133
|
-
position: absolute;
|
|
134
|
-
top: 50%;
|
|
135
|
-
width: 6px;
|
|
136
|
-
height: 6px;
|
|
137
|
-
transform: translateX(-50%);
|
|
138
|
-
border-radius: 50%;
|
|
139
|
-
}
|
|
140
|
-
`;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { styled } from '../Theme';
|
|
2
|
-
|
|
3
|
-
export { default as WithDifferentSizes } from './demo/with-different-sizes';
|
|
4
|
-
export { default as Copyable } from './demo/copyable';
|
|
5
|
-
export { default as CompactMode } from './demo/compact-mode';
|
|
6
|
-
export { default as WithInheritSize } from './demo/with-inherit-size';
|
|
7
|
-
export { default as ResponsiveFontSize } from './demo/responsive-font-size';
|
|
8
|
-
export { default as InlineElementBlockElement } from './demo/inline-element-block-element';
|
|
9
|
-
export { default as DynamicTagname } from './demo/dynamic-tagname';
|
|
10
|
-
export { default as NonResponsiveCompact } from './demo/non-responsive-compact';
|
|
11
|
-
export { default as CopyTextI18N } from './demo/copy-text-i18n';
|
|
12
|
-
export { default as PrependAppend } from './demo/prepend-append';
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
title: 'DID/Address',
|
|
16
|
-
parameters: {},
|
|
17
|
-
decorators: [
|
|
18
|
-
(StoryFn) => (
|
|
19
|
-
<ResizableContainer>
|
|
20
|
-
<StoryFn />
|
|
21
|
-
</ResizableContainer>
|
|
22
|
-
),
|
|
23
|
-
],
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const ResizableContainer = styled('div')`
|
|
27
|
-
width: 600px;
|
|
28
|
-
max-width: 100%;
|
|
29
|
-
padding: 16px;
|
|
30
|
-
border: 1px solid #ddd;
|
|
31
|
-
overflow: auto;
|
|
32
|
-
background: #fff;
|
|
33
|
-
resize: both;
|
|
34
|
-
|
|
35
|
-
> * + * {
|
|
36
|
-
margin-top: 16px;
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Children } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Box, Tooltip, tooltipClasses } from '@mui/material';
|
|
4
|
-
import { styled } from '../Theme';
|
|
5
|
-
import { CopyButton } from '../ClickToCopy';
|
|
6
|
-
|
|
7
|
-
const StyledTooltip = styled(({ className, ...props }) => <Tooltip {...props} classes={{ popper: className }} />)({
|
|
8
|
-
[`& .${tooltipClasses.tooltip}`]: {
|
|
9
|
-
maxWidth: 360,
|
|
10
|
-
wordBreak: 'break-all',
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// 递归, 将 text (string) 部分替换为 CompactText (保持元素结构)
|
|
15
|
-
// eslint-disable-next-line react/prop-types
|
|
16
|
-
function RecursiveWrapper({ children, ...rest }) {
|
|
17
|
-
const wrappedChildren = Children.map(children, (child) => {
|
|
18
|
-
if (typeof child === 'string') {
|
|
19
|
-
return <CompactText {...rest}>{child}</CompactText>;
|
|
20
|
-
}
|
|
21
|
-
if (child.props && child.props.children) {
|
|
22
|
-
return (
|
|
23
|
-
<child.type {...child.props}>
|
|
24
|
-
<RecursiveWrapper {...rest}>{child.props.children}</RecursiveWrapper>
|
|
25
|
-
</child.type>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
return child;
|
|
29
|
-
});
|
|
30
|
-
return wrappedChildren;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 紧凑文本组件 (显示首尾, 中间截断显示省略号), 仅考虑等宽字体的情况
|
|
35
|
-
*/
|
|
36
|
-
export default function CompactText({ startChars = 6, endChars = 6, children, showCopyButtonInTooltip = false }) {
|
|
37
|
-
if (typeof children !== 'string') {
|
|
38
|
-
return (
|
|
39
|
-
<RecursiveWrapper startChars={startChars} endChars={endChars} showCopyButtonInTooltip={showCopyButtonInTooltip}>
|
|
40
|
-
{children}
|
|
41
|
-
</RecursiveWrapper>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// stopPropagation: 当 tooltip 处于 link 中时, 避免点击复制时触发链接跳转
|
|
46
|
-
const tooltipContent = (
|
|
47
|
-
<Box
|
|
48
|
-
onClick={(e) => e.stopPropagation()}
|
|
49
|
-
sx={{
|
|
50
|
-
display: 'flex',
|
|
51
|
-
alignItems: 'center',
|
|
52
|
-
lineHeight: 1,
|
|
53
|
-
}}>
|
|
54
|
-
<Box>{children}</Box>
|
|
55
|
-
{showCopyButtonInTooltip && (
|
|
56
|
-
<CopyButton content={children} showTooltip={false} style={{ fontSize: 16, marginLeft: 4 }} />
|
|
57
|
-
)}
|
|
58
|
-
</Box>
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<StyledTooltip title={tooltipContent} placement="top">
|
|
63
|
-
<span>
|
|
64
|
-
{children.slice(0, startChars)}...{children.slice(children.length - endChars)}
|
|
65
|
-
</span>
|
|
66
|
-
</StyledTooltip>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
CompactText.propTypes = {
|
|
71
|
-
startChars: PropTypes.number,
|
|
72
|
-
endChars: PropTypes.number,
|
|
73
|
-
children: PropTypes.node.isRequired,
|
|
74
|
-
// 在 tooltip 中完整地址后显示复制按钮
|
|
75
|
-
showCopyButtonInTooltip: PropTypes.bool,
|
|
76
|
-
};
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import '@fontsource/ubuntu-mono/400.css';
|
|
2
|
-
import { Check as CheckIcon } from '@mui/icons-material';
|
|
3
|
-
import { Box, BoxProps, Tooltip } from '@mui/material';
|
|
4
|
-
import copy from 'copy-to-clipboard';
|
|
5
|
-
import noop from 'lodash/noop';
|
|
6
|
-
import CopyIcon from '@arcblock/icons/lib/Copy';
|
|
7
|
-
import React, { ReactNode, useImperativeHandle, useRef, useState } from 'react';
|
|
8
|
-
import { styled } from '../Theme';
|
|
9
|
-
import { getFontSize } from '../Util';
|
|
10
|
-
import CompactText from './compact-text';
|
|
11
|
-
import type { Locale, Translations } from '../type';
|
|
12
|
-
|
|
13
|
-
const translations: Translations = {
|
|
14
|
-
en: {
|
|
15
|
-
copy: 'Click To Copy',
|
|
16
|
-
copied: 'Copied!',
|
|
17
|
-
},
|
|
18
|
-
zh: {
|
|
19
|
-
copy: '点击复制',
|
|
20
|
-
copied: '已复制!',
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export interface HTMLDidAddressElement extends HTMLDivElement {
|
|
25
|
-
copy: () => void;
|
|
26
|
-
getEl: () => HTMLDivElement;
|
|
27
|
-
}
|
|
28
|
-
export interface IDidAddressProps extends BoxProps {
|
|
29
|
-
component?: React.ElementType;
|
|
30
|
-
size?: number;
|
|
31
|
-
copyable?: true | false;
|
|
32
|
-
// compact mode 下, hover 时会在 tooltip 中显示完整地址, showCopyButtonInTooltip = true 时会在完整地址后显示一个复制按钮
|
|
33
|
-
showCopyButtonInTooltip?: false | true;
|
|
34
|
-
content?: string;
|
|
35
|
-
inline?: false | true;
|
|
36
|
-
prepend?: ReactNode;
|
|
37
|
-
append?: ReactNode;
|
|
38
|
-
// 紧凑模式
|
|
39
|
-
compact?: false | true;
|
|
40
|
-
startChars?: number;
|
|
41
|
-
endChars?: number;
|
|
42
|
-
locale?: Locale;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* DidAddress 组件 (新版设计)
|
|
47
|
-
*
|
|
48
|
-
* - 样式调整
|
|
49
|
-
* - click-to-copy 调整
|
|
50
|
-
* - 长文本截断处理 (Ellipsis)
|
|
51
|
-
* - 支持 inline 或 block 的显示方式
|
|
52
|
-
* - 支持紧凑模式, 该模式下:
|
|
53
|
-
* - 占用宽度较小, 因此不考虑水平空间不够用的情况, 且忽略末尾省略号
|
|
54
|
-
* - 对于多层元素结构的 children, 保持元素结构, 将最内层 text 替换为 CompactText 组件
|
|
55
|
-
* - 为保证 copy 功能正常工作, 原 children 始终渲染, 但在紧凑式下会隐藏
|
|
56
|
-
* - 可配合 useMediaQuery 使用
|
|
57
|
-
*/
|
|
58
|
-
function DidAddress({
|
|
59
|
-
ref = undefined,
|
|
60
|
-
...props
|
|
61
|
-
}: IDidAddressProps & {
|
|
62
|
-
ref?: React.Ref<unknown>;
|
|
63
|
-
}) {
|
|
64
|
-
const {
|
|
65
|
-
component = 'span',
|
|
66
|
-
size = 0,
|
|
67
|
-
copyable = true,
|
|
68
|
-
showCopyButtonInTooltip = false,
|
|
69
|
-
children = null,
|
|
70
|
-
content = '',
|
|
71
|
-
prepend = null,
|
|
72
|
-
append = null,
|
|
73
|
-
compact = false,
|
|
74
|
-
startChars = 6,
|
|
75
|
-
endChars = 6,
|
|
76
|
-
locale: originalLocale = 'en',
|
|
77
|
-
...rest
|
|
78
|
-
} = props;
|
|
79
|
-
let locale = originalLocale;
|
|
80
|
-
if (!translations[locale]) {
|
|
81
|
-
locale = 'en';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const [copied, setCopied] = useState(false);
|
|
85
|
-
const textRef = useRef<HTMLDivElement>(null);
|
|
86
|
-
const rootRef = useRef<any>(null);
|
|
87
|
-
|
|
88
|
-
const handleCopy = () => {
|
|
89
|
-
copy(content || textRef.current?.textContent || '');
|
|
90
|
-
setCopied(true);
|
|
91
|
-
// 恢复 copied 状态
|
|
92
|
-
setTimeout(() => {
|
|
93
|
-
setCopied(false);
|
|
94
|
-
}, 1500);
|
|
95
|
-
};
|
|
96
|
-
const onCopy = (e: any) => {
|
|
97
|
-
e.stopPropagation();
|
|
98
|
-
e.preventDefault();
|
|
99
|
-
handleCopy();
|
|
100
|
-
};
|
|
101
|
-
useImperativeHandle(
|
|
102
|
-
ref,
|
|
103
|
-
() =>
|
|
104
|
-
new Proxy(
|
|
105
|
-
{
|
|
106
|
-
copy: handleCopy,
|
|
107
|
-
getEl: () => rootRef.current,
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
get(target: any, key: string) {
|
|
111
|
-
return target[key] || rootRef.current?.[key];
|
|
112
|
-
},
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
let copyElement = null;
|
|
118
|
-
if (copyable) {
|
|
119
|
-
copyElement = (
|
|
120
|
-
<span className="did-address-copy-wrapper" title={copied ? '' : translations[locale].copy}>
|
|
121
|
-
{copied ? (
|
|
122
|
-
<Tooltip title={translations[locale].copied} placement="bottom" arrow open={copied}>
|
|
123
|
-
<CheckIcon className="did-address-copy" sx={{ color: 'success.main' }} />
|
|
124
|
-
</Tooltip>
|
|
125
|
-
) : (
|
|
126
|
-
/* title prop 直接加在 icon 上不生效 */
|
|
127
|
-
<CopyIcon className="did-address-copy" width="1em" height="1em" onClick={onCopy} />
|
|
128
|
-
)}
|
|
129
|
-
</span>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return (
|
|
134
|
-
<Root as={component} size={size} {...rest} ref={rootRef}>
|
|
135
|
-
{prepend}
|
|
136
|
-
<Box sx={{ display: 'none' }} ref={textRef}>
|
|
137
|
-
{children}
|
|
138
|
-
</Box>
|
|
139
|
-
{/* 注意: 该元素必须渲染(可以隐藏), 以便 compact 模式下复制的文本是完整的 */}
|
|
140
|
-
<Tooltip title={copyable ? '' : translations[locale].copied} placement="bottom" arrow open={copied}>
|
|
141
|
-
{compact ? (
|
|
142
|
-
<Box
|
|
143
|
-
component="span"
|
|
144
|
-
className="did-address-text"
|
|
145
|
-
sx={{
|
|
146
|
-
cursor: copyable ? 'unset' : 'pointer',
|
|
147
|
-
}}
|
|
148
|
-
onDoubleClick={copyable ? noop : onCopy}>
|
|
149
|
-
<CompactText startChars={startChars} endChars={endChars} showCopyButtonInTooltip={showCopyButtonInTooltip}>
|
|
150
|
-
{children}
|
|
151
|
-
</CompactText>
|
|
152
|
-
</Box>
|
|
153
|
-
) : (
|
|
154
|
-
<Box
|
|
155
|
-
component="span"
|
|
156
|
-
className="did-address-text did-address-truncate"
|
|
157
|
-
sx={{
|
|
158
|
-
display: compact ? 'none' : 'inline',
|
|
159
|
-
cursor: copyable ? 'unset' : 'pointer',
|
|
160
|
-
}}
|
|
161
|
-
onDoubleClick={copyable ? noop : onCopy}>
|
|
162
|
-
{children}
|
|
163
|
-
</Box>
|
|
164
|
-
)}
|
|
165
|
-
</Tooltip>
|
|
166
|
-
{copyElement}
|
|
167
|
-
{append}
|
|
168
|
-
</Root>
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export default DidAddress;
|
|
173
|
-
|
|
174
|
-
const Root = styled<any>(Box, { shouldForwardProp: (prop) => prop !== 'inline' })`
|
|
175
|
-
font-family: 'Ubuntu Mono', monospace;
|
|
176
|
-
&& {
|
|
177
|
-
display: ${({ inline }: any) => (inline ? 'inline-flex' : 'flex')};
|
|
178
|
-
align-items: center;
|
|
179
|
-
max-width: 100%;
|
|
180
|
-
overflow: hidden;
|
|
181
|
-
color: #ccc;
|
|
182
|
-
font-size: ${(props: any) => getFontSize(props.size)};
|
|
183
|
-
font-weight: 400;
|
|
184
|
-
|
|
185
|
-
svg {
|
|
186
|
-
fill: currentColor;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.did-address-text {
|
|
191
|
-
color: ${({ theme }) => theme.palette.text.secondary};
|
|
192
|
-
}
|
|
193
|
-
/* truncate string with ellipsis */
|
|
194
|
-
.did-address-truncate {
|
|
195
|
-
white-space: nowrap;
|
|
196
|
-
overflow: hidden;
|
|
197
|
-
text-overflow: ellipsis;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.did-address-copy-wrapper {
|
|
201
|
-
display: flex;
|
|
202
|
-
justify-content: center;
|
|
203
|
-
align-items: center;
|
|
204
|
-
width: 1em;
|
|
205
|
-
height: 1em;
|
|
206
|
-
margin-left: 8px;
|
|
207
|
-
}
|
|
208
|
-
.did-address-copy {
|
|
209
|
-
flex: 0 0 auto;
|
|
210
|
-
font-size: 1em;
|
|
211
|
-
color: ${({ theme }) => theme.palette.text.secondary};
|
|
212
|
-
cursor: pointer;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/* link */
|
|
216
|
-
a {
|
|
217
|
-
color: ${({ theme }) => theme.palette.text.secondary};
|
|
218
|
-
}
|
|
219
|
-
&:hover a {
|
|
220
|
-
color: ${({ theme }) => theme.palette.text.primary};
|
|
221
|
-
text-decoration: underline;
|
|
222
|
-
}
|
|
223
|
-
`;
|