@arcblock/ux 2.6.9 → 2.7.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/babel.config.es.js +12 -0
- package/es/ActionButton/index.js +99 -0
- package/es/ActivityIndicator/index.js +180 -0
- package/es/Address/compact-text.js +105 -0
- package/es/Address/did-address.js +211 -0
- package/es/Address/index.js +23 -0
- package/es/Address/responsive-did-address.js +88 -0
- package/es/Alert/index.js +134 -0
- package/es/AnimationWaiter/default-animation.json +1 -0
- package/es/AnimationWaiter/index.js +239 -0
- package/es/Async/index.js +38 -0
- package/es/Avatar/did-motif.js +64 -0
- package/es/Avatar/etherscan-blockies.js +83 -0
- package/es/Avatar/index.js +176 -0
- package/es/Badge/index.js +98 -0
- package/es/Blocklet/blocklet.js +298 -0
- package/es/Blocklet/index.js +4 -0
- package/es/Blocklet/utils.js +52 -0
- package/es/BlockletNFT/index.js +412 -0
- package/es/Button/index.js +8 -0
- package/es/Button/wrap.js +140 -0
- package/es/ButtonGroup/index.js +6 -0
- package/es/CardSelector/index.js +131 -0
- package/es/Center/index.js +41 -0
- package/es/ClickToCopy/copy-button.js +72 -0
- package/es/ClickToCopy/hook.js +39 -0
- package/es/ClickToCopy/index.js +93 -0
- package/es/CodeBlock/LightBox.js +85 -0
- package/es/CodeBlock/index.js +226 -0
- package/es/Colors/index.js +2 -0
- package/es/Colors/themes/default.js +78 -0
- package/es/ContactForm/index.js +230 -0
- package/es/CookieConsent/index.js +113 -0
- package/es/CountDown/index.js +178 -0
- package/es/DID/index.js +105 -0
- package/es/Datatable/CustomToolbar.js +396 -0
- package/es/Datatable/DatatableContext.js +34 -0
- package/es/Datatable/TableSearch.js +165 -0
- package/es/Datatable/index.js +627 -0
- package/es/Datatable/utils.js +132 -0
- package/es/Dialog/confirm.js +90 -0
- package/es/Dialog/dialog.js +192 -0
- package/es/Dialog/index.js +3 -0
- package/es/DidLogo/index.js +31 -0
- package/es/DriftBot/index.js +70 -0
- package/es/Earth/countries.json +8057 -0
- package/es/Earth/index.js +521 -0
- package/es/Earth/util.js +51 -0
- package/es/Empty/index.js +64 -0
- package/es/ErrorBoundary/fallback.js +73 -0
- package/es/ErrorBoundary/index.js +1 -0
- package/es/Footer/index.js +172 -0
- package/es/Header/auto-hidden.js +35 -0
- package/es/Header/header.js +211 -0
- package/es/Header/index.js +2 -0
- package/es/Header/responsive-header.js +111 -0
- package/es/Icon/image.js +65 -0
- package/es/Icon/index.js +84 -0
- package/es/Img/index.js +217 -0
- package/es/InfoRow/index.js +87 -0
- package/es/Layout/dashboard/external-link.js +58 -0
- package/es/Layout/dashboard/full-page.js +53 -0
- package/es/Layout/dashboard/index.js +275 -0
- package/es/Layout/dashboard/sidebar.js +209 -0
- package/es/Layout/dashboard-legacy/header.js +174 -0
- package/es/Layout/dashboard-legacy/index.js +149 -0
- package/es/Layout/dashboard-legacy/sidebar.js +129 -0
- package/es/Layout/index.js +335 -0
- package/es/Locale/browser-lang.js +52 -0
- package/es/Locale/context.js +114 -0
- package/es/Locale/languages.js +60 -0
- package/es/Locale/selector.js +180 -0
- package/es/Locale/util.js +13 -0
- package/es/Logo/images/logo-dark-text.svg +3 -0
- package/es/Logo/images/logo-dark-top.svg +6 -0
- package/es/Logo/images/logo-light-text.svg +3 -0
- package/es/Logo/images/logo-light-top.svg +6 -0
- package/es/Logo/index.js +136 -0
- package/es/Metric/index.js +132 -0
- package/es/NFTDisplay/README.md +59 -0
- package/es/NFTDisplay/aspect-ratio-container.js +39 -0
- package/es/NFTDisplay/broken.js +18 -0
- package/es/NFTDisplay/demo/data/asset-state-display-url.json +7 -0
- package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-1-1.json +10 -0
- package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-374-130.json +10 -0
- package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-with-foreign-object.json +20 -0
- package/es/NFTDisplay/demo/data/asset-state-svg.json +29 -0
- package/es/NFTDisplay/demo/data/asset-state-url.json +10 -0
- package/es/NFTDisplay/index.js +323 -0
- package/es/NFTDisplay/loading.js +18 -0
- package/es/NFTDisplay/svg-embedder/img.js +45 -0
- package/es/NFTDisplay/svg-embedder/inline-svg.js +39 -0
- package/es/NavMenu/index.js +2 -0
- package/es/NavMenu/nav-menu.js +286 -0
- package/es/NavMenu/style.js +176 -0
- package/es/PageScroller/index.js +286 -0
- package/es/PageScroller/story/FifthComponent.js +9 -0
- package/es/PageScroller/story/FirstComponent.js +9 -0
- package/es/PageScroller/story/FourthComponent.js +12 -0
- package/es/PageScroller/story/FullPage.js +47 -0
- package/es/PageScroller/story/PageContain.js +59 -0
- package/es/PageScroller/story/SecondComponent.js +9 -0
- package/es/PageScroller/story/ThirdComponent.js +9 -0
- package/es/PageScroller/story/index.css +115 -0
- package/es/PageScroller/usePrevValue.js +9 -0
- package/es/PricingTable/PricingPlan.js +124 -0
- package/es/PricingTable/index.js +53 -0
- package/es/QRCode/index.js +72 -0
- package/es/RelativeTime/index.js +98 -0
- package/es/Result/common.js +140 -0
- package/es/Result/demo/fixtures/result-image-404.svg +1 -0
- package/es/Result/index.js +33 -0
- package/es/Result/result.js +59 -0
- package/es/Result/translations.js +54 -0
- package/es/Screenshot/BaseScreenshot/index.js +91 -0
- package/es/Screenshot/BaseScreenshot/shells/Macbook.js +51 -0
- package/es/Screenshot/BaseScreenshot/shells/Phone.js +36 -0
- package/es/Screenshot/demo/images/bg-00.jpg +0 -0
- package/es/Screenshot/demo/images/bg-01.jpg +0 -0
- package/es/Screenshot/demo/images/bg-02.jpg +0 -0
- package/es/Screenshot/demo/images/bg-03.jpg +0 -0
- package/es/Screenshot/demo/images/bg-04.jpg +0 -0
- package/es/Screenshot/demo/images/bg-05.jpg +0 -0
- package/es/Screenshot/demo/images/bg-06.jpg +0 -0
- package/es/Screenshot/demo/images/bg-07.jpg +0 -0
- package/es/Screenshot/demo/images/bg-08.jpg +0 -0
- package/es/Screenshot/demo/images/bg-09.jpg +0 -0
- package/es/Screenshot/devices.css +1366 -0
- package/es/Screenshot/index.js +299 -0
- package/es/SessionManager/federated-login-detecter.js +166 -0
- package/es/SessionManager/index.js +468 -0
- package/es/SessionManager/user-popper.js +132 -0
- package/es/Sparkline/index.js +193 -0
- package/es/Spinner/index.js +28 -0
- package/es/SplitButton/index.js +144 -0
- package/es/Switch/index.js +96 -0
- package/es/Tabs/index.js +48 -0
- package/es/Tag/index.js +108 -0
- package/es/TextCollapse/index.js +92 -0
- package/es/Theme/index.js +16 -0
- package/es/Theme/theme-provider.js +39 -0
- package/es/Theme/theme.js +133 -0
- package/es/Toast/index.js +95 -0
- package/es/Util/deprecate.js +28 -0
- package/es/Util/index.js +298 -0
- package/es/Util/wallet.js +32 -0
- package/es/Video/index.js +89 -0
- package/es/Wallet/Action.js +119 -0
- package/es/Wallet/Download.js +331 -0
- package/es/Wallet/Open.js +45 -0
- package/es/Wallet/images/abtwallet.png +0 -0
- package/es/Wallet/images/android_download.svg +23 -0
- package/es/Wallet/images/app-store.svg +20 -0
- package/es/Wallet/images/google-play.svg +70 -0
- package/es/WebWalletSWKeeper/index.js +115 -0
- package/es/WechatPrompt/images/android.png +0 -0
- package/es/WechatPrompt/images/ios.png +0 -0
- package/es/WechatPrompt/index.js +88 -0
- package/es/index.js +38 -0
- package/es/withTheme/index.js +69 -0
- package/es/withTracker/README.md +34 -0
- package/es/withTracker/error_boundary.js +34 -0
- package/es/withTracker/index.js +56 -0
- package/package.json +272 -5
@@ -0,0 +1,88 @@
|
|
1
|
+
import { useState, createRef, useEffect } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import useMeasure from 'react-use/lib/useMeasure';
|
4
|
+
import { styled } from '../Theme';
|
5
|
+
import DidAddress from './did-address';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* 根据父容器宽度自动切换 compact 模式
|
9
|
+
*
|
10
|
+
* 实现逻辑:
|
11
|
+
* - DidAddress 外层包裹一个容器, 其宽度自动撑满父容器宽度 (即这个容器需要是块级元素或 100% 宽的 inline-block)
|
12
|
+
* - DidAddress 本身以 inline 形式渲染 (方便探测 did-address 的 full-width)
|
13
|
+
* - 组件 mounted 时记录 did address 的 full-width (非 compact 模式的宽度)
|
14
|
+
* - 监听容器宽度变化, 当容器宽度变化时, 对比容器宽度和 did address full-width, => 切换 compact 模式
|
15
|
+
* - TODO: 初始化时, 在确定是否应该以 compact 模式渲染前, 隐藏显示, 避免闪烁问题
|
16
|
+
*/
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
18
|
+
export default function ResponsiveDidAddress({
|
19
|
+
style,
|
20
|
+
className,
|
21
|
+
component,
|
22
|
+
...rest
|
23
|
+
}) {
|
24
|
+
const [compact, setCompact] = useState(false);
|
25
|
+
// did address 完整显示时的宽度
|
26
|
+
const [addressFullWidth, setAddressFullWidth] = useState(null);
|
27
|
+
const [containerRef, {
|
28
|
+
width: containerWidth
|
29
|
+
}] = useMeasure();
|
30
|
+
const ref = /*#__PURE__*/createRef();
|
31
|
+
// 存储完整显示时 address 组件的宽度
|
32
|
+
useEffect(() => {
|
33
|
+
if (!compact && addressFullWidth === null) {
|
34
|
+
setAddressFullWidth(ref.current.offsetWidth);
|
35
|
+
}
|
36
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
37
|
+
}, []);
|
38
|
+
useEffect(() => {
|
39
|
+
if (containerWidth && addressFullWidth) {
|
40
|
+
setCompact(containerWidth < addressFullWidth);
|
41
|
+
}
|
42
|
+
}, [containerWidth, addressFullWidth]);
|
43
|
+
return /*#__PURE__*/_jsx(Root, {
|
44
|
+
as: component,
|
45
|
+
inline: rest.inline,
|
46
|
+
ref: containerRef,
|
47
|
+
style: style,
|
48
|
+
className: className,
|
49
|
+
children: /*#__PURE__*/_jsx(StyledDidAddress, {
|
50
|
+
...rest,
|
51
|
+
component: component,
|
52
|
+
inline: true,
|
53
|
+
compact: compact,
|
54
|
+
ref: ref
|
55
|
+
})
|
56
|
+
});
|
57
|
+
}
|
58
|
+
ResponsiveDidAddress.propTypes = {
|
59
|
+
style: PropTypes.object,
|
60
|
+
className: PropTypes.string,
|
61
|
+
component: PropTypes.string
|
62
|
+
};
|
63
|
+
ResponsiveDidAddress.defaultProps = {
|
64
|
+
style: {},
|
65
|
+
className: '',
|
66
|
+
component: 'span'
|
67
|
+
};
|
68
|
+
const Root = styled('div')`
|
69
|
+
display: block;
|
70
|
+
overflow: hidden;
|
71
|
+
${({
|
72
|
+
inline
|
73
|
+
}) => inline && `
|
74
|
+
display: inline-block;
|
75
|
+
width: 100%;
|
76
|
+
`}
|
77
|
+
`;
|
78
|
+
const StyledDidAddress = styled(DidAddress)`
|
79
|
+
&& {
|
80
|
+
max-width: none;
|
81
|
+
}
|
82
|
+
.did-address-text {
|
83
|
+
/* 禁止文本 Ellipsis/截断, 以便测量真实的宽度 */
|
84
|
+
white-space: nowrap;
|
85
|
+
overflow: visible;
|
86
|
+
text-overflow: unset;
|
87
|
+
}
|
88
|
+
`;
|
@@ -0,0 +1,134 @@
|
|
1
|
+
import PropTypes from 'prop-types';
|
2
|
+
import Typography from '@mui/material/Typography';
|
3
|
+
import { blueGrey } from '@mui/material/colors';
|
4
|
+
import Icon from '../Icon';
|
5
|
+
import { mergeProps } from '../Util';
|
6
|
+
import colors from '../Colors';
|
7
|
+
import { styled } from '../Theme';
|
8
|
+
import { withDeprecated } from '../Util/deprecate';
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
11
|
+
const types = {
|
12
|
+
error: {
|
13
|
+
icon: 'exclamation-circle',
|
14
|
+
color: colors.error.main,
|
15
|
+
borderColor: '#e35b54',
|
16
|
+
backgroundColor: 'rgba(227, 91, 84, 0.2)'
|
17
|
+
},
|
18
|
+
warning: {
|
19
|
+
icon: 'exclamation-triangle',
|
20
|
+
color: colors.warning.main,
|
21
|
+
borderColor: '#f7d040',
|
22
|
+
backgroundColor: 'rgba(247, 208, 64, 0.2)'
|
23
|
+
},
|
24
|
+
success: {
|
25
|
+
icon: 'check-circle',
|
26
|
+
color: colors.success.main,
|
27
|
+
borderColor: '#89ddd9',
|
28
|
+
backgroundColor: 'rgba(137, 221, 217, 0.2)'
|
29
|
+
},
|
30
|
+
tip: {
|
31
|
+
icon: 'info-circle',
|
32
|
+
color: colors.grey[500],
|
33
|
+
borderColor: '#222222',
|
34
|
+
backgroundColor: '#EEEEEE'
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Alert notification component
|
40
|
+
* @typedef {{
|
41
|
+
* type?: 'error' | 'warning' | 'success' | 'tip';
|
42
|
+
* children: any;
|
43
|
+
* className?: string;
|
44
|
+
* style?: object | string;
|
45
|
+
* variant?: 'border' | 'icon';
|
46
|
+
* } & import('react').ComponentPropsWithoutRef<"div"> } AlertProps
|
47
|
+
*/
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Alert notification component
|
51
|
+
* @param {AlertProps} props
|
52
|
+
* @returns {JSX.Element}
|
53
|
+
*/
|
54
|
+
function Alert(props) {
|
55
|
+
/** @type {AlertProps} */
|
56
|
+
const newProps = mergeProps(props, Alert, ['style']);
|
57
|
+
const {
|
58
|
+
type,
|
59
|
+
children,
|
60
|
+
style,
|
61
|
+
className,
|
62
|
+
variant,
|
63
|
+
...rest
|
64
|
+
} = newProps;
|
65
|
+
const {
|
66
|
+
icon,
|
67
|
+
color,
|
68
|
+
backgroundColor,
|
69
|
+
borderColor
|
70
|
+
} = types[type] || types.success;
|
71
|
+
|
72
|
+
/** @type {import('react').CSSProperties} */
|
73
|
+
const styles = Object.assign({
|
74
|
+
color: blueGrey[500],
|
75
|
+
backgroundColor: variant === 'border' ? backgroundColor : 'transparent',
|
76
|
+
borderLeft: variant === 'border' ? `5px solid ${borderColor}` : 'none'
|
77
|
+
}, style);
|
78
|
+
return /*#__PURE__*/_jsxs(Container, {
|
79
|
+
...rest,
|
80
|
+
className: `alert alert--${type} alert--${variant} ${className}`.trim(),
|
81
|
+
style: styles,
|
82
|
+
children: [variant === 'icon' && /*#__PURE__*/_jsx(Icon, {
|
83
|
+
className: "alert-icon",
|
84
|
+
name: icon,
|
85
|
+
size: 24,
|
86
|
+
style: {
|
87
|
+
color
|
88
|
+
}
|
89
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
90
|
+
component: "div",
|
91
|
+
className: "alert-content",
|
92
|
+
children: children
|
93
|
+
})]
|
94
|
+
});
|
95
|
+
}
|
96
|
+
Alert.propTypes = {
|
97
|
+
type: PropTypes.oneOf(Object.keys(types)),
|
98
|
+
children: PropTypes.any.isRequired,
|
99
|
+
className: PropTypes.string,
|
100
|
+
style: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
101
|
+
variant: PropTypes.oneOf(['border', 'icon'])
|
102
|
+
};
|
103
|
+
Alert.defaultProps = {
|
104
|
+
type: 'tip',
|
105
|
+
className: '',
|
106
|
+
style: '{}',
|
107
|
+
variant: 'border'
|
108
|
+
};
|
109
|
+
export default withDeprecated(Alert, {
|
110
|
+
name: 'Alert',
|
111
|
+
alternative: '@mui/material/Alert'
|
112
|
+
});
|
113
|
+
const Container = styled('div')`
|
114
|
+
display: flex;
|
115
|
+
align-items: center;
|
116
|
+
font-size: 16px;
|
117
|
+
margin: 0;
|
118
|
+
padding: 16px;
|
119
|
+
margin: 16px 0;
|
120
|
+
|
121
|
+
strong {
|
122
|
+
margin: 0 5px;
|
123
|
+
}
|
124
|
+
|
125
|
+
.alert-icon {
|
126
|
+
margin-right: 16px;
|
127
|
+
}
|
128
|
+
|
129
|
+
.alert-content {
|
130
|
+
flex: 1;
|
131
|
+
display: flex;
|
132
|
+
flex-direction: column;
|
133
|
+
}
|
134
|
+
`;
|