@arcblock/ux 0.78.25 → 1.6.59

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 (172) 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/Result/common.js +176 -0
  50. package/lib/Result/index.js +61 -0
  51. package/lib/Result/result.js +69 -0
  52. package/lib/Result/translations.js +61 -0
  53. package/lib/Screenshot/index.js +14 -13
  54. package/lib/Spinner/index.js +37 -0
  55. package/lib/SplitButton/index.js +126 -0
  56. package/lib/Switch/index.js +107 -0
  57. package/lib/Tabs/index.js +24 -47
  58. package/lib/Tag/index.js +15 -13
  59. package/lib/Terminal/Player.js +43 -45
  60. package/lib/Terminal/index.js +3 -1
  61. package/lib/Terminal/util.js +2 -3
  62. package/lib/TextCollapse/index.js +21 -14
  63. package/lib/Theme/index.js +79 -63
  64. package/lib/Theme/responsiveFontSizes.js +8 -8
  65. package/lib/Toast/index.js +12 -11
  66. package/lib/Util/index.js +197 -26
  67. package/lib/Video/index.js +8 -11
  68. package/lib/Wallet/Action.js +15 -13
  69. package/lib/Wallet/Download.js +60 -58
  70. package/lib/Wallet/Open.js +2 -2
  71. package/lib/WechatPrompt/index.js +10 -10
  72. package/lib/index.js +6 -6
  73. package/lib/withTheme/index.js +5 -17
  74. package/lib/withTracker/error_boundary.js +3 -3
  75. package/lib/withTracker/index.js +6 -7
  76. package/package.json +22 -17
  77. package/src/ActionButton/index.js +65 -0
  78. package/src/ActivityIndicator/index.js +141 -0
  79. package/src/Alert/index.js +104 -0
  80. package/src/Async/index.js +39 -0
  81. package/src/Badge/index.js +71 -0
  82. package/src/Blocklet/index.js +424 -0
  83. package/src/Button/index.js +4 -0
  84. package/src/Button/wrap.js +101 -0
  85. package/src/ButtonGroup/index.js +6 -0
  86. package/src/Center/index.js +40 -0
  87. package/src/ClickToCopy/index.js +90 -0
  88. package/src/CodeBlock/index.js +160 -0
  89. package/src/Colors/index.js +1 -0
  90. package/src/Colors/themes/default.js +54 -0
  91. package/src/ContactForm/index.js +240 -0
  92. package/src/CookieConsent/index.js +90 -0
  93. package/src/CountDown/index.js +151 -0
  94. package/src/Dialog/confirm.js +76 -0
  95. package/src/Dialog/dialog.js +162 -0
  96. package/src/Dialog/index.js +2 -0
  97. package/src/DriftBot/index.js +81 -0
  98. package/src/Earth/countries.json +8057 -0
  99. package/src/Earth/index.js +511 -0
  100. package/src/Earth/util.js +69 -0
  101. package/src/Empty/index.js +41 -0
  102. package/src/Footer/index.js +110 -0
  103. package/src/Icon/image.js +55 -0
  104. package/src/Icon/index.js +69 -0
  105. package/src/Img/index.js +172 -0
  106. package/src/InfoRow/index.js +83 -0
  107. package/src/Layout/dashboard/header.js +157 -0
  108. package/src/Layout/dashboard/index.js +150 -0
  109. package/src/Layout/dashboard/sidebar.js +122 -0
  110. package/src/Layout/index.js +318 -0
  111. package/src/Locale/browser-lang.js +63 -0
  112. package/src/Locale/context.js +94 -0
  113. package/src/Locale/images/globe-dark.png +0 -0
  114. package/src/Locale/images/globe-light.png +0 -0
  115. package/src/Locale/selector.js +135 -0
  116. package/src/Logo/images/logo-dark-text.svg +3 -0
  117. package/src/Logo/images/logo-dark-top.svg +6 -0
  118. package/src/Logo/images/logo-light-text.svg +3 -0
  119. package/src/Logo/images/logo-light-top.svg +6 -0
  120. package/src/Logo/index.js +47 -0
  121. package/src/Metric/index.js +115 -0
  122. package/src/NFTDisplay/README.md +59 -0
  123. package/src/NFTDisplay/aspect-ratio-container.js +34 -0
  124. package/src/NFTDisplay/broken.js +18 -0
  125. package/src/NFTDisplay/index.js +257 -0
  126. package/src/NFTDisplay/loading.js +17 -0
  127. package/src/NFTDisplay/svg-embedder/img.js +36 -0
  128. package/src/NFTDisplay/svg-embedder/inline-svg.js +37 -0
  129. package/src/PageScroller/index.js +342 -0
  130. package/src/PageScroller/usePrevValue.js +12 -0
  131. package/src/PricingTable/PricingPlan.js +112 -0
  132. package/src/PricingTable/index.js +43 -0
  133. package/src/Result/common.js +116 -0
  134. package/src/Result/index.js +31 -0
  135. package/src/Result/result.js +57 -0
  136. package/src/Result/translations.js +56 -0
  137. package/src/Screenshot/devices.css +1366 -0
  138. package/src/Screenshot/index.js +181 -0
  139. package/src/Spinner/index.js +19 -0
  140. package/src/SplitButton/index.js +112 -0
  141. package/src/Switch/index.js +78 -0
  142. package/src/Tabs/index.js +46 -0
  143. package/src/Tag/index.js +73 -0
  144. package/src/Terminal/Player.js +364 -0
  145. package/src/Terminal/index.js +150 -0
  146. package/src/Terminal/player.css +378 -0
  147. package/src/Terminal/util.js +167 -0
  148. package/src/Terminal/xterm.css +171 -0
  149. package/src/TextCollapse/index.js +92 -0
  150. package/src/Theme/index.js +184 -0
  151. package/src/Theme/responsiveFontSizes.js +94 -0
  152. package/src/Toast/index.js +118 -0
  153. package/src/Util/index.js +281 -0
  154. package/src/Video/index.js +72 -0
  155. package/src/Wallet/Action.js +105 -0
  156. package/src/Wallet/Download.js +130 -0
  157. package/src/Wallet/Open.js +50 -0
  158. package/src/Wallet/images/abtwallet.png +0 -0
  159. package/src/Wallet/images/android_download.svg +23 -0
  160. package/src/Wallet/images/app-store.svg +20 -0
  161. package/src/Wallet/images/google-play.svg +70 -0
  162. package/src/WechatPrompt/images/android.png +0 -0
  163. package/src/WechatPrompt/images/ios.png +0 -0
  164. package/src/WechatPrompt/index.js +81 -0
  165. package/src/index.js +63 -0
  166. package/src/withTheme/index.js +72 -0
  167. package/src/withTracker/README.md +34 -0
  168. package/src/withTracker/error_boundary.js +34 -0
  169. package/src/withTracker/index.js +70 -0
  170. package/lib/GraphQLPlayground/graphiql.css +0 -1850
  171. package/lib/GraphQLPlayground/index.js +0 -302
  172. package/lib/GraphQLPlayground/util.js +0 -55
