@atlaskit/smart-card 19.1.20 → 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.
Files changed (36) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/version.json +1 -1
  3. package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +19 -2
  4. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +19 -0
  5. package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +6 -25
  6. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
  7. package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +5 -3
  8. package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +4 -4
  9. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +1 -1
  10. package/dist/cjs/view/FlexibleCard/components/utils.js +19 -2
  11. package/dist/cjs/view/HoverCard/components/hover-card-content.js +2 -1
  12. package/dist/cjs/view/HoverCard/utils.js +6 -3
  13. package/dist/es2019/version.json +1 -1
  14. package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +48 -1
  15. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +16 -1
  16. package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +6 -33
  17. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +1 -0
  18. package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +6 -1
  19. package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +7 -2
  20. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +1 -0
  21. package/dist/es2019/view/FlexibleCard/components/utils.js +17 -1
  22. package/dist/es2019/view/HoverCard/components/hover-card-content.js +2 -1
  23. package/dist/es2019/view/HoverCard/utils.js +4 -3
  24. package/dist/esm/version.json +1 -1
  25. package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +19 -3
  26. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +19 -1
  27. package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +6 -26
  28. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
  29. package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +5 -3
  30. package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +4 -4
  31. package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +1 -1
  32. package/dist/esm/view/FlexibleCard/components/utils.js +15 -1
  33. package/dist/esm/view/HoverCard/components/hover-card-content.js +2 -1
  34. package/dist/esm/view/HoverCard/utils.js +4 -3
  35. package/dist/types/view/FlexibleCard/components/utils.d.ts +1 -0
  36. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## 19.1.20
4
12
 
5
13
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.20",
3
+ "version": "19.1.21",
4
4
  "sideEffects": false
5
5
  }
@@ -17,7 +17,9 @@ var _constants = require("../../../../../constants");
17
17
 
18
18
  var _utils = require("../utils");
19
19
 
20
- var _templateObject, _templateObject2, _templateObject3;
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)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n min-width: 10%;\n ", "\n"])), (0, _utils.getBaseStyles)(direction, size), getAlignmentStyles(align), width === _constants.SmartLinkWidth.Flexible ? "flex: 1 3;" : '');
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
- // a) We need the height of the line to be equal on both left and right
40
- // sides so they line up nicely.
41
- // b) There is no way to truncate non-text elements nicely. Here
42
- // it's fix max height of the element group so that anything that is
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) {
@@ -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)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n li {\n span,\n svg {\n max-height: 1.25rem;\n max-width: 1.25rem;\n }\n }\n "])));
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)("div", {
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,
@@ -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
@@ -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: ['AuthorGroup', 'CreatedBy', 'CommentCount', 'ReactCount'],
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: ['AuthorGroup', 'State', 'Priority'],
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: ['ModifiedOn'],
36
+ primary: [_constants.ElementName.ModifiedOn, _constants.ElementName.CreatedBy],
34
37
  secondary: []
35
38
  }
36
39
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.20",
3
+ "version": "19.1.21",
4
4
  "sideEffects": false
5
5
  }
