@atlaskit/smart-card 26.16.1 → 26.18.0
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 +12 -0
- package/dist/cjs/extractors/hover/extractMetadata.js +10 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -2
- package/dist/cjs/view/BlockCard/views/flexible/styled.js +6 -4
- package/dist/cjs/view/BlockCard/views/flexible/utils/index.js +14 -0
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +38 -4
- package/dist/cjs/view/FlexibleCard/components/utils.js +8 -1
- package/dist/cjs/view/HoverCard/components/views/resolved/styled.js +1 -1
- package/dist/cjs/view/HoverCard/styled.js +1 -1
- package/dist/cjs/view/HoverCard/utils.js +13 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/hover/extractMetadata.js +6 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +5 -3
- package/dist/es2019/view/BlockCard/views/flexible/styled.js +3 -0
- package/dist/es2019/view/BlockCard/views/flexible/utils/index.js +14 -0
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +33 -4
- package/dist/es2019/view/FlexibleCard/components/utils.js +8 -0
- package/dist/es2019/view/HoverCard/components/views/resolved/styled.js +1 -1
- package/dist/es2019/view/HoverCard/styled.js +0 -4
- package/dist/es2019/view/HoverCard/utils.js +13 -0
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/hover/extractMetadata.js +9 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +5 -3
- package/dist/esm/view/BlockCard/views/flexible/styled.js +4 -3
- package/dist/esm/view/BlockCard/views/flexible/utils/index.js +14 -0
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +36 -4
- package/dist/esm/view/FlexibleCard/components/utils.js +6 -0
- package/dist/esm/view/HoverCard/components/views/resolved/styled.js +1 -1
- package/dist/esm/view/HoverCard/styled.js +1 -1
- package/dist/esm/view/HoverCard/utils.js +13 -0
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/BlockCard/views/flexible/styled.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +12 -0
- package/dist/types/view/FlexibleCard/components/elements/avatar-group/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/utils.d.ts +2 -0
- package/dist/types-ts4.5/view/BlockCard/views/flexible/styled.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +12 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/avatar-group/types.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +2 -0
- package/package.json +2 -2
- package/report.api.md +3 -0
- package/tmp/api-report-tmp.d.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`e7e73b61721`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e7e73b61721) - [ux] We are testing an improved dispaly for Slack hover & block cards behind a feature flag. If this update is successful it will be available in a later release.
|
|
8
|
+
|
|
9
|
+
## 26.17.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`efc2669bc13`](https://bitbucket.org/atlassian/atlassian-frontend/commits/efc2669bc13) - We are testing adding a prefix to the Avatar name tooltip in the Hover Card behind the "platform.linking-platform.smart-card.enable-better-metadata_iojwg" feature flag. You can turn it on by passing new showNamePrefix prop to the Flexible UI elements such us AssignedToGroup, OwnedByGroup and AuthorGroup. If this fix is successful it will be available in a later release.
|
|
14
|
+
|
|
3
15
|
## 26.16.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.extractMetadata = exports.elementNamesToItems = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _constants = require("../../constants");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
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; }
|
|
13
|
+
var AvatarGroupsWithNamePrefix = [_constants.ElementName.AssignedToGroup, _constants.ElementName.OwnedByGroup, _constants.ElementName.AuthorGroup];
|
|
8
14
|
var elementNamesToItems = function elementNamesToItems(elementNames) {
|
|
9
15
|
return elementNames.filter(function (element) {
|
|
10
16
|
return element in _constants.ElementName;
|
|
11
17
|
}).map(function (elementName) {
|
|
12
|
-
return {
|
|
18
|
+
return _objectSpread({
|
|
13
19
|
name: elementName,
|
|
14
20
|
testId: "".concat(elementName.toLowerCase(), "-metadata-element")
|
|
15
|
-
}
|
|
21
|
+
}, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && AvatarGroupsWithNamePrefix.includes(elementName) && {
|
|
22
|
+
showNamePrefix: true
|
|
23
|
+
});
|
|
16
24
|
});
|
|
17
25
|
};
|
|
18
26
|
exports.elementNamesToItems = elementNamesToItems;
|
|
@@ -21,7 +21,7 @@ exports.ANALYTICS_CHANNEL = ANALYTICS_CHANNEL;
|
|
|
21
21
|
var context = {
|
|
22
22
|
componentName: 'smart-cards',
|
|
23
23
|
packageName: "@atlaskit/smart-card",
|
|
24
|
-
packageVersion: "26.
|
|
24
|
+
packageVersion: "26.18.0"
|
|
25
25
|
};
|
|
26
26
|
exports.context = context;
|
|
27
27
|
var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
@@ -91,7 +91,9 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
91
91
|
onError: function onError() {
|
|
92
92
|
setIsPreviewBlockErrored(true);
|
|
93
93
|
}
|
|
94
|
-
}) : null, /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, {
|
|
94
|
+
}) : null, /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, (0, _extends2.default)({}, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
95
|
+
overrideCss: _styled.footerBlockCss
|
|
96
|
+
}, {
|
|
95
97
|
actions: [{
|
|
96
98
|
name: _constants.ActionName.PreviewAction,
|
|
97
99
|
hideIcon: true,
|
|
@@ -138,7 +140,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
138
140
|
});
|
|
139
141
|
}
|
|
140
142
|
}]
|
|
141
|
-
}));
|
|
143
|
+
})));
|
|
142
144
|
};
|
|
143
145
|
var _default = (0, _withFlexibleUIBlockCardStyle.withFlexibleUIBlockCardStyle)(FlexibleResolvedView);
|
|
144
146
|
exports.default = _default;
|
|
@@ -4,19 +4,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.titleBlockCss = exports.metadataBlockCss = exports.flexibleBlockCardStyle = void 0;
|
|
7
|
+
exports.titleBlockCss = exports.metadataBlockCss = exports.footerBlockCss = exports.flexibleBlockCardStyle = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _token = require("../../../../utils/token");
|
|
10
10
|
var _react = require("@emotion/react");
|
|
11
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
13
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
14
14
|
// in editor prosemirror adds padding-left so we need to overwrite it
|
|
15
15
|
var metadataBlockCss = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n [data-smart-element-group] {\n line-height: 1rem;\n }\n"])));
|
|
16
16
|
exports.metadataBlockCss = metadataBlockCss;
|
|
17
17
|
var titleBlockCss = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n"])), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "gap: 0.5em;" : "", (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
|
|
18
18
|
exports.titleBlockCss = titleBlockCss;
|
|
19
|
-
var
|
|
20
|
-
|
|
19
|
+
var footerBlockCss = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n height: 1.5rem;\n"])));
|
|
20
|
+
exports.footerBlockCss = footerBlockCss;
|
|
21
|
+
var flexibleBlockCardElevationStyle = (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), _token.tokens.elevation, "var(--ds-space-025, 2px)");
|
|
22
|
+
var refreshedFlexibleBlockCardStyle = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-300, 12px)", "var(--ds-border-input, ".concat(_colors.N40, ")"));
|
|
21
23
|
var flexibleBlockCardStyle = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
|
|
22
24
|
exports.flexibleBlockCardStyle = flexibleBlockCardStyle;
|
|
@@ -81,6 +81,20 @@ var getSimulatedBetterMetadata = function getSimulatedBetterMetadata(cardDetails
|
|
|
81
81
|
name: _constants.ElementName.SubTasksProgress
|
|
82
82
|
}]
|
|
83
83
|
};
|
|
84
|
+
case 'slack-object-provider':
|
|
85
|
+
return {
|
|
86
|
+
titleMetadata: defaultTitleMetadata,
|
|
87
|
+
topMetadata: [{
|
|
88
|
+
name: _constants.ElementName.AuthorGroup
|
|
89
|
+
}, {
|
|
90
|
+
name: _constants.ElementName.SentOn
|
|
91
|
+
}],
|
|
92
|
+
bottomMetadata: [{
|
|
93
|
+
name: _constants.ElementName.ReactCount
|
|
94
|
+
}, {
|
|
95
|
+
name: _constants.ElementName.CommentCount
|
|
96
|
+
}]
|
|
97
|
+
};
|
|
84
98
|
default:
|
|
85
99
|
return {
|
|
86
100
|
titleMetadata: defaultTitleMetadata,
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
-
var _react =
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
12
|
var _react2 = require("@emotion/react");
|
|
11
13
|
var _avatarGroup = _interopRequireDefault(require("@atlaskit/avatar-group"));
|
|
12
14
|
var _constants = require("../../../../../constants");
|
|
15
|
+
var _messages = require("../../../../../messages");
|
|
16
|
+
var _reactIntlNext = require("react-intl-next");
|
|
17
|
+
var _utils = require("../../utils");
|
|
13
18
|
var _templateObject, _templateObject2;
|
|
14
19
|
/** @jsx jsx */
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
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; }
|
|
15
24
|
var MAX_COUNT = 4;
|
|
16
25
|
var getStyles = function getStyles(size) {
|
|
17
26
|
var styles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: inline-flex;\n ul,\n ul {\n margin-right: 0.5rem;\n margin-top: 0;\n }\n "])));
|
|
@@ -26,6 +35,18 @@ var getStyles = function getStyles(size) {
|
|
|
26
35
|
return (0, _react2.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);
|
|
27
36
|
}
|
|
28
37
|
};
|
|
38
|
+
var getPersonNameWithPrefix = function getPersonNameWithPrefix(elementName, personName, intl) {
|
|
39
|
+
switch (elementName) {
|
|
40
|
+
case _constants.ElementName.AssignedToGroup:
|
|
41
|
+
return (0, _utils.getFormattedMessageAsString)(intl, _messages.messages.assigned_to, personName);
|
|
42
|
+
case _constants.ElementName.OwnedByGroup:
|
|
43
|
+
return (0, _utils.getFormattedMessageAsString)(intl, _messages.messages.owned_by, personName);
|
|
44
|
+
case _constants.ElementName.AuthorGroup:
|
|
45
|
+
return (0, _utils.getFormattedMessageAsString)(intl, _messages.messages.created_by, personName);
|
|
46
|
+
default:
|
|
47
|
+
return personName;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
29
50
|
|
|
30
51
|
/**
|
|
31
52
|
* A base element that displays a group of avatars.
|
|
@@ -44,8 +65,21 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
44
65
|
_ref$size = _ref.size,
|
|
45
66
|
size = _ref$size === void 0 ? _constants.SmartLinkSize.Medium : _ref$size,
|
|
46
67
|
_ref$testId = _ref.testId,
|
|
47
|
-
testId = _ref$testId === void 0 ? 'smart-element-avatar-group' : _ref$testId
|
|
48
|
-
|
|
68
|
+
testId = _ref$testId === void 0 ? 'smart-element-avatar-group' : _ref$testId,
|
|
69
|
+
_ref$showNamePrefix = _ref.showNamePrefix,
|
|
70
|
+
showNamePrefix = _ref$showNamePrefix === void 0 ? false : _ref$showNamePrefix;
|
|
71
|
+
var intl = (0, _reactIntlNext.useIntl)();
|
|
72
|
+
var data = (0, _react.useMemo)(function () {
|
|
73
|
+
if (name && showNamePrefix) {
|
|
74
|
+
return items.map(function (person) {
|
|
75
|
+
return _objectSpread(_objectSpread({}, person), {}, {
|
|
76
|
+
name: getPersonNameWithPrefix(name, person.name, intl) || person.name
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return items;
|
|
81
|
+
}, [name, items, showNamePrefix, intl]);
|
|
82
|
+
if (!data.length) {
|
|
49
83
|
return null;
|
|
50
84
|
}
|
|
51
85
|
return (0, _react2.jsx)("span", {
|
|
@@ -58,7 +92,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
58
92
|
maxCount: maxCount,
|
|
59
93
|
appearance: "stack",
|
|
60
94
|
size: "small",
|
|
61
|
-
data:
|
|
95
|
+
data: data,
|
|
62
96
|
testId: testId
|
|
63
97
|
}));
|
|
64
98
|
};
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.sizeToButtonSpacing = exports.openEmbedModalWithFlexibleUiIcon = exports.hasWhiteSpace = exports.getTruncateStyles = exports.getMaxLines = exports.getMaxLineHeight = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessage = void 0;
|
|
7
|
+
exports.sizeToButtonSpacing = exports.openEmbedModalWithFlexibleUiIcon = exports.hasWhiteSpace = exports.getTruncateStyles = exports.getMaxLines = exports.getMaxLineHeight = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessageAsString = exports.getFormattedMessage = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -27,6 +27,13 @@ var getFormattedMessage = function getFormattedMessage(message) {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
exports.getFormattedMessage = getFormattedMessage;
|
|
30
|
+
var getFormattedMessageAsString = function getFormattedMessageAsString(intl, message, context) {
|
|
31
|
+
var formatMessage = intl.formatMessage;
|
|
32
|
+
return message ? formatMessage(message, {
|
|
33
|
+
context: context
|
|
34
|
+
}) : null;
|
|
35
|
+
};
|
|
36
|
+
exports.getFormattedMessageAsString = getFormattedMessageAsString;
|
|
30
37
|
var getIconDimensionStyles = function getIconDimensionStyles(value) {
|
|
31
38
|
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: ", ";\n min-height: ", ";\n max-height: ", ";\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n"])), value, value, value, value, value, value);
|
|
32
39
|
};
|
|
@@ -13,7 +13,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
13
13
|
var elementGap = '0.5rem';
|
|
14
14
|
var metadataBlockCss = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n gap: 0px;\n /* primary element group */\n [data-smart-element-group]:nth-of-type(1) {\n flex-grow: 7;\n\n // a separator between text-based element\n ", "\n\n /* horizontal spacing between elements in group */\n > span {\n margin-right: ", ";\n }\n }\n /* secondary element group */\n [data-smart-element-group]:nth-of-type(2) {\n flex-grow: 3;\n /* horizontal spacing between elements in group */\n > span {\n margin-left: ", ";\n }\n }\n ", "\n"])), _styled.separatorCss, elementGap, elementGap, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "[data-smart-element-group] {\n line-height: 1rem;\n }" : "");
|
|
15
15
|
exports.metadataBlockCss = metadataBlockCss;
|
|
16
|
-
var footerBlockCss = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n"])), !(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "padding-top: 0.25rem;" : "");
|
|
16
|
+
var footerBlockCss = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n"])), !(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "padding-top: 0.25rem;" : "height: 1.5rem;");
|
|
17
17
|
exports.footerBlockCss = footerBlockCss;
|
|
18
18
|
var hiddenSnippetStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n visibility: hidden;\n position: absolute;\n"])));
|
|
19
19
|
exports.hiddenSnippetStyles = hiddenSnippetStyles;
|
|
@@ -37,7 +37,7 @@ var CARD_GAP_PX = 10;
|
|
|
37
37
|
exports.CARD_GAP_PX = CARD_GAP_PX;
|
|
38
38
|
var blockGap = '0.5rem';
|
|
39
39
|
var elementGap = '0.5rem';
|
|
40
|
-
var separatorCss = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n
|
|
40
|
+
var separatorCss = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n"])), elementGap);
|
|
41
41
|
exports.separatorCss = separatorCss;
|
|
42
42
|
var HoverCardContainer = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: ", "rem;\n ", "\n\n .", " {\n display: none;\n }\n"])), CARD_WIDTH_REM, !(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "padding: 1rem;" : "", _index.loadingPlaceholderClassName);
|
|
43
43
|
exports.HoverCardContainer = HoverCardContainer;
|
|
@@ -169,6 +169,19 @@ var getSimulatedBetterMetadata = function getSimulatedBetterMetadata() {
|
|
|
169
169
|
subtitle: []
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
|
+
case 'slack-object-provider':
|
|
173
|
+
return {
|
|
174
|
+
topMetadataBlock: {
|
|
175
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.SentOn],
|
|
176
|
+
secondary: [],
|
|
177
|
+
subtitle: []
|
|
178
|
+
},
|
|
179
|
+
bottomMetadataBlock: {
|
|
180
|
+
primary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount],
|
|
181
|
+
secondary: [],
|
|
182
|
+
subtitle: []
|
|
183
|
+
}
|
|
184
|
+
};
|
|
172
185
|
case 'google-object-provider':
|
|
173
186
|
case 'figma-object-provider':
|
|
174
187
|
return _objectSpread(_objectSpread({}, defaultMetadata), {}, {
|
|
@@ -18,7 +18,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
18
18
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
19
19
|
var PACKAGE_DATA = {
|
|
20
20
|
packageName: "@atlaskit/smart-card",
|
|
21
|
-
packageVersion: "26.
|
|
21
|
+
packageVersion: "26.18.0",
|
|
22
22
|
componentName: 'linkUrl'
|
|
23
23
|
};
|
|
24
24
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { ElementName } from '../../constants';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
const AvatarGroupsWithNamePrefix = [ElementName.AssignedToGroup, ElementName.OwnedByGroup, ElementName.AuthorGroup];
|
|
2
4
|
export const elementNamesToItems = elementNames => {
|
|
3
5
|
return elementNames.filter(element => element in ElementName).map(elementName => ({
|
|
4
6
|
name: elementName,
|
|
5
|
-
testId: `${elementName.toLowerCase()}-metadata-element
|
|
7
|
+
testId: `${elementName.toLowerCase()}-metadata-element`,
|
|
8
|
+
...(getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && AvatarGroupsWithNamePrefix.includes(elementName) && {
|
|
9
|
+
showNamePrefix: true
|
|
10
|
+
})
|
|
6
11
|
}));
|
|
7
12
|
};
|
|
8
13
|
export const extractMetadata = jsonLd => {
|
|
@@ -3,7 +3,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
3
3
|
export const context = {
|
|
4
4
|
componentName: 'smart-cards',
|
|
5
5
|
packageName: "@atlaskit/smart-card",
|
|
6
|
-
packageVersion: "26.
|
|
6
|
+
packageVersion: "26.18.0"
|
|
7
7
|
};
|
|
8
8
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
9
9
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
3
3
|
import FlexibleCard from '../../../FlexibleCard';
|
|
4
4
|
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
5
5
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
|
|
6
|
-
import { metadataBlockCss } from './styled';
|
|
6
|
+
import { metadataBlockCss, footerBlockCss } from './styled';
|
|
7
7
|
import { ActionName, CardDisplay, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
|
|
8
8
|
import uuid from 'uuid';
|
|
9
9
|
import { getSimulatedMetadata, getSimulatedBetterMetadata } from './utils';
|
|
@@ -75,7 +75,9 @@ const FlexibleResolvedView = ({
|
|
|
75
75
|
onError: () => {
|
|
76
76
|
setIsPreviewBlockErrored(true);
|
|
77
77
|
}
|
|
78
|
-
}) : null, /*#__PURE__*/React.createElement(FooterBlock, {
|
|
78
|
+
}) : null, /*#__PURE__*/React.createElement(FooterBlock, _extends({}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
79
|
+
overrideCss: footerBlockCss
|
|
80
|
+
}, {
|
|
79
81
|
actions: [{
|
|
80
82
|
name: ActionName.PreviewAction,
|
|
81
83
|
hideIcon: true,
|
|
@@ -122,6 +124,6 @@ const FlexibleResolvedView = ({
|
|
|
122
124
|
});
|
|
123
125
|
}
|
|
124
126
|
}]
|
|
125
|
-
}));
|
|
127
|
+
})));
|
|
126
128
|
};
|
|
127
129
|
export default withFlexibleUIBlockCardStyle(FlexibleResolvedView);
|
|
@@ -75,6 +75,20 @@ export const getSimulatedBetterMetadata = cardDetails => {
|
|
|
75
75
|
name: ElementName.SubTasksProgress
|
|
76
76
|
}]
|
|
77
77
|
};
|
|
78
|
+
case 'slack-object-provider':
|
|
79
|
+
return {
|
|
80
|
+
titleMetadata: defaultTitleMetadata,
|
|
81
|
+
topMetadata: [{
|
|
82
|
+
name: ElementName.AuthorGroup
|
|
83
|
+
}, {
|
|
84
|
+
name: ElementName.SentOn
|
|
85
|
+
}],
|
|
86
|
+
bottomMetadata: [{
|
|
87
|
+
name: ElementName.ReactCount
|
|
88
|
+
}, {
|
|
89
|
+
name: ElementName.CommentCount
|
|
90
|
+
}]
|
|
91
|
+
};
|
|
78
92
|
default:
|
|
79
93
|
return {
|
|
80
94
|
titleMetadata: defaultTitleMetadata,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import AtlaskitAvatarGroup from '@atlaskit/avatar-group';
|
|
5
5
|
import { SmartLinkSize } from '../../../../../constants';
|
|
6
|
+
import { messages } from '../../../../../messages';
|
|
7
|
+
import { useIntl } from 'react-intl-next';
|
|
8
|
+
import { ElementName } from '../../../../../constants';
|
|
9
|
+
import { getFormattedMessageAsString } from '../../utils';
|
|
6
10
|
const MAX_COUNT = 4;
|
|
7
11
|
const getStyles = size => {
|
|
8
12
|
const styles = css`
|
|
@@ -33,6 +37,18 @@ const getStyles = size => {
|
|
|
33
37
|
`;
|
|
34
38
|
}
|
|
35
39
|
};
|
|
40
|
+
const getPersonNameWithPrefix = (elementName, personName, intl) => {
|
|
41
|
+
switch (elementName) {
|
|
42
|
+
case ElementName.AssignedToGroup:
|
|
43
|
+
return getFormattedMessageAsString(intl, messages.assigned_to, personName);
|
|
44
|
+
case ElementName.OwnedByGroup:
|
|
45
|
+
return getFormattedMessageAsString(intl, messages.owned_by, personName);
|
|
46
|
+
case ElementName.AuthorGroup:
|
|
47
|
+
return getFormattedMessageAsString(intl, messages.created_by, personName);
|
|
48
|
+
default:
|
|
49
|
+
return personName;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
36
52
|
|
|
37
53
|
/**
|
|
38
54
|
* A base element that displays a group of avatars.
|
|
@@ -47,9 +63,22 @@ const AvatarGroup = ({
|
|
|
47
63
|
name,
|
|
48
64
|
overrideCss,
|
|
49
65
|
size = SmartLinkSize.Medium,
|
|
50
|
-
testId = 'smart-element-avatar-group'
|
|
66
|
+
testId = 'smart-element-avatar-group',
|
|
67
|
+
showNamePrefix = false
|
|
51
68
|
}) => {
|
|
52
|
-
|
|
69
|
+
const intl = useIntl();
|
|
70
|
+
const data = useMemo(() => {
|
|
71
|
+
if (name && showNamePrefix) {
|
|
72
|
+
return items.map(person => {
|
|
73
|
+
return {
|
|
74
|
+
...person,
|
|
75
|
+
name: getPersonNameWithPrefix(name, person.name, intl) || person.name
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return items;
|
|
80
|
+
}, [name, items, showNamePrefix, intl]);
|
|
81
|
+
if (!data.length) {
|
|
53
82
|
return null;
|
|
54
83
|
}
|
|
55
84
|
return jsx("span", {
|
|
@@ -62,7 +91,7 @@ const AvatarGroup = ({
|
|
|
62
91
|
maxCount: maxCount,
|
|
63
92
|
appearance: "stack",
|
|
64
93
|
size: "small",
|
|
65
|
-
data:
|
|
94
|
+
data: data,
|
|
66
95
|
testId: testId
|
|
67
96
|
}));
|
|
68
97
|
};
|
|
@@ -22,6 +22,14 @@ export const getFormattedMessage = message => {
|
|
|
22
22
|
}));
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
+
export const getFormattedMessageAsString = (intl, message, context) => {
|
|
26
|
+
const {
|
|
27
|
+
formatMessage
|
|
28
|
+
} = intl;
|
|
29
|
+
return message ? formatMessage(message, {
|
|
30
|
+
context
|
|
31
|
+
}) : null;
|
|
32
|
+
};
|
|
25
33
|
const getIconDimensionStyles = value => css`
|
|
26
34
|
height: ${value};
|
|
27
35
|
min-height: ${value};
|
|
@@ -29,7 +29,7 @@ export const metadataBlockCss = css`
|
|
|
29
29
|
}` : ``}
|
|
30
30
|
`;
|
|
31
31
|
export const footerBlockCss = css`
|
|
32
|
-
${!getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? `padding-top: 0.25rem;` :
|
|
32
|
+
${!getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? `padding-top: 0.25rem;` : `height: 1.5rem;`}
|
|
33
33
|
`;
|
|
34
34
|
export const hiddenSnippetStyles = css`
|
|
35
35
|
visibility: hidden;
|
|
@@ -27,10 +27,6 @@ export const separatorCss = css`
|
|
|
27
27
|
[data-separator] + [data-separator]:before {
|
|
28
28
|
margin-right: ${elementGap};
|
|
29
29
|
}
|
|
30
|
-
${getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? ` [data-smart-element-avatar-group] + [data-separator]:before {
|
|
31
|
-
content: '•';
|
|
32
|
-
margin-right: ${elementGap};
|
|
33
|
-
}` : ``}
|
|
34
30
|
`;
|
|
35
31
|
export const HoverCardContainer = css`
|
|
36
32
|
background: none;
|
|
@@ -160,6 +160,19 @@ export const getSimulatedBetterMetadata = (extensionKey = '', data) => {
|
|
|
160
160
|
subtitle: []
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
|
+
case 'slack-object-provider':
|
|
164
|
+
return {
|
|
165
|
+
topMetadataBlock: {
|
|
166
|
+
primary: [ElementName.AuthorGroup, ElementName.SentOn],
|
|
167
|
+
secondary: [],
|
|
168
|
+
subtitle: []
|
|
169
|
+
},
|
|
170
|
+
bottomMetadataBlock: {
|
|
171
|
+
primary: [ElementName.ReactCount, ElementName.CommentCount],
|
|
172
|
+
secondary: [],
|
|
173
|
+
subtitle: []
|
|
174
|
+
}
|
|
175
|
+
};
|
|
163
176
|
case 'google-object-provider':
|
|
164
177
|
case 'figma-object-provider':
|
|
165
178
|
return {
|
|
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
8
8
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
const PACKAGE_DATA = {
|
|
10
10
|
packageName: "@atlaskit/smart-card",
|
|
11
|
-
packageVersion: "26.
|
|
11
|
+
packageVersion: "26.18.0",
|
|
12
12
|
componentName: 'linkUrl'
|
|
13
13
|
};
|
|
14
14
|
const Link = withLinkClickedEvent('a');
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
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) { _defineProperty(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; }
|
|
1
4
|
import { ElementName } from '../../constants';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
var AvatarGroupsWithNamePrefix = [ElementName.AssignedToGroup, ElementName.OwnedByGroup, ElementName.AuthorGroup];
|
|
2
7
|
export var elementNamesToItems = function elementNamesToItems(elementNames) {
|
|
3
8
|
return elementNames.filter(function (element) {
|
|
4
9
|
return element in ElementName;
|
|
5
10
|
}).map(function (elementName) {
|
|
6
|
-
return {
|
|
11
|
+
return _objectSpread({
|
|
7
12
|
name: elementName,
|
|
8
13
|
testId: "".concat(elementName.toLowerCase(), "-metadata-element")
|
|
9
|
-
}
|
|
14
|
+
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && AvatarGroupsWithNamePrefix.includes(elementName) && {
|
|
15
|
+
showNamePrefix: true
|
|
16
|
+
});
|
|
10
17
|
});
|
|
11
18
|
};
|
|
12
19
|
export var extractMetadata = function extractMetadata(jsonLd) {
|
|
@@ -13,7 +13,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
13
13
|
export var context = {
|
|
14
14
|
componentName: 'smart-cards',
|
|
15
15
|
packageName: "@atlaskit/smart-card",
|
|
16
|
-
packageVersion: "26.
|
|
16
|
+
packageVersion: "26.18.0"
|
|
17
17
|
};
|
|
18
18
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
19
19
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -4,7 +4,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
4
4
|
import FlexibleCard from '../../../FlexibleCard';
|
|
5
5
|
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
6
6
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
|
|
7
|
-
import { metadataBlockCss } from './styled';
|
|
7
|
+
import { metadataBlockCss, footerBlockCss } from './styled';
|
|
8
8
|
import { ActionName, CardDisplay, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
|
|
9
9
|
import uuid from 'uuid';
|
|
10
10
|
import { getSimulatedMetadata, getSimulatedBetterMetadata } from './utils';
|
|
@@ -82,7 +82,9 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
82
82
|
onError: function onError() {
|
|
83
83
|
setIsPreviewBlockErrored(true);
|
|
84
84
|
}
|
|
85
|
-
}) : null, /*#__PURE__*/React.createElement(FooterBlock, {
|
|
85
|
+
}) : null, /*#__PURE__*/React.createElement(FooterBlock, _extends({}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
86
|
+
overrideCss: footerBlockCss
|
|
87
|
+
}, {
|
|
86
88
|
actions: [{
|
|
87
89
|
name: ActionName.PreviewAction,
|
|
88
90
|
hideIcon: true,
|
|
@@ -129,6 +131,6 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
129
131
|
});
|
|
130
132
|
}
|
|
131
133
|
}]
|
|
132
|
-
}));
|
|
134
|
+
})));
|
|
133
135
|
};
|
|
134
136
|
export default withFlexibleUIBlockCardStyle(FlexibleResolvedView);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
3
|
import { tokens } from '../../../../utils/token';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { N40 } from '@atlaskit/theme/colors';
|
|
@@ -8,6 +8,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
8
8
|
// in editor prosemirror adds padding-left so we need to overwrite it
|
|
9
9
|
export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n [data-smart-element-group] {\n line-height: 1rem;\n }\n"])));
|
|
10
10
|
export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "gap: 0.5em;" : "", getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 1.5rem;\n"])));
|
|
12
|
+
var flexibleBlockCardElevationStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), tokens.elevation, "var(--ds-space-025, 2px)");
|
|
13
|
+
var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-300, 12px)", "var(--ds-border-input, ".concat(N40, ")"));
|
|
13
14
|
export var flexibleBlockCardStyle = getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
|
|
@@ -75,6 +75,20 @@ export var getSimulatedBetterMetadata = function getSimulatedBetterMetadata(card
|
|
|
75
75
|
name: ElementName.SubTasksProgress
|
|
76
76
|
}]
|
|
77
77
|
};
|
|
78
|
+
case 'slack-object-provider':
|
|
79
|
+
return {
|
|
80
|
+
titleMetadata: defaultTitleMetadata,
|
|
81
|
+
topMetadata: [{
|
|
82
|
+
name: ElementName.AuthorGroup
|
|
83
|
+
}, {
|
|
84
|
+
name: ElementName.SentOn
|
|
85
|
+
}],
|
|
86
|
+
bottomMetadata: [{
|
|
87
|
+
name: ElementName.ReactCount
|
|
88
|
+
}, {
|
|
89
|
+
name: ElementName.CommentCount
|
|
90
|
+
}]
|
|
91
|
+
};
|
|
78
92
|
default:
|
|
79
93
|
return {
|
|
80
94
|
titleMetadata: defaultTitleMetadata,
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
3
|
var _templateObject, _templateObject2;
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
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) { _defineProperty(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; }
|
|
3
6
|
/** @jsx jsx */
|
|
4
|
-
import React from 'react';
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
5
8
|
import { css, jsx } from '@emotion/react';
|
|
6
9
|
import AtlaskitAvatarGroup from '@atlaskit/avatar-group';
|
|
7
10
|
import { SmartLinkSize } from '../../../../../constants';
|
|
11
|
+
import { messages } from '../../../../../messages';
|
|
12
|
+
import { useIntl } from 'react-intl-next';
|
|
13
|
+
import { ElementName } from '../../../../../constants';
|
|
14
|
+
import { getFormattedMessageAsString } from '../../utils';
|
|
8
15
|
var MAX_COUNT = 4;
|
|
9
16
|
var getStyles = function getStyles(size) {
|
|
10
17
|
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n ul,\n ul {\n margin-right: 0.5rem;\n margin-top: 0;\n }\n "])));
|
|
@@ -19,6 +26,18 @@ var getStyles = function getStyles(size) {
|
|
|
19
26
|
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);
|
|
20
27
|
}
|
|
21
28
|
};
|
|
29
|
+
var getPersonNameWithPrefix = function getPersonNameWithPrefix(elementName, personName, intl) {
|
|
30
|
+
switch (elementName) {
|
|
31
|
+
case ElementName.AssignedToGroup:
|
|
32
|
+
return getFormattedMessageAsString(intl, messages.assigned_to, personName);
|
|
33
|
+
case ElementName.OwnedByGroup:
|
|
34
|
+
return getFormattedMessageAsString(intl, messages.owned_by, personName);
|
|
35
|
+
case ElementName.AuthorGroup:
|
|
36
|
+
return getFormattedMessageAsString(intl, messages.created_by, personName);
|
|
37
|
+
default:
|
|
38
|
+
return personName;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
22
41
|
|
|
23
42
|
/**
|
|
24
43
|
* A base element that displays a group of avatars.
|
|
@@ -37,8 +56,21 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
37
56
|
_ref$size = _ref.size,
|
|
38
57
|
size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size,
|
|
39
58
|
_ref$testId = _ref.testId,
|
|
40
|
-
testId = _ref$testId === void 0 ? 'smart-element-avatar-group' : _ref$testId
|
|
41
|
-
|
|
59
|
+
testId = _ref$testId === void 0 ? 'smart-element-avatar-group' : _ref$testId,
|
|
60
|
+
_ref$showNamePrefix = _ref.showNamePrefix,
|
|
61
|
+
showNamePrefix = _ref$showNamePrefix === void 0 ? false : _ref$showNamePrefix;
|
|
62
|
+
var intl = useIntl();
|
|
63
|
+
var data = useMemo(function () {
|
|
64
|
+
if (name && showNamePrefix) {
|
|
65
|
+
return items.map(function (person) {
|
|
66
|
+
return _objectSpread(_objectSpread({}, person), {}, {
|
|
67
|
+
name: getPersonNameWithPrefix(name, person.name, intl) || person.name
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return items;
|
|
72
|
+
}, [name, items, showNamePrefix, intl]);
|
|
73
|
+
if (!data.length) {
|
|
42
74
|
return null;
|
|
43
75
|
}
|
|
44
76
|
return jsx("span", {
|
|
@@ -51,7 +83,7 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
51
83
|
maxCount: maxCount,
|
|
52
84
|
appearance: "stack",
|
|
53
85
|
size: "small",
|
|
54
|
-
data:
|
|
86
|
+
data: data,
|
|
55
87
|
testId: testId
|
|
56
88
|
}));
|
|
57
89
|
};
|
|
@@ -18,6 +18,12 @@ export var getFormattedMessage = function getFormattedMessage(message) {
|
|
|
18
18
|
}));
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
+
export var getFormattedMessageAsString = function getFormattedMessageAsString(intl, message, context) {
|
|
22
|
+
var formatMessage = intl.formatMessage;
|
|
23
|
+
return message ? formatMessage(message, {
|
|
24
|
+
context: context
|
|
25
|
+
}) : null;
|
|
26
|
+
};
|
|
21
27
|
var getIconDimensionStyles = function getIconDimensionStyles(value) {
|
|
22
28
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", ";\n min-height: ", ";\n max-height: ", ";\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n"])), value, value, value, value, value, value);
|
|
23
29
|
};
|
|
@@ -5,5 +5,5 @@ import { separatorCss } from '../../../styled';
|
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
var elementGap = '0.5rem';
|
|
7
7
|
export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n gap: 0px;\n /* primary element group */\n [data-smart-element-group]:nth-of-type(1) {\n flex-grow: 7;\n\n // a separator between text-based element\n ", "\n\n /* horizontal spacing between elements in group */\n > span {\n margin-right: ", ";\n }\n }\n /* secondary element group */\n [data-smart-element-group]:nth-of-type(2) {\n flex-grow: 3;\n /* horizontal spacing between elements in group */\n > span {\n margin-left: ", ";\n }\n }\n ", "\n"])), separatorCss, elementGap, elementGap, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "[data-smart-element-group] {\n line-height: 1rem;\n }" : "");
|
|
8
|
-
export var footerBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n"])), !getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "padding-top: 0.25rem;" : "");
|
|
8
|
+
export var footerBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n"])), !getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "padding-top: 0.25rem;" : "height: 1.5rem;");
|
|
9
9
|
export var hiddenSnippetStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n visibility: hidden;\n position: absolute;\n"])));
|
|
@@ -27,7 +27,7 @@ export var CARD_WIDTH_REM = 24;
|
|
|
27
27
|
export var CARD_GAP_PX = 10;
|
|
28
28
|
var blockGap = '0.5rem';
|
|
29
29
|
var elementGap = '0.5rem';
|
|
30
|
-
export var separatorCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n
|
|
30
|
+
export var separatorCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n"])), elementGap);
|
|
31
31
|
export var HoverCardContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: ", "rem;\n ", "\n\n .", " {\n display: none;\n }\n"])), CARD_WIDTH_REM, !getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "padding: 1rem;" : "", loadingPlaceholderClassName);
|
|
32
32
|
export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n gap: ", ";\n\n ", "\n\n // title and subtitle element group\n [data-smart-element-group] {\n // gap between title and subtitle\n gap: 0.06rem;\n display: flex;\n /* subtitle element group */\n > [data-smart-element-group] {\n > span {\n margin-right: ", ";\n }\n }\n }\n\n ", "\n"])), blockGap, separatorCss, elementGap, getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
|
|
33
33
|
export var getTransitionStyles = function getTransitionStyles(snippetHeight) {
|
|
@@ -161,6 +161,19 @@ export var getSimulatedBetterMetadata = function getSimulatedBetterMetadata() {
|
|
|
161
161
|
subtitle: []
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
|
+
case 'slack-object-provider':
|
|
165
|
+
return {
|
|
166
|
+
topMetadataBlock: {
|
|
167
|
+
primary: [ElementName.AuthorGroup, ElementName.SentOn],
|
|
168
|
+
secondary: [],
|
|
169
|
+
subtitle: []
|
|
170
|
+
},
|
|
171
|
+
bottomMetadataBlock: {
|
|
172
|
+
primary: [ElementName.ReactCount, ElementName.CommentCount],
|
|
173
|
+
secondary: [],
|
|
174
|
+
subtitle: []
|
|
175
|
+
}
|
|
176
|
+
};
|
|
164
177
|
case 'google-object-provider':
|
|
165
178
|
case 'figma-object-provider':
|
|
166
179
|
return _objectSpread(_objectSpread({}, defaultMetadata), {}, {
|
|
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
11
11
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
var PACKAGE_DATA = {
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "26.
|
|
14
|
+
packageVersion: "26.18.0",
|
|
15
15
|
componentName: 'linkUrl'
|
|
16
16
|
};
|
|
17
17
|
var Link = withLinkClickedEvent('a');
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const metadataBlockCss: import("@emotion/react").SerializedStyles;
|
|
2
2
|
export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const footerBlockCss: import("@emotion/react").SerializedStyles;
|
|
3
4
|
export declare const flexibleBlockCardStyle: import("@emotion/react").SerializedStyles;
|
|
@@ -182,6 +182,10 @@ export type AttachmentCount = {
|
|
|
182
182
|
*/
|
|
183
183
|
export type AuthorGroup = {
|
|
184
184
|
name: ElementName.AuthorGroup;
|
|
185
|
+
/**
|
|
186
|
+
* Shows a name prefix Created by in the Avatar tooltip.
|
|
187
|
+
*/
|
|
188
|
+
showNamePrefix?: boolean;
|
|
185
189
|
};
|
|
186
190
|
/**
|
|
187
191
|
* Represents the props available for an OwnedByGroup element.
|
|
@@ -189,6 +193,10 @@ export type AuthorGroup = {
|
|
|
189
193
|
*/
|
|
190
194
|
export type OwnedByGroup = {
|
|
191
195
|
name: ElementName.OwnedByGroup;
|
|
196
|
+
/**
|
|
197
|
+
* Shows a name prefix Owned by in the Avatar tooltip.
|
|
198
|
+
*/
|
|
199
|
+
showNamePrefix?: boolean;
|
|
192
200
|
};
|
|
193
201
|
/**
|
|
194
202
|
* Represents the props available for an AssignedToGroup element.
|
|
@@ -196,6 +204,10 @@ export type OwnedByGroup = {
|
|
|
196
204
|
*/
|
|
197
205
|
export type AssignedToGroup = {
|
|
198
206
|
name: ElementName.AssignedToGroup;
|
|
207
|
+
/**
|
|
208
|
+
* Shows a name prefix Assigned To in the Avatar tooltip.
|
|
209
|
+
*/
|
|
210
|
+
showNamePrefix?: boolean;
|
|
199
211
|
};
|
|
200
212
|
/**
|
|
201
213
|
* Represents the props available for an ChecklistProgress element.
|
|
@@ -18,4 +18,8 @@ export type AvatarGroupProps = ElementProps & {
|
|
|
18
18
|
* The maximum number of Avatars to show in the AvatarGroup
|
|
19
19
|
*/
|
|
20
20
|
maxCount?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Shows a name prefix in the Avatar tooltip (Created by, Assigned To, Owned by)
|
|
23
|
+
*/
|
|
24
|
+
showNamePrefix?: boolean;
|
|
21
25
|
};
|
|
@@ -5,8 +5,10 @@ import { SmartLinkSize } from '../../../constants';
|
|
|
5
5
|
import { MessageProps } from './types';
|
|
6
6
|
import { AnalyticsFacade } from '../../../state/analytics';
|
|
7
7
|
import { PreviewActionData } from '../../../state/flexible-ui-context/types';
|
|
8
|
+
import { IntlShape, MessageDescriptor } from 'react-intl-next';
|
|
8
9
|
export declare const sizeToButtonSpacing: Record<SmartLinkSize, Spacing>;
|
|
9
10
|
export declare const getFormattedMessage: (message?: MessageProps) => JSX.Element | undefined;
|
|
11
|
+
export declare const getFormattedMessageAsString: (intl: IntlShape, message: MessageDescriptor, context?: string) => string | null;
|
|
10
12
|
export declare const getIconSizeStyles: (width: string) => SerializedStyles;
|
|
11
13
|
export declare const getIconWidth: (size?: SmartLinkSize) => string;
|
|
12
14
|
export declare const getLinkLineHeight: (size: SmartLinkSize) => string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const metadataBlockCss: import("@emotion/react").SerializedStyles;
|
|
2
2
|
export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const footerBlockCss: import("@emotion/react").SerializedStyles;
|
|
3
4
|
export declare const flexibleBlockCardStyle: import("@emotion/react").SerializedStyles;
|
|
@@ -182,6 +182,10 @@ export type AttachmentCount = {
|
|
|
182
182
|
*/
|
|
183
183
|
export type AuthorGroup = {
|
|
184
184
|
name: ElementName.AuthorGroup;
|
|
185
|
+
/**
|
|
186
|
+
* Shows a name prefix Created by in the Avatar tooltip.
|
|
187
|
+
*/
|
|
188
|
+
showNamePrefix?: boolean;
|
|
185
189
|
};
|
|
186
190
|
/**
|
|
187
191
|
* Represents the props available for an OwnedByGroup element.
|
|
@@ -189,6 +193,10 @@ export type AuthorGroup = {
|
|
|
189
193
|
*/
|
|
190
194
|
export type OwnedByGroup = {
|
|
191
195
|
name: ElementName.OwnedByGroup;
|
|
196
|
+
/**
|
|
197
|
+
* Shows a name prefix Owned by in the Avatar tooltip.
|
|
198
|
+
*/
|
|
199
|
+
showNamePrefix?: boolean;
|
|
192
200
|
};
|
|
193
201
|
/**
|
|
194
202
|
* Represents the props available for an AssignedToGroup element.
|
|
@@ -196,6 +204,10 @@ export type OwnedByGroup = {
|
|
|
196
204
|
*/
|
|
197
205
|
export type AssignedToGroup = {
|
|
198
206
|
name: ElementName.AssignedToGroup;
|
|
207
|
+
/**
|
|
208
|
+
* Shows a name prefix Assigned To in the Avatar tooltip.
|
|
209
|
+
*/
|
|
210
|
+
showNamePrefix?: boolean;
|
|
199
211
|
};
|
|
200
212
|
/**
|
|
201
213
|
* Represents the props available for an ChecklistProgress element.
|
|
@@ -18,4 +18,8 @@ export type AvatarGroupProps = ElementProps & {
|
|
|
18
18
|
* The maximum number of Avatars to show in the AvatarGroup
|
|
19
19
|
*/
|
|
20
20
|
maxCount?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Shows a name prefix in the Avatar tooltip (Created by, Assigned To, Owned by)
|
|
23
|
+
*/
|
|
24
|
+
showNamePrefix?: boolean;
|
|
21
25
|
};
|
|
@@ -5,8 +5,10 @@ import { SmartLinkSize } from '../../../constants';
|
|
|
5
5
|
import { MessageProps } from './types';
|
|
6
6
|
import { AnalyticsFacade } from '../../../state/analytics';
|
|
7
7
|
import { PreviewActionData } from '../../../state/flexible-ui-context/types';
|
|
8
|
+
import { IntlShape, MessageDescriptor } from 'react-intl-next';
|
|
8
9
|
export declare const sizeToButtonSpacing: Record<SmartLinkSize, Spacing>;
|
|
9
10
|
export declare const getFormattedMessage: (message?: MessageProps) => JSX.Element | undefined;
|
|
11
|
+
export declare const getFormattedMessageAsString: (intl: IntlShape, message: MessageDescriptor, context?: string) => string | null;
|
|
10
12
|
export declare const getIconSizeStyles: (width: string) => SerializedStyles;
|
|
11
13
|
export declare const getIconWidth: (size?: SmartLinkSize) => string;
|
|
12
14
|
export declare const getLinkLineHeight: (size: SmartLinkSize) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.18.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/popup": "^1.9.0",
|
|
49
49
|
"@atlaskit/spinner": "^15.5.0",
|
|
50
50
|
"@atlaskit/theme": "^12.5.0",
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
51
|
+
"@atlaskit/tokens": "^1.17.0",
|
|
52
52
|
"@atlaskit/tooltip": "^17.8.0",
|
|
53
53
|
"@atlaskit/ufo": "^0.2.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
package/report.api.md
CHANGED
|
@@ -156,6 +156,7 @@ type AssignedTo = {
|
|
|
156
156
|
// @public
|
|
157
157
|
type AssignedToGroup = {
|
|
158
158
|
name: ElementName.AssignedToGroup;
|
|
159
|
+
showNamePrefix?: boolean;
|
|
159
160
|
};
|
|
160
161
|
|
|
161
162
|
// @public
|
|
@@ -166,6 +167,7 @@ type AttachmentCount = {
|
|
|
166
167
|
// @public
|
|
167
168
|
type AuthorGroup = {
|
|
168
169
|
name: ElementName.AuthorGroup;
|
|
170
|
+
showNamePrefix?: boolean;
|
|
169
171
|
};
|
|
170
172
|
|
|
171
173
|
// @public
|
|
@@ -738,6 +740,7 @@ type OwnedBy = {
|
|
|
738
740
|
// @public
|
|
739
741
|
type OwnedByGroup = {
|
|
740
742
|
name: ElementName.OwnedByGroup;
|
|
743
|
+
showNamePrefix?: boolean;
|
|
741
744
|
};
|
|
742
745
|
|
|
743
746
|
// @public
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -109,6 +109,7 @@ type AssignedTo = {
|
|
|
109
109
|
// @public
|
|
110
110
|
type AssignedToGroup = {
|
|
111
111
|
name: ElementName.AssignedToGroup;
|
|
112
|
+
showNamePrefix?: boolean;
|
|
112
113
|
};
|
|
113
114
|
|
|
114
115
|
// @public
|
|
@@ -119,6 +120,7 @@ type AttachmentCount = {
|
|
|
119
120
|
// @public
|
|
120
121
|
type AuthorGroup = {
|
|
121
122
|
name: ElementName.AuthorGroup;
|
|
123
|
+
showNamePrefix?: boolean;
|
|
122
124
|
};
|
|
123
125
|
|
|
124
126
|
// @public
|
|
@@ -590,6 +592,7 @@ type OwnedBy = {
|
|
|
590
592
|
// @public
|
|
591
593
|
type OwnedByGroup = {
|
|
592
594
|
name: ElementName.OwnedByGroup;
|
|
595
|
+
showNamePrefix?: boolean;
|
|
593
596
|
};
|
|
594
597
|
|
|
595
598
|
// @public
|