@atlaskit/smart-card 19.1.28 → 19.1.31

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 (99) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/constants.js +4 -1
  3. package/dist/cjs/extractors/common/icon/extractIcon.js +7 -0
  4. package/dist/cjs/extractors/common/icon/priority.js +1 -0
  5. package/dist/cjs/extractors/common/lozenge/extractLozenge.js +7 -1
  6. package/dist/cjs/extractors/common/lozenge/extractState.js +2 -2
  7. package/dist/cjs/extractors/flexible/icon/extract-jsonld-data-icon.js +6 -0
  8. package/dist/cjs/extractors/flexible/index.js +5 -2
  9. package/dist/cjs/extractors/flexible/utils.js +30 -2
  10. package/dist/cjs/extractors/hover/extractMetadata.js +3 -2
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +1 -1
  13. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
  14. package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +2 -0
  15. package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -0
  16. package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +2 -0
  17. package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +2 -0
  18. package/dist/cjs/view/FlexibleCard/components/elements/index.js +25 -4
  19. package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +2 -0
  20. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +2 -0
  21. package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +3 -1
  22. package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +2 -0
  23. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +42 -12
  24. package/dist/cjs/view/HoverCard/components/hover-card-content.js +12 -5
  25. package/dist/cjs/view/HoverCard/index.js +1 -1
  26. package/dist/cjs/view/HoverCard/styled.js +8 -5
  27. package/dist/cjs/view/HoverCard/utils.js +46 -3
  28. package/dist/es2019/constants.js +4 -1
  29. package/dist/es2019/extractors/common/icon/extractIcon.js +6 -0
  30. package/dist/es2019/extractors/common/icon/priority.js +1 -0
  31. package/dist/es2019/extractors/common/lozenge/extractLozenge.js +4 -0
  32. package/dist/es2019/extractors/common/lozenge/extractState.js +2 -2
  33. package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +6 -0
  34. package/dist/es2019/extractors/flexible/index.js +6 -3
  35. package/dist/es2019/extractors/flexible/utils.js +10 -1
  36. package/dist/es2019/extractors/hover/extractMetadata.js +3 -2
  37. package/dist/es2019/version.json +1 -1
  38. package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +11 -1
  39. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +6 -3
  40. package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +2 -0
  41. package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -0
  42. package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +2 -0
  43. package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +2 -0
  44. package/dist/es2019/view/FlexibleCard/components/elements/index.js +18 -0
  45. package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +2 -0
  46. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +2 -0
  47. package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +2 -0
  48. package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +2 -0
  49. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +48 -16
  50. package/dist/es2019/view/HoverCard/components/hover-card-content.js +11 -5
  51. package/dist/es2019/view/HoverCard/index.js +1 -1
  52. package/dist/es2019/view/HoverCard/styled.js +31 -5
  53. package/dist/es2019/view/HoverCard/utils.js +46 -4
  54. package/dist/esm/constants.js +4 -1
  55. package/dist/esm/extractors/common/icon/extractIcon.js +6 -0
  56. package/dist/esm/extractors/common/icon/priority.js +1 -0
  57. package/dist/esm/extractors/common/lozenge/extractLozenge.js +7 -1
  58. package/dist/esm/extractors/common/lozenge/extractState.js +2 -2
  59. package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +6 -0
  60. package/dist/esm/extractors/flexible/index.js +6 -3
  61. package/dist/esm/extractors/flexible/utils.js +16 -0
  62. package/dist/esm/extractors/hover/extractMetadata.js +3 -2
  63. package/dist/esm/state/actions/index.js +1 -1
  64. package/dist/esm/state/hooks/usePrefetch.js +1 -1
  65. package/dist/esm/utils/mocks.js +1 -1
  66. package/dist/esm/version.json +1 -1
  67. package/dist/esm/view/BlockCard/actions/DownloadAction.js +1 -1
  68. package/dist/esm/view/BlockCard/actions/PreviewAction.js +1 -1
  69. package/dist/esm/view/BlockCard/actions/RetryAction.js +1 -1
  70. package/dist/esm/view/BlockCard/actions/ViewAction.js +1 -1
  71. package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +2 -2
  72. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
  73. package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +2 -0
  74. package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -0
  75. package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +2 -0
  76. package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +2 -0
  77. package/dist/esm/view/FlexibleCard/components/elements/index.js +18 -0
  78. package/dist/esm/view/FlexibleCard/components/elements/link/index.js +2 -0
  79. package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +2 -0
  80. package/dist/esm/view/FlexibleCard/components/elements/media/index.js +3 -1
  81. package/dist/esm/view/FlexibleCard/components/elements/text/index.js +2 -0
  82. package/dist/esm/view/FlexibleCard/components/elements/utils.js +41 -12
  83. package/dist/esm/view/HoverCard/components/hover-card-content.js +11 -5
  84. package/dist/esm/view/HoverCard/index.js +1 -1
  85. package/dist/esm/view/HoverCard/styled.js +8 -5
  86. package/dist/esm/view/HoverCard/utils.js +46 -3
  87. package/dist/types/constants.d.ts +4 -1
  88. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +11 -6
  89. package/dist/types/extractors/common/lozenge/extractState.d.ts +1 -1
  90. package/dist/types/extractors/flexible/utils.d.ts +3 -0
  91. package/dist/types/state/flexible-ui-context/types.d.ts +29 -10
  92. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +22 -1
  93. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +15 -0
  94. package/dist/types/view/FlexibleCard/components/elements/lozenge/types.d.ts +2 -1
  95. package/dist/types/view/FlexibleCard/components/elements/types.d.ts +7 -1
  96. package/dist/types/view/HoverCard/types.d.ts +1 -0
  97. package/dist/types/view/HoverCard/utils.d.ts +1 -1
  98. package/package.json +2 -2
  99. package/report.api.md +6 -0
