@atlaskit/smart-card 19.1.6 → 19.1.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 19.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`08bdfa654e2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/08bdfa654e2) - Flexible UI: Add option to hide link tooltip on TitleBlock.
8
+
3
9
  ## 19.1.6
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.6",
3
+ "version": "19.1.7",
4
4
  "sideEffects": false
5
5
  }
@@ -33,7 +33,7 @@ var _actionGroup = _interopRequireDefault(require("../action-group"));
33
33
 
34
34
  var _elements = require("../../elements");
35
35
 
36
- var _excluded = ["actions", "anchorTarget", "maxLines", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme"];
36
+ var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme"];
37
37
 
38
38
  var _templateObject, _templateObject2;
39
39
 
@@ -83,6 +83,7 @@ var TitleBlock = function TitleBlock(_ref) {
83
83
  var _ref$actions = _ref.actions,
84
84
  actions = _ref$actions === void 0 ? [] : _ref$actions,
85
85
  anchorTarget = _ref.anchorTarget,
86
+ hideTitleTooltip = _ref.hideTitleTooltip,
86
87
  maxLines = _ref.maxLines,
87
88
  onClick = _ref.onClick,
88
89
  overrideCss = _ref.overrideCss,
@@ -115,6 +116,7 @@ var TitleBlock = function TitleBlock(_ref) {
115
116
  } : {};
116
117
 
117
118
  var title = /*#__PURE__*/_react.default.createElement(_elements.Title, (0, _extends2.default)({
119
+ hideTooltip: hideTitleTooltip,
118
120
  maxLines: maxLines,
119
121
  onClick: onClick,
120
122
  target: anchorTarget,
@@ -62,6 +62,14 @@ var getMaxLines = function getMaxLines(maxLines) {
62
62
 
63
63
  return maxLines;
64
64
  };
65
+
66
+ var withTooltip = function withTooltip(trigger, content, testId) {
67
+ return (0, _core.jsx)(_tooltip.default, {
68
+ content: content,
69
+ testId: "".concat(testId, "-tooltip"),
70
+ tag: "span"
71
+ }, trigger);
72
+ };
65
73
  /**
66
74
  * A base element that represent an anchor.
67
75
  * @internal
@@ -71,7 +79,8 @@ var getMaxLines = function getMaxLines(maxLines) {
71
79
 
72
80
 
73
81
  var Link = function Link(_ref) {
74
- var _ref$maxLines = _ref.maxLines,
82
+ var hideTooltip = _ref.hideTooltip,
83
+ _ref$maxLines = _ref.maxLines,
75
84
  maxLines = _ref$maxLines === void 0 ? DEFAULT_MAX_LINES : _ref$maxLines,
76
85
  overrideCss = _ref.overrideCss,
77
86
  _ref$size = _ref.size,
@@ -87,20 +96,17 @@ var Link = function Link(_ref) {
87
96
  var hasSpace = (0, _react.useMemo)(function () {
88
97
  return text ? (0, _utils.hasWhiteSpace)(text) : false;
89
98
  }, [text]);
90
- return (0, _core.jsx)("span", {
91
- css: containerStyles
92
- }, (0, _core.jsx)(_tooltip.default, {
93
- content: text,
94
- testId: "".concat(testId, "-tooltip"),
95
- tag: "span"
96
- }, (0, _core.jsx)("a", {
99
+ var anchor = (0, _core.jsx)("a", {
97
100
  css: [getAnchorStyles(size, theme, getMaxLines(maxLines), hasSpace), overrideCss],
98
101
  "data-smart-element-link": true,
99
102
  "data-testid": testId,
100
103
  onClick: onClick,
101
104
  href: url,
102
105
  target: target || '_blank'
103
- }, text)));
106
+ }, text);
107
+ return (0, _core.jsx)("span", {
108
+ css: containerStyles
109
+ }, hideTooltip || text === undefined ? anchor : withTooltip(anchor, text, testId));
104
110
  };
105
111
 
106
112
  var _default = Link;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.6",
3
+ "version": "19.1.7",
4
4
  "sideEffects": false
5
5
  }
@@ -58,6 +58,7 @@ const getTitleBlockViewComponent = status => {
58
58
  const TitleBlock = ({
59
59
  actions = [],
60
60
  anchorTarget,
61
+ hideTitleTooltip,
61
62
  maxLines,
62
63
  onClick,
63
64
  overrideCss,
@@ -82,6 +83,7 @@ const TitleBlock = ({
82
83
  text
83
84
  } : {};
84
85
  const title = /*#__PURE__*/React.createElement(Title, _extends({
86
+ hideTooltip: hideTitleTooltip,
85
87
  maxLines: maxLines,
86
88
  onClick: onClick,
87
89
  target: anchorTarget,
@@ -64,6 +64,12 @@ const getMaxLines = maxLines => {
64
64
 
65
65
  return maxLines;
66
66
  };
67
+
68
+ const withTooltip = (trigger, content, testId) => jsx(Tooltip, {
69
+ content: content,
70
+ testId: `${testId}-tooltip`,
71
+ tag: "span"
72
+ }, trigger);
67
73
  /**
68
74
  * A base element that represent an anchor.
69
75
  * @internal
@@ -73,6 +79,7 @@ const getMaxLines = maxLines => {
73
79
 
74
80
 
75
81
  const Link = ({
82
+ hideTooltip,
76
83
  maxLines = DEFAULT_MAX_LINES,
77
84
  overrideCss,
78
85
  size = SmartLinkSize.Medium,
@@ -84,20 +91,17 @@ const Link = ({
84
91
  target
85
92
  }) => {
86
93
  const hasSpace = useMemo(() => text ? hasWhiteSpace(text) : false, [text]);
87
- return jsx("span", {
88
- css: containerStyles
89
- }, jsx(Tooltip, {
90
- content: text,
91
- testId: `${testId}-tooltip`,
92
- tag: "span"
93
- }, jsx("a", {
94
+ const anchor = jsx("a", {
94
95
  css: [getAnchorStyles(size, theme, getMaxLines(maxLines), hasSpace), overrideCss],
95
96
  "data-smart-element-link": true,
96
97
  "data-testid": testId,
97
98
  onClick: onClick,
98
99
  href: url,
99
100
  target: target || '_blank'
100
- }, text)));
101
+ }, text);
102
+ return jsx("span", {
103
+ css: containerStyles
104
+ }, hideTooltip || text === undefined ? anchor : withTooltip(anchor, text, testId));
101
105
  };
102
106
 
103
107
  export default Link;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.6",
3
+ "version": "19.1.7",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
5
- var _excluded = ["actions", "anchorTarget", "maxLines", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme"];
5
+ var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme"];
6
6
 
7
7
  var _templateObject, _templateObject2;
8
8
 
@@ -57,6 +57,7 @@ var TitleBlock = function TitleBlock(_ref) {
57
57
  var _ref$actions = _ref.actions,
58
58
  actions = _ref$actions === void 0 ? [] : _ref$actions,
59
59
  anchorTarget = _ref.anchorTarget,
60
+ hideTitleTooltip = _ref.hideTitleTooltip,
60
61
  maxLines = _ref.maxLines,
61
62
  onClick = _ref.onClick,
62
63
  overrideCss = _ref.overrideCss,
@@ -87,6 +88,7 @@ var TitleBlock = function TitleBlock(_ref) {
87
88
  text: text
88
89
  } : {};
89
90
  var title = /*#__PURE__*/React.createElement(Title, _extends({
91
+ hideTooltip: hideTitleTooltip,
90
92
  maxLines: maxLines,
91
93
  onClick: onClick,
92
94
  target: anchorTarget,
@@ -42,6 +42,14 @@ var getMaxLines = function getMaxLines(maxLines) {
42
42
 
43
43
  return maxLines;
44
44
  };
45
+
46
+ var withTooltip = function withTooltip(trigger, content, testId) {
47
+ return jsx(Tooltip, {
48
+ content: content,
49
+ testId: "".concat(testId, "-tooltip"),
50
+ tag: "span"
51
+ }, trigger);
52
+ };
45
53
  /**
46
54
  * A base element that represent an anchor.
47
55
  * @internal
@@ -51,7 +59,8 @@ var getMaxLines = function getMaxLines(maxLines) {
51
59
 
52
60
 
53
61
  var Link = function Link(_ref) {
54
- var _ref$maxLines = _ref.maxLines,
62
+ var hideTooltip = _ref.hideTooltip,
63
+ _ref$maxLines = _ref.maxLines,
55
64
  maxLines = _ref$maxLines === void 0 ? DEFAULT_MAX_LINES : _ref$maxLines,
56
65
  overrideCss = _ref.overrideCss,
57
66
  _ref$size = _ref.size,
@@ -67,20 +76,17 @@ var Link = function Link(_ref) {
67
76
  var hasSpace = useMemo(function () {
68
77
  return text ? hasWhiteSpace(text) : false;
69
78
  }, [text]);
70
- return jsx("span", {
71
- css: containerStyles
72
- }, jsx(Tooltip, {
73
- content: text,
74
- testId: "".concat(testId, "-tooltip"),
75
- tag: "span"
76
- }, jsx("a", {
79
+ var anchor = jsx("a", {
77
80
  css: [getAnchorStyles(size, theme, getMaxLines(maxLines), hasSpace), overrideCss],
78
81
  "data-smart-element-link": true,
79
82
  "data-testid": testId,
80
83
  onClick: onClick,
81
84
  href: url,
82
85
  target: target || '_blank'
83
- }, text)));
86
+ }, text);
87
+ return jsx("span", {
88
+ css: containerStyles
89
+ }, hideTooltip || text === undefined ? anchor : withTooltip(anchor, text, testId));
84
90
  };
85
91
 
86
92
  export default Link;
@@ -16,6 +16,10 @@ export declare type TitleBlockProps = {
16
16
  * Determines the href target behaviour of the Link.
17
17
  */
18
18
  anchorTarget?: AnchorTarget;
19
+ /**
20
+ * [Experiment] Determines whether the linked title should display tooltip on hover.
21
+ */
22
+ hideTitleTooltip?: boolean;
19
23
  /**
20
24
  * Determines the maximum number of lines for the underlying link text to
21
25
  * spread over. Default is 2. Maximum is 2.
@@ -3,6 +3,10 @@ import { ElementProps } from '../types';
3
3
  import { SmartLinkTheme } from '../../../../../constants';
4
4
  import { AnchorTarget } from '../../types';
5
5
  export declare type LinkProps = ElementProps & {
6
+ /**
7
+ * Determines whether the link should display tooltip on hover.
8
+ */
9
+ hideTooltip?: boolean;
6
10
  /**
7
11
  * Determines the behaviour when the Link is clicked. By default is used to
8
12
  * propagate analytics.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.6",
3
+ "version": "19.1.7",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"