@atlaskit/smart-card 19.1.25 → 19.1.28
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 +22 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +9 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +2 -1
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +30 -30
- package/dist/cjs/view/HoverCard/components/hover-card-content.js +15 -5
- package/dist/cjs/view/HoverCard/styled.js +10 -4
- package/dist/cjs/view/HoverCard/utils.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +8 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +23 -23
- package/dist/es2019/view/HoverCard/components/hover-card-content.js +15 -6
- package/dist/es2019/view/HoverCard/styled.js +29 -2
- package/dist/es2019/view/HoverCard/utils.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/CardWithUrl/component.js +8 -1
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +2 -1
- package/dist/esm/view/FlexibleCard/components/elements/index.js +23 -23
- package/dist/esm/view/HoverCard/components/hover-card-content.js +15 -6
- package/dist/esm/view/HoverCard/styled.js +5 -2
- package/dist/esm/view/HoverCard/utils.js +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +156 -6
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +20 -20
- package/dist/types/view/HoverCard/styled.d.ts +3 -0
- package/package.json +1 -1
- package/report.api.md +501 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 19.1.28
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`455538b6a3f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/455538b6a3f) - use useFeatureFlag hook to get hover preview FF
|
|
8
|
+
|
|
9
|
+
## 19.1.27
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`98d3f88e428`](https://bitbucket.org/atlassian/atlassian-frontend/commits/98d3f88e428) - This PR adds external element typings for Flexible UI metadata.
|
|
14
|
+
This means code completion will now be available when an element has a prop that can be overridden.
|
|
15
|
+
As of this PR, these are the `CreatedOn` and `ModifiedOn` elements, which now accept some `text` which will override the existing text.
|
|
16
|
+
|
|
17
|
+
This PR also exposes the overrideCss prop, allowing integrators to supply any CSS for their elements.
|
|
18
|
+
|
|
19
|
+
## 19.1.26
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`00c79cca5b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/00c79cca5b0) - hover card white space changes
|
|
24
|
+
|
|
3
25
|
## 19.1.25
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -11,6 +11,8 @@ exports.CardWithUrlContent = CardWithUrlContent;
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
15
|
+
|
|
14
16
|
var _utils = require("../../utils");
|
|
15
17
|
|
|
16
18
|
var measure = _interopRequireWildcard(require("../../utils/performance"));
|
|
@@ -73,7 +75,13 @@ function CardWithUrlContent(_ref) {
|
|
|
73
75
|
var services = (0, _helpers.getServices)(state.details);
|
|
74
76
|
var isFlexibleUi = (0, _react.useMemo)(function () {
|
|
75
77
|
return (0, _flexible.isFlexibleUiCard)(children);
|
|
76
|
-
}, [children]);
|
|
78
|
+
}, [children]);
|
|
79
|
+
var showHoverPreviewFlag = (0, _linkProvider.useFeatureFlag)('showHoverPreview');
|
|
80
|
+
|
|
81
|
+
if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
|
|
82
|
+
showHoverPreview = showHoverPreviewFlag;
|
|
83
|
+
} // Setup UI handlers.
|
|
84
|
+
|
|
77
85
|
|
|
78
86
|
var handleClick = (0, _react.useCallback)(function (event) {
|
|
79
87
|
var clickUrl = (0, _helpers.getClickUrl)(url, state.details);
|
|
@@ -128,11 +128,12 @@ var renderElementItems = function renderElementItems() {
|
|
|
128
128
|
var name = curr.name,
|
|
129
129
|
props = (0, _objectWithoutProperties2.default)(curr, _excluded);
|
|
130
130
|
var Element = Elements[name];
|
|
131
|
+
var typedProps = props;
|
|
131
132
|
|
|
132
133
|
if (Element && isElementDisplayValid(name, display)) {
|
|
133
134
|
var element = /*#__PURE__*/_react.default.createElement(Element, (0, _extends2.default)({
|
|
134
135
|
key: idx
|
|
135
|
-
},
|
|
136
|
+
}, typedProps));
|
|
136
137
|
|
|
137
138
|
if (!isElementNull(element)) {
|
|
138
139
|
return [].concat((0, _toConsumableArray2.default)(acc), [element]);
|
|
@@ -33,45 +33,24 @@ var CollaboratorGroup = (0, _utils.createElement)(_constants.ElementName.Collabo
|
|
|
33
33
|
exports.CollaboratorGroup = CollaboratorGroup;
|
|
34
34
|
var CommentCount = (0, _utils.createElement)(_constants.ElementName.CommentCount);
|
|
35
35
|
/**
|
|
36
|
-
* Creates a
|
|
37
|
-
* @see
|
|
36
|
+
* Creates a CreatedOn DateTime element using the data from CreatedOn in the Flexible UI Context.
|
|
37
|
+
* @see DateTime
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
exports.CommentCount = CommentCount;
|
|
41
|
-
var
|
|
42
|
-
/**
|
|
43
|
-
* Creates a ReactCount Badge element using the data from ReactCount in the Flexible UI Context.
|
|
44
|
-
* @see Badge
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
exports.ViewCount = ViewCount;
|
|
48
|
-
var ReactCount = (0, _utils.createElement)(_constants.ElementName.ReactCount);
|
|
49
|
-
/**
|
|
50
|
-
* Creates a VoteCount Badge element using the data from VoteCount in the Flexible UI Context.
|
|
51
|
-
* @see Badge
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
exports.ReactCount = ReactCount;
|
|
55
|
-
var VoteCount = (0, _utils.createElement)(_constants.ElementName.VoteCount);
|
|
41
|
+
var CreatedOn = (0, _utils.createElement)(_constants.ElementName.CreatedOn);
|
|
56
42
|
/**
|
|
57
43
|
* Creates a CreatedBy text element using the data from CreatedBy in the Flexible UI Context.
|
|
58
44
|
* @see Text
|
|
59
45
|
*/
|
|
60
46
|
|
|
61
|
-
exports.
|
|
47
|
+
exports.CreatedOn = CreatedOn;
|
|
62
48
|
var CreatedBy = (0, _utils.createElement)(_constants.ElementName.CreatedBy);
|
|
63
|
-
/**
|
|
64
|
-
* Creates a CreatedOn DateTime element using the data from CreatedOn in the Flexible UI Context.
|
|
65
|
-
* @see DateTime
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
exports.CreatedBy = CreatedBy;
|
|
69
|
-
var CreatedOn = (0, _utils.createElement)(_constants.ElementName.CreatedOn);
|
|
70
49
|
/**
|
|
71
50
|
* Creates an element that contains Last Commit hash
|
|
72
51
|
*/
|
|
73
52
|
|
|
74
|
-
exports.
|
|
53
|
+
exports.CreatedBy = CreatedBy;
|
|
75
54
|
var LatestCommit = (0, _utils.createElement)(_constants.ElementName.LatestCommit);
|
|
76
55
|
/**
|
|
77
56
|
* Creates a LinkIcon Icon element using the data from LinkIcon in the Flexible UI Context.
|
|
@@ -115,12 +94,26 @@ var Priority = (0, _utils.createElement)(_constants.ElementName.Priority);
|
|
|
115
94
|
|
|
116
95
|
exports.Priority = Priority;
|
|
117
96
|
var ProgrammingLanguage = (0, _utils.createElement)(_constants.ElementName.ProgrammingLanguage);
|
|
97
|
+
/**
|
|
98
|
+
* Creates a Provider Badge element using the data from Provider in the Flexible UI Context.
|
|
99
|
+
* @see Badge
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
exports.ProgrammingLanguage = ProgrammingLanguage;
|
|
103
|
+
var Provider = (0, _utils.createElement)(_constants.ElementName.Provider);
|
|
104
|
+
/**
|
|
105
|
+
* Creates a ReactCount Badge element using the data from ReactCount in the Flexible UI Context.
|
|
106
|
+
* @see Badge
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
exports.Provider = Provider;
|
|
110
|
+
var ReactCount = (0, _utils.createElement)(_constants.ElementName.ReactCount);
|
|
118
111
|
/**
|
|
119
112
|
* Creates a Snippet element using the data from Snippet in the Flexible UI Context.
|
|
120
113
|
* @see Text
|
|
121
114
|
*/
|
|
122
115
|
|
|
123
|
-
exports.
|
|
116
|
+
exports.ReactCount = ReactCount;
|
|
124
117
|
var Snippet = (0, _utils.createElement)(_constants.ElementName.Snippet);
|
|
125
118
|
/**
|
|
126
119
|
* Creates a State Lozenge element using the data from State in the Flexible UI Context.
|
|
@@ -145,10 +138,17 @@ var SubscriberCount = (0, _utils.createElement)(_constants.ElementName.Subscribe
|
|
|
145
138
|
exports.SubscriberCount = SubscriberCount;
|
|
146
139
|
var Title = (0, _utils.createElement)(_constants.ElementName.Title);
|
|
147
140
|
/**
|
|
148
|
-
* Creates a
|
|
141
|
+
* Creates a ViewCount Badge element using the data from ViewCount in the Flexible UI Context.
|
|
149
142
|
* @see Badge
|
|
150
143
|
*/
|
|
151
144
|
|
|
152
145
|
exports.Title = Title;
|
|
153
|
-
var
|
|
154
|
-
|
|
146
|
+
var ViewCount = (0, _utils.createElement)(_constants.ElementName.ViewCount);
|
|
147
|
+
/**
|
|
148
|
+
* Creates a VoteCount Badge element using the data from VoteCount in the Flexible UI Context.
|
|
149
|
+
* @see Badge
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
exports.ViewCount = ViewCount;
|
|
153
|
+
var VoteCount = (0, _utils.createElement)(_constants.ElementName.VoteCount);
|
|
154
|
+
exports.VoteCount = VoteCount;
|
|
@@ -29,15 +29,18 @@ var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"))
|
|
|
29
29
|
|
|
30
30
|
var _helpers = require("../../../state/helpers");
|
|
31
31
|
|
|
32
|
+
var _styled = require("../styled");
|
|
33
|
+
|
|
32
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
35
|
|
|
34
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
37
|
|
|
36
38
|
var flexibleUiOptions = {
|
|
37
39
|
hideElevation: true,
|
|
38
|
-
size: _constants.SmartLinkSize.
|
|
40
|
+
size: _constants.SmartLinkSize.Medium,
|
|
39
41
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
40
|
-
theme: _constants.SmartLinkTheme.Black
|
|
42
|
+
theme: _constants.SmartLinkTheme.Black,
|
|
43
|
+
hidePadding: true
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
var getOpenAction = function getOpenAction(url, analytics) {
|
|
@@ -112,13 +115,20 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
112
115
|
ui: flexibleUiOptions,
|
|
113
116
|
url: url
|
|
114
117
|
}, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, {
|
|
115
|
-
actions: titleActions
|
|
118
|
+
actions: titleActions,
|
|
119
|
+
overrideCss: _styled.titleBlockCss,
|
|
120
|
+
size: _constants.SmartLinkSize.Large,
|
|
121
|
+
position: _constants.SmartLinkPosition.Center
|
|
116
122
|
}), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
|
|
117
123
|
primary: primary,
|
|
118
124
|
secondary: secondary,
|
|
119
|
-
size: _constants.SmartLinkSize.
|
|
125
|
+
size: _constants.SmartLinkSize.Large,
|
|
126
|
+
overrideCss: _styled.metadataBlockCss,
|
|
127
|
+
maxLines: 1
|
|
120
128
|
}), body, /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, {
|
|
121
|
-
actions: footerActions
|
|
129
|
+
actions: footerActions,
|
|
130
|
+
size: _constants.SmartLinkSize.Large,
|
|
131
|
+
overrideCss: _styled.footerBlockCss
|
|
122
132
|
}));
|
|
123
133
|
};
|
|
124
134
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.HoverCardContainer = void 0;
|
|
8
|
+
exports.titleBlockCss = exports.metadataBlockCss = exports.footerBlockCss = exports.HoverCardContainer = void 0;
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
11
|
|
|
@@ -13,7 +13,13 @@ var _core = require("@emotion/core");
|
|
|
13
13
|
|
|
14
14
|
var _index = require("../../index");
|
|
15
15
|
|
|
16
|
-
var _templateObject;
|
|
16
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
17
17
|
|
|
18
|
-
var HoverCardContainer = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: none;\n border-width: 0;\n
|
|
19
|
-
exports.HoverCardContainer = HoverCardContainer;
|
|
18
|
+
var HoverCardContainer = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])), _index.loadingPlaceholderClassName);
|
|
19
|
+
exports.HoverCardContainer = HoverCardContainer;
|
|
20
|
+
var titleBlockCss = (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n gap: 0.5rem;\n"])));
|
|
21
|
+
exports.titleBlockCss = titleBlockCss;
|
|
22
|
+
var metadataBlockCss = (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n gap: 0px;\n\n /* primary element group */\n [data-smart-element-group]:first-of-type {\n flex-grow: 7;\n /* horizontal spacing between elements in group */\n > span {\n margin-right: 0.5rem;\n }\n }\n /* secondary element group */\n [data-smart-element-group]:last-of-type {\n flex-grow: 3;\n /* horizontal spacing between elements in group */\n > span {\n margin-left: 0.5rem;\n }\n }\n"])));
|
|
23
|
+
exports.metadataBlockCss = metadataBlockCss;
|
|
24
|
+
var footerBlockCss = (0, _core.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n padding-top: 0.25rem;\n"])));
|
|
25
|
+
exports.footerBlockCss = footerBlockCss;
|
|
@@ -17,8 +17,8 @@ var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
17
17
|
case 'confluence-object-provider':
|
|
18
18
|
return {
|
|
19
19
|
metadata: {
|
|
20
|
-
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.CreatedBy
|
|
21
|
-
secondary: []
|
|
20
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.CreatedBy],
|
|
21
|
+
secondary: [_constants.ElementName.CommentCount, _constants.ElementName.ReactCount]
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
2
3
|
import { isSpecialEvent } from '../../utils';
|
|
3
4
|
import * as measure from '../../utils/performance';
|
|
4
5
|
import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct } from '../../state/helpers';
|
|
@@ -45,7 +46,13 @@ export function CardWithUrlContent({
|
|
|
45
46
|
const product = getProduct(state.details);
|
|
46
47
|
const subproduct = getSubproduct(state.details);
|
|
47
48
|
const services = getServices(state.details);
|
|
48
|
-
let isFlexibleUi = useMemo(() => isFlexibleUiCard(children), [children]);
|
|
49
|
+
let isFlexibleUi = useMemo(() => isFlexibleUiCard(children), [children]);
|
|
50
|
+
const showHoverPreviewFlag = useFeatureFlag('showHoverPreview');
|
|
51
|
+
|
|
52
|
+
if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
|
|
53
|
+
showHoverPreview = showHoverPreviewFlag;
|
|
54
|
+
} // Setup UI handlers.
|
|
55
|
+
|
|
49
56
|
|
|
50
57
|
const handleClick = useCallback(event => {
|
|
51
58
|
const clickUrl = getClickUrl(url, state.details);
|
|
@@ -116,11 +116,12 @@ export const renderElementItems = (items = [], display = 'inline') => {
|
|
|
116
116
|
...props
|
|
117
117
|
} = curr;
|
|
118
118
|
const Element = Elements[name];
|
|
119
|
+
const typedProps = props;
|
|
119
120
|
|
|
120
121
|
if (Element && isElementDisplayValid(name, display)) {
|
|
121
122
|
const element = /*#__PURE__*/React.createElement(Element, _extends({
|
|
122
123
|
key: idx
|
|
123
|
-
},
|
|
124
|
+
}, typedProps));
|
|
124
125
|
|
|
125
126
|
if (!isElementNull(element)) {
|
|
126
127
|
return [...acc, element];
|
|
@@ -22,35 +22,17 @@ export const CollaboratorGroup = createElement(ElementName.CollaboratorGroup);
|
|
|
22
22
|
|
|
23
23
|
export const CommentCount = createElement(ElementName.CommentCount);
|
|
24
24
|
/**
|
|
25
|
-
* Creates a
|
|
26
|
-
* @see
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
export const ViewCount = createElement(ElementName.ViewCount);
|
|
30
|
-
/**
|
|
31
|
-
* Creates a ReactCount Badge element using the data from ReactCount in the Flexible UI Context.
|
|
32
|
-
* @see Badge
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
export const ReactCount = createElement(ElementName.ReactCount);
|
|
36
|
-
/**
|
|
37
|
-
* Creates a VoteCount Badge element using the data from VoteCount in the Flexible UI Context.
|
|
38
|
-
* @see Badge
|
|
25
|
+
* Creates a CreatedOn DateTime element using the data from CreatedOn in the Flexible UI Context.
|
|
26
|
+
* @see DateTime
|
|
39
27
|
*/
|
|
40
28
|
|
|
41
|
-
export const
|
|
29
|
+
export const CreatedOn = createElement(ElementName.CreatedOn);
|
|
42
30
|
/**
|
|
43
31
|
* Creates a CreatedBy text element using the data from CreatedBy in the Flexible UI Context.
|
|
44
32
|
* @see Text
|
|
45
33
|
*/
|
|
46
34
|
|
|
47
35
|
export const CreatedBy = createElement(ElementName.CreatedBy);
|
|
48
|
-
/**
|
|
49
|
-
* Creates a CreatedOn DateTime element using the data from CreatedOn in the Flexible UI Context.
|
|
50
|
-
* @see DateTime
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
export const CreatedOn = createElement(ElementName.CreatedOn);
|
|
54
36
|
/**
|
|
55
37
|
* Creates an element that contains Last Commit hash
|
|
56
38
|
*/
|
|
@@ -92,6 +74,18 @@ export const Priority = createElement(ElementName.Priority);
|
|
|
92
74
|
*/
|
|
93
75
|
|
|
94
76
|
export const ProgrammingLanguage = createElement(ElementName.ProgrammingLanguage);
|
|
77
|
+
/**
|
|
78
|
+
* Creates a Provider Badge element using the data from Provider in the Flexible UI Context.
|
|
79
|
+
* @see Badge
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
export const Provider = createElement(ElementName.Provider);
|
|
83
|
+
/**
|
|
84
|
+
* Creates a ReactCount Badge element using the data from ReactCount in the Flexible UI Context.
|
|
85
|
+
* @see Badge
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
export const ReactCount = createElement(ElementName.ReactCount);
|
|
95
89
|
/**
|
|
96
90
|
* Creates a Snippet element using the data from Snippet in the Flexible UI Context.
|
|
97
91
|
* @see Text
|
|
@@ -118,8 +112,14 @@ export const SubscriberCount = createElement(ElementName.SubscriberCount);
|
|
|
118
112
|
|
|
119
113
|
export const Title = createElement(ElementName.Title);
|
|
120
114
|
/**
|
|
121
|
-
* Creates a
|
|
115
|
+
* Creates a ViewCount Badge element using the data from ViewCount in the Flexible UI Context.
|
|
116
|
+
* @see Badge
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
export const ViewCount = createElement(ElementName.ViewCount);
|
|
120
|
+
/**
|
|
121
|
+
* Creates a VoteCount Badge element using the data from VoteCount in the Flexible UI Context.
|
|
122
122
|
* @see Badge
|
|
123
123
|
*/
|
|
124
124
|
|
|
125
|
-
export const
|
|
125
|
+
export const VoteCount = createElement(ElementName.VoteCount);
|
|
@@ -2,17 +2,19 @@ import React, { useCallback, useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { extractMetadata } from '../../../extractors/hover/extractMetadata';
|
|
3
3
|
import { getSimulatedMetadata, HOVER_CARD_ANALYTICS_DISPLAY } from '../utils';
|
|
4
4
|
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
5
|
-
import { ActionName, SmartLinkSize, SmartLinkTheme } from '../../../constants';
|
|
5
|
+
import { ActionName, SmartLinkPosition, SmartLinkSize, SmartLinkTheme } from '../../../constants';
|
|
6
6
|
import FlexibleCard from '../../FlexibleCard';
|
|
7
7
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
|
|
8
8
|
import { isSpecialEvent } from '../../../utils';
|
|
9
9
|
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
10
10
|
import { getExtensionKey } from '../../../state/helpers';
|
|
11
|
+
import { titleBlockCss, metadataBlockCss, footerBlockCss } from '../styled';
|
|
11
12
|
const flexibleUiOptions = {
|
|
12
13
|
hideElevation: true,
|
|
13
|
-
size: SmartLinkSize.
|
|
14
|
+
size: SmartLinkSize.Medium,
|
|
14
15
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
15
|
-
theme: SmartLinkTheme.Black
|
|
16
|
+
theme: SmartLinkTheme.Black,
|
|
17
|
+
hidePadding: true
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
const getOpenAction = (url, analytics) => ({
|
|
@@ -73,13 +75,20 @@ const HoverCardContent = ({
|
|
|
73
75
|
ui: flexibleUiOptions,
|
|
74
76
|
url: url
|
|
75
77
|
}, /*#__PURE__*/React.createElement(TitleBlock, {
|
|
76
|
-
actions: titleActions
|
|
78
|
+
actions: titleActions,
|
|
79
|
+
overrideCss: titleBlockCss,
|
|
80
|
+
size: SmartLinkSize.Large,
|
|
81
|
+
position: SmartLinkPosition.Center
|
|
77
82
|
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
78
83
|
primary: primary,
|
|
79
84
|
secondary: secondary,
|
|
80
|
-
size: SmartLinkSize.
|
|
85
|
+
size: SmartLinkSize.Large,
|
|
86
|
+
overrideCss: metadataBlockCss,
|
|
87
|
+
maxLines: 1
|
|
81
88
|
}), body, /*#__PURE__*/React.createElement(FooterBlock, {
|
|
82
|
-
actions: footerActions
|
|
89
|
+
actions: footerActions,
|
|
90
|
+
size: SmartLinkSize.Large,
|
|
91
|
+
overrideCss: footerBlockCss
|
|
83
92
|
}));
|
|
84
93
|
};
|
|
85
94
|
|
|
@@ -3,10 +3,37 @@ import { loadingPlaceholderClassName } from '../../index';
|
|
|
3
3
|
export const HoverCardContainer = css`
|
|
4
4
|
background: none;
|
|
5
5
|
border-width: 0;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
width: 24rem;
|
|
8
|
+
padding: 1rem;
|
|
8
9
|
|
|
9
10
|
.${loadingPlaceholderClassName} {
|
|
10
11
|
display: none;
|
|
11
12
|
}
|
|
13
|
+
`;
|
|
14
|
+
export const titleBlockCss = css`
|
|
15
|
+
gap: 0.5rem;
|
|
16
|
+
`;
|
|
17
|
+
export const metadataBlockCss = css`
|
|
18
|
+
gap: 0px;
|
|
19
|
+
|
|
20
|
+
/* primary element group */
|
|
21
|
+
[data-smart-element-group]:first-of-type {
|
|
22
|
+
flex-grow: 7;
|
|
23
|
+
/* horizontal spacing between elements in group */
|
|
24
|
+
> span {
|
|
25
|
+
margin-right: 0.5rem;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/* secondary element group */
|
|
29
|
+
[data-smart-element-group]:last-of-type {
|
|
30
|
+
flex-grow: 3;
|
|
31
|
+
/* horizontal spacing between elements in group */
|
|
32
|
+
> span {
|
|
33
|
+
margin-left: 0.5rem;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const footerBlockCss = css`
|
|
38
|
+
padding-top: 0.25rem;
|
|
12
39
|
`;
|
|
@@ -5,8 +5,8 @@ export const getSimulatedMetadata = (extensionKey = '') => {
|
|
|
5
5
|
case 'confluence-object-provider':
|
|
6
6
|
return {
|
|
7
7
|
metadata: {
|
|
8
|
-
primary: [ElementName.AuthorGroup, ElementName.CreatedBy
|
|
9
|
-
secondary: []
|
|
8
|
+
primary: [ElementName.AuthorGroup, ElementName.CreatedBy],
|
|
9
|
+
secondary: [ElementName.CommentCount, ElementName.ReactCount]
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
12
|
|
package/dist/esm/version.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
2
3
|
import { isSpecialEvent } from '../../utils';
|
|
3
4
|
import * as measure from '../../utils/performance';
|
|
4
5
|
import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct } from '../../state/helpers';
|
|
@@ -47,7 +48,13 @@ export function CardWithUrlContent(_ref) {
|
|
|
47
48
|
var services = getServices(state.details);
|
|
48
49
|
var isFlexibleUi = useMemo(function () {
|
|
49
50
|
return isFlexibleUiCard(children);
|
|
50
|
-
}, [children]);
|
|
51
|
+
}, [children]);
|
|
52
|
+
var showHoverPreviewFlag = useFeatureFlag('showHoverPreview');
|
|
53
|
+
|
|
54
|
+
if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
|
|
55
|
+
showHoverPreview = showHoverPreviewFlag;
|
|
56
|
+
} // Setup UI handlers.
|
|
57
|
+
|
|
51
58
|
|
|
52
59
|
var handleClick = useCallback(function (event) {
|
|
53
60
|
var clickUrl = getClickUrl(url, state.details);
|
|
@@ -92,11 +92,12 @@ export var renderElementItems = function renderElementItems() {
|
|
|
92
92
|
props = _objectWithoutProperties(curr, _excluded);
|
|
93
93
|
|
|
94
94
|
var Element = Elements[name];
|
|
95
|
+
var typedProps = props;
|
|
95
96
|
|
|
96
97
|
if (Element && isElementDisplayValid(name, display)) {
|
|
97
98
|
var element = /*#__PURE__*/React.createElement(Element, _extends({
|
|
98
99
|
key: idx
|
|
99
|
-
},
|
|
100
|
+
}, typedProps));
|
|
100
101
|
|
|
101
102
|
if (!isElementNull(element)) {
|
|
102
103
|
return [].concat(_toConsumableArray(acc), [element]);
|
|
@@ -22,35 +22,17 @@ export var CollaboratorGroup = createElement(ElementName.CollaboratorGroup);
|
|
|
22
22
|
|
|
23
23
|
export var CommentCount = createElement(ElementName.CommentCount);
|
|
24
24
|
/**
|
|
25
|
-
* Creates a
|
|
26
|
-
* @see
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
export var ViewCount = createElement(ElementName.ViewCount);
|
|
30
|
-
/**
|
|
31
|
-
* Creates a ReactCount Badge element using the data from ReactCount in the Flexible UI Context.
|
|
32
|
-
* @see Badge
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
export var ReactCount = createElement(ElementName.ReactCount);
|
|
36
|
-
/**
|
|
37
|
-
* Creates a VoteCount Badge element using the data from VoteCount in the Flexible UI Context.
|
|
38
|
-
* @see Badge
|
|
25
|
+
* Creates a CreatedOn DateTime element using the data from CreatedOn in the Flexible UI Context.
|
|
26
|
+
* @see DateTime
|
|
39
27
|
*/
|
|
40
28
|
|
|
41
|
-
export var
|
|
29
|
+
export var CreatedOn = createElement(ElementName.CreatedOn);
|
|
42
30
|
/**
|
|
43
31
|
* Creates a CreatedBy text element using the data from CreatedBy in the Flexible UI Context.
|
|
44
32
|
* @see Text
|
|
45
33
|
*/
|
|
46
34
|
|
|
47
35
|
export var CreatedBy = createElement(ElementName.CreatedBy);
|
|
48
|
-
/**
|
|
49
|
-
* Creates a CreatedOn DateTime element using the data from CreatedOn in the Flexible UI Context.
|
|
50
|
-
* @see DateTime
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
export var CreatedOn = createElement(ElementName.CreatedOn);
|
|
54
36
|
/**
|
|
55
37
|
* Creates an element that contains Last Commit hash
|
|
56
38
|
*/
|
|
@@ -92,6 +74,18 @@ export var Priority = createElement(ElementName.Priority);
|
|
|
92
74
|
*/
|
|
93
75
|
|
|
94
76
|
export var ProgrammingLanguage = createElement(ElementName.ProgrammingLanguage);
|
|
77
|
+
/**
|
|
78
|
+
* Creates a Provider Badge element using the data from Provider in the Flexible UI Context.
|
|
79
|
+
* @see Badge
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
export var Provider = createElement(ElementName.Provider);
|
|
83
|
+
/**
|
|
84
|
+
* Creates a ReactCount Badge element using the data from ReactCount in the Flexible UI Context.
|
|
85
|
+
* @see Badge
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
export var ReactCount = createElement(ElementName.ReactCount);
|
|
95
89
|
/**
|
|
96
90
|
* Creates a Snippet element using the data from Snippet in the Flexible UI Context.
|
|
97
91
|
* @see Text
|
|
@@ -118,8 +112,14 @@ export var SubscriberCount = createElement(ElementName.SubscriberCount);
|
|
|
118
112
|
|
|
119
113
|
export var Title = createElement(ElementName.Title);
|
|
120
114
|
/**
|
|
121
|
-
* Creates a
|
|
115
|
+
* Creates a ViewCount Badge element using the data from ViewCount in the Flexible UI Context.
|
|
116
|
+
* @see Badge
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
export var ViewCount = createElement(ElementName.ViewCount);
|
|
120
|
+
/**
|
|
121
|
+
* Creates a VoteCount Badge element using the data from VoteCount in the Flexible UI Context.
|
|
122
122
|
* @see Badge
|
|
123
123
|
*/
|
|
124
124
|
|
|
125
|
-
export var
|
|
125
|
+
export var VoteCount = createElement(ElementName.VoteCount);
|
|
@@ -2,17 +2,19 @@ import React, { useCallback, useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { extractMetadata } from '../../../extractors/hover/extractMetadata';
|
|
3
3
|
import { getSimulatedMetadata, HOVER_CARD_ANALYTICS_DISPLAY } from '../utils';
|
|
4
4
|
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
5
|
-
import { ActionName, SmartLinkSize, SmartLinkTheme } from '../../../constants';
|
|
5
|
+
import { ActionName, SmartLinkPosition, SmartLinkSize, SmartLinkTheme } from '../../../constants';
|
|
6
6
|
import FlexibleCard from '../../FlexibleCard';
|
|
7
7
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
|
|
8
8
|
import { isSpecialEvent } from '../../../utils';
|
|
9
9
|
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
10
10
|
import { getExtensionKey } from '../../../state/helpers';
|
|
11
|
+
import { titleBlockCss, metadataBlockCss, footerBlockCss } from '../styled';
|
|
11
12
|
var flexibleUiOptions = {
|
|
12
13
|
hideElevation: true,
|
|
13
|
-
size: SmartLinkSize.
|
|
14
|
+
size: SmartLinkSize.Medium,
|
|
14
15
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
15
|
-
theme: SmartLinkTheme.Black
|
|
16
|
+
theme: SmartLinkTheme.Black,
|
|
17
|
+
hidePadding: true
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
var getOpenAction = function getOpenAction(url, analytics) {
|
|
@@ -87,13 +89,20 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
87
89
|
ui: flexibleUiOptions,
|
|
88
90
|
url: url
|
|
89
91
|
}, /*#__PURE__*/React.createElement(TitleBlock, {
|
|
90
|
-
actions: titleActions
|
|
92
|
+
actions: titleActions,
|
|
93
|
+
overrideCss: titleBlockCss,
|
|
94
|
+
size: SmartLinkSize.Large,
|
|
95
|
+
position: SmartLinkPosition.Center
|
|
91
96
|
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
92
97
|
primary: primary,
|
|
93
98
|
secondary: secondary,
|
|
94
|
-
size: SmartLinkSize.
|
|
99
|
+
size: SmartLinkSize.Large,
|
|
100
|
+
overrideCss: metadataBlockCss,
|
|
101
|
+
maxLines: 1
|
|
95
102
|
}), body, /*#__PURE__*/React.createElement(FooterBlock, {
|
|
96
|
-
actions: footerActions
|
|
103
|
+
actions: footerActions,
|
|
104
|
+
size: SmartLinkSize.Large,
|
|
105
|
+
overrideCss: footerBlockCss
|
|
97
106
|
}));
|
|
98
107
|
};
|
|
99
108
|
|