@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.
- package/LICENSE +1 -1
- package/README.md +0 -56
- package/lib/ActionButton/index.js +6 -4
- package/lib/ActivityIndicator/index.js +75 -23
- package/lib/Alert/index.js +15 -11
- package/lib/Async/index.js +1 -1
- package/lib/Badge/index.js +17 -15
- package/lib/Blocklet/index.js +261 -0
- package/lib/Button/wrap.js +96 -43
- package/lib/ButtonGroup/index.js +3 -16
- package/lib/Center/index.js +30 -4
- package/lib/ClickToCopy/index.js +10 -8
- package/lib/CodeBlock/index.js +40 -13
- package/lib/Colors/index.js +15 -0
- package/lib/Colors/themes/default.js +85 -0
- package/lib/ContactForm/index.js +9 -10
- package/lib/CookieConsent/index.js +98 -0
- package/lib/CountDown/index.js +18 -14
- package/lib/Dialog/confirm.js +84 -0
- package/lib/Dialog/dialog.js +137 -0
- package/lib/Dialog/index.js +23 -0
- package/lib/Earth/index.js +33 -33
- package/lib/Empty/index.js +61 -0
- package/lib/Footer/index.js +16 -18
- package/lib/Icon/image.js +10 -13
- package/lib/Icon/index.js +10 -8
- package/lib/Img/index.js +212 -0
- package/lib/InfoRow/index.js +7 -6
- package/lib/Layout/dashboard/header.js +60 -42
- package/lib/Layout/dashboard/index.js +72 -60
- package/lib/Layout/dashboard/sidebar.js +41 -25
- package/lib/Layout/index.js +113 -51
- package/lib/Locale/browser-lang.js +0 -2
- package/lib/Locale/context.js +85 -61
- package/lib/Locale/selector.js +33 -20
- package/lib/Logo/index.js +15 -13
- package/lib/Metric/index.js +5 -6
- package/lib/NFTDisplay/README.md +59 -0
- package/lib/NFTDisplay/aspect-ratio-container.js +52 -0
- package/lib/NFTDisplay/broken.js +25 -0
- package/lib/NFTDisplay/index.js +317 -0
- package/lib/NFTDisplay/loading.js +23 -0
- package/lib/NFTDisplay/svg-embedder/img.js +68 -0
- package/lib/NFTDisplay/svg-embedder/inline-svg.js +54 -0
- package/lib/PageScroller/index.js +10 -11
- package/lib/PageScroller/usePrevValue.js +2 -2
- package/lib/PricingTable/PricingPlan.js +12 -15
- package/lib/PricingTable/index.js +5 -5
- package/lib/Result/common.js +176 -0
- package/lib/Result/index.js +61 -0
- package/lib/Result/result.js +69 -0
- package/lib/Result/translations.js +61 -0
- package/lib/Screenshot/index.js +14 -13
- package/lib/Spinner/index.js +37 -0
- package/lib/SplitButton/index.js +126 -0
- package/lib/Switch/index.js +107 -0
- package/lib/Tabs/index.js +24 -47
- package/lib/Tag/index.js +15 -13
- package/lib/Terminal/Player.js +43 -45
- package/lib/Terminal/index.js +3 -1
- package/lib/Terminal/util.js +2 -3
- package/lib/TextCollapse/index.js +21 -14
- package/lib/Theme/index.js +79 -63
- package/lib/Theme/responsiveFontSizes.js +8 -8
- package/lib/Toast/index.js +12 -11
- package/lib/Util/index.js +197 -26
- package/lib/Video/index.js +8 -11
- package/lib/Wallet/Action.js +15 -13
- package/lib/Wallet/Download.js +60 -58
- package/lib/Wallet/Open.js +2 -2
- package/lib/WechatPrompt/index.js +10 -10
- package/lib/index.js +6 -6
- package/lib/withTheme/index.js +5 -17
- package/lib/withTracker/error_boundary.js +3 -3
- package/lib/withTracker/index.js +6 -7
- package/package.json +22 -17
- package/src/ActionButton/index.js +65 -0
- package/src/ActivityIndicator/index.js +141 -0
- package/src/Alert/index.js +104 -0
- package/src/Async/index.js +39 -0
- package/src/Badge/index.js +71 -0
- package/src/Blocklet/index.js +424 -0
- package/src/Button/index.js +4 -0
- package/src/Button/wrap.js +101 -0
- package/src/ButtonGroup/index.js +6 -0
- package/src/Center/index.js +40 -0
- package/src/ClickToCopy/index.js +90 -0
- package/src/CodeBlock/index.js +160 -0
- package/src/Colors/index.js +1 -0
- package/src/Colors/themes/default.js +54 -0
- package/src/ContactForm/index.js +240 -0
- package/src/CookieConsent/index.js +90 -0
- package/src/CountDown/index.js +151 -0
- package/src/Dialog/confirm.js +76 -0
- package/src/Dialog/dialog.js +162 -0
- package/src/Dialog/index.js +2 -0
- package/src/DriftBot/index.js +81 -0
- package/src/Earth/countries.json +8057 -0
- package/src/Earth/index.js +511 -0
- package/src/Earth/util.js +69 -0
- package/src/Empty/index.js +41 -0
- package/src/Footer/index.js +110 -0
- package/src/Icon/image.js +55 -0
- package/src/Icon/index.js +69 -0
- package/src/Img/index.js +172 -0
- package/src/InfoRow/index.js +83 -0
- package/src/Layout/dashboard/header.js +157 -0
- package/src/Layout/dashboard/index.js +150 -0
- package/src/Layout/dashboard/sidebar.js +122 -0
- package/src/Layout/index.js +318 -0
- package/src/Locale/browser-lang.js +63 -0
- package/src/Locale/context.js +94 -0
- package/src/Locale/images/globe-dark.png +0 -0
- package/src/Locale/images/globe-light.png +0 -0
- package/src/Locale/selector.js +135 -0
- package/src/Logo/images/logo-dark-text.svg +3 -0
- package/src/Logo/images/logo-dark-top.svg +6 -0
- package/src/Logo/images/logo-light-text.svg +3 -0
- package/src/Logo/images/logo-light-top.svg +6 -0
- package/src/Logo/index.js +47 -0
- package/src/Metric/index.js +115 -0
- package/src/NFTDisplay/README.md +59 -0
- package/src/NFTDisplay/aspect-ratio-container.js +34 -0
- package/src/NFTDisplay/broken.js +18 -0
- package/src/NFTDisplay/index.js +257 -0
- package/src/NFTDisplay/loading.js +17 -0
- package/src/NFTDisplay/svg-embedder/img.js +36 -0
- package/src/NFTDisplay/svg-embedder/inline-svg.js +37 -0
- package/src/PageScroller/index.js +342 -0
- package/src/PageScroller/usePrevValue.js +12 -0
- package/src/PricingTable/PricingPlan.js +112 -0
- package/src/PricingTable/index.js +43 -0
- package/src/Result/common.js +116 -0
- package/src/Result/index.js +31 -0
- package/src/Result/result.js +57 -0
- package/src/Result/translations.js +56 -0
- package/src/Screenshot/devices.css +1366 -0
- package/src/Screenshot/index.js +181 -0
- package/src/Spinner/index.js +19 -0
- package/src/SplitButton/index.js +112 -0
- package/src/Switch/index.js +78 -0
- package/src/Tabs/index.js +46 -0
- package/src/Tag/index.js +73 -0
- package/src/Terminal/Player.js +364 -0
- package/src/Terminal/index.js +150 -0
- package/src/Terminal/player.css +378 -0
- package/src/Terminal/util.js +167 -0
- package/src/Terminal/xterm.css +171 -0
- package/src/TextCollapse/index.js +92 -0
- package/src/Theme/index.js +184 -0
- package/src/Theme/responsiveFontSizes.js +94 -0
- package/src/Toast/index.js +118 -0
- package/src/Util/index.js +281 -0
- package/src/Video/index.js +72 -0
- package/src/Wallet/Action.js +105 -0
- package/src/Wallet/Download.js +130 -0
- package/src/Wallet/Open.js +50 -0
- package/src/Wallet/images/abtwallet.png +0 -0
- package/src/Wallet/images/android_download.svg +23 -0
- package/src/Wallet/images/app-store.svg +20 -0
- package/src/Wallet/images/google-play.svg +70 -0
- package/src/WechatPrompt/images/android.png +0 -0
- package/src/WechatPrompt/images/ios.png +0 -0
- package/src/WechatPrompt/index.js +81 -0
- package/src/index.js +63 -0
- package/src/withTheme/index.js +72 -0
- package/src/withTracker/README.md +34 -0
- package/src/withTracker/error_boundary.js +34 -0
- package/src/withTracker/index.js +70 -0
- package/lib/GraphQLPlayground/graphiql.css +0 -1850
- package/lib/GraphQLPlayground/index.js +0 -302
- package/lib/GraphQLPlayground/util.js +0 -55
package/lib/withTracker/index.js
CHANGED
|
@@ -19,19 +19,18 @@ var _error_boundary = _interopRequireDefault(require("./error_boundary"));
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
23
|
|
|
24
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
25
|
|
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
27
|
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
29
|
|
|
30
30
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
31
|
|
|
32
32
|
var _default = function _default(WrappedComponent) {
|
|
33
33
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
34
|
-
// eslint-disable-next-line object-curly-newline
|
|
35
34
|
const {
|
|
36
35
|
appVersion,
|
|
37
36
|
gaAccount,
|
|
@@ -81,10 +80,10 @@ var _default = function _default(WrappedComponent) {
|
|
|
81
80
|
|
|
82
81
|
render() {
|
|
83
82
|
if (process.env.NODE_ENV === 'production') {
|
|
84
|
-
return _react.default.createElement(_error_boundary.default, null, _react.default.createElement(WrappedComponent, this.props));
|
|
83
|
+
return /*#__PURE__*/_react.default.createElement(_error_boundary.default, null, /*#__PURE__*/_react.default.createElement(WrappedComponent, this.props));
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
return _react.default.createElement(WrappedComponent, this.props);
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement(WrappedComponent, this.props);
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.6.59",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"main": "lib/index.js",
|
|
14
14
|
"files": [
|
|
15
|
-
"lib"
|
|
15
|
+
"lib",
|
|
16
|
+
"src"
|
|
16
17
|
],
|
|
17
18
|
"repository": {
|
|
18
19
|
"type": "git",
|
|
@@ -42,38 +43,42 @@
|
|
|
42
43
|
"@babel/preset-react": "^7.8.3",
|
|
43
44
|
"babel-plugin-inline-react-svg": "^1.1.1",
|
|
44
45
|
"babel-plugin-styled-components": "^1.10.7",
|
|
46
|
+
"dayjs": "^1.10.6",
|
|
45
47
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
46
|
-
"jest": "^24.1.0"
|
|
48
|
+
"jest": "^24.1.0",
|
|
49
|
+
"moment-timezone": "^0.5.33"
|
|
47
50
|
},
|
|
48
51
|
"peerDependencies": {
|
|
49
52
|
"@sentry/browser": "^5.0.8",
|
|
50
53
|
"react": ">=16.12.0",
|
|
51
54
|
"react-ga": "^2.7.0"
|
|
52
55
|
},
|
|
53
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "0cafb36ee900f1f8f90790d77d88bd23624c30fd",
|
|
54
57
|
"dependencies": {
|
|
55
|
-
"@arcblock/
|
|
58
|
+
"@arcblock/icons": "^1.6.59",
|
|
59
|
+
"@arcblock/react-hooks": "^1.6.59",
|
|
56
60
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
57
|
-
"@
|
|
58
|
-
"@material-ui/
|
|
59
|
-
"
|
|
61
|
+
"@fontsource/lato": "^4.5.3",
|
|
62
|
+
"@material-ui/core": "^4.12.3",
|
|
63
|
+
"@material-ui/icons": "4.11.2",
|
|
64
|
+
"axios": "^0.21.1",
|
|
65
|
+
"base64-url": "^2.3.3",
|
|
60
66
|
"copy-to-clipboard": "^3.2.0",
|
|
61
67
|
"core-js": "^3.6.4",
|
|
62
68
|
"d3-geo": "^1.11.6",
|
|
63
69
|
"devices.css": "^0.1.15",
|
|
64
|
-
"graphiql": "^0.13.2",
|
|
65
|
-
"graphiql-code-exporter": "^2.0.5",
|
|
66
|
-
"graphiql-explorer": "^0.4.3",
|
|
67
|
-
"graphql": "^14.6.0",
|
|
68
70
|
"highlight.js": "^9.15.8",
|
|
71
|
+
"is-svg": "^4.3.1",
|
|
69
72
|
"js-cookie": "^2.2.0",
|
|
70
|
-
"lodash": "^4.17.
|
|
71
|
-
"
|
|
72
|
-
"react-
|
|
73
|
-
"react-
|
|
73
|
+
"lodash": "^4.17.21",
|
|
74
|
+
"mdi-material-ui": "^6.22.1",
|
|
75
|
+
"react-cookie-consent": "^6.4.1",
|
|
76
|
+
"react-helmet": "^6.1.0",
|
|
77
|
+
"react-intersection-observer": "^8.31.1",
|
|
74
78
|
"react-player": "^1.15.2",
|
|
75
79
|
"react-router-dom": "^5.1.2",
|
|
76
|
-
"react-
|
|
80
|
+
"react-shadow": "^19.0.2",
|
|
81
|
+
"react-use": "^17.2.4",
|
|
77
82
|
"rebound": "^0.1.0",
|
|
78
83
|
"styled-components": "^5.0.0",
|
|
79
84
|
"topojson-client": "^3.0.0",
|
|
@@ -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
|
+
`;
|