@@ -0,0 +1,112 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+
5
+ import Card from '@material-ui/core/Card';
6
+ import Button from '@material-ui/core/Button';
7
+ import CardContent from '@material-ui/core/CardContent';
8
+ import Typography from '@material-ui/core/Typography';
9
+
10
+ const PricingPlan = ({ plan }) => (
11
+ <PlanCard shadow>
12
+ <div className="card-header">
13
+ <div className="title">{plan.name}</div>
14
+ </div>
15
+ <CardContent className="card-content">
16
+ <div className="plan-content">
17
+ <div className="plan-pricing">
18
+ <Typography component="h2" variant="h5" className="price-number">
19
+ {plan.price}
20
+ </Typography>
21
+ </div>
22
+ <div className="plan-services">
23
+ {plan.featureList.map(line => (
24
+ <Typography component="p" variant="body1" align="center" key={line}>
25
+ {line}
26
+ </Typography>
27
+ ))}
28
+ </div>
29
+ </div>
30
+ <div className="plan-actions">
31
+ {plan.showButton && (
32
+ <Button fullWidth variant="outlined" color="primary" component="a" href={plan.buttonLink}>
33
+ {plan.buttonText}
34
+ </Button>
35
+ )}
36
+ </div>
37
+ </CardContent>
38
+ </PlanCard>
39
+ );
40
+
41
+ export default PricingPlan;
42
+
43
+ PricingPlan.propTypes = {
44
+ plan: PropTypes.object.isRequired,
45
+ };
46
+
47
+ const PlanCard = styled(Card)`
48
+ height: 500px;
49
+ display: flex;
50
+ flex-direction: column;
51
+ @media (max-width: 320px) {
52
+ margin-top: 20px;
53
+ }
54
+
55
+ && {
56
+ ${props => (props.shadow ? '' : 'box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.1)')}
57
+ }
58
+
59
+ .card-header {
60
+ height: 80px;
61
+ background-color: #f1fbfb;
62
+ display: flex;
63
+ flex-flow: column;
64
+ align-items: center;
65
+ justify-content: center;
66
+ .title {
67
+ font-size: 18px;
68
+ font-weight: 600;
69
+ text-align: center;
70
+ color: #404040;
71
+ margin: 0;
72
+ }
73
+ }
74
+
75
+ .card-content {
76
+ display: flex;
77
+ flex-direction: column;
78
+ justify-content: space-between;
79
+ align-items: center;
80
+ flex-grow: 1;
81
+ }
82
+
83
+ .plan-content {
84
+ display: flex;
85
+ flex-direction: column;
86
+ flex-grow: 1;
87
+
88
+ .plan-pricing {
89
+ display: flex;
90
+ justify-content: center;
91
+ align-items: baseline;
92
+ margin-bottom: 12px;
93
+ color: #4e6af6;
94
+ text-align: center;
95
+ }
96
+
97
+ .price-number {
98
+ font-size: 30px;
99
+ font-weight: 600;
100
+ color: #4e6af6;
101
+ }
102
+
103
+ .plan-services strong {
104
+ color: #4e6af6;
105
+ font-weight: 500;
106
+ }
107
+ }
108
+
109
+ .plan-actions {
110
+ width: 100%;
111
+ }
112
+ `;
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import Grid from '@material-ui/core/Grid';
5
+
6
+ import PricingPlan from './PricingPlan';
7
+
8
+ const PricingTable = ({ plans }) => {
9
+ if (plans && plans.length > 0) {
10
+ return (
11
+ <Div variant="even">
12
+ <Grid container spacing={2} justify="center">
13
+ {plans.map(x => (
14
+ <Grid item className="plan-item" key={x.id} xs={12} sm={6} md={3}>
15
+ <PricingPlan plan={x} />
16
+ </Grid>
17
+ ))}
18
+ </Grid>
19
+ </Div>
20
+ );
21
+ }
22
+ return null;
23
+ };
24
+
25
+ export default PricingTable;
26
+
27
+ PricingTable.propTypes = {
28
+ plans: PropTypes.array.isRequired,
29
+ };
30
+
31
+ const Div = styled.div`
32
+ padding: 100px 0;
33
+ text-align: center;
34
+ background-color: ${props => (props.variant === 'even' ? '#fbfbfb' : '#ffffff')};
35
+ @media (max-width: 320px) {
36
+ padding: 50px 0;
37
+ }
38
+ .plan-item {
39
+ @media (max-width: 320px) {
40
+ margin-bottom: 30px;
41
+ }
42
+ }
43
+ `;
@@ -0,0 +1,116 @@
1
+ /* eslint-disable react/prop-types */
2
+ /* eslint-disable no-param-reassign */
3
+ import React from 'react';
4
+ import useTheme from '@material-ui/core/styles/useTheme';
5
+ import InfoIcon from '@material-ui/icons/Info';
6
+ import CancelRoundedIcon from '@material-ui/icons/CancelRounded';
7
+ import Result from './result';
8
+ import translations from './translations';
9
+ import { useLocaleContext } from '../Locale/context';
10
+
11
+ // 优先使用显式指定的 locale, 再尝试使用 context 中的 locale, 最后使用默认 'en'
12
+ const useLocale = locale => {
13
+ locale = ['zh', 'en'].includes(locale) ? locale : '';
14
+ const { locale: localeFromContext } = useLocaleContext() || { locale: 'en' };
15
+ return locale || localeFromContext;
16
+ };
17
+
18
+ // 404
19
+ export const PageNotFound = ({ locale, ...rest }) => {
20
+ locale = useLocale(locale);
21
+ return (
22
+ <Result
23
+ icon={<StyledErrorIcon />}
24
+ title={translations[locale][404].title}
25
+ description={translations[locale][404].description}
26
+ {...rest}
27
+ />
28
+ );
29
+ };
30
+ PageNotFound.status = '404';
31
+
32
+ // 403
33
+ export const Forbidden = ({ locale, ...rest }) => {
34
+ locale = useLocale(locale);
35
+ return (
36
+ <Result
37
+ icon={<StyledErrorIcon />}
38
+ title={translations[locale][403].title}
39
+ description={translations[locale][403].description}
40
+ {...rest}
41
+ />
42
+ );
43
+ };
44
+ Forbidden.status = '403';
45
+
46
+ // 500
47
+ export const InternalServerError = ({ locale, ...rest }) => {
48
+ locale = useLocale(locale);
49
+ return (
50
+ <Result
51
+ icon={<StyledErrorIcon />}
52
+ title={translations[locale][500].title}
53
+ description={translations[locale][500].description}
54
+ {...rest}
55
+ />
56
+ );
57
+ };
58
+ InternalServerError.status = '500';
59
+
60
+ // 通用错误
61
+ export const Error = ({ locale, ...rest }) => {
62
+ locale = useLocale(locale);
63
+ return (
64
+ <Result
65
+ icon={<StyledErrorIcon />}
66
+ title={translations[locale].error.title}
67
+ description={translations[locale].error.description}
68
+ {...rest}
69
+ />
70
+ );
71
+ };
72
+ Error.status = 'error';
73
+
74
+ // under maintenance
75
+ export const Maintenance = ({ locale, ...rest }) => {
76
+ locale = useLocale(locale);
77
+ return (
78
+ <Result
79
+ icon={<StyledInfoIcon />}
80
+ title={translations[locale].maintenance.title}
81
+ description={translations[locale].maintenance.description}
82
+ {...rest}
83
+ />
84
+ );
85
+ };
86
+ Maintenance.status = 'maintenance';
87
+
88
+ // coming soon
89
+ export const ComingSoon = ({ locale, ...rest }) => {
90
+ locale = useLocale(locale);
91
+ return (
92
+ <Result
93
+ icon={<StyledInfoIcon />}
94
+ title={translations[locale]['coming-soon'].title}
95
+ description={translations[locale]['coming-soon'].description}
96
+ {...rest}
97
+ />
98
+ );
99
+ };
100
+ ComingSoon.status = 'coming-soon';
101
+
102
+ // info, 与其它 status 不同, title/description 需要使用方自己传入
103
+ export const Info = props => {
104
+ return <Result icon={<StyledInfoIcon />} {...props} />;
105
+ };
106
+ Info.status = 'info';
107
+
108
+ const StyledErrorIcon = props => {
109
+ const theme = useTheme();
110
+ return <CancelRoundedIcon style={{ color: theme.palette.error.main, fontSize: 72 }} {...props} />;
111
+ };
112
+
113
+ const StyledInfoIcon = props => {
114
+ const theme = useTheme();
115
+ return <InfoIcon style={{ color: theme.palette.info.main, fontSize: 72 }} {...props} />;
116
+ };
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Result from './result';
4
+ import * as common from './common';
5
+
6
+ const componentsKeyByStatus = Object.keys(common).reduce(
7
+ (acc, cur) => ({ ...acc, [common[cur].status || cur]: common[cur] }),
8
+ {}
9
+ );
10
+
11
+ export default function ResultWrapper({ status, ...rest }) {
12
+ if (status) {
13
+ if (componentsKeyByStatus[status]) {
14
+ const Component = componentsKeyByStatus[status];
15
+ return <Component {...rest} />;
16
+ }
17
+ throw new Error(
18
+ `Please provide a valid status for Result.status. Valid values are: ${Object.keys(
19
+ componentsKeyByStatus
20
+ ).join(', ')}`
21
+ );
22
+ }
23
+ return <Result {...rest} />;
24
+ }
25
+
26
+ ResultWrapper.propTypes = {
27
+ status: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
28
+ };
29
+ ResultWrapper.defaultProps = {
30
+ status: '',
31
+ };
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import Box from '@material-ui/core/Box';
5
+
6
+ function Result({ icon, title, description, extra, ...rest }) {
7
+ return (
8
+ <Root {...rest}>
9
+ {icon}
10
+ {typeof title === 'string' ? (
11
+ <Box mt={3} fontSize={22} fontWeight={400} color="#47494E" textAlign="center">
12
+ {title}
13
+ </Box>
14
+ ) : (
15
+ title
16
+ )}
17
+
18
+ {typeof description === 'string' ? (
19
+ <Box mt={1} fontSize={14} color="#7F828B" textAlign="center">
20
+ {description}
21
+ </Box>
22
+ ) : (
23
+ description
24
+ )}
25
+
26
+ <Box mt={3}>{extra}</Box>
27
+ </Root>
28
+ );
29
+ }
30
+
31
+ Result.propTypes = {
32
+ icon: PropTypes.any,
33
+ title: PropTypes.any.isRequired,
34
+ description: PropTypes.any,
35
+ actions: PropTypes.any,
36
+ extra: PropTypes.any,
37
+ };
38
+ Result.defaultProps = {
39
+ icon: '',
40
+ description: '',
41
+ actions: null,
42
+ extra: null,
43
+ };
44
+
45
+ const Root = styled.div`
46
+ box-sizing: border-box;
47
+ display: flex;
48
+ flex-direction: column;
49
+ justify-content: center;
50
+ align-items: center;
51
+ height: 100%;
52
+ padding: 16px;
53
+
54
+ background-color: #f7f8fb;
55
+ `;
56
+
57
+ export default Result;
@@ -0,0 +1,56 @@
1
+ export default {
2
+ en: {
3
+ 404: {
4
+ title: '404 - Page Not Found',
5
+ description:
6
+ 'Sorry about that, the page you are looking for does not exist or has been moved.',
7
+ },
8
+ 403: {
9
+ title: '403 – Forbidden',
10
+ description: 'Sorry, you are not authorized to access this page.',
11
+ },
12
+ 500: {
13
+ title: '500 - Internal Server Error',
14
+ description: 'An internal server error has occured. Please try again later.',
15
+ },
16
+ error: {
17
+ title: 'Application Error',
18
+ description: 'Something went wrong. Please try again later.',
19
+ },
20
+ maintenance: {
21
+ title: 'Offline for maintenance',
22
+ description: 'This app is undergoing maintenance right now. Please check back later.',
23
+ },
24
+ 'coming-soon': {
25
+ title: 'Coming Soon',
26
+ description: "Our website is under construction. We'll be here soon with our new website.",
27
+ },
28
+ },
29
+
30
+ zh: {
31
+ 404: {
32
+ title: '404 - 页面未找到',
33
+ description: '很抱歉,您正在寻找的页面不存在或已被移动。',
34
+ },
35
+ 403: {
36
+ title: '403 – 禁止访问',
37
+ description: '很抱歉,您没有权限访问此页面。',
38
+ },
39
+ 500: {
40
+ title: '500 - 内部服务器错误',
41
+ description: '发生了一个内部服务器错误。请稍后再试。',
42
+ },
43
+ error: {
44
+ title: 'Application Error',
45
+ description: '出错了, 请稍后再试。',
46
+ },
47
+ maintenance: {
48
+ title: '维护中',
49
+ description: '应用程序正在进行维护。请稍后再查看。',
50
+ },
51
+ 'coming-soon': {
52
+ title: '即将上线',
53
+ description: '我们的网站正在建设中。我们很快就会在这里推出我们的新网站。',
54
+ },
55
+ },
56
+ };