@arcblock/ux 1.15.25 → 1.15.29

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.
@@ -11,9 +11,13 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
+ var _green = _interopRequireDefault(require("@material-ui/core/colors/green"));
15
+
16
+ var _blue = _interopRequireDefault(require("@material-ui/core/colors/blue"));
17
+
14
18
  var _Logo = _interopRequireDefault(require("../Logo"));
15
19
 
16
- var _Theme = require("../Theme");
20
+ var _Colors = _interopRequireDefault(require("../Colors"));
17
21
 
18
22
  const _excluded = ["messages", "interval"];
19
23
 
@@ -82,4 +86,4 @@ ActivityIndicator.defaultProps = {
82
86
  const Div = _styledComponents.default.div.withConfig({
83
87
  displayName: "ActivityIndicator__Div",
84
88
  componentId: "sc-rsk6jb-0"
85
- })(["&&{padding:20px;width:100%;height:100%;min-height:360px;z-index:100;transition:opacity 0.5s linear;display:flex;align-items:center;flex-direction:column;justify-content:center;}@keyframes orbit{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}.pm-loader-text{color:", ";font-size:14px;text-align:center;position:relative;height:70px;-webkit-user-select:none;}.pm-loader-container{width:100%;height:100%;display:flex;align-items:center;flex-direction:column;justify-content:center;flex:1;}.pm-loader-atoms{width:100px;height:100px;display:flex;position:relative;align-items:center;justify-content:center;}.pm-loader-center-atom{top:32px;left:32px;width:32px;height:32px;position:absolute;border-radius:50%;}.pm-loader-orbit-1{top:20px;left:20px;width:56px;height:56px;position:absolute;border-radius:50%;border:1px solid ", ";}.pm-loader-orbit-2{top:8px;left:8px;width:80px;height:80px;border-radius:50%;position:absolute;border:1px solid ", ";}.pm-loader-orbit-3{top:-4px;left:-4px;width:104px;height:104px;position:absolute;border-radius:50%;border:1px solid ", ";}.pm-loader-atom-1{width:7px;height:7px;margin-top:4px;margin-left:4px;border-radius:50%;background-color:", ";transform-origin:24px 24px;animation:orbit 1s infinite;animation-timing-function:linear;-webkit-transform-origin:24px 24px;}.pm-loader-atom-2{width:7px;height:7px;margin-top:8px;margin-left:8px;border-radius:50%;background-color:", ";transform-origin:32px 32px;animation:orbit 2s infinite;animation-timing-function:linear;-webkit-transform-origin:32px 32px;}.pm-loader-atom-3{width:7px;height:7px;margin-top:11px;margin-left:11px;border-radius:50%;background-color:", ";transform-origin:41px 41px;animation:orbit 3s infinite;animation-timing-function:linear;-webkit-transform-origin:41px 41px;}"], _Theme.colors.primary, _Theme.colors.green, _Theme.colors.blue, _Theme.colors.primary, _Theme.colors.green, _Theme.colors.blue, _Theme.colors.primary);
89
+ })(["&&{padding:20px;width:100%;height:100%;min-height:360px;z-index:100;transition:opacity 0.5s linear;display:flex;align-items:center;flex-direction:column;justify-content:center;}@keyframes orbit{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}.pm-loader-text{color:", ";font-size:14px;text-align:center;position:relative;height:70px;-webkit-user-select:none;}.pm-loader-container{width:100%;height:100%;display:flex;align-items:center;flex-direction:column;justify-content:center;flex:1;}.pm-loader-atoms{width:100px;height:100px;display:flex;position:relative;align-items:center;justify-content:center;}.pm-loader-center-atom{top:32px;left:32px;width:32px;height:32px;position:absolute;border-radius:50%;}.pm-loader-orbit-1{top:20px;left:20px;width:56px;height:56px;position:absolute;border-radius:50%;border:1px solid ", ";}.pm-loader-orbit-2{top:8px;left:8px;width:80px;height:80px;border-radius:50%;position:absolute;border:1px solid ", ";}.pm-loader-orbit-3{top:-4px;left:-4px;width:104px;height:104px;position:absolute;border-radius:50%;border:1px solid ", ";}.pm-loader-atom-1{width:7px;height:7px;margin-top:4px;margin-left:4px;border-radius:50%;background-color:", ";transform-origin:24px 24px;animation:orbit 1s infinite;animation-timing-function:linear;-webkit-transform-origin:24px 24px;}.pm-loader-atom-2{width:7px;height:7px;margin-top:8px;margin-left:8px;border-radius:50%;background-color:", ";transform-origin:32px 32px;animation:orbit 2s infinite;animation-timing-function:linear;-webkit-transform-origin:32px 32px;}.pm-loader-atom-3{width:7px;height:7px;margin-top:11px;margin-left:11px;border-radius:50%;background-color:", ";transform-origin:41px 41px;animation:orbit 3s infinite;animation-timing-function:linear;-webkit-transform-origin:41px 41px;}"], _Colors.default.grey[900], _green.default[500], _blue.default[800], _Colors.default.grey[900], _green.default[500], _blue.default[800], _Colors.default.grey[900]);
@@ -13,12 +13,14 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
14
  var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
