@atlaskit/smart-card 26.13.1 → 26.14.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/constants.js +5 -0
  3. package/dist/cjs/extractors/flexible/index.js +5 -0
  4. package/dist/cjs/extractors/flexible/utils.js +23 -2
  5. package/dist/cjs/extractors/hover/extractMetadata.js +2 -1
  6. package/dist/cjs/messages.js +10 -0
  7. package/dist/cjs/version.json +1 -1
  8. package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +21 -37
  9. package/dist/cjs/view/BlockCard/views/flexible/styled.js +15 -0
  10. package/dist/cjs/view/BlockCard/views/flexible/utils.js +116 -0
  11. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
  12. package/dist/cjs/view/FlexibleCard/components/elements/index.js +33 -4
  13. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +20 -0
  14. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +28 -12
  15. package/dist/cjs/view/HoverCard/utils.js +102 -3
  16. package/dist/es2019/constants.js +6 -0
  17. package/dist/es2019/extractors/flexible/index.js +7 -2
  18. package/dist/es2019/extractors/flexible/utils.js +18 -1
  19. package/dist/es2019/extractors/hover/extractMetadata.js +1 -1
  20. package/dist/es2019/messages.js +10 -0
  21. package/dist/es2019/version.json +1 -1
  22. package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +24 -38
  23. package/dist/es2019/view/BlockCard/views/flexible/styled.js +14 -0
  24. package/dist/es2019/view/BlockCard/views/flexible/utils.js +108 -0
  25. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +5 -0
  26. package/dist/es2019/view/FlexibleCard/components/elements/index.js +24 -0
  27. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +25 -0
  28. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +30 -14
  29. package/dist/es2019/view/HoverCard/utils.js +100 -1
  30. package/dist/esm/constants.js +6 -0
  31. package/dist/esm/extractors/flexible/index.js +7 -2
  32. package/dist/esm/extractors/flexible/utils.js +18 -1
  33. package/dist/esm/extractors/hover/extractMetadata.js +1 -1
  34. package/dist/esm/messages.js +10 -0
  35. package/dist/esm/version.json +1 -1
  36. package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +23 -38
  37. package/dist/esm/view/BlockCard/views/flexible/styled.js +7 -0
  38. package/dist/esm/view/BlockCard/views/flexible/utils.js +108 -0
  39. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
  40. package/dist/esm/view/FlexibleCard/components/elements/index.js +24 -0
  41. package/dist/esm/view/FlexibleCard/components/elements/utils.js +20 -0
  42. package/dist/esm/view/HoverCard/components/views/resolved/index.js +30 -14
  43. package/dist/esm/view/HoverCard/utils.js +98 -1
  44. package/dist/types/constants.d.ts +5 -0
  45. package/dist/types/extractors/flexible/utils.d.ts +5 -0
  46. package/dist/types/extractors/hover/extractMetadata.d.ts +2 -0
  47. package/dist/types/messages.d.ts +1 -1
  48. package/dist/types/state/flexible-ui-context/types.d.ts +25 -0
  49. package/dist/types/view/BlockCard/views/flexible/styled.d.ts +2 -0
  50. package/dist/types/view/BlockCard/views/flexible/utils.d.ts +10 -0
  51. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +35 -2
  52. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +24 -0
  53. package/dist/types/view/HoverCard/utils.d.ts +1 -0
  54. package/dist/types-ts4.5/constants.d.ts +5 -0
  55. package/dist/types-ts4.5/extractors/flexible/utils.d.ts +5 -0
  56. package/dist/types-ts4.5/extractors/hover/extractMetadata.d.ts +2 -0
  57. package/dist/types-ts4.5/messages.d.ts +1 -1
  58. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +25 -0
  59. package/dist/types-ts4.5/view/BlockCard/views/flexible/styled.d.ts +2 -0
  60. package/dist/types-ts4.5/view/BlockCard/views/flexible/utils.d.ts +10 -0
  61. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +35 -2
  62. package/dist/types-ts4.5/view/FlexibleCard/components/elements/index.d.ts +24 -0
  63. package/dist/types-ts4.5/view/HoverCard/utils.d.ts +1 -0
  64. package/package.json +4 -1
  65. package/report.api.md +40 -0
  66. package/tmp/api-report-tmp.d.ts +36 -1
@@ -6,6 +6,11 @@ import { IconType, MediaType } from '../../constants';
6
6
  * underlying elements.