@@ -9,6 +9,7 @@ import { isSpecialEvent } from '../../../utils';
9
9
  import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
10
10
  import { getExtensionKey } from '../../../state/helpers';
11
11
  import { titleBlockCss, metadataBlockCss, footerBlockCss } from '../styled';
12
+ import { extractType } from '../../../extractors/common/primitives/extractType';
12
13
  const flexibleUiOptions = {
13
14
  hideElevation: true,
14
15
  size: SmartLinkSize.Medium,
@@ -59,13 +60,16 @@ const HoverCardContent = ({
59
60
  analytics.ui.cardClickedEvent(undefined, HOVER_CARD_ANALYTICS_DISPLAY, cardState.status, undefined, undefined, isModifierKeyPressed, undefined, undefined, undefined, 'titleGoToLink');
60
61
  }, [cardState.status, analytics.ui]);
61
62
  const titleActions = useMemo(() => [getOpenAction(url, analytics)], [url, analytics]);
62
- const footerActions = useMemo(() => toFooterActions(cardActions), [cardActions]); //TODO: EDM-3224 deleted simulated and use real JsonLd
63
+ const footerActions = useMemo(() => toFooterActions(cardActions), [cardActions]);
64
+ const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
65
+ const types = data ? extractType(data) : undefined; //TODO: EDM-3224 deleted simulated and use real JsonLd
63
66
 
64
67
  const {
65
68
  primary,
66
- secondary
67
- } = extractMetadata(getSimulatedMetadata(extensionKey));
68
- const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
69
+ secondary,
70
+ subtitle
71
+ } = extractMetadata(getSimulatedMetadata(extensionKey, types));
72
+ const titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
69
73
  const body = data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, null) : /*#__PURE__*/React.createElement(SnippetBlock, null);
