@atlaskit/smart-card 19.1.5 → 19.1.8

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/state/actions/index.js +3 -3
  3. package/dist/cjs/version.json +1 -1
  4. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
  5. package/dist/cjs/view/FlexibleCard/components/container/index.js +3 -2
  6. package/dist/cjs/view/FlexibleCard/components/container/layered-link/index.js +3 -1
  7. package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +15 -9
  8. package/dist/es2019/state/actions/index.js +3 -3
  9. package/dist/es2019/version.json +1 -1
  10. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +2 -0
  11. package/dist/es2019/view/FlexibleCard/components/container/index.js +3 -2
  12. package/dist/es2019/view/FlexibleCard/components/container/layered-link/index.js +2 -0
  13. package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +12 -8
  14. package/dist/esm/state/actions/index.js +4 -4
  15. package/dist/esm/state/hooks/usePrefetch.js +1 -1
  16. package/dist/esm/utils/mocks.js +1 -1
  17. package/dist/esm/version.json +1 -1
  18. package/dist/esm/view/BlockCard/actions/DownloadAction.js +1 -1
  19. package/dist/esm/view/BlockCard/actions/PreviewAction.js +1 -1
  20. package/dist/esm/view/BlockCard/actions/RetryAction.js +1 -1
  21. package/dist/esm/view/BlockCard/actions/ViewAction.js +1 -1
  22. package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
  23. package/dist/esm/view/FlexibleCard/components/container/index.js +3 -2
  24. package/dist/esm/view/FlexibleCard/components/container/layered-link/index.js +3 -1
  25. package/dist/esm/view/FlexibleCard/components/elements/link/index.js +15 -9
  26. package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +4 -0
  27. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -0
  28. package/dist/types/view/FlexibleCard/components/container/layered-link/types.d.ts +6 -0
  29. package/dist/types/view/FlexibleCard/components/elements/link/types.d.ts +4 -0
  30. package/package.json +3 -2
  31. package/docs-helpers/flexible-ui-action-item.tsx +0 -6
  32. package/docs-helpers/flexible-ui-actions-prop.tsx +0 -6
  33. package/docs-helpers/flexible-ui-element-item.tsx +0 -6
  34. package/docs-helpers/flexible-ui-prop.tsx +0 -6
  35. package/docs-helpers/flexible-ui.tsx +0 -28
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 19.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`81968c216ce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/81968c216ce) - Flexible UI: Fix clickableContainer not triggering analytics event
8
+
9
+ ## 19.1.7
10
+
11
+ ### Patch Changes
12
+
13
+ - [`08bdfa654e2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/08bdfa654e2) - Flexible UI: Add option to hide link tooltip on TitleBlock.
14
+
15
+ ## 19.1.6
16
+
17
+ ### Patch Changes
18
+
19
+ - [`28410ec919d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/28410ec919d) - Flexible UI: Passing JsonLD response on authFlow disabled
20
+ - Updated dependencies
21
+
3
22
  ## 19.1.5
4
23
 
5
24
  ### Patch Changes
@@ -53,7 +53,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
53
53
 
54
54
  var hasAuthFlowSupported = config.authFlow !== 'disabled';
55
55
  var hasData = !!(details && details.data);
56
- var handleResolvedLinkError = (0, _react.useCallback)(function (url, error) {
56
+ var handleResolvedLinkError = (0, _react.useCallback)(function (url, error, response) {
57
57
  if (error.kind === 'fatal') {
58
58
  // If there's no previous data in the store for this URL, then bail
59
59
  // out and let the editor handle fallbacks (returns to a blue link).
@@ -82,7 +82,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
82
82
  // Fallback to blue link with smart link formatting. Not part of reliability.
83
83
  dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_ERROR_FALLBACK, {
84
84
  url: url
85
- }, undefined, error));
85
+ }, response, error));
86
86
  } else {
87
87
  // Fallback to blue link with smart link formatting. Part of reliability.
88
88
  dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_ERROR, {
@@ -97,7 +97,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
97
97
  // throw an error and render as a normal blue link.
98
98
 
99
99
  if ((nextStatus === 'unauthorized' || nextStatus === 'forbidden') && !hasAuthFlowSupported) {
100
- handleResolvedLinkError(resourceUrl, new _linkingCommon.APIError('fallback', hostname, _constants.ERROR_MESSAGE_OAUTH));
100
+ handleResolvedLinkError(resourceUrl, new _linkingCommon.APIError('fallback', hostname, _constants.ERROR_MESSAGE_OAUTH), response);
101
101
  return;
102
102
  } // Handle any other errors
103
103
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.5",
3
+ "version": "19.1.8",
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,
@@ -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 target = _ref.target,
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 _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;
@@ -27,7 +27,7 @@ export const useSmartCardActions = (id, url, analytics) => {
27
27
  };
28
28
  const hasAuthFlowSupported = config.authFlow !== 'disabled';
29
29
  const hasData = !!(details && details.data);
30
- const handleResolvedLinkError = useCallback((url, error) => {
30
+ const handleResolvedLinkError = useCallback((url, error, response) => {
31
31
  if (error.kind === 'fatal') {
32
32
  // If there's no previous data in the store for this URL, then bail
33
33
  // out and let the editor handle fallbacks (returns to a blue link).
@@ -56,7 +56,7 @@ export const useSmartCardActions = (id, url, analytics) => {
56
56
  // Fallback to blue link with smart link formatting. Not part of reliability.
57
57
  dispatch(cardAction(ACTION_ERROR_FALLBACK, {
58
58
  url
59
- }, undefined, error));
59
+ }, response, error));
60
60
  } else {
61
61
  // Fallback to blue link with smart link formatting. Part of reliability.
62
62
  dispatch(cardAction(ACTION_ERROR, {
@@ -71,7 +71,7 @@ export const useSmartCardActions = (id, url, analytics) => {
71
71
  // throw an error and render as a normal blue link.
72
72
 
73
73
  if ((nextStatus === 'unauthorized' || nextStatus === 'forbidden') && !hasAuthFlowSupported) {
74
- handleResolvedLinkError(resourceUrl, new APIError('fallback', hostname, ERROR_MESSAGE_OAUTH));
74
+ handleResolvedLinkError(resourceUrl, new APIError('fallback', hostname, ERROR_MESSAGE_OAUTH), response);
75
75
  return;
76
76
  } // Handle any other errors
77
77
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.5",
3
+ "version": "19.1.8",
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,
@@ -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
- 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
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useMemo, useCallback } from 'react';
4
4
  import { auth } from '@atlaskit/outbound-auth-flow-client';
5
5
  import { APIError } from '@atlaskit/linking-common';
@@ -28,7 +28,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
28
28
 
29
29
  var hasAuthFlowSupported = config.authFlow !== 'disabled';
30
30
  var hasData = !!(details && details.data);
31
- var handleResolvedLinkError = useCallback(function (url, error) {
31
+ var handleResolvedLinkError = useCallback(function (url, error, response) {
32
32
  if (error.kind === 'fatal') {
33
33
  // If there's no previous data in the store for this URL, then bail
34
34
  // out and let the editor handle fallbacks (returns to a blue link).
@@ -57,7 +57,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
57
57
  // Fallback to blue link with smart link formatting. Not part of reliability.
58
58
  dispatch(cardAction(ACTION_ERROR_FALLBACK, {
59
59
  url: url
60
- }, undefined, error));
60
+ }, response, error));
61
61
  } else {
62
62
  // Fallback to blue link with smart link formatting. Part of reliability.
63
63
  dispatch(cardAction(ACTION_ERROR, {
@@ -72,7 +72,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
72
72
  // throw an error and render as a normal blue link.
73
73
 
74
74
  if ((nextStatus === 'unauthorized' || nextStatus === 'forbidden') && !hasAuthFlowSupported) {
75
- handleResolvedLinkError(resourceUrl, new APIError('fallback', hostname, ERROR_MESSAGE_OAUTH));
75
+ handleResolvedLinkError(resourceUrl, new APIError('fallback', hostname, ERROR_MESSAGE_OAUTH), response);
76
76
  return;
77
77
  } // Handle any other errors
78
78
 
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useCallback } from 'react';
4
4
  import { useSmartLinkContext } from '@atlaskit/link-provider';
5
5
  export function usePrefetch(url) {
@@ -1,10 +1,10 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
5
4
  import _inherits from "@babel/runtime/helpers/inherits";
6
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
 
9
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
10
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.5",
3
+ "version": "19.1.8",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import React from 'react';
4
4
  import { FormattedMessage } from 'react-intl-next';
5
5
  import { downloadUrl } from '@atlaskit/media-common';
@@ -1,10 +1,10 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _extends from "@babel/runtime/helpers/extends";
3
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
6
5
  var _excluded = ["popupMountPointId", "onClose"],
7
6
  _excluded2 = ["details"];
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
 
9
9
  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; }
10
10
 
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import React from 'react';
4
4
  import { FormattedMessage } from 'react-intl-next';
5
5
  import { messages } from '@atlaskit/media-ui/messages';
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import React from 'react';
4
4
  import { FormattedMessage } from 'react-intl-next';
5
5
  import { messages } from '@atlaskit/media-ui/messages';
@@ -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 target = _ref.target,
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 _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.
@@ -41,6 +41,7 @@ export declare type ElementItem = {
41
41
  name: ElementName.AuthorGroup | ElementName.CollaboratorGroup | ElementName.CommentCount | ElementName.CreatedBy | ElementName.CreatedOn | ElementName.ModifiedBy | ElementName.ModifiedOn | ElementName.Priority | ElementName.ProgrammingLanguage | ElementName.Provider | ElementName.ReactCount | ElementName.State | ElementName.SubscriberCount | ElementName.ViewCount | ElementName.VoteCount;
42
42
  /**
43
43
  * The size of the element to render.
44
+ * The elements that support sizing are AuthorGroup and CollaboratorGroup.
44
45
  */
45
46
  size?: SmartLinkSize;
46
47
  /**
@@ -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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.5",
3
+ "version": "19.1.8",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -59,7 +59,7 @@
59
59
  "uuid": "^3.1.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "@atlaskit/link-provider": "^1.0.0",
62
+ "@atlaskit/link-provider": "^1.0.1",
63
63
  "react": "^16.8.0",
64
64
  "react-dom": "^16.8.0",
65
65
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -81,6 +81,7 @@
81
81
  "@atlaskit/section-message": "^6.1.5",
82
82
  "@atlaskit/select": "^15.2.0",
83
83
  "@atlaskit/table-tree": "^9.1.0",
84
+ "@atlaskit/tabs": "^13.2.10",
84
85
  "@atlaskit/textarea": "^4.3.0",
85
86
  "@atlaskit/textfield": "^5.1.0",
86
87
  "@atlaskit/visual-regression": "*",
@@ -1,6 +0,0 @@
1
- import { BaseActionItem } from '../src/view/FlexibleCard/components/blocks/types';
2
-
3
- /**
4
- * Hack to display Flexible UI `ActionItem` for documentation purpose.
5
- */
6
- export default (props: BaseActionItem) => null;
@@ -1,6 +0,0 @@
1
- import { BaseActionItem } from '../src/view/FlexibleCard/components/blocks/types';
2
-
3
- /**
4
- * Hack to display Flexible UI `actions` prop for documentation purpose.
5
- */
6
- export default (props: { actions?: BaseActionItem[] }) => null;
@@ -1,6 +0,0 @@
1
- import { ElementItem } from '../src/view/FlexibleCard/components/blocks/types';
2
-
3
- /**
4
- * Hack to display Flexible UI `ElementItem` for documentation purpose.
5
- */
6
- export default (props: ElementItem) => null;
@@ -1,6 +0,0 @@
1
- import { FlexibleUiOptions } from '../src/view/FlexibleCard/types';
2
-
3
- /**
4
- * Hack to display Flexible UI `ui` prop in details for documentation purpose.
5
- */
6
- export default (props: FlexibleUiOptions) => null;
@@ -1,28 +0,0 @@
1
- /** @jsx jsx */
2
- import { css, jsx } from '@emotion/core';
3
- import { Prop, Props } from '@atlaskit/docs';
4
-
5
- const actionsStyles = css`
6
- > div,
7
- > div > div {
8
- margin-top: 0;
9
- }
10
- h3 {
11
- display: none;
12
- }
13
- `;
14
-
15
- const actionsProps = (
16
- <Props
17
- heading=""
18
- props={require('!!extract-react-types-loader!../docs-helpers/flexible-ui-actions-prop')}
19
- />
20
- );
21
-
22
- export const overrideActionsProps = (props: Object) => (
23
- <Prop
24
- {...props}
25
- shapeComponent={() => <div css={actionsStyles}>{actionsProps}</div>}
26
- type="arrayType"
27
- />
28
- );