@atlaskit/smart-card 23.14.2 → 23.14.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/dist/cjs/extractors/block/index.js +4 -3
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +5 -2
- package/dist/cjs/extractors/common/meta/extractIsSupportTheming.js +11 -0
- package/dist/cjs/extractors/constants.js +6 -2
- package/dist/cjs/extractors/embed/index.js +3 -1
- package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +4 -1
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +2 -1
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +10 -2
- package/dist/cjs/view/EmbedModal/index.js +10 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +4 -2
- package/dist/es2019/extractors/block/index.js +4 -3
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +5 -2
- package/dist/es2019/extractors/common/meta/extractIsSupportTheming.js +4 -0
- package/dist/es2019/extractors/constants.js +4 -1
- package/dist/es2019/extractors/embed/index.js +3 -1
- package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +4 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +2 -1
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +11 -2
- package/dist/es2019/view/EmbedModal/index.js +11 -2
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +4 -2
- package/dist/esm/extractors/block/index.js +4 -3
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +5 -2
- package/dist/esm/extractors/common/meta/extractIsSupportTheming.js +4 -0
- package/dist/esm/extractors/constants.js +4 -1
- package/dist/esm/extractors/embed/index.js +3 -1
- package/dist/esm/extractors/flexible/actions/extract-preview-action.js +4 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/views/ResolvedView.js +2 -1
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +10 -2
- package/dist/esm/view/EmbedModal/index.js +10 -2
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +4 -2
- package/dist/types/extractors/block/index.d.ts +1 -1
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +2 -1
- package/dist/types/extractors/common/meta/extractIsSupportTheming.d.ts +2 -0
- package/dist/types/extractors/constants.d.ts +1 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +1 -0
- package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +1 -0
- package/dist/types/view/BlockCard/views/ResolvedView.d.ts +3 -1
- package/dist/types/view/EmbedCard/views/ResolvedView.d.ts +1 -0
- package/dist/types/view/EmbedModal/index.d.ts +1 -0
- package/dist/types/view/EmbedModal/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/actions/action/preview-action/types.d.ts +1 -0
- package/package.json +1 -1
- package/tmp/api-report-tmp.d.ts +0 -870
|
@@ -5,6 +5,7 @@ import LinkGlyph from '@atlaskit/icon/glyph/link';
|
|
|
5
5
|
import { ExpandedFrame } from '../components/ExpandedFrame';
|
|
6
6
|
import { ImageIcon } from '../components/ImageIcon';
|
|
7
7
|
import { Frame } from '../components/Frame';
|
|
8
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
8
9
|
export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref, embedIframeRef) {
|
|
9
10
|
var link = _ref.link,
|
|
10
11
|
context = _ref.context,
|
|
@@ -18,7 +19,8 @@ export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref,
|
|
|
18
19
|
testId = _ref$testId === void 0 ? 'embed-card-resolved-view' : _ref$testId,
|
|
19
20
|
inheritDimensions = _ref.inheritDimensions,
|
|
20
21
|
onIframeDwell = _ref.onIframeDwell,
|
|
21
|
-
onIframeFocus = _ref.onIframeFocus
|
|
22
|
+
onIframeFocus = _ref.onIframeFocus,
|
|
23
|
+
isSupportTheming = _ref.isSupportTheming;
|
|
22
24
|
var iconFromContext = context === null || context === void 0 ? void 0 : context.icon;
|
|
23
25
|
var src = typeof iconFromContext === 'string' ? iconFromContext : undefined;
|
|
24
26
|
var text = title || (context === null || context === void 0 ? void 0 : context.text);
|
|
@@ -38,6 +40,12 @@ export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref,
|
|
|
38
40
|
default: linkGlyph
|
|
39
41
|
});
|
|
40
42
|
}, [src, linkGlyph, iconFromContext]);
|
|
43
|
+
var _useThemeObserver = useThemeObserver(),
|
|
44
|
+
colorMode = _useThemeObserver.colorMode;
|
|
45
|
+
var previewUrl = preview === null || preview === void 0 ? void 0 : preview.src;
|
|
46
|
+
if (previewUrl && isSupportTheming && colorMode) {
|
|
47
|
+
previewUrl = "".concat(previewUrl).concat(previewUrl.includes('?') ? '&' : '?', "themeMode=").concat(colorMode);
|
|
48
|
+
}
|
|
41
49
|
return jsx(ExpandedFrame, {
|
|
42
50
|
isSelected: isSelected,
|
|
43
51
|
isFrameVisible: isFrameVisible,
|
|
@@ -48,7 +56,7 @@ export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref,
|
|
|
48
56
|
onClick: onClick,
|
|
49
57
|
inheritDimensions: inheritDimensions
|
|
50
58
|
}, jsx(Frame, {
|
|
51
|
-
url:
|
|
59
|
+
url: previewUrl,
|
|
52
60
|
isTrusted: isTrusted,
|
|
53
61
|
testId: testId,
|
|
54
62
|
ref: embedIframeRef,
|
|
@@ -7,6 +7,7 @@ import EmbedContent from './components/embed-content';
|
|
|
7
7
|
import { EmbedModalSize } from './types';
|
|
8
8
|
import withErrorBoundary from './components/error-boundary';
|
|
9
9
|
import withAnalytics from './components/analytics';
|
|
10
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
10
11
|
var toSize = function toSize(width) {
|
|
11
12
|
return width === MAX_MODAL_SIZE ? EmbedModalSize.Large : EmbedModalSize.Small;
|
|
12
13
|
};
|
|
@@ -32,7 +33,8 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
32
33
|
_ref$testId = _ref.testId,
|
|
33
34
|
testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
|
|
34
35
|
title = _ref.title,
|
|
35
|
-
url = _ref.url
|
|
36
|
+
url = _ref.url,
|
|
37
|
+
isSupportTheming = _ref.isSupportTheming;
|
|
36
38
|
var defaultWidth = toWidth(size);
|
|
37
39
|
var _useState = useState(showModal),
|
|
38
40
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -72,6 +74,12 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
76
|
}, [onResize, width]);
|
|
77
|
+
var _useThemeObserver = useThemeObserver(),
|
|
78
|
+
colorMode = _useThemeObserver.colorMode;
|
|
79
|
+
var previewUrl = src;
|
|
80
|
+
if (previewUrl && isSupportTheming && colorMode) {
|
|
81
|
+
previewUrl = "".concat(previewUrl).concat(previewUrl.includes('?') ? '&' : '?', "themeMode=").concat(colorMode);
|
|
82
|
+
}
|
|
75
83
|
return /*#__PURE__*/React.createElement(ModalTransition, null, isOpen && /*#__PURE__*/React.createElement(ModalDialog, {
|
|
76
84
|
height: "100%",
|
|
77
85
|
onClose: handleOnClose,
|
|
@@ -93,7 +101,7 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
93
101
|
}), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(EmbedContent, {
|
|
94
102
|
isTrusted: isTrusted,
|
|
95
103
|
name: iframeName,
|
|
96
|
-
src:
|
|
104
|
+
src: previewUrl,
|
|
97
105
|
testId: testId
|
|
98
106
|
}))));
|
|
99
107
|
};
|
|
@@ -23,7 +23,8 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
23
23
|
url = props.url,
|
|
24
24
|
title = props.title,
|
|
25
25
|
providerName = props.providerName,
|
|
26
|
-
downloadUrl = props.downloadUrl
|
|
26
|
+
downloadUrl = props.downloadUrl,
|
|
27
|
+
isSupportTheming = props.isSupportTheming;
|
|
27
28
|
var defaultAnalytics = useSmartLinkAnalytics(url, function () {});
|
|
28
29
|
var analytics = useFlexibleUiAnalyticsContext() || defaultAnalytics;
|
|
29
30
|
var EmbedIcon = {
|
|
@@ -44,7 +45,8 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
44
45
|
title: title,
|
|
45
46
|
url: url,
|
|
46
47
|
analytics: analytics,
|
|
47
|
-
origin: 'smartLinkCard'
|
|
48
|
+
origin: 'smartLinkCard',
|
|
49
|
+
isSupportTheming: isSupportTheming
|
|
48
50
|
});
|
|
49
51
|
};
|
|
50
52
|
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -4,6 +4,6 @@ import { LinkPerson } from '@atlaskit/linking-common/extractors';
|
|
|
4
4
|
import { ExtractBlockOpts } from './types';
|
|
5
5
|
import { BlockCardResolvedViewProps } from '../../view/BlockCard';
|
|
6
6
|
import { ActionProps } from '../../view/BlockCard/components/Action';
|
|
7
|
-
export declare const extractBlockActions: (props: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, opts?: ExtractBlockOpts | undefined, platform?: JsonLd.Primitives.Platforms | undefined) => ActionProps[];
|
|
7
|
+
export declare const extractBlockActions: (props: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, opts?: ExtractBlockOpts | undefined, platform?: JsonLd.Primitives.Platforms | undefined, meta?: JsonLd.Meta.BaseMeta | undefined) => ActionProps[];
|
|
8
8
|
export declare const extractBlockUsers: (jsonLd: JsonLd.Data.BaseData) => LinkPerson[] | undefined;
|
|
9
9
|
export declare const extractBlockProps: (jsonLd: JsonLd.Data.BaseData, meta?: JsonLd.Meta.BaseMeta | undefined, opts?: ExtractBlockOpts | undefined, renderers?: CardProviderRenderers | undefined, platform?: JsonLd.Primitives.Platforms | undefined) => BlockCardResolvedViewProps;
|
|
@@ -2,8 +2,9 @@ import { JsonLd } from 'json-ld-types';
|
|
|
2
2
|
import { CardPlatform } from '../../../view/Card/types';
|
|
3
3
|
import { BlockCardResolvedViewProps } from '../../../view/BlockCard';
|
|
4
4
|
import { ExtractBlockOpts } from '../../block/types';
|
|
5
|
-
export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, analytics, }: ExtractBlockOpts & {
|
|
5
|
+
export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, analytics, meta, }: ExtractBlockOpts & {
|
|
6
6
|
viewProps: BlockCardResolvedViewProps;
|
|
7
7
|
jsonLd: JsonLd.Data.BaseData;
|
|
8
8
|
platform?: JsonLd.Primitives.Platforms | undefined;
|
|
9
|
+
meta?: JsonLd.Meta.BaseMeta | undefined;
|
|
9
10
|
}) => import("../../../view/BlockCard/components/Action").ActionProps | undefined;
|
|
@@ -10,3 +10,4 @@ export declare const JIRA_SERVICE_REQUEST = "JiraServiceRequest";
|
|
|
10
10
|
export declare const JIRA_CHANGE = "JiraChange";
|
|
11
11
|
export declare const JIRA_PROBLEM = "JiraProblem";
|
|
12
12
|
export declare const JIRA_CUSTOM_TASK_TYPE = "JiraCustomTaskType";
|
|
13
|
+
export declare const PROVIDER_KEYS_WITH_THEMING: string[];
|
|
@@ -25,6 +25,7 @@ declare type PreviewInfo = {
|
|
|
25
25
|
onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
26
26
|
analytics: AnalyticsFacade;
|
|
27
27
|
origin?: AnalyticsOrigin;
|
|
28
|
+
isSupportTheming?: boolean;
|
|
28
29
|
};
|
|
29
30
|
declare const _default: ({ details, ...rest }: PreviewInfo) => ActionProps;
|
|
30
31
|
export default _default;
|
|
@@ -28,7 +28,9 @@ export interface ResolvedViewProps {
|
|
|
28
28
|
showActions?: boolean;
|
|
29
29
|
titlePrefix?: React.ReactNode;
|
|
30
30
|
isTrusted?: boolean;
|
|
31
|
+
/** It determines whether a link source supports different design theme modes */
|
|
32
|
+
isSupportTheming?: boolean;
|
|
31
33
|
}
|
|
32
34
|
export declare const blockCardResolvedViewClassName = "block-card-resolved-view";
|
|
33
35
|
export declare const blockCardResolvedViewByClassName = "block-card-resolved-view-by";
|
|
34
|
-
export declare const ResolvedView: ({ icon, actions, thumbnail, context, title, titleTextColor, titlePrefix, isSelected, users, handleAvatarClick, handleMoreAvatarsClick, onClick, link, byline, lozenge, details, testId, showActions, }: ResolvedViewProps) => jsx.JSX.Element;
|
|
36
|
+
export declare const ResolvedView: ({ icon, actions, thumbnail, context, title, titleTextColor, titlePrefix, isSelected, users, handleAvatarClick, handleMoreAvatarsClick, onClick, link, byline, lozenge, details, testId, showActions, isSupportTheming, }: ResolvedViewProps) => jsx.JSX.Element;
|
|
@@ -22,6 +22,7 @@ export interface EmbedCardResolvedViewProps {
|
|
|
22
22
|
onClick?: (evt: React.MouseEvent) => void;
|
|
23
23
|
/** For testing purposes only. */
|
|
24
24
|
testId?: string;
|
|
25
|
+
isSupportTheming?: boolean;
|
|
25
26
|
inheritDimensions?: boolean;
|
|
26
27
|
/** Optional callback for when user dwells cursor over iframe - for analytics **/
|
|
27
28
|
onIframeDwell?: (dwellTime: number, dwellPercentVisible: number) => void;
|
|
@@ -5,6 +5,7 @@ declare const _default: React.FC<{
|
|
|
5
5
|
icon?: import("../common/Icon").IconProps | undefined;
|
|
6
6
|
iframeName: string;
|
|
7
7
|
isTrusted?: boolean | undefined;
|
|
8
|
+
isSupportTheming?: boolean | undefined;
|
|
8
9
|
onClose: (context: import("./types").EmbedModalContext) => void;
|
|
9
10
|
onDownloadActionClick?: (() => void) | undefined;
|
|
10
11
|
onOpen?: ((context: import("./types").EmbedModalContext) => void) | undefined;
|
|
@@ -14,6 +14,7 @@ export declare type EmbedModalProps = {
|
|
|
14
14
|
icon?: IconProps;
|
|
15
15
|
iframeName: string;
|
|
16
16
|
isTrusted?: boolean;
|
|
17
|
+
isSupportTheming?: boolean;
|
|
17
18
|
onClose: (context: EmbedModalContext) => void;
|
|
18
19
|
onDownloadActionClick?: () => void;
|
|
19
20
|
onOpen?: (context: EmbedModalContext) => void;
|