@arcblock/ux 2.4.2 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/lib/ActivityIndicator/index.js +4 -6
  2. package/lib/Alert/index.js +3 -4
  3. package/lib/AnimationWaiter/index.js +3 -4
  4. package/lib/Badge/index.js +3 -3
  5. package/lib/Blocklet/blocklet.js +4 -6
  6. package/lib/Blocklet/utils.js +2 -5
  7. package/lib/BlockletNFT/index.js +4 -6
  8. package/lib/Center/index.js +3 -4
  9. package/lib/ClickToCopy/index.js +3 -3
  10. package/lib/CodeBlock/index.js +3 -4
  11. package/lib/ContactForm/index.js +3 -3
  12. package/lib/CookieConsent/index.js +3 -4
  13. package/lib/CountDown/index.js +3 -4
  14. package/lib/Datatable/CustomToolbar.js +5 -9
  15. package/lib/Datatable/TableSearch.js +3 -4
  16. package/lib/Datatable/index.js +5 -7
  17. package/lib/Dialog/dialog.js +5 -9
  18. package/lib/Earth/index.js +4 -6
  19. package/lib/Empty/index.js +3 -3
  20. package/lib/ErrorBoundary/fallback.js +4 -7
  21. package/lib/Footer/index.js +3 -4
  22. package/lib/Header/auto-hidden.js +3 -3
  23. package/lib/Header/header.js +4 -8
  24. package/lib/Header/responsive-header.js +5 -7
  25. package/lib/Icon/image.js +3 -4
  26. package/lib/Icon/index.js +3 -4
  27. package/lib/Img/index.js +3 -3
  28. package/lib/InfoRow/index.js +3 -5
  29. package/lib/Layout/dashboard/index.js +5 -9
  30. package/lib/Layout/dashboard/sidebar.js +3 -5
  31. package/lib/Layout/dashboard-legacy/header.js +3 -3
  32. package/lib/Layout/dashboard-legacy/index.js +3 -3
  33. package/lib/Layout/dashboard-legacy/sidebar.js +5 -7
  34. package/lib/Layout/index.js +4 -6
  35. package/lib/Locale/selector.js +4 -7
  36. package/lib/Logo/index.js +2 -3
  37. package/lib/Metric/index.js +3 -4
  38. package/lib/NFTDisplay/aspect-ratio-container.js +2 -4
  39. package/lib/NFTDisplay/broken.js +3 -3
  40. package/lib/NFTDisplay/index.js +3 -4
  41. package/lib/NFTDisplay/loading.js +2 -4
  42. package/lib/NFTDisplay/svg-embedder/inline-svg.js +4 -6
  43. package/lib/NavMenu/style.js +4 -7
  44. package/lib/PricingTable/PricingPlan.js +3 -3
  45. package/lib/PricingTable/index.js +3 -4
  46. package/lib/Result/common.js +4 -4
  47. package/lib/Result/result.js +3 -5
  48. package/lib/Screenshot/index.js +3 -4
  49. package/lib/SplitButton/index.js +4 -4
  50. package/lib/Switch/index.js +3 -3
  51. package/lib/Tabs/index.js +3 -3
  52. package/lib/Tag/index.js +4 -6
  53. package/lib/TextCollapse/index.js +2 -2
  54. package/lib/Theme/index.js +16 -0
  55. package/lib/Theme/theme-provider.js +3 -8
  56. package/lib/Theme/theme.js +4 -2
  57. package/lib/Video/index.js +3 -4
  58. package/lib/Wallet/Action.js +3 -4
  59. package/lib/Wallet/Download.js +3 -4
  60. package/lib/Wallet/Open.js +3 -3
  61. package/lib/WechatPrompt/index.js +3 -3
  62. package/lib/withTheme/index.js +18 -40
  63. package/package.json +4 -4
  64. package/src/ActivityIndicator/index.js +3 -3
  65. package/src/Alert/index.js +2 -2
  66. package/src/AnimationWaiter/index.js +3 -2
  67. package/src/Badge/index.js +1 -2
  68. package/src/Blocklet/blocklet.js +2 -3
  69. package/src/Blocklet/utils.js +2 -2
  70. package/src/BlockletNFT/index.js +2 -3
  71. package/src/Center/index.js +3 -2
  72. package/src/ClickToCopy/index.js +2 -1
  73. package/src/CodeBlock/index.js +2 -2
  74. package/src/ContactForm/index.js +2 -3
  75. package/src/CookieConsent/index.js +3 -2
  76. package/src/CountDown/index.js +2 -2
  77. package/src/Datatable/CustomToolbar.js +3 -4
  78. package/src/Datatable/TableSearch.js +2 -2
  79. package/src/Datatable/index.js +4 -4
  80. package/src/Dialog/dialog.js +3 -3
  81. package/src/Earth/index.js +3 -3
  82. package/src/Empty/index.js +3 -2
  83. package/src/ErrorBoundary/fallback.js +2 -3
  84. package/src/Footer/index.js +2 -2
  85. package/src/Header/auto-hidden.js +2 -1
  86. package/src/Header/header.js +2 -3
  87. package/src/Header/responsive-header.js +1 -2
  88. package/src/Icon/image.js +2 -2
  89. package/src/Icon/index.js +2 -2
  90. package/src/Img/index.js +1 -1
  91. package/src/InfoRow/index.js +3 -2
  92. package/src/Layout/dashboard/index.js +2 -3
  93. package/src/Layout/dashboard/sidebar.js +3 -3
  94. package/src/Layout/dashboard-legacy/header.js +1 -1
  95. package/src/Layout/dashboard-legacy/index.js +2 -2
  96. package/src/Layout/dashboard-legacy/sidebar.js +2 -4
  97. package/src/Layout/index.js +3 -3
  98. package/src/Locale/selector.js +2 -4
  99. package/src/Logo/index.js +3 -2
  100. package/src/Metric/index.js +2 -2
  101. package/src/NFTDisplay/aspect-ratio-container.js +3 -2
  102. package/src/NFTDisplay/broken.js +2 -1
  103. package/src/NFTDisplay/index.js +3 -2
  104. package/src/NFTDisplay/loading.js +2 -2
  105. package/src/NFTDisplay/svg-embedder/inline-svg.js +3 -2
  106. package/src/NavMenu/style.js +2 -2
  107. package/src/PricingTable/PricingPlan.js +2 -2
  108. package/src/PricingTable/index.js +2 -2
  109. package/src/Result/common.js +1 -1
  110. package/src/Result/result.js +3 -2
  111. package/src/Screenshot/index.js +2 -2
  112. package/src/SplitButton/index.js +2 -1
  113. package/src/Switch/index.js +1 -1
  114. package/src/Tabs/index.js +1 -1
  115. package/src/Tag/index.js +1 -3
  116. package/src/TextCollapse/index.js +2 -2
  117. package/src/Theme/index.js +1 -0
  118. package/src/Theme/theme-provider.js +4 -7
  119. package/src/Theme/theme.js +5 -3
  120. package/src/Video/index.js +2 -3
  121. package/src/Wallet/Action.js +2 -3
  122. package/src/Wallet/Download.js +2 -3
  123. package/src/Wallet/Open.js +2 -1
  124. package/src/WechatPrompt/index.js +2 -3
  125. package/src/withTheme/index.js +41 -54
