@arcblock/ux 2.4.21 → 2.4.22

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.
@@ -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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.4.21",
3
+ "version": "2.4.22",
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": "5989f403515c81eaaa1c1b459b1d79daf8cca317",
50
+ "gitHead": "a8e5f9c2a89b99064c6a085b6cc1a3042095ecf4",
51
51
  "dependencies": {
52
- "@arcblock/icons": "^2.4.21",
53
- "@arcblock/react-hooks": "^2.4.21",
52
+ "@arcblock/icons": "^2.4.22",
53
+ "@arcblock/react-hooks": "^2.4.22",
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
  };