70
74
  return /*#__PURE__*/React.createElement(FlexibleCard, {
71
75
  cardState: cardState,
@@ -76,9 +80,11 @@ const HoverCardContent = ({
76
80
  url: url
77
81
  }, /*#__PURE__*/React.createElement(TitleBlock, {
78
82
  actions: titleActions,
83
+ maxLines: titleMaxLines,
79
84
  overrideCss: titleBlockCss,
80
85
  size: SmartLinkSize.Large,
81
- position: SmartLinkPosition.Center
86
+ position: SmartLinkPosition.Center,
87
+ subtitle: subtitle
82
88
  }), /*#__PURE__*/React.createElement(MetadataBlock, {
83
89
  primary: primary,
84
90
  secondary: secondary,
@@ -89,7 +89,7 @@ export const HoverCardComponent = ({
89
89
  onMouseEnter: initShowCard,
90
90
  onMouseLeave: initHideCard
91
91
  }), children),
92
- zIndex: 501 // Temporary fix for Confluence inline comment on editor mod has z-index of 500
92
+ zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
93
93
 
94
94
  });
95
95
  };
@@ -1,5 +1,12 @@
1
1
  import { css } from '@emotion/core';
2
2
  import { loadingPlaceholderClassName } from '../../index';
3
+ const blockGap = '0.5rem';
4
+ const elementGap = '0.5rem';
5
+ const separatorCss = css`
6
+ [data-separator] + [data-separator]:before {
7
+ margin-right: ${elementGap};
8
+ }
9
+ `;
3
10
  export const HoverCardContainer = css`
4
11
  background: none;
5
12
  border-width: 0;
@@ -12,25 +19,44 @@ export const HoverCardContainer = css`
12
19
  }
13
20
  `;
14
21
  export const titleBlockCss = css`
15
- gap: 0.5rem;
22
+ gap: ${blockGap};
23
+
24
+ ${separatorCss}
25
+
26
+ // title and subtitle element group
27
+ [data-smart-element-group] {
28
+ // gap between title and subtitle
29
+ gap: 0.06rem;
30
+
31
+ /* subtitle element group */
32
+ > [data-smart-element-group] {
33
+ > span {
34
+ margin-right: ${elementGap};
35
+ }
36
+ }
37
+ }
16
38
  `;
17
39
  export const metadataBlockCss = css`
18
40
  gap: 0px;
19
41
 
20
42
  /* primary element group */
