@arcblock/ux 2.13.11 → 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.
Files changed (95) hide show
  1. package/lib/ActivityIndicator/index.js +9 -5
  2. package/lib/Address/did-address.js +14 -7
  3. package/lib/BlockletV2/blocklet.js +1 -1
  4. package/lib/CloseButton/index.js +1 -2
  5. package/lib/Colors/index.d.ts +1 -3
  6. package/lib/Colors/index.js +2 -4
  7. package/lib/Colors/themes/default.d.ts +3 -66
  8. package/lib/Colors/themes/default.js +4 -74
  9. package/lib/Colors/themes/did-connect.d.ts +11 -6
  10. package/lib/Colors/themes/did-connect.js +17 -12
  11. package/lib/Colors/themes/temp.d.ts +3 -0
  12. package/lib/Colors/themes/temp.js +3 -0
  13. package/lib/Config/config-provider.d.ts +4 -5
  14. package/lib/Config/config-provider.js +7 -26
  15. package/lib/Config/theme-mode-toggle.js +0 -1
  16. package/lib/DID/index.js +3 -4
  17. package/lib/Datatable/CustomToolbar.js +3 -0
  18. package/lib/Datatable/index.js +105 -71
  19. package/lib/Footer/index.js +2 -5
  20. package/lib/Header/header.js +3 -1
  21. package/lib/Header/responsive-header.js +3 -1
  22. package/lib/Layout/dashboard/index.js +14 -2
  23. package/lib/Layout/dashboard/sidebar.js +1 -2
  24. package/lib/LoadingMask/index.js +4 -3
  25. package/lib/Locale/selector.js +3 -3
  26. package/lib/NavMenu/nav-menu.js +14 -9
  27. package/lib/NavMenu/products.js +3 -1
  28. package/lib/NavMenu/style.js +7 -3
  29. package/lib/NavMenu/sub-item-group.js +1 -1
  30. package/lib/PhoneInput/country-select.js +2 -3
  31. package/lib/SessionBlocklet/index.js +3 -3
  32. package/lib/SessionUser/components/did-space.js +14 -28
  33. package/lib/SessionUser/components/logged-in.js +2 -2
  34. package/lib/SessionUser/components/quick-login-item.js +13 -11
  35. package/lib/SessionUser/components/session-user-item.js +5 -6
  36. package/lib/SessionUser/components/session-user-switch.js +15 -13
  37. package/lib/SessionUser/components/un-login.js +9 -7
  38. package/lib/SessionUser/components/user-info.js +9 -8
  39. package/lib/SessionUser/images/did-spaces.svg +7 -13
  40. package/lib/Success/index.js +8 -4
  41. package/lib/Switch/index.js +3 -3
  42. package/lib/Tabs/index.js +8 -9
  43. package/lib/Theme/theme-provider.d.ts +5 -1
  44. package/lib/Theme/theme-provider.js +60 -5
  45. package/lib/Theme/theme.d.ts +6 -3
  46. package/lib/Theme/theme.js +55 -19
  47. package/lib/UserCard/Container/card.js +1 -1
  48. package/lib/UserCard/Container/dialog.js +1 -1
  49. package/lib/Util/index.d.ts +8 -0
  50. package/lib/Util/index.js +23 -1
  51. package/lib/type.d.ts +5 -1
  52. package/package.json +7 -6
  53. package/src/ActivityIndicator/index.jsx +4 -4
  54. package/src/Address/did-address.tsx +5 -5
  55. package/src/BlockletV2/blocklet.tsx +1 -1
  56. package/src/CloseButton/index.tsx +1 -2
  57. package/src/Colors/index.ts +2 -7
  58. package/src/Colors/themes/default.ts +4 -50
  59. package/src/Colors/themes/did-connect.ts +13 -6
  60. package/src/Colors/themes/temp.ts +3 -0
  61. package/src/Config/config-provider.tsx +17 -30
  62. package/src/Config/theme-mode-toggle.tsx +1 -1
  63. package/src/DID/index.tsx +3 -4
  64. package/src/Datatable/CustomToolbar.jsx +1 -0
  65. package/src/Datatable/index.jsx +107 -70
  66. package/src/Footer/index.tsx +2 -2
  67. package/src/Header/header.tsx +1 -1
  68. package/src/Header/responsive-header.tsx +2 -0
  69. package/src/Layout/dashboard/index.tsx +8 -4
  70. package/src/Layout/dashboard/sidebar.tsx +1 -2
  71. package/src/LoadingMask/index.tsx +3 -4
  72. package/src/Locale/selector.tsx +3 -4
  73. package/src/NavMenu/nav-menu.tsx +15 -10
  74. package/src/NavMenu/products.tsx +1 -1
  75. package/src/NavMenu/style.ts +5 -2
  76. package/src/NavMenu/sub-item-group.tsx +1 -1
  77. package/src/PhoneInput/country-select.tsx +2 -3
  78. package/src/SessionBlocklet/index.tsx +3 -3
  79. package/src/SessionUser/components/did-space.tsx +14 -10
  80. package/src/SessionUser/components/logged-in.tsx +2 -2
  81. package/src/SessionUser/components/quick-login-item.tsx +11 -12
  82. package/src/SessionUser/components/session-user-item.tsx +3 -6
  83. package/src/SessionUser/components/session-user-switch.tsx +13 -12
  84. package/src/SessionUser/components/un-login.tsx +7 -6
  85. package/src/SessionUser/components/user-info.tsx +7 -8
  86. package/src/SessionUser/images/did-spaces.svg +7 -13
  87. package/src/Success/index.tsx +6 -4
  88. package/src/Switch/index.jsx +3 -3
  89. package/src/Tabs/index.tsx +8 -9
  90. package/src/Theme/theme-provider.tsx +73 -2
  91. package/src/Theme/theme.ts +73 -22
  92. package/src/UserCard/Container/card.tsx +1 -1
  93. package/src/UserCard/Container/dialog.tsx +1 -1
  94. package/src/Util/index.ts +25 -0
  95. package/src/type.d.ts +5 -1