15
15
 
16
- var _Icon = _interopRequireDefault(require("../Icon"));
16
+ var _blueGrey = _interopRequireDefault(require("@material-ui/core/colors/blueGrey"));
17
17
 
18
- var _Theme = require("../Theme");
18
+ var _Icon = _interopRequireDefault(require("../Icon"));
19
19
 
20
20
  var _Util = require("../Util");
21
21
 
22
+ var _Colors = _interopRequireDefault(require("../Colors"));
23
+
22
24
  const _excluded = ["type", "children", "style", "className", "variant"];
23
25
 
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -30,25 +32,25 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
30
32
  const types = {
31
33
  error: {
32
34
  icon: 'exclamation-circle',
33
- color: _Theme.colors.red,
35
+ color: _Colors.default.error.main,
34
36
  borderColor: '#e35b54',
35
37
  backgroundColor: 'rgba(227, 91, 84, 0.2)'
36
38
  },
37
39
  warning: {
38
40
  icon: 'exclamation-triangle',
39
- color: _Theme.colors.yellow,
41
+ color: _Colors.default.warning.main,
40
42
  borderColor: '#f7d040',
41
43
  backgroundColor: 'rgba(247, 208, 64, 0.2)'
42
44
  },
43
45
  success: {
44
46
  icon: 'check-circle',
45
- color: _Theme.colors.green,
47
+ color: _Colors.default.success.main,
46
48
  borderColor: '#89ddd9',
47
49
  backgroundColor: 'rgba(137, 221, 217, 0.2)'
48
50
  },
49
51
  tip: {
50
52
  icon: 'info-circle',
51
- color: _Theme.colors.minor,
53
+ color: _Colors.default.grey[500],
52
54
  borderColor: '#222222',
53
55
  backgroundColor: '#EEEEEE'
54
56
  }
@@ -73,7 +75,7 @@ const Alert = props => {
73
75
  borderColor
74
76
  } = types[type] || types.success;
75
77
  const styles = Object.assign({
76
- color: _Theme.colors.dark,
78
+ color: _blueGrey.default[500],
77
79
  backgroundColor: variant === 'border' ? backgroundColor : 'transparent',
78
80
  borderLeft: variant === 'border' ? "5px solid ".concat(borderColor) : 'none'
79
81
  }, style);
@@ -13,7 +13,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
14
  var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
15
15
 
16
- var _Theme = require("../Theme");
16
+ var _Colors = _interopRequireDefault(require("../Colors"));
17
17
 
18
18
  var _Util = require("../Util");
19
19
 
@@ -27,24 +27,24 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
27
27
 
28
28
  const types = {
29
29
  error: {
30
- color: _Theme.colors.white,
31
- backgroundColor: _Theme.colors.red
30
+ color: _Colors.default.common.white,
31
+ backgroundColor: _Colors.default.error.main
32
32
  },
33
33
  warning: {
34
- color: _Theme.colors.white,
35
- backgroundColor: _Theme.colors.yellow
34
+ color: _Colors.default.common.white,
35
+ backgroundColor: _Colors.default.warning.main
36
36
  },
37
37
  success: {
38
- color: _Theme.colors.white,
39
- backgroundColor: _Theme.colors.green
38
+ color: _Colors.default.common.white,
39
+ backgroundColor: _Colors.default.success.main
40
40
  },
41
41
  primary: {
42
- color: _Theme.colors.white,
43
- backgroundColor: _Theme.colors.blue
42
+ color: _Colors.default.common.white,
43
+ backgroundColor: _Colors.default.primary.main
44
44
  },
45
45
  reverse: {
46
- color: _Theme.colors.white,
47
- backgroundColor: _Theme.colors.primary
46
+ color: _Colors.default.common.white,
47
+ backgroundColor: _Colors.default.grey[900]
48
48
  }
49
49
  };
50
50
 
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _Spinner = _interopRequireDefault(require("../Spinner"));
13
13
 
14
- var _Theme = require("../Theme");
14
+ var _Colors = _interopRequireDefault(require("../Colors"));
15
15
 
16
16
  var _Util = require("../Util");
17
17
 
@@ -59,31 +59,31 @@ function _default(BaseComponent) {
59
59
 
60
60
  if (rest.color === 'danger') {
61
61
  if (rest.variant === 'contained') {
62
- styles.backgroundColor = _Theme.colors.danger;
63
- styles.color = _Theme.colors.white;
62
+ styles.backgroundColor = _Colors.default.error.main;
63
+ styles.color = _Colors.default.common.white;
64
64
  } else {
65
- styles.borderColor = _Theme.colors.danger;
66
- styles.color = _Theme.colors.danger;
65
+ styles.borderColor = _Colors.default.error.main;
66
+ styles.color = _Colors.default.error.main;
67
67
  }
68
68
  }
69
69
 
70
70
  if (!rest.color || rest.color === 'default') {
71
71
  if (rest.variant === 'contained') {
72
- styles.backgroundColor = isDisabled ? _Theme.colors.lightGrey : _Theme.colors.primary;
73
- styles.color = _Theme.colors.white;
72
+ styles.backgroundColor = isDisabled ? _Colors.default.grey[400] : _Colors.default.grey[900];
73
+ styles.color = _Colors.default.common.white;
74
74
  } else {
75
- styles.borderColor = isDisabled ? _Theme.colors.lightGrey : _Theme.colors.primary;
76
- styles.color = isDisabled ? _Theme.colors.lightGrey : _Theme.colors.primary;
75
+ styles.borderColor = isDisabled ? _Colors.default.grey[400] : _Colors.default.grey[900];
76
+ styles.color = isDisabled ? _Colors.default.grey[400] : _Colors.default.grey[900];
77
77
  }
78
78
  }
79
79
 
80
80
  if (rest.color === 'reverse') {
81
81
  if (rest.variant === 'contained') {
82
82
  styles.backgroundColor = 'rgba(255, 255, 255, 0.9)';
83
- styles.color = _Theme.colors.primary;
83
+ styles.color = _Colors.default.grey[900];
84
84
  } else {
85
- styles.borderColor = _Theme.colors.primary;
86
- styles.color = _Theme.colors.primary;
85
+ styles.borderColor = _Colors.default.grey[900];
86
+ styles.color = _Colors.default.grey[900];
87
87
  }
88
88
  }
89
89
 
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _default.default;
10
+ }
11
+ });
12
+
13
+ var _default = _interopRequireDefault(require("./themes/default"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ /**
9
+ * 默认 colors, ABT 系列
10
+ *
11
+ * - colors object 结构是在 mui theme#palette object 基础上调整后的结构
12
+ * - 色值在 mui default theme 基础上将 figma 中常用的 colors 进行覆盖
13
+ * - 扩展一些常用色值 (如 DID 系列)
14
+ * - figma: https://www.figma.com/file/1qHyMF137EXOQpSFVByszG/UX-Library?node-id=295%3A1518
15
+ */
16
+ const colors = {
17
+ common: {
18
+ black: '#000',
19
+ white: '#fff'
20
+ },
21
+ primary: {
22
+ main: '#4F6AF6',
23
+ contrastText: '#fff'
24
+ },
25
+ // override
26
+ secondary: {
27
+ main: '#31AB86',
28
+ contrastText: '#fff'
29
+ },
30
+ // override
31
+ error: {
32
+ main: '#F16E6E',
33
+ contrastText: '#fff'
34
+ },
35
+ // override
36
+ warning: {
37
+ main: '#DE9E37',
38
+ contrastText: '#fff'
39
+ },
40
+ // override
41
+ info: {
42
+ main: '#0775F8',
43
+ contrastText: '#fff'
44
+ },
45
+ // override
46
+ success: {
47
+ main: '#34BE74',
48
+ contrastText: '#fff'
49
+ },
50
+ // override
51
+ grey: {
52
+ 50: '#fafafa',
53
+ 100: '#f5f5f5',
54
+ 200: '#eeeeee',
55
+ 300: '#e0e0e0',
56
+ 400: '#bdbdbd',
57
+ 500: '#9e9e9e',
58
+ 600: '#757575',
59
+ 700: '#616161',
60
+ 800: '#424242',
61
+ 900: '#212121',
62
+ A100: '#d5d5d5',
63
+ A200: '#aaaaaa',
64
+ A400: '#303030',
65
+ A700: '#616161'
66
+ },
67
+ text: {
68
+ primary: 'rgba(0, 0, 0, 0.87)',
69
+ secondary: 'rgba(0, 0, 0, 0.54)',
70
+ disabled: 'rgba(0, 0, 0, 0.38)',
71
+ hint: 'rgba(0, 0, 0, 0.38)'
72
+ },
73
+ divider: 'rgba(0, 0, 0, 0.12)',
74
+ background: {
75
+ default: '#fff'
76
+ },
77
+ // 扩展色值, 适用于 did 相关的组件, 如果某些产品整体风格是 did 系列, 可以扩展出一个 did 系列的 theme
78
+ did: {
79
+ primary: '#4598FA',
80
+ secondary: '#49C3AD'
81
+ }
82
+ };
83
+ var _default = colors;
84
+ exports.default = _default;
@@ -3,83 +3,96 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.UXCookieConsent = UXCookieConsent;
7
6
  exports.default = DefaultCookieConsent;
7
+ Object.defineProperty(exports, "resetCookieConsentValue", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _reactCookieConsent.resetCookieConsentValue;
11
+ }
12
+ });
8
13
 
