@atlaskit/smart-card 26.58.0 → 26.59.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 +3539 -1953
- package/dist/cjs/extractors/common/icon/extractIcon.js +11 -0
- package/dist/cjs/extractors/common/icon/extractIconFromDocument.js +20 -0
- package/dist/cjs/extractors/common/icon/extractIconFromTask.js +8 -0
- package/dist/cjs/extractors/common/icon/prioritiseIcon.js +40 -0
- package/dist/cjs/extractors/common/icon/priority.js +3 -0
- package/dist/cjs/extractors/common/lozenge/extractState.js +47 -9
- package/dist/cjs/extractors/flexible/icon/extract-jsonld-data-icon.js +15 -0
- package/dist/cjs/extractors/flexible/icon/extract-provider-icon.js +10 -0
- package/dist/cjs/extractors/flexible/icon/extract-url-icon.js +7 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +10 -6
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +17 -10
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +2 -0
- package/dist/cjs/view/InlineCard/ResolvedView/index.js +3 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/common/icon/extractIcon.js +11 -0
- package/dist/es2019/extractors/common/icon/extractIconFromDocument.js +22 -0
- package/dist/es2019/extractors/common/icon/extractIconFromTask.js +9 -0
- package/dist/es2019/extractors/common/icon/prioritiseIcon.js +29 -0
- package/dist/es2019/extractors/common/icon/priority.js +3 -0
- package/dist/es2019/extractors/common/lozenge/extractState.js +49 -10
- package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +15 -0
- package/dist/es2019/extractors/flexible/icon/extract-provider-icon.js +11 -0
- package/dist/es2019/extractors/flexible/icon/extract-url-icon.js +8 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +11 -7
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +16 -10
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +2 -0
- package/dist/es2019/view/InlineCard/ResolvedView/index.js +3 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/common/icon/extractIcon.js +11 -0
- package/dist/esm/extractors/common/icon/extractIconFromDocument.js +20 -0
- package/dist/esm/extractors/common/icon/extractIconFromTask.js +9 -0
- package/dist/esm/extractors/common/icon/prioritiseIcon.js +34 -0
- package/dist/esm/extractors/common/icon/priority.js +3 -0
- package/dist/esm/extractors/common/lozenge/extractState.js +49 -10
- package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +15 -0
- package/dist/esm/extractors/flexible/icon/extract-provider-icon.js +11 -0
- package/dist/esm/extractors/flexible/icon/extract-url-icon.js +8 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/ResolvedView.js +11 -7
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +16 -10
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +2 -0
- package/dist/esm/view/InlineCard/ResolvedView/index.js +3 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/common/icon/extractIcon.d.ts +3 -3
- package/dist/types/extractors/common/icon/extractIconFromDocument.d.ts +8 -1
- package/dist/types/extractors/common/icon/extractIconFromTask.d.ts +8 -0
- package/dist/types/extractors/common/icon/prioritiseIcon.d.ts +40 -0
- package/dist/types/extractors/common/icon/priority.d.ts +3 -0
- package/dist/types/extractors/common/lozenge/types.d.ts +3 -0
- package/dist/types/extractors/flexible/icon/extract-document-type-icon.d.ts +1 -1
- package/dist/types/extractors/flexible/icon/extract-jsonld-data-icon.d.ts +5 -2
- package/dist/types/extractors/flexible/icon/extract-provider-icon.d.ts +10 -0
- package/dist/types/extractors/flexible/icon/extract-url-icon.d.ts +7 -0
- package/dist/types/extractors/flexible/icon/types.d.ts +3 -0
- package/dist/types/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-block/index.d.ts +4 -3
- package/dist/types/view/FlexibleCard/components/elements/lozenge/types.d.ts +5 -0
- package/dist/types-ts4.5/extractors/common/icon/extractIcon.d.ts +3 -3
- package/dist/types-ts4.5/extractors/common/icon/extractIconFromDocument.d.ts +8 -1
- package/dist/types-ts4.5/extractors/common/icon/extractIconFromTask.d.ts +8 -0
- package/dist/types-ts4.5/extractors/common/icon/prioritiseIcon.d.ts +40 -0
- package/dist/types-ts4.5/extractors/common/icon/priority.d.ts +3 -0
- package/dist/types-ts4.5/extractors/common/lozenge/types.d.ts +3 -0
- package/dist/types-ts4.5/extractors/flexible/icon/extract-document-type-icon.d.ts +1 -1
- package/dist/types-ts4.5/extractors/flexible/icon/extract-jsonld-data-icon.d.ts +5 -2
- package/dist/types-ts4.5/extractors/flexible/icon/extract-provider-icon.d.ts +10 -0
- package/dist/types-ts4.5/extractors/flexible/icon/extract-url-icon.d.ts +7 -0
- package/dist/types-ts4.5/extractors/flexible/icon/types.d.ts +3 -0
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/index.d.ts +4 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/types.d.ts +5 -0
- package/package.json +13 -10
|
@@ -2,6 +2,17 @@ import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
|
2
2
|
import { IconType } from '../../../constants';
|
|
3
3
|
import extractUrlIcon from './extract-url-icon';
|
|
4
4
|
import { extractTitle } from '@atlaskit/link-extractors';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Extracts the provider icon and label from the given JSON-LD data.
|
|
8
|
+
*
|
|
9
|
+
* If the data is from Confluence, the icon will be the Confluence icon and the label will be 'Confluence'.
|
|
10
|
+
* If the data is from Jira, the icon will be the Jira icon and the label will be 'Jira'.
|
|
11
|
+
* If the data is from another provider, the icon and label will be extracted from the generator object.
|
|
12
|
+
*
|
|
13
|
+
* @param data - The JSON-LD data to extract the provider icon and label from.
|
|
14
|
+
* @returns IconDescriptor with optional icon string name, url and label, or `undefined` if the data is not provided.
|
|
15
|
+
*/
|
|
5
16
|
const extractProviderIcon = data => {
|
|
6
17
|
if (!data) {
|
|
7
18
|
return undefined;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { extractUrlFromIconJsonLd } from '@atlaskit/link-extractors';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extracts the URL icon from the given icon or link object.
|
|
5
|
+
*
|
|
6
|
+
* @param icon - The icon or link object from which to extract the URL icon.
|
|
7
|
+
* @param label - The label for the URL icon.
|
|
8
|
+
* @returns IconDescriptor, which will contain label and url, or undefined
|
|
9
|
+
*/
|
|
2
10
|
const extractUrlIcon = (icon, label) => {
|
|
3
11
|
const url = icon && extractUrlFromIconJsonLd(icon);
|
|
4
12
|
return url ? {
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "26.
|
|
7
|
+
packageVersion: "26.59.0"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
|
+
import { jsx, css } from '@emotion/react';
|
|
3
4
|
import Lozenge from '@atlaskit/lozenge';
|
|
4
5
|
import { Frame } from '../components/Frame';
|
|
5
6
|
import { Thumbnail } from '../components/Thumbnail';
|
|
@@ -17,6 +18,11 @@ import { ContentHeader } from '../components/ContentHeader';
|
|
|
17
18
|
import { ContentFooter } from '../components/ContentFooter';
|
|
18
19
|
import { gs } from '../../common/utils';
|
|
19
20
|
import { handleClickCommon } from '../utils/handlers';
|
|
21
|
+
const styles = css({
|
|
22
|
+
display: 'flex',
|
|
23
|
+
justifyContent: 'space-between',
|
|
24
|
+
alignItems: 'flex-start'
|
|
25
|
+
});
|
|
20
26
|
/**
|
|
21
27
|
* Class name for selecting non-flexible resolved block card
|
|
22
28
|
*
|
|
@@ -67,11 +73,7 @@ export const ResolvedView = ({
|
|
|
67
73
|
testId: testId,
|
|
68
74
|
className: blockCardResolvedViewClassName
|
|
69
75
|
}, jsx(Content, null, jsx("div", null, jsx("div", {
|
|
70
|
-
css:
|
|
71
|
-
display: 'flex',
|
|
72
|
-
justifyContent: 'space-between',
|
|
73
|
-
alignItems: 'flex-start'
|
|
74
|
-
}
|
|
76
|
+
css: styles
|
|
75
77
|
}, jsx(ContentHeader, {
|
|
76
78
|
onClick: handleClick,
|
|
77
79
|
link: link
|
|
@@ -87,7 +89,9 @@ export const ResolvedView = ({
|
|
|
87
89
|
alignItems: 'center',
|
|
88
90
|
justifyContent: 'center'
|
|
89
91
|
}
|
|
90
|
-
}, jsx(Lozenge,
|
|
92
|
+
}, jsx(Lozenge, _extends({
|
|
93
|
+
style: lozenge.style
|
|
94
|
+
}, lozenge), lozenge.text))), jsx(CollaboratorList, {
|
|
91
95
|
items: users,
|
|
92
96
|
handleAvatarClick: handleAvatarClick,
|
|
93
97
|
handleMoreAvatarsClick: handleMoreAvatarsClick,
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
|
+
import { xcss } from '@atlaskit/primitives';
|
|
4
|
+
import { useMemo } from 'react';
|
|
3
5
|
import { SmartLinkSize } from '../../../../../constants';
|
|
4
6
|
import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
|
|
5
7
|
import * as Actions from '../../actions';
|
|
6
8
|
import { getPrimitivesPaddingSpaceBySize } from '../../utils';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
const ignoreContainerPaddingStyles = css({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
boxSizing: 'border-box',
|
|
13
|
+
flexGrow: 1,
|
|
14
|
+
width: '100%',
|
|
15
|
+
// We have to find a better way to ignore container padding
|
|
16
|
+
// This has become more and more of a common use case.
|
|
10
17
|
marginLeft: 'calc(var(--container-gap-left) * -1)',
|
|
11
18
|
marginRight: 'calc(var(--container-gap-right) * -1)'
|
|
12
19
|
});
|
|
@@ -40,7 +47,7 @@ const ActionBlock = ({
|
|
|
40
47
|
arr.sort(sort);
|
|
41
48
|
return arr.map(name => {
|
|
42
49
|
const Action = name in Actions ? Actions[name] : undefined;
|
|
43
|
-
return Action ?
|
|
50
|
+
return Action ? jsx(Action, {
|
|
44
51
|
as: "stack-item",
|
|
45
52
|
spaceInline: spaceInline,
|
|
46
53
|
key: name,
|
|
@@ -52,11 +59,10 @@ const ActionBlock = ({
|
|
|
52
59
|
}) : null;
|
|
53
60
|
});
|
|
54
61
|
}, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, spaceInline]);
|
|
55
|
-
return actions ?
|
|
56
|
-
|
|
57
|
-
xcss: ignoreContainerPaddingStyles,
|
|
62
|
+
return actions ? jsx("div", {
|
|
63
|
+
css: ignoreContainerPaddingStyles,
|
|
58
64
|
ref: blockRef,
|
|
59
|
-
|
|
65
|
+
"data-testid": testId
|
|
60
66
|
}, actions) : null;
|
|
61
67
|
};
|
|
62
68
|
export default ActionBlock;
|
|
@@ -20,6 +20,7 @@ const Lozenge = ({
|
|
|
20
20
|
appearance = 'default',
|
|
21
21
|
name,
|
|
22
22
|
overrideCss,
|
|
23
|
+
style,
|
|
23
24
|
text,
|
|
24
25
|
testId = 'smart-element-lozenge'
|
|
25
26
|
}) => {
|
|
@@ -35,6 +36,7 @@ const Lozenge = ({
|
|
|
35
36
|
zIndex: ui === null || ui === void 0 ? void 0 : ui.zIndex
|
|
36
37
|
}) : jsx(AtlaskitLozenge, {
|
|
37
38
|
appearance: appearance,
|
|
39
|
+
style: style,
|
|
38
40
|
testId: `${testId}-lozenge`
|
|
39
41
|
}, text);
|
|
40
42
|
return jsx("span", {
|
|
@@ -12,9 +12,11 @@ export class InlineCardResolvedView extends React.Component {
|
|
|
12
12
|
if (!lozenge) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
|
+
const appearance = lozenge.appearance || 'default';
|
|
15
16
|
return /*#__PURE__*/React.createElement(LozengeWrapper, null, /*#__PURE__*/React.createElement(Lozenge, {
|
|
16
17
|
testId: "inline-card-resolved-view-lozenge",
|
|
17
|
-
appearance:
|
|
18
|
+
appearance: appearance,
|
|
19
|
+
style: lozenge.style,
|
|
18
20
|
isBold: lozenge.isBold
|
|
19
21
|
}, lozenge.text));
|
|
20
22
|
}
|
|
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
7
7
|
import LinkWarningModal from './LinkWarningModal';
|
|
8
8
|
const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "26.
|
|
10
|
+
packageVersion: "26.59.0",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -31,6 +31,17 @@ export var extractIcon = function extractIcon(jsonLd) {
|
|
|
31
31
|
return extractIconByType(type, opts);
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Extracts an icon based on the given type.
|
|
37
|
+
*
|
|
38
|
+
* Some types return hardcoded icons, while others follow a priority list on how to pick the icon.
|
|
39
|
+
* If type is not recognized, it will return the icon from the provider, or `undefined` if no icon is found.
|
|
40
|
+
*
|
|
41
|
+
* @param type - The type of the object.
|
|
42
|
+
* @param opts - Options for the icon extraction.
|
|
43
|
+
* @returns The extracted icon as a React node, or `undefined` if no icon is found.
|
|
44
|
+
*/
|
|
34
45
|
var extractIconByType = function extractIconByType(type, opts) {
|
|
35
46
|
switch (type) {
|
|
36
47
|
case 'Document':
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import BlogIcon from '@atlaskit/icon-object/glyph/blog/16';
|
|
3
4
|
import FileIcon from '@atlaskit/icon-file-type/glyph/generic/16';
|
|
4
5
|
import PresentationIcon from '@atlaskit/icon-file-type/glyph/presentation/16';
|
|
@@ -6,10 +7,29 @@ import SpreadsheetIcon from '@atlaskit/icon-file-type/glyph/spreadsheet/16';
|
|
|
6
7
|
import DocumentIcon from '@atlaskit/icon-file-type/glyph/document/16';
|
|
7
8
|
import DocumentFilledIcon from '@atlaskit/icon/glyph/document-filled';
|
|
8
9
|
import { getIconForFileType } from '../../../utils';
|
|
10
|
+
import { prioritiseIcon } from './prioritiseIcon';
|
|
11
|
+
/**
|
|
12
|
+
* Extracts an icon for a document pbject
|
|
13
|
+
*
|
|
14
|
+
* @param type - The type of the document.
|
|
15
|
+
* @param opts - The options for extracting the icon.
|
|
16
|
+
* @returns The React node representing the extracted icon, or `undefined` if no icon is found.
|
|
17
|
+
*/
|
|
9
18
|
export var extractIconFromDocument = function extractIconFromDocument(type, opts) {
|
|
19
|
+
var provider = opts.provider;
|
|
10
20
|
var iconFromType = documentTypeToIcon(type, opts);
|
|
11
21
|
var iconFromFileFormat = documentFileFormatToIcon(opts);
|
|
12
22
|
var iconFromProvider = opts.provider && opts.provider.icon;
|
|
23
|
+
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
24
|
+
var providerId = provider === null || provider === void 0 ? void 0 : provider.id;
|
|
25
|
+
return prioritiseIcon({
|
|
26
|
+
providerId: providerId,
|
|
27
|
+
fileFormatIcon: iconFromFileFormat,
|
|
28
|
+
documentTypeIcon: iconFromType,
|
|
29
|
+
urlIcon: opts.icon,
|
|
30
|
+
providerIcon: iconFromProvider
|
|
31
|
+
});
|
|
32
|
+
}
|
|
13
33
|
// If we encounter a native provider, we privilege the
|
|
14
34
|
// icon generated by its type. Otherwise, we privilege the
|
|
15
35
|
// provider icon, followed by the type & mime type icons.
|
|
@@ -10,6 +10,15 @@ import JiraServiceRequestIcon from '@atlaskit/icon-object/glyph/issue/16';
|
|
|
10
10
|
import JiraChangeIcon from '@atlaskit/icon-object/glyph/changes/16';
|
|
11
11
|
import JiraProblemIcon from '@atlaskit/icon-object/glyph/problem/16';
|
|
12
12
|
import { JIRA_GENERATOR_ID, JIRA_TASK, JIRA_SUB_TASK, JIRA_STORY, JIRA_BUG, JIRA_EPIC, JIRA_INCIDENT, JIRA_SERVICE_REQUEST, JIRA_CHANGE, JIRA_PROBLEM, JIRA_CUSTOM_TASK_TYPE } from '../../constants';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Chooses an icon for a task based on the provided options.
|
|
16
|
+
*
|
|
17
|
+
* Chooses icon based on variety of Jira task types, based on opts.taskType.id
|
|
18
|
+
*
|
|
19
|
+
* @param opts - The options for extracting the icon.
|
|
20
|
+
* @returns The React node representing the extracted icon, or `undefined` if no icon is found.
|
|
21
|
+
*/
|
|
13
22
|
export var extractIconFromTask = function extractIconFromTask(opts) {
|
|
14
23
|
// Render Atlaskit icons for all supported Jira issue types.
|
|
15
24
|
var taskType = opts.taskType,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
2
|
+
var isConfluenceProvider = function isConfluenceProvider(provider) {
|
|
3
|
+
return provider === CONFLUENCE_GENERATOR_ID;
|
|
4
|
+
};
|
|
5
|
+
var isJiraProvider = function isJiraProvider(provider) {
|
|
6
|
+
return provider === JIRA_GENERATOR_ID;
|
|
7
|
+
};
|
|
8
|
+
var isNativeProvider = function isNativeProvider(provider) {
|
|
9
|
+
return isConfluenceProvider(provider) || isJiraProvider(provider);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Represents an icon. Should either contain a label and url, or a an icon type and label.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Options required to prioritise which icon to show
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Reusable priority function for choosing which icon to show.
|
|
22
|
+
* Generic so it can be used to prioritise strings, or React components depending on the usage.
|
|
23
|
+
*/
|
|
24
|
+
export function prioritiseIcon(_ref) {
|
|
25
|
+
var providerId = _ref.providerId,
|
|
26
|
+
fileFormatIcon = _ref.fileFormatIcon,
|
|
27
|
+
documentTypeIcon = _ref.documentTypeIcon,
|
|
28
|
+
urlIcon = _ref.urlIcon,
|
|
29
|
+
providerIcon = _ref.providerIcon;
|
|
30
|
+
if (isNativeProvider(providerId)) {
|
|
31
|
+
return fileFormatIcon || documentTypeIcon || urlIcon || providerIcon;
|
|
32
|
+
}
|
|
33
|
+
return urlIcon || fileFormatIcon || documentTypeIcon || providerIcon;
|
|
34
|
+
}
|
|
@@ -1,4 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OMIT_STATES, VALID_STATES } from './utils';
|
|
2
|
+
|
|
3
|
+
// Maps accent color short names to their corresponding background and text colors
|
|
4
|
+
var lozengeAccentStyles = {
|
|
5
|
+
blue: {
|
|
6
|
+
backgroundColor: "var(--ds-background-accent-blue-subtler, #CCE0FF)",
|
|
7
|
+
color: "var(--ds-text-accent-blue, #0055CC)"
|
|
8
|
+
},
|
|
9
|
+
gray: {
|
|
10
|
+
backgroundColor: "var(--ds-background-accent-gray-subtler, #DCDFE4)",
|
|
11
|
+
color: "var(--ds-text-accent-gray, #44546F)"
|
|
12
|
+
},
|
|
13
|
+
green: {
|
|
14
|
+
backgroundColor: "var(--ds-background-accent-green-subtler, #BAF3DB)",
|
|
15
|
+
color: "var(--ds-text-accent-green, #216E4E)"
|
|
16
|
+
},
|
|
17
|
+
lime: {
|
|
18
|
+
backgroundColor: "var(--ds-background-accent-lime-subtler, #D3F1A7)",
|
|
19
|
+
color: "var(--ds-text-accent-lime, #4C6B1F)"
|
|
20
|
+
},
|
|
21
|
+
magenta: {
|
|
22
|
+
backgroundColor: "var(--ds-background-accent-magenta-subtler, #FDD0EC)",
|
|
23
|
+
color: "var(--ds-text-accent-magenta, #943D73)"
|
|
24
|
+
},
|
|
25
|
+
orange: {
|
|
26
|
+
backgroundColor: "var(--ds-background-accent-orange-subtler, #FEDEC8)",
|
|
27
|
+
color: "var(--ds-text-accent-orange, #A54800)"
|
|
28
|
+
},
|
|
29
|
+
purple: {
|
|
30
|
+
backgroundColor: "var(--ds-background-accent-purple-subtler, #DFD8FD)",
|
|
31
|
+
color: "var(--ds-text-accent-purple, #5E4DB2)"
|
|
32
|
+
},
|
|
33
|
+
red: {
|
|
34
|
+
backgroundColor: "var(--ds-background-accent-red-subtler, #FFD5D2)",
|
|
35
|
+
color: "var(--ds-text-accent-red, #AE2E24)"
|
|
36
|
+
},
|
|
37
|
+
teal: {
|
|
38
|
+
backgroundColor: "var(--ds-background-accent-teal-subtler, #C6EDFB)",
|
|
39
|
+
color: "var(--ds-text-accent-teal, #206A83)"
|
|
40
|
+
},
|
|
41
|
+
yellow: {
|
|
42
|
+
backgroundColor: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
|
|
43
|
+
color: "var(--ds-text-accent-yellow, #7F5F01)"
|
|
44
|
+
}
|
|
45
|
+
};
|
|
2
46
|
export var extractState = function extractState(jsonLd) {
|
|
3
47
|
var state = jsonLd['atlassian:state'];
|
|
4
48
|
if (state) {
|
|
@@ -10,18 +54,13 @@ export var extractState = function extractState(jsonLd) {
|
|
|
10
54
|
appearance: VALID_STATES[linkState] || 'default'
|
|
11
55
|
};
|
|
12
56
|
}
|
|
13
|
-
} else if (state['@type'] === 'Link') {
|
|
14
|
-
if (state.name) {
|
|
15
|
-
return {
|
|
16
|
-
text: state.name,
|
|
17
|
-
appearance: state.appearance || 'default'
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
} else if (state['@type'] === 'Object') {
|
|
57
|
+
} else if (state['@type'] === 'Link' || state['@type'] === 'Object') {
|
|
21
58
|
if (state.name) {
|
|
59
|
+
var accent = state.accent;
|
|
22
60
|
return {
|
|
23
61
|
text: state.name,
|
|
24
|
-
appearance: state.appearance || 'default'
|
|
62
|
+
appearance: state.appearance || 'default',
|
|
63
|
+
style: accent ? lozengeAccentStyles[accent] : undefined
|
|
25
64
|
};
|
|
26
65
|
}
|
|
27
66
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
2
3
|
import extractDocumentTypeIcon from './extract-document-type-icon';
|
|
3
4
|
import extractFileFormatIcon from './extract-file-formatIcon';
|
|
@@ -8,6 +9,7 @@ import { extractTaskType } from '../../common/lozenge';
|
|
|
8
9
|
import { extractTitle } from '@atlaskit/link-extractors';
|
|
9
10
|
import { extractorPriorityMap as priorityMap } from '../../common/icon/priority';
|
|
10
11
|
import { IconType } from '../../../constants';
|
|
12
|
+
import { prioritiseIcon } from '../../common/icon/prioritiseIcon';
|
|
11
13
|
var extractTask = function extractTask(data, label) {
|
|
12
14
|
var _ref = extractTaskType(data) || {},
|
|
13
15
|
id = _ref.id,
|
|
@@ -37,6 +39,10 @@ var isJiraProvider = function isJiraProvider(provider) {
|
|
|
37
39
|
var isNativeProvider = function isNativeProvider(provider) {
|
|
38
40
|
return isConfluenceProvider(provider) || isJiraProvider(provider);
|
|
39
41
|
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Return the icon object given a JSON-LD data object.
|
|
45
|
+
*/
|
|
40
46
|
var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
41
47
|
var generator = data.generator;
|
|
42
48
|
var label = extractTitle(data);
|
|
@@ -61,6 +67,15 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
|
61
67
|
var fileFormat = documentData === null || documentData === void 0 ? void 0 : documentData['schema:fileFormat'];
|
|
62
68
|
var fileFormatIcon = extractFileFormatIcon(fileFormat);
|
|
63
69
|
var documentTypeIcon = extractDocumentTypeIcon(type, label);
|
|
70
|
+
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
71
|
+
return prioritiseIcon({
|
|
72
|
+
providerId: provider,
|
|
73
|
+
fileFormatIcon: fileFormatIcon,
|
|
74
|
+
documentTypeIcon: documentTypeIcon,
|
|
75
|
+
urlIcon: urlIcon,
|
|
76
|
+
providerIcon: providerIcon
|
|
77
|
+
});
|
|
78
|
+
}
|
|
64
79
|
return isNativeProvider(provider) ? fileFormatIcon || documentTypeIcon || urlIcon || providerIcon : providerIcon || fileFormatIcon || documentTypeIcon;
|
|
65
80
|
case 'atlassian:Task':
|
|
66
81
|
var taskLabel = label || 'Task';
|
|
@@ -2,6 +2,17 @@ import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
|
2
2
|
import { IconType } from '../../../constants';
|
|
3
3
|
import extractUrlIcon from './extract-url-icon';
|
|
4
4
|
import { extractTitle } from '@atlaskit/link-extractors';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Extracts the provider icon and label from the given JSON-LD data.
|
|
8
|
+
*
|
|
9
|
+
* If the data is from Confluence, the icon will be the Confluence icon and the label will be 'Confluence'.
|
|
10
|
+
* If the data is from Jira, the icon will be the Jira icon and the label will be 'Jira'.
|
|
11
|
+
* If the data is from another provider, the icon and label will be extracted from the generator object.
|
|
12
|
+
*
|
|
13
|
+
* @param data - The JSON-LD data to extract the provider icon and label from.
|
|
14
|
+
* @returns IconDescriptor with optional icon string name, url and label, or `undefined` if the data is not provided.
|
|
15
|
+
*/
|
|
5
16
|
var extractProviderIcon = function extractProviderIcon(data) {
|
|
6
17
|
if (!data) {
|
|
7
18
|
return undefined;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { extractUrlFromIconJsonLd } from '@atlaskit/link-extractors';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extracts the URL icon from the given icon or link object.
|
|
5
|
+
*
|
|
6
|
+
* @param icon - The icon or link object from which to extract the URL icon.
|
|
7
|
+
* @param label - The label for the URL icon.
|
|
8
|
+
* @returns IconDescriptor, which will contain label and url, or undefined
|
|
9
|
+
*/
|
|
2
10
|
var extractUrlIcon = function extractUrlIcon(icon, label) {
|
|
3
11
|
var url = icon && extractUrlFromIconJsonLd(icon);
|
|
4
12
|
return url ? {
|
|
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
15
15
|
export var context = {
|
|
16
16
|
componentName: 'smart-cards',
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "26.
|
|
18
|
+
packageVersion: "26.59.0"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
|
+
import { jsx, css } from '@emotion/react';
|
|
3
4
|
import Lozenge from '@atlaskit/lozenge';
|
|
4
5
|
import { Frame } from '../components/Frame';
|
|
5
6
|
import { Thumbnail } from '../components/Thumbnail';
|
|
@@ -17,6 +18,11 @@ import { ContentHeader } from '../components/ContentHeader';
|
|
|
17
18
|
import { ContentFooter } from '../components/ContentFooter';
|
|
18
19
|
import { gs } from '../../common/utils';
|
|
19
20
|
import { handleClickCommon } from '../utils/handlers';
|
|
21
|
+
var styles = css({
|
|
22
|
+
display: 'flex',
|
|
23
|
+
justifyContent: 'space-between',
|
|
24
|
+
alignItems: 'flex-start'
|
|
25
|
+
});
|
|
20
26
|
/**
|
|
21
27
|
* Class name for selecting non-flexible resolved block card
|
|
22
28
|
*
|
|
@@ -81,11 +87,7 @@ export var ResolvedView = function ResolvedView(_ref) {
|
|
|
81
87
|
testId: testId,
|
|
82
88
|
className: blockCardResolvedViewClassName
|
|
83
89
|
}, jsx(Content, null, jsx("div", null, jsx("div", {
|
|
84
|
-
css:
|
|
85
|
-
display: 'flex',
|
|
86
|
-
justifyContent: 'space-between',
|
|
87
|
-
alignItems: 'flex-start'
|
|
88
|
-
}
|
|
90
|
+
css: styles
|
|
89
91
|
}, jsx(ContentHeader, {
|
|
90
92
|
onClick: handleClick,
|
|
91
93
|
link: link
|
|
@@ -101,7 +103,9 @@ export var ResolvedView = function ResolvedView(_ref) {
|
|
|
101
103
|
alignItems: 'center',
|
|
102
104
|
justifyContent: 'center'
|
|
103
105
|
}
|
|
104
|
-
}, jsx(Lozenge,
|
|
106
|
+
}, jsx(Lozenge, _extends({
|
|
107
|
+
style: lozenge.style
|
|
108
|
+
}, lozenge), lozenge.text))), jsx(CollaboratorList, {
|
|
105
109
|
items: users,
|
|
106
110
|
handleAvatarClick: handleAvatarClick,
|
|
107
111
|
handleMoreAvatarsClick: handleMoreAvatarsClick,
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
|
+
import { xcss } from '@atlaskit/primitives';
|
|
4
|
+
import { useMemo } from 'react';
|
|
3
5
|
import { SmartLinkSize } from '../../../../../constants';
|
|
4
6
|
import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
|
|
5
7
|
import * as Actions from '../../actions';
|
|
6
8
|
import { getPrimitivesPaddingSpaceBySize } from '../../utils';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
var ignoreContainerPaddingStyles = css({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
boxSizing: 'border-box',
|
|
13
|
+
flexGrow: 1,
|
|
14
|
+
width: '100%',
|
|
15
|
+
// We have to find a better way to ignore container padding
|
|
16
|
+
// This has become more and more of a common use case.
|
|
10
17
|
marginLeft: 'calc(var(--container-gap-left) * -1)',
|
|
11
18
|
marginRight: 'calc(var(--container-gap-right) * -1)'
|
|
12
19
|
});
|
|
@@ -40,7 +47,7 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
40
47
|
arr.sort(sort);
|
|
41
48
|
return arr.map(function (name) {
|
|
42
49
|
var Action = name in Actions ? Actions[name] : undefined;
|
|
43
|
-
return Action ?
|
|
50
|
+
return Action ? jsx(Action, {
|
|
44
51
|
as: "stack-item",
|
|
45
52
|
spaceInline: spaceInline,
|
|
46
53
|
key: name,
|
|
@@ -54,11 +61,10 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
54
61
|
}) : null;
|
|
55
62
|
});
|
|
56
63
|
}, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, spaceInline]);
|
|
57
|
-
return actions ?
|
|
58
|
-
|
|
59
|
-
xcss: ignoreContainerPaddingStyles,
|
|
64
|
+
return actions ? jsx("div", {
|
|
65
|
+
css: ignoreContainerPaddingStyles,
|
|
60
66
|
ref: blockRef,
|
|
61
|
-
|
|
67
|
+
"data-testid": testId
|
|
62
68
|
}, actions) : null;
|
|
63
69
|
};
|
|
64
70
|
export default ActionBlock;
|
|
@@ -21,6 +21,7 @@ var Lozenge = function Lozenge(_ref) {
|
|
|
21
21
|
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
22
22
|
name = _ref.name,
|
|
23
23
|
overrideCss = _ref.overrideCss,
|
|
24
|
+
style = _ref.style,
|
|
24
25
|
text = _ref.text,
|
|
25
26
|
_ref$testId = _ref.testId,
|
|
26
27
|
testId = _ref$testId === void 0 ? 'smart-element-lozenge' : _ref$testId;
|
|
@@ -36,6 +37,7 @@ var Lozenge = function Lozenge(_ref) {
|
|
|
36
37
|
zIndex: ui === null || ui === void 0 ? void 0 : ui.zIndex
|
|
37
38
|
}) : jsx(AtlaskitLozenge, {
|
|
38
39
|
appearance: appearance,
|
|
40
|
+
style: style,
|
|
39
41
|
testId: "".concat(testId, "-lozenge")
|
|
40
42
|
}, text);
|
|
41
43
|
return jsx("span", {
|
|
@@ -25,9 +25,11 @@ export var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
|
|
|
25
25
|
if (!lozenge) {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
|
+
var appearance = lozenge.appearance || 'default';
|
|
28
29
|
return /*#__PURE__*/React.createElement(LozengeWrapper, null, /*#__PURE__*/React.createElement(Lozenge, {
|
|
29
30
|
testId: "inline-card-resolved-view-lozenge",
|
|
30
|
-
appearance:
|
|
31
|
+
appearance: appearance,
|
|
32
|
+
style: lozenge.style,
|
|
31
33
|
isBold: lozenge.isBold
|
|
32
34
|
}, lozenge.text));
|
|
33
35
|
}
|
|
@@ -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.59.0",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { JsonLd } from 'json-ld-types';
|
|
3
|
-
import { LinkProvider } from '@atlaskit/link-extractors';
|
|
4
|
-
import { LinkTaskType } from '../lozenge/extractTaskType';
|
|
2
|
+
import { type JsonLd } from 'json-ld-types';
|
|
3
|
+
import { type LinkProvider } from '@atlaskit/link-extractors';
|
|
4
|
+
import { type LinkTaskType } from '../lozenge/extractTaskType';
|
|
5
5
|
export type IconPriority = 'type' | 'provider';
|
|
6
6
|
export interface IconOpts {
|
|
7
7
|
title?: string;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IconOpts } from './extractIcon';
|
|
2
|
+
import { type IconOpts } from './extractIcon';
|
|
3
3
|
export type DocumentType = 'Document' | 'schema:BlogPosting' | 'schema:DigitalDocument' | 'schema:TextDigitalDocument' | 'schema:PresentationDigitalDocument' | 'schema:SpreadsheetDigitalDocument' | 'atlassian:Template' | 'atlassian:UndefinedLink';
|
|
4
|
+
/**
|
|
5
|
+
* Extracts an icon for a document pbject
|
|
6
|
+
*
|
|
7
|
+
* @param type - The type of the document.
|
|
8
|
+
* @param opts - The options for extracting the icon.
|
|
9
|
+
* @returns The React node representing the extracted icon, or `undefined` if no icon is found.
|
|
10
|
+
*/
|
|
4
11
|
export declare const extractIconFromDocument: (type: DocumentType, opts: IconOpts) => React.ReactNode | undefined;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IconOpts } from './extractIcon';
|
|
3
|
+
/**
|
|
4
|
+
* Chooses an icon for a task based on the provided options.
|
|
5
|
+
*
|
|
6
|
+
* Chooses icon based on variety of Jira task types, based on opts.taskType.id
|
|
7
|
+
*
|
|
8
|
+
* @param opts - The options for extracting the icon.
|
|
9
|
+
* @returns The React node representing the extracted icon, or `undefined` if no icon is found.
|
|
10
|
+
*/
|
|
3
11
|
export declare const extractIconFromTask: (opts: IconOpts) => React.ReactNode | undefined;
|