@arcblock/ux 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 (144) hide show
  1. package/lib/ActivityIndicator/index.js +9 -5
  2. package/lib/Address/did-address.js +14 -7
  3. package/lib/Address/responsive-did-address.js +3 -1
  4. package/lib/BlockletV2/blocklet.js +1 -1
  5. package/lib/CloseButton/index.js +1 -2
  6. package/lib/Colors/index.d.ts +1 -3
  7. package/lib/Colors/index.js +2 -4
  8. package/lib/Colors/themes/default.d.ts +3 -66
  9. package/lib/Colors/themes/default.js +4 -74
  10. package/lib/Colors/themes/did-connect.d.ts +11 -6
  11. package/lib/Colors/themes/did-connect.js +17 -12
  12. package/lib/Colors/themes/temp.d.ts +3 -0
  13. package/lib/Colors/themes/temp.js +3 -0
  14. package/lib/Config/config-provider.d.ts +4 -5
  15. package/lib/Config/config-provider.js +7 -26
  16. package/lib/Config/theme-mode-toggle.js +0 -1
  17. package/lib/DID/index.js +3 -4
  18. package/lib/DIDConnect/app-icon.d.ts +8 -0
  19. package/lib/DIDConnect/app-icon.js +31 -0
  20. package/lib/DIDConnect/app-info-item.d.ts +7 -0
  21. package/lib/DIDConnect/app-info-item.js +73 -0
  22. package/lib/DIDConnect/did-connect-footer.d.ts +4 -0
  23. package/lib/DIDConnect/did-connect-footer.js +54 -0
  24. package/lib/DIDConnect/did-connect-logo.d.ts +1 -0
  25. package/lib/DIDConnect/did-connect-logo.js +11 -0
  26. package/lib/DIDConnect/index.d.ts +7 -0
  27. package/lib/DIDConnect/index.js +7 -0
  28. package/lib/DIDConnect/powered-by.d.ts +3 -0
  29. package/lib/DIDConnect/powered-by.js +46 -0
  30. package/lib/DIDConnect/with-container.d.ts +11 -0
  31. package/lib/DIDConnect/with-container.js +273 -0
  32. package/lib/DIDConnect/with-ux-theme.d.ts +1 -0
  33. package/lib/DIDConnect/with-ux-theme.js +23 -0
  34. package/lib/Datatable/CustomToolbar.js +3 -0
  35. package/lib/Datatable/index.js +105 -71
  36. package/lib/Dialog/confirm.d.ts +6 -1
  37. package/lib/Dialog/confirm.js +7 -3
  38. package/lib/Dialog/use-confirm.js +6 -0
  39. package/lib/Footer/index.js +2 -5
  40. package/lib/Header/header.js +3 -1
  41. package/lib/Header/responsive-header.js +3 -1
  42. package/lib/Layout/dashboard/index.js +14 -2
  43. package/lib/Layout/dashboard/sidebar.js +1 -2
  44. package/lib/LoadingMask/index.js +4 -3
  45. package/lib/Locale/selector.js +3 -3
  46. package/lib/Locale/util.d.ts +3 -3
  47. package/lib/Locale/util.js +6 -1
  48. package/lib/LoginButton/index.d.ts +12 -0
  49. package/lib/LoginButton/index.js +74 -0
  50. package/lib/NavMenu/nav-menu.js +14 -9
  51. package/lib/NavMenu/products.js +3 -1
  52. package/lib/NavMenu/style.js +7 -3
  53. package/lib/NavMenu/sub-item-group.js +1 -1
  54. package/lib/PhoneInput/country-select.js +2 -3
  55. package/lib/SessionBlocklet/index.js +3 -3
  56. package/lib/SessionUser/components/did-space.js +14 -28
  57. package/lib/SessionUser/components/logged-in.js +2 -2
  58. package/lib/SessionUser/components/quick-login-item.js +13 -11
  59. package/lib/SessionUser/components/session-user-item.js +5 -6
  60. package/lib/SessionUser/components/session-user-switch.js +15 -13
  61. package/lib/SessionUser/components/un-login.js +51 -38
  62. package/lib/SessionUser/components/user-info.js +9 -8
  63. package/lib/SessionUser/images/did-spaces.svg +7 -13
  64. package/lib/SharedBridge/index.d.ts +16 -0
  65. package/lib/SharedBridge/index.js +109 -0
  66. package/lib/SharedBridge/need-storage-access-api-dialog.d.ts +7 -0
  67. package/lib/SharedBridge/need-storage-access-api-dialog.js +212 -0
  68. package/lib/Success/index.js +8 -4
  69. package/lib/Switch/index.js +3 -3
  70. package/lib/Tabs/index.js +8 -9
  71. package/lib/Theme/index.d.ts +2 -2
  72. package/lib/Theme/index.js +1 -1
  73. package/lib/Theme/theme-provider.d.ts +5 -1
  74. package/lib/Theme/theme-provider.js +60 -5
  75. package/lib/Theme/theme.d.ts +6 -3
  76. package/lib/Theme/theme.js +55 -19
  77. package/lib/UserCard/Container/card.js +1 -1
  78. package/lib/UserCard/Container/dialog.js +1 -1
  79. package/lib/Util/iframe.d.ts +5 -0
  80. package/lib/Util/iframe.js +24 -0
  81. package/lib/Util/index.d.ts +18 -1
  82. package/lib/Util/index.js +90 -5
  83. package/lib/type.d.ts +5 -1
  84. package/package.json +8 -6
  85. package/src/ActivityIndicator/index.jsx +4 -4
  86. package/src/Address/did-address.tsx +5 -5
  87. package/src/Address/responsive-did-address.tsx +11 -1
  88. package/src/BlockletV2/blocklet.tsx +1 -1
  89. package/src/CloseButton/index.tsx +1 -2
  90. package/src/Colors/index.ts +2 -7
  91. package/src/Colors/themes/default.ts +4 -50
  92. package/src/Colors/themes/did-connect.ts +13 -6
  93. package/src/Colors/themes/temp.ts +3 -0
  94. package/src/Config/config-provider.tsx +17 -30
  95. package/src/Config/theme-mode-toggle.tsx +1 -1
  96. package/src/DID/index.tsx +3 -4
  97. package/src/DIDConnect/app-icon.tsx +36 -0
  98. package/src/DIDConnect/app-info-item.tsx +82 -0
  99. package/src/DIDConnect/did-connect-footer.tsx +51 -0
  100. package/src/DIDConnect/did-connect-logo.tsx +8 -0
  101. package/src/DIDConnect/index.ts +7 -0
  102. package/src/DIDConnect/powered-by.tsx +48 -0
  103. package/src/DIDConnect/with-container.tsx +307 -0
  104. package/src/DIDConnect/with-ux-theme.tsx +22 -0
  105. package/src/Datatable/CustomToolbar.jsx +1 -0
  106. package/src/Datatable/index.jsx +107 -70
  107. package/src/Dialog/confirm.jsx +31 -23
  108. package/src/Dialog/use-confirm.jsx +6 -0
  109. package/src/Footer/index.tsx +2 -2
  110. package/src/Header/header.tsx +1 -1
  111. package/src/Header/responsive-header.tsx +2 -0
  112. package/src/Layout/dashboard/index.tsx +8 -4
  113. package/src/Layout/dashboard/sidebar.tsx +1 -2
  114. package/src/LoadingMask/index.tsx +3 -4
  115. package/src/Locale/selector.tsx +3 -4
  116. package/src/Locale/util.ts +7 -2
  117. package/src/LoginButton/index.tsx +73 -0
  118. package/src/NavMenu/nav-menu.tsx +15 -10
  119. package/src/NavMenu/products.tsx +1 -1
  120. package/src/NavMenu/style.ts +5 -2
  121. package/src/NavMenu/sub-item-group.tsx +1 -1
  122. package/src/PhoneInput/country-select.tsx +2 -3
  123. package/src/SessionBlocklet/index.tsx +3 -3
  124. package/src/SessionUser/components/did-space.tsx +14 -10
  125. package/src/SessionUser/components/logged-in.tsx +2 -2
  126. package/src/SessionUser/components/quick-login-item.tsx +11 -12
  127. package/src/SessionUser/components/session-user-item.tsx +3 -6
  128. package/src/SessionUser/components/session-user-switch.tsx +13 -12
  129. package/src/SessionUser/components/un-login.tsx +41 -33
  130. package/src/SessionUser/components/user-info.tsx +7 -8
  131. package/src/SessionUser/images/did-spaces.svg +7 -13
  132. package/src/SharedBridge/index.tsx +123 -0
  133. package/src/SharedBridge/need-storage-access-api-dialog.tsx +171 -0
  134. package/src/Success/index.tsx +6 -4
  135. package/src/Switch/index.jsx +3 -3
  136. package/src/Tabs/index.tsx +8 -9
  137. package/src/Theme/index.ts +2 -2
  138. package/src/Theme/theme-provider.tsx +73 -2
  139. package/src/Theme/theme.ts +73 -22
  140. package/src/UserCard/Container/card.tsx +1 -1
  141. package/src/UserCard/Container/dialog.tsx +1 -1
  142. package/src/Util/iframe.ts +19 -0
  143. package/src/Util/index.ts +102 -4
  144. package/src/type.d.ts +5 -1