9
14
  var _react = _interopRequireDefault(require("react"));
10
15
 
11
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
17
 
18
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
19
+
13
20
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
14
21
 
15
- var _reactCookieConsent = _interopRequireDefault(require("react-cookie-consent"));
22
+ var _reactCookieConsent = _interopRequireWildcard(require("react-cookie-consent"));
16
23
 
17
- const _excluded = ["style", "contentStyle"];
24
+ const _excluded = ["children", "locale", "style"];
18
25
 
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
+ 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); }
20
27
 
21
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
28
+ 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; }
22
29
 
23
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
24
-
25
- 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; }
30
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
31
 
27
32
  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; }
28
33
 
29
34
  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; }
30
35
 
31
- /**
32
- * UXCookieConsent, 目前直接返回 CookieConsent 组件, 定制化要求高的场景可以使用该组件
33
- * 使用文档参考:https://github.com/Mastermindzh/react-cookie-consent
34
- */
35
- function UXCookieConsent(props) {
36
- return /*#__PURE__*/_react.default.createElement(_reactCookieConsent.default, props);
37
- }
36
+ const translations = {
37
+ en: {
38
+ content: 'We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content, to analyze our website traffic, and to understand where our visitors are coming from.',
39
+ agree: 'I Understand'
40
+ },
41
+ zh: {
42
+ content: '我们使用 cookies 和其他跟踪技术来改善您在我们网站上的浏览体验,向您展示个性化的内容,分析我们的网站流量,并了解我们的访问者来自哪里。',
43
+ agree: '我知道了'
44
+ }
45
+ };
38
46
  /**
39
47
  * DefaultCookieConsent, 对 react-cookie-consent package 封装, 以便 arcblock 内部产品可以快速使用
40
48
  * - 默认内容
41
49
  * - 默认配置/样式
42
50
  */
