@arcblock/ux 2.4.1 → 2.4.4

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 (129) 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/BaseScreenshot/index.js +84 -0
  49. package/lib/Screenshot/BaseScreenshot/shells/Phone.js +57 -0
  50. package/lib/Screenshot/index.js +123 -10
  51. package/lib/SplitButton/index.js +4 -4
  52. package/lib/Switch/index.js +3 -3
  53. package/lib/Tabs/index.js +3 -3
  54. package/lib/Tag/index.js +4 -6
  55. package/lib/TextCollapse/index.js +2 -2
  56. package/lib/Theme/index.js +16 -0
  57. package/lib/Theme/theme-provider.js +3 -8
  58. package/lib/Theme/theme.js +4 -2
  59. package/lib/Video/index.js +3 -4
  60. package/lib/Wallet/Action.js +3 -4
  61. package/lib/Wallet/Download.js +3 -4
  62. package/lib/Wallet/Open.js +3 -3
  63. package/lib/WechatPrompt/index.js +3 -3
  64. package/lib/withTheme/index.js +18 -40
  65. package/package.json +4 -4
  66. package/src/ActivityIndicator/index.js +3 -3
  67. package/src/Alert/index.js +2 -2
  68. package/src/AnimationWaiter/index.js +3 -2
  69. package/src/Badge/index.js +1 -2
  70. package/src/Blocklet/blocklet.js +2 -3
  71. package/src/Blocklet/utils.js +2 -2
  72. package/src/BlockletNFT/index.js +2 -3
  73. package/src/Center/index.js +3 -2
  74. package/src/ClickToCopy/index.js +2 -1
  75. package/src/CodeBlock/index.js +2 -2
  76. package/src/ContactForm/index.js +2 -3
  77. package/src/CookieConsent/index.js +3 -2
  78. package/src/CountDown/index.js +2 -2
  79. package/src/Datatable/CustomToolbar.js +3 -4
  80. package/src/Datatable/TableSearch.js +2 -2
  81. package/src/Datatable/index.js +4 -4
  82. package/src/Dialog/dialog.js +3 -3
  83. package/src/Earth/index.js +3 -3
  84. package/src/Empty/index.js +3 -2
  85. package/src/ErrorBoundary/fallback.js +2 -3
  86. package/src/Footer/index.js +2 -2
  87. package/src/Header/auto-hidden.js +2 -1
  88. package/src/Header/header.js +2 -3
  89. package/src/Header/responsive-header.js +1 -2
  90. package/src/Icon/image.js +2 -2
  91. package/src/Icon/index.js +2 -2
  92. package/src/Img/index.js +1 -1
  93. package/src/InfoRow/index.js +3 -2
  94. package/src/Layout/dashboard/index.js +2 -3
  95. package/src/Layout/dashboard/sidebar.js +3 -3
  96. package/src/Layout/dashboard-legacy/header.js +1 -1
  97. package/src/Layout/dashboard-legacy/index.js +2 -2
  98. package/src/Layout/dashboard-legacy/sidebar.js +2 -4
  99. package/src/Layout/index.js +3 -3
  100. package/src/Locale/selector.js +2 -4
  101. package/src/Logo/index.js +3 -2
  102. package/src/Metric/index.js +2 -2
  103. package/src/NFTDisplay/aspect-ratio-container.js +3 -2
  104. package/src/NFTDisplay/broken.js +2 -1
  105. package/src/NFTDisplay/index.js +3 -2
  106. package/src/NFTDisplay/loading.js +2 -2
  107. package/src/NFTDisplay/svg-embedder/inline-svg.js +3 -2
  108. package/src/NavMenu/style.js +2 -2
  109. package/src/PricingTable/PricingPlan.js +2 -2
  110. package/src/PricingTable/index.js +2 -2
  111. package/src/Result/common.js +1 -1
  112. package/src/Result/result.js +3 -2
  113. package/src/Screenshot/BaseScreenshot/index.jsx +77 -0
  114. package/src/Screenshot/BaseScreenshot/shells/Phone.jsx +33 -0
  115. package/src/Screenshot/index.js +99 -7
  116. package/src/SplitButton/index.js +2 -1
  117. package/src/Switch/index.js +1 -1
  118. package/src/Tabs/index.js +1 -1
  119. package/src/Tag/index.js +1 -3
  120. package/src/TextCollapse/index.js +2 -2
  121. package/src/Theme/index.js +1 -0
  122. package/src/Theme/theme-provider.js +4 -7
  123. package/src/Theme/theme.js +5 -3
  124. package/src/Video/index.js +2 -3
  125. package/src/Wallet/Action.js +2 -3
  126. package/src/Wallet/Download.js +2 -3
  127. package/src/Wallet/Open.js +2 -1
  128. package/src/WechatPrompt/index.js +2 -3
  129. package/src/withTheme/index.js +41 -54
