@atlaskit/smart-card 19.0.4 → 19.1.2

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,28 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 19.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3a0fdf3c651`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3a0fdf3c651) - change hover previews to show preview over snippet when its available
8
+
9
+ ## 19.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 19.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`6b7ba46a96b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6b7ba46a96b) - [MEX-1456] Remove unused infinite scroll from Media-UI and Remove lodash from Media package
20
+
21
+ ### Patch Changes
22
+
23
+ - [`7c926026ca3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7c926026ca3) - Adds testId to FlexibleCard test.
24
+ - Updated dependencies
25
+
3
26
  ## 19.0.4
4
27
 
5
28
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.0.4",
3
+ "version": "19.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -311,11 +311,22 @@ var AtlaskitIcon = function AtlaskitIcon(_ref3) {
311
311
 
312
312
  switch (icon) {
313
313
  case _constants.IconType.Confluence:
314
+ return /*#__PURE__*/_react.default.createElement(ImportedIcon, {
315
+ testId: testId,
316
+ textColor: (0, _tokens.token)('color.text.subtle', _colors.N700)
317
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
318
+ ,
319
+ iconColor: _colors.B200,
320
+ iconGradientStart: _colors.B400,
321
+ iconGradientStop: _colors.B200
322
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
323
+
324
+ });
325
+
314
326
  case _constants.IconType.Jira:
315
327
  // Logo component has a different prop set from other icon components
316
328
  return /*#__PURE__*/_react.default.createElement(ImportedIcon, {
317
- "data-testid": testId // Confluence and Jira imports don't have native testId prop
318
- ,
329
+ testId: testId,
319
330
  textColor: (0, _tokens.token)('color.text.subtle', _colors.N700)
320
331
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
321
332
  ,
@@ -45,6 +45,8 @@ var _extractMetadata = require("../../extractors/hover/extractMetadata");
45
45
 
46
46
  var _utils = require("./utils");
47
47
 
48
+ var _extractPreview = _interopRequireDefault(require("../../extractors/flexible/extract-preview"));
49
+
48
50
  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); }
49
51
 
50
52
  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; }
@@ -139,9 +141,13 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
139
141
  }, [url, definitionId, extensionKey, analytics]);
140
142
 
141
143
  var CardComponent = function CardComponent(_ref2) {
144
+ var _linkState$details;
145
+
142
146
  var update = _ref2.update;
143
147
  //TODO: EDM-3224 deleted simulated and use real JsonLd
144
148
  var metadataElements = (0, _extractMetadata.extractMetadata)((0, _utils.getSimulatedMetadata)(extensionKey));
149
+ var linkData = (_linkState$details = linkState.details) === null || _linkState$details === void 0 ? void 0 : _linkState$details.data;
150
+ var content = (0, _extractPreview.default)(linkData) ? (0, _core.jsx)(_blocks.PreviewBlock, null) : (0, _core.jsx)(_blocks.SnippetBlock, null);
145
151
  return (0, _core.jsx)("div", {
146
152
  onMouseEnter: initShowCard,
147
153
  onMouseLeave: initHideCard,
@@ -159,7 +165,7 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
159
165
  }), (0, _core.jsx)(_blocks.MetadataBlock, {
160
166
  primary: metadataElements.primary,
161
167
  secondary: metadataElements.secondary
162
- }), (0, _core.jsx)(_blocks.SnippetBlock, null), (0, _core.jsx)(_blocks.FooterBlock, {
168
+ }), content, (0, _core.jsx)(_blocks.FooterBlock, {
163
169
  actions: smartlinkActions
164
170
  })));
165
171
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.0.4",
3
+ "version": "19.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -224,11 +224,22 @@ const AtlaskitIcon = ({
224
224
 
225
225
  switch (icon) {
226
226
  case IconType.Confluence:
227
+ return /*#__PURE__*/React.createElement(ImportedIcon, {
228
+ testId: testId,
229
+ textColor: token('color.text.subtle', N700)
230
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
231
+ ,
232
+ iconColor: B200,
233
+ iconGradientStart: B400,
234
+ iconGradientStop: B200
235
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
236
+
237
+ });
238
+
227
239
  case IconType.Jira:
228
240
  // Logo component has a different prop set from other icon components
229
241
  return /*#__PURE__*/React.createElement(ImportedIcon, {
230
- "data-testid": testId // Confluence and Jira imports don't have native testId prop
231
- ,
242
+ testId: testId,
232
243
  textColor: token('color.text.subtle', N700)
233
244
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
234
245
  ,
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  /** @jsx jsx */
4
4
  import { jsx } from '@emotion/core';
5
5
  import React, { useCallback, useRef, useMemo } from 'react';
6
- import { TitleBlock, SnippetBlock, FooterBlock, MetadataBlock } from '../FlexibleCard/components/blocks';
6
+ import { TitleBlock, SnippetBlock, FooterBlock, MetadataBlock, PreviewBlock } from '../FlexibleCard/components/blocks';
7
7
  import { Card } from '../Card';
8
8
  import Popup from '@atlaskit/popup';
9
9
  import { SmartLinkSize, ActionName } from '../../constants';
@@ -17,6 +17,7 @@ import { useSmartLinkAnalytics } from '../../state/analytics';
17
17
  import { getExtensionKey, getDefinitionId } from '../../state/helpers';
18
18
  import { extractMetadata } from '../../extractors/hover/extractMetadata';
19
19
  import { getSimulatedMetadata } from './utils';
20
+ import extractPreview from '../../extractors/flexible/extract-preview';
20
21
  export const HoverCardComponent = ({
21
22
  children,
22
23
  url,
@@ -94,8 +95,12 @@ export const HoverCardComponent = ({
94
95
  const CardComponent = ({
95
96
  update
96
97
  }) => {
98
+ var _linkState$details;
99
+
97
100
  //TODO: EDM-3224 deleted simulated and use real JsonLd
98
101
  const metadataElements = extractMetadata(getSimulatedMetadata(extensionKey));
102
+ const linkData = (_linkState$details = linkState.details) === null || _linkState$details === void 0 ? void 0 : _linkState$details.data;
103
+ const content = extractPreview(linkData) ? jsx(PreviewBlock, null) : jsx(SnippetBlock, null);
99
104
  return jsx("div", {
100
105
  onMouseEnter: initShowCard,
101
106
  onMouseLeave: initHideCard,
@@ -113,7 +118,7 @@ export const HoverCardComponent = ({
113
118
  }), jsx(MetadataBlock, {
114
119
  primary: metadataElements.primary,
115
120
  secondary: metadataElements.secondary
116
- }), jsx(SnippetBlock, null), jsx(FooterBlock, {
121
+ }), content, jsx(FooterBlock, {
117
122
  actions: smartlinkActions
118
123
  })));
119
124
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.0.4",
3
+ "version": "19.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -291,11 +291,22 @@ var AtlaskitIcon = function AtlaskitIcon(_ref3) {
291
291
 
292
292
  switch (icon) {
293
293
  case IconType.Confluence:
294
+ return /*#__PURE__*/React.createElement(ImportedIcon, {
295
+ testId: testId,
296
+ textColor: token('color.text.subtle', N700)
297
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
298
+ ,
299
+ iconColor: B200,
300
+ iconGradientStart: B400,
301
+ iconGradientStop: B200
302
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
303
+
304
+ });
305
+
294
306
  case IconType.Jira:
295
307
  // Logo component has a different prop set from other icon components
296
308
  return /*#__PURE__*/React.createElement(ImportedIcon, {
297
- "data-testid": testId // Confluence and Jira imports don't have native testId prop
298
- ,
309
+ testId: testId,
299
310
  textColor: token('color.text.subtle', N700)
300
311
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
301
312
  ,
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  /** @jsx jsx */
5
5
  import { jsx } from '@emotion/core';
6
6
  import React, { useCallback, useRef, useMemo } from 'react';
7
- import { TitleBlock, SnippetBlock, FooterBlock, MetadataBlock } from '../FlexibleCard/components/blocks';
7
+ import { TitleBlock, SnippetBlock, FooterBlock, MetadataBlock, PreviewBlock } from '../FlexibleCard/components/blocks';
8
8
  import { Card } from '../Card';
9
9
  import Popup from '@atlaskit/popup';
10
10
  import { SmartLinkSize, ActionName } from '../../constants';
@@ -18,6 +18,7 @@ import { useSmartLinkAnalytics } from '../../state/analytics';
18
18
  import { getExtensionKey, getDefinitionId } from '../../state/helpers';
19
19
  import { extractMetadata } from '../../extractors/hover/extractMetadata';
20
20
  import { getSimulatedMetadata } from './utils';
21
+ import extractPreview from '../../extractors/flexible/extract-preview';
21
22
  export var HoverCardComponent = function HoverCardComponent(_ref) {
22
23
  var children = _ref.children,
23
24
  url = _ref.url,
@@ -107,9 +108,13 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
107
108
  }, [url, definitionId, extensionKey, analytics]);
108
109
 
109
110
  var CardComponent = function CardComponent(_ref2) {
111
+ var _linkState$details;
112
+
110
113
  var update = _ref2.update;
111
114
  //TODO: EDM-3224 deleted simulated and use real JsonLd
112
115
  var metadataElements = extractMetadata(getSimulatedMetadata(extensionKey));
116
+ var linkData = (_linkState$details = linkState.details) === null || _linkState$details === void 0 ? void 0 : _linkState$details.data;
117
+ var content = extractPreview(linkData) ? jsx(PreviewBlock, null) : jsx(SnippetBlock, null);
113
118
  return jsx("div", {
114
119
  onMouseEnter: initShowCard,
115
120
  onMouseLeave: initHideCard,
@@ -127,7 +132,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
127
132
  }), jsx(MetadataBlock, {
128
133
  primary: metadataElements.primary,
129
134
  secondary: metadataElements.secondary
130
- }), jsx(SnippetBlock, null), jsx(FooterBlock, {
135
+ }), content, jsx(FooterBlock, {
131
136
  actions: smartlinkActions
132
137
  })));
133
138
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.0.4",
3
+ "version": "19.1.2",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,16 +34,16 @@
34
34
  "@atlaskit/icon-priority": "^6.3.0",
35
35
  "@atlaskit/in-product-testing": "^0.1.0",
36
36
  "@atlaskit/linking-common": "^1.1.0",
37
- "@atlaskit/logo": "^13.5.0",
37
+ "@atlaskit/logo": "^13.6.0",
38
38
  "@atlaskit/lozenge": "^11.1.0",
39
- "@atlaskit/media-common": "^2.12.0",
40
- "@atlaskit/media-ui": "^21.1.0",
39
+ "@atlaskit/media-common": "^2.13.0",
40
+ "@atlaskit/media-ui": "^22.0.0",
41
41
  "@atlaskit/modal-dialog": "^12.2.0",
42
42
  "@atlaskit/outbound-auth-flow-client": "^3.3.0",
43
43
  "@atlaskit/popup": "^1.3.0",
44
44
  "@atlaskit/spinner": "^15.1.0",
45
45
  "@atlaskit/theme": "^12.1.0",
46
- "@atlaskit/tokens": "^0.9.0",
46
+ "@atlaskit/tokens": "^0.10.0",
47
47
  "@atlaskit/tooltip": "^17.5.2",
48
48
  "@atlaskit/ufo": "^0.1.0",
49
49
  "@babel/runtime": "^7.0.0",
@@ -74,7 +74,7 @@
74
74
  "@atlaskit/inline-message": "^11.2.0",
75
75
  "@atlaskit/lozenge": "^11.1.0",
76
76
  "@atlaskit/media-integration-test-helpers": "^2.6.0",
77
- "@atlaskit/media-test-helpers": "^29.4.0",
77
+ "@atlaskit/media-test-helpers": "^30.0.0",
78
78
  "@atlaskit/page": "^12.1.0",
79
79
  "@atlaskit/radio": "^5.3.0",
80
80
  "@atlaskit/range": "^6.0.0",
@@ -90,7 +90,6 @@
90
90
  "@testing-library/react-hooks": "^1.0.4",
91
91
  "@testing-library/user-event": "10.4.0",
92
92
  "@types/enzyme": "^3.1.15",
93
- "@types/lodash": "^4.14.157",
94
93
  "@types/lorem-ipsum": "^1.0.2",
95
94
  "@types/react": "^16.8.0",
96
95
  "@types/react-loadable": "^5.4.1",