43
51
 
44
-
45
52
  function DefaultCookieConsent(_ref) {
46
53
  let {
47
- style,
48
- contentStyle
54
+ children,
55
+ locale,
56
+ style
49
57
  } = _ref,
50
58
  rest = _objectWithoutProperties(_ref, _excluded);
51
59
 
52
- return /*#__PURE__*/_react.default.createElement(_reactCookieConsent.default, Object.assign({
60
+ if (locale && !translations[locale]) {
61
+ // eslint-disable-next-line no-param-reassign
62
+ locale = 'en';
63
+ }
64
+
65
+ return /*#__PURE__*/_react.default.createElement(Wrapper, {
66
+ style: style
67
+ }, /*#__PURE__*/_react.default.createElement(_reactCookieConsent.default, Object.assign({
68
+ disableStyles: true,
53
69
  disableButtonStyles: true,
54
70
  ButtonComponent: _Button.default,
71
+ buttonText: translations[locale].agree,
55
72
  buttonClasses: "MuiButton-contained MuiButton-containedPrimary",
56
73
  buttonStyle: {
57
- margin: '0 16px',
74
+ marginTop: 16,
58
75
  padding: '6px 16px'
59
- },
60
- contentStyle: _objectSpread({
61
- margin: 16
62
- }, contentStyle),
63
- style: _objectSpread({
64
- boxSizing: 'border-box',
65
- alignItems: 'center',
66
- padding: 16
67
- }, style)
68
- }, rest));
76
+ }
77
+ }, rest), children || /*#__PURE__*/_react.default.createElement("p", {
78
+ style: {
79
+ margin: 0
80
+ }
81
+ }, translations[locale].content)));
69
82
  }
