@arcblock/ux 1.16.64 → 1.16.67
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/Blocklet/blocklet.js +18 -16
- package/package.json +4 -4
- package/src/Blocklet/blocklet.js +81 -78
package/lib/Blocklet/blocklet.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = BlockletStore;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
11
|
|
|
@@ -17,6 +17,10 @@ var _CircularProgress = _interopRequireDefault(require("@material-ui/core/Circul
|
|
|
17
17
|
|
|
18
18
|
var _Avatar = _interopRequireDefault(require("@arcblock/did-connect/lib/Avatar"));
|
|
19
19
|
|
|
20
|
+
var _useTheme = _interopRequireDefault(require("@material-ui/core/styles/useTheme"));
|
|
21
|
+
|
|
22
|
+
var _useMediaQuery = _interopRequireDefault(require("@material-ui/core/useMediaQuery"));
|
|
23
|
+
|
|
20
24
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
21
25
|
|
|
22
26
|
var _Img = _interopRequireDefault(require("../Img"));
|
|
@@ -25,10 +29,6 @@ const _excluded = ["title", "did", "description", "cover", "version", "button",
|
|
|
25
29
|
|
|
26
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
31
|
|
|
28
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
-
|
|
32
32
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
33
33
|
|
|
34
34
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -36,7 +36,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
36
36
|
const Div = _styledComponents.default.div.withConfig({
|
|
37
37
|
displayName: "blocklet__Div",
|
|
38
38
|
componentId: "sc-atxvkd-0"
|
|
39
|
-
})(["
|
|
39
|
+
})(["&.arcblock-blocklet{padding:16px 16px 0 16px;}.arcblock-blocklet__content{cursor:pointer;display:flex;", "{align-items:center;}}.arcblock-blocklet__cover{width:64px;height:64px;margin-right:16px;overflow:hidden;border-radius:12px;transform:translateZ(0);", "{width:80px;height:80px;margin-bottom:12px;}}.arcblock-blocklet__button--hover{&:not(.Mui-disabled){position:relative;z-index:1;&::before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;transition:opacity 0.3s;}&:hover::before{opacity:0;}&::after{content:'';position:absolute;height:100%;width:100%;background-color:", ";transform:scale(0.1);opacity:0;z-index:-1;transition:transform 0.3s,opacity 0.3s,background-color 0.3s;}&:hover::after{opacity:1;transform-origin:center;transform:scale(1);}}&:not(.Mui-disabled){background-color:transparent !important;color:", ";}&:not(.Mui-disabled){&:hover{color:", ";}}}.arcblock-blocklet__info{flex:1;overflow:hidden;border-bottom:1px solid ", ";padding-bottom:24px;}.arcblock-blocklet__text{height:57px;overflow:hidden;}.arcblock-blocklet__title{margin:0;font-size:16px;font-weight:500;line-height:19px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;max-height:38px;word-break:break-all;}.arcblock-blocklet__describe{margin-top:2px;color:", ";font-size:14px;font-weight:500;line-height:17px;max-height:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.arcblock-blocklet__version{color:", ";font-size:12px;}"], props => props.theme.breakpoints.up('sm'), props => props.theme.breakpoints.up('sm'), props => props.theme.palette.primary.main, props => props.theme.palette.primary.main, props => props.theme.palette.common.white, props => props.theme.palette.divider, props => props.theme.palette.grey[600], props => props.theme.palette.grey[600]);
|
|
40
40
|
|
|
41
41
|
function BlockletStore(_ref) {
|
|
42
42
|
let {
|
|
@@ -83,15 +83,17 @@ function BlockletStore(_ref) {
|
|
|
83
83
|
return false;
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
+
const theme = (0, _useTheme.default)();
|
|
87
|
+
const isUpSm = (0, _useMediaQuery.default)(theme.breakpoints.up('sm'));
|
|
88
|
+
|
|
86
89
|
const _onMainClick = wrapHandler(onMainClick);
|
|
87
90
|
|
|
88
|
-
const
|
|
89
|
-
return /*#__PURE__*/_react.default.createElement(Div,
|
|
90
|
-
className: "".concat(className, " arcblock-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
className: "arcblock-blocklet__content--body"
|
|
91
|
+
const didAvatarSize = isUpSm ? 80 : 64;
|
|
92
|
+
return /*#__PURE__*/_react.default.createElement(Div, Object.assign({
|
|
93
|
+
className: "".concat(className, " arcblock-blocklet")
|
|
94
|
+
}, rest), /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
+
className: "arcblock-blocklet__content",
|
|
96
|
+
onClick: _onMainClick
|
|
95
97
|
}, cover ? /*#__PURE__*/_react.default.createElement("div", {
|
|
96
98
|
className: "arcblock-blocklet__cover"
|
|
97
99
|
}, /*#__PURE__*/_react.default.createElement(_Img.default, {
|
|
@@ -100,7 +102,7 @@ function BlockletStore(_ref) {
|
|
|
100
102
|
className: "arcblock-blocklet__cover"
|
|
101
103
|
}, /*#__PURE__*/_react.default.createElement(_Avatar.default, {
|
|
102
104
|
did: did,
|
|
103
|
-
size:
|
|
105
|
+
size: didAvatarSize
|
|
104
106
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
105
107
|
className: "arcblock-blocklet__info"
|
|
106
108
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -119,7 +121,7 @@ function BlockletStore(_ref) {
|
|
|
119
121
|
style: {
|
|
120
122
|
display: 'flex',
|
|
121
123
|
alignItems: 'center',
|
|
122
|
-
marginTop: '
|
|
124
|
+
marginTop: '10px',
|
|
123
125
|
flexFlow: 'wrap'
|
|
124
126
|
}
|
|
125
127
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -147,7 +149,7 @@ function BlockletStore(_ref) {
|
|
|
147
149
|
}
|
|
148
150
|
}), buttonText)), /*#__PURE__*/_react.default.createElement("div", {
|
|
149
151
|
className: "arcblock-blocklet__version"
|
|
150
|
-
}, version && "v".concat(version))))))
|
|
152
|
+
}, version && "v".concat(version))))));
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
BlockletStore.propTypes = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.67",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"react": ">=16.12.0",
|
|
54
54
|
"react-ga": "^2.7.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "9fc7e3166b8ff17a65008f0037b6d5e9d9a6488e",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@arcblock/icons": "^1.16.
|
|
59
|
-
"@arcblock/react-hooks": "^1.16.
|
|
58
|
+
"@arcblock/icons": "^1.16.67",
|
|
59
|
+
"@arcblock/react-hooks": "^1.16.67",
|
|
60
60
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
61
61
|
"@fontsource/lato": "^4.5.3",
|
|
62
62
|
"@material-ui/core": "^4.12.3",
|
package/src/Blocklet/blocklet.js
CHANGED
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import Typography from '@material-ui/core/Typography';
|
|
5
5
|
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
6
6
|
import Avatar from '@arcblock/did-connect/lib/Avatar';
|
|
7
|
+
import useTheme from '@material-ui/core/styles/useTheme';
|
|
8
|
+
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
|
7
9
|
|
|
8
10
|
import Button from '../Button';
|
|
9
11
|
import Img from '../Img';
|
|
10
12
|
|
|
11
13
|
const Div = styled.div`
|
|
14
|
+
&.arcblock-blocklet {
|
|
15
|
+
padding: 16px 16px 0 16px;
|
|
16
|
+
}
|
|
12
17
|
.arcblock-blocklet__content {
|
|
13
|
-
padding: 24px 16px 0 16px;
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
18
|
cursor: pointer;
|
|
17
|
-
}
|
|
18
|
-
.arcblock-blocklet__content--body {
|
|
19
|
-
overflow: hidden;
|
|
20
|
-
flex: 1;
|
|
21
19
|
display: flex;
|
|
22
|
-
|
|
20
|
+
${props => props.theme.breakpoints.up('sm')} {
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
23
|
}
|
|
24
24
|
.arcblock-blocklet__cover {
|
|
25
25
|
width: 64px;
|
|
26
26
|
height: 64px;
|
|
27
|
-
margin-right:
|
|
27
|
+
margin-right: 16px;
|
|
28
28
|
overflow: hidden;
|
|
29
29
|
border-radius: 12px;
|
|
30
30
|
/* see: https://stackoverflow.com/questions/49066011/overflow-hidden-with-border-radius-not-working-on-safari */
|
|
31
31
|
transform: translateZ(0);
|
|
32
|
+
${props => props.theme.breakpoints.up('sm')} {
|
|
33
|
+
width: 80px;
|
|
34
|
+
height: 80px;
|
|
35
|
+
margin-bottom: 12px;
|
|
36
|
+
}
|
|
32
37
|
}
|
|
33
38
|
.arcblock-blocklet__button--hover {
|
|
34
39
|
&:not(.Mui-disabled) {
|
|
@@ -81,25 +86,25 @@ const Div = styled.div`
|
|
|
81
86
|
padding-bottom: 24px;
|
|
82
87
|
}
|
|
83
88
|
.arcblock-blocklet__text {
|
|
84
|
-
height:
|
|
89
|
+
height: 57px;
|
|
85
90
|
overflow: hidden;
|
|
86
91
|
}
|
|
87
92
|
/* 设置多行文本溢出显示省略号 兼容fireFox、safari */
|
|
88
93
|
.arcblock-blocklet__title {
|
|
89
94
|
margin: 0;
|
|
90
|
-
font-size:
|
|
95
|
+
font-size: 16px;
|
|
91
96
|
font-weight: 500;
|
|
92
|
-
line-height:
|
|
97
|
+
line-height: 19px;
|
|
93
98
|
overflow: hidden;
|
|
94
99
|
text-overflow: ellipsis;
|
|
95
100
|
display: -webkit-box;
|
|
96
101
|
-webkit-line-clamp: 2;
|
|
97
102
|
-webkit-box-orient: vertical;
|
|
98
|
-
max-height:
|
|
103
|
+
max-height: 38px;
|
|
99
104
|
word-break: break-all;
|
|
100
105
|
}
|
|
101
106
|
.arcblock-blocklet__describe {
|
|
102
|
-
margin:
|
|
107
|
+
margin-top: 2px;
|
|
103
108
|
color: ${props => props.theme.palette.grey[600]};
|
|
104
109
|
font-size: 14px;
|
|
105
110
|
font-weight: 500;
|
|
@@ -111,6 +116,7 @@ const Div = styled.div`
|
|
|
111
116
|
}
|
|
112
117
|
.arcblock-blocklet__version {
|
|
113
118
|
color: ${props => props.theme.palette.grey[600]};
|
|
119
|
+
font-size: 12px;
|
|
114
120
|
}
|
|
115
121
|
`;
|
|
116
122
|
export default function BlockletStore({
|
|
@@ -147,77 +153,74 @@ export default function BlockletStore({
|
|
|
147
153
|
}
|
|
148
154
|
return false;
|
|
149
155
|
});
|
|
156
|
+
const theme = useTheme();
|
|
157
|
+
const isUpSm = useMediaQuery(theme.breakpoints.up('sm'));
|
|
150
158
|
const _onMainClick = wrapHandler(onMainClick);
|
|
151
|
-
const
|
|
159
|
+
const didAvatarSize = isUpSm ? 80 : 64;
|
|
152
160
|
|
|
153
161
|
return (
|
|
154
|
-
<Div {...rest}>
|
|
155
|
-
<div
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
<Div className={`${className} arcblock-blocklet`} {...rest}>
|
|
163
|
+
<div className="arcblock-blocklet__content" onClick={_onMainClick}>
|
|
164
|
+
{cover ? (
|
|
165
|
+
<div className="arcblock-blocklet__cover">
|
|
166
|
+
<Img src={cover} />
|
|
167
|
+
</div>
|
|
168
|
+
) : (
|
|
169
|
+
did && (
|
|
161
170
|
<div className="arcblock-blocklet__cover">
|
|
162
|
-
<
|
|
171
|
+
<Avatar did={did} size={didAvatarSize} />
|
|
163
172
|
</div>
|
|
164
|
-
)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
+
)
|
|
174
|
+
)}
|
|
175
|
+
<div className="arcblock-blocklet__info">
|
|
176
|
+
<div className="arcblock-blocklet__text">
|
|
177
|
+
<Typography
|
|
178
|
+
component="h3"
|
|
179
|
+
variant="h3"
|
|
180
|
+
className="arcblock-blocklet__title"
|
|
181
|
+
title={title}>
|
|
182
|
+
{title}
|
|
183
|
+
</Typography>
|
|
184
|
+
{description && (
|
|
173
185
|
<Typography
|
|
174
|
-
component="
|
|
175
|
-
variant="
|
|
176
|
-
className="arcblock-
|
|
177
|
-
title={
|
|
178
|
-
{
|
|
186
|
+
component="div"
|
|
187
|
+
variant="body2"
|
|
188
|
+
className="arcblock-blocklet__describe"
|
|
189
|
+
title={description}>
|
|
190
|
+
{description}
|
|
179
191
|
</Typography>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
textAlign: 'center',
|
|
211
|
-
}}>
|
|
212
|
-
{buttonLoading && (
|
|
213
|
-
<CircularProgress size={15} style={{ marginRight: 3, color: 'inherit' }} />
|
|
214
|
-
)}
|
|
215
|
-
{buttonText}
|
|
216
|
-
</Button>
|
|
217
|
-
))}
|
|
218
|
-
</div>
|
|
219
|
-
<div className="arcblock-blocklet__version">{version && `v${version}`}</div>
|
|
192
|
+
)}
|
|
193
|
+
</div>
|
|
194
|
+
<div
|
|
195
|
+
style={{
|
|
196
|
+
display: 'flex',
|
|
197
|
+
alignItems: 'center',
|
|
198
|
+
marginTop: '10px',
|
|
199
|
+
flexFlow: 'wrap',
|
|
200
|
+
}}>
|
|
201
|
+
<div onClick={_onButtonClick} style={{ marginRight: '12px' }}>
|
|
202
|
+
{button ||
|
|
203
|
+
(onButtonClick && (
|
|
204
|
+
<Button
|
|
205
|
+
className="arcblock-blocklet__button--hover"
|
|
206
|
+
variant="outlined"
|
|
207
|
+
color="primary"
|
|
208
|
+
size="small"
|
|
209
|
+
disabled={buttonDisabled || buttonLoading}
|
|
210
|
+
style={{
|
|
211
|
+
padding: '3px 6px',
|
|
212
|
+
fontSize: '14px',
|
|
213
|
+
minWidth: '92px',
|
|
214
|
+
textAlign: 'center',
|
|
215
|
+
}}>
|
|
216
|
+
{buttonLoading && (
|
|
217
|
+
<CircularProgress size={15} style={{ marginRight: 3, color: 'inherit' }} />
|
|
218
|
+
)}
|
|
219
|
+
{buttonText}
|
|
220
|
+
</Button>
|
|
221
|
+
))}
|
|
220
222
|
</div>
|
|
223
|
+
<div className="arcblock-blocklet__version">{version && `v${version}`}</div>
|
|
221
224
|
</div>
|
|
222
225
|
</div>
|
|
223
226
|
</div>
|