@@ -1,3 +1,8 @@
1
+ import type { Theme } from '@mui/material';
2
+
3
+ /**
4
+ * @deprecated 请使用 MUI theme 对象替代
5
+ */
1
6
  const colors = {
2
7
  background: {
3
8
  overlay: 'rgba(15, 23, 42, 0.5)',
@@ -10,7 +15,7 @@ const colors = {
10
15
  text: {
11
16
  primary: '#18181B',
12
17
  secondary: '#71717B',
13
- disable: '#D4D4D8',
18
+ disabled: '#D4D4D8',
14
19
  hint: '#D4D4D8',
15
20
  },
16
21
  state: {
@@ -23,37 +28,39 @@ const colors = {
23
28
  main: '#2B7FFF',
24
29
  light: '#51A2FF',
25
30
  dark: '#155DFC',
31
+ contrastText: '#fff',
26
32
  },
27
33
  secondary: {
28
34
  main: '#615FFF',
29
35
  light: '#7C86FF',
30
36
  dark: '#4F39F6',
37
+ contrastText: '#fff',
31
38
  },
32
39
  error: {
33
40
  main: '#FB2C36',
34
41
  light: '#FF6467',
35
42
  dark: '#E7000B',
43
+ contrastText: '#fff',
36
44
  },
37
45
  warning: {
38
46
  main: '#FF6900',
39
47
  light: '#FF8904',
40
48
  dark: '#F54900',
49
+ contrastText: '#fff',
41
50
  },
42
51
  info: {
43
52
  main: '#2B7FFF',
44
53
  light: '#51A2FF',
45
54
  dark: '#155DFC',
55
+ contrastText: '#fff',
46
56
  },
47
57
  success: {
48
58
  main: '#00C950',
49
59
  light: '#05DF72',
50
60
  dark: '#00A63E',
61
+ contrastText: '#fff',
51
62
  },
52
- divider: {
53
- main: 'rgba(18, 22, 24, 0.06)',
54
- light: '#F4F4F5',
55
- dark: '#D4D4D5',
56
- },
63
+ divider: 'rgba(18, 22, 24, 0.06)',
57
64
  };
58
65
 
59
66
  export default colors;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @deprecated 请使用 MUI theme 对象替代
3
+ */
1
4
  const colors = {
2
5
  textMuted: 'rgba(18, 22, 24, 0.36)',
3
6
  textSubtitle: 'rgba(18, 22, 24, 0.6)',
@@ -1,34 +1,33 @@
1
1
  import { createContext, useContext, ReactNode, useMemo, useState, useCallback, useEffect } from 'react';
2
- import { type PaletteMode } from '@mui/material';
3
- import type { ThemeOptions } from '@mui/material/styles';
4
- import useMediaQuery from '@mui/material/useMediaQuery';
2
+ import { ThemeOptions, type PaletteMode } from '@mui/material';
3
+ import { BLOCKLET_THEME_PREFER_KEY } from '@blocklet/theme';
5
4
  import set from 'lodash/set';
6
5
  import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
7
6
  import { LocaleProvider, LocaleProviderProps, useLocaleContext } from '../Locale/context';
8
7
  import ThemeProvider, { ThemeProviderProps } from '../Theme/theme-provider';
9
- import { createTheme, useTheme } from '../Theme';
8
+ import {
9
+ createTheme,
10
+ getDefaultThemePrefer,
11
+ lazyThemeConfig,
12
+ useTheme,
13
+ type UserThemeOptions,
14
+ type ThemeConfig,
15
+ } from '../Theme';
10
16
 
11
17
  export interface ConfigContextType {
12
18
  mode: PaletteMode;
13
- themeOptions: ThemeOptions;
19
+ themeOptions: UserThemeOptions;
14
20
  toggleMode: () => void;
15
21
  }
16
22
 
17
23
  const ConfigContext = createContext<ConfigContextType>({} as ConfigContextType);
18
- const preferThemeModeKey = 'blocklet_theme_prefer';
19
-
20
- export function isThemeRecord(
21
- theme: ThemeOptions | Record<PaletteMode, ThemeOptions>
22
- ): theme is Record<PaletteMode, ThemeOptions> {
23
- return 'light' in theme || 'dark' in theme;
24
- }
25
24
 
26
25
  export interface ConfigProviderProps
27
26
  extends Omit<LocaleProviderProps, 'translations'>,
28
27
  Omit<ThemeProviderProps, 'theme'> {
29
28
  children: ReactNode;
30
29
  prefer?: PaletteMode;
31
- theme?: ThemeOptions | Record<PaletteMode, ThemeOptions>;
30
+ theme?: UserThemeOptions | ((config: ThemeConfig) => UserThemeOptions);
32
31
  disableBlockletTheme?: boolean;
33
32
  translations?: Record<string, any>;
34
33
  }
@@ -50,33 +49,21 @@ export function ConfigProvider({
50
49
  languages,
51
50
  onLoadingTranslation,
52
51
  }: ConfigProviderProps) {
53
- const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
54
52
  const [mode, setMode] = useState<PaletteMode>(() => {
55
53
  if (prefer) {
56
54
  return prefer;
57
55
  }
58
56
 
59
- // 未启用暗色主题
60
- if (['1', 'true'].includes(window.blocklet?.USE_DARK_THEME) === false) {
61
- return 'light';
62
- }
63
-
64
- // 本地缓存
65
- const localPrefer = localStorage.getItem(preferThemeModeKey) as PaletteMode;
66
- if (localPrefer && (localPrefer === 'light' || localPrefer === 'dark')) {
67
- return localPrefer;
68
- }
69
-
70
- // 系统偏好
71
- return prefersDarkMode ? 'dark' : 'light';
57
+ return getDefaultThemePrefer();
72
58
  });
73
59
 
74
60
  const _themeOptions = useMemo(() => {
75
61
  let result: ThemeOptions = {};
62
+ const getThemeConfig = lazyThemeConfig(mode);
76
63
 
77
64
  if (themeOptions) {
78
- if (isThemeRecord(themeOptions)) {
79
- result = themeOptions[mode] ? { ...themeOptions[mode] } : {};
65
+ if (typeof themeOptions === 'function') {
66
+ result = themeOptions(getThemeConfig());
80
67
  } else {
81
68
  result = { ...themeOptions };
82
69
  }
@@ -95,7 +82,7 @@ export function ConfigProvider({
95
82
  const toggleMode = useCallback(() => {
96
83
  const newMode = mode === 'light' ? 'dark' : 'light';
97
84
  setMode(newMode);
98
- localStorage.setItem(preferThemeModeKey, newMode);
85
+ localStorage.setItem(BLOCKLET_THEME_PREFER_KEY, newMode);
99
86
  }, [mode, setMode]);
100
87
 
101
88
  const config = useMemo(
@@ -15,7 +15,7 @@ export default function ThemeModeToggle() {
15
15
  }
16
16
 
17
17
  return (
18
- <IconButton onClick={toggleMode} color="inherit">
18
+ <IconButton onClick={toggleMode}>
19
19
  {mode === 'light' ? <LightModeOutlinedIcon /> : <Brightness2OutlinedIcon />}
20
20
  </IconButton>
21
21
  );
package/src/DID/index.tsx CHANGED
@@ -9,7 +9,6 @@ import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
9
9
 
10
10
  import Address, { IDidAddressWrapper } 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
 
15
14
  import { HTMLDidAddressElement } from '../Address/did-address';
@@ -222,7 +221,7 @@ export const DID = forwardRef<HTMLDIDElement, DIDProps>((props, ref) => {
222
221
  flexShrink: 0,
223
222
  cursor: 'pointer',
224
223
  ml: 0.5,
225
- color: 'grey.500',
224
+ color: 'text.secondary',
226
225
  }}
227
226
  />
228
227
  ) : null}
@@ -290,7 +289,7 @@ export function DIDDialog({
290
289
  target="_blank"
291
290
  rel="noreferrer"
292
291
  sx={{
293
- color: colors.foregroundsFgInteractive,
292
+ color: 'secondary.main',
294
293
  textDecoration: 'none',
295
294
  '&:hover': {
296
295
  textDecoration: 'underline',
@@ -371,7 +370,7 @@ export function DIDDialog({
371
370
  <Typography
372
371
  variant="body2"
373
372
  sx={{
374
- color: colors.textSubtitle,
373
+ color: 'text.secondary',
375
374
  fontSize: '12px',
376
375
  mt: 1,
377
376
  }}>
@@ -356,6 +356,7 @@ const Container = styled('div')`
356
356
  display: flex;
357
357
  align-items: center;
358
358
  height: 56px;
359
+ background-color: ${({ theme }) => theme.palette.background.default};
359
360
  .custom-toobar-title {
360
361
  position: relative;
361
362
  flex: 1;
@@ -488,101 +488,138 @@ const alignCss = css`
488
488
  }
489
489
  `;
490
490
 
491
- const TableContainer = styled('div', { shouldForwardProp: (prop) => prop !== 'verticalKeyWidth' })`
492
- &.datatable-hide-header {
493
- thead.MuiTableHead-root {
494
- display: none;
495
- }
496
- }
491
+ const TableContainer = styled('div', { shouldForwardProp: (prop) => prop !== 'verticalKeyWidth' })(({
492
+ theme,
493
+ verticalKeyWidth,
494
+ }) => {
495
+ const primaryTextColor = theme.palette.text.primary;
496
+ const defaultBgColor = theme.palette.background.default;
497
+ const hoverBgColor = theme.palette.action.hover;
498
+ const oddRowBgColor = theme.palette.grey[50];
499
+
500
+ const verticalKeyWidthStyle = verticalKeyWidth
501
+ ? `
502
+ ${theme.breakpoints.down('md')} {
503
+ [class*='MUIDataTable-responsiveBase'] {
504
+ tr:not([class*='responsiveSimple']) {
505
+ td.MuiTableCell-body {
506
+ > div {
507
+ &:first-of-type {
508
+ width: ${verticalKeyWidth + (!/\D/.test(verticalKeyWidth) ? 'px' : '')};
509
+ }
510
+ }
511
+ }
512
+ }
513
+ }
514
+ }
515
+ `
516
+ : '';
497
517
 
498
- td {
499
- &.vertical-align-top {
500
- align-items: flex-start;
501
- }
502
- &.vertical-align-center {
503
- align-items: center;
518
+ return css`
519
+ &.datatable-hide-header {
520
+ thead.MuiTableHead-root {
521
+ display: none;
522
+ }
504
523
  }
505
- &.vertical-align-bottom {
506
- align-items: flex-end;
524
+
525
+ td {
526
+ &.vertical-align-top {
527
+ align-items: flex-start;
528
+ }
529
+ &.vertical-align-center {
530
+ align-items: center;
531
+ }
532
+ &.vertical-align-bottom {
533
+ align-items: flex-end;
534
+ }
507
535
  }
508
- }
509
536
 
510
- height: 100%;
511
- > .MuiPaper-root {
512
- display: flex;
513
- flex-direction: column;
514
537
  height: 100%;
515
- box-shadow: none;
516
- }
517
- ${(props) => props.theme.breakpoints.down('md')} {
518
- td.MuiTableCell-body {
519
- padding-right: 0;
538
+ > .MuiPaper-root {
539
+ display: flex;
540
+ flex-direction: column;
541
+ height: 100%;
542
+ box-shadow: none;
543
+ background: none;
544
+ background-color: ${defaultBgColor};
520
545
  }
521
- [class*='MUIDataTable-responsiveBase'] {
522
- tr:not([class*='responsiveSimple']) {
523
- td.MuiTableCell-body {
524
- display: flex;
525
- > div {
526
- width: auto;
527
- flex: 1;
528
- &:first-of-type {
529
- font-weight: bold;
530
- font-size: 14px;
546
+ ${theme.breakpoints.down('md')} {
547
+ td.MuiTableCell-body {
548
+ padding-right: 0;
549
+ }
550
+ [class*='MUIDataTable-responsiveBase'] {
551
+ tr:not([class*='responsiveSimple']) {
552
+ td.MuiTableCell-body {
553
+ display: flex;
554
+ > div {
531
555
  width: auto;
532
- flex: 0 0 auto;
533
- padding-right: 16px;
534
- &:empty {
535
- padding-right: 0;
556
+ flex: 1;
557
+ &:first-of-type {
558
+ font-weight: bold;
559
+ font-size: 14px;
560
+ width: auto;
561
+ flex: 0 0 auto;
562
+ padding-right: 16px;
563
+ &:empty {
564
+ padding-right: 0;
565
+ }
536
566
  }
537
567
  }
538
568
  }
539
569
  }
540
570
  }
541
571
  }
542
- }
543
- ${(props) => props.theme.breakpoints.up('md')} {
544
- ${alignCss}
545
- }
546
- ${(props) => props.theme.breakpoints.up('sm')} {
547
- [class*='responsiveSimple'] {
572
+ ${theme.breakpoints.up('md')} {
548
573
  ${alignCss}
549
574
  }
550
- }
575
+ ${theme.breakpoints.up('sm')} {
576
+ [class*='responsiveSimple'] {
577
+ ${alignCss}
578
+ }
579
+ }
551
580
 
552
- ${(inProps) => {
553
- if (inProps.verticalKeyWidth) {
554
- return `
555
- ${inProps.theme.breakpoints.down('md')} {
556
- [class*='MUIDataTable-responsiveBase'] {
557
- tr:not([class*='responsiveSimple']) {
558
- td.MuiTableCell-body {
559
- > div {
560
- &:first-of-type {
561
- width: ${inProps.verticalKeyWidth + (!/\D/.test(inProps.verticalKeyWidth) ? 'px' : '')};
562
- }
563
- }
564
- }
565
- }
566
- }
567
- }
568
- `;
581
+ ${verticalKeyWidthStyle}
582
+
583
+ .MuiTableCell-head {
584
+ color: ${primaryTextColor};
585
+ background-color: ${defaultBgColor};
569
586
  }
570
587
 
571
- return '';
572
- }}
588
+ .MuiTableCell-root {
589
+ color: ${primaryTextColor};
590
+ }
573
591
 
574
- &.datatable-stripped {
575
- .MuiTableBody-root {
576
- tr:nth-of-type(odd) {
577
- background-color: ${(props) => props.theme.palette.action.hover};
592
+ .MuiTableRow-root {
593
+ background-color: ${defaultBgColor};
594
+ &:nth-of-type(even) {
595
+ background-color: ${defaultBgColor};
596
+ }
597
+ &:hover {
598
+ background-color: ${hoverBgColor};
599
+ }
600
+ &.MuiTableRow-footer {
601
+ background-color: ${defaultBgColor};
578
602
  }
579
603
  }
580
- }
581
- `;
604
+
605
+ &.datatable-stripped {
606
+ .MuiTableRow-root:nth-of-type(odd) {
607
+ background-color: ${oddRowBgColor};
608
+ &:hover {
609
+ background-color: ${hoverBgColor};
610
+ }
611
+ &.MuiTableRow-footer {
612
+ background-color: ${defaultBgColor};
613
+ }
614
+ }
615
+ }
616
+ `;
617
+ });
582
618
 
583
619
  const FooterContainer = styled('div')`
584
620
  display: flex;
585
621
  align-items: center;
622
+ background-color: ${(props) => props.theme.palette.background.default};
586
623
  .datatable-footer {
587
624
  position: relative;
588
625
  margin-left: auto;
@@ -77,7 +77,7 @@ const Container = styled('div', {
77
77
  position: relative;
78
78
  margin-top: 64px;
79
79
  padding: 24px 0 32px;
80
- border-top: 1px solid ${(props) => (props.dark ? props.theme.palette.grey[900] : '#dee2e7')};
80
+ border-top: 1px solid ${(props) => props.theme.palette.divider};
81
81
  box-sizing: border-box;
82
82
  width: 100%;
83
83
 
@@ -92,7 +92,7 @@ const Container = styled('div', {
92
92
  flex-wrap: wrap;
93
93
 
94
94
  .footer-item {
95
- color: ${({ theme, dark }) => (dark ? theme.palette.grey[500] : theme.palette.grey[900])};
95
+ color: ${(props) => props.theme.palette.text.hint};
96
96
  display: flex;
97
97
  align-items: center;
98
98
  flex-wrap: wrap;
@@ -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
  />
@@ -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 {