@@ -7,12 +7,12 @@ exports.default = OpenInWallet;
7
7
 
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
 
10
- var _styled = _interopRequireDefault(require("@emotion/styled"));
11
-
12
10
  var _useBrowser = _interopRequireDefault(require("@arcblock/react-hooks/lib/useBrowser"));
13
11
 
14
12
  var _Fab = _interopRequireDefault(require("@mui/material/Fab"));
15
13
 
14
+ var _Theme = require("../Theme");
15
+
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
 
18
18
  var _templateObject;
@@ -53,4 +53,4 @@ OpenInWallet.propTypes = {
53
53
  OpenInWallet.defaultProps = {
54
54
  locale: 'zh'
55
55
  };
56
- const Button = (0, _styled.default)(_Fab.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n && {\n font-size: 12px;\n position: fixed;\n bottom: 24px;\n left: 50%;\n transform-origin: 50% 50%;\n transform: translateX(-50%);\n min-width: 120px;\n z-index: ", ";\n }\n"])), props => props.theme.zIndex.tooltip);
56
+ const Button = (0, _Theme.styled)(_Fab.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n && {\n font-size: 12px;\n position: fixed;\n bottom: 24px;\n left: 50%;\n transform-origin: 50% 50%;\n transform: translateX(-50%);\n min-width: 120px;\n z-index: ", ";\n }\n"])), props => props.theme.zIndex.tooltip);
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = WechatPrompt;
7
7
 
8
- var _styled = _interopRequireDefault(require("@emotion/styled"));
9
-
10
8
  var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
11
9
 
12
10
  var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
@@ -17,6 +15,8 @@ var _ios = _interopRequireDefault(require("./images/ios.png"));
17
15
 
18
16
  var _android = _interopRequireDefault(require("./images/android.png"));
19
17
 
18
+ var _Theme = require("../Theme");
19
+
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
21
 
22
22
  var _templateObject;
@@ -81,4 +81,4 @@ function WechatPrompt() {
81
81
  });
82
82
  }
83
83
 
84
- const Container = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .wechat-title {\n height: 80px;\n line-height: 80px;\n text-align: center;\n font-size: 20px;\n color: #fff;\n background-color: #9cdbd8;\n }\n\n .wechat-tip {\n display: flex;\n flex-direction: column;\n align-items: center;\n\n .wechat-tip-text {\n font-size: 20px;\n padding: 10px 10px;\n overflow: auto;\n word-break: break-word;\n text-align: center;\n }\n\n .wechat-tip-img {\n width: 90%;\n object-fit: cover;\n }\n }\n"])));
84
+ const Container = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .wechat-title {\n height: 80px;\n line-height: 80px;\n text-align: center;\n font-size: 20px;\n color: #fff;\n background-color: #9cdbd8;\n }\n\n .wechat-tip {\n display: flex;\n flex-direction: column;\n align-items: center;\n\n .wechat-tip-text {\n font-size: 20px;\n padding: 10px 10px;\n overflow: auto;\n word-break: break-word;\n text-align: center;\n }\n\n .wechat-tip-img {\n width: 90%;\n object-fit: cover;\n }\n }\n"])));
@@ -5,12 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var React = _interopRequireWildcard(require("react"));
8
+ var _react = require("react");
9
9
 
10
10
  var _react2 = require("@emotion/react");
11
11
 
12
- var _styles = require("@mui/material/styles");
13
-
14
12
  var _CssBaseline = _interopRequireDefault(require("@mui/material/CssBaseline"));
15
13
 
16
14
  var _Theme = require("../Theme");
@@ -21,10 +19,6 @@ var _templateObject;
21
19
 
22
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
21
 
24
- 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); }
25
-
26
- 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; }
27
-
28
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; }
29
23
 
