@atlaskit/smart-card 18.0.5 → 18.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 18.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d9b55e7cd29`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d9b55e7cd29) - Add classname for placeholder element that is shown while we load js module
8
+
9
+ ## 18.0.7
10
+
11
+ ### Patch Changes
12
+
13
+ - [`1f377bd17a4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1f377bd17a4) - Added open in new tab action to titleblock and refactored tests
14
+
15
+ ## 18.0.6
16
+
17
+ ### Patch Changes
18
+
19
+ - [`9945f8983f0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9945f8983f0) - TitleBlock now has "anchorTarget" property
20
+
3
21
  ## 18.0.5
4
22
 
5
23
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "18.0.5",
3
+ "version": "18.0.8",
4
4
  "sideEffects": false
5
5
  }
@@ -112,9 +112,18 @@ function CardWithUrlContent(_ref) {
112
112
  }, [appearance, state.details, state.status, url, definitionId, extensionKey, analytics.ui, id]);
113
113
 
114
114
  if (isFlexibleUi) {
115
- var cardState = (error === null || error === void 0 ? void 0 : error.constructor) === _.APIError ? {
116
- status: 'errored'
117
- } : state;
115
+ var cardState = state;
116
+
117
+ if (error) {
118
+ if ((error === null || error === void 0 ? void 0 : error.constructor) === _.APIError) {
119
+ cardState = {
120
+ status: 'errored'
121
+ };
122
+ } else {
123
+ throw error;
124
+ }
125
+ }
126
+
118
127
  return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
119
128
  cardState: cardState,
120
129
  onAuthorize: services.length && handleAuthorize || undefined,
@@ -23,7 +23,7 @@ var _reactErrorBoundary = require("react-error-boundary");
23
23
 
24
24
  var _ufoExperiences = require("../../state/analytics/ufoExperiences");
25
25
 
26
- var _LinkView = require("../LinkView");
26
+ var _LazyFallback = require("./component-lazy/LazyFallback");
27
27
 
28
28
  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); }
29
29
 
@@ -106,15 +106,7 @@ function CardWithURLRenderer(props) {
106
106
  throw new Error('@atlaskit/smart-card: url property is missing.');
107
107
  }
108
108
 
109
- return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
110
- FallbackComponent: ErrorFallback,
111
- onError: logError
112
- }, /*#__PURE__*/_react.default.createElement(_react.Suspense, {
113
- fallback: /*#__PURE__*/_react.default.createElement(_LinkView.CardLinkView, {
114
- key: 'chunk-placeholder',
115
- link: url
116
- })
117
- }, /*#__PURE__*/_react.default.createElement(LazyCardWithUrlContent, {
109
+ var cardWithUrlProps = {
118
110
  id: id,
119
111
  url: url,
120
112
  appearance: appearance,
@@ -131,7 +123,13 @@ function CardWithURLRenderer(props) {
131
123
  embedIframeRef: embedIframeRef,
132
124
  inlinePreloaderStyle: inlinePreloaderStyle,
133
125
  ui: ui
134
- }, children)));
126
+ };
127
+ return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
128
+ FallbackComponent: ErrorFallback,
129
+ onError: logError
130
+ }, /*#__PURE__*/_react.default.createElement(_react.Suspense, {
131
+ fallback: /*#__PURE__*/_react.default.createElement(_LazyFallback.LoadingCardLink, cardWithUrlProps)
132
+ }, /*#__PURE__*/_react.default.createElement(LazyCardWithUrlContent, cardWithUrlProps, children)));
135
133
  }
136
134
 
137
135
  var ErrorFallback = function ErrorFallback() {
@@ -33,7 +33,7 @@ var _elementGroup = _interopRequireDefault(require("../element-group"));
33
33
 
34
34
  var _utils = require("../utils");
35
35
 
36
- var _excluded = ["children", "blockTestIdPostfix", "blockIcon", "testId", "showActionOnHover", "position", "actions", "text", "maxLines", "theme", "onClick", "metadata", "subtitle"];
36
+ var _excluded = ["children", "blockTestIdPostfix", "blockIcon", "testId", "showActionOnHover", "position", "actions", "text", "maxLines", "theme", "onClick", "metadata", "subtitle", "anchorTarget"];
37
37
 
38
38
  var _templateObject;
39
39
 
@@ -61,6 +61,7 @@ var BaseTitleBlockComponent = function BaseTitleBlockComponent(_ref) {
61
61
  metadata = _ref$metadata === void 0 ? [] : _ref$metadata,
62
62
  _ref$subtitle = _ref.subtitle,
63
63
  subtitle = _ref$subtitle === void 0 ? [] : _ref$subtitle,
64
+ anchorTarget = _ref.anchorTarget,
64
65
  blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
65
66
 
66
67
  var _useState = (0, _react.useState)(false),
@@ -85,6 +86,7 @@ var BaseTitleBlockComponent = function BaseTitleBlockComponent(_ref) {
85
86
  }, (0, _core.jsx)(_elements.Title, (0, _extends2.default)({
86
87
  maxLines: maxLines,
87
88
  theme: theme,
89
+ target: anchorTarget,
88
90
  onClick: onClick
89
91
  }, overrideText)), subtitleElements && (0, _core.jsx)(_elementGroup.default, {
90
92
  direction: _constants.SmartLinkDirection.Horizontal
@@ -67,7 +67,8 @@ var Link = function Link(_ref) {
67
67
  _ref$theme = _ref.theme,
68
68
  theme = _ref$theme === void 0 ? _constants.SmartLinkTheme.Link : _ref$theme,
69
69
  url = _ref.url,
70
- onClick = _ref.onClick;
70
+ onClick = _ref.onClick,
71
+ target = _ref.target;
71
72
  return (0, _core.jsx)("span", {
72
73
  css: containerStyles
73
74
  }, (0, _core.jsx)(_tooltip.default, {
@@ -79,7 +80,8 @@ var Link = function Link(_ref) {
79
80
  "data-smart-element-link": true,
80
81
  "data-testid": testId,
81
82
  onClick: onClick,
82
- href: url
83
+ href: url,
84
+ target: target || '_blank'
83
85
  }, text)));
84
86
  };
85
87
 
@@ -29,6 +29,8 @@ var _useSmartLinkActions = require("../../state/hooks-external/useSmartLinkActio
29
29
 
30
30
  var _styled = require("./styled");
31
31
 
32
+ var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
33
+
32
34
  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); }
33
35
 
34
36
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -71,7 +73,7 @@ var HoverCard = function HoverCard(_ref) {
71
73
  appearance: 'block',
72
74
  analyticsHandler: analyticsHandler
73
75
  });
74
- var actions = (0, _react.useMemo)(function () {
76
+ var smartlinkActions = (0, _react.useMemo)(function () {
75
77
  return linkActions.map(function (action) {
76
78
  return {
77
79
  content: action.text,
@@ -83,6 +85,20 @@ var HoverCard = function HoverCard(_ref) {
83
85
  };
84
86
  });
85
87
  }, [linkActions]);
88
+ var openAction = (0, _react.useMemo)(function () {
89
+ return {
90
+ name: _constants.ActionName.CustomAction,
91
+ icon: (0, _core.jsx)(_shortcut.default, {
92
+ label: "open in new tab",
93
+ size: "medium"
94
+ }),
95
+ iconPosition: 'before',
96
+ onClick: function onClick() {
97
+ return window.open(url, '_blank');
98
+ },
99
+ testId: 'hover-card-open-button'
100
+ };
101
+ }, [url]);
86
102
 
87
103
  var cardComponent = function cardComponent() {
88
104
  return (0, _core.jsx)("div", {
@@ -96,8 +112,10 @@ var HoverCard = function HoverCard(_ref) {
96
112
  hideElevation: true,
97
113
  size: _constants.SmartLinkSize.Large
98
114
  }
99
- }, (0, _core.jsx)(_blocks.TitleBlock, null), (0, _core.jsx)(_blocks.SnippetBlock, null), (0, _core.jsx)(_blocks.FooterBlock, {
100
- actions: actions
115
+ }, (0, _core.jsx)(_blocks.TitleBlock, {
116
+ actions: [openAction]
117
+ }), (0, _core.jsx)(_blocks.SnippetBlock, null), (0, _core.jsx)(_blocks.FooterBlock, {
118
+ actions: smartlinkActions
101
119
  })));
102
120
  };
103
121
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "18.0.5",
3
+ "version": "18.0.8",
4
4
  "sideEffects": false
5
5
  }
@@ -80,9 +80,18 @@ export function CardWithUrlContent({
80
80
  }, [appearance, state.details, state.status, url, definitionId, extensionKey, analytics.ui, id]);
81
81
 
82
82
  if (isFlexibleUi) {
83
- let cardState = (error === null || error === void 0 ? void 0 : error.constructor) === APIError ? {
84
- status: 'errored'
85
- } : state;
83
+ let cardState = state;
84
+
85
+ if (error) {
86
+ if ((error === null || error === void 0 ? void 0 : error.constructor) === APIError) {
87
+ cardState = {
88
+ status: 'errored'
89
+ };
90
+ } else {
91
+ throw error;
92
+ }
93
+ }
94
+
86
95
  return /*#__PURE__*/React.createElement(FlexibleCard, {
87
96
  cardState: cardState,
88
97
  onAuthorize: services.length && handleAuthorize || undefined,
@@ -4,7 +4,7 @@ import { uiRenderFailedEvent, fireSmartLinkEvent } from '../../utils/analytics';
4
4
  import { clearMarks, clearMeasures } from '../../utils/performance';
5
5
  import { ErrorBoundary } from 'react-error-boundary';
6
6
  import { failUfoExperience, startUfoExperience } from '../../state/analytics/ufoExperiences';
7
- import { CardLinkView } from '../LinkView';
7
+ import { LoadingCardLink } from './component-lazy/LazyFallback';
8
8
  const LazyCardWithUrlContent = /*#__PURE__*/lazy(() => import(
9
9
  /* webpackChunkName: "@atlaskit-internal_smartcard-urlcardcontent" */
10
10
  './component-lazy/index'));
@@ -78,32 +78,30 @@ export function CardWithURLRenderer(props) {
78
78
  throw new Error('@atlaskit/smart-card: url property is missing.');
79
79
  }
80
80
 
81
+ const cardWithUrlProps = {
82
+ id,
83
+ url,
84
+ appearance,
85
+ onClick,
86
+ isSelected,
87
+ isFrameVisible,
88
+ dispatchAnalytics,
89
+ container,
90
+ onResolve,
91
+ testId,
92
+ showActions,
93
+ inheritDimensions,
94
+ platform,
95
+ embedIframeRef,
96
+ inlinePreloaderStyle,
97
+ ui
98
+ };
81
99
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
82
100
  FallbackComponent: ErrorFallback,
83
101
  onError: logError
84
102
  }, /*#__PURE__*/React.createElement(Suspense, {
85
- fallback: /*#__PURE__*/React.createElement(CardLinkView, {
86
- key: 'chunk-placeholder',
87
- link: url
88
- })
89
- }, /*#__PURE__*/React.createElement(LazyCardWithUrlContent, {
90
- id: id,
91
- url: url,
92
- appearance: appearance,
93
- onClick: onClick,
94
- isSelected: isSelected,
95
- isFrameVisible: isFrameVisible,
96
- dispatchAnalytics: dispatchAnalytics,
97
- container: container,
98
- onResolve: onResolve,
99
- testId: testId,
100
- showActions: showActions,
101
- inheritDimensions: inheritDimensions,
102
- platform: platform,
103
- embedIframeRef: embedIframeRef,
104
- inlinePreloaderStyle: inlinePreloaderStyle,
105
- ui: ui
106
- }, children)));
103
+ fallback: /*#__PURE__*/React.createElement(LoadingCardLink, cardWithUrlProps)
104
+ }, /*#__PURE__*/React.createElement(LazyCardWithUrlContent, cardWithUrlProps, children)));
107
105
  }
108
106
 
109
107
  const ErrorFallback = () => {
@@ -35,6 +35,7 @@ export const BaseTitleBlockComponent = ({
35
35
  onClick,
36
36
  metadata = [],
37
37
  subtitle = [],
38
+ anchorTarget,
38
39
  ...blockProps
39
40
  }) => {
40
41
  const [actionDropdownOpen, setActionDropdownOpen] = useState(false);
@@ -55,6 +56,7 @@ export const BaseTitleBlockComponent = ({
55
56
  }, jsx(Title, _extends({
56
57
  maxLines: maxLines,
57
58
  theme: theme,
59
+ target: anchorTarget,
58
60
  onClick: onClick
59
61
  }, overrideText)), subtitleElements && jsx(ElementGroup, {
60
62
  direction: SmartLinkDirection.Horizontal
@@ -71,7 +71,8 @@ const Link = ({
71
71
  text,
72
72
  theme = SmartLinkTheme.Link,
73
73
  url,
74
- onClick
74
+ onClick,
75
+ target
75
76
  }) => jsx("span", {
76
77
  css: containerStyles
77
78
  }, jsx(Tooltip, {
@@ -83,7 +84,8 @@ const Link = ({
83
84
  "data-smart-element-link": true,
84
85
  "data-testid": testId,
85
86
  onClick: onClick,
86
- href: url
87
+ href: url,
88
+ target: target || '_blank'
87
89
  }, text)));
88
90
 
89
91
  export default Link;
@@ -9,6 +9,7 @@ import Popup from '@atlaskit/popup';
9
9
  import { SmartLinkSize, ActionName } from '../../constants';
10
10
  import { useSmartLinkActions } from '../../state/hooks-external/useSmartLinkActions';
11
11
  import { HoverCardContainer } from './styled';
12
+ import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
12
13
  export const HoverCard = ({
13
14
  children,
14
15
  url
@@ -42,12 +43,24 @@ export const HoverCard = ({
42
43
  appearance: 'block',
43
44
  analyticsHandler
44
45
  });
45
- const actions = useMemo(() => linkActions.map(action => ({
46
+ const smartlinkActions = useMemo(() => linkActions.map(action => ({
46
47
  content: action.text,
47
48
  name: ActionName.CustomAction,
48
49
  onClick: () => action.invoke(),
49
50
  testId: action.id
50
51
  })), [linkActions]);
52
+ const openAction = useMemo(() => {
53
+ return {
54
+ name: ActionName.CustomAction,
55
+ icon: jsx(ShortcutIcon, {
56
+ label: "open in new tab",
57
+ size: "medium"
58
+ }),
59
+ iconPosition: 'before',
60
+ onClick: () => window.open(url, '_blank'),
61
+ testId: 'hover-card-open-button'
62
+ };
63
+ }, [url]);
51
64
 
52
65
  const cardComponent = () => jsx("div", {
53
66
  onMouseEnter: initShowCard,
@@ -60,8 +73,10 @@ export const HoverCard = ({
60
73
  hideElevation: true,
61
74
  size: SmartLinkSize.Large
62
75
  }
63
- }, jsx(TitleBlock, null), jsx(SnippetBlock, null), jsx(FooterBlock, {
64
- actions: actions
76
+ }, jsx(TitleBlock, {
77
+ actions: [openAction]
78
+ }), jsx(SnippetBlock, null), jsx(FooterBlock, {
79
+ actions: smartlinkActions
65
80
  })));
66
81
 
67
82
  const onClose = useCallback(() => setIsOpen(false), []);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "18.0.5",
3
+ "version": "18.0.8",
4
4
  "sideEffects": false
5
5
  }
@@ -86,9 +86,18 @@ export function CardWithUrlContent(_ref) {
86
86
  }, [appearance, state.details, state.status, url, definitionId, extensionKey, analytics.ui, id]);
87
87
 
88
88
  if (isFlexibleUi) {
89
- var cardState = (error === null || error === void 0 ? void 0 : error.constructor) === APIError ? {
90
- status: 'errored'
91
- } : state;
89
+ var cardState = state;
90
+
91
+ if (error) {
92
+ if ((error === null || error === void 0 ? void 0 : error.constructor) === APIError) {
93
+ cardState = {
94
+ status: 'errored'
95
+ };
96
+ } else {
97
+ throw error;
98
+ }
99
+ }
100
+
92
101
  return /*#__PURE__*/React.createElement(FlexibleCard, {
93
102
  cardState: cardState,
94
103
  onAuthorize: services.length && handleAuthorize || undefined,
@@ -5,7 +5,7 @@ import { uiRenderFailedEvent, fireSmartLinkEvent } from '../../utils/analytics';
5
5
  import { clearMarks, clearMeasures } from '../../utils/performance';
6
6
  import { ErrorBoundary } from 'react-error-boundary';
7
7
  import { failUfoExperience, startUfoExperience } from '../../state/analytics/ufoExperiences';
8
- import { CardLinkView } from '../LinkView';
8
+ import { LoadingCardLink } from './component-lazy/LazyFallback';
9
9
  var LazyCardWithUrlContent = /*#__PURE__*/lazy(function () {
10
10
  return import(
11
11
  /* webpackChunkName: "@atlaskit-internal_smartcard-urlcardcontent" */
@@ -82,15 +82,7 @@ export function CardWithURLRenderer(props) {
82
82
  throw new Error('@atlaskit/smart-card: url property is missing.');
83
83
  }
84
84
 
85
- return /*#__PURE__*/React.createElement(ErrorBoundary, {
86
- FallbackComponent: ErrorFallback,
87
- onError: logError
88
- }, /*#__PURE__*/React.createElement(Suspense, {
89
- fallback: /*#__PURE__*/React.createElement(CardLinkView, {
90
- key: 'chunk-placeholder',
91
- link: url
92
- })
93
- }, /*#__PURE__*/React.createElement(LazyCardWithUrlContent, {
85
+ var cardWithUrlProps = {
94
86
  id: id,
95
87
  url: url,
96
88
  appearance: appearance,
@@ -107,7 +99,13 @@ export function CardWithURLRenderer(props) {
107
99
  embedIframeRef: embedIframeRef,
108
100
  inlinePreloaderStyle: inlinePreloaderStyle,
109
101
  ui: ui
110
- }, children)));
102
+ };
103
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
104
+ FallbackComponent: ErrorFallback,
105
+ onError: logError
106
+ }, /*#__PURE__*/React.createElement(Suspense, {
107
+ fallback: /*#__PURE__*/React.createElement(LoadingCardLink, cardWithUrlProps)
108
+ }, /*#__PURE__*/React.createElement(LazyCardWithUrlContent, cardWithUrlProps, children)));
111
109
  }
112
110
 
113
111
  var ErrorFallback = function ErrorFallback() {
@@ -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 = ["children", "blockTestIdPostfix", "blockIcon", "testId", "showActionOnHover", "position", "actions", "text", "maxLines", "theme", "onClick", "metadata", "subtitle"];
5
+ var _excluded = ["children", "blockTestIdPostfix", "blockIcon", "testId", "showActionOnHover", "position", "actions", "text", "maxLines", "theme", "onClick", "metadata", "subtitle", "anchorTarget"];
6
6
 
7
7
  var _templateObject;
8
8
 
@@ -34,6 +34,7 @@ export var BaseTitleBlockComponent = function BaseTitleBlockComponent(_ref) {
34
34
  metadata = _ref$metadata === void 0 ? [] : _ref$metadata,
35
35
  _ref$subtitle = _ref.subtitle,
36
36
  subtitle = _ref$subtitle === void 0 ? [] : _ref$subtitle,
37
+ anchorTarget = _ref.anchorTarget,
37
38
  blockProps = _objectWithoutProperties(_ref, _excluded);
38
39
 
39
40
  var _useState = useState(false),
@@ -58,6 +59,7 @@ export var BaseTitleBlockComponent = function BaseTitleBlockComponent(_ref) {
58
59
  }, jsx(Title, _extends({
59
60
  maxLines: maxLines,
60
61
  theme: theme,
62
+ target: anchorTarget,
61
63
  onClick: onClick
62
64
  }, overrideText)), subtitleElements && jsx(ElementGroup, {
63
65
  direction: SmartLinkDirection.Horizontal
@@ -53,7 +53,8 @@ var Link = function Link(_ref) {
53
53
  _ref$theme = _ref.theme,
54
54
  theme = _ref$theme === void 0 ? SmartLinkTheme.Link : _ref$theme,
55
55
  url = _ref.url,
56
- onClick = _ref.onClick;
56
+ onClick = _ref.onClick,
57
+ target = _ref.target;
57
58
  return jsx("span", {
58
59
  css: containerStyles
59
60
  }, jsx(Tooltip, {
@@ -65,7 +66,8 @@ var Link = function Link(_ref) {
65
66
  "data-smart-element-link": true,
66
67
  "data-testid": testId,
67
68
  onClick: onClick,
68
- href: url
69
+ href: url,
70
+ target: target || '_blank'
69
71
  }, text)));
70
72
  };
71
73
 
@@ -10,6 +10,7 @@ import Popup from '@atlaskit/popup';
10
10
  import { SmartLinkSize, ActionName } from '../../constants';
11
11
  import { useSmartLinkActions } from '../../state/hooks-external/useSmartLinkActions';
12
12
  import { HoverCardContainer } from './styled';
13
+ import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
13
14
  export var HoverCard = function HoverCard(_ref) {
14
15
  var children = _ref.children,
15
16
  url = _ref.url;
@@ -47,7 +48,7 @@ export var HoverCard = function HoverCard(_ref) {
47
48
  appearance: 'block',
48
49
  analyticsHandler: analyticsHandler
49
50
  });
50
- var actions = useMemo(function () {
51
+ var smartlinkActions = useMemo(function () {
51
52
  return linkActions.map(function (action) {
52
53
  return {
53
54
  content: action.text,
@@ -59,6 +60,20 @@ export var HoverCard = function HoverCard(_ref) {
59
60
  };
60
61
  });
61
62
  }, [linkActions]);
63
+ var openAction = useMemo(function () {
64
+ return {
65
+ name: ActionName.CustomAction,
66
+ icon: jsx(ShortcutIcon, {
67
+ label: "open in new tab",
68
+ size: "medium"
69
+ }),
70
+ iconPosition: 'before',
71
+ onClick: function onClick() {
72
+ return window.open(url, '_blank');
73
+ },
74
+ testId: 'hover-card-open-button'
75
+ };
76
+ }, [url]);
62
77
 
63
78
  var cardComponent = function cardComponent() {
64
79
  return jsx("div", {
@@ -72,8 +87,10 @@ export var HoverCard = function HoverCard(_ref) {
72
87
  hideElevation: true,
73
88
  size: SmartLinkSize.Large
74
89
  }
75
- }, jsx(TitleBlock, null), jsx(SnippetBlock, null), jsx(FooterBlock, {
76
- actions: actions
90
+ }, jsx(TitleBlock, {
91
+ actions: [openAction]
92
+ }), jsx(SnippetBlock, null), jsx(FooterBlock, {
93
+ actions: smartlinkActions
77
94
  })));
78
95
  };
79
96
 
@@ -2,6 +2,7 @@
2
2
  import { BlockProps, ElementItem, ActionItem } from '../types';
3
3
  import { SmartLinkPosition, SmartLinkTheme } from '../../../../../constants';
4
4
  import { RetryOptions } from '../../../types';
5
+ import { LinkProps } from '../../elements/link/types';
5
6
  export declare type TitleBlockProps = BlockProps & {
6
7
  maxLines?: number;
7
8
  metadata?: ElementItem[];
@@ -13,4 +14,5 @@ export declare type TitleBlockProps = BlockProps & {
13
14
  text?: string;
14
15
  showActionOnHover?: boolean;
15
16
  onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
17
+ anchorTarget?: LinkProps['target'];
16
18
  };
@@ -7,4 +7,5 @@ export declare type LinkProps = ElementProps & {
7
7
  text?: string;
8
8
  theme?: SmartLinkTheme;
9
9
  url?: string;
10
+ target?: '_blank' | '_self' | '_top' | '_parent';
10
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "18.0.5",
3
+ "version": "18.0.8",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"