@arcblock/ux 0.78.26 → 1.6.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +0 -56
  3. package/lib/ActionButton/index.js +6 -4
  4. package/lib/ActivityIndicator/index.js +75 -23
  5. package/lib/Alert/index.js +15 -11
  6. package/lib/Async/index.js +1 -1
  7. package/lib/Badge/index.js +17 -15
  8. package/lib/Blocklet/index.js +261 -0
  9. package/lib/Button/wrap.js +96 -43
  10. package/lib/ButtonGroup/index.js +3 -16
  11. package/lib/Center/index.js +30 -4
  12. package/lib/ClickToCopy/index.js +10 -8
  13. package/lib/CodeBlock/index.js +40 -13
  14. package/lib/Colors/index.js +15 -0
  15. package/lib/Colors/themes/default.js +85 -0
  16. package/lib/ContactForm/index.js +9 -10
  17. package/lib/CookieConsent/index.js +98 -0
  18. package/lib/CountDown/index.js +18 -14
  19. package/lib/Dialog/confirm.js +84 -0
  20. package/lib/Dialog/dialog.js +137 -0
  21. package/lib/Dialog/index.js +23 -0
  22. package/lib/Earth/index.js +33 -33
  23. package/lib/Empty/index.js +61 -0
  24. package/lib/Footer/index.js +16 -18
  25. package/lib/Icon/image.js +10 -13
  26. package/lib/Icon/index.js +10 -8
  27. package/lib/Img/index.js +212 -0
  28. package/lib/InfoRow/index.js +7 -6
  29. package/lib/Layout/dashboard/header.js +60 -42
  30. package/lib/Layout/dashboard/index.js +72 -60
  31. package/lib/Layout/dashboard/sidebar.js +41 -25
  32. package/lib/Layout/index.js +113 -51
  33. package/lib/Locale/browser-lang.js +0 -2
  34. package/lib/Locale/context.js +85 -61
  35. package/lib/Locale/selector.js +33 -20
  36. package/lib/Logo/index.js +15 -13
  37. package/lib/Metric/index.js +5 -6
  38. package/lib/NFTDisplay/README.md +59 -0
  39. package/lib/NFTDisplay/aspect-ratio-container.js +52 -0
  40. package/lib/NFTDisplay/broken.js +25 -0
  41. package/lib/NFTDisplay/index.js +317 -0
  42. package/lib/NFTDisplay/loading.js +23 -0
  43. package/lib/NFTDisplay/svg-embedder/img.js +68 -0
  44. package/lib/NFTDisplay/svg-embedder/inline-svg.js +54 -0
  45. package/lib/PageScroller/index.js +10 -11
  46. package/lib/PageScroller/usePrevValue.js +2 -2
  47. package/lib/PricingTable/PricingPlan.js +12 -15
  48. package/lib/PricingTable/index.js +5 -5
  49. package/lib/QRCode/index.js +89 -0
  50. package/lib/Result/common.js +176 -0
  51. package/lib/Result/index.js +61 -0
  52. package/lib/Result/result.js +69 -0
  53. package/lib/Result/translations.js +61 -0
  54. package/lib/Screenshot/index.js +14 -13
  55. package/lib/Spinner/index.js +37 -0
  56. package/lib/SplitButton/index.js +126 -0
  57. package/lib/Switch/index.js +107 -0
  58. package/lib/Tabs/index.js +24 -47
  59. package/lib/Tag/index.js +15 -13
  60. package/lib/Terminal/Player.js +43 -45
  61. package/lib/Terminal/index.js +3 -1
  62. package/lib/Terminal/util.js +2 -3
  63. package/lib/TextCollapse/index.js +21 -14
  64. package/lib/Theme/index.js +79 -63
  65. package/lib/Theme/responsiveFontSizes.js +8 -8
  66. package/lib/Toast/index.js +12 -11
  67. package/lib/Util/index.js +197 -26
  68. package/lib/Video/index.js +8 -11
  69. package/lib/Wallet/Action.js +15 -13
  70. package/lib/Wallet/Download.js +60 -58
  71. package/lib/Wallet/Open.js +2 -2
  72. package/lib/WechatPrompt/index.js +10 -10
  73. package/lib/index.js +6 -6
  74. package/lib/withTheme/index.js +5 -17
  75. package/lib/withTracker/error_boundary.js +3 -3
  76. package/lib/withTracker/index.js +6 -7
  77. package/package.json +23 -17
  78. package/src/ActionButton/index.js +65 -0
  79. package/src/ActivityIndicator/index.js +141 -0
  80. package/src/Alert/index.js +104 -0
  81. package/src/Async/index.js +39 -0
  82. package/src/Badge/index.js +71 -0
  83. package/src/Blocklet/index.js +424 -0
  84. package/src/Button/index.js +4 -0
  85. package/src/Button/wrap.js +101 -0
  86. package/src/ButtonGroup/index.js +6 -0
  87. package/src/Center/index.js +40 -0
  88. package/src/ClickToCopy/index.js +90 -0
  89. package/src/CodeBlock/index.js +160 -0
  90. package/src/Colors/index.js +1 -0
  91. package/src/Colors/themes/default.js +54 -0
  92. package/src/ContactForm/index.js +240 -0
  93. package/src/CookieConsent/index.js +90 -0
  94. package/src/CountDown/index.js +151 -0
  95. package/src/Dialog/confirm.js +76 -0
  96. package/src/Dialog/dialog.js +162 -0
  97. package/src/Dialog/index.js +2 -0
  98. package/src/DriftBot/index.js +81 -0
  99. package/src/Earth/countries.json +8057 -0
  100. package/src/Earth/index.js +511 -0
  101. package/src/Earth/util.js +69 -0
  102. package/src/Empty/index.js +41 -0
  103. package/src/Footer/index.js +110 -0
  104. package/src/Icon/image.js +55 -0
  105. package/src/Icon/index.js +69 -0
  106. package/src/Img/index.js +172 -0
  107. package/src/InfoRow/index.js +83 -0
  108. package/src/Layout/dashboard/header.js +157 -0
  109. package/src/Layout/dashboard/index.js +150 -0
  110. package/src/Layout/dashboard/sidebar.js +122 -0
  111. package/src/Layout/index.js +318 -0
  112. package/src/Locale/browser-lang.js +63 -0
  113. package/src/Locale/context.js +94 -0
  114. package/src/Locale/images/globe-dark.png +0 -0
  115. package/src/Locale/images/globe-light.png +0 -0
  116. package/src/Locale/selector.js +135 -0
  117. package/src/Logo/images/logo-dark-text.svg +3 -0
  118. package/src/Logo/images/logo-dark-top.svg +6 -0
  119. package/src/Logo/images/logo-light-text.svg +3 -0
  120. package/src/Logo/images/logo-light-top.svg +6 -0
  121. package/src/Logo/index.js +47 -0
  122. package/src/Metric/index.js +115 -0
  123. package/src/NFTDisplay/README.md +59 -0
  124. package/src/NFTDisplay/aspect-ratio-container.js +34 -0
  125. package/src/NFTDisplay/broken.js +18 -0
  126. package/src/NFTDisplay/index.js +257 -0
  127. package/src/NFTDisplay/loading.js +17 -0
  128. package/src/NFTDisplay/svg-embedder/img.js +36 -0
  129. package/src/NFTDisplay/svg-embedder/inline-svg.js +37 -0
  130. package/src/PageScroller/index.js +342 -0
  131. package/src/PageScroller/usePrevValue.js +12 -0
  132. package/src/PricingTable/PricingPlan.js +112 -0
  133. package/src/PricingTable/index.js +43 -0
  134. package/src/QRCode/index.js +56 -0
  135. package/src/Result/common.js +116 -0
  136. package/src/Result/index.js +31 -0
  137. package/src/Result/result.js +57 -0
  138. package/src/Result/translations.js +56 -0
  139. package/src/Screenshot/devices.css +1366 -0
  140. package/src/Screenshot/index.js +181 -0
  141. package/src/Spinner/index.js +19 -0
  142. package/src/SplitButton/index.js +112 -0
  143. package/src/Switch/index.js +78 -0
  144. package/src/Tabs/index.js +46 -0
  145. package/src/Tag/index.js +73 -0
  146. package/src/Terminal/Player.js +364 -0
  147. package/src/Terminal/index.js +150 -0
  148. package/src/Terminal/player.css +378 -0
  149. package/src/Terminal/util.js +167 -0
  150. package/src/Terminal/xterm.css +171 -0
  151. package/src/TextCollapse/index.js +92 -0
  152. package/src/Theme/index.js +184 -0
  153. package/src/Theme/responsiveFontSizes.js +94 -0
  154. package/src/Toast/index.js +118 -0
  155. package/src/Util/index.js +281 -0
  156. package/src/Video/index.js +72 -0
  157. package/src/Wallet/Action.js +105 -0
  158. package/src/Wallet/Download.js +130 -0
  159. package/src/Wallet/Open.js +50 -0
  160. package/src/Wallet/images/abtwallet.png +0 -0
  161. package/src/Wallet/images/android_download.svg +23 -0
  162. package/src/Wallet/images/app-store.svg +20 -0
  163. package/src/Wallet/images/google-play.svg +70 -0
  164. package/src/WechatPrompt/images/android.png +0 -0
  165. package/src/WechatPrompt/images/ios.png +0 -0
  166. package/src/WechatPrompt/index.js +81 -0
  167. package/src/index.js +63 -0
  168. package/src/withTheme/index.js +72 -0
  169. package/src/withTracker/README.md +34 -0
  170. package/src/withTracker/error_boundary.js +34 -0
  171. package/src/withTracker/index.js +70 -0
  172. package/lib/GraphQLPlayground/graphiql.css +0 -1850
  173. package/lib/GraphQLPlayground/index.js +0 -302
  174. package/lib/GraphQLPlayground/util.js +0 -55
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import Button from '../Button';
5
+ import { mergeProps } from '../Util';
6
+
7
+ const ActionButton = props => {
8
+ const newProps = mergeProps(props, ActionButton);
9
+ const { href, icon, size, color, theme, variant, gradient, children, text, ...rest } = newProps;
10
+ const styles = {};
11
+ if (gradient) {
12
+ styles.backgroundImage = gradient;
13
+ styles.borderColor = 'transparent';
14
+ }
15
+ const attrs = ['color', 'border', 'width'];
16
+ attrs.forEach(x => {
17
+ if (newProps[x]) {
18
+ styles[x] = newProps[x];
19
+ }
20
+ });
21
+
22
+ return (
23
+ <Button
24
+ color={theme}
25
+ href={href}
26
+ target="_blank"
27
+ variant={variant}
28
+ style={styles}
29
+ size={size}
30
+ className="action-button"
31
+ {...rest}>
32
+ {!!icon && <i className={icon} />}
33
+ {text || children}
34
+ </Button>
35
+ );
36
+ };
37
+
38
+ ActionButton.propTypes = {
39
+ href: PropTypes.string.isRequired,
40
+ children: PropTypes.any,
41
+ gradient: PropTypes.string,
42
+ color: PropTypes.string,
43
+ icon: PropTypes.string,
44
+ border: PropTypes.string,
45
+ text: PropTypes.string,
46
+ theme: PropTypes.string,
47
+ variant: PropTypes.string,
48
+ size: PropTypes.string,
49
+ width: PropTypes.string,
50
+ };
51
+
52
+ ActionButton.defaultProps = {
53
+ gradient: '',
54
+ icon: '',
55
+ text: '',
56
+ color: '',
57
+ border: '',
58
+ width: '',
59
+ theme: 'default',
60
+ variant: 'outlined',
61
+ size: 'large',
62
+ children: null,
63
+ };
64
+
65
+ export default ActionButton;
@@ -0,0 +1,141 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import green from '@material-ui/core/colors/green';
5
+ import blue from '@material-ui/core/colors/blue';
6
+
7
+ import Logo from '../Logo';
8
+ import colors from '../Colors';
9
+
10
+ // inspired by: https://codepen.io/wangshijun/pen/oQvwdX?editors=1100
11
+ export default function ActivityIndicator({ messages, interval, ...rest }) {
12
+ const [index, setIndex] = useState(0);
13
+
14
+ useEffect(() => {
15
+ const timer = setInterval(() => {
16
+ setIndex((index + 1) % messages.length);
17
+ }, interval);
18
+
19
+ return () => {
20
+ clearTimeout(timer);
21
+ };
22
+ });
23
+
24
+ return (
25
+ <Div {...rest}>
26
+ <div className="pm-loader-container">
27
+ <div className="pm-loader-text">
28
+ <p>{messages[index]}</p>
29
+ </div>
30
+ <div className="pm-loader-atoms">
31
+ <Logo style={{ transform: 'scale(0.6)' }} showText={false} />
32
+ <Orbit size={56} orbitColor={green[500]} atomColor={green[500]} duration={1} />
33
+ <Orbit size={80} orbitColor={blue[800]} atomColor={blue[800]} duration={1.5} />
34
+ <Orbit size={100} orbitColor={colors.grey[900]} atomColor={colors.grey[900]} />
35
+ </div>
36
+ </div>
37
+ </Div>
38
+ );
39
+ }
40
+
41
+ ActivityIndicator.propTypes = {
42
+ interval: PropTypes.number,
43
+ messages: PropTypes.arrayOf(PropTypes.string.isRequired),
44
+ };
45
+
46
+ ActivityIndicator.defaultProps = {
47
+ interval: 3000,
48
+ messages: ['Loading data...'],
49
+ };
50
+
51
+ const Div = styled.div`
52
+ && {
53
+ box-sizing: border-box;
54
+ padding: 20px;
55
+ width: 100%;
56
+ height: 100%;
57
+ min-height: 360px;
58
+ z-index: 100;
59
+ transition: opacity 0.5s linear;
60
+ display: flex;
61
+ align-items: center;
62
+ flex-direction: column;
63
+ justify-content: center;
64
+ }
65
+
66
+ .pm-loader-text {
67
+ color: ${colors.grey[900]};
68
+ font-size: 14px;
69
+ text-align: center;
70
+ position: relative;
71
+ height: 70px;
72
+ -webkit-user-select: none;
73
+ }
74
+
75
+ .pm-loader-container {
76
+ width: 100%;
77
+ height: 100%;
78
+ display: flex;
79
+ align-items: center;
80
+ flex-direction: column;
81
+ justify-content: center;
82
+ flex: 1;
83
+ }
84
+
85
+ .pm-loader-atoms {
86
+ width: 100px;
87
+ height: 100px;
88
+ display: flex;
89
+ position: relative;
90
+ align-items: center;
91
+ justify-content: center;
92
+ }
93
+ `;
94
+
95
+ const Orbit = ({ size, orbitColor, atomColor, duration, ...rest }) => {
96
+ return (
97
+ <OrbitRoot
98
+ $duration={duration}
99
+ style={{ width: size, height: size, border: `1px solid ${orbitColor}` }}
100
+ {...rest}>
101
+ <div style={{ background: atomColor }} />
102
+ </OrbitRoot>
103
+ );
104
+ };
105
+
106
+ Orbit.propTypes = {
107
+ size: PropTypes.number.isRequired,
108
+ orbitColor: PropTypes.string.isRequired,
109
+ atomColor: PropTypes.string.isRequired,
110
+ duration: PropTypes.number,
111
+ };
112
+
113
+ Orbit.defaultProps = {
114
+ duration: 2,
115
+ };
116
+
117
+ const OrbitRoot = styled.div`
118
+ @keyframes orbit {
119
+ 0% {
120
+ transform: rotate(0deg);
121
+ }
122
+ 100% {
123
+ transform: rotate(360deg);
124
+ }
125
+ }
126
+
127
+ position: absolute;
128
+ border-radius: 50%;
129
+ animation: orbit ${({ $duration }) => $duration}s infinite;
130
+ animation-timing-function: linear;
131
+ transform-origin: center;
132
+
133
+ > div {
134
+ position: absolute;
135
+ top: 50%;
136
+ width: 6px;
137
+ height: 6px;
138
+ transform: translateX(-50%);
139
+ border-radius: 50%;
140
+ }
141
+ `;
@@ -0,0 +1,104 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import Typography from '@material-ui/core/Typography';
5
+ import blueGrey from '@material-ui/core/colors/blueGrey';
6
+
7
+ import Icon from '../Icon';
8
+ import { mergeProps } from '../Util';
9
+ import colors from '../Colors';
10
+
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
+ const Alert = props => {
39
+ const newProps = mergeProps(props, Alert, ['style']);
40
+ const { type, children, style, className, variant, ...rest } = newProps;
41
+ const { icon, color, backgroundColor, borderColor } = types[type] || types.success;
42
+ const styles = Object.assign(
43
+ {
44
+ color: blueGrey[500],
45
+ backgroundColor: variant === 'border' ? backgroundColor : 'transparent',
46
+ borderLeft: variant === 'border' ? `5px solid ${borderColor}` : 'none',
47
+ },
48
+ style
49
+ );
50
+
51
+ return (
52
+ <Container
53
+ {...rest}
54
+ className={`alert alert--${type} alert--${variant} ${className}`.trim()}
55
+ style={styles}>
56
+ {variant === 'icon' && (
57
+ <Icon className="alert-icon" name={icon} size={24} style={{ color }} />
58
+ )}
59
+ <Typography component="div" className="alert-content">
60
+ {children}
61
+ </Typography>
62
+ </Container>
63
+ );
64
+ };
65
+
66
+ Alert.propTypes = {
67
+ type: PropTypes.oneOf(Object.keys(types)),
68
+ children: PropTypes.any.isRequired,
69
+ className: PropTypes.string,
70
+ style: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
71
+ variant: PropTypes.oneOf(['border', 'icon']),
72
+ };
73
+
74
+ Alert.defaultProps = {
75
+ type: 'tip',
76
+ className: '',
77
+ style: '{}',
78
+ variant: 'border',
79
+ };
80
+
81
+ export default Alert;
82
+
83
+ const Container = styled.div`
84
+ display: flex;
85
+ align-items: center;
86
+ font-size: 16px;
87
+ margin: 0;
88
+ padding: 16px;
89
+ margin: 16px 0;
90
+
91
+ strong {
92
+ margin: 0 5px;
93
+ }
94
+
95
+ .alert-icon {
96
+ margin-right: 16px;
97
+ }
98
+
99
+ .alert-content {
100
+ flex: 1;
101
+ display: flex;
102
+ flex-direction: column;
103
+ }
104
+ `;
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+
3
+ import CircularProgress from '@material-ui/core/CircularProgress';
4
+
5
+ export default function LoadAsyncComponent(importComponent, key = 'default', showProgress = true) {
6
+ class AsyncComponent extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+
10
+ this.state = {
11
+ Component: null,
12
+ error: null,
13
+ };
14
+ }
15
+
16
+ componentDidMount() {
17
+ importComponent()
18
+ .then(asyncModule => this.setState({ Component: asyncModule[key] }))
19
+ .catch(err => this.setState({ error: `Failed to load async component: ${err.message}` }));
20
+ }
21
+
22
+ render() {
23
+ const { Component, error } = this.state;
24
+
25
+ if (error) {
26
+ return error;
27
+ }
28
+
29
+ // eslint-disable-next-line no-nested-ternary
30
+ return Component ? (
31
+ <Component {...this.props} />
32
+ ) : showProgress ? (
33
+ <CircularProgress color="primary" />
34
+ ) : null;
35
+ }
36
+ }
37
+
38
+ return AsyncComponent;
39
+ }
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+
5
+ import Typography from '@material-ui/core/Typography';
6
+
7
+ import colors from '../Colors';
8
+ import { mergeProps } from '../Util';
9
+
10
+ const types = {
11
+ error: {
12
+ color: colors.common.white,
13
+ backgroundColor: colors.error.main,
14
+ },
15
+ warning: {
16
+ color: colors.common.white,
17
+ backgroundColor: colors.warning.main,
18
+ },
19
+ success: {
20
+ color: colors.common.white,
21
+ backgroundColor: colors.success.main,
22
+ },
23
+ primary: {
24
+ color: colors.common.white,
25
+ backgroundColor: colors.primary.main,
26
+ },
27
+ reverse: {
28
+ color: colors.common.white,
29
+ backgroundColor: colors.grey[900],
30
+ },
31
+ };
32
+
33
+ function Badge(props) {
34
+ const newProps = mergeProps(props, Badge, ['style']);
35
+ const { type, content, children, style, className, forwardedRef, ...rest } = newProps;
36
+ const styles = Object.assign(types[type] || types.primary, style);
37
+
38
+ return (
39
+ <Span ref={forwardedRef} component="span" className={className} style={styles} {...rest}>
40
+ {content || children}
41
+ </Span>
42
+ );
43
+ }
44
+
45
+ Badge.propTypes = {
46
+ children: PropTypes.any.isRequired,
47
+ content: PropTypes.string,
48
+ type: PropTypes.oneOf(Object.keys(types)),
49
+ className: PropTypes.string,
50
+ style: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
51
+ };
52
+
53
+ Badge.defaultProps = {
54
+ type: 'primary',
55
+ content: '',
56
+ className: '',
57
+ style: '{}',
58
+ };
59
+
60
+ export default React.forwardRef((props, ref) => <Badge {...props} forwardedRef={ref} />);
61
+
62
+ const Span = styled(Typography)`
63
+ && {
64
+ display: inline-flex;
65
+ justify-content: center;
66
+ align-items: center;
67
+ padding: 2px 10px;
68
+ height: 24px;
69
+ line-height: 24px;
70
+ }
71
+ `;