7
7
  */
8
8
  export type FlexibleUiDataContext = {
9
+ /**
10
+ * An array containing data used to populate the AssignedToGroup element.
11
+ * @see AvatarGroup
12
+ */
13
+ assignedToGroup?: LinkPerson[];
9
14
  /**
10
15
  * Contains the number of attachments on the linked resource.
11
16
  * @type number
@@ -58,6 +63,12 @@ export type FlexibleUiDataContext = {
58
63
  * @see VoteCount
59
64
  */
60
65
  voteCount?: number;
66
+ /**
67
+ * Contains the name of the entity that has the resource assigend to.
68
+ * @type string
69
+ * @see AssignedTo
70
+ */
71
+ assignedTo?: string;
61
72
  /**
62
73
  * Contains the name of the entity that created the resource.
63
74
  * @type string
@@ -70,6 +81,12 @@ export type FlexibleUiDataContext = {
70
81
  * @see OwnedBy
71
82
  */
72
83
  ownedBy?: string;
84
+ /**
85
+ * Contains the person that owns the resource.
86
+ * @type LinkPerson
87
+ * @see OwnedByGroup
88
+ */
89
+ ownedByGroup?: LinkPerson[];
73
90
  /**
74
91
  * Contains the ISO timestamp of when the resource was created.
75
92
  * @type string - ISO Timestamp
@@ -146,6 +163,10 @@ export type FlexibleUiDataContext = {
146
163
  * @see Snippet
147
164
  */
148
165
  snippet?: string;
166
+ /**
167
+ * Contains read time (time taken to read) of the resource
168
+ */
169
+ readTime?: string;
149
170
  /**
150
171
  * Contains the source branch name of the link typed pull request.
151
172
  * @type string
@@ -158,6 +179,10 @@ export type FlexibleUiDataContext = {
158
179
  * @see SubscriberCount
159
180
  */
160
181
  subscriberCount?: number;
182
+ /**
183
+ * A string displaying progress on subtasks
184
+ */
185
+ subTasksProgress?: string;
161
186
  /**
162
187
  * Contains the number of subscribers of the linked resource.
163
188
  * @type number
@@ -0,0 +1,2 @@
1
+ export declare const metadataBlockCss: import("@emotion/react").SerializedStyles;
2
+ export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,10 @@
1
+ import { JsonLd } from 'json-ld-types';
2
+ import { ElementItem } from '../../../FlexibleCard/components/blocks/types';
3
+ export declare const getSimulatedBetterMetadata: (cardDetails?: JsonLd.Response) => SimulatedMetadata;
4
+ export declare const getSimulatedMetadata: (cardDetails?: JsonLd.Response) => SimulatedMetadata;
5
+ type SimulatedMetadata = {
6
+ titleMetadata: ElementItem[];
7
+ topMetadata: ElementItem[];
8
+ bottomMetadata?: ElementItem[];
9
+ };
10
+ export {};
@@ -168,7 +168,7 @@ export type OnActionMenuOpenChangeOptions = {
168
168
  /**
169
169
  * A type that contains all the possible combinations of elements with their corresponding props.
170
170
  */
171
- export type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | Location | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
171
+ export type ElementItemProps = AssignedTo | AssignedToGroup | AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | Location | ModifiedBy | ModifiedOn | OwnedBy | OwnedByGroup | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | ReadTime | Snippet | SourceBranch | State | SubscriberCount | SubTasksProgress | TargetBranch | Title | ViewCount | VoteCount;
172
172
  /**
173
173
  * Represents the props available for an AttachmentCount element.
174
174
  * @see AttachmentCount
@@ -183,6 +183,20 @@ export type AttachmentCount = {
183
183
  export type AuthorGroup = {
184
184
  name: ElementName.AuthorGroup;
185
185
  };
186
+ /**
187
+ * Represents the props available for an OwnedByGroup element.
188
+ * @see AuthorGroup
189
+ */
190
+ export type OwnedByGroup = {
191
+ name: ElementName.OwnedByGroup;
192
+ };
193
+ /**
194
+ * Represents the props available for an AssignedToGroup element.
195
+ * @see AuthorGroup
196
+ */
197
+ export type AssignedToGroup = {
198
+ name: ElementName.AssignedToGroup;
199
+ };
186
200
  /**
187
201
  * Represents the props available for an ChecklistProgress element.
188
202
  * @see ChecklistProgress
@@ -204,6 +218,13 @@ export type CollaboratorGroup = {
204
218
  export type CommentCount = {
205
219
  name: ElementName.CommentCount;
206
220
  };
221
+ /**
222
+ * Represents the props available for an AssignedTo element.
223
+ * @see AssignedTo
224
+ */
225
+ export type AssignedTo = {
226
+ name: ElementName.AssignedTo;
227
+ };
207
228
  /**
208
229
  * Represents the props available for an CreatedBy element.
209
230
  * @see CreatedBy
@@ -309,6 +330,12 @@ export type Provider = {
309
330
  export type ReactCount = {
310
331
  name: ElementName.ReactCount;
311
332
  };
333
+ /**
334
+ * Represents the props available for a ReadTime element.
335
+ */
336
+ export type ReadTime = {
337
+ name: ElementName.ReadTime;
338
+ };
312
339
  /**
313
340
  * Represents the props available for an Snippet element.
314
341
  * @see Snippet
@@ -331,12 +358,18 @@ export type State = {
331
358
  name: ElementName.State;
332
359
  };
333
360
  /**
334
- * Represents the props available for an SubscriberCount element.
361
+ * Represents the props available for a SubscriberCount element.
335
362
  * @see SubscriberCount
336
363
  */
337
364
  export type SubscriberCount = {
338
365
  name: ElementName.SubscriberCount;
339
366
  };
367
+ /**
368
+ * Represents the props available for a Subtasks element.
369
+ */
370
+ export type SubTasksProgress = {
371
+ name: ElementName.SubTasksProgress;
372
+ };
340
373
  /**
341
374
  * Represents the props available for an TargetBranch element.
342
375
  * @see TargetBranch
@@ -7,6 +7,16 @@ import { AvatarGroupProps } from './avatar-group/types';
7
7
  import { TextProps } from './text/types';
8
8
  import { DateTimeProps } from './date-time/types';
9
9
  import { MediaProps } from './media/types';
10
+ /**
11
+ * Creates a AssignedTo text element using the data from AssignedTo in the Flexible UI Context.
12
+ * @see Text
13
+ */
14
+ export declare const AssignedTo: import("react").FC<TextProps>;
15
+ /**
16
+ * An AvatarGroup element using the data from AssignedToGroup in the Flexible UI Context.
17
+ * @see AvatarGroup
18
+ */
19
+ export declare const AssignedToGroup: import("react").FC<AvatarGroupProps>;
10
20
  /**
11
21
  * Creates a AttachmentCount Badge element using the data from AttachmentCount in the Flexible UI Context.
12
22
  * @see Badge
@@ -77,6 +87,11 @@ export declare const ModifiedOn: import("react").FC<DateTimeProps>;
77
87
  * @see Text
78
88
  */
79
89
  export declare const OwnedBy: import("react").FC<TextProps>;
90
+ /**
91
+ * An AvatarGroup element using the data from OwnedByGroup in the Flexible UI Context.
92
+ * @see AvatarGroup
93
+ */
94
+ export declare const OwnedByGroup: import("react").FC<AvatarGroupProps>;
80
95
  /**
81
96
  * Creates a Preview element using the data from Preview in the Flexible UI Context.
82
97
  * @see Preview
@@ -102,6 +117,10 @@ export declare const Provider: import("react").FC<BadgeProps>;
102
117
  * @see Badge
103
118
  */
104
119
  export declare const ReactCount: import("react").FC<BadgeProps>;
120
+ /**
121
+ * Creates a ReadTime Text element using the data from readTime in the Flexible UI Context
122
+ */
123
+ export declare const ReadTime: import("react").FC<TextProps>;
105
124
  /**
106
125
  * Creates a Snippet element using the data from Snippet in the Flexible UI Context.
107
126
  * @see Text
@@ -122,6 +141,11 @@ export declare const State: import("react").FC<LozengeProps>;
122
141
  * @see Badge
123
142
  */
124
143
  export declare const SubscriberCount: import("react").FC<BadgeProps>;
144
+ /**
145
+ * Create a SubTasks Badge element using the data from subTasks in the Flexible UI Context.
146
+ * @see Badge
147
+ */
148
+ export declare const SubTasksProgress: import("react").FC<BadgeProps>;
125
149
  /**
126
150
  * Creates a TargetBranch Text element using the data from targetBranch in the Flexible UI Context.
127
151
  * @see Text
@@ -1,2 +1,3 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
2
  export declare const getSimulatedMetadata: (extensionKey: string | undefined, data: JsonLd.Data.BaseData) => JsonLd.Primitives.Property<any>;
3
+ export declare const getSimulatedBetterMetadata: (extensionKey: string | undefined, data: JsonLd.Data.BaseData) => JsonLd.Primitives.Property<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.13.1",
3
+ "version": "26.14.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -142,6 +142,9 @@
142
142
  },
143
143
  "platform.linking-platform.smart-card.show-inline-card-refreshed-design": {
144
144
  "type": "boolean"
145
+ },
146
+ "platform.linking-platform.smart-card.enable-better-metadata_iojwg": {
147
+ "type": "boolean"
145
148
  }
146
149
  },
147
150
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
package/report.api.md CHANGED
@@ -148,6 +148,16 @@ type AnchorTarget = '_blank' | '_parent' | '_self' | '_top';
148
148
 
149
149
  export { APIError };
150
150
 
151
+ // @public
152
+ type AssignedTo = {
153
+ name: ElementName.AssignedTo;
154
+ };
155
+
156
+ // @public
157
+ type AssignedToGroup = {
158
+ name: ElementName.AssignedToGroup;
159
+ };
160
+
151
161
  // @public
152
162
  type AttachmentCount = {
153
163
  name: ElementName.AttachmentCount;
@@ -446,6 +456,8 @@ export type ElementItem = {
446
456
 
447
457
  // @public
448
458
  type ElementItemProps =
459
+ | AssignedTo
460
+ | AssignedToGroup
449
461
  | AttachmentCount
450
462
  | AuthorGroup
451
463
  | ChecklistProgress
@@ -460,14 +472,17 @@ type ElementItemProps =
460
472
  | ModifiedBy
461
473
  | ModifiedOn
462
474
  | OwnedBy
475
+ | OwnedByGroup
463
476
  | Preview
464
477
  | Priority
465
478
  | ProgrammingLanguage
466
479
  | Provider_2
467
480
  | ReactCount
481
+ | ReadTime
468
482
  | Snippet
469
483
  | SourceBranch
470
484
  | State_2
485
+ | SubTasksProgress
471
486
  | SubscriberCount
472
487
  | TargetBranch
473
488
  | Title
@@ -476,6 +491,10 @@ type ElementItemProps =
476
491
 
477
492
  // @public
478
493
  export enum ElementName {
494
+ // (undocumented)
495
+ AssignedTo = 'AssignedTo',
496
+ // (undocumented)
497
+ AssignedToGroup = 'AssignedToGroup',
479
498
  // (undocumented)
480
499
  AttachmentCount = 'AttachmentCount',
481
500
  // (undocumented)
@@ -505,6 +524,8 @@ export enum ElementName {
505
524
  // (undocumented)
506
525
  OwnedBy = 'OwnedBy',
507
526
  // (undocumented)
527
+ OwnedByGroup = 'OwnedByGroup',
528
+ // (undocumented)
508
529
  Preview = 'Preview',
509
530
  // (undocumented)
510
531
  Priority = 'Priority',
@@ -515,6 +536,8 @@ export enum ElementName {
515
536
  // (undocumented)
516
537
  ReactCount = 'ReactCount',
517
538
  // (undocumented)
539
+ ReadTime = 'ReadTime',
540
+ // (undocumented)
518
541
  Snippet = 'Snippet',
519
542
  // (undocumented)
520
543
  SourceBranch = 'SourceBranch',
@@ -523,6 +546,8 @@ export enum ElementName {
523
546
  // (undocumented)
524
547
  SubscriberCount = 'SubscriberCount',
525
548
  // (undocumented)
549
+ SubTasksProgress = 'SubTasksProgress',
550
+ // (undocumented)
526
551
  TargetBranch = 'TargetBranch',
527
552
  // (undocumented)
528
553
  Title = 'Title',
@@ -704,6 +729,11 @@ type OwnedBy = {
704
729
  name: ElementName.OwnedBy;
705
730
  };
706
731
 
732
+ // @public
733
+ type OwnedByGroup = {
734
+ name: ElementName.OwnedByGroup;
735
+ };
736
+
707
737
  // @public
708
738
  type Preview = {
709
739
  name: ElementName.Preview;
@@ -757,6 +787,11 @@ type ReactCount = {
757
787
  name: ElementName.ReactCount;
758
788
  };
759
789
 
790
+ // @public
791
+ type ReadTime = {
792
+ name: ElementName.ReadTime;
793
+ };
794
+
760
795
  // @public (undocumented)
761
796
  export type ResolveResponse = JsonLd.Response;
762
797
 
@@ -870,6 +905,11 @@ type SubscriberCount = {
870
905
  name: ElementName.SubscriberCount;
871
906
  };
872
907
 
908
+ // @public
909
+ type SubTasksProgress = {
910
+ name: ElementName.SubTasksProgress;
911
+ };
912
+
873
913
  // @public
874
914
  type TargetBranch = {
875
915
  name: ElementName.TargetBranch;
@@ -101,6 +101,16 @@ type AnchorTarget = '_blank' | '_parent' | '_self' | '_top';
101
101
 
102
102
  export { APIError }
103
103
 
104
+ // @public
105
+ type AssignedTo = {
106
+ name: ElementName.AssignedTo;
107
+ };
108
+
109
+ // @public
110
+ type AssignedToGroup = {
111
+ name: ElementName.AssignedToGroup;
112
+ };
113
+
104
114
  // @public
105
115
  type AttachmentCount = {
106
116
  name: ElementName.AttachmentCount;
@@ -344,10 +354,14 @@ export type ElementItem = {
344
354
  } & ElementItemProps;
345
355
 
346
356
  // @public
347
- type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | Location_2 | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
357
+ type ElementItemProps = AssignedTo | AssignedToGroup | AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | Location_2 | ModifiedBy | ModifiedOn | OwnedBy | OwnedByGroup | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | ReadTime | Snippet | SourceBranch | State_2 | SubTasksProgress | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
348
358
 
349
359
  // @public
350
360
  export enum ElementName {
361
+ // (undocumented)
362
+ AssignedTo = "AssignedTo",
363
+ // (undocumented)
364
+ AssignedToGroup = "AssignedToGroup",
351
365
  // (undocumented)
352
366
  AttachmentCount = "AttachmentCount",
353
367
  // (undocumented)
@@ -377,6 +391,8 @@ export enum ElementName {
377
391
  // (undocumented)
378
392
  OwnedBy = "OwnedBy",
379
393
  // (undocumented)
394
+ OwnedByGroup = "OwnedByGroup",
395
+ // (undocumented)
380
396
  Preview = "Preview",
381
397
  // (undocumented)
382
398
  Priority = "Priority",
@@ -387,6 +403,8 @@ export enum ElementName {
387
403
  // (undocumented)
388
404
  ReactCount = "ReactCount",
389
405
  // (undocumented)
406
+ ReadTime = "ReadTime",
407
+ // (undocumented)
390
408
  Snippet = "Snippet",
391
409
  // (undocumented)
392
410
  SourceBranch = "SourceBranch",
@@ -395,6 +413,8 @@ export enum ElementName {
395
413
  // (undocumented)
396
414
  SubscriberCount = "SubscriberCount",
397
415
  // (undocumented)
416
+ SubTasksProgress = "SubTasksProgress",
417
+ // (undocumented)
398
418
  TargetBranch = "TargetBranch",
399
419
  // (undocumented)
400
420
  Title = "Title",
@@ -563,6 +583,11 @@ type OwnedBy = {
563
583
  name: ElementName.OwnedBy;
564
584
  };
565
585
 
586
+ // @public
587
+ type OwnedByGroup = {
588
+ name: ElementName.OwnedByGroup;
589
+ };
590
+
566
591
  // @public
567
592
  type Preview = {
568
593
  name: ElementName.Preview;
@@ -616,6 +641,11 @@ type ReactCount = {
616
641
  name: ElementName.ReactCount;
617
642
  };
618
643
 
644
+ // @public
645
+ type ReadTime = {
646
+ name: ElementName.ReadTime;
647
+ };
648
+
619
649
  // @public (undocumented)
620
650
  export type ResolveResponse = JsonLd.Response;
621
651
 
@@ -726,6 +756,11 @@ type SubscriberCount = {
726
756
  name: ElementName.SubscriberCount;
727
757
  };
728
758
 
759
+ // @public
760
+ type SubTasksProgress = {
761
+ name: ElementName.SubTasksProgress;
762
+ };
763
+
729
764
  // @public
730
765
  type TargetBranch = {
731
766
  name: ElementName.TargetBranch;