70
83
 
71
84
  DefaultCookieConsent.propTypes = {
72
85
  children: _propTypes.default.any,
73
86
  style: _propTypes.default.object,
74
- contentStyle: _propTypes.default.object
87
+ locale: _propTypes.default.string
75
88
  };
76
89
  DefaultCookieConsent.defaultProps = {
77
- children: /*#__PURE__*/_react.default.createElement("p", {
78
- style: {
79
- margin: 0,
80
- textAlign: 'justify'
81
- }
82
- }, "We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content, to analyze our website traffic, and to understand where our visitors are coming from."),
90
+ children: null,
83
91
  style: {},
84
- contentStyle: {}
85
- };
92
+ locale: 'en'
93
+ };
94
+
95
+ const Wrapper = _styledComponents.default.div.withConfig({
96
+ displayName: "CookieConsent__Wrapper",
97
+ componentId: "sc-xilwg4-0"
98
+ })(["box-sizing:border-box;position:absolute;right:20px;bottom:20px;z-index:999;max-width:440px;padding:16px 24px;font-size:16px;color:#666;background:#fff;border-radius:6px;box-shadow:0 0 18px rgba(0,0,0,0.2);&:empty{display:none;}button{min-width:200px;}@media screen and (max-width:480px){left:16px;right:16px;bottom:16px;width:auto;button{display:block;width:100%;}}"]);
@@ -76,4 +76,4 @@ Footer.defaultProps = {
76
76
  const Container = _styledComponents.default.div.withConfig({
77
77
  displayName: "Footer__Container",
78
78
  componentId: "sc-1qpifuv-0"
79
- })(["margin-top:64px;padding:24px 0 32px;border-top:1px solid ", ";box-sizing:border-box;width:100%;.footer{display:flex;align-items:center;justify-content:space-between;@media (max-width:540px){flex-direction:column;align-items:flex-start;justify-content:flex-start;}.footer-item{color:", ";display:flex;align-items:center;flex-wrap:wrap;font-size:0.9rem;}.footer-brand{margin-left:8px;margin-right:8px;}}"], props => props.dark ? props.theme.colors.minor : '#dee2e7', props => props.theme.colors.minor);
79
+ })(["margin-top:64px;padding:24px 0 32px;border-top:1px solid ", ";box-sizing:border-box;width:100%;.footer{display:flex;align-items:center;justify-content:space-between;@media (max-width:540px){flex-direction:column;align-items:flex-start;justify-content:flex-start;}.footer-item{color:", ";display:flex;align-items:center;flex-wrap:wrap;font-size:0.9rem;}.footer-brand{margin-left:8px;margin-right:8px;}}"], props => props.dark ? props.theme.palette.grey[900] : '#dee2e7', props => props.theme.palette.grey[900]);
package/lib/Icon/index.js CHANGED
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
- var _Theme = require("../Theme");
14
+ var _Colors = _interopRequireDefault(require("../Colors"));
15
15
 
16
16
  const _excluded = ["name", "color", "size", "variant", "rounded", "style", "className", "forwardedRef"];
17
17
 
