@atlaskit/smart-card 21.1.3 → 21.3.0
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 +25 -0
- package/dist/cjs/extractors/block/index.js +3 -2
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +2 -0
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +12 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/actions/PreviewAction.js +1 -1
- package/dist/cjs/view/BlockCard/index.js +10 -0
- package/dist/cjs/view/CardWithUrl/component.js +1 -1
- package/dist/cjs/view/EmbedModal/components/size-experiment/index.js +41 -0
- package/dist/cjs/view/EmbedModal/components/size-experiment/types.js +5 -0
- package/dist/cjs/view/EmbedModal/index.js +7 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +17 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +5 -2
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +20 -8
- package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -2
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +5 -2
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +21 -4
- package/dist/cjs/view/HoverCard/components/SnippetOrPreview.js +74 -0
- package/dist/cjs/view/HoverCard/styled.js +11 -3
- package/dist/es2019/extractors/block/index.js +2 -1
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +2 -1
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +11 -2
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/actions/PreviewAction.js +1 -1
- package/dist/es2019/view/BlockCard/index.js +9 -0
- package/dist/es2019/view/CardWithUrl/component.js +1 -1
- package/dist/es2019/view/EmbedModal/components/size-experiment/index.js +28 -0
- package/dist/es2019/view/EmbedModal/components/size-experiment/types.js +1 -0
- package/dist/es2019/view/EmbedModal/index.js +5 -3
- package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +17 -7
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +4 -1
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +17 -6
- package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +4 -2
- package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -3
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +5 -2
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +21 -6
- package/dist/es2019/view/HoverCard/components/SnippetOrPreview.js +42 -0
- package/dist/es2019/view/HoverCard/styled.js +8 -0
- package/dist/esm/extractors/block/index.js +3 -2
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +2 -0
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +11 -2
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/actions/PreviewAction.js +1 -1
- package/dist/esm/view/BlockCard/index.js +9 -0
- package/dist/esm/view/CardWithUrl/component.js +1 -1
- package/dist/esm/view/EmbedModal/components/size-experiment/index.js +28 -0
- package/dist/esm/view/EmbedModal/components/size-experiment/types.js +1 -0
- package/dist/esm/view/EmbedModal/index.js +6 -3
- package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +11 -3
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +5 -2
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +18 -8
- package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +4 -2
- package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -2
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +5 -2
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +21 -6
- package/dist/esm/view/HoverCard/components/SnippetOrPreview.js +53 -0
- package/dist/esm/view/HoverCard/styled.js +6 -2
- package/dist/types/extractors/block/types.d.ts +2 -0
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +2 -1
- package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +4 -2
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/EmbedModal/components/size-experiment/index.d.ts +6 -0
- package/dist/types/view/EmbedModal/components/size-experiment/types.d.ts +4 -0
- package/dist/types/view/EmbedModal/index.d.ts +1 -1
- package/dist/types/view/EmbedModal/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/preview-block/types.d.ts +7 -1
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +15 -0
- package/dist/types/view/FlexibleCard/components/common/image-icon/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/elements/media/types.d.ts +5 -0
- package/dist/types/view/HoverCard/components/SnippetOrPreview.d.ts +4 -0
- package/dist/types/view/HoverCard/styled.d.ts +2 -0
- package/dist/types/view/HoverCard/types.d.ts +5 -0
- package/package.json +5 -5
- package/report.api.md +23 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["status", "testId"];
|
|
3
|
+
var _excluded = ["status", "testId", "onError"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
6
6
|
import Block from '../block';
|
|
@@ -17,6 +17,7 @@ var PreviewBlock = function PreviewBlock(_ref) {
|
|
|
17
17
|
status = _ref$status === void 0 ? SmartLinkStatus.Fallback : _ref$status,
|
|
18
18
|
_ref$testId = _ref.testId,
|
|
19
19
|
testId = _ref$testId === void 0 ? 'smart-block-preview' : _ref$testId,
|
|
20
|
+
onError = _ref.onError,
|
|
20
21
|
blockProps = _objectWithoutProperties(_ref, _excluded);
|
|
21
22
|
|
|
22
23
|
if (status !== SmartLinkStatus.Resolved) {
|
|
@@ -25,7 +26,9 @@ var PreviewBlock = function PreviewBlock(_ref) {
|
|
|
25
26
|
|
|
26
27
|
return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
|
|
27
28
|
testId: "".concat(testId, "-resolved-view")
|
|
28
|
-
}), /*#__PURE__*/React.createElement(Preview,
|
|
29
|
+
}), /*#__PURE__*/React.createElement(Preview, {
|
|
30
|
+
onError: onError
|
|
31
|
+
}));
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
export default PreviewBlock;
|
|
@@ -5,6 +5,8 @@ var _importIconMapper;
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import Loadable from 'react-loadable';
|
|
7
7
|
import { B200, B400, N700, R400 } from '@atlaskit/theme/colors';
|
|
8
|
+
import DocumentIcon from '@atlaskit/icon-file-type/glyph/document/16';
|
|
9
|
+
import BlogIcon from '@atlaskit/icon-object/glyph/blog/16';
|
|
8
10
|
import { IconType } from '../../../../../constants';
|
|
9
11
|
import { token } from '@atlaskit/tokens'; // prettier-ignore
|
|
10
12
|
|
|
@@ -16,18 +18,10 @@ var importIconMapper = (_importIconMapper = {}, _defineProperty(_importIconMappe
|
|
|
16
18
|
return import(
|
|
17
19
|
/* webpackChunkName: "glyphAudio" */
|
|
18
20
|
'@atlaskit/icon-file-type/glyph/audio/16');
|
|
19
|
-
}), _defineProperty(_importIconMapper, IconType.Blog, function () {
|
|
20
|
-
return import(
|
|
21
|
-
/* webpackChunkName: "glyphBlog" */
|
|
22
|
-
'@atlaskit/icon-object/glyph/blog/16');
|
|
23
21
|
}), _defineProperty(_importIconMapper, IconType.Code, function () {
|
|
24
22
|
return import(
|
|
25
23
|
/* webpackChunkName: "glyphCode" */
|
|
26
24
|
'@atlaskit/icon-file-type/glyph/source-code/16');
|
|
27
|
-
}), _defineProperty(_importIconMapper, IconType.Document, function () {
|
|
28
|
-
return import(
|
|
29
|
-
/* webpackChunkName: "glyphDocument" */
|
|
30
|
-
'@atlaskit/icon-file-type/glyph/document/16');
|
|
31
25
|
}), _defineProperty(_importIconMapper, IconType.Executable, function () {
|
|
32
26
|
return import(
|
|
33
27
|
/* webpackChunkName: "glyphExecutable" */
|
|
@@ -281,6 +275,22 @@ var AtlaskitIcon = function AtlaskitIcon(_ref3) {
|
|
|
281
275
|
var icon = _ref3.icon,
|
|
282
276
|
label = _ref3.label,
|
|
283
277
|
testId = _ref3.testId;
|
|
278
|
+
|
|
279
|
+
// Check for synchonously loaded icons first for SSR purposes
|
|
280
|
+
switch (icon) {
|
|
281
|
+
case IconType.Document:
|
|
282
|
+
return /*#__PURE__*/React.createElement(DocumentIcon, {
|
|
283
|
+
label: label || 'document',
|
|
284
|
+
testId: testId
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
case IconType.Blog:
|
|
288
|
+
return /*#__PURE__*/React.createElement(BlogIcon, {
|
|
289
|
+
label: label || 'blog',
|
|
290
|
+
testId: testId
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
284
294
|
var importFn = getIconImportFn(icon);
|
|
285
295
|
|
|
286
296
|
if (!importFn) {
|
|
@@ -7,7 +7,8 @@ import LoadingSkeleton from '../loading-skeleton';
|
|
|
7
7
|
var ImageIcon = function ImageIcon(_ref) {
|
|
8
8
|
var defaultIcon = _ref.defaultIcon,
|
|
9
9
|
testId = _ref.testId,
|
|
10
|
-
url = _ref.url
|
|
10
|
+
url = _ref.url,
|
|
11
|
+
onError = _ref.onError;
|
|
11
12
|
return jsx(ImageLoader, {
|
|
12
13
|
src: url,
|
|
13
14
|
loading: jsx(LoadingSkeleton, {
|
|
@@ -17,7 +18,8 @@ var ImageIcon = function ImageIcon(_ref) {
|
|
|
17
18
|
src: url,
|
|
18
19
|
"data-testid": "".concat(testId, "-image")
|
|
19
20
|
}),
|
|
20
|
-
errored: defaultIcon
|
|
21
|
+
errored: defaultIcon,
|
|
22
|
+
onError: onError
|
|
21
23
|
});
|
|
22
24
|
};
|
|
23
25
|
|
|
@@ -11,8 +11,7 @@ var LoadingSkeleton = function LoadingSkeleton(_ref) {
|
|
|
11
11
|
var testId = _ref.testId,
|
|
12
12
|
width = _ref.width,
|
|
13
13
|
height = _ref.height;
|
|
14
|
-
var
|
|
15
|
-
var animationNameStyles = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% { background-position: -", " 0; }\n 100% { background-position: ", " 0; }\n "])), animationWidth, animationWidth);
|
|
14
|
+
var animationNameStyles = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% { background-position: 50% 0; }\n 100% { background-position: -50% 0; }\n "])));
|
|
16
15
|
var styles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: ", "rem;\n height: ", "rem;\n border-radius: 2px;\n user-select: none;\n background: ", ";\n // TODO: https://product-fabric.atlassian.net/browse/DSP-4236\n background-image: linear-gradient(\n to right,\n ", " 0%,\n ", " 20%,\n ", " 40%,\n ", "100%\n );\n background-repeat: no-repeat;\n background-size: 280% 100%;\n display: inline-block;\n\n animation-duration: 1s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: ", ";\n animation-timing-function: linear;\n "])), width, height, token('color.skeleton.subtle', '#f6f7f8'), token('color.skeleton.subtle', '#f6f7f8'), token('color.skeleton', '#edeef1'), token('color.skeleton.subtle', '#f6f7f8'), token('color.skeleton.subtle', '#f6f7f8'), animationNameStyles);
|
|
17
16
|
return jsx("span", {
|
|
18
17
|
css: styles,
|
|
@@ -31,7 +31,8 @@ var Media = function Media(_ref) {
|
|
|
31
31
|
_ref$testId = _ref.testId,
|
|
32
32
|
testId = _ref$testId === void 0 ? 'smart-element-media' : _ref$testId,
|
|
33
33
|
type = _ref.type,
|
|
34
|
-
url = _ref.url
|
|
34
|
+
url = _ref.url,
|
|
35
|
+
onError = _ref.onError;
|
|
35
36
|
|
|
36
37
|
if (!type || !url) {
|
|
37
38
|
return null;
|
|
@@ -44,7 +45,9 @@ var Media = function Media(_ref) {
|
|
|
44
45
|
"data-testid": testId
|
|
45
46
|
}, jsx(ImageIcon, {
|
|
46
47
|
testId: "".concat(testId, "-image"),
|
|
47
|
-
url: url
|
|
48
|
+
url: url,
|
|
49
|
+
onError: onError,
|
|
50
|
+
defaultIcon: null
|
|
48
51
|
}));
|
|
49
52
|
};
|
|
50
53
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
2
2
|
import { extractType } from '@atlaskit/linking-common/extractors';
|
|
3
|
-
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { ActionName, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
5
|
-
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
6
5
|
import { extractMetadata } from '../../../extractors/hover/extractMetadata';
|
|
7
6
|
import { useSmartCardActions } from '../../../state/actions';
|
|
8
7
|
import { getExtensionKey } from '../../../state/helpers';
|
|
9
8
|
import { isSpecialEvent } from '../../../utils';
|
|
10
9
|
import FlexibleCard from '../../FlexibleCard';
|
|
11
|
-
import { FooterBlock, MetadataBlock,
|
|
12
|
-
import { flexibleUiOptions, footerBlockCss, metadataBlockCss, titleBlockCss } from '../styled';
|
|
10
|
+
import { FooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
|
|
11
|
+
import { flexibleUiOptions, footerBlockCss, metadataBlockCss, titleBlockCss, hiddenSnippetStyles } from '../styled';
|
|
13
12
|
import { getSimulatedMetadata, SMART_CARD_ANALYTICS_DISPLAY } from '../utils';
|
|
14
13
|
import HoverCardLoadingView from './HoverCardLoadingView';
|
|
14
|
+
import SnippetOrPreview from './SnippetOrPreview';
|
|
15
15
|
export var getOpenAction = function getOpenAction(url, analytics, onActionClick) {
|
|
16
16
|
return {
|
|
17
17
|
name: ActionName.CustomAction,
|
|
@@ -92,7 +92,17 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
92
92
|
subtitle = _extractMetadata.subtitle;
|
|
93
93
|
|
|
94
94
|
var titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
|
|
95
|
-
var
|
|
95
|
+
var snippetHeight = React.useRef(0);
|
|
96
|
+
var snippetBlockRef = useRef(null);
|
|
97
|
+
var onSnippetRender = useCallback(function () {
|
|
98
|
+
var _snippetBlockRef$curr, _snippetBlockRef$curr2;
|
|
99
|
+
|
|
100
|
+
snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
|
|
101
|
+
}, []);
|
|
102
|
+
var body = SnippetOrPreview({
|
|
103
|
+
data: data,
|
|
104
|
+
snippetHeight: snippetHeight.current
|
|
105
|
+
});
|
|
96
106
|
var titleBlockProps = {
|
|
97
107
|
actions: titleActions,
|
|
98
108
|
maxLines: titleMaxLines,
|
|
@@ -125,7 +135,12 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
125
135
|
size: SmartLinkSize.Large,
|
|
126
136
|
overrideCss: metadataBlockCss,
|
|
127
137
|
maxLines: 1
|
|
128
|
-
}), body, /*#__PURE__*/React.createElement(
|
|
138
|
+
}), body, /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
139
|
+
testId: 'hidden-snippet',
|
|
140
|
+
onRender: onSnippetRender,
|
|
141
|
+
blockRef: snippetBlockRef,
|
|
142
|
+
overrideCss: hiddenSnippetStyles
|
|
143
|
+
}), /*#__PURE__*/React.createElement(FooterBlock, {
|
|
129
144
|
actions: footerActions,
|
|
130
145
|
size: SmartLinkSize.Large,
|
|
131
146
|
overrideCss: footerBlockCss
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
|
|
4
|
+
var _templateObject;
|
|
5
|
+
|
|
6
|
+
import React, { useCallback, useState, useRef } from 'react';
|
|
7
|
+
import { css } from '@emotion/core';
|
|
8
|
+
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
9
|
+
import { PreviewBlock, SnippetBlock } from '../../FlexibleCard/components/blocks';
|
|
10
|
+
import { getTransitionStyles } from '../styled';
|
|
11
|
+
|
|
12
|
+
var SnippetOrPreview = function SnippetOrPreview(_ref) {
|
|
13
|
+
var data = _ref.data,
|
|
14
|
+
snippetHeight = _ref.snippetHeight;
|
|
15
|
+
var transitionStarted = useRef(false);
|
|
16
|
+
var previewBlockRef = useRef(null);
|
|
17
|
+
|
|
18
|
+
var _useState = useState(false),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
showSnippet = _useState2[0],
|
|
21
|
+
setShowSnippet = _useState2[1];
|
|
22
|
+
|
|
23
|
+
var _useState3 = useState(),
|
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
+
previewCss = _useState4[0],
|
|
26
|
+
setPreviewCss = _useState4[1]; // Set Preview to a fixed height to enable transitions
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
var onPreviewRender = useCallback(function () {
|
|
30
|
+
var _previewBlockRef$curr;
|
|
31
|
+
|
|
32
|
+
previewBlockRef.current && setPreviewCss(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", "px;\n "])), (_previewBlockRef$curr = previewBlockRef.current) === null || _previewBlockRef$curr === void 0 ? void 0 : _previewBlockRef$curr.getBoundingClientRect().height));
|
|
33
|
+
}, []); // On error set Preview to Snippet height with transition
|
|
34
|
+
|
|
35
|
+
var onPreviewError = useCallback(function () {
|
|
36
|
+
if (transitionStarted.current === false) {
|
|
37
|
+
setPreviewCss(getTransitionStyles(snippetHeight));
|
|
38
|
+
transitionStarted.current = true;
|
|
39
|
+
}
|
|
40
|
+
}, [snippetHeight]);
|
|
41
|
+
var onPreviewTransitionEnd = useCallback(function () {
|
|
42
|
+
setShowSnippet(true);
|
|
43
|
+
}, []);
|
|
44
|
+
return !showSnippet && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
45
|
+
onError: onPreviewError,
|
|
46
|
+
overrideCss: previewCss,
|
|
47
|
+
onTransitionEnd: onPreviewTransitionEnd,
|
|
48
|
+
blockRef: previewBlockRef,
|
|
49
|
+
onRender: onPreviewRender
|
|
50
|
+
}) : /*#__PURE__*/React.createElement(SnippetBlock, null);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default SnippetOrPreview;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/core';
|
|
6
6
|
import { loadingPlaceholderClassName } from '../../index';
|
|
@@ -23,4 +23,8 @@ export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTe
|
|
|
23
23
|
export var metadataBlockCss = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n gap: 0px;\n\n /* primary element group */\n [data-smart-element-group]:nth-of-type(1) {\n flex-grow: 7;\n\n // a separator between text-based element\n ", "\n\n /* horizontal spacing between elements in group */\n > span {\n margin-right: ", ";\n }\n }\n /* secondary element group */\n [data-smart-element-group]:nth-of-type(2) {\n flex-grow: 3;\n /* horizontal spacing between elements in group */\n > span {\n margin-left: ", ";\n }\n }\n"])), separatorCss, elementGap, elementGap);
|
|
24
24
|
export var footerBlockCss = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-top: 0.25rem;\n"])));
|
|
25
25
|
export var loadingViewContainer = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n"])));
|
|
26
|
-
export var skeletonContainer = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 0.625rem;\n align-items: center;\n"])));
|
|
26
|
+
export var skeletonContainer = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 0.625rem;\n align-items: center;\n"])));
|
|
27
|
+
export var hiddenSnippetStyles = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n visibility: hidden;\n position: absolute;\n"])));
|
|
28
|
+
export var getTransitionStyles = function getTransitionStyles(snippetHeight) {
|
|
29
|
+
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
|
|
30
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
|
|
1
2
|
import { InvokeHandler } from '../../model/invoke-handler';
|
|
2
3
|
import { AnalyticsHandler } from '../../utils/types';
|
|
3
4
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
@@ -5,6 +6,7 @@ export interface ExtractBlockOpts {
|
|
|
5
6
|
handleInvoke: InvokeHandler;
|
|
6
7
|
handleAnalytics: AnalyticsHandler;
|
|
7
8
|
extensionKey?: string;
|
|
9
|
+
featureFlags?: Partial<LinkingPlatformFeatureFlags>;
|
|
8
10
|
source?: CardInnerAppearance;
|
|
9
11
|
testId?: string;
|
|
10
12
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
+
import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
|
|
2
3
|
import { InvokeHandler } from '../../../model/invoke-handler';
|
|
3
4
|
import { CardInnerAppearance } from '../../../view/Card/types';
|
|
4
5
|
import { AnalyticsHandler } from '../../../utils/types';
|
|
5
6
|
import { BlockCardResolvedViewProps } from '../../../view/BlockCard';
|
|
6
|
-
export declare const extractPreviewAction: (extensionKey: string | undefined, viewProps: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, handleInvoke: InvokeHandler, handleAnalytics: AnalyticsHandler, testId?: string | undefined, platform?: JsonLd.Primitives.Platforms | undefined, source?: CardInnerAppearance | undefined) => import("../../../view/BlockCard/components/Action").ActionProps | undefined;
|
|
7
|
+
export declare const extractPreviewAction: (extensionKey: string | undefined, viewProps: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, handleInvoke: InvokeHandler, handleAnalytics: AnalyticsHandler, testId?: string | undefined, platform?: JsonLd.Primitives.Platforms | undefined, source?: CardInnerAppearance | undefined, featureFlags?: Partial<LinkingPlatformFeatureFlags> | undefined) => import("../../../view/BlockCard/components/Action").ActionProps | undefined;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { ErrorInfo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
|
|
3
|
+
import { EmbedModalWithExperimentProps } from '../../EmbedModal/types';
|
|
3
4
|
import { ActionProps } from '../components/Action';
|
|
4
5
|
import { IconProps } from '../../common/Icon';
|
|
5
6
|
import { MetadataProps } from '../../common/Metadata';
|
|
6
|
-
export interface PreviewFunctionArg extends
|
|
7
|
+
export interface PreviewFunctionArg extends EmbedModalWithExperimentProps {
|
|
7
8
|
popupMountPointId: string;
|
|
8
9
|
}
|
|
9
10
|
export declare function previewFunction({ popupMountPointId, onClose, ...rest }: PreviewFunctionArg): Promise<void>;
|
|
@@ -21,6 +22,7 @@ declare type PreviewInfo = {
|
|
|
21
22
|
onDownloadActionClick?: () => void;
|
|
22
23
|
onOpen?: () => void;
|
|
23
24
|
onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
25
|
+
featureFlags?: Partial<LinkingPlatformFeatureFlags>;
|
|
24
26
|
};
|
|
25
27
|
declare const _default: ({ details, ...rest }: PreviewInfo) => ActionProps;
|
|
26
28
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CardAppearance, CardPlatform, CardProps } from './types';
|
|
3
3
|
import { WrappedComponentProps } from 'react-intl-next';
|
|
4
|
-
export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "id" | "placeholder" | "onError" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showActions" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "
|
|
4
|
+
export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "id" | "placeholder" | "onError" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showHoverPreview" | "showActions" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "inlinePreloaderStyle" | "importer" | "container" | "analyticsEvents" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
5
5
|
export type { CardAppearance, CardProps, CardPlatform };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ModalProps } from '../../../common/Modal';
|
|
3
|
+
import { EmbedModalProps } from '../../types';
|
|
4
|
+
import { WithSizeExperimentProps } from './types';
|
|
5
|
+
declare const withSizeExperiment: (Component: React.ComponentType<EmbedModalProps>) => React.FC<(EmbedModalProps | ModalProps) & WithSizeExperimentProps>;
|
|
6
|
+
export default withSizeExperiment;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EmbedModalProps } from './types';
|
|
3
|
-
declare const _default: React.FC<EmbedModalProps>;
|
|
3
|
+
declare const _default: React.FC<(import("../common/Modal").ModalProps | EmbedModalProps) & import("./components/size-experiment/types").WithSizeExperimentProps>;
|
|
4
4
|
export default _default;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ErrorInfo } from 'react';
|
|
2
2
|
import { IconProps } from '../common/Icon';
|
|
3
|
+
import { WithSizeExperimentProps } from './components/size-experiment/types';
|
|
4
|
+
import { ModalProps } from '../common/Modal';
|
|
3
5
|
export declare type EmbedModalProps = {
|
|
4
6
|
closeLabel?: string;
|
|
5
7
|
download?: string;
|
|
@@ -13,8 +15,10 @@ export declare type EmbedModalProps = {
|
|
|
13
15
|
onViewActionClick?: () => void;
|
|
14
16
|
providerName?: string;
|
|
15
17
|
showModal?: boolean;
|
|
18
|
+
size?: string;
|
|
16
19
|
src?: string;
|
|
17
20
|
testId?: string;
|
|
18
21
|
title?: string;
|
|
19
22
|
url?: string;
|
|
20
23
|
};
|
|
24
|
+
export declare type EmbedModalWithExperimentProps = EmbedModalProps & ModalProps & WithSizeExperimentProps;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ActionName, ElementName, SmartLinkDirection, SmartLinkSize, SmartLinkStatus } from '../../../../constants';
|
|
2
2
|
import { SerializedStyles } from '@emotion/core';
|
|
3
3
|
import { ActionProps } from '../actions/action/types';
|
|
4
|
+
import { Ref } from 'react';
|
|
4
5
|
export declare type BlockProps = {
|
|
5
6
|
/**
|
|
6
7
|
* The direction that the block should arrange it's elements. Can be vertical
|
|
@@ -29,6 +30,20 @@ export declare type BlockProps = {
|
|
|
29
30
|
* serving as a hook for automated tests
|
|
30
31
|
*/
|
|
31
32
|
testId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Ref to block wrapper div.
|
|
35
|
+
*/
|
|
36
|
+
blockRef?: Ref<HTMLDivElement>;
|
|
37
|
+
/**
|
|
38
|
+
* Function to be called on render of block.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
onRender?: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Function to be called on transition end of block.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
onTransitionEnd?: () => void;
|
|
32
47
|
};
|
|
33
48
|
/**
|
|
34
49
|
* Used to represent a metadata element to be rendered.
|
|
@@ -8,3 +8,5 @@ export declare const metadataBlockCss: import("@emotion/utils").SerializedStyles
|
|
|
8
8
|
export declare const footerBlockCss: import("@emotion/utils").SerializedStyles;
|
|
9
9
|
export declare const loadingViewContainer: import("@emotion/utils").SerializedStyles;
|
|
10
10
|
export declare const skeletonContainer: import("@emotion/utils").SerializedStyles;
|
|
11
|
+
export declare const hiddenSnippetStyles: import("@emotion/utils").SerializedStyles;
|
|
12
|
+
export declare const getTransitionStyles: (snippetHeight: number) => import("@emotion/utils").SerializedStyles;
|
|
@@ -8,6 +8,7 @@ import { AnalyticsHandler } from '../../utils/types';
|
|
|
8
8
|
import { ReactElement } from 'react';
|
|
9
9
|
import { TitleBlockProps } from '../FlexibleCard/components/blocks/title-block/types';
|
|
10
10
|
import { FlexibleCardProps } from '../FlexibleCard/types';
|
|
11
|
+
import { JsonLd } from 'json-ld-types';
|
|
11
12
|
export interface HoverCardProps extends WithAnalyticsEventsProps {
|
|
12
13
|
id?: string;
|
|
13
14
|
url: string;
|
|
@@ -38,3 +39,7 @@ export declare type HoverCardLoadingViewProps = {
|
|
|
38
39
|
flexibleCardProps: FlexibleCardProps;
|
|
39
40
|
titleBlockProps: TitleBlockProps;
|
|
40
41
|
};
|
|
42
|
+
export declare type SnippetOrPreviewProps = {
|
|
43
|
+
data: JsonLd.Data.BaseData;
|
|
44
|
+
snippetHeight: number;
|
|
45
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.3.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@atlaskit/icon-object": "^6.2.0",
|
|
34
34
|
"@atlaskit/icon-priority": "^6.3.0",
|
|
35
35
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
36
|
-
"@atlaskit/linking-common": "^1.
|
|
36
|
+
"@atlaskit/linking-common": "^1.6.0",
|
|
37
37
|
"@atlaskit/logo": "^13.8.0",
|
|
38
38
|
"@atlaskit/lozenge": "^11.1.0",
|
|
39
39
|
"@atlaskit/media-common": "^2.16.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"uuid": "^3.1.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@atlaskit/link-provider": "^1.2.
|
|
61
|
+
"@atlaskit/link-provider": "^1.2.4",
|
|
62
62
|
"react": "^16.8.0",
|
|
63
63
|
"react-dom": "^16.8.0",
|
|
64
64
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
"react-dom": "^16.8.0",
|
|
110
110
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
111
111
|
"react-test-renderer": "^16.8.0",
|
|
112
|
-
"ts-jest": "
|
|
113
|
-
"typescript": "4.
|
|
112
|
+
"ts-jest": "26.5.6",
|
|
113
|
+
"typescript": "4.3.5",
|
|
114
114
|
"xhr-mock": "^2.4.0"
|
|
115
115
|
},
|
|
116
116
|
"af:exports": {
|
package/report.api.md
CHANGED
|
@@ -29,6 +29,7 @@ import { SmartCardProvider as Provider } from '@atlaskit/link-provider';
|
|
|
29
29
|
import { ProviderProps } from '@atlaskit/link-provider';
|
|
30
30
|
import { default as React_2 } from 'react';
|
|
31
31
|
import { ReactChild } from 'react';
|
|
32
|
+
import { Ref } from 'react';
|
|
32
33
|
import { SerializedStyles } from '@emotion/core';
|
|
33
34
|
import { SmartCardContext } from '@atlaskit/link-provider';
|
|
34
35
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
@@ -237,6 +238,20 @@ declare type BlockProps = {
|
|
|
237
238
|
* serving as a hook for automated tests
|
|
238
239
|
*/
|
|
239
240
|
testId?: string;
|
|
241
|
+
/**
|
|
242
|
+
* Ref to block wrapper div.
|
|
243
|
+
*/
|
|
244
|
+
blockRef?: Ref<HTMLDivElement>;
|
|
245
|
+
/**
|
|
246
|
+
* Function to be called on render of block.
|
|
247
|
+
* @internal
|
|
248
|
+
*/
|
|
249
|
+
onRender?: () => void;
|
|
250
|
+
/**
|
|
251
|
+
* Function to be called on transition end of block.
|
|
252
|
+
* @internal
|
|
253
|
+
*/
|
|
254
|
+
onTransitionEnd?: () => void;
|
|
240
255
|
};
|
|
241
256
|
|
|
242
257
|
export declare const Card: React_2.ForwardRefExoticComponent<
|
|
@@ -263,12 +278,12 @@ export declare const Card: React_2.ForwardRefExoticComponent<
|
|
|
263
278
|
| 'key'
|
|
264
279
|
| 'url'
|
|
265
280
|
| 'ui'
|
|
281
|
+
| 'showHoverPreview'
|
|
266
282
|
| 'showActions'
|
|
267
283
|
| 'onResolve'
|
|
268
284
|
| 'platform'
|
|
269
285
|
| 'isFrameVisible'
|
|
270
286
|
| 'embedIframeRef'
|
|
271
|
-
| 'showHoverPreview'
|
|
272
287
|
| 'inlinePreloaderStyle'
|
|
273
288
|
| 'importer'
|
|
274
289
|
| 'container'
|
|
@@ -672,7 +687,13 @@ declare type Preview = {
|
|
|
672
687
|
*/
|
|
673
688
|
export declare const PreviewBlock: React_2.FC<PreviewBlockProps>;
|
|
674
689
|
|
|
675
|
-
declare type PreviewBlockProps =
|
|
690
|
+
declare type PreviewBlockProps = {
|
|
691
|
+
/**
|
|
692
|
+
* Function to be called on error loading media.
|
|
693
|
+
* @internal
|
|
694
|
+
*/
|
|
695
|
+
onError?: () => void;
|
|
696
|
+
} & BlockProps;
|
|
676
697
|
|
|
677
698
|
declare type PreviewDisplay = 'card' | 'embed';
|
|
678
699
|
|