@atlaskit/smart-card 19.1.18 → 19.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/cjs/constants.js +2 -1
- package/dist/cjs/extractors/flexible/index.js +3 -0
- package/dist/cjs/extractors/flexible/latest-commit/index.js +21 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +19 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +19 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +6 -25
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +5 -3
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +4 -4
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +8 -2
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/utils.js +19 -2
- package/dist/cjs/view/HoverCard/components/hover-card-content.js +2 -1
- package/dist/cjs/view/HoverCard/utils.js +6 -3
- package/dist/es2019/constants.js +2 -1
- package/dist/es2019/extractors/flexible/index.js +2 -0
- package/dist/es2019/extractors/flexible/latest-commit/index.js +12 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +48 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +16 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +6 -33
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +6 -1
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +7 -2
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +7 -0
- package/dist/es2019/view/FlexibleCard/components/utils.js +17 -1
- package/dist/es2019/view/HoverCard/components/hover-card-content.js +2 -1
- package/dist/es2019/view/HoverCard/utils.js +4 -3
- package/dist/esm/constants.js +2 -1
- package/dist/esm/extractors/flexible/index.js +2 -0
- package/dist/esm/extractors/flexible/latest-commit/index.js +12 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +19 -3
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +19 -1
- package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +6 -26
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +2 -2
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +5 -3
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +4 -4
- package/dist/esm/view/FlexibleCard/components/elements/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +6 -0
- package/dist/esm/view/FlexibleCard/components/utils.js +15 -1
- package/dist/esm/view/HoverCard/components/hover-card-content.js +2 -1
- package/dist/esm/view/HoverCard/utils.js +4 -3
- package/dist/types/constants.d.ts +3 -2
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +91 -0
- package/dist/types/extractors/flexible/latest-commit/index.d.ts +2 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/utils.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 19.1.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b39f43e68c3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b39f43e68c3) - [ux] Hover Preview: Add CreatedBy to 3P link metadata
|
|
8
|
+
|
|
9
|
+
[ux] Flexible UI: Text based elements now wrap and truncate within metadata group.
|
|
10
|
+
|
|
11
|
+
## 19.1.20
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`0b7abdcf058`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0b7abdcf058) - Flexible UI: Fix PreviewBlock not showing image loading skeleton
|
|
16
|
+
|
|
17
|
+
## 19.1.19
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`f7aedc6cf7d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f7aedc6cf7d) - [ux] A new element 'LatestCommit' was added in FlexibleUI for Smart Links. It displays the latest commit of a repository. Version of package 'json-ld-types' was upgraded to 2.4.2
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 19.1.18
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/cjs/constants.js
CHANGED
|
@@ -100,7 +100,7 @@ var SmartLinkWidth;
|
|
|
100
100
|
/**
|
|
101
101
|
* Flexible UI element name - each reflecting the link data its represented.
|
|
102
102
|
* When adding an element...
|
|
103
|
-
* 1) Create base element if it doesn't already
|
|
103
|
+
* 1) Create base element if it doesn't already exist.
|
|
104
104
|
* Base element are inside src/view/FlexibleCard/components/elements.
|
|
105
105
|
* E.g. Badge,DateTime, Icon, Lozenge, etc.
|
|
106
106
|
* 2) Update FlexibleUiContext with the new prop for data representing
|
|
@@ -148,6 +148,7 @@ exports.ElementName = ElementName;
|
|
|
148
148
|
ElementName["Title"] = "Title";
|
|
149
149
|
ElementName["ViewCount"] = "ViewCount";
|
|
150
150
|
ElementName["VoteCount"] = "VoteCount";
|
|
151
|
+
ElementName["LatestCommit"] = "LatestCommit";
|
|
151
152
|
})(ElementName || (exports.ElementName = ElementName = {}));
|
|
152
153
|
|
|
153
154
|
var ActionName;
|
|
@@ -29,6 +29,8 @@ var _extractProviderIcon = _interopRequireDefault(require("./icon/extract-provid
|
|
|
29
29
|
|
|
30
30
|
var _extractPreview = _interopRequireDefault(require("./extract-preview"));
|
|
31
31
|
|
|
32
|
+
var _latestCommit = require("./latest-commit");
|
|
33
|
+
|
|
32
34
|
var extractFlexibleUiContext = function extractFlexibleUiContext(response, renderers) {
|
|
33
35
|
if (!response) {
|
|
34
36
|
return undefined;
|
|
@@ -57,6 +59,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
|
|
|
57
59
|
subscriberCount: (0, _utils.extractSubscriberCount)(data),
|
|
58
60
|
title: (0, _primitives.extractTitle)(data) || url,
|
|
59
61
|
provider: (0, _extractProviderIcon.default)(data),
|
|
62
|
+
latestCommit: (0, _latestCommit.extractLatestCommit)(data),
|
|
60
63
|
url: url
|
|
61
64
|
};
|
|
62
65
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.extractLatestCommit = void 0;
|
|
7
|
+
|
|
8
|
+
var extractLatestCommit = function extractLatestCommit(jsonLd) {
|
|
9
|
+
var latestCommit = jsonLd['atlassian:latestCommit'];
|
|
10
|
+
|
|
11
|
+
if (typeof latestCommit === 'string') {
|
|
12
|
+
return latestCommit;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (latestCommit) {
|
|
16
|
+
//todo: change the properties to latestCommit.hash when BE is ready
|
|
17
|
+
return latestCommit ? latestCommit.name : undefined;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.extractLatestCommit = extractLatestCommit;
|
package/dist/cjs/version.json
CHANGED
|
@@ -17,7 +17,9 @@ var _constants = require("../../../../../constants");
|
|
|
17
17
|
|
|
18
18
|
var _utils = require("../utils");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _utils2 = require("../../utils");
|
|
21
|
+
|
|
22
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
21
23
|
|
|
22
24
|
var getAlignmentStyles = function getAlignmentStyles(align) {
|
|
23
25
|
switch (align) {
|
|
@@ -30,8 +32,23 @@ var getAlignmentStyles = function getAlignmentStyles(align) {
|
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
34
|
|
|
35
|
+
var getGapStyles = function getGapStyles(size, align) {
|
|
36
|
+
var gap = (0, _utils.getGapSize)(size);
|
|
37
|
+
|
|
38
|
+
if (align === _constants.SmartLinkAlignment.Right) {
|
|
39
|
+
return (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n > span {\n margin-left: ", "rem;\n &:first-child {\n margin-left: initial;\n }\n }\n "])), gap);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (0, _core.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n > span {\n margin-right: ", "rem;\n &:last-child {\n margin-right: initial;\n }\n }\n "])), gap);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var getHorizontalDirectionStyles = function getHorizontalDirectionStyles(size, align) {
|
|
46
|
+
var lineHeight = (0, _utils2.getMaxLineHeight)(size);
|
|
47
|
+
return (0, _core.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: block;\n vertical-align: middle;\n ", "\n\n > span, > div {\n vertical-align: middle;\n\n &[data-smart-element-date-time],\n &[data-smart-element-text] {\n // Show all/wrapped/truncated\n display: inline;\n }\n }\n\n ", "\n "])), (0, _utils2.getTruncateStyles)(1, lineHeight + 'rem'), getGapStyles(size, align));
|
|
48
|
+
};
|
|
49
|
+
|
|
33
50
|
var getElementGroupStyles = function getElementGroupStyles(direction, size, align, width) {
|
|
34
|
-
return (0, _core.css)(
|
|
51
|
+
return (0, _core.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n min-width: 10%;\n ", "\n ", "\n"])), (0, _utils.getBaseStyles)(direction, size), getAlignmentStyles(align), width === _constants.SmartLinkWidth.Flexible ? "flex: 1 3;" : '', direction === _constants.SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : '');
|
|
35
52
|
};
|
|
36
53
|
/**
|
|
37
54
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
@@ -9,8 +9,12 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
12
14
|
var _react = _interopRequireDefault(require("react"));
|
|
13
15
|
|
|
16
|
+
var _core = require("@emotion/core");
|
|
17
|
+
|
|
14
18
|
var _constants = require("../../../../../constants");
|
|
15
19
|
|
|
16
20
|
var _block = _interopRequireDefault(require("../block"));
|
|
@@ -21,6 +25,16 @@ var _elements = require("../../elements");
|
|
|
21
25
|
|
|
22
26
|
var _actionGroup = _interopRequireDefault(require("../action-group"));
|
|
23
27
|
|
|
28
|
+
var _templateObject;
|
|
29
|
+
|
|
30
|
+
var getActionGroupStyles = function getActionGroupStyles(size) {
|
|
31
|
+
if (size === _constants.SmartLinkSize.XLarge) {
|
|
32
|
+
// The biggest height of the action button exceeds the max line-height
|
|
33
|
+
// of the elements causing the action on the block with x-large size to
|
|
34
|
+
// get cut at the bottom.
|
|
35
|
+
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n max-height: 2rem;\n "])));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
24
38
|
/**
|
|
25
39
|
* Represents a FooterBlock, designed to contain elements and actions that should appear
|
|
26
40
|
* at the bottom of a link card.
|
|
@@ -28,9 +42,13 @@ var _actionGroup = _interopRequireDefault(require("../action-group"));
|
|
|
28
42
|
* @param {FooterBlockProps} FooterBlockProps
|
|
29
43
|
* @see Block
|
|
30
44
|
*/
|
|
45
|
+
|
|
46
|
+
|
|
31
47
|
var FooterBlock = function FooterBlock(props) {
|
|
32
48
|
var status = props.status,
|
|
33
49
|
actions = props.actions,
|
|
50
|
+
_props$size = props.size,
|
|
51
|
+
size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size,
|
|
34
52
|
_props$testId = props.testId,
|
|
35
53
|
testId = _props$testId === void 0 ? 'smart-footer-block' : _props$testId;
|
|
36
54
|
|
|
@@ -46,6 +64,7 @@ var FooterBlock = function FooterBlock(props) {
|
|
|
46
64
|
testId: "smart-element-group-actions",
|
|
47
65
|
align: _constants.SmartLinkAlignment.Right,
|
|
48
66
|
direction: _constants.SmartLinkDirection.Horizontal,
|
|
67
|
+
overrideCss: getActionGroupStyles(size),
|
|
49
68
|
width: _constants.SmartLinkWidth.Flexible
|
|
50
69
|
}, /*#__PURE__*/_react.default.createElement(_actionGroup.default, {
|
|
51
70
|
items: actions,
|
|
@@ -25,6 +25,8 @@ var _block = _interopRequireDefault(require("../block"));
|
|
|
25
25
|
|
|
26
26
|
var _elementGroup = _interopRequireDefault(require("../element-group"));
|
|
27
27
|
|
|
28
|
+
var _utils2 = require("../../utils");
|
|
29
|
+
|
|
28
30
|
var _excluded = ["maxLines", "status", "testId", "primary", "secondary"];
|
|
29
31
|
|
|
30
32
|
var _templateObject;
|
|
@@ -36,31 +38,10 @@ var MINIMUM_MAX_LINES = 1;
|
|
|
36
38
|
var getElementGroupStyles = function getElementGroupStyles(size, maxLines) {
|
|
37
39
|
// MetadataBlock allows metadata elements to be displayed in
|
|
38
40
|
// multiple lines, with maximum of 2 lines.
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// overflown will not be visible.
|
|
44
|
-
var lineHeight = getLineHeight(size);
|
|
45
|
-
var gap = (0, _utils.getGapSize)(size);
|
|
46
|
-
var gapHeight = gap * (maxLines - 1);
|
|
47
|
-
var height = lineHeight * maxLines + gapHeight;
|
|
48
|
-
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n flex-wrap: wrap;\n line-height: ", "rem;\n max-height: ", "rem;\n > span,\n > div {\n min-height: ", "rem;\n max-height: ", "rem;\n line-height: ", "rem;\n }\n "])), lineHeight, height, lineHeight, lineHeight, lineHeight);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
var getLineHeight = function getLineHeight(size) {
|
|
52
|
-
// The maximum height of all elements in specific size.
|
|
53
|
-
// These heights belongs to AvatarGroup.
|
|
54
|
-
switch (size) {
|
|
55
|
-
case _constants.SmartLinkSize.XLarge:
|
|
56
|
-
case _constants.SmartLinkSize.Large:
|
|
57
|
-
return 1.75;
|
|
58
|
-
|
|
59
|
-
case _constants.SmartLinkSize.Medium:
|
|
60
|
-
case _constants.SmartLinkSize.Small:
|
|
61
|
-
default:
|
|
62
|
-
return 1.5;
|
|
63
|
-
}
|
|
41
|
+
// We need the height of the line to be equal on both left and right
|
|
42
|
+
// sides so they line up nicely.
|
|
43
|
+
var lineHeight = (0, _utils2.getMaxLineHeight)(size);
|
|
44
|
+
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n line-height: ", "rem;\n ", "\n "])), lineHeight, (0, _utils2.getTruncateStyles)(maxLines, lineHeight + 'rem'));
|
|
64
45
|
};
|
|
65
46
|
|
|
66
47
|
var getMaxLines = function getMaxLines(maxLines) {
|
|
@@ -48,7 +48,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
48
48
|
|
|
49
49
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
50
50
|
|
|
51
|
-
var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ViewCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ReactCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.VoteCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Preview, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), _ElementDisplaySchema);
|
|
51
|
+
var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ViewCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ReactCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.VoteCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Preview, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LatestCommit, ['inline']), _ElementDisplaySchema);
|
|
52
52
|
exports.ElementDisplaySchema = ElementDisplaySchema;
|
|
53
53
|
|
|
54
54
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
@@ -82,7 +82,7 @@ var getGapSize = function getGapSize(size) {
|
|
|
82
82
|
exports.getGapSize = getGapSize;
|
|
83
83
|
|
|
84
84
|
var getBaseStyles = function getBaseStyles(direction, size) {
|
|
85
|
-
return (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n gap: ", "rem;\n line-height: 1rem;\n min-width: 0;\n overflow: hidden;\n ", ";\n &:empty {\n display: none;\n }\n & > * {\n min-width: 0;\n }\n & > [data-fit-to-content] {\n min-width: fit-content;\n }\n"])), getGapSize(size), getDirectionStyles(direction));
|
|
85
|
+
return (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n display: flex;\n gap: ", "rem;\n line-height: 1rem;\n min-width: 0;\n overflow: hidden;\n ", ";\n &:empty {\n display: none;\n }\n & > * {\n min-width: 0;\n }\n & > [data-fit-to-content] {\n min-width: fit-content;\n }\n"])), getGapSize(size), getDirectionStyles(direction));
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
exports.getBaseStyles = getBaseStyles;
|
|
@@ -17,21 +17,23 @@ var _avatarGroup = _interopRequireDefault(require("@atlaskit/avatar-group"));
|
|
|
17
17
|
|
|
18
18
|
var _constants = require("../../../../../constants");
|
|
19
19
|
|
|
20
|
-
var _templateObject;
|
|
20
|
+
var _templateObject, _templateObject2;
|
|
21
21
|
|
|
22
22
|
var MAX_COUNT = 4;
|
|
23
23
|
|
|
24
24
|
var getStyles = function getStyles(size) {
|
|
25
|
+
var styles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: inline-flex;\n "])));
|
|
26
|
+
|
|
25
27
|
switch (size) {
|
|
26
28
|
case _constants.SmartLinkSize.XLarge:
|
|
27
29
|
case _constants.SmartLinkSize.Large:
|
|
28
30
|
// Default AK small size
|
|
29
|
-
return;
|
|
31
|
+
return styles;
|
|
30
32
|
|
|
31
33
|
case _constants.SmartLinkSize.Medium:
|
|
32
34
|
case _constants.SmartLinkSize.Small:
|
|
33
35
|
default:
|
|
34
|
-
return (0, _core.css)(
|
|
36
|
+
return (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n li {\n span,\n svg {\n max-height: 1.25rem;\n max-width: 1.25rem;\n }\n }\n "])), styles);
|
|
35
37
|
}
|
|
36
38
|
};
|
|
37
39
|
/**
|
|
@@ -29,9 +29,9 @@ var _atlaskitIcon = _interopRequireDefault(require("../../common/atlaskit-icon")
|
|
|
29
29
|
|
|
30
30
|
var _templateObject, _templateObject2, _templateObject3, _messageMapper;
|
|
31
31
|
|
|
32
|
-
var badgeStyles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n display: flex;\n min-width: fit-content;\n"])));
|
|
33
|
-
var iconStyles = (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n ", "\n span,\n svg {\n line-height: 0;\n }\n"])), _token.tokens.badgeIcon, (0, _utils.getIconSizeStyles)('1rem'));
|
|
34
|
-
var labelStyles = (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n padding-left: 0.125rem;\n"])), _token.tokens.badgeText);
|
|
32
|
+
var badgeStyles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n display: inline-flex;\n min-width: fit-content;\n"])));
|
|
33
|
+
var iconStyles = (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n line-height: 0;\n vertical-align: middle;\n ", "\n img,\n span,\n svg {\n line-height: 0;\n vertical-align: middle;\n }\n"])), _token.tokens.badgeIcon, (0, _utils.getIconSizeStyles)('1rem'));
|
|
34
|
+
var labelStyles = (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n padding-left: 0.125rem;\n vertical-align: middle;\n"])), _token.tokens.badgeText);
|
|
35
35
|
var messageMapper = (_messageMapper = {}, (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityBlocker, _messages.messages.priority_blocker), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityCritical, _messages.messages.priority_critical), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityHigh, _messages.messages.priority_high), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityHighest, _messages.messages.priority_highest), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityLow, _messages.messages.priority_low), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityLowest, _messages.messages.priority_lowest), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityMajor, _messages.messages.priority_major), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityMedium, _messages.messages.priority_medium), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityMinor, _messages.messages.priority_minor), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityTrivial, _messages.messages.priority_trivial), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityUndefined, _messages.messages.priority_undefined), _messageMapper);
|
|
36
36
|
|
|
37
37
|
var getFormattedMessageFromIcon = function getFormattedMessageFromIcon(icon) {
|
|
@@ -93,7 +93,7 @@ var Badge = function Badge(_ref) {
|
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
return (0, _core.jsx)("
|
|
96
|
+
return (0, _core.jsx)("span", {
|
|
97
97
|
css: [badgeStyles, overrideCss],
|
|
98
98
|
"data-fit-to-content": true,
|
|
99
99
|
"data-smart-element-badge": true,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.VoteCount = exports.ViewCount = exports.Title = exports.SubscriberCount = exports.State = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
|
|
6
|
+
exports.VoteCount = exports.ViewCount = exports.Title = exports.SubscriberCount = exports.State = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.LatestCommit = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
|
|
7
7
|
|
|
8
8
|
var _utils = require("./utils");
|
|
9
9
|
|
|
@@ -67,12 +67,18 @@ var CreatedBy = (0, _utils.createElement)(_constants.ElementName.CreatedBy);
|
|
|
67
67
|
|
|
68
68
|
exports.CreatedBy = CreatedBy;
|
|
69
69
|
var CreatedOn = (0, _utils.createElement)(_constants.ElementName.CreatedOn);
|
|
70
|
+
/**
|
|
71
|
+
* Creates an element that contains Last Commit hash
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
exports.CreatedOn = CreatedOn;
|
|
75
|
+
var LatestCommit = (0, _utils.createElement)(_constants.ElementName.LatestCommit);
|
|
70
76
|
/**
|
|
71
77
|
* Creates a LinkIcon Icon element using the data from LinkIcon in the Flexible UI Context.
|
|
72
78
|
* @see Icon
|
|
73
79
|
*/
|
|
74
80
|
|
|
75
|
-
exports.
|
|
81
|
+
exports.LatestCommit = LatestCommit;
|
|
76
82
|
var LinkIcon = (0, _utils.createElement)(_constants.ElementName.LinkIcon);
|
|
77
83
|
/**
|
|
78
84
|
* Creates a ModifiedBy Text element using the data from ModifiedBy in the Flexible UI Context.
|
|
@@ -17,7 +17,7 @@ var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
|
17
17
|
|
|
18
18
|
var _templateObject;
|
|
19
19
|
|
|
20
|
-
var styles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n line-height: inherit;\n"])));
|
|
20
|
+
var styles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: inline-flex;\n line-height: inherit;\n"])));
|
|
21
21
|
/**
|
|
22
22
|
* A base element that displays a Lozenge.
|
|
23
23
|
* @internal
|
|
@@ -27,7 +27,7 @@ var _templateObject;
|
|
|
27
27
|
* [object-position] Center alignment of the selected replaced element's
|
|
28
28
|
* contents within the element's box.
|
|
29
29
|
*/
|
|
30
|
-
var styles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n aspect-ratio: 16 / 9;\n display: flex;\n width: 100%;\n height: fit-content; // Fix Safari height not respecting aspect-ratio\n\n // fallback\n @supports not (aspect-ratio: auto) {\n padding-top: 56.25%; // 16:9 ratio (9 / 16 = 0.5625)\n height: 0;\n position: relative;\n overflow: hidden;\n }\n\n > img {\n min-height: 100%;\n min-width: 100%;\n max-height: 100%;\n max-width: 100%;\n object-fit: cover;\n object-position: center center;\n\n // fallback\n @supports not (aspect-ratio: auto) {\n position: absolute;\n transform: translate(-50%, -50%);\n left: 50%;\n top: 50%;\n width: auto;\n height: auto;\n }\n }\n"])));
|
|
30
|
+
var styles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n aspect-ratio: 16 / 9;\n display: flex;\n width: 100%;\n height: fit-content; // Fix Safari height not respecting aspect-ratio\n\n // fallback\n @supports not (aspect-ratio: auto) {\n padding-top: 56.25%; // 16:9 ratio (9 / 16 = 0.5625)\n height: 0;\n position: relative;\n overflow: hidden;\n }\n\n > img,\n > span {\n min-height: 100%;\n min-width: 100%;\n max-height: 100%;\n max-width: 100%;\n object-fit: cover;\n object-position: center center;\n\n // fallback\n @supports not (aspect-ratio: auto) {\n position: absolute;\n transform: translate(-50%, -50%);\n left: 50%;\n top: 50%;\n width: auto;\n height: auto;\n }\n }\n"])));
|
|
31
31
|
/**
|
|
32
32
|
* A base element that displays a Media.
|
|
33
33
|
* @internal
|
|
@@ -110,6 +110,11 @@ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_ele
|
|
|
110
110
|
component: _dateTime.default
|
|
111
111
|
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.Provider, {
|
|
112
112
|
component: _badge.default
|
|
113
|
+
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.LatestCommit, {
|
|
114
|
+
component: _badge.default,
|
|
115
|
+
props: {
|
|
116
|
+
icon: _constants.IconType.Commit
|
|
117
|
+
}
|
|
113
118
|
}), _elementMappings);
|
|
114
119
|
|
|
115
120
|
var getContextKey = function getContextKey(name) {
|
|
@@ -136,6 +141,7 @@ var getData = function getData(elementName, contextKey, context) {
|
|
|
136
141
|
case _constants.ElementName.VoteCount:
|
|
137
142
|
case _constants.ElementName.ProgrammingLanguage:
|
|
138
143
|
case _constants.ElementName.SubscriberCount:
|
|
144
|
+
case _constants.ElementName.LatestCommit:
|
|
139
145
|
return toBadgeProps(data);
|
|
140
146
|
|
|
141
147
|
case _constants.ElementName.CreatedBy:
|
|
@@ -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.hasWhiteSpace = exports.getTruncateStyles = exports.getMaxLines = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessage = void 0;
|
|
8
|
+
exports.hasWhiteSpace = exports.getTruncateStyles = exports.getMaxLines = exports.getMaxLineHeight = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessage = void 0;
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
11
|
|
|
@@ -95,6 +95,23 @@ var getLinkSizeStyles = function getLinkSizeStyles(size) {
|
|
|
95
95
|
|
|
96
96
|
exports.getLinkSizeStyles = getLinkSizeStyles;
|
|
97
97
|
|
|
98
|
+
var getMaxLineHeight = function getMaxLineHeight(size) {
|
|
99
|
+
// The maximum line height based on all elements in specific size.
|
|
100
|
+
// These heights belongs to AvatarGroup.
|
|
101
|
+
switch (size) {
|
|
102
|
+
case _constants.SmartLinkSize.XLarge:
|
|
103
|
+
case _constants.SmartLinkSize.Large:
|
|
104
|
+
return 1.75;
|
|
105
|
+
|
|
106
|
+
case _constants.SmartLinkSize.Medium:
|
|
107
|
+
case _constants.SmartLinkSize.Small:
|
|
108
|
+
default:
|
|
109
|
+
return 1.5;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
exports.getMaxLineHeight = getMaxLineHeight;
|
|
114
|
+
|
|
98
115
|
var getMaxLines = function getMaxLines(value, defaultValue, max, min) {
|
|
99
116
|
if (value > max) {
|
|
100
117
|
return defaultValue;
|
|
@@ -112,7 +129,7 @@ exports.getMaxLines = getMaxLines;
|
|
|
112
129
|
var getTruncateStyles = function getTruncateStyles(maxLines) {
|
|
113
130
|
var lineHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1rem';
|
|
114
131
|
var wordBreak = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'break-word';
|
|
115
|
-
return (0, _core.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n display: -webkit-box;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: ", ";\n -webkit-line-clamp: ", ";\n -webkit-box-orient: vertical;\n // Fallback options\n max-height: calc(", " * ", ");\n "])), wordBreak, maxLines, maxLines, lineHeight);
|
|
132
|
+
return (0, _core.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n display: -webkit-box;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: ", ";\n -webkit-line-clamp: ", ";\n -webkit-box-orient: vertical;\n // Fallback options\n @supports not (-webkit-line-clamp: 1) {\n max-height: calc(", " * ", ");\n }\n "])), wordBreak, maxLines, maxLines, lineHeight);
|
|
116
133
|
};
|
|
117
134
|
|
|
118
135
|
exports.getTruncateStyles = getTruncateStyles;
|
|
@@ -115,7 +115,8 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
115
115
|
actions: titleActions
|
|
116
116
|
}), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
|
|
117
117
|
primary: primary,
|
|
118
|
-
secondary: secondary
|
|
118
|
+
secondary: secondary,
|
|
119
|
+
size: _constants.SmartLinkSize.Small
|
|
119
120
|
}), body, /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, {
|
|
120
121
|
actions: footerActions
|
|
121
122
|
}));
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getSimulatedMetadata = exports.HOVER_CARD_ANALYTICS_DISPLAY = void 0;
|
|
7
|
+
|
|
8
|
+
var _constants = require("../../constants");
|
|
9
|
+
|
|
7
10
|
var HOVER_CARD_ANALYTICS_DISPLAY = 'flexible';
|
|
8
11
|
exports.HOVER_CARD_ANALYTICS_DISPLAY = HOVER_CARD_ANALYTICS_DISPLAY;
|
|
9
12
|
|
|
@@ -14,7 +17,7 @@ var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
14
17
|
case 'confluence-object-provider':
|
|
15
18
|
return {
|
|
16
19
|
metadata: {
|
|
17
|
-
primary: [
|
|
20
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.CreatedBy, _constants.ElementName.CommentCount, _constants.ElementName.ReactCount],
|
|
18
21
|
secondary: []
|
|
19
22
|
}
|
|
20
23
|
};
|
|
@@ -22,7 +25,7 @@ var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
22
25
|
case 'jira-object-provider':
|
|
23
26
|
return {
|
|
24
27
|
metadata: {
|
|
25
|
-
primary: [
|
|
28
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.State, _constants.ElementName.Priority],
|
|
26
29
|
secondary: []
|
|
27
30
|
}
|
|
28
31
|
};
|
|
@@ -30,7 +33,7 @@ var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
30
33
|
default:
|
|
31
34
|
return {
|
|
32
35
|
metadata: {
|
|
33
|
-
primary: [
|
|
36
|
+
primary: [_constants.ElementName.ModifiedOn, _constants.ElementName.CreatedBy],
|
|
34
37
|
secondary: []
|
|
35
38
|
}
|
|
36
39
|
};
|
package/dist/es2019/constants.js
CHANGED
|
@@ -81,7 +81,7 @@ export let SmartLinkWidth;
|
|
|
81
81
|
/**
|
|
82
82
|
* Flexible UI element name - each reflecting the link data its represented.
|
|
83
83
|
* When adding an element...
|
|
84
|
-
* 1) Create base element if it doesn't already
|
|
84
|
+
* 1) Create base element if it doesn't already exist.
|
|
85
85
|
* Base element are inside src/view/FlexibleCard/components/elements.
|
|
86
86
|
* E.g. Badge,DateTime, Icon, Lozenge, etc.
|
|
87
87
|
* 2) Update FlexibleUiContext with the new prop for data representing
|
|
@@ -125,6 +125,7 @@ export let ElementName;
|
|
|
125
125
|
ElementName["Title"] = "Title";
|
|
126
126
|
ElementName["ViewCount"] = "ViewCount";
|
|
127
127
|
ElementName["VoteCount"] = "VoteCount";
|
|
128
|
+
ElementName["LatestCommit"] = "LatestCommit";
|
|
128
129
|
})(ElementName || (ElementName = {}));
|
|
129
130
|
|
|
130
131
|
export let ActionName;
|
|
@@ -9,6 +9,7 @@ import { extractDateCreated } from '../common/date/extractDateCreated';
|
|
|
9
9
|
import extractPriority from './extract-priority';
|
|
10
10
|
import extractProviderIcon from './icon/extract-provider-icon';
|
|
11
11
|
import extractPreview from './extract-preview';
|
|
12
|
+
import { extractLatestCommit } from './latest-commit';
|
|
12
13
|
|
|
13
14
|
const extractFlexibleUiContext = (response, renderers) => {
|
|
14
15
|
if (!response) {
|
|
@@ -38,6 +39,7 @@ const extractFlexibleUiContext = (response, renderers) => {
|
|
|
38
39
|
subscriberCount: extractSubscriberCount(data),
|
|
39
40
|
title: extractTitle(data) || url,
|
|
40
41
|
provider: extractProviderIcon(data),
|
|
42
|
+
latestCommit: extractLatestCommit(data),
|
|
41
43
|
url
|
|
42
44
|
};
|
|
43
45
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const extractLatestCommit = jsonLd => {
|
|
2
|
+
const latestCommit = jsonLd['atlassian:latestCommit'];
|
|
3
|
+
|
|
4
|
+
if (typeof latestCommit === 'string') {
|
|
5
|
+
return latestCommit;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (latestCommit) {
|
|
9
|
+
//todo: change the properties to latestCommit.hash when BE is ready
|
|
10
|
+
return latestCommit ? latestCommit.name : undefined;
|
|
11
|
+
}
|
|
12
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
5
|
-
import { getBaseStyles, renderChildren } from '../utils';
|
|
5
|
+
import { getBaseStyles, getGapSize, renderChildren } from '../utils';
|
|
6
|
+
import { getMaxLineHeight, getTruncateStyles } from '../../utils';
|
|
6
7
|
|
|
7
8
|
const getAlignmentStyles = align => {
|
|
8
9
|
switch (align) {
|
|
@@ -21,11 +22,57 @@ const getAlignmentStyles = align => {
|
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
|
|
25
|
+
const getGapStyles = (size, align) => {
|
|
26
|
+
const gap = getGapSize(size);
|
|
27
|
+
|
|
28
|
+
if (align === SmartLinkAlignment.Right) {
|
|
29
|
+
return css`
|
|
30
|
+
> span {
|
|
31
|
+
margin-left: ${gap}rem;
|
|
32
|
+
&:first-child {
|
|
33
|
+
margin-left: initial;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return css`
|
|
40
|
+
> span {
|
|
41
|
+
margin-right: ${gap}rem;
|
|
42
|
+
&:last-child {
|
|
43
|
+
margin-right: initial;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const getHorizontalDirectionStyles = (size, align) => {
|
|
50
|
+
const lineHeight = getMaxLineHeight(size);
|
|
51
|
+
return css`
|
|
52
|
+
display: block;
|
|
53
|
+
vertical-align: middle;
|
|
54
|
+
${getTruncateStyles(1, lineHeight + 'rem')}
|
|
55
|
+
|
|
56
|
+
> span, > div {
|
|
57
|
+
vertical-align: middle;
|
|
58
|
+
|
|
59
|
+
&[data-smart-element-date-time],
|
|
60
|
+
&[data-smart-element-text] {
|
|
61
|
+
// Show all/wrapped/truncated
|
|
62
|
+
display: inline;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
${getGapStyles(size, align)}
|
|
67
|
+
`;
|
|
68
|
+
};
|
|
69
|
+
|
|
24
70
|
export const getElementGroupStyles = (direction, size, align, width) => css`
|
|
25
71
|
${getBaseStyles(direction, size)}
|
|
26
72
|
${getAlignmentStyles(align)}
|
|
27
73
|
min-width: 10%;
|
|
28
74
|
${width === SmartLinkWidth.Flexible ? `flex: 1 3;` : ''}
|
|
75
|
+
${direction === SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : ''}
|
|
29
76
|
`;
|
|
30
77
|
/**
|
|
31
78
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { css } from '@emotion/core';
|
|
4
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
|
|
4
5
|
import Block from '../block';
|
|
5
6
|
import ElementGroup from '../element-group';
|
|
6
7
|
import { Provider } from '../../elements';
|
|
7
8
|
import ActionGroup from '../action-group';
|
|
9
|
+
|
|
10
|
+
const getActionGroupStyles = size => {
|
|
11
|
+
if (size === SmartLinkSize.XLarge) {
|
|
12
|
+
// The biggest height of the action button exceeds the max line-height
|
|
13
|
+
// of the elements causing the action on the block with x-large size to
|
|
14
|
+
// get cut at the bottom.
|
|
15
|
+
return css`
|
|
16
|
+
max-height: 2rem;
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
8
20
|
/**
|
|
9
21
|
* Represents a FooterBlock, designed to contain elements and actions that should appear
|
|
10
22
|
* at the bottom of a link card.
|
|
@@ -13,10 +25,12 @@ import ActionGroup from '../action-group';
|
|
|
13
25
|
* @see Block
|
|
14
26
|
*/
|
|
15
27
|
|
|
28
|
+
|
|
16
29
|
const FooterBlock = props => {
|
|
17
30
|
const {
|
|
18
31
|
status,
|
|
19
32
|
actions,
|
|
33
|
+
size = SmartLinkSize.Medium,
|
|
20
34
|
testId = 'smart-footer-block'
|
|
21
35
|
} = props;
|
|
22
36
|
|
|
@@ -32,6 +46,7 @@ const FooterBlock = props => {
|
|
|
32
46
|
testId: "smart-element-group-actions",
|
|
33
47
|
align: SmartLinkAlignment.Right,
|
|
34
48
|
direction: SmartLinkDirection.Horizontal,
|
|
49
|
+
overrideCss: getActionGroupStyles(size),
|
|
35
50
|
width: SmartLinkWidth.Flexible
|
|
36
51
|
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
37
52
|
items: actions,
|