@atlaskit/smart-card 19.1.29 → 19.1.30
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 +7 -0
- package/dist/cjs/constants.js +3 -1
- package/dist/cjs/extractors/flexible/index.js +4 -2
- package/dist/cjs/extractors/flexible/utils.js +24 -2
- package/dist/cjs/extractors/hover/extractMetadata.js +3 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +2 -0
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -0
- package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +2 -0
- package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +2 -0
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +17 -3
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +2 -0
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +2 -0
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +2 -0
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +20 -12
- package/dist/cjs/view/HoverCard/components/hover-card-content.js +12 -5
- package/dist/cjs/view/HoverCard/styled.js +8 -5
- package/dist/cjs/view/HoverCard/utils.js +27 -3
- package/dist/es2019/constants.js +3 -1
- package/dist/es2019/extractors/flexible/index.js +5 -3
- package/dist/es2019/extractors/flexible/utils.js +9 -1
- package/dist/es2019/extractors/hover/extractMetadata.js +3 -2
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +11 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +5 -3
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +12 -0
- package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +26 -16
- package/dist/es2019/view/HoverCard/components/hover-card-content.js +11 -5
- package/dist/es2019/view/HoverCard/styled.js +31 -5
- package/dist/es2019/view/HoverCard/utils.js +27 -4
- package/dist/esm/constants.js +3 -1
- package/dist/esm/extractors/flexible/index.js +5 -3
- package/dist/esm/extractors/flexible/utils.js +13 -0
- package/dist/esm/extractors/hover/extractMetadata.js +3 -2
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/elements/index.js +12 -0
- package/dist/esm/view/FlexibleCard/components/elements/link/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/elements/text/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +20 -12
- package/dist/esm/view/HoverCard/components/hover-card-content.js +11 -5
- package/dist/esm/view/HoverCard/styled.js +8 -5
- package/dist/esm/view/HoverCard/utils.js +27 -3
- package/dist/types/constants.d.ts +3 -1
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +1 -0
- package/dist/types/extractors/flexible/utils.d.ts +2 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +22 -10
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +15 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +10 -0
- package/dist/types/view/FlexibleCard/components/elements/types.d.ts +7 -1
- package/dist/types/view/HoverCard/types.d.ts +1 -0
- package/dist/types/view/HoverCard/utils.d.ts +1 -1
- package/package.json +1 -1
- package/report.api.md +4 -0
|
@@ -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);
|
|
@@ -92,6 +92,12 @@ export var ReactCount = createElement(ElementName.ReactCount);
|
|
|
92
92
|
*/
|
|
93
93
|
|
|
94
94
|
export var Snippet = createElement(ElementName.Snippet);
|
|
95
|
+
/**
|
|
96
|
+
* Creates a SourceBranch Text element using the data from sourceBranch in the Flexible UI Context.
|
|
97
|
+
* @see Text
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
export var SourceBranch = createElement(ElementName.SourceBranch);
|
|
95
101
|
/**
|
|
96
102
|
* Creates a State Lozenge element using the data from State in the Flexible UI Context.
|
|
97
103
|
* @see Lozenge
|
|
@@ -104,6 +110,12 @@ export var State = createElement(ElementName.State);
|
|
|
104
110
|
*/
|
|
105
111
|
|
|
106
112
|
export var SubscriberCount = createElement(ElementName.SubscriberCount);
|
|
113
|
+
/**
|
|
114
|
+
* Creates a TargetBranch Text element using the data from targetBranch in the Flexible UI Context.
|
|
115
|
+
* @see Text
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
export var TargetBranch = createElement(ElementName.TargetBranch);
|
|
107
119
|
/**
|
|
108
120
|
* Creates a Title Link element using the data from Title in the Flexible UI Context.
|
|
109
121
|
* 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, {
|
|
@@ -26,7 +26,8 @@ var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
var Media = function Media(_ref) {
|
|
29
|
-
var
|
|
29
|
+
var name = _ref.name,
|
|
30
|
+
overrideCss = _ref.overrideCss,
|
|
30
31
|
_ref$testId = _ref.testId,
|
|
31
32
|
testId = _ref$testId === void 0 ? 'smart-element-media' : _ref$testId,
|
|
32
33
|
type = _ref.type,
|
|
@@ -38,6 +39,7 @@ var Media = function Media(_ref) {
|
|
|
38
39
|
|
|
39
40
|
return jsx("div", {
|
|
40
41
|
css: [styles, overrideCss],
|
|
42
|
+
"data-smart-element": name,
|
|
41
43
|
"data-smart-element-media": true,
|
|
42
44
|
"data-testid": testId
|
|
43
45
|
}, jsx(ImageIcon, {
|
|
@@ -24,6 +24,7 @@ var Text = function Text(_ref) {
|
|
|
24
24
|
_ref$maxLines = _ref.maxLines,
|
|
25
25
|
maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
|
|
26
26
|
message = _ref.message,
|
|
27
|
+
name = _ref.name,
|
|
27
28
|
overrideCss = _ref.overrideCss,
|
|
28
29
|
_ref$testId = _ref.testId,
|
|
29
30
|
testId = _ref$testId === void 0 ? 'smart-element-text' : _ref$testId;
|
|
@@ -35,6 +36,7 @@ var Text = function Text(_ref) {
|
|
|
35
36
|
return jsx("span", {
|
|
36
37
|
css: [getStyles(maxLines), overrideCss],
|
|
37
38
|
"data-separator": true,
|
|
39
|
+
"data-smart-element": name,
|
|
38
40
|
"data-smart-element-text": true,
|
|
39
41
|
"data-testid": testId
|
|
40
42
|
}, getFormattedMessage(message) || content);
|
|
@@ -45,10 +45,19 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
45
45
|
}
|
|
46
46
|
}), _defineProperty(_elementMappings, ElementName.CreatedBy, {
|
|
47
47
|
component: Text
|
|
48
|
+
}), _defineProperty(_elementMappings, ElementName.CreatedOn, {
|
|
49
|
+
component: DateTime
|
|
50
|
+
}), _defineProperty(_elementMappings, ElementName.LatestCommit, {
|
|
51
|
+
component: Badge,
|
|
52
|
+
props: {
|
|
53
|
+
icon: IconType.Commit
|
|
54
|
+
}
|
|
48
55
|
}), _defineProperty(_elementMappings, ElementName.LinkIcon, {
|
|
49
56
|
component: Icon
|
|
50
57
|
}), _defineProperty(_elementMappings, ElementName.ModifiedBy, {
|
|
51
58
|
component: Text
|
|
59
|
+
}), _defineProperty(_elementMappings, ElementName.ModifiedOn, {
|
|
60
|
+
component: DateTime
|
|
52
61
|
}), _defineProperty(_elementMappings, ElementName.Preview, {
|
|
53
62
|
component: Media
|
|
54
63
|
}), _defineProperty(_elementMappings, ElementName.Priority, {
|
|
@@ -58,12 +67,16 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
58
67
|
props: {
|
|
59
68
|
icon: IconType.ProgrammingLanguage
|
|
60
69
|
}
|
|
70
|
+
}), _defineProperty(_elementMappings, ElementName.Provider, {
|
|
71
|
+
component: Badge
|
|
61
72
|
}), _defineProperty(_elementMappings, ElementName.Snippet, {
|
|
62
73
|
component: Text,
|
|
63
74
|
props: {
|
|
64
75
|
maxLines: SNIPPET_DEFAULT_MAX_LINES,
|
|
65
76
|
overrideCss: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])), tokens.snippet)
|
|
66
77
|
}
|
|
78
|
+
}), _defineProperty(_elementMappings, ElementName.SourceBranch, {
|
|
79
|
+
component: Text
|
|
67
80
|
}), _defineProperty(_elementMappings, ElementName.State, {
|
|
68
81
|
component: Lozenge
|
|
69
82
|
}), _defineProperty(_elementMappings, ElementName.SubscriberCount, {
|
|
@@ -71,19 +84,10 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
71
84
|
props: {
|
|
72
85
|
icon: IconType.Subscriber
|
|
73
86
|
}
|
|
87
|
+
}), _defineProperty(_elementMappings, ElementName.TargetBranch, {
|
|
88
|
+
component: Text
|
|
74
89
|
}), _defineProperty(_elementMappings, ElementName.Title, {
|
|
75
90
|
component: Link
|
|
76
|
-
}), _defineProperty(_elementMappings, ElementName.CreatedOn, {
|
|
77
|
-
component: DateTime
|
|
78
|
-
}), _defineProperty(_elementMappings, ElementName.ModifiedOn, {
|
|
79
|
-
component: DateTime
|
|
80
|
-
}), _defineProperty(_elementMappings, ElementName.Provider, {
|
|
81
|
-
component: Badge
|
|
82
|
-
}), _defineProperty(_elementMappings, ElementName.LatestCommit, {
|
|
83
|
-
component: Badge,
|
|
84
|
-
props: {
|
|
85
|
-
icon: IconType.Commit
|
|
86
|
-
}
|
|
87
91
|
}), _elementMappings);
|
|
88
92
|
|
|
89
93
|
var getContextKey = function getContextKey(name) {
|
|
@@ -126,6 +130,8 @@ var getData = function getData(elementName, contextKey, context) {
|
|
|
126
130
|
return toDateTimeProps('modified', context.modifiedOn);
|
|
127
131
|
|
|
128
132
|
case ElementName.Snippet:
|
|
133
|
+
case ElementName.SourceBranch:
|
|
134
|
+
case ElementName.TargetBranch:
|
|
129
135
|
return toTextProps(data);
|
|
130
136
|
|
|
131
137
|
case ElementName.Title:
|
|
@@ -193,6 +199,8 @@ export var createElement = function createElement(name) {
|
|
|
193
199
|
return function (overrides) {
|
|
194
200
|
var context = useContext(FlexibleUiContext);
|
|
195
201
|
var data = getData(name, contextKey, context);
|
|
196
|
-
return data ? /*#__PURE__*/React.createElement(BaseElement, _extends({}, props, data, overrides
|
|
202
|
+
return data ? /*#__PURE__*/React.createElement(BaseElement, _extends({}, props, data, overrides, {
|
|
203
|
+
name: name
|
|
204
|
+
})) : null;
|
|
197
205
|
};
|
|
198
206
|
};
|
|
@@ -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
|
var flexibleUiOptions = {
|
|
13
14
|
hideElevation: true,
|
|
14
15
|
size: SmartLinkSize.Medium,
|
|
@@ -73,13 +74,16 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
73
74
|
}, [url, analytics]);
|
|
74
75
|
var footerActions = useMemo(function () {
|
|
75
76
|
return toFooterActions(cardActions);
|
|
76
|
-
}, [cardActions]);
|
|
77
|
+
}, [cardActions]);
|
|
78
|
+
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
79
|
+
var types = data ? extractType(data) : undefined; //TODO: EDM-3224 deleted simulated and use real JsonLd
|
|
77
80
|
|
|
78
|
-
var _extractMetadata = extractMetadata(getSimulatedMetadata(extensionKey)),
|
|
81
|
+
var _extractMetadata = extractMetadata(getSimulatedMetadata(extensionKey, types)),
|
|
79
82
|
primary = _extractMetadata.primary,
|
|
80
|
-
secondary = _extractMetadata.secondary
|
|
83
|
+
secondary = _extractMetadata.secondary,
|
|
84
|
+
subtitle = _extractMetadata.subtitle;
|
|
81
85
|
|
|
82
|
-
var
|
|
86
|
+
var titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
|
|
83
87
|
var body = data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, null) : /*#__PURE__*/React.createElement(SnippetBlock, null);
|
|
84
88
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
85
89
|
cardState: cardState,
|
|
@@ -90,9 +94,11 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
90
94
|
url: url
|
|
91
95
|
}, /*#__PURE__*/React.createElement(TitleBlock, {
|
|
92
96
|
actions: titleActions,
|
|
97
|
+
maxLines: titleMaxLines,
|
|
93
98
|
overrideCss: titleBlockCss,
|
|
94
99
|
size: SmartLinkSize.Large,
|
|
95
|
-
position: SmartLinkPosition.Center
|
|
100
|
+
position: SmartLinkPosition.Center,
|
|
101
|
+
subtitle: subtitle
|
|
96
102
|
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
97
103
|
primary: primary,
|
|
98
104
|
secondary: secondary,
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/core';
|
|
6
6
|
import { loadingPlaceholderClassName } from '../../index';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export var
|
|
7
|
+
var blockGap = '0.5rem';
|
|
8
|
+
var elementGap = '0.5rem';
|
|
9
|
+
var separatorCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n"])), elementGap);
|
|
10
|
+
export var HoverCardContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: 24rem;\n padding: 1rem;\n\n .", " {\n display: none;\n }\n"])), loadingPlaceholderClassName);
|
|
11
|
+
export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n gap: ", ";\n\n ", "\n\n // title and subtitle element group\n [data-smart-element-group] {\n // gap between title and subtitle\n gap: 0.06rem;\n\n /* subtitle element group */\n > [data-smart-element-group] {\n > span {\n margin-right: ", ";\n }\n }\n }\n"])), blockGap, separatorCss, elementGap);
|
|
12
|
+
export var metadataBlockCss = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n gap: 0px;\n\n /* primary element group */\n [data-smart-element-group]:nth-of-type(1) {\n flex-grow: 7;\n\n // a separator between text-based element\n ", "\n\n /* horizontal spacing between elements in group */\n > span {\n margin-right: ", ";\n }\n }\n /* secondary element group */\n [data-smart-element-group]:nth-of-type(2) {\n flex-grow: 3;\n /* horizontal spacing between elements in group */\n > span {\n margin-left: ", ";\n }\n }\n"])), separatorCss, elementGap, elementGap);
|
|
13
|
+
export var footerBlockCss = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-top: 0.25rem;\n"])));
|
|
@@ -2,13 +2,35 @@ import { ElementName } from '../../constants';
|
|
|
2
2
|
export var HOVER_CARD_ANALYTICS_DISPLAY = 'flexible';
|
|
3
3
|
export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
4
4
|
var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
5
|
+
var types = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
5
6
|
|
|
6
7
|
switch (extensionKey) {
|
|
8
|
+
case 'bitbucket-object-provider':
|
|
9
|
+
case 'native-bitbucket-object-provider':
|
|
10
|
+
if (types.includes('atlassian:SourceCodePullRequest')) {
|
|
11
|
+
return {
|
|
12
|
+
metadata: {
|
|
13
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.SubscriberCount, ElementName.State],
|
|
14
|
+
secondary: [],
|
|
15
|
+
subtitle: [ElementName.SourceBranch, ElementName.TargetBranch]
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
metadata: {
|
|
22
|
+
primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
|
|
23
|
+
secondary: [],
|
|
24
|
+
subtitle: []
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
7
28
|
case 'confluence-object-provider':
|
|
8
29
|
return {
|
|
9
30
|
metadata: {
|
|
10
31
|
primary: [ElementName.AuthorGroup, ElementName.CreatedBy],
|
|
11
|
-
secondary: [ElementName.CommentCount, ElementName.ReactCount]
|
|
32
|
+
secondary: [ElementName.CommentCount, ElementName.ReactCount],
|
|
33
|
+
subtitle: []
|
|
12
34
|
}
|
|
13
35
|
};
|
|
14
36
|
|
|
@@ -16,7 +38,8 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
16
38
|
return {
|
|
17
39
|
metadata: {
|
|
18
40
|
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.Priority],
|
|
19
|
-
secondary: []
|
|
41
|
+
secondary: [],
|
|
42
|
+
subtitle: []
|
|
20
43
|
}
|
|
21
44
|
};
|
|
22
45
|
|
|
@@ -24,7 +47,8 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
24
47
|
return {
|
|
25
48
|
metadata: {
|
|
26
49
|
primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
|
|
27
|
-
secondary: []
|
|
50
|
+
secondary: [],
|
|
51
|
+
subtitle: []
|
|
28
52
|
}
|
|
29
53
|
};
|
|
30
54
|
}
|
|
@@ -68,7 +68,7 @@ export declare enum SmartLinkWidth {
|
|
|
68
68
|
* When adding an element...
|
|
69
69
|
* 1) Create base element if it doesn't already exist.
|
|
70
70
|
* Base element are inside src/view/FlexibleCard/components/elements.
|
|
71
|
-
* E.g. Badge,DateTime, Icon, Lozenge, etc.
|
|
71
|
+
* E.g. Badge, DateTime, Icon, Lozenge, etc.
|
|
72
72
|
* 2) Update FlexibleUiContext with the new prop for data representing
|
|
73
73
|
* the element, preferably with the same name as the element itself.
|
|
74
74
|
* (src/state/flexible-ui-context/types.ts)
|
|
@@ -94,8 +94,10 @@ export declare enum ElementName {
|
|
|
94
94
|
Provider = "Provider",
|
|
95
95
|
ReactCount = "ReactCount",
|
|
96
96
|
Snippet = "Snippet",
|
|
97
|
+
SourceBranch = "SourceBranch",
|
|
97
98
|
State = "State",
|
|
98
99
|
SubscriberCount = "SubscriberCount",
|
|
100
|
+
TargetBranch = "TargetBranch",
|
|
99
101
|
Title = "Title",
|
|
100
102
|
ViewCount = "ViewCount",
|
|
101
103
|
VoteCount = "VoteCount",
|
|
@@ -17,6 +17,7 @@ export declare const TEST_BASE_DATA: JsonLd.Data.BaseData;
|
|
|
17
17
|
export declare const TEST_DATA_WITH_EMOJI: JsonLd.Data.BaseData;
|
|
18
18
|
export declare const TEST_DATA_WITH_NO_PREFIX: JsonLd.Data.BaseData;
|
|
19
19
|
export declare const TEST_PROJECT: JsonLd.Data.Project;
|
|
20
|
+
export declare const TEST_PULL_REQUEST: JsonLd.Data.SourceCodePullRequest;
|
|
20
21
|
export declare const TEST_TASK: JsonLd.Data.Task;
|
|
21
22
|
export declare const TEST_META_DATA: JsonLd.Meta.BaseMeta;
|
|
22
23
|
export declare const TEST_DOCUMENT: JsonLd.Data.Document;
|
|
@@ -6,4 +6,6 @@ export declare const extractVoteCount: (data: JsonLd.Data.BaseData) => number |
|
|
|
6
6
|
export declare const extractCreatedBy: (data: JsonLd.Data.BaseData) => string | undefined;
|
|
7
7
|
export declare const extractModifiedBy: (data: JsonLd.Data.BaseData) => string | undefined;
|
|
8
8
|
export declare const extractProgrammingLanguage: (data: JsonLd.Data.BaseData) => string | undefined;
|
|
9
|
+
export declare const extractSourceBranch: (data: JsonLd.Data.SourceCodePullRequest) => string | undefined;
|
|
9
10
|
export declare const extractSubscriberCount: (data: JsonLd.Data.BaseData) => number | undefined;
|
|
11
|
+
export declare const extractTargetBranch: (data: JsonLd.Data.SourceCodePullRequest) => string | undefined;
|
|
@@ -52,6 +52,10 @@ export declare type FlexibleUiDataContext = {
|
|
|
52
52
|
* @see CreatedOn
|
|
53
53
|
*/
|
|
54
54
|
createdOn?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Contains the information about the latest commit in the repository
|
|
57
|
+
*/
|
|
58
|
+
latestCommit?: string;
|
|
55
59
|
/**
|
|
56
60
|
* Contains the favicon of the resource.
|
|
57
61
|
* @type Icon
|
|
@@ -88,12 +92,24 @@ export declare type FlexibleUiDataContext = {
|
|
|
88
92
|
* @see ProgrammingLanguage
|
|
89
93
|
*/
|
|
90
94
|
programmingLanguage?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Contains the provider icon of the linked resource.
|
|
97
|
+
* @type Icon
|
|
98
|
+
* @see Provider
|
|
99
|
+
*/
|
|
100
|
+
provider?: Icon;
|
|
91
101
|
/**
|
|
92
102
|
* Contains the snippet of the resource.
|
|
93
103
|
* @type string
|
|
94
104
|
* @see Snippet
|
|
95
105
|
*/
|
|
96
106
|
snippet?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Contains the source branch name of the link typed pull request.
|
|
109
|
+
* @type string
|
|
110
|
+
* @see SourceBranch
|
|
111
|
+
*/
|
|
112
|
+
sourceBranch?: string;
|
|
97
113
|
/**
|
|
98
114
|
* Contains the number of subscribers of the linked resource.
|
|
99
115
|
* @type number
|
|
@@ -106,6 +122,12 @@ export declare type FlexibleUiDataContext = {
|
|
|
106
122
|
* @see SubscriberCount
|
|
107
123
|
*/
|
|
108
124
|
state?: LinkLozenge;
|
|
125
|
+
/**
|
|
126
|
+
* Contains the target branch name of the link typed pull request.
|
|
127
|
+
* @type string
|
|
128
|
+
* @see TargetBranch
|
|
129
|
+
*/
|
|
130
|
+
targetBranch?: string;
|
|
109
131
|
/**
|
|
110
132
|
* Contains the Title of the linked resource.
|
|
111
133
|
* @type string
|
|
@@ -118,16 +140,6 @@ export declare type FlexibleUiDataContext = {
|
|
|
118
140
|
* @see Title
|
|
119
141
|
*/
|
|
120
142
|
url?: string;
|
|
121
|
-
/**
|
|
122
|
-
* Contains the provider icon of the linked resource.
|
|
123
|
-
* @type Icon
|
|
124
|
-
* @see Provider
|
|
125
|
-
*/
|
|
126
|
-
provider?: Icon;
|
|
127
|
-
/**
|
|
128
|
-
* Contains the information about the latest commit in the repository
|
|
129
|
-
*/
|
|
130
|
-
latestCommit?: string;
|
|
131
143
|
};
|
|
132
144
|
export declare type Icon = {
|
|
133
145
|
icon?: IconType;
|
|
@@ -103,7 +103,7 @@ export declare type ActionItem = NamedActionItem | CustomActionItem;
|
|
|
103
103
|
/**
|
|
104
104
|
* A type that contains all the possible combinations of elements with their corresponding props.
|
|
105
105
|
*/
|
|
106
|
-
export declare type ElementItemProps = AuthorGroup | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | State | SubscriberCount | Title | ViewCount | VoteCount;
|
|
106
|
+
export declare type ElementItemProps = AuthorGroup | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
107
107
|
/**
|
|
108
108
|
* Represents the props available for an AuthorGroup element.
|
|
109
109
|
* @see AuthorGroup
|
|
@@ -217,6 +217,13 @@ export declare type ReactCount = {
|
|
|
217
217
|
export declare type Snippet = {
|
|
218
218
|
name: ElementName.Snippet;
|
|
219
219
|
};
|
|
220
|
+
/**
|
|
221
|
+
* Represents the props available for an SourceBranch element.
|
|
222
|
+
* @see SourceBranch
|
|
223
|
+
*/
|
|
224
|
+
export declare type SourceBranch = {
|
|
225
|
+
name: ElementName.SourceBranch;
|
|
226
|
+
};
|
|
220
227
|
/**
|
|
221
228
|
* Represents the props available for an State element.
|
|
222
229
|
* @see State
|
|
@@ -231,6 +238,13 @@ export declare type State = {
|
|
|
231
238
|
export declare type SubscriberCount = {
|
|
232
239
|
name: ElementName.SubscriberCount;
|
|
233
240
|
};
|
|
241
|
+
/**
|
|
242
|
+
* Represents the props available for an TargetBranch element.
|
|
243
|
+
* @see TargetBranch
|
|
244
|
+
*/
|
|
245
|
+
export declare type TargetBranch = {
|
|
246
|
+
name: ElementName.TargetBranch;
|
|
247
|
+
};
|
|
234
248
|
/**
|
|
235
249
|
* Represents the props available for an Title element.
|
|
236
250
|
* @see Title
|
|
@@ -81,6 +81,11 @@ export declare const ReactCount: import("react").FC<BadgeProps>;
|
|
|
81
81
|
* @see Text
|
|
82
82
|
*/
|
|
83
83
|
export declare const Snippet: import("react").FC<TextProps>;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a SourceBranch Text element using the data from sourceBranch in the Flexible UI Context.
|
|
86
|
+
* @see Text
|
|
87
|
+
*/
|
|
88
|
+
export declare const SourceBranch: import("react").FC<TextProps>;
|
|
84
89
|
/**
|
|
85
90
|
* Creates a State Lozenge element using the data from State in the Flexible UI Context.
|
|
86
91
|
* @see Lozenge
|
|
@@ -91,6 +96,11 @@ export declare const State: import("react").FC<LozengeProps>;
|
|
|
91
96
|
* @see Badge
|
|
92
97
|
*/
|
|
93
98
|
export declare const SubscriberCount: import("react").FC<BadgeProps>;
|
|
99
|
+
/**
|
|
100
|
+
* Creates a TargetBranch Text element using the data from targetBranch in the Flexible UI Context.
|
|
101
|
+
* @see Text
|
|
102
|
+
*/
|
|
103
|
+
export declare const TargetBranch: import("react").FC<TextProps>;
|
|
94
104
|
/**
|
|
95
105
|
* Creates a Title Link element using the data from Title in the Flexible UI Context.
|
|
96
106
|
* This represents the main link text within the Smart Link.
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { SerializedStyles } from '@emotion/core';
|
|
2
|
-
import { SmartLinkSize } from '../../../../constants';
|
|
2
|
+
import { ElementName, SmartLinkSize } from '../../../../constants';
|
|
3
3
|
export declare type ElementProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Name of the element, can be used as a selector.
|
|
6
|
+
* E.g. [data-smart-element="Provider"]
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
name?: ElementName;
|
|
4
10
|
/**
|
|
5
11
|
* Any additional CSS properties to apply to the element.
|
|
6
12
|
*/
|
|
@@ -13,6 +13,7 @@ export declare type PreviewInvokeMethod = 'keyboard' | 'mouse_hover' | 'mouse_cl
|
|
|
13
13
|
export interface MetadataOptions {
|
|
14
14
|
primary: Array<ElementItem>;
|
|
15
15
|
secondary: Array<ElementItem>;
|
|
16
|
+
subtitle: Array<ElementItem>;
|
|
16
17
|
}
|
|
17
18
|
export declare type HoverCardContentProps = {
|
|
18
19
|
analytics: AnalyticsFacade;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
2
|
export declare const HOVER_CARD_ANALYTICS_DISPLAY = "flexible";
|
|
3
|
-
export declare const getSimulatedMetadata: (extensionKey?: string) => JsonLd.Primitives.Property<any>;
|
|
3
|
+
export declare const getSimulatedMetadata: (extensionKey?: string, types?: JsonLd.Primitives.ObjectType[]) => JsonLd.Primitives.Property<any>;
|
package/package.json
CHANGED
package/report.api.md
CHANGED
|
@@ -267,10 +267,14 @@ export enum ElementName {
|
|
|
267
267
|
// (undocumented)
|
|
268
268
|
Snippet = 'Snippet',
|
|
269
269
|
// (undocumented)
|
|
270
|
+
SourceBranch = 'SourceBranch',
|
|
271
|
+
// (undocumented)
|
|
270
272
|
State = 'State',
|
|
271
273
|
// (undocumented)
|
|
272
274
|
SubscriberCount = 'SubscriberCount',
|
|
273
275
|
// (undocumented)
|
|
276
|
+
TargetBranch = 'TargetBranch',
|
|
277
|
+
// (undocumented)
|
|
274
278
|
Title = 'Title',
|
|
275
279
|
// (undocumented)
|
|
276
280
|
ViewCount = 'ViewCount',
|