@@ -73,7 +73,7 @@ Icon.propTypes = {
73
73
  Icon.defaultProps = {
74
74
  rounded: false,
75
75
  variant: 'light',
76
- color: _Theme.colors.primary,
76
+ color: _Colors.default.grey[900],
77
77
  className: '',
78
78
  size: 24,
79
79
  style: {}
@@ -19,6 +19,8 @@ var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
19
19
 
20
20
  var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
21
21
 
22
+ var _teal = _interopRequireDefault(require("@material-ui/core/colors/teal"));
23
+
22
24
  var _image = _interopRequireDefault(require("../../Icon/image"));
23
25
 
24
26
  var _Logo = _interopRequireDefault(require("../../Logo"));
@@ -105,7 +107,7 @@ const gradient = 'linear-gradient(32deg, rgba(144, 255, 230, 0.1), rgba(144, 255
105
107
  const MenuItem = (0, _styledComponents.default)(_Button.default).withConfig({
106
108
  displayName: "sidebar__MenuItem",
107
109
  componentId: "sc-gaosgy-1"
108
- })(["&&{display:block;width:100%;transition:all 200ms ease-in-out;background:", ";padding:24px 0;border-left:2px solid ", ";&:hover{background:", ";border-left-color:", ";}.menu-title{margin-top:8px;font-size:12px;font-weight:500;text-align:center;text-transform:capitalize;letter-spacing:normal;width:80%;}.MuiButton-label{display:flex;flex-direction:column;justify-content:center;align-items:center;}}"], props => props.selected ? gradient : '', props => props.selected ? props.theme.colors.green : 'transparent', gradient, props => props.theme.colors.green);
110
+ })(["&&{display:block;width:100%;transition:all 200ms ease-in-out;background:", ";padding:24px 0;border-left:2px solid ", ";&:hover{background:", ";border-left-color:", ";}.menu-title{margin-top:8px;font-size:12px;font-weight:500;text-align:center;text-transform:capitalize;letter-spacing:normal;width:80%;}.MuiButton-label{display:flex;flex-direction:column;justify-content:center;align-items:center;}}"], props => props.selected ? gradient : '', props => props.selected ? _teal.default.A700 : 'transparent', gradient, _teal.default.A700);
109
111
 
110
112
  var _default = (0, _reactRouterDom.withRouter)((0, _withTheme.default)(Sidebar));
111
113
 
package/lib/Tag/index.js CHANGED
@@ -13,10 +13,10 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
14
  var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
15
15
 
16
- var _Theme = require("../Theme");
17
-
18
16
  var _Util = require("../Util");
19
17
 
18
+ var _Colors = _interopRequireDefault(require("../Colors"));
19
+
20
20
  const _excluded = ["type", "content", "children", "style", "className", "forwardedRef"];
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -27,24 +27,24 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
27
27
 
28
28
  const types = {
29
29
  error: {
30
- color: _Theme.colors.red,
30
+ color: _Colors.default.error.main,
31
31
  backgroundColor: 'rgba(227, 91, 84, 0.2)'
32
32
  },
33
33
  warning: {
34
- color: _Theme.colors.yellow,
34
+ color: _Colors.default.warning.main,
35
35
  backgroundColor: 'rgba(247, 208, 64, 0.2)'
36
36
  },
37
37
  success: {
38
- color: '#5b9025',
38
+ color: _Colors.default.success.main,
39
39
  backgroundColor: '#eafbd9'
40
40
  },
41
41
  primary: {
42
- color: _Theme.colors.blue,
42
+ color: _Colors.default.primary.main,
43
43
  backgroundColor: '#ECEFFF'
44
44
  },
45
45
  reverse: {
46
- color: _Theme.colors.white,
47
- backgroundColor: _Theme.colors.primary
46
+ color: '#fff',
47
+ backgroundColor: '#222'
48
48
  }
49
49
  };
50
50
 
@@ -3,12 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.create = exports.colors = void 0;
6
+ exports.create = void 0;
7
7
 
8
8
  var _styles = require("@material-ui/core/styles");
9
9
 
10
10
  var _responsiveFontSizes = _interopRequireDefault(require("./responsiveFontSizes"));
11
11
 
12
+ var _Colors = _interopRequireDefault(require("../Colors"));
13
+
12
14
  const _excluded = ["mode", "pageWidth", "palette", "typography", "overrides"];
13
15
 
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -23,29 +25,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
23
25
 
24
26
  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; }
25
27
 
