@blocklet/ui-react 2.13.12 → 2.13.14

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 (72) hide show
  1. package/lib/ComponentInstaller/index.js +6 -7
  2. package/lib/ComponentInstaller/installer-item.js +6 -6
  3. package/lib/Dashboard/index.js +6 -4
  4. package/lib/Footer/index.js +9 -5
  5. package/lib/Footer/links.js +1 -1
  6. package/lib/Footer/social-media.js +3 -12
  7. package/lib/Header/index.js +7 -6
  8. package/lib/Notifications/hooks/use-title.js +7 -5
  9. package/lib/UserCenter/components/config-profile.js +2 -3
  10. package/lib/UserCenter/components/editable-field.d.ts +2 -0
  11. package/lib/UserCenter/components/editable-field.js +4 -5
  12. package/lib/UserCenter/components/nft.js +3 -4
  13. package/lib/UserCenter/components/notification.js +4 -7
  14. package/lib/UserCenter/components/passport.js +3 -6
  15. package/lib/UserCenter/components/settings.js +4 -4
  16. package/lib/UserCenter/components/status-dialog/index.js +4 -5
  17. package/lib/UserCenter/components/status-selector/duration-menu.d.ts +1 -3
  18. package/lib/UserCenter/components/status-selector/duration-menu.js +2 -4
  19. package/lib/UserCenter/components/status-selector/menu-item.d.ts +1 -3
  20. package/lib/UserCenter/components/status-selector/menu-item.js +2 -4
  21. package/lib/UserCenter/components/third-party-login/index.js +3 -1
  22. package/lib/UserCenter/components/third-party-login/third-party-item.js +21 -17
  23. package/lib/UserCenter/components/user-center.js +6 -7
  24. package/lib/UserCenter/components/user-info/address.js +2 -3
  25. package/lib/UserCenter/components/user-info/link-preview-input.js +8 -8
  26. package/lib/UserCenter/components/user-info/metadata.js +1 -1
  27. package/lib/UserCenter/components/user-info/switch-role.js +5 -8
  28. package/lib/UserCenter/components/user-info/timezone-select.js +13 -8
  29. package/lib/UserCenter/components/user-info/user-basic-info.js +3 -4
  30. package/lib/UserCenter/components/user-info/user-info-item.js +2 -3
  31. package/lib/UserCenter/components/user-info/utils.d.ts +2 -2
  32. package/lib/UserCenter/components/user-info/utils.js +12 -13
  33. package/lib/UserCenter/components/webhook-item.js +16 -13
  34. package/lib/UserSessions/components/user-session-info.js +2 -3
  35. package/lib/UserSessions/components/user-sessions.js +9 -6
  36. package/lib/common/header-addons.js +1 -1
  37. package/lib/hooks/use-blocklet-logo.d.ts +8 -0
  38. package/lib/hooks/use-blocklet-logo.js +23 -0
  39. package/package.json +5 -5
  40. package/src/ComponentInstaller/index.jsx +7 -7
  41. package/src/ComponentInstaller/installer-item.jsx +6 -6
  42. package/src/Dashboard/index.jsx +6 -4
  43. package/src/Footer/index.jsx +9 -5
  44. package/src/Footer/links.jsx +1 -1
  45. package/src/Footer/social-media.jsx +3 -9
  46. package/src/Header/index.tsx +7 -6
  47. package/src/Notifications/hooks/use-title.tsx +8 -5
  48. package/src/UserCenter/components/config-profile.tsx +2 -3
  49. package/src/UserCenter/components/editable-field.tsx +6 -5
  50. package/src/UserCenter/components/nft.tsx +3 -4
  51. package/src/UserCenter/components/notification.tsx +4 -7
  52. package/src/UserCenter/components/passport.tsx +3 -7
  53. package/src/UserCenter/components/settings.tsx +4 -4
  54. package/src/UserCenter/components/status-dialog/index.tsx +4 -5
  55. package/src/UserCenter/components/status-selector/duration-menu.tsx +2 -4
  56. package/src/UserCenter/components/status-selector/menu-item.tsx +2 -4
  57. package/src/UserCenter/components/third-party-login/index.tsx +18 -14
  58. package/src/UserCenter/components/third-party-login/third-party-item.tsx +22 -17
  59. package/src/UserCenter/components/user-center.tsx +6 -7
  60. package/src/UserCenter/components/user-info/address.tsx +3 -3
  61. package/src/UserCenter/components/user-info/link-preview-input.tsx +9 -10
  62. package/src/UserCenter/components/user-info/metadata.tsx +1 -1
  63. package/src/UserCenter/components/user-info/switch-role.tsx +6 -9
  64. package/src/UserCenter/components/user-info/timezone-select.tsx +12 -9
  65. package/src/UserCenter/components/user-info/user-basic-info.tsx +3 -4
  66. package/src/UserCenter/components/user-info/user-info-item.tsx +2 -3
  67. package/src/UserCenter/components/user-info/utils.ts +13 -13
  68. package/src/UserCenter/components/webhook-item.tsx +16 -13
  69. package/src/UserSessions/components/user-session-info.tsx +2 -3
  70. package/src/UserSessions/components/user-sessions.tsx +9 -5
  71. package/src/common/header-addons.jsx +2 -2
  72. package/src/hooks/use-blocklet-logo.tsx +32 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.13.12",
