@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.
- package/lib/Util/constant.d.ts +6 -0
- package/lib/Util/constant.js +25 -16
- package/lib/package.json.js +1 -1
- package/package.json +12 -9
- 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 -60
- 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
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
import { memo, useRef, useState } from 'react';
|
|
2
|
-
import { Dialog, DialogContent, useMediaQuery, Box, Backdrop, SwipeableDrawer, Drawer } from '@mui/material';
|
|
3
|
-
import { useDebounce, useMemoizedFn } from 'ahooks';
|
|
4
|
-
import { useBrowser } from '@arcblock/react-hooks';
|
|
5
|
-
import colorConvert from 'color-convert';
|
|
6
|
-
|
|
7
|
-
import { useTheme } from '../Theme';
|
|
8
|
-
import { mergeSx } from '../Util/style';
|
|
9
|
-
import { hexToRgba } from '../Util';
|
|
10
|
-
import { Locale } from '../type';
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line react/require-default-props
|
|
13
|
-
const BackdropWrap = memo(({ ref, ...backdropProps }: { ref?: React.Ref<unknown> }) => {
|
|
14
|
-
return (
|
|
15
|
-
<Backdrop
|
|
16
|
-
open
|
|
17
|
-
ref={ref}
|
|
18
|
-
style={{
|
|
19
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
20
|
-
backdropFilter: 'blur(3px)',
|
|
21
|
-
touchAction: 'none',
|
|
22
|
-
}}
|
|
23
|
-
{...backdropProps}
|
|
24
|
-
key="background"
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export default function withContainer(Component: React.ComponentType<any>) {
|
|
30
|
-
function WithContainerComponent({
|
|
31
|
-
popup = false,
|
|
32
|
-
open = false,
|
|
33
|
-
hideCloseButton = false,
|
|
34
|
-
...rest
|
|
35
|
-
}: {
|
|
36
|
-
// 是否弹出显示, true 表示在 Dialog 中渲染, 并可以通过 open/onClose 控制 dialog 的显示/隐藏, false 表示直接渲染原内容
|
|
37
|
-
popup?: boolean;
|
|
38
|
-
open?: boolean;
|
|
39
|
-
hideCloseButton?: boolean;
|
|
40
|
-
onClose: () => void;
|
|
41
|
-
blocklet?: any;
|
|
42
|
-
origin?: string;
|
|
43
|
-
host?: string;
|
|
44
|
-
locale?: Locale;
|
|
45
|
-
}) {
|
|
46
|
-
const [color, setColor] = useState('#fff');
|
|
47
|
-
|
|
48
|
-
const drawerDragger = useRef(null);
|
|
49
|
-
const browser = useBrowser();
|
|
50
|
-
// 屏宽小于 sm 且在 mobile 设备中全屏显示 dialog (PC 端屏宽小于 sm 的情况正常弹窗, 不全屏显示)
|
|
51
|
-
const matchSm = useMediaQuery('(max-width:640px)');
|
|
52
|
-
let openVariant = 'page';
|
|
53
|
-
if (popup) {
|
|
54
|
-
openVariant = 'dialog';
|
|
55
|
-
if (matchSm && browser.mobile.any) {
|
|
56
|
-
openVariant = 'drawer';
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const theme = useTheme();
|
|
61
|
-
|
|
62
|
-
// 兼容 did-react 版本中存在的 responsive prop, responsive=true 则让 dialog 始终保持 open 状态, 否则遵循外部传入的 open prop
|
|
63
|
-
const isOpen = open;
|
|
64
|
-
|
|
65
|
-
const leavingScreenDelay = theme?.transitions?.duration?.leavingScreen || 500; // 默认值是 195
|
|
66
|
-
const debouncedShow = useDebounce(isOpen, {
|
|
67
|
-
wait: leavingScreenDelay,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const removeMagicToken = useMemoizedFn(() => {
|
|
71
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
72
|
-
if (searchParams.get('magicToken')) {
|
|
73
|
-
searchParams.delete('magicToken');
|
|
74
|
-
}
|
|
75
|
-
if (searchParams.toString()) {
|
|
76
|
-
window.history.replaceState({}, '', `${window.location.pathname}?${searchParams.toString()}`);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// eslint-disable-next-line no-unused-vars
|
|
81
|
-
const handleOnClose = (e: React.MouseEvent<HTMLElement>, reason: string) => {
|
|
82
|
-
if (['backdropClick', 'escapeKeyDown'].includes(reason)) return;
|
|
83
|
-
removeMagicToken();
|
|
84
|
-
rest?.onClose();
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const showModal = debouncedShow || isOpen;
|
|
88
|
-
|
|
89
|
-
const DrawerComponent = hideCloseButton ? Drawer : SwipeableDrawer;
|
|
90
|
-
|
|
91
|
-
const hslColor = colorConvert.hex.hsl(color);
|
|
92
|
-
|
|
93
|
-
const [h, s, l] = hslColor;
|
|
94
|
-
const percentageList = [0, 30, 60, 30, 0, 30, 60, 30];
|
|
95
|
-
const maxPercentage = Math.max(...percentageList);
|
|
96
|
-
const minPercentage = Math.min(...percentageList);
|
|
97
|
-
let useAlpha = false;
|
|
98
|
-
if ((l * (100 + maxPercentage)) / 100 > 100 || (l * (100 + minPercentage)) / 100 < 0) {
|
|
99
|
-
// 超出范围,使用 alpha 通道变化
|
|
100
|
-
useAlpha = true;
|
|
101
|
-
}
|
|
102
|
-
const colorList = percentageList.map((percentageItem) => {
|
|
103
|
-
let finalL = (l * (100 + percentageItem)) / 100;
|
|
104
|
-
let finalAlpha = 0.6;
|
|
105
|
-
if (useAlpha) {
|
|
106
|
-
finalAlpha = (0.5 * (100 + percentageItem)) / 100;
|
|
107
|
-
} else {
|
|
108
|
-
finalL = (l * (100 + percentageItem)) / 100;
|
|
109
|
-
}
|
|
110
|
-
return `hsla(${h}, ${s}%, ${finalL}%, ${finalAlpha})`;
|
|
111
|
-
});
|
|
112
|
-
const background = `linear-gradient(45deg, ${colorList.join(', ')})`;
|
|
113
|
-
const colorListGlow = percentageList.map((percentageItem) => {
|
|
114
|
-
let finalL = (l * (100 + percentageItem)) / 100;
|
|
115
|
-
let finalAlpha = 0.2;
|
|
116
|
-
if (useAlpha) {
|
|
117
|
-
finalAlpha = (0.3 * (100 + percentageItem)) / 100;
|
|
118
|
-
} else {
|
|
119
|
-
finalL = (l * (100 + percentageItem)) / 100;
|
|
120
|
-
}
|
|
121
|
-
return `hsla(${h}, ${s}%, ${finalL}%, ${finalAlpha})`;
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
const backgroundGlow = `linear-gradient(45deg, ${colorListGlow.join(', ')})`;
|
|
125
|
-
|
|
126
|
-
const glowStyle =
|
|
127
|
-
rest.blocklet?.settings?.didConnect?.showDidColor === false
|
|
128
|
-
? {}
|
|
129
|
-
: {
|
|
130
|
-
overflow: 'visible',
|
|
131
|
-
'&::before, &::after': {
|
|
132
|
-
content: '""',
|
|
133
|
-
position: 'absolute',
|
|
134
|
-
top: '-3px',
|
|
135
|
-
right: '-3px',
|
|
136
|
-
bottom: '-3px',
|
|
137
|
-
left: '-3px',
|
|
138
|
-
background,
|
|
139
|
-
backgroundSize: '300% 300%',
|
|
140
|
-
backgroundRepeat: 'no-repeat',
|
|
141
|
-
animation: 'glowRotate 10s linear infinite',
|
|
142
|
-
borderRadius: '14px !important',
|
|
143
|
-
zIndex: 0,
|
|
144
|
-
},
|
|
145
|
-
'&::after': {
|
|
146
|
-
background: backgroundGlow,
|
|
147
|
-
filter: 'blur(15px)',
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
'@keyframes glowRotate': {
|
|
151
|
-
'0%': {
|
|
152
|
-
backgroundPosition: '0 0',
|
|
153
|
-
},
|
|
154
|
-
'50%': {
|
|
155
|
-
backgroundPosition: '100% 0',
|
|
156
|
-
},
|
|
157
|
-
'100%': {
|
|
158
|
-
backgroundPosition: '0 0',
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
const glowBorderStyle =
|
|
163
|
-
rest.blocklet?.settings?.didConnect?.showDidColor === false
|
|
164
|
-
? {}
|
|
165
|
-
: {
|
|
166
|
-
animation: 'glowBreathe 7s linear infinite',
|
|
167
|
-
'.did-connect__root': {
|
|
168
|
-
backgroundColor: 'transparent',
|
|
169
|
-
},
|
|
170
|
-
overflow: 'hidden',
|
|
171
|
-
'@keyframes glowBreathe': {
|
|
172
|
-
'0%, 100%': {
|
|
173
|
-
boxShadow: `
|
|
174
|
-
inset 0 0 7px ${hexToRgba(color, 0.3)},
|
|
175
|
-
inset 0 0 12px ${hexToRgba(color, 0.3)}`,
|
|
176
|
-
},
|
|
177
|
-
'50%': {
|
|
178
|
-
boxShadow: `
|
|
179
|
-
inset 0 0 18px ${hexToRgba(color, 0.7)},
|
|
180
|
-
inset 0 0 24px ${hexToRgba(color, 0.5)}`,
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const wrapOnClose = useMemoizedFn(() => {
|
|
186
|
-
removeMagicToken();
|
|
187
|
-
rest?.onClose?.();
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
if (openVariant === 'page') {
|
|
191
|
-
return (
|
|
192
|
-
<Box
|
|
193
|
-
className="did-connect__container-page"
|
|
194
|
-
sx={mergeSx(glowStyle, {
|
|
195
|
-
borderRadius: 1,
|
|
196
|
-
position: 'relative',
|
|
197
|
-
zIndex: 1,
|
|
198
|
-
})}>
|
|
199
|
-
<Box
|
|
200
|
-
sx={{
|
|
201
|
-
border: `1px solid ${hexToRgba(color, 0.1)}`,
|
|
202
|
-
m: '-1px',
|
|
203
|
-
position: 'relative',
|
|
204
|
-
borderRadius: '12px',
|
|
205
|
-
zIndex: 2,
|
|
206
|
-
overflow: 'hidden',
|
|
207
|
-
}}>
|
|
208
|
-
<Component {...rest} onClose={wrapOnClose} setColor={setColor} hideCloseButton mode={openVariant} />
|
|
209
|
-
</Box>
|
|
210
|
-
</Box>
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (openVariant === 'drawer') {
|
|
215
|
-
return (
|
|
216
|
-
<DrawerComponent
|
|
217
|
-
className="did-connect__container-drawer"
|
|
218
|
-
disableSwipeToOpen
|
|
219
|
-
open={isOpen}
|
|
220
|
-
anchor="bottom"
|
|
221
|
-
drawerDragger={drawerDragger.current}
|
|
222
|
-
// @ts-ignore
|
|
223
|
-
onClose={handleOnClose}
|
|
224
|
-
slots={{
|
|
225
|
-
backdrop: BackdropWrap,
|
|
226
|
-
}}
|
|
227
|
-
sx={{
|
|
228
|
-
zIndex: '1400 !important', // dialog 的默认 z-index 是 1300,在 dialog 中打开验证/登录时会被遮挡,这里强制设置为 1400,确保 Drawer 在最上层
|
|
229
|
-
}}
|
|
230
|
-
slotProps={{
|
|
231
|
-
paper: {
|
|
232
|
-
sx: {
|
|
233
|
-
backgroundColor: 'background.default',
|
|
234
|
-
borderRadius: 3, // 保持跟 DID Wallet 一致
|
|
235
|
-
borderBottomLeftRadius: 0,
|
|
236
|
-
borderBottomRightRadius: 0,
|
|
237
|
-
p: '2px',
|
|
238
|
-
...glowBorderStyle,
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
}}>
|
|
242
|
-
{hideCloseButton ? null : (
|
|
243
|
-
<Box
|
|
244
|
-
ref={drawerDragger}
|
|
245
|
-
sx={{
|
|
246
|
-
px: 1,
|
|
247
|
-
pt: 2,
|
|
248
|
-
m: 'auto',
|
|
249
|
-
mt: -1,
|
|
250
|
-
mb: -2,
|
|
251
|
-
zIndex: 2,
|
|
252
|
-
}}>
|
|
253
|
-
<Box
|
|
254
|
-
sx={{
|
|
255
|
-
width: '48px',
|
|
256
|
-
height: '4px',
|
|
257
|
-
borderRadius: '100vw',
|
|
258
|
-
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
|
259
|
-
}}
|
|
260
|
-
/>
|
|
261
|
-
</Box>
|
|
262
|
-
)}
|
|
263
|
-
<Box
|
|
264
|
-
sx={{
|
|
265
|
-
touchAction: 'none',
|
|
266
|
-
maxWidth: '100%',
|
|
267
|
-
width: 500,
|
|
268
|
-
height: 'auto',
|
|
269
|
-
}}>
|
|
270
|
-
{/* HACK: 由于 MUI 文档中描述 使用 keepMounted: false 可能会造成问题,所以采用下面的方案进行 HACK */}
|
|
271
|
-
{/* https://mui.com/material-ui/react-drawer/#keep-mounted */}
|
|
272
|
-
{showModal ? (
|
|
273
|
-
<Component {...rest} onClose={wrapOnClose} setColor={setColor} hideCloseButton mode={openVariant} />
|
|
274
|
-
) : null}
|
|
275
|
-
</Box>
|
|
276
|
-
</DrawerComponent>
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return (
|
|
281
|
-
<Dialog
|
|
282
|
-
open={isOpen}
|
|
283
|
-
slots={{
|
|
284
|
-
backdrop: BackdropWrap,
|
|
285
|
-
}}
|
|
286
|
-
className="did-connect__container-dialog"
|
|
287
|
-
onClose={handleOnClose}
|
|
288
|
-
PaperProps={{
|
|
289
|
-
sx: {
|
|
290
|
-
// 避免样式被 server 中的定义覆盖
|
|
291
|
-
'&.MuiPaper-rounded': {
|
|
292
|
-
borderRadius: '12px !important',
|
|
293
|
-
},
|
|
294
|
-
position: 'relative',
|
|
295
|
-
...glowStyle,
|
|
296
|
-
},
|
|
297
|
-
}}>
|
|
298
|
-
<DialogContent
|
|
299
|
-
sx={{
|
|
300
|
-
maxWidth: 'calc(100vw - 18px)',
|
|
301
|
-
maxHeight: 'calc(100vh - 18px)',
|
|
302
|
-
p: '0px !important',
|
|
303
|
-
height: 'auto',
|
|
304
|
-
backgroundColor: 'background.default',
|
|
305
|
-
borderRadius: '12px !important',
|
|
306
|
-
zIndex: 1,
|
|
307
|
-
}}>
|
|
308
|
-
{showModal ? (
|
|
309
|
-
<Component
|
|
310
|
-
{...rest}
|
|
311
|
-
onClose={wrapOnClose}
|
|
312
|
-
setColor={setColor}
|
|
313
|
-
hideCloseButton={hideCloseButton}
|
|
314
|
-
mode={openVariant}
|
|
315
|
-
/>
|
|
316
|
-
) : null}
|
|
317
|
-
</DialogContent>
|
|
318
|
-
</Dialog>
|
|
319
|
-
);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
return WithContainerComponent;
|
|
323
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createTheme, useTheme } from '@mui/material';
|
|
2
|
-
import { DID_CONNECT_THEME_LIGHT, DID_CONNECT_THEME_DARK } from '@blocklet/theme';
|
|
3
|
-
import { ThemeProvider } from '../Theme';
|
|
4
|
-
|
|
5
|
-
// DID Connect 使用自己的 Theme 配置,不受 Blocklet theme 影响
|
|
6
|
-
const themeLight = createTheme(DID_CONNECT_THEME_LIGHT);
|
|
7
|
-
const themeDark = createTheme(DID_CONNECT_THEME_DARK);
|
|
8
|
-
|
|
9
|
-
export default function withUxTheme(Component: React.ComponentType<any>) {
|
|
10
|
-
function WithUxThemeComponent(props: any) {
|
|
11
|
-
const { palette } = useTheme();
|
|
12
|
-
const theme = palette.mode === 'dark' ? themeDark : themeLight;
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<ThemeProvider theme={theme}>
|
|
16
|
-
<Component {...props} />
|
|
17
|
-
</ThemeProvider>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return WithUxThemeComponent;
|
|
22
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { default as WithDifferentSizes } from './demo/with-different-sizes';
|
|
2
|
-
export { default as WithDifferentStyles } from './demo/with-different-styles';
|
|
3
|
-
export { default as WithInheritStyles } from './demo/with-inherit-styles';
|
|
4
|
-
export { default as MakeALogo } from './demo/make-a-logo';
|
|
5
|
-
export { default as WithText } from './demo/with-text';
|
|
6
|
-
export { default as WithPreset } from './demo/with-preset';
|
|
7
|
-
export { default as WithDark } from './demo/with-dark';
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'DID/Logo',
|
|
11
|
-
};
|
package/src/DIDLogo/index.tsx
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
const presetMap = {
|
|
4
|
-
default: {
|
|
5
|
-
color: '#4598FA',
|
|
6
|
-
text: undefined,
|
|
7
|
-
},
|
|
8
|
-
wallet: {
|
|
9
|
-
color: '#4598FA',
|
|
10
|
-
text: 'Wallet',
|
|
11
|
-
},
|
|
12
|
-
spaces: {
|
|
13
|
-
color: '#8C6AFC',
|
|
14
|
-
text: 'Spaces',
|
|
15
|
-
},
|
|
16
|
-
names: {
|
|
17
|
-
color: '#5D8BB4',
|
|
18
|
-
text: 'Names',
|
|
19
|
-
},
|
|
20
|
-
connect: {
|
|
21
|
-
color: '#1DC1C7',
|
|
22
|
-
text: 'Connect',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export interface DIDLogoProps {
|
|
27
|
-
style?: React.CSSProperties;
|
|
28
|
-
size?: string | number;
|
|
29
|
-
className?: string;
|
|
30
|
-
color?: string;
|
|
31
|
-
text?: string;
|
|
32
|
-
textColor?: string;
|
|
33
|
-
fontSize?: string | number;
|
|
34
|
-
gap?: number;
|
|
35
|
-
variant?: 'contained' | 'default';
|
|
36
|
-
name?: keyof typeof presetMap;
|
|
37
|
-
dark?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default function DIDLogo({
|
|
41
|
-
style = {},
|
|
42
|
-
className = '',
|
|
43
|
-
size = '1em',
|
|
44
|
-
color = undefined,
|
|
45
|
-
text = undefined,
|
|
46
|
-
textColor = undefined,
|
|
47
|
-
fontSize = undefined,
|
|
48
|
-
gap = 10,
|
|
49
|
-
variant = 'default',
|
|
50
|
-
name = undefined,
|
|
51
|
-
dark = false,
|
|
52
|
-
}: DIDLogoProps) {
|
|
53
|
-
const isContained = variant === 'contained';
|
|
54
|
-
const currentPreset = presetMap[name as keyof typeof presetMap] || presetMap.default;
|
|
55
|
-
// 可通过传入 text = null,强制隐藏文字
|
|
56
|
-
const finalText = text === undefined ? currentPreset?.text : text;
|
|
57
|
-
const finalColor = color || currentPreset?.color;
|
|
58
|
-
const finalTextColor = textColor || (dark ? 'white' : '#121212');
|
|
59
|
-
|
|
60
|
-
let scaleIcon = 1;
|
|
61
|
-
let initSize = 80;
|
|
62
|
-
let finalTextSize = fontSize;
|
|
63
|
-
let finalGap = gap + 5;
|
|
64
|
-
if (!isContained && finalText) {
|
|
65
|
-
initSize = 64;
|
|
66
|
-
scaleIcon = 1.25;
|
|
67
|
-
finalGap = gap;
|
|
68
|
-
if (!fontSize) finalTextSize = 32;
|
|
69
|
-
}
|
|
70
|
-
finalTextSize = finalTextSize || 40;
|
|
71
|
-
|
|
72
|
-
const textRef = useRef(null);
|
|
73
|
-
const iconRef = useRef(null);
|
|
74
|
-
const [svgWidth, setSvgWidth] = useState<number>();
|
|
75
|
-
const [textX, setTextX] = useState(initSize);
|
|
76
|
-
const [viewBoxWidth, setViewBoxWidth] = useState(initSize);
|
|
77
|
-
const textY = isContained ? initSize / 2 + 5 : initSize / 2 + 3;
|
|
78
|
-
|
|
79
|
-
const rx = initSize / 5;
|
|
80
|
-
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
if (iconRef.current) {
|
|
83
|
-
setTimeout(() => {
|
|
84
|
-
if (iconRef.current) {
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
const textBbox = textRef.current?.getBBox();
|
|
87
|
-
// @ts-ignore
|
|
88
|
-
const iconRect = iconRef.current.getBoundingClientRect();
|
|
89
|
-
|
|
90
|
-
const textWidth = textBbox?.width || 0;
|
|
91
|
-
const scaleSize = iconRect.height / initSize;
|
|
92
|
-
|
|
93
|
-
const newViewBoxWidth = initSize * scaleIcon + textWidth + (textWidth ? finalGap : 0);
|
|
94
|
-
setViewBoxWidth(newViewBoxWidth);
|
|
95
|
-
setTextX(initSize * scaleIcon + (textWidth ? finalGap : 0));
|
|
96
|
-
setSvgWidth(newViewBoxWidth * scaleSize);
|
|
97
|
-
}
|
|
98
|
-
// HACK: 留给字体渲染一些时间,否则首次出现时,计算的 svg 宽度是不对的
|
|
99
|
-
// 这个时间小于 dialog 动画出现的时间,所以不会引起视觉上的抖动
|
|
100
|
-
}, 300);
|
|
101
|
-
}
|
|
102
|
-
}, [finalText, finalGap, scaleIcon, initSize]);
|
|
103
|
-
|
|
104
|
-
const withBg = (
|
|
105
|
-
<>
|
|
106
|
-
<rect ref={iconRef} width={initSize} height={initSize} rx={rx} fill="currentColor" opacity={0.1} />
|
|
107
|
-
<path
|
|
108
|
-
d="M63.660598583984374,17.9996337890625C67.41619858398437,17.9997131347625,70.46059858398438,21.0441537890625,70.46059858398438,24.7996337890625L70.46059858398438,55.4496337890625C70.46059858398438,59.2048337890625,67.41619858398437,62.2496337890625,63.660598583984374,62.2496337890625L15.999798583984376,62.2496337890625C12.244398583984374,62.2496337890625,9.199918364984375,59.2048337890625,9.199798583984375,55.4496337890625L9.199798583984375,54.6668337890625L13.199798583984375,54.6668337890625L13.199798583984375,55.4496337890625C13.199918583984374,56.9960337890625,14.453558583984375,58.2496337890625,15.999798583984376,58.2496337890625L63.660598583984374,58.2496337890625C65.20699858398437,58.2496337890625,66.46059858398438,56.9960337890625,66.46059858398438,55.4496337890625L66.46059858398438,24.7996337890625C66.46059858398438,23.2532737890625,65.20699858398437,21.9997137890625,63.660598583984374,21.9996337890625L15.999798583984376,21.9996337890625C14.453478583984374,21.9997137890625,13.199798583984375,23.2532737890625,13.199798583984375,24.7996337890625L13.199798583984375,25.7683937890625L9.199798583984375,25.7683937890625L9.199798583984375,24.7996337890625C9.199798583984375,21.0441537890625,12.244318583984375,17.9997131347625,15.999798583984376,17.9996337890625L63.660598583984374,17.9996337890625ZM16.728718583984374,29.982433789062497C18.729478583984374,29.982433789062497,20.462598583984374,30.4036337890625,21.927498583984374,31.2457337890625C23.410198583984375,32.0687337890625,24.562398583984375,33.2364337890625,25.384198583984375,34.7484337890625C26.205998583984375,36.2605337890625,26.616998583984376,38.0406337890625,26.616998583984376,40.088833789062505C26.616998583984376,42.117633789062495,26.205898583984375,43.8784337890625,25.384198583984375,45.3716337890625C24.562398583984375,46.8644337890625,23.410198583984375,48.0228337890625,21.927498583984374,48.845633789062504C20.462598583984374,49.668833789062504,18.729478583984374,50.0800337890625,16.728718583984374,50.0800337890625L9.734958583984374,50.0800337890625L9.734958583984374,29.982433789062497L16.728718583984374,29.982433789062497ZM32.97789858398437,50.0800337890625L29.360398583984374,50.0800337890625L29.360398583984374,29.982433789062497L32.97789858398437,29.982433789062497L32.97789858398437,50.0800337890625ZM43.629798583984375,29.982433789062497C45.63059858398437,29.982433789062497,47.36379858398438,30.4036337890625,48.82859858398437,31.2457337890625C50.31139858398438,32.0687337890625,51.46339858398437,33.2364337890625,52.285398583984374,34.7484337890625C53.10699858398438,36.2605337890625,53.51819858398437,38.0406337890625,53.51819858398437,40.088833789062505C53.51819858398437,42.117633789062495,53.10699858398438,43.8784337890625,52.285398583984374,45.3716337890625C51.46339858398437,46.8644337890625,50.31139858398438,48.0228337890625,48.82859858398437,48.845633789062504C47.36379858398438,49.668833789062504,45.63059858398437,50.0800337890625,43.629798583984375,50.0800337890625L36.63609858398438,50.0800337890625L36.63609858398438,29.982433789062497L43.629798583984375,29.982433789062497ZM58.98419858398437,42.9380337890625C60.101798583984376,42.9380337890625,61.008198583984374,43.8440337890625,61.008198583984374,44.9616337890625C61.008198583984374,46.0796337890625,60.101798583984376,46.9860337890625,58.98419858398437,46.9860337890625C57.86659858398438,46.985633789062504,56.96059858398438,46.0792337890625,56.96019858398437,44.9616337890625C56.96059858398438,43.8440337890625,57.86659858398438,42.9380337890625,58.98419858398437,42.9380337890625ZM13.352518583984375,46.8360337890625L16.621678583984377,46.8360337890625C18.640238583984377,46.8360337890625,20.194398583984373,46.2424337890625,21.284198583984377,45.0560337890625C22.373898583984374,43.8500337890625,22.918998583984376,42.1940337890625,22.918998583984376,40.088833789062505C22.918898583984372,37.9641337890625,22.373898583984374,36.2894337890625,21.284198583984377,35.064433789062505C20.194398583984373,33.8395337890625,18.640278583984376,33.2270337890625,16.621678583984377,33.2270337890625L13.352518583984375,33.2270337890625L13.352518583984375,46.8360337890625ZM40.25379858398438,46.8360337890625L43.522998583984375,46.8360337890625C45.541398583984375,46.8360337890625,47.095798583984376,46.2424337890625,48.18539858398437,45.0560337890625C49.27499858398438,43.8500337890625,49.82019858398437,42.1940337890625,49.82019858398437,40.088833789062505C49.82019858398437,37.9641337890625,49.27499858398438,36.2894337890625,48.18539858398437,35.064433789062505C47.095798583984376,33.8395337890625,45.541398583984375,33.2270337890625,43.522998583984375,33.2270337890625L40.25379858398438,33.2270337890625L40.25379858398438,46.8360337890625ZM58.98419858398437,33.4934337890625C60.101798583984376,33.4934337890625,61.008198583984374,34.3994337890625,61.008198583984374,35.5172337890625C61.008198583984374,36.6349337890625,60.101798583984376,37.541033789062496,58.98419858398437,37.541033789062496C57.86659858398438,37.5408337890625,56.96059858398438,36.6348337890625,56.96019858398437,35.5172337890625C56.96019858398437,34.3995337890625,57.86659858398438,33.4935337890625,58.98419858398437,33.4934337890625Z"
|
|
109
|
-
fill="currentColor"
|
|
110
|
-
/>
|
|
111
|
-
</>
|
|
112
|
-
);
|
|
113
|
-
const noBg = (
|
|
114
|
-
<>
|
|
115
|
-
<rect ref={iconRef} width={initSize * scaleIcon} height={initSize} rx={rx} fill="none" />
|
|
116
|
-
<path
|
|
117
|
-
d="M71.3426,5C75.0978,5.000119781,78.1426,8.04456,78.1426,11.8L78.1426,52.9101C78.1426,56.6657,75.0978,59.7101,71.3426,59.7101L8.79998,59.7101C5.0445,59.7101,2.0000801086,56.6657,2,52.9101L2,50.6765L5.99998,50.6765L5.99998,52.9101C6.00006,54.4565,7.25366,55.7101,8.79998,55.7101L71.3426,55.7101C72.8886,55.7101,74.1426,54.4565,74.1426,52.9101L74.1426,11.8C74.1426,10.25368,72.889,9.000119999999999,71.3426,9L8.79998,9C7.25358,9,5.99998,10.253599999999999,5.99998,11.8L5.99998,14.26796L2,14.26796L2,11.8C2,8.04448,5.04446,5,8.79998,5L71.3426,5ZM10.96602,19.576999999999998C13.4867,19.576999999999998,15.6701,20.107799999999997,17.5156,21.1688C19.3837,22.2057,20.8358,23.6766,21.8711,25.5816C22.9064,27.4867,23.4238,29.7295,23.4238,32.3097C23.4238,34.8661,22.9064,37.0845,21.8711,38.9657C20.8358,40.8465,19.3837,42.3057,17.5156,43.3425C15.6701,44.3793,13.4867,44.8981,10.96602,44.8981L2.154688,44.8981L2.154688,19.576999999999998L10.96602,19.576999999999998ZM31.4383,44.8981L26.8805,44.8981L26.8805,19.5774L31.4383,19.5774L31.4383,44.8981ZM44.8586,19.5774C47.3794,19.5774,49.5626,20.107799999999997,51.4082,21.1688C53.2762,22.2057,54.7282,23.6766,55.7638,25.5816C56.799,27.4867,57.3162,29.7296,57.3162,32.3097C57.3162,34.8661,56.799,37.0849,55.7638,38.9657C54.7282,40.8465,53.2762,42.3057,51.4082,43.3425C49.5626,44.3793,47.3794,44.8981,44.8586,44.8981L36.0469,44.8981L36.0469,19.5774L44.8586,19.5774ZM64.2034,35.899699999999996C65.6118,35.899699999999996,66.7534,37.0413,66.7534,38.4497C66.7534,39.8577,65.6118,40.9993,64.2034,40.9993C62.7954,40.9993,61.6534,39.8577,61.6534,38.4497C61.6534,37.0413,62.7954,35.899699999999996,64.2034,35.899699999999996ZM6.7121,40.8105L10.83126,40.8105C13.3745,40.8105,15.3326,40.0625,16.7055,38.5677C18.0783,37.0485,18.7648,34.9625,18.7648,32.3097C18.7648,29.6331,18.0784,27.523,16.7055,25.9797C15.3326,24.4364,13.3745,23.6645,10.83126,23.6644L6.7121,23.6644L6.7121,40.8105ZM40.6046,40.8105L44.7238,40.8105C47.267,40.8105,49.225,40.0629,50.5982,38.5681C51.971,37.0489,52.6574,34.9625,52.6574,32.3097C52.6574,29.6331,51.971,27.523,50.5982,25.9797C49.225,24.4364,47.267,23.6649,44.7238,23.6648L40.6046,23.6648L40.6046,40.8105ZM64.2034,24.0004C65.6118,24.0005,66.7534,25.1422,66.7534,26.5504C66.7534,27.9586,65.6118,29.1003,64.2034,29.1004C62.795,29.1004,61.6534,27.9587,61.6534,26.5504C61.6534,25.1421,62.7954,24.0004,64.2034,24.0004Z"
|
|
118
|
-
fill="currentColor"
|
|
119
|
-
/>
|
|
120
|
-
</>
|
|
121
|
-
);
|
|
122
|
-
const noBgText = (
|
|
123
|
-
<>
|
|
124
|
-
<rect ref={iconRef} width={initSize * scaleIcon} height={initSize} rx={rx} fill="none" />
|
|
125
|
-
<path
|
|
126
|
-
d="M71.342621,13C75.097809,13.00011978147,78.142624,16.0445597,78.142624,19.799999200000002L78.142624,60.910069C78.142624,64.665668,75.097809,67.710068,71.342621,67.710068L8.799983000000001,67.710068C5.0445037,67.710068,2.000080108621,64.665668,2,60.910069L2,58.676472L5.9999835,58.676472L5.9999835,60.910069C6.0000634,62.456467,7.253664,63.710068,8.799983000000001,63.710068L71.342621,63.710068C72.888603,63.710068,74.142609,62.456467,74.142609,60.910069L74.142609,19.799999200000002C74.142609,18.2536793,72.889008,17.0001183,71.342621,16.9999986L8.799983000000001,16.9999986C7.2535834,16.9999986,5.9999835,18.2535977,5.9999835,19.799999200000002L5.9999835,22.267959599999998L2,22.267959599999998L2,19.799999200000002C2,16.0444784,5.0444634,13,8.799983000000001,13L71.342621,13ZM10.9660225,27.576957C13.486742,27.576957,15.670061,28.107757,17.515621,29.168756C19.383659,30.205677,20.835781,31.676603,21.871099,33.581635C22.906384,35.486677,23.423822,37.729511,23.423822,40.309677C23.423822,42.86607,22.906384,45.084473,21.871099,46.965672C20.835781,48.846466,19.383701,50.305676,17.515621,51.342476C15.670061,52.379284,13.486703,52.898083,10.9660225,52.898083L2.15468803,52.898083L2.15468803,27.576957L10.9660225,27.576957ZM31.438259,52.898083L26.880459,52.898083L26.880459,27.577358L31.438259,27.577358L31.438259,52.898083ZM44.858624,27.577358C47.379414,27.577358,49.562618,28.107757,51.408211,29.168756C53.276222,30.205677,54.728218,31.676636,55.763813,33.581635C56.799011,35.486677,57.316219,37.729555000000005,57.316219,40.309677C57.316219,42.86607,56.799011,45.084873,55.763813,46.965672C54.728218,48.846466,53.276222,50.305676,51.408211,51.342476C49.562618,52.379284,47.379414,52.898083,44.858624,52.898083L36.046856,52.898083L36.046856,27.577358L44.858624,27.577358ZM64.20340300000001,43.899673C65.611801,43.899673,66.75341,45.041279,66.75341,46.44968C66.75341,47.85767,65.611801,48.999275,64.20340300000001,48.999275C62.79541,48.999275,61.653412,47.85767,61.653412,46.44968C61.653412,45.041279,62.79541,43.899673,64.20340300000001,43.899673ZM6.7121043,48.810471L10.8312635,48.810471C13.374459,48.810471,15.332582,48.062473,16.705461,46.567677C18.078341,45.048477,18.764822,42.962473,18.764822,40.309677C18.764822,37.633072,18.078381,35.523035,16.705461,33.979670999999996C15.332582,32.436394,13.374459,31.664515,10.8312635,31.664434L6.7121043,31.664434L6.7121043,48.810471ZM40.604622,48.810471L44.723808,48.810471C47.267017,48.810471,49.225018,48.062874,50.598221,46.568077C51.97102,45.04887,52.657417,42.962473,52.657417,40.309677C52.657417,37.633114,51.97102,35.522997000000004,50.598221,33.979670999999996C49.225018,32.436394,47.267017,31.664913,44.723808,31.664837L40.604622,31.664837L40.604622,48.810471ZM64.20340300000001,32.000399C65.611801,32.000515,66.75341,33.142193,66.75341,34.550396C66.75341,35.958591,65.611801,37.100274999999996,64.20340300000001,37.100391C62.79501,37.100391,61.653412,35.958675,61.653412,34.550396C61.653412,33.142112999999995,62.79541,32.000399,64.20340300000001,32.000399Z"
|
|
127
|
-
fill="currentColor"
|
|
128
|
-
/>
|
|
129
|
-
</>
|
|
130
|
-
);
|
|
131
|
-
let content = noBgText;
|
|
132
|
-
if (isContained) {
|
|
133
|
-
content = withBg;
|
|
134
|
-
} else if (finalText) {
|
|
135
|
-
content = noBg;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<svg
|
|
140
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
141
|
-
width={svgWidth}
|
|
142
|
-
height={size}
|
|
143
|
-
viewBox={`0 0 ${viewBoxWidth} ${initSize}`}
|
|
144
|
-
fill="currentColor"
|
|
145
|
-
className={`${className}`.trim()}
|
|
146
|
-
style={Object.assign({ color: finalColor }, style)}>
|
|
147
|
-
{content}
|
|
148
|
-
{finalText && (
|
|
149
|
-
<text
|
|
150
|
-
ref={textRef}
|
|
151
|
-
x={textX}
|
|
152
|
-
y={textY}
|
|
153
|
-
fontSize={finalTextSize}
|
|
154
|
-
fill={finalTextColor}
|
|
155
|
-
textAnchor="start"
|
|
156
|
-
dominantBaseline="middle"
|
|
157
|
-
fontFamily="Lato, Arial, sans-serif"
|
|
158
|
-
fontWeight="normal"
|
|
159
|
-
style={{
|
|
160
|
-
userSelect: 'none',
|
|
161
|
-
textTransform: 'capitalize',
|
|
162
|
-
}}>
|
|
163
|
-
{finalText}
|
|
164
|
-
</text>
|
|
165
|
-
)}
|
|
166
|
-
</svg>
|
|
167
|
-
);
|
|
168
|
-
}
|