@arcblock/ux 1.16.43 → 1.16.44
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/lib/Button/wrap.js +62 -32
- package/lib/Colors/themes/default.js +4 -3
- package/lib/Theme/index.js +5 -2
- package/package.json +5 -4
- package/src/Button/wrap.js +38 -25
- package/src/Colors/themes/default.js +3 -2
- package/src/Theme/index.js +3 -1
package/lib/Button/wrap.js
CHANGED
|
@@ -15,10 +15,16 @@ var _Colors = _interopRequireDefault(require("../Colors"));
|
|
|
15
15
|
|
|
16
16
|
var _Util = require("../Util");
|
|
17
17
|
|
|
18
|
-
const _excluded = ["children", "rounded", "loading", "disabled", "style", "forwardedRef"];
|
|
18
|
+
const _excluded = ["children", "rounded", "loading", "disabled", "style", "forwardedRef", "color"];
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
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; }
|
|
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
|
+
|
|
22
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; }
|
|
23
29
|
|
|
24
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; }
|
|
@@ -33,7 +39,8 @@ function _default(BaseComponent) {
|
|
|
33
39
|
loading,
|
|
34
40
|
disabled,
|
|
35
41
|
style,
|
|
36
|
-
forwardedRef
|
|
42
|
+
forwardedRef,
|
|
43
|
+
color
|
|
37
44
|
} = newProps,
|
|
38
45
|
rest = _objectWithoutProperties(newProps, _excluded);
|
|
39
46
|
|
|
@@ -55,36 +62,59 @@ function _default(BaseComponent) {
|
|
|
55
62
|
const styles = Object.assign({}, style, {
|
|
56
63
|
boxShadow: 'none',
|
|
57
64
|
textTransform: 'capitalize'
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
}); // mui 只支持 4 种 color 值: default/inherit/primary/secondary (传入这 4 种之外的值会报 warning),
|
|
66
|
+
// 这里扩展 danger/warning/reverse 三种 color
|
|
67
|
+
|
|
68
|
+
let _rest = rest;
|
|
69
|
+
|
|
70
|
+
switch (color) {
|
|
71
|
+
case 'error':
|
|
72
|
+
case 'danger':
|
|
73
|
+
{
|
|
74
|
+
if (rest.variant === 'contained') {
|
|
75
|
+
styles.backgroundColor = _Colors.default.error.main;
|
|
76
|
+
styles.color = _Colors.default.common.white;
|
|
77
|
+
} else {
|
|
78
|
+
styles.borderColor = _Colors.default.error.main;
|
|
79
|
+
styles.color = _Colors.default.error.main;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
case 'warning':
|
|
86
|
+
{
|
|
87
|
+
if (rest.variant === 'contained') {
|
|
88
|
+
styles.backgroundColor = _Colors.default.warning.main;
|
|
89
|
+
styles.color = _Colors.default.common.white;
|
|
90
|
+
} else {
|
|
91
|
+
styles.borderColor = _Colors.default.warning.main;
|
|
92
|
+
styles.color = _Colors.default.warning.main;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
case 'reverse':
|
|
99
|
+
{
|
|
100
|
+
if (rest.variant === 'contained') {
|
|
101
|
+
styles.backgroundColor = 'rgba(255, 255, 255, 0.9)';
|
|
102
|
+
styles.color = _Colors.default.grey[900];
|
|
103
|
+
} else {
|
|
104
|
+
styles.borderColor = _Colors.default.grey[900];
|
|
105
|
+
styles.color = _Colors.default.grey[900];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
// 除扩展的几种 color 外, 由 mui button 自己处理 color
|
|
69
111
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
styles.color = isDisabled ? _Colors.default.grey[400] : _Colors.default.grey[900];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (rest.color === 'reverse') {
|
|
81
|
-
if (rest.variant === 'contained') {
|
|
82
|
-
styles.backgroundColor = 'rgba(255, 255, 255, 0.9)';
|
|
83
|
-
styles.color = _Colors.default.grey[900];
|
|
84
|
-
} else {
|
|
85
|
-
styles.borderColor = _Colors.default.grey[900];
|
|
86
|
-
styles.color = _Colors.default.grey[900];
|
|
87
|
-
}
|
|
112
|
+
default:
|
|
113
|
+
{
|
|
114
|
+
_rest = _objectSpread(_objectSpread({}, _rest), {}, {
|
|
115
|
+
color
|
|
116
|
+
});
|
|
117
|
+
}
|
|
88
118
|
}
|
|
89
119
|
|
|
90
120
|
if (rounded) {
|
|
@@ -96,7 +126,7 @@ function _default(BaseComponent) {
|
|
|
96
126
|
style: styles,
|
|
97
127
|
ref: forwardedRef,
|
|
98
128
|
disabled: isDisabled
|
|
99
|
-
},
|
|
129
|
+
}, _rest), loading && /*#__PURE__*/_react.default.createElement(_Spinner.default, {
|
|
100
130
|
size: loadingSize,
|
|
101
131
|
style: {
|
|
102
132
|
marginRight: 5
|
|
@@ -19,12 +19,12 @@ const colors = {
|
|
|
19
19
|
white: '#fff'
|
|
20
20
|
},
|
|
21
21
|
primary: {
|
|
22
|
-
main: '#
|
|
22
|
+
main: '#3773F2',
|
|
23
23
|
contrastText: '#fff'
|
|
24
24
|
},
|
|
25
25
|
// override
|
|
26
26
|
secondary: {
|
|
27
|
-
main: '#
|
|
27
|
+
main: '#16CED1',
|
|
28
28
|
contrastText: '#fff'
|
|
29
29
|
},
|
|
30
30
|
// override
|
|
@@ -78,7 +78,8 @@ const colors = {
|
|
|
78
78
|
did: {
|
|
79
79
|
primary: '#4598FA',
|
|
80
80
|
secondary: '#49C3AD'
|
|
81
|
-
}
|
|
81
|
+
} // TODO: 等设计规范稳定后, 考虑扩展 trade 相关的常用颜色 (send/receive/exchange/transfer)
|
|
82
|
+
|
|
82
83
|
};
|
|
83
84
|
var _default = colors;
|
|
84
85
|
exports.default = _default;
|
package/lib/Theme/index.js
CHANGED
|
@@ -7,6 +7,10 @@ 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
|
|
|
12
16
|
var _Colors = _interopRequireDefault(require("../Colors"));
|
|
@@ -58,12 +62,11 @@ const create = function create() {
|
|
|
58
62
|
gray: mode === 'light' ? _Colors.default.grey[500] : _Colors.default.grey[300]
|
|
59
63
|
},
|
|
60
64
|
fontSize: 16,
|
|
61
|
-
fontFamily: ['Avenir', '-apple-system', 'BlinkMacSystemFont', '"Segoe UI"', 'Roboto', '"Helvetica Neue"', 'Arial', 'sans-serif', '"Apple Color Emoji"', '"Segoe UI Emoji"', '"Segoe UI Symbol"'].join(',')
|
|
65
|
+
fontFamily: ['Lato', 'Avenir', '-apple-system', 'BlinkMacSystemFont', '"Segoe UI"', 'Roboto', '"Helvetica Neue"', 'Arial', 'sans-serif', '"Apple Color Emoji"', '"Segoe UI Emoji"', '"Segoe UI Symbol"'].join(',')
|
|
62
66
|
}, typography || {}),
|
|
63
67
|
overrides: Object.assign({
|
|
64
68
|
MuiButton: {
|
|
65
69
|
root: {
|
|
66
|
-
borderRadius: 0,
|
|
67
70
|
boxShadow: 'none'
|
|
68
71
|
}
|
|
69
72
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.44",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -53,11 +53,12 @@
|
|
|
53
53
|
"react": ">=16.12.0",
|
|
54
54
|
"react-ga": "^2.7.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "912f6b79061afd403605e241044579d60a1149fc",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@arcblock/icons": "^1.16.
|
|
59
|
-
"@arcblock/react-hooks": "^1.16.
|
|
58
|
+
"@arcblock/icons": "^1.16.44",
|
|
59
|
+
"@arcblock/react-hooks": "^1.16.44",
|
|
60
60
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
61
|
+
"@fontsource/lato": "^4.5.3",
|
|
61
62
|
"@material-ui/core": "^4.12.3",
|
|
62
63
|
"@material-ui/icons": "4.11.2",
|
|
63
64
|
"axios": "^0.21.1",
|
package/src/Button/wrap.js
CHANGED
|
@@ -10,7 +10,7 @@ import { mergeProps } from '../Util';
|
|
|
10
10
|
export default function (BaseComponent) {
|
|
11
11
|
function WrappedComponent(props) {
|
|
12
12
|
const newProps = mergeProps(props, WrappedComponent, ['style']);
|
|
13
|
-
const { children, rounded, loading, disabled, style, forwardedRef, ...rest } = newProps;
|
|
13
|
+
const { children, rounded, loading, disabled, style, forwardedRef, color, ...rest } = newProps;
|
|
14
14
|
|
|
15
15
|
const isDisabled = disabled || loading;
|
|
16
16
|
|
|
@@ -29,31 +29,44 @@ export default function (BaseComponent) {
|
|
|
29
29
|
textTransform: 'capitalize',
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
// mui 只支持 4 种 color 值: default/inherit/primary/secondary (传入这 4 种之外的值会报 warning),
|
|
33
|
+
// 这里扩展 danger/warning/reverse 三种 color
|
|
34
|
+
let _rest = rest;
|
|
35
|
+
switch (color) {
|
|
36
|
+
case 'error':
|
|
37
|
+
case 'danger': {
|
|
38
|
+
if (rest.variant === 'contained') {
|
|
39
|
+
styles.backgroundColor = colors.error.main;
|
|
40
|
+
styles.color = colors.common.white;
|
|
41
|
+
} else {
|
|
42
|
+
styles.borderColor = colors.error.main;
|
|
43
|
+
styles.color = colors.error.main;
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
39
46
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
case 'warning': {
|
|
48
|
+
if (rest.variant === 'contained') {
|
|
49
|
+
styles.backgroundColor = colors.warning.main;
|
|
50
|
+
styles.color = colors.common.white;
|
|
51
|
+
} else {
|
|
52
|
+
styles.borderColor = colors.warning.main;
|
|
53
|
+
styles.color = colors.warning.main;
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
48
56
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
case 'reverse': {
|
|
58
|
+
if (rest.variant === 'contained') {
|
|
59
|
+
styles.backgroundColor = 'rgba(255, 255, 255, 0.9)';
|
|
60
|
+
styles.color = colors.grey[900];
|
|
61
|
+
} else {
|
|
62
|
+
styles.borderColor = colors.grey[900];
|
|
63
|
+
styles.color = colors.grey[900];
|
|
64
|
+
}
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
// 除扩展的几种 color 外, 由 mui button 自己处理 color
|
|
68
|
+
default: {
|
|
69
|
+
_rest = { ..._rest, color };
|
|
57
70
|
}
|
|
58
71
|
}
|
|
59
72
|
if (rounded) {
|
|
@@ -62,7 +75,7 @@ export default function (BaseComponent) {
|
|
|
62
75
|
}
|
|
63
76
|
|
|
64
77
|
return (
|
|
65
|
-
<BaseComponent style={styles} ref={forwardedRef} disabled={isDisabled} {...
|
|
78
|
+
<BaseComponent style={styles} ref={forwardedRef} disabled={isDisabled} {..._rest}>
|
|
66
79
|
{loading && <Spinner size={loadingSize} style={{ marginRight: 5 }} />}
|
|
67
80
|
{children}
|
|
68
81
|
</BaseComponent>
|
|
@@ -11,8 +11,8 @@ const colors = {
|
|
|
11
11
|
black: '#000',
|
|
12
12
|
white: '#fff',
|
|
13
13
|
},
|
|
14
|
-
primary: { main: '#
|
|
15
|
-
secondary: { main: '#
|
|
14
|
+
primary: { main: '#3773F2', contrastText: '#fff' }, // override
|
|
15
|
+
secondary: { main: '#16CED1', contrastText: '#fff' }, // override
|
|
16
16
|
error: { main: '#F16E6E', contrastText: '#fff' }, // override
|
|
17
17
|
warning: { main: '#DE9E37', contrastText: '#fff' }, // override
|
|
18
18
|
info: { main: '#0775F8', contrastText: '#fff' }, // override
|
|
@@ -48,6 +48,7 @@ const colors = {
|
|
|
48
48
|
primary: '#4598FA',
|
|
49
49
|
secondary: '#49C3AD',
|
|
50
50
|
},
|
|
51
|
+
// TODO: 等设计规范稳定后, 考虑扩展 trade 相关的常用颜色 (send/receive/exchange/transfer)
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
export default colors;
|
package/src/Theme/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// https://app.zeplin.io/styleguide/5d1436f1e97c2156f49c0725/colors
|
|
2
2
|
import { createTheme } from '@material-ui/core/styles';
|
|
3
|
+
import '@fontsource/lato/400.css';
|
|
4
|
+
import '@fontsource/lato/700.css';
|
|
3
5
|
import responsiveFontSizes from './responsiveFontSizes';
|
|
4
6
|
import colors from '../Colors';
|
|
5
7
|
|
|
@@ -39,6 +41,7 @@ export const create = ({
|
|
|
39
41
|
},
|
|
40
42
|
fontSize: 16,
|
|
41
43
|
fontFamily: [
|
|
44
|
+
'Lato',
|
|
42
45
|
'Avenir',
|
|
43
46
|
'-apple-system',
|
|
44
47
|
'BlinkMacSystemFont',
|
|
@@ -58,7 +61,6 @@ export const create = ({
|
|
|
58
61
|
{
|
|
59
62
|
MuiButton: {
|
|
60
63
|
root: {
|
|
61
|
-
borderRadius: 0,
|
|
62
64
|
boxShadow: 'none',
|
|
63
65
|
},
|
|
64
66
|
},
|