3
+ "version": "2.13.14",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -34,9 +34,9 @@
34
34
  "dependencies": {
35
35
  "@abtnode/constant": "^1.16.42",
36
36
  "@abtnode/util": "^1.16.42",
37
- "@arcblock/bridge": "^2.13.12",
38
- "@arcblock/react-hooks": "^2.13.12",
39
- "@arcblock/ws": "^1.20.1",
37
+ "@arcblock/bridge": "^2.13.14",
38
+ "@arcblock/react-hooks": "^2.13.14",
39
+ "@arcblock/ws": "^1.20.2",
40
40
  "@blocklet/constant": "^1.16.42",
41
41
  "@blocklet/did-space-react": "^1.0.48",
42
42
  "@iconify-icons/logos": "^1.2.36",
@@ -94,5 +94,5 @@
94
94
  "jest": "^29.7.0",
95
95
  "unbuild": "^2.0.0"
96
96
  },
97
- "gitHead": "898e576675cefb8c4738d87f4198271943efec76"
97
+ "gitHead": "b9f48199169b641a2d3277806501471a56dd496d"
98
98
  }
@@ -1,5 +1,4 @@
1
1
  import { SessionContext } from '@arcblock/did-connect/lib/Session';
2
- import { temp as colors } from '@arcblock/ux/lib/Colors';
3
2
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
4
3
  import { translate } from '@arcblock/ux/lib/Locale/util';
5
4
  import SessionPermission from '@arcblock/ux/lib/SessionPermission';
@@ -86,14 +85,15 @@ function ComponentInstaller({
86
85
  top: 20,
87
86
  right: 20,
88
87
  zIndex: 3000,
89
- borderRadius: 3,
88
+ borderRadius: 1.5,
90
89
  width: 400,
91
90
  maxWidth: '90vw',
92
- borderColor: colors.lineStep,
91
+ borderColor: 'divider',
93
92
  border: '0 !important',
94
93
  fontSize: '14px',
95
94
  textAlign: 'left',
96
- boxShadow: `0px 8px 16px 0px ${colors.gray6}, 0px 0px 0px 1px ${colors.gray6}`,
95
+ boxShadow: ({ palette }) =>
96
+ `0px 8px 16px 0px ${palette.grey[100]}, 0px 0px 0px 1px ${palette.grey[100]}`,
97
97
  }}>
