@arcblock/ux 2.13.12 → 2.13.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ActivityIndicator/index.js +9 -5
- package/lib/Address/did-address.js +14 -7
- package/lib/BlockletV2/blocklet.js +1 -1
- package/lib/CloseButton/index.js +1 -2
- package/lib/Colors/index.d.ts +1 -3
- package/lib/Colors/index.js +2 -4
- package/lib/Colors/themes/default.d.ts +3 -66
- package/lib/Colors/themes/default.js +4 -74
- package/lib/Colors/themes/did-connect.d.ts +11 -6
- package/lib/Colors/themes/did-connect.js +17 -12
- package/lib/Colors/themes/temp.d.ts +3 -0
- package/lib/Colors/themes/temp.js +3 -0
- package/lib/Config/config-provider.d.ts +4 -5
- package/lib/Config/config-provider.js +7 -26
- package/lib/Config/theme-mode-toggle.js +0 -1
- package/lib/DID/index.js +3 -4
- package/lib/Datatable/CustomToolbar.js +3 -0
- package/lib/Datatable/index.js +105 -71
- package/lib/Footer/index.js +2 -5
- package/lib/Header/header.js +3 -1
- package/lib/Header/responsive-header.js +3 -1
- package/lib/Layout/dashboard/index.js +14 -2
- package/lib/Layout/dashboard/sidebar.js +1 -2
- package/lib/LoadingMask/index.js +4 -3
- package/lib/Locale/selector.js +3 -3
- package/lib/NavMenu/nav-menu.js +14 -9
- package/lib/NavMenu/products.js +3 -1
- package/lib/NavMenu/style.js +7 -3
- package/lib/NavMenu/sub-item-group.js +1 -1
- package/lib/PhoneInput/country-select.js +2 -3
- package/lib/SessionBlocklet/index.js +3 -3
- package/lib/SessionUser/components/did-space.js +14 -28
- package/lib/SessionUser/components/logged-in.js +2 -2
- package/lib/SessionUser/components/quick-login-item.js +13 -11
- package/lib/SessionUser/components/session-user-item.js +5 -6
- package/lib/SessionUser/components/session-user-switch.js +15 -13
- package/lib/SessionUser/components/un-login.js +9 -7
- package/lib/SessionUser/components/user-info.js +9 -8
- package/lib/SessionUser/images/did-spaces.svg +7 -13
- package/lib/Success/index.js +8 -4
- package/lib/Switch/index.js +3 -3
- package/lib/Tabs/index.js +8 -9
- package/lib/Theme/theme-provider.d.ts +5 -1
- package/lib/Theme/theme-provider.js +60 -5
- package/lib/Theme/theme.d.ts +6 -3
- package/lib/Theme/theme.js +55 -19
- package/lib/UserCard/Container/card.js +1 -1
- package/lib/UserCard/Container/dialog.js +1 -1
- package/lib/Util/index.d.ts +8 -0
- package/lib/Util/index.js +23 -1
- package/lib/type.d.ts +5 -1
- package/package.json +7 -6
- package/src/ActivityIndicator/index.jsx +4 -4
- package/src/Address/did-address.tsx +5 -5
- package/src/BlockletV2/blocklet.tsx +1 -1
- package/src/CloseButton/index.tsx +1 -2
- package/src/Colors/index.ts +2 -7
- package/src/Colors/themes/default.ts +4 -50
- package/src/Colors/themes/did-connect.ts +13 -6
- package/src/Colors/themes/temp.ts +3 -0
- package/src/Config/config-provider.tsx +17 -30
- package/src/Config/theme-mode-toggle.tsx +1 -1
- package/src/DID/index.tsx +3 -4
- package/src/Datatable/CustomToolbar.jsx +1 -0
- package/src/Datatable/index.jsx +107 -70
- package/src/Footer/index.tsx +2 -2
- package/src/Header/header.tsx +1 -1
- package/src/Header/responsive-header.tsx +2 -0
- package/src/Layout/dashboard/index.tsx +8 -4
- package/src/Layout/dashboard/sidebar.tsx +1 -2
- package/src/LoadingMask/index.tsx +3 -4
- package/src/Locale/selector.tsx +3 -4
- package/src/NavMenu/nav-menu.tsx +15 -10
- package/src/NavMenu/products.tsx +1 -1
- package/src/NavMenu/style.ts +5 -2
- package/src/NavMenu/sub-item-group.tsx +1 -1
- package/src/PhoneInput/country-select.tsx +2 -3
- package/src/SessionBlocklet/index.tsx +3 -3
- package/src/SessionUser/components/did-space.tsx +14 -10
- package/src/SessionUser/components/logged-in.tsx +2 -2
- package/src/SessionUser/components/quick-login-item.tsx +11 -12
- package/src/SessionUser/components/session-user-item.tsx +3 -6
- package/src/SessionUser/components/session-user-switch.tsx +13 -12
- package/src/SessionUser/components/un-login.tsx +7 -6
- package/src/SessionUser/components/user-info.tsx +7 -8
- package/src/SessionUser/images/did-spaces.svg +7 -13
- package/src/Success/index.tsx +6 -4
- package/src/Switch/index.jsx +3 -3
- package/src/Tabs/index.tsx +8 -9
- package/src/Theme/theme-provider.tsx +73 -2
- package/src/Theme/theme.ts +73 -22
- package/src/UserCard/Container/card.tsx +1 -1
- package/src/UserCard/Container/dialog.tsx +1 -1
- package/src/Util/index.ts +25 -0
- package/src/type.d.ts +5 -1
@@ -3,8 +3,7 @@ import { useEffect, useState } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import { green, blue } from '@mui/material/colors';
|
5
5
|
import Logo from '../Logo';
|
6
|
-
import
|
7
|
-
import { styled } from '../Theme';
|
6
|
+
import { styled, useTheme } from '../Theme';
|
8
7
|
|
9
8
|
/**
|
10
9
|
* ActivityIndicator is used when we want to tell the user the request they made on the UI will take time.
|
@@ -25,6 +24,9 @@ export default function ActivityIndicator({
|
|
25
24
|
...rest
|
26
25
|
}) {
|
27
26
|
const [index, setIndex] = useState(0);
|
27
|
+
const {
|
28
|
+
palette
|
29
|
+
} = useTheme();
|
28
30
|
useEffect(() => {
|
29
31
|
const timer = setInterval(() => {
|
30
32
|
setIndex((index + 1) % messages.length);
|
@@ -61,8 +63,8 @@ export default function ActivityIndicator({
|
|
61
63
|
duration: 1.5
|
62
64
|
}), /*#__PURE__*/_jsx(Orbit, {
|
63
65
|
size: 100,
|
64
|
-
orbitColor:
|
65
|
-
atomColor:
|
66
|
+
orbitColor: palette.grey[900],
|
67
|
+
atomColor: palette.grey[900]
|
66
68
|
})]
|
67
69
|
})]
|
68
70
|
})
|
@@ -92,7 +94,9 @@ const Div = styled('div')`
|
|
92
94
|
}
|
93
95
|
|
94
96
|
.pm-loader-text {
|
95
|
-
color: ${
|
97
|
+
color: ${({
|
98
|
+
theme
|
99
|
+
}) => theme.palette.grey[900]};
|
96
100
|
font-size: 14px;
|
97
101
|
text-align: center;
|
98
102
|
position: relative;
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import '@fontsource/ubuntu-mono/400.css';
|
3
3
|
import { Check as CheckIcon } from '@mui/icons-material';
|
4
4
|
import { Box, Tooltip } from '@mui/material';
|
5
|
-
import { green } from '@mui/material/colors';
|
6
5
|
import copy from 'copy-to-clipboard';
|
7
6
|
import noop from 'lodash/noop';
|
8
7
|
import CopyIcon from '@arcblock/icons/lib/Copy';
|
@@ -89,8 +88,8 @@ const DidAddress = /*#__PURE__*/forwardRef((props, ref) => {
|
|
89
88
|
open: copied,
|
90
89
|
children: /*#__PURE__*/_jsx(CheckIcon, {
|
91
90
|
className: "did-address-copy",
|
92
|
-
|
93
|
-
color:
|
91
|
+
sx: {
|
92
|
+
color: 'success.main'
|
94
93
|
}
|
95
94
|
})
|
96
95
|
}) :
|
@@ -168,7 +167,9 @@ const Root = styled(Box, {
|
|
168
167
|
}
|
169
168
|
|
170
169
|
.did-address-text {
|
171
|
-
color:
|
170
|
+
color: ${({
|
171
|
+
theme
|
172
|
+
}) => theme.palette.text.secondary};
|
172
173
|
}
|
173
174
|
/* truncate string with ellipsis */
|
174
175
|
.did-address-truncate {
|
@@ -188,16 +189,22 @@ const Root = styled(Box, {
|
|
188
189
|
.did-address-copy {
|
189
190
|
flex: 0 0 auto;
|
190
191
|
font-size: 1em;
|
191
|
-
color:
|
192
|
+
color: ${({
|
193
|
+
theme
|
194
|
+
}) => theme.palette.text.secondary};
|
192
195
|
cursor: pointer;
|
193
196
|
}
|
194
197
|
|
195
198
|
/* link */
|
196
199
|
a {
|
197
|
-
color:
|
200
|
+
color: ${({
|
201
|
+
theme
|
202
|
+
}) => theme.palette.text.secondary};
|
198
203
|
}
|
199
204
|
&:hover a {
|
200
|
-
color:
|
205
|
+
color: ${({
|
206
|
+
theme
|
207
|
+
}) => theme.palette.text.primary};
|
201
208
|
text-decoration: underline;
|
202
209
|
}
|
203
210
|
`;
|
package/lib/CloseButton/index.js
CHANGED
@@ -3,7 +3,6 @@ import { Box } from '@mui/material';
|
|
3
3
|
import { Icon } from '@iconify/react';
|
4
4
|
import CloseRoundedIcon from '@iconify-icons/material-symbols/close-rounded';
|
5
5
|
import noop from 'lodash/noop';
|
6
|
-
import { temp as colors } from '../Colors';
|
7
6
|
import { mergeSx } from '../Util/style';
|
8
7
|
export default function CloseButton({
|
9
8
|
onClose = noop,
|
@@ -15,7 +14,7 @@ export default function CloseButton({
|
|
15
14
|
sx: mergeSx({
|
16
15
|
fontSize: 0,
|
17
16
|
cursor: 'pointer',
|
18
|
-
color:
|
17
|
+
color: 'text.secondary',
|
19
18
|
transition: 'transform 0.25s ease-in-out 0s',
|
20
19
|
transformOrigin: 'center',
|
21
20
|
'&:hover': {
|
package/lib/Colors/index.d.ts
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
|
2
|
-
declare const colors: Theme["palette"];
|
3
|
-
export default colors;
|
1
|
+
export { default } from './themes/default';
|
4
2
|
export { default as temp } from './themes/temp';
|
5
3
|
export { default as didConnectColors } from './themes/did-connect';
|
package/lib/Colors/index.js
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
const colors = BLOCKLET_THEME_LIGHT.palette;
|
4
|
-
export default colors;
|
1
|
+
// eslint-disable-next-line no-restricted-exports
|
2
|
+
export { default } from './themes/default';
|
5
3
|
export { default as temp } from './themes/temp';
|
6
4
|
export { default as didConnectColors } from './themes/did-connect';
|
@@ -1,69 +1,6 @@
|
|
1
|
+
import { type Theme } from '@blocklet/theme';
|
1
2
|
/**
|
2
|
-
*
|
3
|
-
*
|
4
|
-
* - colors object 结构是在 mui theme#palette object 基础上调整后的结构
|
5
|
-
* - 色值在 mui default theme 基础上将 figma 中常用的 colors 进行覆盖
|
6
|
-
* - 扩展一些常用色值 (如 DID 系列)
|
7
|
-
* - figma: https://www.figma.com/file/1qHyMF137EXOQpSFVByszG/UX-Library?node-id=295%3A1518
|
3
|
+
* @deprecated 请使用 MUI theme 对象替代
|
8
4
|
*/
|
9
|
-
declare const colors:
|
10
|
-
common: {
|
11
|
-
black: string;
|
12
|
-
white: string;
|
13
|
-
};
|
14
|
-
primary: {
|
15
|
-
main: string;
|
16
|
-
contrastText: string;
|
17
|
-
};
|
18
|
-
secondary: {
|
19
|
-
main: string;
|
20
|
-
contrastText: string;
|
21
|
-
};
|
22
|
-
error: {
|
23
|
-
main: string;
|
24
|
-
contrastText: string;
|
25
|
-
};
|
26
|
-
warning: {
|
27
|
-
main: string;
|
28
|
-
contrastText: string;
|
29
|
-
};
|
30
|
-
info: {
|
31
|
-
main: string;
|
32
|
-
contrastText: string;
|
33
|
-
};
|
34
|
-
success: {
|
35
|
-
main: string;
|
36
|
-
contrastText: string;
|
37
|
-
};
|
38
|
-
grey: {
|
39
|
-
50: string;
|
40
|
-
100: string;
|
41
|
-
200: string;
|
42
|
-
300: string;
|
43
|
-
400: string;
|
44
|
-
500: string;
|
45
|
-
600: string;
|
46
|
-
700: string;
|
47
|
-
800: string;
|
48
|
-
900: string;
|
49
|
-
A100: string;
|
50
|
-
A200: string;
|
51
|
-
A400: string;
|
52
|
-
A700: string;
|
53
|
-
};
|
54
|
-
text: {
|
55
|
-
primary: string;
|
56
|
-
secondary: string;
|
57
|
-
disabled: string;
|
58
|
-
hint: string;
|
59
|
-
};
|
60
|
-
divider: string;
|
61
|
-
background: {
|
62
|
-
default: string;
|
63
|
-
};
|
64
|
-
did: {
|
65
|
-
primary: string;
|
66
|
-
secondary: string;
|
67
|
-
};
|
68
|
-
};
|
5
|
+
declare const colors: Theme["palette"];
|
69
6
|
export default colors;
|
@@ -1,77 +1,7 @@
|
|
1
|
+
import { BLOCKLET_THEME_LIGHT } from '@blocklet/theme';
|
2
|
+
|
1
3
|
/**
|
2
|
-
*
|
3
|
-
*
|
4
|
-
* - colors object 结构是在 mui theme#palette object 基础上调整后的结构
|
5
|
-
* - 色值在 mui default theme 基础上将 figma 中常用的 colors 进行覆盖
|
6
|
-
* - 扩展一些常用色值 (如 DID 系列)
|
7
|
-
* - figma: https://www.figma.com/file/1qHyMF137EXOQpSFVByszG/UX-Library?node-id=295%3A1518
|
4
|
+
* @deprecated 请使用 MUI theme 对象替代
|
8
5
|
*/
|
9
|
-
const colors =
|
10
|
-
common: {
|
11
|
-
black: '#000',
|
12
|
-
white: '#fff'
|
13
|
-
},
|
14
|
-
primary: {
|
15
|
-
main: '#3773F2',
|
16
|
-
contrastText: '#fff'
|
17
|
-
},
|
18
|
-
// override
|
19
|
-
secondary: {
|
20
|
-
main: '#16CED1',
|
21
|
-
contrastText: '#fff'
|
22
|
-
},
|
23
|
-
// override
|
24
|
-
error: {
|
25
|
-
main: '#F16E6E',
|
26
|
-
contrastText: '#fff'
|
27
|
-
},
|
28
|
-
// override
|
29
|
-
warning: {
|
30
|
-
main: '#DE9E37',
|
31
|
-
contrastText: '#fff'
|
32
|
-
},
|
33
|
-
// override
|
34
|
-
info: {
|
35
|
-
main: '#0775F8',
|
36
|
-
contrastText: '#fff'
|
37
|
-
},
|
38
|
-
// override
|
39
|
-
success: {
|
40
|
-
main: '#34BE74',
|
41
|
-
contrastText: '#fff'
|
42
|
-
},
|
43
|
-
// override
|
44
|
-
grey: {
|
45
|
-
50: '#fafafa',
|
46
|
-
100: '#f5f5f5',
|
47
|
-
200: '#eeeeee',
|
48
|
-
300: '#e0e0e0',
|
49
|
-
400: '#bdbdbd',
|
50
|
-
500: '#9e9e9e',
|
51
|
-
600: '#757575',
|
52
|
-
700: '#616161',
|
53
|
-
800: '#424242',
|
54
|
-
900: '#212121',
|
55
|
-
A100: '#d5d5d5',
|
56
|
-
A200: '#aaaaaa',
|
57
|
-
A400: '#303030',
|
58
|
-
A700: '#616161'
|
59
|
-
},
|
60
|
-
text: {
|
61
|
-
primary: 'rgba(0, 0, 0, 0.87)',
|
62
|
-
secondary: 'rgba(0, 0, 0, 0.54)',
|
63
|
-
disabled: 'rgba(0, 0, 0, 0.38)',
|
64
|
-
hint: 'rgba(0, 0, 0, 0.38)'
|
65
|
-
},
|
66
|
-
divider: 'rgba(0, 0, 0, 0.12)',
|
67
|
-
background: {
|
68
|
-
default: '#fff'
|
69
|
-
},
|
70
|
-
// 扩展色值, 适用于 did 相关的组件, 如果某些产品整体风格是 did 系列, 可以扩展出一个 did 系列的 theme
|
71
|
-
did: {
|
72
|
-
primary: '#4598FA',
|
73
|
-
secondary: '#49C3AD'
|
74
|
-
}
|
75
|
-
// TODO: 等设计规范稳定后, 考虑扩展 trade 相关的常用颜色 (send/receive/exchange/transfer)
|
76
|
-
};
|
6
|
+
const colors = BLOCKLET_THEME_LIGHT.palette;
|
77
7
|
export default colors;
|
@@ -1,3 +1,6 @@
|
|
1
|
+
/**
|
2
|
+
* @deprecated 请使用 MUI theme 对象替代
|
3
|
+
*/
|
1
4
|
declare const colors: {
|
2
5
|
background: {
|
3
6
|
overlay: string;
|
@@ -10,7 +13,7 @@ declare const colors: {
|
|
10
13
|
text: {
|
11
14
|
primary: string;
|
12
15
|
secondary: string;
|
13
|
-
|
16
|
+
disabled: string;
|
14
17
|
hint: string;
|
15
18
|
};
|
16
19
|
state: {
|
@@ -23,36 +26,38 @@ declare const colors: {
|
|
23
26
|
main: string;
|
24
27
|
light: string;
|
25
28
|
dark: string;
|
29
|
+
contrastText: string;
|
26
30
|
};
|
27
31
|
secondary: {
|
28
32
|
main: string;
|
29
33
|
light: string;
|
30
34
|
dark: string;
|
35
|
+
contrastText: string;
|
31
36
|
};
|
32
37
|
error: {
|
33
38
|
main: string;
|
34
39
|
light: string;
|
35
40
|
dark: string;
|
41
|
+
contrastText: string;
|
36
42
|
};
|
37
43
|
warning: {
|
38
44
|
main: string;
|
39
45
|
light: string;
|
40
46
|
dark: string;
|
47
|
+
contrastText: string;
|
41
48
|
};
|
42
49
|
info: {
|
43
50
|
main: string;
|
44
51
|
light: string;
|
45
52
|
dark: string;
|
53
|
+
contrastText: string;
|
46
54
|
};
|
47
55
|
success: {
|
48
56
|
main: string;
|
49
57
|
light: string;
|
50
58
|
dark: string;
|
59
|
+
contrastText: string;
|
51
60
|
};
|
52
|
-
divider:
|
53
|
-
main: string;
|
54
|
-
light: string;
|
55
|
-
dark: string;
|
56
|
-
};
|
61
|
+
divider: string;
|
57
62
|
};
|
58
63
|
export default colors;
|
@@ -1,3 +1,6 @@
|
|
1
|
+
/**
|
2
|
+
* @deprecated 请使用 MUI theme 对象替代
|
3
|
+
*/
|
1
4
|
const colors = {
|
2
5
|
background: {
|
3
6
|
overlay: 'rgba(15, 23, 42, 0.5)',
|
@@ -10,7 +13,7 @@ const colors = {
|
|
10
13
|
text: {
|
11
14
|
primary: '#18181B',
|
12
15
|
secondary: '#71717B',
|
13
|
-
|
16
|
+
disabled: '#D4D4D8',
|
14
17
|
hint: '#D4D4D8'
|
15
18
|
},
|
16
19
|
state: {
|
@@ -22,37 +25,39 @@ const colors = {
|
|
22
25
|
primary: {
|
23
26
|
main: '#2B7FFF',
|
24
27
|
light: '#51A2FF',
|
25
|
-
dark: '#155DFC'
|
28
|
+
dark: '#155DFC',
|
29
|
+
contrastText: '#fff'
|
26
30
|
},
|
27
31
|
secondary: {
|
28
32
|
main: '#615FFF',
|
29
33
|
light: '#7C86FF',
|
30
|
-
dark: '#4F39F6'
|
34
|
+
dark: '#4F39F6',
|
35
|
+
contrastText: '#fff'
|
31
36
|
},
|
32
37
|
error: {
|
33
38
|
main: '#FB2C36',
|
34
39
|
light: '#FF6467',
|
35
|
-
dark: '#E7000B'
|
40
|
+
dark: '#E7000B',
|
41
|
+
contrastText: '#fff'
|
36
42
|
},
|
37
43
|
warning: {
|
38
44
|
main: '#FF6900',
|
39
45
|
light: '#FF8904',
|
40
|
-
dark: '#F54900'
|
46
|
+
dark: '#F54900',
|
47
|
+
contrastText: '#fff'
|
41
48
|
},
|
42
49
|
info: {
|
43
50
|
main: '#2B7FFF',
|
44
51
|
light: '#51A2FF',
|
45
|
-
dark: '#155DFC'
|
52
|
+
dark: '#155DFC',
|
53
|
+
contrastText: '#fff'
|
46
54
|
},
|
47
55
|
success: {
|
48
56
|
main: '#00C950',
|
49
57
|
light: '#05DF72',
|
50
|
-
dark: '#00A63E'
|
58
|
+
dark: '#00A63E',
|
59
|
+
contrastText: '#fff'
|
51
60
|
},
|
52
|
-
divider:
|
53
|
-
main: 'rgba(18, 22, 24, 0.06)',
|
54
|
-
light: '#F4F4F5',
|
55
|
-
dark: '#D4D4D5'
|
56
|
-
}
|
61
|
+
divider: 'rgba(18, 22, 24, 0.06)'
|
57
62
|
};
|
58
63
|
export default colors;
|
@@ -1,18 +1,17 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
2
|
import { type PaletteMode } from '@mui/material';
|
3
|
-
import type { ThemeOptions } from '@mui/material/styles';
|
4
3
|
import { LocaleProviderProps } from '../Locale/context';
|
5
4
|
import { ThemeProviderProps } from '../Theme/theme-provider';
|
5
|
+
import { type UserThemeOptions, type ThemeConfig } from '../Theme';
|
6
6
|
export interface ConfigContextType {
|
7
7
|
mode: PaletteMode;
|
8
|
-
themeOptions:
|
8
|
+
themeOptions: UserThemeOptions;
|
9
9
|
toggleMode: () => void;
|
10
10
|
}
|
11
|
-
export declare function isThemeRecord(theme: ThemeOptions | Record<PaletteMode, ThemeOptions>): theme is Record<PaletteMode, ThemeOptions>;
|
12
11
|
export interface ConfigProviderProps extends Omit<LocaleProviderProps, 'translations'>, Omit<ThemeProviderProps, 'theme'> {
|
13
12
|
children: ReactNode;
|
14
13
|
prefer?: PaletteMode;
|
15
|
-
theme?:
|
14
|
+
theme?: UserThemeOptions | ((config: ThemeConfig) => UserThemeOptions);
|
16
15
|
disableBlockletTheme?: boolean;
|
17
16
|
translations?: Record<string, any>;
|
18
17
|
}
|
@@ -25,7 +24,7 @@ export declare namespace ConfigProvider {
|
|
25
24
|
}
|
26
25
|
export declare function useConfig(): {
|
27
26
|
mode: PaletteMode;
|
28
|
-
themeOptions:
|
27
|
+
themeOptions: UserThemeOptions;
|
29
28
|
toggleMode: () => void;
|
30
29
|
locale: import("../type").Locale;
|
31
30
|
changeLocale: (locale: import("../type").Locale) => void;
|
@@ -1,16 +1,12 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { createContext, useContext, useMemo, useState, useCallback, useEffect } from 'react';
|
3
|
-
import
|
3
|
+
import { BLOCKLET_THEME_PREFER_KEY } from '@blocklet/theme';
|
4
4
|
import set from 'lodash/set';
|
5
5
|
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
6
6
|
import { LocaleProvider, useLocaleContext } from '../Locale/context';
|
7
7
|
import ThemeProvider from '../Theme/theme-provider';
|
8
|
-
import { createTheme, useTheme } from '../Theme';
|
8
|
+
import { createTheme, getDefaultThemePrefer, lazyThemeConfig, useTheme } from '../Theme';
|
9
9
|
const ConfigContext = /*#__PURE__*/createContext({});
|
10
|
-
const preferThemeModeKey = 'blocklet_theme_prefer';
|
11
|
-
export function isThemeRecord(theme) {
|
12
|
-
return 'light' in theme || 'dark' in theme;
|
13
|
-
}
|
14
10
|
/**
|
15
11
|
* 集中化配置
|
16
12
|
*/
|
@@ -28,33 +24,18 @@ export function ConfigProvider({
|
|
28
24
|
languages,
|
29
25
|
onLoadingTranslation
|
30
26
|
}) {
|
31
|
-
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
|
32
27
|
const [mode, setMode] = useState(() => {
|
33
28
|
if (prefer) {
|
34
29
|
return prefer;
|
35
30
|
}
|
36
|
-
|
37
|
-
// 未启用暗色主题
|
38
|
-
if (['1', 'true'].includes(window.blocklet?.USE_DARK_THEME) === false) {
|
39
|
-
return 'light';
|
40
|
-
}
|
41
|
-
|
42
|
-
// 本地缓存
|
43
|
-
const localPrefer = localStorage.getItem(preferThemeModeKey);
|
44
|
-
if (localPrefer && (localPrefer === 'light' || localPrefer === 'dark')) {
|
45
|
-
return localPrefer;
|
46
|
-
}
|
47
|
-
|
48
|
-
// 系统偏好
|
49
|
-
return prefersDarkMode ? 'dark' : 'light';
|
31
|
+
return getDefaultThemePrefer();
|
50
32
|
});
|
51
33
|
const _themeOptions = useMemo(() => {
|
52
34
|
let result = {};
|
35
|
+
const getThemeConfig = lazyThemeConfig(mode);
|
53
36
|
if (themeOptions) {
|
54
|
-
if (
|
55
|
-
result = themeOptions
|
56
|
-
...themeOptions[mode]
|
57
|
-
} : {};
|
37
|
+
if (typeof themeOptions === 'function') {
|
38
|
+
result = themeOptions(getThemeConfig());
|
58
39
|
} else {
|
59
40
|
result = {
|
60
41
|
...themeOptions
|
@@ -74,7 +55,7 @@ export function ConfigProvider({
|
|
74
55
|
const toggleMode = useCallback(() => {
|
75
56
|
const newMode = mode === 'light' ? 'dark' : 'light';
|
76
57
|
setMode(newMode);
|
77
|
-
localStorage.setItem(
|
58
|
+
localStorage.setItem(BLOCKLET_THEME_PREFER_KEY, newMode);
|
78
59
|
}, [mode, setMode]);
|
79
60
|
const config = useMemo(() => ({
|
80
61
|
mode,
|
@@ -16,7 +16,6 @@ export default function ThemeModeToggle() {
|
|
16
16
|
}
|
17
17
|
return /*#__PURE__*/_jsx(IconButton, {
|
18
18
|
onClick: toggleMode,
|
19
|
-
color: "inherit",
|
20
19
|
children: mode === 'light' ? /*#__PURE__*/_jsx(LightModeOutlinedIcon, {}) : /*#__PURE__*/_jsx(Brightness2OutlinedIcon, {})
|
21
20
|
});
|
22
21
|
}
|
package/lib/DID/index.js
CHANGED
@@ -9,7 +9,6 @@ import { useCreation, useMemoizedFn } from 'ahooks';
|
|
9
9
|
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
10
10
|
import Address from '../Address';
|
11
11
|
import Avatar from '../Avatar';
|
12
|
-
import { temp as colors } from '../Colors';
|
13
12
|
import { DID_PREFIX } from '../Util/constant';
|
14
13
|
import { translate } from '../Locale/util';
|
15
14
|
import { getDIDColor, isEthereumDid } from '../Util';
|
@@ -191,7 +190,7 @@ export const DID = /*#__PURE__*/forwardRef((props, ref) => {
|
|
191
190
|
flexShrink: 0,
|
192
191
|
cursor: 'pointer',
|
193
192
|
ml: 0.5,
|
194
|
-
color: '
|
193
|
+
color: 'text.secondary'
|
195
194
|
}
|
196
195
|
}) : null, rest.append]
|
197
196
|
}),
|
@@ -248,7 +247,7 @@ export function DIDDialog({
|
|
248
247
|
target: "_blank",
|
249
248
|
rel: "noreferrer",
|
250
249
|
sx: {
|
251
|
-
color:
|
250
|
+
color: 'secondary.main',
|
252
251
|
textDecoration: 'none',
|
253
252
|
'&:hover': {
|
254
253
|
textDecoration: 'underline'
|
@@ -335,7 +334,7 @@ export function DIDDialog({
|
|
335
334
|
}), /*#__PURE__*/_jsx(Typography, {
|
336
335
|
variant: "body2",
|
337
336
|
sx: {
|
338
|
-
color:
|
337
|
+
color: 'text.secondary',
|
339
338
|
fontSize: '12px',
|
340
339
|
mt: 1
|
341
340
|
},
|