@arcblock/ux 2.10.57 → 2.10.59
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/BlockletV2/blocklet.d.ts +5 -0
- package/lib/BlockletV2/blocklet.js +38 -6
- package/lib/BlockletV2/index.d.ts +2 -1
- package/lib/BlockletV2/index.js +2 -1
- package/lib/BlockletV2/tooltip-icon.d.ts +7 -0
- package/lib/BlockletV2/tooltip-icon.js +33 -0
- package/package.json +5 -5
- package/src/BlockletV2/blocklet.tsx +29 -6
- package/src/BlockletV2/index.ts +2 -1
- package/src/BlockletV2/tooltip-icon.tsx +46 -0
@@ -8,6 +8,11 @@ export interface IBlockletStore extends CardProps {
|
|
8
8
|
avatar: string;
|
9
9
|
author: string;
|
10
10
|
download: string;
|
11
|
+
official?: {
|
12
|
+
tooltip: React.ReactNode;
|
13
|
+
size?: number;
|
14
|
+
color?: string;
|
15
|
+
};
|
11
16
|
button?: React.ReactNode;
|
12
17
|
buttonText?: string;
|
13
18
|
buttonDisabled?: boolean;
|
@@ -2,11 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { isValidElement } from 'react';
|
3
3
|
import Download from '@iconify-icons/tabler/cloud-download';
|
4
4
|
import { Icon } from '@iconify/react';
|
5
|
-
import
|
5
|
+
import VerifiedIcon from '@mui/icons-material/Verified';
|
6
|
+
import { Box, Card, CircularProgress, Stack, Typography } from '@mui/material';
|
6
7
|
import Avatar from '../Avatar';
|
7
8
|
import Button from '../Button';
|
8
9
|
import { useTheme } from '../Theme';
|
9
10
|
import IconText from './components/icon-text';
|
11
|
+
import TooltipIcon from './tooltip-icon';
|
10
12
|
import { formatDownloadCount, strippedString } from './utils';
|
11
13
|
export default function BlockletStore(props) {
|
12
14
|
const {
|
@@ -17,6 +19,7 @@ export default function BlockletStore(props) {
|
|
17
19
|
author,
|
18
20
|
download,
|
19
21
|
did,
|
22
|
+
official,
|
20
23
|
buttonText = 'Install',
|
21
24
|
buttonDisabled,
|
22
25
|
buttonLoading,
|
@@ -74,24 +77,52 @@ export default function BlockletStore(props) {
|
|
74
77
|
children: [/*#__PURE__*/_jsxs(Stack, {
|
75
78
|
flex: 1,
|
76
79
|
direction: "row",
|
77
|
-
gap:
|
80
|
+
gap: 1,
|
78
81
|
alignItems: "center",
|
79
82
|
overflow: "hidden",
|
83
|
+
sx: {
|
84
|
+
'& > *': {
|
85
|
+
flexShrink: 0
|
86
|
+
}
|
87
|
+
},
|
80
88
|
children: [/*#__PURE__*/_jsx(Avatar, {
|
81
89
|
src: cover,
|
82
90
|
did: did,
|
83
91
|
size: 48,
|
84
|
-
variant: "rounded"
|
92
|
+
variant: "rounded",
|
93
|
+
style: {
|
94
|
+
borderRadius: '8px',
|
95
|
+
overflow: 'hidden'
|
96
|
+
}
|
85
97
|
}), /*#__PURE__*/_jsx(Typography, {
|
86
|
-
|
87
|
-
fontWeight: "
|
98
|
+
className: "blocklet-title",
|
99
|
+
fontWeight: "fontWeightMedium",
|
88
100
|
sx: {
|
89
101
|
fontSize: 16,
|
90
102
|
textOverflow: 'ellipsis',
|
91
103
|
whiteSpace: 'nowrap',
|
92
|
-
overflow: 'hidden'
|
104
|
+
overflow: 'hidden',
|
105
|
+
pl: 0.5,
|
106
|
+
'&&': {
|
107
|
+
flexShrink: 1
|
108
|
+
}
|
93
109
|
},
|
94
110
|
...titleProps
|
111
|
+
}), /*#__PURE__*/_jsx(Box, {
|
112
|
+
flex: 1,
|
113
|
+
display: "flex",
|
114
|
+
alignItems: "center",
|
115
|
+
justifyContent: "flex-start",
|
116
|
+
gap: 1,
|
117
|
+
children: official && /*#__PURE__*/_jsx(TooltipIcon, {
|
118
|
+
title: official.tooltip,
|
119
|
+
children: /*#__PURE__*/_jsx(VerifiedIcon, {
|
120
|
+
sx: {
|
121
|
+
color: official.color || '#D97706',
|
122
|
+
fontSize: official.size || 18
|
123
|
+
}
|
124
|
+
})
|
125
|
+
})
|
95
126
|
}), button || onButtonClick && /*#__PURE__*/_jsxs(Button, {
|
96
127
|
color: "reverse",
|
97
128
|
variant: "outlined",
|
@@ -115,6 +146,7 @@ export default function BlockletStore(props) {
|
|
115
146
|
}), /*#__PURE__*/_jsx(Stack, {
|
116
147
|
py: 2,
|
117
148
|
children: /*#__PURE__*/_jsx(Typography, {
|
149
|
+
className: "blocklet-description",
|
118
150
|
variant: "body2",
|
119
151
|
color: "text.secondary",
|
120
152
|
sx: {
|
package/lib/BlockletV2/index.js
CHANGED
@@ -0,0 +1,7 @@
|
|
1
|
+
import { TooltipProps } from '@mui/material';
|
2
|
+
export interface TooltipIconProps extends TooltipProps {
|
3
|
+
fontSize?: number | string;
|
4
|
+
fontWeight?: number | string;
|
5
|
+
color?: string;
|
6
|
+
}
|
7
|
+
export default function TooltipIcon({ title, sx, children, PopperProps, fontSize, fontWeight, color, ...props }: TooltipIconProps): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { Tooltip, tooltipClasses } from '@mui/material';
|
3
|
+
export default function TooltipIcon({
|
4
|
+
title,
|
5
|
+
sx,
|
6
|
+
children,
|
7
|
+
PopperProps,
|
8
|
+
fontSize = 12,
|
9
|
+
fontWeight = 500,
|
10
|
+
color = 'text.secondary',
|
11
|
+
...props
|
12
|
+
}) {
|
13
|
+
return title ? /*#__PURE__*/_jsx(Tooltip, {
|
14
|
+
title: title,
|
15
|
+
placement: "top",
|
16
|
+
...props,
|
17
|
+
PopperProps: {
|
18
|
+
...PopperProps,
|
19
|
+
sx: [{
|
20
|
+
[`& .${tooltipClasses.tooltip}`]: {
|
21
|
+
backgroundColor: 'common.white',
|
22
|
+
boxShadow: 1,
|
23
|
+
fontSize,
|
24
|
+
fontWeight,
|
25
|
+
color,
|
26
|
+
display: 'flex',
|
27
|
+
alignItems: 'center'
|
28
|
+
}
|
29
|
+
}, ...(Array.isArray(PopperProps?.sx) ? PopperProps.sx : [PopperProps?.sx])]
|
30
|
+
},
|
31
|
+
children: children
|
32
|
+
}) : children;
|
33
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.10.
|
3
|
+
"version": "2.10.59",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -64,12 +64,12 @@
|
|
64
64
|
"react": ">=18.2.0",
|
65
65
|
"react-router-dom": ">=6.22.3"
|
66
66
|
},
|
67
|
-
"gitHead": "
|
67
|
+
"gitHead": "6e83602a81e7f104f3f0b6cb94d22a1974becef2",
|
68
68
|
"dependencies": {
|
69
69
|
"@arcblock/did-motif": "^1.1.13",
|
70
|
-
"@arcblock/icons": "^2.10.
|
71
|
-
"@arcblock/nft-display": "^2.10.
|
72
|
-
"@arcblock/react-hooks": "^2.10.
|
70
|
+
"@arcblock/icons": "^2.10.59",
|
71
|
+
"@arcblock/nft-display": "^2.10.59",
|
72
|
+
"@arcblock/react-hooks": "^2.10.59",
|
73
73
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
74
74
|
"@fontsource/inter": "^5.0.16",
|
75
75
|
"@fontsource/ubuntu-mono": "^5.0.18",
|
@@ -2,11 +2,13 @@ import React, { isValidElement } from 'react';
|
|
2
2
|
|
3
3
|
import Download from '@iconify-icons/tabler/cloud-download';
|
4
4
|
import { Icon } from '@iconify/react';
|
5
|
-
import
|
5
|
+
import VerifiedIcon from '@mui/icons-material/Verified';
|
6
|
+
import { Box, Card, CardProps, CircularProgress, Stack, Typography } from '@mui/material';
|
6
7
|
import Avatar from '../Avatar';
|
7
8
|
import Button from '../Button';
|
8
9
|
import { useTheme } from '../Theme';
|
9
10
|
import IconText from './components/icon-text';
|
11
|
+
import TooltipIcon from './tooltip-icon';
|
10
12
|
import { formatDownloadCount, strippedString } from './utils';
|
11
13
|
|
12
14
|
export interface IBlockletStore extends CardProps {
|
@@ -17,6 +19,11 @@ export interface IBlockletStore extends CardProps {
|
|
17
19
|
avatar: string;
|
18
20
|
author: string;
|
19
21
|
download: string;
|
22
|
+
official?: {
|
23
|
+
tooltip: React.ReactNode;
|
24
|
+
size?: number;
|
25
|
+
color?: string;
|
26
|
+
};
|
20
27
|
button?: React.ReactNode;
|
21
28
|
buttonText?: string;
|
22
29
|
buttonDisabled?: boolean;
|
@@ -35,6 +42,7 @@ export default function BlockletStore(props: IBlockletStore) {
|
|
35
42
|
author,
|
36
43
|
download,
|
37
44
|
did,
|
45
|
+
official,
|
38
46
|
buttonText = 'Install',
|
39
47
|
buttonDisabled,
|
40
48
|
buttonLoading,
|
@@ -81,14 +89,28 @@ export default function BlockletStore(props: IBlockletStore) {
|
|
81
89
|
onClick={handleMainClick}
|
82
90
|
{...rest}
|
83
91
|
sx={{ p: { xs: 2, md: 3 }, borderRadius: 2, ...rest.sx }}>
|
84
|
-
<Stack flex={1} direction="row" gap={
|
85
|
-
<Avatar src={cover} did={did} size={48} variant="rounded" />
|
92
|
+
<Stack flex={1} direction="row" gap={1} alignItems="center" overflow="hidden" sx={{ '& > *': { flexShrink: 0 } }}>
|
93
|
+
<Avatar src={cover} did={did} size={48} variant="rounded" style={{ borderRadius: '8px', overflow: 'hidden' }} />
|
86
94
|
<Typography
|
87
|
-
|
88
|
-
fontWeight="
|
89
|
-
sx={{
|
95
|
+
className="blocklet-title"
|
96
|
+
fontWeight="fontWeightMedium"
|
97
|
+
sx={{
|
98
|
+
fontSize: 16,
|
99
|
+
textOverflow: 'ellipsis',
|
100
|
+
whiteSpace: 'nowrap',
|
101
|
+
overflow: 'hidden',
|
102
|
+
pl: 0.5,
|
103
|
+
'&&': { flexShrink: 1 },
|
104
|
+
}}
|
90
105
|
{...titleProps}
|
91
106
|
/>
|
107
|
+
<Box flex={1} display="flex" alignItems="center" justifyContent="flex-start" gap={1}>
|
108
|
+
{official && (
|
109
|
+
<TooltipIcon title={official.tooltip}>
|
110
|
+
<VerifiedIcon sx={{ color: official.color || '#D97706', fontSize: official.size || 18 }} />
|
111
|
+
</TooltipIcon>
|
112
|
+
)}
|
113
|
+
</Box>
|
92
114
|
{button ||
|
93
115
|
(onButtonClick && (
|
94
116
|
<Button
|
@@ -110,6 +132,7 @@ export default function BlockletStore(props: IBlockletStore) {
|
|
110
132
|
</Stack>
|
111
133
|
<Stack py={2}>
|
112
134
|
<Typography
|
135
|
+
className="blocklet-description"
|
113
136
|
variant="body2"
|
114
137
|
color="text.secondary"
|
115
138
|
sx={{
|
package/src/BlockletV2/index.ts
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
import { Tooltip, TooltipProps, tooltipClasses } from '@mui/material';
|
2
|
+
|
3
|
+
export interface TooltipIconProps extends TooltipProps {
|
4
|
+
fontSize?: number | string;
|
5
|
+
fontWeight?: number | string;
|
6
|
+
color?: string;
|
7
|
+
}
|
8
|
+
|
9
|
+
export default function TooltipIcon({
|
10
|
+
title,
|
11
|
+
sx,
|
12
|
+
children,
|
13
|
+
PopperProps,
|
14
|
+
fontSize = 12,
|
15
|
+
fontWeight = 500,
|
16
|
+
color = 'text.secondary',
|
17
|
+
...props
|
18
|
+
}: TooltipIconProps) {
|
19
|
+
return title ? (
|
20
|
+
<Tooltip
|
21
|
+
title={title}
|
22
|
+
placement="top"
|
23
|
+
{...props}
|
24
|
+
PopperProps={{
|
25
|
+
...PopperProps,
|
26
|
+
sx: [
|
27
|
+
{
|
28
|
+
[`& .${tooltipClasses.tooltip}`]: {
|
29
|
+
backgroundColor: 'common.white',
|
30
|
+
boxShadow: 1,
|
31
|
+
fontSize,
|
32
|
+
fontWeight,
|
33
|
+
color,
|
34
|
+
display: 'flex',
|
35
|
+
alignItems: 'center',
|
36
|
+
},
|
37
|
+
},
|
38
|
+
...(Array.isArray(PopperProps?.sx) ? PopperProps.sx : [PopperProps?.sx]),
|
39
|
+
],
|
40
|
+
}}>
|
41
|
+
{children}
|
42
|
+
</Tooltip>
|
43
|
+
) : (
|
44
|
+
children
|
45
|
+
);
|
46
|
+
}
|