@atlaskit/smart-card 19.1.0 → 19.1.3

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
+ ## 19.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3de372f6670`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3de372f6670) - Hover Previews: use black flex-ui theme
8
+
9
+ ## 19.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`3a0fdf3c651`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3a0fdf3c651) - change hover previews to show preview over snippet when its available
14
+
15
+ ## 19.1.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 19.1.0
4
22
 
5
23
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.0",
3
+ "version": "19.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -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,
@@ -151,7 +157,9 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
151
157
  url: url,
152
158
  ui: {
153
159
  hideElevation: true,
154
- size: _constants.SmartLinkSize.Large
160
+ size: _constants.SmartLinkSize.Large,
161
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
162
+ theme: _constants.SmartLinkTheme.Black
155
163
  },
156
164
  onResolve: update
157
165
  }, (0, _core.jsx)(_blocks.TitleBlock, {
@@ -159,7 +167,7 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
159
167
  }), (0, _core.jsx)(_blocks.MetadataBlock, {
160
168
  primary: metadataElements.primary,
161
169
  secondary: metadataElements.secondary
162
- }), (0, _core.jsx)(_blocks.SnippetBlock, null), (0, _core.jsx)(_blocks.FooterBlock, {
170
+ }), content, (0, _core.jsx)(_blocks.FooterBlock, {
163
171
  actions: smartlinkActions
164
172
  })));
165
173
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.0",
3
+ "version": "19.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -3,10 +3,10 @@ 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
- import { SmartLinkSize, ActionName } from '../../constants';
9
+ import { SmartLinkSize, ActionName, SmartLinkTheme } from '../../constants';
10
10
  import { useSmartLinkActions } from '../../state/hooks-external/useSmartLinkActions';
11
11
  import { HoverCardContainer } from './styled';
12
12
  import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
@@ -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,
@@ -105,7 +110,9 @@ export const HoverCardComponent = ({
105
110
  url: url,
106
111
  ui: {
107
112
  hideElevation: true,
108
- size: SmartLinkSize.Large
113
+ size: SmartLinkSize.Large,
114
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
115
+ theme: SmartLinkTheme.Black
109
116
  },
110
117
  onResolve: update
111
118
  }, jsx(TitleBlock, {
@@ -113,7 +120,7 @@ export const HoverCardComponent = ({
113
120
  }), jsx(MetadataBlock, {
114
121
  primary: metadataElements.primary,
115
122
  secondary: metadataElements.secondary
116
- }), jsx(SnippetBlock, null), jsx(FooterBlock, {
123
+ }), content, jsx(FooterBlock, {
117
124
  actions: smartlinkActions
118
125
  })));
119
126
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.0",
3
+ "version": "19.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -4,10 +4,10 @@ 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
- import { SmartLinkSize, ActionName } from '../../constants';
10
+ import { SmartLinkSize, ActionName, SmartLinkTheme } from '../../constants';
11
11
  import { useSmartLinkActions } from '../../state/hooks-external/useSmartLinkActions';
12
12
  import { HoverCardContainer } from './styled';
13
13
  import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
@@ -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,
@@ -119,7 +124,9 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
119
124
  url: url,
120
125
  ui: {
121
126
  hideElevation: true,
122
- size: SmartLinkSize.Large
127
+ size: SmartLinkSize.Large,
128
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
129
+ theme: SmartLinkTheme.Black
123
130
  },
124
131
  onResolve: update
125
132
  }, jsx(TitleBlock, {
@@ -127,7 +134,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
127
134
  }), jsx(MetadataBlock, {
128
135
  primary: metadataElements.primary,
129
136
  secondary: metadataElements.secondary
130
- }), jsx(SnippetBlock, null), jsx(FooterBlock, {
137
+ }), content, jsx(FooterBlock, {
131
138
  actions: smartlinkActions
132
139
  })));
133
140
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.0",
3
+ "version": "19.1.3",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -43,7 +43,7 @@
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",