@arcblock/ux 2.4.14 → 2.4.17
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/index.js +14 -15
- package/lib/Empty/index.js +9 -10
- package/lib/Locale/selector.js +7 -6
- package/package.json +4 -4
- package/src/ClickToCopy/index.js +13 -9
- package/src/Empty/index.js +3 -6
- package/src/Locale/selector.js +3 -8
package/lib/ClickToCopy/index.js
CHANGED
@@ -17,8 +17,6 @@ var _useWindowSize = _interopRequireDefault(require("react-use/lib/useWindowSize
|
|
17
17
|
|
18
18
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
19
19
|
|
20
|
-
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
21
|
-
|
22
20
|
var _hook = _interopRequireDefault(require("./hook"));
|
23
21
|
|
24
22
|
var _Toast = _interopRequireWildcard(require("../Toast"));
|
@@ -31,9 +29,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
31
29
|
|
32
30
|
var _copyButton = _interopRequireDefault(require("./copy-button"));
|
33
31
|
|
34
|
-
var _templateObject;
|
32
|
+
var _templateObject, _templateObject2;
|
35
33
|
|
36
|
-
const _excluded = ["children", "content", "tip", "copiedTip", "tipPlacement", "locale", "style"];
|
34
|
+
const _excluded = ["children", "content", "tip", "copiedTip", "tipPlacement", "locale", "style", "unstyled"];
|
37
35
|
|
38
36
|
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); }
|
39
37
|
|
@@ -63,7 +61,8 @@ function ClickToCopy(props) {
|
|
63
61
|
copiedTip,
|
64
62
|
tipPlacement,
|
65
63
|
locale,
|
66
|
-
style
|
64
|
+
style,
|
65
|
+
unstyled
|
67
66
|
} = newProps,
|
68
67
|
rest = _objectWithoutProperties(newProps, _excluded);
|
69
68
|
|
@@ -93,20 +92,16 @@ function ClickToCopy(props) {
|
|
93
92
|
}
|
94
93
|
};
|
95
94
|
|
95
|
+
const ContainerComponent = unstyled ? UnstyledContainer : Container;
|
96
96
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Toast.ToastProvider, {
|
97
97
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, _objectSpread(_objectSpread({
|
98
98
|
title: copied ? _copiedTip : _tip
|
99
99
|
}, rest), {}, {
|
100
100
|
placement: tipPlacement,
|
101
101
|
disableFocusListener: true,
|
102
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
102
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ContainerComponent, {
|
103
103
|
ref: containerRef,
|
104
|
-
|
105
|
-
style: Object.assign({
|
106
|
-
fontSize: 'inherit',
|
107
|
-
color: 'inherit',
|
108
|
-
fontWeight: 'inherit'
|
109
|
-
}, style),
|
104
|
+
style: style,
|
110
105
|
onClick: onCopy,
|
111
106
|
children: children || content
|
112
107
|
})
|
@@ -121,7 +116,9 @@ ClickToCopy.propTypes = {
|
|
121
116
|
tipPlacement: _propTypes.default.string,
|
122
117
|
copiedTip: _propTypes.default.string,
|
123
118
|
locale: _propTypes.default.oneOf(['en', 'zh']),
|
124
|
-
style: _propTypes.default.object
|
119
|
+
style: _propTypes.default.object,
|
120
|
+
// 仅提供点击复制功能, 不提供样式
|
121
|
+
unstyled: _propTypes.default.bool
|
125
122
|
};
|
126
123
|
ClickToCopy.defaultProps = {
|
127
124
|
content: '',
|
@@ -129,6 +126,8 @@ ClickToCopy.defaultProps = {
|
|
129
126
|
copiedTip: '',
|
130
127
|
tipPlacement: 'right',
|
131
128
|
locale: 'en',
|
132
|
-
style: {}
|
129
|
+
style: {},
|
130
|
+
unstyled: false
|
133
131
|
};
|
134
|
-
const Container = (0, _Theme.styled)(
|
132
|
+
const Container = (0, _Theme.styled)('span')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline;\n white-space: pre-wrap;\n word-wrap: break-word;\n overflow-wrap: break-word;\n align-items: center;\n justify-content: start;\n border-radius: 15px;\n padding: 1px 12px;\n background-color: rgba(0, 0, 0, 0.08);\n cursor: pointer;\n"])));
|
133
|
+
const UnstyledContainer = (0, _Theme.styled)('span')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: pointer;\n"])));
|
package/lib/Empty/index.js
CHANGED
@@ -7,13 +7,13 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
|
10
|
-
var
|
10
|
+
var _EmptyIcon = _interopRequireDefault(require("@arcblock/icons/lib/EmptyIcon"));
|
11
11
|
|
12
12
|
var _Theme = require("../Theme");
|
13
13
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
15
15
|
|
16
|
-
const _excluded = ["
|
16
|
+
const _excluded = ["color", "size", "children"];
|
17
17
|
|
18
18
|
var _templateObject;
|
19
19
|
|
@@ -35,7 +35,6 @@ const Wrapper = (0, _Theme.styled)('div')(_templateObject || (_templateObject =
|
|
35
35
|
|
36
36
|
function Empty(_ref) {
|
37
37
|
let {
|
38
|
-
name,
|
39
38
|
color,
|
40
39
|
size,
|
41
40
|
children
|
@@ -43,11 +42,13 @@ function Empty(_ref) {
|
|
43
42
|
rest = _objectWithoutProperties(_ref, _excluded);
|
44
43
|
|
45
44
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, _objectSpread(_objectSpread({}, rest), {}, {
|
46
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyIcon.default, {
|
46
|
+
style: {
|
47
|
+
width: size,
|
48
|
+
height: size,
|
49
|
+
color
|
50
|
+
},
|
51
|
+
className: "empty-icon"
|
51
52
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
52
53
|
className: "empty-content",
|
53
54
|
children: children
|
@@ -57,13 +58,11 @@ function Empty(_ref) {
|
|
57
58
|
|
58
59
|
Empty.propTypes = {
|
59
60
|
color: _propTypes.default.string,
|
60
|
-
name: _propTypes.default.string,
|
61
61
|
size: _propTypes.default.number,
|
62
62
|
children: _propTypes.default.any
|
63
63
|
};
|
64
64
|
Empty.defaultProps = {
|
65
65
|
color: 'inherit',
|
66
|
-
name: 'inbox',
|
67
66
|
size: 36,
|
68
67
|
children: null
|
69
68
|
};
|
package/lib/Locale/selector.js
CHANGED
@@ -39,7 +39,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
39
39
|
|
40
40
|
var _templateObject;
|
41
41
|
|
42
|
-
const _excluded = ["showText", "popperProps", "popperType", "icon"];
|
42
|
+
const _excluded = ["showText", "popperProps", "popperType", "icon", "size"];
|
43
43
|
|
44
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
45
45
|
|
@@ -62,7 +62,8 @@ function LocaleSelector(props) {
|
|
62
62
|
showText,
|
63
63
|
popperProps,
|
64
64
|
popperType,
|
65
|
-
icon: Icon
|
65
|
+
icon: Icon,
|
66
|
+
size
|
66
67
|
} = props,
|
67
68
|
rest = _objectWithoutProperties(props, _excluded);
|
68
69
|
|
@@ -111,12 +112,12 @@ function LocaleSelector(props) {
|
|
111
112
|
|
112
113
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Globe.default, {
|
113
114
|
style: {
|
114
|
-
width:
|
115
|
-
height:
|
115
|
+
width: 'auto',
|
116
|
+
height: size,
|
116
117
|
color: theme.palette.text.secondary
|
117
118
|
}
|
118
119
|
});
|
119
|
-
}, [Icon, theme === null || theme === void 0 ? void 0 : (_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : (_theme$palette2$text = _theme$palette2.text) === null || _theme$palette2$text === void 0 ? void 0 : _theme$palette2$text.secondary]);
|
120
|
+
}, [Icon, theme === null || theme === void 0 ? void 0 : (_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : (_theme$palette2$text = _theme$palette2.text) === null || _theme$palette2$text === void 0 ? void 0 : _theme$palette2$text.secondary, size]);
|
120
121
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, _objectSpread(_objectSpread(_objectSpread({
|
121
122
|
component: "div",
|
122
123
|
dark: dark,
|
@@ -183,4 +184,4 @@ LocaleSelector.defaultProps = {
|
|
183
184
|
};
|
184
185
|
var _default = LocaleSelector;
|
185
186
|
exports.default = _default;
|
186
|
-
const Div = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n\n .trigger {\n display: flex;\n flex-direction: column;\n justify-content: center;\n font-size: 14px;\n\n .trigger-
|
187
|
+
const Div = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n\n .trigger {\n display: flex;\n flex-direction: column;\n justify-content: center;\n font-size: 14px;\n\n .trigger-text {\n margin-left: 5px;\n font-size: 14px;\n color: ", ";\n }\n }\n\n .locales {\n background: ", ";\n }\n\n .locale-item {\n font-size: 16px;\n font-style: normal;\n font-stretch: normal;\n line-height: normal;\n letter-spacing: 2px;\n text-align: center;\n color: ", ";\n cursor: pointer;\n display: flex;\n padding: 16px;\n align-items: center;\n .check-icon {\n visibility: hidden;\n margin-right: 4px;\n }\n .check-icon-visible {\n visibility: visible;\n }\n }\n"])), props => (0, _Util.getColor)(props), props => (0, _Util.getBackground)(props), props => (0, _Util.getColor)(props));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.4.
|
3
|
+
"version": "2.4.17",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -47,10 +47,10 @@
|
|
47
47
|
"react": ">=18.1.0",
|
48
48
|
"react-ga": "^2.7.0"
|
49
49
|
},
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "074d03aa938b1a9f52d2d9ef2bb8d68bb08d061e",
|
51
51
|
"dependencies": {
|
52
|
-
"@arcblock/icons": "^2.4.
|
53
|
-
"@arcblock/react-hooks": "^2.4.
|
52
|
+
"@arcblock/icons": "^2.4.17",
|
53
|
+
"@arcblock/react-hooks": "^2.4.17",
|
54
54
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
55
55
|
"@emotion/react": "^11.10.0",
|
56
56
|
"@emotion/styled": "^11.10.0",
|
package/src/ClickToCopy/index.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import useWindowSize from 'react-use/lib/useWindowSize';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import Typography from '@mui/material/Typography';
|
5
4
|
|
6
5
|
import useCopy from './hook';
|
7
6
|
import Toast, { ToastProvider } from '../Toast';
|
@@ -12,7 +11,7 @@ export { default as CopyButton } from './copy-button';
|
|
12
11
|
|
13
12
|
export default function ClickToCopy(props) {
|
14
13
|
const newProps = mergeProps(props, ClickToCopy, ['style']);
|
15
|
-
const { children, content, tip, copiedTip, tipPlacement, locale, style, ...rest } = newProps;
|
14
|
+
const { children, content, tip, copiedTip, tipPlacement, locale, style, unstyled, ...rest } = newProps;
|
16
15
|
const { containerRef, copied, copy, texts } = useCopy({ content, locale });
|
17
16
|
const _tip = tip || texts.copy;
|
18
17
|
const _copiedTip = copiedTip || texts.copied;
|
@@ -26,16 +25,14 @@ export default function ClickToCopy(props) {
|
|
26
25
|
}
|
27
26
|
};
|
28
27
|
|
28
|
+
const ContainerComponent = unstyled ? UnstyledContainer : Container;
|
29
|
+
|
29
30
|
return (
|
30
31
|
<ToastProvider>
|
31
32
|
<Tooltip title={copied ? _copiedTip : _tip} {...rest} placement={tipPlacement} disableFocusListener>
|
32
|
-
<
|
33
|
-
ref={containerRef}
|
34
|
-
component="span"
|
35
|
-
style={Object.assign({ fontSize: 'inherit', color: 'inherit', fontWeight: 'inherit' }, style)}
|
36
|
-
onClick={onCopy}>
|
33
|
+
<ContainerComponent ref={containerRef} style={style} onClick={onCopy}>
|
37
34
|
{children || content}
|
38
|
-
</
|
35
|
+
</ContainerComponent>
|
39
36
|
</Tooltip>
|
40
37
|
</ToastProvider>
|
41
38
|
);
|
@@ -49,6 +46,8 @@ ClickToCopy.propTypes = {
|
|
49
46
|
copiedTip: PropTypes.string,
|
50
47
|
locale: PropTypes.oneOf(['en', 'zh']),
|
51
48
|
style: PropTypes.object,
|
49
|
+
// 仅提供点击复制功能, 不提供样式
|
50
|
+
unstyled: PropTypes.bool,
|
52
51
|
};
|
53
52
|
|
54
53
|
ClickToCopy.defaultProps = {
|
@@ -58,9 +57,10 @@ ClickToCopy.defaultProps = {
|
|
58
57
|
tipPlacement: 'right',
|
59
58
|
locale: 'en',
|
60
59
|
style: {},
|
60
|
+
unstyled: false,
|
61
61
|
};
|
62
62
|
|
63
|
-
const Container = styled(
|
63
|
+
const Container = styled('span')`
|
64
64
|
display: inline;
|
65
65
|
white-space: pre-wrap;
|
66
66
|
word-wrap: break-word;
|
@@ -72,3 +72,7 @@ const Container = styled(Typography)`
|
|
72
72
|
background-color: rgba(0, 0, 0, 0.08);
|
73
73
|
cursor: pointer;
|
74
74
|
`;
|
75
|
+
|
76
|
+
const UnstyledContainer = styled('span')`
|
77
|
+
cursor: pointer;
|
78
|
+
`;
|
package/src/Empty/index.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
|
-
|
3
|
-
import Icon from '../Icon';
|
2
|
+
import EmptyIcon from '@arcblock/icons/lib/EmptyIcon';
|
4
3
|
import { styled } from '../Theme';
|
5
4
|
|
6
5
|
const Wrapper = styled('div')`
|
@@ -16,10 +15,10 @@ const Wrapper = styled('div')`
|
|
16
15
|
}
|
17
16
|
`;
|
18
17
|
|
19
|
-
function Empty({
|
18
|
+
function Empty({ color, size, children, ...rest }) {
|
20
19
|
return (
|
21
20
|
<Wrapper {...rest}>
|
22
|
-
<
|
21
|
+
<EmptyIcon style={{ width: size, height: size, color }} className="empty-icon" />
|
23
22
|
<div className="empty-content">{children}</div>
|
24
23
|
</Wrapper>
|
25
24
|
);
|
@@ -27,13 +26,11 @@ function Empty({ name, color, size, children, ...rest }) {
|
|
27
26
|
|
28
27
|
Empty.propTypes = {
|
29
28
|
color: PropTypes.string,
|
30
|
-
name: PropTypes.string,
|
31
29
|
size: PropTypes.number,
|
32
30
|
children: PropTypes.any,
|
33
31
|
};
|
34
32
|
Empty.defaultProps = {
|
35
33
|
color: 'inherit',
|
36
|
-
name: 'inbox',
|
37
34
|
size: 36,
|
38
35
|
children: null,
|
39
36
|
};
|
package/src/Locale/selector.js
CHANGED
@@ -18,7 +18,7 @@ import { LocaleContext, languages } from './context';
|
|
18
18
|
import { styled, useTheme } from '../Theme';
|
19
19
|
|
20
20
|
function LocaleSelector(props) {
|
21
|
-
const { showText, popperProps, popperType, icon: Icon, ...rest } = props;
|
21
|
+
const { showText, popperProps, popperType, icon: Icon, size, ...rest } = props;
|
22
22
|
const { locale, changeLocale } = useContext(LocaleContext);
|
23
23
|
const anchorEl = useRef(null);
|
24
24
|
const [open, setOpen] = useState(false);
|
@@ -61,8 +61,8 @@ function LocaleSelector(props) {
|
|
61
61
|
return <Icon />;
|
62
62
|
}
|
63
63
|
|
64
|
-
return <GlobeIcon style={{ width:
|
65
|
-
}, [Icon, theme?.palette?.text?.secondary]);
|
64
|
+
return <GlobeIcon style={{ width: 'auto', height: size, color: theme.palette.text.secondary }} />;
|
65
|
+
}, [Icon, theme?.palette?.text?.secondary, size]);
|
66
66
|
|
67
67
|
return (
|
68
68
|
<Div component="div" dark={dark} theme={theme} {...rest} {...handleEventProps}>
|
@@ -130,11 +130,6 @@ const Div = styled('div')`
|
|
130
130
|
justify-content: center;
|
131
131
|
font-size: 14px;
|
132
132
|
|
133
|
-
.trigger-image {
|
134
|
-
width: ${(props) => props.size}px;
|
135
|
-
height: ${(props) => props.size}px;
|
136
|
-
}
|
137
|
-
|
138
133
|
.trigger-text {
|
139
134
|
margin-left: 5px;
|
140
135
|
font-size: 14px;
|