@atlaskit/smart-card 26.67.0 → 26.69.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 +28 -0
- package/dist/cjs/messages.js +22 -22
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +5 -2
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/index.js +5 -4
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js +7 -7
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +8 -3
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +13 -0
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +3 -7
- package/dist/cjs/view/HoverCard/components/views/resolved/redesign.js +81 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/messages.js +22 -22
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js +7 -7
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +8 -3
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +13 -0
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +4 -8
- package/dist/es2019/view/HoverCard/components/views/resolved/redesign.js +73 -0
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/messages.js +22 -22
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +5 -2
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/index.js +5 -4
- package/dist/esm/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js +7 -7
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +8 -3
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +13 -0
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +4 -8
- package/dist/esm/view/HoverCard/components/views/resolved/redesign.js +71 -0
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/__fixtures__/flexible-ui-data-context.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +7 -2
- package/dist/types/view/HoverCard/components/views/resolved/redesign.d.ts +4 -0
- package/dist/types-ts4.5/__fixtures__/flexible-ui-data-context.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +7 -2
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/redesign.d.ts +4 -0
- package/package.json +3 -3
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { CardDisplay, SmartLinkPosition, SmartLinkSize, SmartLinkStatus } from '../../../../../constants';
|
|
4
|
+
import { getCanBeDatasource } from '../../../../../state/helpers';
|
|
5
|
+
import FlexibleCard from '../../../../FlexibleCard';
|
|
6
|
+
import { ActionBlock, AIFooterBlock, AISummaryBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
7
|
+
import { getMetadata } from '../../../utils';
|
|
8
|
+
import ImagePreview from '../../ImagePreview';
|
|
9
|
+
import { hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
10
|
+
var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
11
|
+
var _cardState$details;
|
|
12
|
+
var analytics = _ref.analytics,
|
|
13
|
+
cardState = _ref.cardState,
|
|
14
|
+
extensionKey = _ref.extensionKey,
|
|
15
|
+
flexibleCardProps = _ref.flexibleCardProps,
|
|
16
|
+
isAISummaryEnabled = _ref.isAISummaryEnabled,
|
|
17
|
+
onActionClick = _ref.onActionClick,
|
|
18
|
+
titleBlockProps = _ref.titleBlockProps;
|
|
19
|
+
var canBeDatasource = getCanBeDatasource(cardState.details);
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
// Since this hover view is only rendered on resolved status,
|
|
22
|
+
// there is no need to check for statuses.
|
|
23
|
+
analytics.ui.renderSuccessEvent({
|
|
24
|
+
display: CardDisplay.HoverCardPreview,
|
|
25
|
+
status: cardState.status,
|
|
26
|
+
canBeDatasource: canBeDatasource
|
|
27
|
+
});
|
|
28
|
+
}, [analytics.ui, cardState.status, canBeDatasource]);
|
|
29
|
+
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
30
|
+
var _useMemo = useMemo(function () {
|
|
31
|
+
return getMetadata(extensionKey, data);
|
|
32
|
+
}, [data, extensionKey]),
|
|
33
|
+
primary = _useMemo.primary,
|
|
34
|
+
secondary = _useMemo.secondary;
|
|
35
|
+
var snippetHeight = React.useRef(0);
|
|
36
|
+
var snippetBlockRef = useRef(null);
|
|
37
|
+
var onSnippetRender = useCallback(function () {
|
|
38
|
+
var _snippetBlockRef$curr, _snippetBlockRef$curr2;
|
|
39
|
+
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;
|
|
40
|
+
}, []);
|
|
41
|
+
var imagePreview = ImagePreview({
|
|
42
|
+
data: data,
|
|
43
|
+
fallbackElementHeight: snippetHeight.current
|
|
44
|
+
});
|
|
45
|
+
var snippet = imagePreview ? null : /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
46
|
+
status: SmartLinkStatus.Resolved
|
|
47
|
+
});
|
|
48
|
+
var aiSummaryMinHeight = snippet ? snippetHeight.current : 0;
|
|
49
|
+
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
50
|
+
metadataPosition: SmartLinkPosition.Top
|
|
51
|
+
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
52
|
+
primary: primary,
|
|
53
|
+
secondary: secondary,
|
|
54
|
+
overrideCss: metadataBlockCss,
|
|
55
|
+
maxLines: 1,
|
|
56
|
+
size: SmartLinkSize.Medium
|
|
57
|
+
}), isAISummaryEnabled ? /*#__PURE__*/React.createElement(AISummaryBlock, {
|
|
58
|
+
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
59
|
+
placeholder: snippet,
|
|
60
|
+
status: SmartLinkStatus.Resolved
|
|
61
|
+
}) : snippet, /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
62
|
+
testId: "hidden-snippet",
|
|
63
|
+
onRender: onSnippetRender,
|
|
64
|
+
blockRef: snippetBlockRef,
|
|
65
|
+
overrideCss: hiddenSnippetStyles
|
|
66
|
+
}), /*#__PURE__*/React.createElement(ActionBlock, {
|
|
67
|
+
onClick: onActionClick,
|
|
68
|
+
spaceInline: "space.100"
|
|
69
|
+
}), /*#__PURE__*/React.createElement(AIFooterBlock, null));
|
|
70
|
+
};
|
|
71
|
+
export default HoverCardResolvedView;
|
|
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
10
10
|
import LinkWarningModal from './LinkWarningModal';
|
|
11
11
|
var PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "26.
|
|
13
|
+
packageVersion: "26.69.0",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ActionItem, type BlockProps, type ElementItem } from '../types';
|
|
3
|
+
import { type OnActionMenuOpenChangeOptions } from '../types';
|
|
3
4
|
export type AISummaryBlockProps = {
|
|
4
5
|
/**
|
|
5
6
|
* An array of actions to be displayed on the right
|
|
@@ -20,4 +21,8 @@ export type AISummaryBlockProps = {
|
|
|
20
21
|
* Minimum height requirement for the AISummary component to prevent fluctuations in a card size on the summary action.
|
|
21
22
|
*/
|
|
22
23
|
aiSummaryMinHeight?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Placeholder to show when summary is not available
|
|
26
|
+
*/
|
|
27
|
+
placeholder?: ReactNode;
|
|
23
28
|
} & BlockProps;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ActionItem, type BlockProps, type ElementItem } from '../types';
|
|
3
|
+
import { type OnActionMenuOpenChangeOptions } from '../types';
|
|
3
4
|
export type AISummaryBlockProps = {
|
|
4
5
|
/**
|
|
5
6
|
* An array of actions to be displayed on the right
|
|
@@ -20,4 +21,8 @@ export type AISummaryBlockProps = {
|
|
|
20
21
|
* Minimum height requirement for the AISummary component to prevent fluctuations in a card size on the summary action.
|
|
21
22
|
*/
|
|
22
23
|
aiSummaryMinHeight?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Placeholder to show when summary is not available
|
|
26
|
+
*/
|
|
27
|
+
placeholder?: ReactNode;
|
|
23
28
|
} & BlockProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.69.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"@atlaskit/link-extractors": "^1.5.0",
|
|
47
47
|
"@atlaskit/linking-common": "^5.6.0",
|
|
48
48
|
"@atlaskit/linking-types": "^8.8.0",
|
|
49
|
-
"@atlaskit/logo": "^13.
|
|
49
|
+
"@atlaskit/logo": "^13.17.0",
|
|
50
50
|
"@atlaskit/lozenge": "^11.7.0",
|
|
51
51
|
"@atlaskit/modal-dialog": "^12.13.0",
|
|
52
52
|
"@atlaskit/outbound-auth-flow-client": "^3.4.0",
|
|
53
53
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
54
54
|
"@atlaskit/popup": "^1.17.0",
|
|
55
|
-
"@atlaskit/primitives": "^6.
|
|
55
|
+
"@atlaskit/primitives": "^6.2.0",
|
|
56
56
|
"@atlaskit/spinner": "^16.1.0",
|
|
57
57
|
"@atlaskit/theme": "^12.8.0",
|
|
58
58
|
"@atlaskit/tokens": "^1.48.0",
|