@atlaskit/smart-card 18.0.5 → 18.0.6

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
+ ## 18.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9945f8983f0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9945f8983f0) - TitleBlock now has "anchorTarget" property
8
+
3
9
  ## 18.0.5
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "18.0.5",
3
+ "version": "18.0.6",
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,
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "18.0.5",
3
+ "version": "18.0.6",
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,
@@ -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;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "18.0.5",
3
+ "version": "18.0.6",
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,
@@ -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
 
@@ -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.6",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"