@atlaskit/smart-card 19.1.4 → 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.
Files changed (31) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/ssr.js +17 -3
  3. package/dist/cjs/state/actions/index.js +3 -3
  4. package/dist/cjs/version.json +1 -1
  5. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
  6. package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +15 -9
  7. package/dist/es2019/ssr.js +9 -5
  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/elements/link/index.js +12 -8
  12. package/dist/esm/ssr.js +16 -3
  13. package/dist/esm/state/actions/index.js +4 -4
  14. package/dist/esm/state/hooks/usePrefetch.js +1 -1
  15. package/dist/esm/utils/mocks.js +1 -1
  16. package/dist/esm/version.json +1 -1
  17. package/dist/esm/view/BlockCard/actions/DownloadAction.js +1 -1
  18. package/dist/esm/view/BlockCard/actions/PreviewAction.js +1 -1
  19. package/dist/esm/view/BlockCard/actions/RetryAction.js +1 -1
  20. package/dist/esm/view/BlockCard/actions/ViewAction.js +1 -1
  21. package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
  22. package/dist/esm/view/FlexibleCard/components/elements/link/index.js +15 -9
  23. package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +4 -0
  24. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -0
  25. package/dist/types/view/FlexibleCard/components/elements/link/types.d.ts +4 -0
  26. package/package.json +3 -2
  27. package/docs-helpers/flexible-ui-action-item.tsx +0 -6
  28. package/docs-helpers/flexible-ui-actions-prop.tsx +0 -6
  29. package/docs-helpers/flexible-ui-element-item.tsx +0 -6
  30. package/docs-helpers/flexible-ui-prop.tsx +0 -6
  31. 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.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
+
9
+ ## 19.1.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [`28410ec919d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/28410ec919d) - Flexible UI: Passing JsonLD response on authFlow disabled
14
+ - Updated dependencies
15
+
16
+ ## 19.1.5
17
+
18
+ ### Patch Changes
19
+
20
+ - [`db78a813922`](https://bitbucket.org/atlassian/atlassian-frontend/commits/db78a813922) - Add error handling to smart-card ssr component
21
+
3
22
  ## 19.1.4
4
23
 
5
24
  ### Patch Changes
package/dist/cjs/ssr.js CHANGED
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.CardSSR = void 0;
11
11
 
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
 
14
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
15
 
@@ -17,12 +17,20 @@ var _react = _interopRequireWildcard(require("react"));
17
17
 
18
18
  var _uuid = _interopRequireDefault(require("uuid"));
19
19
 
20
+ var _reactErrorBoundary = require("react-error-boundary");
21
+
20
22
  var _component = require("./view/CardWithUrl/component");
21
23
 
24
+ var _LazyFallback = require("./view/CardWithUrl/component-lazy/LazyFallback");
25
+
22
26
  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); }
23
27
 
24
28
  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; }
25
29
 
30
+ 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; }
31
+
32
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
+
26
34
  // SSR friendly version of smart-card
27
35
  // simplifies the logic around rendering and loading placeholders and
28
36
  // only contains whats necessary to render the card on SSR mode
@@ -36,10 +44,16 @@ var CardSSR = function CardSSR(props) {
36
44
  var dispatchAnalytics = function dispatchAnalytics() {}; // we can't dispatch events on SSR, after hydration the we will provide the real callback
37
45
 
38
46
 
39
- return /*#__PURE__*/_react.default.createElement(_component.CardWithUrlContent, (0, _extends2.default)({}, props, {
47
+ var cardProps = _objectSpread(_objectSpread({}, props), {}, {
40
48
  id: id,
41
49
  dispatchAnalytics: dispatchAnalytics
42
- }));
50
+ });
51
+
52
+ return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
53
+ FallbackComponent: function FallbackComponent() {
54
+ return /*#__PURE__*/_react.default.createElement(_LazyFallback.LoadingCardLink, cardProps);
55
+ }
56
+ }, /*#__PURE__*/_react.default.createElement(_component.CardWithUrlContent, cardProps));
43
57
  };
44
58
 
45
59
  exports.CardSSR = CardSSR;
@@ -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.4",
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,8 +1,9 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import React from 'react';
3
2
  import { useState } from 'react';
4
3
  import uuid from 'uuid';
4
+ import { ErrorBoundary } from 'react-error-boundary';
5
5
  import { CardWithUrlContent } from './view/CardWithUrl/component';
6
+ import { LoadingCardLink } from './view/CardWithUrl/component-lazy/LazyFallback';
6
7
  // SSR friendly version of smart-card
7
8
  // simplifies the logic around rendering and loading placeholders and
8
9
  // only contains whats necessary to render the card on SSR mode
@@ -12,8 +13,11 @@ export const CardSSR = props => {
12
13
  const dispatchAnalytics = () => {}; // we can't dispatch events on SSR, after hydration the we will provide the real callback
13
14
 
14
15
 
15
- return /*#__PURE__*/React.createElement(CardWithUrlContent, _extends({}, props, {
16
- id: id,
17
- dispatchAnalytics: dispatchAnalytics
18
- }));
16
+ const cardProps = { ...props,
17
+ id,
18
+ dispatchAnalytics
19
+ };
20
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
21
+ FallbackComponent: () => /*#__PURE__*/React.createElement(LoadingCardLink, cardProps)
22
+ }, /*#__PURE__*/React.createElement(CardWithUrlContent, cardProps));
19
23
  };
@@ -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.4",
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;
package/dist/esm/ssr.js CHANGED
@@ -1,9 +1,16 @@
1
- import _extends from "@babel/runtime/helpers/extends";
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+
4
+ 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; }
5
+
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
+
3
8
  import React from 'react';
4
9
  import { useState } from 'react';
5
10
  import uuid from 'uuid';
11
+ import { ErrorBoundary } from 'react-error-boundary';
6
12
  import { CardWithUrlContent } from './view/CardWithUrl/component';
13
+ import { LoadingCardLink } from './view/CardWithUrl/component-lazy/LazyFallback';
7
14
  // SSR friendly version of smart-card
8
15
  // simplifies the logic around rendering and loading placeholders and
9
16
  // only contains whats necessary to render the card on SSR mode
@@ -17,8 +24,14 @@ export var CardSSR = function CardSSR(props) {
17
24
  var dispatchAnalytics = function dispatchAnalytics() {}; // we can't dispatch events on SSR, after hydration the we will provide the real callback
18
25
 
19
26
 
20
- return /*#__PURE__*/React.createElement(CardWithUrlContent, _extends({}, props, {
27
+ var cardProps = _objectSpread(_objectSpread({}, props), {}, {
21
28
  id: id,
22
29
  dispatchAnalytics: dispatchAnalytics
23
- }));
30
+ });
31
+
32
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
33
+ FallbackComponent: function FallbackComponent() {
34
+ return /*#__PURE__*/React.createElement(LoadingCardLink, cardProps);
35
+ }
36
+ }, /*#__PURE__*/React.createElement(CardWithUrlContent, cardProps));
24
37
  };
@@ -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.4",
3
+ "version": "19.1.7",
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,
@@ -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
  /**
@@ -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.4",
3
+ "version": "19.1.7",
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
- );