@atlaskit/smart-card 17.2.1 → 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 +28 -0
- package/dist/cjs/constants.js +16 -1
- 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 +5 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +17 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +27 -7
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +24 -2
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -4
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +6 -2
- package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +6 -2
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +64 -39
- package/dist/es2019/constants.js +15 -1
- 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 +5 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +17 -3
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +38 -6
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +28 -2
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -4
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +5 -3
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +66 -37
- package/dist/esm/constants.js +15 -1
- 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 +5 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +17 -3
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +25 -7
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +24 -2
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -4
- package/dist/esm/view/FlexibleCard/components/elements/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/elements/text/index.js +7 -2
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +64 -39
- package/dist/types/__fixtures__/flexible-ui-data-context.d.ts +3 -0
- package/dist/types/constants.d.ts +3 -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 +4 -2
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +4 -2
- package/dist/types/view/FlexibleCard/components/elements/avatar-group/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/elements/avatar-group/types.d.ts +1 -2
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -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 {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractLink, extractTitle } from '../common/primitives';
|
|
1
|
+
import { extractLink, extractSummary, extractTitle } from '../common/primitives';
|
|
2
2
|
import { extractLozenge } from '../common/lozenge';
|
|
3
3
|
import { extractLinkIcon } from './icon';
|
|
4
4
|
import { extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount } from './utils';
|
|
@@ -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) {
|
|
@@ -26,9 +27,12 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
|
|
|
26
27
|
modifiedOn: extractDateUpdated(data),
|
|
27
28
|
priority: extractPriority(data),
|
|
28
29
|
programmingLanguage: extractProgrammingLanguage(data),
|
|
30
|
+
snippet: extractSummary(data) || undefined,
|
|
31
|
+
// Explicitly set here to remove an empty string
|
|
29
32
|
state: extractLozenge(data),
|
|
30
33
|
subscriberCount: extractSubscriberCount(data),
|
|
31
34
|
title: extractTitle(data) || url,
|
|
35
|
+
provider: extractProviderIcon(data),
|
|
32
36
|
url: url
|
|
33
37
|
};
|
|
34
38
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -19,18 +19,32 @@ var getElementGroupStyles = function getElementGroupStyles(size, maxLines) {
|
|
|
19
19
|
// MetadataBlock allows metadata elements to be displayed in
|
|
20
20
|
// multiple lines, with maximum of 2 lines.
|
|
21
21
|
// a) We need the height of the line to be equal on both left and right
|
|
22
|
-
// sides so they line up nicely.
|
|
23
|
-
// all elements in specific size. This height belongs to AvatarGroup.
|
|
22
|
+
// sides so they line up nicely.
|
|
24
23
|
// b) There is no way to truncate non-text elements nicely. Here
|
|
25
24
|
// it's fix max height of the element group so that anything that is
|
|
26
25
|
// overflown will not be visible.
|
|
27
|
-
var lineHeight =
|
|
26
|
+
var lineHeight = getLineHeight(size);
|
|
28
27
|
var gap = getGapSize(size);
|
|
29
28
|
var gapHeight = gap * (maxLines - 1);
|
|
30
29
|
var height = lineHeight * maxLines + gapHeight;
|
|
31
30
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex-wrap: wrap;\n line-height: ", "rem;\n max-height: ", "rem;\n > span,\n > div {\n min-height: ", "rem;\n max-height: ", "rem;\n line-height: ", "rem;\n }\n "])), lineHeight, height, lineHeight, lineHeight, lineHeight);
|
|
32
31
|
};
|
|
33
32
|
|
|
33
|
+
var getLineHeight = function getLineHeight(size) {
|
|
34
|
+
// The maximum height of all elements in specific size.
|
|
35
|
+
// These heights belongs to AvatarGroup.
|
|
36
|
+
switch (size) {
|
|
37
|
+
case SmartLinkSize.XLarge:
|
|
38
|
+
case SmartLinkSize.Large:
|
|
39
|
+
return 1.75;
|
|
40
|
+
|
|
41
|
+
case SmartLinkSize.Medium:
|
|
42
|
+
case SmartLinkSize.Small:
|
|
43
|
+
default:
|
|
44
|
+
return 1.5;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
34
48
|
var getMaxLines = function getMaxLines(maxLines) {
|
|
35
49
|
if (maxLines > MAXIMUM_MAX_LINES) {
|
|
36
50
|
return DEFAULT_MAX_LINES;
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
6
|
var _excluded = ["name"],
|
|
6
7
|
_excluded2 = ["name"];
|
|
7
8
|
|
|
8
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
9
|
+
var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3;
|
|
9
10
|
|
|
10
11
|
import React from 'react';
|
|
11
12
|
import { css } from '@emotion/core';
|
|
12
|
-
import { SmartLinkDirection, SmartLinkSize } from '../../../../constants';
|
|
13
|
+
import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
|
|
13
14
|
import * as Elements from '../elements';
|
|
14
15
|
import * as Actions from '../actions';
|
|
15
16
|
import { isFlexibleUiElement } from '../../../../utils/flexible';
|
|
16
17
|
import ActionGroup from './action-group';
|
|
17
|
-
import ElementGroup from './element-group';
|
|
18
|
+
import ElementGroup from './element-group'; // Determine whether the element can be display as inline/block.
|
|
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']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _ElementDisplaySchema);
|
|
18
21
|
|
|
19
22
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
20
23
|
switch (direction) {
|
|
@@ -51,6 +54,16 @@ var isActionGroup = function isActionGroup(node) {
|
|
|
51
54
|
return /*#__PURE__*/React.isValidElement(node) && node.type === ActionGroup;
|
|
52
55
|
};
|
|
53
56
|
|
|
57
|
+
var isElementDisplayValid = function isElementDisplayValid(name, display) {
|
|
58
|
+
var _ElementDisplaySchema2, _ElementDisplaySchema3;
|
|
59
|
+
|
|
60
|
+
return (_ElementDisplaySchema2 = (_ElementDisplaySchema3 = ElementDisplaySchema[name]) === null || _ElementDisplaySchema3 === void 0 ? void 0 : _ElementDisplaySchema3.includes(display)) !== null && _ElementDisplaySchema2 !== void 0 ? _ElementDisplaySchema2 : false;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
var isElementNull = function isElementNull(children) {
|
|
64
|
+
return Boolean(children.type() === null);
|
|
65
|
+
};
|
|
66
|
+
|
|
54
67
|
var isElementOrElementGroup = function isElementOrElementGroup(node) {
|
|
55
68
|
return /*#__PURE__*/React.isValidElement(node) && (isFlexibleUiElement(node) || node.type === ElementGroup);
|
|
56
69
|
};
|
|
@@ -70,16 +83,21 @@ export var renderChildren = function renderChildren(children, size) {
|
|
|
70
83
|
};
|
|
71
84
|
export var renderElementItems = function renderElementItems() {
|
|
72
85
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
86
|
+
var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inline';
|
|
73
87
|
var elements = items.reduce(function (acc, curr, idx) {
|
|
74
88
|
var name = curr.name,
|
|
75
89
|
props = _objectWithoutProperties(curr, _excluded);
|
|
76
90
|
|
|
77
91
|
var Element = Elements[name];
|
|
78
92
|
|
|
79
|
-
if (Element) {
|
|
80
|
-
|
|
93
|
+
if (Element && isElementDisplayValid(name, display)) {
|
|
94
|
+
var element = /*#__PURE__*/React.createElement(Element, _extends({
|
|
81
95
|
key: idx
|
|
82
|
-
}, props))
|
|
96
|
+
}, props));
|
|
97
|
+
|
|
98
|
+
if (!isElementNull(element)) {
|
|
99
|
+
return [].concat(_toConsumableArray(acc), [element]);
|
|
100
|
+
}
|
|
83
101
|
}
|
|
84
102
|
|
|
85
103
|
return acc;
|
|
@@ -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,
|