@atlaskit/smart-card 19.1.18 → 19.1.21
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 +21 -0
- package/dist/cjs/constants.js +2 -1
- package/dist/cjs/extractors/flexible/index.js +3 -0
- package/dist/cjs/extractors/flexible/latest-commit/index.js +21 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +19 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +19 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +6 -25
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +5 -3
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +4 -4
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +8 -2
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/utils.js +19 -2
- package/dist/cjs/view/HoverCard/components/hover-card-content.js +2 -1
- package/dist/cjs/view/HoverCard/utils.js +6 -3
- package/dist/es2019/constants.js +2 -1
- package/dist/es2019/extractors/flexible/index.js +2 -0
- package/dist/es2019/extractors/flexible/latest-commit/index.js +12 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +48 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +16 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +6 -33
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +6 -1
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +7 -2
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +7 -0
- package/dist/es2019/view/FlexibleCard/components/utils.js +17 -1
- package/dist/es2019/view/HoverCard/components/hover-card-content.js +2 -1
- package/dist/es2019/view/HoverCard/utils.js +4 -3
- package/dist/esm/constants.js +2 -1
- package/dist/esm/extractors/flexible/index.js +2 -0
- package/dist/esm/extractors/flexible/latest-commit/index.js +12 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +19 -3
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +19 -1
- package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +6 -26
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +2 -2
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +5 -3
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +4 -4
- package/dist/esm/view/FlexibleCard/components/elements/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +6 -0
- package/dist/esm/view/FlexibleCard/components/utils.js +15 -1
- package/dist/esm/view/HoverCard/components/hover-card-content.js +2 -1
- package/dist/esm/view/HoverCard/utils.js +4 -3
- package/dist/types/constants.d.ts +3 -2
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +91 -0
- package/dist/types/extractors/flexible/latest-commit/index.d.ts +2 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/utils.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ElementName } from '../../constants';
|
|
1
2
|
export var HOVER_CARD_ANALYTICS_DISPLAY = 'flexible';
|
|
2
3
|
export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
3
4
|
var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
@@ -6,7 +7,7 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
6
7
|
case 'confluence-object-provider':
|
|
7
8
|
return {
|
|
8
9
|
metadata: {
|
|
9
|
-
primary: [
|
|
10
|
+
primary: [ElementName.AuthorGroup, ElementName.CreatedBy, ElementName.CommentCount, ElementName.ReactCount],
|
|
10
11
|
secondary: []
|
|
11
12
|
}
|
|
12
13
|
};
|
|
@@ -14,7 +15,7 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
14
15
|
case 'jira-object-provider':
|
|
15
16
|
return {
|
|
16
17
|
metadata: {
|
|
17
|
-
primary: [
|
|
18
|
+
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.Priority],
|
|
18
19
|
secondary: []
|
|
19
20
|
}
|
|
20
21
|
};
|
|
@@ -22,7 +23,7 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
22
23
|
default:
|
|
23
24
|
return {
|
|
24
25
|
metadata: {
|
|
25
|
-
primary: [
|
|
26
|
+
primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
|
|
26
27
|
secondary: []
|
|
27
28
|
}
|
|
28
29
|
};
|
|
@@ -66,7 +66,7 @@ export declare enum SmartLinkWidth {
|
|
|
66
66
|
/**
|
|
67
67
|
* Flexible UI element name - each reflecting the link data its represented.
|
|
68
68
|
* When adding an element...
|
|
69
|
-
* 1) Create base element if it doesn't already
|
|
69
|
+
* 1) Create base element if it doesn't already exist.
|
|
70
70
|
* Base element are inside src/view/FlexibleCard/components/elements.
|
|
71
71
|
* E.g. Badge,DateTime, Icon, Lozenge, etc.
|
|
72
72
|
* 2) Update FlexibleUiContext with the new prop for data representing
|
|
@@ -98,7 +98,8 @@ export declare enum ElementName {
|
|
|
98
98
|
SubscriberCount = "SubscriberCount",
|
|
99
99
|
Title = "Title",
|
|
100
100
|
ViewCount = "ViewCount",
|
|
101
|
-
VoteCount = "VoteCount"
|
|
101
|
+
VoteCount = "VoteCount",
|
|
102
|
+
LatestCommit = "LatestCommit"
|
|
102
103
|
}
|
|
103
104
|
/**
|
|
104
105
|
* Flexible UI action (button)
|
|
@@ -134,3 +134,94 @@ export declare const TEST_DOCUMENT_WITH_PREVIEW: {
|
|
|
134
134
|
summaryMap?: Record<string, string> | undefined;
|
|
135
135
|
updated?: string | undefined;
|
|
136
136
|
};
|
|
137
|
+
export declare const TEST_DATA_WITH_LATEST_COMMIT_OBJ: {
|
|
138
|
+
'atlassian:latestCommit': {
|
|
139
|
+
'@type': string;
|
|
140
|
+
name: string;
|
|
141
|
+
};
|
|
142
|
+
'@context': JsonLd.Primitives.Context;
|
|
143
|
+
'@type': JsonLd.Primitives.Property<JsonLd.Primitives.ObjectType>;
|
|
144
|
+
'schema:potentialAction'?: import("schema-dts").DeleteAction | import("schema-dts").ViewAction | import("schema-dts").DownloadAction | import("schema-dts").WatchAction | import("schema-dts").AssignAction | import("schema-dts").CommentAction | import("schema-dts").ReplyAction | import("schema-dts").ShareAction | import("schema-dts").SubscribeAction | (import("schema-dts").DeleteAction | import("schema-dts").ViewAction | import("schema-dts").DownloadAction | import("schema-dts").WatchAction | import("schema-dts").AssignAction | import("schema-dts").CommentAction | import("schema-dts").ReplyAction | import("schema-dts").ShareAction | import("schema-dts").SubscribeAction)[] | undefined;
|
|
145
|
+
'atlassian:downloadUrl'?: string | undefined;
|
|
146
|
+
'atlassian:visitUrl'?: string | undefined;
|
|
147
|
+
'atlassian:titlePrefix'?: JsonLd.Data.TitlePrefix | undefined;
|
|
148
|
+
'@id'?: string | undefined;
|
|
149
|
+
attachment?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
150
|
+
attributedTo?: JsonLd.Primitives.Property<(JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link) & {
|
|
151
|
+
actor?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
152
|
+
}> | undefined;
|
|
153
|
+
audience?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
154
|
+
bcc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
155
|
+
bto?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
156
|
+
cc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
157
|
+
context?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
|
|
158
|
+
generator?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
|
|
159
|
+
icon?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
|
|
160
|
+
image?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
|
|
161
|
+
inReplyTo?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
162
|
+
location?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
163
|
+
oneOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
|
|
164
|
+
anyOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
|
|
165
|
+
closed?: boolean | JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
|
|
166
|
+
preview?: string | ((JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel) & JsonLd.Primitives.PreviewExtension) | undefined;
|
|
167
|
+
replies?: JsonLd.Primitives.Collection<any> | undefined;
|
|
168
|
+
tag?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
169
|
+
to?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
170
|
+
url?: JsonLd.Primitives.Property<JsonLd.Primitives.Link> | undefined;
|
|
171
|
+
content?: string | undefined;
|
|
172
|
+
contentMap?: Record<string, string> | undefined;
|
|
173
|
+
name?: string | undefined;
|
|
174
|
+
nameMap?: Record<string, string> | undefined;
|
|
175
|
+
duration?: string | undefined;
|
|
176
|
+
mediaType?: string | undefined;
|
|
177
|
+
endTime?: string | undefined;
|
|
178
|
+
published?: string | undefined;
|
|
179
|
+
startTime?: string | undefined;
|
|
180
|
+
summary?: string | undefined;
|
|
181
|
+
summaryMap?: Record<string, string> | undefined;
|
|
182
|
+
updated?: string | undefined;
|
|
183
|
+
};
|
|
184
|
+
export declare const TEST_DATA_WITH_LATEST_COMMIT_TEXT: {
|
|
185
|
+
'atlassian:latestCommit': string;
|
|
186
|
+
'@context': JsonLd.Primitives.Context;
|
|
187
|
+
'@type': JsonLd.Primitives.Property<JsonLd.Primitives.ObjectType>;
|
|
188
|
+
'schema:potentialAction'?: import("schema-dts").DeleteAction | import("schema-dts").ViewAction | import("schema-dts").DownloadAction | import("schema-dts").WatchAction | import("schema-dts").AssignAction | import("schema-dts").CommentAction | import("schema-dts").ReplyAction | import("schema-dts").ShareAction | import("schema-dts").SubscribeAction | (import("schema-dts").DeleteAction | import("schema-dts").ViewAction | import("schema-dts").DownloadAction | import("schema-dts").WatchAction | import("schema-dts").AssignAction | import("schema-dts").CommentAction | import("schema-dts").ReplyAction | import("schema-dts").ShareAction | import("schema-dts").SubscribeAction)[] | undefined;
|
|
189
|
+
'atlassian:downloadUrl'?: string | undefined;
|
|
190
|
+
'atlassian:visitUrl'?: string | undefined;
|
|
191
|
+
'atlassian:titlePrefix'?: JsonLd.Data.TitlePrefix | undefined;
|
|
192
|
+
'@id'?: string | undefined;
|
|
193
|
+
attachment?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
194
|
+
attributedTo?: JsonLd.Primitives.Property<(JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link) & {
|
|
195
|
+
actor?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
196
|
+
}> | undefined;
|
|
197
|
+
audience?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
198
|
+
bcc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
199
|
+
bto?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
200
|
+
cc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
201
|
+
context?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
|
|
202
|
+
generator?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
|
|
203
|
+
icon?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
|
|
204
|
+
image?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
|
|
205
|
+
inReplyTo?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
206
|
+
location?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
207
|
+
oneOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
|
|
208
|
+
anyOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
|
|
209
|
+
closed?: boolean | JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
|
|
210
|
+
preview?: string | ((JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel) & JsonLd.Primitives.PreviewExtension) | undefined;
|
|
211
|
+
replies?: JsonLd.Primitives.Collection<any> | undefined;
|
|
212
|
+
tag?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
213
|
+
to?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
|
|
214
|
+
url?: JsonLd.Primitives.Property<JsonLd.Primitives.Link> | undefined;
|
|
215
|
+
content?: string | undefined;
|
|
216
|
+
contentMap?: Record<string, string> | undefined;
|
|
217
|
+
name?: string | undefined;
|
|
218
|
+
nameMap?: Record<string, string> | undefined;
|
|
219
|
+
duration?: string | undefined;
|
|
220
|
+
mediaType?: string | undefined;
|
|
221
|
+
endTime?: string | undefined;
|
|
222
|
+
published?: string | undefined;
|
|
223
|
+
startTime?: string | undefined;
|
|
224
|
+
summary?: string | undefined;
|
|
225
|
+
summaryMap?: Record<string, string> | undefined;
|
|
226
|
+
updated?: string | undefined;
|
|
227
|
+
};
|
|
@@ -124,6 +124,10 @@ export declare type FlexibleUiDataContext = {
|
|
|
124
124
|
* @see Provider
|
|
125
125
|
*/
|
|
126
126
|
provider?: Icon;
|
|
127
|
+
/**
|
|
128
|
+
* Contains the information about the latest commit in the repository
|
|
129
|
+
*/
|
|
130
|
+
latestCommit?: string;
|
|
127
131
|
};
|
|
128
132
|
export declare type Icon = {
|
|
129
133
|
icon?: IconType;
|
|
@@ -38,7 +38,7 @@ export declare type ElementItem = {
|
|
|
38
38
|
* The name of the metadata element, used by Flexible UI to determine which
|
|
39
39
|
* element to render.
|
|
40
40
|
*/
|
|
41
|
-
name: ElementName.AuthorGroup | ElementName.CollaboratorGroup | ElementName.CommentCount | ElementName.CreatedBy | ElementName.CreatedOn | ElementName.ModifiedBy | ElementName.ModifiedOn | ElementName.Priority | ElementName.ProgrammingLanguage | ElementName.Provider | ElementName.ReactCount | ElementName.State | ElementName.SubscriberCount | ElementName.ViewCount | ElementName.VoteCount;
|
|
41
|
+
name: ElementName.AuthorGroup | ElementName.CollaboratorGroup | ElementName.CommentCount | ElementName.CreatedBy | ElementName.CreatedOn | ElementName.ModifiedBy | ElementName.ModifiedOn | ElementName.Priority | ElementName.ProgrammingLanguage | ElementName.Provider | ElementName.ReactCount | ElementName.State | ElementName.SubscriberCount | ElementName.ViewCount | ElementName.VoteCount | ElementName.LatestCommit;
|
|
42
42
|
/**
|
|
43
43
|
* The size of the element to render.
|
|
44
44
|
* The elements that support sizing are AuthorGroup and CollaboratorGroup.
|
|
@@ -47,6 +47,10 @@ export declare const CreatedBy: import("react").FC<TextProps>;
|
|
|
47
47
|
* @see DateTime
|
|
48
48
|
*/
|
|
49
49
|
export declare const CreatedOn: import("react").FC<DateTimeProps>;
|
|
50
|
+
/**
|
|
51
|
+
* Creates an element that contains Last Commit hash
|
|
52
|
+
*/
|
|
53
|
+
export declare const LatestCommit: import("react").FC<BadgeProps>;
|
|
50
54
|
/**
|
|
51
55
|
* Creates a LinkIcon Icon element using the data from LinkIcon in the Flexible UI Context.
|
|
52
56
|
* @see Icon
|
|
@@ -7,6 +7,7 @@ export declare const getIconSizeStyles: (width: string) => SerializedStyles;
|
|
|
7
7
|
export declare const getIconWidth: (size?: SmartLinkSize | undefined) => string;
|
|
8
8
|
export declare const getLinkLineHeight: (size: SmartLinkSize) => string;
|
|
9
9
|
export declare const getLinkSizeStyles: (size: SmartLinkSize) => SerializedStyles;
|
|
10
|
+
export declare const getMaxLineHeight: (size: SmartLinkSize) => 1.5 | 1.75;
|
|
10
11
|
export declare const getMaxLines: (value: number, defaultValue: number, max: number, min: number) => number;
|
|
11
12
|
export declare const getTruncateStyles: (maxLines: number, lineHeight?: string, wordBreak?: 'break-word' | 'break-all') => SerializedStyles;
|
|
12
13
|
export declare const hasWhiteSpace: (str: string) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "19.1.
|
|
3
|
+
"version": "19.1.21",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@emotion/styled": "^10.0.7",
|
|
51
51
|
"@formatjs/intl-utils": "^3.8.4",
|
|
52
52
|
"facepaint": "^1.2.1",
|
|
53
|
-
"json-ld-types": "2.4.
|
|
53
|
+
"json-ld-types": "2.4.2",
|
|
54
54
|
"react-error-boundary": "^3.1.3",
|
|
55
55
|
"react-lazily-render": "^1.2.0",
|
|
56
56
|
"react-loadable": "^5.1.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"uuid": "^3.1.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@atlaskit/link-provider": "^1.0.
|
|
61
|
+
"@atlaskit/link-provider": "^1.0.3",
|
|
62
62
|
"react": "^16.8.0",
|
|
63
63
|
"react-dom": "^16.8.0",
|
|
64
64
|
"react-intl-next": "npm:react-intl@^5.18.1"
|