@atlaskit/smart-card 19.1.1 → 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 +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/HoverCard/index.js +7 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/HoverCard/index.js +7 -2
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/HoverCard/index.js +7 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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
|
+
|
|
3
9
|
## 19.1.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -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
|
-
}),
|
|
168
|
+
}), content, (0, _core.jsx)(_blocks.FooterBlock, {
|
|
163
169
|
actions: smartlinkActions
|
|
164
170
|
})));
|
|
165
171
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -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
|
-
}),
|
|
121
|
+
}), content, jsx(FooterBlock, {
|
|
117
122
|
actions: smartlinkActions
|
|
118
123
|
})));
|
|
119
124
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -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
|
-
}),
|
|
135
|
+
}), content, jsx(FooterBlock, {
|
|
131
136
|
actions: smartlinkActions
|
|
132
137
|
})));
|
|
133
138
|
};
|