@atlaskit/smart-card 17.3.2 → 17.4.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 +6 -0
- package/dist/cjs/constants.js +1 -0
- package/dist/cjs/extractors/flexible/icon/extract-document-type-icon.js +28 -7
- package/dist/cjs/extractors/flexible/icon/extract-file-formatIcon.js +88 -22
- package/dist/cjs/extractors/flexible/icon/extract-jira-task-icon.js +36 -9
- package/dist/cjs/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -9
- package/dist/cjs/extractors/flexible/icon/extract-provider-icon.js +20 -3
- package/dist/cjs/extractors/flexible/icon/extract-url-icon.js +4 -1
- package/dist/cjs/extractors/flexible/icon/index.js +11 -20
- package/dist/cjs/extractors/flexible/index.js +3 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -4
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +2 -0
- package/dist/es2019/constants.js +1 -0
- package/dist/es2019/extractors/flexible/icon/extract-document-type-icon.js +28 -7
- package/dist/es2019/extractors/flexible/icon/extract-file-formatIcon.js +88 -22
- package/dist/es2019/extractors/flexible/icon/extract-jira-task-icon.js +36 -9
- package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -9
- package/dist/es2019/extractors/flexible/icon/extract-provider-icon.js +19 -3
- package/dist/es2019/extractors/flexible/icon/extract-url-icon.js +4 -1
- package/dist/es2019/extractors/flexible/icon/index.js +6 -9
- package/dist/es2019/extractors/flexible/index.js +2 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -4
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +3 -0
- package/dist/esm/constants.js +1 -0
- package/dist/esm/extractors/flexible/icon/extract-document-type-icon.js +28 -7
- package/dist/esm/extractors/flexible/icon/extract-file-formatIcon.js +88 -22
- package/dist/esm/extractors/flexible/icon/extract-jira-task-icon.js +36 -9
- package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -9
- package/dist/esm/extractors/flexible/icon/extract-provider-icon.js +19 -3
- package/dist/esm/extractors/flexible/icon/extract-url-icon.js +4 -1
- package/dist/esm/extractors/flexible/icon/index.js +12 -20
- package/dist/esm/extractors/flexible/index.js +2 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -4
- package/dist/esm/view/FlexibleCard/components/elements/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +2 -0
- package/dist/types/__fixtures__/flexible-ui-data-context.d.ts +3 -0
- package/dist/types/constants.d.ts +2 -1
- package/dist/types/extractors/flexible/icon/extract-provider-icon.d.ts +1 -1
- package/dist/types/extractors/flexible/icon/index.d.ts +3 -3
- package/dist/types/extractors/flexible/icon/types.d.ts +5 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4,66 +4,111 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
4
4
|
switch (fileFormat) {
|
|
5
5
|
// Generic documents
|
|
6
6
|
case 'folder':
|
|
7
|
-
return
|
|
7
|
+
return {
|
|
8
|
+
icon: IconType.Folder,
|
|
9
|
+
label: 'Folder'
|
|
10
|
+
};
|
|
8
11
|
|
|
9
12
|
case 'text/plain':
|
|
10
13
|
case 'application/vnd.oasis.opendocument.text':
|
|
11
14
|
case 'application/vnd.apple.pages':
|
|
12
|
-
return
|
|
15
|
+
return {
|
|
16
|
+
icon: IconType.Document,
|
|
17
|
+
label: 'Document'
|
|
18
|
+
};
|
|
13
19
|
|
|
14
20
|
case 'application/pdf':
|
|
15
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
icon: IconType.PDF,
|
|
23
|
+
label: 'PDF document'
|
|
24
|
+
};
|
|
16
25
|
|
|
17
26
|
case 'application/vnd.oasis.opendocument.presentation':
|
|
18
27
|
case 'application/vnd.apple.keynote':
|
|
19
|
-
return
|
|
28
|
+
return {
|
|
29
|
+
icon: IconType.Presentation,
|
|
30
|
+
label: 'Presentation'
|
|
31
|
+
};
|
|
20
32
|
|
|
21
33
|
case 'application/vnd.oasis.opendocument.spreadsheet':
|
|
22
34
|
case 'application/vnd.apple.numbers':
|
|
23
|
-
return
|
|
35
|
+
return {
|
|
36
|
+
icon: IconType.Spreadsheet,
|
|
37
|
+
label: 'Spreadsheet'
|
|
38
|
+
};
|
|
24
39
|
// Google Drive
|
|
25
40
|
|
|
26
41
|
case 'application/vnd.google-apps.document':
|
|
27
|
-
return
|
|
42
|
+
return {
|
|
43
|
+
icon: IconType.GoogleDocs,
|
|
44
|
+
label: 'Google Docs'
|
|
45
|
+
};
|
|
28
46
|
|
|
29
47
|
case 'application/vnd.google-apps.form':
|
|
30
|
-
return
|
|
48
|
+
return {
|
|
49
|
+
icon: IconType.GoogleForms,
|
|
50
|
+
label: 'Google Form'
|
|
51
|
+
};
|
|
31
52
|
|
|
32
53
|
case 'application/vnd.google-apps.spreadsheet':
|
|
33
|
-
return
|
|
54
|
+
return {
|
|
55
|
+
icon: IconType.GoogleSheets,
|
|
56
|
+
label: 'Google Sheets'
|
|
57
|
+
};
|
|
34
58
|
|
|
35
59
|
case 'application/vnd.google-apps.presentation':
|
|
36
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
icon: IconType.GoogleSlides,
|
|
62
|
+
label: 'Google Slides'
|
|
63
|
+
};
|
|
37
64
|
// Microsoft
|
|
38
65
|
|
|
39
66
|
case 'application/vnd.ms-excel':
|
|
40
67
|
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
|
41
|
-
return
|
|
68
|
+
return {
|
|
69
|
+
icon: IconType.MSExcel,
|
|
70
|
+
label: 'Excel spreadsheet'
|
|
71
|
+
};
|
|
42
72
|
|
|
43
73
|
case 'application/vnd.ms-powerpoint':
|
|
44
74
|
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
|
45
|
-
return
|
|
75
|
+
return {
|
|
76
|
+
icon: IconType.MSPowerpoint,
|
|
77
|
+
label: 'PowerPoint presentation'
|
|
78
|
+
};
|
|
46
79
|
|
|
47
80
|
case 'application/msword':
|
|
48
81
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
49
|
-
return
|
|
82
|
+
return {
|
|
83
|
+
icon: IconType.MSWord,
|
|
84
|
+
label: 'Word document'
|
|
85
|
+
};
|
|
50
86
|
|
|
51
87
|
case 'image/png':
|
|
52
88
|
case 'image/jpeg':
|
|
53
89
|
case 'image/bmp':
|
|
54
90
|
case 'image/webp':
|
|
55
91
|
case 'image/svg+xml':
|
|
56
|
-
return
|
|
92
|
+
return {
|
|
93
|
+
icon: IconType.Image,
|
|
94
|
+
label: 'Image'
|
|
95
|
+
};
|
|
57
96
|
|
|
58
97
|
case 'image/gif':
|
|
59
|
-
return
|
|
98
|
+
return {
|
|
99
|
+
icon: IconType.GIF,
|
|
100
|
+
label: 'GIF'
|
|
101
|
+
};
|
|
60
102
|
|
|
61
103
|
case 'audio/midi':
|
|
62
104
|
case 'audio/mpeg':
|
|
63
105
|
case 'audio/webm':
|
|
64
106
|
case 'audio/ogg':
|
|
65
107
|
case 'audio/wav':
|
|
66
|
-
return
|
|
108
|
+
return {
|
|
109
|
+
icon: IconType.Audio,
|
|
110
|
+
label: 'Audio'
|
|
111
|
+
};
|
|
67
112
|
|
|
68
113
|
case 'video/mp4':
|
|
69
114
|
case 'video/quicktime':
|
|
@@ -72,13 +117,19 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
72
117
|
case 'video/ogg':
|
|
73
118
|
case 'video/x-ms-wmv':
|
|
74
119
|
case 'video/x-msvideo':
|
|
75
|
-
return
|
|
120
|
+
return {
|
|
121
|
+
icon: IconType.Video,
|
|
122
|
+
label: 'Video'
|
|
123
|
+
};
|
|
76
124
|
// Others
|
|
77
125
|
|
|
78
126
|
case 'text/css':
|
|
79
127
|
case 'text/html':
|
|
80
128
|
case 'application/javascript':
|
|
81
|
-
return
|
|
129
|
+
return {
|
|
130
|
+
icon: IconType.Code,
|
|
131
|
+
label: 'Source Code'
|
|
132
|
+
};
|
|
82
133
|
|
|
83
134
|
case 'application/zip':
|
|
84
135
|
case 'application/x-tar':
|
|
@@ -86,19 +137,34 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
86
137
|
case 'application/x-7z-compressed':
|
|
87
138
|
case 'application/x-apple-diskimage':
|
|
88
139
|
case 'application/vnd.rar':
|
|
89
|
-
return
|
|
140
|
+
return {
|
|
141
|
+
icon: IconType.Archive,
|
|
142
|
+
label: 'Archive'
|
|
143
|
+
};
|
|
90
144
|
|
|
91
145
|
case 'application/dmg':
|
|
92
|
-
return
|
|
146
|
+
return {
|
|
147
|
+
icon: IconType.Executable,
|
|
148
|
+
label: 'Executable'
|
|
149
|
+
};
|
|
93
150
|
|
|
94
151
|
case 'application/sketch':
|
|
95
|
-
return
|
|
152
|
+
return {
|
|
153
|
+
icon: IconType.Sketch,
|
|
154
|
+
label: 'Sketch'
|
|
155
|
+
};
|
|
96
156
|
|
|
97
157
|
case 'application/octet-stream':
|
|
98
|
-
return
|
|
158
|
+
return {
|
|
159
|
+
icon: IconType.Generic,
|
|
160
|
+
label: 'Binary file'
|
|
161
|
+
};
|
|
99
162
|
|
|
100
163
|
case 'application/invision.prototype':
|
|
101
|
-
return
|
|
164
|
+
return {
|
|
165
|
+
icon: IconType.Generic,
|
|
166
|
+
label: 'Prototype'
|
|
167
|
+
};
|
|
102
168
|
|
|
103
169
|
default:
|
|
104
170
|
return undefined;
|
|
@@ -5,32 +5,59 @@ var extractJiraTaskIcon = function extractJiraTaskIcon(taskType) {
|
|
|
5
5
|
|
|
6
6
|
switch (taskType) {
|
|
7
7
|
case 'JiraBug':
|
|
8
|
-
return
|
|
8
|
+
return {
|
|
9
|
+
icon: IconType.Bug,
|
|
10
|
+
label: label
|
|
11
|
+
};
|
|
9
12
|
|
|
10
13
|
case 'JiraChange':
|
|
11
|
-
return
|
|
14
|
+
return {
|
|
15
|
+
icon: IconType.Change,
|
|
16
|
+
label: label
|
|
17
|
+
};
|
|
12
18
|
|
|
13
19
|
case 'JiraEpic':
|
|
14
|
-
return
|
|
20
|
+
return {
|
|
21
|
+
icon: IconType.Epic,
|
|
22
|
+
label: label
|
|
23
|
+
};
|
|
15
24
|
|
|
16
25
|
case 'JiraIncident':
|
|
17
|
-
return
|
|
26
|
+
return {
|
|
27
|
+
icon: IconType.Incident,
|
|
28
|
+
label: label
|
|
29
|
+
};
|
|
18
30
|
|
|
19
31
|
case 'JiraProblem':
|
|
20
|
-
return
|
|
32
|
+
return {
|
|
33
|
+
icon: IconType.Problem,
|
|
34
|
+
label: label
|
|
35
|
+
};
|
|
21
36
|
|
|
22
37
|
case 'JiraServiceRequest':
|
|
23
|
-
return
|
|
38
|
+
return {
|
|
39
|
+
icon: IconType.ServiceRequest,
|
|
40
|
+
label: label
|
|
41
|
+
};
|
|
24
42
|
|
|
25
43
|
case 'JiraStory':
|
|
26
|
-
return
|
|
44
|
+
return {
|
|
45
|
+
icon: IconType.Story,
|
|
46
|
+
label: label
|
|
47
|
+
};
|
|
27
48
|
|
|
28
49
|
case 'JiraSubTask':
|
|
29
|
-
return
|
|
50
|
+
return {
|
|
51
|
+
icon: IconType.SubTask,
|
|
52
|
+
label: label
|
|
53
|
+
};
|
|
30
54
|
|
|
31
55
|
case 'JiraTask':
|
|
32
56
|
default:
|
|
33
|
-
return
|
|
57
|
+
return {
|
|
58
|
+
icon: IconType.Task,
|
|
59
|
+
label: label
|
|
60
|
+
};
|
|
34
61
|
}
|
|
35
62
|
};
|
|
36
63
|
|
|
@@ -15,7 +15,10 @@ var extractTask = function extractTask(data, label) {
|
|
|
15
15
|
url = _ref.icon;
|
|
16
16
|
|
|
17
17
|
var taskType = id === null || id === void 0 ? void 0 : id.split('#').pop();
|
|
18
|
-
var taskIcon = url ?
|
|
18
|
+
var taskIcon = url ? {
|
|
19
|
+
label: label,
|
|
20
|
+
url: url
|
|
21
|
+
} : undefined;
|
|
19
22
|
return {
|
|
20
23
|
taskType: taskType,
|
|
21
24
|
taskIcon: taskIcon
|
|
@@ -47,7 +50,7 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
|
47
50
|
var type = extractType(data);
|
|
48
51
|
var urlIcon = extractUrlIcon(data.icon, label);
|
|
49
52
|
var provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
|
|
50
|
-
var providerIcon = extractProviderIcon(
|
|
53
|
+
var providerIcon = extractProviderIcon(data);
|
|
51
54
|
|
|
52
55
|
switch (type) {
|
|
53
56
|
case 'Document':
|
|
@@ -76,25 +79,46 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
|
76
79
|
taskType = _extractTask.taskType,
|
|
77
80
|
taskIcon = _extractTask.taskIcon;
|
|
78
81
|
|
|
79
|
-
return taskType === 'JiraCustomTaskType' ? taskIcon || urlIcon || providerIcon ||
|
|
82
|
+
return taskType === 'JiraCustomTaskType' ? taskIcon || urlIcon || providerIcon || {
|
|
83
|
+
icon: IconType.Task,
|
|
84
|
+
label: taskLabel
|
|
85
|
+
} : extractJiraTaskIcon(taskType, taskLabel);
|
|
80
86
|
}
|
|
81
87
|
|
|
82
|
-
return
|
|
88
|
+
return {
|
|
89
|
+
icon: IconType.Task,
|
|
90
|
+
label: taskLabel
|
|
91
|
+
};
|
|
83
92
|
|
|
84
93
|
case 'atlassian:Project':
|
|
85
|
-
return urlIcon ||
|
|
94
|
+
return urlIcon || {
|
|
95
|
+
icon: IconType.Project,
|
|
96
|
+
label: label || 'Project'
|
|
97
|
+
};
|
|
86
98
|
|
|
87
99
|
case 'atlassian:SourceCodeCommit':
|
|
88
|
-
return
|
|
100
|
+
return {
|
|
101
|
+
icon: IconType.Commit,
|
|
102
|
+
label: label || 'Commit'
|
|
103
|
+
};
|
|
89
104
|
|
|
90
105
|
case 'atlassian:SourceCodePullRequest':
|
|
91
|
-
return
|
|
106
|
+
return {
|
|
107
|
+
icon: IconType.PullRequest,
|
|
108
|
+
label: label || 'Pull request'
|
|
109
|
+
};
|
|
92
110
|
|
|
93
111
|
case 'atlassian:SourceCodeReference':
|
|
94
|
-
return
|
|
112
|
+
return {
|
|
113
|
+
icon: IconType.Branch,
|
|
114
|
+
label: label || 'Reference'
|
|
115
|
+
};
|
|
95
116
|
|
|
96
117
|
case 'atlassian:SourceCodeRepository':
|
|
97
|
-
return
|
|
118
|
+
return {
|
|
119
|
+
icon: IconType.Repo,
|
|
120
|
+
label: label || 'Repository'
|
|
121
|
+
};
|
|
98
122
|
|
|
99
123
|
default:
|
|
100
124
|
return providerIcon;
|
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
2
2
|
import { IconType } from '../../../constants';
|
|
3
3
|
import extractUrlIcon from './extract-url-icon';
|
|
4
|
+
import { extractTitle } from '../../common/primitives';
|
|
5
|
+
|
|
6
|
+
var extractProviderIcon = function extractProviderIcon(data) {
|
|
7
|
+
if (!data) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var generator = data.generator;
|
|
12
|
+
var provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
|
|
13
|
+
var icon = generator === null || generator === void 0 ? void 0 : generator.icon;
|
|
14
|
+
var label = (generator === null || generator === void 0 ? void 0 : generator.name) || extractTitle(data);
|
|
4
15
|
|
|
5
|
-
var extractProviderIcon = function extractProviderIcon(provider, icon, label) {
|
|
6
16
|
if (provider === CONFLUENCE_GENERATOR_ID) {
|
|
7
|
-
return
|
|
17
|
+
return {
|
|
18
|
+
icon: IconType.Confluence,
|
|
19
|
+
label: label || 'Confluence'
|
|
20
|
+
};
|
|
8
21
|
}
|
|
9
22
|
|
|
10
23
|
if (provider === JIRA_GENERATOR_ID) {
|
|
11
|
-
return
|
|
24
|
+
return {
|
|
25
|
+
icon: IconType.Jira,
|
|
26
|
+
label: label || 'Jira'
|
|
27
|
+
};
|
|
12
28
|
}
|
|
13
29
|
|
|
14
30
|
return extractUrlIcon(icon, label);
|
|
@@ -2,7 +2,10 @@ import { extractUrlFromIconJsonLd } from '../../common/utils';
|
|
|
2
2
|
|
|
3
3
|
var extractUrlIcon = function extractUrlIcon(icon, label) {
|
|
4
4
|
var url = icon && extractUrlFromIconJsonLd(icon);
|
|
5
|
-
return url ?
|
|
5
|
+
return url ? {
|
|
6
|
+
label: label,
|
|
7
|
+
url: url
|
|
8
|
+
} : undefined;
|
|
6
9
|
};
|
|
7
10
|
|
|
8
11
|
export default extractUrlIcon;
|
|
@@ -1,36 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
|
|
2
7
|
import extractJsonldDataIcon from './extract-jsonld-data-icon';
|
|
3
8
|
import extractProviderIcon from './extract-provider-icon';
|
|
4
9
|
import { IconType, SmartLinkStatus } from '../../../constants';
|
|
5
10
|
import extractIconRenderer from './extract-icon-renderer';
|
|
6
11
|
export var extractLinkIcon = function extractLinkIcon(response, renderers) {
|
|
7
12
|
var data = response.data;
|
|
8
|
-
|
|
9
|
-
var _ref = extractJsonldDataIcon(data) || [],
|
|
10
|
-
_ref2 = _slicedToArray(_ref, 3),
|
|
11
|
-
icon = _ref2[0],
|
|
12
|
-
label = _ref2[1],
|
|
13
|
-
url = _ref2[2];
|
|
14
|
-
|
|
15
13
|
var render = extractIconRenderer(data, renderers);
|
|
16
|
-
return {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
render: render,
|
|
20
|
-
url: url
|
|
21
|
-
};
|
|
14
|
+
return _objectSpread(_objectSpread({}, extractJsonldDataIcon(data)), {}, {
|
|
15
|
+
render: render
|
|
16
|
+
});
|
|
22
17
|
};
|
|
23
18
|
export var extractErrorIcon = function extractErrorIcon(response, status) {
|
|
24
19
|
// Try to get provider icon first.
|
|
25
20
|
if (response) {
|
|
26
21
|
var data = response.data;
|
|
27
|
-
var generator = data.generator;
|
|
28
|
-
var provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
|
|
29
22
|
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
url = _ref4[2];
|
|
23
|
+
var _ref = extractProviderIcon(data) || {},
|
|
24
|
+
icon = _ref.icon,
|
|
25
|
+
url = _ref.url;
|
|
34
26
|
|
|
35
27
|
if (icon || url) {
|
|
36
28
|
return {
|
|
@@ -7,6 +7,7 @@ import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
|
7
7
|
import { extractDateUpdated } from '../common/date/extractDateUpdated';
|
|
8
8
|
import { extractDateCreated } from '../common/date/extractDateCreated';
|
|
9
9
|
import extractPriority from './extract-priority';
|
|
10
|
+
import extractProviderIcon from './icon/extract-provider-icon';
|
|
10
11
|
|
|
11
12
|
var extractFlexibleUiContext = function extractFlexibleUiContext(response, renderers) {
|
|
12
13
|
if (!response) {
|
|
@@ -31,6 +32,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
|
|
|
31
32
|
state: extractLozenge(data),
|
|
32
33
|
subscriberCount: extractSubscriberCount(data),
|
|
33
34
|
title: extractTitle(data) || url,
|
|
35
|
+
provider: extractProviderIcon(data),
|
|
34
36
|
url: url
|
|
35
37
|
};
|
|
36
38
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -17,7 +17,7 @@ import { isFlexibleUiElement } from '../../../../utils/flexible';
|
|
|
17
17
|
import ActionGroup from './action-group';
|
|
18
18
|
import ElementGroup from './element-group'; // Determine whether the element can be display as inline/block.
|
|
19
19
|
|
|
20
|
-
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _ElementDisplaySchema);
|
|
20
|
+
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _ElementDisplaySchema);
|
|
21
21
|
|
|
22
22
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
23
23
|
switch (direction) {
|
|
@@ -281,6 +281,8 @@ var AtlaskitIcon = function AtlaskitIcon(_ref3) {
|
|
|
281
281
|
case IconType.Jira:
|
|
282
282
|
// Logo component has a different prop set from other icon components
|
|
283
283
|
return /*#__PURE__*/React.createElement(ImportedIcon, {
|
|
284
|
+
"data-testId": testId // Confluence and Jira imports don't have native testId prop
|
|
285
|
+
,
|
|
284
286
|
textColor: N700,
|
|
285
287
|
iconColor: B200,
|
|
286
288
|
iconGradientStart: B400,
|
|
@@ -17,7 +17,7 @@ var iconStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLite
|
|
|
17
17
|
var labelStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n padding-left: 0.125rem;\n"])), tokens.badgeText);
|
|
18
18
|
var messageMapper = (_messageMapper = {}, _defineProperty(_messageMapper, IconType.PriorityBlocker, messages.priority_blocker), _defineProperty(_messageMapper, IconType.PriorityCritical, messages.priority_critical), _defineProperty(_messageMapper, IconType.PriorityHigh, messages.priority_high), _defineProperty(_messageMapper, IconType.PriorityHighest, messages.priority_highest), _defineProperty(_messageMapper, IconType.PriorityLow, messages.priority_low), _defineProperty(_messageMapper, IconType.PriorityLowest, messages.priority_lowest), _defineProperty(_messageMapper, IconType.PriorityMajor, messages.priority_major), _defineProperty(_messageMapper, IconType.PriorityMedium, messages.priority_medium), _defineProperty(_messageMapper, IconType.PriorityMinor, messages.priority_minor), _defineProperty(_messageMapper, IconType.PriorityTrivial, messages.priority_trivial), _defineProperty(_messageMapper, IconType.PriorityUndefined, messages.priority_undefined), _messageMapper);
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var getFormattedMessageFromIcon = function getFormattedMessageFromIcon(icon) {
|
|
21
21
|
if (icon) {
|
|
22
22
|
var descriptor = messageMapper[icon];
|
|
23
23
|
|
|
@@ -27,8 +27,6 @@ var getFormattedMessageOrLabel = function getFormattedMessageOrLabel(icon, conte
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
return content;
|
|
32
30
|
};
|
|
33
31
|
|
|
34
32
|
var renderAtlaskitIcon = function renderAtlaskitIcon(icon, testId) {
|
|
@@ -56,7 +54,7 @@ var Badge = function Badge(_ref) {
|
|
|
56
54
|
label = _ref.label,
|
|
57
55
|
_ref$testId = _ref.testId,
|
|
58
56
|
testId = _ref$testId === void 0 ? 'smart-element-badge' : _ref$testId;
|
|
59
|
-
var formattedMessageOrLabel =
|
|
57
|
+
var formattedMessageOrLabel = getFormattedMessageFromIcon(icon) || label;
|
|
60
58
|
var badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId);
|
|
61
59
|
|
|
62
60
|
if (!formattedMessageOrLabel || !badgeIcon) {
|
|
@@ -16,4 +16,5 @@ export var ProgrammingLanguage = createElement(ElementName.ProgrammingLanguage);
|
|
|
16
16
|
export var Snippet = createElement(ElementName.Snippet);
|
|
17
17
|
export var State = createElement(ElementName.State);
|
|
18
18
|
export var SubscriberCount = createElement(ElementName.SubscriberCount);
|
|
19
|
-
export var Title = createElement(ElementName.Title);
|
|
19
|
+
export var Title = createElement(ElementName.Title);
|
|
20
|
+
export var Provider = createElement(ElementName.Provider);
|
|
@@ -54,6 +54,8 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
54
54
|
component: DateTime
|
|
55
55
|
}), _defineProperty(_elementMappings, ElementName.ModifiedOn, {
|
|
56
56
|
component: DateTime
|
|
57
|
+
}), _defineProperty(_elementMappings, ElementName.Provider, {
|
|
58
|
+
component: Badge
|
|
57
59
|
}), _elementMappings);
|
|
58
60
|
|
|
59
61
|
var getContextKey = function getContextKey(name) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
2
|
import { IconDescriptor } from './types';
|
|
3
|
-
declare const extractProviderIcon: (
|
|
3
|
+
declare const extractProviderIcon: (data?: JsonLd.Data.BaseData | undefined) => IconDescriptor | undefined;
|
|
4
4
|
export default extractProviderIcon;
|
|
@@ -3,10 +3,10 @@ import { JsonLd } from 'json-ld-types';
|
|
|
3
3
|
import { IconType, SmartLinkStatus } from '../../../constants';
|
|
4
4
|
import { CardProviderRenderers } from '../../../state/context/types';
|
|
5
5
|
export declare const extractLinkIcon: (response: JsonLd.Response, renderers?: CardProviderRenderers | undefined) => {
|
|
6
|
-
icon: IconType | undefined;
|
|
7
|
-
label: string | undefined;
|
|
8
6
|
render: (() => import("react").ReactNode) | undefined;
|
|
9
|
-
|
|
7
|
+
icon?: IconType | undefined;
|
|
8
|
+
label?: string | undefined;
|
|
9
|
+
url?: string | undefined;
|
|
10
10
|
};
|
|
11
11
|
export declare const extractErrorIcon: (response?: JsonLd.Response<JsonLd.Data.BaseData> | undefined, status?: SmartLinkStatus | undefined) => {
|
|
12
12
|
icon: IconType | undefined;
|
|
@@ -20,3 +20,4 @@ export declare const Snippet: import("react").FC<TextProps>;
|
|
|
20
20
|
export declare const State: import("react").FC<LozengeProps>;
|
|
21
21
|
export declare const SubscriberCount: import("react").FC<BadgeProps>;
|
|
22
22
|
export declare const Title: import("react").FC<LinkProps>;
|
|
23
|
+
export declare const Provider: import("react").FC<BadgeProps>;
|