@atlaskit/smart-card 19.1.6 → 19.1.9
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 +18 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/container/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/container/layered-link/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +15 -9
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/container/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/container/layered-link/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +12 -8
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/container/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/container/layered-link/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/elements/link/index.js +15 -9
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/container/layered-link/types.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/link/types.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 19.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`003ac36263e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/003ac36263e) - Flexible UI: Fix preview block showing white space below image in Safari
|
|
8
|
+
|
|
9
|
+
## 19.1.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`81968c216ce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/81968c216ce) - Flexible UI: Fix clickableContainer not triggering analytics event
|
|
14
|
+
|
|
15
|
+
## 19.1.7
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`08bdfa654e2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/08bdfa654e2) - Flexible UI: Add option to hide link tooltip on TitleBlock.
|
|
20
|
+
|
|
3
21
|
## 19.1.6
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -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,
|
|
@@ -109,7 +109,7 @@ var getTitleBlockProps = function getTitleBlockProps(children) {
|
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
var getLayeredLink = function getLayeredLink(testId, context, children) {
|
|
112
|
+
var getLayeredLink = function getLayeredLink(testId, context, children, onClick) {
|
|
113
113
|
var _ref = context || {},
|
|
114
114
|
title = _ref.title,
|
|
115
115
|
_ref$url = _ref.url,
|
|
@@ -120,6 +120,7 @@ var getLayeredLink = function getLayeredLink(testId, context, children) {
|
|
|
120
120
|
text = _ref2.text;
|
|
121
121
|
|
|
122
122
|
return (0, _core.jsx)(_layeredLink.default, {
|
|
123
|
+
onClick: onClick,
|
|
123
124
|
target: target,
|
|
124
125
|
testId: testId,
|
|
125
126
|
text: text || title,
|
|
@@ -160,7 +161,7 @@ var Container = function Container(_ref3) {
|
|
|
160
161
|
css: getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer),
|
|
161
162
|
"data-smart-link-container": true,
|
|
162
163
|
"data-testid": testId
|
|
163
|
-
}, clickableContainer ? getLayeredLink(testId, context, children) : null, renderChildren(children, size, theme, status, retry, onClick));
|
|
164
|
+
}, clickableContainer ? getLayeredLink(testId, context, children, onClick) : null, renderChildren(children, size, theme, status, retry, onClick));
|
|
164
165
|
};
|
|
165
166
|
|
|
166
167
|
var _default = Container;
|
|
@@ -23,7 +23,8 @@ var styles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTem
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
var LayeredLink = function LayeredLink(_ref) {
|
|
26
|
-
var
|
|
26
|
+
var onClick = _ref.onClick,
|
|
27
|
+
target = _ref.target,
|
|
27
28
|
testId = _ref.testId,
|
|
28
29
|
text = _ref.text,
|
|
29
30
|
url = _ref.url;
|
|
@@ -32,6 +33,7 @@ var LayeredLink = function LayeredLink(_ref) {
|
|
|
32
33
|
css: styles,
|
|
33
34
|
"data-testid": "".concat(testId, "-layered-link"),
|
|
34
35
|
href: url,
|
|
36
|
+
onClick: onClick,
|
|
35
37
|
target: target,
|
|
36
38
|
tabIndex: -1 // Hide tab index and let the title link be the link.
|
|
37
39
|
|
|
@@ -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
|
|
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
|
-
|
|
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;
|
|
@@ -27,7 +27,7 @@ var _templateObject;
|
|
|
27
27
|
* [object-position] Center alignment of the selected replaced element's
|
|
28
28
|
* contents within the element's box.
|
|
29
29
|
*/
|
|
30
|
-
var styles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n aspect-ratio: 16 / 9;\n display: flex;\n width: 100%;\n\n // fallback\n @supports not (aspect-ratio: auto) {\n padding-top: 56.25%; // 16:9 ratio (9 / 16 = 0.5625)\n height: 0;\n position: relative;\n overflow: hidden;\n }\n\n > img {\n min-height: 100%;\n min-width: 100%;\n max-height: 100%;\n max-width: 100%;\n object-fit: cover;\n object-position: center center;\n\n // fallback\n @supports not (aspect-ratio: auto) {\n position: absolute;\n transform: translate(-50%, -50%);\n left: 50%;\n top: 50%;\n width: auto;\n height: auto;\n }\n }\n"])));
|
|
30
|
+
var styles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n aspect-ratio: 16 / 9;\n display: flex;\n width: 100%;\n height: fit-content; // Fix Safari height not respecting aspect-ratio\n\n // fallback\n @supports not (aspect-ratio: auto) {\n padding-top: 56.25%; // 16:9 ratio (9 / 16 = 0.5625)\n height: 0;\n position: relative;\n overflow: hidden;\n }\n\n > img {\n min-height: 100%;\n min-width: 100%;\n max-height: 100%;\n max-width: 100%;\n object-fit: cover;\n object-position: center center;\n\n // fallback\n @supports not (aspect-ratio: auto) {\n position: absolute;\n transform: translate(-50%, -50%);\n left: 50%;\n top: 50%;\n width: auto;\n height: auto;\n }\n }\n"])));
|
|
31
31
|
/**
|
|
32
32
|
* A base element that displays a Media.
|
|
33
33
|
* @internal
|
package/dist/es2019/version.json
CHANGED
|
@@ -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,
|
|
@@ -108,7 +108,7 @@ const getTitleBlockProps = children => {
|
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
const getLayeredLink = (testId, context, children) => {
|
|
111
|
+
const getLayeredLink = (testId, context, children, onClick) => {
|
|
112
112
|
const {
|
|
113
113
|
title,
|
|
114
114
|
url = ''
|
|
@@ -118,6 +118,7 @@ const getLayeredLink = (testId, context, children) => {
|
|
|
118
118
|
text
|
|
119
119
|
} = getTitleBlockProps(children) || {};
|
|
120
120
|
return jsx(LayeredLink, {
|
|
121
|
+
onClick: onClick,
|
|
121
122
|
target: target,
|
|
122
123
|
testId: testId,
|
|
123
124
|
text: text || title,
|
|
@@ -152,7 +153,7 @@ const Container = ({
|
|
|
152
153
|
css: getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer),
|
|
153
154
|
"data-smart-link-container": true,
|
|
154
155
|
"data-testid": testId
|
|
155
|
-
}, clickableContainer ? getLayeredLink(testId, context, children) : null, renderChildren(children, size, theme, status, retry, onClick));
|
|
156
|
+
}, clickableContainer ? getLayeredLink(testId, context, children, onClick) : null, renderChildren(children, size, theme, status, retry, onClick));
|
|
156
157
|
};
|
|
157
158
|
|
|
158
159
|
export default Container;
|
|
@@ -42,6 +42,7 @@ const styles = css`
|
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
const LayeredLink = ({
|
|
45
|
+
onClick,
|
|
45
46
|
target,
|
|
46
47
|
testId,
|
|
47
48
|
text,
|
|
@@ -51,6 +52,7 @@ const LayeredLink = ({
|
|
|
51
52
|
css: styles,
|
|
52
53
|
"data-testid": `${testId}-layered-link`,
|
|
53
54
|
href: url,
|
|
55
|
+
onClick: onClick,
|
|
54
56
|
target: target,
|
|
55
57
|
tabIndex: -1 // Hide tab index and let the title link be the link.
|
|
56
58
|
|
|
@@ -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
|
-
|
|
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;
|
package/dist/esm/version.json
CHANGED
|
@@ -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,
|
|
@@ -85,7 +85,7 @@ var getTitleBlockProps = function getTitleBlockProps(children) {
|
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
var getLayeredLink = function getLayeredLink(testId, context, children) {
|
|
88
|
+
var getLayeredLink = function getLayeredLink(testId, context, children, onClick) {
|
|
89
89
|
var _ref = context || {},
|
|
90
90
|
title = _ref.title,
|
|
91
91
|
_ref$url = _ref.url,
|
|
@@ -96,6 +96,7 @@ var getLayeredLink = function getLayeredLink(testId, context, children) {
|
|
|
96
96
|
text = _ref2.text;
|
|
97
97
|
|
|
98
98
|
return jsx(LayeredLink, {
|
|
99
|
+
onClick: onClick,
|
|
99
100
|
target: target,
|
|
100
101
|
testId: testId,
|
|
101
102
|
text: text || title,
|
|
@@ -136,7 +137,7 @@ var Container = function Container(_ref3) {
|
|
|
136
137
|
css: getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer),
|
|
137
138
|
"data-smart-link-container": true,
|
|
138
139
|
"data-testid": testId
|
|
139
|
-
}, clickableContainer ? getLayeredLink(testId, context, children) : null, renderChildren(children, size, theme, status, retry, onClick));
|
|
140
|
+
}, clickableContainer ? getLayeredLink(testId, context, children, onClick) : null, renderChildren(children, size, theme, status, retry, onClick));
|
|
140
141
|
};
|
|
141
142
|
|
|
142
143
|
export default Container;
|
|
@@ -13,7 +13,8 @@ var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
var LayeredLink = function LayeredLink(_ref) {
|
|
16
|
-
var
|
|
16
|
+
var onClick = _ref.onClick,
|
|
17
|
+
target = _ref.target,
|
|
17
18
|
testId = _ref.testId,
|
|
18
19
|
text = _ref.text,
|
|
19
20
|
url = _ref.url;
|
|
@@ -22,6 +23,7 @@ var LayeredLink = function LayeredLink(_ref) {
|
|
|
22
23
|
css: styles,
|
|
23
24
|
"data-testid": "".concat(testId, "-layered-link"),
|
|
24
25
|
href: url,
|
|
26
|
+
onClick: onClick,
|
|
25
27
|
target: target,
|
|
26
28
|
tabIndex: -1 // Hide tab index and let the title link be the link.
|
|
27
29
|
|
|
@@ -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
|
|
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
|
-
|
|
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;
|
|
@@ -17,7 +17,7 @@ import ImageIcon from '../../common/image-icon';
|
|
|
17
17
|
* [object-position] Center alignment of the selected replaced element's
|
|
18
18
|
* contents within the element's box.
|
|
19
19
|
*/
|
|
20
|
-
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n aspect-ratio: 16 / 9;\n display: flex;\n width: 100%;\n\n // fallback\n @supports not (aspect-ratio: auto) {\n padding-top: 56.25%; // 16:9 ratio (9 / 16 = 0.5625)\n height: 0;\n position: relative;\n overflow: hidden;\n }\n\n > img {\n min-height: 100%;\n min-width: 100%;\n max-height: 100%;\n max-width: 100%;\n object-fit: cover;\n object-position: center center;\n\n // fallback\n @supports not (aspect-ratio: auto) {\n position: absolute;\n transform: translate(-50%, -50%);\n left: 50%;\n top: 50%;\n width: auto;\n height: auto;\n }\n }\n"])));
|
|
20
|
+
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n aspect-ratio: 16 / 9;\n display: flex;\n width: 100%;\n height: fit-content; // Fix Safari height not respecting aspect-ratio\n\n // fallback\n @supports not (aspect-ratio: auto) {\n padding-top: 56.25%; // 16:9 ratio (9 / 16 = 0.5625)\n height: 0;\n position: relative;\n overflow: hidden;\n }\n\n > img {\n min-height: 100%;\n min-width: 100%;\n max-height: 100%;\n max-width: 100%;\n object-fit: cover;\n object-position: center center;\n\n // fallback\n @supports not (aspect-ratio: auto) {\n position: absolute;\n transform: translate(-50%, -50%);\n left: 50%;\n top: 50%;\n width: auto;\n height: auto;\n }\n }\n"])));
|
|
21
21
|
/**
|
|
22
22
|
* A base element that displays a Media.
|
|
23
23
|
* @internal
|
|
@@ -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.
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare type LayeredLinkProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Determines the onClick behaviour of the Link. By default used for analytics.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
2
8
|
target?: '_blank' | '_self' | '_top' | '_parent';
|
|
3
9
|
testId?: string;
|
|
4
10
|
text?: string;
|
|
@@ -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.
|