@@ -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 { SmartLinkAlignment, SmartLinkDirection, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
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,
@@ -2,9 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { css } from '@emotion/core';
4
4
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
5
- import { getGapSize, renderElementItems } from '../utils';
5
+ import { renderElementItems } from '../utils';
6
6
  import Block from '../block';
7
7
  import ElementGroup from '../element-group';
8
+ import { getMaxLineHeight, getTruncateStyles } from '../../utils';
8
9
  const DEFAULT_MAX_LINES = 2;
9
10
  const MAXIMUM_MAX_LINES = 2;
10
11
  const MINIMUM_MAX_LINES = 1;
@@ -12,43 +13,15 @@ const MINIMUM_MAX_LINES = 1;
12
13
  const getElementGroupStyles = (size, maxLines) => {
13
14
  // MetadataBlock allows metadata elements to be displayed in
14
15
  // multiple lines, with maximum of 2 lines.
15
- // a) We need the height of the line to be equal on both left and right
16
- // sides so they line up nicely.
17
- // b) There is no way to truncate non-text elements nicely. Here
18
- // it's fix max height of the element group so that anything that is
19
- // overflown will not be visible.
20
- const lineHeight = getLineHeight(size);
21
- const gap = getGapSize(size);
22
- const gapHeight = gap * (maxLines - 1);
23
- const height = lineHeight * maxLines + gapHeight;
16
+ // We need the height of the line to be equal on both left and right
17
+ // sides so they line up nicely.
18
+ const lineHeight = getMaxLineHeight(size);
24
19
  return css`
25
- flex-wrap: wrap;
26
20
  line-height: ${lineHeight}rem;
27
- max-height: ${height}rem;
28
- > span,
29
- > div {
30
- min-height: ${lineHeight}rem;
31
- max-height: ${lineHeight}rem;
32
- line-height: ${lineHeight}rem;
33
- }
21
+ ${getTruncateStyles(maxLines, lineHeight + 'rem')}
34
22
  `;
35
23
  };
36
24
 
37
- const getLineHeight = size => {
38
- // The maximum height of all elements in specific size.
39
- // These heights belongs to AvatarGroup.
40
- switch (size) {
41
- case SmartLinkSize.XLarge:
42
- case SmartLinkSize.Large:
43
- return 1.75;
44
-
45
- case SmartLinkSize.Medium:
46
- case SmartLinkSize.Small:
47
- default:
48
- return 1.5;
49
- }
50
- };
51
-
52
25
  const getMaxLines = maxLines => {
53
26
  if (maxLines > MAXIMUM_MAX_LINES) {
54
27
  return DEFAULT_MAX_LINES;
@@ -64,6 +64,7 @@ export const getGapSize = size => {
64
64
  }
65
65
  };
66
66
  export const getBaseStyles = (direction, size) => css`
67
+ align-items: center;
67
68
  display: flex;
68
69
  gap: ${getGapSize(size)}rem;
69
70
  line-height: 1rem;
@@ -6,16 +6,21 @@ import { SmartLinkSize } from '../../../../../constants';
6
6
  const MAX_COUNT = 4;
7
7
 
8
8
  const getStyles = size => {
9
+ const styles = css`
10
+ display: inline-flex;
11
+ `;
12
+
9
13
  switch (size) {
10
14
  case SmartLinkSize.XLarge:
11
15
  case SmartLinkSize.Large:
12
16
  // Default AK small size
13
- return;
17
+ return styles;
14
18
 
15
19
  case SmartLinkSize.Medium:
16
20
  case SmartLinkSize.Small:
17
21
  default:
18
22
  return css`
23
+ ${styles}
19
24
  li {
20
25
  span,
21
26
  svg {
@@ -9,15 +9,19 @@ import ImageIcon from '../../common/image-icon';
9
9
  import AtlaskitIcon from '../../common/atlaskit-icon';
10
10
  const badgeStyles = css`
11
11
  align-items: center;
12
- display: flex;
12
+ display: inline-flex;
13
13
  min-width: fit-content;
14
14
  `;
15
15
  const iconStyles = css`
16
16
  color: ${tokens.badgeIcon};
17
+ line-height: 0;
18
+ vertical-align: middle;
17
19
  ${getIconSizeStyles('1rem')}
20
+ img,
18
21
  span,
19
22
  svg {
20
23
  line-height: 0;
24
+ vertical-align: middle;
21
25
  }
22
26
  `;
23
27
  const labelStyles = css`
@@ -25,6 +29,7 @@ const labelStyles = css`
25
29
  font-size: 0.75rem;
26
30
  line-height: 1rem;
27
31
  padding-left: 0.125rem;
32
+ vertical-align: middle;
28
33
  `;
29
34
  const messageMapper = {
30
35
  [IconType.PriorityBlocker]: messages.priority_blocker,
@@ -99,7 +104,7 @@ const Badge = ({
99
104
  return null;
100
105
  }
101
106
 
102
- return jsx("div", {
107
+ return jsx("span", {
103
108
  css: [badgeStyles, overrideCss],
104
109
  "data-fit-to-content": true,
105
110
  "data-smart-element-badge": true,
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { css, jsx } from '@emotion/core';
4
4
  import AtlaskitLozenge from '@atlaskit/lozenge';
5
5
  const styles = css`
6
+ display: inline-flex;
6
7
  line-height: inherit;
7
8
  `;
8
9
  /**
@@ -96,6 +96,20 @@ export const getLinkSizeStyles = size => {
96
96
  `;
97
97
  }
98
98
  };
99
+ export const getMaxLineHeight = size => {
100
+ // The maximum line height based on all elements in specific size.
101
+ // These heights belongs to AvatarGroup.
102
+ switch (size) {
103
+ case SmartLinkSize.XLarge:
104
+ case SmartLinkSize.Large:
105
+ return 1.75;
106
+
107
+ case SmartLinkSize.Medium:
108
+ case SmartLinkSize.Small:
109
+ default:
110
+ return 1.5;
111
+ }
112
+ };
99
113
  export const getMaxLines = (value, defaultValue, max, min) => {
100
114
  if (value > max) {
101
115
  return defaultValue;
@@ -115,7 +129,9 @@ export const getTruncateStyles = (maxLines, lineHeight = '1rem', wordBreak = 'br
115
129
  -webkit-line-clamp: ${maxLines};
116
130
  -webkit-box-orient: vertical;
117
131
  // Fallback options
118
- max-height: calc(${maxLines} * ${lineHeight});
132
+ @supports not (-webkit-line-clamp: 1) {
133
+ max-height: calc(${maxLines} * ${lineHeight});
134
+ }
119
135
  `;
120
136
  export const hasWhiteSpace = str => {
121
137
  return str.search(/\s/) >= 0;
@@ -76,7 +76,8 @@ const HoverCardContent = ({
76
76
  actions: titleActions
77
77
  }), /*#__PURE__*/React.createElement(MetadataBlock, {
78
78
  primary: primary,
79
- secondary: secondary
79
+ secondary: secondary,
80
+ size: SmartLinkSize.Small
80
81
  }), body, /*#__PURE__*/React.createElement(FooterBlock, {
81
82
  actions: footerActions
82
83
  }));
@@ -1,10 +1,11 @@
1
+ import { ElementName } from '../../constants';
1
2
  export const HOVER_CARD_ANALYTICS_DISPLAY = 'flexible';
2
3
  export const getSimulatedMetadata = (extensionKey = '') => {
3
4
  switch (extensionKey) {
4
5
  case 'confluence-object-provider':
5
6
  return {
6
7
  metadata: {
7
- primary: ['AuthorGroup', 'CreatedBy', 'CommentCount', 'ReactCount'],
8
+ primary: [ElementName.AuthorGroup, ElementName.CreatedBy, ElementName.CommentCount, ElementName.ReactCount],
8
9
  secondary: []
9
10
  }
10
11
  };
@@ -12,7 +13,7 @@ export const getSimulatedMetadata = (extensionKey = '') => {
12
13
  case 'jira-object-provider':
13
14
  return {
14
15
  metadata: {
15
- primary: ['AuthorGroup', 'State', 'Priority'],
16
+ primary: [ElementName.AuthorGroup, ElementName.State, ElementName.Priority],
16
17
  secondary: []
17
18
  }
18
19
  };
@@ -20,7 +21,7 @@ export const getSimulatedMetadata = (extensionKey = '') => {
20
21
  default:
21
22
  return {
22
23
  metadata: {
23
- primary: ['ModifiedOn'],
24
+ primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
24
25
  secondary: []
25
26
  }
26
27
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.20",
3
+ "version": "19.1.21",
4
4
  "sideEffects": false
5
5
  }
@@ -1,12 +1,13 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
 
3
- var _templateObject, _templateObject2, _templateObject3;
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
4
4
 
5
5
  /** @jsx jsx */
6
6
  import React from 'react';
7
7
  import { css, jsx } from '@emotion/core';
8
8
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
9
- import { getBaseStyles, renderChildren } from '../utils';
9
+ import { getBaseStyles, getGapSize, renderChildren } from '../utils';
10
+ import { getMaxLineHeight, getTruncateStyles } from '../../utils';
10
11
 
11
12
  var getAlignmentStyles = function getAlignmentStyles(align) {
12
13
  switch (align) {
@@ -19,8 +20,23 @@ var getAlignmentStyles = function getAlignmentStyles(align) {
19
20
  }
20
21
  };
21
22
 
23
+ var getGapStyles = function getGapStyles(size, align) {
24
+ var gap = getGapSize(size);
25
+
26
+ if (align === SmartLinkAlignment.Right) {
27
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n > span {\n margin-left: ", "rem;\n &:first-child {\n margin-left: initial;\n }\n }\n "])), gap);
28
+ }
29
+
30
+ return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n > span {\n margin-right: ", "rem;\n &:last-child {\n margin-right: initial;\n }\n }\n "])), gap);
31
+ };
32
+
33
+ var getHorizontalDirectionStyles = function getHorizontalDirectionStyles(size, align) {
34
+ var lineHeight = getMaxLineHeight(size);
35
+ return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\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 "])), getTruncateStyles(1, lineHeight + 'rem'), getGapStyles(size, align));
36
+ };
37
+
22
38
  export var getElementGroupStyles = function getElementGroupStyles(direction, size, align, width) {
23
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n ", "\n min-width: 10%;\n ", "\n"])), getBaseStyles(direction, size), getAlignmentStyles(align), width === SmartLinkWidth.Flexible ? "flex: 1 3;" : '');
39
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n min-width: 10%;\n ", "\n ", "\n"])), getBaseStyles(direction, size), getAlignmentStyles(align), width === SmartLinkWidth.Flexible ? "flex: 1 3;" : '', direction === SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : '');
24
40
  };
25
41
  /**
26
42
  * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
@@ -1,10 +1,24 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
+
4
+ var _templateObject;
5
+
2
6
  import React from 'react';
3
- import { SmartLinkAlignment, SmartLinkDirection, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
7
+ import { css } from '@emotion/core';
8
+ import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
4
9
  import Block from '../block';
5
10
  import ElementGroup from '../element-group';
6
11
  import { Provider } from '../../elements';
7
12
  import ActionGroup from '../action-group';
13
+
14
+ var getActionGroupStyles = function getActionGroupStyles(size) {
15
+ if (size === SmartLinkSize.XLarge) {
16
+ // The biggest height of the action button exceeds the max line-height
17
+ // of the elements causing the action on the block with x-large size to
18
+ // get cut at the bottom.
19
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n max-height: 2rem;\n "])));
20
+ }
21
+ };
8
22
  /**
9
23
  * Represents a FooterBlock, designed to contain elements and actions that should appear
10
24
  * at the bottom of a link card.
@@ -13,9 +27,12 @@ import ActionGroup from '../action-group';
13
27
  * @see Block
14
28
  */
15
29
 
30
+
16
31
  var FooterBlock = function FooterBlock(props) {
17
32
  var status = props.status,
18
33
  actions = props.actions,
34
+ _props$size = props.size,
35
+ size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size,
19
36
  _props$testId = props.testId,
20
37
  testId = _props$testId === void 0 ? 'smart-footer-block' : _props$testId;
21
38
 
@@ -31,6 +48,7 @@ var FooterBlock = function FooterBlock(props) {
31
48
  testId: "smart-element-group-actions",
32
49
  align: SmartLinkAlignment.Right,
33
50
  direction: SmartLinkDirection.Horizontal,
51
+ overrideCss: getActionGroupStyles(size),
34
52
  width: SmartLinkWidth.Flexible
35
53
  }, /*#__PURE__*/React.createElement(ActionGroup, {
36
54
  items: actions,
@@ -8,9 +8,10 @@ var _templateObject;
8
8
  import React from 'react';
9
9
  import { css } from '@emotion/core';
10
10
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
11
- import { getGapSize, renderElementItems } from '../utils';
11
+ import { renderElementItems } from '../utils';
12
12
  import Block from '../block';
13
13
  import ElementGroup from '../element-group';
14
+ import { getMaxLineHeight, getTruncateStyles } from '../../utils';
14
15
  var DEFAULT_MAX_LINES = 2;
15
16
  var MAXIMUM_MAX_LINES = 2;
16
17
  var MINIMUM_MAX_LINES = 1;
@@ -18,31 +19,10 @@ var MINIMUM_MAX_LINES = 1;
18
19
  var getElementGroupStyles = function getElementGroupStyles(size, maxLines) {
19
20
  // MetadataBlock allows metadata elements to be displayed in
20
21
  // multiple lines, with maximum of 2 lines.
21
- // a) We need the height of the line to be equal on both left and right
22
- // sides so they line up nicely.
23
- // b) There is no way to truncate non-text elements nicely. Here
24
- // it's fix max height of the element group so that anything that is
25
- // overflown will not be visible.
26
- var lineHeight = getLineHeight(size);
27
- var gap = getGapSize(size);
28
- var gapHeight = gap * (maxLines - 1);
29
- var height = lineHeight * maxLines + gapHeight;
30
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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);
31
- };
32
-
33
- var getLineHeight = function getLineHeight(size) {
34
- // The maximum height of all elements in specific size.
35
- // These heights belongs to AvatarGroup.
36
- switch (size) {
37
- case SmartLinkSize.XLarge:
38
- case SmartLinkSize.Large:
39
- return 1.75;
40
-
41
- case SmartLinkSize.Medium:
42
- case SmartLinkSize.Small:
43
- default:
44
- return 1.5;
45
- }
22
+ // We need the height of the line to be equal on both left and right
23
+ // sides so they line up nicely.
24
+ var lineHeight = getMaxLineHeight(size);
25
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n line-height: ", "rem;\n ", "\n "])), lineHeight, getTruncateStyles(maxLines, lineHeight + 'rem'));
46
26
  };
47
27
 
48
28
  var getMaxLines = function getMaxLines(maxLines) {
@@ -50,7 +50,7 @@ export var getGapSize = function getGapSize(size) {
50
50
  }
51
51
  };
52
52
  export var getBaseStyles = function getBaseStyles(direction, size) {
53
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\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));
53
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\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));
54
54
  };
55
55
 
56
56
  var isActionGroup = function isActionGroup(node) {
@@ -1,6 +1,6 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
 
3
- var _templateObject;
3
+ var _templateObject, _templateObject2;
4
4
 
5
5
  /** @jsx jsx */
6
6
  import React from 'react';
@@ -10,16 +10,18 @@ import { SmartLinkSize } from '../../../../../constants';
10
10
  var MAX_COUNT = 4;
11
11
 
12
12
  var getStyles = function getStyles(size) {
13
+ var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n "])));
14
+
13
15
  switch (size) {
14
16
  case SmartLinkSize.XLarge:
15
17
  case SmartLinkSize.Large:
16
18
  // Default AK small size
17
- return;
19
+ return styles;
18
20
 
19
21
  case SmartLinkSize.Medium:
20
22
  case SmartLinkSize.Small:
21
23
  default:
22
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n li {\n span,\n svg {\n max-height: 1.25rem;\n max-width: 1.25rem;\n }\n }\n "])));
24
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n li {\n span,\n svg {\n max-height: 1.25rem;\n max-width: 1.25rem;\n }\n }\n "])), styles);
23
25
  }
24
26
  };
25
27
  /**
@@ -12,9 +12,9 @@ import { IconType } from '../../../../../constants';
12
12
  import { messages } from '../../../../../messages';
13
13
  import ImageIcon from '../../common/image-icon';
14
14
  import AtlaskitIcon from '../../common/atlaskit-icon';
15
- var badgeStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n min-width: fit-content;\n"])));
16
- var iconStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n ", "\n span,\n svg {\n line-height: 0;\n }\n"])), tokens.badgeIcon, getIconSizeStyles('1rem'));
17
- var labelStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n padding-left: 0.125rem;\n"])), tokens.badgeText);
15
+ var badgeStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n display: inline-flex;\n min-width: fit-content;\n"])));
16
+ var iconStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\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"])), tokens.badgeIcon, getIconSizeStyles('1rem'));
17
+ var labelStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n padding-left: 0.125rem;\n vertical-align: middle;\n"])), tokens.badgeText);
18
18
  var messageMapper = (_messageMapper = {}, _defineProperty(_messageMapper, IconType.PriorityBlocker, messages.priority_blocker), _defineProperty(_messageMapper, IconType.PriorityCritical, messages.priority_critical), _defineProperty(_messageMapper, IconType.PriorityHigh, messages.priority_high), _defineProperty(_messageMapper, IconType.PriorityHighest, messages.priority_highest), _defineProperty(_messageMapper, IconType.PriorityLow, messages.priority_low), _defineProperty(_messageMapper, IconType.PriorityLowest, messages.priority_lowest), _defineProperty(_messageMapper, IconType.PriorityMajor, messages.priority_major), _defineProperty(_messageMapper, IconType.PriorityMedium, messages.priority_medium), _defineProperty(_messageMapper, IconType.PriorityMinor, messages.priority_minor), _defineProperty(_messageMapper, IconType.PriorityTrivial, messages.priority_trivial), _defineProperty(_messageMapper, IconType.PriorityUndefined, messages.priority_undefined), _messageMapper);
19
19
 
20
20
  var getFormattedMessageFromIcon = function getFormattedMessageFromIcon(icon) {
@@ -76,7 +76,7 @@ var Badge = function Badge(_ref) {
76
76
  return null;
77
77
  }
78
78
 
79
- return jsx("div", {
79
+ return jsx("span", {
80
80
  css: [badgeStyles, overrideCss],
81
81
  "data-fit-to-content": true,
82
82
  "data-smart-element-badge": true,
@@ -6,7 +6,7 @@ var _templateObject;
6
6
  import React from 'react';
7
7
  import { css, jsx } from '@emotion/core';
8
8
  import AtlaskitLozenge from '@atlaskit/lozenge';
9
- var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n line-height: inherit;\n"])));
9
+ var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n line-height: inherit;\n"])));
10
10
  /**
11
11
  * A base element that displays a Lozenge.
12
12
  * @internal
@@ -67,6 +67,20 @@ export var getLinkSizeStyles = function getLinkSizeStyles(size) {
67
67
  return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: 0.75rem;\n font-weight: 400;\n letter-spacing: 0em;\n line-height: ", ";\n "])), getLinkLineHeight(size));
68
68
  }
69
69
  };
70
+ export var getMaxLineHeight = function getMaxLineHeight(size) {
71
+ // The maximum line height based on all elements in specific size.
72
+ // These heights belongs to AvatarGroup.
73
+ switch (size) {
74
+ case SmartLinkSize.XLarge:
75
+ case SmartLinkSize.Large:
76
+ return 1.75;
77
+
78
+ case SmartLinkSize.Medium:
79
+ case SmartLinkSize.Small:
80
+ default:
81
+ return 1.5;
82
+ }
83
+ };
70
84
  export var getMaxLines = function getMaxLines(value, defaultValue, max, min) {
71
85
  if (value > max) {
72
86
  return defaultValue;
@@ -81,7 +95,7 @@ export var getMaxLines = function getMaxLines(value, defaultValue, max, min) {
81
95
  export var getTruncateStyles = function getTruncateStyles(maxLines) {
82
96
  var lineHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1rem';
83
97
  var wordBreak = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'break-word';
84
- return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\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);
98
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\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);
85
99
  };
86
100
  export var hasWhiteSpace = function hasWhiteSpace(str) {
87
101
  return str.search(/\s/) >= 0;
@@ -90,7 +90,8 @@ var HoverCardContent = function HoverCardContent(_ref) {
90
90
  actions: titleActions
91
91
  }), /*#__PURE__*/React.createElement(MetadataBlock, {
92
92
  primary: primary,
93
- secondary: secondary
93
+ secondary: secondary,
94
+ size: SmartLinkSize.Small
94
95
  }), body, /*#__PURE__*/React.createElement(FooterBlock, {
95
96
  actions: footerActions
96
97
  }));
@@ -1,3 +1,4 @@
1
+ import { ElementName } from '../../constants';
1
2
  export var HOVER_CARD_ANALYTICS_DISPLAY = 'flexible';
2
3
  export var getSimulatedMetadata = function getSimulatedMetadata() {
3
4
  var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
@@ -6,7 +7,7 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
6
7
  case 'confluence-object-provider':
7
8
  return {
8
9
  metadata: {
9
- primary: ['AuthorGroup', 'CreatedBy', 'CommentCount', 'ReactCount'],
10
+ primary: [ElementName.AuthorGroup, ElementName.CreatedBy, ElementName.CommentCount, ElementName.ReactCount],
10
11
  secondary: []
11
12
  }
12
13
  };
@@ -14,7 +15,7 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
14
15
  case 'jira-object-provider':
15
16
  return {
16
17
  metadata: {
17
- primary: ['AuthorGroup', 'State', 'Priority'],
18
+ primary: [ElementName.AuthorGroup, ElementName.State, ElementName.Priority],
18
19
  secondary: []
19
20
  }
20
21
  };
@@ -22,7 +23,7 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
22
23
  default:
23
24
  return {
24
25
  metadata: {
25
- primary: ['ModifiedOn'],
26
+ primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
26
27
  secondary: []
27
28
  }
28
29
  };
@@ -7,6 +7,7 @@ export declare const getIconSizeStyles: (width: string) => SerializedStyles;
7
7
  export declare const getIconWidth: (size?: SmartLinkSize | undefined) => string;
8
8
  export declare const getLinkLineHeight: (size: SmartLinkSize) => string;
9
9
  export declare const getLinkSizeStyles: (size: SmartLinkSize) => SerializedStyles;
10
+ export declare const getMaxLineHeight: (size: SmartLinkSize) => 1.5 | 1.75;
10
11
  export declare const getMaxLines: (value: number, defaultValue: number, max: number, min: number) => number;
11
12
  export declare const getTruncateStyles: (maxLines: number, lineHeight?: string, wordBreak?: 'break-word' | 'break-all') => SerializedStyles;
12
13
  export declare const hasWhiteSpace: (str: string) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.20",
3
+ "version": "19.1.21",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"