26
- const colors = {
27
- white: '#FFFFFF',
28
- dark: '#4A707C',
29
- gray: '#222222',
30
- minor: '#9B9B9B',
31
- darkText: '#DCDCDC',
32
- background: '#F7F8F8',
33
- yellow: '#FFCF71',
34
- green: '#44cdc6',
35
- red: '#D0021B',
36
- blue: '#4E6AF6',
37
- primary: '#222222',
38
- black: '#222222',
39
- secondary: '#44cdc6',
40
- mint: '#44cdc6',
41
- textSecondary: '#4A4A4A',
42
- active: '#5b9025',
43
- danger: '#D0021B',
44
- lightGrey: '#BCBCBC'
45
- }; // https://material-ui.com/customization/default-theme/
46
-
47
- exports.colors = colors;
48
-
28
+ // https://material-ui.com/customization/default-theme/
29
+ // eslint-disable-next-line import/prefer-default-export
49
30
  const create = function create() {
50
31
  let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
51
32
  {
@@ -59,35 +40,22 @@ const create = function create() {
59
40
 
60
41
  const theme = (0, _styles.createTheme)(_objectSpread({
61
42
  themeName: 'ArcBlock',
62
- palette: Object.assign({
63
- primary: {
64
- main: colors.blue,
65
- contrastText: colors.white
66
- },
67
- secondary: {
68
- main: colors.mint,
69
- contrastText: colors.white
70
- },
71
- danger: {
72
- main: colors.danger,
73
- contrastText: colors.white
74
- },
75
- text: {
76
- primary: '#404040',
77
- contrast: colors.white
78
- },
43
+ palette: Object.assign(_objectSpread(_objectSpread({}, _Colors.default), {}, {
79
44
  background: {
80
- paper: mode === 'light' ? colors.white : colors.gray,
81
- default: mode === 'light' ? colors.background : colors.gray
45
+ paper: mode === 'light' ? _Colors.default.common.white : _Colors.default.grey[900],
46
+ default: mode === 'light' ? _Colors.default.background.default : _Colors.default.grey[900]
82
47
  },
83
48
  type: mode
84
- }, palette || {}),
49
+ }), palette || {}),
85
50
  typography: Object.assign({
86
51
  useNextVariants: true,
87
52
  color: {
88
- main: mode === 'light' ? colors.gray : colors.white,
89
- gray: mode === 'light' ? colors.minor : colors.darkText,
90
- blue: colors.blue
53
+ // 此处 #222222 必须硬编码, layout/sidebar.js -> Icon/image 加载图片时 color 会影响加载路径
54
+ // TODO: 此处硬编码的色值后面需要改为 colors.grey[900],
55
+ // 或者如果可以的话直接删掉 typography#color, 文本颜色建议使用 theme.palette.text 中的色值?
56
+ // layout 组件建议重构, sidebar 中建议使用 icon 替换 img (#366)
57
+ main: mode === 'light' ? '#222222' : _Colors.default.common.white,
58
+ gray: mode === 'light' ? _Colors.default.grey[500] : _Colors.default.grey[300]
91
59
  },
92
60
  fontSize: 16,
93
61
  fontFamily: ['Avenir', '-apple-system', 'BlinkMacSystemFont', '"Segoe UI"', 'Roboto', '"Helvetica Neue"', 'Arial', 'sans-serif', '"Apple Color Emoji"', '"Segoe UI Emoji"', '"Segoe UI Symbol"'].join(',')
@@ -106,7 +74,7 @@ const create = function create() {
106
74
  },
107
75
  MuiToolbar: {
108
76
  root: {
109
- background: mode === 'light' ? colors.background : colors.gray
77
+ background: mode === 'light' ? _Colors.default.background.default : _Colors.default.grey[900]
110
78
  }
111
79
  },
112
80
  MuiTableCell: {
@@ -119,10 +87,10 @@ const create = function create() {
119
87
  },
120
88
  head: {
121
89
  textTransform: 'uppercase',
122
- color: mode === 'light' ? colors.gray : colors.darkText
90
+ color: mode === 'light' ? _Colors.default.grey[900] : _Colors.default.grey[300]
123
91
  },
124
92
  body: {
125
- color: mode === 'light' ? colors.gray : colors.darkText
93
+ color: mode === 'light' ? _Colors.default.grey[900] : _Colors.default.grey[300]
126
94
  }
127
95
  },
128
96
  MuiChip: {
@@ -145,15 +113,36 @@ const create = function create() {
145
113
  },
146
114
  MuiTypography: {
147
115
  body1: {
148
- color: mode === 'light' ? colors.gray : colors.darkText
116
+ color: mode === 'light' ? _Colors.default.grey[900] : _Colors.default.grey[300]
149
117
  },
150
118
  body2: {
151
- color: mode === 'light' ? colors.gray : colors.darkText
119
+ color: mode === 'light' ? _Colors.default.grey[900] : _Colors.default.grey[300]
152
120
  }
153
121
  }
154
122
  }, overrides || {}),
155
123
  pageWidth,
156
- colors,
124
+ // TODO: 过时的 colors, 需要各项目负责人检查项目中是否使用 "theme.colors", 如果有需要清除,
125
+ // 可以从 Colors 模块/theme.palette/mui colors 中取值
126
+ colors: {
127
+ white: '#FFFFFF',
128
+ dark: '#4A707C',
129
+ gray: '#222222',
130
+ minor: '#9B9B9B',
131
+ darkText: '#DCDCDC',
132
+ background: '#F7F8F8',
133
+ yellow: '#FFCF71',
134
+ green: '#44cdc6',
135
+ red: '#D0021B',
136
+ blue: '#4E6AF6',
137
+ primary: '#222222',
138
+ black: '#222222',
139
+ secondary: '#44cdc6',
140
+ mint: '#44cdc6',
141
+ textSecondary: '#4A4A4A',
142
+ active: '#5b9025',
143
+ danger: '#D0021B',
144
+ lightGrey: '#BCBCBC'
145
+ },
157
146
  mode
158
147
  }, rest));
159
148
  const enhanced = (0, _responsiveFontSizes.default)(theme, {
package/lib/Util/index.js CHANGED
@@ -116,10 +116,10 @@ const getBackground = props => {
116
116
  }
117
117
 
118
118
  if (props.dark) {
119
- return props.theme.palette.text.primary;
119
+ return props.theme.palette.common.black;
120
120
  }
121
121
 
122
- return props.theme.palette.text.contrast;
122
+ return props.theme.palette.common.white;
123
123
  };
124
124
 
125
125
  exports.getBackground = getBackground;
@@ -17,7 +17,7 @@ var _abtwallet = _interopRequireDefault(require("./images/abtwallet.png"));
17
17
 
18
18
  var _Util = require("../Util");
19
19
 
20
- var _Theme = require("../Theme");
20
+ var _Colors = _interopRequireDefault(require("../Colors"));
21
21
 
22
22
  var _Button = _interopRequireDefault(require("../Button"));
23
23
 
@@ -100,4 +100,4 @@ const sizes = {
100
100
  const Content = _styledComponents.default.div.withConfig({
101
101
  displayName: "Action__Content",
102
102
  componentId: "sc-zuf4zr-0"
103
- })(["display:flex;justify-content:center;align-items:center;&:hover{opacity:0.9;}.wallet-action__logo{width:auto;height:auto;max-width:", "px;margin-left:5px;}.wallet-action__text{padding:8px;display:flex;height:100%;flex-direction:column;justify-content:space-between;align-items:flex-start;}.wallet-action__action{font-size:", "px;text-transform:capitalize;margin-bottom:1px;color:", ";letter-spacing:1px;}.wallet-action__title{font-size:", "px;text-transform:capitalize;color:", ";letter-spacing:1px;}"], props => sizes.logo[props.size], props => sizes.font[props.size], props => props.color || _Theme.colors.blue, props => sizes.font[props.size] * 1.5, props => props.color || _Theme.colors.blue);
103
+ })(["display:flex;justify-content:center;align-items:center;&:hover{opacity:0.9;}.wallet-action__logo{width:auto;height:auto;max-width:", "px;margin-left:5px;}.wallet-action__text{padding:8px;display:flex;height:100%;flex-direction:column;justify-content:space-between;align-items:flex-start;}.wallet-action__action{font-size:", "px;text-transform:capitalize;margin-bottom:1px;color:", ";letter-spacing:1px;}.wallet-action__title{font-size:", "px;text-transform:capitalize;color:", ";letter-spacing:1px;}"], props => sizes.logo[props.size], props => sizes.font[props.size], props => props.color || _Colors.default.primary.main, props => sizes.font[props.size] * 1.5, props => props.color || _Colors.default.primary.main);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "1.15.25",
3
+ "version": "1.15.29",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -52,10 +52,10 @@
52
52
  "react": ">=16.12.0",
53
53
  "react-ga": "^2.7.0"
54
54
  },
55
- "gitHead": "2ed5c5f32f4d1065109e18a3ccfc04a559595835",
55
+ "gitHead": "70fc37255f3e512fd45c5c0f0e06ee828d69b259",
56
56
  "dependencies": {
57
- "@arcblock/icons": "^1.15.25",
58
- "@arcblock/react-hooks": "^1.15.25",
57
+ "@arcblock/icons": "^1.15.29",
58
+ "@arcblock/react-hooks": "^1.15.29",
59
59
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
60
60
  "@material-ui/core": "^4.12.3",
61
61
  "@material-ui/icons": "4.11.2",