@arcblock/ux 2.4.20 → 2.4.23
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/ClickToCopy/copy-button.js +8 -5
- package/lib/Screenshot/BaseScreenshot/index.js +4 -1
- package/lib/Screenshot/BaseScreenshot/shells/Macbook.js +67 -0
- package/lib/Screenshot/index.js +1 -1
- package/package.json +9 -9
- package/src/ClickToCopy/copy-button.js +4 -2
- package/src/Screenshot/BaseScreenshot/index.jsx +2 -0
- package/src/Screenshot/BaseScreenshot/shells/Macbook.jsx +36 -0
- package/src/Screenshot/index.js +1 -1
@@ -19,7 +19,7 @@ var _hook = _interopRequireDefault(require("./hook"));
|
|
19
19
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
21
21
|
|
22
|
-
const _excluded = ["content", "locale", "render"];
|
22
|
+
const _excluded = ["content", "locale", "render", "showTooltip"];
|
23
23
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
25
|
|
@@ -37,7 +37,8 @@ function CopyButton(_ref) {
|
|
37
37
|
let {
|
38
38
|
content,
|
39
39
|
locale,
|
40
|
-
render
|
40
|
+
render,
|
41
|
+
showTooltip
|
41
42
|
} = _ref,
|
42
43
|
rest = _objectWithoutProperties(_ref, _excluded);
|
43
44
|
|
@@ -63,7 +64,7 @@ function CopyButton(_ref) {
|
|
63
64
|
title: texts.copied,
|
64
65
|
placement: "bottom",
|
65
66
|
arrow: true,
|
66
|
-
open: copied,
|
67
|
+
open: copied && showTooltip,
|
67
68
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Check.default, {
|
68
69
|
sx: _objectSpread(_objectSpread({}, iconStyle), {}, {
|
69
70
|
color: _colors.green[500]
|
@@ -90,10 +91,12 @@ function CopyButton(_ref) {
|
|
90
91
|
CopyButton.propTypes = {
|
91
92
|
content: _propTypes.default.string,
|
92
93
|
locale: _propTypes.default.oneOf(['en', 'zh']),
|
93
|
-
render: _propTypes.default.func
|
94
|
+
render: _propTypes.default.func,
|
95
|
+
showTooltip: _propTypes.default.bool
|
94
96
|
};
|
95
97
|
CopyButton.defaultProps = {
|
96
98
|
content: '',
|
97
99
|
locale: 'en',
|
98
|
-
render: undefined
|
100
|
+
render: undefined,
|
101
|
+
showTooltip: true
|
99
102
|
};
|
@@ -11,6 +11,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
12
12
|
var _Phone = _interopRequireDefault(require("./shells/Phone"));
|
13
13
|
|
14
|
+
var _Macbook = _interopRequireDefault(require("./shells/Macbook"));
|
15
|
+
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
15
17
|
|
16
18
|
var _templateObject;
|
@@ -32,7 +34,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
32
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; }
|
33
35
|
|
34
36
|
const map = {
|
35
|
-
phone: _Phone.default
|
37
|
+
phone: _Phone.default,
|
38
|
+
macbook: _Macbook.default
|
36
39
|
};
|
37
40
|
|
38
41
|
function Screenshot(_ref) {
|
@@ -0,0 +1,67 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Shell = Shell;
|
7
|
+
exports.width = exports.screenData = exports.ratio = exports.height = exports.default = void 0;
|
8
|
+
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
10
|
+
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
12
|
+
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
14
|
+
|
15
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
16
|
+
|
17
|
+
function Shell(_ref) {
|
18
|
+
let rest = Object.assign({}, _ref);
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", _objectSpread(_objectSpread({
|
20
|
+
width: "909",
|
21
|
+
height: "517",
|
22
|
+
viewBox: "0 0 909 517",
|
23
|
+
fill: "none",
|
24
|
+
xmlns: "http://www.w3.org/2000/svg"
|
25
|
+
}, rest), {}, {
|
26
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
27
|
+
d: "M48 16C48 7.16343 55.1634 0 64 0H845C853.837 0 861 7.16344 861 16V490H48V16Z",
|
28
|
+
fill: "black"
|
29
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
30
|
+
fillRule: "evenodd",
|
31
|
+
clipRule: "evenodd",
|
32
|
+
d: "M62 28H847V466H62V28Z"
|
33
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
34
|
+
d: "M0 490H909V493C909 506.255 898.255 517 885 517H24C10.7452 517 0 506.255 0 493V490Z",
|
35
|
+
fill: "#282828"
|
36
|
+
})]
|
37
|
+
}));
|
38
|
+
} // 设备截图的实际尺寸
|
39
|
+
|
40
|
+
|
41
|
+
const width = 909;
|
42
|
+
exports.width = width;
|
43
|
+
const height = 517; // 屏幕的比例
|
44
|
+
|
45
|
+
exports.height = height;
|
46
|
+
const ratio = 438 / 785; // 屏幕相关数据
|
47
|
+
|
48
|
+
exports.ratio = ratio;
|
49
|
+
const screenData = {
|
50
|
+
// 屏幕坐标轴相对图片的百分比
|
51
|
+
x: 68 / 909,
|
52
|
+
y: 28 / 517,
|
53
|
+
// 屏幕尺寸相对图片尺寸的百分比
|
54
|
+
width: 773 / 909,
|
55
|
+
height: 438 / 517,
|
56
|
+
// 是否有圆角
|
57
|
+
radius: 'none'
|
58
|
+
};
|
59
|
+
exports.screenData = screenData;
|
60
|
+
var _default = {
|
61
|
+
Shell,
|
62
|
+
ratio,
|
63
|
+
screenData,
|
64
|
+
width,
|
65
|
+
height
|
66
|
+
};
|
67
|
+
exports.default = _default;
|
package/lib/Screenshot/index.js
CHANGED
@@ -279,7 +279,7 @@ function Screenshot(_ref) {
|
|
279
279
|
const _type = type.toLowerCase(); // 新版采用容器采用BaseScreenshot,svg集成,更容易拓展,响应式更好
|
280
280
|
|
281
281
|
|
282
|
-
if (['phone'].includes(_type)) {
|
282
|
+
if (['phone', 'macbook'].includes(_type)) {
|
283
283
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseScreenshot.default, _objectSpread(_objectSpread({
|
284
284
|
type: _type,
|
285
285
|
sx: _objectSpread(_objectSpread({}, sx), style)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.4.
|
3
|
+
"version": "2.4.23",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -19,11 +19,11 @@
|
|
19
19
|
"lint": "eslint src tests",
|
20
20
|
"build": "babel src --out-dir lib --copy-files --no-copy-ignored",
|
21
21
|
"watch": "babel src --out-dir lib -w --copy-files --no-copy-ignored",
|
22
|
-
"precommit": "CI=1
|
23
|
-
"prepush": "CI=1
|
22
|
+
"precommit": "CI=1 npm run lint",
|
23
|
+
"prepush": "CI=1 npm run lint",
|
24
24
|
"prepublish": "npm run build",
|
25
|
-
"test": "
|
26
|
-
"coverage": "npm run
|
25
|
+
"test": "node tools/jest.js",
|
26
|
+
"coverage": "npm run test -- --coverage"
|
27
27
|
},
|
28
28
|
"bugs": {
|
29
29
|
"url": "https://github.com/ArcBlock/ux/issues"
|
@@ -39,7 +39,7 @@
|
|
39
39
|
"@babel/preset-react": "^7.18.6",
|
40
40
|
"babel-plugin-inline-react-svg": "^1.1.2",
|
41
41
|
"eslint-plugin-react-hooks": "^4.6.0",
|
42
|
-
"jest": "^
|
42
|
+
"jest": "^28.1.3",
|
43
43
|
"moment-timezone": "^0.5.34"
|
44
44
|
},
|
45
45
|
"peerDependencies": {
|
@@ -47,10 +47,10 @@
|
|
47
47
|
"react": ">=18.1.0",
|
48
48
|
"react-ga": "^2.7.0"
|
49
49
|
},
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "2a53c85d0567c3534060d8f38ab05279d7e39d15",
|
51
51
|
"dependencies": {
|
52
|
-
"@arcblock/icons": "^2.4.
|
53
|
-
"@arcblock/react-hooks": "^2.4.
|
52
|
+
"@arcblock/icons": "^2.4.23",
|
53
|
+
"@arcblock/react-hooks": "^2.4.23",
|
54
54
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
55
55
|
"@emotion/react": "^11.10.0",
|
56
56
|
"@emotion/styled": "^11.10.0",
|
@@ -5,7 +5,7 @@ import CopyIcon from '@mui/icons-material/ContentCopy';
|
|
5
5
|
import CheckIcon from '@mui/icons-material/Check';
|
6
6
|
import useCopy from './hook';
|
7
7
|
|
8
|
-
export default function CopyButton({ content, locale, render, ...rest }) {
|
8
|
+
export default function CopyButton({ content, locale, render, showTooltip, ...rest }) {
|
9
9
|
const { containerRef, copied, copy, texts } = useCopy({ content, locale });
|
10
10
|
const iconStyle = {
|
11
11
|
fontSize: '1em',
|
@@ -14,7 +14,7 @@ export default function CopyButton({ content, locale, render, ...rest }) {
|
|
14
14
|
const copyButton = (
|
15
15
|
<span title={copied ? '' : texts.copy} {...rest} style={{ height: '1em', ...rest.style }}>
|
16
16
|
{copied ? (
|
17
|
-
<Tooltip title={texts.copied} placement="bottom" arrow open={copied}>
|
17
|
+
<Tooltip title={texts.copied} placement="bottom" arrow open={copied && showTooltip}>
|
18
18
|
<CheckIcon sx={{ ...iconStyle, color: green[500] }} />
|
19
19
|
</Tooltip>
|
20
20
|
) : (
|
@@ -33,10 +33,12 @@ CopyButton.propTypes = {
|
|
33
33
|
content: PropTypes.string,
|
34
34
|
locale: PropTypes.oneOf(['en', 'zh']),
|
35
35
|
render: PropTypes.func,
|
36
|
+
showTooltip: PropTypes.bool,
|
36
37
|
};
|
37
38
|
|
38
39
|
CopyButton.defaultProps = {
|
39
40
|
content: '',
|
40
41
|
locale: 'en',
|
41
42
|
render: undefined,
|
43
|
+
showTooltip: true,
|
42
44
|
};
|
@@ -2,9 +2,11 @@ import { styled } from '@arcblock/ux/lib/Theme';
|
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
|
4
4
|
import phone from './shells/Phone';
|
5
|
+
import macbook from './shells/Macbook';
|
5
6
|
|
6
7
|
const map = {
|
7
8
|
phone,
|
9
|
+
macbook,
|
8
10
|
};
|
9
11
|
|
10
12
|
function Screenshot({ width, children, type, sx, ...rest }) {
|
@@ -0,0 +1,36 @@
|
|
1
|
+
export function Shell({ ...rest }) {
|
2
|
+
return (
|
3
|
+
<svg width="909" height="517" viewBox="0 0 909 517" fill="none" xmlns="http://www.w3.org/2000/svg" {...rest}>
|
4
|
+
<path d="M48 16C48 7.16343 55.1634 0 64 0H845C853.837 0 861 7.16344 861 16V490H48V16Z" fill="black" />
|
5
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M62 28H847V466H62V28Z" />
|
6
|
+
<path d="M0 490H909V493C909 506.255 898.255 517 885 517H24C10.7452 517 0 506.255 0 493V490Z" fill="#282828" />
|
7
|
+
</svg>
|
8
|
+
);
|
9
|
+
}
|
10
|
+
|
11
|
+
// 设备截图的实际尺寸
|
12
|
+
export const width = 909;
|
13
|
+
export const height = 517;
|
14
|
+
|
15
|
+
// 屏幕的比例
|
16
|
+
export const ratio = 438 / 785;
|
17
|
+
|
18
|
+
// 屏幕相关数据
|
19
|
+
export const screenData = {
|
20
|
+
// 屏幕坐标轴相对图片的百分比
|
21
|
+
x: 68 / 909,
|
22
|
+
y: 28 / 517,
|
23
|
+
// 屏幕尺寸相对图片尺寸的百分比
|
24
|
+
width: 773 / 909,
|
25
|
+
height: 438 / 517,
|
26
|
+
// 是否有圆角
|
27
|
+
radius: 'none',
|
28
|
+
};
|
29
|
+
|
30
|
+
export default {
|
31
|
+
Shell,
|
32
|
+
ratio,
|
33
|
+
screenData,
|
34
|
+
width,
|
35
|
+
height,
|
36
|
+
};
|
package/src/Screenshot/index.js
CHANGED
@@ -242,7 +242,7 @@ function Screenshot({ type, src, children, style, sx, ...rest }) {
|
|
242
242
|
const _type = type.toLowerCase();
|
243
243
|
|
244
244
|
// 新版采用容器采用BaseScreenshot,svg集成,更容易拓展,响应式更好
|
245
|
-
if (['phone'].includes(_type)) {
|
245
|
+
if (['phone', 'macbook'].includes(_type)) {
|
246
246
|
return (
|
247
247
|
<BaseScreenshot type={_type} sx={{ ...sx, ...style }} {...rest}>
|
248
248
|
{children || (src ? <img src={src} alt="screenshot" /> : null)}
|