@@ -1,18 +1,19 @@
1
1
  /* eslint-disable react-hooks/rules-of-hooks */
2
2
  import { useRef, useEffect, useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import styled from '@emotion/styled';
5
4
  import clsx from 'clsx';
6
5
  import { Buffer } from 'buffer';
7
6
  import get from 'lodash/get';
8
7
  import pako from 'pako';
9
8
  import base64 from 'base64-url';
10
9
  import isSvg from 'is-svg';
10
+
11
11
  import AspectRatioContainer from './aspect-ratio-container';
12
12
  import ImgSvgEmbedder from './svg-embedder/img';
13
13
  import InlineSvgEmbedder from './svg-embedder/inline-svg';
14
14
  import DefaultLoading from './loading';
15
15
  import DefaultBrokenImage from './broken';
16
+ import { styled } from '../Theme';
16
17
 
17
18
  /**
18
19
  * 从 assetState 中获取 nft data, 兼容新旧两种类型的数据结构, 建议将该方法的返回值传入 NFTDisplay 组件的 data prop
@@ -220,7 +221,7 @@ NFTDisplay.defaultProps = {
220
221
  onCompleted: () => {},
221
222
  };
222
223
 
223
- const Root = styled.div`
224
+ const Root = styled('div')`
224
225
  display: flex;
225
226
  justify-content: center;
226
227
  align-items: center;
@@ -1,10 +1,10 @@
1
- import styled from '@emotion/styled';
1
+ import { styled } from '../Theme';
2
2
 
3
3
  export default function Loading() {
4
4
  return <Root className="nft-display__loading">loading...</Root>;
5
5
  }
6
6
 
7
- const Root = styled.span`
7
+ const Root = styled('span')`
8
8
  display: flex;
9
9
  justify-content: center;
10
10
  align-items: center;
@@ -1,7 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
2
  import root from 'react-shadow/emotion';
4
3
 
4
+ import { styled } from '../../Theme';
5
+
5
6
  /**
6
7
  * inline svg 的方式嵌入 svg, 使用 shadow DOM 避免样式污染
7
8
  */
@@ -23,7 +24,7 @@ const Root = styled(root.span)`
23
24
  height: 100%;
24
25
  `;
25
26
 
26
- const Inner = styled.div`
27
+ const Inner = styled('div')`
27
28
  &,
28
29
  & > svg {
29
30
  height: 100%;
@@ -1,6 +1,6 @@
1
- import styled from '@emotion/styled';
1
+ import { styled } from '../Theme';
2
2
 
3
- const NavMenuBase = styled.nav`
3
+ const NavMenuBase = styled('nav')`
4
4
  background-color: ${(props) => props.$bgColor};
5
5
  font-size: 16px;
6
6
  ul {
@@ -1,11 +1,11 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
-
4
2
  import Card from '@mui/material/Card';
5
3
  import Button from '@mui/material/Button';
6
4
  import CardContent from '@mui/material/CardContent';
7
5
  import Typography from '@mui/material/Typography';
8
6
 
7
+ import { styled } from '../Theme';
8
+
9
9
  function PricingPlan({ plan }) {
10
10
  return (
11
11
  <PlanCard $shadow>
@@ -1,8 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
2
  import Grid from '@mui/material/Grid';
4
3
 
5
4
  import PricingPlan from './PricingPlan';
5
+ import { styled } from '../Theme';
6
6
 
7
7
  function PricingTable({ plans }) {
8
8
  if (plans && plans.length > 0) {
@@ -28,7 +28,7 @@ PricingTable.propTypes = {
28
28
  plans: PropTypes.array.isRequired,
29
29
  };
30
30
 
31
- const Div = styled.div`
31
+ const Div = styled('div')`
32
32
  padding: 100px 0;
33
33
  text-align: center;
34
34
  background-color: ${(props) => (props.variant === 'even' ? '#fbfbfb' : '#ffffff')};
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  /* eslint-disable no-param-reassign */
3
- import { useTheme } from '@mui/material/styles';
4
3
  import InfoIcon from '@mui/icons-material/Info';
5
4
  import CancelRoundedIcon from '@mui/icons-material/CancelRounded';
6
5
  import Result from './result';
7
6
  import translations from './translations';
8
7
  import { useLocaleContext } from '../Locale/context';
8
+ import { useTheme } from '../Theme';
9
9
 
10
10
  // 优先使用显式指定的 locale, 再尝试使用 context 中的 locale, 最后使用默认 'en'
11
11
  const useLocale = (locale) => {
@@ -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
  function Result({ icon, title, description, extra, ...rest }) {
6
7
  return (
7
8
  <Root {...rest}>
@@ -42,7 +43,7 @@ Result.defaultProps = {
42
43
  extra: undefined,
43
44
  };
44
45
 
45
- const Root = styled.div`
46
+ const Root = styled('div')`
46
47
  box-sizing: border-box;
47
48
  display: flex;
48
49
  flex-direction: column;
@@ -0,0 +1,77 @@
1
+ import { styled } from '@arcblock/ux/lib/Theme';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import phone from './shells/Phone';
5
+
6
+ const map = {
7
+ phone,
8
+ };
9
+
10
+ function Screenshot({ width, children, type, sx, ...rest }) {
11
+ const _type = type.toLowerCase();
12
+
13
+ const { Shell, ratio, screenData, width: defaultWidth } = map[_type || 'phone'];
14
+
15
+ const Root = styled('div')`
16
+ position: relative;
17
+ display: inline-block;
18
+ width: ${width || `${defaultWidth}px`};
19
+ &:after {
20
+ display: block;
21
+ content: '';
22
+ padding-bottom: ${ratio * 100}%;
23
+ }
24
+ > svg {
25
+ display: block;
26
+ }
27
+
28
+ .screenshot--container {
29
+ position: absolute;
30
+ left: ${screenData.x * 100}%;
31
+ top: ${screenData.y * 100}%;
32
+ width: ${screenData.width * 100}%;
33
+ height: ${screenData.height * 100}%;
34
+ ${screenData.radius ? `border-radius: ${screenData.radius}` : ''};
35
+ background-color: #fff;
36
+ overflow: hidden;
37
+ > img {
38
+ display: block;
39
+ width: 100%;
40
+ height: 100%;
41
+ min-width: 100%;
42
+ min-height: 100%;
43
+ }
44
+ }
45
+
46
+ .absolute-size {
47
+ position: absolute;
48
+ left: 0;
49
+ top: 0;
50
+ width: 100%;
51
+ height: 100%;
52
+ }
53
+ `;
54
+
55
+ return (
56
+ <div style={{ display: 'flex', justifyContent: 'center' }}>
57
+ <Root {...rest}>
58
+ <Shell className="absolute-size" />
59
+ <div className="screenshot--container">{children}</div>
60
+ </Root>
61
+ </div>
62
+ );
63
+ }
64
+
65
+ Screenshot.propTypes = {
66
+ width: PropTypes.number,
67
+ type: PropTypes.string,
68
+ children: PropTypes.node.isRequired,
69
+ sx: PropTypes.object,
70
+ };
71
+ Screenshot.defaultProps = {
72
+ width: 0,
73
+ type: 'phone',
74
+ sx: {},
75
+ };
76
+
77
+ export default Screenshot;
@@ -0,0 +1,33 @@
1
+ export const width = 268;
2
+ export const height = 554;
3
+
4
+ export function Shell({ ...rest }) {
5
+ return (
6
+ <svg width="268" height="554" viewBox="0 0 268 554" fill="none" xmlns="http://www.w3.org/2000/svg" {...rest}>
7
+ <path
8
+ d="M37 7.5H230.929C247.222 7.5 260.429 20.7076 260.429 37V517C260.429 533.292 247.222 546.5 230.929 546.5H37C20.7076 546.5 7.5 533.292 7.5 517V37C7.5 20.7076 20.7076 7.5 37 7.5Z"
9
+ fill="#2F2F2F"
10
+ stroke="#2F2F2F"
11
+ strokeWidth="15"
12
+ />
13
+ </svg>
14
+ );
15
+ }
16
+
17
+ export const ratio = 798 / 386;
18
+
19
+ export const screenData = {
20
+ x: 15 / 384,
21
+ y: 15 / 794,
22
+ width: 354 / 384,
23
+ height: 764 / 794,
24
+ radius: '10% / 5%',
25
+ };
26
+
27
+ export default {
28
+ Shell,
29
+ ratio,
30
+ screenData,
31
+ width,
32
+ height,
33
+ };
@@ -1,8 +1,9 @@
1
- import { createElement, Children, cloneElement } from 'react';
1
+ import { createElement, Children, cloneElement, useEffect, useRef, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from '@emotion/styled';
4
3
 
5
4
  import { mergeProps } from '../Util';
5
+ import { styled } from '../Theme';
6
+ import BaseScreenshot from './BaseScreenshot';
6
7
 
7
8
  import './devices.css';
8
9
 
@@ -116,8 +117,8 @@ const findChildren = (children, returnArgWhenNotFound = true) => {
116
117
  // This component is built upon the awesome device.css lib
117
118
  // By default it will find and only render img/video tags in the children
118
119
  // If neither of them are found, the whole child tree is rendered
119
- function Screenshot(props) {
120
- const newProps = mergeProps(props, Screenshot, ['style', 'width', 'height']);
120
+ function OldScreenshot(props) {
121
+ const newProps = mergeProps(props, OldScreenshot, ['style', 'width', 'height']);
121
122
  const { type, children, style, className, width, height, ...rest } = newProps;
122
123
  const { zIndex = 0, borderRadius = 0 } = types[type] || {};
123
124
 
@@ -144,7 +145,7 @@ function Screenshot(props) {
144
145
  );
145
146
  }
146
147
 
147
- const Div = styled.div`
148
+ const Div = styled('div')`
148
149
  @media (max-width: ${(props) => types[props.type].width}px) {
149
150
  transform-origin: 0 0;
150
151
  transform: scale(${(props) => types[props.type].scale});
@@ -164,7 +165,7 @@ const Div = styled.div`
164
165
  }
165
166
  `;
166
167
 
167
- Screenshot.propTypes = {
168
+ OldScreenshot.propTypes = {
168
169
  type: PropTypes.oneOf(Object.keys(types)),
169
170
  children: PropTypes.any.isRequired,
170
171
  className: PropTypes.string,
@@ -173,7 +174,7 @@ Screenshot.propTypes = {
173
174
  style: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
174
175
  };
175
176
 
176
- Screenshot.defaultProps = {
177
+ OldScreenshot.defaultProps = {
177
178
  type: 'iphone-x',
178
179
  className: '',
179
180
  style: '{}',
@@ -181,4 +182,95 @@ Screenshot.defaultProps = {
181
182
  height: 0,
182
183
  };
183
184
 
185
+ /**
186
+ * 用于修正旧版 Screenshot 无法匹配尺寸的问题
187
+ * @param {*} props params to OldScreenshot
188
+ * @returns <OldScreenshot />
189
+ */
190
+ function ScreenFixer(props) {
191
+ const screenEl = useRef(null);
192
+ const [height, setHeight] = useState(undefined);
193
+ const [scale, setScale] = useState(null);
194
+
195
+ useEffect(() => {
196
+ let resizeObs;
197
+
198
+ const fixSize = () => {
199
+ const { clientWidth } = screenEl.current;
200
+
201
+ // 获取内部元素的宽高
202
+ const { clientWidth: targetWidth, clientHeight: targetHeight } = screenEl.current.children[0];
203
+
204
+ const realScale = clientWidth / targetWidth;
205
+ if (realScale < 1) {
206
+ setScale(realScale);
207
+ setHeight(realScale * targetHeight);
208
+ } else {
209
+ setScale(null);
210
+ setHeight(undefined);
211
+ }
212
+ };
213
+
214
+ if (screenEl.current) {
215
+ resizeObs = new ResizeObserver(fixSize);
216
+ resizeObs.observe(screenEl.current);
217
+ }
218
+
219
+ return () => {
220
+ if (resizeObs) {
221
+ resizeObs.disconnect();
222
+ }
223
+ };
224
+ // eslint-disable-next-line react-hooks/exhaustive-deps
225
+ }, [screenEl.current]);
226
+
227
+ return (
228
+ <ReScreen ref={screenEl} style={{ height }}>
229
+ <OldScreenshot {...props} style={{ transform: scale ? `scale(${scale})` : undefined }} />
230
+ </ReScreen>
231
+ );
232
+ }
233
+
234
+ const ReScreen = styled('div')`
235
+ div[type] {
236
+ transform: scale(1);
237
+ transform-origin: 0 0;
238
+ }
239
+ `;
240
+
241
+ function Screenshot({ type, src, children, style, sx, ...rest }) {
242
+ const _type = type.toLowerCase();
243
+
244
+ // 新版采用容器采用BaseScreenshot,svg集成,更容易拓展,响应式更好
245
+ if (['phone'].includes(_type)) {
246
+ return (
247
+ <BaseScreenshot type={_type} sx={{ ...sx, ...style }} {...rest}>
248
+ {children || (src ? <img src={src} alt="screenshot" /> : null)}
249
+ </BaseScreenshot>
250
+ );
251
+ }
252
+
253
+ // 旧版采用纯css制作,定制性欠缺,暂时保留使用
254
+ return (
255
+ <ScreenFixer type={type} {...rest} sx={{ ...sx, ...style, margin: 'auto' }}>
256
+ {children || (src ? <img src={src} alt="screenshot" /> : null)}
257
+ </ScreenFixer>
258
+ );
259
+ }
260
+
261
+ Screenshot.propTypes = {
262
+ type: PropTypes.string.isRequired,
263
+ src: PropTypes.string,
264
+ style: PropTypes.object,
265
+ sx: PropTypes.object,
266
+ children: PropTypes.any,
267
+ };
268
+
269
+ Screenshot.defaultProps = {
270
+ src: '',
271
+ children: null,
272
+ style: {},
273
+ sx: {},
274
+ };
275
+
184
276
  export default Screenshot;
@@ -1,6 +1,5 @@
1
1
  import { useState, useRef, isValidElement } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from '@emotion/styled';
4
3
  import ExpandMore from '@mui/icons-material/ExpandMore';
5
4
  import Popper from '@mui/material/Popper';
6
5
  import Paper from '@mui/material/Paper';
@@ -10,6 +9,8 @@ import MenuItem from '@mui/material/MenuItem';
10
9
  import ButtonGroup from '@mui/material/ButtonGroup';
11
10
  import Button from '@mui/material/Button';
12
11
 
12
+ import { styled } from '../Theme';
13
+
13
14
  /**
14
15
  * SplitButton allows the user to execute a default action which is bound to a Button or to choose a predefined action from a drop-down list.
15
16
  */
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
- import { styled } from '@mui/material/styles';
3
2
  import FormControlLabel from '@mui/material/FormControlLabel';
4
3
  import MuiSwitch from '@mui/material/Switch';
4
+ import { styled } from '../Theme';
5
5
 
6
6
  // 参考: https://mui.com/material-ui/react-switch/#customization
7
7
  const IOSSwitch = styled((props) => <MuiSwitch focusVisibleClassName=".Mui-focusVisible" disableRipple {...props} />)(
package/src/Tabs/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { styled } from '@mui/material/styles';
2
1
  import PropTypes from 'prop-types';
3
2
  import MuiTabs from '@mui/material/Tabs';
4
3
  import MuiTab from '@mui/material/Tab';
4
+ import { styled } from '../Theme';
5
5
 
6
6
  const PREFIX = 'index';
7
7
 
package/src/Tag/index.js CHANGED
@@ -1,12 +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
- import { useTheme } from '@mui/material/styles';
7
4
 
8
5
  import { mergeProps } from '../Util';
9
6
  import colors from '../Colors';
7
+ import { useTheme, styled } from '../Theme';
10
8
 
11
9
  const types = {
12
10
  error: {
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
-
3
2
  import Typography from '@mui/material/Typography';
4
- import styled from '@emotion/styled';
3
+
4
+ import { styled } from '../Theme';
5
5
 
6
6
  export default function TextCollapse({
7
7
  children,
@@ -1,2 +1,3 @@
1
1
  export * from './theme';
2
+ export { styled, useTheme } from '@mui/material/styles';
2
3
  export { default as ThemeProvider } from './theme-provider';
@@ -1,11 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
- import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
3
2
  import { ThemeProvider as MuiThemeProvider } from '@mui/material/styles';
4
3
  import StyledEngineProvider from '@mui/material/StyledEngineProvider';
5
4
  import CssBaseline from '@mui/material/CssBaseline';
6
- import { create } from './theme';
5
+ import { createTheme } from './theme';
7
6
 
8
- const defaultTheme = create();
7
+ const defaultTheme = createTheme();
9
8
 
10
9
  /**
11
10
  * 默认的 theme provider, 可以为 webapp/blocklet 快捷的配置好 mui theme provider
@@ -15,10 +14,8 @@ export default function ThemeProvider({ children, theme, injectFirst }) {
15
14
  // injectFirst 会影响 makeStyles 自定义样式和 mui styles 覆盖问题
16
15
  <StyledEngineProvider injectFirst={injectFirst}>
17
16
  <MuiThemeProvider theme={theme}>
18
- <EmotionThemeProvider theme={theme}>
19
- <CssBaseline />
20
- {children}
21
- </EmotionThemeProvider>
17
+ <CssBaseline />
18
+ {children}
22
19
  </MuiThemeProvider>
23
20
  </StyledEngineProvider>
24
21
  );
@@ -1,10 +1,10 @@
1
1
  // https://app.zeplin.io/styleguide/5d1436f1e97c2156f49c0725/colors
2
- import { createTheme, responsiveFontSizes } from '@mui/material/styles';
2
+ import { createTheme as _createTheme, responsiveFontSizes } from '@mui/material/styles';
3
3
  import '@fontsource/lato/400.css';
4
4
  import '@fontsource/lato/700.css';
5
5
  import colors from '../Colors';
6
6
 
7
- const muiDarkTheme = createTheme({ palette: { mode: 'dark' } });
7
+ const muiDarkTheme = _createTheme({ palette: { mode: 'dark' } });
8
8
 
9
9
  // https://material-ui.com/customization/default-theme/
10
10
  // eslint-disable-next-line import/prefer-default-export
@@ -37,7 +37,7 @@ export const create = ({ mode = 'light', pageWidth = 'md', palette, typography,
37
37
  palette || {}
38
38
  );
39
39
 
40
- const theme = createTheme({
40
+ const theme = _createTheme({
41
41
  themeName: 'ArcBlock',
42
42
  palette: _palette,
43
43
  typography: Object.assign(
@@ -162,3 +162,5 @@ export const create = ({ mode = 'light', pageWidth = 'md', palette, typography,
162
162
 
163
163
  return enhanced;
164
164
  };
165
+
166
+ export const createTheme = create;
@@ -1,11 +1,10 @@
1
1
  import { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Player from 'react-player';
4
- import styled from '@emotion/styled';
5
-
6
4
  import CircularProgress from '@mui/material/CircularProgress';
7
5
 
8
6
  import { mergeProps } from '../Util';
7
+ import { styled } from '../Theme';
9
8
 
10
9
  const { string, number, array, oneOfType, object } = PropTypes;
11
10
 
@@ -50,7 +49,7 @@ Video.defaultProps = {
50
49
  style: {},
51
50
  };
52
51
 
53
- const Placeholder = styled.div`
52
+ const Placeholder = styled('div')`
54
53
  background-color: #222222;
55
54
  display: flex;
56
55
  justify-content: center;
@@ -1,12 +1,11 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
-
4
2
  import Typography from '@mui/material/Typography';
5
3
 
6
4
  import logo from './images/abtwallet.png';
7
5
  import { mergeProps } from '../Util';
8
6
  import colors from '../Colors';
9
7
  import Button from '../Button';
8
+ import { styled } from '../Theme';
10
9
 
11
10
  export default function WalletAction(props) {
12
11
  const newProps = mergeProps(props, WalletAction, ['style']);
@@ -62,7 +61,7 @@ const sizes = {
62
61
  },
63
62
  };
64
63
 
65
- const Content = styled.div`
64
+ const Content = styled('div')`
66
65
  display: flex;
67
66
  justify-content: center;
68
67
  align-items: center;
@@ -1,6 +1,4 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
-
4
2
  import Typography from '@mui/material/Typography';
5
3
  import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
6
4
 
@@ -10,6 +8,7 @@ import { ReactComponent as AndroidDownloadIcon } from './images/android_download
10
8
 
11
9
  import Button from '../Button';
12
10
  import { mergeProps } from '../Util';
11
+ import { styled } from '../Theme';
13
12
 
14
13
  export default function WalletDownload(props) {
15
14
  const browser = useBrowser();
@@ -97,7 +96,7 @@ WalletDownload.defaultProps = {
97
96
  locale: 'zh',
98
97
  };
99
98
 
100
- const Container = styled.div`
99
+ const Container = styled('div')`
101
100
  display: flex;
102
101
  flex-direction: ${(props) => (props.layout === 'vertical' ? 'column' : 'row')};
103
102
  align-items: center;
@@ -1,8 +1,9 @@
1
1
  import PropTypes from 'prop-types';
2
- import styled from '@emotion/styled';
3
2
  import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
4
3
  import Fab from '@mui/material/Fab';
5
4
 
5
+ import { styled } from '../Theme';
6
+
6
7
  export default function OpenInWallet({ locale, link }) {
7
8
  const buttonText = locale === 'zh' ? '在 DID 钱包打开' : 'Open in DID Wallet';
8
9
  const browser = useBrowser();
@@ -1,11 +1,10 @@
1
- import styled from '@emotion/styled';
2
-
3
1
  import Typography from '@mui/material/Typography';
4
2
  import Dialog from '@mui/material/Dialog';
5
3
  import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
6
4
 
7
5
  import IosImage from './images/ios.png';
8
6
  import AndroidImage from './images/android.png';
7
+ import { styled } from '../Theme';
9
8
 
10
9
  export default function WechatPrompt() {
11
10
  const browser = useBrowser();
@@ -45,7 +44,7 @@ export default function WechatPrompt() {
45
44
  );
46
45
  }
47
46
 
48
- const Container = styled.div`
47
+ const Container = styled('div')`
49
48
  .wechat-title {
50
49
  height: 80px;
51
50
  line-height: 80px;