@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
|
@@ -38,6 +38,17 @@ var extractIcon = exports.extractIcon = function extractIcon(jsonLd) {
|
|
|
38
38
|
return extractIconByType(type, opts);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Extracts an icon based on the given type.
|
|
44
|
+
*
|
|
45
|
+
* Some types return hardcoded icons, while others follow a priority list on how to pick the icon.
|
|
46
|
+
* If type is not recognized, it will return the icon from the provider, or `undefined` if no icon is found.
|
|
47
|
+
*
|
|
48
|
+
* @param type - The type of the object.
|
|
49
|
+
* @param opts - Options for the icon extraction.
|
|
50
|
+
* @returns The extracted icon as a React node, or `undefined` if no icon is found.
|
|
51
|
+
*/
|
|
41
52
|
var extractIconByType = function extractIconByType(type, opts) {
|
|
42
53
|
switch (type) {
|
|
43
54
|
case 'Document':
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.extractIconFromDocument = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var _ = _interopRequireDefault(require("@atlaskit/icon-object/glyph/blog/16"));
|
|
10
11
|
var _2 = _interopRequireDefault(require("@atlaskit/icon-file-type/glyph/generic/16"));
|
|
11
12
|
var _3 = _interopRequireDefault(require("@atlaskit/icon-file-type/glyph/presentation/16"));
|
|
@@ -13,10 +14,29 @@ var _4 = _interopRequireDefault(require("@atlaskit/icon-file-type/glyph/spreadsh
|
|
|
13
14
|
var _5 = _interopRequireDefault(require("@atlaskit/icon-file-type/glyph/document/16"));
|
|
14
15
|
var _documentFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/document-filled"));
|
|
15
16
|
var _utils = require("../../../utils");
|
|
17
|
+
var _prioritiseIcon = require("./prioritiseIcon");
|
|
18
|
+
/**
|
|
19
|
+
* Extracts an icon for a document pbject
|
|
20
|
+
*
|
|
21
|
+
* @param type - The type of the document.
|
|
22
|
+
* @param opts - The options for extracting the icon.
|
|
23
|
+
* @returns The React node representing the extracted icon, or `undefined` if no icon is found.
|
|
24
|
+
*/
|
|
16
25
|
var extractIconFromDocument = exports.extractIconFromDocument = function extractIconFromDocument(type, opts) {
|
|
26
|
+
var provider = opts.provider;
|
|
17
27
|
var iconFromType = documentTypeToIcon(type, opts);
|
|
18
28
|
var iconFromFileFormat = documentFileFormatToIcon(opts);
|
|
19
29
|
var iconFromProvider = opts.provider && opts.provider.icon;
|
|
30
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
31
|
+
var providerId = provider === null || provider === void 0 ? void 0 : provider.id;
|
|
32
|
+
return (0, _prioritiseIcon.prioritiseIcon)({
|
|
33
|
+
providerId: providerId,
|
|
34
|
+
fileFormatIcon: iconFromFileFormat,
|
|
35
|
+
documentTypeIcon: iconFromType,
|
|
36
|
+
urlIcon: opts.icon,
|
|
37
|
+
providerIcon: iconFromProvider
|
|
38
|
+
});
|
|
39
|
+
}
|
|
20
40
|
// If we encounter a native provider, we privilege the
|
|
21
41
|
// icon generated by its type. Otherwise, we privilege the
|
|
22
42
|
// provider icon, followed by the type & mime type icons.
|
|
@@ -16,6 +16,14 @@ var _7 = _interopRequireDefault(require("@atlaskit/icon-object/glyph/issue/16"))
|
|
|
16
16
|
var _8 = _interopRequireDefault(require("@atlaskit/icon-object/glyph/changes/16"));
|
|
17
17
|
var _9 = _interopRequireDefault(require("@atlaskit/icon-object/glyph/problem/16"));
|
|
18
18
|
var _constants = require("../../constants");
|
|
19
|
+
/**
|
|
20
|
+
* Chooses an icon for a task based on the provided options.
|
|
21
|
+
*
|
|
22
|
+
* Chooses icon based on variety of Jira task types, based on opts.taskType.id
|
|
23
|
+
*
|
|
24
|
+
* @param opts - The options for extracting the icon.
|
|
25
|
+
* @returns The React node representing the extracted icon, or `undefined` if no icon is found.
|
|
26
|
+
*/
|
|
19
27
|
var extractIconFromTask = exports.extractIconFromTask = function extractIconFromTask(opts) {
|
|
20
28
|
// Render Atlaskit icons for all supported Jira issue types.
|
|
21
29
|
var taskType = opts.taskType,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.prioritiseIcon = prioritiseIcon;
|
|
7
|
+
var _constants = require("../../constants");
|
|
8
|
+
var isConfluenceProvider = function isConfluenceProvider(provider) {
|
|
9
|
+
return provider === _constants.CONFLUENCE_GENERATOR_ID;
|
|
10
|
+
};
|
|
11
|
+
var isJiraProvider = function isJiraProvider(provider) {
|
|
12
|
+
return provider === _constants.JIRA_GENERATOR_ID;
|
|
13
|
+
};
|
|
14
|
+
var isNativeProvider = function isNativeProvider(provider) {
|
|
15
|
+
return isConfluenceProvider(provider) || isJiraProvider(provider);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Represents an icon. Should either contain a label and url, or a an icon type and label.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Options required to prioritise which icon to show
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Reusable priority function for choosing which icon to show.
|
|
28
|
+
* Generic so it can be used to prioritise strings, or React components depending on the usage.
|
|
29
|
+
*/
|
|
30
|
+
function prioritiseIcon(_ref) {
|
|
31
|
+
var providerId = _ref.providerId,
|
|
32
|
+
fileFormatIcon = _ref.fileFormatIcon,
|
|
33
|
+
documentTypeIcon = _ref.documentTypeIcon,
|
|
34
|
+
urlIcon = _ref.urlIcon,
|
|
35
|
+
providerIcon = _ref.providerIcon;
|
|
36
|
+
if (isNativeProvider(providerId)) {
|
|
37
|
+
return fileFormatIcon || documentTypeIcon || urlIcon || providerIcon;
|
|
38
|
+
}
|
|
39
|
+
return urlIcon || fileFormatIcon || documentTypeIcon || providerIcon;
|
|
40
|
+
}
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.extractorPriorityMap = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Preference more detailed object types over less detailed ones (like 'Document' or 'Object').
|
|
9
|
+
*/
|
|
7
10
|
var extractorPriorityMap = exports.extractorPriorityMap = {
|
|
8
11
|
Object: 0,
|
|
9
12
|
Document: 5,
|
|
@@ -5,6 +5,49 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.extractState = void 0;
|
|
7
7
|
var _utils = require("./utils");
|
|
8
|
+
// Maps accent color short names to their corresponding background and text colors
|
|
9
|
+
var lozengeAccentStyles = {
|
|
10
|
+
blue: {
|
|
11
|
+
backgroundColor: "var(--ds-background-accent-blue-subtler, #CCE0FF)",
|
|
12
|
+
color: "var(--ds-text-accent-blue, #0055CC)"
|
|
13
|
+
},
|
|
14
|
+
gray: {
|
|
15
|
+
backgroundColor: "var(--ds-background-accent-gray-subtler, #DCDFE4)",
|
|
16
|
+
color: "var(--ds-text-accent-gray, #44546F)"
|
|
17
|
+
},
|
|
18
|
+
green: {
|
|
19
|
+
backgroundColor: "var(--ds-background-accent-green-subtler, #BAF3DB)",
|
|
20
|
+
color: "var(--ds-text-accent-green, #216E4E)"
|
|
21
|
+
},
|
|
22
|
+
lime: {
|
|
23
|
+
backgroundColor: "var(--ds-background-accent-lime-subtler, #D3F1A7)",
|
|
24
|
+
color: "var(--ds-text-accent-lime, #4C6B1F)"
|
|
25
|
+
},
|
|
26
|
+
magenta: {
|
|
27
|
+
backgroundColor: "var(--ds-background-accent-magenta-subtler, #FDD0EC)",
|
|
28
|
+
color: "var(--ds-text-accent-magenta, #943D73)"
|
|
29
|
+
},
|
|
30
|
+
orange: {
|
|
31
|
+
backgroundColor: "var(--ds-background-accent-orange-subtler, #FEDEC8)",
|
|
32
|
+
color: "var(--ds-text-accent-orange, #A54800)"
|
|
33
|
+
},
|
|
34
|
+
purple: {
|
|
35
|
+
backgroundColor: "var(--ds-background-accent-purple-subtler, #DFD8FD)",
|
|
36
|
+
color: "var(--ds-text-accent-purple, #5E4DB2)"
|
|
37
|
+
},
|
|
38
|
+
red: {
|
|
39
|
+
backgroundColor: "var(--ds-background-accent-red-subtler, #FFD5D2)",
|
|
40
|
+
color: "var(--ds-text-accent-red, #AE2E24)"
|
|
41
|
+
},
|
|
42
|
+
teal: {
|
|
43
|
+
backgroundColor: "var(--ds-background-accent-teal-subtler, #C6EDFB)",
|
|
44
|
+
color: "var(--ds-text-accent-teal, #206A83)"
|
|
45
|
+
},
|
|
46
|
+
yellow: {
|
|
47
|
+
backgroundColor: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
|
|
48
|
+
color: "var(--ds-text-accent-yellow, #7F5F01)"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
8
51
|
var extractState = exports.extractState = function extractState(jsonLd) {
|
|
9
52
|
var state = jsonLd['atlassian:state'];
|
|
10
53
|
if (state) {
|
|
@@ -16,18 +59,13 @@ var extractState = exports.extractState = function extractState(jsonLd) {
|
|
|
16
59
|
appearance: _utils.VALID_STATES[linkState] || 'default'
|
|
17
60
|
};
|
|
18
61
|
}
|
|
19
|
-
} else if (state['@type'] === 'Link') {
|
|
20
|
-
if (state.name) {
|
|
21
|
-
return {
|
|
22
|
-
text: state.name,
|
|
23
|
-
appearance: state.appearance || 'default'
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
} else if (state['@type'] === 'Object') {
|
|
62
|
+
} else if (state['@type'] === 'Link' || state['@type'] === 'Object') {
|
|
27
63
|
if (state.name) {
|
|
64
|
+
var accent = state.accent;
|
|
28
65
|
return {
|
|
29
66
|
text: state.name,
|
|
30
|
-
appearance: state.appearance || 'default'
|
|
67
|
+
appearance: state.appearance || 'default',
|
|
68
|
+
style: accent ? lozengeAccentStyles[accent] : undefined
|
|
31
69
|
};
|
|
32
70
|
}
|
|
33
71
|
}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
var _constants = require("../../constants");
|
|
9
10
|
var _extractDocumentTypeIcon = _interopRequireDefault(require("./extract-document-type-icon"));
|
|
10
11
|
var _extractFileFormatIcon = _interopRequireDefault(require("./extract-file-formatIcon"));
|
|
@@ -15,6 +16,7 @@ var _lozenge = require("../../common/lozenge");
|
|
|
15
16
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
16
17
|
var _priority = require("../../common/icon/priority");
|
|
17
18
|
var _constants2 = require("../../../constants");
|
|
19
|
+
var _prioritiseIcon = require("../../common/icon/prioritiseIcon");
|
|
18
20
|
var extractTask = function extractTask(data, label) {
|
|
19
21
|
var _ref = (0, _lozenge.extractTaskType)(data) || {},
|
|
20
22
|
id = _ref.id,
|
|
@@ -44,6 +46,10 @@ var isJiraProvider = function isJiraProvider(provider) {
|
|
|
44
46
|
var isNativeProvider = function isNativeProvider(provider) {
|
|
45
47
|
return isConfluenceProvider(provider) || isJiraProvider(provider);
|
|
46
48
|
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Return the icon object given a JSON-LD data object.
|
|
52
|
+
*/
|
|
47
53
|
var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
48
54
|
var generator = data.generator;
|
|
49
55
|
var label = (0, _linkExtractors.extractTitle)(data);
|
|
@@ -68,6 +74,15 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
|
68
74
|
var fileFormat = documentData === null || documentData === void 0 ? void 0 : documentData['schema:fileFormat'];
|
|
69
75
|
var fileFormatIcon = (0, _extractFileFormatIcon.default)(fileFormat);
|
|
70
76
|
var documentTypeIcon = (0, _extractDocumentTypeIcon.default)(type, label);
|
|
77
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
78
|
+
return (0, _prioritiseIcon.prioritiseIcon)({
|
|
79
|
+
providerId: provider,
|
|
80
|
+
fileFormatIcon: fileFormatIcon,
|
|
81
|
+
documentTypeIcon: documentTypeIcon,
|
|
82
|
+
urlIcon: urlIcon,
|
|
83
|
+
providerIcon: providerIcon
|
|
84
|
+
});
|
|
85
|
+
}
|
|
71
86
|
return isNativeProvider(provider) ? fileFormatIcon || documentTypeIcon || urlIcon || providerIcon : providerIcon || fileFormatIcon || documentTypeIcon;
|
|
72
87
|
case 'atlassian:Task':
|
|
73
88
|
var taskLabel = label || 'Task';
|
|
@@ -9,6 +9,16 @@ var _constants = require("../../constants");
|
|
|
9
9
|
var _constants2 = require("../../../constants");
|
|
10
10
|
var _extractUrlIcon = _interopRequireDefault(require("./extract-url-icon"));
|
|
11
11
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
12
|
+
/**
|
|
13
|
+
* Extracts the provider icon and label from the given JSON-LD data.
|
|
14
|
+
*
|
|
15
|
+
* If the data is from Confluence, the icon will be the Confluence icon and the label will be 'Confluence'.
|
|
16
|
+
* If the data is from Jira, the icon will be the Jira icon and the label will be 'Jira'.
|
|
17
|
+
* If the data is from another provider, the icon and label will be extracted from the generator object.
|
|
18
|
+
*
|
|
19
|
+
* @param data - The JSON-LD data to extract the provider icon and label from.
|
|
20
|
+
* @returns IconDescriptor with optional icon string name, url and label, or `undefined` if the data is not provided.
|
|
21
|
+
*/
|
|
12
22
|
var extractProviderIcon = function extractProviderIcon(data) {
|
|
13
23
|
if (!data) {
|
|
14
24
|
return undefined;
|
|
@@ -5,6 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
8
|
+
/**
|
|
9
|
+
* Extracts the URL icon from the given icon or link object.
|
|
10
|
+
*
|
|
11
|
+
* @param icon - The icon or link object from which to extract the URL icon.
|
|
12
|
+
* @param label - The label for the URL icon.
|
|
13
|
+
* @returns IconDescriptor, which will contain label and url, or undefined
|
|
14
|
+
*/
|
|
8
15
|
var extractUrlIcon = function extractUrlIcon(icon, label) {
|
|
9
16
|
var url = icon && (0, _linkExtractors.extractUrlFromIconJsonLd)(icon);
|
|
10
17
|
return url ? {
|
|
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
22
22
|
var context = exports.context = {
|
|
23
23
|
componentName: 'smart-cards',
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "26.
|
|
25
|
+
packageVersion: "26.59.0"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.blockCardResolvedViewClassName = exports.blockCardResolvedViewByClassName = exports.ResolvedView = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
9
|
var _react = require("@emotion/react");
|
|
9
10
|
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
10
11
|
var _Frame = require("../components/Frame");
|
|
@@ -25,6 +26,11 @@ var _utils = require("../../common/utils");
|
|
|
25
26
|
var _handlers = require("../utils/handlers");
|
|
26
27
|
/** @jsx jsx */
|
|
27
28
|
|
|
29
|
+
var styles = (0, _react.css)({
|
|
30
|
+
display: 'flex',
|
|
31
|
+
justifyContent: 'space-between',
|
|
32
|
+
alignItems: 'flex-start'
|
|
33
|
+
});
|
|
28
34
|
/**
|
|
29
35
|
* Class name for selecting non-flexible resolved block card
|
|
30
36
|
*
|
|
@@ -89,11 +95,7 @@ var ResolvedView = exports.ResolvedView = function ResolvedView(_ref) {
|
|
|
89
95
|
testId: testId,
|
|
90
96
|
className: blockCardResolvedViewClassName
|
|
91
97
|
}, (0, _react.jsx)(_Content.Content, null, (0, _react.jsx)("div", null, (0, _react.jsx)("div", {
|
|
92
|
-
css:
|
|
93
|
-
display: 'flex',
|
|
94
|
-
justifyContent: 'space-between',
|
|
95
|
-
alignItems: 'flex-start'
|
|
96
|
-
}
|
|
98
|
+
css: styles
|
|
97
99
|
}, (0, _react.jsx)(_ContentHeader.ContentHeader, {
|
|
98
100
|
onClick: handleClick,
|
|
99
101
|
link: link
|
|
@@ -109,7 +111,9 @@ var ResolvedView = exports.ResolvedView = function ResolvedView(_ref) {
|
|
|
109
111
|
alignItems: 'center',
|
|
110
112
|
justifyContent: 'center'
|
|
111
113
|
}
|
|
112
|
-
}, (0, _react.jsx)(_lozenge.default,
|
|
114
|
+
}, (0, _react.jsx)(_lozenge.default, (0, _extends2.default)({
|
|
115
|
+
style: lozenge.style
|
|
116
|
+
}, lozenge), lozenge.text))), (0, _react.jsx)(_CollaboratorList.CollaboratorList, {
|
|
113
117
|
items: users,
|
|
114
118
|
handleAvatarClick: handleAvatarClick,
|
|
115
119
|
handleMoreAvatarsClick: handleMoreAvatarsClick,
|
|
@@ -5,17 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _react = require("@emotion/react");
|
|
8
9
|
var _primitives = require("@atlaskit/primitives");
|
|
9
|
-
var
|
|
10
|
+
var _react2 = require("react");
|
|
10
11
|
var _constants = require("../../../../../constants");
|
|
11
12
|
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
12
13
|
var Actions = _interopRequireWildcard(require("../../actions"));
|
|
13
14
|
var _utils = require("../../utils");
|
|
14
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var ignoreContainerPaddingStyles = (0,
|
|
17
|
+
/** @jsx jsx */
|
|
18
|
+
|
|
19
|
+
var ignoreContainerPaddingStyles = (0, _react.css)({
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
boxSizing: 'border-box',
|
|
23
|
+
flexGrow: 1,
|
|
24
|
+
width: '100%',
|
|
25
|
+
// We have to find a better way to ignore container padding
|
|
26
|
+
// This has become more and more of a common use case.
|
|
19
27
|
marginLeft: 'calc(var(--container-gap-left) * -1)',
|
|
20
28
|
marginRight: 'calc(var(--container-gap-right) * -1)'
|
|
21
29
|
});
|
|
@@ -41,7 +49,7 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
41
49
|
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
42
50
|
var ui = (0, _flexibleUiContext.useFlexibleUiOptionContext)();
|
|
43
51
|
var padding = !(ui !== null && ui !== void 0 && ui.hidePadding) ? (0, _utils.getPrimitivesPaddingSpaceBySize)((ui === null || ui === void 0 ? void 0 : ui.size) || _constants.SmartLinkSize.Medium) : undefined;
|
|
44
|
-
var actions = (0,
|
|
52
|
+
var actions = (0, _react2.useMemo)(function () {
|
|
45
53
|
if (!(context !== null && context !== void 0 && context.actions)) {
|
|
46
54
|
return;
|
|
47
55
|
}
|
|
@@ -49,7 +57,7 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
49
57
|
arr.sort(sort);
|
|
50
58
|
return arr.map(function (name) {
|
|
51
59
|
var Action = name in Actions ? Actions[name] : undefined;
|
|
52
|
-
return Action ?
|
|
60
|
+
return Action ? (0, _react.jsx)(Action, {
|
|
53
61
|
as: "stack-item",
|
|
54
62
|
spaceInline: spaceInline,
|
|
55
63
|
key: name,
|
|
@@ -63,11 +71,10 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
63
71
|
}) : null;
|
|
64
72
|
});
|
|
65
73
|
}, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, spaceInline]);
|
|
66
|
-
return actions ?
|
|
67
|
-
|
|
68
|
-
xcss: ignoreContainerPaddingStyles,
|
|
74
|
+
return actions ? (0, _react.jsx)("div", {
|
|
75
|
+
css: ignoreContainerPaddingStyles,
|
|
69
76
|
ref: blockRef,
|
|
70
|
-
|
|
77
|
+
"data-testid": testId
|
|
71
78
|
}, actions) : null;
|
|
72
79
|
};
|
|
73
80
|
var _default = exports.default = ActionBlock;
|
|
@@ -29,6 +29,7 @@ var Lozenge = function Lozenge(_ref) {
|
|
|
29
29
|
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
30
30
|
name = _ref.name,
|
|
31
31
|
overrideCss = _ref.overrideCss,
|
|
32
|
+
style = _ref.style,
|
|
32
33
|
text = _ref.text,
|
|
33
34
|
_ref$testId = _ref.testId,
|
|
34
35
|
testId = _ref$testId === void 0 ? 'smart-element-lozenge' : _ref$testId;
|
|
@@ -44,6 +45,7 @@ var Lozenge = function Lozenge(_ref) {
|
|
|
44
45
|
zIndex: ui === null || ui === void 0 ? void 0 : ui.zIndex
|
|
45
46
|
}) : (0, _react2.jsx)(_lozenge.default, {
|
|
46
47
|
appearance: appearance,
|
|
48
|
+
style: style,
|
|
47
49
|
testId: "".concat(testId, "-lozenge")
|
|
48
50
|
}, text);
|
|
49
51
|
return (0, _react2.jsx)("span", {
|
|
@@ -32,9 +32,11 @@ var InlineCardResolvedView = exports.InlineCardResolvedView = /*#__PURE__*/funct
|
|
|
32
32
|
if (!lozenge) {
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
|
+
var appearance = lozenge.appearance || 'default';
|
|
35
36
|
return /*#__PURE__*/_react.default.createElement(_styled.LozengeWrapper, null, /*#__PURE__*/_react.default.createElement(_lozenge.default, {
|
|
36
37
|
testId: "inline-card-resolved-view-lozenge",
|
|
37
|
-
appearance:
|
|
38
|
+
appearance: appearance,
|
|
39
|
+
style: lozenge.style,
|
|
38
40
|
isBold: lozenge.isBold
|
|
39
41
|
}, lozenge.text));
|
|
40
42
|
}
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "26.
|
|
20
|
+
packageVersion: "26.59.0",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -28,6 +28,17 @@ export const extractIcon = (jsonLd, priority = 'type') => {
|
|
|
28
28
|
return extractIconByType(type, opts);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Extracts an icon based on the given type.
|
|
34
|
+
*
|
|
35
|
+
* Some types return hardcoded icons, while others follow a priority list on how to pick the icon.
|
|
36
|
+
* If type is not recognized, it will return the icon from the provider, or `undefined` if no icon is found.
|
|
37
|
+
*
|
|
38
|
+
* @param type - The type of the object.
|
|
39
|
+
* @param opts - Options for the icon extraction.
|
|
40
|
+
* @returns The extracted icon as a React node, or `undefined` if no icon is found.
|
|
41
|
+
*/
|
|
31
42
|
const extractIconByType = (type, opts) => {
|
|
32
43
|
switch (type) {
|
|
33
44
|
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,31 @@ 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 const extractIconFromDocument = (type, opts) => {
|
|
19
|
+
const {
|
|
20
|
+
provider
|
|
21
|
+
} = opts;
|
|
10
22
|
const iconFromType = documentTypeToIcon(type, opts);
|
|
11
23
|
const iconFromFileFormat = documentFileFormatToIcon(opts);
|
|
12
24
|
const iconFromProvider = opts.provider && opts.provider.icon;
|
|
25
|
+
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
26
|
+
const providerId = provider === null || provider === void 0 ? void 0 : provider.id;
|
|
27
|
+
return prioritiseIcon({
|
|
28
|
+
providerId,
|
|
29
|
+
fileFormatIcon: iconFromFileFormat,
|
|
30
|
+
documentTypeIcon: iconFromType,
|
|
31
|
+
urlIcon: opts.icon,
|
|
32
|
+
providerIcon: iconFromProvider
|
|
33
|
+
});
|
|
34
|
+
}
|
|
13
35
|
// If we encounter a native provider, we privilege the
|
|
14
36
|
// icon generated by its type. Otherwise, we privilege the
|
|
15
37
|
// 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 const extractIconFromTask = opts => {
|
|
14
23
|
// Render Atlaskit icons for all supported Jira issue types.
|
|
15
24
|
const {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
2
|
+
const isConfluenceProvider = provider => provider === CONFLUENCE_GENERATOR_ID;
|
|
3
|
+
const isJiraProvider = provider => provider === JIRA_GENERATOR_ID;
|
|
4
|
+
const isNativeProvider = provider => isConfluenceProvider(provider) || isJiraProvider(provider);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents an icon. Should either contain a label and url, or a an icon type and label.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Options required to prioritise which icon to show
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Reusable priority function for choosing which icon to show.
|
|
16
|
+
* Generic so it can be used to prioritise strings, or React components depending on the usage.
|
|
17
|
+
*/
|
|
18
|
+
export function prioritiseIcon({
|
|
19
|
+
providerId,
|
|
20
|
+
fileFormatIcon,
|
|
21
|
+
documentTypeIcon,
|
|
22
|
+
urlIcon,
|
|
23
|
+
providerIcon
|
|
24
|
+
}) {
|
|
25
|
+
if (isNativeProvider(providerId)) {
|
|
26
|
+
return fileFormatIcon || documentTypeIcon || urlIcon || providerIcon;
|
|
27
|
+
}
|
|
28
|
+
return urlIcon || fileFormatIcon || documentTypeIcon || providerIcon;
|
|
29
|
+
}
|
|
@@ -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
|
+
const 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 const extractState = jsonLd => {
|
|
3
47
|
const state = jsonLd['atlassian:state'];
|
|
4
48
|
if (state) {
|
|
@@ -10,18 +54,13 @@ export const 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
|
+
const 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
|
const extractTask = (data, label) => {
|
|
12
14
|
const {
|
|
13
15
|
id,
|
|
@@ -30,6 +32,10 @@ const extractType = jsonLd => {
|
|
|
30
32
|
const isConfluenceProvider = provider => provider === CONFLUENCE_GENERATOR_ID;
|
|
31
33
|
const isJiraProvider = provider => provider === JIRA_GENERATOR_ID;
|
|
32
34
|
const isNativeProvider = provider => isConfluenceProvider(provider) || isJiraProvider(provider);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Return the icon object given a JSON-LD data object.
|
|
38
|
+
*/
|
|
33
39
|
const extractJsonldDataIcon = data => {
|
|
34
40
|
const generator = data.generator;
|
|
35
41
|
const label = extractTitle(data);
|
|
@@ -54,6 +60,15 @@ const extractJsonldDataIcon = data => {
|
|
|
54
60
|
const fileFormat = documentData === null || documentData === void 0 ? void 0 : documentData['schema:fileFormat'];
|
|
55
61
|
const fileFormatIcon = extractFileFormatIcon(fileFormat);
|
|
56
62
|
const documentTypeIcon = extractDocumentTypeIcon(type, label);
|
|
63
|
+
if (getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour')) {
|
|
64
|
+
return prioritiseIcon({
|
|
65
|
+
providerId: provider,
|
|
66
|
+
fileFormatIcon,
|
|
67
|
+
documentTypeIcon,
|
|
68
|
+
urlIcon,
|
|
69
|
+
providerIcon
|
|
70
|
+
});
|
|
71
|
+
}
|
|
57
72
|
return isNativeProvider(provider) ? fileFormatIcon || documentTypeIcon || urlIcon || providerIcon : providerIcon || fileFormatIcon || documentTypeIcon;
|
|
58
73
|
case 'atlassian:Task':
|
|
59
74
|
const taskLabel = label || 'Task';
|