@arcblock/ux 2.12.64 → 2.12.70
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/Config/config-provider.js +9 -0
- package/lib/Config/index.d.ts +1 -0
- package/lib/Config/index.js +1 -0
- package/lib/Header/header.js +6 -2
- package/lib/Locale/selector.js +8 -18
- package/lib/NavMenu/style.js +10 -8
- package/lib/NavMenu/sub-item-group.js +6 -2
- package/lib/SessionBlocklet/index.js +7 -15
- package/lib/SessionUser/components/logged-in.js +4 -8
- package/lib/Theme/theme.d.ts +2 -0
- package/lib/Theme/theme.js +2 -1
- package/lib/UserCard/Cards/avatar-only.d.ts +8 -0
- package/lib/UserCard/Cards/avatar-only.js +34 -0
- package/lib/UserCard/Cards/basic-info.d.ts +9 -0
- package/lib/UserCard/Cards/basic-info.js +51 -0
- package/lib/UserCard/Cards/index.d.ts +8 -0
- package/lib/UserCard/Cards/index.js +24 -0
- package/lib/UserCard/Cards/name-only.d.ts +3 -0
- package/lib/UserCard/Cards/name-only.js +18 -0
- package/lib/UserCard/Container/card.d.ts +13 -0
- package/lib/UserCard/Container/card.js +46 -0
- package/lib/UserCard/Container/dialog.d.ts +9 -0
- package/lib/UserCard/Container/dialog.js +25 -0
- package/lib/UserCard/Content/basic.d.ts +7 -0
- package/lib/UserCard/Content/basic.js +139 -0
- package/lib/UserCard/Content/clock.d.ts +4 -0
- package/lib/UserCard/Content/clock.js +68 -0
- package/lib/UserCard/Content/left-layout.d.ts +16 -0
- package/lib/UserCard/Content/left-layout.js +33 -0
- package/lib/UserCard/Content/minimal.d.ts +15 -0
- package/lib/UserCard/Content/minimal.js +61 -0
- package/lib/UserCard/Content/tooltip-avatar.d.ts +15 -0
- package/lib/UserCard/Content/tooltip-avatar.js +61 -0
- package/lib/UserCard/components.d.ts +4 -0
- package/lib/UserCard/components.js +45 -0
- package/lib/UserCard/index.d.ts +5 -0
- package/lib/UserCard/index.js +74 -0
- package/lib/UserCard/types.d.ts +107 -0
- package/lib/UserCard/types.js +42 -0
- package/lib/UserCard/utils.d.ts +2 -0
- package/lib/UserCard/utils.js +19 -0
- package/lib/hooks/use-clock.d.ts +10 -0
- package/lib/hooks/use-clock.js +71 -0
- package/package.json +5 -5
- package/src/Config/config-provider.tsx +7 -0
- package/src/Config/index.ts +1 -0
- package/src/Header/header.tsx +2 -2
- package/src/Locale/selector.tsx +7 -14
- package/src/NavMenu/style.ts +8 -8
- package/src/NavMenu/sub-item-group.tsx +2 -2
- package/src/SessionBlocklet/index.tsx +7 -20
- package/src/SessionUser/components/logged-in.tsx +4 -6
- package/src/Theme/theme.ts +1 -0
- package/src/UserCard/Cards/avatar-only.tsx +38 -0
- package/src/UserCard/Cards/basic-info.tsx +50 -0
- package/src/UserCard/Cards/index.tsx +24 -0
- package/src/UserCard/Cards/name-only.tsx +17 -0
- package/src/UserCard/Container/card.tsx +52 -0
- package/src/UserCard/Container/dialog.tsx +30 -0
- package/src/UserCard/Content/basic.tsx +134 -0
- package/src/UserCard/Content/clock.tsx +63 -0
- package/src/UserCard/Content/left-layout.tsx +40 -0
- package/src/UserCard/Content/minimal.tsx +60 -0
- package/src/UserCard/Content/tooltip-avatar.tsx +55 -0
- package/src/UserCard/components.tsx +49 -0
- package/src/UserCard/index.tsx +63 -0
- package/src/UserCard/types.ts +129 -0
- package/src/UserCard/utils.ts +22 -0
- package/src/hooks/use-clock.tsx +61 -0
@@ -32,10 +32,19 @@ export function ConfigProvider({
|
|
32
32
|
if (prefer) {
|
33
33
|
return prefer;
|
34
34
|
}
|
35
|
+
|
36
|
+
// 未启用暗色主题
|
37
|
+
if (!window.blocklet?.USE_DARK_THEME) {
|
38
|
+
return 'light';
|
39
|
+
}
|
40
|
+
|
41
|
+
// 本地缓存
|
35
42
|
const localPrefer = localStorage.getItem(preferThemeModeKey);
|
36
43
|
if (localPrefer && (localPrefer === 'light' || localPrefer === 'dark')) {
|
37
44
|
return localPrefer;
|
38
45
|
}
|
46
|
+
|
47
|
+
// 系统偏好
|
39
48
|
return prefersDarkMode ? 'dark' : 'light';
|
40
49
|
});
|
41
50
|
const _themeOptions = useMemo(() => {
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './config-provider';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './config-provider';
|
package/lib/Header/header.js
CHANGED
@@ -100,8 +100,12 @@ function Header({
|
|
100
100
|
const Root = styled(Box)`
|
101
101
|
position: relative;
|
102
102
|
font-size: 14px;
|
103
|
-
z-index: ${
|
104
|
-
|
103
|
+
z-index: ${({
|
104
|
+
theme
|
105
|
+
}) => theme.zIndex.appBar};
|
106
|
+
background: ${({
|
107
|
+
theme
|
108
|
+
}) => theme.palette.background.default};
|
105
109
|
.header-container {
|
106
110
|
display: flex;
|
107
111
|
align-items: center;
|
package/lib/Locale/selector.js
CHANGED
@@ -6,8 +6,6 @@ import { Icon as IconifyIcon } from '@iconify/react';
|
|
6
6
|
import CheckIcon from '@iconify-icons/material-symbols/check';
|
7
7
|
import LanguageIcon from 'iconify-icons-material-symbols-400/language';
|
8
8
|
import noop from 'lodash/noop';
|
9
|
-
import { getColor, getBackground } from '../Util';
|
10
|
-
import { temp as colors } from '../Colors';
|
11
9
|
import { LocaleContext } from './context';
|
12
10
|
import { styled, useTheme } from '../Theme';
|
13
11
|
import { mergeSx } from '../Util/style';
|
@@ -68,9 +66,7 @@ export default function LocaleSelector(props) {
|
|
68
66
|
}
|
69
67
|
});
|
70
68
|
}, [Icon, size]);
|
71
|
-
return /*#__PURE__*/_jsxs(
|
72
|
-
dark: dark,
|
73
|
-
theme: theme,
|
69
|
+
return /*#__PURE__*/_jsxs(Wrapper, {
|
74
70
|
...rest,
|
75
71
|
...handleEventProps,
|
76
72
|
children: [/*#__PURE__*/_jsx(ButtonComponent, {
|
@@ -102,11 +98,8 @@ export default function LocaleSelector(props) {
|
|
102
98
|
children: /*#__PURE__*/_jsx(Box, {
|
103
99
|
className: "locales",
|
104
100
|
sx: {
|
105
|
-
|
106
|
-
|
107
|
-
theme
|
108
|
-
}),
|
109
|
-
boxShadow: `0px 8px 16px 0px ${colors.gray6}, 0px 0px 0px 1px ${colors.gray6}`,
|
101
|
+
backgroundColor: 'background.default',
|
102
|
+
boxShadow: 2,
|
110
103
|
borderRadius: 2
|
111
104
|
},
|
112
105
|
children: /*#__PURE__*/_jsx(ClickAwayListener, {
|
@@ -126,10 +119,7 @@ export default function LocaleSelector(props) {
|
|
126
119
|
lineHeight: 'normal',
|
127
120
|
letterSpacing: '2px',
|
128
121
|
textAlign: 'center',
|
129
|
-
color:
|
130
|
-
...popperProps,
|
131
|
-
theme
|
132
|
-
}),
|
122
|
+
color: 'text.primary',
|
133
123
|
cursor: 'pointer',
|
134
124
|
display: 'flex',
|
135
125
|
padding: '16px',
|
@@ -152,9 +142,7 @@ export default function LocaleSelector(props) {
|
|
152
142
|
})]
|
153
143
|
});
|
154
144
|
}
|
155
|
-
const
|
156
|
-
shouldForwardProp: prop => prop !== 'dark'
|
157
|
-
})`
|
145
|
+
const Wrapper = styled(Box)`
|
158
146
|
display: inline-block;
|
159
147
|
|
160
148
|
.trigger {
|
@@ -167,7 +155,9 @@ const Div = styled('div', {
|
|
167
155
|
.trigger-text {
|
168
156
|
margin-left: 5px;
|
169
157
|
font-size: 14px;
|
170
|
-
color: ${
|
158
|
+
color: ${({
|
159
|
+
theme
|
160
|
+
}) => theme.palette.text.primary};
|
171
161
|
}
|
172
162
|
}
|
173
163
|
`;
|
package/lib/NavMenu/style.js
CHANGED
@@ -125,20 +125,20 @@ export const NavMenuItem = styled('li', {
|
|
125
125
|
marginRight: '16px',
|
126
126
|
border: '1px solid #eff1f5',
|
127
127
|
borderRadius: '4px',
|
128
|
-
color:
|
128
|
+
color: theme.palette.grey[500]
|
129
129
|
},
|
130
130
|
'.navmenu-item__label': {
|
131
131
|
fontSize: '14px',
|
132
132
|
lineHeight: 1,
|
133
|
-
color:
|
133
|
+
color: theme.palette.text.primary
|
134
134
|
},
|
135
135
|
'.navmenu-item__desc': {
|
136
136
|
fontSize: '12px',
|
137
137
|
lineHeight: 1,
|
138
|
-
color:
|
138
|
+
color: theme.palette.grey[500]
|
139
139
|
},
|
140
140
|
'&:hover': {
|
141
|
-
background:
|
141
|
+
background: theme.palette.action.hover,
|
142
142
|
transition: theme.transitions.create('background', {
|
143
143
|
duration: theme.transitions.duration.standard
|
144
144
|
}),
|
@@ -146,14 +146,14 @@ export const NavMenuItem = styled('li', {
|
|
146
146
|
opacity: 1
|
147
147
|
},
|
148
148
|
'.navmenu-item__desc': {
|
149
|
-
color:
|
149
|
+
color: theme.palette.text.primary,
|
150
150
|
transition: theme.transitions.create('color', {
|
151
151
|
duration: theme.transitions.duration.standard
|
152
152
|
})
|
153
153
|
}
|
154
154
|
},
|
155
155
|
'&.navmenu-item--active': {
|
156
|
-
background:
|
156
|
+
background: theme.palette.action.hover
|
157
157
|
}
|
158
158
|
},
|
159
159
|
// inline 布局中
|
@@ -236,11 +236,13 @@ export const NavMenuSub = styled(NavMenuItem)(({
|
|
236
236
|
}));
|
237
237
|
|
238
238
|
// 下拉子菜单 .navmenu-sub__list
|
239
|
-
export const NavMenuSubList = styled('ul')((
|
239
|
+
export const NavMenuSubList = styled('ul')(({
|
240
|
+
theme
|
241
|
+
}) => ({
|
240
242
|
margin: 0,
|
241
243
|
padding: '16px',
|
242
244
|
borderRadius: '4px',
|
243
|
-
background:
|
245
|
+
background: theme.palette.background.default,
|
244
246
|
'& .navmenu-item + .navmenu-item': {
|
245
247
|
marginTop: '8px'
|
246
248
|
}
|
@@ -4,12 +4,16 @@ import { styled } from '../Theme';
|
|
4
4
|
const Group = styled(Box)`
|
5
5
|
padding: 16px 24px;
|
6
6
|
border-radius: 8px;
|
7
|
-
background-color:
|
7
|
+
background-color: ${({
|
8
|
+
theme
|
9
|
+
}) => theme.palette.background.default};
|
8
10
|
cursor: auto;
|
9
11
|
|
10
12
|
.group-label {
|
11
13
|
margin-bottom: 8px;
|
12
|
-
color:
|
14
|
+
color: ${({
|
15
|
+
theme
|
16
|
+
}) => theme.palette.grey[600]};
|
13
17
|
font-size: 12px;
|
14
18
|
}
|
15
19
|
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useRef } from 'react';
|
3
|
-
import { Box, ClickAwayListener, Fade, IconButton, List, ListItem, ListItemButton, Paper, Popper, Typography } from '@mui/material';
|
3
|
+
import { Box, ClickAwayListener, Fade, IconButton, List, ListItem, ListItemButton, Paper, Popper, Typography, useTheme } from '@mui/material';
|
4
4
|
import { Icon } from '@iconify/react';
|
5
5
|
import DashboardOutlineRoundedIcon from 'iconify-icons-material-symbols-400/dashboard-outline-rounded';
|
6
6
|
import WidgetsOutlineRoundedIcon from '@iconify-icons/material-symbols/widgets-outline-rounded';
|
7
7
|
import { useMemoizedFn, useReactive } from 'ahooks';
|
8
8
|
import Button from '../Button';
|
9
|
-
import { temp as colors } from '../Colors';
|
10
9
|
import { BLOCKLET_SERVICE_PATH_PREFIX, NAVIGATION_URL } from '../Util/constant';
|
11
10
|
import SessionPermission from '../SessionPermission';
|
12
11
|
import { getTranslation } from '../Util';
|
@@ -33,6 +32,7 @@ export default function SessionBlocklet({
|
|
33
32
|
component
|
34
33
|
};
|
35
34
|
});
|
35
|
+
const theme = useTheme();
|
36
36
|
const popperAnchorRef = useRef(null);
|
37
37
|
const currentState = useReactive({
|
38
38
|
open: false
|
@@ -93,10 +93,9 @@ export default function SessionBlocklet({
|
|
93
93
|
borderRadius: 3,
|
94
94
|
width: 350,
|
95
95
|
maxWidth: '90vw',
|
96
|
-
borderColor: colors.lineStep,
|
97
96
|
p: 2,
|
98
97
|
border: '0 !important',
|
99
|
-
boxShadow:
|
98
|
+
boxShadow: 2
|
100
99
|
},
|
101
100
|
children: [/*#__PURE__*/_jsx(List, {
|
102
101
|
sx: {
|
@@ -122,7 +121,7 @@ export default function SessionBlocklet({
|
|
122
121
|
height: '100%',
|
123
122
|
borderRadius: 2,
|
124
123
|
'&:hover': {
|
125
|
-
backgroundColor:
|
124
|
+
backgroundColor: 'action.hover'
|
126
125
|
}
|
127
126
|
},
|
128
127
|
children: [item?.component?.did ? /*#__PURE__*/_jsx(Box, {
|
@@ -138,11 +137,11 @@ export default function SessionBlocklet({
|
|
138
137
|
}) : /*#__PURE__*/_jsx(Icon, {
|
139
138
|
fontSize: 50,
|
140
139
|
icon: item.icon || WidgetsOutlineRoundedIcon,
|
141
|
-
color:
|
140
|
+
color: theme.palette.text.secondary
|
142
141
|
}), /*#__PURE__*/_jsx(Typography, {
|
143
142
|
sx: {
|
144
143
|
fontSize: '12px',
|
145
|
-
color:
|
144
|
+
color: 'text.primary',
|
146
145
|
textAlign: 'center',
|
147
146
|
lineHeight: 'normal'
|
148
147
|
},
|
@@ -157,14 +156,7 @@ export default function SessionBlocklet({
|
|
157
156
|
fullWidth: true,
|
158
157
|
href: NAVIGATION_URL,
|
159
158
|
sx: {
|
160
|
-
mt: 1
|
161
|
-
borderRadius: 2,
|
162
|
-
color: colors.textBase,
|
163
|
-
borderColor: colors.lineBorderStrong,
|
164
|
-
'&:hover': {
|
165
|
-
color: colors.primaryBase,
|
166
|
-
borderColor: colors.primaryBase
|
167
|
-
}
|
159
|
+
mt: 1
|
168
160
|
},
|
169
161
|
children: locale === 'zh' ? '管理' : 'Manage'
|
170
162
|
})
|
@@ -13,7 +13,6 @@ import Toast from '../../Toast';
|
|
13
13
|
import DidAvatar from '../../Avatar';
|
14
14
|
import { getUserAvatar } from '../../Util';
|
15
15
|
import UserInfo from './user-info';
|
16
|
-
import { temp as colors } from '../../Colors';
|
17
16
|
import { DASHBOARD_URL, PROFILE_URL } from '../../Util/constant';
|
18
17
|
import SessionPermission from '../../SessionPermission';
|
19
18
|
import { translations } from '../libs/translation';
|
@@ -158,9 +157,8 @@ export default function LoggedIn({
|
|
158
157
|
borderRadius: 3,
|
159
158
|
width: 350,
|
160
159
|
maxWidth: '90vw',
|
161
|
-
borderColor: colors.lineStep,
|
162
160
|
border: '0 !important',
|
163
|
-
boxShadow:
|
161
|
+
boxShadow: 2
|
164
162
|
},
|
165
163
|
children: [/*#__PURE__*/_jsx(UserInfo, {
|
166
164
|
locale: locale,
|
@@ -172,8 +170,7 @@ export default function LoggedIn({
|
|
172
170
|
onBindWallet: handleBindWallet
|
173
171
|
}), /*#__PURE__*/_jsx(Divider, {
|
174
172
|
sx: {
|
175
|
-
m: '0!important'
|
176
|
-
borderColor: colors.strokeSep
|
173
|
+
m: '0 !important'
|
177
174
|
}
|
178
175
|
}), /*#__PURE__*/_jsxs(MenuList, {
|
179
176
|
sx: {
|
@@ -214,8 +211,7 @@ export default function LoggedIn({
|
|
214
211
|
}
|
215
212
|
}), /*#__PURE__*/_jsx(Divider, {
|
216
213
|
sx: {
|
217
|
-
m: '0!important'
|
218
|
-
borderColor: colors.strokeSep
|
214
|
+
m: '0 !important'
|
219
215
|
}
|
220
216
|
}), /*#__PURE__*/_jsx(DidSpace, {
|
221
217
|
session: session,
|
@@ -257,7 +253,7 @@ function SessionMenuItem({
|
|
257
253
|
alignItems: 'center',
|
258
254
|
borderRadius: 2,
|
259
255
|
'&:hover': {
|
260
|
-
backgroundColor:
|
256
|
+
backgroundColor: 'action.hover'
|
261
257
|
},
|
262
258
|
py: 1
|
263
259
|
},
|
package/lib/Theme/theme.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Components, type ThemeOptions } from '@mui/material/styles';
|
2
|
+
import { deepmerge } from '@mui/utils';
|
2
3
|
import type { Typography } from '@mui/material/styles/createTypography';
|
3
4
|
import '@fontsource/roboto/400';
|
4
5
|
import '@fontsource/roboto/500';
|
@@ -43,3 +44,4 @@ export declare function loadFonts(fonts: string[]): Promise<boolean>;
|
|
43
44
|
export declare function createDefaultThemeOptions(mode?: ThemeMode): ThemeOptions;
|
44
45
|
export declare const create: ({ mode, pageWidth, overrides, palette, components, ...rest }?: ThemeOptions) => import("@mui/material/styles").Theme;
|
45
46
|
export declare const createTheme: ({ mode, pageWidth, overrides, palette, components, ...rest }?: ThemeOptions) => import("@mui/material/styles").Theme;
|
47
|
+
export { deepmerge };
|
package/lib/Theme/theme.js
CHANGED
@@ -0,0 +1,8 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { UserCardProps } from '../types';
|
3
|
+
interface AvatarOnlyCardProps extends UserCardProps {
|
4
|
+
renderCardContent: () => React.ReactNode;
|
5
|
+
shouldShowHoverCard: boolean;
|
6
|
+
}
|
7
|
+
declare function AvatarOnlyCard(props: AvatarOnlyCardProps): import("react/jsx-runtime").JSX.Element;
|
8
|
+
export default AvatarOnlyCard;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import React from 'react';
|
3
|
+
import { InfoType } from '../types';
|
4
|
+
import TooltipAvatar from '../Content/tooltip-avatar';
|
5
|
+
// AvatarOnly卡片组件,处理仅头像模式的渲染
|
6
|
+
function AvatarOnlyCard(props) {
|
7
|
+
const {
|
8
|
+
user,
|
9
|
+
infoType,
|
10
|
+
avatarSize = 48,
|
11
|
+
shouldShowHoverCard = false,
|
12
|
+
renderCardContent
|
13
|
+
} = props;
|
14
|
+
|
15
|
+
// 对于NameOnly类型使用普通Tooltip
|
16
|
+
if (infoType === InfoType.NameOnly) {
|
17
|
+
return /*#__PURE__*/_jsx(TooltipAvatar, {
|
18
|
+
user: user,
|
19
|
+
avatarSize: avatarSize,
|
20
|
+
shouldShowHoverCard: false,
|
21
|
+
renderCardContent: renderCardContent,
|
22
|
+
tooltipTitle: user.fullName || user.email || user.did
|
23
|
+
});
|
24
|
+
}
|
25
|
+
|
26
|
+
// 其他类型使用自定义Tooltip或无Tooltip
|
27
|
+
return /*#__PURE__*/_jsx(TooltipAvatar, {
|
28
|
+
user: user,
|
29
|
+
avatarSize: avatarSize,
|
30
|
+
shouldShowHoverCard: shouldShowHoverCard,
|
31
|
+
renderCardContent: renderCardContent
|
32
|
+
});
|
33
|
+
}
|
34
|
+
export default AvatarOnlyCard;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { UserCardProps } from '../types';
|
3
|
+
interface BasicCardProps extends UserCardProps {
|
4
|
+
shouldShowHoverCard: boolean;
|
5
|
+
renderCardContent?: () => React.ReactNode | null;
|
6
|
+
isFull?: boolean;
|
7
|
+
}
|
8
|
+
declare function BasicCard(props: BasicCardProps): import("react/jsx-runtime").JSX.Element;
|
9
|
+
export default BasicCard;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import React from 'react';
|
3
|
+
import { Box } from '@mui/material';
|
4
|
+
import { InfoType } from '../types';
|
5
|
+
import MinimalContent from '../Content/minimal';
|
6
|
+
import BasicContent from '../Content/basic';
|
7
|
+
// 详细卡片模式下的Basic渲染组件
|
8
|
+
function BasicCard(props) {
|
9
|
+
const {
|
10
|
+
user,
|
11
|
+
avatarSize = 40,
|
12
|
+
showDid = false,
|
13
|
+
didProps = {},
|
14
|
+
shouldShowHoverCard,
|
15
|
+
renderCardContent,
|
16
|
+
renderTopRightContent,
|
17
|
+
topRightMaxWidth = 100,
|
18
|
+
renderCustomContent,
|
19
|
+
isFull = true,
|
20
|
+
infoType = InfoType.Minimal
|
21
|
+
} = props;
|
22
|
+
return /*#__PURE__*/_jsxs(Box, {
|
23
|
+
display: "flex",
|
24
|
+
flexDirection: "column",
|
25
|
+
width: "100%",
|
26
|
+
sx: {
|
27
|
+
flex: 1,
|
28
|
+
minWidth: 0
|
29
|
+
},
|
30
|
+
children: [/*#__PURE__*/_jsx(MinimalContent, {
|
31
|
+
infoType: infoType,
|
32
|
+
user: user,
|
33
|
+
showDid: showDid,
|
34
|
+
didProps: didProps,
|
35
|
+
avatarSize: avatarSize,
|
36
|
+
shouldShowHoverCard: shouldShowHoverCard,
|
37
|
+
renderCardContent: renderCardContent,
|
38
|
+
renderTopRightContent: renderTopRightContent,
|
39
|
+
topRightMaxWidth: topRightMaxWidth
|
40
|
+
}), infoType === InfoType.Basic && /*#__PURE__*/_jsx(BasicContent, {
|
41
|
+
user: user,
|
42
|
+
isFull: isFull
|
43
|
+
}), renderCustomContent && /*#__PURE__*/_jsx(Box, {
|
44
|
+
sx: {
|
45
|
+
mt: 1.5
|
46
|
+
},
|
47
|
+
children: renderCustomContent()
|
48
|
+
})]
|
49
|
+
});
|
50
|
+
}
|
51
|
+
export default BasicCard;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { UserCardProps } from '../types';
|
3
|
+
interface DetailedCardProps extends UserCardProps {
|
4
|
+
shouldShowHoverCard: boolean;
|
5
|
+
renderCardContent?: () => React.ReactNode | null;
|
6
|
+
}
|
7
|
+
declare function DetailedCard(props: DetailedCardProps): import("react/jsx-runtime").JSX.Element;
|
8
|
+
export default DetailedCard;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import React from 'react';
|
3
|
+
import { InfoType } from '../types';
|
4
|
+
import NameOnlyCard from './name-only';
|
5
|
+
import BasicCard from './basic-info';
|
6
|
+
// DetailedCard组件,根据infoType选择不同的卡片组件进行渲染
|
7
|
+
function DetailedCard(props) {
|
8
|
+
const {
|
9
|
+
infoType = InfoType.Minimal
|
10
|
+
} = props;
|
11
|
+
|
12
|
+
// 根据信息类型选择合适的卡片组件
|
13
|
+
switch (infoType) {
|
14
|
+
case InfoType.NameOnly:
|
15
|
+
return /*#__PURE__*/_jsx(NameOnlyCard, {
|
16
|
+
...props
|
17
|
+
});
|
18
|
+
default:
|
19
|
+
return /*#__PURE__*/_jsx(BasicCard, {
|
20
|
+
...props
|
21
|
+
});
|
22
|
+
}
|
23
|
+
}
|
24
|
+
export default DetailedCard;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Typography } from '@mui/material';
|
3
|
+
import { renderAvatar } from '../components';
|
4
|
+
|
5
|
+
// 详细卡片模式下的NameOnly渲染组件
|
6
|
+
function NameOnlyCard(props) {
|
7
|
+
const {
|
8
|
+
user,
|
9
|
+
avatarSize = 48
|
10
|
+
} = props;
|
11
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
12
|
+
children: [renderAvatar(user, avatarSize), /*#__PURE__*/_jsx(Typography, {
|
13
|
+
variant: "body1",
|
14
|
+
children: user.fullName || user.email || user.did
|
15
|
+
})]
|
16
|
+
});
|
17
|
+
}
|
18
|
+
export default NameOnlyCard;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { CardType } from '../types';
|
3
|
+
interface CardContainerProps {
|
4
|
+
children: React.ReactNode;
|
5
|
+
cardType?: CardType;
|
6
|
+
variant?: 'paper' | 'box';
|
7
|
+
containerRef?: React.RefObject<HTMLDivElement>;
|
8
|
+
}
|
9
|
+
/**
|
10
|
+
* 统一的卡片容器组件,处理常见的布局容器样式
|
11
|
+
*/
|
12
|
+
declare function CardContainer({ children, cardType, variant, containerRef }: CardContainerProps): import("react/jsx-runtime").JSX.Element;
|
13
|
+
export default CardContainer;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import React from 'react';
|
3
|
+
import { Box, Paper } from '@mui/material';
|
4
|
+
import { CardType } from '../types';
|
5
|
+
/**
|
6
|
+
* 统一的卡片容器组件,处理常见的布局容器样式
|
7
|
+
*/
|
8
|
+
function CardContainer({
|
9
|
+
children,
|
10
|
+
cardType = CardType.Detailed,
|
11
|
+
variant = 'box',
|
12
|
+
containerRef
|
13
|
+
}) {
|
14
|
+
const commonStyles = {
|
15
|
+
minWidth: 320,
|
16
|
+
p: 2,
|
17
|
+
borderRadius: 2,
|
18
|
+
...(cardType === CardType.Detailed ? {
|
19
|
+
border: '1px solid',
|
20
|
+
borderColor: 'divider'
|
21
|
+
} : {})
|
22
|
+
};
|
23
|
+
|
24
|
+
// Paper变体,用于Basic和Full类型卡片
|
25
|
+
if (variant === 'paper') {
|
26
|
+
return /*#__PURE__*/_jsx(Paper, {
|
27
|
+
ref: containerRef,
|
28
|
+
elevation: 0,
|
29
|
+
sx: commonStyles,
|
30
|
+
children: children
|
31
|
+
});
|
32
|
+
}
|
33
|
+
|
34
|
+
// Box变体,用于Minimal和NameOnly类型卡片
|
35
|
+
return /*#__PURE__*/_jsx(Box, {
|
36
|
+
ref: containerRef,
|
37
|
+
sx: {
|
38
|
+
...commonStyles,
|
39
|
+
display: 'flex',
|
40
|
+
alignItems: cardType === CardType.AvatarOnly ? 'center' : 'flex-start',
|
41
|
+
gap: 2
|
42
|
+
},
|
43
|
+
children: children
|
44
|
+
});
|
45
|
+
}
|
46
|
+
export default CardContainer;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface DialogContainerProps {
|
3
|
+
children: React.ReactNode;
|
4
|
+
}
|
5
|
+
/**
|
6
|
+
* 统一的卡片容器组件,处理常见的布局容器样式
|
7
|
+
*/
|
8
|
+
declare function DialogContainer({ children }: DialogContainerProps): import("react/jsx-runtime").JSX.Element;
|
9
|
+
export default DialogContainer;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import React from 'react';
|
3
|
+
import { Box, useTheme } from '@mui/material';
|
4
|
+
/**
|
5
|
+
* 统一的卡片容器组件,处理常见的布局容器样式
|
6
|
+
*/
|
7
|
+
function DialogContainer({
|
8
|
+
children
|
9
|
+
}) {
|
10
|
+
// Box变体,用于Minimal和NameOnly类型卡片
|
11
|
+
const theme = useTheme();
|
12
|
+
return /*#__PURE__*/_jsx(Box, {
|
13
|
+
sx: {
|
14
|
+
p: 2,
|
15
|
+
backgroundColor: theme.palette.background.paper,
|
16
|
+
border: '1px solid',
|
17
|
+
borderColor: 'divider',
|
18
|
+
borderRadius: 2,
|
19
|
+
maxWidth: 400,
|
20
|
+
display: 'flex'
|
21
|
+
},
|
22
|
+
children: children
|
23
|
+
});
|
24
|
+
}
|
25
|
+
export default DialogContainer;
|