@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 17.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`392b7d2b98f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/392b7d2b98f) - Add Provider element
|
|
8
|
+
|
|
9
|
+
## 17.3.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`02ed34221ef`](https://bitbucket.org/atlassian/atlassian-frontend/commits/02ed34221ef) - Flexible UI: Add Snippet element
|
|
14
|
+
|
|
15
|
+
## 17.3.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`66dc86e0331`](https://bitbucket.org/atlassian/atlassian-frontend/commits/66dc86e0331) - Flexible UI: Check for null element
|
|
20
|
+
|
|
21
|
+
## 17.3.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- [`dab29fc6697`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dab29fc6697) - [ux] Flexible UI: AvatarGroup sizing updated for small and medium size
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [`25408fac413`](https://bitbucket.org/atlassian/atlassian-frontend/commits/25408fac413) - Flexible UI: Add MetadataBlock example
|
|
30
|
+
|
|
3
31
|
## 17.2.1
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/cjs/constants.js
CHANGED
|
@@ -60,7 +60,20 @@ exports.SmartLinkTheme = SmartLinkTheme;
|
|
|
60
60
|
SmartLinkTheme["Link"] = "link";
|
|
61
61
|
})(SmartLinkTheme || (exports.SmartLinkTheme = SmartLinkTheme = {}));
|
|
62
62
|
|
|
63
|
-
var SmartLinkWidth;
|
|
63
|
+
var SmartLinkWidth; // When adding an element...
|
|
64
|
+
// 1) Create base element if it doesn't already existed.
|
|
65
|
+
// Base element are inside src/view/FlexibleCard/components/elements.
|
|
66
|
+
// E.g. Badge,DateTime, Icon, Lozenge, etc.
|
|
67
|
+
// 2) Update FlexibleUiContext with the new prop for data representing
|
|
68
|
+
// the element, preferably with the same name as the element itself.
|
|
69
|
+
// (src/state/flexible-ui-context/types.ts)
|
|
70
|
+
// 3) Update Flexible UI extractor (src/extractors/flexible/index.ts)
|
|
71
|
+
// 4) Set base element and data mapping.
|
|
72
|
+
// (src/view/FlexibleCard/components/elements/utils.tsx)
|
|
73
|
+
// 5) Create element. (src/view/FlexibleCard/components/elements/index.ts)
|
|
74
|
+
// 6) Update element ElementDisplaySchema for inline/block display
|
|
75
|
+
// (src/view/FlexibleCard/components/blocks/utils.tsx)
|
|
76
|
+
|
|
64
77
|
exports.SmartLinkWidth = SmartLinkWidth;
|
|
65
78
|
|
|
66
79
|
(function (SmartLinkWidth) {
|
|
@@ -82,9 +95,11 @@ exports.ElementName = ElementName;
|
|
|
82
95
|
ElementName["ModifiedOn"] = "ModifiedOn";
|
|
83
96
|
ElementName["Priority"] = "Priority";
|
|
84
97
|
ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
|
|
98
|
+
ElementName["Snippet"] = "Snippet";
|
|
85
99
|
ElementName["State"] = "State";
|
|
86
100
|
ElementName["SubscriberCount"] = "SubscriberCount";
|
|
87
101
|
ElementName["Title"] = "Title";
|
|
102
|
+
ElementName["Provider"] = "Provider";
|
|
88
103
|
})(ElementName || (exports.ElementName = ElementName = {}));
|
|
89
104
|
|
|
90
105
|
var ActionName;
|
|
@@ -10,25 +10,46 @@ var _constants = require("../../../constants");
|
|
|
10
10
|
var extractDocumentTypeIcon = function extractDocumentTypeIcon(documentType, label) {
|
|
11
11
|
switch (documentType) {
|
|
12
12
|
case 'schema:BlogPosting':
|
|
13
|
-
return
|
|
13
|
+
return {
|
|
14
|
+
icon: _constants.IconType.Blog,
|
|
15
|
+
label: label || 'Blog'
|
|
16
|
+
};
|
|
14
17
|
|
|
15
18
|
case 'schema:DigitalDocument':
|
|
16
|
-
return
|
|
19
|
+
return {
|
|
20
|
+
icon: _constants.IconType.File,
|
|
21
|
+
label: label || 'File'
|
|
22
|
+
};
|
|
17
23
|
|
|
18
24
|
case 'schema:TextDigitalDocument':
|
|
19
|
-
return
|
|
25
|
+
return {
|
|
26
|
+
icon: _constants.IconType.Document,
|
|
27
|
+
label: label || 'Document'
|
|
28
|
+
};
|
|
20
29
|
|
|
21
30
|
case 'schema:PresentationDigitalDocument':
|
|
22
|
-
return
|
|
31
|
+
return {
|
|
32
|
+
icon: _constants.IconType.Presentation,
|
|
33
|
+
label: label || 'Presentation'
|
|
34
|
+
};
|
|
23
35
|
|
|
24
36
|
case 'schema:SpreadsheetDigitalDocument':
|
|
25
|
-
return
|
|
37
|
+
return {
|
|
38
|
+
icon: _constants.IconType.Spreadsheet,
|
|
39
|
+
label: label || 'Spreadsheet'
|
|
40
|
+
};
|
|
26
41
|
|
|
27
42
|
case 'atlassian:Template':
|
|
28
|
-
return
|
|
43
|
+
return {
|
|
44
|
+
icon: _constants.IconType.Template,
|
|
45
|
+
label: label || 'Template'
|
|
46
|
+
};
|
|
29
47
|
|
|
30
48
|
case 'atlassian:UndefinedLink':
|
|
31
|
-
return
|
|
49
|
+
return {
|
|
50
|
+
icon: _constants.IconType.Document,
|
|
51
|
+
label: label || 'Undefined link'
|
|
52
|
+
};
|
|
32
53
|
|
|
33
54
|
default:
|
|
34
55
|
return undefined;
|
|
@@ -11,66 +11,111 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
11
11
|
switch (fileFormat) {
|
|
12
12
|
// Generic documents
|
|
13
13
|
case 'folder':
|
|
14
|
-
return
|
|
14
|
+
return {
|
|
15
|
+
icon: _constants.IconType.Folder,
|
|
16
|
+
label: 'Folder'
|
|
17
|
+
};
|
|
15
18
|
|
|
16
19
|
case 'text/plain':
|
|
17
20
|
case 'application/vnd.oasis.opendocument.text':
|
|
18
21
|
case 'application/vnd.apple.pages':
|
|
19
|
-
return
|
|
22
|
+
return {
|
|
23
|
+
icon: _constants.IconType.Document,
|
|
24
|
+
label: 'Document'
|
|
25
|
+
};
|
|
20
26
|
|
|
21
27
|
case 'application/pdf':
|
|
22
|
-
return
|
|
28
|
+
return {
|
|
29
|
+
icon: _constants.IconType.PDF,
|
|
30
|
+
label: 'PDF document'
|
|
31
|
+
};
|
|
23
32
|
|
|
24
33
|
case 'application/vnd.oasis.opendocument.presentation':
|
|
25
34
|
case 'application/vnd.apple.keynote':
|
|
26
|
-
return
|
|
35
|
+
return {
|
|
36
|
+
icon: _constants.IconType.Presentation,
|
|
37
|
+
label: 'Presentation'
|
|
38
|
+
};
|
|
27
39
|
|
|
28
40
|
case 'application/vnd.oasis.opendocument.spreadsheet':
|
|
29
41
|
case 'application/vnd.apple.numbers':
|
|
30
|
-
return
|
|
42
|
+
return {
|
|
43
|
+
icon: _constants.IconType.Spreadsheet,
|
|
44
|
+
label: 'Spreadsheet'
|
|
45
|
+
};
|
|
31
46
|
// Google Drive
|
|
32
47
|
|
|
33
48
|
case 'application/vnd.google-apps.document':
|
|
34
|
-
return
|
|
49
|
+
return {
|
|
50
|
+
icon: _constants.IconType.GoogleDocs,
|
|
51
|
+
label: 'Google Docs'
|
|
52
|
+
};
|
|
35
53
|
|
|
36
54
|
case 'application/vnd.google-apps.form':
|
|
37
|
-
return
|
|
55
|
+
return {
|
|
56
|
+
icon: _constants.IconType.GoogleForms,
|
|
57
|
+
label: 'Google Form'
|
|
58
|
+
};
|
|
38
59
|
|
|
39
60
|
case 'application/vnd.google-apps.spreadsheet':
|
|
40
|
-
return
|
|
61
|
+
return {
|
|
62
|
+
icon: _constants.IconType.GoogleSheets,
|
|
63
|
+
label: 'Google Sheets'
|
|
64
|
+
};
|
|
41
65
|
|
|
42
66
|
case 'application/vnd.google-apps.presentation':
|
|
43
|
-
return
|
|
67
|
+
return {
|
|
68
|
+
icon: _constants.IconType.GoogleSlides,
|
|
69
|
+
label: 'Google Slides'
|
|
70
|
+
};
|
|
44
71
|
// Microsoft
|
|
45
72
|
|
|
46
73
|
case 'application/vnd.ms-excel':
|
|
47
74
|
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
|
48
|
-
return
|
|
75
|
+
return {
|
|
76
|
+
icon: _constants.IconType.MSExcel,
|
|
77
|
+
label: 'Excel spreadsheet'
|
|
78
|
+
};
|
|
49
79
|
|
|
50
80
|
case 'application/vnd.ms-powerpoint':
|
|
51
81
|
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
|
52
|
-
return
|
|
82
|
+
return {
|
|
83
|
+
icon: _constants.IconType.MSPowerpoint,
|
|
84
|
+
label: 'PowerPoint presentation'
|
|
85
|
+
};
|
|
53
86
|
|
|
54
87
|
case 'application/msword':
|
|
55
88
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
56
|
-
return
|
|
89
|
+
return {
|
|
90
|
+
icon: _constants.IconType.MSWord,
|
|
91
|
+
label: 'Word document'
|
|
92
|
+
};
|
|
57
93
|
|
|
58
94
|
case 'image/png':
|
|
59
95
|
case 'image/jpeg':
|
|
60
96
|
case 'image/bmp':
|
|
61
97
|
case 'image/webp':
|
|
62
98
|
case 'image/svg+xml':
|
|
63
|
-
return
|
|
99
|
+
return {
|
|
100
|
+
icon: _constants.IconType.Image,
|
|
101
|
+
label: 'Image'
|
|
102
|
+
};
|
|
64
103
|
|
|
65
104
|
case 'image/gif':
|
|
66
|
-
return
|
|
105
|
+
return {
|
|
106
|
+
icon: _constants.IconType.GIF,
|
|
107
|
+
label: 'GIF'
|
|
108
|
+
};
|
|
67
109
|
|
|
68
110
|
case 'audio/midi':
|
|
69
111
|
case 'audio/mpeg':
|
|
70
112
|
case 'audio/webm':
|
|
71
113
|
case 'audio/ogg':
|
|
72
114
|
case 'audio/wav':
|
|
73
|
-
return
|
|
115
|
+
return {
|
|
116
|
+
icon: _constants.IconType.Audio,
|
|
117
|
+
label: 'Audio'
|
|
118
|
+
};
|
|
74
119
|
|
|
75
120
|
case 'video/mp4':
|
|
76
121
|
case 'video/quicktime':
|
|
@@ -79,13 +124,19 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
79
124
|
case 'video/ogg':
|
|
80
125
|
case 'video/x-ms-wmv':
|
|
81
126
|
case 'video/x-msvideo':
|
|
82
|
-
return
|
|
127
|
+
return {
|
|
128
|
+
icon: _constants.IconType.Video,
|
|
129
|
+
label: 'Video'
|
|
130
|
+
};
|
|
83
131
|
// Others
|
|
84
132
|
|
|
85
133
|
case 'text/css':
|
|
86
134
|
case 'text/html':
|
|
87
135
|
case 'application/javascript':
|
|
88
|
-
return
|
|
136
|
+
return {
|
|
137
|
+
icon: _constants.IconType.Code,
|
|
138
|
+
label: 'Source Code'
|
|
139
|
+
};
|
|
89
140
|
|
|
90
141
|
case 'application/zip':
|
|
91
142
|
case 'application/x-tar':
|
|
@@ -93,19 +144,34 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
|
|
|
93
144
|
case 'application/x-7z-compressed':
|
|
94
145
|
case 'application/x-apple-diskimage':
|
|
95
146
|
case 'application/vnd.rar':
|
|
96
|
-
return
|
|
147
|
+
return {
|
|
148
|
+
icon: _constants.IconType.Archive,
|
|
149
|
+
label: 'Archive'
|
|
150
|
+
};
|
|
97
151
|
|
|
98
152
|
case 'application/dmg':
|
|
99
|
-
return
|
|
153
|
+
return {
|
|
154
|
+
icon: _constants.IconType.Executable,
|
|
155
|
+
label: 'Executable'
|
|
156
|
+
};
|
|
100
157
|
|
|
101
158
|
case 'application/sketch':
|
|
102
|
-
return
|
|
159
|
+
return {
|
|
160
|
+
icon: _constants.IconType.Sketch,
|
|
161
|
+
label: 'Sketch'
|
|
162
|
+
};
|
|
103
163
|
|
|
104
164
|
case 'application/octet-stream':
|
|
105
|
-
return
|
|
165
|
+
return {
|
|
166
|
+
icon: _constants.IconType.Generic,
|
|
167
|
+
label: 'Binary file'
|
|
168
|
+
};
|
|
106
169
|
|
|
107
170
|
case 'application/invision.prototype':
|
|
108
|
-
return
|
|
171
|
+
return {
|
|
172
|
+
icon: _constants.IconType.Generic,
|
|
173
|
+
label: 'Prototype'
|
|
174
|
+
};
|
|
109
175
|
|
|
110
176
|
default:
|
|
111
177
|
return undefined;
|
|
@@ -12,32 +12,59 @@ var extractJiraTaskIcon = function extractJiraTaskIcon(taskType) {
|
|
|
12
12
|
|
|
13
13
|
switch (taskType) {
|
|
14
14
|
case 'JiraBug':
|
|
15
|
-
return
|
|
15
|
+
return {
|
|
16
|
+
icon: _constants.IconType.Bug,
|
|
17
|
+
label: label
|
|
18
|
+
};
|
|
16
19
|
|
|
17
20
|
case 'JiraChange':
|
|
18
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
icon: _constants.IconType.Change,
|
|
23
|
+
label: label
|
|
24
|
+
};
|
|
19
25
|
|
|
20
26
|
case 'JiraEpic':
|
|
21
|
-
return
|
|
27
|
+
return {
|
|
28
|
+
icon: _constants.IconType.Epic,
|
|
29
|
+
label: label
|
|
30
|
+
};
|
|
22
31
|
|
|
23
32
|
case 'JiraIncident':
|
|
24
|
-
return
|
|
33
|
+
return {
|
|
34
|
+
icon: _constants.IconType.Incident,
|
|
35
|
+
label: label
|
|
36
|
+
};
|
|
25
37
|
|
|
26
38
|
case 'JiraProblem':
|
|
27
|
-
return
|
|
39
|
+
return {
|
|
40
|
+
icon: _constants.IconType.Problem,
|
|
41
|
+
label: label
|
|
42
|
+
};
|
|
28
43
|
|
|
29
44
|
case 'JiraServiceRequest':
|
|
30
|
-
return
|
|
45
|
+
return {
|
|
46
|
+
icon: _constants.IconType.ServiceRequest,
|
|
47
|
+
label: label
|
|
48
|
+
};
|
|
31
49
|
|
|
32
50
|
case 'JiraStory':
|
|
33
|
-
return
|
|
51
|
+
return {
|
|
52
|
+
icon: _constants.IconType.Story,
|
|
53
|
+
label: label
|
|
54
|
+
};
|
|
34
55
|
|
|
35
56
|
case 'JiraSubTask':
|
|
36
|
-
return
|
|
57
|
+
return {
|
|
58
|
+
icon: _constants.IconType.SubTask,
|
|
59
|
+
label: label
|
|
60
|
+
};
|
|
37
61
|
|
|
38
62
|
case 'JiraTask':
|
|
39
63
|
default:
|
|
40
|
-
return
|
|
64
|
+
return {
|
|
65
|
+
icon: _constants.IconType.Task,
|
|
66
|
+
label: label
|
|
67
|
+
};
|
|
41
68
|
}
|
|
42
69
|
};
|
|
43
70
|
|
|
@@ -33,7 +33,10 @@ var extractTask = function extractTask(data, label) {
|
|
|
33
33
|
url = _ref.icon;
|
|
34
34
|
|
|
35
35
|
var taskType = id === null || id === void 0 ? void 0 : id.split('#').pop();
|
|
36
|
-
var taskIcon = url ?
|
|
36
|
+
var taskIcon = url ? {
|
|
37
|
+
label: label,
|
|
38
|
+
url: url
|
|
39
|
+
} : undefined;
|
|
37
40
|
return {
|
|
38
41
|
taskType: taskType,
|
|
39
42
|
taskIcon: taskIcon
|
|
@@ -65,7 +68,7 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
|
65
68
|
var type = extractType(data);
|
|
66
69
|
var urlIcon = (0, _extractUrlIcon.default)(data.icon, label);
|
|
67
70
|
var provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
|
|
68
|
-
var providerIcon = (0, _extractProviderIcon.default)(
|
|
71
|
+
var providerIcon = (0, _extractProviderIcon.default)(data);
|
|
69
72
|
|
|
70
73
|
switch (type) {
|
|
71
74
|
case 'Document':
|
|
@@ -94,25 +97,46 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
|
|
|
94
97
|
taskType = _extractTask.taskType,
|
|
95
98
|
taskIcon = _extractTask.taskIcon;
|
|
96
99
|
|
|
97
|
-
return taskType === 'JiraCustomTaskType' ? taskIcon || urlIcon || providerIcon ||
|
|
100
|
+
return taskType === 'JiraCustomTaskType' ? taskIcon || urlIcon || providerIcon || {
|
|
101
|
+
icon: _constants2.IconType.Task,
|
|
102
|
+
label: taskLabel
|
|
103
|
+
} : (0, _extractJiraTaskIcon.default)(taskType, taskLabel);
|
|
98
104
|
}
|
|
99
105
|
|
|
100
|
-
return
|
|
106
|
+
return {
|
|
107
|
+
icon: _constants2.IconType.Task,
|
|
108
|
+
label: taskLabel
|
|
109
|
+
};
|
|
101
110
|
|
|
102
111
|
case 'atlassian:Project':
|
|
103
|
-
return urlIcon ||
|
|
112
|
+
return urlIcon || {
|
|
113
|
+
icon: _constants2.IconType.Project,
|
|
114
|
+
label: label || 'Project'
|
|
115
|
+
};
|
|
104
116
|
|
|
105
117
|
case 'atlassian:SourceCodeCommit':
|
|
106
|
-
return
|
|
118
|
+
return {
|
|
119
|
+
icon: _constants2.IconType.Commit,
|
|
120
|
+
label: label || 'Commit'
|
|
121
|
+
};
|
|
107
122
|
|
|
108
123
|
case 'atlassian:SourceCodePullRequest':
|
|
109
|
-
return
|
|
124
|
+
return {
|
|
125
|
+
icon: _constants2.IconType.PullRequest,
|
|
126
|
+
label: label || 'Pull request'
|
|
127
|
+
};
|
|
110
128
|
|
|
111
129
|
case 'atlassian:SourceCodeReference':
|
|
112
|
-
return
|
|
130
|
+
return {
|
|
131
|
+
icon: _constants2.IconType.Branch,
|
|
132
|
+
label: label || 'Reference'
|
|
133
|
+
};
|
|
113
134
|
|
|
114
135
|
case 'atlassian:SourceCodeRepository':
|
|
115
|
-
return
|
|
136
|
+
return {
|
|
137
|
+
icon: _constants2.IconType.Repo,
|
|
138
|
+
label: label || 'Repository'
|
|
139
|
+
};
|
|
116
140
|
|
|
117
141
|
default:
|
|
118
142
|
return providerIcon;
|
|
@@ -13,13 +13,30 @@ var _constants2 = require("../../../constants");
|
|
|
13
13
|
|
|
14
14
|
var _extractUrlIcon = _interopRequireDefault(require("./extract-url-icon"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _primitives = require("../../common/primitives");
|
|
17
|
+
|
|
18
|
+
var extractProviderIcon = function extractProviderIcon(data) {
|
|
19
|
+
if (!data) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var generator = data.generator;
|
|
24
|
+
var provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
|
|
25
|
+
var icon = generator === null || generator === void 0 ? void 0 : generator.icon;
|
|
26
|
+
var label = (generator === null || generator === void 0 ? void 0 : generator.name) || (0, _primitives.extractTitle)(data);
|
|
27
|
+
|
|
17
28
|
if (provider === _constants.CONFLUENCE_GENERATOR_ID) {
|
|
18
|
-
return
|
|
29
|
+
return {
|
|
30
|
+
icon: _constants2.IconType.Confluence,
|
|
31
|
+
label: label || 'Confluence'
|
|
32
|
+
};
|
|
19
33
|
}
|
|
20
34
|
|
|
21
35
|
if (provider === _constants.JIRA_GENERATOR_ID) {
|
|
22
|
-
return
|
|
36
|
+
return {
|
|
37
|
+
icon: _constants2.IconType.Jira,
|
|
38
|
+
label: label || 'Jira'
|
|
39
|
+
};
|
|
23
40
|
}
|
|
24
41
|
|
|
25
42
|
return (0, _extractUrlIcon.default)(icon, label);
|
|
@@ -9,7 +9,10 @@ var _utils = require("../../common/utils");
|
|
|
9
9
|
|
|
10
10
|
var extractUrlIcon = function extractUrlIcon(icon, label) {
|
|
11
11
|
var url = icon && (0, _utils.extractUrlFromIconJsonLd)(icon);
|
|
12
|
-
return url ?
|
|
12
|
+
return url ? {
|
|
13
|
+
label: label,
|
|
14
|
+
url: url
|
|
15
|
+
} : undefined;
|
|
13
16
|
};
|
|
14
17
|
|
|
15
18
|
var _default = extractUrlIcon;
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.extractLinkIcon = exports.extractErrorIcon = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
12
|
var _extractJsonldDataIcon = _interopRequireDefault(require("./extract-jsonld-data-icon"));
|
|
13
13
|
|
|
@@ -17,22 +17,16 @@ var _constants = require("../../../constants");
|
|
|
17
17
|
|
|
18
18
|
var _extractIconRenderer = _interopRequireDefault(require("./extract-icon-renderer"));
|
|
19
19
|
|
|
20
|
-
var
|
|
21
|
-
var data = response.data;
|
|
20
|
+
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; }
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
_ref2 = (0, _slicedToArray2.default)(_ref, 3),
|
|
25
|
-
icon = _ref2[0],
|
|
26
|
-
label = _ref2[1],
|
|
27
|
-
url = _ref2[2];
|
|
22
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
28
23
|
|
|
24
|
+
var extractLinkIcon = function extractLinkIcon(response, renderers) {
|
|
25
|
+
var data = response.data;
|
|
29
26
|
var render = (0, _extractIconRenderer.default)(data, renderers);
|
|
30
|
-
return {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
render: render,
|
|
34
|
-
url: url
|
|
35
|
-
};
|
|
27
|
+
return _objectSpread(_objectSpread({}, (0, _extractJsonldDataIcon.default)(data)), {}, {
|
|
28
|
+
render: render
|
|
29
|
+
});
|
|
36
30
|
};
|
|
37
31
|
|
|
38
32
|
exports.extractLinkIcon = extractLinkIcon;
|
|
@@ -41,13 +35,10 @@ var extractErrorIcon = function extractErrorIcon(response, status) {
|
|
|
41
35
|
// Try to get provider icon first.
|
|
42
36
|
if (response) {
|
|
43
37
|
var data = response.data;
|
|
44
|
-
var generator = data.generator;
|
|
45
|
-
var provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
|
|
46
38
|
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
url = _ref4[2];
|
|
39
|
+
var _ref = (0, _extractProviderIcon.default)(data) || {},
|
|
40
|
+
icon = _ref.icon,
|
|
41
|
+
url = _ref.url;
|
|
51
42
|
|
|
52
43
|
if (icon || url) {
|
|
53
44
|
return {
|
|
@@ -25,6 +25,8 @@ var _extractDateCreated = require("../common/date/extractDateCreated");
|
|
|
25
25
|
|
|
26
26
|
var _extractPriority = _interopRequireDefault(require("./extract-priority"));
|
|
27
27
|
|
|
28
|
+
var _extractProviderIcon = _interopRequireDefault(require("./icon/extract-provider-icon"));
|
|
29
|
+
|
|
28
30
|
var extractFlexibleUiContext = function extractFlexibleUiContext(response, renderers) {
|
|
29
31
|
if (!response) {
|
|
30
32
|
return undefined;
|
|
@@ -43,9 +45,12 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
|
|
|
43
45
|
modifiedOn: (0, _extractDateUpdated.extractDateUpdated)(data),
|
|
44
46
|
priority: (0, _extractPriority.default)(data),
|
|
45
47
|
programmingLanguage: (0, _utils.extractProgrammingLanguage)(data),
|
|
48
|
+
snippet: (0, _primitives.extractSummary)(data) || undefined,
|
|
49
|
+
// Explicitly set here to remove an empty string
|
|
46
50
|
state: (0, _lozenge.extractLozenge)(data),
|
|
47
51
|
subscriberCount: (0, _utils.extractSubscriberCount)(data),
|
|
48
52
|
title: (0, _primitives.extractTitle)(data) || url,
|
|
53
|
+
provider: (0, _extractProviderIcon.default)(data),
|
|
49
54
|
url: url
|
|
50
55
|
};
|
|
51
56
|
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -37,18 +37,32 @@ var getElementGroupStyles = function getElementGroupStyles(size, maxLines) {
|
|
|
37
37
|
// MetadataBlock allows metadata elements to be displayed in
|
|
38
38
|
// multiple lines, with maximum of 2 lines.
|
|
39
39
|
// a) We need the height of the line to be equal on both left and right
|
|
40
|
-
// sides so they line up nicely.
|
|
41
|
-
// all elements in specific size. This height belongs to AvatarGroup.
|
|
40
|
+
// sides so they line up nicely.
|
|
42
41
|
// b) There is no way to truncate non-text elements nicely. Here
|
|
43
42
|
// it's fix max height of the element group so that anything that is
|
|
44
43
|
// overflown will not be visible.
|
|
45
|
-
var lineHeight =
|
|
44
|
+
var lineHeight = getLineHeight(size);
|
|
46
45
|
var gap = (0, _utils.getGapSize)(size);
|
|
47
46
|
var gapHeight = gap * (maxLines - 1);
|
|
48
47
|
var height = lineHeight * maxLines + gapHeight;
|
|
49
48
|
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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);
|
|
50
49
|
};
|
|
51
50
|
|
|
51
|
+
var getLineHeight = function getLineHeight(size) {
|
|
52
|
+
// The maximum height of all elements in specific size.
|
|
53
|
+
// These heights belongs to AvatarGroup.
|
|
54
|
+
switch (size) {
|
|
55
|
+
case _constants.SmartLinkSize.XLarge:
|
|
56
|
+
case _constants.SmartLinkSize.Large:
|
|
57
|
+
return 1.75;
|
|
58
|
+
|
|
59
|
+
case _constants.SmartLinkSize.Medium:
|
|
60
|
+
case _constants.SmartLinkSize.Small:
|
|
61
|
+
default:
|
|
62
|
+
return 1.5;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
52
66
|
var getMaxLines = function getMaxLines(maxLines) {
|
|
53
67
|
if (maxLines > MAXIMUM_MAX_LINES) {
|
|
54
68
|
return DEFAULT_MAX_LINES;
|