@@ -152,7 +152,7 @@ const Root = styled(Box)`
152
152
  }
153
153
  .header-brand-desc {
154
154
  margin-top: 4px;
155
- color: #9397a1;
155
+ color: ${({ theme }) => theme.palette.text.hint};
156
156
  }
157
157
  }
158
158
  .header-brand-addon {
@@ -102,6 +102,8 @@ function ResponsiveHeader({ menu, prepend, children, ...rest }: ResponsiveHeader
102
102
  top: 64,
103
103
  bottom: 0,
104
104
  boxShadow: 'none',
105
+ backgroundImage: 'none',
106
+ backgroundColor: theme.palette.background.paper,
105
107
  },
106
108
  }}>
107
109
  <MenuPanel>{_children}</MenuPanel>
@@ -73,6 +73,7 @@ function Dashboard({
73
73
  fullWidth = false,
74
74
  dense = 'auto',
75
75
  footerProps = {},
76
+ sx,
76
77
  children,
77
78
  ...rest
78
79
  }: DashboardProps) {
@@ -98,7 +99,7 @@ function Dashboard({
98
99
  }, []);
99
100
 
100
101
  return (
101
- <Wrapper {...rest} className={classes} sidebarWidth={sidebarWidth}>
102
+ <Wrapper sx={sx} {...rest} className={classes} sidebarWidth={sidebarWidth}>
102
103
  <Helmet title={title} key={title} />
103
104
 
104
105
  {headerVisible && (
@@ -164,7 +165,7 @@ function Dashboard({
164
165
  <Container className="dashboard-content" id="arc__dashboard-content" {...(fullWidth && { maxWidth: false })}>
165
166
  {children}
166
167
  </Container>
167
- {footerVisible && <Footer {...footerProps} />}
168
+ {footerVisible && <Footer {...{ dark: theme.palette.mode === 'dark', ...footerProps }} />}
168
169
  </Box>
169
170
  </Box>
170
171
  </Wrapper>
@@ -180,6 +181,7 @@ const Wrapper = styled('div', {
180
181
  display: flex;
181
182
  flex-direction: column;
182
183
  height: 100vh;
184
+ background-color: ${({ theme }) => theme.palette.background.default};
183
185
  }
184
186
  .dashboard-body {
185
187
  overflow: hidden;
@@ -209,11 +211,13 @@ const Wrapper = styled('div', {
209
211
  }
210
212
  &.dashboard-dense {
211
213
  .dashboard-header {
212
- border-bottom: 1px solid #eee;
214
+ border-bottom: 1px solid;
215
+ border-color: ${({ theme }) => theme.palette.divider};
213
216
  }
214
217
  .dashboard-sidebar {
215
218
  width: 256px;
216
- border-right: 1px solid #eee;
219
+ border-right: 1px solid;
220
+ border-color: ${({ theme }) => theme.palette.divider};
217
221
  }
218
222
  }
219
223
  ${(props) => props.theme.breakpoints.up('md')} {
@@ -1,5 +1,4 @@
1
1
  import Typography from '@mui/material/Typography';
2
- import { teal } from '@mui/material/colors';
3
2
  import clsx from 'clsx';
4
3
  import { styled } from '../../Theme';
5
4
  import { NavLink } from './external-link';
@@ -87,7 +86,7 @@ const Root = styled('div')`
87
86
  &.layout-sidebar-link--active {
88
87
  color: ${(props) => props.theme.palette.primary.main};
89
88
  background: ${gradient};
90
- border-left-color: ${teal.A700};
89
+ border-left-color: ${(props) => props.theme.palette.primary.main};
91
90
  }
