@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/Theme/index.js
CHANGED
|
@@ -3,88 +3,83 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.create =
|
|
6
|
+
exports.create = void 0;
|
|
7
7
|
|
|
8
8
|
var _styles = require("@material-ui/core/styles");
|
|
9
9
|
|
|
10
|
+
require("@fontsource/lato/400.css");
|
|
11
|
+
|
|
12
|
+
require("@fontsource/lato/700.css");
|
|
13
|
+
|
|
10
14
|
var _responsiveFontSizes = _interopRequireDefault(require("./responsiveFontSizes"));
|
|
11
15
|
|
|
16
|
+
var _Colors = _interopRequireDefault(require("../Colors"));
|
|
17
|
+
|
|
18
|
+
const _excluded = ["mode", "pageWidth", "palette", "typography", "overrides"];
|
|
19
|
+
|
|
12
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// https://app.zeplin.io/styleguide/5d1436f1e97c2156f49c0725/colors
|
|
18
|
-
const colors = {
|
|
19
|
-
white: '#FFFFFF',
|
|
20
|
-
dark: '#4A707C',
|
|
21
|
-
gray: '#222222',
|
|
22
|
-
minor: '#9B9B9B',
|
|
23
|
-
darkText: '#DCDCDC',
|
|
24
|
-
background: '#F7F8F8',
|
|
25
|
-
yellow: '#FFCF71',
|
|
26
|
-
green: '#44cdc6',
|
|
27
|
-
red: '#D0021B',
|
|
28
|
-
blue: '#4E6AF6',
|
|
29
|
-
primary: '#222222',
|
|
30
|
-
black: '#222222',
|
|
31
|
-
secondary: '#44cdc6',
|
|
32
|
-
mint: '#44cdc6',
|
|
33
|
-
textSecondary: '#4A4A4A',
|
|
34
|
-
active: '#5b9025',
|
|
35
|
-
danger: '#D0021B',
|
|
36
|
-
lightGrey: '#BCBCBC'
|
|
37
|
-
}; // https://material-ui.com/customization/default-theme/
|
|
38
|
-
|
|
39
|
-
exports.colors = colors;
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
40
25
|
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
29
|
+
|
|
30
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
31
|
+
|
|
32
|
+
// https://material-ui.com/customization/default-theme/
|
|
33
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
41
34
|
const create = function create() {
|
|
42
|
-
let {
|
|
35
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
36
|
+
{
|
|
43
37
|
mode = 'light',
|
|
44
38
|
pageWidth = 'md',
|
|
45
39
|
palette,
|
|
46
40
|
typography,
|
|
47
41
|
overrides
|
|
48
|
-
} =
|
|
49
|
-
|
|
42
|
+
} = _ref,
|
|
43
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
+
|
|
45
|
+
const theme = (0, _styles.createTheme)(_objectSpread({
|
|
50
46
|
themeName: 'ArcBlock',
|
|
51
|
-
palette: Object.assign({
|
|
52
|
-
primary: {
|
|
53
|
-
main: colors.blue,
|
|
54
|
-
contrastText: colors.white
|
|
55
|
-
},
|
|
56
|
-
secondary: {
|
|
57
|
-
main: colors.mint,
|
|
58
|
-
contrastText: colors.white
|
|
59
|
-
},
|
|
60
|
-
danger: {
|
|
61
|
-
main: colors.danger,
|
|
62
|
-
contrastText: colors.white
|
|
63
|
-
},
|
|
64
|
-
text: {
|
|
65
|
-
primary: '#404040',
|
|
66
|
-
contrast: colors.white
|
|
67
|
-
},
|
|
47
|
+
palette: Object.assign(_objectSpread(_objectSpread({}, _Colors.default), {}, {
|
|
68
48
|
background: {
|
|
69
|
-
paper: mode === 'light' ?
|
|
70
|
-
default: mode === 'light' ?
|
|
49
|
+
paper: mode === 'light' ? _Colors.default.common.white : _Colors.default.grey[900],
|
|
50
|
+
default: mode === 'light' ? _Colors.default.background.default : _Colors.default.grey[900]
|
|
71
51
|
},
|
|
72
52
|
type: mode
|
|
73
|
-
}, palette || {}),
|
|
53
|
+
}), palette || {}),
|
|
74
54
|
typography: Object.assign({
|
|
75
55
|
useNextVariants: true,
|
|
76
56
|
color: {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
57
|
+
// 此处 #222222 必须硬编码, layout/sidebar.js -> Icon/image 加载图片时 color 会影响加载路径
|
|
58
|
+
// TODO: 此处硬编码的色值后面需要改为 colors.grey[900],
|
|
59
|
+
// 或者如果可以的话直接删掉 typography#color, 文本颜色建议使用 theme.palette.text 中的色值?
|
|
60
|
+
// layout 组件建议重构, sidebar 中建议使用 icon 替换 img (#366)
|
|
61
|
+
main: mode === 'light' ? '#222222' : _Colors.default.common.white,
|
|
62
|
+
gray: mode === 'light' ? _Colors.default.grey[500] : _Colors.default.grey[300]
|
|
80
63
|
},
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
fontFamily: ['Lato', 'Avenir', '-apple-system', 'BlinkMacSystemFont', '"Segoe UI"', 'Roboto', '"Helvetica Neue"', 'Arial', 'sans-serif', '"Apple Color Emoji"', '"Segoe UI Emoji"', '"Segoe UI Symbol"'].join(','),
|
|
65
|
+
// 按最新设计规范, 只使用 400/700
|
|
66
|
+
fontWeightLight: 400,
|
|
67
|
+
fontWeightRegular: 400,
|
|
68
|
+
fontWeightMedium: 700,
|
|
69
|
+
fontWeightBold: 700,
|
|
70
|
+
// button 默认使用粗体
|
|
71
|
+
button: {
|
|
72
|
+
fontWeight: 700
|
|
73
|
+
}
|
|
83
74
|
}, typography || {}),
|
|
84
75
|
overrides: Object.assign({
|
|
85
76
|
MuiButton: {
|
|
86
77
|
root: {
|
|
87
|
-
|
|
78
|
+
boxShadow: 'none'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
MuiButtonGroup: {
|
|
82
|
+
contained: {
|
|
88
83
|
boxShadow: 'none'
|
|
89
84
|
}
|
|
90
85
|
},
|
|
@@ -95,7 +90,7 @@ const create = function create() {
|
|
|
95
90
|
},
|
|
96
91
|
MuiToolbar: {
|
|
97
92
|
root: {
|
|
98
|
-
background: mode === 'light' ?
|
|
93
|
+
background: mode === 'light' ? _Colors.default.background.default : _Colors.default.grey[900]
|
|
99
94
|
}
|
|
100
95
|
},
|
|
101
96
|
MuiTableCell: {
|
|
@@ -108,10 +103,10 @@ const create = function create() {
|
|
|
108
103
|
},
|
|
109
104
|
head: {
|
|
110
105
|
textTransform: 'uppercase',
|
|
111
|
-
color: mode === 'light' ?
|
|
106
|
+
color: mode === 'light' ? _Colors.default.grey[900] : _Colors.default.grey[300]
|
|
112
107
|
},
|
|
113
108
|
body: {
|
|
114
|
-
color: mode === 'light' ?
|
|
109
|
+
color: mode === 'light' ? _Colors.default.grey[900] : _Colors.default.grey[300]
|
|
115
110
|
}
|
|
116
111
|
},
|
|
117
112
|
MuiChip: {
|
|
@@ -134,17 +129,38 @@ const create = function create() {
|
|
|
134
129
|
},
|
|
135
130
|
MuiTypography: {
|
|
136
131
|
body1: {
|
|
137
|
-
color: mode === 'light' ?
|
|
132
|
+
color: mode === 'light' ? _Colors.default.grey[900] : _Colors.default.grey[300]
|
|
138
133
|
},
|
|
139
134
|
body2: {
|
|
140
|
-
color: mode === 'light' ?
|
|
135
|
+
color: mode === 'light' ? _Colors.default.grey[900] : _Colors.default.grey[300]
|
|
141
136
|
}
|
|
142
137
|
}
|
|
143
138
|
}, overrides || {}),
|
|
144
139
|
pageWidth,
|
|
145
|
-
colors,
|
|
140
|
+
// TODO: 过时的 colors, 需要各项目负责人检查项目中是否使用 "theme.colors", 如果有需要清除,
|
|
141
|
+
// 可以从 Colors 模块/theme.palette/mui colors 中取值
|
|
142
|
+
colors: {
|
|
143
|
+
white: '#FFFFFF',
|
|
144
|
+
dark: '#4A707C',
|
|
145
|
+
gray: '#222222',
|
|
146
|
+
minor: '#9B9B9B',
|
|
147
|
+
darkText: '#DCDCDC',
|
|
148
|
+
background: '#F7F8F8',
|
|
149
|
+
yellow: '#FFCF71',
|
|
150
|
+
green: '#44cdc6',
|
|
151
|
+
red: '#D0021B',
|
|
152
|
+
blue: '#4E6AF6',
|
|
153
|
+
primary: '#222222',
|
|
154
|
+
black: '#222222',
|
|
155
|
+
secondary: '#44cdc6',
|
|
156
|
+
mint: '#44cdc6',
|
|
157
|
+
textSecondary: '#4A4A4A',
|
|
158
|
+
active: '#5b9025',
|
|
159
|
+
danger: '#D0021B',
|
|
160
|
+
lightGrey: '#BCBCBC'
|
|
161
|
+
},
|
|
146
162
|
mode
|
|
147
|
-
});
|
|
163
|
+
}, rest));
|
|
148
164
|
const enhanced = (0, _responsiveFontSizes.default)(theme, {
|
|
149
165
|
breakpoints: ['xs', 'sm', 'md', 'lg'],
|
|
150
166
|
disableAlign: false,
|
|
@@ -7,9 +7,9 @@ exports.default = responsiveFontSizes;
|
|
|
7
7
|
|
|
8
8
|
var _cssUtils = require("@material-ui/core/styles/cssUtils");
|
|
9
9
|
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
10
|
+
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; }
|
|
11
11
|
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
12
|
+
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; }
|
|
13
13
|
|
|
14
14
|
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; }
|
|
15
15
|
|
|
@@ -26,9 +26,10 @@ function responsiveFontSizes(themeInput) {
|
|
|
26
26
|
|
|
27
27
|
const theme = _objectSpread({}, themeInput);
|
|
28
28
|
|
|
29
|
-
theme.typography = _objectSpread({}, theme.typography);
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
theme.typography = _objectSpread({}, theme.typography);
|
|
30
|
+
const {
|
|
31
|
+
typography
|
|
32
|
+
} = theme; // Convert between css lengths e.g. em->px or px->rem
|
|
32
33
|
// Set the baseFontSize for your project. Defaults to 16px (also the browser default).
|
|
33
34
|
|
|
34
35
|
const convert = (0, _cssUtils.convertLength)(typography.htmlFontSize);
|
|
@@ -59,8 +60,7 @@ function responsiveFontSizes(themeInput) {
|
|
|
59
60
|
let transform = null;
|
|
60
61
|
|
|
61
62
|
if (!disableAlign) {
|
|
62
|
-
transform = value =>
|
|
63
|
-
(0, _cssUtils.alignProperty)({
|
|
63
|
+
transform = value => (0, _cssUtils.alignProperty)({
|
|
64
64
|
size: value,
|
|
65
65
|
grid: (0, _cssUtils.fontGrid)({
|
|
66
66
|
pixels: 4,
|
|
@@ -70,7 +70,7 @@ function responsiveFontSizes(themeInput) {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
typography[variant] = _objectSpread({}, style,
|
|
73
|
+
typography[variant] = _objectSpread(_objectSpread({}, style), (0, _cssUtils.responsiveProperty)({
|
|
74
74
|
cssProperty: 'fontSize',
|
|
75
75
|
min: minFontSize,
|
|
76
76
|
max: maxFontSize,
|
package/lib/Toast/index.js
CHANGED
|
@@ -29,6 +29,8 @@ var _colors = require("@material-ui/core/colors");
|
|
|
29
29
|
|
|
30
30
|
var _styles = require("@material-ui/core/styles");
|
|
31
31
|
|
|
32
|
+
const _excluded = ["className", "message", "onClose", "variant"];
|
|
33
|
+
|
|
32
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
35
|
|
|
34
36
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
@@ -68,7 +70,7 @@ const useStyles1 = (0, _styles.makeStyles)(theme => ({
|
|
|
68
70
|
}));
|
|
69
71
|
|
|
70
72
|
function SnackbarContentWrapper(props) {
|
|
71
|
-
const classes = useStyles1();
|
|
73
|
+
const classes = useStyles1();
|
|
72
74
|
|
|
73
75
|
const {
|
|
74
76
|
className,
|
|
@@ -76,24 +78,23 @@ function SnackbarContentWrapper(props) {
|
|
|
76
78
|
onClose,
|
|
77
79
|
variant
|
|
78
80
|
} = props,
|
|
79
|
-
rest = _objectWithoutProperties(props,
|
|
81
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
80
82
|
|
|
81
83
|
const Icon = variantIcon[variant];
|
|
82
|
-
return _react.default.createElement(_SnackbarContent.default, Object.assign({
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement(_SnackbarContent.default, Object.assign({
|
|
83
85
|
className: [classes[variant], className].join(' ').trim(),
|
|
84
|
-
message:
|
|
85
|
-
_react.default.createElement("span", {
|
|
86
|
+
message: /*#__PURE__*/_react.default.createElement("span", {
|
|
86
87
|
id: "client-snackbar",
|
|
87
88
|
className: classes.message
|
|
88
|
-
}, _react.default.createElement(Icon, {
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(Icon, {
|
|
89
90
|
className: [classes.icon, classes.iconVariant].join(' ').trim()
|
|
90
91
|
}), message),
|
|
91
|
-
action: [_react.default.createElement(_IconButton.default, {
|
|
92
|
+
action: [/*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
92
93
|
key: "close",
|
|
93
94
|
"aria-label": "close",
|
|
94
95
|
color: "inherit",
|
|
95
96
|
onClick: onClose
|
|
96
|
-
}, _react.default.createElement(_Close.default, {
|
|
97
|
+
}, /*#__PURE__*/_react.default.createElement(_Close.default, {
|
|
97
98
|
className: classes.icon
|
|
98
99
|
}))]
|
|
99
100
|
}, rest));
|
|
@@ -108,7 +109,7 @@ SnackbarContentWrapper.propTypes = {
|
|
|
108
109
|
SnackbarContentWrapper.defaultProps = {
|
|
109
110
|
className: '',
|
|
110
111
|
variant: 'success'
|
|
111
|
-
};
|
|
112
|
+
};
|
|
112
113
|
|
|
113
114
|
function Toast(_ref) {
|
|
114
115
|
let {
|
|
@@ -129,7 +130,7 @@ function Toast(_ref) {
|
|
|
129
130
|
onClose();
|
|
130
131
|
};
|
|
131
132
|
|
|
132
|
-
return _react.default.createElement(_Snackbar.default, {
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement(_Snackbar.default, {
|
|
133
134
|
open: open,
|
|
134
135
|
anchorOrigin: {
|
|
135
136
|
vertical: 'top',
|
|
@@ -137,7 +138,7 @@ function Toast(_ref) {
|
|
|
137
138
|
},
|
|
138
139
|
autoHideDuration: duration,
|
|
139
140
|
onClose: handleClose
|
|
140
|
-
}, _react.default.createElement(SnackbarContentWrapper, {
|
|
141
|
+
}, /*#__PURE__*/_react.default.createElement(SnackbarContentWrapper, {
|
|
141
142
|
onClose: handleClose,
|
|
142
143
|
variant: variant,
|
|
143
144
|
message: message
|
package/lib/Util/index.js
CHANGED
|
@@ -3,23 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.formatToDate = formatToDate;
|
|
7
|
+
exports.formatToDatetime = formatToDatetime;
|
|
8
|
+
exports.getColor = exports.getBackground = exports.formatUptime = void 0;
|
|
7
9
|
exports.getCookieOptions = getCookieOptions;
|
|
8
|
-
exports.mergeProps = mergeProps;
|
|
9
10
|
exports.getCopyright = getCopyright;
|
|
10
|
-
exports.
|
|
11
|
+
exports.getDateTool = getDateTool;
|
|
12
|
+
exports.getTimezone = void 0;
|
|
13
|
+
exports.mergeProps = mergeProps;
|
|
14
|
+
exports.openWebWallet = openWebWallet;
|
|
15
|
+
exports.parseQuery = parseQuery;
|
|
16
|
+
exports.setDateTool = setDateTool;
|
|
17
|
+
exports.str2color = void 0;
|
|
11
18
|
|
|
12
19
|
var _padStart = _interopRequireDefault(require("lodash/padStart"));
|
|
13
20
|
|
|
14
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
22
|
|
|
16
23
|
/* eslint-disable no-bitwise */
|
|
24
|
+
let dateTool = null;
|
|
17
25
|
|
|
18
|
-
/* eslint-disable no-plusplus */
|
|
19
|
-
|
|
20
|
-
/* eslint-disable operator-linebreak */
|
|
21
26
|
function parseQuery(str) {
|
|
22
|
-
return str.replace(/^\?/, '').split('&').map(x => x.split('=')).filter(
|
|
27
|
+
return str.replace(/^\?/, '').split('&').map(x => x.split('=')).filter(_ref => {
|
|
23
28
|
let [key] = _ref;
|
|
24
29
|
return !!key;
|
|
25
30
|
}).reduce((memo, x) => {
|
|
@@ -29,22 +34,50 @@ function parseQuery(str) {
|
|
|
29
34
|
return memo;
|
|
30
35
|
}, {});
|
|
31
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* @param {number} opts.expireInDays
|
|
39
|
+
* @param {string} opts.path
|
|
40
|
+
* @param {domain} opts.domain
|
|
41
|
+
* @param {boolean} opts.returnDomain if === false, opts.domain will be skipped
|
|
42
|
+
*/
|
|
43
|
+
|
|
32
44
|
|
|
33
45
|
function getCookieOptions() {
|
|
34
46
|
let expireInDays = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
47
|
+
let opts = {
|
|
48
|
+
expireInDays
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (typeof expireInDays === 'object') {
|
|
52
|
+
opts = expireInDays;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (opts.path === undefined) {
|
|
56
|
+
opts.path = '/';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!opts.expireInDays) {
|
|
60
|
+
opts.expireInDays = 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
35
63
|
const options = {
|
|
36
|
-
expires: expireInDays,
|
|
37
|
-
path:
|
|
38
|
-
domain: ''
|
|
64
|
+
expires: opts.expireInDays,
|
|
65
|
+
path: opts.path,
|
|
66
|
+
domain: opts.domain || '',
|
|
67
|
+
sameSite: opts.sameSite || 'lax'
|
|
39
68
|
};
|
|
40
69
|
|
|
41
|
-
if (typeof window === 'undefined') {
|
|
70
|
+
if (typeof window === 'undefined' || opts.domain || opts.returnDomain === false) {
|
|
71
|
+
if (opts.returnDomain === false) {
|
|
72
|
+
delete options.domain;
|
|
73
|
+
}
|
|
74
|
+
|
|
42
75
|
return options;
|
|
43
76
|
}
|
|
44
77
|
|
|
45
78
|
const {
|
|
46
79
|
host
|
|
47
|
-
} = window.location;
|
|
80
|
+
} = window.location;
|
|
48
81
|
|
|
49
82
|
if (/^[.:0-9]+$/.test(host)) {
|
|
50
83
|
options.domain = '';
|
|
@@ -72,7 +105,7 @@ const getColor = props => {
|
|
|
72
105
|
}
|
|
73
106
|
|
|
74
107
|
if (props.dark) {
|
|
75
|
-
return props.theme.palette.
|
|
108
|
+
return props.theme.palette.common.white;
|
|
76
109
|
}
|
|
77
110
|
|
|
78
111
|
return props.theme.palette.text.primary;
|
|
@@ -86,10 +119,10 @@ const getBackground = props => {
|
|
|
86
119
|
}
|
|
87
120
|
|
|
88
121
|
if (props.dark) {
|
|
89
|
-
return props.theme.palette.
|
|
122
|
+
return props.theme.palette.common.black;
|
|
90
123
|
}
|
|
91
124
|
|
|
92
|
-
return props.theme.palette.
|
|
125
|
+
return props.theme.palette.common.white;
|
|
93
126
|
};
|
|
94
127
|
|
|
95
128
|
exports.getBackground = getBackground;
|
|
@@ -99,7 +132,6 @@ function mergeProps(props, component) {
|
|
|
99
132
|
const newProps = Object.assign({}, props);
|
|
100
133
|
Object.keys(component.defaultProps || {}).forEach(x => {
|
|
101
134
|
if (typeof newProps[x] === 'string' && newProps[x].indexOf('::prop::') === 0) {
|
|
102
|
-
// eslint-disable-next-line react/default-props-match-prop-types
|
|
103
135
|
newProps[x] = component.defaultProps[x];
|
|
104
136
|
}
|
|
105
137
|
});
|
|
@@ -139,6 +171,25 @@ const getTimezone = () => {
|
|
|
139
171
|
|
|
140
172
|
exports.getTimezone = getTimezone;
|
|
141
173
|
|
|
174
|
+
const str2color = str => {
|
|
175
|
+
let hash = 0;
|
|
176
|
+
|
|
177
|
+
for (let i = 0; i < str.length; i++) {
|
|
178
|
+
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let colour = '#';
|
|
182
|
+
|
|
183
|
+
for (let j = 0; j < 3; j++) {
|
|
184
|
+
const value = hash >> j * 8 & 0xff;
|
|
185
|
+
colour += "00".concat(value.toString(16)).substr(-2);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return colour;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
exports.str2color = str2color;
|
|
192
|
+
|
|
142
193
|
const formatUptime = uptime => {
|
|
143
194
|
const total = Math.round(uptime / 1000);
|
|
144
195
|
const hours = Math.floor(total / 3600);
|
|
@@ -146,24 +197,144 @@ const formatUptime = uptime => {
|
|
|
146
197
|
const seconds = total % 60;
|
|
147
198
|
return "".concat((0, _padStart.default)(hours, 2, '0'), ":").concat((0, _padStart.default)(minutes, 2, '0'), ":").concat((0, _padStart.default)(seconds, 2, '0'));
|
|
148
199
|
};
|
|
200
|
+
/**
|
|
201
|
+
* Set the date tool library which support for format() and locale() functions,
|
|
202
|
+
* moment and dayjs are recommended.
|
|
203
|
+
* @param {object} the date tool library
|
|
204
|
+
*/
|
|
205
|
+
|
|
149
206
|
|
|
150
207
|
exports.formatUptime = formatUptime;
|
|
151
208
|
|
|
152
|
-
|
|
153
|
-
|
|
209
|
+
function setDateTool(tool) {
|
|
210
|
+
dateTool = tool;
|
|
211
|
+
}
|
|
154
212
|
|
|
155
|
-
|
|
156
|
-
|
|
213
|
+
function getDateTool() {
|
|
214
|
+
return dateTool;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const createDateFormater = format => (date, _ref2) => {
|
|
218
|
+
let {
|
|
219
|
+
locale,
|
|
220
|
+
tz
|
|
221
|
+
} = _ref2;
|
|
222
|
+
|
|
223
|
+
if (dateTool === null) {
|
|
224
|
+
throw new Error('call setDateTool to set the date tool library, such as: setDateTool(dayjs)');
|
|
157
225
|
}
|
|
158
226
|
|
|
159
|
-
|
|
227
|
+
if (!date) {
|
|
228
|
+
return '-';
|
|
229
|
+
}
|
|
160
230
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
231
|
+
let instance = dateTool(date);
|
|
232
|
+
|
|
233
|
+
if (typeof tz !== 'undefined') {
|
|
234
|
+
instance = instance.tz(tz);
|
|
164
235
|
}
|
|
165
236
|
|
|
166
|
-
|
|
237
|
+
if (typeof locale !== 'undefined') {
|
|
238
|
+
instance = instance.locale(locale);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return instance.format(format);
|
|
167
242
|
};
|
|
243
|
+
/**
|
|
244
|
+
* Format the time string as `ll` format: MMM D, YYYY
|
|
245
|
+
* Ensure that the setDateTool() function is called first to set the time tool library.
|
|
246
|
+
* @param {string} date date string
|
|
247
|
+
* @param {object} option
|
|
248
|
+
* @param {string} option.locale, default: en
|
|
249
|
+
* @param {string} option.tz, default: timzone
|
|
250
|
+
* @returns formated date string
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
function formatToDate(date) {
|
|
255
|
+
let {
|
|
256
|
+
locale,
|
|
257
|
+
tz
|
|
258
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
259
|
+
return createDateFormater('ll')(date, {
|
|
260
|
+
locale,
|
|
261
|
+
tz
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Format the time string as `lll` format: MMM D, YYYY h:mm A
|
|
266
|
+
* Ensure that the setDateTool() function is called first to set the time tool library.
|
|
267
|
+
* @param {string} date date string
|
|
268
|
+
* @param {object} option
|
|
269
|
+
* @param {string} option.locale, default: en
|
|
270
|
+
* @param {string} option.tz, default: timzone
|
|
271
|
+
* @returns formated date string
|
|
272
|
+
*/
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
function formatToDatetime(date) {
|
|
276
|
+
let {
|
|
277
|
+
locale,
|
|
278
|
+
tz
|
|
279
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
280
|
+
return createDateFormater('lll')(date, {
|
|
281
|
+
locale,
|
|
282
|
+
tz
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function openWebWallet(_ref3) {
|
|
287
|
+
var _window;
|
|
288
|
+
|
|
289
|
+
let {
|
|
290
|
+
webWalletUrl,
|
|
291
|
+
action = 'login',
|
|
292
|
+
locale = 'en',
|
|
293
|
+
url,
|
|
294
|
+
windowFeatures
|
|
295
|
+
} = _ref3;
|
|
296
|
+
// web wallet extension
|
|
297
|
+
const webWalletExtension = ((_window = window) === null || _window === void 0 ? void 0 : _window.ABT_DEV) || window.ABT;
|
|
298
|
+
|
|
299
|
+
if (webWalletExtension && typeof webWalletExtension.open === 'function') {
|
|
300
|
+
webWalletExtension.open({
|
|
301
|
+
action,
|
|
302
|
+
locale,
|
|
303
|
+
url: encodeURIComponent(url)
|
|
304
|
+
});
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const defaultWindowFeatures = {
|
|
309
|
+
toolbar: 'no',
|
|
310
|
+
location: 'no',
|
|
311
|
+
status: 'no',
|
|
312
|
+
menubar: 'no',
|
|
313
|
+
scrollbars: 'yes',
|
|
314
|
+
resizable: 'yes',
|
|
315
|
+
// iphone 8plus size
|
|
316
|
+
width: 414,
|
|
317
|
+
height: 736
|
|
318
|
+
};
|
|
319
|
+
const windowUrl = "".concat(webWalletUrl, "?action=").concat(action, "&locale=").concat(locale, "&url=").concat(encodeURIComponent(url));
|
|
320
|
+
const mergedWindowFeatures = Object.assign({}, defaultWindowFeatures, windowFeatures);
|
|
321
|
+
|
|
322
|
+
const getWindowWidth = win => {
|
|
323
|
+
return win.innerWidth || win.document.documentElement.clientWidth || win.document.body.clientWidth;
|
|
324
|
+
}; // 默认在浏览器右上角弹出窗口
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
if (!('left' in mergedWindowFeatures)) {
|
|
328
|
+
const winWidth = getWindowWidth(window.top || window);
|
|
329
|
+
const winLeft = window.screenLeft || window.screenX;
|
|
330
|
+
mergedWindowFeatures.left = winWidth + winLeft - mergedWindowFeatures.width;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (!('top' in mergedWindowFeatures)) {
|
|
334
|
+
const winTop = window.screenTop || window.screenY;
|
|
335
|
+
mergedWindowFeatures.top = winTop;
|
|
336
|
+
}
|
|
168
337
|
|
|
169
|
-
|
|
338
|
+
const strWindowFeatures = Object.keys(mergedWindowFeatures).map(key => "".concat(key, "=").concat(mergedWindowFeatures[key])).join(',');
|
|
339
|
+
window.open(windowUrl, 'targetWindow', strWindowFeatures);
|
|
340
|
+
}
|