98
98
  {!definedInBlockletYML ? (
99
99
  <Box sx={{ display: 'flex', flexDirection: 'column' }}>
@@ -117,7 +117,7 @@ function ComponentInstaller({
117
117
  </IconButton>
118
118
  ) : null}
119
119
  </Box>
120
- <Box sx={{ width: '100%', height: '1px', backgroundColor: colors.gray6 }} />
120
+ <Box sx={{ width: '100%', height: '1px', backgroundColor: 'grey.100' }} />
121
121
  <Box sx={{ padding: '20px 24px', marginTop: 0 }}>
122
122
  {t('componentInstallerNoDefinedInBlockletYML')}: {did}
123
123
  </Box>
@@ -144,7 +144,7 @@ function ComponentInstaller({
144
144
  </IconButton>
145
145
  ) : null}
146
146
  </Box>
147
- <Box sx={{ width: '100%', height: '1px', backgroundColor: colors.gray6 }} />
147
+ <Box sx={{ width: '100%', height: '1px', backgroundColor: 'grey.100' }} />
148
148
  <Box sx={{ maxHeight: '70vh', overflowY: 'auto' }}>
149
149
  {optComponents.map((optionalComponent, index) => {
150
150
  return (
@@ -161,7 +161,7 @@ function ComponentInstaller({
161
161
  </Box>
162
162
  {hasPermission ? null : (
163
163
  <>
164
- <Box sx={{ width: '100%', height: '1px', backgroundColor: colors.gray6 }} />
164
+ <Box sx={{ width: '100%', height: '1px', backgroundColor: 'grey.100' }} />
165
165
  <Box sx={{ padding: '20px 24px' }}>
166
166
  <Box sx={{ opacity: 1 }}>{t('componentInstallerSuggestions')}</Box>
167
167
  </Box>
@@ -1,9 +1,9 @@
1
- import { temp as colors } from '@arcblock/ux/lib/Colors';
2
1
  import { Icon } from '@iconify/react';
3
- import { Box, Button } from '@mui/material';
2
+ import { Box, Button, useTheme } from '@mui/material';
4
3
  import PropTypes from 'prop-types';
5
4
 
6
5
  export default function InstallerItem({ optionalComponent, index, installStatus, hasPermission, t }) {
6
+ const { palette } = useTheme();
7
7
  const handleInstall = () => {
8
8
  // 这里是安全的
9
9
  window.open(optionalComponent?.installUrl, '_blank');
@@ -23,7 +23,7 @@ export default function InstallerItem({ optionalComponent, index, installStatus,
23
23
 
24
24
  return (
25
25
  <Box>
26
- {index === 0 ? null : <Box sx={{ width: '100%', height: '1px', backgroundColor: colors.gray6 }} />}
26
+ {index === 0 ? null : <Box sx={{ width: '100%', height: '1px', backgroundColor: 'grey.100' }} />}
27
27
  <Box
28
28
  sx={{
29
29
  padding: '20px 24px',
@@ -73,7 +73,7 @@ export default function InstallerItem({ optionalComponent, index, installStatus,
73
73
  className="link-icon"
74
74
  icon="fluent:open-20-filled"
75
75
  style={{
76
- color: colors.primaryBase,
76
+ color: palette.primary.main,
77
77
  fontSize: 16,
78
78
  transform: 'translate(6px, 3px)',
79
79
  transition: 'all 0.3s',
@@ -93,8 +93,8 @@ export default function InstallerItem({ optionalComponent, index, installStatus,
93
93
  <Button
94
94
  key="status"
95
95
  disabled
96
- sx={{ color: '#333' }}
97
- startIcon={<Icon icon="line-md:loading-loop" style={{ color: '#333', fontSize: 16 }} />}
96
+ sx={{ color: 'text.primary' }}
97
+ startIcon={<Icon icon="line-md:loading-loop" style={{ color: 'text.primary', fontSize: 16 }} />}
98
98
  variant="contained">
99
99
  {installStatus}
100
100
  </Button>
@@ -12,7 +12,7 @@ import { mapRecursive, flatRecursive, matchPaths } from '../utils';
12
12
  import { publicPath, formatBlockletInfo, getLocalizedNavigation, filterNavByRole } from '../blocklets';
13
13
  import HeaderAddons from '../common/header-addons';
14
14
  import { useWalletHiddenTopbar } from '../common/wallet-hidden-topbar';
15
- import useMobile from '../hooks/use-mobile';
15
+ import useBlockletLogo from '../hooks/use-blocklet-logo';
16
16
 
17
17
  /**
18
18
  * 专门用于 (composable) blocklet 的 Dashboard 组件, 解析 blocklet meta 中 section 为 dashboard 的 navigation 数据, 渲染一个 UX Dashboard
@@ -33,7 +33,6 @@ function Dashboard({
33
33
  const user = sessionCtx?.session?.user;
34
34
  const userRole = user?.role;
35
35
  const { locale } = useLocaleContext() || {};
36
- const isMobile = useMobile();
37
36
  const formattedBlocklet = useMemo(() => {
38
37
  const blocklet = Object.assign({}, window.blocklet, meta);
39
38
  try {
@@ -86,6 +85,9 @@ function Dashboard({
86
85
  }, [formattedBlocklet, locale, userRole]);
87
86
 
88
87
  const allLinks = typeof links === 'function' ? links(localizedNav) : [...localizedNav, ...links];
88
+ const appLogo = useBlockletLogo({
89
+ meta,
90
+ });
89
91
 
90
92
  // 页面初始化时, 如果当前用户没有权限访问任何导航菜单 (比如登录时未提供 VC 导致无权限), 则跳转到 fallbackUrl
91
93
  // 未认证 (user 为空) 时不做处理, 这种情况的页面跳转逻辑一般由应用自行处理
@@ -113,7 +115,7 @@ function Dashboard({
113
115
  if (!formattedBlocklet.appName) {
114
116
  return null;
115
117
  }
116
- const { appLogo, appLogoRect, appName } = formattedBlocklet;
118
+ const { appName } = formattedBlocklet;
117
119
  // eslint-disable-next-line @typescript-eslint/naming-convention
118
120
  const _headerAddons = (
119
121
  <HeaderAddons
@@ -134,7 +136,7 @@ function Dashboard({
134
136
  {...rest}
135
137
  headerProps={{
136
138
  homeLink: publicPath,
137
- logo: <img src={isMobile ? appLogo : appLogoRect || appLogo} alt="logo" />,
139
+ logo: <img src={appLogo} alt="logo" />,
138
140
  addons: _headerAddons,
139
141
  ...rest.headerProps,
140
142
  }}
@@ -4,7 +4,6 @@ import { styled, useTheme, deepmerge, ThemeProvider } from '@arcblock/ux/lib/The
4
4
  import { withErrorBoundary } from 'react-error-boundary';
5
5
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
6
6
  import { ErrorFallback } from '@arcblock/ux/lib/ErrorBoundary';
7
- import { temp as colors } from '@arcblock/ux/lib/Colors';
8
7
  import omit from 'lodash/omit';
9
8
 
10
9
  import InternalFooter from './internal-footer';
@@ -12,6 +11,7 @@ import { mapRecursive } from '../utils';
12
11
  import { formatBlockletInfo, getLocalizedNavigation } from '../blocklets';
13
12
  import { BlockletMetaProps } from '../types';
14
13
  import withHideWhenEmbed from '../libs/with-hide-when-embed';
14
+ import useBlockletLogo from '../hooks/use-blocklet-logo';
15
15
 
16
16
  /**
17
17
  * 专门用于 (composable) blocklet 的 Footer 组件, 基于 blocklet meta 中的数据渲染
@@ -30,12 +30,16 @@ function Footer({ meta, theme: themeOverrides, ...rest }) {
30
30
  }, [meta]);
31
31
 
32
32
  const mergeTheme = useMemo(() => deepmerge(parentTheme, themeOverrides), [parentTheme, themeOverrides]);
33
+ const appLogo = useBlockletLogo({
34
+ meta,
35
+ theme: themeOverrides,
36
+ });
33
37
 
34
38
  if (!formattedBlocklet.appName) {
35
39
  return null;
36
40
  }
37
41
 
38
- const { appLogo, appLogoRect, appName, appDescription, description, copyright } = formattedBlocklet;
42
+ const { appName, appDescription, description, copyright } = formattedBlocklet;
39
43
  const $bgColor = mergeTheme.palette.background.default;
40
44
 
41
45
  const localized = {
@@ -48,7 +52,7 @@ function Footer({ meta, theme: themeOverrides, ...rest }) {
48
52
  brand: {
49
53
  name: appName,
50
54
  description: appDescription || description,
51
- logo: appLogoRect || appLogo,
55
+ logo: appLogo,
52
56
  },
53
57
  navigation: mapRecursive(
54
58
  localized.footerNav,
@@ -83,8 +87,8 @@ Footer.defaultProps = {
83
87
  };
84
88
 
85
89
  const StyledInternalFooter = styled(InternalFooter)`
86
- ${({ $bordered }) => `border-top: 1px solid ${$bordered ? colors.strokeSep : '#eee'};`}
87
- color: ${(props) => props.theme.palette.grey[600]};
90
+ ${({ $bordered, theme }) => `border-top: 1px solid ${$bordered && theme.palette.divider};`}
91
+ color: ${({ theme }) => theme.palette.grey[400]};
88
92
  ${({ $bgcolor }) => $bgcolor && `background-color: ${$bgcolor};`}
89
93
  `;
90
94
 
@@ -167,7 +167,7 @@ Links.defaultProps = {
167
167
 
168
168
  const Root = styled('div')`
169
169
  overflow: hidden;
170
- color: ${({ theme }) => theme.palette.grey[500]};
170
+ color: ${({ theme }) => theme.palette.grey[400]};
171
171
  .footer-links-inner {
172
172
  display: flex;
173
173
  justify-content: space-between;
@@ -1,9 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
- import { useTheme, styled } from '@arcblock/ux/lib/Theme';
2
+ import { styled } from '@arcblock/ux/lib/Theme';
3
3
  import Icon from '../Icon';
4
4
 
5
5
  export default function SocialMedia({ items, ...rest }) {
6
- const theme = useTheme();
7
6
  if (!items?.length) {
8
7
  return null;
9
8
  }
@@ -18,12 +17,7 @@ export default function SocialMedia({ items, ...rest }) {
18
17
  target="_blank"
19
18
  aria-label={`Social media icon${item.title ? ` for ${item.title}` : ''}`}
20
19
  rel="noreferrer">
21
- <Icon
22
- icon={item.icon || item.title}
23
- sx={{ bgcolor: theme.palette.grey[600], color: '#fff' }}
24
- size={24}
25
- component="span"
26
- />
20
+ <Icon icon={item.icon || item.title} size={24} component="span" />
27
21
  </a>
28
22
  );
29
23
  })}
@@ -52,7 +46,7 @@ const Root = styled('div')`
52
46
  justify-content: center;
53
47
  gap: 20px;
54
48
  a {
55
- color: ${(props) => props.theme.palette.grey[500]};
49
+ color: ${(props) => props.theme.palette.grey[400]};
56
50
  text-decoration: none;
57
51
  transition: color 0.2s ease-in-out;
58
52
  &:hover {
@@ -6,7 +6,6 @@ import { styled, useTheme, deepmerge, ThemeProvider } from '@arcblock/ux/lib/The
6
6
  import { ResponsiveHeader } from '@arcblock/ux/lib/Header';
7
7
  import NavMenu, { Products } from '@arcblock/ux/lib/NavMenu';
8
8
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
9
- import { temp as colors } from '@arcblock/ux/lib/Colors';
10
9
  import { translate } from '@arcblock/ux/lib/Locale/util';
11
10
  import omit from 'lodash/omit';
12
11
  import isFinite from 'lodash/isFinite';
@@ -20,7 +19,7 @@ import HeaderAddons from '../common/header-addons';
20
19
  import { useWalletHiddenTopbar } from '../common/wallet-hidden-topbar';
21
20
  import { BlockletMetaProps, SessionManagerProps } from '../@types';
22
21
  import withHideWhenEmbed from '../libs/with-hide-when-embed';
23
- import useMobile from '../hooks/use-mobile';
22
+ import useBlockletLogo from '../hooks/use-blocklet-logo';
24
23
 
25
24
  const translations = {
26
25
  en: {
@@ -128,13 +127,15 @@ function Header({
128
127
  return blocklet;
129
128
  }
130
129
  }, [meta]);
131
- const isMobileDevice = useMobile();
132
130
  const mergeTheme = useMemo(() => deepmerge(parentTheme, themeOverrides), [parentTheme, themeOverrides]);
131
+ const appLogo = useBlockletLogo({
132
+ meta,
133
+ theme: themeOverrides,
134
+ });
133
135
 
134
136
  if (!formattedBlocklet.appName) {
135
137
  return null;
136
138
  }
137
- const { appLogo, appLogoRect } = formattedBlocklet;
138
139
  const navigation = getLocalizedNavigation(formattedBlocklet?.navigation?.header, locale);
139
140
  const parsedNavigation = parseNavigation(navigation);
140
141
  const { navItems, activeId } = parsedNavigation;
@@ -169,7 +170,7 @@ function Header({
169
170
  <StyledUxHeader
170
171
  // @ts-ignore
171
172
  homeLink={homeLink}
172
- logo={<img src={isMobileDevice ? appLogo : appLogoRect || appLogo} alt="logo" />}
173
+ logo={<img src={appLogo} alt="logo" />}
173
174
  addons={headerAddons}
174
175
  {...omit(rest, ['bordered'])}
175
176
  $bordered={rest?.bordered}
@@ -205,7 +206,7 @@ const StyledUxHeader = styled(ResponsiveHeader)<StyledUxHeaderProps>`
205
206
  .header-logo {
206
207
  min-width: 44px;
207
208
  }
208
- ${({ $bordered }) => ($bordered ? `border-bottom: 1px solid ${colors.strokeSep};` : '')}
209
+ ${({ $bordered, theme }) => ($bordered ? `border-bottom: 1px solid ${theme.palette.divider};` : '')}
209
210
  ${(props) => props.theme.breakpoints.down('md')} {
210
211
  .header-logo {
211
212
  min-width: 32px;
@@ -1,8 +1,7 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  import React, { MouseEvent } from 'react';
3
3
  import { useCreation, useMemoizedFn } from 'ahooks';
4
- import { temp as colors } from '@arcblock/ux/lib/Colors';
5
- import Link from '@mui/material/Link';
4
+ import { useTheme, Link } from '@mui/material';
6
5
  import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
7
6
  import { joinURL, withQuery } from 'ufo';
8
7
  import isEmpty from 'lodash/isEmpty';
@@ -62,13 +61,16 @@ interface CustomMouseEvent extends MouseEvent<HTMLAnchorElement> {
62
61
  * UserLink component for rendering a user's name as a profile link
63
62
  * Memoized to prevent unnecessary re-renders
64
63
  */
65
- function UserLink({ user, color = colors.textBase }: UserLinkProps) {
64
+ function UserLink({ user, color }: UserLinkProps) {
65
+ const { palette } = useTheme();
66
66
  const profileLink = withQuery(joinURL(WELLKNOWN_SERVICE_PATH_PREFIX, 'user'), { did: user.did });
67
+ // eslint-disable-next-line @typescript-eslint/naming-convention
68
+ const _color = color || palette.text.primary;
67
69
 
68
70
  return (
69
71
  <Link
70
72
  href={profileLink}
71
- color={color}
73
+ color={_color}
72
74
  fontWeight={600}
73
75
  target="_blank"
74
76
  sx={{ textDecoration: 'none', '&:hover': { cursor: 'pointer' } }}
@@ -115,9 +117,10 @@ interface ActivityTitleProps {
115
117
  * @returns {React.ReactNode} Formatted title with linked usernames
116
118
  */
117
119
  export default function useActivityTitle({ activity, users, actors, extra = {}, mountPoint = '' }: ActivityTitleProps) {
120
+ const { palette } = useTheme();
118
121
  const { type, target } = activity || {};
119
122
  const { type: targetType } = target || {};
120
- const { linkColor = colors.textBase } = extra || {};
123
+ const { linkColor = palette.text.primary } = extra || {};
121
124
 
122
125
  // Create a map of users by their DID for efficient lookup
123
126
  const usersMap = useCreation(() => {
@@ -3,7 +3,6 @@ import { useMemoizedFn, useReactive } from 'ahooks';
3
3
  import { translate } from '@arcblock/ux/lib/Locale/util';
4
4
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
5
5
  import Toast from '@arcblock/ux/lib/Toast';
6
- import { temp as colors } from '@arcblock/ux/lib/Colors';
7
6
  // eslint-disable-next-line import/no-extraneous-dependencies
8
7
  import ArrowDownwardIcon from '@arcblock/icons/lib/ArrowDown';
9
8
 
@@ -73,11 +72,11 @@ export default function ConfigProfile({ user, onSave }: { user: User; onSave: (t
73
72
  minWidth: 300,
74
73
  '&:hover': {
75
74
  'fieldset.MuiOutlinedInput-notchedOutline': {
76
- borderColor: colors.dividerColor,
75
+ borderColor: 'divider',
77
76
  },
78
77
  },
79
78
  fieldset: {
80
- borderColor: colors.dividerColor,
79
+ borderColor: 'divider',
81
80
  },
82
81
  }}>
83
82
  {(window.blocklet.languages || languages).map((x: { name: string; code: string }) => (
@@ -1,7 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Box, TextField, Typography, Tooltip, TooltipProps } from '@mui/material';
3
3
  import { useCreation, useMemoizedFn } from 'ahooks';
4
- import { temp as colors } from '@arcblock/ux/lib/Colors';
5
4
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
6
5
  import { translate } from '@arcblock/ux/lib/Locale/util';
7
6
  import VerifiedIcon from '@mui/icons-material/Verified';
@@ -31,21 +30,23 @@ interface EditableFieldProps {
31
30
  renderValue?: (value: string) => React.ReactNode;
32
31
  }
33
32
 
33
+ /** only for sx */
34
34
  export const commonInputStyle = {
35
35
  '.MuiOutlinedInput-root': {
36
36
  '&:hover': {
37
37
  fieldset: {
38
- borderColor: colors.dividerColor,
38
+ borderColor: 'divider',
39
39
  },
40
40
  },
41
41
  '&.Mui-focused': {
42
42
  fieldset: {
43
- borderColor: colors.dividerColor,
43
+ borderColor: 'divider',
44
44
  },
45
45
  },
46
46
  },
47
47
  };
48
48
 
49
+ /** only for sx */
49
50
  export const inputFieldStyle = {
50
51
  width: '100%',
51
52
  '& .MuiFormHelperText-root': {
@@ -55,7 +56,7 @@ export const inputFieldStyle = {
55
56
  margin: 0,
56
57
  },
57
58
  fieldset: {
58
- borderColor: colors.dividerColor,
59
+ borderColor: 'divider',
59
60
  },
60
61
  };
61
62
 
@@ -245,7 +246,7 @@ function EditableField({
245
246
  return (
246
247
  <Box sx={{ width: '100%' }} style={style}>
247
248
  {label && (
248
- <Typography variant="subtitle1" gutterBottom sx={{ mb: 0.5, fontSize: '12px', color: '#4B5563' }}>
249
+ <Typography variant="subtitle1" gutterBottom sx={{ mb: 0.5, fontSize: '12px', color: 'text.primary' }}>
249
250
  {label}
250
251
  </Typography>
251
252
  )}
@@ -1,7 +1,6 @@
1
1
  import { Box, Pagination, Skeleton, Typography } from '@mui/material';
2
2
  import { useCreation, useMemoizedFn, useReactive, useRequest } from 'ahooks';
3
3
  import axios from 'axios';
4
- import { temp as colors } from '@arcblock/ux/lib/Colors';
5
4
  import NFTDisplay from '@arcblock/ux/lib/NFTDisplay';
6
5
  import Empty from '@arcblock/ux/lib/Empty';
7
6
  import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
@@ -65,7 +64,7 @@ export default function Nft({ user }: { user: User }) {
65
64
  const content = useCreation(() => {
66
65
  if (loading) {
67
66
  const skeletonItems = ['skeleton-1', 'skeleton-2', 'skeleton-3', 'skeleton-4', 'skeleton-5'].map((id) => (
68
- <Skeleton key={id} variant="rectangular" width="15%" height={166} sx={{ borderRadius: 2, flexShrink: 0 }} />
67
+ <Skeleton key={id} variant="rectangular" width="15%" height={166} sx={{ borderRadius: 1, flexShrink: 0 }} />
69
68
  ));
70
69
 
71
70
  return (
@@ -81,7 +80,7 @@ export default function Nft({ user }: { user: User }) {
81
80
  <>
82
81
  <Typography
83
82
  sx={{
84
- color: colors.foregroundsFgBase,
83
+ color: 'grey.A700',
85
84
  fontWeight: 600,
86
85
  mb: 2.5,
87
86
  }}>
@@ -124,5 +123,5 @@ export default function Nft({ user }: { user: User }) {
124
123
  );
125
124
  }, [loading, dataPage, paging.page, paging.size, handlePageChange]);
126
125
 
127
- return <Box sx={{ border: `1px solid ${colors.dividerColor}`, borderRadius: 2, p: 2, mb: 5 }}>{content}</Box>;
126
+ return <Box sx={{ border: '1px solid', borderColor: 'divider', borderRadius: 1, p: 2, mb: 5 }}>{content}</Box>;
128
127
  }
@@ -5,7 +5,6 @@ import { Icon } from '@iconify/react';
5
5
  import AddRoundedIcon from '@iconify-icons/material-symbols/add-rounded';
6
6
  import Switch from '@arcblock/ux/lib/Switch';
7
7
  import Button from '@arcblock/ux/lib/Button';
8
- import { temp as colors } from '@arcblock/ux/lib/Colors';
9
8
  import Toast from '@arcblock/ux/lib/Toast';
10
9
  import { getWalletDid } from '@arcblock/ux/lib/SessionUser/libs/utils';
11
10
  import { translate } from '@arcblock/ux/lib/Locale/util';
@@ -269,15 +268,13 @@ export default function Notification({ user }: { user: User }) {
269
268
  variant="outlined"
270
269
  size="small"
271
270
  sx={{
272
- color: colors.foregroundsFgBase,
273
- borderColor: colors.strokeBorderBase,
274
- backgroundColor: colors.buttonsButtonNeutral,
271
+ color: 'text.primary',
272
+ borderColor: 'divider',
275
273
  '&:hover': {
276
- borderColor: colors.strokeBorderBase,
277
- backgroundColor: colors.buttonsButtonNeutralHover,
274
+ borderColor: 'divider',
278
275
  },
279
276
  py: 0.5,
280
- borderRadius: 2,
277
+ borderRadius: 1,
281
278
  }}
282
279
  startIcon={<Icon icon={AddRoundedIcon} />}
283
280
  onClick={() => {
@@ -2,7 +2,6 @@ import { Box } from '@mui/material';
2
2
  import type { BoxProps } from '@mui/material';
3
3
  import Empty from '@arcblock/ux/lib/Empty';
4
4
  import { useTheme } from '@arcblock/ux/lib/Theme';
5
- import { temp as colors } from '@arcblock/ux/lib/Colors';
6
5
  import PassportItem from '@arcblock/ux/lib/Passport';
7
6
  import { PASSPORT_STATUS } from '@arcblock/ux/lib/Util/constant';
8
7
  import { useCreation, useMemoizedFn } from 'ahooks';
@@ -47,10 +46,7 @@ export default function Passport({ user, ...rest }: { user: User } & BoxProps) {
47
46
  }, [user?.passports]);
48
47
 
49
48
  const currentRole = useCreation(() => passports?.find((item) => item.name === user.role), [passports, user?.role]);
50
-
51
- const activeColor = useCreation(() => {
52
- return theme?.palette?.primary?.main || colors.textBase;
53
- }, [theme?.palette?.primary?.main]);
49
+ const activeColor = theme.palette.primary.main;
54
50
 
55
51
  if (passports.length === 0) {
56
52
  return (
@@ -90,11 +86,11 @@ export default function Passport({ user, ...rest }: { user: User } & BoxProps) {
90
86
  '.passport-item__display': {
91
87
  width: 166,
92
88
  height: 166,
93
- borderRadius: 2,
89
+ borderRadius: 1,
94
90
  px: 2,
95
91
  display: 'flex',
96
92
  justifyContent: 'center',
97
- backgroundColor: colors.backgroundsBgComponent,
93
+ backgroundColor: 'grey.50',
98
94
  boxShadow:
99
95
  currentRole && currentRole.role === x.role
100
96
  ? `0px 2px 4px 0px ${activeColor}, 0px 1px 2px -1px ${activeColor}, 0px 0px 0px 1px ${activeColor} !important`
@@ -6,7 +6,6 @@ import { translate } from '@arcblock/ux/lib/Locale/util';
6
6
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
7
7
  import { mergeSx } from '@arcblock/ux/lib/Util/style';
8
8
 
9
- import colors from '@arcblock/ux/lib/Colors/themes/temp';
10
9
  import { translations } from '../libs/locales';
11
10
  import Notification from './notification';
12
11
  import Privacy from './privacy';
@@ -118,8 +117,9 @@ export default function Settings({
118
117
  key={tab.value}
119
118
  sx={mergeSx(
120
119
  {
121
- border: `1px solid ${colors.dividerColor}`,
122
- borderRadius: 2,
120
+ border: '1px solid',
121
+ borderColor: 'divider',
122
+ borderRadius: 1,
123
123
  p: 2,
124
124
  '&:last-child': {
125
125
  mb: 5,
@@ -129,7 +129,7 @@ export default function Settings({
129
129
  )}>
130
130
  <Typography
131
131
  sx={{
132
- color: colors.foregroundsFgBase,
132
+ color: 'text.primary',
133
133
  fontWeight: 600,
134
134
  }}>
135
135
  {tab.label}
@@ -18,7 +18,6 @@ import dayjs from 'dayjs';
18
18
  import CloseIcon from '@mui/icons-material/Close';
19
19
  import { translate } from '@arcblock/ux/lib/Locale/util';
20
20
  import { useMemoizedFn } from 'ahooks';
21
- import { temp as colors } from '@arcblock/ux/lib/Colors';
22
21
  // eslint-disable-next-line import/no-extraneous-dependencies
23
22
  import ArrowDownwardIcon from '@arcblock/icons/lib/ArrowDown';
24
23
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
@@ -33,11 +32,11 @@ const selectStyle = {
33
32
  borderRadius: '8px',
34
33
  '&:hover': {
35
34
  'fieldset.MuiOutlinedInput-notchedOutline': {
36
- borderColor: colors.dividerColor,
35
+ borderColor: 'divider',
37
36
  },
38
37
  },
39
38
  'fieldset.MuiOutlinedInput-notchedOutline': {
40
- borderColor: colors.dividerColor,
39
+ borderColor: 'divider',
41
40
  borderRadius: '8px',
42
41
  },
43
42
  '.MuiSelect-select': {
@@ -113,7 +112,7 @@ export default function StatusDialog({ open, onClose, data, selected, onSelect,
113
112
  borderRadius: '8px',
114
113
  },
115
114
  }}>
116
- <DialogTitle sx={{ borderBottom: `1px solid ${colors.dividerColor}` }}>
115
+ <DialogTitle sx={{ borderBottom: '1px solid', borderColor: 'divider' }}>
117
116
  <Typography variant="body1" sx={{ fontSize: '16px !important', mb: 0 }}>
118
117
  {t('profile.setStatus')}
119
118
  </Typography>
@@ -244,7 +243,7 @@ export default function StatusDialog({ open, onClose, data, selected, onSelect,
244
243
  </Box>
245
244
  )}
246
245
  </DialogContent>
247
- <DialogActions sx={{ p: '16px 24px', borderTop: `1px solid ${colors.dividerColor}` }}>
246
+ <DialogActions sx={{ p: '16px 24px', borderTop: '1px solid', borderColor: 'divider' }}>
248
247
  {selected?.value && !changed ? (
249
248
  <Button
250
249
  sx={{ ...defaultButtonStyle, minWidth: '54px' }}
@@ -1,6 +1,4 @@
1
- import { Menu, Typography } from '@mui/material';
2
- import styled from '@emotion/styled';
3
- import { temp as colors } from '@arcblock/ux/lib/Colors';
1
+ import { Menu, styled, Typography } from '@mui/material';
4
2
  import { useState } from 'react';
5
3
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
6
4
  import { useMemoizedFn } from 'ahooks';
@@ -82,6 +80,6 @@ export const MenuDiv = styled(Menu)`
82
80
  min-width: 160px;
83
81
  }
84
82
  .selected {
85
- background-color: ${colors.backgroundsBgSubtitle};
83
+ background-color: ${({ theme }) => theme.palette.grey[50]};
86
84
  }
87
85
  `;
@@ -1,8 +1,6 @@
1
- import { ListItemIcon, MenuItem, Menu } from '@mui/material';
1
+ import { ListItemIcon, MenuItem, Menu, styled } from '@mui/material';
2
2
  import { SvgIconProps } from '@mui/material/SvgIcon';
3
3
  import React from 'react';
4
- import styled from '@emotion/styled';
5
- import { temp as colors } from '@arcblock/ux/lib/Colors';
6
4
  import { UserMetadata } from '../../../@types';
7
5
 
8
6
  interface StatusMenuItemProps {
@@ -35,7 +33,7 @@ export const StyledMenu = styled(Menu)`
35
33
  min-width: 160px;
36
34
  }
37
35
  .selected {
38
- background-color: ${colors.backgroundsBgSubtitle};
36
+ background-color: ${({ theme }) => theme.palette.grey[50]};
39
37
  }
40
38
  `;
41
39