92
91
  }
93
92
  .layout-sidebar-icon {
@@ -1,7 +1,5 @@
1
1
  import { Box } from '@mui/material';
2
2
 
3
- import { temp as colors } from '../Colors';
4
-
5
3
  export interface LoadingMaskProps {
6
4
  size?: number;
7
5
  padding?: number;
@@ -49,7 +47,7 @@ export default function LoadingMask({
49
47
  height: finialSize,
50
48
  overflow: 'hidden',
51
49
  borderRadius: `${finialRadius}px`,
52
- backgroundColor: colors.strokeBorderBase,
50
+ backgroundColor: 'grey.200',
53
51
  '&::before,&::after': {
54
52
  content: '""',
55
53
  position: 'absolute',
@@ -68,7 +66,8 @@ export default function LoadingMask({
68
66
  borderRadius: `${finialRadius - finialBorderWidth}px`,
69
67
  },
70
68
  '&::before': {
71
- background: `conic-gradient(from 45deg, ${colors.foregroundsFgInteractiveTransparent} 0%, ${colors.foregroundsFgInteractiveTransparent} 50%, ${colors.foregroundsFgInteractive} 90%, ${colors.foregroundsFgInteractive} 100%)`,
69
+ background: ({ palette }) =>
70
+ `conic-gradient(from 45deg, transparent 0%, transparent 50%, ${palette.secondary.main} 90%, ${palette.secondary.main} 100%)`,
72
71
  transform: 'scale(100)',
73
72
  animation: `rotate ${finialDuration}s linear infinite`,
74
73
  '@keyframes rotate': {
@@ -6,7 +6,6 @@ import CheckIcon from '@iconify-icons/material-symbols/check';
6
6
  import LanguageIcon from 'iconify-icons-material-symbols-400/language';
7
7
  import noop from 'lodash/noop';
8
8
 
9
- import { temp as colors } from '../Colors';
10
9
  import { LocaleContext } from './context';
11
10
  import { styled, useTheme } from '../Theme';
12
11
  import type { Locale } from '../type';
@@ -108,9 +107,9 @@ export default function LocaleSelector(props: LocaleSelectorProps) {
108
107
  <Box
109
108
  className="locales"
110
109
  sx={{
111
- backgroundColor: 'background.default',
110
+ backgroundColor: 'background.paper',
112
111
  boxShadow: 2,
113
- borderRadius: 2,
112
+ borderRadius: 1,
114
113
  }}>
115
114
  <ClickAwayListener onClickAway={onClose}>
116
115
  <MenuList>
@@ -138,7 +137,7 @@ export default function LocaleSelector(props: LocaleSelectorProps) {
138
137
  icon={CheckIcon}
139
138
  className={code === locale ? 'check-icon check-icon-visible' : 'check-icon'}
140
139
  sx={{
141
- marginRight: 0.5,
140
+ marginRight: 1,
142
141
  visibility: code === locale ? 'visible' : 'hidden',
143
142
  }}
144
143
  />
@@ -2,8 +2,13 @@ import get from 'lodash/get';
2
2
  import type { Locale, Translations } from '../type';
3
3
 
4
4
  /* eslint-disable no-prototype-builtins */
5
- export const replace = (template: string, data: Record<string, any>) =>
6
- template.replace(/{(\w*)}/g, (m, key) => (data.hasOwnProperty(key) ? data[key] : ''));
5
+ export const replace = (template: string | Function, data: Record<string, any>) => {
6
+ if (typeof template === 'function') {
7
+ return template(data);
8
+ }
9
+
10
+ return template.replace(/{(\w*)}/g, (m, key) => (data.hasOwnProperty(key) ? data[key] : ''));
11
+ };
7
12
 
8
13
  export const translate = (
9
14
  translations: Translations,
@@ -0,0 +1,73 @@
1
+ import { Box } from '@mui/material';
2
+ import { joinURL } from 'ufo';
3
+ import { useRef, useState } from 'react';
4
+ import { useMemoizedFn } from 'ahooks';
5
+ import { useBrowser } from '@arcblock/react-hooks';
6
+
7
+ import SharedBridge from '../SharedBridge';
8
+ import { setVisitorId } from '../Util';
9
+ import { getFederatedEnabled, getMaster } from '../Util/federated';
10
+ import { callIframe } from '../Util/iframe';
11
+ import { Locale } from '../type';
12
+
13
+ type LoginButtonProps = {
14
+ onClick: (options?: { openMode?: 'popup' | 'window' }) => void;
15
+ render: (options: { onClick: () => void }) => React.ReactNode;
16
+ locale?: Locale;
17
+ };
18
+
19
+ export default function LoginButton({ onClick, render, locale }: LoginButtonProps) {
20
+ const blocklet = window?.blocklet;
21
+ const federatedEnabled = getFederatedEnabled(blocklet);
22
+ const masterSite = getMaster(blocklet);
23
+ const sharedBridgeRef = useRef<HTMLIFrameElement>(null);
24
+ const [hasStorageAccess, setHasStorageAccess] = useState(false);
25
+ const browser = useBrowser();
26
+
27
+ const handleClick = useMemoizedFn(() => {
28
+ if (hasStorageAccess) {
29
+ onClick({ openMode: 'popup' });
30
+ } else {
31
+ onClick();
32
+ }
33
+ });
34
+ const handleLoad = useMemoizedFn(async () => {
35
+ const { value: visitorId } = await callIframe(sharedBridgeRef.current as HTMLIFrameElement, 'getVisitorId');
36
+ if (visitorId) {
37
+ setHasStorageAccess(true);
38
+ setVisitorId(visitorId);
39
+ }
40
+ });
41
+ const handleClickBridge = useMemoizedFn(({ value, visitorId }) => {
42
+ if (visitorId) {
43
+ setVisitorId(visitorId);
44
+ }
45
+ if (value) {
46
+ onClick({ openMode: 'popup' });
47
+ } else {
48
+ onClick();
49
+ }
50
+ });
51
+
52
+ if (browser.arcSphere || browser.wallet) {
53
+ return render({ onClick });
54
+ }
55
+
56
+ return (
57
+ <Box
58
+ sx={{
59
+ position: 'relative',
60
+ }}>
61
+ {render({ onClick: handleClick })}
62
+ {masterSite?.appUrl && federatedEnabled ? (
63
+ <SharedBridge
64
+ locale={locale}
65
+ iframeRef={sharedBridgeRef}
66
+ onLoad={handleLoad}
67
+ onClick={handleClickBridge}
68
+ src={joinURL(masterSite.appUrl, '/.well-known/service/share/shared-bridge.html')}
69
+ />
70
+ ) : null}
71
+ </Box>
72
+ );
73
+ }
@@ -7,6 +7,7 @@ import { useCreation, useMemoizedFn, useReactive, useSize, useThrottleFn } from
7
7
  import { NavMenuProvider, useNavMenuContext } from './nav-menu-context';
8
8
  import { NavMenuRoot, NavMenuItem, NavMenuSub, NavMenuSubList, NavMenuStyled } from './style';
9
9
  import { SubContainer } from './sub-container';
10
+ import { useTheme } from '../Theme';
10
11
 
11
12
  // 过滤 children 中的 Item/Sub, 忽略其它类型的 element
12
13
  function filterItems(children: React.ReactNode) {
@@ -57,12 +58,16 @@ function NavMenu({
57
58
  mode = 'horizontal',
58
59
  children: _childs = null,
59
60
  activeId = null,
60
- textColor = '#9397a1',
61
- activeTextColor = '#25292f',
62
- bgColor = '#fff',
61
+ textColor,
62
+ activeTextColor,
63
+ bgColor,
63
64
  onSelected,
64
65
  ...rest
65
66
  }: NavMenuProps) {
67
+ const theme = useTheme();
68
+ const $textColor = useCreation(() => theme.palette.grey[400], [theme]);
69
+ const $activeTextColor = useCreation(() => theme.palette.text.primary, [theme]);
70
+ const $bgColor = useCreation(() => theme.palette.background.default, [theme]);
66
71
  // eslint-disable-next-line no-param-reassign
67
72
  const children = filterItems(_childs);
68
73
  if (!items?.length && !children?.length) {
@@ -89,9 +94,9 @@ function NavMenu({
89
94
  return {
90
95
  ...currentState,
91
96
  mode,
92
- textColor,
93
- activeTextColor,
94
- bgColor,
97
+ textColor: $textColor,
98
+ activeTextColor: $activeTextColor,
99
+ bgColor: $bgColor,
95
100
  activate,
96
101
  open,
97
102
  close,
@@ -101,9 +106,9 @@ function NavMenu({
101
106
  currentState.hiddenItemCount,
102
107
  currentState.openedIds,
103
108
  mode,
104
- textColor,
105
- activeTextColor,
106
- bgColor,
109
+ $textColor,
110
+ $activeTextColor,
111
+ $bgColor,
107
112
  activate,
108
113
  open,
109
114
  close,
@@ -259,7 +264,7 @@ function NavMenu({
259
264
 
260
265
  return (
261
266
  <NavMenuProvider value={contextValue}>
262
- <NavMenuStyled {...rest} className={classes} $textColor={textColor} $bgColor={bgColor}>
267
+ <NavMenuStyled {...rest} className={classes} $textColor={$textColor} $bgColor={$bgColor}>
263
268
  <NavMenuRoot className={clsx('navmenu-root', `navmenu-root--${mode}`)} ref={navMenuRef}>
264
269
  {items ? items.map((item, index) => renderItem(item, index)) : renderChildrenWithRef(children || [])}
265
270
  {currentState.hiddenItemCount > 0 && (
@@ -162,7 +162,7 @@ const Wrapper = styled(Box)`
162
162
  width: 80vw;
163
163
  max-width: 900px;
164
164
  padding: 8px;
165
- background: #f7f9fc;
165
+ background: ${({ theme }) => theme.palette.grey[100]};
166
166
  border-radius: 8px;
167
167
 
168
168
  &.is-inline {
@@ -8,7 +8,7 @@ type NavMenuProps = {
8
8
  // .navmenu
9
9
  export const NavMenuStyled = styled('nav', {
10
10
  shouldForwardProp: (prop) => prop !== '$bgColor' && prop !== '$textColor',
11
- })<NavMenuProps>(({ $bgColor, $textColor }) => ({
11
+ })<NavMenuProps>(({ $bgColor, $textColor, theme }) => ({
12
12
  position: 'relative',
13
13
  padding: '0 16px',
14
14
  minWidth: '50px',
@@ -17,6 +17,9 @@ export const NavMenuStyled = styled('nav', {
17
17
  backgroundColor: $bgColor,
18
18
  color: $textColor,
19
19
  fontSize: '16px',
20
+ '&.navmenu--inline': {
21
+ backgroundColor: theme.palette.background.paper,
22
+ },
20
23
  }));
21
24
 
22
25
  // .navmenu-root
@@ -241,7 +244,7 @@ export const NavMenuSubList = styled('ul')(({ theme }) => ({
241
244
  margin: 0,
242
245
  padding: '16px',
243
246
  borderRadius: '4px',
244
- background: theme.palette.background.default,
247
+ backgroundColor: theme.palette.background.paper,
245
248
  '& .navmenu-item + .navmenu-item': {
246
249
  marginTop: '8px',
247
250
  },
@@ -4,7 +4,7 @@ import { styled } from '../Theme';
4
4
  const Group = styled(Box)`
5
5
  padding: 16px 24px;
6
6
  border-radius: 8px;
7
- background-color: ${({ theme }) => theme.palette.background.default};
7
+ background-color: ${({ theme }) => theme.palette.background.paper};
8
8
  cursor: auto;
9
9
 
10
10
  .group-label {
@@ -4,7 +4,6 @@ import { FlagEmoji, defaultCountries, parseCountry } from 'react-international-p
4
4
  import type { CountryIso2 } from 'react-international-phone';
5
5
  import { ParsedCountry } from 'react-international-phone/build/types';
6
6
  import ArrowDownwardIcon from '@arcblock/icons/lib/ArrowDown';
7
- import { temp as colors } from '../Colors';
8
7
  import { mergeSx } from '../Util/style';
9
8
 
10
9
  export interface CountryDisplayOptions {
@@ -97,11 +96,11 @@ const CountrySelectInner = forwardRef(
97
96
  svg: { right: 4, top: 10 },
98
97
  '&:hover': {
99
98
  'fieldset.MuiOutlinedInput-notchedOutline': {
100
- borderColor: colors.dividerColor,
99
+ borderColor: 'divider',
101
100
  },
102
101
  },
103
102
  'fieldset.MuiOutlinedInput-notchedOutline': {
104
- borderColor: colors.dividerColor,
103
+ borderColor: 'divider',
105
104
  },
106
105
  '.MuiMenuItem-root': { justifyContent: 'flex-start' },
107
106
  },
@@ -98,7 +98,7 @@ export default function SessionBlocklet({
98
98
  <Paper
99
99
  variant="outlined"
100
100
  sx={{
101
- borderRadius: 3,
101
+ borderRadius: 1.5,
102
102
  width: 350,
103
103
  maxWidth: '90vw',
104
104
  p: 2,
@@ -127,7 +127,7 @@ export default function SessionBlocklet({
127
127
  gap: 1,
128
128
  width: '100%',
129
129
  height: '100%',
130
- borderRadius: 2,
130
+ borderRadius: 1,
131
131
  '&:hover': {
132
132
  backgroundColor: 'action.hover',
133
133
  },
@@ -137,7 +137,7 @@ export default function SessionBlocklet({
137
137
  component="img"
138
138
  src={`${BLOCKLET_SERVICE_PATH_PREFIX}/blocklet/logo-bundle/${item.component.did}`}
139
139
  sx={{
140
- borderRadius: 2,
140
+ borderRadius: 1,
141
141
  width: 50,
142
142
  height: 50,
143
143
  objectFit: 'contain',
@@ -1,9 +1,8 @@
1
1
  import { useState } from 'react';
2
2
  import { useMemoizedFn } from 'ahooks';
3
- import { MenuItem, BoxProps, Divider } from '@mui/material';
3
+ import { MenuItem, BoxProps, Divider, useTheme } from '@mui/material';
4
4
  import { Icon } from '@iconify/react';
5
5
  import LensIcon from '@iconify-icons/material-symbols/lens';
6
- import { temp as colors } from '../../Colors';
7
6
  import { Locale, Session } from '../../type';
8
7
  import { translate } from '../../Locale/util';
9
8
  import { translations } from '../libs/translation';
@@ -21,6 +20,7 @@ export default function DidSpace({ session, locale = 'en', ...rest }: DidSpacePr
21
20
  const t = useMemoizedFn((key, data = {}) => {
22
21
  return translate(translations, key, locale, 'en', data);
23
22
  });
23
+ const theme = useTheme();
24
24
 
25
25
  const didSpace = session.user?.didSpace ?? {};
26
26
  const [offset, setOffset] = useState(0);
@@ -36,20 +36,24 @@ export default function DidSpace({ session, locale = 'en', ...rest }: DidSpacePr
36
36
  display: 'flex',
37
37
  alignItems: 'center',
38
38
  gap: 0.5,
39
- '&:hover': {
40
- backgroundColor: `${colors.surfacePrimarySubtitle} !important`,
41
- },
42
39
  py: 1,
43
40
  }}>
44
41
  <div style={{ display: 'flex', alignItems: 'center' }}>
45
- <DIDSpaceIcon style={{ height: '24px', marginLeft: '-24px', marginRight: '-28px' }} />
42
+ <DIDSpaceIcon
43
+ style={{
44
+ height: '24px',
45
+ marginLeft: '-24px',
46
+ marginRight: '-28px',
47
+ fill: theme.palette.text.secondary,
48
+ }}
49
+ />
46
50
  </div>
47
- <span style={{ color: colors.foregroundsFgSubtile }}>:</span>
51
+ <span style={{ color: theme.palette.text.secondary }}>:</span>
48
52
  <div
49
53
  style={{
50
54
  flexGrow: 1,
51
55
  minWidth: 0,
52
- color: didSpace.did ? colors.foregroundsFgSubtile : colors.textMuted,
56
+ color: didSpace.did ? theme.palette.text.primary : theme.palette.text.secondary,
53
57
  overflow: 'hidden',
54
58
  whiteSpace: 'nowrap',
55
59
  }}>
@@ -61,11 +65,11 @@ export default function DidSpace({ session, locale = 'en', ...rest }: DidSpacePr
61
65
  style={{ marginTop: `${offset}px`, flexShrink: 0 }}
62
66
  icon={LensIcon}
63
67
  fontSize={8}
64
- color={didSpace.did ? colors.surfaceSuccess : colors.gray6}
68
+ color={didSpace.did ? theme.palette.success.main : theme.palette.grey[200]}
65
69
  />
66
70
  </MenuItem>
67
71
  </TBox>
68
- <Divider sx={{ m: '0!important', borderColor: colors.strokeSep }} />
72
+ <Divider />
69
73
  </>
70
74
  );
71
75
  }
@@ -173,7 +173,7 @@ export default function LoggedIn({
173
173
  <Paper
174
174
  variant="outlined"
175
175
  sx={{
176
- borderRadius: 3,
176
+ borderRadius: 1.5,
177
177
  width: 350,
178
178
  maxWidth: '90vw',
179
179
  border: '0 !important',
@@ -257,7 +257,7 @@ function SessionMenuItem<C extends ElementType>({
257
257
  display: 'flex',
258
258
  gap: 1,
259
259
  alignItems: 'center',
260
- borderRadius: 2,
260
+ borderRadius: 1,
261
261
  '&:hover': {
262
262
  backgroundColor: 'action.hover',
263
263
  },
@@ -1,10 +1,8 @@
1
- import PropTypes from 'prop-types';
2
1
  import DID from '@arcblock/ux/lib/DID';
3
2
  import RelativeTime from '@arcblock/ux/lib/RelativeTime';
4
3
  import WalletOSIcon from '@arcblock/ux/lib/WalletOSIcon';
5
- import { Box, Chip, Typography, useMediaQuery } from '@mui/material';
4
+ import { Box, Chip, Typography, useMediaQuery, useTheme } from '@mui/material';
6
5
  import type { Theme } from '@mui/material';
7
- import { temp as colors } from '@arcblock/ux/lib/Colors';
8
6
  import noop from 'lodash/noop';
9
7
 
10
8
  import Avatar from '../../Avatar';
@@ -33,24 +31,25 @@ export default function QuickLoginItem({
33
31
  updatedAt: string;
34
32
  };
35
33
  }) {
34
+ const { palette } = useTheme();
36
35
  const isMobile = useMediaQuery((theme: Theme) => theme.breakpoints.down('md'));
37
36
  const isRawWalletAccount = getSourceProvider(userSession?.user) === 'wallet';
38
37
 
39
38
  return (
40
39
  <Box
41
40
  sx={{
42
- borderRadius: 2,
41
+ borderRadius: 1,
43
42
  p: 2,
44
43
  transition: 'background-color 0.5s',
45
44
  '&:hover, &:active': {
46
- backgroundColor: colors.backgroundsBgSubtileHover,
45
+ backgroundColor: 'grey.100',
47
46
  },
48
47
  display: 'flex',
49
48
  justifyContent: 'space-between',
50
49
  alignItems: 'center',
51
50
  cursor: 'pointer',
52
51
  '&:hover': {
53
- backgroundColor: colors.surfacePrimarySubtitle,
52
+ backgroundColor: 'grey.200',
54
53
  },
55
54
  width: '100%',
56
55
  backgroundColor: 'white',
@@ -74,7 +73,7 @@ export default function QuickLoginItem({
74
73
  display: 'flex',
75
74
  alignItems: 'center',
76
75
  gap: 1,
77
- color: colors.textBase,
76
+ color: 'text.primary',
78
77
  }}>
79
78
  {userSession.user.fullName}
80
79
  <Chip
@@ -85,8 +84,8 @@ export default function QuickLoginItem({
85
84
  height: 'auto',
86
85
  fontWeight: 'bold',
87
86
  fontSize: '12px',
88
- borderColor: colors.lineBorderStrong,
89
- color: colors.textSubtitle,
87
+ borderColor: 'grey.300',
88
+ color: 'text.secondary',
90
89
  })}
91
90
  />
92
91
  </Typography>
@@ -100,7 +99,7 @@ export default function QuickLoginItem({
100
99
  <WalletOSIcon
101
100
  provider={userSession?.extra?.provider}
102
101
  walletOS={userSession?.extra?.walletOS}
103
- color={colors.textSubtitle}
102
+ color={palette.text.secondary}
104
103
  />
105
104
  <DID
106
105
  // @ts-ignore
@@ -119,12 +118,12 @@ export default function QuickLoginItem({
119
118
  />
120
119
  </Box>
121
120
  ) : (
122
- <Typography sx={{ fontSize: '12px', color: colors.textSubtitle }}>{userSession.user.email}</Typography>
121
+ <Typography sx={{ fontSize: '12px', color: 'text.secondary' }}>{userSession.user.email}</Typography>
123
122
  )}
124
123
  </Box>
125
124
  </Box>
126
125
  {userSession.updatedAt && !isMobile && (
127
- <Box component="span" sx={{ color: colors.textMuted, fontSize: '12px', flexShrink: 0 }}>
126
+ <Box component="span" sx={{ color: 'text.hint', fontSize: '12px', flexShrink: 0 }}>
128
127
  {/* @ts-ignore */}
129
128
  <RelativeTime value={userSession.updatedAt} locale={locale} />
130
129
  </Box>
@@ -1,12 +1,11 @@
1
1
  import { forwardRef } from 'react';
2
- import { Box, type BoxProps, IconButton, Tooltip, Typography } from '@mui/material';
2
+ import { Box, type BoxProps, IconButton, Tooltip, Typography, useTheme } from '@mui/material';
3
3
  import { Icon } from '@iconify/react';
4
4
  import LensIcon from '@iconify-icons/material-symbols/lens';
5
5
 
6
6
  import WalletOSIcon from '../../WalletOSIcon';
7
7
  import Avatar from '../../Avatar';
8
8
  import DID from '../../DID';
9
- import { temp as colors } from '../../Colors';
10
9
  import { getSourceProvider } from '../libs/utils';
11
10
  import { Session } from '../../type';
12
11
 
@@ -18,6 +17,7 @@ export interface SessionUserItemProps extends BoxProps {
18
17
 
19
18
  const SessionUserItem = forwardRef<HTMLDivElement, SessionUserItemProps>(
20
19
  ({ sessionItem, statusContent = null, active = false, ...rest }, ref) => {
20
+ const { palette } = useTheme();
21
21
  const isRawWalletAccount = getSourceProvider(sessionItem?.user) === 'wallet';
22
22
 
23
23
  return (
@@ -42,9 +42,6 @@ const SessionUserItem = forwardRef<HTMLDivElement, SessionUserItemProps>(
42
42
  '& .did-address-avatar': {
43
43
  display: 'none !important',
44
44
  },
45
- '& .did-address-text': {
46
- color: `${colors.textBase} !important`,
47
- },
48
45
  }}>
49
46
  <Box sx={{ mr: 0.5, fontSize: 0 }}>
50
47
  <Avatar did={sessionItem.userDid} size={36} />
@@ -86,7 +83,7 @@ const SessionUserItem = forwardRef<HTMLDivElement, SessionUserItemProps>(
86
83
  {statusContent ||
87
84
  (active && (
88
85
  <IconButton size="small" disableRipple>
89
- <Icon icon={LensIcon} fontSize={6} color={colors.surfaceSuccess} />
86
+ <Icon icon={LensIcon} fontSize={6} color={palette.success.main} />
90
87
  </IconButton>
91
88
  ))}
92
89
  </Box>