@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
|
@@ -3,25 +3,46 @@ import { IconType } from '../../../constants';
|
|
|
3
3
|
const extractDocumentTypeIcon = (documentType, label) => {
|
|
4
4
|
switch (documentType) {
|
|
5
5
|
case 'schema:BlogPosting':
|
|
6
|
-
return
|
|
6
|
+
return {
|
|
7
|
+
icon: IconType.Blog,
|
|
8
|
+
label: label || 'Blog'
|
|
9
|
+
};
|
|
7
10
|
|
|
8
11
|
case 'schema:DigitalDocument':
|
|
9
|
-
return
|
|
12
|
+
return {
|
|
13
|
+
icon: IconType.File,
|
|
14
|
+
label: label || 'File'
|
|
15
|
+
};
|
|
10
16
|
|
|
11
17
|
case 'schema:TextDigitalDocument':
|
|
12
|
-
return
|
|
18
|
+
return {
|
|
19
|
+
icon: IconType.Document,
|
|
20
|
+
label: label || 'Document'
|
|
21
|
+
};
|
|
13
22
|
|
|
14
23
|
case 'schema:PresentationDigitalDocument':
|
|
15
|
-
return
|
|
24
|
+
return {
|
|
25
|
+
icon: IconType.Presentation,
|
|
26
|
+
label: label || 'Presentation'
|
|
27
|
+
};
|
|
16
28
|
|
|
17
29
|
case 'schema:SpreadsheetDigitalDocument':
|
|
18
|
-
return
|
|
30
|
+
return {
|
|
31
|
+
icon: IconType.Spreadsheet,
|
|
32
|
+
label: label || 'Spreadsheet'
|
|
33
|
+
};
|
|
19
34
|
|
|
20
35
|
case 'atlassian:Template':
|
|
21
|
-
return
|
|
36
|
+
return {
|
|
37
|
+
icon: IconType.Template,
|
|
38
|
+
label: label || 'Template'
|
|
39
|
+
};
|
|
22
40
|
|
|
23
41
|
case 'atlassian:UndefinedLink':
|
|
24
|
-
return
|
|
42
|
+
return {
|
|
43
|
+
icon: IconType.Document,
|
|
44
|
+
label: label || 'Undefined link'
|
|
45
|
+
};
|
|
25
46
|
|
|
26
47
|
default:
|
|
27
48
|
return undefined;
|
|
@@ -4,66 +4,111 @@ const 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 @@ const 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 @@ const 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;
|
|
@@ -3,32 +3,59 @@ import { IconType } from '../../../constants';
|
|
|
3
3
|
const extractJiraTaskIcon = (taskType, label = 'Task') => {
|
|
4
4
|
switch (taskType) {
|
|
5
5
|
case 'JiraBug':
|
|
6
|
-
return
|
|
6
|
+
return {
|
|
7
|
+
icon: IconType.Bug,
|
|
8
|
+
label
|
|
9
|
+
};
|
|
7
10
|
|
|
8
11
|
case 'JiraChange':
|
|
9
|
-
return
|
|
12
|
+
return {
|
|
13
|
+
icon: IconType.Change,
|
|
14
|
+
label
|
|
15
|
+
};
|
|
10
16
|
|
|
11
17
|
case 'JiraEpic':
|
|
12
|
-
return
|
|
18
|
+
return {
|
|
19
|
+
icon: IconType.Epic,
|
|
20
|
+
label
|
|
21
|
+
};
|
|
13
22
|
|
|
14
23
|
case 'JiraIncident':
|
|
15
|
-
return
|
|
24
|
+
return {
|
|
25
|
+
icon: IconType.Incident,
|
|
26
|
+
label
|
|
27
|
+
};
|
|
16
28
|
|
|
17
29
|
case 'JiraProblem':
|
|
18
|
-
return
|
|
30
|
+
return {
|
|
31
|
+
icon: IconType.Problem,
|
|
32
|
+
label
|
|
33
|
+
};
|
|
19
34
|
|
|
20
35
|
case 'JiraServiceRequest':
|
|
21
|
-
return
|
|
36
|
+
return {
|
|
37
|
+
icon: IconType.ServiceRequest,
|
|
38
|
+
label
|
|
39
|
+
};
|
|
22
40
|
|
|
23
41
|
case 'JiraStory':
|
|
24
|
-
return
|
|
42
|
+
return {
|
|
43
|
+
icon: IconType.Story,
|
|
44
|
+
label
|
|
45
|
+
};
|
|
25
46
|
|
|
26
47
|
case 'JiraSubTask':
|
|
27
|
-
return
|
|
48
|
+
return {
|
|
49
|
+
icon: IconType.SubTask,
|
|
50
|
+
label
|
|
51
|
+
};
|
|
28
52
|
|
|
29
53
|
case 'JiraTask':
|
|
30
54
|
default:
|
|
31
|
-
return
|
|
55
|
+
return {
|
|
56
|
+
icon: IconType.Task,
|
|
57
|
+
label
|
|
58
|
+
};
|
|
32
59
|
}
|
|
33
60
|
};
|
|
34
61
|
|
|
@@ -15,7 +15,10 @@ const extractTask = (data, label) => {
|
|
|
15
15
|
icon: url
|
|
16
16
|
} = extractTaskType(data) || {};
|
|
17
17
|
const taskType = id === null || id === void 0 ? void 0 : id.split('#').pop();
|
|
18
|
-
const taskIcon = url ?
|
|
18
|
+
const taskIcon = url ? {
|
|
19
|
+
label,
|
|
20
|
+
url
|
|
21
|
+
} : undefined;
|
|
19
22
|
return {
|
|
20
23
|
taskType,
|
|
21
24
|
taskIcon
|
|
@@ -39,7 +42,7 @@ const extractJsonldDataIcon = data => {
|
|
|
39
42
|
const type = extractType(data);
|
|
40
43
|
const urlIcon = extractUrlIcon(data.icon, label);
|
|
41
44
|
const provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
|
|
42
|
-
const providerIcon = extractProviderIcon(
|
|
45
|
+
const providerIcon = extractProviderIcon(data);
|
|
43
46
|
|
|
44
47
|
switch (type) {
|
|
45
48
|
case 'Document':
|
|
@@ -68,25 +71,46 @@ const extractJsonldDataIcon = data => {
|
|
|
68
71
|
taskType,
|
|
69
72
|
taskIcon
|
|
70
73
|
} = extractTask(data);
|
|
71
|
-
return taskType === 'JiraCustomTaskType' ? taskIcon || urlIcon || providerIcon ||
|
|
74
|
+
return taskType === 'JiraCustomTaskType' ? taskIcon || urlIcon || providerIcon || {
|
|
75
|
+
icon: IconType.Task,
|
|
76
|
+
label: taskLabel
|
|
77
|
+
} : extractJiraTaskIcon(taskType, taskLabel);
|
|
72
78
|
}
|
|
73
79
|
|
|
74
|
-
return
|
|
80
|
+
return {
|
|
81
|
+
icon: IconType.Task,
|
|
82
|
+
label: taskLabel
|
|
83
|
+
};
|
|
75
84
|
|
|
76
85
|
case 'atlassian:Project':
|
|
77
|
-
return urlIcon ||
|
|
86
|
+
return urlIcon || {
|
|
87
|
+
icon: IconType.Project,
|
|
88
|
+
label: label || 'Project'
|
|
89
|
+
};
|
|
78
90
|
|
|
79
91
|
case 'atlassian:SourceCodeCommit':
|
|
80
|
-
return
|
|
92
|
+
return {
|
|
93
|
+
icon: IconType.Commit,
|
|
94
|
+
label: label || 'Commit'
|
|
95
|
+
};
|
|
81
96
|
|
|
82
97
|
case 'atlassian:SourceCodePullRequest':
|
|
83
|
-
return
|
|
98
|
+
return {
|
|
99
|
+
icon: IconType.PullRequest,
|
|
100
|
+
label: label || 'Pull request'
|
|
101
|
+
};
|
|
84
102
|
|
|
85
103
|
case 'atlassian:SourceCodeReference':
|
|
86
|
-
return
|
|
104
|
+
return {
|
|
105
|
+
icon: IconType.Branch,
|
|
106
|
+
label: label || 'Reference'
|
|
107
|
+
};
|
|
87
108
|
|
|
88
109
|
case 'atlassian:SourceCodeRepository':
|
|
89
|
-
return
|
|
110
|
+
return {
|
|
111
|
+
icon: IconType.Repo,
|
|
112
|
+
label: label || 'Repository'
|
|
113
|
+
};
|
|
90
114
|
|
|
91
115
|
default:
|
|
92
116
|
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
|
+
const extractProviderIcon = data => {
|
|
7
|
+
if (!data) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const generator = data.generator;
|
|
12
|
+
const provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
|
|
13
|
+
const icon = generator === null || generator === void 0 ? void 0 : generator.icon;
|
|
14
|
+
const label = (generator === null || generator === void 0 ? void 0 : generator.name) || extractTitle(data);
|
|
4
15
|
|
|
5
|
-
const 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
|
const extractUrlIcon = (icon, label) => {
|
|
4
4
|
const url = icon && extractUrlFromIconJsonLd(icon);
|
|
5
|
-
return url ?
|
|
5
|
+
return url ? {
|
|
6
|
+
label,
|
|
7
|
+
url
|
|
8
|
+
} : undefined;
|
|
6
9
|
};
|
|
7
10
|
|
|
8
11
|
export default extractUrlIcon;
|
|
@@ -4,22 +4,19 @@ import { IconType, SmartLinkStatus } from '../../../constants';
|
|
|
4
4
|
import extractIconRenderer from './extract-icon-renderer';
|
|
5
5
|
export const extractLinkIcon = (response, renderers) => {
|
|
6
6
|
const data = response.data;
|
|
7
|
-
const [icon, label, url] = extractJsonldDataIcon(data) || [];
|
|
8
7
|
const render = extractIconRenderer(data, renderers);
|
|
9
|
-
return {
|
|
10
|
-
|
|
11
|
-
label,
|
|
12
|
-
render,
|
|
13
|
-
url
|
|
8
|
+
return { ...extractJsonldDataIcon(data),
|
|
9
|
+
render
|
|
14
10
|
};
|
|
15
11
|
};
|
|
16
12
|
export const extractErrorIcon = (response, status) => {
|
|
17
13
|
// Try to get provider icon first.
|
|
18
14
|
if (response) {
|
|
19
15
|
const data = response.data;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const {
|
|
17
|
+
icon,
|
|
18
|
+
url
|
|
19
|
+
} = extractProviderIcon(data) || {};
|
|
23
20
|
|
|
24
21
|
if (icon || url) {
|
|
25
22
|
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
|
const extractFlexibleUiContext = (response, renderers) => {
|
|
12
13
|
if (!response) {
|
|
@@ -31,6 +32,7 @@ const extractFlexibleUiContext = (response, renderers) => {
|
|
|
31
32
|
state: extractLozenge(data),
|
|
32
33
|
subscriberCount: extractSubscriberCount(data),
|
|
33
34
|
title: extractTitle(data) || url,
|
|
35
|
+
provider: extractProviderIcon(data),
|
|
34
36
|
url
|
|
35
37
|
};
|
|
36
38
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -22,7 +22,8 @@ export const ElementDisplaySchema = {
|
|
|
22
22
|
[ElementName.Snippet]: ['block'],
|
|
23
23
|
[ElementName.State]: ['inline'],
|
|
24
24
|
[ElementName.SubscriberCount]: ['inline'],
|
|
25
|
-
[ElementName.Title]: ['inline']
|
|
25
|
+
[ElementName.Title]: ['inline'],
|
|
26
|
+
[ElementName.Provider]: ['inline']
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
const getDirectionStyles = direction => {
|
|
@@ -217,6 +217,8 @@ const AtlaskitIcon = ({
|
|
|
217
217
|
case IconType.Jira:
|
|
218
218
|
// Logo component has a different prop set from other icon components
|
|
219
219
|
return /*#__PURE__*/React.createElement(ImportedIcon, {
|
|
220
|
+
"data-testId": testId // Confluence and Jira imports don't have native testId prop
|
|
221
|
+
,
|
|
220
222
|
textColor: N700,
|
|
221
223
|
iconColor: B200,
|
|
222
224
|
iconGradientStart: B400,
|
|
@@ -40,7 +40,7 @@ const messageMapper = {
|
|
|
40
40
|
[IconType.PriorityUndefined]: messages.priority_undefined
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const getFormattedMessageFromIcon = icon => {
|
|
44
44
|
if (icon) {
|
|
45
45
|
const descriptor = messageMapper[icon];
|
|
46
46
|
|
|
@@ -50,8 +50,6 @@ const getFormattedMessageOrLabel = (icon, content) => {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
return content;
|
|
55
53
|
};
|
|
56
54
|
|
|
57
55
|
const renderAtlaskitIcon = (icon, testId) => {
|
|
@@ -79,7 +77,7 @@ const Badge = ({
|
|
|
79
77
|
label,
|
|
80
78
|
testId = 'smart-element-badge'
|
|
81
79
|
}) => {
|
|
82
|
-
const formattedMessageOrLabel =
|
|
80
|
+
const formattedMessageOrLabel = getFormattedMessageFromIcon(icon) || label;
|
|
83
81
|
const badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId);
|
|
84
82
|
|
|
85
83
|
if (!formattedMessageOrLabel || !badgeIcon) {
|
|
@@ -16,4 +16,5 @@ export const ProgrammingLanguage = createElement(ElementName.ProgrammingLanguage
|
|
|
16
16
|
export const Snippet = createElement(ElementName.Snippet);
|
|
17
17
|
export const State = createElement(ElementName.State);
|
|
18
18
|
export const SubscriberCount = createElement(ElementName.SubscriberCount);
|
|
19
|
-
export const Title = createElement(ElementName.Title);
|
|
19
|
+
export const Title = createElement(ElementName.Title);
|
|
20
|
+
export const Provider = createElement(ElementName.Provider);
|
package/dist/esm/constants.js
CHANGED
|
@@ -3,25 +3,46 @@ import { IconType } from '../../../constants';
|
|
|
3
3
|
var extractDocumentTypeIcon = function extractDocumentTypeIcon(documentType, label) {
|
|
4
4
|
switch (documentType) {
|
|
5
5
|
case 'schema:BlogPosting':
|
|
6
|
-
return
|
|
6
|
+
return {
|
|
7
|
+
icon: IconType.Blog,
|
|
8
|
+
label: label || 'Blog'
|
|
9
|
+
};
|
|
7
10
|
|
|
8
11
|
case 'schema:DigitalDocument':
|
|
9
|
-
return
|
|
12
|
+
return {
|
|
13
|
+
icon: IconType.File,
|
|
14
|
+
label: label || 'File'
|
|
15
|
+
};
|
|
10
16
|
|
|
11
17
|
case 'schema:TextDigitalDocument':
|
|
12
|
-
return
|
|
18
|
+
return {
|
|
19
|
+
icon: IconType.Document,
|
|
20
|
+
label: label || 'Document'
|
|
21
|
+
};
|
|
13
22
|
|
|
14
23
|
case 'schema:PresentationDigitalDocument':
|
|
15
|
-
return
|
|
24
|
+
return {
|
|
25
|
+
icon: IconType.Presentation,
|
|
26
|
+
label: label || 'Presentation'
|
|
27
|
+
};
|
|
16
28
|
|
|
17
29
|
case 'schema:SpreadsheetDigitalDocument':
|
|
18
|
-
return
|
|
30
|
+
return {
|
|
31
|
+
icon: IconType.Spreadsheet,
|
|
32
|
+
label: label || 'Spreadsheet'
|
|
33
|
+
};
|
|
19
34
|
|
|
20
35
|
case 'atlassian:Template':
|
|
21
|
-
return
|
|
36
|
+
return {
|
|
37
|
+
icon: IconType.Template,
|
|
38
|
+
label: label || 'Template'
|
|
39
|
+
};
|
|
22
40
|
|
|
23
41
|
case 'atlassian:UndefinedLink':
|
|
24
|
-
return
|
|
42
|
+
return {
|
|
43
|
+
icon: IconType.Document,
|
|
44
|
+
label: label || 'Undefined link'
|
|
45
|
+
};
|
|
25
46
|
|
|
26
47
|
default:
|
|
27
48
|
return undefined;
|