30
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; }
@@ -33,8 +27,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
33
27
 
34
28
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
35
29
 
36
- const globalStyles = (0, _react2.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-family: ", ";\n color: ", ";\n\n a,\n a:hover,\n a:active {\n text-decoration: none;\n color: ", ";\n }\n\n a:hover {\n color: ", ";\n }\n\n .section--latest-post {\n p:last-of-type {\n margin: 0;\n }\n }\n\n .has-scrolled {\n .section--footnotes {\n position: static !important;\n transition-property: background-color;\n transition-duration: 600ms;\n transition-timing-function: ease;\n .footnote__title {\n color: #fff;\n }\n }\n }\n"])), props => props.theme.typography.fontFamily, props => props.theme.typography.color.main, props => props.theme.palette.primary.dark, props => props.theme.palette.primary.main);
37
-
38
30
  function withTheme(Component) {
39
31
  let {
40
32
  mode = 'light',
@@ -42,42 +34,28 @@ function withTheme(Component) {
42
34
  palette,
43
35
  typography
44
36
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
45
-
46
- class WithTheme extends React.Component {
47
- constructor(props) {
48
- super(props);
49
- this.theme = (0, _Theme.create)({
50
- mode,
51
- pageWidth,
52
- palette,
53
- typography
54
- });
55
- }
56
-
57
- componentDidMount() {
58
- // Remove the server-side injected CSS.
37
+ const theme = (0, _Theme.createTheme)({
38
+ mode,
39
+ pageWidth,
40
+ palette,
41
+ typography
42
+ });
43
+ const globalStyles = (0, _react2.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-family: ", ";\n color: ", ";\n\n a,\n a:hover,\n a:active {\n text-decoration: none;\n color: ", ";\n }\n\n a:hover {\n color: ", ";\n }\n\n .section--latest-post {\n p:last-of-type {\n margin: 0;\n }\n }\n\n .has-scrolled {\n .section--footnotes {\n position: static !important;\n transition-property: background-color;\n transition-duration: 600ms;\n transition-timing-function: ease;\n .footnote__title {\n color: #fff;\n }\n }\n }\n "])), theme.typography.fontFamily, theme.typography.color.main, theme.palette.primary.dark, theme.palette.primary.main);
44
+ return function WithTheme(props) {
45
+ (0, _react.useEffect)(() => {
59
46
  const jssStyles = document.querySelector('#jss-server-side');
60
47
 
61
48
  if (jssStyles && jssStyles.parentNode) {
62
49
  jssStyles.parentNode.removeChild(jssStyles);
63
50
  }
64
- }
65
-
66
- render() {
67
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ThemeProvider, {
68
- theme: this.theme,
69
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CssBaseline.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Global, {
70
- styles: globalStyles
71
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.ThemeProvider, {
72
- theme: this.theme,
73
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread({}, this.props))
74
- })]
75
- });
76
- }
77
-
78
- }
79
-
80
- return WithTheme;
51
+ }, []);
52
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Theme.ThemeProvider, {
53
+ theme: theme,
54
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CssBaseline.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Global, {
55
+ styles: globalStyles
56
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread({}, props))]
57
+ });
58
+ };
81
59
  }
82
60
 
83
61
  var _default = withTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -47,10 +47,10 @@
47
47
  "react": ">=18.1.0",
48
48
  "react-ga": "^2.7.0"
49
49
  },
50
- "gitHead": "6a7e96c930c4ef0dd995bc9383738bb1cdf12844",
50
+ "gitHead": "a3c4e62917f630b62edccc064cfbb88e72b8407d",
51
51
  "dependencies": {
52
- "@arcblock/icons": "^2.4.2",
53
- "@arcblock/react-hooks": "^2.4.2",
52
+ "@arcblock/icons": "^2.4.3",
53
+ "@arcblock/react-hooks": "^2.4.3",
54
54
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
55
55
  "@emotion/react": "^11.10.0",
56
56
  "@emotion/styled": "^11.10.0",
@@ -1,10 +1,10 @@
1
1
  import { useEffect, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from '@emotion/styled';
4
3
  import { green, blue } from '@mui/material/colors';
5
4
 
6
5
  import Logo from '../Logo';
7
6
  import colors from '../Colors';
7
+ import { styled } from '../Theme';
8
8
 
9
9
  /**
10
10
  * ActivityIndicator is used when we want to tell the user the request they made on the UI will take time.
@@ -49,7 +49,7 @@ ActivityIndicator.defaultProps = {
49
49
  messages: ['Loading data...'],
50
50
  };
51
51
 
52
- const Div = styled.div`
52
+ const Div = styled('div')`
53
53
  && {
54
54
  box-sizing: border-box;
55
55
  padding: 20px;
@@ -112,7 +112,7 @@ Orbit.defaultProps = {
112
112
  duration: 2,
113
113
  };
114
114
 
115
- const OrbitRoot = styled.div`
115
+ const OrbitRoot = styled('div')`
116
116
  @keyframes orbit {
117
117
  0% {
118
118
  transform: rotate(0deg);
@@ -1,11 +1,11 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
2
  import Typography from '@mui/material/Typography';
4
3
  import { blueGrey } from '@mui/material/colors';
5
4
 
6
5
  import Icon from '../Icon';
7
6
  import { mergeProps } from '../Util';
8
7
  import colors from '../Colors';
8
+ import { styled } from '../Theme';
9
9
 
10
10
  const types = {
11
11
  error: {
@@ -74,7 +74,7 @@ Alert.defaultProps = {
74
74
 
75
75
  export default Alert;
76
76
 
77
- const Container = styled.div`
77
+ const Container = styled('div')`
78
78
  display: flex;
79
79
  align-items: center;
80
80
  font-size: 16px;
@@ -1,8 +1,9 @@
1
1
  import { useState, useEffect, useRef } from 'react';
2
- import styled from '@emotion/styled';
3
2
  import PropTypes from 'prop-types';
4
3
  import Lottie from 'react-lottie-player';
4
+
5
5
  import lottieJson from './default-animation.json';
6
+ import { styled } from '../Theme';
6
7
 
7
8
  /**
8
9
  * 用于长时间等待的用的动画组件
@@ -191,7 +192,7 @@ AnimationWaiter.defaultProps = {
191
192
  increaseSpeed: 0,
192
193
  };
193
194
 
194
- const Container = styled.div`
195
+ const Container = styled('div')`
195
196
  display: flex;
196
197
  justify-content: center;
197
198
  align-items: center;
@@ -1,11 +1,10 @@
1
1
  import { forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from '@emotion/styled';
4
-
5
3
  import Typography from '@mui/material/Typography';
6
4
 
7
5
  import colors from '../Colors';
8
6
  import { mergeProps } from '../Util';
7
+ import { styled } from '../Theme';
9
8
 
10
9
  const types = {
11
10
  error: {
@@ -1,15 +1,14 @@
1
- import styled from '@emotion/styled';
2
1
  import PropTypes from 'prop-types';
3
2
  import Typography from '@mui/material/Typography';
4
3
  import CircularProgress from '@mui/material/CircularProgress';
5
4
  import Avatar from '@arcblock/did-connect/lib/Avatar';
6
- import { useTheme } from '@mui/material/styles';
7
5
  import useMediaQuery from '@mui/material/useMediaQuery';
8
6
 
9
7
  import Button from '../Button';
10
8
  import Img from '../Img';
9
+ import { useTheme, styled } from '../Theme';
11
10
 
12
- const Div = styled.div`
11
+ const Div = styled('div')`
13
12
  &.arcblock-blocklet {
14
13
  padding: ${(props) => props.theme.spacing(2)} ${(props) => props.theme.spacing(2)} 0
15
14
  ${(props) => props.theme.spacing(2)};
@@ -1,6 +1,6 @@
1
- import styled from '@emotion/styled';
1
+ import { styled } from '../Theme';
2
2
 
3
- const ActionButton = styled.div`
3
+ const ActionButton = styled('div')`
4
4
  background-color: transparent !important;
5
5
  & > :not(.Mui-disabled) {
6
6
  position: relative;
@@ -1,16 +1,15 @@
1
1
  import { useRef } from 'react';
2
- import styled from '@emotion/styled';
3
2
  import PropTypes from 'prop-types';
4
3
  import Portal from '@mui/material/Portal';
5
4
  import Typography from '@mui/material/Typography';
6
5
  import CircularProgress from '@mui/material/CircularProgress';
7
6
  import useMediaQuery from '@mui/material/useMediaQuery';
8
- import { useTheme } from '@mui/material/styles';
9
7
  import Avatar from '@arcblock/did-connect/lib/Avatar';
10
8
 
11
9
  import Icon from '../Icon';
12
10
  import Button from '../Button';
13
11
  import Img from '../Img';
12
+ import { useTheme, styled } from '../Theme';
14
13
 
15
14
  /**
16
15
  * 美化数字 1000-->1k
@@ -29,7 +28,7 @@ function prettySize(_size, digits = 1) {
29
28
  return _size && `${size}${list[index]}`;
30
29
  }
31
30
 
32
- const Div = styled.div`
31
+ const Div = styled('div')`
33
32
  &.arcblock-blocklet {
34
33
  padding: 0 16px;
35
34
  background: ${(props) => props.theme.palette.common.white};
@@ -1,6 +1,7 @@
1
- import styled from '@emotion/styled';
2
1
  import PropTypes from 'prop-types';
3
2
 
3
+ import { styled } from '../Theme';
4
+
4
5
  /**
5
6
  *
6
7
  * @param {string} relative 容器相对尺寸,默认相对屏幕(screen),可设置为父容器(parent)
@@ -19,7 +20,7 @@ export default function Center({ children, relative }) {
19
20
  return <Div style={style}>{children}</Div>;
20
21
  }
21
22
 
22
- const Div = styled.div`
23
+ const Div = styled('div')`
23
24
  flex: 1;
24
25
  width: 100vw;
25
26
  height: 100vh;
@@ -2,10 +2,11 @@ import PropTypes from 'prop-types';
2
2
  import useWindowSize from 'react-use/lib/useWindowSize';
3
3
  import Tooltip from '@mui/material/Tooltip';
4
4
  import Typography from '@mui/material/Typography';
5
- import styled from '@emotion/styled';
5
+
6
6
  import useCopy from './hook';
7
7
  import Toast, { ToastProvider } from '../Toast';
8
8
  import { mergeProps } from '../Util';
9
+ import { styled } from '../Theme';
9
10
 
10
11
  export { default as CopyButton } from './copy-button';
11
12
 
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable react/no-danger */
2
2
  import { useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import styled from '@emotion/styled';
5
4
  import Copy from 'copy-to-clipboard';
6
5
  import Button from '@mui/material/IconButton';
7
6
  import useMountedState from 'react-use/lib/useMountedState';
@@ -27,6 +26,7 @@ import 'highlight.js/styles/atom-one-dark.css';
27
26
  import CopyIcon from '@mui/icons-material/FileCopy';
28
27
  import CheckIcon from '@mui/icons-material/Check';
29
28
  import colors from '../Colors';
29
+ import { styled } from '../Theme';
30
30
 
31
31
  hljs.registerLanguage('javascript', javascript);
32
32
  hljs.registerLanguage('js', javascript);
@@ -100,7 +100,7 @@ CodeBlock.defaultProps = {
100
100
  };
101
101
 
102
102
  const fontFamily = 'source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !important';
103
- const Pre = styled.pre`
103
+ const Pre = styled('pre')`
104
104
  font-family: ${fontFamily};
105
105
  display: block;
106
106
  font-size: 14px;
@@ -2,14 +2,13 @@
2
2
  /* eslint-disable react/static-property-placement */
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import styled from '@emotion/styled';
6
5
  import axios from 'axios';
7
-
8
6
  import Typography from '@mui/material/Typography';
9
7
  import CircularProgress from '@mui/material/CircularProgress';
10
8
 
11
9
  import { mergeProps } from '../Util';
12
10
  import Button from '../Button';
11
+ import { styled } from '../Theme';
13
12
 
14
13
  export async function submitContactForm({ formId, portalId }, fields, context) {
15
14
  const url = `https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`;
@@ -188,7 +187,7 @@ export default class ContactForm extends React.Component {
188
187
  // prettier-ignore
189
188
  const getInputWidth = props => (props.layout === 'vertical' ? '100%' : `${Math.max(95 / (props.fieldCount + 1), 20)}%`);
190
189
 
191
- const Form = styled.form`
190
+ const Form = styled('form')`
192
191
  display: flex;
193
192
  flex-direction: column;
194
193
  justify-content: center;
@@ -1,8 +1,9 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
2
  import Button from '@mui/material/Button';
4
3
  import CookieConsent, { resetCookieConsentValue } from 'react-cookie-consent';
5
4
 
5
+ import { styled } from '../Theme';
6
+
6
7
  export { resetCookieConsentValue };
7
8
 
8
9
  const translations = {
@@ -59,7 +60,7 @@ DefaultCookieConsent.defaultProps = {
59
60
  locale: 'en',
60
61
  };
61
62
 
62
- const Wrapper = styled.div`
63
+ const Wrapper = styled('div')`
63
64
  box-sizing: border-box;
64
65
  position: fixed;
65
66
  right: 20px;
@@ -1,8 +1,8 @@
1
1
  import { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from '@emotion/styled';
4
3
 
5
4
  import { getColor, mergeProps } from '../Util';
5
+ import { styled } from '../Theme';
6
6
 
7
7
  const SECONDS_OF_MINUTE = 60;
8
8
  const SECONDS_OF_HOUR = 60 * SECONDS_OF_MINUTE;
@@ -99,7 +99,7 @@ CountDown.defaultProps = {
99
99
  const textBackground = `linear-gradient(to bottom, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
100
100
  linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5) 77%, rgba(0, 0, 0, 0.5))`;
101
101
 
102
- const Container = styled.div`
102
+ const Container = styled('div')`
103
103
  color: ${(props) => getColor(props)};
104
104
  font-size: 50px;
105
105
  display: flex;
@@ -1,7 +1,6 @@
1
1
  import { useState, useRef, useEffect, isValidElement } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { TableFilter, TableViewCol } from 'mui-datatables';
4
- import styled from '@emotion/styled';
5
4
  import ReactToPrint, { PrintContextConsumer } from 'react-to-print';
6
5
  import IconButton from '@mui/material/IconButton';
7
6
  import Tooltip from '@mui/material/Tooltip';
@@ -16,11 +15,11 @@ import MenuItem from '@mui/material/MenuItem';
16
15
  import ListItemIcon from '@mui/material/ListItemIcon';
17
16
  import ListItemText from '@mui/material/ListItemText';
18
17
  import useMediaQuery from '@mui/material/useMediaQuery';
19
- import { useTheme } from '@mui/material/styles';
20
18
  import LinearProgress from '@mui/material/LinearProgress';
21
19
  import { handleCSVDownload } from './utils';
22
20
  import TableSearch from './TableSearch';
23
21
  import { useDatatableContext } from './DatatableContext';
22
+ import { styled, useTheme } from '../Theme';
24
23
 
25
24
  function useMobile() {
26
25
  const theme = useTheme();
@@ -351,7 +350,7 @@ CustomToolbar.defaultProps = {
351
350
  searchText: null,
352
351
  };
353
352
 
354
- const Container = styled.div`
353
+ const Container = styled('div')`
355
354
  display: flex;
356
355
  align-items: center;
357
356
  height: 56px;
@@ -413,7 +412,7 @@ const Container = styled.div`
413
412
  }
414
413
  `;
415
414
 
416
- const ProgressContainer = styled.div`
415
+ const ProgressContainer = styled('div')`
417
416
  width: 100%;
418
417
  height: 2px;
419
418
  .toolbar-progress {
@@ -5,9 +5,9 @@ import Tooltip from '@mui/material/Tooltip';
5
5
  import SearchIcon from '@mui/icons-material/Search';
6
6
  import TextField from '@mui/material/TextField';
7
7
  import ClearIcon from '@mui/icons-material/Clear';
8
- import styled from '@emotion/styled';
9
8
  import clsx from 'clsx';
10
9
  import { useDatatableContext } from './DatatableContext';
10
+ import { styled } from '../Theme';
11
11
 
12
12
  export default function TableSearch({ search, options, searchText, searchTextUpdate, searchClose, onSearchOpen }) {
13
13
  const { searchOpen, searchPlaceholder, searchAlwaysOpen } = options;
@@ -113,7 +113,7 @@ TableSearch.defaultProps = {
113
113
  onSearchOpen: () => {},
114
114
  };
115
115
 
116
- const Container = styled.div`
116
+ const Container = styled('div')`
117
117
  display: flex;
118
118
  align-items: center;
119
119
  .toolbar-search-area {
@@ -2,7 +2,6 @@
2
2
  import { useEffect, useRef, isValidElement } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import MUIDataTable, { TableFilterList, TableFooter } from 'mui-datatables';
5
- import styled from '@emotion/styled';
6
5
  import { css } from '@emotion/react';
7
6
  import isObject from 'lodash/isObject';
8
7
  import cloneDeep from 'lodash/cloneDeep';
@@ -12,6 +11,7 @@ import Empty from '../Empty';
12
11
  import Spinner from '../Spinner';
13
12
  import CustomToolbar from './CustomToolbar';
14
13
  import { DatatableProvider, useDatatableContext } from './DatatableContext';
14
+ import { styled } from '../Theme';
15
15
 
16
16
  export default function Datatable({ ...props }) {
17
17
  return (
@@ -382,7 +382,7 @@ const alignCss = css`
382
382
  }
383
383
  `;
384
384
 
385
- const TableContainer = styled.div`
385
+ const TableContainer = styled('div')`
386
386
  &.datatable-hide-header {
387
387
  thead.MuiTableHead-root {
388
388
  display: none;
@@ -474,7 +474,7 @@ const TableContainer = styled.div`
474
474
  }
475
475
  `;
476
476
 
477
- const FilterLine = styled.div`
477
+ const FilterLine = styled('div')`
478
478
  display: flex;
479
479
  align-items: center;
480
480
  .toolbar-filter-content {
@@ -522,7 +522,7 @@ function WrapTableFooter(props) {
522
522
  );
523
523
  }
524
524
 
525
- const FooterContainer = styled.div`
525
+ const FooterContainer = styled('div')`
526
526
  display: flex;
527
527
  align-items: center;
528
528
  .datatable-footer {
@@ -1,13 +1,13 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
2
  import MuiDialog from '@mui/material/Dialog';
4
3
  import MuiDialogContent from '@mui/material/DialogContent';
5
4
  import DialogActions from '@mui/material/DialogActions';
6
5
  import IconButton from '@mui/material/IconButton';
7
6
  import useMediaQuery from '@mui/material/useMediaQuery';
8
- import { useTheme } from '@mui/material/styles';
9
7
  import CloseIcon from '@mui/icons-material/Close';
10
8
 
9
+ import { styled, useTheme } from '../Theme';
10
+
11
11
  /**
12
12
  * Dialog
13
13
  *
@@ -108,7 +108,7 @@ const StyledMuiDialog = styled(MuiDialog)`
108
108
  }
109
109
  `;
110
110
 
111
- const Header = styled.div`
111
+ const Header = styled('div')`
112
112
  display: flex;
113
113
  justify-content: space-between;
114
114
  align-items: center;
@@ -2,13 +2,13 @@
2
2
  import { useReducer, useRef, useEffect } from 'react';
3
3
  import useSpring from 'react-use/lib/useSpring';
4
4
  import PropTypes from 'prop-types';
5
- import styled from '@emotion/styled';
6
5
  import * as d3 from 'd3-geo';
7
6
  import * as topojson from 'topojson-client';
8
7
  import versor from 'versor';
9
8
 
10
9
  import json from './countries.json';
11
10
  import util from './util';
11
+ import { styled } from '../Theme';
12
12
 
13
13
  const geoJson = topojson.feature(json, json.objects.ne_110m_admin_0_countries);
14
14
  const themes = {
@@ -371,7 +371,7 @@ Earth.defaultProps = {
371
371
  colors: {},
372
372
  };
373
373
 
374
- const Container = styled.div`
374
+ const Container = styled('div')`
375
375
  background-color: ${(props) => (props.theme === 'light' ? '#f7f7f7' : '#222')};
376
376
  width: ${(props) => props.width}px;
377
377
  height: ${(props) => props.height}px;
@@ -454,7 +454,7 @@ const Container = styled.div`
454
454
  }
455
455
  `;
456
456
 
457
- const Tooltip = styled.div`
457
+ const Tooltip = styled('div')`
458
458
  position: absolute;
459
459
  width: auto;
460
460
  min-width: 90px;
@@ -1,8 +1,9 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
2
+
3
3
  import Icon from '../Icon';
4
+ import { styled } from '../Theme';
4
5
 
5
- const Wrapper = styled.div`
6
+ const Wrapper = styled('div')`
6
7
  display: flex;
7
8
  justify-content: center;
8
9
  align-items: center;
@@ -1,8 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
- import { useTheme } from '@mui/material/styles';
4
2
  import { red } from '@mui/material/colors';
5
3
  import Button from '../Button';
4
+ import { styled, useTheme } from '../Theme';
6
5
 
7
6
  function InternalErrorFallback({ title, desc, retryFunc }) {
8
7
  const theme = useTheme();
@@ -46,7 +45,7 @@ ErrorFallbackRetry.propTypes = {
46
45
  resetErrorBoundary: PropTypes.func.isRequired,
47
46
  };
48
47
 
49
- const Root = styled.div`
48
+ const Root = styled('div')`
50
49
  padding: 16px;
51
50
  border: 2px solid ${(props) => props.$theme.palette.error.main};
52
51
  border-radius: 4px;
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable react/no-unused-prop-types */
2
2
  import PropTypes from 'prop-types';
3
- import styled from '@emotion/styled';
4
3
  import Typography from '@mui/material/Typography';
5
4
  import MuiContainer from '@mui/material/Container';
6
5
 
7
6
  import { mergeProps } from '../Util';
8
7
  import Logo from '../Logo';
8
+ import { styled } from '../Theme';
9
9
 
10
10
  export default function Footer(props) {
11
11
  const newProps = mergeProps(props, Footer, ['dark', 'style']);
@@ -49,7 +49,7 @@ Footer.defaultProps = {
49
49
  style: {},
50
50
  };
51
51
 
52
- const Container = styled.div`
52
+ const Container = styled('div')`
53
53
  margin-top: 64px;
54
54
  padding: 24px 0 32px;
55
55
  border-top: 1px solid ${(props) => (props.dark ? props.theme.palette.grey[900] : '#dee2e7')};
@@ -1,7 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
2
  import Box from '@mui/material/Box';
4
3
 
4
+ import { styled } from '../Theme';
5
+
5
6
  /**
6
7
  * 一个容器组件, 当子元素 width 超出该容器时自动隐藏子元素, 必须设置明确的 height 值
7
8
  */