21
- [data-smart-element-group]:first-of-type {
43
+ [data-smart-element-group]:nth-of-type(1) {
22
44
  flex-grow: 7;
45
+
46
+ // a separator between text-based element
47
+ ${separatorCss}
48
+
23
49
  /* horizontal spacing between elements in group */
24
50
  > span {
25
- margin-right: 0.5rem;
51
+ margin-right: ${elementGap};
26
52
  }
27
53
  }
28
54
  /* secondary element group */
29
- [data-smart-element-group]:last-of-type {
55
+ [data-smart-element-group]:nth-of-type(2) {
30
56
  flex-grow: 3;
31
57
  /* horizontal spacing between elements in group */
32
58
  > span {
33
- margin-left: 0.5rem;
59
+ margin-left: ${elementGap};
34
60
  }
35
61
  }
36
62
  `;
@@ -1,12 +1,33 @@
1
1
  import { ElementName } from '../../constants';
2
2
  export const HOVER_CARD_ANALYTICS_DISPLAY = 'flexible';
3
- export const getSimulatedMetadata = (extensionKey = '') => {
3
+ export const getSimulatedMetadata = (extensionKey = '', types = []) => {
4
4
  switch (extensionKey) {
5
+ case 'bitbucket-object-provider':
6
+ case 'native-bitbucket-object-provider':
7
+ if (types.includes('atlassian:SourceCodePullRequest')) {
8
+ return {
9
+ metadata: {
10
+ primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.SubscriberCount, ElementName.State],
11
+ secondary: [],
12
+ subtitle: [ElementName.SourceBranch, ElementName.TargetBranch]
13
+ }
14
+ };
15
+ }
16
+
17
+ return {
18
+ metadata: {
19
+ primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
20
+ secondary: [],
21
+ subtitle: []
22
+ }
23
+ };
24
+
5
25
  case 'confluence-object-provider':
6
26
  return {
7
27
  metadata: {
8
28
  primary: [ElementName.AuthorGroup, ElementName.CreatedBy],
9
- secondary: [ElementName.CommentCount, ElementName.ReactCount]
29
+ secondary: [ElementName.CommentCount, ElementName.ReactCount],
30
+ subtitle: []
10
31
  }
11
32
  };
12
33
 
@@ -14,7 +35,27 @@ export const getSimulatedMetadata = (extensionKey = '') => {
14
35
  return {
15
36
  metadata: {
16
37
  primary: [ElementName.AuthorGroup, ElementName.State, ElementName.Priority],
17
- secondary: []
38
+ secondary: [],
39
+ subtitle: []
40
+ }
41
+ };
42
+
43
+ case 'watermelon-object-provider':
44
+ if (types.includes('atlassian:Project')) {
45
+ return {
46
+ metadata: {
47
+ primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.State, ElementName.DueOn],
48
+ secondary: [],
49
+ subtitle: []
50
+ }
51
+ };
52
+ }
53
+
54
+ return {
55
+ metadata: {
56
+ primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
57
+ secondary: [],
58
+ subtitle: []
18
59
  }
19
60
  };
20
61
 
@@ -22,7 +63,8 @@ export const getSimulatedMetadata = (extensionKey = '') => {
22
63
  return {
23
64
  metadata: {
24
65
  primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
25
- secondary: []
66
+ secondary: [],
67
+ subtitle: []
26
68
  }
27
69
  };
28
70
  }
@@ -83,7 +83,7 @@ export var SmartLinkWidth;
83
83
  * When adding an element...
84
84
  * 1) Create base element if it doesn't already exist.
85
85
  * Base element are inside src/view/FlexibleCard/components/elements.
86
- * E.g. Badge,DateTime, Icon, Lozenge, etc.
86
+ * E.g. Badge, DateTime, Icon, Lozenge, etc.
87
87
  * 2) Update FlexibleUiContext with the new prop for data representing
88
88
  * the element, preferably with the same name as the element itself.
89
89
  * (src/state/flexible-ui-context/types.ts)
@@ -111,6 +111,7 @@ export var ElementName;
111
111
  ElementName["CommentCount"] = "CommentCount";
112
112
  ElementName["CreatedBy"] = "CreatedBy";
113
113
  ElementName["CreatedOn"] = "CreatedOn";
114
+ ElementName["DueOn"] = "DueOn";
114
115
  ElementName["LinkIcon"] = "LinkIcon";
115
116
  ElementName["ModifiedBy"] = "ModifiedBy";
116
117
  ElementName["ModifiedOn"] = "ModifiedOn";
@@ -120,8 +121,10 @@ export var ElementName;
120
121
  ElementName["Provider"] = "Provider";
121
122
  ElementName["ReactCount"] = "ReactCount";
122
123
  ElementName["Snippet"] = "Snippet";
124
+ ElementName["SourceBranch"] = "SourceBranch";
123
125
  ElementName["State"] = "State";
124
126
  ElementName["SubscriberCount"] = "SubscriberCount";
127
+ ElementName["TargetBranch"] = "TargetBranch";
125
128
  ElementName["Title"] = "Title";
126
129
  ElementName["ViewCount"] = "ViewCount";
127
130
  ElementName["VoteCount"] = "VoteCount";
@@ -4,6 +4,7 @@ import CommitIcon from '@atlaskit/icon-object/glyph/commit/16';
4
4
  import PullRequestIcon from '@atlaskit/icon-object/glyph/pull-request/16';
5
5
  import BranchIcon from '@atlaskit/icon-object/glyph/branch/16';
6
6
  import RepoIcon from '@atlaskit/icon-object/glyph/code/16';
7
+ import TaskIcon from '@atlaskit/icon-object/glyph/task/16';
7
8
  import { extractorPriorityMap } from './priority';
8
9
  import { extractProvider } from '../context/extractProvider';
9
10
  import { extractTitle } from '../primitives/extractTitle';
@@ -46,6 +47,11 @@ var extractIconByType = function extractIconByType(type, opts) {
46
47
  case 'atlassian:UndefinedLink':
47
48
  return extractIconFromDocument(type, opts);
48
49
 
50
+ case 'atlassian:Goal':
51
+ return opts.icon || /*#__PURE__*/React.createElement(TaskIcon, {
52
+ label: opts.title || 'goal'
53
+ });
54
+
49
55
  case 'atlassian:Project':
50
56
  return opts.icon || /*#__PURE__*/React.createElement(ProjectIcon, {
51
57
  label: opts.title || 'project',
@@ -6,6 +6,7 @@ export var extractorPriorityMap = {
6
6
  'schema:BlogPosting': 10,
7
7
  'schema:SpreadsheetDigitalDocument': 10,
8
8
  'schema:PresentationDigitalDocument': 10,
9
+ 'atlassian:Goal': 10,
9
10
  'atlassian:Task': 10,
10
11
  'atlassian:Project': 10,
11
12
  'atlassian:Template': 10,
@@ -22,12 +22,18 @@ export var extractLozenge = function extractLozenge(jsonLd) {
22
22
  var jsonLdDocument = jsonLd;
23
23
  var lozengeFromState = extractState(jsonLdDocument);
24
24
  return lozengeFromState;
25
- } else if (type.includes('atlassian:Project')) {
25
+ } else if (type.includes('atlassian:Goal')) {
26
26
  var jsonLdProject = jsonLd;
27
27
 
28
28
  var _lozengeFromState = extractState(jsonLdProject);
29
29
 
30
30
  return _lozengeFromState;
31
+ } else if (type.includes('atlassian:Project')) {
32
+ var _jsonLdProject = jsonLd;
33
+
34
+ var _lozengeFromState2 = extractState(_jsonLdProject);
35
+
36
+ return _lozengeFromState2;
31
37
  } else if (type.includes('atlassian:UndefinedLink')) {
32
38
  return {
33
39
  text: 'UNDEFINED',
@@ -16,14 +16,14 @@ export var extractState = function extractState(jsonLd) {
16
16
  if (state.name) {
17
17
  return {
18
18
  text: state.name,
19
- appearance: 'default'
19
+ appearance: state.appearance || 'default'
20
20
  };
21
21
  }
22
22
  } else if (state['@type'] === 'Object') {
23
23
  if (state.name) {
24
24
  return {
25
25
  text: state.name,
26
- appearance: 'default'
26
+ appearance: state.appearance || 'default'
27
27
  };
28
28
  }
29
29
  }
@@ -90,6 +90,12 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
90
90
  label: taskLabel
91
91
  };
92
92
 
93
+ case 'atlassian:Goal':
94
+ return urlIcon || {
95
+ icon: IconType.Task,
96
+ label: label || 'Goal'
97
+ };
98
+
93
99
  case 'atlassian:Project':
94
100
  return urlIcon || {
95
101
  icon: IconType.Project,
@@ -1,7 +1,7 @@
1
1
  import { extractLink, extractSummary, extractTitle } from '../common/primitives';
2
2
  import { extractLozenge } from '../common/lozenge';
3
3
  import { extractLinkIcon } from './icon';
4
- import { extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount } from './utils';
4
+ import { extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
5
5
  import { extractPersonCreatedBy } from '../common/person';
6
6
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
7
7
  import { extractDateUpdated } from '../common/date/extractDateUpdated';
@@ -27,19 +27,22 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
27
27
  voteCount: extractVoteCount(data),
28
28
  createdBy: extractCreatedBy(data),
29
29
  createdOn: extractDateCreated(data),
30
+ dueOn: extractDueOn(data),
31
+ latestCommit: extractLatestCommit(data),
30
32
  linkIcon: extractLinkIcon(response, renderers),
31
33
  modifiedBy: extractModifiedBy(data),
32
34
  modifiedOn: extractDateUpdated(data),
33
35
  preview: extractPreview(data),
34
36
  priority: extractPriority(data),
37
+ provider: extractProviderIcon(data),
35
38
  programmingLanguage: extractProgrammingLanguage(data),
36
39
  snippet: extractSummary(data) || undefined,
37
40
  // Explicitly set here to remove an empty string
41
+ sourceBranch: extractSourceBranch(data),
38
42
  state: extractLozenge(data),
39
43
  subscriberCount: extractSubscriberCount(data),
44
+ targetBranch: extractTargetBranch(data),
40
45
  title: extractTitle(data) || url,
41
- provider: extractProviderIcon(data),
42
- latestCommit: extractLatestCommit(data),
43
46
  url: url
44
47
  };
45
48
  };
@@ -1,5 +1,12 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import { extractPersonCreatedBy, extractPersonUpdatedBy } from '../common/person';
2
3
 
4
+ var extractLinkName = function extractLinkName(link) {
5
+ if (link && _typeof(link) === 'object' && link['@type'] === 'Link') {
6
+ return link.name;
7
+ }
8
+ };
9
+
3
10
  var extractValue = function extractValue(data, key) {
4
11
  return data === null || data === void 0 ? void 0 : data[key];
5
12
  };
@@ -7,6 +14,9 @@ var extractValue = function extractValue(data, key) {
7
14
  export var extractCommentCount = function extractCommentCount(data) {
8
15
  return extractValue(data, 'schema:commentCount');
9
16
  };
17
+ export var extractDueOn = function extractDueOn(data) {
18
+ return extractValue(data, 'endTime');
19
+ };
10
20
  export var extractViewCount = function extractViewCount(data) {
11
21
  return extractValue(data, 'atlassian:viewCount');
12
22
  };
@@ -33,6 +43,12 @@ export var extractModifiedBy = function extractModifiedBy(data) {
33
43
  export var extractProgrammingLanguage = function extractProgrammingLanguage(data) {
34
44
  return extractValue(data, 'schema:programmingLanguage');
35
45
  };
46
+ export var extractSourceBranch = function extractSourceBranch(data) {
47
+ return extractLinkName(data['atlassian:mergeSource']);
48
+ };
36
49
  export var extractSubscriberCount = function extractSubscriberCount(data) {
37
50
  return extractValue(data, 'atlassian:subscriberCount');
51
+ };
52
+ export var extractTargetBranch = function extractTargetBranch(data) {
53
+ return extractLinkName(data['atlassian:mergeDestination']);
38
54
  };
@@ -12,11 +12,12 @@ var elementNamesToItems = function elementNamesToItems(elementNames) {
12
12
  };
13
13
 
14
14
  export var extractMetadata = function extractMetadata(jsonLd) {
15
- var _jsonLd$metadata, _metadata$primary, _metadata$secondary;
15
+ var _jsonLd$metadata, _metadata$primary, _metadata$secondary, _metadata$subtitle;
16
16
 
17
17
  var metadata = (_jsonLd$metadata = jsonLd.metadata) !== null && _jsonLd$metadata !== void 0 ? _jsonLd$metadata : [];
18
18
  return {
19
19
  primary: elementNamesToItems((_metadata$primary = metadata.primary) !== null && _metadata$primary !== void 0 ? _metadata$primary : []),
20
- secondary: elementNamesToItems((_metadata$secondary = metadata.secondary) !== null && _metadata$secondary !== void 0 ? _metadata$secondary : [])
20
+ secondary: elementNamesToItems((_metadata$secondary = metadata.secondary) !== null && _metadata$secondary !== void 0 ? _metadata$secondary : []),
21
+ subtitle: elementNamesToItems((_metadata$subtitle = metadata.subtitle) !== null && _metadata$subtitle !== void 0 ? _metadata$subtitle : [])
21
22
  };
22
23
  };
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useMemo, useCallback } from 'react';
4
4
  import { auth } from '@atlaskit/outbound-auth-flow-client';
5
5
  import { APIError } from '@atlaskit/linking-common';
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useCallback } from 'react';
4
4
  import { useSmartLinkContext } from '@atlaskit/link-provider';
5
5
  export function usePrefetch(url) {
@@ -1,10 +1,10 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
5
4
  import _inherits from "@babel/runtime/helpers/inherits";
6
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
 
9
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
10
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.28",
3
+ "version": "19.1.31",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import React from 'react';
4
4
  import { FormattedMessage } from 'react-intl-next';
5
5
  import { downloadUrl } from '@atlaskit/media-common';
@@ -1,10 +1,10 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _extends from "@babel/runtime/helpers/extends";
3
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
6
5
  var _excluded = ["popupMountPointId", "onClose"],
7
6
  _excluded2 = ["details"];
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
 
9
9
  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; }
10
10
 
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import React from 'react';
4
4
  import { FormattedMessage } from 'react-intl-next';
5
5
  import { messages } from '../../../messages';
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import React from 'react';
4
4
  import { FormattedMessage } from 'react-intl-next';
5
5
  import { messages } from '../../../messages';
@@ -5,11 +5,11 @@ var _templateObject;
5
5
  /** @jsx jsx */
6
6
  import React from 'react';
7
7
  import { css, jsx } from '@emotion/core';
8
- import { SmartLinkDirection, SmartLinkSize } from '../../../../../constants';
8
+ import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../../constants';
9
9
  import { getBaseStyles, getGapSize, renderChildren } from '../utils';
10
10
 
11
11
  var getBlockStyles = function getBlockStyles(direction, size) {
12
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n justify-content: flex-start;\n [data-separator] + [data-separator]:before {\n content: '\u2022';\n margin-right: ", "rem;\n }\n"])), getBaseStyles(direction, size), getGapSize(size));
12
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n justify-content: flex-start;\n [data-separator] + [data-separator]:before {\n content: '\u2022';\n margin-right: ", "rem;\n }\n // Pull request elements: source branch \u2192 target branch\n [data-smart-element='", "']\n + [data-smart-element='", "']:before {\n content: '\u2192';\n }\n // Pull request elements: target branch \u2190 source branch\n [data-smart-element='", "']\n + [data-smart-element='", "']:before {\n content: '\u2190';\n }\n"])), getBaseStyles(direction, size), getGapSize(size), ElementName.SourceBranch, ElementName.TargetBranch, ElementName.TargetBranch, ElementName.SourceBranch);
13
13
  };
14
14
  /**
15
15
  * A block represents a collection of elements and actions that are arranged
@@ -20,7 +20,7 @@ import * as Actions from '../actions';
20
20
  import { isFlexibleUiElement } from '../../../../utils/flexible';
21
21
  import ActionGroup from './action-group';
22
22
  import ElementGroup from './element-group';
23
- export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['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.Preview, ['block']), _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']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _ElementDisplaySchema);
23
+ export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _ElementDisplaySchema);
24
24
 
25
25
  var getDirectionStyles = function getDirectionStyles(direction) {
26
26
  switch (direction) {
@@ -38,6 +38,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
38
38
  items = _ref$items === void 0 ? [] : _ref$items,
39
39
  _ref$maxCount = _ref.maxCount,
40
40
  maxCount = _ref$maxCount === void 0 ? MAX_COUNT : _ref$maxCount,
41
+ name = _ref.name,
41
42
  overrideCss = _ref.overrideCss,
42
43
  _ref$size = _ref.size,
43
44
  size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size,
@@ -51,6 +52,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
51
52
  return jsx("span", {
52
53
  css: [getStyles(size), overrideCss],
53
54
  "data-fit-to-content": true,
55
+ "data-smart-element": name,
54
56
  "data-smart-element-avatar-group": true,
55
57
  "data-testid": testId
56
58
  }, jsx(AtlaskitAvatarGroup, {
@@ -65,6 +65,7 @@ var renderImageIcon = function renderImageIcon(url, testId) {
65
65
  var Badge = function Badge(_ref) {
66
66
  var icon = _ref.icon,
67
67
  label = _ref.label,
68
+ name = _ref.name,
68
69
  overrideCss = _ref.overrideCss,
69
70
  _ref$testId = _ref.testId,
70
71
  testId = _ref$testId === void 0 ? 'smart-element-badge' : _ref$testId,
@@ -79,6 +80,7 @@ var Badge = function Badge(_ref) {
79
80
  return jsx("span", {
80
81
  css: [badgeStyles, overrideCss],
81
82
  "data-fit-to-content": true,
83
+ "data-smart-element": name,
82
84
  "data-smart-element-badge": true,
83
85
  "data-testid": testId
84
86
  }, jsx("span", {
@@ -32,6 +32,7 @@ var typeToDescriptorMap = {
32
32
 
33
33
  var DateTime = function DateTime(_ref) {
34
34
  var date = _ref.date,
35
+ name = _ref.name,
35
36
  overrideCss = _ref.overrideCss,
36
37
  type = _ref.type,
37
38
  _ref$testId = _ref.testId,
@@ -71,6 +72,7 @@ var DateTime = function DateTime(_ref) {
71
72
  return jsx("span", {
72
73
  css: [styles, overrideCss],
73
74
  "data-separator": true,
75
+ "data-smart-element": name,
74
76
  "data-smart-element-date-time": true,
75
77
  "data-testid": testId
76
78
  }, text ? "".concat(text, " ").concat(context) : jsx(FormattedMessage, _extends({}, typeToDescriptorMap[type][typeVariant], {
@@ -68,6 +68,7 @@ var Icon = function Icon(_ref) {
68
68
  var icon = _ref.icon,
69
69
  _ref$label = _ref.label,
70
70
  label = _ref$label === void 0 ? 'Link' : _ref$label,
71
+ name = _ref.name,
71
72
  _ref$position = _ref.position,
72
73
  position = _ref$position === void 0 ? SmartLinkPosition.Top : _ref$position,
73
74
  overrideCss = _ref.overrideCss,
@@ -87,6 +88,7 @@ var Icon = function Icon(_ref) {
87
88
  return jsx("div", {
88
89
  css: [styles, renderStyles, overrideCss],
89
90
  "data-fit-to-content": true,
91
+ "data-smart-element": name,
90
92
  "data-smart-element-icon": true,
91
93
  "data-testid": testId
92
94
  }, element);
@@ -33,6 +33,12 @@ export var CreatedOn = createElement(ElementName.CreatedOn);
33
33
  */
34
34
 
35
35
  export var CreatedBy = createElement(ElementName.CreatedBy);
36
+ /**
37
+ * Creates a DueOn Lozenge element using the data from dueOn in the Flexible UI Context.
38
+ * @see Lozenge
39
+ */
40
+
41
+ export var DueOn = createElement(ElementName.DueOn);
36
42
  /**
37
43
  * Creates an element that contains Last Commit hash
38
44
  */
@@ -92,6 +98,12 @@ export var ReactCount = createElement(ElementName.ReactCount);
92
98
  */
93
99
 
94
100
  export var Snippet = createElement(ElementName.Snippet);
101
+ /**
102
+ * Creates a SourceBranch Text element using the data from sourceBranch in the Flexible UI Context.
103
+ * @see Text
104
+ */
105
+
106
+ export var SourceBranch = createElement(ElementName.SourceBranch);
95
107
  /**
96
108
  * Creates a State Lozenge element using the data from State in the Flexible UI Context.
97
109
  * @see Lozenge
@@ -104,6 +116,12 @@ export var State = createElement(ElementName.State);
104
116
  */
105
117
 
106
118
  export var SubscriberCount = createElement(ElementName.SubscriberCount);
119
+ /**
120
+ * Creates a TargetBranch Text element using the data from targetBranch in the Flexible UI Context.
121
+ * @see Text
122
+ */
123
+
124
+ export var TargetBranch = createElement(ElementName.TargetBranch);
107
125
  /**
108
126
  * Creates a Title Link element using the data from Title in the Flexible UI Context.
109
127
  * This represents the main link text within the Smart Link.
@@ -62,6 +62,7 @@ var Link = function Link(_ref) {
62
62
  var hideTooltip = _ref.hideTooltip,
63
63
  _ref$maxLines = _ref.maxLines,
64
64
  maxLines = _ref$maxLines === void 0 ? DEFAULT_MAX_LINES : _ref$maxLines,
65
+ name = _ref.name,
65
66
  overrideCss = _ref.overrideCss,
66
67
  _ref$size = _ref.size,
67
68
  size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size,
@@ -78,6 +79,7 @@ var Link = function Link(_ref) {
78
79
  }, [text]);
79
80
  var anchor = jsx("a", {
80
81
  css: [getAnchorStyles(size, theme, getMaxLines(maxLines), hasSpace), overrideCss],
82
+ "data-smart-element": name,
81
83
  "data-smart-element-link": true,
82
84
  "data-testid": testId,
83
85
  onClick: onClick,
@@ -17,6 +17,7 @@ var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["
17
17
  var Lozenge = function Lozenge(_ref) {
18
18
  var _ref$appearance = _ref.appearance,
19
19
  appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
20
+ name = _ref.name,
20
21
  overrideCss = _ref.overrideCss,
21
22
  text = _ref.text,
22
23
  _ref$testId = _ref.testId,
@@ -29,6 +30,7 @@ var Lozenge = function Lozenge(_ref) {
29
30
  return jsx("span", {
30
31
  css: [styles, overrideCss],
31
32
  "data-fit-to-content": true,
33
+ "data-smart-element": name,
32
34
  "data-smart-element-lozenge": true,
33
35
  "data-testid": testId
34
36
  }, jsx(AtlaskitLozenge, {